Example #1
0
    def _get_node_from_remote(self, id):

        nodeInCtxt = gRPC.NodeInContext(context=self._server_ctx,
                                        node=gRPC.Node(id=id))
        gRPCNode = self._ctx.rpc.getNode(nodeInCtxt, _TIMEOUT_SECONDS)

        self._ids.append(id)
        self._nodes[id] = Node.deserialize(gRPCNode)
Example #2
0
    def _get_node_from_remote(self, id):

        nodeInCtxt = gRPC.NodeInContext(context=self._server_ctx,
                                        node=gRPC.Node(id=id))
        gRPCNode = self._ctx.rpc.getNode(nodeInCtxt, _TIMEOUT_SECONDS)

        self._ids.append(id)
        self._nodes[id] = Node.deserialize(gRPCNode)
Example #3
0
    def _update_node_from_remote(self, id):

        nodeInCtxt = gRPC.NodeInContext(context=self._server_ctx,
                                        node=gRPC.Node(id=id))
        gRPCNode = self._ctx.rpc.getNode(nodeInCtxt, _TIMEOUT_SECONDS)

        updated_node = Node.deserialize(gRPCNode)
        self._nodes[id] = updated_node

        try:
            self._updated_ids.remove(id)
        except ValueError as ve:
            raise ve
Example #4
0
    def _update_node_from_remote(self, id):

        nodeInCtxt = gRPC.NodeInContext(context=self._server_ctx,
                                        node=gRPC.Node(id=id))
        gRPCNode = self._ctx.rpc.getNode(nodeInCtxt, _TIMEOUT_SECONDS)

        updated_node = Node.deserialize(gRPCNode)
        self._nodes[id] = updated_node

        try:
            self._updated_ids.remove(id)
        except ValueError as ve:
            raise ve
Example #5
0
    def test_nodes(self):

        n = Node()

        self.assertIsNotNone(n.id)

        n.name = "test"
        n.type = MESH

        serialized = n.serialize()

        n2 = Node.deserialize(serialized)

        self.assertEqual(n, n2)
Example #6
0
    def _get_node_from_remote(self, id):
        assert (id is not None)
        nodeInCtxt = gRPC.NodeInContext(context=self._server_ctx,
                                        node=gRPC.Node(id=id))
        try:
            gRPCNode = self._ctx.rpc.getNode(nodeInCtxt, _TIMEOUT_SECONDS)
        except AbortionError as e:
            raise IndexError(e.details)

        # is it a new node, or rather an update to an existing one?
        if id not in self._ids:
            self._ids.append(id)

        self._nodes[id] = Node.deserialize(gRPCNode)
Example #7
0
    def test_nodes(self):

        n = Node()

        self.assertIsNotNone(n.id)

        n.name = "test"
        n.type = MESH

        serialized = n.serialize(underworlds.underworlds_pb2.Node)

        n2 = Node.deserialize(serialized)

        self.assertEqual(n, n2)
    def _get_node_from_remote(self, id):

        nodeInCtxt = gRPC.NodeInContext(context=self._server_ctx,
                                        node=gRPC.Node(id=id))
        try:
            gRPCNode = self._ctx.rpc.getNode(nodeInCtxt, _TIMEOUT_SECONDS)
        except AbortionError as e:
            raise ValueError(e.details)

        # is it a new node, or rather an update to an existing one?
        if id not in self._ids:
            self._ids.append(id)

        self._nodes[id] = Node.deserialize(gRPCNode)