Loading src/common/tests/MockServicerImpl_Context.py +17 −1 Original line number Original line Diff line number Diff line Loading @@ -22,7 +22,7 @@ from common.proto.context_pb2 import ( Link, LinkEvent, LinkId, LinkIdList, LinkList, Link, LinkEvent, LinkId, LinkIdList, LinkList, Service, ServiceEvent, ServiceFilter, ServiceId, ServiceIdList, ServiceList, Service, ServiceEvent, ServiceFilter, ServiceId, ServiceIdList, ServiceList, Slice, SliceEvent, SliceFilter, SliceId, SliceIdList, SliceList, Slice, SliceEvent, SliceFilter, SliceId, SliceIdList, SliceList, Topology, TopologyEvent, TopologyId, TopologyIdList, TopologyList) Topology, TopologyDetails, TopologyEvent, TopologyId, TopologyIdList, TopologyList) from common.proto.context_pb2_grpc import ContextServiceServicer from common.proto.context_pb2_grpc import ContextServiceServicer from common.tests.MockMessageBroker import ( from common.tests.MockMessageBroker import ( TOPIC_CONNECTION, TOPIC_CONTEXT, TOPIC_DEVICE, TOPIC_LINK, TOPIC_SERVICE, TOPIC_SLICE, TOPIC_TOPOLOGY, TOPIC_CONNECTION, TOPIC_CONTEXT, TOPIC_DEVICE, TOPIC_LINK, TOPIC_SERVICE, TOPIC_SLICE, TOPIC_TOPOLOGY, Loading Loading @@ -162,6 +162,22 @@ class MockServicerImpl_Context(ContextServiceServicer): LOGGER.info('[GetTopology] reply={:s}'.format(grpc_message_to_json_string(reply))) LOGGER.info('[GetTopology] reply={:s}'.format(grpc_message_to_json_string(reply))) return reply return reply def GetTopologyDetails(self, request : TopologyId, context : grpc.ServicerContext) -> TopologyDetails: LOGGER.info('[GetTopologyDetails] request={:s}'.format(grpc_message_to_json_string(request))) container_name = 'topology[{:s}]'.format(str(request.context_id.context_uuid.uuid)) reply = get_entry(context, self.database, container_name, request.topology_uuid.uuid) topology_details = TopologyDetails() topology_details.topology_id.CopyFrom(reply.topology_id) topology_details.name = reply.name for device_id in reply.device_ids: device = get_entry(context, self.database, 'device', device_id.device_uuid.uuid) topology_details.devices.append(device) for link_id in reply.link_ids: link = get_entry(context, self.database, 'link', link_id.link_uuid.uuid) topology_details.links.append(link) LOGGER.info('[GetTopologyDetails] reply={:s}'.format(grpc_message_to_json_string(reply))) return reply def SetTopology(self, request: Topology, context : grpc.ServicerContext) -> TopologyId: def SetTopology(self, request: Topology, context : grpc.ServicerContext) -> TopologyId: LOGGER.info('[SetTopology] request={:s}'.format(grpc_message_to_json_string(request))) LOGGER.info('[SetTopology] request={:s}'.format(grpc_message_to_json_string(request))) container_name = 'topology[{:s}]'.format(str(request.topology_id.context_id.context_uuid.uuid)) container_name = 'topology[{:s}]'.format(str(request.topology_id.context_id.context_uuid.uuid)) Loading Loading
src/common/tests/MockServicerImpl_Context.py +17 −1 Original line number Original line Diff line number Diff line Loading @@ -22,7 +22,7 @@ from common.proto.context_pb2 import ( Link, LinkEvent, LinkId, LinkIdList, LinkList, Link, LinkEvent, LinkId, LinkIdList, LinkList, Service, ServiceEvent, ServiceFilter, ServiceId, ServiceIdList, ServiceList, Service, ServiceEvent, ServiceFilter, ServiceId, ServiceIdList, ServiceList, Slice, SliceEvent, SliceFilter, SliceId, SliceIdList, SliceList, Slice, SliceEvent, SliceFilter, SliceId, SliceIdList, SliceList, Topology, TopologyEvent, TopologyId, TopologyIdList, TopologyList) Topology, TopologyDetails, TopologyEvent, TopologyId, TopologyIdList, TopologyList) from common.proto.context_pb2_grpc import ContextServiceServicer from common.proto.context_pb2_grpc import ContextServiceServicer from common.tests.MockMessageBroker import ( from common.tests.MockMessageBroker import ( TOPIC_CONNECTION, TOPIC_CONTEXT, TOPIC_DEVICE, TOPIC_LINK, TOPIC_SERVICE, TOPIC_SLICE, TOPIC_TOPOLOGY, TOPIC_CONNECTION, TOPIC_CONTEXT, TOPIC_DEVICE, TOPIC_LINK, TOPIC_SERVICE, TOPIC_SLICE, TOPIC_TOPOLOGY, Loading Loading @@ -162,6 +162,22 @@ class MockServicerImpl_Context(ContextServiceServicer): LOGGER.info('[GetTopology] reply={:s}'.format(grpc_message_to_json_string(reply))) LOGGER.info('[GetTopology] reply={:s}'.format(grpc_message_to_json_string(reply))) return reply return reply def GetTopologyDetails(self, request : TopologyId, context : grpc.ServicerContext) -> TopologyDetails: LOGGER.info('[GetTopologyDetails] request={:s}'.format(grpc_message_to_json_string(request))) container_name = 'topology[{:s}]'.format(str(request.context_id.context_uuid.uuid)) reply = get_entry(context, self.database, container_name, request.topology_uuid.uuid) topology_details = TopologyDetails() topology_details.topology_id.CopyFrom(reply.topology_id) topology_details.name = reply.name for device_id in reply.device_ids: device = get_entry(context, self.database, 'device', device_id.device_uuid.uuid) topology_details.devices.append(device) for link_id in reply.link_ids: link = get_entry(context, self.database, 'link', link_id.link_uuid.uuid) topology_details.links.append(link) LOGGER.info('[GetTopologyDetails] reply={:s}'.format(grpc_message_to_json_string(reply))) return reply def SetTopology(self, request: Topology, context : grpc.ServicerContext) -> TopologyId: def SetTopology(self, request: Topology, context : grpc.ServicerContext) -> TopologyId: LOGGER.info('[SetTopology] request={:s}'.format(grpc_message_to_json_string(request))) LOGGER.info('[SetTopology] request={:s}'.format(grpc_message_to_json_string(request))) container_name = 'topology[{:s}]'.format(str(request.topology_id.context_id.context_uuid.uuid)) container_name = 'topology[{:s}]'.format(str(request.topology_id.context_id.context_uuid.uuid)) Loading