diff --git a/src/tests/ofc25/.gitlab-ci.yml b/src/tests/ofc25/.gitlab-ci.yml index 7bc42ce7b55066eef8f3bb8e600c221d505ca5ea..49eaba5231206c0afecc9fa68ed0d891610599e6 100644 --- a/src/tests/ofc25/.gitlab-ci.yml +++ b/src/tests/ofc25/.gitlab-ci.yml @@ -91,11 +91,15 @@ end2end_test ofc25: # Run end-to-end test: onboard scenario - > docker run -t --rm --name ${TEST_NAME} --network=host + --volume "$PWD/tfs_runtime_env_vars.sh:/var/teraflow/tfs_runtime_env_vars.sh" + --volume "$PWD/src/tests/${TEST_NAME}:/opt/results" $CI_REGISTRY_IMAGE/${TEST_NAME}:latest /var/teraflow/run-onboarding.sh # Run end-to-end test: configure service TFS - > docker run -t --rm --name ${TEST_NAME} --network=host + --volume "$PWD/tfs_runtime_env_vars.sh:/var/teraflow/tfs_runtime_env_vars.sh" + --volume "$PWD/src/tests/${TEST_NAME}:/opt/results" $CI_REGISTRY_IMAGE/${TEST_NAME}:latest /var/teraflow/run-e2e-ietf-slice-operations.sh after_script: diff --git a/src/tests/ofc25/Dockerfile b/src/tests/ofc25/Dockerfile index b2ce8157aea2f2167b468bc5d1104f369907566c..2d7d5ce34677fd362aa82a130c0a8e3d80ceee47 100644 --- a/src/tests/ofc25/Dockerfile +++ b/src/tests/ofc25/Dockerfile @@ -58,6 +58,19 @@ RUN python3 -m pip install -r requirements.txt # Add component files into working directory WORKDIR /var/teraflow COPY src/__init__.py ./__init__.py +COPY src/common/*.py ./common/ +COPY src/common/tests/. ./common/tests/ +COPY src/common/tools/. ./common/tools/ +COPY src/context/__init__.py context/__init__.py +COPY src/context/client/. context/client/ +COPY src/device/__init__.py device/__init__.py +COPY src/device/client/. device/client/ +COPY src/monitoring/__init__.py monitoring/__init__.py +COPY src/monitoring/client/. monitoring/client/ +COPY src/service/__init__.py service/__init__.py +COPY src/service/client/. service/client/ +COPY src/slice/__init__.py slice/__init__.py +COPY src/slice/client/. slice/client/ COPY src/tests/*.py ./tests/ COPY src/tests/ofc25/__init__.py ./tests/ofc25/__init__.py COPY src/tests/ofc25/data/. ./tests/ofc25/data/ diff --git a/src/tests/ofc25/data/slice/target-full-ietf-slice.json b/src/tests/ofc25/data/target-full-ietf-slice.json similarity index 100% rename from src/tests/ofc25/data/slice/target-full-ietf-slice.json rename to src/tests/ofc25/data/target-full-ietf-slice.json diff --git a/src/tests/ofc25/deploy_specs.sh b/src/tests/ofc25/deploy_specs.sh index 72cd25b58a02f442838bab866cc969680c073ebc..9ae83e7b126aa2913cd3c30887292b4626dd5855 100755 --- a/src/tests/ofc25/deploy_specs.sh +++ b/src/tests/ofc25/deploy_specs.sh @@ -21,7 +21,7 @@ export TFS_REGISTRY_IMAGES="http://localhost:32000/tfs/" # Set the list of components, separated by spaces, you want to build images for, and deploy. #export TFS_COMPONENTS="context device pathcomp service slice nbi webui load_generator" -export TFS_COMPONENTS="context device pathcomp service nbi" +export TFS_COMPONENTS="context device pathcomp service slice nbi" # Uncomment to activate Monitoring (old) #export TFS_COMPONENTS="${TFS_COMPONENTS} monitoring" diff --git a/src/tests/ofc25/requirements.in b/src/tests/ofc25/requirements.in index 6210ec8172e17efbb23e0e14d30a91d7b61d4abe..1bdaec9997da4b83fa89c1bf0d00d4c3a73558a4 100644 --- a/src/tests/ofc25/requirements.in +++ b/src/tests/ofc25/requirements.in @@ -14,3 +14,17 @@ deepdiff==6.7.* requests==2.27.* + +coverage==6.3 +grpcio==1.47.* +grpcio-health-checking==1.47.* +grpcio-reflection==1.47.* +grpcio-tools==1.47.* +grpclib==0.4.4 +prettytable==3.5.0 +prometheus-client==0.13.0 +protobuf==3.20.* +pytest==6.2.5 +pytest-benchmark==3.4.1 +python-dateutil==2.8.2 +pytest-depends==1.0.1 diff --git a/src/tests/ofc25/tests/test_e2e_ietf_slice_operations.py b/src/tests/ofc25/tests/test_e2e_ietf_slice_operations.py index d6207d675db6b1d72b717f648dd684a00565a093..cb991edbf1f3cc0768d006ef58725e621ac83de9 100644 --- a/src/tests/ofc25/tests/test_e2e_ietf_slice_operations.py +++ b/src/tests/ofc25/tests/test_e2e_ietf_slice_operations.py @@ -82,14 +82,12 @@ TARGET_NCE_APP_FLOWS = os.path.join( os.path.dirname(os.path.abspath(__file__)), "..", "data", - "slice", "target-nce-app-flows.json", ) TARGET_NCE_APPS = os.path.join( os.path.dirname(os.path.abspath(__file__)), "..", "data", - "slice", "target-nce-apps.json", ) TARGET_FULL_IETF_SLICE = os.path.join( @@ -103,7 +101,6 @@ TARGET_FULL_IETF_SLICE = os.path.join( os.path.dirname(os.path.abspath(__file__)), "..", "data", - "slice", "target-full-ietf-slice.json", ) TARGET_IETF_SLICE_POSTED_SLICES = os.path.join( @@ -171,18 +168,18 @@ def test_ietf_slice_creation_removal(): requests.post(URL, headers=HEADERS, json=post_network_slice1) URL = NCE_APP_DATA_URL - apps_response = requests.get(URL) + apps_response = requests.get(URL).json() URL = NCE_APP_FLOW_DATA_URL - app_flows_response = requests.get(URL) + app_flows_response = requests.get(URL).json() URL = AGG_TFS_IETF_SLICE_URL - ietf_slice_services = requests.get(URL) + ietf_slice_services = requests.get(URL).json() URL = ( AGG_TFS_IETF_SLICE_URL + "/slice-service=dummy/connection-groups/connection-group=dummy" ) - ietf_slice_connection_groups = requests.get(URL) + ietf_slice_connection_groups = requests.get(URL).json() - app_name = apps_response["application"][0]["name"] + app_name = "App_Flow_2_1_slice1" apps_diff = DeepDiff(apps_response[app_name], target_nce_apps[app_name]) app_flows_diff = DeepDiff( app_flows_response[app_name], @@ -211,18 +208,18 @@ def test_ietf_slice_creation_removal(): requests.post(URL, headers=HEADERS, json=post_match_criteria_to_sdp1_in_slice1) URL = NCE_APP_DATA_URL - apps_response = requests.get(URL) + apps_response = requests.get(URL).json() URL = NCE_APP_FLOW_DATA_URL - app_flows_response = requests.get(URL) + app_flows_response = requests.get(URL).json() URL = AGG_TFS_IETF_SLICE_URL - ietf_slice_services = requests.get(URL) + ietf_slice_services = requests.get(URL).json() URL = ( AGG_TFS_IETF_SLICE_URL + "/slice-service=dummy/connection-groups/connection-group=dummy" ) - ietf_slice_connection_groups = requests.get(URL) + ietf_slice_connection_groups = requests.get(URL).json() - app_name = apps_response["application"][0]["name"] + app_name = "App_Flow_3_1_slice1" apps_diff = DeepDiff(apps_response[app_name], target_nce_apps[app_name]) app_flows_diff = DeepDiff( app_flows_response[app_name], @@ -245,18 +242,18 @@ def test_ietf_slice_creation_removal(): requests.post(URL, headers=HEADERS, json=post_network_slice2) URL = NCE_APP_DATA_URL - apps_response = requests.get(URL) + apps_response = requests.get(URL).json() URL = NCE_APP_FLOW_DATA_URL - app_flows_response = requests.get(URL) + app_flows_response = requests.get(URL).json() URL = AGG_TFS_IETF_SLICE_URL - ietf_slice_services = requests.get(URL) + ietf_slice_services = requests.get(URL).json() URL = ( AGG_TFS_IETF_SLICE_URL + "/slice-service=dummy/connection-groups/connection-group=dummy" ) - ietf_slice_connection_groups = requests.get(URL) + ietf_slice_connection_groups = requests.get(URL).json() - app_name = apps_response["application"][0]["name"] + app_name = "App_Flow_2_1_slice2" apps_diff = DeepDiff(apps_response[app_name], target_nce_apps[app_name]) app_flows_diff = DeepDiff( app_flows_response[app_name], @@ -267,7 +264,7 @@ def test_ietf_slice_creation_removal(): assert not app_flows_diff assert len(apps_response) == 3 and len(app_flows_response) == 3 - assert len(ietf_slice_connection_groups) == 0 + assert len(ietf_slice_connection_groups) == 1 assert len(ietf_slice_services) == 2 slice_diff = DeepDiff( ietf_slice_services["slice2"], target_ietf_slice_posted_slices[1] @@ -285,18 +282,18 @@ def test_ietf_slice_creation_removal(): requests.post(URL, headers=HEADERS, json=post_match_criteria_to_sdp1_in_slice2) URL = NCE_APP_DATA_URL - apps_response = requests.get(URL) + apps_response = requests.get(URL).json() URL = NCE_APP_FLOW_DATA_URL - app_flows_response = requests.get(URL) + app_flows_response = requests.get(URL).json() URL = AGG_TFS_IETF_SLICE_URL - ietf_slice_services = requests.get(URL) + ietf_slice_services = requests.get(URL).json() URL = ( AGG_TFS_IETF_SLICE_URL + "/slice-service=dummy/connection-groups/connection-group=dummy" ) - ietf_slice_connection_groups = requests.get(URL) + ietf_slice_connection_groups = requests.get(URL).json() - app_name = apps_response["application"][0]["name"] + app_name = "App_Flow_3_1_slice2" apps_diff = DeepDiff(apps_response[app_name], target_nce_apps[app_name]) app_flows_diff = DeepDiff( app_flows_response[app_name], @@ -315,7 +312,7 @@ def test_ietf_slice_creation_removal(): assert not connection_group_diff # op 5 - ietf_slices_full_retrieved = requests.get(BASE_IETF_SLICE_URL) + ietf_slices_full_retrieved = requests.get(BASE_IETF_SLICE_URL).json() ietf_slice_data = DeepDiff(ietf_slices_full_retrieved, target_full_ietf_slice) assert not ietf_slice_data @@ -334,16 +331,16 @@ def test_ietf_slice_creation_removal(): requests.delete(URL) URL = NCE_APP_DATA_URL - apps_response = requests.get(URL) + apps_response = requests.get(URL).json() URL = NCE_APP_FLOW_DATA_URL - app_flows_response = requests.get(URL) + app_flows_response = requests.get(URL).json() URL = AGG_TFS_IETF_SLICE_URL - ietf_slice_services = requests.get(URL) + ietf_slice_services = requests.get(URL).json() URL = ( AGG_TFS_IETF_SLICE_URL + "/slice-service=dummy/connection-groups/connection-group=dummy" ) - ietf_slice_connection_groups = requests.get(URL) + ietf_slice_connection_groups = requests.get(URL).json() app_name = "App_Flow_2_1_slice1" assert app_name not in apps_response @@ -373,16 +370,16 @@ def test_ietf_slice_creation_removal(): URL = BASE_IETF_SLICE_URL + "/slice-service=slice1/sdps/sdp=1" URL = NCE_APP_DATA_URL - apps_response = requests.get(URL) + apps_response = requests.get(URL).json() URL = NCE_APP_FLOW_DATA_URL - app_flows_response = requests.get(URL) + app_flows_response = requests.get(URL).json() URL = AGG_TFS_IETF_SLICE_URL - ietf_slice_services = requests.get(URL) + ietf_slice_services = requests.get(URL).json() URL = ( AGG_TFS_IETF_SLICE_URL + "/slice-service=dummy/connection-groups/connection-group=dummy" ) - ietf_slice_connection_groups = requests.get(URL) + ietf_slice_connection_groups = requests.get(URL).json() requests.delete(URL) URL = BASE_IETF_SLICE_URL + "/slice-service=slice1" @@ -412,16 +409,16 @@ def test_ietf_slice_creation_removal(): requests.delete(URL) URL = NCE_APP_DATA_URL - apps_response = requests.get(URL) + apps_response = requests.get(URL).json() URL = NCE_APP_FLOW_DATA_URL - app_flows_response = requests.get(URL) + app_flows_response = requests.get(URL).json() URL = AGG_TFS_IETF_SLICE_URL - ietf_slice_services = requests.get(URL) + ietf_slice_services = requests.get(URL).json() URL = ( AGG_TFS_IETF_SLICE_URL + "/slice-service=dummy/connection-groups/connection-group=dummy" ) - ietf_slice_connection_groups = requests.get(URL) + ietf_slice_connection_groups = requests.get(URL).json() app_name = "App_Flow_2_1_slice2" assert app_name not in apps_response @@ -450,16 +447,16 @@ def test_ietf_slice_creation_removal(): requests.delete(URL) URL = NCE_APP_DATA_URL - apps_response = requests.get(URL) + apps_response = requests.get(URL).json() URL = NCE_APP_FLOW_DATA_URL - app_flows_response = requests.get(URL) + app_flows_response = requests.get(URL).json() URL = AGG_TFS_IETF_SLICE_URL - ietf_slice_services = requests.get(URL) + ietf_slice_services = requests.get(URL).json() URL = ( AGG_TFS_IETF_SLICE_URL + "/slice-service=dummy/connection-groups/connection-group=dummy" ) - ietf_slice_connection_groups = requests.get(URL) + ietf_slice_connection_groups = requests.get(URL).json() URL = BASE_IETF_SLICE_URL + "/slice-service=slice2/sdps/sdp=1" requests.delete(URL) @@ -475,7 +472,7 @@ def test_ietf_slice_creation_removal(): assert len(ietf_slice_services) == 0 # op 10 - ietf_slices_full_retrieved = requests.get(BASE_IETF_SLICE_URL) + ietf_slices_full_retrieved = requests.get(BASE_IETF_SLICE_URL).json() empty_ietf_slices = {"network-slice-services": {"slice-service": []}} ietf_slice_data = DeepDiff(ietf_slices_full_retrieved, empty_ietf_slices) assert not ietf_slice_data diff --git a/src/tests/ofc25/tests/test_onboarding.py b/src/tests/ofc25/tests/test_onboarding.py index b58cb38219c36caa77998af1e66eb80d0888301f..05e031da7b3ab88a8ee3f3c80fdddb92d9f26913 100644 --- a/src/tests/ofc25/tests/test_onboarding.py +++ b/src/tests/ofc25/tests/test_onboarding.py @@ -37,7 +37,7 @@ def test_scenario_onboarding( descriptors_file=DESCRIPTOR_FILE, context_client=context_client, device_client=device_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 response = context_client.GetContext(ADMIN_CONTEXT_ID)