diff --git a/my_deploy.sh b/my_deploy.sh index 5d0d3faaa89e873c47c4c4dd910ccb7fd12802df..ee17cb3679f6390115917a005cfaf670585c28c7 100755 --- a/my_deploy.sh +++ b/my_deploy.sh @@ -20,8 +20,7 @@ export TFS_REGISTRY_IMAGES="http://localhost:32000/tfs/" # Set the list of components, separated by spaces, you want to build images for, and deploy. -#export TFS_COMPONENTS="context device pathcomp service slice nbi webui load_generator" -export TFS_COMPONENTS="context device pathcomp service slice nbi webui" +export TFS_COMPONENTS="context device pathcomp service slice nbi webui load_generator" # Uncomment to activate Monitoring (old) #export TFS_COMPONENTS="${TFS_COMPONENTS} monitoring" @@ -75,11 +74,11 @@ export TFS_COMPONENTS="context device pathcomp service slice nbi webui" # 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 +#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. diff --git a/src/device/.gitlab-ci.yml b/src/device/.gitlab-ci.yml index 402a5a1f88ca230d11c52f3b82a4b59472763ad8..3ae6b2b20d22d0a91d10b61acd20fd0d2d4a28ac 100644 --- a/src/device/.gitlab-ci.yml +++ b/src/device/.gitlab-ci.yml @@ -38,29 +38,29 @@ build device: - manifests/${IMAGE_NAME}service.yaml - .gitlab-ci.yml -# Start Mock QKD Nodes before unit testing -start_mock_nodes: - stage: deploy - script: - - bash src/tests/tools/mock_qkd_nodes/start.sh & - - sleep 10 # wait for nodes to spin up - artifacts: - paths: - - mock_nodes.log - 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"' +## Start Mock QKD Nodes before unit testing +#start_mock_nodes: +# stage: deploy +# script: +# - bash src/tests/tools/mock_qkd_nodes/start.sh & +# - sleep 10 # wait for nodes to spin up +# artifacts: +# paths: +# - mock_nodes.log +# 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"' -# Prepare Scenario (Start NBI, mock services) -prepare_scenario: - stage: deploy - script: - - pytest src/tests/qkd/unit/PrepareScenario.py - needs: - - start_mock_nodes - 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"' +## Prepare Scenario (Start NBI, mock services) +#prepare_scenario: +# stage: deploy +# script: +# - pytest src/tests/qkd/unit/PrepareScenario.py +# needs: +# - start_mock_nodes +# 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"' # Apply unit test to the component unit_test device: @@ -70,8 +70,8 @@ unit_test device: stage: unit_test needs: - build device - - start_mock_nodes - - prepare_scenario + #- start_mock_nodes + #- prepare_scenario before_script: - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY - > @@ -94,7 +94,7 @@ unit_test device: - docker logs $IMAGE_NAME - docker exec -i $IMAGE_NAME bash -c "coverage run --append -m pytest --log-level=INFO --verbose $IMAGE_NAME/tests/test_unitary_emulated.py --junitxml=/opt/results/${IMAGE_NAME}_report_emulated.xml" - docker exec -i $IMAGE_NAME bash -c "coverage run --append -m pytest --log-level=INFO --verbose $IMAGE_NAME/tests/test_unitary_ietf_actn.py --junitxml=/opt/results/${IMAGE_NAME}_report_ietf_actn.xml" - - docker exec -i $IMAGE_NAME bash -c "coverage run --append -m pytest --log-level=INFO --verbose $IMAGE_NAME/tests/qkd/unit/test_*.py" + #- docker exec -i $IMAGE_NAME bash -c "coverage run --append -m pytest --log-level=INFO --verbose $IMAGE_NAME/tests/qkd/unit/test_*.py" - docker exec -i $IMAGE_NAME bash -c "coverage report --include='${IMAGE_NAME}/*' --show-missing" coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/' after_script: diff --git a/src/device/tests/qkd/unit/test_create_apps.py b/src/device/tests/qkd/unit/test_create_apps.py index c4da21d895c22407596ec8541cbff875b33333e1..4724e5c4abd04e28586d54ae6dbbbf0be3c7dc5c 100644 --- a/src/device/tests/qkd/unit/test_create_apps.py +++ b/src/device/tests/qkd/unit/test_create_apps.py @@ -1,3 +1,17 @@ +# 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 requests QKD_ADDRESS = '10.0.2.10'