Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
controller
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TFS
controller
Commits
5d2d4546
Commit
5d2d4546
authored
8 months ago
by
Lluis Gifre Renom
Browse files
Options
Downloads
Patches
Plain Diff
Pre-merge code cleanup
parent
fa52178f
No related branches found
No related tags found
2 merge requests
!294
Release TeraFlowSDN 4.0
,
!268
Resolve "(OPT) Integrate QKD tests in TFS CI/CD pipeline"
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
my_deploy.sh
+6
-7
6 additions, 7 deletions
my_deploy.sh
src/device/.gitlab-ci.yml
+25
-25
25 additions, 25 deletions
src/device/.gitlab-ci.yml
src/device/tests/qkd/unit/test_create_apps.py
+14
-0
14 additions, 0 deletions
src/device/tests/qkd/unit/test_create_apps.py
with
45 additions
and
32 deletions
my_deploy.sh
+
6
−
7
View file @
5d2d4546
...
@@ -20,8 +20,7 @@
...
@@ -20,8 +20,7 @@
export
TFS_REGISTRY_IMAGES
=
"http://localhost:32000/tfs/"
export
TFS_REGISTRY_IMAGES
=
"http://localhost:32000/tfs/"
# Set the list of components, separated by spaces, you want to build images for, and deploy.
# 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 load_generator"
export
TFS_COMPONENTS
=
"context device pathcomp service slice nbi webui"
# Uncomment to activate Monitoring (old)
# Uncomment to activate Monitoring (old)
#export TFS_COMPONENTS="${TFS_COMPONENTS} monitoring"
#export TFS_COMPONENTS="${TFS_COMPONENTS} monitoring"
...
@@ -75,11 +74,11 @@ export TFS_COMPONENTS="context device pathcomp service slice nbi webui"
...
@@ -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
# To manage QKD Apps, "service" requires "qkd_app" to be deployed
# before "service", thus we "hack" the TFS_COMPONENTS environment variable prepending the
# 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.
# "qkd_app" only if "service" is already in TFS_COMPONENTS, and re-export it.
if
[[
"
$TFS_COMPONENTS
"
==
*
"service"
*
]]
;
then
#
if [[ "$TFS_COMPONENTS" == *"service"* ]]; then
BEFORE
=
"
${
TFS_COMPONENTS
% service*
}
"
#
BEFORE="${TFS_COMPONENTS% service*}"
AFTER
=
"
${
TFS_COMPONENTS
#* service
}
"
#
AFTER="${TFS_COMPONENTS#* service}"
export
TFS_COMPONENTS
=
"
${
BEFORE
}
qkd_app service
${
AFTER
}
"
#
export TFS_COMPONENTS="${BEFORE} qkd_app service ${AFTER}"
fi
#
fi
# Set the tag you want to use for your images.
# Set the tag you want to use for your images.
...
...
This diff is collapsed.
Click to expand it.
src/device/.gitlab-ci.yml
+
25
−
25
View file @
5d2d4546
...
@@ -38,29 +38,29 @@ build device:
...
@@ -38,29 +38,29 @@ build device:
-
manifests/${IMAGE_NAME}service.yaml
-
manifests/${IMAGE_NAME}service.yaml
-
.gitlab-ci.yml
-
.gitlab-ci.yml
# Start Mock QKD Nodes before unit testing
#
# Start Mock QKD Nodes before unit testing
start_mock_nodes
:
#
start_mock_nodes:
stage
:
deploy
#
stage: deploy
script
:
#
script:
-
bash src/tests/tools/mock_qkd_nodes/start.sh &
#
- bash src/tests/tools/mock_qkd_nodes/start.sh &
-
sleep
10
# wait for nodes to spin up
#
- sleep 10 # wait for nodes to spin up
artifacts
:
#
artifacts:
paths
:
#
paths:
-
mock_nodes.log
#
- mock_nodes.log
rules
:
#
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 == "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"'
#
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "develop"'
# Prepare Scenario (Start NBI, mock services)
#
# Prepare Scenario (Start NBI, mock services)
prepare_scenario
:
#
prepare_scenario:
stage
:
deploy
#
stage: deploy
script
:
#
script:
-
pytest src/tests/qkd/unit/PrepareScenario.py
#
- pytest src/tests/qkd/unit/PrepareScenario.py
needs
:
#
needs:
-
start_mock_nodes
#
- start_mock_nodes
rules
:
#
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 == "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"'
#
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "develop"'
# Apply unit test to the component
# Apply unit test to the component
unit_test device
:
unit_test device
:
...
@@ -70,8 +70,8 @@ unit_test device:
...
@@ -70,8 +70,8 @@ unit_test device:
stage
:
unit_test
stage
:
unit_test
needs
:
needs
:
-
build device
-
build device
-
start_mock_nodes
#
- start_mock_nodes
-
prepare_scenario
#
- prepare_scenario
before_script
:
before_script
:
-
docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
-
docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
-
>
-
>
...
@@ -94,7 +94,7 @@ unit_test device:
...
@@ -94,7 +94,7 @@ unit_test device:
-
docker logs $IMAGE_NAME
-
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_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/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"
-
docker exec -i $IMAGE_NAME bash -c "coverage report --include='${IMAGE_NAME}/*' --show-missing"
coverage
:
'
/TOTAL\s+\d+\s+\d+\s+(\d+%)/'
coverage
:
'
/TOTAL\s+\d+\s+\d+\s+(\d+%)/'
after_script
:
after_script
:
...
...
This diff is collapsed.
Click to expand it.
src/device/tests/qkd/unit/test_create_apps.py
+
14
−
0
View file @
5d2d4546
# 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
import
requests
QKD_ADDRESS
=
'
10.0.2.10
'
QKD_ADDRESS
=
'
10.0.2.10
'
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment