def get_node(self, session_id: int, node_id: int) -> core_pb2.GetNodeResponse: """ Get node details. :param session_id: session id :param node_id: node id :return: response with node details :raises grpc.RpcError: when session or node doesn't exist """ request = core_pb2.GetNodeRequest(session_id=session_id, node_id=node_id) return self.stub.GetNode(request)
def get_node( self, session_id: int, node_id: int ) -> Tuple[wrappers.Node, List[wrappers.Interface], List[wrappers.Link]]: """ Get node details. :param session_id: session id :param node_id: node id :return: tuple of node and its interfaces :raises grpc.RpcError: when session or node doesn't exist """ request = core_pb2.GetNodeRequest(session_id=session_id, node_id=node_id) response = self.stub.GetNode(request) node = wrappers.Node.from_proto(response.node) ifaces = [] for iface_proto in response.ifaces: iface = wrappers.Interface.from_proto(iface_proto) ifaces.append(iface) links = [] for link_proto in response.links: link = wrappers.Link.from_proto(link_proto) links.append(link) return node, ifaces, links