diff --git a/src/tests/.gitlab-ci.yml b/src/tests/.gitlab-ci.yml index fdc86805ba4824f64844a9b4bc78c3e27b606945..b49d40c1142522ab0fb3fa1936395f2aadc80baf 100644 --- a/src/tests/.gitlab-ci.yml +++ b/src/tests/.gitlab-ci.yml @@ -21,4 +21,6 @@ include: #- local: '/src/tests/ofc23/.gitlab-ci.yml' - local: '/src/tests/ofc24/.gitlab-ci.yml' - local: '/src/tests/eucnc24/.gitlab-ci.yml' + - local: '/src/tests/ofc25-camara-agg-net-controller/.gitlab-ci.yml' + - local: '/src/tests/ofc25-camara-e2e-controller/.gitlab-ci.yml' #- local: '/src/tests/ecoc24/.gitlab-ci.yml' diff --git a/src/tests/ofc25-camara-agg-net-controller/.gitignore b/src/tests/ofc25-camara-agg-net-controller/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..24a4b233365e23a9462f4b64e8b60fef6a62bee4 --- /dev/null +++ b/src/tests/ofc25-camara-agg-net-controller/.gitignore @@ -0,0 +1,5 @@ +clab-*/ +images/ +*.clab.yml.bak +*.tar +*.tar.gz diff --git a/src/tests/ofc25-camara-agg-net-controller/.gitlab-ci.yml b/src/tests/ofc25-camara-agg-net-controller/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..f69c37b38a5a4414c2d75f816ed12035cbb0d53c --- /dev/null +++ b/src/tests/ofc25-camara-agg-net-controller/.gitlab-ci.yml @@ -0,0 +1,90 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +# Deploy TeraFlowSDN and Execute end-2-end test +end2end_test ofc25_camara_agg_net: + variables: + TEST_NAME: 'ofc25-camara-agg-net-controller' + IP_NAME: 'ip' + IP_PORT: '9092' + stage: end2end_test + # Disable to force running it after all other tasks + before_script: + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + - HOST_IP=$(kubectl get nodes -o json | jq -r '.items[].status.addresses[] | select(.type=="InternalIP") | .address') + - sed -i "s/IP_NET_IP/${HOST_IP}/g" src/tests/${TEST_NAME}/data/agg-net-descriptor.json + - sed -i "s/IP_NET_PORT/${IP_PORT}/g" src/tests/${TEST_NAME}/data/agg-net-descriptor.json + - docker buildx build -t "${TEST_NAME}:latest" -f ./src/tests/${TEST_NAME}/Dockerfile . + - docker buildx build -t "${IP_NAME}:latest" -f ./src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/Dockerfile ./src/tests/tools/mock_ietf_l3vpn_sdn_ctrl + - docker rm -f ${TEST_NAME} || true + - docker rm -f ${IP_NAME} || true + - docker run -d --name ${IP_NAME} -p ${IP_PORT}:8443 ${IP_NAME}:latest + + script: + # Check MicroK8s is ready + - microk8s status --wait-ready + - kubectl get pods --all-namespaces + + - source src/tests/${TEST_NAME}/deploy_specs.sh + + # Deploy TeraFlowSDN + - ./deploy/crdb.sh + - ./deploy/nats.sh + - ./deploy/qdb.sh + - ./deploy/kafka.sh + - ./deploy/tfs.sh + - ./deploy/show.sh + + - kubectl --namespace $TFS_K8S_NAMESPACE logs deployment/contextservice -c server + + # 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" + ${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" + ${TEST_NAME}:latest /var/teraflow/run-agg-net-ietf-slice-operations.sh + + after_script: + - kubectl --namespace tfs logs deployment/contextservice -c server + - kubectl --namespace tfs logs deployment/deviceservice -c server + - kubectl --namespace tfs logs deployment/pathcompservice -c frontend + - kubectl --namespace tfs logs deployment/serviceservice -c server + - kubectl --namespace tfs logs deployment/sliceservice -c server + - kubectl --namespace tfs logs deployment/nbiservice -c server + - docker logs ${IP_NAME} + + # Destroy Scenario + - kubectl delete namespaces tfs || true + + - docker rm -f ${TEST_NAME} || true + - docker rm -f ${IP_NAME} || true + + # Clean old docker images + - docker images --filter="dangling=true" --quiet | xargs -r docker rmi + + #coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/' + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH)' + - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "develop"' + artifacts: + when: always + reports: + junit: ./src/tests/${TEST_NAME}/report_*.xml diff --git a/src/tests/ofc25-camara-agg-net-controller/Dockerfile b/src/tests/ofc25-camara-agg-net-controller/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..36ab9d366bd186f4ac0ade9f9dcea21f0a2a46e8 --- /dev/null +++ b/src/tests/ofc25-camara-agg-net-controller/Dockerfile @@ -0,0 +1,84 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +FROM python:3.9-slim + +# Install dependencies +RUN apt-get --yes --quiet --quiet update && \ + apt-get --yes --quiet --quiet install wget g++ git && \ + rm -rf /var/lib/apt/lists/* + +# Set Python to show logs as they occur +ENV PYTHONUNBUFFERED=0 + +# Get generic Python packages +RUN python3 -m pip install --upgrade pip +RUN python3 -m pip install --upgrade setuptools wheel +RUN python3 -m pip install --upgrade pip-tools + +# Get common Python packages +# Note: this step enables sharing the previous Docker build steps among all the Python components +WORKDIR /var/teraflow +COPY common_requirements.in common_requirements.in +RUN pip-compile --quiet --output-file=common_requirements.txt common_requirements.in +RUN python3 -m pip install -r common_requirements.txt + +# Add common files into working directory +WORKDIR /var/teraflow/common +COPY src/common/. ./ +RUN rm -rf proto + +# Create proto sub-folder, copy .proto files, and generate Python code +RUN mkdir -p /var/teraflow/common/proto +WORKDIR /var/teraflow/common/proto +RUN touch __init__.py +COPY proto/*.proto ./ +RUN python3 -m grpc_tools.protoc -I=. --python_out=. --grpc_python_out=. *.proto +RUN rm *.proto +RUN find . -type f -exec sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' {} \; + +# Create component sub-folders, get specific Python packages +RUN mkdir -p /var/teraflow/tests/ofc25-camara-agg-net-controller +WORKDIR /var/teraflow/tests/ofc25-camara-agg-net-controller +COPY src/tests/ofc25-camara-agg-net-controller/requirements.in requirements.in +RUN pip-compile --quiet --output-file=requirements.txt requirements.in +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-camara-agg-net-controller/__init__.py ./tests/ofc25-camara-agg-net-controller/__init__.py +COPY src/tests/ofc25-camara-agg-net-controller/data/. ./tests/ofc25-camara-agg-net-controller/data/ +COPY src/tests/ofc25-camara-agg-net-controller/tests/. ./tests/ofc25-camara-agg-net-controller/tests/ +COPY src/tests/ofc25-camara-agg-net-controller/scripts/. ./ + +RUN apt-get --yes --quiet --quiet update && \ + apt-get --yes --quiet --quiet install tree && \ + rm -rf /var/lib/apt/lists/* + +RUN tree -la /var/teraflow diff --git a/src/tests/ofc25-camara-agg-net-controller/__init__.py b/src/tests/ofc25-camara-agg-net-controller/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..3ccc21c7db78aac26daa1f8c5ff8e1ffd3f35460 --- /dev/null +++ b/src/tests/ofc25-camara-agg-net-controller/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + diff --git a/src/tests/ofc25-camara-agg-net-controller/data/agg-net-descriptor.json b/src/tests/ofc25-camara-agg-net-controller/data/agg-net-descriptor.json new file mode 100644 index 0000000000000000000000000000000000000000..5e0e612ddb4206974bb7b8b9d37f62365ade0dfa --- /dev/null +++ b/src/tests/ofc25-camara-agg-net-controller/data/agg-net-descriptor.json @@ -0,0 +1,858 @@ +{ + "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": "ip-net-controller" + } + }, + "name": "ip-net-controller", + "device_type": "ip-sdn-controller", + "device_operational_status": 1, + "device_drivers": [ + 13 + ], + "device_config": { + "config_rules": [ + { + "action": 1, + "custom": { + "resource_key": "_connect/address", + "resource_value": "IP_NET_IP" + } + }, + { + "action": 1, + "custom": { + "resource_key": "_connect/port", + "resource_value": "IP_NET_PORT" + } + }, + { + "action": 1, + "custom": { + "resource_key": "_connect/settings", + "resource_value": { + "endpoints": [ + { + "uuid": "mgmt", + "name": "mgmt", + "type": "mgmt" + } + ], + "scheme": "http", + "username": "admin", + "password": "admin", + "base_url": "/restconf/v2/data", + "timeout": 120, + "verify": false + } + } + } + ] + }, + "device_endpoints": [] + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.182.25" + } + }, + "name": "172.16.182.25", + "device_type": "emu-packet-router", + "controller_id": { + "device_uuid": { + "uuid": "ip-net-controller" + } + }, + "device_operational_status": 1, + "device_drivers": [ + 13 + ], + "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": "mgmt", + "name": "mgmt", + "type": "mgmt" + }, + { + "uuid": "200", + "name": "200", + "type": "optical", + "address_ip": "128.32.33.254", + "address_prefix": "24", + "site_location": "access" + }, + { + "uuid": "500", + "name": "500", + "type": "optical" + }, + { + "uuid": "501", + "name": "501", + "type": "optical" + } + ] + } + } + } + ] + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.31" + } + }, + "name": "172.16.185.31", + "device_type": "emu-packet-router", + "controller_id": { + "device_uuid": { + "uuid": "ip-net-controller" + } + }, + "device_operational_status": 1, + "device_drivers": [ + 13 + ], + "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": "mgmt", + "name": "mgmt", + "type": "mgmt" + }, + { + "uuid": "500", + "name": "500", + "type": "optical" + }, + { + "uuid": "501", + "name": "501", + "type": "optical" + } + ] + } + } + } + ] + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.33" + } + }, + "name": "172.16.185.33", + "device_type": "emu-packet-router", + "controller_id": { + "device_uuid": { + "uuid": "ip-net-controller" + } + }, + "device_operational_status": 1, + "device_drivers": [ + 13 + ], + "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": "mgmt", + "name": "mgmt", + "type": "mgmt" + }, + { + "uuid": "500", + "name": "500", + "type": "optical" + }, + { + "uuid": "501", + "name": "501", + "type": "optical" + } + ] + } + } + } + ] + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.32" + } + }, + "name": "172.16.185.32", + "device_type": "emu-packet-router", + "controller_id": { + "device_uuid": { + "uuid": "ip-net-controller" + } + }, + "device_operational_status": 1, + "device_drivers": [ + 13 + ], + "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": "mgmt", + "name": "mgmt", + "type": "mgmt" + }, + { + "uuid": "200", + "name": "200", + "type": "optical", + "address_ip": "172.10.33.254", + "address_prefix": "24", + "site_location": "cloud" + }, + { + "uuid": "500", + "name": "500", + "type": "optical" + }, + { + "uuid": "501", + "name": "501", + "type": "optical" + } + ] + } + } + } + ] + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.204.220" + } + }, + "device_type": "emu-datacenter", + "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": [ + { + "sample_types": [], + "type": "optical", + "uuid": "500" + }, + { + "sample_types": [], + "type": "optical", + "uuid": "200" + }, + { + "sample_types": [], + "type": "optical", + "uuid": "201" + } + ] + } + } + } + ] + } + } + ], + "links": [ + { + "link_id": { + "link_uuid": { + "uuid": "ip-net-controller/mgmt==172.16.182.25/mgmt" + } + }, + "name": "ip-net-controller/mgmt==172.16.182.25/mgmt", + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "ip-net-controller" + } + }, + "endpoint_uuid": { + "uuid": "mgmt" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.182.25" + } + }, + "endpoint_uuid": { + "uuid": "mgmt" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "ip-net-controller/mgmt==172.16.185.31/mgmt" + } + }, + "name": "ip-net-controller/mgmt==172.16.185.31/mgmt", + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "ip-net-controller" + } + }, + "endpoint_uuid": { + "uuid": "mgmt" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.31" + } + }, + "endpoint_uuid": { + "uuid": "mgmt" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "ip-net-controller/mgmt==172.16.185.33/mgmt" + } + }, + "name": "ip-net-controller/mgmt==172.16.185.33/mgmt", + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "ip-net-controller" + } + }, + "endpoint_uuid": { + "uuid": "mgmt" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.33" + } + }, + "endpoint_uuid": { + "uuid": "mgmt" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "ip-net-controller/mgmt==172.16.185.32/mgmt" + } + }, + "name": "ip-net-controller/mgmt==172.16.185.32/mgmt", + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "ip-net-controller" + } + }, + "endpoint_uuid": { + "uuid": "mgmt" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.32" + } + }, + "endpoint_uuid": { + "uuid": "mgmt" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "172.16.182.25-500" + } + }, + "name": "172.16.182.25-500", + "attributes": { + "total_capacity_gbps": 10, + "used_capacity_gbps": 0 + }, + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "172.16.182.25" + } + }, + "endpoint_uuid": { + "uuid": "500" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.33" + } + }, + "endpoint_uuid": { + "uuid": "500" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "172.16.185.33-500" + } + }, + "name": "172.16.185.33-500", + "attributes": { + "total_capacity_gbps": 10, + "used_capacity_gbps": 0 + }, + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.33" + } + }, + "endpoint_uuid": { + "uuid": "500" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.182.25" + } + }, + "endpoint_uuid": { + "uuid": "500" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "172.16.182.25-501" + } + }, + "name": "172.16.182.25-501", + "attributes": { + "total_capacity_gbps": 10, + "used_capacity_gbps": 0 + }, + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "172.16.182.25" + } + }, + "endpoint_uuid": { + "uuid": "501" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.31" + } + }, + "endpoint_uuid": { + "uuid": "501" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "172.16.185.31-501" + } + }, + "name": "172.16.185.31-501", + "attributes": { + "total_capacity_gbps": 10, + "used_capacity_gbps": 0 + }, + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.31" + } + }, + "endpoint_uuid": { + "uuid": "501" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.182.25" + } + }, + "endpoint_uuid": { + "uuid": "501" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "172.16.185.31-500" + } + }, + "name": "172.16.185.31-500", + "attributes": { + "total_capacity_gbps": 10, + "used_capacity_gbps": 0 + }, + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.31" + } + }, + "endpoint_uuid": { + "uuid": "500" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.32" + } + }, + "endpoint_uuid": { + "uuid": "500" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "172.16.185.32-500" + } + }, + "name": "172.16.185.32-500", + "attributes": { + "total_capacity_gbps": 10, + "used_capacity_gbps": 0 + }, + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.32" + } + }, + "endpoint_uuid": { + "uuid": "500" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.31" + } + }, + "endpoint_uuid": { + "uuid": "500" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "172.16.185.33-501" + } + }, + "name": "172.16.185.33-501", + "attributes": { + "total_capacity_gbps": 10, + "used_capacity_gbps": 0 + }, + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.33" + } + }, + "endpoint_uuid": { + "uuid": "501" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.32" + } + }, + "endpoint_uuid": { + "uuid": "501" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "172.16.185.32-501" + } + }, + "name": "172.16.185.32-501", + "attributes": { + "total_capacity_gbps": 10, + "used_capacity_gbps": 0 + }, + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.32" + } + }, + "endpoint_uuid": { + "uuid": "501" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.33" + } + }, + "endpoint_uuid": { + "uuid": "501" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "172.16.185.32-200" + } + }, + "name": "172.16.185.32-200", + "attributes": { + "total_capacity_gbps": 10, + "used_capacity_gbps": 0 + }, + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.32" + } + }, + "endpoint_uuid": { + "uuid": "200" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.204.220" + } + }, + "endpoint_uuid": { + "uuid": "500" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "172.16.204.220-500" + } + }, + "name": "172.16.204.220-500", + "attributes": { + "total_capacity_gbps": 10, + "used_capacity_gbps": 0 + }, + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "172.16.204.220" + } + }, + "endpoint_uuid": { + "uuid": "500" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.32" + } + }, + "endpoint_uuid": { + "uuid": "200" + } + } + ] + } + ] +} diff --git a/src/tests/ofc25-camara-agg-net-controller/data/pc1_slice1_post_ietf_network_slice.json b/src/tests/ofc25-camara-agg-net-controller/data/pc1_slice1_post_ietf_network_slice.json new file mode 100644 index 0000000000000000000000000000000000000000..ac1f09dd838d60ab42c64e134203f398179874e7 --- /dev/null +++ b/src/tests/ofc25-camara-agg-net-controller/data/pc1_slice1_post_ietf_network_slice.json @@ -0,0 +1,190 @@ +{ + "network-slice-services": { + "slice-service": [ + { + "connection-groups": { + "connection-group": [ + { + "connectivity-construct": [ + { + "id": 1, + "p2p-receiver-sdp": "2", + "p2p-sender-sdp": "1", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": 10, + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": 5000, + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": 0.001 + } + ] + } + } + }, + { + "id": 2, + "p2p-receiver-sdp": "1", + "p2p-sender-sdp": "2", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": 20, + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": 1000, + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": 0.001 + } + ] + } + } + } + ], + "connectivity-type": "point-to-point", + "id": "line1" + } + ] + }, + "description": "dsc", + "id": "slice1", + "sdps": { + "sdp": [ + { + "attachment-circuits": { + "attachment-circuit": [ + { + "ac-node-id": "172.16.185.32", + "ac-tp-id": "200", + "description": "dsc", + "id": "0" + } + ] + }, + "id": "1", + "node-id": "172.16.185.32", + "sdp-ip-address": [ + "172.16.185.32" + ], + "service-match-criteria": { + "match-criterion": [ + { + "index": 1, + "match-type": [ + { + "type": "ietf-network-slice-service:vlan", + "value": [ + "101" + ] + }, + { + "type": "ietf-network-slice-service:source-ip-prefix", + "value": [ + "172.1.101.22/24" + ] + }, + { + "type": "ietf-network-slice-service:source-tcp-port", + "value": [ + "10200" + ] + }, + { + "type": "ietf-network-slice-service:destination-ip-prefix", + "value": [ + "172.16.104.221/24" + ] + }, + { + "type": "ietf-network-slice-service:destination-tcp-port", + "value": [ + "10500" + ] + } + ], + "target-connection-group-id": "line1" + } + ] + } + }, + { + "attachment-circuits": { + "attachment-circuit": [ + { + "ac-node-id": "172.16.182.25", + "ac-tp-id": "200", + "description": "dsc", + "id": "0" + } + ] + }, + "id": "2", + "node-id": "172.16.182.25", + "sdp-ip-address": [ + "172.16.182.25" + ], + "service-match-criteria": { + "match-criterion": [ + { + "index": 1, + "match-type": [ + { + "type": "ietf-network-slice-service:vlan", + "value": [ + "21" + ] + }, + { + "type": "ietf-network-slice-service:source-ip-prefix", + "value": [ + "172.16.104.221/24" + ] + }, + { + "type": "ietf-network-slice-service:source-tcp-port", + "value": [ + "10500" + ] + }, + { + "type": "ietf-network-slice-service:destination-ip-prefix", + "value": [ + "172.1.101.22/24" + ] + }, + { + "type": "ietf-network-slice-service:destination-tcp-port", + "value": [ + "10200" + ] + } + ], + "target-connection-group-id": "line1" + } + ] + } + } + ] + } + } + ] + } +} diff --git a/src/tests/ofc25-camara-agg-net-controller/data/pc1_slice1_put_ietf_network_slice.json b/src/tests/ofc25-camara-agg-net-controller/data/pc1_slice1_put_ietf_network_slice.json new file mode 100644 index 0000000000000000000000000000000000000000..690a84d915620667121cd6893e430576c592322a --- /dev/null +++ b/src/tests/ofc25-camara-agg-net-controller/data/pc1_slice1_put_ietf_network_slice.json @@ -0,0 +1,58 @@ +{ + "connectivity-construct": [ + { + "id": 1, + "p2p-receiver-sdp": "2", + "p2p-sender-sdp": "1", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": 10, + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": 5000, + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": 0.001 + } + ] + } + } + }, + { + "id": 2, + "p2p-receiver-sdp": "1", + "p2p-sender-sdp": "2", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": 20, + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": 1000, + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": 0.001 + } + ] + } + } + } + ], + "connectivity-type": "point-to-point", + "id": "line1" + } diff --git a/src/tests/ofc25-camara-agg-net-controller/data/pc1_slice2_post_ietf_network_slice.json b/src/tests/ofc25-camara-agg-net-controller/data/pc1_slice2_post_ietf_network_slice.json new file mode 100644 index 0000000000000000000000000000000000000000..079239a8bef20c67aaac4a7707a1041650c9bdf9 --- /dev/null +++ b/src/tests/ofc25-camara-agg-net-controller/data/pc1_slice2_post_ietf_network_slice.json @@ -0,0 +1,190 @@ +{ + "network-slice-services": { + "slice-service": [ + { + "connection-groups": { + "connection-group": [ + { + "connectivity-construct": [ + { + "id": 1, + "p2p-receiver-sdp": "2", + "p2p-sender-sdp": "1", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": 10, + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": 5000, + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": 0.001 + } + ] + } + } + }, + { + "id": 2, + "p2p-receiver-sdp": "1", + "p2p-sender-sdp": "2", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": 20, + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": 1000, + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": 0.001 + } + ] + } + } + } + ], + "connectivity-type": "point-to-point", + "id": "line1" + } + ] + }, + "description": "dsc", + "id": "slice2", + "sdps": { + "sdp": [ + { + "attachment-circuits": { + "attachment-circuit": [ + { + "ac-node-id": "172.16.185.32", + "ac-tp-id": "200", + "description": "dsc", + "id": "0" + } + ] + }, + "id": "1", + "node-id": "172.16.185.32", + "sdp-ip-address": [ + "172.16.185.32" + ], + "service-match-criteria": { + "match-criterion": [ + { + "index": 1, + "match-type": [ + { + "type": "ietf-network-slice-service:vlan", + "value": [ + "201" + ] + }, + { + "type": "ietf-network-slice-service:source-ip-prefix", + "value": [ + "172.1.201.22/24" + ] + }, + { + "type": "ietf-network-slice-service:source-tcp-port", + "value": [ + "10200" + ] + }, + { + "type": "ietf-network-slice-service:destination-ip-prefix", + "value": [ + "172.16.104.221/24" + ] + }, + { + "type": "ietf-network-slice-service:destination-tcp-port", + "value": [ + "10500" + ] + } + ], + "target-connection-group-id": "line1" + } + ] + } + }, + { + "attachment-circuits": { + "attachment-circuit": [ + { + "ac-node-id": "172.16.182.25", + "ac-tp-id": "200", + "description": "dsc", + "id": "0" + } + ] + }, + "id": "2", + "node-id": "172.16.182.25", + "sdp-ip-address": [ + "172.16.182.25" + ], + "service-match-criteria": { + "match-criterion": [ + { + "index": 1, + "match-type": [ + { + "type": "ietf-network-slice-service:vlan", + "value": [ + "31" + ] + }, + { + "type": "ietf-network-slice-service:source-ip-prefix", + "value": [ + "172.16.104.221/24" + ] + }, + { + "type": "ietf-network-slice-service:source-tcp-port", + "value": [ + "10500" + ] + }, + { + "type": "ietf-network-slice-service:destination-ip-prefix", + "value": [ + "172.1.201.22/24" + ] + }, + { + "type": "ietf-network-slice-service:destination-tcp-port", + "value": [ + "10200" + ] + } + ], + "target-connection-group-id": "line1" + } + ] + } + } + ] + } + } + ] + } +} diff --git a/src/tests/ofc25-camara-agg-net-controller/data/pc1_slice2_put_ietf_network_slice.json b/src/tests/ofc25-camara-agg-net-controller/data/pc1_slice2_put_ietf_network_slice.json new file mode 100644 index 0000000000000000000000000000000000000000..948276a5a79048cf2980c60c57f697b491d19f44 --- /dev/null +++ b/src/tests/ofc25-camara-agg-net-controller/data/pc1_slice2_put_ietf_network_slice.json @@ -0,0 +1,58 @@ +{ + "connectivity-construct": [ + { + "id": 1, + "p2p-receiver-sdp": "2", + "p2p-sender-sdp": "1", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": 10, + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": 5000, + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": 0.001 + } + ] + } + } + }, + { + "id": 2, + "p2p-receiver-sdp": "1", + "p2p-sender-sdp": "2", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": 20, + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": 1000, + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": 0.001 + } + ] + } + } + } + ], + "connectivity-type": "point-to-point", + "id": "line1" +} diff --git a/src/tests/ofc25-camara-agg-net-controller/data/pc2_slice1_put_ietf_network_slice.json b/src/tests/ofc25-camara-agg-net-controller/data/pc2_slice1_put_ietf_network_slice.json new file mode 100644 index 0000000000000000000000000000000000000000..66e386c483ca1989519ec9ae5c4eef468c41f4bf --- /dev/null +++ b/src/tests/ofc25-camara-agg-net-controller/data/pc2_slice1_put_ietf_network_slice.json @@ -0,0 +1,58 @@ +{ + "connectivity-construct": [ + { + "id": 1, + "p2p-receiver-sdp": "2", + "p2p-sender-sdp": "1", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": 10, + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": 10000, + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": 0.001 + } + ] + } + } + }, + { + "id": 2, + "p2p-receiver-sdp": "1", + "p2p-sender-sdp": "2", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": 20, + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": 2000, + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": 0.001 + } + ] + } + } + } + ], + "connectivity-type": "point-to-point", + "id": "line1" +} diff --git a/src/tests/ofc25-camara-agg-net-controller/data/pc2_slice2_put_ietf_network_slice.json b/src/tests/ofc25-camara-agg-net-controller/data/pc2_slice2_put_ietf_network_slice.json new file mode 100644 index 0000000000000000000000000000000000000000..66e386c483ca1989519ec9ae5c4eef468c41f4bf --- /dev/null +++ b/src/tests/ofc25-camara-agg-net-controller/data/pc2_slice2_put_ietf_network_slice.json @@ -0,0 +1,58 @@ +{ + "connectivity-construct": [ + { + "id": 1, + "p2p-receiver-sdp": "2", + "p2p-sender-sdp": "1", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": 10, + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": 10000, + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": 0.001 + } + ] + } + } + }, + { + "id": 2, + "p2p-receiver-sdp": "1", + "p2p-sender-sdp": "2", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": 20, + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": 2000, + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": 0.001 + } + ] + } + } + } + ], + "connectivity-type": "point-to-point", + "id": "line1" +} diff --git a/src/tests/ofc25-camara-agg-net-controller/data/target-l3vpn-slice1-stages.json b/src/tests/ofc25-camara-agg-net-controller/data/target-l3vpn-slice1-stages.json new file mode 100644 index 0000000000000000000000000000000000000000..5e75b0ff71eee30c3e73e58e92a5830981a2ef96 --- /dev/null +++ b/src/tests/ofc25-camara-agg-net-controller/data/target-l3vpn-slice1-stages.json @@ -0,0 +1,557 @@ +[ + { + "ietf-l3vpn-svc:l3vpn-svc": { + "sites": { + "site": [ + { + "devices": { + "device": [ + { + "device-id": "172.16.185.32", + "location": "cloud" + } + ] + }, + "locations": { + "location": [ + { + "location-id": "cloud" + } + ] + }, + "management": { + "type": "ietf-l3vpn-svc:provider-managed" + }, + "routing-protocols": { + "routing-protocol": [ + { + "static": { + "cascaded-lan-prefixes": { + "ipv4-lan-prefixes": [ + { + "lan": "172.16.104.221/24", + "lan-tag": "101", + "next-hop": "172.10.33.254" + } + ] + } + }, + "type": "ietf-l3vpn-svc:static" + } + ] + }, + "site-id": "site_cloud", + "site-network-accesses": { + "site-network-access": [ + { + "device-reference": "172.16.185.32", + "ip-connection": { + "ipv4": { + "address-allocation-type": "ietf-l3vpn-svc:static-address", + "addresses": { + "customer-address": "172.10.33.254", + "prefix-length": "24", + "provider-address": "172.10.33.254" + } + } + }, + "service": { + "qos": { + "qos-profile": { + "classes": { + "class": [ + { + "bandwidth": { + "guaranteed-bw-percent": 100 + }, + "class-id": "qos-realtime", + "direction": "ietf-l3vpn-svc:both", + "latency": { + "latency-boundary": 10 + } + } + ] + } + } + }, + "svc-input-bandwidth": 5000000000, + "svc-mtu": 1500, + "svc-output-bandwidth": 1000000000 + }, + "site-network-access-id": "200", + "site-network-access-type": "ietf-l3vpn-svc:multipoint", + "vpn-attachment": { + "site-role": "ietf-l3vpn-svc:hub-role", + "vpn-id": "slice1" + } + } + ] + } + }, + { + "devices": { + "device": [ + { + "device-id": "172.16.182.25", + "location": "access" + } + ] + }, + "locations": { + "location": [ + { + "location-id": "access" + } + ] + }, + "management": { + "type": "ietf-l3vpn-svc:provider-managed" + }, + "routing-protocols": { + "routing-protocol": [ + { + "static": { + "cascaded-lan-prefixes": { + "ipv4-lan-prefixes": [ + { + "lan": "172.1.101.22/24", + "lan-tag": "21", + "next-hop": "128.32.33.254" + } + ] + } + }, + "type": "ietf-l3vpn-svc:static" + } + ] + }, + "site-id": "site_access", + "site-network-accesses": { + "site-network-access": [ + { + "device-reference": "172.16.182.25", + "ip-connection": { + "ipv4": { + "address-allocation-type": "ietf-l3vpn-svc:static-address", + "addresses": { + "customer-address": "128.32.33.254", + "prefix-length": "24", + "provider-address": "128.32.33.254" + } + } + }, + "service": { + "qos": { + "qos-profile": { + "classes": { + "class": [ + { + "bandwidth": { + "guaranteed-bw-percent": 100 + }, + "class-id": "qos-realtime", + "direction": "ietf-l3vpn-svc:both", + "latency": { + "latency-boundary": 20 + } + } + ] + } + } + }, + "svc-input-bandwidth": 1000000000, + "svc-mtu": 1500, + "svc-output-bandwidth": 5000000000 + }, + "site-network-access-id": "200", + "site-network-access-type": "ietf-l3vpn-svc:multipoint", + "vpn-attachment": { + "site-role": "ietf-l3vpn-svc:spoke-role", + "vpn-id": "slice1" + } + } + ] + } + } + ] + }, + "vpn-services": { + "vpn-service": [ + { + "vpn-id": "slice1" + } + ] + } + } + }, + { + "ietf-l3vpn-svc:l3vpn-svc": { + "sites": { + "site": [ + { + "devices": { + "device": [ + { + "device-id": "172.16.185.32", + "location": "cloud" + } + ] + }, + "locations": { + "location": [ + { + "location-id": "cloud" + } + ] + }, + "management": { + "type": "ietf-l3vpn-svc:provider-managed" + }, + "routing-protocols": { + "routing-protocol": [ + { + "static": { + "cascaded-lan-prefixes": { + "ipv4-lan-prefixes": [ + { + "lan": "172.16.104.221/24", + "lan-tag": "101", + "next-hop": "172.10.33.254" + } + ] + } + }, + "type": "ietf-l3vpn-svc:static" + } + ] + }, + "site-id": "site_cloud", + "site-network-accesses": { + "site-network-access": [ + { + "device-reference": "172.16.185.32", + "ip-connection": { + "ipv4": { + "address-allocation-type": "ietf-l3vpn-svc:static-address", + "addresses": { + "customer-address": "172.10.33.254", + "prefix-length": "24", + "provider-address": "172.10.33.254" + } + } + }, + "service": { + "qos": { + "qos-profile": { + "classes": { + "class": [ + { + "bandwidth": { + "guaranteed-bw-percent": 100 + }, + "class-id": "qos-realtime", + "direction": "ietf-l3vpn-svc:both", + "latency": { + "latency-boundary": 10 + } + } + ] + } + } + }, + "svc-input-bandwidth": 10000000000, + "svc-mtu": 1500, + "svc-output-bandwidth": 2000000000 + }, + "site-network-access-id": "200", + "site-network-access-type": "ietf-l3vpn-svc:multipoint", + "vpn-attachment": { + "site-role": "ietf-l3vpn-svc:hub-role", + "vpn-id": "slice1" + } + } + ] + } + }, + { + "devices": { + "device": [ + { + "device-id": "172.16.182.25", + "location": "access" + } + ] + }, + "locations": { + "location": [ + { + "location-id": "access" + } + ] + }, + "management": { + "type": "ietf-l3vpn-svc:provider-managed" + }, + "routing-protocols": { + "routing-protocol": [ + { + "static": { + "cascaded-lan-prefixes": { + "ipv4-lan-prefixes": [ + { + "lan": "172.1.101.22/24", + "lan-tag": "21", + "next-hop": "128.32.33.254" + } + ] + } + }, + "type": "ietf-l3vpn-svc:static" + } + ] + }, + "site-id": "site_access", + "site-network-accesses": { + "site-network-access": [ + { + "device-reference": "172.16.182.25", + "ip-connection": { + "ipv4": { + "address-allocation-type": "ietf-l3vpn-svc:static-address", + "addresses": { + "customer-address": "128.32.33.254", + "prefix-length": "24", + "provider-address": "128.32.33.254" + } + } + }, + "service": { + "qos": { + "qos-profile": { + "classes": { + "class": [ + { + "bandwidth": { + "guaranteed-bw-percent": 100 + }, + "class-id": "qos-realtime", + "direction": "ietf-l3vpn-svc:both", + "latency": { + "latency-boundary": 20 + } + } + ] + } + } + }, + "svc-input-bandwidth": 2000000000, + "svc-mtu": 1500, + "svc-output-bandwidth": 10000000000 + }, + "site-network-access-id": "200", + "site-network-access-type": "ietf-l3vpn-svc:multipoint", + "vpn-attachment": { + "site-role": "ietf-l3vpn-svc:spoke-role", + "vpn-id": "slice1" + } + } + ] + } + } + ] + }, + "vpn-services": { + "vpn-service": [ + { + "vpn-id": "slice1" + } + ] + } + } + }, + { + "ietf-l3vpn-svc:l3vpn-svc": { + "sites": { + "site": [ + { + "devices": { + "device": [ + { + "device-id": "172.16.185.32", + "location": "cloud" + } + ] + }, + "locations": { + "location": [ + { + "location-id": "cloud" + } + ] + }, + "management": { + "type": "ietf-l3vpn-svc:provider-managed" + }, + "routing-protocols": { + "routing-protocol": [ + { + "static": { + "cascaded-lan-prefixes": { + "ipv4-lan-prefixes": [ + { + "lan": "172.16.104.221/24", + "lan-tag": "101", + "next-hop": "172.10.33.254" + } + ] + } + }, + "type": "ietf-l3vpn-svc:static" + } + ] + }, + "site-id": "site_cloud", + "site-network-accesses": { + "site-network-access": [ + { + "device-reference": "172.16.185.32", + "ip-connection": { + "ipv4": { + "address-allocation-type": "ietf-l3vpn-svc:static-address", + "addresses": { + "customer-address": "172.10.33.254", + "prefix-length": "24", + "provider-address": "172.10.33.254" + } + } + }, + "service": { + "qos": { + "qos-profile": { + "classes": { + "class": [ + { + "bandwidth": { + "guaranteed-bw-percent": 100 + }, + "class-id": "qos-realtime", + "direction": "ietf-l3vpn-svc:both", + "latency": { + "latency-boundary": 10 + } + } + ] + } + } + }, + "svc-input-bandwidth": 5000000000, + "svc-mtu": 1500, + "svc-output-bandwidth": 1000000000 + }, + "site-network-access-id": "200", + "site-network-access-type": "ietf-l3vpn-svc:multipoint", + "vpn-attachment": { + "site-role": "ietf-l3vpn-svc:hub-role", + "vpn-id": "slice1" + } + } + ] + } + }, + { + "devices": { + "device": [ + { + "device-id": "172.16.182.25", + "location": "access" + } + ] + }, + "locations": { + "location": [ + { + "location-id": "access" + } + ] + }, + "management": { + "type": "ietf-l3vpn-svc:provider-managed" + }, + "routing-protocols": { + "routing-protocol": [ + { + "static": { + "cascaded-lan-prefixes": { + "ipv4-lan-prefixes": [ + { + "lan": "172.1.101.22/24", + "lan-tag": "21", + "next-hop": "128.32.33.254" + } + ] + } + }, + "type": "ietf-l3vpn-svc:static" + } + ] + }, + "site-id": "site_access", + "site-network-accesses": { + "site-network-access": [ + { + "device-reference": "172.16.182.25", + "ip-connection": { + "ipv4": { + "address-allocation-type": "ietf-l3vpn-svc:static-address", + "addresses": { + "customer-address": "128.32.33.254", + "prefix-length": "24", + "provider-address": "128.32.33.254" + } + } + }, + "service": { + "qos": { + "qos-profile": { + "classes": { + "class": [ + { + "bandwidth": { + "guaranteed-bw-percent": 100 + }, + "class-id": "qos-realtime", + "direction": "ietf-l3vpn-svc:both", + "latency": { + "latency-boundary": 20 + } + } + ] + } + } + }, + "svc-input-bandwidth": 1000000000, + "svc-mtu": 1500, + "svc-output-bandwidth": 5000000000 + }, + "site-network-access-id": "200", + "site-network-access-type": "ietf-l3vpn-svc:multipoint", + "vpn-attachment": { + "site-role": "ietf-l3vpn-svc:spoke-role", + "vpn-id": "slice1" + } + } + ] + } + } + ] + }, + "vpn-services": { + "vpn-service": [ + { + "vpn-id": "slice1" + } + ] + } + } + } +] diff --git a/src/tests/ofc25-camara-agg-net-controller/data/target-l3vpn-slice2-stages.json b/src/tests/ofc25-camara-agg-net-controller/data/target-l3vpn-slice2-stages.json new file mode 100644 index 0000000000000000000000000000000000000000..216287af816b4b8656c9bd386eb6f622c0afe987 --- /dev/null +++ b/src/tests/ofc25-camara-agg-net-controller/data/target-l3vpn-slice2-stages.json @@ -0,0 +1,557 @@ +[ + { + "ietf-l3vpn-svc:l3vpn-svc": { + "sites": { + "site": [ + { + "devices": { + "device": [ + { + "device-id": "172.16.185.32", + "location": "cloud" + } + ] + }, + "locations": { + "location": [ + { + "location-id": "cloud" + } + ] + }, + "management": { + "type": "ietf-l3vpn-svc:provider-managed" + }, + "routing-protocols": { + "routing-protocol": [ + { + "static": { + "cascaded-lan-prefixes": { + "ipv4-lan-prefixes": [ + { + "lan": "172.16.104.221/24", + "lan-tag": "201", + "next-hop": "172.10.33.254" + } + ] + } + }, + "type": "ietf-l3vpn-svc:static" + } + ] + }, + "site-id": "site_cloud", + "site-network-accesses": { + "site-network-access": [ + { + "device-reference": "172.16.185.32", + "ip-connection": { + "ipv4": { + "address-allocation-type": "ietf-l3vpn-svc:static-address", + "addresses": { + "customer-address": "172.10.33.254", + "prefix-length": "24", + "provider-address": "172.10.33.254" + } + } + }, + "service": { + "qos": { + "qos-profile": { + "classes": { + "class": [ + { + "bandwidth": { + "guaranteed-bw-percent": 100 + }, + "class-id": "qos-realtime", + "direction": "ietf-l3vpn-svc:both", + "latency": { + "latency-boundary": 10 + } + } + ] + } + } + }, + "svc-input-bandwidth": 5000000000, + "svc-mtu": 1500, + "svc-output-bandwidth": 1000000000 + }, + "site-network-access-id": "200", + "site-network-access-type": "ietf-l3vpn-svc:multipoint", + "vpn-attachment": { + "site-role": "ietf-l3vpn-svc:hub-role", + "vpn-id": "slice2" + } + } + ] + } + }, + { + "devices": { + "device": [ + { + "device-id": "172.16.182.25", + "location": "access" + } + ] + }, + "locations": { + "location": [ + { + "location-id": "access" + } + ] + }, + "management": { + "type": "ietf-l3vpn-svc:provider-managed" + }, + "routing-protocols": { + "routing-protocol": [ + { + "static": { + "cascaded-lan-prefixes": { + "ipv4-lan-prefixes": [ + { + "lan": "172.1.201.22/24", + "lan-tag": "31", + "next-hop": "128.32.33.254" + } + ] + } + }, + "type": "ietf-l3vpn-svc:static" + } + ] + }, + "site-id": "site_access", + "site-network-accesses": { + "site-network-access": [ + { + "device-reference": "172.16.182.25", + "ip-connection": { + "ipv4": { + "address-allocation-type": "ietf-l3vpn-svc:static-address", + "addresses": { + "customer-address": "128.32.33.254", + "prefix-length": "24", + "provider-address": "128.32.33.254" + } + } + }, + "service": { + "qos": { + "qos-profile": { + "classes": { + "class": [ + { + "bandwidth": { + "guaranteed-bw-percent": 100 + }, + "class-id": "qos-realtime", + "direction": "ietf-l3vpn-svc:both", + "latency": { + "latency-boundary": 20 + } + } + ] + } + } + }, + "svc-input-bandwidth": 1000000000, + "svc-mtu": 1500, + "svc-output-bandwidth": 5000000000 + }, + "site-network-access-id": "200", + "site-network-access-type": "ietf-l3vpn-svc:multipoint", + "vpn-attachment": { + "site-role": "ietf-l3vpn-svc:spoke-role", + "vpn-id": "slice2" + } + } + ] + } + } + ] + }, + "vpn-services": { + "vpn-service": [ + { + "vpn-id": "slice2" + } + ] + } + } + }, + { + "ietf-l3vpn-svc:l3vpn-svc": { + "sites": { + "site": [ + { + "devices": { + "device": [ + { + "device-id": "172.16.185.32", + "location": "cloud" + } + ] + }, + "locations": { + "location": [ + { + "location-id": "cloud" + } + ] + }, + "management": { + "type": "ietf-l3vpn-svc:provider-managed" + }, + "routing-protocols": { + "routing-protocol": [ + { + "static": { + "cascaded-lan-prefixes": { + "ipv4-lan-prefixes": [ + { + "lan": "172.16.104.221/24", + "lan-tag": "201", + "next-hop": "172.10.33.254" + } + ] + } + }, + "type": "ietf-l3vpn-svc:static" + } + ] + }, + "site-id": "site_cloud", + "site-network-accesses": { + "site-network-access": [ + { + "device-reference": "172.16.185.32", + "ip-connection": { + "ipv4": { + "address-allocation-type": "ietf-l3vpn-svc:static-address", + "addresses": { + "customer-address": "172.10.33.254", + "prefix-length": "24", + "provider-address": "172.10.33.254" + } + } + }, + "service": { + "qos": { + "qos-profile": { + "classes": { + "class": [ + { + "bandwidth": { + "guaranteed-bw-percent": 100 + }, + "class-id": "qos-realtime", + "direction": "ietf-l3vpn-svc:both", + "latency": { + "latency-boundary": 10 + } + } + ] + } + } + }, + "svc-input-bandwidth": 10000000000, + "svc-mtu": 1500, + "svc-output-bandwidth": 2000000000 + }, + "site-network-access-id": "200", + "site-network-access-type": "ietf-l3vpn-svc:multipoint", + "vpn-attachment": { + "site-role": "ietf-l3vpn-svc:hub-role", + "vpn-id": "slice2" + } + } + ] + } + }, + { + "devices": { + "device": [ + { + "device-id": "172.16.182.25", + "location": "access" + } + ] + }, + "locations": { + "location": [ + { + "location-id": "access" + } + ] + }, + "management": { + "type": "ietf-l3vpn-svc:provider-managed" + }, + "routing-protocols": { + "routing-protocol": [ + { + "static": { + "cascaded-lan-prefixes": { + "ipv4-lan-prefixes": [ + { + "lan": "172.1.201.22/24", + "lan-tag": "31", + "next-hop": "128.32.33.254" + } + ] + } + }, + "type": "ietf-l3vpn-svc:static" + } + ] + }, + "site-id": "site_access", + "site-network-accesses": { + "site-network-access": [ + { + "device-reference": "172.16.182.25", + "ip-connection": { + "ipv4": { + "address-allocation-type": "ietf-l3vpn-svc:static-address", + "addresses": { + "customer-address": "128.32.33.254", + "prefix-length": "24", + "provider-address": "128.32.33.254" + } + } + }, + "service": { + "qos": { + "qos-profile": { + "classes": { + "class": [ + { + "bandwidth": { + "guaranteed-bw-percent": 100 + }, + "class-id": "qos-realtime", + "direction": "ietf-l3vpn-svc:both", + "latency": { + "latency-boundary": 20 + } + } + ] + } + } + }, + "svc-input-bandwidth": 2000000000, + "svc-mtu": 1500, + "svc-output-bandwidth": 10000000000 + }, + "site-network-access-id": "200", + "site-network-access-type": "ietf-l3vpn-svc:multipoint", + "vpn-attachment": { + "site-role": "ietf-l3vpn-svc:spoke-role", + "vpn-id": "slice2" + } + } + ] + } + } + ] + }, + "vpn-services": { + "vpn-service": [ + { + "vpn-id": "slice2" + } + ] + } + } + }, + { + "ietf-l3vpn-svc:l3vpn-svc": { + "sites": { + "site": [ + { + "devices": { + "device": [ + { + "device-id": "172.16.185.32", + "location": "cloud" + } + ] + }, + "locations": { + "location": [ + { + "location-id": "cloud" + } + ] + }, + "management": { + "type": "ietf-l3vpn-svc:provider-managed" + }, + "routing-protocols": { + "routing-protocol": [ + { + "static": { + "cascaded-lan-prefixes": { + "ipv4-lan-prefixes": [ + { + "lan": "172.16.104.221/24", + "lan-tag": "201", + "next-hop": "172.10.33.254" + } + ] + } + }, + "type": "ietf-l3vpn-svc:static" + } + ] + }, + "site-id": "site_cloud", + "site-network-accesses": { + "site-network-access": [ + { + "device-reference": "172.16.185.32", + "ip-connection": { + "ipv4": { + "address-allocation-type": "ietf-l3vpn-svc:static-address", + "addresses": { + "customer-address": "172.10.33.254", + "prefix-length": "24", + "provider-address": "172.10.33.254" + } + } + }, + "service": { + "qos": { + "qos-profile": { + "classes": { + "class": [ + { + "bandwidth": { + "guaranteed-bw-percent": 100 + }, + "class-id": "qos-realtime", + "direction": "ietf-l3vpn-svc:both", + "latency": { + "latency-boundary": 10 + } + } + ] + } + } + }, + "svc-input-bandwidth": 5000000000, + "svc-mtu": 1500, + "svc-output-bandwidth": 1000000000 + }, + "site-network-access-id": "200", + "site-network-access-type": "ietf-l3vpn-svc:multipoint", + "vpn-attachment": { + "site-role": "ietf-l3vpn-svc:hub-role", + "vpn-id": "slice2" + } + } + ] + } + }, + { + "devices": { + "device": [ + { + "device-id": "172.16.182.25", + "location": "access" + } + ] + }, + "locations": { + "location": [ + { + "location-id": "access" + } + ] + }, + "management": { + "type": "ietf-l3vpn-svc:provider-managed" + }, + "routing-protocols": { + "routing-protocol": [ + { + "static": { + "cascaded-lan-prefixes": { + "ipv4-lan-prefixes": [ + { + "lan": "172.1.201.22/24", + "lan-tag": "31", + "next-hop": "128.32.33.254" + } + ] + } + }, + "type": "ietf-l3vpn-svc:static" + } + ] + }, + "site-id": "site_access", + "site-network-accesses": { + "site-network-access": [ + { + "device-reference": "172.16.182.25", + "ip-connection": { + "ipv4": { + "address-allocation-type": "ietf-l3vpn-svc:static-address", + "addresses": { + "customer-address": "128.32.33.254", + "prefix-length": "24", + "provider-address": "128.32.33.254" + } + } + }, + "service": { + "qos": { + "qos-profile": { + "classes": { + "class": [ + { + "bandwidth": { + "guaranteed-bw-percent": 100 + }, + "class-id": "qos-realtime", + "direction": "ietf-l3vpn-svc:both", + "latency": { + "latency-boundary": 20 + } + } + ] + } + } + }, + "svc-input-bandwidth": 1000000000, + "svc-mtu": 1500, + "svc-output-bandwidth": 5000000000 + }, + "site-network-access-id": "200", + "site-network-access-type": "ietf-l3vpn-svc:multipoint", + "vpn-attachment": { + "site-role": "ietf-l3vpn-svc:spoke-role", + "vpn-id": "slice2" + } + } + ] + } + } + ] + }, + "vpn-services": { + "vpn-service": [ + { + "vpn-id": "slice2" + } + ] + } + } + } +] diff --git a/src/tests/ofc25-camara-agg-net-controller/deploy_specs.sh b/src/tests/ofc25-camara-agg-net-controller/deploy_specs.sh new file mode 100755 index 0000000000000000000000000000000000000000..9ae83e7b126aa2913cd3c30887292b4626dd5855 --- /dev/null +++ b/src/tests/ofc25-camara-agg-net-controller/deploy_specs.sh @@ -0,0 +1,208 @@ +#!/bin/bash +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + + +# ----- TeraFlowSDN ------------------------------------------------------------ + +# Set the URL of the internal MicroK8s Docker registry where the images will be uploaded to. +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 slice nbi" + +# Uncomment to activate Monitoring (old) +#export TFS_COMPONENTS="${TFS_COMPONENTS} monitoring" + +# Uncomment to activate Monitoring Framework (new) +#export TFS_COMPONENTS="${TFS_COMPONENTS} kpi_manager kpi_value_writer kpi_value_api telemetry analytics automation" + +# Uncomment to activate QoS Profiles +#export TFS_COMPONENTS="${TFS_COMPONENTS} qos_profile" + +# Uncomment to activate BGP-LS Speaker +#export TFS_COMPONENTS="${TFS_COMPONENTS} bgpls_speaker" + +# Uncomment to activate Optical Controller +# To manage optical connections, "service" requires "opticalcontroller" to be deployed +# before "service", thus we "hack" the TFS_COMPONENTS environment variable prepending the +# "opticalcontroller" only if "service" is already in TFS_COMPONENTS, and re-export it. +#if [[ "$TFS_COMPONENTS" == *"service"* ]]; then +# BEFORE="${TFS_COMPONENTS% service*}" +# AFTER="${TFS_COMPONENTS#* service}" +# export TFS_COMPONENTS="${BEFORE} opticalcontroller service ${AFTER}" +#fi + +# Uncomment to activate ZTP +#export TFS_COMPONENTS="${TFS_COMPONENTS} ztp" + +# Uncomment to activate Policy Manager +#export TFS_COMPONENTS="${TFS_COMPONENTS} policy" + +# Uncomment to activate Optical CyberSecurity +#export TFS_COMPONENTS="${TFS_COMPONENTS} dbscanserving opticalattackmitigator opticalattackdetector opticalattackmanager" + +# Uncomment to activate L3 CyberSecurity +#export TFS_COMPONENTS="${TFS_COMPONENTS} l3_attackmitigator l3_centralizedattackdetector" + +# Uncomment to activate TE +#export TFS_COMPONENTS="${TFS_COMPONENTS} te" + +# Uncomment to activate Forecaster +#export TFS_COMPONENTS="${TFS_COMPONENTS} forecaster" + +# Uncomment to activate E2E Orchestrator +#export TFS_COMPONENTS="${TFS_COMPONENTS} e2e_orchestrator" + +# Uncomment to activate DLT and Interdomain +#export TFS_COMPONENTS="${TFS_COMPONENTS} interdomain dlt" +#if [[ "$TFS_COMPONENTS" == *"dlt"* ]]; then +# export KEY_DIRECTORY_PATH="src/dlt/gateway/keys/priv_sk" +# export CERT_DIRECTORY_PATH="src/dlt/gateway/keys/cert.pem" +# export TLS_CERT_PATH="src/dlt/gateway/keys/ca.crt" +#fi + +# Uncomment to activate QKD App +# To manage QKD Apps, "service" requires "qkd_app" to be deployed +# before "service", thus we "hack" the TFS_COMPONENTS environment variable prepending the +# "qkd_app" only if "service" is already in TFS_COMPONENTS, and re-export it. +#if [[ "$TFS_COMPONENTS" == *"service"* ]]; then +# BEFORE="${TFS_COMPONENTS% service*}" +# AFTER="${TFS_COMPONENTS#* service}" +# export TFS_COMPONENTS="${BEFORE} qkd_app service ${AFTER}" +#fi + + +# Set the tag you want to use for your images. +export TFS_IMAGE_TAG="dev" + +# Set the name of the Kubernetes namespace to deploy TFS to. +export TFS_K8S_NAMESPACE="tfs" + +# Set additional manifest files to be applied after the deployment +export TFS_EXTRA_MANIFESTS="manifests/nginx_ingress_http.yaml" + +# Uncomment to monitor performance of components +#export TFS_EXTRA_MANIFESTS="${TFS_EXTRA_MANIFESTS} manifests/servicemonitors.yaml" + +# Uncomment when deploying Optical CyberSecurity +#export TFS_EXTRA_MANIFESTS="${TFS_EXTRA_MANIFESTS} manifests/cachingservice.yaml" + +# Set the new Grafana admin password +export TFS_GRAFANA_PASSWORD="admin123+" + +# Disable skip-build flag to rebuild the Docker images. +export TFS_SKIP_BUILD="" + + +# ----- CockroachDB ------------------------------------------------------------ + +# Set the namespace where CockroackDB will be deployed. +export CRDB_NAMESPACE="crdb" + +# Set the external port CockroackDB Postgre SQL interface will be exposed to. +export CRDB_EXT_PORT_SQL="26257" + +# Set the external port CockroackDB HTTP Mgmt GUI interface will be exposed to. +export CRDB_EXT_PORT_HTTP="8081" + +# Set the database username to be used by Context. +export CRDB_USERNAME="tfs" + +# Set the database user's password to be used by Context. +export CRDB_PASSWORD="tfs123" + +# Set CockroachDB installation mode to 'single'. This option is convenient for development and testing. +# See ./deploy/all.sh or ./deploy/crdb.sh for additional details +export CRDB_DEPLOY_MODE="single" + +# Disable flag for dropping database, if it exists. +export CRDB_DROP_DATABASE_IF_EXISTS="YES" + +# Disable flag for re-deploying CockroachDB from scratch. +export CRDB_REDEPLOY="" + + +# ----- NATS ------------------------------------------------------------------- + +# Set the namespace where NATS will be deployed. +export NATS_NAMESPACE="nats" + +# Set the external port NATS Client interface will be exposed to. +export NATS_EXT_PORT_CLIENT="4222" + +# Set the external port NATS HTTP Mgmt GUI interface will be exposed to. +export NATS_EXT_PORT_HTTP="8222" + +# Set NATS installation mode to 'single'. This option is convenient for development and testing. +# See ./deploy/all.sh or ./deploy/nats.sh for additional details +export NATS_DEPLOY_MODE="single" + +# Disable flag for re-deploying NATS from scratch. +export NATS_REDEPLOY="" + + +# ----- QuestDB ---------------------------------------------------------------- + +# Set the namespace where QuestDB will be deployed. +export QDB_NAMESPACE="qdb" + +# Set the external port QuestDB Postgre SQL interface will be exposed to. +export QDB_EXT_PORT_SQL="8812" + +# Set the external port QuestDB Influx Line Protocol interface will be exposed to. +export QDB_EXT_PORT_ILP="9009" + +# Set the external port QuestDB HTTP Mgmt GUI interface will be exposed to. +export QDB_EXT_PORT_HTTP="9000" + +# Set the database username to be used for QuestDB. +export QDB_USERNAME="admin" + +# Set the database user's password to be used for QuestDB. +export QDB_PASSWORD="quest" + +# Set the table name to be used by Monitoring for KPIs. +export QDB_TABLE_MONITORING_KPIS="tfs_monitoring_kpis" + +# Set the table name to be used by Slice for plotting groups. +export QDB_TABLE_SLICE_GROUPS="tfs_slice_groups" + +# Disable flag for dropping tables if they exist. +export QDB_DROP_TABLES_IF_EXIST="YES" + +# Disable flag for re-deploying QuestDB from scratch. +export QDB_REDEPLOY="" + + +# ----- K8s Observability ------------------------------------------------------ + +# Set the external port Prometheus Mgmt HTTP GUI interface will be exposed to. +export PROM_EXT_PORT_HTTP="9090" + +# Set the external port Grafana HTTP Dashboards will be exposed to. +export GRAF_EXT_PORT_HTTP="3000" + + +# ----- Apache Kafka ----------------------------------------------------------- + +# Set the namespace where Apache Kafka will be deployed. +export KFK_NAMESPACE="kafka" + +# Set the port Apache Kafka server will be exposed to. +export KFK_SERVER_PORT="9092" + +# Set the flag to YES for redeploying of Apache Kafka +export KFK_REDEPLOY="" diff --git a/src/tests/ofc25-camara-agg-net-controller/redeploy-tfs.sh b/src/tests/ofc25-camara-agg-net-controller/redeploy-tfs.sh new file mode 100755 index 0000000000000000000000000000000000000000..7f4e0c0f4048348b4b220508d60088e69a3219fb --- /dev/null +++ b/src/tests/ofc25-camara-agg-net-controller/redeploy-tfs.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +source ~/tfs-ctrl/src/tests/ofc25-camara-agg-net-controller/deploy_specs.sh +./deploy/all.sh diff --git a/src/tests/ofc25-camara-agg-net-controller/requirements.in b/src/tests/ofc25-camara-agg-net-controller/requirements.in new file mode 100644 index 0000000000000000000000000000000000000000..1bdaec9997da4b83fa89c1bf0d00d4c3a73558a4 --- /dev/null +++ b/src/tests/ofc25-camara-agg-net-controller/requirements.in @@ -0,0 +1,30 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +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-camara-agg-net-controller/scripts/run-agg-net-ietf-slice-operations.sh b/src/tests/ofc25-camara-agg-net-controller/scripts/run-agg-net-ietf-slice-operations.sh new file mode 100755 index 0000000000000000000000000000000000000000..001380ea2fcb88f8546bfd2345fab9431c5e1d03 --- /dev/null +++ b/src/tests/ofc25-camara-agg-net-controller/scripts/run-agg-net-ietf-slice-operations.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +source /var/teraflow/tfs_runtime_env_vars.sh +export PYTHONPATH=/var/teraflow +pytest --verbose --log-level=INFO \ + --junitxml=/opt/results/report_e2e_ietf_l3vpn_operations.xml \ + /var/teraflow/tests/ofc25-camara-agg-net-controller/tests/test_agg_net_ietf_slice_operations.py diff --git a/src/tests/ofc25-camara-agg-net-controller/scripts/run-onboarding.sh b/src/tests/ofc25-camara-agg-net-controller/scripts/run-onboarding.sh new file mode 100755 index 0000000000000000000000000000000000000000..f62294a934ac4aed1140143d2ffbfe02568a6405 --- /dev/null +++ b/src/tests/ofc25-camara-agg-net-controller/scripts/run-onboarding.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +source /var/teraflow/tfs_runtime_env_vars.sh +export PYTHONPATH=/var/teraflow +pytest --verbose --log-level=INFO \ + --junitxml=/opt/results/report_onboarding.xml \ + /var/teraflow/tests/ofc25-camara-agg-net-controller/tests/test_onboarding.py diff --git a/src/tests/ofc25-camara-agg-net-controller/tests/Fixtures.py b/src/tests/ofc25-camara-agg-net-controller/tests/Fixtures.py new file mode 100644 index 0000000000000000000000000000000000000000..15978851faae668339fa4eed6db8ab7e1be2eb5e --- /dev/null +++ b/src/tests/ofc25-camara-agg-net-controller/tests/Fixtures.py @@ -0,0 +1,43 @@ +# Copyright 2022-2024 ETSI SDG TeraFlowSDN (TFS) (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. + +import pytest +from context.client.ContextClient import ContextClient +from device.client.DeviceClient import DeviceClient +from monitoring.client.MonitoringClient import MonitoringClient +from service.client.ServiceClient import ServiceClient + +@pytest.fixture(scope='session') +def context_client(): + _client = ContextClient() + yield _client + _client.close() + +@pytest.fixture(scope='session') +def device_client(): + _client = DeviceClient() + yield _client + _client.close() + +@pytest.fixture(scope='session') +def monitoring_client(): + _client = MonitoringClient() + yield _client + _client.close() + +@pytest.fixture(scope='session') +def service_client(): + _client = ServiceClient() + yield _client + _client.close() diff --git a/src/tests/ofc25-camara-agg-net-controller/tests/Tools.py b/src/tests/ofc25-camara-agg-net-controller/tests/Tools.py new file mode 100644 index 0000000000000000000000000000000000000000..cd2add49edd23f4c169b5fdc3c5123b2b31daa8d --- /dev/null +++ b/src/tests/ofc25-camara-agg-net-controller/tests/Tools.py @@ -0,0 +1,109 @@ +# Copyright 2022-2024 ETSI SDG TeraFlowSDN (TFS) (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. + +import enum, logging, requests +from typing import Any, Dict, List, Optional, Set, Union +from common.Constants import ServiceNameEnum +from common.Settings import get_service_host, get_service_port_http + +NBI_ADDRESS = get_service_host(ServiceNameEnum.NBI) +NBI_PORT = get_service_port_http(ServiceNameEnum.NBI) +NBI_USERNAME = 'admin' +NBI_PASSWORD = 'admin' +NBI_BASE_URL = '' + +class RestRequestMethod(enum.Enum): + GET = 'get' + POST = 'post' + PUT = 'put' + PATCH = 'patch' + DELETE = 'delete' + +EXPECTED_STATUS_CODES : Set[int] = { + requests.codes['OK' ], + requests.codes['CREATED' ], + requests.codes['ACCEPTED' ], + requests.codes['NO_CONTENT'], +} + +def do_rest_request( + 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]]: + request_url = 'http://{:s}:{:s}@{:s}:{:d}{:s}{:s}'.format( + NBI_USERNAME, NBI_PASSWORD, NBI_ADDRESS, NBI_PORT, str(NBI_BASE_URL), url + ) + + if logger is not None: + 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, headers={'Content-Type': 'application/json'}, 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) + + 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 +) -> Optional[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 +) -> Optional[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 +) -> Optional[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_patch_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 +) -> Optional[Union[Dict, List]]: + return do_rest_request( + RestRequestMethod.PATCH, 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 +) -> Optional[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/tests/ofc25-camara-agg-net-controller/tests/__init__.py b/src/tests/ofc25-camara-agg-net-controller/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..3ccc21c7db78aac26daa1f8c5ff8e1ffd3f35460 --- /dev/null +++ b/src/tests/ofc25-camara-agg-net-controller/tests/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + diff --git a/src/tests/ofc25-camara-agg-net-controller/tests/test_agg_net_ietf_slice_operations.py b/src/tests/ofc25-camara-agg-net-controller/tests/test_agg_net_ietf_slice_operations.py new file mode 100644 index 0000000000000000000000000000000000000000..d15a8bbb6d3e9007da24985c6d452e80f9b7db5a --- /dev/null +++ b/src/tests/ofc25-camara-agg-net-controller/tests/test_agg_net_ietf_slice_operations.py @@ -0,0 +1,206 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +import json, logging, os +import requests +from deepdiff import DeepDiff + + +LOGGER = logging.getLogger(__name__) +LOGGER.setLevel(logging.DEBUG) + +HEADERS = {"Content-Type": "application/json"} + +TARGET_L3VPN_SLICE1_STAGES = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "..", + "data", + "target-l3vpn-slice1-stages.json", +) + +TARGET_L3VPN_SLICE2_STAGES = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "..", + "data", + "target-l3vpn-slice2-stages.json", +) + +OP1_IETF_SLICE = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "..", + "data", + "pc1_slice1_post_ietf_network_slice.json", +) + +OP2_IETF_SLICE = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "..", + "data", + "pc2_slice1_put_ietf_network_slice.json", +) + +OP3_IETF_SLICE = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "..", + "data", + "pc1_slice2_post_ietf_network_slice.json", +) + +OP4_IETF_SLICE = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "..", + "data", + "pc2_slice2_put_ietf_network_slice.json", +) + +OP6_IETF_SLICE = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "..", + "data", + "pc1_slice1_put_ietf_network_slice.json", +) + +OP8_IETF_SLICE = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "..", + "data", + "pc1_slice2_put_ietf_network_slice.json", +) + +NBI_ADDRESS = "localhost" +NBI_PORT = "80" +NBI_USERNAME = "admin" +NBI_PASSWORD = "admin" + +IP_ADDRESS = "localhost" +IP_PORT = 9092 + +BASE_IETF_SLICE_URL = f"http://{NBI_ADDRESS}:{NBI_PORT}/restconf/data/ietf-network-slice-service:network-slice-services" +IP_L3VPN_URL = f"http://{IP_ADDRESS}:{IP_PORT}/restconf/data/ietf-l3vpn-svc:l3vpn-svc/vpn-services" + +# pylint: disable=redefined-outer-name, unused-argument +def test_ietf_slice_creation_removal(): + # Issue service creation request + with open(OP1_IETF_SLICE, "r", encoding="UTF-8") as f: + op1_ietf_slice = json.load(f) + with open(OP2_IETF_SLICE, "r", encoding="UTF-8") as f: + op2_ietf_slice = json.load(f) + with open(OP3_IETF_SLICE, "r", encoding="UTF-8") as f: + op3_ietf_slice = json.load(f) + with open(OP4_IETF_SLICE, "r", encoding="UTF-8") as f: + op4_ietf_slice = json.load(f) + with open(OP6_IETF_SLICE, "r", encoding="UTF-8") as f: + op6_ietf_slice = json.load(f) + with open(OP8_IETF_SLICE, "r", encoding="UTF-8") as f: + op8_ietf_slice = json.load(f) + with open(TARGET_L3VPN_SLICE1_STAGES, "r", encoding="UTF-8") as f: + target_l3vpn_slice1_stages = json.load(f) + with open(TARGET_L3VPN_SLICE2_STAGES, "r", encoding="UTF-8") as f: + target_l3vpn_slice2_stages = json.load(f) + + # op 1 + URL = BASE_IETF_SLICE_URL + requests.post(URL, headers=HEADERS, json=op1_ietf_slice) + + URL = IP_L3VPN_URL + l3vpns = requests.get(URL).json() + + slice_name = "slice1" + diff = DeepDiff(target_l3vpn_slice1_stages[0], l3vpns[slice_name]) + assert not diff + + # op 2 + URL = BASE_IETF_SLICE_URL + "/slice-service=slice1/connection-groups/connection-group=line1" + requests.put(URL, headers=HEADERS, json=op2_ietf_slice) + + URL = IP_L3VPN_URL + l3vpns = requests.get(URL).json() + + slice_name = "slice1" + diff = DeepDiff(target_l3vpn_slice1_stages[1], l3vpns[slice_name]) + assert not diff + + # op 3 + URL = BASE_IETF_SLICE_URL + requests.post(URL, headers=HEADERS, json=op3_ietf_slice) + + URL = IP_L3VPN_URL + l3vpns = requests.get(URL).json() + + slice_name = "slice2" + diff = DeepDiff(target_l3vpn_slice2_stages[0], l3vpns[slice_name]) + assert not diff + + # op 4 + URL = BASE_IETF_SLICE_URL + "/slice-service=slice2/connection-groups/connection-group=line1" + requests.put(URL, headers=HEADERS, json=op4_ietf_slice) + + URL = IP_L3VPN_URL + l3vpns = requests.get(URL).json() + + slice_name = "slice2" + diff = DeepDiff(target_l3vpn_slice2_stages[1], l3vpns[slice_name]) + assert not diff + + # op 5 + + + # op 6 + URL = BASE_IETF_SLICE_URL + "/slice-service=slice1/connection-groups/connection-group=line1" + requests.put(URL, headers=HEADERS, json=op6_ietf_slice) + + URL = IP_L3VPN_URL + l3vpns = requests.get(URL).json() + + slice_name = "slice1" + diff = DeepDiff(target_l3vpn_slice1_stages[2], l3vpns[slice_name]) + assert not diff + + # op 7 + URL = BASE_IETF_SLICE_URL + "/slice-service=slice1" + requests.delete(URL) + + URL = IP_L3VPN_URL + l3vpns = requests.get(URL).json() + + slice_name = "slice1" + assert slice_name not in l3vpns + + # op 8 + URL = BASE_IETF_SLICE_URL + "/slice-service=slice2/connection-groups/connection-group=line1" + requests.put(URL, headers=HEADERS, json=op8_ietf_slice) + + URL = IP_L3VPN_URL + l3vpns = requests.get(URL).json() + + slice_name = "slice2" + diff = DeepDiff(target_l3vpn_slice2_stages[2], l3vpns[slice_name]) + assert not diff + + # op 9 + URL = BASE_IETF_SLICE_URL + "/slice-service=slice2" + requests.delete(URL) + + URL = IP_L3VPN_URL + l3vpns = requests.get(URL).json() + + slice_name = "slice2" + assert slice_name not in l3vpns + + # op 10 + + URL = IP_L3VPN_URL + l3vpns = requests.get(URL).json() + + assert not l3vpns diff --git a/src/tests/ofc25-camara-agg-net-controller/tests/test_onboarding.py b/src/tests/ofc25-camara-agg-net-controller/tests/test_onboarding.py new file mode 100644 index 0000000000000000000000000000000000000000..7173ddacc6e6a06aad9cba099a2cb26bab56f7a9 --- /dev/null +++ b/src/tests/ofc25-camara-agg-net-controller/tests/test_onboarding.py @@ -0,0 +1,67 @@ +# Copyright 2022-2024 ETSI SDG TeraFlowSDN (TFS) (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. + +import logging, os, time +from common.Constants import DEFAULT_CONTEXT_NAME +from common.proto.context_pb2 import ContextId, DeviceOperationalStatusEnum, Empty +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 device.client.DeviceClient import DeviceClient +from .Fixtures import context_client, device_client # pylint: disable=unused-import + +LOGGER = logging.getLogger(__name__) +LOGGER.setLevel(logging.DEBUG) + +DESCRIPTOR_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'data', 'agg-net-descriptor.json') +ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME)) + +def test_scenario_onboarding( + context_client : ContextClient, # pylint: disable=redefined-outer-name + device_client : DeviceClient, # pylint: disable=redefined-outer-name +) -> None: + validate_empty_scenario(context_client) + + descriptor_loader = DescriptorLoader( + 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() + + # 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 + +def test_scenario_devices_enabled( + context_client : ContextClient, # pylint: disable=redefined-outer-name +) -> None: + """ + This test validates that the devices are enabled. + """ + DEVICE_OP_STATUS_ENABLED = DeviceOperationalStatusEnum.DEVICEOPERATIONALSTATUS_ENABLED + + num_devices = -1 + num_devices_enabled, num_retry = 0, 0 + while (num_devices != num_devices_enabled) and (num_retry < 10): + time.sleep(1.0) + response = context_client.ListDevices(Empty()) + num_devices = len(response.devices) + num_devices_enabled = 0 + for device in response.devices: + if device.device_operational_status != DEVICE_OP_STATUS_ENABLED: continue + num_devices_enabled += 1 + LOGGER.info('Num Devices enabled: {:d}/{:d}'.format(num_devices_enabled, num_devices)) + num_retry += 1 + assert num_devices_enabled == num_devices diff --git a/src/tests/ofc25-camara-e2e-controller/.gitignore b/src/tests/ofc25-camara-e2e-controller/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..24a4b233365e23a9462f4b64e8b60fef6a62bee4 --- /dev/null +++ b/src/tests/ofc25-camara-e2e-controller/.gitignore @@ -0,0 +1,5 @@ +clab-*/ +images/ +*.clab.yml.bak +*.tar +*.tar.gz diff --git a/src/tests/ofc25-camara-e2e-controller/.gitlab-ci.yml b/src/tests/ofc25-camara-e2e-controller/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..c78468180ee8fdf855c0dd096031d49bd53ceec3 --- /dev/null +++ b/src/tests/ofc25-camara-e2e-controller/.gitlab-ci.yml @@ -0,0 +1,101 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +# Deploy TeraFlowSDN and Execute end-2-end test +end2end_test ofc25_camara_e2e: + variables: + TEST_NAME: 'ofc25-camara-e2e-controller' + NCE_NAME: 'nce' + AGG_NET_NAME: 'agg_net' + NCE_PORT: '9090' + AGG_NET_PORT: '9091' + stage: end2end_test + # Disable to force running it after all other tasks + before_script: + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + - HOST_IP=$(kubectl get nodes -o json | jq -r '.items[].status.addresses[] | select(.type=="InternalIP") | .address') + - sed -i "s/AGG_NET_IP/${HOST_IP}/g" src/tests/${TEST_NAME}/data/camara-e2e-topology.json + - sed -i "s/NCE_IP/${HOST_IP}/g" src/tests/${TEST_NAME}/data/camara-e2e-topology.json + - sed -i "s/AGG_NET_PORT/${AGG_NET_PORT}/g" src/tests/${TEST_NAME}/data/camara-e2e-topology.json + - sed -i "s/NCE_PORT/${NCE_PORT}/g" src/tests/${TEST_NAME}/data/camara-e2e-topology.json + - docker buildx build -t "${TEST_NAME}:latest" -f ./src/tests/${TEST_NAME}/Dockerfile . + - docker buildx build -t "${NCE_NAME}:latest" -f ./src/tests/tools/mock_nce_ctrl/Dockerfile ./src/tests/tools/mock_nce_ctrl + - docker buildx build -t "${AGG_NET_NAME}:latest" -f ./src/tests/tools/mock_ietf_network_slice_sdn_ctrl/Dockerfile ./src/tests/tools/mock_ietf_network_slice_sdn_ctrl + - docker rm -f ${TEST_NAME} || true + - docker rm -f ${AGG_NET_NAME} || true + - docker rm -f ${NCE_NAME} || true + - docker run -d --name ${NCE_NAME} -p ${NCE_PORT}:8443 ${NCE_NAME}:latest + - docker run -d --name ${AGG_NET_NAME} -p ${AGG_NET_PORT}:8443 ${AGG_NET_NAME}:latest + + script: + # Check MicroK8s is ready + - microk8s status --wait-ready + - kubectl get pods --all-namespaces + + - source src/tests/${TEST_NAME}/deploy_specs.sh + + # Deploy TeraFlowSDN + - ./deploy/crdb.sh + - ./deploy/nats.sh + - ./deploy/qdb.sh + - ./deploy/kafka.sh + - ./deploy/tfs.sh + - ./deploy/show.sh + + - kubectl --namespace $TFS_K8S_NAMESPACE logs deployment/contextservice -c server + + # 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" + ${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" + ${TEST_NAME}:latest /var/teraflow/run-e2e-ietf-slice-operations.sh + + after_script: + - kubectl --namespace tfs logs deployment/contextservice -c server + - kubectl --namespace tfs logs deployment/deviceservice -c server + - kubectl --namespace tfs logs deployment/pathcompservice -c frontend + - kubectl --namespace tfs logs deployment/serviceservice -c server + - kubectl --namespace tfs logs deployment/sliceservice -c server + - kubectl --namespace tfs logs deployment/nbiservice -c server + + - docker logs ${NCE_NAME} + + - docker logs ${AGG_NET_NAME} + + # Destroy Scenario + - kubectl delete namespaces tfs || true + + - docker rm -f ${TEST_NAME} || true + - docker rm -f ${AGG_NET_NAME} || true + - docker rm -f ${NCE_NAME} || true + + # Clean old docker images + - docker images --filter="dangling=true" --quiet | xargs -r docker rmi + + #coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/' + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH)' + - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "develop"' + artifacts: + when: always + reports: + junit: ./src/tests/${TEST_NAME}/report_*.xml diff --git a/src/tests/ofc25-camara-e2e-controller/Dockerfile b/src/tests/ofc25-camara-e2e-controller/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..79b709c13dc352bb853bbe626183e72d37a074f0 --- /dev/null +++ b/src/tests/ofc25-camara-e2e-controller/Dockerfile @@ -0,0 +1,84 @@ +# Copyright 2022-2024 ETSI SDG TeraFlowSDN (TFS) (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. + +FROM python:3.9-slim + +# Install dependencies +RUN apt-get --yes --quiet --quiet update && \ + apt-get --yes --quiet --quiet install wget g++ git && \ + rm -rf /var/lib/apt/lists/* + +# Set Python to show logs as they occur +ENV PYTHONUNBUFFERED=0 + +# Get generic Python packages +RUN python3 -m pip install --upgrade pip +RUN python3 -m pip install --upgrade setuptools wheel +RUN python3 -m pip install --upgrade pip-tools + +# Get common Python packages +# Note: this step enables sharing the previous Docker build steps among all the Python components +WORKDIR /var/teraflow +COPY common_requirements.in common_requirements.in +RUN pip-compile --quiet --output-file=common_requirements.txt common_requirements.in +RUN python3 -m pip install -r common_requirements.txt + +# Add common files into working directory +WORKDIR /var/teraflow/common +COPY src/common/. ./ +RUN rm -rf proto + +# Create proto sub-folder, copy .proto files, and generate Python code +RUN mkdir -p /var/teraflow/common/proto +WORKDIR /var/teraflow/common/proto +RUN touch __init__.py +COPY proto/*.proto ./ +RUN python3 -m grpc_tools.protoc -I=. --python_out=. --grpc_python_out=. *.proto +RUN rm *.proto +RUN find . -type f -exec sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' {} \; + +# Create component sub-folders, get specific Python packages +RUN mkdir -p /var/teraflow/tests/ofc25-camara-e2e-controller +WORKDIR /var/teraflow/tests/ofc25-camara-e2e-controller +COPY src/tests/ofc25-camara-e2e-controller/requirements.in requirements.in +RUN pip-compile --quiet --output-file=requirements.txt requirements.in +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-camara-e2e-controller/__init__.py ./tests/ofc25-camara-e2e-controller/__init__.py +COPY src/tests/ofc25-camara-e2e-controller/data/. ./tests/ofc25-camara-e2e-controller/data/ +COPY src/tests/ofc25-camara-e2e-controller/tests/. ./tests/ofc25-camara-e2e-controller/tests/ +COPY src/tests/ofc25-camara-e2e-controller/scripts/. ./ + +RUN apt-get --yes --quiet --quiet update && \ + apt-get --yes --quiet --quiet install tree && \ + rm -rf /var/lib/apt/lists/* + +RUN tree -la /var/teraflow diff --git a/src/tests/ofc25-camara-e2e-controller/__init__.py b/src/tests/ofc25-camara-e2e-controller/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..3ccc21c7db78aac26daa1f8c5ff8e1ffd3f35460 --- /dev/null +++ b/src/tests/ofc25-camara-e2e-controller/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + diff --git a/src/tests/ofc25-camara-e2e-controller/data/camara-e2e-topology.json b/src/tests/ofc25-camara-e2e-controller/data/camara-e2e-topology.json new file mode 100644 index 0000000000000000000000000000000000000000..7ae2da79c0fe54f883c4c08b98fa0d05c7e74ee0 --- /dev/null +++ b/src/tests/ofc25-camara-e2e-controller/data/camara-e2e-topology.json @@ -0,0 +1,1642 @@ +{ + "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": "agg-net-controller" + } + }, + "name": "agg-net-controller", + "device_type": "ietf-slice", + "device_operational_status": 1, + "device_drivers": [ + 14 + ], + "device_config": { + "config_rules": [ + { + "action": 1, + "custom": { + "resource_key": "_connect/address", + "resource_value": "AGG_NET_IP" + } + }, + { + "action": 1, + "custom": { + "resource_key": "_connect/port", + "resource_value": "AGG_NET_PORT" + } + }, + { + "action": 1, + "custom": { + "resource_key": "_connect/settings", + "resource_value": { + "endpoints": [ + { + "uuid": "mgmt", + "name": "mgmt", + "type": "mgmt" + } + ], + "scheme": "http", + "username": "admin", + "password": "admin", + "base_url": "/restconf/v2/data", + "timeout": 120, + "verify": false + } + } + } + ] + }, + "device_endpoints": [] + }, + { + "device_id": { + "device_uuid": { + "uuid": "nce-controller" + } + }, + "name": "nce-controller", + "device_type": "nce", + "device_operational_status": 1, + "device_drivers": [ + 15 + ], + "device_config": { + "config_rules": [ + { + "action": 1, + "custom": { + "resource_key": "_connect/address", + "resource_value": "NCE_IP" + } + }, + { + "action": 1, + "custom": { + "resource_key": "_connect/port", + "resource_value": "NCE_PORT" + } + }, + { + "action": 1, + "custom": { + "resource_key": "_connect/settings", + "resource_value": { + "endpoints": [ + { + "uuid": "mgmt", + "name": "mgmt", + "type": "mgmt" + } + ], + "scheme": "http", + "username": "admin", + "password": "admin", + "base_url": "/restconf/v2/data", + "timeout": 120, + "verify": false + } + } + } + ] + }, + "device_endpoints": [] + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.182.25" + } + }, + "name": "172.16.182.25", + "device_type": "emu-packet-router", + "controller_id": { + "device_uuid": { + "uuid": "agg-net-controller" + } + }, + "device_operational_status": 1, + "device_drivers": [ + 0, + 14 + ], + "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": "mgmt", + "name": "mgmt", + "type": "mgmt" + }, + { + "uuid": "200", + "name": "200", + "type": "optical", + "address_ip": "128.32.33.254", + "address_prefix": "24", + "site_location": "access", + "mtu": "1500" + }, + { + "uuid": "500", + "name": "500", + "type": "optical" + }, + { + "uuid": "501", + "name": "501", + "type": "optical" + } + ] + } + } + } + ] + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.31" + } + }, + "name": "172.16.185.31", + "device_type": "emu-packet-router", + "controller_id": { + "device_uuid": { + "uuid": "agg-net-controller" + } + }, + "device_operational_status": 1, + "device_drivers": [ + 0, + 14 + ], + "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": "mgmt", + "name": "mgmt", + "type": "mgmt" + }, + { + "uuid": "500", + "name": "500", + "type": "optical" + }, + { + "uuid": "501", + "name": "501", + "type": "optical" + } + ] + } + } + } + ] + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.33" + } + }, + "name": "172.16.185.33", + "device_type": "emu-packet-router", + "controller_id": { + "device_uuid": { + "uuid": "agg-net-controller" + } + }, + "device_operational_status": 1, + "device_drivers": [ + 0, + 14 + ], + "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": "mgmt", + "name": "mgmt", + "type": "mgmt" + }, + { + "uuid": "500", + "name": "500", + "type": "optical" + }, + { + "uuid": "501", + "name": "501", + "type": "optical" + } + ] + } + } + } + ] + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.32" + } + }, + "name": "172.16.185.32", + "device_type": "emu-packet-router", + "controller_id": { + "device_uuid": { + "uuid": "agg-net-controller" + } + }, + "device_operational_status": 1, + "device_drivers": [ + 0, + 14 + ], + "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": "mgmt", + "name": "mgmt", + "type": "mgmt" + }, + { + "uuid": "200", + "name": "200", + "type": "optical", + "ce-ip": "172.10.33.2", + "address_ip": "172.10.33.254", + "address_prefix": "24", + "site_location": "cloud", + "mtu": "1500" + }, + { + "uuid": "500", + "name": "500", + "type": "optical" + }, + { + "uuid": "501", + "name": "501", + "type": "optical" + } + ] + } + } + } + ] + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.58.10" + } + }, + "name": "172.16.58.10", + "device_type": "emu-packet-router", + "controller_id": { + "device_uuid": { + "uuid": "nce-controller" + } + }, + "device_operational_status": 1, + "device_drivers": [ + 15 + ], + "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": "mgmt", + "name": "mgmt", + "type": "mgmt" + }, + { + "uuid": "200", + "name": "200", + "type": "optical", + "address_ip": "0.0.0.0", + "address_prefix": "24" + }, + { + "uuid": "201", + "name": "201", + "type": "optical", + "address_ip": "0.0.0.0", + "address_prefix": "24" + }, + { + "uuid": "500", + "name": "500", + "type": "optical", + "address_ip": "128.32.33.2", + "address_prefix": "24" + } + ] + } + } + } + ] + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.61.10" + } + }, + "name": "172.16.61.10", + "device_type": "emu-packet-router", + "controller_id": { + "device_uuid": { + "uuid": "nce-controller" + } + }, + "device_operational_status": 1, + "device_drivers": [ + 15 + ], + "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": "mgmt", + "name": "mgmt", + "type": "mgmt" + }, + { + "uuid": "200", + "name": "200", + "type": "optical", + "address_ip": "0.0.0.0", + "address_prefix": "24" + }, + { + "uuid": "500", + "name": "500", + "type": "optical", + "address_ip": "128.32.33.2", + "address_prefix": "24" + } + ] + } + } + } + ] + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.61.11" + } + }, + "name": "172.16.61.11", + "device_type": "emu-packet-router", + "controller_id": { + "device_uuid": { + "uuid": "nce-controller" + } + }, + "device_operational_status": 1, + "device_drivers": [ + 15 + ], + "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": "mgmt", + "name": "mgmt", + "type": "mgmt" + }, + { + "uuid": "200", + "name": "200", + "type": "optical", + "address_ip": "0.0.0.0", + "address_prefix": "24" + }, + { + "uuid": "500", + "name": "500", + "type": "optical", + "address_ip": "128.32.33.2", + "address_prefix": "24" + } + ] + } + } + } + ] + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.104.221" + } + }, + "device_type": "emu-datacenter", + "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": [ + { + "sample_types": [], + "type": "copper", + "uuid": "eth0" + } + ] + } + } + } + ] + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.104.222" + } + }, + "device_type": "emu-datacenter", + "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": [ + { + "sample_types": [], + "type": "copper", + "uuid": "eth0" + } + ] + } + } + } + ] + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.204.220" + } + }, + "device_type": "emu-datacenter", + "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": [ + { + "sample_types": [], + "type": "optical", + "uuid": "500" + }, + { + "sample_types": [], + "type": "optical", + "uuid": "200" + }, + { + "sample_types": [], + "type": "optical", + "uuid": "201" + } + ] + } + } + } + ] + } + } + ], + "links": [ + { + "link_id": { + "link_uuid": { + "uuid": "nce-controller/mgmt==172.16.61.11/mgmt" + } + }, + "name": "nce-controller/mgmt==172.16.61.11/mgmt", + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "nce-controller" + } + }, + "endpoint_uuid": { + "uuid": "mgmt" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.61.11" + } + }, + "endpoint_uuid": { + "uuid": "mgmt" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "nce-controller/mgmt==172.16.61.10/mgmt" + } + }, + "name": "nce-controller/mgmt==172.16.61.10/mgmt", + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "nce-controller" + } + }, + "endpoint_uuid": { + "uuid": "mgmt" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.61.10" + } + }, + "endpoint_uuid": { + "uuid": "mgmt" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "nce-controller/mgmt==172.16.58.10/mgmt" + } + }, + "name": "nce-controller/mgmt==172.16.58.10/mgmt", + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "nce-controller" + } + }, + "endpoint_uuid": { + "uuid": "mgmt" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.58.10" + } + }, + "endpoint_uuid": { + "uuid": "mgmt" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "agg-net-controller/mgmt==172.16.185.33/mgmt" + } + }, + "name": "agg-net-controller/mgmt==172.16.185.33/mgmt", + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "agg-net-controller" + } + }, + "endpoint_uuid": { + "uuid": "mgmt" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.33" + } + }, + "endpoint_uuid": { + "uuid": "mgmt" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "agg-net-controller/mgmt==172.16.185.31/mgmt" + } + }, + "name": "agg-net-controller/mgmt==172.16.185.31/mgmt", + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "agg-net-controller" + } + }, + "endpoint_uuid": { + "uuid": "mgmt" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.31" + } + }, + "endpoint_uuid": { + "uuid": "mgmt" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "agg-net-controller/mgmt==172.16.182.25/mgmt" + } + }, + "name": "agg-net-controller/mgmt==172.16.182.25/mgmt", + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "agg-net-controller" + } + }, + "endpoint_uuid": { + "uuid": "mgmt" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.182.25" + } + }, + "endpoint_uuid": { + "uuid": "mgmt" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "agg-net-controller/mgmt==172.16.182.25/mgmt" + } + }, + "name": "agg-net-controller/mgmt==172.16.182.25/mgmt", + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "agg-net-controller" + } + }, + "endpoint_uuid": { + "uuid": "mgmt" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.182.25" + } + }, + "endpoint_uuid": { + "uuid": "mgmt" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "172.16.182.25-500" + } + }, + "name": "172.16.182.25-500", + "attributes": { + "total_capacity_gbps": 10, + "used_capacity_gbps": 0 + }, + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "172.16.182.25" + } + }, + "endpoint_uuid": { + "uuid": "500" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.33" + } + }, + "endpoint_uuid": { + "uuid": "500" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "172.16.185.33-500" + } + }, + "name": "172.16.185.33-500", + "attributes": { + "total_capacity_gbps": 10, + "used_capacity_gbps": 0 + }, + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.33" + } + }, + "endpoint_uuid": { + "uuid": "500" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.182.25" + } + }, + "endpoint_uuid": { + "uuid": "500" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "172.16.182.25-501" + } + }, + "name": "172.16.182.25-501", + "attributes": { + "total_capacity_gbps": 10, + "used_capacity_gbps": 0 + }, + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "172.16.182.25" + } + }, + "endpoint_uuid": { + "uuid": "501" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.31" + } + }, + "endpoint_uuid": { + "uuid": "501" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "172.16.185.31-501" + } + }, + "name": "172.16.185.31-501", + "attributes": { + "total_capacity_gbps": 10, + "used_capacity_gbps": 0 + }, + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.31" + } + }, + "endpoint_uuid": { + "uuid": "501" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.182.25" + } + }, + "endpoint_uuid": { + "uuid": "501" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "172.16.185.31-500" + } + }, + "name": "172.16.185.31-500", + "attributes": { + "total_capacity_gbps": 10, + "used_capacity_gbps": 0 + }, + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.31" + } + }, + "endpoint_uuid": { + "uuid": "500" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.32" + } + }, + "endpoint_uuid": { + "uuid": "500" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "172.16.185.32-500" + } + }, + "name": "172.16.185.32-500", + "attributes": { + "total_capacity_gbps": 10, + "used_capacity_gbps": 0 + }, + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.32" + } + }, + "endpoint_uuid": { + "uuid": "500" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.31" + } + }, + "endpoint_uuid": { + "uuid": "500" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "172.16.185.33-501" + } + }, + "name": "172.16.185.33-501", + "attributes": { + "total_capacity_gbps": 10, + "used_capacity_gbps": 0 + }, + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.33" + } + }, + "endpoint_uuid": { + "uuid": "501" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.32" + } + }, + "endpoint_uuid": { + "uuid": "501" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "172.16.185.32-501" + } + }, + "name": "172.16.185.32-501", + "attributes": { + "total_capacity_gbps": 10, + "used_capacity_gbps": 0 + }, + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.32" + } + }, + "endpoint_uuid": { + "uuid": "501" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.33" + } + }, + "endpoint_uuid": { + "uuid": "501" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "172.16.185.32-200" + } + }, + "name": "172.16.185.32-200", + "attributes": { + "total_capacity_gbps": 10, + "used_capacity_gbps": 0 + }, + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.32" + } + }, + "endpoint_uuid": { + "uuid": "200" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.204.220" + } + }, + "endpoint_uuid": { + "uuid": "500" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "172.16.204.220-500" + } + }, + "name": "172.16.204.220-500", + "attributes": { + "total_capacity_gbps": 10, + "used_capacity_gbps": 0 + }, + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "172.16.204.220" + } + }, + "endpoint_uuid": { + "uuid": "500" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.185.32" + } + }, + "endpoint_uuid": { + "uuid": "200" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "172.16.182.25-200" + } + }, + "name": "172.16.182.25-200", + "attributes": { + "total_capacity_gbps": 10, + "used_capacity_gbps": 0 + }, + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "172.16.182.25" + } + }, + "endpoint_uuid": { + "uuid": "200" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.58.10" + } + }, + "endpoint_uuid": { + "uuid": "500" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "172.16.58.10-500" + } + }, + "name": "172.16.58.10-500", + "attributes": { + "total_capacity_gbps": 10, + "used_capacity_gbps": 0 + }, + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "172.16.58.10" + } + }, + "endpoint_uuid": { + "uuid": "500" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.182.25" + } + }, + "endpoint_uuid": { + "uuid": "200" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "172.16.58.10-200" + } + }, + "name": "172.16.58.10-200", + "attributes": { + "total_capacity_gbps": 10, + "used_capacity_gbps": 0 + }, + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "172.16.58.10" + } + }, + "endpoint_uuid": { + "uuid": "200" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.61.10" + } + }, + "endpoint_uuid": { + "uuid": "500" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "172.16.61.10-500" + } + }, + "name": "172.16.61.10-500", + "attributes": { + "total_capacity_gbps": 10, + "used_capacity_gbps": 0 + }, + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "172.16.61.10" + } + }, + "endpoint_uuid": { + "uuid": "500" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.58.10" + } + }, + "endpoint_uuid": { + "uuid": "200" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "172.16.58.10-201" + } + }, + "name": "172.16.58.10-201", + "attributes": { + "total_capacity_gbps": 10, + "used_capacity_gbps": 0 + }, + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "172.16.58.10" + } + }, + "endpoint_uuid": { + "uuid": "201" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.61.11" + } + }, + "endpoint_uuid": { + "uuid": "500" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "172.16.61.11-500" + } + }, + "name": "172.16.61.11-500", + "attributes": { + "total_capacity_gbps": 10, + "used_capacity_gbps": 0 + }, + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "172.16.61.11" + } + }, + "endpoint_uuid": { + "uuid": "500" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.58.10" + } + }, + "endpoint_uuid": { + "uuid": "201" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "172.16.61.10-200" + } + }, + "name": "172.16.61.10-200", + "attributes": { + "total_capacity_gbps": 10, + "used_capacity_gbps": 0 + }, + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "172.16.61.10" + } + }, + "endpoint_uuid": { + "uuid": "200" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.104.221" + } + }, + "endpoint_uuid": { + "uuid": "eth0" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "172.16.104.221-eth0" + } + }, + "name": "172.16.104.221-eth0", + "attributes": { + "total_capacity_gbps": 10, + "used_capacity_gbps": 0 + }, + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "172.16.104.221" + } + }, + "endpoint_uuid": { + "uuid": "eth0" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.61.10" + } + }, + "endpoint_uuid": { + "uuid": "200" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "172.16.61.11-200" + } + }, + "name": "172.16.61.11-200", + "attributes": { + "total_capacity_gbps": 10, + "used_capacity_gbps": 0 + }, + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "172.16.61.11" + } + }, + "endpoint_uuid": { + "uuid": "200" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.104.222" + } + }, + "endpoint_uuid": { + "uuid": "eth0" + } + } + ] + }, + { + "link_id": { + "link_uuid": { + "uuid": "172.16.104.222-eth0" + } + }, + "name": "172.16.104.222-eth0", + "attributes": { + "total_capacity_gbps": 10, + "used_capacity_gbps": 0 + }, + "link_endpoint_ids": [ + { + "device_id": { + "device_uuid": { + "uuid": "172.16.104.222" + } + }, + "endpoint_uuid": { + "uuid": "eth0" + } + }, + { + "device_id": { + "device_uuid": { + "uuid": "172.16.61.11" + } + }, + "endpoint_uuid": { + "uuid": "200" + } + } + ] + } + ] +} diff --git a/src/tests/ofc25-camara-e2e-controller/data/slice/post_connection_group_to_network_slice1.json b/src/tests/ofc25-camara-e2e-controller/data/slice/post_connection_group_to_network_slice1.json new file mode 100644 index 0000000000000000000000000000000000000000..d39a837bd8c3719463e8ecfd3fbfc2d25111afef --- /dev/null +++ b/src/tests/ofc25-camara-e2e-controller/data/slice/post_connection_group_to_network_slice1.json @@ -0,0 +1,62 @@ +{ + "connection-group": [ + { + "id": "line2", + "connectivity-type": "point-to-point", + "connectivity-construct": [ + { + "id": 1, + "p2p-sender-sdp": "1", + "p2p-receiver-sdp": "3", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds", + "bound": "10" + }, + { + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps", + "bound": "5000" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": "0.001" + } + ] + } + } + }, + { + "id": 2, + "p2p-sender-sdp": "3", + "p2p-receiver-sdp": "1", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds", + "bound": "20" + }, + { + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps", + "bound": "1000" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": "0.001" + } + ] + } + } + } + ] + } + ] +} \ No newline at end of file diff --git a/src/tests/ofc25-camara-e2e-controller/data/slice/post_connection_group_to_network_slice2.json b/src/tests/ofc25-camara-e2e-controller/data/slice/post_connection_group_to_network_slice2.json new file mode 100644 index 0000000000000000000000000000000000000000..d39a837bd8c3719463e8ecfd3fbfc2d25111afef --- /dev/null +++ b/src/tests/ofc25-camara-e2e-controller/data/slice/post_connection_group_to_network_slice2.json @@ -0,0 +1,62 @@ +{ + "connection-group": [ + { + "id": "line2", + "connectivity-type": "point-to-point", + "connectivity-construct": [ + { + "id": 1, + "p2p-sender-sdp": "1", + "p2p-receiver-sdp": "3", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds", + "bound": "10" + }, + { + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps", + "bound": "5000" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": "0.001" + } + ] + } + } + }, + { + "id": 2, + "p2p-sender-sdp": "3", + "p2p-receiver-sdp": "1", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds", + "bound": "20" + }, + { + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps", + "bound": "1000" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": "0.001" + } + ] + } + } + } + ] + } + ] +} \ No newline at end of file diff --git a/src/tests/ofc25-camara-e2e-controller/data/slice/post_match_criteria_to_sdp1_in_slice1.json b/src/tests/ofc25-camara-e2e-controller/data/slice/post_match_criteria_to_sdp1_in_slice1.json new file mode 100644 index 0000000000000000000000000000000000000000..16a36d45b86230b27eafa45a612b95c248a7b3ac --- /dev/null +++ b/src/tests/ofc25-camara-e2e-controller/data/slice/post_match_criteria_to_sdp1_in_slice1.json @@ -0,0 +1,40 @@ +{ + "match-criterion": [ + { + "index": 2, + "match-type": [ + { + "type": "ietf-network-slice-service:vlan", + "value": [ + "101" + ] + }, + { + "type": "ietf-network-slice-service:source-ip-prefix", + "value": [ + "172.1.101.22/24" + ] + }, + { + "type": "ietf-network-slice-service:source-tcp-port", + "value": [ + "10200" + ] + }, + { + "type": "ietf-network-slice-service:destination-ip-prefix", + "value": [ + "172.16.104.222/24" + ] + }, + { + "type": "ietf-network-slice-service:destination-tcp-port", + "value": [ + "10500" + ] + } + ], + "target-connection-group-id": "line2" + } + ] +} \ No newline at end of file diff --git a/src/tests/ofc25-camara-e2e-controller/data/slice/post_match_criteria_to_sdp1_in_slice2.json b/src/tests/ofc25-camara-e2e-controller/data/slice/post_match_criteria_to_sdp1_in_slice2.json new file mode 100644 index 0000000000000000000000000000000000000000..8ceefdc2f2471af225143e5a1def2d7ba71e2ab1 --- /dev/null +++ b/src/tests/ofc25-camara-e2e-controller/data/slice/post_match_criteria_to_sdp1_in_slice2.json @@ -0,0 +1,40 @@ +{ + "match-criterion": [ + { + "index": 2, + "match-type": [ + { + "type": "ietf-network-slice-service:vlan", + "value": [ + "201" + ] + }, + { + "type": "ietf-network-slice-service:source-ip-prefix", + "value": [ + "172.1.201.22/24" + ] + }, + { + "type": "ietf-network-slice-service:source-tcp-port", + "value": [ + "10200" + ] + }, + { + "type": "ietf-network-slice-service:destination-ip-prefix", + "value": [ + "172.16.104.222/24" + ] + }, + { + "type": "ietf-network-slice-service:destination-tcp-port", + "value": [ + "10500" + ] + } + ], + "target-connection-group-id": "line2" + } + ] +} \ No newline at end of file diff --git a/src/tests/ofc25-camara-e2e-controller/data/slice/post_network_slice1.json b/src/tests/ofc25-camara-e2e-controller/data/slice/post_network_slice1.json new file mode 100644 index 0000000000000000000000000000000000000000..e6e0ee90a25ff12f73c8f8896f9c2c74ab6b4019 --- /dev/null +++ b/src/tests/ofc25-camara-e2e-controller/data/slice/post_network_slice1.json @@ -0,0 +1,188 @@ +{ + "slice-service": [ + { + "id": "slice1", + "description": "network slice 1, connect to VM1", + "sdps": { + "sdp": [ + { + "id": "1", + "node-id": "172.16.204.220", + "sdp-ip-address": [ + "172.16.204.220" + ], + "service-match-criteria": { + "match-criterion": [ + { + "index": 1, + "match-type": [ + { + "type": "ietf-network-slice-service:vlan", + "value": [ + "101" + ] + }, + { + "type": "ietf-network-slice-service:destination-ip-prefix", + "value": [ + "172.16.104.221/24" + ] + }, + { + "type": "ietf-network-slice-service:destination-tcp-port", + "value": [ + "10500" + ] + }, + { + "type": "ietf-network-slice-service:source-ip-prefix", + "value": [ + "172.1.101.22/24" + ] + }, + { + "type": "ietf-network-slice-service:source-tcp-port", + "value": [ + "10200" + ] + } + ], + "target-connection-group-id": "line1" + } + ] + }, + "attachment-circuits": { + "attachment-circuit": [ + { + "id": "AC POP to VM1", + "description": "AC VM1 connected to POP", + "ac-node-id": "172.16.204.220", + "ac-tp-id": "200" + } + ] + } + }, + { + "id": "2", + "node-id": "172.16.61.10", + "sdp-ip-address": [ + "172.16.61.10" + ], + "service-match-criteria": { + "match-criterion": [ + { + "index": 1, + "match-type": [ + { + "type": "ietf-network-slice-service:vlan", + "value": [ + "21" + ] + }, + { + "type": "ietf-network-slice-service:source-ip-prefix", + "value": [ + "172.16.104.221/24" + ] + }, + { + "type": "ietf-network-slice-service:source-tcp-port", + "value": [ + "10500" + ] + }, + { + "type": "ietf-network-slice-service:destination-ip-prefix", + "value": [ + "172.1.101.22/24" + ] + }, + { + "type": "ietf-network-slice-service:destination-tcp-port", + "value": [ + "10200" + ] + } + ], + "target-connection-group-id": "line1" + } + ] + }, + "attachment-circuits": { + "attachment-circuit": [ + { + "id": "AC ONT", + "description": "AC connected to PC1", + "ac-node-id": "172.16.61.10", + "ac-tp-id": "200" + } + ] + } + } + ] + }, + "connection-groups": { + "connection-group": [ + { + "id": "line1", + "connectivity-type": "point-to-point", + "connectivity-construct": [ + { + "id": 1, + "p2p-sender-sdp": "1", + "p2p-receiver-sdp": "2", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds", + "bound": "10" + }, + { + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps", + "bound": "5000" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": "0.001" + } + ] + } + } + }, + { + "id": 2, + "p2p-sender-sdp": "2", + "p2p-receiver-sdp": "1", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds", + "bound": "20" + }, + { + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps", + "bound": "1000" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": "0.001" + } + ] + } + } + } + ] + } + ] + } + } + ] +} \ No newline at end of file diff --git a/src/tests/ofc25-camara-e2e-controller/data/slice/post_network_slice2.json b/src/tests/ofc25-camara-e2e-controller/data/slice/post_network_slice2.json new file mode 100644 index 0000000000000000000000000000000000000000..97e6ade27449be0a3816085aa31b707ffbb6f813 --- /dev/null +++ b/src/tests/ofc25-camara-e2e-controller/data/slice/post_network_slice2.json @@ -0,0 +1,189 @@ +{ + "slice-service": [ + { + "id": "slice2", + "description": "network slice 2, connect to VM2", + "sdps": { + "sdp": [ + { + "id": "1", + "node-id": "172.16.204.220", + "sdp-ip-address": [ + "172.16.204.220" + ], + "service-match-criteria": { + "match-criterion": [ + { + "index": 1, + "match-type": [ + { + "type": "ietf-network-slice-service:vlan", + "value": [ + "201" + ] + }, + { + "type": "ietf-network-slice-service:destination-ip-prefix", + "value": [ + "172.16.104.221/24" + ] + }, + { + "type": "ietf-network-slice-service:destination-tcp-port", + "value": [ + "10500" + ] + }, + { + "type": "ietf-network-slice-service:source-ip-prefix", + "value": [ + "172.1.201.22/24" + ] + }, + { + "type": "ietf-network-slice-service:source-tcp-port", + "value": [ + "10200" + ] + } + ], + "target-connection-group-id": "line1" + } + ] + }, + "attachment-circuits": { + "attachment-circuit": [ + { + "id": "AC POP to VM2", + "description": "AC VM2 connected to POP", + "ac-node-id": "172.16.204.220", + "ac-tp-id": "201" + } + ] + } + }, + { + "id": "2", + "node-id": "172.16.61.10", + "sdp-ip-address": [ + "172.16.61.10" + ], + "service-match-criteria": { + "match-criterion": [ + { + "index": 1, + "match-type": [ + { + "type": "ietf-network-slice-service:vlan", + "value": [ + "31" + ] + }, + { + "type": "ietf-network-slice-service:source-ip-prefix", + "value": [ + "172.16.104.221/24" + ] + }, + { + "type": "ietf-network-slice-service:source-tcp-port", + "value": [ + "10500" + ] + }, + { + "type": "ietf-network-slice-service:destination-ip-prefix", + "value": [ + "172.1.201.22/24" + ] + }, + { + "type": "ietf-network-slice-service:destination-tcp-port", + "value": [ + "10200" + ] + } + ], + "target-connection-group-id": "line1" + } + ] + }, + "attachment-circuits": { + "attachment-circuit": [ + { + "id": "AC ONT", + "description": "AC connected to PC", + "ac-node-id": "172.16.61.10", + "ac-tp-id": "200", + "ac-ipv4-address": "172.16.61.10" + } + ] + } + } + ] + }, + "connection-groups": { + "connection-group": [ + { + "id": "line1", + "connectivity-type": "point-to-point", + "connectivity-construct": [ + { + "id": 1, + "p2p-sender-sdp": "1", + "p2p-receiver-sdp": "2", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds", + "bound": "10" + }, + { + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps", + "bound": "5000" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": "0.001" + } + ] + } + } + }, + { + "id": 2, + "p2p-sender-sdp": "2", + "p2p-receiver-sdp": "1", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds", + "bound": "20" + }, + { + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps", + "bound": "1000" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": "0.001" + } + ] + } + } + } + ] + } + ] + } + } + ] +} diff --git a/src/tests/ofc25-camara-e2e-controller/data/slice/post_sdp_to_network_slice1.json b/src/tests/ofc25-camara-e2e-controller/data/slice/post_sdp_to_network_slice1.json new file mode 100644 index 0000000000000000000000000000000000000000..bd3895fc4ae5a9a0b2059be3f6b31a05451abd22 --- /dev/null +++ b/src/tests/ofc25-camara-e2e-controller/data/slice/post_sdp_to_network_slice1.json @@ -0,0 +1,61 @@ +{ + "sdp": [ + { + "id": "3", + "node-id": "172.16.61.11", + "sdp-ip-address": [ + "172.16.61.11" + ], + "service-match-criteria": { + "match-criterion": [ + { + "index": 1, + "match-type": [ + { + "type": "ietf-network-slice-service:vlan", + "value": [ + "21" + ] + }, + { + "type": "ietf-network-slice-service:source-ip-prefix", + "value": [ + "172.16.104.222/24" + ] + }, + { + "type": "ietf-network-slice-service:source-tcp-port", + "value": [ + "10500" + ] + }, + { + "type": "ietf-network-slice-service:destination-ip-prefix", + "value": [ + "172.1.101.22/24" + ] + }, + { + "type": "ietf-network-slice-service:destination-tcp-port", + "value": [ + "10200" + ] + } + ], + "target-connection-group-id": "line2" + } + ] + }, + "attachment-circuits": { + "attachment-circuit": [ + { + "id": "AC ONT", + "description": "AC connected to PC2", + "ac-node-id": "172.16.61.11", + "ac-tp-id": "200" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/src/tests/ofc25-camara-e2e-controller/data/slice/post_sdp_to_network_slice2.json b/src/tests/ofc25-camara-e2e-controller/data/slice/post_sdp_to_network_slice2.json new file mode 100644 index 0000000000000000000000000000000000000000..0b147125bd7eb3efc84c87bebab919639782f760 --- /dev/null +++ b/src/tests/ofc25-camara-e2e-controller/data/slice/post_sdp_to_network_slice2.json @@ -0,0 +1,62 @@ +{ + "sdp": [ + { + "id": "3", + "node-id": "172.16.61.11", + "sdp-ip-address": [ + "172.16.61.11" + ], + "service-match-criteria": { + "match-criterion": [ + { + "index": 1, + "match-type": [ + { + "type": "ietf-network-slice-service:vlan", + "value": [ + "31" + ] + }, + { + "type": "ietf-network-slice-service:source-ip-prefix", + "value": [ + "172.16.104.222/24" + ] + }, + { + "type": "ietf-network-slice-service:source-tcp-port", + "value": [ + "10500" + ] + }, + { + "type": "ietf-network-slice-service:destination-ip-prefix", + "value": [ + "172.1.201.22/24" + ] + }, + { + "type": "ietf-network-slice-service:destination-tcp-port", + "value": [ + "10200" + ] + } + ], + "target-connection-group-id": "line2" + } + ] + }, + "attachment-circuits": { + "attachment-circuit": [ + { + "id": "AC ONT", + "description": "AC connected to PC2", + "ac-node-id": "172.16.61.11", + "ac-tp-id": "200", + "ac-ipv4-address": "172.16.61.11" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/src/tests/ofc25-camara-e2e-controller/data/target-full-ietf-slice.json b/src/tests/ofc25-camara-e2e-controller/data/target-full-ietf-slice.json new file mode 100644 index 0000000000000000000000000000000000000000..c99876ad9e00e2f94ce44d17b2376f61282e60d7 --- /dev/null +++ b/src/tests/ofc25-camara-e2e-controller/data/target-full-ietf-slice.json @@ -0,0 +1,678 @@ +{ + "network-slice-services": { + "slice-service": [ + { + "connection-groups": { + "connection-group": [ + { + "connectivity-construct": [ + { + "id": 1, + "p2p-receiver-sdp": "2", + "p2p-sender-sdp": "1", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": "10", + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": "5000", + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": "0.001" + } + ] + } + } + }, + { + "id": 2, + "p2p-receiver-sdp": "1", + "p2p-sender-sdp": "2", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": "20", + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": "1000", + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": "0.001" + } + ] + } + } + } + ], + "connectivity-type": "point-to-point", + "id": "line1" + }, + { + "connectivity-construct": [ + { + "id": 1, + "p2p-receiver-sdp": "3", + "p2p-sender-sdp": "1", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": "10", + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": "5000", + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": "0.001" + } + ] + } + } + }, + { + "id": 2, + "p2p-receiver-sdp": "1", + "p2p-sender-sdp": "3", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": "20", + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": "1000", + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": "0.001" + } + ] + } + } + } + ], + "connectivity-type": "point-to-point", + "id": "line2" + } + ] + }, + "description": "network slice 2, connect to VM2", + "id": "slice2", + "sdps": { + "sdp": [ + { + "attachment-circuits": { + "attachment-circuit": [ + { + "ac-node-id": "172.16.204.220", + "ac-tp-id": "201", + "description": "AC VM2 connected to POP", + "id": "AC POP to VM2" + } + ] + }, + "id": "1", + "node-id": "172.16.204.220", + "sdp-ip-address": [ + "172.16.204.220" + ], + "service-match-criteria": { + "match-criterion": [ + { + "index": 1, + "match-type": [ + { + "type": "ietf-network-slice-service:vlan", + "value": [ + "201" + ] + }, + { + "type": "ietf-network-slice-service:destination-ip-prefix", + "value": [ + "172.16.104.221/24" + ] + }, + { + "type": "ietf-network-slice-service:destination-tcp-port", + "value": [ + "10500" + ] + }, + { + "type": "ietf-network-slice-service:source-ip-prefix", + "value": [ + "172.1.201.22/24" + ] + }, + { + "type": "ietf-network-slice-service:source-tcp-port", + "value": [ + "10200" + ] + } + ], + "target-connection-group-id": "line1" + }, + { + "index": 2, + "match-type": [ + { + "type": "ietf-network-slice-service:vlan", + "value": [ + "201" + ] + }, + { + "type": "ietf-network-slice-service:source-ip-prefix", + "value": [ + "172.1.201.22/24" + ] + }, + { + "type": "ietf-network-slice-service:source-tcp-port", + "value": [ + "10200" + ] + }, + { + "type": "ietf-network-slice-service:destination-ip-prefix", + "value": [ + "172.16.104.222/24" + ] + }, + { + "type": "ietf-network-slice-service:destination-tcp-port", + "value": [ + "10500" + ] + } + ], + "target-connection-group-id": "line2" + } + ] + } + }, + { + "attachment-circuits": { + "attachment-circuit": [ + { + "ac-ipv4-address": "172.16.61.10", + "ac-node-id": "172.16.61.10", + "ac-tp-id": "200", + "description": "AC connected to PC", + "id": "AC ONT" + } + ] + }, + "id": "2", + "node-id": "172.16.61.10", + "sdp-ip-address": [ + "172.16.61.10" + ], + "service-match-criteria": { + "match-criterion": [ + { + "index": 1, + "match-type": [ + { + "type": "ietf-network-slice-service:vlan", + "value": [ + "31" + ] + }, + { + "type": "ietf-network-slice-service:source-ip-prefix", + "value": [ + "172.16.104.221/24" + ] + }, + { + "type": "ietf-network-slice-service:source-tcp-port", + "value": [ + "10500" + ] + }, + { + "type": "ietf-network-slice-service:destination-ip-prefix", + "value": [ + "172.1.201.22/24" + ] + }, + { + "type": "ietf-network-slice-service:destination-tcp-port", + "value": [ + "10200" + ] + } + ], + "target-connection-group-id": "line1" + } + ] + } + }, + { + "attachment-circuits": { + "attachment-circuit": [ + { + "ac-ipv4-address": "172.16.61.11", + "ac-node-id": "172.16.61.11", + "ac-tp-id": "200", + "description": "AC connected to PC2", + "id": "AC ONT" + } + ] + }, + "id": "3", + "node-id": "172.16.61.11", + "sdp-ip-address": [ + "172.16.61.11" + ], + "service-match-criteria": { + "match-criterion": [ + { + "index": 1, + "match-type": [ + { + "type": "ietf-network-slice-service:vlan", + "value": [ + "31" + ] + }, + { + "type": "ietf-network-slice-service:source-ip-prefix", + "value": [ + "172.16.104.222/24" + ] + }, + { + "type": "ietf-network-slice-service:source-tcp-port", + "value": [ + "10500" + ] + }, + { + "type": "ietf-network-slice-service:destination-ip-prefix", + "value": [ + "172.1.201.22/24" + ] + }, + { + "type": "ietf-network-slice-service:destination-tcp-port", + "value": [ + "10200" + ] + } + ], + "target-connection-group-id": "line2" + } + ] + } + } + ] + } + }, + { + "connection-groups": { + "connection-group": [ + { + "connectivity-construct": [ + { + "id": 1, + "p2p-receiver-sdp": "2", + "p2p-sender-sdp": "1", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": "10", + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": "5000", + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": "0.001" + } + ] + } + } + }, + { + "id": 2, + "p2p-receiver-sdp": "1", + "p2p-sender-sdp": "2", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": "20", + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": "1000", + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": "0.001" + } + ] + } + } + } + ], + "connectivity-type": "point-to-point", + "id": "line1" + }, + { + "connectivity-construct": [ + { + "id": 1, + "p2p-receiver-sdp": "3", + "p2p-sender-sdp": "1", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": "10", + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": "5000", + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": "0.001" + } + ] + } + } + }, + { + "id": 2, + "p2p-receiver-sdp": "1", + "p2p-sender-sdp": "3", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": "20", + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": "1000", + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": "0.001" + } + ] + } + } + } + ], + "connectivity-type": "point-to-point", + "id": "line2" + } + ] + }, + "description": "network slice 1, connect to VM1", + "id": "slice1", + "sdps": { + "sdp": [ + { + "attachment-circuits": { + "attachment-circuit": [ + { + "ac-node-id": "172.16.204.220", + "ac-tp-id": "200", + "description": "AC VM1 connected to POP", + "id": "AC POP to VM1" + } + ] + }, + "id": "1", + "node-id": "172.16.204.220", + "sdp-ip-address": [ + "172.16.204.220" + ], + "service-match-criteria": { + "match-criterion": [ + { + "index": 1, + "match-type": [ + { + "type": "ietf-network-slice-service:vlan", + "value": [ + "101" + ] + }, + { + "type": "ietf-network-slice-service:destination-ip-prefix", + "value": [ + "172.16.104.221/24" + ] + }, + { + "type": "ietf-network-slice-service:destination-tcp-port", + "value": [ + "10500" + ] + }, + { + "type": "ietf-network-slice-service:source-ip-prefix", + "value": [ + "172.1.101.22/24" + ] + }, + { + "type": "ietf-network-slice-service:source-tcp-port", + "value": [ + "10200" + ] + } + ], + "target-connection-group-id": "line1" + }, + { + "index": 2, + "match-type": [ + { + "type": "ietf-network-slice-service:vlan", + "value": [ + "101" + ] + }, + { + "type": "ietf-network-slice-service:source-ip-prefix", + "value": [ + "172.1.101.22/24" + ] + }, + { + "type": "ietf-network-slice-service:source-tcp-port", + "value": [ + "10200" + ] + }, + { + "type": "ietf-network-slice-service:destination-ip-prefix", + "value": [ + "172.16.104.222/24" + ] + }, + { + "type": "ietf-network-slice-service:destination-tcp-port", + "value": [ + "10500" + ] + } + ], + "target-connection-group-id": "line2" + } + ] + } + }, + { + "attachment-circuits": { + "attachment-circuit": [ + { + "ac-node-id": "172.16.61.10", + "ac-tp-id": "200", + "description": "AC connected to PC1", + "id": "AC ONT" + } + ] + }, + "id": "2", + "node-id": "172.16.61.10", + "sdp-ip-address": [ + "172.16.61.10" + ], + "service-match-criteria": { + "match-criterion": [ + { + "index": 1, + "match-type": [ + { + "type": "ietf-network-slice-service:vlan", + "value": [ + "21" + ] + }, + { + "type": "ietf-network-slice-service:source-ip-prefix", + "value": [ + "172.16.104.221/24" + ] + }, + { + "type": "ietf-network-slice-service:source-tcp-port", + "value": [ + "10500" + ] + }, + { + "type": "ietf-network-slice-service:destination-ip-prefix", + "value": [ + "172.1.101.22/24" + ] + }, + { + "type": "ietf-network-slice-service:destination-tcp-port", + "value": [ + "10200" + ] + } + ], + "target-connection-group-id": "line1" + } + ] + } + }, + { + "attachment-circuits": { + "attachment-circuit": [ + { + "ac-node-id": "172.16.61.11", + "ac-tp-id": "200", + "description": "AC connected to PC2", + "id": "AC ONT" + } + ] + }, + "id": "3", + "node-id": "172.16.61.11", + "sdp-ip-address": [ + "172.16.61.11" + ], + "service-match-criteria": { + "match-criterion": [ + { + "index": 1, + "match-type": [ + { + "type": "ietf-network-slice-service:vlan", + "value": [ + "21" + ] + }, + { + "type": "ietf-network-slice-service:source-ip-prefix", + "value": [ + "172.16.104.222/24" + ] + }, + { + "type": "ietf-network-slice-service:source-tcp-port", + "value": [ + "10500" + ] + }, + { + "type": "ietf-network-slice-service:destination-ip-prefix", + "value": [ + "172.1.101.22/24" + ] + }, + { + "type": "ietf-network-slice-service:destination-tcp-port", + "value": [ + "10200" + ] + } + ], + "target-connection-group-id": "line2" + } + ] + } + } + ] + } + } + ] + } +} diff --git a/src/tests/ofc25-camara-e2e-controller/data/target-ietf-slice-posted-slices.json b/src/tests/ofc25-camara-e2e-controller/data/target-ietf-slice-posted-slices.json new file mode 100644 index 0000000000000000000000000000000000000000..004d3cafff0decf4cbe550f555e99b2229702b07 --- /dev/null +++ b/src/tests/ofc25-camara-e2e-controller/data/target-ietf-slice-posted-slices.json @@ -0,0 +1,382 @@ +[ + { + "network-slice-services": { + "slice-service": [ + { + "connection-groups": { + "connection-group": [ + { + "connectivity-construct": [ + { + "id": 1, + "p2p-receiver-sdp": "2", + "p2p-sender-sdp": "1", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": 10, + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": 5000, + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": 0.001 + } + ] + } + } + }, + { + "id": 2, + "p2p-receiver-sdp": "1", + "p2p-sender-sdp": "2", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": 20, + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": 1000, + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": 0.001 + } + ] + } + } + } + ], + "connectivity-type": "point-to-point", + "id": "line1" + } + ] + }, + "description": "dsc", + "id": "slice1", + "sdps": { + "sdp": [ + { + "attachment-circuits": { + "attachment-circuit": [ + { + "ac-node-id": "172.16.185.32", + "ac-tp-id": "200", + "description": "dsc", + "id": "0" + } + ] + }, + "id": "1", + "node-id": "172.16.185.32", + "sdp-ip-address": [ + "172.16.185.32" + ], + "service-match-criteria": { + "match-criterion": [ + { + "index": 1, + "match-type": [ + { + "type": "ietf-network-slice-service:vlan", + "value": [ + "101" + ] + }, + { + "type": "ietf-network-slice-service:source-ip-prefix", + "value": [ + "172.1.101.22/24" + ] + }, + { + "type": "ietf-network-slice-service:source-tcp-port", + "value": [ + "10200" + ] + }, + { + "type": "ietf-network-slice-service:destination-ip-prefix", + "value": [ + "172.16.104.221/24" + ] + }, + { + "type": "ietf-network-slice-service:destination-tcp-port", + "value": [ + "10500" + ] + } + ], + "target-connection-group-id": "line1" + } + ] + } + }, + { + "attachment-circuits": { + "attachment-circuit": [ + { + "ac-node-id": "172.16.182.25", + "ac-tp-id": "200", + "description": "dsc", + "id": "0" + } + ] + }, + "id": "2", + "node-id": "172.16.182.25", + "sdp-ip-address": [ + "172.16.182.25" + ], + "service-match-criteria": { + "match-criterion": [ + { + "index": 1, + "match-type": [ + { + "type": "ietf-network-slice-service:vlan", + "value": [ + "21" + ] + }, + { + "type": "ietf-network-slice-service:source-ip-prefix", + "value": [ + "172.16.104.221/24" + ] + }, + { + "type": "ietf-network-slice-service:source-tcp-port", + "value": [ + "10500" + ] + }, + { + "type": "ietf-network-slice-service:destination-ip-prefix", + "value": [ + "172.1.101.22/24" + ] + }, + { + "type": "ietf-network-slice-service:destination-tcp-port", + "value": [ + "10200" + ] + } + ], + "target-connection-group-id": "line1" + } + ] + } + } + ] + } + } + ] + } + }, + { + "network-slice-services": { + "slice-service": [ + { + "connection-groups": { + "connection-group": [ + { + "connectivity-construct": [ + { + "id": 1, + "p2p-receiver-sdp": "2", + "p2p-sender-sdp": "1", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": 10, + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": 5000, + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": 0.001 + } + ] + } + } + }, + { + "id": 2, + "p2p-receiver-sdp": "1", + "p2p-sender-sdp": "2", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": 20, + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": 1000, + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": 0.001 + } + ] + } + } + } + ], + "connectivity-type": "point-to-point", + "id": "line1" + } + ] + }, + "description": "dsc", + "id": "slice2", + "sdps": { + "sdp": [ + { + "attachment-circuits": { + "attachment-circuit": [ + { + "ac-node-id": "172.16.185.32", + "ac-tp-id": "200", + "description": "dsc", + "id": "0" + } + ] + }, + "id": "1", + "node-id": "172.16.185.32", + "sdp-ip-address": [ + "172.16.185.32" + ], + "service-match-criteria": { + "match-criterion": [ + { + "index": 1, + "match-type": [ + { + "type": "ietf-network-slice-service:vlan", + "value": [ + "201" + ] + }, + { + "type": "ietf-network-slice-service:source-ip-prefix", + "value": [ + "172.1.201.22/24" + ] + }, + { + "type": "ietf-network-slice-service:source-tcp-port", + "value": [ + "10200" + ] + }, + { + "type": "ietf-network-slice-service:destination-ip-prefix", + "value": [ + "172.16.104.221/24" + ] + }, + { + "type": "ietf-network-slice-service:destination-tcp-port", + "value": [ + "10500" + ] + } + ], + "target-connection-group-id": "line1" + } + ] + } + }, + { + "attachment-circuits": { + "attachment-circuit": [ + { + "ac-node-id": "172.16.182.25", + "ac-tp-id": "200", + "description": "dsc", + "id": "0" + } + ] + }, + "id": "2", + "node-id": "172.16.182.25", + "sdp-ip-address": [ + "172.16.182.25" + ], + "service-match-criteria": { + "match-criterion": [ + { + "index": 1, + "match-type": [ + { + "type": "ietf-network-slice-service:vlan", + "value": [ + "31" + ] + }, + { + "type": "ietf-network-slice-service:source-ip-prefix", + "value": [ + "172.16.104.221/24" + ] + }, + { + "type": "ietf-network-slice-service:source-tcp-port", + "value": [ + "10500" + ] + }, + { + "type": "ietf-network-slice-service:destination-ip-prefix", + "value": [ + "172.1.201.22/24" + ] + }, + { + "type": "ietf-network-slice-service:destination-tcp-port", + "value": [ + "10200" + ] + } + ], + "target-connection-group-id": "line1" + } + ] + } + } + ] + } + } + ] + } + } +] diff --git a/src/tests/ofc25-camara-e2e-controller/data/target-ietf-slice-put-connection-groups.json b/src/tests/ofc25-camara-e2e-controller/data/target-ietf-slice-put-connection-groups.json new file mode 100644 index 0000000000000000000000000000000000000000..7526ebd8b92a2eab7f30d94a035ba63f0a503c2d --- /dev/null +++ b/src/tests/ofc25-camara-e2e-controller/data/target-ietf-slice-put-connection-groups.json @@ -0,0 +1,234 @@ +[ + { + "connectivity-construct": [ + { + "id": 1, + "p2p-receiver-sdp": "2", + "p2p-sender-sdp": "1", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": 10, + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": 10000, + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": 0.001 + } + ] + } + } + }, + { + "id": 2, + "p2p-receiver-sdp": "1", + "p2p-sender-sdp": "2", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": 20, + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": 2000, + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": 0.001 + } + ] + } + } + } + ], + "connectivity-type": "point-to-point", + "id": "line1" + }, + { + "connectivity-construct": [ + { + "id": 1, + "p2p-receiver-sdp": "2", + "p2p-sender-sdp": "1", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": 10, + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": 10000, + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": 0.001 + } + ] + } + } + }, + { + "id": 2, + "p2p-receiver-sdp": "1", + "p2p-sender-sdp": "2", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": 20, + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": 2000, + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": 0.001 + } + ] + } + } + } + ], + "connectivity-type": "point-to-point", + "id": "line1" + }, + { + "connectivity-construct": [ + { + "id": 1, + "p2p-receiver-sdp": "2", + "p2p-sender-sdp": "1", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": 10, + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": 5000, + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": 0.001 + } + ] + } + } + }, + { + "id": 2, + "p2p-receiver-sdp": "1", + "p2p-sender-sdp": "2", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": 20, + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": 1000, + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": 0.001 + } + ] + } + } + } + ], + "connectivity-type": "point-to-point", + "id": "line1" + }, + { + "connectivity-construct": [ + { + "id": 1, + "p2p-receiver-sdp": "2", + "p2p-sender-sdp": "1", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": 10, + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": 5000, + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": 0.001 + } + ] + } + } + }, + { + "id": 2, + "p2p-receiver-sdp": "1", + "p2p-sender-sdp": "2", + "service-slo-sle-policy": { + "slo-policy": { + "metric-bound": [ + { + "bound": 20, + "metric-type": "ietf-network-slice-service:one-way-delay-maximum", + "metric-unit": "milliseconds" + }, + { + "bound": 1000, + "metric-type": "ietf-network-slice-service:one-way-bandwidth", + "metric-unit": "Mbps" + }, + { + "metric-type": "ietf-network-slice-service:two-way-packet-loss", + "metric-unit": "percentage", + "percentile-value": 0.001 + } + ] + } + } + } + ], + "connectivity-type": "point-to-point", + "id": "line1" + } +] diff --git a/src/tests/ofc25-camara-e2e-controller/data/target-nce-app-flows.json b/src/tests/ofc25-camara-e2e-controller/data/target-nce-app-flows.json new file mode 100644 index 0000000000000000000000000000000000000000..66f7ed2543f7f5472e50ccda9755dd965bc73452 --- /dev/null +++ b/src/tests/ofc25-camara-e2e-controller/data/target-nce-app-flows.json @@ -0,0 +1,58 @@ +{ + "App_Flow_2_1_slice1": { + "app-flow": [ + { + "app-name": "App_Flow_2_1_slice1", + "duration": 9999, + "max-online-users": 1, + "name": "App_Flow_2_1_slice1", + "qos-profile": "AR_VR_Gaming", + "service-profile": "service_2_1_slice1", + "stas": "00:3D:E1:18:82:9E", + "user-id": "a8b5b840-1548-46c9-892e-5c18f9ec8d99" + } + ] + }, + "App_Flow_3_1_slice1": { + "app-flow": [ + { + "app-name": "App_Flow_3_1_slice1", + "duration": 9999, + "max-online-users": 1, + "name": "App_Flow_3_1_slice1", + "qos-profile": "AR_VR_Gaming", + "service-profile": "service_3_1_slice1", + "stas": "00:3D:E1:18:82:9E", + "user-id": "28a1c47b-0179-4ab8-85da-632e6f946491" + } + ] + }, + "App_Flow_2_1_slice2": { + "app-flow": [ + { + "app-name": "App_Flow_2_1_slice2", + "duration": 9999, + "max-online-users": 1, + "name": "App_Flow_2_1_slice2", + "qos-profile": "AR_VR_Gaming", + "service-profile": "service_2_1_slice2", + "stas": "00:3D:E1:18:82:9E", + "user-id": "9df7b98a-d5c0-43d4-bd0e-8d81ee4485f0" + } + ] + }, + "App_Flow_3_1_slice2": { + "app-flow": [ + { + "app-name": "App_Flow_3_1_slice2", + "duration": 9999, + "max-online-users": 1, + "name": "App_Flow_3_1_slice2", + "qos-profile": "AR_VR_Gaming", + "service-profile": "service_3_1_slice2", + "stas": "00:3D:E1:18:82:9E", + "user-id": "79b2becb-8500-42cc-b6be-c27c2ea60b22" + } + ] + } +} diff --git a/src/tests/ofc25-camara-e2e-controller/data/target-nce-apps.json b/src/tests/ofc25-camara-e2e-controller/data/target-nce-apps.json new file mode 100644 index 0000000000000000000000000000000000000000..11a25897910cbbfd7fb666ddd86babc1972e7052 --- /dev/null +++ b/src/tests/ofc25-camara-e2e-controller/data/target-nce-apps.json @@ -0,0 +1,82 @@ +{ + "App_Flow_2_1_slice1": { + "application": [ + { + "app-features": { + "app-feature": [ + { + "dest-ip": "172.1.101.22", + "dest-port": "10200", + "id": "feature_2_1_slice1", + "protocol": "tcp", + "src-ip": "172.16.104.221", + "src-port": "10500" + } + ] + }, + "app-id": "app_2_1_slice1", + "name": "App_Flow_2_1_slice1" + } + ] + }, + "App_Flow_3_1_slice1": { + "application": [ + { + "app-features": { + "app-feature": [ + { + "dest-ip": "172.1.101.22", + "dest-port": "10200", + "id": "feature_3_1_slice1", + "protocol": "tcp", + "src-ip": "172.16.104.222", + "src-port": "10500" + } + ] + }, + "app-id": "app_3_1_slice1", + "name": "App_Flow_3_1_slice1" + } + ] + }, + "App_Flow_2_1_slice2": { + "application": [ + { + "app-features": { + "app-feature": [ + { + "dest-ip": "172.1.201.22", + "dest-port": "10200", + "id": "feature_2_1_slice2", + "protocol": "tcp", + "src-ip": "172.16.104.221", + "src-port": "10500" + } + ] + }, + "app-id": "app_2_1_slice2", + "name": "App_Flow_2_1_slice2" + } + ] + }, + "App_Flow_3_1_slice2": { + "application": [ + { + "app-features": { + "app-feature": [ + { + "dest-ip": "172.1.201.22", + "dest-port": "10200", + "id": "feature_3_1_slice2", + "protocol": "tcp", + "src-ip": "172.16.104.222", + "src-port": "10500" + } + ] + }, + "app-id": "app_3_1_slice2", + "name": "App_Flow_3_1_slice2" + } + ] + } +} diff --git a/src/tests/ofc25-camara-e2e-controller/deploy_specs.sh b/src/tests/ofc25-camara-e2e-controller/deploy_specs.sh new file mode 100755 index 0000000000000000000000000000000000000000..9ae83e7b126aa2913cd3c30887292b4626dd5855 --- /dev/null +++ b/src/tests/ofc25-camara-e2e-controller/deploy_specs.sh @@ -0,0 +1,208 @@ +#!/bin/bash +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + + +# ----- TeraFlowSDN ------------------------------------------------------------ + +# Set the URL of the internal MicroK8s Docker registry where the images will be uploaded to. +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 slice nbi" + +# Uncomment to activate Monitoring (old) +#export TFS_COMPONENTS="${TFS_COMPONENTS} monitoring" + +# Uncomment to activate Monitoring Framework (new) +#export TFS_COMPONENTS="${TFS_COMPONENTS} kpi_manager kpi_value_writer kpi_value_api telemetry analytics automation" + +# Uncomment to activate QoS Profiles +#export TFS_COMPONENTS="${TFS_COMPONENTS} qos_profile" + +# Uncomment to activate BGP-LS Speaker +#export TFS_COMPONENTS="${TFS_COMPONENTS} bgpls_speaker" + +# Uncomment to activate Optical Controller +# To manage optical connections, "service" requires "opticalcontroller" to be deployed +# before "service", thus we "hack" the TFS_COMPONENTS environment variable prepending the +# "opticalcontroller" only if "service" is already in TFS_COMPONENTS, and re-export it. +#if [[ "$TFS_COMPONENTS" == *"service"* ]]; then +# BEFORE="${TFS_COMPONENTS% service*}" +# AFTER="${TFS_COMPONENTS#* service}" +# export TFS_COMPONENTS="${BEFORE} opticalcontroller service ${AFTER}" +#fi + +# Uncomment to activate ZTP +#export TFS_COMPONENTS="${TFS_COMPONENTS} ztp" + +# Uncomment to activate Policy Manager +#export TFS_COMPONENTS="${TFS_COMPONENTS} policy" + +# Uncomment to activate Optical CyberSecurity +#export TFS_COMPONENTS="${TFS_COMPONENTS} dbscanserving opticalattackmitigator opticalattackdetector opticalattackmanager" + +# Uncomment to activate L3 CyberSecurity +#export TFS_COMPONENTS="${TFS_COMPONENTS} l3_attackmitigator l3_centralizedattackdetector" + +# Uncomment to activate TE +#export TFS_COMPONENTS="${TFS_COMPONENTS} te" + +# Uncomment to activate Forecaster +#export TFS_COMPONENTS="${TFS_COMPONENTS} forecaster" + +# Uncomment to activate E2E Orchestrator +#export TFS_COMPONENTS="${TFS_COMPONENTS} e2e_orchestrator" + +# Uncomment to activate DLT and Interdomain +#export TFS_COMPONENTS="${TFS_COMPONENTS} interdomain dlt" +#if [[ "$TFS_COMPONENTS" == *"dlt"* ]]; then +# export KEY_DIRECTORY_PATH="src/dlt/gateway/keys/priv_sk" +# export CERT_DIRECTORY_PATH="src/dlt/gateway/keys/cert.pem" +# export TLS_CERT_PATH="src/dlt/gateway/keys/ca.crt" +#fi + +# Uncomment to activate QKD App +# To manage QKD Apps, "service" requires "qkd_app" to be deployed +# before "service", thus we "hack" the TFS_COMPONENTS environment variable prepending the +# "qkd_app" only if "service" is already in TFS_COMPONENTS, and re-export it. +#if [[ "$TFS_COMPONENTS" == *"service"* ]]; then +# BEFORE="${TFS_COMPONENTS% service*}" +# AFTER="${TFS_COMPONENTS#* service}" +# export TFS_COMPONENTS="${BEFORE} qkd_app service ${AFTER}" +#fi + + +# Set the tag you want to use for your images. +export TFS_IMAGE_TAG="dev" + +# Set the name of the Kubernetes namespace to deploy TFS to. +export TFS_K8S_NAMESPACE="tfs" + +# Set additional manifest files to be applied after the deployment +export TFS_EXTRA_MANIFESTS="manifests/nginx_ingress_http.yaml" + +# Uncomment to monitor performance of components +#export TFS_EXTRA_MANIFESTS="${TFS_EXTRA_MANIFESTS} manifests/servicemonitors.yaml" + +# Uncomment when deploying Optical CyberSecurity +#export TFS_EXTRA_MANIFESTS="${TFS_EXTRA_MANIFESTS} manifests/cachingservice.yaml" + +# Set the new Grafana admin password +export TFS_GRAFANA_PASSWORD="admin123+" + +# Disable skip-build flag to rebuild the Docker images. +export TFS_SKIP_BUILD="" + + +# ----- CockroachDB ------------------------------------------------------------ + +# Set the namespace where CockroackDB will be deployed. +export CRDB_NAMESPACE="crdb" + +# Set the external port CockroackDB Postgre SQL interface will be exposed to. +export CRDB_EXT_PORT_SQL="26257" + +# Set the external port CockroackDB HTTP Mgmt GUI interface will be exposed to. +export CRDB_EXT_PORT_HTTP="8081" + +# Set the database username to be used by Context. +export CRDB_USERNAME="tfs" + +# Set the database user's password to be used by Context. +export CRDB_PASSWORD="tfs123" + +# Set CockroachDB installation mode to 'single'. This option is convenient for development and testing. +# See ./deploy/all.sh or ./deploy/crdb.sh for additional details +export CRDB_DEPLOY_MODE="single" + +# Disable flag for dropping database, if it exists. +export CRDB_DROP_DATABASE_IF_EXISTS="YES" + +# Disable flag for re-deploying CockroachDB from scratch. +export CRDB_REDEPLOY="" + + +# ----- NATS ------------------------------------------------------------------- + +# Set the namespace where NATS will be deployed. +export NATS_NAMESPACE="nats" + +# Set the external port NATS Client interface will be exposed to. +export NATS_EXT_PORT_CLIENT="4222" + +# Set the external port NATS HTTP Mgmt GUI interface will be exposed to. +export NATS_EXT_PORT_HTTP="8222" + +# Set NATS installation mode to 'single'. This option is convenient for development and testing. +# See ./deploy/all.sh or ./deploy/nats.sh for additional details +export NATS_DEPLOY_MODE="single" + +# Disable flag for re-deploying NATS from scratch. +export NATS_REDEPLOY="" + + +# ----- QuestDB ---------------------------------------------------------------- + +# Set the namespace where QuestDB will be deployed. +export QDB_NAMESPACE="qdb" + +# Set the external port QuestDB Postgre SQL interface will be exposed to. +export QDB_EXT_PORT_SQL="8812" + +# Set the external port QuestDB Influx Line Protocol interface will be exposed to. +export QDB_EXT_PORT_ILP="9009" + +# Set the external port QuestDB HTTP Mgmt GUI interface will be exposed to. +export QDB_EXT_PORT_HTTP="9000" + +# Set the database username to be used for QuestDB. +export QDB_USERNAME="admin" + +# Set the database user's password to be used for QuestDB. +export QDB_PASSWORD="quest" + +# Set the table name to be used by Monitoring for KPIs. +export QDB_TABLE_MONITORING_KPIS="tfs_monitoring_kpis" + +# Set the table name to be used by Slice for plotting groups. +export QDB_TABLE_SLICE_GROUPS="tfs_slice_groups" + +# Disable flag for dropping tables if they exist. +export QDB_DROP_TABLES_IF_EXIST="YES" + +# Disable flag for re-deploying QuestDB from scratch. +export QDB_REDEPLOY="" + + +# ----- K8s Observability ------------------------------------------------------ + +# Set the external port Prometheus Mgmt HTTP GUI interface will be exposed to. +export PROM_EXT_PORT_HTTP="9090" + +# Set the external port Grafana HTTP Dashboards will be exposed to. +export GRAF_EXT_PORT_HTTP="3000" + + +# ----- Apache Kafka ----------------------------------------------------------- + +# Set the namespace where Apache Kafka will be deployed. +export KFK_NAMESPACE="kafka" + +# Set the port Apache Kafka server will be exposed to. +export KFK_SERVER_PORT="9092" + +# Set the flag to YES for redeploying of Apache Kafka +export KFK_REDEPLOY="" diff --git a/src/tests/ofc25-camara-e2e-controller/redeploy-tfs.sh b/src/tests/ofc25-camara-e2e-controller/redeploy-tfs.sh new file mode 100755 index 0000000000000000000000000000000000000000..d030596d707c5f49c14bc0f43a654bda3159b688 --- /dev/null +++ b/src/tests/ofc25-camara-e2e-controller/redeploy-tfs.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +source ~/tfs-ctrl/src/tests/ofc25-camara-e2e-controller/deploy_specs.sh +./deploy/all.sh diff --git a/src/tests/ofc25-camara-e2e-controller/requirements.in b/src/tests/ofc25-camara-e2e-controller/requirements.in new file mode 100644 index 0000000000000000000000000000000000000000..1bdaec9997da4b83fa89c1bf0d00d4c3a73558a4 --- /dev/null +++ b/src/tests/ofc25-camara-e2e-controller/requirements.in @@ -0,0 +1,30 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +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-camara-e2e-controller/scripts/run-e2e-ietf-slice-operations.sh b/src/tests/ofc25-camara-e2e-controller/scripts/run-e2e-ietf-slice-operations.sh new file mode 100755 index 0000000000000000000000000000000000000000..6c41a85db2d5363971531c814283edbf3ebc0d62 --- /dev/null +++ b/src/tests/ofc25-camara-e2e-controller/scripts/run-e2e-ietf-slice-operations.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +source /var/teraflow/tfs_runtime_env_vars.sh +export PYTHONPATH=/var/teraflow +pytest --verbose --log-level=INFO \ + --junitxml=/opt/results/report_e2e_ietf_slice_operations.xml \ + /var/teraflow/tests/ofc25-camara-e2e-controller/tests/test_e2e_ietf_slice_operations.py diff --git a/src/tests/ofc25-camara-e2e-controller/scripts/run-onboarding.sh b/src/tests/ofc25-camara-e2e-controller/scripts/run-onboarding.sh new file mode 100755 index 0000000000000000000000000000000000000000..397d98d4b4db7952b2b879dcd1977c1a43cc30a2 --- /dev/null +++ b/src/tests/ofc25-camara-e2e-controller/scripts/run-onboarding.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +source /var/teraflow/tfs_runtime_env_vars.sh +export PYTHONPATH=/var/teraflow +pytest --verbose --log-level=INFO \ + --junitxml=/opt/results/report_onboarding.xml \ + /var/teraflow/tests/ofc25-camara-e2e-controller/tests/test_onboarding.py diff --git a/src/tests/ofc25-camara-e2e-controller/tests/Fixtures.py b/src/tests/ofc25-camara-e2e-controller/tests/Fixtures.py new file mode 100644 index 0000000000000000000000000000000000000000..15978851faae668339fa4eed6db8ab7e1be2eb5e --- /dev/null +++ b/src/tests/ofc25-camara-e2e-controller/tests/Fixtures.py @@ -0,0 +1,43 @@ +# Copyright 2022-2024 ETSI SDG TeraFlowSDN (TFS) (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. + +import pytest +from context.client.ContextClient import ContextClient +from device.client.DeviceClient import DeviceClient +from monitoring.client.MonitoringClient import MonitoringClient +from service.client.ServiceClient import ServiceClient + +@pytest.fixture(scope='session') +def context_client(): + _client = ContextClient() + yield _client + _client.close() + +@pytest.fixture(scope='session') +def device_client(): + _client = DeviceClient() + yield _client + _client.close() + +@pytest.fixture(scope='session') +def monitoring_client(): + _client = MonitoringClient() + yield _client + _client.close() + +@pytest.fixture(scope='session') +def service_client(): + _client = ServiceClient() + yield _client + _client.close() diff --git a/src/tests/ofc25-camara-e2e-controller/tests/Tools.py b/src/tests/ofc25-camara-e2e-controller/tests/Tools.py new file mode 100644 index 0000000000000000000000000000000000000000..cd2add49edd23f4c169b5fdc3c5123b2b31daa8d --- /dev/null +++ b/src/tests/ofc25-camara-e2e-controller/tests/Tools.py @@ -0,0 +1,109 @@ +# Copyright 2022-2024 ETSI SDG TeraFlowSDN (TFS) (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. + +import enum, logging, requests +from typing import Any, Dict, List, Optional, Set, Union +from common.Constants import ServiceNameEnum +from common.Settings import get_service_host, get_service_port_http + +NBI_ADDRESS = get_service_host(ServiceNameEnum.NBI) +NBI_PORT = get_service_port_http(ServiceNameEnum.NBI) +NBI_USERNAME = 'admin' +NBI_PASSWORD = 'admin' +NBI_BASE_URL = '' + +class RestRequestMethod(enum.Enum): + GET = 'get' + POST = 'post' + PUT = 'put' + PATCH = 'patch' + DELETE = 'delete' + +EXPECTED_STATUS_CODES : Set[int] = { + requests.codes['OK' ], + requests.codes['CREATED' ], + requests.codes['ACCEPTED' ], + requests.codes['NO_CONTENT'], +} + +def do_rest_request( + 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]]: + request_url = 'http://{:s}:{:s}@{:s}:{:d}{:s}{:s}'.format( + NBI_USERNAME, NBI_PASSWORD, NBI_ADDRESS, NBI_PORT, str(NBI_BASE_URL), url + ) + + if logger is not None: + 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, headers={'Content-Type': 'application/json'}, 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) + + 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 +) -> Optional[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 +) -> Optional[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 +) -> Optional[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_patch_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 +) -> Optional[Union[Dict, List]]: + return do_rest_request( + RestRequestMethod.PATCH, 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 +) -> Optional[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/tests/ofc25-camara-e2e-controller/tests/__init__.py b/src/tests/ofc25-camara-e2e-controller/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..3ccc21c7db78aac26daa1f8c5ff8e1ffd3f35460 --- /dev/null +++ b/src/tests/ofc25-camara-e2e-controller/tests/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + diff --git a/src/tests/ofc25-camara-e2e-controller/tests/test_e2e_ietf_slice_operations.py b/src/tests/ofc25-camara-e2e-controller/tests/test_e2e_ietf_slice_operations.py new file mode 100644 index 0000000000000000000000000000000000000000..cb991edbf1f3cc0768d006ef58725e621ac83de9 --- /dev/null +++ b/src/tests/ofc25-camara-e2e-controller/tests/test_e2e_ietf_slice_operations.py @@ -0,0 +1,478 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +import json, logging, os +import requests +from deepdiff import DeepDiff + + +LOGGER = logging.getLogger(__name__) +LOGGER.setLevel(logging.DEBUG) + +HEADERS = {"Content-Type": "application/json"} + +POST_NETWORK_SLICE1 = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "..", + "data", + "slice", + "post_network_slice1.json", +) +POST_NETWORK_SLICE2 = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "..", + "data", + "slice", + "post_network_slice2.json", +) +POST_CONNECTION_GROUP_TO_NETWORK_SLICE1 = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "..", + "data", + "slice", + "post_connection_group_to_network_slice1.json", +) +POST_CONNECTION_GROUP_TO_NETWORK_SLICE2 = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "..", + "data", + "slice", + "post_connection_group_to_network_slice2.json", +) +POST_MATCH_CRITERIA_TO_SDP1_IN_SLICE1 = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "..", + "data", + "slice", + "post_match_criteria_to_sdp1_in_slice1.json", +) +POST_MATCH_CRITERIA_TO_SDP1_IN_SLICE2 = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "..", + "data", + "slice", + "post_match_criteria_to_sdp1_in_slice2.json", +) +POST_SDP_TO_NETWORK_SLICE1 = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "..", + "data", + "slice", + "post_sdp_to_network_slice1.json", +) +POST_SDP_TO_NETWORK_SLICE2 = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "..", + "data", + "slice", + "post_sdp_to_network_slice2.json", +) +TARGET_NCE_APP_FLOWS = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "..", + "data", + "target-nce-app-flows.json", +) +TARGET_NCE_APPS = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "..", + "data", + "target-nce-apps.json", +) +TARGET_FULL_IETF_SLICE = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "..", + "data", + "slice", + "target-full-ietf-slice.json", +) +TARGET_FULL_IETF_SLICE = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "..", + "data", + "target-full-ietf-slice.json", +) +TARGET_IETF_SLICE_POSTED_SLICES = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "..", + "data", + "target-ietf-slice-posted-slices.json", +) +TARGET_IETF_SLICE_PUT_CONNECTION_GROUPS = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "..", + "data", + "target-ietf-slice-put-connection-groups.json", +) + +NBI_ADDRESS = "localhost" +NBI_PORT = "80" +NBI_USERNAME = "admin" +NBI_PASSWORD = "admin" + +NCE_ADDRESS = "localhost" +NCE_PORT = 9090 + +AGG_TFS_ADDRESS = "localhost" +AGG_TFS_PORT = 9091 + +BASE_IETF_SLICE_URL = f"http://{NBI_ADDRESS}:{NBI_PORT}/restconf/data/ietf-network-slice-service:network-slice-services" +NCE_APP_DATA_URL = f"http://{NCE_ADDRESS}:{NCE_PORT}/restconf/v1/data/app-flows/apps" +NCE_APP_FLOW_DATA_URL = f"http://{NCE_ADDRESS}:{NCE_PORT}/restconf/v1/data/app-flows" +AGG_TFS_IETF_SLICE_URL = f"http://{AGG_TFS_ADDRESS}:{AGG_TFS_PORT}/restconf/data/ietf-network-slice-service:network-slice-services" + + +# pylint: disable=redefined-outer-name, unused-argument +def test_ietf_slice_creation_removal(): + # Issue service creation request + with open(POST_NETWORK_SLICE1, "r", encoding="UTF-8") as f: + post_network_slice1 = json.load(f) + with open(POST_NETWORK_SLICE2, "r", encoding="UTF-8") as f: + post_network_slice2 = json.load(f) + with open(POST_CONNECTION_GROUP_TO_NETWORK_SLICE1, "r", encoding="UTF-8") as f: + post_connection_group_to_network_slice1 = json.load(f) + with open(POST_CONNECTION_GROUP_TO_NETWORK_SLICE2, "r", encoding="UTF-8") as f: + post_connection_group_to_network_slice2 = json.load(f) + with open(POST_MATCH_CRITERIA_TO_SDP1_IN_SLICE1, "r", encoding="UTF-8") as f: + post_match_criteria_to_sdp1_in_slice1 = json.load(f) + with open(POST_MATCH_CRITERIA_TO_SDP1_IN_SLICE2, "r", encoding="UTF-8") as f: + post_match_criteria_to_sdp1_in_slice2 = json.load(f) + with open(POST_SDP_TO_NETWORK_SLICE1, "r", encoding="UTF-8") as f: + post_sdp_to_network_slice1 = json.load(f) + with open(POST_SDP_TO_NETWORK_SLICE2, "r", encoding="UTF-8") as f: + post_sdp_to_network_slice2 = json.load(f) + with open(TARGET_NCE_APPS, "r", encoding="UTF-8") as f: + target_nce_apps = json.load(f) + with open(TARGET_NCE_APP_FLOWS, "r", encoding="UTF-8") as f: + target_nce_app_flows = json.load(f) + with open(TARGET_FULL_IETF_SLICE, "r", encoding="UTF-8") as f: + target_full_ietf_slice = json.load(f) + with open(TARGET_IETF_SLICE_POSTED_SLICES, "r", encoding="UTF-8") as f: + target_ietf_slice_posted_slices = json.load(f) + with open(TARGET_IETF_SLICE_PUT_CONNECTION_GROUPS, "r", encoding="UTF-8") as f: + target_ietf_slice_put_connection_groups = json.load(f) + + # op 1 + URL = BASE_IETF_SLICE_URL + requests.post(URL, headers=HEADERS, json=post_network_slice1) + + URL = NCE_APP_DATA_URL + apps_response = requests.get(URL).json() + URL = NCE_APP_FLOW_DATA_URL + app_flows_response = requests.get(URL).json() + URL = AGG_TFS_IETF_SLICE_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).json() + + 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], + target_nce_app_flows[app_name], + exclude_regex_paths=r"root\['app-flow'\]\[\d+\]\['user-id'\]", + ) + assert not apps_diff + assert not app_flows_diff + assert len(apps_response) == 1 and len(app_flows_response) == 1 + + assert len(ietf_slice_connection_groups) == 0 + assert len(ietf_slice_services) == 1 + slice_diff = DeepDiff( + ietf_slice_services["slice1"], target_ietf_slice_posted_slices[0] + ) + assert not slice_diff + + # op 2 + URL = BASE_IETF_SLICE_URL + "/slice-service=slice1/sdps" + requests.post(URL, headers=HEADERS, json=post_sdp_to_network_slice1) + URL = BASE_IETF_SLICE_URL + "/slice-service=slice1/connection-groups" + requests.post(URL, headers=HEADERS, json=post_connection_group_to_network_slice1) + URL = ( + BASE_IETF_SLICE_URL + "/slice-service=slice1/sdps/sdp=1/service-match-criteria" + ) + requests.post(URL, headers=HEADERS, json=post_match_criteria_to_sdp1_in_slice1) + + URL = NCE_APP_DATA_URL + apps_response = requests.get(URL).json() + URL = NCE_APP_FLOW_DATA_URL + app_flows_response = requests.get(URL).json() + URL = AGG_TFS_IETF_SLICE_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).json() + + 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], + target_nce_app_flows[app_name], + exclude_regex_paths=r"root\['app-flow'\]\[\d+\]\['user-id'\]", + ) + assert not apps_diff + assert not app_flows_diff + assert len(apps_response) == 2 and len(app_flows_response) == 2 + + assert len(ietf_slice_connection_groups) == 1 + assert len(ietf_slice_services) == 1 + connection_group_diff = DeepDiff( + ietf_slice_connection_groups[0], target_ietf_slice_put_connection_groups[0] + ) + assert not connection_group_diff + + # op 3 + URL = BASE_IETF_SLICE_URL + requests.post(URL, headers=HEADERS, json=post_network_slice2) + + URL = NCE_APP_DATA_URL + apps_response = requests.get(URL).json() + URL = NCE_APP_FLOW_DATA_URL + app_flows_response = requests.get(URL).json() + URL = AGG_TFS_IETF_SLICE_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).json() + + 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], + target_nce_app_flows[app_name], + exclude_regex_paths=r"root\['app-flow'\]\[\d+\]\['user-id'\]", + ) + assert not apps_diff + assert not app_flows_diff + assert len(apps_response) == 3 and len(app_flows_response) == 3 + + 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] + ) + assert not slice_diff + + # op 4 + URL = BASE_IETF_SLICE_URL + "/slice-service=slice2/sdps" + requests.post(URL, headers=HEADERS, json=post_sdp_to_network_slice2) + URL = BASE_IETF_SLICE_URL + "/slice-service=slice2/connection-groups" + requests.post(URL, headers=HEADERS, json=post_connection_group_to_network_slice2) + URL = ( + BASE_IETF_SLICE_URL + "/slice-service=slice2/sdps/sdp=1/service-match-criteria" + ) + requests.post(URL, headers=HEADERS, json=post_match_criteria_to_sdp1_in_slice2) + + URL = NCE_APP_DATA_URL + apps_response = requests.get(URL).json() + URL = NCE_APP_FLOW_DATA_URL + app_flows_response = requests.get(URL).json() + URL = AGG_TFS_IETF_SLICE_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).json() + + 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], + target_nce_app_flows[app_name], + exclude_regex_paths=r"root\['app-flow'\]\[\d+\]\['user-id'\]", + ) + assert not apps_diff + assert not app_flows_diff + assert len(apps_response) == 4 and len(app_flows_response) == 4 + + assert len(ietf_slice_connection_groups) == 2 + assert len(ietf_slice_services) == 2 + connection_group_diff = DeepDiff( + ietf_slice_connection_groups[1], target_ietf_slice_put_connection_groups[1] + ) + assert not connection_group_diff + + # op 5 + 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 + + # op 6 + URL = BASE_IETF_SLICE_URL + "/slice-service=slice1/sdps/sdp=2" + requests.delete(URL) + URL = ( + BASE_IETF_SLICE_URL + + "/slice-service=slice1/sdps/sdp=1/service-match-criteria/match-criterion=1" + ) + requests.delete(URL) + URL = ( + BASE_IETF_SLICE_URL + + "/slice-service=slice1/connection-groups/connection-group=line1" + ) + requests.delete(URL) + + URL = NCE_APP_DATA_URL + apps_response = requests.get(URL).json() + URL = NCE_APP_FLOW_DATA_URL + app_flows_response = requests.get(URL).json() + URL = AGG_TFS_IETF_SLICE_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).json() + + app_name = "App_Flow_2_1_slice1" + assert app_name not in apps_response + assert app_name not in app_flows_response + assert len(apps_response) == 3 and len(app_flows_response) == 3 + + assert len(ietf_slice_connection_groups) == 3 + assert len(ietf_slice_services) == 2 + connection_group_diff = DeepDiff( + ietf_slice_connection_groups[2], target_ietf_slice_put_connection_groups[2] + ) + assert not connection_group_diff + + # op 7 + URL = BASE_IETF_SLICE_URL + "/slice-service=slice1/sdps/sdp=3" + requests.delete(URL) + URL = ( + BASE_IETF_SLICE_URL + + "/slice-service=slice1/sdps/sdp=1/service-match-criteria/match-criterion=2" + ) + requests.delete(URL) + URL = ( + BASE_IETF_SLICE_URL + + "/slice-service=slice1/connection-groups/connection-group=line2" + ) + requests.delete(URL) + URL = BASE_IETF_SLICE_URL + "/slice-service=slice1/sdps/sdp=1" + + URL = NCE_APP_DATA_URL + apps_response = requests.get(URL).json() + URL = NCE_APP_FLOW_DATA_URL + app_flows_response = requests.get(URL).json() + URL = AGG_TFS_IETF_SLICE_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).json() + + requests.delete(URL) + URL = BASE_IETF_SLICE_URL + "/slice-service=slice1" + requests.delete(URL) + + app_name = "App_Flow_3_1_slice1" + assert app_name not in apps_response + assert app_name not in app_flows_response + assert len(apps_response) == 2 and len(app_flows_response) == 2 + + assert len(ietf_slice_connection_groups) == 3 + assert len(ietf_slice_services) == 1 + assert "slice1" not in ietf_slice_services + + # op 8 + URL = BASE_IETF_SLICE_URL + "/slice-service=slice2/sdps/sdp=2" + requests.delete(URL) + URL = ( + BASE_IETF_SLICE_URL + + "/slice-service=slice2/sdps/sdp=1/service-match-criteria/match-criterion=1" + ) + requests.delete(URL) + URL = ( + BASE_IETF_SLICE_URL + + "/slice-service=slice2/connection-groups/connection-group=line1" + ) + requests.delete(URL) + + URL = NCE_APP_DATA_URL + apps_response = requests.get(URL).json() + URL = NCE_APP_FLOW_DATA_URL + app_flows_response = requests.get(URL).json() + URL = AGG_TFS_IETF_SLICE_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).json() + + app_name = "App_Flow_2_1_slice2" + assert app_name not in apps_response + assert app_name not in app_flows_response + assert len(apps_response) == 1 and len(app_flows_response) == 1 + + assert len(ietf_slice_connection_groups) == 4 + assert len(ietf_slice_services) == 1 + connection_group_diff = DeepDiff( + ietf_slice_connection_groups[3], target_ietf_slice_put_connection_groups[3] + ) + assert not connection_group_diff + + # op 9 + URL = BASE_IETF_SLICE_URL + "/slice-service=slice2/sdps/sdp=3" + requests.delete(URL) + URL = ( + BASE_IETF_SLICE_URL + + "/slice-service=slice2/sdps/sdp=1/service-match-criteria/match-criterion=2" + ) + requests.delete(URL) + URL = ( + BASE_IETF_SLICE_URL + + "/slice-service=slice2/connection-groups/connection-group=line2" + ) + requests.delete(URL) + + URL = NCE_APP_DATA_URL + apps_response = requests.get(URL).json() + URL = NCE_APP_FLOW_DATA_URL + app_flows_response = requests.get(URL).json() + URL = AGG_TFS_IETF_SLICE_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).json() + + URL = BASE_IETF_SLICE_URL + "/slice-service=slice2/sdps/sdp=1" + requests.delete(URL) + URL = BASE_IETF_SLICE_URL + "/slice-service=slice2" + requests.delete(URL) + + app_name = "App_Flow_3_1_slice2" + assert app_name not in apps_response + assert app_name not in app_flows_response + assert len(apps_response) == 0 and len(app_flows_response) == 0 + + assert len(ietf_slice_connection_groups) == 4 + assert len(ietf_slice_services) == 0 + + # op 10 + 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-camara-e2e-controller/tests/test_onboarding.py b/src/tests/ofc25-camara-e2e-controller/tests/test_onboarding.py new file mode 100644 index 0000000000000000000000000000000000000000..05e031da7b3ab88a8ee3f3c80fdddb92d9f26913 --- /dev/null +++ b/src/tests/ofc25-camara-e2e-controller/tests/test_onboarding.py @@ -0,0 +1,67 @@ +# Copyright 2022-2024 ETSI SDG TeraFlowSDN (TFS) (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. + +import logging, os, time +from common.Constants import DEFAULT_CONTEXT_NAME +from common.proto.context_pb2 import ContextId, DeviceOperationalStatusEnum, Empty +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 device.client.DeviceClient import DeviceClient +from .Fixtures import context_client, device_client # pylint: disable=unused-import + +LOGGER = logging.getLogger(__name__) +LOGGER.setLevel(logging.DEBUG) + +DESCRIPTOR_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'data', 'camara-e2e-topology.json') +ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME)) + +def test_scenario_onboarding( + context_client : ContextClient, # pylint: disable=redefined-outer-name + device_client : DeviceClient, # pylint: disable=redefined-outer-name +) -> None: + validate_empty_scenario(context_client) + + descriptor_loader = DescriptorLoader( + 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() + + # 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 + +def test_scenario_devices_enabled( + context_client : ContextClient, # pylint: disable=redefined-outer-name +) -> None: + """ + This test validates that the devices are enabled. + """ + DEVICE_OP_STATUS_ENABLED = DeviceOperationalStatusEnum.DEVICEOPERATIONALSTATUS_ENABLED + + num_devices = -1 + num_devices_enabled, num_retry = 0, 0 + while (num_devices != num_devices_enabled) and (num_retry < 10): + time.sleep(1.0) + response = context_client.ListDevices(Empty()) + num_devices = len(response.devices) + num_devices_enabled = 0 + for device in response.devices: + if device.device_operational_status != DEVICE_OP_STATUS_ENABLED: continue + num_devices_enabled += 1 + LOGGER.info('Num Devices enabled: {:d}/{:d}'.format(num_devices_enabled, num_devices)) + num_retry += 1 + assert num_devices_enabled == num_devices diff --git a/src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/Dockerfile b/src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..b2ac55af45ba673cd7c119f19a5245d065d02ea3 --- /dev/null +++ b/src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/Dockerfile @@ -0,0 +1,37 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +FROM python:3.9-slim + +# Set Python to show logs as they occur +ENV PYTHONUNBUFFERED=0 + +# Get generic Python packages +RUN python3 -m pip install --upgrade pip +RUN python3 -m pip install --upgrade setuptools wheel +RUN python3 -m pip install --upgrade pip-tools + +# Create component sub-folders, and copy content +RUN mkdir -p /var/teraflow/mock_ietf_l3vpn_sdn_ctrl +WORKDIR /var/teraflow/mock_ietf_l3vpn_sdn_ctrl +COPY . . + +# Get specific Python packages +RUN pip-compile --quiet --output-file=requirements.txt requirements.in +RUN python3 -m pip install -r requirements.txt + +RUN python3 -m pip list + +# Start the service +ENTRYPOINT ["python", "MockIetfL3VPNSdnCtrl.py"] diff --git a/src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/L3VPNServices.py b/src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/L3VPNServices.py new file mode 100644 index 0000000000000000000000000000000000000000..1e4d7c6195a3dd0b0cb6c124f788c2efa5fe7927 --- /dev/null +++ b/src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/L3VPNServices.py @@ -0,0 +1,44 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +# REST-API resource implementing minimal support for "IETF YANG Data Model for Transport Network Client Signals". +# Ref: https://www.ietf.org/archive/id/draft-ietf-ccamp-client-signal-yang-10.html + +from flask import jsonify, make_response, request +from flask_restful import Resource + +VPN_SERVICES = {} + + +class L3VPNServices(Resource): + def get(self): + return make_response(jsonify(VPN_SERVICES), 200) + + def post(self): + json_request = request.get_json() + name = json_request["ietf-l3vpn-svc:l3vpn-svc"]["vpn-services"]["vpn-service"][0]["vpn-id"] + VPN_SERVICES[name] = json_request + return make_response(jsonify({}), 201) + + +class L3VPNService(Resource): + def put(self, vpn_id: str): + json_request = request.get_json() + VPN_SERVICES[vpn_id] = json_request + return make_response(jsonify({}), 200) + + def delete(self, vpn_id: str): + slice = VPN_SERVICES.pop(vpn_id, None) + data, status = ({}, 404) if slice is None else (slice, 204) + return make_response(jsonify(data), status) diff --git a/src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/MockIetfL3VPNSdnCtrl.py b/src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/MockIetfL3VPNSdnCtrl.py new file mode 100644 index 0000000000000000000000000000000000000000..49685aa19902c619cdc0259b5cb0573dbf77bd63 --- /dev/null +++ b/src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/MockIetfL3VPNSdnCtrl.py @@ -0,0 +1,77 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +# Mock IETF ACTN SDN controller +# ----------------------------- +# REST server implementing minimal support for: +# - IETF YANG Data Model for Transport Network Client Signals +# Ref: https://www.ietf.org/archive/id/draft-ietf-ccamp-client-signal-yang-10.html +# - IETF YANG Data Model for Traffic Engineering Tunnels, Label Switched Paths and Interfaces +# Ref: https://www.ietf.org/archive/id/draft-ietf-teas-yang-te-34.html + + +import functools, logging, sys, time +from flask import Flask, request +from flask_restful import Api + +from L3VPNServices import L3VPNService, L3VPNServices + +BIND_ADDRESS = "0.0.0.0" +BIND_PORT = 8443 +BASE_URL = "/restconf/data/ietf-l3vpn-svc:l3vpn-svc/vpn-services" +STR_ENDPOINT = "http://{:s}:{:s}{:s}".format( + str(BIND_ADDRESS), str(BIND_PORT), str(BASE_URL) +) +LOG_LEVEL = logging.DEBUG + +logging.basicConfig( + level=LOG_LEVEL, format="[%(asctime)s] %(levelname)s:%(name)s:%(message)s" +) +LOGGER = logging.getLogger(__name__) + +logging.getLogger("werkzeug").setLevel(logging.WARNING) + + +def log_request(logger: logging.Logger, response): + timestamp = time.strftime("[%Y-%b-%d %H:%M]") + logger.info( + "%s %s %s %s %s", + timestamp, + request.remote_addr, + request.method, + request.full_path, + response.status, + ) + return response + + +def main(): + LOGGER.info("Starting...") + + app = Flask(__name__) + app.after_request(functools.partial(log_request, LOGGER)) + + api = Api(app, prefix=BASE_URL) + api.add_resource(L3VPNServices, "") + api.add_resource(L3VPNService, "/vpn-service=<string:vpn_id>") + + LOGGER.info("Listening on {:s}...".format(str(STR_ENDPOINT))) + app.run(debug=True, host=BIND_ADDRESS, port=BIND_PORT) + + LOGGER.info("Bye") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/README.md b/src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/README.md new file mode 100644 index 0000000000000000000000000000000000000000..ed9d744f7641e20ddd39b51f837ea68e47fe64c0 --- /dev/null +++ b/src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/README.md @@ -0,0 +1,31 @@ +# Mock IETF L3VPN SDN Controller + +This REST server implements very basic support for the following YANG data models: +- YANG Data Model for L3VPN Service Delivery + - Ref: https://datatracker.ietf.org/doc/html/rfc8049 + +The aim of this server is to enable testing ietf netowrk slice service handler, ietf l3vpn service handler, and ietf l3vpn driver + + +## 1. Install requirements for the Mock IETF Network Slice SDN controller +__NOTE__: if you run the Mock IETF L3VPN SDN controller from the PyEnv used for developing on the TeraFlowSDN +framework and you followed the official steps in +[Development Guide > Configure Environment > Python](https://labs.etsi.org/rep/tfs/controller/-/wikis/2.-Development-Guide/2.1.-Configure-Environment/2.1.1.-Python), +all the requirements are already in place. Install them only if you execute it in a separate/standalone environment. + +Install the required dependencies as follows: +```bash +pip install -r src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/requirements.in +``` + +Run the Mock IETF L3VPN SDN Controller as follows: +```bash +python src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/MockIetfL3VPNSdnCtrl.py +``` + + +## 2. Run the Mock IETF L3VPN SDN controller +Run the Mock IETF L3VPN SDN Controller as follows: +```bash +python src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/MockIetfL3VPNSdnCtrl.py +``` diff --git a/src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/__init__.py b/src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..3ccc21c7db78aac26daa1f8c5ff8e1ffd3f35460 --- /dev/null +++ b/src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + diff --git a/src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/build.sh b/src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/build.sh new file mode 100755 index 0000000000000000000000000000000000000000..e5f12798556b0c9c044d86c0f175aeec9d0cff23 --- /dev/null +++ b/src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/build.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +# Make folder containing the script the root folder for its execution +cd $(dirname $0) + +docker build -t mock-ietf-l3vpn-sdn-ctrl:test -f Dockerfile . +docker tag mock-ietf-l3vpn-sdn-ctrl:test localhost:32000/tfs/mock-ietf-l3vpn-sdn-ctrl:test +docker push localhost:32000/tfs/mock-ietf-l3vpn-sdn-ctrl:test diff --git a/src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/deploy.sh b/src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/deploy.sh new file mode 100755 index 0000000000000000000000000000000000000000..1c6e68deb33de588cffab91fda550aafe222ce37 --- /dev/null +++ b/src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/deploy.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +kubectl delete namespace mocks +kubectl --namespace mocks apply -f mock-ietf-l3vpn-sdn-ctrl.yaml diff --git a/src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/mock-ietf-network-slice-sdn-ctrl.yaml b/src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/mock-ietf-network-slice-sdn-ctrl.yaml new file mode 100644 index 0000000000000000000000000000000000000000..ace79810f0cbfbd6605ef049c71c6c75cf5c0317 --- /dev/null +++ b/src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/mock-ietf-network-slice-sdn-ctrl.yaml @@ -0,0 +1,64 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +kind: Namespace +apiVersion: v1 +metadata: + name: mocks +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mock-ietf-l3vpn-sdn-ctrl +spec: + selector: + matchLabels: + app: mock-ietf-l3vpn-sdn-ctrl + replicas: 1 + template: + metadata: + annotations: + config.linkerd.io/skip-inbound-ports: "8443" + labels: + app: mock-ietf-l3vpn-sdn-ctrl + spec: + terminationGracePeriodSeconds: 5 + containers: + - name: server + image: localhost:32000/tfs/mock-ietf-l3vpn-sdn-ctrl:test + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8443 + resources: + requests: + cpu: 250m + memory: 512Mi + limits: + cpu: 700m + memory: 1024Mi +--- +apiVersion: v1 +kind: Service +metadata: + name: mock-ietf-l3vpn-sdn-ctrl + labels: + app: mock-ietf-l3vpn-sdn-ctrl +spec: + type: ClusterIP + selector: + app: mock-ietf-l3vpn-sdn-ctrl + ports: + - name: http + port: 8443 + targetPort: 8443 diff --git a/src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/requirements.in b/src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/requirements.in new file mode 100644 index 0000000000000000000000000000000000000000..dbb8e95d65cfd0f1ee60d9bb4f840393ac893725 --- /dev/null +++ b/src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/requirements.in @@ -0,0 +1,22 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +cryptography==39.0.1 +pyopenssl==23.0.0 +Flask==2.1.3 +Flask-HTTPAuth==4.5.0 +Flask-RESTful==0.3.9 +jsonschema==4.4.0 +requests==2.27.1 +werkzeug==2.3.7 diff --git a/src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/run.sh b/src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/run.sh new file mode 100755 index 0000000000000000000000000000000000000000..3c0ddc2b06f8f3af6ed3645a65fcea31888c82de --- /dev/null +++ b/src/tests/tools/mock_ietf_l3vpn_sdn_ctrl/run.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +# Make folder containing the script the root folder for its execution +cd $(dirname $0) + +python MockIetfL3VPNSdnCtrl.py diff --git a/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/Dockerfile b/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..a624152de7d9188067a5828b4a8958b8d3418694 --- /dev/null +++ b/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/Dockerfile @@ -0,0 +1,37 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +FROM python:3.9-slim + +# Set Python to show logs as they occur +ENV PYTHONUNBUFFERED=0 + +# Get generic Python packages +RUN python3 -m pip install --upgrade pip +RUN python3 -m pip install --upgrade setuptools wheel +RUN python3 -m pip install --upgrade pip-tools + +# Create component sub-folders, and copy content +RUN mkdir -p /var/teraflow/mock_ietf_network_slice_sdn_ctrl +WORKDIR /var/teraflow/mock_ietf_network_slice_sdn_ctrl +COPY . . + +# Get specific Python packages +RUN pip-compile --quiet --output-file=requirements.txt requirements.in +RUN python3 -m pip install -r requirements.txt + +RUN python3 -m pip list + +# Start the service +ENTRYPOINT ["python", "MockIetfNetworkSliceSdnCtrl.py"] diff --git a/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/MockIetfNetworkSliceSdnCtrl.py b/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/MockIetfNetworkSliceSdnCtrl.py new file mode 100644 index 0000000000000000000000000000000000000000..8d13f1bafcd98c28f20033ab8859bc6cc4b207dd --- /dev/null +++ b/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/MockIetfNetworkSliceSdnCtrl.py @@ -0,0 +1,81 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +# Mock IETF ACTN SDN controller +# ----------------------------- +# REST server implementing minimal support for: +# - IETF YANG Data Model for Transport Network Client Signals +# Ref: https://www.ietf.org/archive/id/draft-ietf-ccamp-client-signal-yang-10.html +# - IETF YANG Data Model for Traffic Engineering Tunnels, Label Switched Paths and Interfaces +# Ref: https://www.ietf.org/archive/id/draft-ietf-teas-yang-te-34.html + + +import functools, logging, sys, time +from flask import Flask, request +from flask_restful import Api +from ResourceNetworkSlices import NetworkSliceService, NetworkSliceServices +from ResourceConnectionGroups import ConnectionGroup + +BIND_ADDRESS = "0.0.0.0" +BIND_PORT = 8443 +BASE_URL = "/restconf/data/ietf-network-slice-service:network-slice-services" +STR_ENDPOINT = "http://{:s}:{:s}{:s}".format( + str(BIND_ADDRESS), str(BIND_PORT), str(BASE_URL) +) +LOG_LEVEL = logging.DEBUG + +logging.basicConfig( + level=LOG_LEVEL, format="[%(asctime)s] %(levelname)s:%(name)s:%(message)s" +) +LOGGER = logging.getLogger(__name__) + +logging.getLogger("werkzeug").setLevel(logging.WARNING) + + +def log_request(logger: logging.Logger, response): + timestamp = time.strftime("[%Y-%b-%d %H:%M]") + logger.info( + "%s %s %s %s %s", + timestamp, + request.remote_addr, + request.method, + request.full_path, + response.status, + ) + return response + + +def main(): + LOGGER.info("Starting...") + + app = Flask(__name__) + app.after_request(functools.partial(log_request, LOGGER)) + + api = Api(app, prefix=BASE_URL) + api.add_resource(NetworkSliceServices, "") + api.add_resource(NetworkSliceService, "/slice-service=<string:slice_id>") + api.add_resource( + ConnectionGroup, + "/slice-service=<string:slice_id>/connection-groups/connection-group=<string:connection_group_id>", + ) + + LOGGER.info("Listening on {:s}...".format(str(STR_ENDPOINT))) + app.run(debug=True, host=BIND_ADDRESS, port=BIND_PORT) + + LOGGER.info("Bye") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/README.md b/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/README.md new file mode 100644 index 0000000000000000000000000000000000000000..493fe37362dbbb8e8dbdf1a9621cb81a15c64691 --- /dev/null +++ b/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/README.md @@ -0,0 +1,31 @@ +# Mock IETF Network Slice SDN Controller + +This REST server implements very basic support for the following YANG data models: +- IETF YANG Data Model for Transport Network Client Signals (draft-ietf-ccamp-client-signal-yang-10) + - Ref: https://datatracker.ietf.org/doc/draft-ietf-teas-ietf-network-slice-nbi-yang/ + +The aim of this server is to enable testing ietf netowrk slice service driver and ietf slice service service handler + + +## 1. Install requirements for the Mock IETF Network Slice SDN controller +__NOTE__: if you run the Mock IETF Network Slice SDN controller from the PyEnv used for developing on the TeraFlowSDN +framework and you followed the official steps in +[Development Guide > Configure Environment > Python](https://labs.etsi.org/rep/tfs/controller/-/wikis/2.-Development-Guide/2.1.-Configure-Environment/2.1.1.-Python), +all the requirements are already in place. Install them only if you execute it in a separate/standalone environment. + +Install the required dependencies as follows: +```bash +pip install -r src/tests/tools/mock_ietf_network_slice_sdn_ctrl/requirements.in +``` + +Run the Mock IETF Network Slice SDN Controller as follows: +```bash +python src/tests/tools/mock_ietf_network_slice_sdn_ctrl/MockIetfNetworkSliceSdnCtrl.py +``` + + +## 2. Run the Mock IETF Network Slice SDN controller +Run the Mock IETF Network Slice SDN Controller as follows: +```bash +python src/tests/tools/mock_ietf_network_slice_sdn_ctrl/MockIetfNetworkSliceSdnCtrl.py +``` diff --git a/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/ResourceConnectionGroups.py b/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/ResourceConnectionGroups.py new file mode 100644 index 0000000000000000000000000000000000000000..19c84e181a97354940fd3dca8f3d6396c0a50068 --- /dev/null +++ b/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/ResourceConnectionGroups.py @@ -0,0 +1,31 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +# REST-API resource implementing minimal support for "IETF YANG Data Model for Transport Network Client Signals". +# Ref: https://www.ietf.org/archive/id/draft-ietf-ccamp-client-signal-yang-10.html + +from flask import jsonify, make_response, request +from flask_restful import Resource + +CONNECTION_GROUPS = [] + + +class ConnectionGroup(Resource): + def get(self, slice_id: str, connection_group_id: str): + return make_response(jsonify(CONNECTION_GROUPS), 200) + + def put(self, slice_id: str, connection_group_id: str): + json_request = request.get_json() + CONNECTION_GROUPS.append(json_request) + return make_response(jsonify({}), 200) diff --git a/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/ResourceNetworkSlices.py b/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/ResourceNetworkSlices.py new file mode 100644 index 0000000000000000000000000000000000000000..80840f8da13e00af689c7b84e9577e952d9e2adf --- /dev/null +++ b/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/ResourceNetworkSlices.py @@ -0,0 +1,39 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +# REST-API resource implementing minimal support for "IETF YANG Data Model for Transport Network Client Signals". +# Ref: https://www.ietf.org/archive/id/draft-ietf-ccamp-client-signal-yang-10.html + +from flask import jsonify, make_response, request +from flask_restful import Resource + +NETWORK_SLICES = {} + + +class NetworkSliceServices(Resource): + def get(self): + return make_response(jsonify(NETWORK_SLICES), 200) + + def post(self): + json_request = request.get_json() + name = json_request["network-slice-services"]["slice-service"][0]["id"] + NETWORK_SLICES[name] = json_request + return make_response(jsonify({}), 201) + + +class NetworkSliceService(Resource): + def delete(self, slice_id: str): + slice = NETWORK_SLICES.pop(slice_id, None) + data, status = ({}, 404) if slice is None else (slice, 204) + return make_response(jsonify(data), status) diff --git a/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/__init__.py b/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..3ccc21c7db78aac26daa1f8c5ff8e1ffd3f35460 --- /dev/null +++ b/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + diff --git a/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/build.sh b/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/build.sh new file mode 100755 index 0000000000000000000000000000000000000000..8e4dda34d7c83ef76c9944bcf52475de05d5238d --- /dev/null +++ b/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/build.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +# Make folder containing the script the root folder for its execution +cd $(dirname $0) + +docker build -t mock-ietf-network-slice-sdn-ctrl:test -f Dockerfile . +docker tag mock-ietf-network-slice-sdn-ctrl:test localhost:32000/tfs/mock-ietf-network-slice-sdn-ctrl:test +docker push localhost:32000/tfs/mock-ietf-network-slice-sdn-ctrl:test diff --git a/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/deploy.sh b/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/deploy.sh new file mode 100755 index 0000000000000000000000000000000000000000..6db45be588e4d538e04ecb8922b3350432439a70 --- /dev/null +++ b/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/deploy.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +kubectl delete namespace mocks +kubectl --namespace mocks apply -f mock-ietf-network-slice-sdn-ctrl.yaml diff --git a/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/mock-ietf-network-slice-sdn-ctrl.yaml b/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/mock-ietf-network-slice-sdn-ctrl.yaml new file mode 100644 index 0000000000000000000000000000000000000000..cd5734a5f3087dc36d9a103a75e90f3eb902865d --- /dev/null +++ b/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/mock-ietf-network-slice-sdn-ctrl.yaml @@ -0,0 +1,64 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +kind: Namespace +apiVersion: v1 +metadata: + name: mocks +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mock-ietf-network-slice-sdn-ctrl +spec: + selector: + matchLabels: + app: mock-ietf-network-slice-sdn-ctrl + replicas: 1 + template: + metadata: + annotations: + config.linkerd.io/skip-inbound-ports: "8443" + labels: + app: mock-ietf-network-slice-sdn-ctrl + spec: + terminationGracePeriodSeconds: 5 + containers: + - name: server + image: localhost:32000/tfs/mock-ietf-network-slice-sdn-ctrl:test + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8443 + resources: + requests: + cpu: 250m + memory: 512Mi + limits: + cpu: 700m + memory: 1024Mi +--- +apiVersion: v1 +kind: Service +metadata: + name: mock-ietf-network-slice-sdn-ctrl + labels: + app: mock-ietf-network-slice-sdn-ctrl +spec: + type: ClusterIP + selector: + app: mock-ietf-network-slice-sdn-ctrl + ports: + - name: http + port: 8443 + targetPort: 8443 diff --git a/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/requirements.in b/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/requirements.in new file mode 100644 index 0000000000000000000000000000000000000000..dbb8e95d65cfd0f1ee60d9bb4f840393ac893725 --- /dev/null +++ b/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/requirements.in @@ -0,0 +1,22 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +cryptography==39.0.1 +pyopenssl==23.0.0 +Flask==2.1.3 +Flask-HTTPAuth==4.5.0 +Flask-RESTful==0.3.9 +jsonschema==4.4.0 +requests==2.27.1 +werkzeug==2.3.7 diff --git a/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/run.sh b/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/run.sh new file mode 100755 index 0000000000000000000000000000000000000000..f52b6061b3d89b75504f2b80d77696573a09814d --- /dev/null +++ b/src/tests/tools/mock_ietf_network_slice_sdn_ctrl/run.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +# Make folder containing the script the root folder for its execution +cd $(dirname $0) + +python MockIetfNetworkSliceSdnCtrl.py diff --git a/src/tests/tools/mock_nce_ctrl/Dockerfile b/src/tests/tools/mock_nce_ctrl/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..ae9dde4eb469a951c1ccf3f78a79a9ab2d07c122 --- /dev/null +++ b/src/tests/tools/mock_nce_ctrl/Dockerfile @@ -0,0 +1,37 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +FROM python:3.9-slim + +# Set Python to show logs as they occur +ENV PYTHONUNBUFFERED=0 + +# Get generic Python packages +RUN python3 -m pip install --upgrade pip +RUN python3 -m pip install --upgrade setuptools wheel +RUN python3 -m pip install --upgrade pip-tools + +# Create component sub-folders, and copy content +RUN mkdir -p /var/teraflow/mock_nce_ctrl +WORKDIR /var/teraflow/mock_nce_ctrl +COPY . . + +# Get specific Python packages +RUN pip-compile --quiet --output-file=requirements.txt requirements.in +RUN python3 -m pip install -r requirements.txt + +RUN python3 -m pip list + +# Start the service +ENTRYPOINT ["python", "MockNCECtrl.py"] diff --git a/src/tests/tools/mock_nce_ctrl/MockNCECtrl.py b/src/tests/tools/mock_nce_ctrl/MockNCECtrl.py new file mode 100644 index 0000000000000000000000000000000000000000..e58a4dc445e74e6186267e7b43b2872b05cb114e --- /dev/null +++ b/src/tests/tools/mock_nce_ctrl/MockNCECtrl.py @@ -0,0 +1,79 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +# Mock IETF ACTN SDN controller +# ----------------------------- +# REST server implementing minimal support for: +# - IETF YANG Data Model for Transport Network Client Signals +# Ref: https://www.ietf.org/archive/id/draft-ietf-ccamp-client-signal-yang-10.html +# - IETF YANG Data Model for Traffic Engineering Tunnels, Label Switched Paths and Interfaces +# Ref: https://www.ietf.org/archive/id/draft-ietf-teas-yang-te-34.html + + +import functools, logging, sys, time +from flask import Flask, jsonify, make_response, request +from flask_restful import Api, Resource +from ResourceApps import Apps, App +from ResourceAppFlows import AppFlows, AppFlow + +BIND_ADDRESS = "0.0.0.0" +BIND_PORT = 8443 +BASE_URL = "/restconf/v1/data/app-flows" +STR_ENDPOINT = "http://{:s}:{:s}{:s}".format( + str(BIND_ADDRESS), str(BIND_PORT), str(BASE_URL) +) +LOG_LEVEL = logging.DEBUG + +logging.basicConfig( + level=LOG_LEVEL, format="[%(asctime)s] %(levelname)s:%(name)s:%(message)s" +) +LOGGER = logging.getLogger(__name__) + +logging.getLogger("werkzeug").setLevel(logging.WARNING) + + +def log_request(logger: logging.Logger, response): + timestamp = time.strftime("[%Y-%b-%d %H:%M]") + logger.info( + "%s %s %s %s %s", + timestamp, + request.remote_addr, + request.method, + request.full_path, + response.status, + ) + return response + + +def main(): + LOGGER.info("Starting...") + + app = Flask(__name__) + app.after_request(functools.partial(log_request, LOGGER)) + + api = Api(app, prefix=BASE_URL) + api.add_resource(Apps, "/apps") + api.add_resource(App, "/apps/application=<string:app_name>") + api.add_resource(AppFlows, "") + api.add_resource(AppFlow, "/app-flow=<string:app_name>") + + LOGGER.info("Listening on {:s}...".format(str(STR_ENDPOINT))) + app.run(debug=True, host=BIND_ADDRESS, port=BIND_PORT) + + LOGGER.info("Bye") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/src/tests/tools/mock_nce_ctrl/README.md b/src/tests/tools/mock_nce_ctrl/README.md new file mode 100644 index 0000000000000000000000000000000000000000..407f26425bd70b22e1426cc13dede15993925258 --- /dev/null +++ b/src/tests/tools/mock_nce_ctrl/README.md @@ -0,0 +1,29 @@ +# Mock NCE Controller + +This REST server implements very basic support for the NCE access controller. + +The aim of this server is to enable testing IETF Network Slice NBI, NCE driver and NCE service handler. + + +## 1. Install requirements for the Mock NCE controller +__NOTE__: if you run the Mock NCE controller from the PyEnv used for developing on the TeraFlowSDN +framework and you followed the official steps in +[Development Guide > Configure Environment > Python](https://labs.etsi.org/rep/tfs/controller/-/wikis/2.-Development-Guide/2.1.-Configure-Environment/2.1.1.-Python), +all the requirements are already in place. Install them only if you execute it in a separate/standalone environment. + +Install the required dependencies as follows: +```bash +pip install -r src/tests/tools/mock_nce_ctrl/requirements.in +``` + +Run the Mock NCE Controller as follows: +```bash +python src/tests/tools/mock_nce_ctrl/MockNCECtrl.py +``` + + +## 2. Run the Mock NCE controller +Run the Mock NCE Controller as follows: +```bash +python src/tests/tools/mock_nce_ctrl/MockNCECtrl.py +``` diff --git a/src/tests/tools/mock_nce_ctrl/ResourceAppFlows.py b/src/tests/tools/mock_nce_ctrl/ResourceAppFlows.py new file mode 100644 index 0000000000000000000000000000000000000000..9f7a8df41497293af912bcf4f77aa27eabdbf095 --- /dev/null +++ b/src/tests/tools/mock_nce_ctrl/ResourceAppFlows.py @@ -0,0 +1,39 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +# REST-API resource implementing minimal support for "IETF YANG Data Model for Transport Network Client Signals". +# Ref: https://www.ietf.org/archive/id/draft-ietf-ccamp-client-signal-yang-10.html + +from flask import jsonify, make_response, request +from flask_restful import Resource + +APP_FLOWS = {} + + +class AppFlows(Resource): + def get(self): + return make_response(jsonify(APP_FLOWS), 200) + + def post(self): + json_request = request.get_json() + name = json_request["app-flow"][0]["app-name"] + APP_FLOWS[name] = json_request + return make_response(jsonify({}), 201) + + +class AppFlow(Resource): + def delete(self, app_name: str): + app_flow = APP_FLOWS.pop(app_name, None) + data, status = ({}, 404) if app_flow is None else (app_flow, 204) + return make_response(jsonify(data), status) diff --git a/src/tests/tools/mock_nce_ctrl/ResourceApps.py b/src/tests/tools/mock_nce_ctrl/ResourceApps.py new file mode 100644 index 0000000000000000000000000000000000000000..163d08fc2fed7fd3c21806418de06bf7ef08741a --- /dev/null +++ b/src/tests/tools/mock_nce_ctrl/ResourceApps.py @@ -0,0 +1,39 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +# REST-API resource implementing minimal support for "IETF YANG Data Model for Transport Network Client Signals". +# Ref: https://www.ietf.org/archive/id/draft-ietf-ccamp-client-signal-yang-10.html + +from flask import jsonify, make_response, request +from flask_restful import Resource + +APPS = {} + + +class Apps(Resource): + def get(self): + return make_response(jsonify(APPS), 200) + + def post(self): + json_request = request.get_json() + name = json_request["application"][0]["name"] + APPS[name] = json_request + return make_response(jsonify({}), 201) + + +class App(Resource): + def delete(self, app_name: str): + app_flow = APPS.pop(app_name, None) + data, status = ({}, 404) if app_flow is None else (app_flow, 204) + return make_response(jsonify(data), status) diff --git a/src/tests/tools/mock_nce_ctrl/__init__.py b/src/tests/tools/mock_nce_ctrl/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..3ccc21c7db78aac26daa1f8c5ff8e1ffd3f35460 --- /dev/null +++ b/src/tests/tools/mock_nce_ctrl/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + diff --git a/src/tests/tools/mock_nce_ctrl/build.sh b/src/tests/tools/mock_nce_ctrl/build.sh new file mode 100755 index 0000000000000000000000000000000000000000..766d2c1dc5d3a890c5a74d88c22055792b089de4 --- /dev/null +++ b/src/tests/tools/mock_nce_ctrl/build.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +# Make folder containing the script the root folder for its execution +cd $(dirname $0) + +docker build -t mock-nce-ctrl:test -f Dockerfile . +docker tag mock-nce-ctrl:test localhost:32000/tfs/mock-nce-ctrl:test +docker push localhost:32000/tfs/mock-nce-ctrl:test diff --git a/src/tests/tools/mock_nce_ctrl/deploy.sh b/src/tests/tools/mock_nce_ctrl/deploy.sh new file mode 100755 index 0000000000000000000000000000000000000000..0e5faf26d435ee928f550106e36f85e65109ac66 --- /dev/null +++ b/src/tests/tools/mock_nce_ctrl/deploy.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Copyright 2022-2024 ETSI SDG TeraFlowSDN (TFS) (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. + +kubectl delete namespace mocks +kubectl --namespace mocks apply -f mock-nce-ctrl.yaml diff --git a/src/tests/tools/mock_nce_ctrl/mock-nce-ctrl.yaml b/src/tests/tools/mock_nce_ctrl/mock-nce-ctrl.yaml new file mode 100644 index 0000000000000000000000000000000000000000..4a1512f238970afb0867a3cb79824df4ac60d5c9 --- /dev/null +++ b/src/tests/tools/mock_nce_ctrl/mock-nce-ctrl.yaml @@ -0,0 +1,64 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +kind: Namespace +apiVersion: v1 +metadata: + name: mocks +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mock-nce-ctrl +spec: + selector: + matchLabels: + app: mock-nce-ctrl + replicas: 1 + template: + metadata: + annotations: + config.linkerd.io/skip-inbound-ports: "8443" + labels: + app: mock-nce-ctrl + spec: + terminationGracePeriodSeconds: 5 + containers: + - name: server + image: localhost:32000/tfs/mock-nce-ctrl:test + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8443 + resources: + requests: + cpu: 250m + memory: 512Mi + limits: + cpu: 700m + memory: 1024Mi +--- +apiVersion: v1 +kind: Service +metadata: + name: mock-nce-ctrl + labels: + app: mock-nce-ctrl +spec: + type: ClusterIP + selector: + app: mock-nce-ctrl + ports: + - name: https + port: 8443 + targetPort: 8443 diff --git a/src/tests/tools/mock_nce_ctrl/requirements.in b/src/tests/tools/mock_nce_ctrl/requirements.in new file mode 100644 index 0000000000000000000000000000000000000000..dbb8e95d65cfd0f1ee60d9bb4f840393ac893725 --- /dev/null +++ b/src/tests/tools/mock_nce_ctrl/requirements.in @@ -0,0 +1,22 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +cryptography==39.0.1 +pyopenssl==23.0.0 +Flask==2.1.3 +Flask-HTTPAuth==4.5.0 +Flask-RESTful==0.3.9 +jsonschema==4.4.0 +requests==2.27.1 +werkzeug==2.3.7 diff --git a/src/tests/tools/mock_nce_ctrl/run.sh b/src/tests/tools/mock_nce_ctrl/run.sh new file mode 100755 index 0000000000000000000000000000000000000000..6aa1149a4a9571bc1e52ab66ca0a36391edc6f54 --- /dev/null +++ b/src/tests/tools/mock_nce_ctrl/run.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (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. + +# Make folder containing the script the root folder for its execution +cd $(dirname $0) + +python MockNCECtrl.py