Loading deploy/crdb.sh +2 −0 Original line number Diff line number Diff line Loading @@ -387,6 +387,7 @@ if [ "$CRDB_DEPLOY_MODE" == "single" ]; then fi crdb_deploy_single sleep 3 if [ "$CRDB_DROP_DATABASE_IF_EXISTS" == "YES" ]; then crdb_drop_databases_single Loading @@ -397,6 +398,7 @@ elif [ "$CRDB_DEPLOY_MODE" == "cluster" ]; then fi crdb_deploy_cluster sleep 3 if [ "$CRDB_DROP_DATABASE_IF_EXISTS" == "YES" ]; then crdb_drop_databases_cluster Loading proto/context.proto +3 −0 Original line number Diff line number Diff line Loading @@ -565,6 +565,9 @@ message Location { oneof location { string region = 1; GPS_Position gps_position = 2; string interface=3; string circuit_pack=4; } } Loading src/common/DeviceTypes.py +1 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ class DeviceTypeEnum(Enum): PACKET_SWITCH = 'packet-switch' XR_CONSTELLATION = 'xr-constellation' QKD_NODE = 'qkd-node' OPEN_ROADM = 'openroadm' # ETSI TeraFlowSDN controller TERAFLOWSDN_CONTROLLER = 'teraflowsdn' src/common/tests/MockServicerImpl_Context.py +79 −3 Original line number Diff line number Diff line Loading @@ -21,9 +21,11 @@ from common.proto.context_pb2 import ( Device, DeviceEvent, DeviceFilter, DeviceId, DeviceIdList, DeviceList, Empty, EventTypeEnum, Link, LinkEvent, LinkId, LinkIdList, LinkList, OpticalLink, OpticalLinkList, Service, ServiceEvent, ServiceFilter, ServiceId, ServiceIdList, ServiceList, Slice, SliceEvent, SliceFilter, SliceId, SliceIdList, SliceList, Topology, TopologyDetails, TopologyEvent, TopologyId, TopologyIdList, TopologyList) Topology, TopologyDetails, TopologyEvent, TopologyId, TopologyIdList, TopologyList ) from common.proto.context_pb2_grpc import ContextServiceServicer from common.proto.policy_pb2 import PolicyRule, PolicyRuleId, PolicyRuleIdList, PolicyRuleList from common.tools.grpc.Tools import grpc_message_to_json, grpc_message_to_json_string Loading @@ -31,8 +33,10 @@ from common.tools.object_factory.Device import json_device_id from common.tools.object_factory.Link import json_link_id from .InMemoryObjectDatabase import InMemoryObjectDatabase from .MockMessageBroker import ( TOPIC_CONNECTION, TOPIC_CONTEXT, TOPIC_DEVICE, TOPIC_LINK, TOPIC_SERVICE, TOPIC_SLICE, TOPIC_TOPOLOGY, TOPIC_POLICY, MockMessageBroker, notify_event) TOPIC_CONNECTION, TOPIC_CONTEXT, TOPIC_DEVICE, TOPIC_LINK, TOPIC_SERVICE, TOPIC_SLICE, TOPIC_TOPOLOGY, TOPIC_POLICY, MockMessageBroker, notify_event ) LOGGER = logging.getLogger(__name__) Loading Loading @@ -579,6 +583,7 @@ class MockServicerImpl_Context(ContextServiceServicer): LOGGER.debug('[SelectService] reply={:s}'.format(grpc_message_to_json_string(reply))) return reply # ----- Connection ------------------------------------------------------------------------------------------------- def ListConnectionIds(self, request : ServiceId, context : grpc.ServicerContext) -> ConnectionIdList: Loading Loading @@ -628,6 +633,9 @@ class MockServicerImpl_Context(ContextServiceServicer): LOGGER.debug('[GetConnectionEvents] request={:s}'.format(grpc_message_to_json_string(request))) for message in self.msg_broker.consume({TOPIC_CONNECTION}): yield ConnectionEvent(**json.loads(message.content)) # ----- Policy Rule ------------------------------------------------------------------------------------------------ def ListPolicyRuleIds(self, request : Empty, context : grpc.ServicerContext): # pylint: disable=unused-argument LOGGER.debug('[ListPolicyRuleIds] request={:s}'.format(grpc_message_to_json_string(request))) reply = PolicyRuleIdList(policyRuleIdList=[ Loading Loading @@ -666,3 +674,71 @@ class MockServicerImpl_Context(ContextServiceServicer): reply = self._del(request, 'policy', policy_uuid, rule_id_field, TOPIC_CONTEXT, context) LOGGER.debug('[RemovePolicyRule] reply={:s}'.format(grpc_message_to_json_string(reply))) return reply # ----- Optical Link ----------------------------------------------------------------------------------------------- def GetOpticalLinkList(self, request : Empty, context : grpc.ServicerContext) -> OpticalLinkList: LOGGER.debug('[GetOpticalLinkList] request={:s}'.format(grpc_message_to_json_string(request))) reply = OpticalLinkList(optical_links=self.obj_db.get_entries('optical_link')) LOGGER.debug('[GetOpticalLinkList] reply={:s}'.format(grpc_message_to_json_string(reply))) return reply def GetOpticalLink(self, request : LinkId, context : grpc.ServicerContext) -> OpticalLink: LOGGER.debug('[GetOpticalLink] request={:s}'.format(grpc_message_to_json_string(request))) reply = self.obj_db.get_entry('optical_link', request.link_uuid.uuid, context) LOGGER.debug('[GetOpticalLink] reply={:s}'.format(grpc_message_to_json_string(reply))) return reply def SetOpticalLink(self, request : OpticalLink, context : grpc.ServicerContext) -> Empty: LOGGER.debug('[SetOpticalLink] request={:s}'.format(grpc_message_to_json_string(request))) link_uuid = request.link_id.link_uuid.uuid reply, link = self._set(request, 'optical_link', link_uuid, 'link_id', TOPIC_LINK) context_topology_uuids : Set[Tuple[str, str]] = set() context_topology_uuids.add((DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME)) for endpoint_id in link.link_endpoint_ids: endpoint_context_uuid = endpoint_id.topology_id.context_id.context_uuid.uuid if len(endpoint_context_uuid) == 0: endpoint_context_uuid = DEFAULT_CONTEXT_NAME endpoint_topology_uuid = endpoint_id.topology_id.topology_uuid.uuid if len(endpoint_topology_uuid) == 0: endpoint_topology_uuid = DEFAULT_TOPOLOGY_NAME context_topology_uuids.add((endpoint_context_uuid, endpoint_topology_uuid)) for context_uuid,topology_uuid in context_topology_uuids: container_name = 'topology[{:s}]'.format(str(context_uuid)) topology = self.obj_db.get_entry(container_name, topology_uuid, context) for _optical_link_id in topology.optical_link_ids: if _optical_link_id.link_uuid.uuid == link_uuid: break else: # link not found, add it topology.optical_link_ids.add().link_uuid.uuid = link_uuid reply = Empty() LOGGER.debug('[SetOpticalLink] reply={:s}'.format(grpc_message_to_json_string(reply))) return reply def DeleteOpticalLink(self, request : LinkId, context : grpc.ServicerContext) -> Empty: LOGGER.debug('[DeleteOpticalLink] request={:s}'.format(grpc_message_to_json_string(request))) link_uuid = request.link_uuid.uuid optical_link = self.obj_db.get_entry('optical_link', link_uuid, context) reply = self._del(request, 'optical_link', link_uuid, 'link_id', TOPIC_LINK, context) context_topology_uuids : Set[Tuple[str, str]] = set() context_topology_uuids.add((DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME)) for endpoint_id in optical_link.link_endpoint_ids: endpoint_context_uuid = endpoint_id.topology_id.context_id.context_uuid.uuid if len(endpoint_context_uuid) == 0: endpoint_context_uuid = DEFAULT_CONTEXT_NAME endpoint_topology_uuid = endpoint_id.topology_id.topology_uuid.uuid if len(endpoint_topology_uuid) == 0: endpoint_topology_uuid = DEFAULT_TOPOLOGY_NAME context_topology_uuids.add((endpoint_context_uuid, endpoint_topology_uuid)) for context_uuid,topology_uuid in context_topology_uuids: container_name = 'topology[{:s}]'.format(str(context_uuid)) topology = self.obj_db.get_entry(container_name, topology_uuid, context) for optical_link_id in topology.optical_link_ids: if optical_link_id.link_uuid.uuid == link_uuid: topology.optical_link_ids.remove(optical_link_id) break LOGGER.debug('[DeleteOpticalLink] reply={:s}'.format(grpc_message_to_json_string(reply))) return reply src/common/tools/descriptor/Loader.py +29 −13 Original line number Diff line number Diff line Loading @@ -133,11 +133,11 @@ class DescriptorLoader: self.__topologies = self.__descriptors.get('topologies' , []) self.__devices = self.__descriptors.get('devices' , []) self.__links = self.__descriptors.get('links' , []) self.__optical_links = self.__descriptors.get('optical_links',[]) self.__services = self.__descriptors.get('services' , []) self.__slices = self.__descriptors.get('slices' , []) self.__ietf_slices = self.__descriptors.get('ietf-network-slice-service:network-slice-services', {}) self.__connections = self.__descriptors.get('connections', []) self.__optical_links = self.__descriptors.get('optical_links',[]) if len(self.__ietf_slices) > 0: for slice_service in self.__ietf_slices["slice-service"]: Loading Loading @@ -249,6 +249,12 @@ class DescriptorLoader: @property def num_links(self) -> int: return len(self.__links) @property def optical_links(self) -> List[Dict]: return self.__optical_links @property def num_optical_links(self) -> int: return len(self.__optical_links) @property def services(self) -> Dict[str, List[Dict]]: _services = {} Loading Loading @@ -287,9 +293,6 @@ class DescriptorLoader: @property def num_connections(self) -> int: return len(self.__connections) @property def optical_links(self) -> List[Dict]: return self.__optical_links def process(self) -> TypeResults: # Format CustomConfigRules in Devices, Services and Slices provided in JSON format self.__devices = [format_device_custom_config_rules (device ) for device in self.__devices ] Loading Loading @@ -319,6 +322,7 @@ class DescriptorLoader: self._process_descr('controller', 'add', self.__ctx_cli.SetDevice, Device, controllers ) self._process_descr('device', 'add', self.__ctx_cli.SetDevice, Device, network_devices ) self._process_descr('link', 'add', self.__ctx_cli.SetLink, Link, self.__links ) self._process_descr('link', 'add', self.__ctx_cli.SetOpticalLink, OpticalLink, self.__optical_links ) self._process_descr('service', 'add', self.__ctx_cli.SetService, Service, self.__services ) self._process_descr('slice', 'add', self.__ctx_cli.SetSlice, Slice, self.__slices ) self._process_descr('connection', 'add', self.__ctx_cli.SetConnection, Connection, self.__connections ) Loading Loading @@ -358,11 +362,11 @@ class DescriptorLoader: self._process_descr('device', 'add', self.__dev_cli.AddDevice, Device, network_devices_add ) self._process_descr('device', 'config', self.__dev_cli.ConfigureDevice, Device, self.__devices_config) self._process_descr('link', 'add', self.__ctx_cli.SetLink, Link, self.__links ) self._process_descr('link', 'add', self.__ctx_cli.SetOpticalLink, OpticalLink, self.__optical_links ) self._process_descr('service', 'add', self.__svc_cli.CreateService, Service, self.__services_add ) self._process_descr('service', 'update', self.__svc_cli.UpdateService, Service, self.__services ) self._process_descr('slice', 'add', self.__slc_cli.CreateSlice, Slice, self.__slices_add ) self._process_descr('slice', 'update', self.__slc_cli.UpdateSlice, Slice, self.__slices ) self._process_descr('link', 'add', self.__ctx_cli.SetOpticalLink, OpticalLink, self.__optical_links ) # By default the Context component automatically assigns devices and links to topologies based on their # endpoints, and assigns topologies, services, and slices to contexts based on their identifiers. Loading Loading @@ -420,6 +424,9 @@ class DescriptorLoader: response = self.__ctx_cli.ListLinks(Empty()) assert len(response.links) == self.num_links response = self.__ctx_cli.GetOpticalLinkList(Empty()) assert len(response.optical_links) == self.num_optical_links for context_uuid, num_services in self.num_services.items(): response = self.__ctx_cli.ListServices(ContextId(**json_context_id(context_uuid))) assert len(response.services) == num_services Loading @@ -440,6 +447,9 @@ class DescriptorLoader: for service in service_list: self.__ctx_cli.RemoveService(ServiceId(**service['service_id'])) for optical_link in self.optical_links: self.__ctx_cli.DeleteOpticalLink(LinkId(**optical_link['link_id'])) for link in self.links: self.__ctx_cli.RemoveLink(LinkId(**link['link_id'])) Loading Loading @@ -470,6 +480,9 @@ class DescriptorLoader: for service in service_list: self.__svc_cli.DeleteService(ServiceId(**service['service_id'])) for optical_link in self.optical_links: self.__ctx_cli.DeleteOpticalLink(LinkId(**optical_link['link_id'])) for link in self.links: self.__ctx_cli.RemoveLink(LinkId(**link['link_id'])) Loading Loading @@ -524,3 +537,6 @@ def validate_empty_scenario(context_client : ContextClient) -> None: response = context_client.ListLinks(Empty()) assert len(response.links) == 0 response = context_client.GetOpticalLinkList(Empty()) assert len(response.optical_links) == 0 Loading
deploy/crdb.sh +2 −0 Original line number Diff line number Diff line Loading @@ -387,6 +387,7 @@ if [ "$CRDB_DEPLOY_MODE" == "single" ]; then fi crdb_deploy_single sleep 3 if [ "$CRDB_DROP_DATABASE_IF_EXISTS" == "YES" ]; then crdb_drop_databases_single Loading @@ -397,6 +398,7 @@ elif [ "$CRDB_DEPLOY_MODE" == "cluster" ]; then fi crdb_deploy_cluster sleep 3 if [ "$CRDB_DROP_DATABASE_IF_EXISTS" == "YES" ]; then crdb_drop_databases_cluster Loading
proto/context.proto +3 −0 Original line number Diff line number Diff line Loading @@ -565,6 +565,9 @@ message Location { oneof location { string region = 1; GPS_Position gps_position = 2; string interface=3; string circuit_pack=4; } } Loading
src/common/DeviceTypes.py +1 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ class DeviceTypeEnum(Enum): PACKET_SWITCH = 'packet-switch' XR_CONSTELLATION = 'xr-constellation' QKD_NODE = 'qkd-node' OPEN_ROADM = 'openroadm' # ETSI TeraFlowSDN controller TERAFLOWSDN_CONTROLLER = 'teraflowsdn'
src/common/tests/MockServicerImpl_Context.py +79 −3 Original line number Diff line number Diff line Loading @@ -21,9 +21,11 @@ from common.proto.context_pb2 import ( Device, DeviceEvent, DeviceFilter, DeviceId, DeviceIdList, DeviceList, Empty, EventTypeEnum, Link, LinkEvent, LinkId, LinkIdList, LinkList, OpticalLink, OpticalLinkList, Service, ServiceEvent, ServiceFilter, ServiceId, ServiceIdList, ServiceList, Slice, SliceEvent, SliceFilter, SliceId, SliceIdList, SliceList, Topology, TopologyDetails, TopologyEvent, TopologyId, TopologyIdList, TopologyList) Topology, TopologyDetails, TopologyEvent, TopologyId, TopologyIdList, TopologyList ) from common.proto.context_pb2_grpc import ContextServiceServicer from common.proto.policy_pb2 import PolicyRule, PolicyRuleId, PolicyRuleIdList, PolicyRuleList from common.tools.grpc.Tools import grpc_message_to_json, grpc_message_to_json_string Loading @@ -31,8 +33,10 @@ from common.tools.object_factory.Device import json_device_id from common.tools.object_factory.Link import json_link_id from .InMemoryObjectDatabase import InMemoryObjectDatabase from .MockMessageBroker import ( TOPIC_CONNECTION, TOPIC_CONTEXT, TOPIC_DEVICE, TOPIC_LINK, TOPIC_SERVICE, TOPIC_SLICE, TOPIC_TOPOLOGY, TOPIC_POLICY, MockMessageBroker, notify_event) TOPIC_CONNECTION, TOPIC_CONTEXT, TOPIC_DEVICE, TOPIC_LINK, TOPIC_SERVICE, TOPIC_SLICE, TOPIC_TOPOLOGY, TOPIC_POLICY, MockMessageBroker, notify_event ) LOGGER = logging.getLogger(__name__) Loading Loading @@ -579,6 +583,7 @@ class MockServicerImpl_Context(ContextServiceServicer): LOGGER.debug('[SelectService] reply={:s}'.format(grpc_message_to_json_string(reply))) return reply # ----- Connection ------------------------------------------------------------------------------------------------- def ListConnectionIds(self, request : ServiceId, context : grpc.ServicerContext) -> ConnectionIdList: Loading Loading @@ -628,6 +633,9 @@ class MockServicerImpl_Context(ContextServiceServicer): LOGGER.debug('[GetConnectionEvents] request={:s}'.format(grpc_message_to_json_string(request))) for message in self.msg_broker.consume({TOPIC_CONNECTION}): yield ConnectionEvent(**json.loads(message.content)) # ----- Policy Rule ------------------------------------------------------------------------------------------------ def ListPolicyRuleIds(self, request : Empty, context : grpc.ServicerContext): # pylint: disable=unused-argument LOGGER.debug('[ListPolicyRuleIds] request={:s}'.format(grpc_message_to_json_string(request))) reply = PolicyRuleIdList(policyRuleIdList=[ Loading Loading @@ -666,3 +674,71 @@ class MockServicerImpl_Context(ContextServiceServicer): reply = self._del(request, 'policy', policy_uuid, rule_id_field, TOPIC_CONTEXT, context) LOGGER.debug('[RemovePolicyRule] reply={:s}'.format(grpc_message_to_json_string(reply))) return reply # ----- Optical Link ----------------------------------------------------------------------------------------------- def GetOpticalLinkList(self, request : Empty, context : grpc.ServicerContext) -> OpticalLinkList: LOGGER.debug('[GetOpticalLinkList] request={:s}'.format(grpc_message_to_json_string(request))) reply = OpticalLinkList(optical_links=self.obj_db.get_entries('optical_link')) LOGGER.debug('[GetOpticalLinkList] reply={:s}'.format(grpc_message_to_json_string(reply))) return reply def GetOpticalLink(self, request : LinkId, context : grpc.ServicerContext) -> OpticalLink: LOGGER.debug('[GetOpticalLink] request={:s}'.format(grpc_message_to_json_string(request))) reply = self.obj_db.get_entry('optical_link', request.link_uuid.uuid, context) LOGGER.debug('[GetOpticalLink] reply={:s}'.format(grpc_message_to_json_string(reply))) return reply def SetOpticalLink(self, request : OpticalLink, context : grpc.ServicerContext) -> Empty: LOGGER.debug('[SetOpticalLink] request={:s}'.format(grpc_message_to_json_string(request))) link_uuid = request.link_id.link_uuid.uuid reply, link = self._set(request, 'optical_link', link_uuid, 'link_id', TOPIC_LINK) context_topology_uuids : Set[Tuple[str, str]] = set() context_topology_uuids.add((DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME)) for endpoint_id in link.link_endpoint_ids: endpoint_context_uuid = endpoint_id.topology_id.context_id.context_uuid.uuid if len(endpoint_context_uuid) == 0: endpoint_context_uuid = DEFAULT_CONTEXT_NAME endpoint_topology_uuid = endpoint_id.topology_id.topology_uuid.uuid if len(endpoint_topology_uuid) == 0: endpoint_topology_uuid = DEFAULT_TOPOLOGY_NAME context_topology_uuids.add((endpoint_context_uuid, endpoint_topology_uuid)) for context_uuid,topology_uuid in context_topology_uuids: container_name = 'topology[{:s}]'.format(str(context_uuid)) topology = self.obj_db.get_entry(container_name, topology_uuid, context) for _optical_link_id in topology.optical_link_ids: if _optical_link_id.link_uuid.uuid == link_uuid: break else: # link not found, add it topology.optical_link_ids.add().link_uuid.uuid = link_uuid reply = Empty() LOGGER.debug('[SetOpticalLink] reply={:s}'.format(grpc_message_to_json_string(reply))) return reply def DeleteOpticalLink(self, request : LinkId, context : grpc.ServicerContext) -> Empty: LOGGER.debug('[DeleteOpticalLink] request={:s}'.format(grpc_message_to_json_string(request))) link_uuid = request.link_uuid.uuid optical_link = self.obj_db.get_entry('optical_link', link_uuid, context) reply = self._del(request, 'optical_link', link_uuid, 'link_id', TOPIC_LINK, context) context_topology_uuids : Set[Tuple[str, str]] = set() context_topology_uuids.add((DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME)) for endpoint_id in optical_link.link_endpoint_ids: endpoint_context_uuid = endpoint_id.topology_id.context_id.context_uuid.uuid if len(endpoint_context_uuid) == 0: endpoint_context_uuid = DEFAULT_CONTEXT_NAME endpoint_topology_uuid = endpoint_id.topology_id.topology_uuid.uuid if len(endpoint_topology_uuid) == 0: endpoint_topology_uuid = DEFAULT_TOPOLOGY_NAME context_topology_uuids.add((endpoint_context_uuid, endpoint_topology_uuid)) for context_uuid,topology_uuid in context_topology_uuids: container_name = 'topology[{:s}]'.format(str(context_uuid)) topology = self.obj_db.get_entry(container_name, topology_uuid, context) for optical_link_id in topology.optical_link_ids: if optical_link_id.link_uuid.uuid == link_uuid: topology.optical_link_ids.remove(optical_link_id) break LOGGER.debug('[DeleteOpticalLink] reply={:s}'.format(grpc_message_to_json_string(reply))) return reply
src/common/tools/descriptor/Loader.py +29 −13 Original line number Diff line number Diff line Loading @@ -133,11 +133,11 @@ class DescriptorLoader: self.__topologies = self.__descriptors.get('topologies' , []) self.__devices = self.__descriptors.get('devices' , []) self.__links = self.__descriptors.get('links' , []) self.__optical_links = self.__descriptors.get('optical_links',[]) self.__services = self.__descriptors.get('services' , []) self.__slices = self.__descriptors.get('slices' , []) self.__ietf_slices = self.__descriptors.get('ietf-network-slice-service:network-slice-services', {}) self.__connections = self.__descriptors.get('connections', []) self.__optical_links = self.__descriptors.get('optical_links',[]) if len(self.__ietf_slices) > 0: for slice_service in self.__ietf_slices["slice-service"]: Loading Loading @@ -249,6 +249,12 @@ class DescriptorLoader: @property def num_links(self) -> int: return len(self.__links) @property def optical_links(self) -> List[Dict]: return self.__optical_links @property def num_optical_links(self) -> int: return len(self.__optical_links) @property def services(self) -> Dict[str, List[Dict]]: _services = {} Loading Loading @@ -287,9 +293,6 @@ class DescriptorLoader: @property def num_connections(self) -> int: return len(self.__connections) @property def optical_links(self) -> List[Dict]: return self.__optical_links def process(self) -> TypeResults: # Format CustomConfigRules in Devices, Services and Slices provided in JSON format self.__devices = [format_device_custom_config_rules (device ) for device in self.__devices ] Loading Loading @@ -319,6 +322,7 @@ class DescriptorLoader: self._process_descr('controller', 'add', self.__ctx_cli.SetDevice, Device, controllers ) self._process_descr('device', 'add', self.__ctx_cli.SetDevice, Device, network_devices ) self._process_descr('link', 'add', self.__ctx_cli.SetLink, Link, self.__links ) self._process_descr('link', 'add', self.__ctx_cli.SetOpticalLink, OpticalLink, self.__optical_links ) self._process_descr('service', 'add', self.__ctx_cli.SetService, Service, self.__services ) self._process_descr('slice', 'add', self.__ctx_cli.SetSlice, Slice, self.__slices ) self._process_descr('connection', 'add', self.__ctx_cli.SetConnection, Connection, self.__connections ) Loading Loading @@ -358,11 +362,11 @@ class DescriptorLoader: self._process_descr('device', 'add', self.__dev_cli.AddDevice, Device, network_devices_add ) self._process_descr('device', 'config', self.__dev_cli.ConfigureDevice, Device, self.__devices_config) self._process_descr('link', 'add', self.__ctx_cli.SetLink, Link, self.__links ) self._process_descr('link', 'add', self.__ctx_cli.SetOpticalLink, OpticalLink, self.__optical_links ) self._process_descr('service', 'add', self.__svc_cli.CreateService, Service, self.__services_add ) self._process_descr('service', 'update', self.__svc_cli.UpdateService, Service, self.__services ) self._process_descr('slice', 'add', self.__slc_cli.CreateSlice, Slice, self.__slices_add ) self._process_descr('slice', 'update', self.__slc_cli.UpdateSlice, Slice, self.__slices ) self._process_descr('link', 'add', self.__ctx_cli.SetOpticalLink, OpticalLink, self.__optical_links ) # By default the Context component automatically assigns devices and links to topologies based on their # endpoints, and assigns topologies, services, and slices to contexts based on their identifiers. Loading Loading @@ -420,6 +424,9 @@ class DescriptorLoader: response = self.__ctx_cli.ListLinks(Empty()) assert len(response.links) == self.num_links response = self.__ctx_cli.GetOpticalLinkList(Empty()) assert len(response.optical_links) == self.num_optical_links for context_uuid, num_services in self.num_services.items(): response = self.__ctx_cli.ListServices(ContextId(**json_context_id(context_uuid))) assert len(response.services) == num_services Loading @@ -440,6 +447,9 @@ class DescriptorLoader: for service in service_list: self.__ctx_cli.RemoveService(ServiceId(**service['service_id'])) for optical_link in self.optical_links: self.__ctx_cli.DeleteOpticalLink(LinkId(**optical_link['link_id'])) for link in self.links: self.__ctx_cli.RemoveLink(LinkId(**link['link_id'])) Loading Loading @@ -470,6 +480,9 @@ class DescriptorLoader: for service in service_list: self.__svc_cli.DeleteService(ServiceId(**service['service_id'])) for optical_link in self.optical_links: self.__ctx_cli.DeleteOpticalLink(LinkId(**optical_link['link_id'])) for link in self.links: self.__ctx_cli.RemoveLink(LinkId(**link['link_id'])) Loading Loading @@ -524,3 +537,6 @@ def validate_empty_scenario(context_client : ContextClient) -> None: response = context_client.ListLinks(Empty()) assert len(response.links) == 0 response = context_client.GetOpticalLinkList(Empty()) assert len(response.optical_links) == 0