Skip to content
Snippets Groups Projects
Commit 85b07090 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

EuCNC24:

- Reorganized scripts
- Adapted test to check connectivity between devices with ping
parent 6235134c
No related branches found
No related tags found
2 merge requests!294Release TeraFlowSDN 4.0,!172Resolve "(CTTC) Extend gNMI-OpenConfig SBI driver"
Showing
with 251 additions and 17 deletions
...@@ -112,12 +112,61 @@ end2end_test eucnc24: ...@@ -112,12 +112,61 @@ end2end_test eucnc24:
# done # done
- kubectl --namespace $TFS_K8S_NAMESPACE logs deployment/contextservice -c server - kubectl --namespace $TFS_K8S_NAMESPACE logs deployment/contextservice -c server
# Run end-to-end tests # Run end-to-end test: onboard scenario
- > - >
docker run -t --name ${TEST_NAME} --network=host docker run -t --name ${TEST_NAME} --network=host
--volume "$PWD/tfs_runtime_env_vars.sh:/var/teraflow/tfs_runtime_env_vars.sh" --volume "$PWD/tfs_runtime_env_vars.sh:/var/teraflow/tfs_runtime_env_vars.sh"
--volume "$PWD/src/tests/${TEST_NAME}:/opt/results" --volume "$PWD/src/tests/${TEST_NAME}:/opt/results"
$CI_REGISTRY_IMAGE/${TEST_NAME}:latest $CI_REGISTRY_IMAGE/${TEST_NAME}:latest ./run_onboarding.sh
# Run end-to-end test: configure service TFS
- >
docker run -t --name ${TEST_NAME} --network=host
--volume "$PWD/tfs_runtime_env_vars.sh:/var/teraflow/tfs_runtime_env_vars.sh"
--volume "$PWD/src/tests/${TEST_NAME}:/opt/results"
$CI_REGISTRY_IMAGE/${TEST_NAME}:latest ./run_tfs_service_create.sh
# Run end-to-end test: test connectivity with ping
- sudo containerlab exec --name eucnc24 --label clab-node-name=dc1 --cmd 'ping -n -c3 192.168.1.10'
- sudo containerlab exec --name eucnc24 --label clab-node-name=dc1 --cmd 'ping -n -c3 192.168.1.1'
- sudo containerlab exec --name eucnc24 --label clab-node-name=dc1 --cmd 'ping -n -c3 192.168.2.1'
- sudo containerlab exec --name eucnc24 --label clab-node-name=dc1 --cmd 'ping -n -c3 192.168.2.10'
- sudo containerlab exec --name eucnc24 --label clab-node-name=dc1 --cmd 'ping -n -c3 192.168.3.10'
# Run end-to-end test: deconfigure service TFS
- >
docker run -t --name ${TEST_NAME} --network=host
--volume "$PWD/tfs_runtime_env_vars.sh:/var/teraflow/tfs_runtime_env_vars.sh"
--volume "$PWD/src/tests/${TEST_NAME}:/opt/results"
$CI_REGISTRY_IMAGE/${TEST_NAME}:latest ./run_tfs_service_remove.sh
# Run end-to-end test: configure service IETF
- >
docker run -t --name ${TEST_NAME} --network=host
--volume "$PWD/tfs_runtime_env_vars.sh:/var/teraflow/tfs_runtime_env_vars.sh"
--volume "$PWD/src/tests/${TEST_NAME}:/opt/results"
$CI_REGISTRY_IMAGE/${TEST_NAME}:latest ./run_ietf_service_create.sh
# Run end-to-end test: test connectivity with ping
- sudo containerlab exec --name eucnc24 --label clab-node-name=dc1 --cmd 'ping -n -c3 192.168.1.10'
- sudo containerlab exec --name eucnc24 --label clab-node-name=dc1 --cmd 'ping -n -c3 192.168.1.1'
- sudo containerlab exec --name eucnc24 --label clab-node-name=dc1 --cmd 'ping -n -c3 192.168.2.1'
- sudo containerlab exec --name eucnc24 --label clab-node-name=dc1 --cmd 'ping -n -c3 192.168.2.10'
- sudo containerlab exec --name eucnc24 --label clab-node-name=dc1 --cmd 'ping -n -c3 192.168.3.10'
# Run end-to-end test: deconfigure service IETF
- >
docker run -t --name ${TEST_NAME} --network=host
--volume "$PWD/tfs_runtime_env_vars.sh:/var/teraflow/tfs_runtime_env_vars.sh"
--volume "$PWD/src/tests/${TEST_NAME}:/opt/results"
$CI_REGISTRY_IMAGE/${TEST_NAME}:latest ./run_ietf_service_remove.sh
# Run end-to-end test: cleanup scenario
- >
docker run -t --name ${TEST_NAME} --network=host
--volume "$PWD/tfs_runtime_env_vars.sh:/var/teraflow/tfs_runtime_env_vars.sh"
--volume "$PWD/src/tests/${TEST_NAME}:/opt/results"
$CI_REGISTRY_IMAGE/${TEST_NAME}:latest ./run_cleanup.sh
after_script: after_script:
# Dump TeraFlowSDN component logs # Dump TeraFlowSDN component logs
......
...@@ -75,17 +75,4 @@ COPY src/tests/*.py ./tests/ ...@@ -75,17 +75,4 @@ COPY src/tests/*.py ./tests/
COPY src/tests/eucnc24/__init__.py ./tests/eucnc24/__init__.py COPY src/tests/eucnc24/__init__.py ./tests/eucnc24/__init__.py
COPY src/tests/eucnc24/data/. ./tests/eucnc24/data/ COPY src/tests/eucnc24/data/. ./tests/eucnc24/data/
COPY src/tests/eucnc24/tests/. ./tests/eucnc24/tests/ COPY src/tests/eucnc24/tests/. ./tests/eucnc24/tests/
COPY src/tests/eucnc24/scripts/. ./
RUN tee ./run_tests.sh <<EOF
#!/bin/bash
source /var/teraflow/tfs_runtime_env_vars.sh
export PYTHONPATH=/var/teraflow
pytest --verbose --log-level=INFO /var/teraflow/tests/eucnc24/tests/test_functional_bootstrap.py --junitxml=/opt/results/report_bootstrap.xml
pytest --verbose --log-level=INFO /var/teraflow/tests/eucnc24/tests/test_functional_service_tfs.py --junitxml=/opt/results/report_service_tfs.xml
pytest --verbose --log-level=INFO /var/teraflow/tests/eucnc24/tests/test_functional_service_ietf.py --junitxml=/opt/results/report_service_ietf.xml
pytest --verbose --log-level=INFO /var/teraflow/tests/eucnc24/tests/test_functional_cleanup.py --junitxml=/opt/results/report_cleanup.xml
EOF
RUN chmod ug+x ./run_tests.sh
# Run the tests
ENTRYPOINT ["./run_tests.sh"]
#!/bin/bash
# Copyright 2022-2024 ETSI OSG/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_cleanup.xml \
/var/teraflow/tests/eucnc24/tests/test_functional_cleanup.py
#!/bin/bash
# Copyright 2022-2024 ETSI OSG/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/eucnc24/tests/test_functional_onboarding.py
#!/bin/bash
# Copyright 2022-2024 ETSI OSG/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_service_ietf_create.xml \
/var/teraflow/tests/eucnc24/tests/test_service_ietf_create.py
#!/bin/bash
# Copyright 2022-2024 ETSI OSG/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_service_ietf_remove.xml \
/var/teraflow/tests/eucnc24/tests/test_service_ietf_remove.py
#!/bin/bash
# Copyright 2022-2024 ETSI OSG/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_service_tfs_create.xml \
/var/teraflow/tests/eucnc24/tests/test_service_tfs_create.py
#!/bin/bash
# Copyright 2022-2024 ETSI OSG/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_service_tfs_remove.xml \
/var/teraflow/tests/eucnc24/tests/test_service_tfs_remove.py
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
# limitations under the License. # limitations under the License.
import pytest import pytest
from typing import Dict
from context.client.ContextClient import ContextClient from context.client.ContextClient import ContextClient
from device.client.DeviceClient import DeviceClient from device.client.DeviceClient import DeviceClient
from monitoring.client.MonitoringClient import MonitoringClient from monitoring.client.MonitoringClient import MonitoringClient
...@@ -41,3 +42,7 @@ def service_client(): ...@@ -41,3 +42,7 @@ def service_client():
_client = ServiceClient() _client = ServiceClient()
yield _client yield _client
_client.close() _client.close()
@pytest.fixture(scope='session')
def storage() -> Dict:
yield dict()
...@@ -27,7 +27,7 @@ LOGGER.setLevel(logging.DEBUG) ...@@ -27,7 +27,7 @@ LOGGER.setLevel(logging.DEBUG)
DESCRIPTOR_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'data', 'tfs-topology.json') DESCRIPTOR_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'data', 'tfs-topology.json')
ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME)) ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME))
def test_scenario_bootstrap( def test_scenario_onboarding(
context_client : ContextClient, # pylint: disable=redefined-outer-name context_client : ContextClient, # pylint: disable=redefined-outer-name
device_client : DeviceClient, # pylint: disable=redefined-outer-name device_client : DeviceClient, # pylint: disable=redefined-outer-name
) -> None: ) -> None:
......
# Copyright 2022-2024 ETSI OSG/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
from typing import Dict
from common.Constants import DEFAULT_CONTEXT_NAME
from common.proto.context_pb2 import ContextId, ServiceStatusEnum, ServiceTypeEnum
from common.tools.grpc.Tools import grpc_message_to_json_string
from common.tools.object_factory.Context import json_context_id
from context.client.ContextClient import ContextClient
from .Fixtures import context_client, storage # pylint: disable=unused-import
from .Tools import do_rest_get_request, do_rest_post_request
LOGGER = logging.getLogger(__name__)
LOGGER.setLevel(logging.DEBUG)
REQUEST_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'data', 'ietf-l3vpn-service.json')
ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME))
# pylint: disable=redefined-outer-name, unused-argument
def test_service_ietf_creation(
context_client : ContextClient,
storage : Dict
):
# Issue service creation request
with open(REQUEST_FILE, 'r', encoding='UTF-8') as f:
svc1_data = json.load(f)
URL = '/restconf/data/ietf-l3vpn-svc:l3vpn-svc/vpn-services'
do_rest_post_request(URL, body=svc1_data, logger=LOGGER, expected_status_codes={201})
vpn_id = svc1_data['ietf-l3vpn-svc:l3vpn-svc']['vpn-services']['vpn-service'][0]['vpn-id']
URL = '/restconf/data/ietf-l3vpn-svc:l3vpn-svc/vpn-services/vpn-service={:s}/'.format(vpn_id)
service_data = do_rest_get_request(URL, logger=LOGGER, expected_status_codes={200})
service_uuid = service_data['service-id']
storage['svc-uuid'] = service_uuid
# Verify service was created
response = context_client.GetContext(ADMIN_CONTEXT_ID)
assert len(response.service_ids) == 1
assert len(response.slice_ids) == 0
# Check there is 1 service
response = context_client.ListServices(ADMIN_CONTEXT_ID)
LOGGER.warning('Services[{:d}] = {:s}'.format(
len(response.services), grpc_message_to_json_string(response)
))
assert len(response.services) == 1
for service in response.services:
service_id = service.service_id
assert service_id.service_uuid.uuid == service_uuid
assert service.service_status.service_status == ServiceStatusEnum.SERVICESTATUS_ACTIVE
assert service.service_type == ServiceTypeEnum.SERVICETYPE_L3NM
response = context_client.ListConnections(service_id)
LOGGER.warning(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format(
grpc_message_to_json_string(service_id), len(response.connections),
grpc_message_to_json_string(response)
))
assert len(response.connections) == 1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment