From 1f1aaf44a71c895613ed05d2f672219b5e952470 Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Fri, 22 Dec 2023 10:13:28 +0000 Subject: [PATCH 1/8] Common - Tests - Mock Context: - Correct retrieval of context_uuid in methods RemoveSlice and RemoveService --- src/common/tests/MockServicerImpl_Context.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/tests/MockServicerImpl_Context.py b/src/common/tests/MockServicerImpl_Context.py index 209621887..98a216850 100644 --- a/src/common/tests/MockServicerImpl_Context.py +++ b/src/common/tests/MockServicerImpl_Context.py @@ -430,7 +430,7 @@ class MockServicerImpl_Context(ContextServiceServicer): def RemoveSlice(self, request: SliceId, context : grpc.ServicerContext) -> Empty: LOGGER.debug('[RemoveSlice] request={:s}'.format(grpc_message_to_json_string(request))) - context_uuid = str(request.slice_id.context_id.context_uuid.uuid) + context_uuid = str(request.context_id.context_uuid.uuid) container_name = 'slice[{:s}]'.format(context_uuid) slice_uuid = request.slice_uuid.uuid reply = self._del(request, container_name, slice_uuid, 'slice_id', TOPIC_SLICE, context) @@ -522,7 +522,7 @@ class MockServicerImpl_Context(ContextServiceServicer): def RemoveService(self, request: ServiceId, context : grpc.ServicerContext) -> Empty: LOGGER.debug('[RemoveService] request={:s}'.format(grpc_message_to_json_string(request))) - context_uuid = str(request.service_id.context_id.context_uuid.uuid) + context_uuid = str(request.context_id.context_uuid.uuid) container_name = 'service[{:s}]'.format(context_uuid) service_uuid = request.service_uuid.uuid reply = self._del(request, container_name, service_uuid, 'service_id', TOPIC_SERVICE, context) -- GitLab From d6b2243cf01d842af08b3511b43f2d0dfd00ad94 Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Fri, 22 Dec 2023 10:21:10 +0000 Subject: [PATCH 2/8] NBI Component: - Extended PrepareTestScenario to support multiple REST methods - Updated unitary tests accordingly - Renamed test_unitary to test_ietf_l2vpn - Cosmetic changes in CI/CD pipeline - Fixed Python dependency versions in requirements file --- src/nbi/.gitlab-ci.yml | 20 +++++- src/nbi/requirements.in | 2 +- src/nbi/tests/PrepareTestScenario.py | 70 +++++++++++++++++-- src/nbi/tests/test_debug_api.py | 68 ++++++++---------- .../{test_unitary.py => test_ietf_l2vpn.py} | 0 src/nbi/tests/test_ietf_network.py | 4 +- 6 files changed, 113 insertions(+), 51 deletions(-) rename src/nbi/tests/{test_unitary.py => test_ietf_l2vpn.py} (100%) diff --git a/src/nbi/.gitlab-ci.yml b/src/nbi/.gitlab-ci.yml index 7d98e6160..8711cfb72 100644 --- a/src/nbi/.gitlab-ci.yml +++ b/src/nbi/.gitlab-ci.yml @@ -48,15 +48,29 @@ unit_test nbi: - build nbi before_script: - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY - - if docker network list | grep teraflowbridge; then echo "teraflowbridge is already created"; else docker network create -d bridge teraflowbridge; fi - - if docker container ls | grep $IMAGE_NAME; then docker rm -f $IMAGE_NAME; else echo "$IMAGE_NAME image is not in the system"; fi + - > + if docker network list | grep teraflowbridge; then + echo "teraflowbridge is already created"; + else + docker network create -d bridge teraflowbridge; + fi + - > + if docker container ls | grep $IMAGE_NAME; then + docker rm -f $IMAGE_NAME; + else + echo "$IMAGE_NAME image is not in the system"; + fi script: - docker pull "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG" - docker run --name $IMAGE_NAME -d -p 9090:9090 -v "$PWD/src/$IMAGE_NAME/tests:/opt/results" --network=teraflowbridge $CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG - sleep 5 - docker ps -a - docker logs $IMAGE_NAME - - docker exec -i $IMAGE_NAME bash -c "coverage run -m pytest --log-level=INFO --verbose $IMAGE_NAME/tests/test_unitary.py $IMAGE_NAME/tests/test_ietf_network.py --junitxml=/opt/results/${IMAGE_NAME}_report.xml" + - > + docker exec -i $IMAGE_NAME bash -c "coverage run -m pytest --log-level=INFO --verbose + $IMAGE_NAME/tests/test_ietf_l2vpn.py + $IMAGE_NAME/tests/test_ietf_network.py + --junitxml=/opt/results/${IMAGE_NAME}_report.xml" - docker exec -i $IMAGE_NAME bash -c "coverage report --include='${IMAGE_NAME}/*' --show-missing" coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/' after_script: diff --git a/src/nbi/requirements.in b/src/nbi/requirements.in index 69978edc0..a1da58d01 100644 --- a/src/nbi/requirements.in +++ b/src/nbi/requirements.in @@ -17,7 +17,7 @@ Flask==2.1.3 Flask-HTTPAuth==4.5.0 Flask-RESTful==0.3.9 jsonschema==4.4.0 -pyang +pyang==2.6.0 git+https://github.com/robshakir/pyangbind.git requests==2.27.1 werkzeug==2.3.7 diff --git a/src/nbi/tests/PrepareTestScenario.py b/src/nbi/tests/PrepareTestScenario.py index c3461da61..88a77b6e0 100644 --- a/src/nbi/tests/PrepareTestScenario.py +++ b/src/nbi/tests/PrepareTestScenario.py @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import logging, os, pytest, requests, time -from typing import Dict, List, Optional, Set, Union +import enum, logging, os, pytest, requests, time +from typing import Any, Dict, List, Optional, Set, Union from common.Constants import ServiceNameEnum from common.Settings import ( ENVVAR_SUFIX_SERVICE_HOST, ENVVAR_SUFIX_SERVICE_PORT_HTTP, @@ -79,17 +79,73 @@ def slice_client(mock_service : MockService_Dependencies): # pylint: disable=red yield _client _client.close() +class RestRequestMethod(enum.Enum): + GET = 'get' + POST = 'post' + PUT = 'put' + DELETE = 'delete' + +EXPECTED_STATUS_CODES : Set[int] = { + requests.codes['OK' ], + requests.codes['CREATED' ], + requests.codes['ACCEPTED' ], + requests.codes['NO_CONTENT'], +} + def do_rest_request( - url : str, logger : Optional[logging.Logger] = None, timeout=10, expected_status_codes : Set[int] = {200} -) -> Union[Dict, List]: + method : RestRequestMethod, url : str, body : Optional[Any] = None, timeout : int = 10, + allow_redirects : bool = True, expected_status_codes : Set[int] = EXPECTED_STATUS_CODES, + logger : Optional[logging.Logger] = None +) -> Optional[Union[Dict, List]]: base_url = get_service_baseurl_http(ServiceNameEnum.NBI) or '' request_url = 'http://{:s}:{:s}@{:s}:{:d}{:s}{:s}'.format( USERNAME, PASSWORD, LOCAL_HOST, NBI_SERVICE_PORT, str(base_url), url ) if logger is not None: - logger.warning('Request: GET {:s}'.format(str(request_url))) - reply = requests.get(request_url, timeout=timeout) + msg = 'Request: {:s} {:s}'.format(str(method.value).upper(), str(request_url)) + if body is not None: msg += ' body={:s}'.format(str(body)) + logger.warning(msg) + reply = requests.request(method.value, request_url, timeout=timeout, json=body, allow_redirects=allow_redirects) if logger is not None: logger.warning('Reply: {:s}'.format(str(reply.text))) assert reply.status_code in expected_status_codes, 'Reply failed with status code {:d}'.format(reply.status_code) - return reply.json() + + if reply.content and len(reply.content) > 0: return reply.json() + return None + +def do_rest_get_request( + url : str, body : Optional[Any] = None, timeout : int = 10, + allow_redirects : bool = True, expected_status_codes : Set[int] = EXPECTED_STATUS_CODES, + logger : Optional[logging.Logger] = None +) -> Union[Dict, List]: + return do_rest_request( + RestRequestMethod.GET, url, body=body, timeout=timeout, allow_redirects=allow_redirects, + expected_status_codes=expected_status_codes, logger=logger + ) + +def do_rest_post_request(url : str, body : Optional[Any] = None, timeout : int = 10, + allow_redirects : bool = True, expected_status_codes : Set[int] = EXPECTED_STATUS_CODES, + logger : Optional[logging.Logger] = None +) -> Union[Dict, List]: + return do_rest_request( + RestRequestMethod.POST, url, body=body, timeout=timeout, allow_redirects=allow_redirects, + expected_status_codes=expected_status_codes, logger=logger + ) + +def do_rest_put_request(url : str, body : Optional[Any] = None, timeout : int = 10, + allow_redirects : bool = True, expected_status_codes : Set[int] = EXPECTED_STATUS_CODES, + logger : Optional[logging.Logger] = None +) -> Union[Dict, List]: + return do_rest_request( + RestRequestMethod.PUT, url, body=body, timeout=timeout, allow_redirects=allow_redirects, + expected_status_codes=expected_status_codes, logger=logger + ) + +def do_rest_delete_request(url : str, body : Optional[Any] = None, timeout : int = 10, + allow_redirects : bool = True, expected_status_codes : Set[int] = EXPECTED_STATUS_CODES, + logger : Optional[logging.Logger] = None +) -> Union[Dict, List]: + return do_rest_request( + RestRequestMethod.DELETE, url, body=body, timeout=timeout, allow_redirects=allow_redirects, + expected_status_codes=expected_status_codes, logger=logger + ) diff --git a/src/nbi/tests/test_debug_api.py b/src/nbi/tests/test_debug_api.py index 06ad8cedc..e28499261 100644 --- a/src/nbi/tests/test_debug_api.py +++ b/src/nbi/tests/test_debug_api.py @@ -12,27 +12,29 @@ # See the License for the specific language governing permissions and # limitations under the License. -import logging, os, pytest, requests, time, urllib -from typing import Tuple +import logging, os, pytest, time, urllib from common.Constants import DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME, ServiceNameEnum from common.proto.context_pb2 import Connection, Context, Device, Link, Service, Slice, Topology from common.proto.policy_pb2 import PolicyRuleIdList, PolicyRuleId, PolicyRuleList, PolicyRule from common.Settings import ( ENVVAR_SUFIX_SERVICE_HOST, ENVVAR_SUFIX_SERVICE_PORT_GRPC, ENVVAR_SUFIX_SERVICE_PORT_HTTP, get_env_var_name, - get_service_baseurl_http, get_service_port_grpc, get_service_port_http) + get_service_port_grpc, get_service_port_http +) from common.type_checkers.Assertions import ( validate_connection, validate_connection_ids, validate_connections, validate_context, validate_context_ids, validate_contexts, validate_device, validate_device_ids, validate_devices, validate_link, validate_link_ids, validate_links, validate_service, validate_service_ids, validate_services, validate_topologies, validate_topology, validate_topology_ids) from context.client.ContextClient import ContextClient +from nbi.tests.PrepareTestScenario import do_rest_get_request from .MockService_Dependencies import MockService_Dependencies from .Objects import ( CONNECTION_R1_R3, CONNECTION_R1_R3_ID, CONNECTION_R1_R3_UUID, CONTEXT, CONTEXT_ID, DEVICE_R1, DEVICE_R1_ID, DEVICE_R1_UUID, DEVICE_R2, DEVICE_R2_ID, DEVICE_R2_UUID, DEVICE_R3, DEVICE_R3_ID, DEVICE_R3_UUID, LINK_R1_R2, LINK_R1_R2_ID, LINK_R1_R2_UUID, SERVICE_R1_R2, SERVICE_R1_R2_ID, SERVICE_R1_R2_UUID, SERVICE_R1_R3, SERVICE_R1_R3_ID, SERVICE_R1_R3_UUID, SERVICE_R2_R3, SERVICE_R2_R3_ID, SERVICE_R2_R3_UUID, SLICE_R1_R3, TOPOLOGY, - TOPOLOGY_ID, POLICY_RULE, POLICY_RULE_ID, POLICY_RULE_UUID) + TOPOLOGY_ID, POLICY_RULE, POLICY_RULE_ID, POLICY_RULE_UUID +) @pytest.fixture(scope='session') @@ -100,129 +102,119 @@ def test_populate_database(): client.SetSlice(Slice(**SLICE_R1_R3)) client.SetConnection(Connection(**CONNECTION_R1_R3)) -def do_rest_request(url : str): - base_url = get_service_baseurl_http(ServiceNameEnum.CONTEXT) - request_url = 'http://{:s}:{:s}{:s}{:s}'.format(str(LOCAL_HOST), str(HTTP_PORT), str(base_url), url) - LOGGER.warning('Request: GET {:s}'.format(str(request_url))) - reply = requests.get(request_url) - LOGGER.warning('Reply: {:s}'.format(str(reply.text))) - assert reply.status_code == 200, 'Reply failed with code {}'.format(reply.status_code) - return reply.json() - - def test_rest_get_context_ids(context_service_rest : RestServer): # pylint: disable=redefined-outer-name - reply = do_rest_request('/context_ids') + reply = do_rest_get_request('/context_ids') validate_context_ids(reply) def test_rest_get_contexts(context_service_rest : RestServer): # pylint: disable=redefined-outer-name - reply = do_rest_request('/contexts') + reply = do_rest_get_request('/contexts') validate_contexts(reply) def test_rest_get_context(context_service_rest : RestServer): # pylint: disable=redefined-outer-name context_uuid = urllib.parse.quote(DEFAULT_CONTEXT_NAME) - reply = do_rest_request('/context/{:s}'.format(context_uuid)) + reply = do_rest_get_request('/context/{:s}'.format(context_uuid)) validate_context(reply) def test_rest_get_topology_ids(context_service_rest : RestServer): # pylint: disable=redefined-outer-name context_uuid = urllib.parse.quote(DEFAULT_CONTEXT_NAME) - reply = do_rest_request('/context/{:s}/topology_ids'.format(context_uuid)) + reply = do_rest_get_request('/context/{:s}/topology_ids'.format(context_uuid)) validate_topology_ids(reply) def test_rest_get_topologies(context_service_rest : RestServer): # pylint: disable=redefined-outer-name context_uuid = urllib.parse.quote(DEFAULT_CONTEXT_NAME) - reply = do_rest_request('/context/{:s}/topologies'.format(context_uuid)) + reply = do_rest_get_request('/context/{:s}/topologies'.format(context_uuid)) validate_topologies(reply) def test_rest_get_topology(context_service_rest : RestServer): # pylint: disable=redefined-outer-name context_uuid = urllib.parse.quote(DEFAULT_CONTEXT_NAME) topology_uuid = urllib.parse.quote(DEFAULT_TOPOLOGY_NAME) - reply = do_rest_request('/context/{:s}/topology/{:s}'.format(context_uuid, topology_uuid)) + reply = do_rest_get_request('/context/{:s}/topology/{:s}'.format(context_uuid, topology_uuid)) validate_topology(reply, num_devices=3, num_links=3) def test_rest_get_service_ids(context_service_rest : RestServer): # pylint: disable=redefined-outer-name context_uuid = urllib.parse.quote(DEFAULT_CONTEXT_NAME) - reply = do_rest_request('/context/{:s}/service_ids'.format(context_uuid)) + reply = do_rest_get_request('/context/{:s}/service_ids'.format(context_uuid)) validate_service_ids(reply) def test_rest_get_services(context_service_rest : RestServer): # pylint: disable=redefined-outer-name context_uuid = urllib.parse.quote(DEFAULT_CONTEXT_NAME) - reply = do_rest_request('/context/{:s}/services'.format(context_uuid)) + reply = do_rest_get_request('/context/{:s}/services'.format(context_uuid)) validate_services(reply) def test_rest_get_service(context_service_rest : RestServer): # pylint: disable=redefined-outer-name context_uuid = urllib.parse.quote(DEFAULT_CONTEXT_NAME) service_uuid = urllib.parse.quote(SERVICE_R1_R2_UUID, safe='') - reply = do_rest_request('/context/{:s}/service/{:s}'.format(context_uuid, service_uuid)) + reply = do_rest_get_request('/context/{:s}/service/{:s}'.format(context_uuid, service_uuid)) validate_service(reply) def test_rest_get_slice_ids(context_service_rest : RestServer): # pylint: disable=redefined-outer-name context_uuid = urllib.parse.quote(DEFAULT_CONTEXT_NAME) - reply = do_rest_request('/context/{:s}/slice_ids'.format(context_uuid)) + reply = do_rest_get_request('/context/{:s}/slice_ids'.format(context_uuid)) #validate_slice_ids(reply) def test_rest_get_slices(context_service_rest : RestServer): # pylint: disable=redefined-outer-name context_uuid = urllib.parse.quote(DEFAULT_CONTEXT_NAME) - reply = do_rest_request('/context/{:s}/slices'.format(context_uuid)) + reply = do_rest_get_request('/context/{:s}/slices'.format(context_uuid)) #validate_slices(reply) def test_rest_get_slice(context_service_rest : RestServer): # pylint: disable=redefined-outer-name context_uuid = urllib.parse.quote(DEFAULT_CONTEXT_NAME) slice_uuid = urllib.parse.quote(SLICE_R1_R3_UUID, safe='') - reply = do_rest_request('/context/{:s}/slice/{:s}'.format(context_uuid, slice_uuid)) + reply = do_rest_get_request('/context/{:s}/slice/{:s}'.format(context_uuid, slice_uuid)) #validate_slice(reply) def test_rest_get_device_ids(context_service_rest : RestServer): # pylint: disable=redefined-outer-name - reply = do_rest_request('/device_ids') + reply = do_rest_get_request('/device_ids') validate_device_ids(reply) def test_rest_get_devices(context_service_rest : RestServer): # pylint: disable=redefined-outer-name - reply = do_rest_request('/devices') + reply = do_rest_get_request('/devices') validate_devices(reply) def test_rest_get_device(context_service_rest : RestServer): # pylint: disable=redefined-outer-name device_uuid = urllib.parse.quote(DEVICE_R1_UUID, safe='') - reply = do_rest_request('/device/{:s}'.format(device_uuid)) + reply = do_rest_get_request('/device/{:s}'.format(device_uuid)) validate_device(reply) def test_rest_get_link_ids(context_service_rest : RestServer): # pylint: disable=redefined-outer-name - reply = do_rest_request('/link_ids') + reply = do_rest_get_request('/link_ids') validate_link_ids(reply) def test_rest_get_links(context_service_rest : RestServer): # pylint: disable=redefined-outer-name - reply = do_rest_request('/links') + reply = do_rest_get_request('/links') validate_links(reply) def test_rest_get_link(context_service_rest : RestServer): # pylint: disable=redefined-outer-name link_uuid = urllib.parse.quote(LINK_R1_R2_UUID, safe='') - reply = do_rest_request('/link/{:s}'.format(link_uuid)) + reply = do_rest_get_request('/link/{:s}'.format(link_uuid)) validate_link(reply) def test_rest_get_connection_ids(context_service_rest : RestServer): # pylint: disable=redefined-outer-name context_uuid = urllib.parse.quote(DEFAULT_CONTEXT_NAME) service_uuid = urllib.parse.quote(SERVICE_R1_R3_UUID, safe='') - reply = do_rest_request('/context/{:s}/service/{:s}/connection_ids'.format(context_uuid, service_uuid)) + reply = do_rest_get_request('/context/{:s}/service/{:s}/connection_ids'.format(context_uuid, service_uuid)) validate_connection_ids(reply) def test_rest_get_connections(context_service_rest : RestServer): # pylint: disable=redefined-outer-name context_uuid = urllib.parse.quote(DEFAULT_CONTEXT_NAME) service_uuid = urllib.parse.quote(SERVICE_R1_R3_UUID, safe='') - reply = do_rest_request('/context/{:s}/service/{:s}/connections'.format(context_uuid, service_uuid)) + reply = do_rest_get_request('/context/{:s}/service/{:s}/connections'.format(context_uuid, service_uuid)) validate_connections(reply) def test_rest_get_connection(context_service_rest : RestServer): # pylint: disable=redefined-outer-name connection_uuid = urllib.parse.quote(CONNECTION_R1_R3_UUID, safe='') - reply = do_rest_request('/connection/{:s}'.format(connection_uuid)) + reply = do_rest_get_request('/connection/{:s}'.format(connection_uuid)) validate_connection(reply) def test_rest_get_policyrule_ids(context_service_rest : RestServer): # pylint: disable=redefined-outer-name - reply = do_rest_request('/policyrule_ids') + reply = do_rest_get_request('/policyrule_ids') #validate_policyrule_ids(reply) def test_rest_get_policyrules(context_service_rest : RestServer): # pylint: disable=redefined-outer-name - reply = do_rest_request('/policyrules') + reply = do_rest_get_request('/policyrules') #validate_policyrules(reply) def test_rest_get_policyrule(context_service_rest : RestServer): # pylint: disable=redefined-outer-name policyrule_uuid = urllib.parse.quote(POLICYRULE_UUID, safe='') - reply = do_rest_request('/policyrule/{:s}'.format(policyrule_uuid)) + reply = do_rest_get_request('/policyrule/{:s}'.format(policyrule_uuid)) #validate_policyrule(reply) diff --git a/src/nbi/tests/test_unitary.py b/src/nbi/tests/test_ietf_l2vpn.py similarity index 100% rename from src/nbi/tests/test_unitary.py rename to src/nbi/tests/test_ietf_l2vpn.py diff --git a/src/nbi/tests/test_ietf_network.py b/src/nbi/tests/test_ietf_network.py index 6fa09dd65..78338c88f 100644 --- a/src/nbi/tests/test_ietf_network.py +++ b/src/nbi/tests/test_ietf_network.py @@ -23,7 +23,7 @@ from context.client.ContextClient import ContextClient from nbi.service.rest_server import RestServer from .PrepareTestScenario import ( # pylint: disable=unused-import # be careful, order of symbols is important here! - do_rest_request, mock_service, nbi_service_rest, osm_wim, context_client) + do_rest_get_request, mock_service, nbi_service_rest, osm_wim, context_client) LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.DEBUG) @@ -79,7 +79,7 @@ def test_rest_get_networks(nbi_service_rest : RestServer): # pylint: disable=red with open(TARGET_DATA_FILE, 'r', encoding='UTF-8') as f: target_data = json.load(f) URL = '/restconf/data/ietf-network:networks' - retrieved_data = do_rest_request(URL, logger=LOGGER, expected_status_codes={200}) + retrieved_data = do_rest_get_request(URL, logger=LOGGER, expected_status_codes={200}) sort_data(retrieved_data) sort_data(target_data) diff_data = deepdiff.DeepDiff(target_data, retrieved_data) -- GitLab From d5c00e1bec2e6da0925d45826cdf3c997f3cf32f Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Fri, 22 Dec 2023 11:24:43 +0000 Subject: [PATCH 3/8] NBI Component: - Corrected unitary test for IETF L2VPNs - Added required descriptors --- .../data/topology-7router-emu-dummy.json | 157 ++++++++++++++++++ src/nbi/tests/data/topology-7router-emu.json | 156 +++++++++++++++++ src/nbi/tests/test_ietf_l2vpn.py | 46 ++++- 3 files changed, 354 insertions(+), 5 deletions(-) create mode 100644 src/nbi/tests/data/topology-7router-emu-dummy.json create mode 100644 src/nbi/tests/data/topology-7router-emu.json diff --git a/src/nbi/tests/data/topology-7router-emu-dummy.json b/src/nbi/tests/data/topology-7router-emu-dummy.json new file mode 100644 index 000000000..3bb622626 --- /dev/null +++ b/src/nbi/tests/data/topology-7router-emu-dummy.json @@ -0,0 +1,157 @@ +{ + "dummy_mode": true, + "contexts": [ + {"context_id": {"context_uuid": {"uuid": "admin"}}} + ], + "topologies": [ + {"topology_id": {"context_id": {"context_uuid": {"uuid": "admin"}}, "topology_uuid": {"uuid": "admin"}}} + ], + "devices": [ + {"device_id": {"device_uuid": {"uuid": "R1"}}, "device_type": "emu-packet-router", "device_drivers": [0], + "device_endpoints": [], "device_operational_status": 1, "device_config": {"config_rules": [ + {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "127.0.0.1"}}, + {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "0"}}, + {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": {"endpoints": [ + {"uuid": "1/1", "type": "copper"}, {"uuid": "1/2", "type": "copper"}, {"uuid": "1/3", "type": "copper"}, + {"uuid": "1/4", "type": "copper"}, {"uuid": "1/5", "type": "copper"}, {"uuid": "1/6", "type": "copper"}, + {"uuid": "2/1", "type": "copper"}, {"uuid": "2/2", "type": "copper"}, {"uuid": "2/3", "type": "copper"} + ]}}} + ]}}, + {"device_id": {"device_uuid": {"uuid": "R2"}}, "device_type": "emu-packet-router", "device_drivers": [0], + "device_endpoints": [], "device_operational_status": 1, "device_config": {"config_rules": [ + {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "127.0.0.1"}}, + {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "0"}}, + {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": {"endpoints": [ + {"uuid": "1/1", "type": "copper"}, {"uuid": "1/2", "type": "copper"}, {"uuid": "1/3", "type": "copper"}, + {"uuid": "1/4", "type": "copper"}, {"uuid": "1/5", "type": "copper"}, {"uuid": "1/6", "type": "copper"}, + {"uuid": "2/1", "type": "copper"}, {"uuid": "2/2", "type": "copper"}, {"uuid": "2/3", "type": "copper"} + ]}}} + ]}}, + {"device_id": {"device_uuid": {"uuid": "R3"}}, "device_type": "emu-packet-router", "device_drivers": [0], + "device_endpoints": [], "device_operational_status": 1, "device_config": {"config_rules": [ + {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "127.0.0.1"}}, + {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "0"}}, + {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": {"endpoints": [ + {"uuid": "1/1", "type": "copper"}, {"uuid": "1/2", "type": "copper"}, {"uuid": "1/3", "type": "copper"}, + {"uuid": "1/4", "type": "copper"}, {"uuid": "1/5", "type": "copper"}, {"uuid": "1/6", "type": "copper"}, + {"uuid": "2/1", "type": "copper"}, {"uuid": "2/2", "type": "copper"}, {"uuid": "2/3", "type": "copper"} + ]}}} + ]}}, + {"device_id": {"device_uuid": {"uuid": "R4"}}, "device_type": "emu-packet-router", "device_drivers": [0], + "device_endpoints": [], "device_operational_status": 1, "device_config": {"config_rules": [ + {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "127.0.0.1"}}, + {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "0"}}, + {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": {"endpoints": [ + {"uuid": "1/1", "type": "copper"}, {"uuid": "1/2", "type": "copper"}, {"uuid": "1/3", "type": "copper"}, + {"uuid": "1/4", "type": "copper"}, {"uuid": "1/5", "type": "copper"}, {"uuid": "1/6", "type": "copper"}, + {"uuid": "2/1", "type": "copper"}, {"uuid": "2/2", "type": "copper"}, {"uuid": "2/3", "type": "copper"} + ]}}} + ]}}, + {"device_id": {"device_uuid": {"uuid": "R5"}}, "device_type": "emu-packet-router", "device_drivers": [0], + "device_endpoints": [], "device_operational_status": 1, "device_config": {"config_rules": [ + {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "127.0.0.1"}}, + {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "0"}}, + {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": {"endpoints": [ + {"uuid": "1/1", "type": "copper"}, {"uuid": "1/2", "type": "copper"}, {"uuid": "1/3", "type": "copper"}, + {"uuid": "1/4", "type": "copper"}, {"uuid": "1/5", "type": "copper"}, {"uuid": "1/6", "type": "copper"}, + {"uuid": "2/1", "type": "copper"}, {"uuid": "2/2", "type": "copper"}, {"uuid": "2/3", "type": "copper"} + ]}}} + ]}}, + {"device_id": {"device_uuid": {"uuid": "R6"}}, "device_type": "emu-packet-router", "device_drivers": [0], + "device_endpoints": [], "device_operational_status": 1, "device_config": {"config_rules": [ + {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "127.0.0.1"}}, + {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "0"}}, + {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": {"endpoints": [ + {"uuid": "1/1", "type": "copper"}, {"uuid": "1/2", "type": "copper"}, {"uuid": "1/3", "type": "copper"}, + {"uuid": "1/4", "type": "copper"}, {"uuid": "1/5", "type": "copper"}, {"uuid": "1/6", "type": "copper"}, + {"uuid": "2/1", "type": "copper"}, {"uuid": "2/2", "type": "copper"}, {"uuid": "2/3", "type": "copper"} + ]}}} + ]}}, + {"device_id": {"device_uuid": {"uuid": "R7"}}, "device_type": "emu-packet-router", "device_drivers": [0], + "device_endpoints": [], "device_operational_status": 1, "device_config": {"config_rules": [ + {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "127.0.0.1"}}, + {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "0"}}, + {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": {"endpoints": [ + {"uuid": "1/1", "type": "copper"}, {"uuid": "1/2", "type": "copper"}, + {"uuid": "1/3", "type": "copper"}, {"uuid": "2/1", "type": "copper"}, + {"uuid": "2/2", "type": "copper"}, {"uuid": "2/3", "type": "copper"}, + {"uuid": "2/4", "type": "copper"}, {"uuid": "2/5", "type": "copper"}, + {"uuid": "2/6", "type": "copper"} + ]}}} + ]}} + ], + "links": [ + {"link_id": {"link_uuid": {"uuid": "R1==R2"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R1"}}, "endpoint_uuid": {"uuid": "2/1"}}, + {"device_id": {"device_uuid": {"uuid": "R2"}}, "endpoint_uuid": {"uuid": "2/2"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R1==R6"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R1"}}, "endpoint_uuid": {"uuid": "2/2"}}, + {"device_id": {"device_uuid": {"uuid": "R6"}}, "endpoint_uuid": {"uuid": "2/1"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R1==R7"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R1"}}, "endpoint_uuid": {"uuid": "2/3"}}, + {"device_id": {"device_uuid": {"uuid": "R7"}}, "endpoint_uuid": {"uuid": "2/1"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R2==R1"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R2"}}, "endpoint_uuid": {"uuid": "2/2"}}, + {"device_id": {"device_uuid": {"uuid": "R1"}}, "endpoint_uuid": {"uuid": "2/1"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R2==R3"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R2"}}, "endpoint_uuid": {"uuid": "2/1"}}, + {"device_id": {"device_uuid": {"uuid": "R3"}}, "endpoint_uuid": {"uuid": "2/2"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R3==R2"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R3"}}, "endpoint_uuid": {"uuid": "2/2"}}, + {"device_id": {"device_uuid": {"uuid": "R2"}}, "endpoint_uuid": {"uuid": "2/1"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R3==R4"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R3"}}, "endpoint_uuid": {"uuid": "2/1"}}, + {"device_id": {"device_uuid": {"uuid": "R4"}}, "endpoint_uuid": {"uuid": "2/2"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R3==R7"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R3"}}, "endpoint_uuid": {"uuid": "2/3"}}, + {"device_id": {"device_uuid": {"uuid": "R7"}}, "endpoint_uuid": {"uuid": "2/3"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R4==R3"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R4"}}, "endpoint_uuid": {"uuid": "2/2"}}, + {"device_id": {"device_uuid": {"uuid": "R3"}}, "endpoint_uuid": {"uuid": "2/1"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R4==R5"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R4"}}, "endpoint_uuid": {"uuid": "2/1"}}, + {"device_id": {"device_uuid": {"uuid": "R5"}}, "endpoint_uuid": {"uuid": "2/2"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R5==R4"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R5"}}, "endpoint_uuid": {"uuid": "2/2"}}, + {"device_id": {"device_uuid": {"uuid": "R4"}}, "endpoint_uuid": {"uuid": "2/1"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R5==R6"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R5"}}, "endpoint_uuid": {"uuid": "2/1"}}, + {"device_id": {"device_uuid": {"uuid": "R6"}}, "endpoint_uuid": {"uuid": "2/2"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R5==R7"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R5"}}, "endpoint_uuid": {"uuid": "2/3"}}, + {"device_id": {"device_uuid": {"uuid": "R7"}}, "endpoint_uuid": {"uuid": "2/5"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R6==R1"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R6"}}, "endpoint_uuid": {"uuid": "2/1"}}, + {"device_id": {"device_uuid": {"uuid": "R1"}}, "endpoint_uuid": {"uuid": "2/2"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R6==R5"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R6"}}, "endpoint_uuid": {"uuid": "2/2"}}, + {"device_id": {"device_uuid": {"uuid": "R5"}}, "endpoint_uuid": {"uuid": "2/1"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R7==R1"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R7"}}, "endpoint_uuid": {"uuid": "2/1"}}, + {"device_id": {"device_uuid": {"uuid": "R1"}}, "endpoint_uuid": {"uuid": "2/3"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R7==R3"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R7"}}, "endpoint_uuid": {"uuid": "2/3"}}, + {"device_id": {"device_uuid": {"uuid": "R3"}}, "endpoint_uuid": {"uuid": "2/3"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R7==R5"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R7"}}, "endpoint_uuid": {"uuid": "2/5"}}, + {"device_id": {"device_uuid": {"uuid": "R5"}}, "endpoint_uuid": {"uuid": "2/3"}} + ]} + ] +} diff --git a/src/nbi/tests/data/topology-7router-emu.json b/src/nbi/tests/data/topology-7router-emu.json new file mode 100644 index 000000000..4174f4fb4 --- /dev/null +++ b/src/nbi/tests/data/topology-7router-emu.json @@ -0,0 +1,156 @@ +{ + "contexts": [ + {"context_id": {"context_uuid": {"uuid": "admin"}}} + ], + "topologies": [ + {"topology_id": {"context_id": {"context_uuid": {"uuid": "admin"}}, "topology_uuid": {"uuid": "admin"}}} + ], + "devices": [ + {"device_id": {"device_uuid": {"uuid": "R1"}}, "device_type": "emu-packet-router", "device_drivers": [0], + "device_endpoints": [], "device_operational_status": 1, "device_config": {"config_rules": [ + {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "127.0.0.1"}}, + {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "0"}}, + {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": {"endpoints": [ + {"uuid": "1/1", "type": "copper"}, {"uuid": "1/2", "type": "copper"}, {"uuid": "1/3", "type": "copper"}, + {"uuid": "1/4", "type": "copper"}, {"uuid": "1/5", "type": "copper"}, {"uuid": "1/6", "type": "copper"}, + {"uuid": "2/1", "type": "copper"}, {"uuid": "2/2", "type": "copper"}, {"uuid": "2/3", "type": "copper"} + ]}}} + ]}}, + {"device_id": {"device_uuid": {"uuid": "R2"}}, "device_type": "emu-packet-router", "device_drivers": [0], + "device_endpoints": [], "device_operational_status": 1, "device_config": {"config_rules": [ + {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "127.0.0.1"}}, + {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "0"}}, + {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": {"endpoints": [ + {"uuid": "1/1", "type": "copper"}, {"uuid": "1/2", "type": "copper"}, {"uuid": "1/3", "type": "copper"}, + {"uuid": "1/4", "type": "copper"}, {"uuid": "1/5", "type": "copper"}, {"uuid": "1/6", "type": "copper"}, + {"uuid": "2/1", "type": "copper"}, {"uuid": "2/2", "type": "copper"}, {"uuid": "2/3", "type": "copper"} + ]}}} + ]}}, + {"device_id": {"device_uuid": {"uuid": "R3"}}, "device_type": "emu-packet-router", "device_drivers": [0], + "device_endpoints": [], "device_operational_status": 1, "device_config": {"config_rules": [ + {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "127.0.0.1"}}, + {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "0"}}, + {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": {"endpoints": [ + {"uuid": "1/1", "type": "copper"}, {"uuid": "1/2", "type": "copper"}, {"uuid": "1/3", "type": "copper"}, + {"uuid": "1/4", "type": "copper"}, {"uuid": "1/5", "type": "copper"}, {"uuid": "1/6", "type": "copper"}, + {"uuid": "2/1", "type": "copper"}, {"uuid": "2/2", "type": "copper"}, {"uuid": "2/3", "type": "copper"} + ]}}} + ]}}, + {"device_id": {"device_uuid": {"uuid": "R4"}}, "device_type": "emu-packet-router", "device_drivers": [0], + "device_endpoints": [], "device_operational_status": 1, "device_config": {"config_rules": [ + {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "127.0.0.1"}}, + {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "0"}}, + {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": {"endpoints": [ + {"uuid": "1/1", "type": "copper"}, {"uuid": "1/2", "type": "copper"}, {"uuid": "1/3", "type": "copper"}, + {"uuid": "1/4", "type": "copper"}, {"uuid": "1/5", "type": "copper"}, {"uuid": "1/6", "type": "copper"}, + {"uuid": "2/1", "type": "copper"}, {"uuid": "2/2", "type": "copper"}, {"uuid": "2/3", "type": "copper"} + ]}}} + ]}}, + {"device_id": {"device_uuid": {"uuid": "R5"}}, "device_type": "emu-packet-router", "device_drivers": [0], + "device_endpoints": [], "device_operational_status": 1, "device_config": {"config_rules": [ + {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "127.0.0.1"}}, + {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "0"}}, + {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": {"endpoints": [ + {"uuid": "1/1", "type": "copper"}, {"uuid": "1/2", "type": "copper"}, {"uuid": "1/3", "type": "copper"}, + {"uuid": "1/4", "type": "copper"}, {"uuid": "1/5", "type": "copper"}, {"uuid": "1/6", "type": "copper"}, + {"uuid": "2/1", "type": "copper"}, {"uuid": "2/2", "type": "copper"}, {"uuid": "2/3", "type": "copper"} + ]}}} + ]}}, + {"device_id": {"device_uuid": {"uuid": "R6"}}, "device_type": "emu-packet-router", "device_drivers": [0], + "device_endpoints": [], "device_operational_status": 1, "device_config": {"config_rules": [ + {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "127.0.0.1"}}, + {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "0"}}, + {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": {"endpoints": [ + {"uuid": "1/1", "type": "copper"}, {"uuid": "1/2", "type": "copper"}, {"uuid": "1/3", "type": "copper"}, + {"uuid": "1/4", "type": "copper"}, {"uuid": "1/5", "type": "copper"}, {"uuid": "1/6", "type": "copper"}, + {"uuid": "2/1", "type": "copper"}, {"uuid": "2/2", "type": "copper"}, {"uuid": "2/3", "type": "copper"} + ]}}} + ]}}, + {"device_id": {"device_uuid": {"uuid": "R7"}}, "device_type": "emu-packet-router", "device_drivers": [0], + "device_endpoints": [], "device_operational_status": 1, "device_config": {"config_rules": [ + {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "127.0.0.1"}}, + {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "0"}}, + {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": {"endpoints": [ + {"uuid": "1/1", "type": "copper"}, {"uuid": "1/2", "type": "copper"}, + {"uuid": "1/3", "type": "copper"}, {"uuid": "2/1", "type": "copper"}, + {"uuid": "2/2", "type": "copper"}, {"uuid": "2/3", "type": "copper"}, + {"uuid": "2/4", "type": "copper"}, {"uuid": "2/5", "type": "copper"}, + {"uuid": "2/6", "type": "copper"} + ]}}} + ]}} + ], + "links": [ + {"link_id": {"link_uuid": {"uuid": "R1==R2"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R1"}}, "endpoint_uuid": {"uuid": "2/1"}}, + {"device_id": {"device_uuid": {"uuid": "R2"}}, "endpoint_uuid": {"uuid": "2/2"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R1==R6"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R1"}}, "endpoint_uuid": {"uuid": "2/2"}}, + {"device_id": {"device_uuid": {"uuid": "R6"}}, "endpoint_uuid": {"uuid": "2/1"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R1==R7"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R1"}}, "endpoint_uuid": {"uuid": "2/3"}}, + {"device_id": {"device_uuid": {"uuid": "R7"}}, "endpoint_uuid": {"uuid": "2/1"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R2==R1"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R2"}}, "endpoint_uuid": {"uuid": "2/2"}}, + {"device_id": {"device_uuid": {"uuid": "R1"}}, "endpoint_uuid": {"uuid": "2/1"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R2==R3"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R2"}}, "endpoint_uuid": {"uuid": "2/1"}}, + {"device_id": {"device_uuid": {"uuid": "R3"}}, "endpoint_uuid": {"uuid": "2/2"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R3==R2"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R3"}}, "endpoint_uuid": {"uuid": "2/2"}}, + {"device_id": {"device_uuid": {"uuid": "R2"}}, "endpoint_uuid": {"uuid": "2/1"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R3==R4"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R3"}}, "endpoint_uuid": {"uuid": "2/1"}}, + {"device_id": {"device_uuid": {"uuid": "R4"}}, "endpoint_uuid": {"uuid": "2/2"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R3==R7"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R3"}}, "endpoint_uuid": {"uuid": "2/3"}}, + {"device_id": {"device_uuid": {"uuid": "R7"}}, "endpoint_uuid": {"uuid": "2/3"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R4==R3"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R4"}}, "endpoint_uuid": {"uuid": "2/2"}}, + {"device_id": {"device_uuid": {"uuid": "R3"}}, "endpoint_uuid": {"uuid": "2/1"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R4==R5"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R4"}}, "endpoint_uuid": {"uuid": "2/1"}}, + {"device_id": {"device_uuid": {"uuid": "R5"}}, "endpoint_uuid": {"uuid": "2/2"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R5==R4"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R5"}}, "endpoint_uuid": {"uuid": "2/2"}}, + {"device_id": {"device_uuid": {"uuid": "R4"}}, "endpoint_uuid": {"uuid": "2/1"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R5==R6"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R5"}}, "endpoint_uuid": {"uuid": "2/1"}}, + {"device_id": {"device_uuid": {"uuid": "R6"}}, "endpoint_uuid": {"uuid": "2/2"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R5==R7"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R5"}}, "endpoint_uuid": {"uuid": "2/3"}}, + {"device_id": {"device_uuid": {"uuid": "R7"}}, "endpoint_uuid": {"uuid": "2/5"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R6==R1"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R6"}}, "endpoint_uuid": {"uuid": "2/1"}}, + {"device_id": {"device_uuid": {"uuid": "R1"}}, "endpoint_uuid": {"uuid": "2/2"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R6==R5"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R6"}}, "endpoint_uuid": {"uuid": "2/2"}}, + {"device_id": {"device_uuid": {"uuid": "R5"}}, "endpoint_uuid": {"uuid": "2/1"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R7==R1"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R7"}}, "endpoint_uuid": {"uuid": "2/1"}}, + {"device_id": {"device_uuid": {"uuid": "R1"}}, "endpoint_uuid": {"uuid": "2/3"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R7==R3"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R7"}}, "endpoint_uuid": {"uuid": "2/3"}}, + {"device_id": {"device_uuid": {"uuid": "R3"}}, "endpoint_uuid": {"uuid": "2/3"}} + ]}, + {"link_id": {"link_uuid": {"uuid": "R7==R5"}}, "link_endpoint_ids": [ + {"device_id": {"device_uuid": {"uuid": "R7"}}, "endpoint_uuid": {"uuid": "2/5"}}, + {"device_id": {"device_uuid": {"uuid": "R5"}}, "endpoint_uuid": {"uuid": "2/3"}} + ]} + ] +} diff --git a/src/nbi/tests/test_ietf_l2vpn.py b/src/nbi/tests/test_ietf_l2vpn.py index 9aec95c68..22171ce70 100644 --- a/src/nbi/tests/test_ietf_l2vpn.py +++ b/src/nbi/tests/test_ietf_l2vpn.py @@ -13,27 +13,63 @@ # limitations under the License. import logging +from common.Constants import DEFAULT_CONTEXT_NAME +from common.proto.context_pb2 import ContextId +from common.tools.descriptor.Loader import DescriptorLoader, check_descriptor_load_results, validate_empty_scenario +from common.tools.object_factory.Context import json_context_id +from context.client.ContextClient import ContextClient from tests.tools.mock_osm.MockOSM import MockOSM from .Constants import SERVICE_CONNECTION_POINTS_1, SERVICE_CONNECTION_POINTS_2, SERVICE_TYPE from .PrepareTestScenario import ( # pylint: disable=unused-import # be careful, order of symbols is important here! - mock_service, nbi_service_rest, osm_wim) + mock_service, nbi_service_rest, osm_wim, context_client +) LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.DEBUG) +DESCRIPTOR_FILE = 'nbi/tests/data/topology-7router-emu-dummy.json' -def test_nbi_create_connectivity_service_rest_api(osm_wim : MockOSM): # pylint: disable=redefined-outer-name +JSON_ADMIN_CONTEXT_ID = json_context_id(DEFAULT_CONTEXT_NAME) +ADMIN_CONTEXT_ID = ContextId(**JSON_ADMIN_CONTEXT_ID) + +def test_prepare_environment(context_client : ContextClient) -> None: # pylint: disable=redefined-outer-name + validate_empty_scenario(context_client) + descriptor_loader = DescriptorLoader(descriptors_file=DESCRIPTOR_FILE, context_client=context_client) + results = descriptor_loader.process() + check_descriptor_load_results(results, descriptor_loader) + descriptor_loader.validate() + + # Verify the scenario has no services/slices + response = context_client.GetContext(ADMIN_CONTEXT_ID) + assert len(response.topology_ids) == 1 + assert len(response.service_ids ) == 0 + assert len(response.slice_ids ) == 0 + +def test_create_service(osm_wim : MockOSM): # pylint: disable=redefined-outer-name osm_wim.create_connectivity_service(SERVICE_TYPE, SERVICE_CONNECTION_POINTS_1) -def test_nbi_get_connectivity_service_status_rest_api(osm_wim : MockOSM): # pylint: disable=redefined-outer-name +def test_get_service_status(osm_wim : MockOSM): # pylint: disable=redefined-outer-name service_uuid = list(osm_wim.conn_info.keys())[0] # this test adds a single service osm_wim.get_connectivity_service_status(service_uuid) -def test_nbi_edit_connectivity_service_rest_api(osm_wim : MockOSM): # pylint: disable=redefined-outer-name +def test_edit_service(osm_wim : MockOSM): # pylint: disable=redefined-outer-name service_uuid = list(osm_wim.conn_info.keys())[0] # this test adds a single service osm_wim.edit_connectivity_service(service_uuid, SERVICE_CONNECTION_POINTS_2) -def test_nbi_delete_connectivity_service_rest_api(osm_wim : MockOSM): # pylint: disable=redefined-outer-name +def test_delete_service(osm_wim : MockOSM): # pylint: disable=redefined-outer-name service_uuid = list(osm_wim.conn_info.keys())[0] # this test adds a single service osm_wim.delete_connectivity_service(service_uuid) + +def test_cleanup_environment(context_client : ContextClient) -> None: # pylint: disable=redefined-outer-name + # Verify the scenario has no services/slices + response = context_client.GetContext(ADMIN_CONTEXT_ID) + assert len(response.topology_ids) == 1 + assert len(response.service_ids ) == 0 + assert len(response.slice_ids ) == 0 + + # Load descriptors and validate the base scenario + descriptor_loader = DescriptorLoader(descriptors_file=DESCRIPTOR_FILE, context_client=context_client) + descriptor_loader.validate() + descriptor_loader.unload() + validate_empty_scenario(context_client) -- GitLab From 8b10016fb78bd9fc954450f091f15970842e390b Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Fri, 22 Dec 2023 11:42:34 +0000 Subject: [PATCH 4/8] NBI Component: - Fixing GitLab CI/CD pipeline --- src/nbi/tests/test_ietf_l2vpn.py | 12 ++++++------ src/nbi/tests/test_ietf_network.py | 14 ++++++-------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/nbi/tests/test_ietf_l2vpn.py b/src/nbi/tests/test_ietf_l2vpn.py index 22171ce70..9e0c95fd8 100644 --- a/src/nbi/tests/test_ietf_l2vpn.py +++ b/src/nbi/tests/test_ietf_l2vpn.py @@ -33,7 +33,7 @@ DESCRIPTOR_FILE = 'nbi/tests/data/topology-7router-emu-dummy.json' JSON_ADMIN_CONTEXT_ID = json_context_id(DEFAULT_CONTEXT_NAME) ADMIN_CONTEXT_ID = ContextId(**JSON_ADMIN_CONTEXT_ID) -def test_prepare_environment(context_client : ContextClient) -> None: # pylint: disable=redefined-outer-name +def test_ietf_l2vpn_prepare_environment(context_client : ContextClient) -> None: # pylint: disable=redefined-outer-name validate_empty_scenario(context_client) descriptor_loader = DescriptorLoader(descriptors_file=DESCRIPTOR_FILE, context_client=context_client) results = descriptor_loader.process() @@ -46,22 +46,22 @@ def test_prepare_environment(context_client : ContextClient) -> None: # pylint: assert len(response.service_ids ) == 0 assert len(response.slice_ids ) == 0 -def test_create_service(osm_wim : MockOSM): # pylint: disable=redefined-outer-name +def test_ietf_l2vpn_create_service(osm_wim : MockOSM): # pylint: disable=redefined-outer-name osm_wim.create_connectivity_service(SERVICE_TYPE, SERVICE_CONNECTION_POINTS_1) -def test_get_service_status(osm_wim : MockOSM): # pylint: disable=redefined-outer-name +def test_ietf_l2vpn_get_service_status(osm_wim : MockOSM): # pylint: disable=redefined-outer-name service_uuid = list(osm_wim.conn_info.keys())[0] # this test adds a single service osm_wim.get_connectivity_service_status(service_uuid) -def test_edit_service(osm_wim : MockOSM): # pylint: disable=redefined-outer-name +def test_ietf_l2vpn_edit_service(osm_wim : MockOSM): # pylint: disable=redefined-outer-name service_uuid = list(osm_wim.conn_info.keys())[0] # this test adds a single service osm_wim.edit_connectivity_service(service_uuid, SERVICE_CONNECTION_POINTS_2) -def test_delete_service(osm_wim : MockOSM): # pylint: disable=redefined-outer-name +def test_ietf_l2vpn_delete_service(osm_wim : MockOSM): # pylint: disable=redefined-outer-name service_uuid = list(osm_wim.conn_info.keys())[0] # this test adds a single service osm_wim.delete_connectivity_service(service_uuid) -def test_cleanup_environment(context_client : ContextClient) -> None: # pylint: disable=redefined-outer-name +def test_ietf_l2vpn_cleanup_environment(context_client : ContextClient) -> None: # pylint: disable=redefined-outer-name # Verify the scenario has no services/slices response = context_client.GetContext(ADMIN_CONTEXT_ID) assert len(response.topology_ids) == 1 diff --git a/src/nbi/tests/test_ietf_network.py b/src/nbi/tests/test_ietf_network.py index 78338c88f..1977bd508 100644 --- a/src/nbi/tests/test_ietf_network.py +++ b/src/nbi/tests/test_ietf_network.py @@ -14,16 +14,15 @@ from typing import Dict import deepdiff, json, logging, operator -from common.Constants import DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME -from common.proto.context_pb2 import ContextId, TopologyId +from common.Constants import DEFAULT_CONTEXT_NAME from common.tools.descriptor.Loader import DescriptorLoader, check_descriptor_load_results, validate_empty_scenario from common.tools.object_factory.Context import json_context_id -from common.tools.object_factory.Topology import json_topology_id from context.client.ContextClient import ContextClient from nbi.service.rest_server import RestServer from .PrepareTestScenario import ( # pylint: disable=unused-import # be careful, order of symbols is important here! - do_rest_get_request, mock_service, nbi_service_rest, osm_wim, context_client) + do_rest_get_request, mock_service, nbi_service_rest, osm_wim, context_client +) LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.DEBUG) @@ -33,9 +32,8 @@ TARGET_DATA_FILE = 'nbi/tests/data/test-ietf-network.json' JSON_ADMIN_CONTEXT_ID = json_context_id(DEFAULT_CONTEXT_NAME) ADMIN_CONTEXT_ID = ContextId(**JSON_ADMIN_CONTEXT_ID) -ADMIN_TOPOLOGY_ID = TopologyId(**json_topology_id(DEFAULT_TOPOLOGY_NAME, context_id=JSON_ADMIN_CONTEXT_ID)) -def test_prepare_environment(context_client : ContextClient) -> None: # pylint: disable=redefined-outer-name +def test_ietf_network_prepare_environment(context_client : ContextClient) -> None: # pylint: disable=redefined-outer-name validate_empty_scenario(context_client) descriptor_loader = DescriptorLoader(descriptors_file=DESCRIPTOR_FILE, context_client=context_client) results = descriptor_loader.process() @@ -75,7 +73,7 @@ def sort_data(data : Dict) -> None: key=operator.itemgetter('link-id') ) -def test_rest_get_networks(nbi_service_rest : RestServer): # pylint: disable=redefined-outer-name, unused-argument +def test_ietf_network_rest_get_networks(nbi_service_rest : RestServer): # pylint: disable=redefined-outer-name, unused-argument with open(TARGET_DATA_FILE, 'r', encoding='UTF-8') as f: target_data = json.load(f) URL = '/restconf/data/ietf-network:networks' @@ -86,7 +84,7 @@ def test_rest_get_networks(nbi_service_rest : RestServer): # pylint: disable=red LOGGER.error('Differences:\n{:s}'.format(str(diff_data.pretty()))) assert len(diff_data) == 0 -def test_cleanup_environment(context_client : ContextClient) -> None: # pylint: disable=redefined-outer-name +def test_ietf_network_cleanup_environment(context_client : ContextClient) -> None: # pylint: disable=redefined-outer-name # Verify the scenario has no services/slices response = context_client.GetContext(ADMIN_CONTEXT_ID) assert len(response.topology_ids) == 1 -- GitLab From 75598da9a1d75965f5aa507d55bfeb660429fed6 Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Fri, 22 Dec 2023 11:54:01 +0000 Subject: [PATCH 5/8] NBI Component: - Fixing GitLab CI/CD pipeline - Updated script to manually launch IETF L2VPN test --- ...tests_locally-nbi.sh => run_tests_locally-nbi-ietf-l2vpn.sh} | 2 +- src/nbi/tests/test_ietf_network.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) rename scripts/{run_tests_locally-nbi.sh => run_tests_locally-nbi-ietf-l2vpn.sh} (96%) diff --git a/scripts/run_tests_locally-nbi.sh b/scripts/run_tests_locally-nbi-ietf-l2vpn.sh similarity index 96% rename from scripts/run_tests_locally-nbi.sh rename to scripts/run_tests_locally-nbi-ietf-l2vpn.sh index 1be045158..f6b53e432 100755 --- a/scripts/run_tests_locally-nbi.sh +++ b/scripts/run_tests_locally-nbi-ietf-l2vpn.sh @@ -21,4 +21,4 @@ RCFILE=$PROJECTDIR/coverage/.coveragerc # Run unitary tests and analyze coverage of code at same time coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \ - nbi/tests/test_unitary.py + nbi/tests/test_ietf_l2vpn.py diff --git a/src/nbi/tests/test_ietf_network.py b/src/nbi/tests/test_ietf_network.py index 1977bd508..78183c3da 100644 --- a/src/nbi/tests/test_ietf_network.py +++ b/src/nbi/tests/test_ietf_network.py @@ -15,6 +15,7 @@ from typing import Dict import deepdiff, json, logging, operator from common.Constants import DEFAULT_CONTEXT_NAME +from common.proto.context_pb2 import ContextId from common.tools.descriptor.Loader import DescriptorLoader, check_descriptor_load_results, validate_empty_scenario from common.tools.object_factory.Context import json_context_id from context.client.ContextClient import ContextClient -- GitLab From d2c9b727e7156b5d277a4088e7a4c6357a9f5c61 Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Fri, 22 Dec 2023 12:06:29 +0000 Subject: [PATCH 6/8] NBI Component: - Fixing GitLab CI/CD pipeline - Updated scripts to manually launch NBI tests --- scripts/run_tests_locally-nbi-all.sh | 26 +++++++++++++++++++++ scripts/run_tests_locally-nbi-ietf-l2vpn.sh | 1 + src/nbi/.gitlab-ci.yml | 2 +- 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100755 scripts/run_tests_locally-nbi-all.sh diff --git a/scripts/run_tests_locally-nbi-all.sh b/scripts/run_tests_locally-nbi-all.sh new file mode 100755 index 000000000..39930a677 --- /dev/null +++ b/scripts/run_tests_locally-nbi-all.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +PROJECTDIR=`pwd` + +cd $PROJECTDIR/src +RCFILE=$PROJECTDIR/coverage/.coveragerc + +# Run unitary tests and analyze coverage of code at same time +# helpful pytest flags: --log-level=INFO -o log_cli=true --verbose --maxfail=1 --durations=0 +coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \ + nbi/tests/test_ietf_l2vpn.py \ + nbi/tests/test_ietf_network.py diff --git a/scripts/run_tests_locally-nbi-ietf-l2vpn.sh b/scripts/run_tests_locally-nbi-ietf-l2vpn.sh index f6b53e432..595606d1f 100755 --- a/scripts/run_tests_locally-nbi-ietf-l2vpn.sh +++ b/scripts/run_tests_locally-nbi-ietf-l2vpn.sh @@ -20,5 +20,6 @@ cd $PROJECTDIR/src RCFILE=$PROJECTDIR/coverage/.coveragerc # Run unitary tests and analyze coverage of code at same time +# helpful pytest flags: --log-level=INFO -o log_cli=true --verbose --maxfail=1 --durations=0 coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \ nbi/tests/test_ietf_l2vpn.py diff --git a/src/nbi/.gitlab-ci.yml b/src/nbi/.gitlab-ci.yml index 8711cfb72..1cb086a6b 100644 --- a/src/nbi/.gitlab-ci.yml +++ b/src/nbi/.gitlab-ci.yml @@ -67,7 +67,7 @@ unit_test nbi: - docker ps -a - docker logs $IMAGE_NAME - > - docker exec -i $IMAGE_NAME bash -c "coverage run -m pytest --log-level=INFO --verbose + docker exec -i $IMAGE_NAME bash -c "coverage run -m pytest --log-level=INFO -o log_cli=true --verbose $IMAGE_NAME/tests/test_ietf_l2vpn.py $IMAGE_NAME/tests/test_ietf_network.py --junitxml=/opt/results/${IMAGE_NAME}_report.xml" -- GitLab From 16c36229225d84dd93cca528bda5a3194a890305 Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Fri, 22 Dec 2023 12:19:25 +0000 Subject: [PATCH 7/8] NBI Component: - Fixing GitLab CI/CD pipeline - Updated scripts to manually launch NBI tests --- scripts/run_tests_locally-nbi-all.sh | 5 ++++- src/nbi/.gitlab-ci.yml | 9 +++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/run_tests_locally-nbi-all.sh b/scripts/run_tests_locally-nbi-all.sh index 39930a677..ec2987d77 100755 --- a/scripts/run_tests_locally-nbi-all.sh +++ b/scripts/run_tests_locally-nbi-all.sh @@ -21,6 +21,9 @@ RCFILE=$PROJECTDIR/coverage/.coveragerc # Run unitary tests and analyze coverage of code at same time # helpful pytest flags: --log-level=INFO -o log_cli=true --verbose --maxfail=1 --durations=0 + +coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \ + nbi/tests/test_ietf_l2vpn.py + coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \ - nbi/tests/test_ietf_l2vpn.py \ nbi/tests/test_ietf_network.py diff --git a/src/nbi/.gitlab-ci.yml b/src/nbi/.gitlab-ci.yml index 1cb086a6b..47bd5bcbc 100644 --- a/src/nbi/.gitlab-ci.yml +++ b/src/nbi/.gitlab-ci.yml @@ -66,11 +66,8 @@ unit_test nbi: - sleep 5 - docker ps -a - docker logs $IMAGE_NAME - - > - docker exec -i $IMAGE_NAME bash -c "coverage run -m pytest --log-level=INFO -o log_cli=true --verbose - $IMAGE_NAME/tests/test_ietf_l2vpn.py - $IMAGE_NAME/tests/test_ietf_network.py - --junitxml=/opt/results/${IMAGE_NAME}_report.xml" + - docker exec -i $IMAGE_NAME bash -c "coverage run --append -m pytest --log-level=INFO --verbose $IMAGE_NAME/tests/test_ietf_l2vpn.py --junitxml=/opt/results/${IMAGE_NAME}_report_ietf_l2vpn.xml" + - docker exec -i $IMAGE_NAME bash -c "coverage run --append -m pytest --log-level=INFO --verbose $IMAGE_NAME/tests/test_ietf_network.py --junitxml=/opt/results/${IMAGE_NAME}_report_ietf_network.xml" - docker exec -i $IMAGE_NAME bash -c "coverage report --include='${IMAGE_NAME}/*' --show-missing" coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/' after_script: @@ -91,7 +88,7 @@ unit_test nbi: artifacts: when: always reports: - junit: src/$IMAGE_NAME/tests/${IMAGE_NAME}_report.xml + junit: src/$IMAGE_NAME/tests/${IMAGE_NAME}_report_*.xml ## Deployment of the service in Kubernetes Cluster #deploy nbi: -- GitLab From c622f31f647fdb989a557e79fa07098758f52b90 Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Fri, 22 Dec 2023 12:24:03 +0000 Subject: [PATCH 8/8] NBI Component: - Unit test cosmetic cleanup --- src/nbi/tests/test_ietf_l2vpn.py | 12 ++++++------ src/nbi/tests/test_ietf_network.py | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/nbi/tests/test_ietf_l2vpn.py b/src/nbi/tests/test_ietf_l2vpn.py index 9e0c95fd8..22171ce70 100644 --- a/src/nbi/tests/test_ietf_l2vpn.py +++ b/src/nbi/tests/test_ietf_l2vpn.py @@ -33,7 +33,7 @@ DESCRIPTOR_FILE = 'nbi/tests/data/topology-7router-emu-dummy.json' JSON_ADMIN_CONTEXT_ID = json_context_id(DEFAULT_CONTEXT_NAME) ADMIN_CONTEXT_ID = ContextId(**JSON_ADMIN_CONTEXT_ID) -def test_ietf_l2vpn_prepare_environment(context_client : ContextClient) -> None: # pylint: disable=redefined-outer-name +def test_prepare_environment(context_client : ContextClient) -> None: # pylint: disable=redefined-outer-name validate_empty_scenario(context_client) descriptor_loader = DescriptorLoader(descriptors_file=DESCRIPTOR_FILE, context_client=context_client) results = descriptor_loader.process() @@ -46,22 +46,22 @@ def test_ietf_l2vpn_prepare_environment(context_client : ContextClient) -> None: assert len(response.service_ids ) == 0 assert len(response.slice_ids ) == 0 -def test_ietf_l2vpn_create_service(osm_wim : MockOSM): # pylint: disable=redefined-outer-name +def test_create_service(osm_wim : MockOSM): # pylint: disable=redefined-outer-name osm_wim.create_connectivity_service(SERVICE_TYPE, SERVICE_CONNECTION_POINTS_1) -def test_ietf_l2vpn_get_service_status(osm_wim : MockOSM): # pylint: disable=redefined-outer-name +def test_get_service_status(osm_wim : MockOSM): # pylint: disable=redefined-outer-name service_uuid = list(osm_wim.conn_info.keys())[0] # this test adds a single service osm_wim.get_connectivity_service_status(service_uuid) -def test_ietf_l2vpn_edit_service(osm_wim : MockOSM): # pylint: disable=redefined-outer-name +def test_edit_service(osm_wim : MockOSM): # pylint: disable=redefined-outer-name service_uuid = list(osm_wim.conn_info.keys())[0] # this test adds a single service osm_wim.edit_connectivity_service(service_uuid, SERVICE_CONNECTION_POINTS_2) -def test_ietf_l2vpn_delete_service(osm_wim : MockOSM): # pylint: disable=redefined-outer-name +def test_delete_service(osm_wim : MockOSM): # pylint: disable=redefined-outer-name service_uuid = list(osm_wim.conn_info.keys())[0] # this test adds a single service osm_wim.delete_connectivity_service(service_uuid) -def test_ietf_l2vpn_cleanup_environment(context_client : ContextClient) -> None: # pylint: disable=redefined-outer-name +def test_cleanup_environment(context_client : ContextClient) -> None: # pylint: disable=redefined-outer-name # Verify the scenario has no services/slices response = context_client.GetContext(ADMIN_CONTEXT_ID) assert len(response.topology_ids) == 1 diff --git a/src/nbi/tests/test_ietf_network.py b/src/nbi/tests/test_ietf_network.py index 78183c3da..e41a88af0 100644 --- a/src/nbi/tests/test_ietf_network.py +++ b/src/nbi/tests/test_ietf_network.py @@ -34,7 +34,7 @@ TARGET_DATA_FILE = 'nbi/tests/data/test-ietf-network.json' JSON_ADMIN_CONTEXT_ID = json_context_id(DEFAULT_CONTEXT_NAME) ADMIN_CONTEXT_ID = ContextId(**JSON_ADMIN_CONTEXT_ID) -def test_ietf_network_prepare_environment(context_client : ContextClient) -> None: # pylint: disable=redefined-outer-name +def test_prepare_environment(context_client : ContextClient) -> None: # pylint: disable=redefined-outer-name validate_empty_scenario(context_client) descriptor_loader = DescriptorLoader(descriptors_file=DESCRIPTOR_FILE, context_client=context_client) results = descriptor_loader.process() @@ -74,7 +74,7 @@ def sort_data(data : Dict) -> None: key=operator.itemgetter('link-id') ) -def test_ietf_network_rest_get_networks(nbi_service_rest : RestServer): # pylint: disable=redefined-outer-name, unused-argument +def test_rest_get_networks(nbi_service_rest : RestServer): # pylint: disable=redefined-outer-name, unused-argument with open(TARGET_DATA_FILE, 'r', encoding='UTF-8') as f: target_data = json.load(f) URL = '/restconf/data/ietf-network:networks' @@ -85,7 +85,7 @@ def test_ietf_network_rest_get_networks(nbi_service_rest : RestServer): # pylint LOGGER.error('Differences:\n{:s}'.format(str(diff_data.pretty()))) assert len(diff_data) == 0 -def test_ietf_network_cleanup_environment(context_client : ContextClient) -> None: # pylint: disable=redefined-outer-name +def test_cleanup_environment(context_client : ContextClient) -> None: # pylint: disable=redefined-outer-name # Verify the scenario has no services/slices response = context_client.GetContext(ADMIN_CONTEXT_ID) assert len(response.topology_ids) == 1 -- GitLab