Loading src/tests/ofc24/Dockerfile +0 −5 Original line number Original line Diff line number Diff line Loading @@ -70,10 +70,6 @@ COPY src/context/__init__.py context/__init__.py COPY src/context/client/. context/client/ COPY src/context/client/. context/client/ COPY src/device/__init__.py device/__init__.py COPY src/device/__init__.py device/__init__.py COPY src/device/client/. device/client/ COPY src/device/client/. device/client/ #COPY src/monitoring/__init__.py monitoring/__init__.py #COPY src/monitoring/client/. monitoring/client/ #COPY src/monitoring/__init__.py monitoring/__init__.py #COPY src/monitoring/client/. monitoring/client/ COPY src/e2e_orchestrator/__init__.py e2e_orchestrator/__init__.py COPY src/e2e_orchestrator/__init__.py e2e_orchestrator/__init__.py COPY src/e2e_orchestrator/client/. e2e_orchestrator/client/ COPY src/e2e_orchestrator/client/. e2e_orchestrator/client/ COPY src/service/__init__.py service/__init__.py COPY src/service/__init__.py service/__init__.py Loading @@ -86,7 +82,6 @@ COPY src/tests/ofc24/descriptors/topology.json ./tests/ofc24/descriptors/topolog COPY src/tests/ofc24/descriptors/service-unidir.json ./tests/ofc24/descriptors/service-unidir.json COPY src/tests/ofc24/descriptors/service-unidir.json ./tests/ofc24/descriptors/service-unidir.json COPY src/tests/ofc24/descriptors/service-bidir.json ./tests/ofc24/descriptors/service-bidir.json COPY src/tests/ofc24/descriptors/service-bidir.json ./tests/ofc24/descriptors/service-bidir.json COPY src/tests/ofc24/tests/. ./tests/ofc24/tests/ COPY src/tests/ofc24/tests/. ./tests/ofc24/tests/ COPY src/tests/tools/. ./tests/tools/ RUN tee ./run_tests.sh <<EOF RUN tee ./run_tests.sh <<EOF #!/bin/bash #!/bin/bash Loading src/tests/ofc24/tests/test_functional_create_service_bidir.py +29 −25 Original line number Original line Diff line number Diff line Loading @@ -15,14 +15,13 @@ import logging, os import logging, os from common.Constants import DEFAULT_CONTEXT_NAME from common.Constants import DEFAULT_CONTEXT_NAME from common.proto.context_pb2 import ContextId, ServiceTypeEnum from common.proto.context_pb2 import ContextId, ServiceTypeEnum from common.tools.descriptor.Loader import DescriptorLoader from common.tools.descriptor.Loader import DescriptorLoader, check_descriptor_load_results from common.tools.grpc.Tools import grpc_message_to_json_string from common.tools.grpc.Tools import grpc_message_to_json_string from common.tools.object_factory.Context import json_context_id from common.tools.object_factory.Context import json_context_id from context.client.ContextClient import ContextClient from context.client.ContextClient import ContextClient from tests.Fixtures import context_client, monitoring_client # pylint: disable=unused-import from device.client.DeviceClient import DeviceClient from tests.tools.mock_osm.MockOSM import MockOSM from service.client.ServiceClient import ServiceClient from .Fixtures import osm_wim # pylint: disable=unused-import from tests.Fixtures import context_client, device_client, service_client # pylint: disable=unused-import from .Objects import WIM_SERVICE_CONNECTION_POINTS, WIM_SERVICE_TYPE LOGGER = logging.getLogger(__name__) LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.DEBUG) LOGGER.setLevel(logging.DEBUG) Loading @@ -30,39 +29,44 @@ LOGGER.setLevel(logging.DEBUG) DESCRIPTOR_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'descriptors', 'service-bidir.json') DESCRIPTOR_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'descriptors', 'service-bidir.json') ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME)) ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME)) def test_service_creation_bidir(context_client : ContextClient, osm_wim : MockOSM): # pylint: disable=redefined-outer-name def test_service_creation_bidir( context_client : ContextClient, # pylint: disable=redefined-outer-name device_client : DeviceClient, # pylint: disable=redefined-outer-name service_client : ServiceClient, # pylint: disable=redefined-outer-name ): # Load descriptors and validate the base scenario # Load descriptors and validate the base scenario descriptor_loader = DescriptorLoader(descriptors_file=DESCRIPTOR_FILE, context_client=context_client) descriptor_loader = DescriptorLoader( descriptors_file=DESCRIPTOR_FILE, context_client=context_client, device_client=device_client, service_client=service_client ) results = descriptor_loader.process() check_descriptor_load_results(results, descriptor_loader) descriptor_loader.validate() descriptor_loader.validate() # Verify the scenario has no services/slices # Verify the scenario has no services/slices response = context_client.GetContext(ADMIN_CONTEXT_ID) response = context_client.GetContext(ADMIN_CONTEXT_ID) assert len(response.service_ids) == 0 #assert len(response.service_ids) == 0 assert len(response.slice_ids) == 0 #assert len(response.slice_ids) == 0 # Create Connectivity Service service_uuid = osm_wim.create_connectivity_service(WIM_SERVICE_TYPE, WIM_SERVICE_CONNECTION_POINTS) osm_wim.get_connectivity_service_status(service_uuid) # Ensure slices and services are created # Ensure slices and services are created response = context_client.ListSlices(ADMIN_CONTEXT_ID) response = context_client.ListSlices(ADMIN_CONTEXT_ID) LOGGER.info('Slices[{:d}] = {:s}'.format(len(response.slices), grpc_message_to_json_string(response))) LOGGER.warning('Slices[{:d}] = {:s}'.format(len(response.slices), grpc_message_to_json_string(response))) assert len(response.slices) == 1 # OSM slice #assert len(response.slices) == 1 # OSM slice response = context_client.ListServices(ADMIN_CONTEXT_ID) response = context_client.ListServices(ADMIN_CONTEXT_ID) LOGGER.info('Services[{:d}] = {:s}'.format(len(response.services), grpc_message_to_json_string(response))) LOGGER.warning('Services[{:d}] = {:s}'.format(len(response.services), grpc_message_to_json_string(response))) assert len(response.services) == 2 # 1xL3NM + 1xTAPI #assert len(response.services) == 2 # 1xL3NM + 1xTAPI for service in response.services: for service in response.services: service_id = service.service_id service_id = service.service_id response = context_client.ListConnections(service_id) response = context_client.ListConnections(service_id) LOGGER.info(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format( LOGGER.warning(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format( grpc_message_to_json_string(service_id), len(response.connections), grpc_message_to_json_string(response))) grpc_message_to_json_string(service_id), len(response.connections), grpc_message_to_json_string(response))) if service.service_type == ServiceTypeEnum.SERVICETYPE_L3NM: #if service.service_type == ServiceTypeEnum.SERVICETYPE_L3NM: assert len(response.connections) == 1 # 1 connection per service # assert len(response.connections) == 1 # 1 connection per service elif service.service_type == ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE: #elif service.service_type == ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE: assert len(response.connections) == 1 # 1 connection per service # assert len(response.connections) == 1 # 1 connection per service else: #else: str_service = grpc_message_to_json_string(service) # str_service = grpc_message_to_json_string(service) raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) # raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) src/tests/ofc24/tests/test_functional_create_service_unidir.py +29 −25 Original line number Original line Diff line number Diff line Loading @@ -15,14 +15,13 @@ import logging, os import logging, os from common.Constants import DEFAULT_CONTEXT_NAME from common.Constants import DEFAULT_CONTEXT_NAME from common.proto.context_pb2 import ContextId, ServiceTypeEnum from common.proto.context_pb2 import ContextId, ServiceTypeEnum from common.tools.descriptor.Loader import DescriptorLoader from common.tools.descriptor.Loader import DescriptorLoader, check_descriptor_load_results from common.tools.grpc.Tools import grpc_message_to_json_string from common.tools.grpc.Tools import grpc_message_to_json_string from common.tools.object_factory.Context import json_context_id from common.tools.object_factory.Context import json_context_id from context.client.ContextClient import ContextClient from context.client.ContextClient import ContextClient from tests.Fixtures import context_client, monitoring_client # pylint: disable=unused-import from device.client.DeviceClient import DeviceClient from tests.tools.mock_osm.MockOSM import MockOSM from service.client.ServiceClient import ServiceClient from .Fixtures import osm_wim # pylint: disable=unused-import from tests.Fixtures import context_client, device_client, service_client # pylint: disable=unused-import from .Objects import WIM_SERVICE_CONNECTION_POINTS, WIM_SERVICE_TYPE LOGGER = logging.getLogger(__name__) LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.DEBUG) LOGGER.setLevel(logging.DEBUG) Loading @@ -30,39 +29,44 @@ LOGGER.setLevel(logging.DEBUG) DESCRIPTOR_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'descriptors', 'service-bidir.json') DESCRIPTOR_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'descriptors', 'service-bidir.json') ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME)) ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME)) def test_service_creation_unidir(context_client : ContextClient, osm_wim : MockOSM): # pylint: disable=redefined-outer-name def test_service_creation_unidir( context_client : ContextClient, # pylint: disable=redefined-outer-name device_client : DeviceClient, # pylint: disable=redefined-outer-name service_client : ServiceClient, # pylint: disable=redefined-outer-name ): # Load descriptors and validate the base scenario # Load descriptors and validate the base scenario descriptor_loader = DescriptorLoader(descriptors_file=DESCRIPTOR_FILE, context_client=context_client) descriptor_loader = DescriptorLoader( descriptors_file=DESCRIPTOR_FILE, context_client=context_client, device_client=device_client, service_client=service_client ) results = descriptor_loader.process() check_descriptor_load_results(results, descriptor_loader) descriptor_loader.validate() descriptor_loader.validate() # Verify the scenario has no services/slices # Verify the scenario has no services/slices response = context_client.GetContext(ADMIN_CONTEXT_ID) response = context_client.GetContext(ADMIN_CONTEXT_ID) assert len(response.service_ids) == 0 #assert len(response.service_ids) == 0 assert len(response.slice_ids) == 0 #assert len(response.slice_ids) == 0 # Create Connectivity Service service_uuid = osm_wim.create_connectivity_service(WIM_SERVICE_TYPE, WIM_SERVICE_CONNECTION_POINTS) osm_wim.get_connectivity_service_status(service_uuid) # Ensure slices and services are created # Ensure slices and services are created response = context_client.ListSlices(ADMIN_CONTEXT_ID) response = context_client.ListSlices(ADMIN_CONTEXT_ID) LOGGER.info('Slices[{:d}] = {:s}'.format(len(response.slices), grpc_message_to_json_string(response))) LOGGER.warning('Slices[{:d}] = {:s}'.format(len(response.slices), grpc_message_to_json_string(response))) assert len(response.slices) == 1 # OSM slice #assert len(response.slices) == 1 # OSM slice response = context_client.ListServices(ADMIN_CONTEXT_ID) response = context_client.ListServices(ADMIN_CONTEXT_ID) LOGGER.info('Services[{:d}] = {:s}'.format(len(response.services), grpc_message_to_json_string(response))) LOGGER.warning('Services[{:d}] = {:s}'.format(len(response.services), grpc_message_to_json_string(response))) assert len(response.services) == 2 # 1xL3NM + 1xTAPI #assert len(response.services) == 2 # 1xL3NM + 1xTAPI for service in response.services: for service in response.services: service_id = service.service_id service_id = service.service_id response = context_client.ListConnections(service_id) response = context_client.ListConnections(service_id) LOGGER.info(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format( LOGGER.warning(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format( grpc_message_to_json_string(service_id), len(response.connections), grpc_message_to_json_string(response))) grpc_message_to_json_string(service_id), len(response.connections), grpc_message_to_json_string(response))) if service.service_type == ServiceTypeEnum.SERVICETYPE_L3NM: #if service.service_type == ServiceTypeEnum.SERVICETYPE_L3NM: assert len(response.connections) == 1 # 1 connection per service # assert len(response.connections) == 1 # 1 connection per service elif service.service_type == ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE: #elif service.service_type == ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE: assert len(response.connections) == 1 # 1 connection per service # assert len(response.connections) == 1 # 1 connection per service else: #else: str_service = grpc_message_to_json_string(service) # str_service = grpc_message_to_json_string(service) raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) # raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) src/tests/ofc24/tests/test_functional_delete_service_bidir.py +49 −33 Original line number Original line Diff line number Diff line Loading @@ -14,14 +14,14 @@ import logging, os import logging, os from common.Constants import DEFAULT_CONTEXT_NAME from common.Constants import DEFAULT_CONTEXT_NAME from common.proto.context_pb2 import ContextId, ServiceTypeEnum from common.proto.context_pb2 import ContextId, ServiceId, ServiceTypeEnum from common.tools.descriptor.Loader import DescriptorLoader from common.tools.descriptor.Loader import DescriptorLoader from common.tools.grpc.Tools import grpc_message_to_json_string from common.tools.grpc.Tools import grpc_message_to_json_string from common.tools.object_factory.Context import json_context_id from common.tools.object_factory.Context import json_context_id from context.client.ContextClient import ContextClient from context.client.ContextClient import ContextClient from tests.Fixtures import context_client # pylint: disable=unused-import from device.client.DeviceClient import DeviceClient from tests.tools.mock_osm.MockOSM import MockOSM from service.client.ServiceClient import ServiceClient from .Fixtures import osm_wim # pylint: disable=unused-import from tests.Fixtures import context_client, device_client, service_client # pylint: disable=unused-import LOGGER = logging.getLogger(__name__) LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.DEBUG) LOGGER.setLevel(logging.DEBUG) Loading @@ -29,46 +29,62 @@ LOGGER.setLevel(logging.DEBUG) DESCRIPTOR_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'descriptors', 'service-bidir.json') DESCRIPTOR_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'descriptors', 'service-bidir.json') ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME)) ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME)) def test_service_removal_bidir(context_client : ContextClient, osm_wim : MockOSM): # pylint: disable=redefined-outer-name def test_service_removal_bidir( context_client : ContextClient, # pylint: disable=redefined-outer-name device_client : DeviceClient, # pylint: disable=redefined-outer-name service_client : ServiceClient, # pylint: disable=redefined-outer-name ): # Load descriptors and validate the base scenario descriptor_loader = DescriptorLoader( descriptors_file=DESCRIPTOR_FILE, context_client=context_client, device_client=device_client, service_client=service_client ) descriptor_loader.validate() # Verify the scenario has no services/slices response = context_client.GetContext(ADMIN_CONTEXT_ID) #assert len(response.service_ids) == 0 #assert len(response.slice_ids) == 0 # Ensure slices and services are created # Ensure slices and services are created response = context_client.ListSlices(ADMIN_CONTEXT_ID) response = context_client.ListSlices(ADMIN_CONTEXT_ID) LOGGER.info('Slices[{:d}] = {:s}'.format(len(response.slices), grpc_message_to_json_string(response))) LOGGER.warning('Slices[{:d}] = {:s}'.format(len(response.slices), grpc_message_to_json_string(response))) assert len(response.slices) == 1 # OSM slice #assert len(response.slices) == 1 # OSM slice response = context_client.ListServices(ADMIN_CONTEXT_ID) response = context_client.ListServices(ADMIN_CONTEXT_ID) LOGGER.info('Services[{:d}] = {:s}'.format(len(response.services), grpc_message_to_json_string(response))) LOGGER.warning('Services[{:d}] = {:s}'.format(len(response.services), grpc_message_to_json_string(response))) assert len(response.services) == 2 # 1xL3NM + 1xTAPI #assert len(response.services) == 2 # 1xL3NM + 1xTAPI service_uuids = set() #service_uuids = set() for service in response.services: for service in response.services: service_id = service.service_id service_id = service.service_id response = context_client.ListConnections(service_id) response = context_client.ListConnections(service_id) LOGGER.info(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format( LOGGER.warning(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format( grpc_message_to_json_string(service_id), len(response.connections), grpc_message_to_json_string(response))) grpc_message_to_json_string(service_id), len(response.connections), grpc_message_to_json_string(response))) if service.service_type == ServiceTypeEnum.SERVICETYPE_L3NM: #if service.service_type == ServiceTypeEnum.SERVICETYPE_L3NM: assert len(response.connections) == 1 # 1 connection per service # assert len(response.connections) == 1 # 1 connection per service service_uuid = service_id.service_uuid.uuid # service_uuid = service_id.service_uuid.uuid service_uuids.add(service_uuid) # service_uuids.add(service_uuid) osm_wim.conn_info[service_uuid] = {} # osm_wim.conn_info[service_uuid] = {} elif service.service_type == ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE: #elif service.service_type == ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE: assert len(response.connections) == 1 # 1 connection per service # assert len(response.connections) == 1 # 1 connection per service else: #else: str_service = grpc_message_to_json_string(service) # str_service = grpc_message_to_json_string(service) raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) # raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) # Identify service to delete ## Identify service to delete assert len(service_uuids) == 1 # assume a single L3NM service has been created #assert len(service_uuids) == 1 # assume a single L3NM service has been created service_uuid = set(service_uuids).pop() #service_uuid = set(service_uuids).pop() # Delete Connectivity Service ## Delete Service osm_wim.delete_connectivity_service(service_uuid) #service_client.DeleteService(ServiceId(json_service_id(service_uuid, context_uuid))) # Verify the scenario has no services/slices ## Verify the scenario has no services/slices response = context_client.GetContext(ADMIN_CONTEXT_ID) #response = context_client.GetContext(ADMIN_CONTEXT_ID) assert len(response.service_ids) == 0 #assert len(response.service_ids) == 0 assert len(response.slice_ids) == 0 #assert len(response.slice_ids) == 0 # Load descriptors and validate the base scenario ## Load descriptors and validate the base scenario descriptor_loader = DescriptorLoader(descriptors_file=DESCRIPTOR_FILE, context_client=context_client) #descriptor_loader = DescriptorLoader(descriptors_file=DESCRIPTOR_FILE, context_client=context_client) descriptor_loader.validate() #descriptor_loader.validate() src/tests/ofc24/tests/test_functional_delete_service_unidir.py +49 −33 Original line number Original line Diff line number Diff line Loading @@ -14,14 +14,14 @@ import logging, os import logging, os from common.Constants import DEFAULT_CONTEXT_NAME from common.Constants import DEFAULT_CONTEXT_NAME from common.proto.context_pb2 import ContextId, ServiceTypeEnum from common.proto.context_pb2 import ContextId, ServiceId, ServiceTypeEnum from common.tools.descriptor.Loader import DescriptorLoader from common.tools.descriptor.Loader import DescriptorLoader from common.tools.grpc.Tools import grpc_message_to_json_string from common.tools.grpc.Tools import grpc_message_to_json_string from common.tools.object_factory.Context import json_context_id from common.tools.object_factory.Context import json_context_id from context.client.ContextClient import ContextClient from context.client.ContextClient import ContextClient from tests.Fixtures import context_client # pylint: disable=unused-import from device.client.DeviceClient import DeviceClient from tests.tools.mock_osm.MockOSM import MockOSM from service.client.ServiceClient import ServiceClient from .Fixtures import osm_wim # pylint: disable=unused-import from tests.Fixtures import context_client, device_client, service_client # pylint: disable=unused-import LOGGER = logging.getLogger(__name__) LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.DEBUG) LOGGER.setLevel(logging.DEBUG) Loading @@ -29,46 +29,62 @@ LOGGER.setLevel(logging.DEBUG) DESCRIPTOR_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'descriptors', 'service-unidir.json') DESCRIPTOR_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'descriptors', 'service-unidir.json') ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME)) ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME)) def test_service_removal_unidir(context_client : ContextClient, osm_wim : MockOSM): # pylint: disable=redefined-outer-name def test_service_removal_unidir( context_client : ContextClient, # pylint: disable=redefined-outer-name device_client : DeviceClient, # pylint: disable=redefined-outer-name service_client : ServiceClient, # pylint: disable=redefined-outer-name ): # Load descriptors and validate the base scenario descriptor_loader = DescriptorLoader( descriptors_file=DESCRIPTOR_FILE, context_client=context_client, device_client=device_client, service_client=service_client ) descriptor_loader.validate() # Verify the scenario has no services/slices response = context_client.GetContext(ADMIN_CONTEXT_ID) #assert len(response.service_ids) == 0 #assert len(response.slice_ids) == 0 # Ensure slices and services are created # Ensure slices and services are created response = context_client.ListSlices(ADMIN_CONTEXT_ID) response = context_client.ListSlices(ADMIN_CONTEXT_ID) LOGGER.info('Slices[{:d}] = {:s}'.format(len(response.slices), grpc_message_to_json_string(response))) LOGGER.warning('Slices[{:d}] = {:s}'.format(len(response.slices), grpc_message_to_json_string(response))) assert len(response.slices) == 1 # OSM slice #assert len(response.slices) == 1 # OSM slice response = context_client.ListServices(ADMIN_CONTEXT_ID) response = context_client.ListServices(ADMIN_CONTEXT_ID) LOGGER.info('Services[{:d}] = {:s}'.format(len(response.services), grpc_message_to_json_string(response))) LOGGER.warning('Services[{:d}] = {:s}'.format(len(response.services), grpc_message_to_json_string(response))) assert len(response.services) == 2 # 1xL3NM + 1xTAPI #assert len(response.services) == 2 # 1xL3NM + 1xTAPI service_uuids = set() #service_uuids = set() for service in response.services: for service in response.services: service_id = service.service_id service_id = service.service_id response = context_client.ListConnections(service_id) response = context_client.ListConnections(service_id) LOGGER.info(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format( LOGGER.warning(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format( grpc_message_to_json_string(service_id), len(response.connections), grpc_message_to_json_string(response))) grpc_message_to_json_string(service_id), len(response.connections), grpc_message_to_json_string(response))) if service.service_type == ServiceTypeEnum.SERVICETYPE_L3NM: #if service.service_type == ServiceTypeEnum.SERVICETYPE_L3NM: assert len(response.connections) == 1 # 1 connection per service # assert len(response.connections) == 1 # 1 connection per service service_uuid = service_id.service_uuid.uuid # service_uuid = service_id.service_uuid.uuid service_uuids.add(service_uuid) # service_uuids.add(service_uuid) osm_wim.conn_info[service_uuid] = {} # osm_wim.conn_info[service_uuid] = {} elif service.service_type == ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE: #elif service.service_type == ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE: assert len(response.connections) == 1 # 1 connection per service # assert len(response.connections) == 1 # 1 connection per service else: #else: str_service = grpc_message_to_json_string(service) # str_service = grpc_message_to_json_string(service) raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) # raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) # Identify service to delete ## Identify service to delete assert len(service_uuids) == 1 # assume a single L3NM service has been created #assert len(service_uuids) == 1 # assume a single L3NM service has been created service_uuid = set(service_uuids).pop() #service_uuid = set(service_uuids).pop() # Delete Connectivity Service ## Delete Service osm_wim.delete_connectivity_service(service_uuid) #service_client.DeleteService(ServiceId(json_service_id(service_uuid, context_uuid))) # Verify the scenario has no services/slices ## Verify the scenario has no services/slices response = context_client.GetContext(ADMIN_CONTEXT_ID) #response = context_client.GetContext(ADMIN_CONTEXT_ID) assert len(response.service_ids) == 0 #assert len(response.service_ids) == 0 assert len(response.slice_ids) == 0 #assert len(response.slice_ids) == 0 # Load descriptors and validate the base scenario ## Load descriptors and validate the base scenario descriptor_loader = DescriptorLoader(descriptors_file=DESCRIPTOR_FILE, context_client=context_client) #descriptor_loader = DescriptorLoader(descriptors_file=DESCRIPTOR_FILE, context_client=context_client) descriptor_loader.validate() #descriptor_loader.validate() Loading
src/tests/ofc24/Dockerfile +0 −5 Original line number Original line Diff line number Diff line Loading @@ -70,10 +70,6 @@ COPY src/context/__init__.py context/__init__.py COPY src/context/client/. context/client/ COPY src/context/client/. context/client/ COPY src/device/__init__.py device/__init__.py COPY src/device/__init__.py device/__init__.py COPY src/device/client/. device/client/ COPY src/device/client/. device/client/ #COPY src/monitoring/__init__.py monitoring/__init__.py #COPY src/monitoring/client/. monitoring/client/ #COPY src/monitoring/__init__.py monitoring/__init__.py #COPY src/monitoring/client/. monitoring/client/ COPY src/e2e_orchestrator/__init__.py e2e_orchestrator/__init__.py COPY src/e2e_orchestrator/__init__.py e2e_orchestrator/__init__.py COPY src/e2e_orchestrator/client/. e2e_orchestrator/client/ COPY src/e2e_orchestrator/client/. e2e_orchestrator/client/ COPY src/service/__init__.py service/__init__.py COPY src/service/__init__.py service/__init__.py Loading @@ -86,7 +82,6 @@ COPY src/tests/ofc24/descriptors/topology.json ./tests/ofc24/descriptors/topolog COPY src/tests/ofc24/descriptors/service-unidir.json ./tests/ofc24/descriptors/service-unidir.json COPY src/tests/ofc24/descriptors/service-unidir.json ./tests/ofc24/descriptors/service-unidir.json COPY src/tests/ofc24/descriptors/service-bidir.json ./tests/ofc24/descriptors/service-bidir.json COPY src/tests/ofc24/descriptors/service-bidir.json ./tests/ofc24/descriptors/service-bidir.json COPY src/tests/ofc24/tests/. ./tests/ofc24/tests/ COPY src/tests/ofc24/tests/. ./tests/ofc24/tests/ COPY src/tests/tools/. ./tests/tools/ RUN tee ./run_tests.sh <<EOF RUN tee ./run_tests.sh <<EOF #!/bin/bash #!/bin/bash Loading
src/tests/ofc24/tests/test_functional_create_service_bidir.py +29 −25 Original line number Original line Diff line number Diff line Loading @@ -15,14 +15,13 @@ import logging, os import logging, os from common.Constants import DEFAULT_CONTEXT_NAME from common.Constants import DEFAULT_CONTEXT_NAME from common.proto.context_pb2 import ContextId, ServiceTypeEnum from common.proto.context_pb2 import ContextId, ServiceTypeEnum from common.tools.descriptor.Loader import DescriptorLoader from common.tools.descriptor.Loader import DescriptorLoader, check_descriptor_load_results from common.tools.grpc.Tools import grpc_message_to_json_string from common.tools.grpc.Tools import grpc_message_to_json_string from common.tools.object_factory.Context import json_context_id from common.tools.object_factory.Context import json_context_id from context.client.ContextClient import ContextClient from context.client.ContextClient import ContextClient from tests.Fixtures import context_client, monitoring_client # pylint: disable=unused-import from device.client.DeviceClient import DeviceClient from tests.tools.mock_osm.MockOSM import MockOSM from service.client.ServiceClient import ServiceClient from .Fixtures import osm_wim # pylint: disable=unused-import from tests.Fixtures import context_client, device_client, service_client # pylint: disable=unused-import from .Objects import WIM_SERVICE_CONNECTION_POINTS, WIM_SERVICE_TYPE LOGGER = logging.getLogger(__name__) LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.DEBUG) LOGGER.setLevel(logging.DEBUG) Loading @@ -30,39 +29,44 @@ LOGGER.setLevel(logging.DEBUG) DESCRIPTOR_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'descriptors', 'service-bidir.json') DESCRIPTOR_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'descriptors', 'service-bidir.json') ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME)) ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME)) def test_service_creation_bidir(context_client : ContextClient, osm_wim : MockOSM): # pylint: disable=redefined-outer-name def test_service_creation_bidir( context_client : ContextClient, # pylint: disable=redefined-outer-name device_client : DeviceClient, # pylint: disable=redefined-outer-name service_client : ServiceClient, # pylint: disable=redefined-outer-name ): # Load descriptors and validate the base scenario # Load descriptors and validate the base scenario descriptor_loader = DescriptorLoader(descriptors_file=DESCRIPTOR_FILE, context_client=context_client) descriptor_loader = DescriptorLoader( descriptors_file=DESCRIPTOR_FILE, context_client=context_client, device_client=device_client, service_client=service_client ) results = descriptor_loader.process() check_descriptor_load_results(results, descriptor_loader) descriptor_loader.validate() descriptor_loader.validate() # Verify the scenario has no services/slices # Verify the scenario has no services/slices response = context_client.GetContext(ADMIN_CONTEXT_ID) response = context_client.GetContext(ADMIN_CONTEXT_ID) assert len(response.service_ids) == 0 #assert len(response.service_ids) == 0 assert len(response.slice_ids) == 0 #assert len(response.slice_ids) == 0 # Create Connectivity Service service_uuid = osm_wim.create_connectivity_service(WIM_SERVICE_TYPE, WIM_SERVICE_CONNECTION_POINTS) osm_wim.get_connectivity_service_status(service_uuid) # Ensure slices and services are created # Ensure slices and services are created response = context_client.ListSlices(ADMIN_CONTEXT_ID) response = context_client.ListSlices(ADMIN_CONTEXT_ID) LOGGER.info('Slices[{:d}] = {:s}'.format(len(response.slices), grpc_message_to_json_string(response))) LOGGER.warning('Slices[{:d}] = {:s}'.format(len(response.slices), grpc_message_to_json_string(response))) assert len(response.slices) == 1 # OSM slice #assert len(response.slices) == 1 # OSM slice response = context_client.ListServices(ADMIN_CONTEXT_ID) response = context_client.ListServices(ADMIN_CONTEXT_ID) LOGGER.info('Services[{:d}] = {:s}'.format(len(response.services), grpc_message_to_json_string(response))) LOGGER.warning('Services[{:d}] = {:s}'.format(len(response.services), grpc_message_to_json_string(response))) assert len(response.services) == 2 # 1xL3NM + 1xTAPI #assert len(response.services) == 2 # 1xL3NM + 1xTAPI for service in response.services: for service in response.services: service_id = service.service_id service_id = service.service_id response = context_client.ListConnections(service_id) response = context_client.ListConnections(service_id) LOGGER.info(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format( LOGGER.warning(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format( grpc_message_to_json_string(service_id), len(response.connections), grpc_message_to_json_string(response))) grpc_message_to_json_string(service_id), len(response.connections), grpc_message_to_json_string(response))) if service.service_type == ServiceTypeEnum.SERVICETYPE_L3NM: #if service.service_type == ServiceTypeEnum.SERVICETYPE_L3NM: assert len(response.connections) == 1 # 1 connection per service # assert len(response.connections) == 1 # 1 connection per service elif service.service_type == ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE: #elif service.service_type == ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE: assert len(response.connections) == 1 # 1 connection per service # assert len(response.connections) == 1 # 1 connection per service else: #else: str_service = grpc_message_to_json_string(service) # str_service = grpc_message_to_json_string(service) raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) # raise Exception('Unexpected ServiceType: {:s}'.format(str_service))
src/tests/ofc24/tests/test_functional_create_service_unidir.py +29 −25 Original line number Original line Diff line number Diff line Loading @@ -15,14 +15,13 @@ import logging, os import logging, os from common.Constants import DEFAULT_CONTEXT_NAME from common.Constants import DEFAULT_CONTEXT_NAME from common.proto.context_pb2 import ContextId, ServiceTypeEnum from common.proto.context_pb2 import ContextId, ServiceTypeEnum from common.tools.descriptor.Loader import DescriptorLoader from common.tools.descriptor.Loader import DescriptorLoader, check_descriptor_load_results from common.tools.grpc.Tools import grpc_message_to_json_string from common.tools.grpc.Tools import grpc_message_to_json_string from common.tools.object_factory.Context import json_context_id from common.tools.object_factory.Context import json_context_id from context.client.ContextClient import ContextClient from context.client.ContextClient import ContextClient from tests.Fixtures import context_client, monitoring_client # pylint: disable=unused-import from device.client.DeviceClient import DeviceClient from tests.tools.mock_osm.MockOSM import MockOSM from service.client.ServiceClient import ServiceClient from .Fixtures import osm_wim # pylint: disable=unused-import from tests.Fixtures import context_client, device_client, service_client # pylint: disable=unused-import from .Objects import WIM_SERVICE_CONNECTION_POINTS, WIM_SERVICE_TYPE LOGGER = logging.getLogger(__name__) LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.DEBUG) LOGGER.setLevel(logging.DEBUG) Loading @@ -30,39 +29,44 @@ LOGGER.setLevel(logging.DEBUG) DESCRIPTOR_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'descriptors', 'service-bidir.json') DESCRIPTOR_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'descriptors', 'service-bidir.json') ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME)) ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME)) def test_service_creation_unidir(context_client : ContextClient, osm_wim : MockOSM): # pylint: disable=redefined-outer-name def test_service_creation_unidir( context_client : ContextClient, # pylint: disable=redefined-outer-name device_client : DeviceClient, # pylint: disable=redefined-outer-name service_client : ServiceClient, # pylint: disable=redefined-outer-name ): # Load descriptors and validate the base scenario # Load descriptors and validate the base scenario descriptor_loader = DescriptorLoader(descriptors_file=DESCRIPTOR_FILE, context_client=context_client) descriptor_loader = DescriptorLoader( descriptors_file=DESCRIPTOR_FILE, context_client=context_client, device_client=device_client, service_client=service_client ) results = descriptor_loader.process() check_descriptor_load_results(results, descriptor_loader) descriptor_loader.validate() descriptor_loader.validate() # Verify the scenario has no services/slices # Verify the scenario has no services/slices response = context_client.GetContext(ADMIN_CONTEXT_ID) response = context_client.GetContext(ADMIN_CONTEXT_ID) assert len(response.service_ids) == 0 #assert len(response.service_ids) == 0 assert len(response.slice_ids) == 0 #assert len(response.slice_ids) == 0 # Create Connectivity Service service_uuid = osm_wim.create_connectivity_service(WIM_SERVICE_TYPE, WIM_SERVICE_CONNECTION_POINTS) osm_wim.get_connectivity_service_status(service_uuid) # Ensure slices and services are created # Ensure slices and services are created response = context_client.ListSlices(ADMIN_CONTEXT_ID) response = context_client.ListSlices(ADMIN_CONTEXT_ID) LOGGER.info('Slices[{:d}] = {:s}'.format(len(response.slices), grpc_message_to_json_string(response))) LOGGER.warning('Slices[{:d}] = {:s}'.format(len(response.slices), grpc_message_to_json_string(response))) assert len(response.slices) == 1 # OSM slice #assert len(response.slices) == 1 # OSM slice response = context_client.ListServices(ADMIN_CONTEXT_ID) response = context_client.ListServices(ADMIN_CONTEXT_ID) LOGGER.info('Services[{:d}] = {:s}'.format(len(response.services), grpc_message_to_json_string(response))) LOGGER.warning('Services[{:d}] = {:s}'.format(len(response.services), grpc_message_to_json_string(response))) assert len(response.services) == 2 # 1xL3NM + 1xTAPI #assert len(response.services) == 2 # 1xL3NM + 1xTAPI for service in response.services: for service in response.services: service_id = service.service_id service_id = service.service_id response = context_client.ListConnections(service_id) response = context_client.ListConnections(service_id) LOGGER.info(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format( LOGGER.warning(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format( grpc_message_to_json_string(service_id), len(response.connections), grpc_message_to_json_string(response))) grpc_message_to_json_string(service_id), len(response.connections), grpc_message_to_json_string(response))) if service.service_type == ServiceTypeEnum.SERVICETYPE_L3NM: #if service.service_type == ServiceTypeEnum.SERVICETYPE_L3NM: assert len(response.connections) == 1 # 1 connection per service # assert len(response.connections) == 1 # 1 connection per service elif service.service_type == ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE: #elif service.service_type == ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE: assert len(response.connections) == 1 # 1 connection per service # assert len(response.connections) == 1 # 1 connection per service else: #else: str_service = grpc_message_to_json_string(service) # str_service = grpc_message_to_json_string(service) raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) # raise Exception('Unexpected ServiceType: {:s}'.format(str_service))
src/tests/ofc24/tests/test_functional_delete_service_bidir.py +49 −33 Original line number Original line Diff line number Diff line Loading @@ -14,14 +14,14 @@ import logging, os import logging, os from common.Constants import DEFAULT_CONTEXT_NAME from common.Constants import DEFAULT_CONTEXT_NAME from common.proto.context_pb2 import ContextId, ServiceTypeEnum from common.proto.context_pb2 import ContextId, ServiceId, ServiceTypeEnum from common.tools.descriptor.Loader import DescriptorLoader from common.tools.descriptor.Loader import DescriptorLoader from common.tools.grpc.Tools import grpc_message_to_json_string from common.tools.grpc.Tools import grpc_message_to_json_string from common.tools.object_factory.Context import json_context_id from common.tools.object_factory.Context import json_context_id from context.client.ContextClient import ContextClient from context.client.ContextClient import ContextClient from tests.Fixtures import context_client # pylint: disable=unused-import from device.client.DeviceClient import DeviceClient from tests.tools.mock_osm.MockOSM import MockOSM from service.client.ServiceClient import ServiceClient from .Fixtures import osm_wim # pylint: disable=unused-import from tests.Fixtures import context_client, device_client, service_client # pylint: disable=unused-import LOGGER = logging.getLogger(__name__) LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.DEBUG) LOGGER.setLevel(logging.DEBUG) Loading @@ -29,46 +29,62 @@ LOGGER.setLevel(logging.DEBUG) DESCRIPTOR_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'descriptors', 'service-bidir.json') DESCRIPTOR_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'descriptors', 'service-bidir.json') ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME)) ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME)) def test_service_removal_bidir(context_client : ContextClient, osm_wim : MockOSM): # pylint: disable=redefined-outer-name def test_service_removal_bidir( context_client : ContextClient, # pylint: disable=redefined-outer-name device_client : DeviceClient, # pylint: disable=redefined-outer-name service_client : ServiceClient, # pylint: disable=redefined-outer-name ): # Load descriptors and validate the base scenario descriptor_loader = DescriptorLoader( descriptors_file=DESCRIPTOR_FILE, context_client=context_client, device_client=device_client, service_client=service_client ) descriptor_loader.validate() # Verify the scenario has no services/slices response = context_client.GetContext(ADMIN_CONTEXT_ID) #assert len(response.service_ids) == 0 #assert len(response.slice_ids) == 0 # Ensure slices and services are created # Ensure slices and services are created response = context_client.ListSlices(ADMIN_CONTEXT_ID) response = context_client.ListSlices(ADMIN_CONTEXT_ID) LOGGER.info('Slices[{:d}] = {:s}'.format(len(response.slices), grpc_message_to_json_string(response))) LOGGER.warning('Slices[{:d}] = {:s}'.format(len(response.slices), grpc_message_to_json_string(response))) assert len(response.slices) == 1 # OSM slice #assert len(response.slices) == 1 # OSM slice response = context_client.ListServices(ADMIN_CONTEXT_ID) response = context_client.ListServices(ADMIN_CONTEXT_ID) LOGGER.info('Services[{:d}] = {:s}'.format(len(response.services), grpc_message_to_json_string(response))) LOGGER.warning('Services[{:d}] = {:s}'.format(len(response.services), grpc_message_to_json_string(response))) assert len(response.services) == 2 # 1xL3NM + 1xTAPI #assert len(response.services) == 2 # 1xL3NM + 1xTAPI service_uuids = set() #service_uuids = set() for service in response.services: for service in response.services: service_id = service.service_id service_id = service.service_id response = context_client.ListConnections(service_id) response = context_client.ListConnections(service_id) LOGGER.info(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format( LOGGER.warning(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format( grpc_message_to_json_string(service_id), len(response.connections), grpc_message_to_json_string(response))) grpc_message_to_json_string(service_id), len(response.connections), grpc_message_to_json_string(response))) if service.service_type == ServiceTypeEnum.SERVICETYPE_L3NM: #if service.service_type == ServiceTypeEnum.SERVICETYPE_L3NM: assert len(response.connections) == 1 # 1 connection per service # assert len(response.connections) == 1 # 1 connection per service service_uuid = service_id.service_uuid.uuid # service_uuid = service_id.service_uuid.uuid service_uuids.add(service_uuid) # service_uuids.add(service_uuid) osm_wim.conn_info[service_uuid] = {} # osm_wim.conn_info[service_uuid] = {} elif service.service_type == ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE: #elif service.service_type == ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE: assert len(response.connections) == 1 # 1 connection per service # assert len(response.connections) == 1 # 1 connection per service else: #else: str_service = grpc_message_to_json_string(service) # str_service = grpc_message_to_json_string(service) raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) # raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) # Identify service to delete ## Identify service to delete assert len(service_uuids) == 1 # assume a single L3NM service has been created #assert len(service_uuids) == 1 # assume a single L3NM service has been created service_uuid = set(service_uuids).pop() #service_uuid = set(service_uuids).pop() # Delete Connectivity Service ## Delete Service osm_wim.delete_connectivity_service(service_uuid) #service_client.DeleteService(ServiceId(json_service_id(service_uuid, context_uuid))) # Verify the scenario has no services/slices ## Verify the scenario has no services/slices response = context_client.GetContext(ADMIN_CONTEXT_ID) #response = context_client.GetContext(ADMIN_CONTEXT_ID) assert len(response.service_ids) == 0 #assert len(response.service_ids) == 0 assert len(response.slice_ids) == 0 #assert len(response.slice_ids) == 0 # Load descriptors and validate the base scenario ## Load descriptors and validate the base scenario descriptor_loader = DescriptorLoader(descriptors_file=DESCRIPTOR_FILE, context_client=context_client) #descriptor_loader = DescriptorLoader(descriptors_file=DESCRIPTOR_FILE, context_client=context_client) descriptor_loader.validate() #descriptor_loader.validate()
src/tests/ofc24/tests/test_functional_delete_service_unidir.py +49 −33 Original line number Original line Diff line number Diff line Loading @@ -14,14 +14,14 @@ import logging, os import logging, os from common.Constants import DEFAULT_CONTEXT_NAME from common.Constants import DEFAULT_CONTEXT_NAME from common.proto.context_pb2 import ContextId, ServiceTypeEnum from common.proto.context_pb2 import ContextId, ServiceId, ServiceTypeEnum from common.tools.descriptor.Loader import DescriptorLoader from common.tools.descriptor.Loader import DescriptorLoader from common.tools.grpc.Tools import grpc_message_to_json_string from common.tools.grpc.Tools import grpc_message_to_json_string from common.tools.object_factory.Context import json_context_id from common.tools.object_factory.Context import json_context_id from context.client.ContextClient import ContextClient from context.client.ContextClient import ContextClient from tests.Fixtures import context_client # pylint: disable=unused-import from device.client.DeviceClient import DeviceClient from tests.tools.mock_osm.MockOSM import MockOSM from service.client.ServiceClient import ServiceClient from .Fixtures import osm_wim # pylint: disable=unused-import from tests.Fixtures import context_client, device_client, service_client # pylint: disable=unused-import LOGGER = logging.getLogger(__name__) LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.DEBUG) LOGGER.setLevel(logging.DEBUG) Loading @@ -29,46 +29,62 @@ LOGGER.setLevel(logging.DEBUG) DESCRIPTOR_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'descriptors', 'service-unidir.json') DESCRIPTOR_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'descriptors', 'service-unidir.json') ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME)) ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME)) def test_service_removal_unidir(context_client : ContextClient, osm_wim : MockOSM): # pylint: disable=redefined-outer-name def test_service_removal_unidir( context_client : ContextClient, # pylint: disable=redefined-outer-name device_client : DeviceClient, # pylint: disable=redefined-outer-name service_client : ServiceClient, # pylint: disable=redefined-outer-name ): # Load descriptors and validate the base scenario descriptor_loader = DescriptorLoader( descriptors_file=DESCRIPTOR_FILE, context_client=context_client, device_client=device_client, service_client=service_client ) descriptor_loader.validate() # Verify the scenario has no services/slices response = context_client.GetContext(ADMIN_CONTEXT_ID) #assert len(response.service_ids) == 0 #assert len(response.slice_ids) == 0 # Ensure slices and services are created # Ensure slices and services are created response = context_client.ListSlices(ADMIN_CONTEXT_ID) response = context_client.ListSlices(ADMIN_CONTEXT_ID) LOGGER.info('Slices[{:d}] = {:s}'.format(len(response.slices), grpc_message_to_json_string(response))) LOGGER.warning('Slices[{:d}] = {:s}'.format(len(response.slices), grpc_message_to_json_string(response))) assert len(response.slices) == 1 # OSM slice #assert len(response.slices) == 1 # OSM slice response = context_client.ListServices(ADMIN_CONTEXT_ID) response = context_client.ListServices(ADMIN_CONTEXT_ID) LOGGER.info('Services[{:d}] = {:s}'.format(len(response.services), grpc_message_to_json_string(response))) LOGGER.warning('Services[{:d}] = {:s}'.format(len(response.services), grpc_message_to_json_string(response))) assert len(response.services) == 2 # 1xL3NM + 1xTAPI #assert len(response.services) == 2 # 1xL3NM + 1xTAPI service_uuids = set() #service_uuids = set() for service in response.services: for service in response.services: service_id = service.service_id service_id = service.service_id response = context_client.ListConnections(service_id) response = context_client.ListConnections(service_id) LOGGER.info(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format( LOGGER.warning(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format( grpc_message_to_json_string(service_id), len(response.connections), grpc_message_to_json_string(response))) grpc_message_to_json_string(service_id), len(response.connections), grpc_message_to_json_string(response))) if service.service_type == ServiceTypeEnum.SERVICETYPE_L3NM: #if service.service_type == ServiceTypeEnum.SERVICETYPE_L3NM: assert len(response.connections) == 1 # 1 connection per service # assert len(response.connections) == 1 # 1 connection per service service_uuid = service_id.service_uuid.uuid # service_uuid = service_id.service_uuid.uuid service_uuids.add(service_uuid) # service_uuids.add(service_uuid) osm_wim.conn_info[service_uuid] = {} # osm_wim.conn_info[service_uuid] = {} elif service.service_type == ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE: #elif service.service_type == ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE: assert len(response.connections) == 1 # 1 connection per service # assert len(response.connections) == 1 # 1 connection per service else: #else: str_service = grpc_message_to_json_string(service) # str_service = grpc_message_to_json_string(service) raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) # raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) # Identify service to delete ## Identify service to delete assert len(service_uuids) == 1 # assume a single L3NM service has been created #assert len(service_uuids) == 1 # assume a single L3NM service has been created service_uuid = set(service_uuids).pop() #service_uuid = set(service_uuids).pop() # Delete Connectivity Service ## Delete Service osm_wim.delete_connectivity_service(service_uuid) #service_client.DeleteService(ServiceId(json_service_id(service_uuid, context_uuid))) # Verify the scenario has no services/slices ## Verify the scenario has no services/slices response = context_client.GetContext(ADMIN_CONTEXT_ID) #response = context_client.GetContext(ADMIN_CONTEXT_ID) assert len(response.service_ids) == 0 #assert len(response.service_ids) == 0 assert len(response.slice_ids) == 0 #assert len(response.slice_ids) == 0 # Load descriptors and validate the base scenario ## Load descriptors and validate the base scenario descriptor_loader = DescriptorLoader(descriptors_file=DESCRIPTOR_FILE, context_client=context_client) #descriptor_loader = DescriptorLoader(descriptors_file=DESCRIPTOR_FILE, context_client=context_client) descriptor_loader.validate() #descriptor_loader.validate()