From fe89c48bb46dead2117d6cb5738a4b23ddc509b1 Mon Sep 17 00:00:00 2001 From: sgambelluri Date: Mon, 25 Mar 2024 07:44:20 +0000 Subject: [PATCH 01/28] Bugs Fixed in Running Agents --- src/tests/ofc24/2.device1.json | 2 +- src/tests/ofc24/3.device2.json | 2 +- src/tests/ofc24/4.device3_R1.json | 2 +- src/tests/ofc24/5.device4_R2.json | 2 +- src/tests/ofc24/startExtraNetConfigAgent.sh | 46 +++++++++------- src/tests/ofc24/start_topo.sh | 53 +++++++++++-------- .../ofc24/{ => tempOC/files}/platform_r1.xml | 0 .../ofc24/{ => tempOC/files}/platform_r2.xml | 0 .../ofc24/{ => tempOC/files}/platform_t1.xml | 0 .../ofc24/{ => tempOC/files}/platform_t2.xml | 0 .../{ => tempOC/files}/startNetconfAgent.sh | 0 11 files changed, 62 insertions(+), 45 deletions(-) rename src/tests/ofc24/{ => tempOC/files}/platform_r1.xml (100%) mode change 100755 => 100644 rename src/tests/ofc24/{ => tempOC/files}/platform_r2.xml (100%) mode change 100755 => 100644 rename src/tests/ofc24/{ => tempOC/files}/platform_t1.xml (100%) mode change 100755 => 100644 rename src/tests/ofc24/{ => tempOC/files}/platform_t2.xml (100%) mode change 100755 => 100644 rename src/tests/ofc24/{ => tempOC/files}/startNetconfAgent.sh (100%) mode change 100755 => 100644 diff --git a/src/tests/ofc24/2.device1.json b/src/tests/ofc24/2.device1.json index 3e31f31eb..c5a189e31 100755 --- a/src/tests/ofc24/2.device1.json +++ b/src/tests/ofc24/2.device1.json @@ -41,7 +41,7 @@ "action": 1, "custom": { "resource_key": "_connect/address", - "resource_value": "10.0.2.15" + "resource_value": "10.0.2.4" } }, { diff --git a/src/tests/ofc24/3.device2.json b/src/tests/ofc24/3.device2.json index 812affa7b..a38fc2905 100755 --- a/src/tests/ofc24/3.device2.json +++ b/src/tests/ofc24/3.device2.json @@ -41,7 +41,7 @@ "action": 1, "custom": { "resource_key": "_connect/address", - "resource_value": "10.0.2.15" + "resource_value": "10.0.2.4" } }, { diff --git a/src/tests/ofc24/4.device3_R1.json b/src/tests/ofc24/4.device3_R1.json index 3a57ba79c..1c110f20e 100755 --- a/src/tests/ofc24/4.device3_R1.json +++ b/src/tests/ofc24/4.device3_R1.json @@ -107,7 +107,7 @@ "action": 1, "custom": { "resource_key": "_connect/address", - "resource_value": "10.0.2.15" + "resource_value": "10.0.2.4" } }, { diff --git a/src/tests/ofc24/5.device4_R2.json b/src/tests/ofc24/5.device4_R2.json index 9b1968d09..43ebda5c6 100755 --- a/src/tests/ofc24/5.device4_R2.json +++ b/src/tests/ofc24/5.device4_R2.json @@ -108,7 +108,7 @@ "action": 1, "custom": { "resource_key": "_connect/address", - "resource_value": "10.0.2.15" + "resource_value": "10.0.2.4" } }, { diff --git a/src/tests/ofc24/startExtraNetConfigAgent.sh b/src/tests/ofc24/startExtraNetConfigAgent.sh index d9428585e..f8638a51f 100755 --- a/src/tests/ofc24/startExtraNetConfigAgent.sh +++ b/src/tests/ofc24/startExtraNetConfigAgent.sh @@ -13,22 +13,32 @@ # See the License for the specific language governing permissions and # limitations under the License. -DOCKER_CONTAINER=$1 -DOCKER_PORT=$2 - -if [ -n "$DOCKER_CONTAINER" ] && [ -n "$DOCKER_PORT" ];then - sudo docker stop "$DOCKER_CONTAINER" -t 1 - sudo docker rm "$DOCKER_CONTAINER" - - echo "Creating TPs" - screen -dmS t1 -T xterm sh -c "docker run -p 10.0.2.15:"$DOCKER_PORT":2022 -v ~/tfs-ctrl/tempOC/files:/files --name $DOCKER_CONTAINER -it asgamb1/oc23bgp.img:latest" - sleep 2 - if [ "$( docker container inspect -f '{{.State.Running}}' "$DOCKER_CONTAINER")" = "true" ]; then - docker exec "$DOCKER_CONTAINER" cp /files/demoECOC21_4.xml demoECOC21.xml - docker exec "$DOCKER_CONTAINER" /confd/examples.confd/OC23/startNetconfAgent.sh - else - echo "your container is not running yet" - fi + + + + +screen -dmS t1 -T xterm sh -c "docker run -p 10.0.2.4:2023:2022 -v ~/tfs-ctrl/src/tests/ofc24/tempOC/files:/files --name na1 -it asgamb1/oc23bgp.img:latest bash" +screen -dmS t2 -T xterm sh -c "docker run -p 10.0.2.4:2024:2022 -v ~/tfs-ctrl/src/tests/ofc24/tempOC/files:/files --name na2 -it asgamb1/oc23bgp.img:latest bash" + + + +sleep 4 +echo "starting transponder1 " + +if [ "$( docker container inspect -f '{{.State.Running}}' na1)" = "true" ]; then + docker exec na1 sh -c " cp /files/platform_t1.xml demoECOC21.xml ; + /confd/examples.confd/OC23/startNetconfAgent.sh;" + +else + echo "na1 container is not running yet" +fi + +echo "starting transponder2 " + +if [ "$( docker container inspect -f '{{.State.Running}}' na2)" = "true" ]; then + docker exec na2 sh -c " cp /files/platform_t2.xml demoECOC21.xml; + /confd/examples.confd/OC23/startNetconfAgent.sh " + else - echo "Please define the docker container name and port" -fi + echo "na2 container is not running yet" +fi \ No newline at end of file diff --git a/src/tests/ofc24/start_topo.sh b/src/tests/ofc24/start_topo.sh index c92406476..ed93641c9 100755 --- a/src/tests/ofc24/start_topo.sh +++ b/src/tests/ofc24/start_topo.sh @@ -29,35 +29,42 @@ sudo docker rm na4 echo "Creating Transponder Agents" -# if ! docker image inspect "$IMAGE_NAME" >/dev/null 2>&1 ; then -# echo "asgamb1/oc23bgp.img:latest not existed ! " -# screen -dmS t3 -T xterm sh -c "docker run -p 10.0.2.15:2025:2022 -v ~/tempOC/files:/files --name na -it $IMAGE_NAME bash" -# echo 'start downloading asgamb1/oc23bgp.img:latest , it may take few minutes ! .... ' -# while [ "$(docker image inspect asgamb1/oc23bgp.img:latest 2>/dev/null)" == "[]" ]; do -# sleep 1 -# done + ./startExtraNetConfigAgent.sh -#fi +echo "Creating Roadms Agents" -screen -dmS t1 -T xterm sh -c "docker run -p 127.0.0.1:2023:2022 -v ~/tempOC/files:/files --name $DOCKER_CONTAINER -it asgamb1/oc23bgp.img:latest bash" -sleep 2 -if [ "$( docker container inspect -f '{{.State.Running}}' "$DOCKER_CONTAINER")" = "true" ]; then - docker exec "$DOCKER_CONTAINER" cp /files/demoECOC21_4.xml demoECOC21.xml - docker exec "$DOCKER_CONTAINER" /confd/examples.confd/OC23/startNetconfAgent.sh +screen -dmS t3 -T xterm sh -c 'docker run -p 10.0.2.4:2025:2022 -v ~/tfs-ctrl/src/tests/ofc24/tempOC/files:/files --name na3 -it asgamb1/flexscale-node.img:latest bash ' +screen -dmS t4 -T xterm sh -c 'docker run -p 10.0.2.4:2026:2022 -v ~/tfs-ctrl/src/tests/ofc24/tempOC/files:/files --name na4 -it asgamb1/flexscale-node.img:latest bash ' +sleep 4 + +echo "starting Roadm1 " + +if [ "$( docker container inspect -f '{{.State.Running}}' na4)" = "true" ]; then + docker exec na4 sh -c " cp /files/platform_r2.xml init_openconfig-platform.xml; + cp /files/startNetconfAgent.sh startNetconfAgent.sh; + /confd/examples.confd/OC23/startNetconfAgent.sh ;"& + else - echo "your container is not running yet" + echo "na4 is not running yet" fi -echo " It may take a while , Hang on ..." -source "./startExtraNetConfigAgent.sh" "na1" "2023" -sleep 3 -source "./startExtraNetConfigAgent.sh" "na2" "2024" -sleep 3 +echo "starting Roadm2 " + + + +if [ "$( docker container inspect -f '{{.State.Running}}' na3)" = "true" ]; then + docker exec na3 sh -c " cp /files/platform_r1.xml init_openconfig-platform.xml; + cp /files/startNetconfAgent.sh startNetconfAgent.sh; + /confd/examples.confd/OC23/startNetconfAgent.sh; " + +else + echo "na3 is not running yet" +fi + -bash -c "cp /tempOC/files/plat_r1.xml /confd/examples.confd/OC23/init_openconfig-platform.xml; ./startNetconfAgent.sh" -bash -c "cp /tempOC/files/plat_r2.xml /confd/examples.confd/OC23/init_openconfig-platform.xml; ./startNetconfAgent.sh" -screen -dmS t3 -T xterm sh -c 'docker run -p 10.0.2.15:2025:2022 -v ~/tfs-ctrl/tempOC/files:/files --name na3 -it asgamb1/flexscale-node.img:latest ./startNetconfAgent.sh' -screen -dmS t4 -T xterm sh -c 'docker run -p 10.0.2.15:2026:2022 -v ~/tfs-ctrl/tempOC/files:/files --name na4 -it asgamb1/flexscale-node.img:latest ./startNetconfAgent.sh' +# screen -S t3 -X stuff "cp ~/files/platform_r1.xml /confd/examples.confd/OC23/init_openconfig-platform.xml && ./startNetconfAgent.sh" +# bash -c "docker cp ~/tfs-ctrl/src/tests/ofc24/tempOC/files/platform_r2.xml na4:/confd/examples.confd/OC23/init_openconfig-platform.xml; +# docker cp ~/tfs-ctrl/src/tests/ofc24/tempOC/files/startNetconfAgent.sh na4:/confd/examples.confd/OC23/startNetconfAgent.sh;" diff --git a/src/tests/ofc24/platform_r1.xml b/src/tests/ofc24/tempOC/files/platform_r1.xml old mode 100755 new mode 100644 similarity index 100% rename from src/tests/ofc24/platform_r1.xml rename to src/tests/ofc24/tempOC/files/platform_r1.xml diff --git a/src/tests/ofc24/platform_r2.xml b/src/tests/ofc24/tempOC/files/platform_r2.xml old mode 100755 new mode 100644 similarity index 100% rename from src/tests/ofc24/platform_r2.xml rename to src/tests/ofc24/tempOC/files/platform_r2.xml diff --git a/src/tests/ofc24/platform_t1.xml b/src/tests/ofc24/tempOC/files/platform_t1.xml old mode 100755 new mode 100644 similarity index 100% rename from src/tests/ofc24/platform_t1.xml rename to src/tests/ofc24/tempOC/files/platform_t1.xml diff --git a/src/tests/ofc24/platform_t2.xml b/src/tests/ofc24/tempOC/files/platform_t2.xml old mode 100755 new mode 100644 similarity index 100% rename from src/tests/ofc24/platform_t2.xml rename to src/tests/ofc24/tempOC/files/platform_t2.xml diff --git a/src/tests/ofc24/startNetconfAgent.sh b/src/tests/ofc24/tempOC/files/startNetconfAgent.sh old mode 100755 new mode 100644 similarity index 100% rename from src/tests/ofc24/startNetconfAgent.sh rename to src/tests/ofc24/tempOC/files/startNetconfAgent.sh -- GitLab From 10a2f3ff40d47f6f48265b24076d29e5231bf047 Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Tue, 26 Mar 2024 13:08:30 +0000 Subject: [PATCH 02/28] GitLab CI/CD pipeline - OFC'24: - Updated script to deploy node agents --- src/tests/ofc24/deploy-node-agents.sh | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/tests/ofc24/deploy-node-agents.sh b/src/tests/ofc24/deploy-node-agents.sh index 5c3c8d0d2..d0d32e079 100755 --- a/src/tests/ofc24/deploy-node-agents.sh +++ b/src/tests/ofc24/deploy-node-agents.sh @@ -26,29 +26,30 @@ docker network rm na-br echo echo "Pull Docker images:" echo "-------------------" -docker pull asgamb1/flexscale-hhi.img:latest +docker pull asgamb1/oc23bgp.img:latest docker pull asgamb1/flexscale-node.img:latest + echo echo "Create Management Network and Node Agents:" echo "------------------------------------------" docker network create -d bridge --subnet=172.254.253.0/24 --gateway=172.254.253.254 --ip-range=172.254.253.0/24 na-br docker run -d --name na-t1 --network=na-br --ip 172.254.253.1 \ - --volume "$PWD/src/tests/${TEST_NAME}/startNetconfAgent.sh:/confd/examples.confd/OC23/startNetconfAgent.sh" \ - --volume "$PWD/src/tests/${TEST_NAME}/platform_t1.xml:/confd/examples.confd/OC23/init_openconfig-platform.xml" \ - asgamb1/flexscale-hhi.img:latest /confd/examples.confd/OC23/startNetconfAgent.sh + --volume "$PWD/src/tests/${TEST_NAME}/tempOC/files/platform_t1.xml:/confd/examples.confd/OC23/demoECOC21.xml" \ + asgamb1/oc23bgp.img:latest /confd/examples.confd/OC23/startNetconfAgent.sh + #--volume "$PWD/src/tests/${TEST_NAME}/tempOC/files/startNetconfAgent.sh:/confd/examples.confd/OC23/startNetconfAgent.sh" \ docker run -d --name na-t2 --network=na-br --ip 172.254.253.2 \ - --volume "$PWD/src/tests/${TEST_NAME}/startNetconfAgent.sh:/confd/examples.confd/OC23/startNetconfAgent.sh" \ - --volume "$PWD/src/tests/${TEST_NAME}/platform_t2.xml:/confd/examples.confd/OC23/init_openconfig-platform.xml" \ - asgamb1/flexscale-hhi.img:latest /confd/examples.confd/OC23/startNetconfAgent.sh + --volume "$PWD/src/tests/${TEST_NAME}/tempOC/files/platform_t2.xml:/confd/examples.confd/OC23/demoECOC21.xml" \ + asgamb1/oc23bgp.img:latest /confd/examples.confd/OC23/startNetconfAgent.sh + #--volume "$PWD/src/tests/${TEST_NAME}/tempOC/files/startNetconfAgent.sh:/confd/examples.confd/OC23/startNetconfAgent.sh" \ docker run -d --name na-r1 --network=na-br --ip 172.254.253.101 \ - --volume "$PWD/src/tests/${TEST_NAME}/startNetconfAgent.sh:/confd/examples.confd/OC23/startNetconfAgent.sh" \ - --volume "$PWD/src/tests/${TEST_NAME}/platform_r1.xml:/confd/examples.confd/OC23/init_openconfig-platform.xml" \ + --volume "$PWD/src/tests/${TEST_NAME}/tempOC/files/platform_r1.xml:/confd/examples.confd/OC23/init_openconfig-platform.xml" \ asgamb1/flexscale-node.img:latest /confd/examples.confd/OC23/startNetconfAgent.sh + #--volume "$PWD/src/tests/${TEST_NAME}/tempOC/files/startNetconfAgent.sh:/confd/examples.confd/OC23/startNetconfAgent.sh" \ docker run -d --name na-r2 --network=na-br --ip 172.254.253.102 \ - --volume "$PWD/src/tests/${TEST_NAME}/startNetconfAgent.sh:/confd/examples.confd/OC23/startNetconfAgent.sh" \ - --volume "$PWD/src/tests/${TEST_NAME}/platform_r2.xml:/confd/examples.confd/OC23/init_openconfig-platform.xml" \ + --volume "$PWD/src/tests/${TEST_NAME}/tempOC/files/platform_r2.xml:/confd/examples.confd/OC23/init_openconfig-platform.xml" \ asgamb1/flexscale-node.img:latest /confd/examples.confd/OC23/startNetconfAgent.sh + #--volume "$PWD/src/tests/${TEST_NAME}/tempOC/files/startNetconfAgent.sh:/confd/examples.confd/OC23/startNetconfAgent.sh" \ echo -- GitLab From 2a5918013d10ce4590373805835b47414a66ea4e Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Fri, 5 Apr 2024 09:54:13 +0000 Subject: [PATCH 03/28] OFC'24 test: - Reorganized descriptor files - Reorganized node agent config files - Reorganized old node agent deploy scripts - Updated node agents deploy scripts --- src/tests/ofc24/_old/README.md | 21 +++++++++ .../{ => _old}/startExtraNetConfigAgent.sh | 0 src/tests/ofc24/{ => _old}/start_topo.sh | 0 src/tests/ofc24/deploy-node-agents.sh | 46 ++++++++----------- .../{ => descriptors}/7.service-bidir.json | 0 .../{ => descriptors}/7.service-unidir.json | 0 .../descriptors_topology.json | 0 .../{ => descriptors/old}/1.context.json | 0 .../{ => descriptors/old}/2.device1.json | 0 .../{ => descriptors/old}/3.device2.json | 0 .../{ => descriptors/old}/4.device3_R1.json | 0 .../{ => descriptors/old}/5.device4_R2.json | 0 .../ofc24/{ => descriptors/old}/6.links.json | 0 src/tests/ofc24/destroy-node-agents.sh | 22 +++++++++ .../platform_r1.xml | 0 .../platform_r2.xml | 0 .../platform_t1.xml | 0 .../platform_t2.xml | 0 .../startNetconfAgent-mg-on.sh | 15 ++++++ .../startNetconfAgent-tp.sh | 17 +++++++ .../ofc24/tempOC/files/startNetconfAgent.sh | 7 --- 21 files changed, 94 insertions(+), 34 deletions(-) create mode 100644 src/tests/ofc24/_old/README.md rename src/tests/ofc24/{ => _old}/startExtraNetConfigAgent.sh (100%) rename src/tests/ofc24/{ => _old}/start_topo.sh (100%) rename src/tests/ofc24/{ => descriptors}/7.service-bidir.json (100%) rename src/tests/ofc24/{ => descriptors}/7.service-unidir.json (100%) rename src/tests/ofc24/{ => descriptors}/descriptors_topology.json (100%) rename src/tests/ofc24/{ => descriptors/old}/1.context.json (100%) rename src/tests/ofc24/{ => descriptors/old}/2.device1.json (100%) rename src/tests/ofc24/{ => descriptors/old}/3.device2.json (100%) rename src/tests/ofc24/{ => descriptors/old}/4.device3_R1.json (100%) rename src/tests/ofc24/{ => descriptors/old}/5.device4_R2.json (100%) rename src/tests/ofc24/{ => descriptors/old}/6.links.json (100%) create mode 100755 src/tests/ofc24/destroy-node-agents.sh rename src/tests/ofc24/{tempOC/files => node-agents-config}/platform_r1.xml (100%) rename src/tests/ofc24/{tempOC/files => node-agents-config}/platform_r2.xml (100%) rename src/tests/ofc24/{tempOC/files => node-agents-config}/platform_t1.xml (100%) rename src/tests/ofc24/{tempOC/files => node-agents-config}/platform_t2.xml (100%) create mode 100755 src/tests/ofc24/node-agents-config/startNetconfAgent-mg-on.sh create mode 100755 src/tests/ofc24/node-agents-config/startNetconfAgent-tp.sh delete mode 100644 src/tests/ofc24/tempOC/files/startNetconfAgent.sh diff --git a/src/tests/ofc24/_old/README.md b/src/tests/ofc24/_old/README.md new file mode 100644 index 000000000..93e95fc64 --- /dev/null +++ b/src/tests/ofc24/_old/README.md @@ -0,0 +1,21 @@ +# OFC'24 - Test scenario + +## Start Topology +Topology is composed of 2 transponders managed through OpenConfig and 2 Multi-granular ROAMDS +Strat the topology executing the following command: +```bash +sudo ./start_topo.sh +``` + +## Populate the TFS context and topology +Pushing the JSON files following the file indexes, i.e, 1, 2, 3, ... +The last JSON file with ID 7 is the service. +To check the service is onboarded successfully go into the TFS WebUI and check the `Service` tab. + +## Check configuration in devices +Check if the devices are configured properly. +To check that, run, for each device (X={1, 2, 3, 4}): +```bash +screen -r tX +``` +To release the terminal, press `Ctrl + A + D` diff --git a/src/tests/ofc24/startExtraNetConfigAgent.sh b/src/tests/ofc24/_old/startExtraNetConfigAgent.sh similarity index 100% rename from src/tests/ofc24/startExtraNetConfigAgent.sh rename to src/tests/ofc24/_old/startExtraNetConfigAgent.sh diff --git a/src/tests/ofc24/start_topo.sh b/src/tests/ofc24/_old/start_topo.sh similarity index 100% rename from src/tests/ofc24/start_topo.sh rename to src/tests/ofc24/_old/start_topo.sh diff --git a/src/tests/ofc24/deploy-node-agents.sh b/src/tests/ofc24/deploy-node-agents.sh index d0d32e079..1c1e45526 100755 --- a/src/tests/ofc24/deploy-node-agents.sh +++ b/src/tests/ofc24/deploy-node-agents.sh @@ -17,8 +17,8 @@ TEST_NAME="ofc24" echo -echo "Pre-deploy clean-up:" -echo "--------------------" +echo "Clean-up:" +echo "---------" docker rm -f na-t1 na-t2 na-r1 na-r2 docker network rm na-br @@ -34,35 +34,33 @@ echo echo "Create Management Network and Node Agents:" echo "------------------------------------------" docker network create -d bridge --subnet=172.254.253.0/24 --gateway=172.254.253.254 --ip-range=172.254.253.0/24 na-br -docker run -d --name na-t1 --network=na-br --ip 172.254.253.1 \ - --volume "$PWD/src/tests/${TEST_NAME}/tempOC/files/platform_t1.xml:/confd/examples.confd/OC23/demoECOC21.xml" \ +docker run -dit --init --name na-t1 --network=na-br --ip 172.254.253.101 \ + --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/startNetconfAgent-tp.sh:/confd/examples.confd/OC23/startNetconfAgent.sh" \ + --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/platform_t1.xml:/confd/examples.confd/OC23/platform.xml" \ asgamb1/oc23bgp.img:latest /confd/examples.confd/OC23/startNetconfAgent.sh - #--volume "$PWD/src/tests/${TEST_NAME}/tempOC/files/startNetconfAgent.sh:/confd/examples.confd/OC23/startNetconfAgent.sh" \ -docker run -d --name na-t2 --network=na-br --ip 172.254.253.2 \ - --volume "$PWD/src/tests/${TEST_NAME}/tempOC/files/platform_t2.xml:/confd/examples.confd/OC23/demoECOC21.xml" \ +docker run -dit --init --name na-t2 --network=na-br --ip 172.254.253.102 \ + --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/startNetconfAgent-tp.sh:/confd/examples.confd/OC23/startNetconfAgent.sh" \ + --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/platform_t2.xml:/confd/examples.confd/OC23/platform.xml" \ asgamb1/oc23bgp.img:latest /confd/examples.confd/OC23/startNetconfAgent.sh - #--volume "$PWD/src/tests/${TEST_NAME}/tempOC/files/startNetconfAgent.sh:/confd/examples.confd/OC23/startNetconfAgent.sh" \ -docker run -d --name na-r1 --network=na-br --ip 172.254.253.101 \ - --volume "$PWD/src/tests/${TEST_NAME}/tempOC/files/platform_r1.xml:/confd/examples.confd/OC23/init_openconfig-platform.xml" \ +docker run -dit --init --name na-r1 --network=na-br --ip 172.254.253.201 \ + --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/startNetconfAgent-mg-on.sh:/confd/examples.confd/OC23/startNetconfAgent.sh" \ + --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/platform_r1.xml:/confd/examples.confd/OC23/platform.xml" \ asgamb1/flexscale-node.img:latest /confd/examples.confd/OC23/startNetconfAgent.sh - #--volume "$PWD/src/tests/${TEST_NAME}/tempOC/files/startNetconfAgent.sh:/confd/examples.confd/OC23/startNetconfAgent.sh" \ -docker run -d --name na-r2 --network=na-br --ip 172.254.253.102 \ - --volume "$PWD/src/tests/${TEST_NAME}/tempOC/files/platform_r2.xml:/confd/examples.confd/OC23/init_openconfig-platform.xml" \ +docker run -dit --init --name na-r2 --network=na-br --ip 172.254.253.202 \ + --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/startNetconfAgent-mg-on.sh:/confd/examples.confd/OC23/startNetconfAgent.sh" \ + --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/platform_r2.xml:/confd/examples.confd/OC23/platform.xml" \ asgamb1/flexscale-node.img:latest /confd/examples.confd/OC23/startNetconfAgent.sh - #--volume "$PWD/src/tests/${TEST_NAME}/tempOC/files/startNetconfAgent.sh:/confd/examples.confd/OC23/startNetconfAgent.sh" \ echo echo "Waiting for initialization..." echo "-----------------------------" docker ps -a -sleep 5 -docker ps -a while ! docker logs na-t1 2>&1 | grep -q '*** ConfD OpenConfig NETCONF agent ***'; do sleep 1; done while ! docker logs na-t2 2>&1 | grep -q '*** ConfD OpenConfig NETCONF agent ***'; do sleep 1; done while ! docker logs na-r1 2>&1 | grep -q '*** ConfD OpenConfig NETCONF agent ***'; do sleep 1; done while ! docker logs na-r2 2>&1 | grep -q '*** ConfD OpenConfig NETCONF agent ***'; do sleep 1; done -sleep 2 +sleep 3 docker ps -a @@ -70,16 +68,10 @@ echo echo "Dump Node Agent status:" echo "-----------------------" docker ps -a -#docker logs na-t1 -#docker logs na-t2 -#docker logs na-r1 -#docker logs na-r2 - +docker logs na-t1 +docker logs na-t2 +docker logs na-r1 +docker logs na-r2 -#echo -#echo "Post-test clean-up:" -#echo "-------------------" -#docker rm -f na-t1 na-t2 na-r1 na-r2 -#docker network rm na-br echo "Done!" diff --git a/src/tests/ofc24/7.service-bidir.json b/src/tests/ofc24/descriptors/7.service-bidir.json similarity index 100% rename from src/tests/ofc24/7.service-bidir.json rename to src/tests/ofc24/descriptors/7.service-bidir.json diff --git a/src/tests/ofc24/7.service-unidir.json b/src/tests/ofc24/descriptors/7.service-unidir.json similarity index 100% rename from src/tests/ofc24/7.service-unidir.json rename to src/tests/ofc24/descriptors/7.service-unidir.json diff --git a/src/tests/ofc24/descriptors_topology.json b/src/tests/ofc24/descriptors/descriptors_topology.json similarity index 100% rename from src/tests/ofc24/descriptors_topology.json rename to src/tests/ofc24/descriptors/descriptors_topology.json diff --git a/src/tests/ofc24/1.context.json b/src/tests/ofc24/descriptors/old/1.context.json similarity index 100% rename from src/tests/ofc24/1.context.json rename to src/tests/ofc24/descriptors/old/1.context.json diff --git a/src/tests/ofc24/2.device1.json b/src/tests/ofc24/descriptors/old/2.device1.json similarity index 100% rename from src/tests/ofc24/2.device1.json rename to src/tests/ofc24/descriptors/old/2.device1.json diff --git a/src/tests/ofc24/3.device2.json b/src/tests/ofc24/descriptors/old/3.device2.json similarity index 100% rename from src/tests/ofc24/3.device2.json rename to src/tests/ofc24/descriptors/old/3.device2.json diff --git a/src/tests/ofc24/4.device3_R1.json b/src/tests/ofc24/descriptors/old/4.device3_R1.json similarity index 100% rename from src/tests/ofc24/4.device3_R1.json rename to src/tests/ofc24/descriptors/old/4.device3_R1.json diff --git a/src/tests/ofc24/5.device4_R2.json b/src/tests/ofc24/descriptors/old/5.device4_R2.json similarity index 100% rename from src/tests/ofc24/5.device4_R2.json rename to src/tests/ofc24/descriptors/old/5.device4_R2.json diff --git a/src/tests/ofc24/6.links.json b/src/tests/ofc24/descriptors/old/6.links.json similarity index 100% rename from src/tests/ofc24/6.links.json rename to src/tests/ofc24/descriptors/old/6.links.json diff --git a/src/tests/ofc24/destroy-node-agents.sh b/src/tests/ofc24/destroy-node-agents.sh new file mode 100755 index 000000000..19e7fc9a9 --- /dev/null +++ b/src/tests/ofc24/destroy-node-agents.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. + +echo +echo "Clean-up:" +echo "---------" +docker rm -f na-t1 na-t2 na-r1 na-r2 +docker network rm na-br + +echo "Done!" diff --git a/src/tests/ofc24/tempOC/files/platform_r1.xml b/src/tests/ofc24/node-agents-config/platform_r1.xml similarity index 100% rename from src/tests/ofc24/tempOC/files/platform_r1.xml rename to src/tests/ofc24/node-agents-config/platform_r1.xml diff --git a/src/tests/ofc24/tempOC/files/platform_r2.xml b/src/tests/ofc24/node-agents-config/platform_r2.xml similarity index 100% rename from src/tests/ofc24/tempOC/files/platform_r2.xml rename to src/tests/ofc24/node-agents-config/platform_r2.xml diff --git a/src/tests/ofc24/tempOC/files/platform_t1.xml b/src/tests/ofc24/node-agents-config/platform_t1.xml similarity index 100% rename from src/tests/ofc24/tempOC/files/platform_t1.xml rename to src/tests/ofc24/node-agents-config/platform_t1.xml diff --git a/src/tests/ofc24/tempOC/files/platform_t2.xml b/src/tests/ofc24/node-agents-config/platform_t2.xml similarity index 100% rename from src/tests/ofc24/tempOC/files/platform_t2.xml rename to src/tests/ofc24/node-agents-config/platform_t2.xml diff --git a/src/tests/ofc24/node-agents-config/startNetconfAgent-mg-on.sh b/src/tests/ofc24/node-agents-config/startNetconfAgent-mg-on.sh new file mode 100755 index 000000000..fe5ad5618 --- /dev/null +++ b/src/tests/ofc24/node-agents-config/startNetconfAgent-mg-on.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +echo 'Cleaning...' +make clean + +echo 'Rebuilding...' +make all + +echo 'Initializing database...' +cp platform.xml confd-cdb/ + +echo 'Starting ConfD...' +make start2 + +echo 'ConfD Ready!!' diff --git a/src/tests/ofc24/node-agents-config/startNetconfAgent-tp.sh b/src/tests/ofc24/node-agents-config/startNetconfAgent-tp.sh new file mode 100755 index 000000000..afc28cee7 --- /dev/null +++ b/src/tests/ofc24/node-agents-config/startNetconfAgent-tp.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +echo 'Cleaning...' +make clean + +echo 'Rebuilding...' +make all + +echo 'Initializing database...' +cp platform.xml confd-cdb/ +cp interfaces.xml confd-cdb/ +cp bgp.xml confd-cdb/ + +echo 'Starting ConfD...' +make start2 + +echo 'ConfD Ready!!' diff --git a/src/tests/ofc24/tempOC/files/startNetconfAgent.sh b/src/tests/ofc24/tempOC/files/startNetconfAgent.sh deleted file mode 100644 index 10b721883..000000000 --- a/src/tests/ofc24/tempOC/files/startNetconfAgent.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -make clean -make all -#make init -cp init_openconfig-platform.xml confd-cdb/ -#cp init_flex-scale-mg-on.xml confd-cdb/ -make start2 -- GitLab From 3f31baf859619c85d452523ff5184e6110398924 Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Fri, 5 Apr 2024 10:12:21 +0000 Subject: [PATCH 04/28] GitLab CI/CD pipeline - OFC'24: - Updated pipeline manifest - Updated TFS deploy specs --- src/tests/ofc24/.gitlab-ci.yml | 28 +++++++++++++++++++++++----- src/tests/ofc24/deploy_specs.sh | 2 +- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/tests/ofc24/.gitlab-ci.yml b/src/tests/ofc24/.gitlab-ci.yml index 0b5593b16..6d5257964 100644 --- a/src/tests/ofc24/.gitlab-ci.yml +++ b/src/tests/ofc24/.gitlab-ci.yml @@ -13,9 +13,9 @@ # limitations under the License. # Build, tag, and push the Docker image to the GitLab Docker registry -build ofc22: +build ofc24: variables: - TEST_NAME: 'ofc22' + TEST_NAME: 'ofc24' stage: build before_script: - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY @@ -36,13 +36,13 @@ build ofc22: - .gitlab-ci.yml # Deploy TeraFlowSDN and Execute end-2-end test -end2end_test ofc22: +end2end_test ofc24: variables: - TEST_NAME: 'ofc22' + TEST_NAME: 'ofc24' stage: end2end_test # Disable to force running it after all other tasks #needs: - # - build ofc22 + # - build ofc24 before_script: - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY script: @@ -53,6 +53,9 @@ end2end_test ofc22: - microk8s status --wait-ready - kubectl get pods --all-namespaces + # Deploy Optical Device Node Agents + - ./src/tests/${TEST_NAME}/deploy-node-agents.sh + # Configure TeraFlowSDN deployment # Uncomment if DEBUG log level is needed for the components #- yq -i '((select(.kind=="Deployment").spec.template.spec.containers.[] | select(.name=="server").env.[]) | select(.name=="LOG_LEVEL").value) |= "DEBUG"' manifests/contextservice.yaml @@ -87,6 +90,7 @@ end2end_test ofc22: --volume "$PWD/src/tests/${TEST_NAME}:/opt/results" $CI_REGISTRY_IMAGE/${TEST_NAME}:latest after_script: + # Dump TeraFlowSDN component logs - source src/tests/${TEST_NAME}/deploy_specs.sh - kubectl --namespace $TFS_K8S_NAMESPACE logs deployment/contextservice -c server - kubectl --namespace $TFS_K8S_NAMESPACE logs deployment/deviceservice -c server @@ -94,8 +98,22 @@ end2end_test ofc22: - kubectl --namespace $TFS_K8S_NAMESPACE logs deployment/serviceservice -c server - kubectl --namespace $TFS_K8S_NAMESPACE logs deployment/sliceservice -c server - kubectl --namespace $TFS_K8S_NAMESPACE logs deployment/nbiservice -c server + - kubectl --namespace $TFS_K8S_NAMESPACE logs deployment/opticalcontrollerservice -c server - if docker ps -a | grep ${TEST_NAME}; then docker rm -f ${TEST_NAME}; fi + + # Dump Optical Device Node Agents container status and logs + - docker ps -a + - docker logs na-t1 + - docker logs na-t2 + - docker logs na-r1 + - docker logs na-r2 + + # Destroy Optical Device Node Agents + - ./src/tests/${TEST_NAME}/destroy-node-agents.sh + + # 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)' diff --git a/src/tests/ofc24/deploy_specs.sh b/src/tests/ofc24/deploy_specs.sh index ca5494de2..e7458dc9d 100755 --- a/src/tests/ofc24/deploy_specs.sh +++ b/src/tests/ofc24/deploy_specs.sh @@ -63,7 +63,7 @@ export TFS_K8S_NAMESPACE="tfs" 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" +#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" -- GitLab From 94219359fe6d02a76291edf7a3f411fc521cec9e Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Fri, 5 Apr 2024 10:30:38 +0000 Subject: [PATCH 05/28] GitLab CI/CD pipeline - OFC'24: - Activate test in pipeline --- src/tests/.gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/.gitlab-ci.yml b/src/tests/.gitlab-ci.yml index 41b8bb36c..b7345bbd1 100644 --- a/src/tests/.gitlab-ci.yml +++ b/src/tests/.gitlab-ci.yml @@ -19,4 +19,4 @@ include: - local: '/src/tests/ecoc22/.gitlab-ci.yml' #- local: '/src/tests/nfvsdn22/.gitlab-ci.yml' #- local: '/src/tests/ofc23/.gitlab-ci.yml' - #- local: '/src/tests/ofc24/.gitlab-ci.yml' + - local: '/src/tests/ofc24/.gitlab-ci.yml' -- GitLab From 68bb8fdf52e87ee0e344fa436023b673cce057a4 Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Fri, 5 Apr 2024 10:38:28 +0000 Subject: [PATCH 06/28] GitLab CI/CD pipeline - OFC'24: - Updated descriptor file names - Updated descriptor paths in Dockerfile --- src/tests/ofc24/Dockerfile | 4 +++- .../descriptors/{7.service-bidir.json => service-bidir.json} | 0 .../{7.service-unidir.json => service-unidir.json} | 0 .../descriptors/{descriptors_topology.json => topology.json} | 0 4 files changed, 3 insertions(+), 1 deletion(-) rename src/tests/ofc24/descriptors/{7.service-bidir.json => service-bidir.json} (100%) rename src/tests/ofc24/descriptors/{7.service-unidir.json => service-unidir.json} (100%) rename src/tests/ofc24/descriptors/{descriptors_topology.json => topology.json} (100%) diff --git a/src/tests/ofc24/Dockerfile b/src/tests/ofc24/Dockerfile index 8efa0c72c..df42fe338 100644 --- a/src/tests/ofc24/Dockerfile +++ b/src/tests/ofc24/Dockerfile @@ -82,7 +82,9 @@ COPY src/slice/__init__.py slice/__init__.py COPY src/slice/client/. slice/client/ COPY src/tests/*.py ./tests/ COPY src/tests/ofc24/__init__.py ./tests/ofc24/__init__.py -COPY src/tests/ofc24/descriptors_topology.json ./tests/ofc24/descriptors_topology.json +COPY src/tests/ofc24/descriptors/topology.json ./tests/ofc24/descriptors/topology.json +COPY src/tests/ofc24/descriptors/service-unidir.json ./tests/ofc24/descriptors/service-unidir.json +COPY src/tests/ofc24/descriptors/service-bidir.json ./tests/ofc24/descriptors/service-bidir.json COPY src/tests/ofc24/tests/. ./tests/ofc24/tests/ COPY src/tests/tools/. ./tests/tools/ diff --git a/src/tests/ofc24/descriptors/7.service-bidir.json b/src/tests/ofc24/descriptors/service-bidir.json similarity index 100% rename from src/tests/ofc24/descriptors/7.service-bidir.json rename to src/tests/ofc24/descriptors/service-bidir.json diff --git a/src/tests/ofc24/descriptors/7.service-unidir.json b/src/tests/ofc24/descriptors/service-unidir.json similarity index 100% rename from src/tests/ofc24/descriptors/7.service-unidir.json rename to src/tests/ofc24/descriptors/service-unidir.json diff --git a/src/tests/ofc24/descriptors/descriptors_topology.json b/src/tests/ofc24/descriptors/topology.json similarity index 100% rename from src/tests/ofc24/descriptors/descriptors_topology.json rename to src/tests/ofc24/descriptors/topology.json -- GitLab From 3e6e31fd85fafd18b9bab54284ab9037e1d83eea Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Fri, 5 Apr 2024 10:46:11 +0000 Subject: [PATCH 07/28] GitLab CI/CD pipeline - OFC'24: - Fixed missing file required in Dockerfile --- src/tests/ofc24/__init__.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/tests/ofc24/__init__.py diff --git a/src/tests/ofc24/__init__.py b/src/tests/ofc24/__init__.py new file mode 100644 index 000000000..1549d9811 --- /dev/null +++ b/src/tests/ofc24/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. + -- GitLab From ab161a185b061531429cc1e6e5f35a4c30b84269 Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Fri, 5 Apr 2024 11:31:42 +0000 Subject: [PATCH 08/28] GitLab CI/CD pipeline - OFC'24: - Fixed deployment of dataplane node agents - Added testsfor bidir and unidir services to Dockerfile - Updated descriptors in functional tests - Separated functional tests for bidir and unidir services - Removed unneeded KPI-related test methods --- src/tests/ofc24/.gitlab-ci.yml | 42 ++++++++++- src/tests/ofc24/Dockerfile | 10 ++- .../ofc24/tests/test_functional_bootstrap.py | 2 +- .../ofc24/tests/test_functional_cleanup.py | 2 +- ...> test_functional_create_service_bidir.py} | 42 +---------- .../test_functional_create_service_unidir.py | 68 +++++++++++++++++ ...> test_functional_delete_service_bidir.py} | 4 +- .../test_functional_delete_service_unidir.py | 74 +++++++++++++++++++ 8 files changed, 197 insertions(+), 47 deletions(-) rename src/tests/ofc24/tests/{test_functional_create_service.py => test_functional_create_service_bidir.py} (61%) create mode 100644 src/tests/ofc24/tests/test_functional_create_service_unidir.py rename src/tests/ofc24/tests/{test_functional_delete_service.py => test_functional_delete_service_bidir.py} (95%) create mode 100644 src/tests/ofc24/tests/test_functional_delete_service_unidir.py diff --git a/src/tests/ofc24/.gitlab-ci.yml b/src/tests/ofc24/.gitlab-ci.yml index 6d5257964..6dc32a181 100644 --- a/src/tests/ofc24/.gitlab-ci.yml +++ b/src/tests/ofc24/.gitlab-ci.yml @@ -45,16 +45,55 @@ end2end_test ofc24: # - build ofc24 before_script: - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + - docker rm -f na-t1 na-t2 na-r1 na-r2 + - docker network rm na-br + script: # Download Docker image to run the test - docker pull "${CI_REGISTRY_IMAGE}/${TEST_NAME}:latest" + - docker pull asgamb1/oc23bgp.img:latest + - docker pull asgamb1/flexscale-node.img:latest # Check MicroK8s is ready - microk8s status --wait-ready - kubectl get pods --all-namespaces # Deploy Optical Device Node Agents - - ./src/tests/${TEST_NAME}/deploy-node-agents.sh + - > + docker network create -d bridge --subnet=172.254.253.0/24 --gateway=172.254.253.254 \ + --ip-range=172.254.253.0/24 na-br + - > + docker run -dit --init --name na-t1 --network=na-br --ip 172.254.253.101 \ + --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/startNetconfAgent-tp.sh:/confd/examples.confd/OC23/startNetconfAgent.sh" \ + --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/platform_t1.xml:/confd/examples.confd/OC23/platform.xml" \ + asgamb1/oc23bgp.img:latest /confd/examples.confd/OC23/startNetconfAgent.sh + - > + docker run -dit --init --name na-t2 --network=na-br --ip 172.254.253.102 \ + --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/startNetconfAgent-tp.sh:/confd/examples.confd/OC23/startNetconfAgent.sh" \ + --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/platform_t2.xml:/confd/examples.confd/OC23/platform.xml" \ + asgamb1/oc23bgp.img:latest /confd/examples.confd/OC23/startNetconfAgent.sh + - > + docker run -dit --init --name na-r1 --network=na-br --ip 172.254.253.201 \ + --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/startNetconfAgent-mg-on.sh:/confd/examples.confd/OC23/startNetconfAgent.sh" \ + --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/platform_r1.xml:/confd/examples.confd/OC23/platform.xml" \ + asgamb1/flexscale-node.img:latest /confd/examples.confd/OC23/startNetconfAgent.sh + - > + docker run -dit --init --name na-r2 --network=na-br --ip 172.254.253.202 \ + --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/startNetconfAgent-mg-on.sh:/confd/examples.confd/OC23/startNetconfAgent.sh" \ + --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/platform_r2.xml:/confd/examples.confd/OC23/platform.xml" \ + asgamb1/flexscale-node.img:latest /confd/examples.confd/OC23/startNetconfAgent.sh + + + # Wait for initialization of Optical Device Node Agents + - sleep 3 + - docker ps -a + - while ! docker logs na-t1 2>&1 | grep -q '*** ConfD OpenConfig NETCONF agent ***'; do sleep 1; done + - while ! docker logs na-t2 2>&1 | grep -q '*** ConfD OpenConfig NETCONF agent ***'; do sleep 1; done + - while ! docker logs na-r1 2>&1 | grep -q '*** ConfD OpenConfig NETCONF agent ***'; do sleep 1; done + - while ! docker logs na-r2 2>&1 | grep -q '*** ConfD OpenConfig NETCONF agent ***'; do sleep 1; done + - sleep 3 + - docker ps -a + # Configure TeraFlowSDN deployment # Uncomment if DEBUG log level is needed for the components @@ -89,6 +128,7 @@ end2end_test ofc24: --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 + after_script: # Dump TeraFlowSDN component logs - source src/tests/${TEST_NAME}/deploy_specs.sh diff --git a/src/tests/ofc24/Dockerfile b/src/tests/ofc24/Dockerfile index df42fe338..db1d1d9ef 100644 --- a/src/tests/ofc24/Dockerfile +++ b/src/tests/ofc24/Dockerfile @@ -92,10 +92,12 @@ RUN tee ./run_tests.sh < None: - """ - This test validates that KPI values have been inserted into the monitoring database. - We short k KPI descriptors to test. - """ - response = monitoring_client.GetKpiDescriptorList(Empty()) - kpi_descriptors = random.choices(response.kpi_descriptor_list, k=2) - - for kpi_descriptor in kpi_descriptors: - MSG = 'KPI(kpi_uuid={:s}, device_uuid={:s}, endpoint_uuid={:s}, service_uuid={:s}, kpi_sample_type={:s})...' - LOGGER.info(MSG.format( - str(kpi_descriptor.kpi_id.kpi_id.uuid), str(kpi_descriptor.device_id.device_uuid.uuid), - str(kpi_descriptor.endpoint_id.endpoint_uuid.uuid), str(kpi_descriptor.service_id.service_uuid.uuid), - str(KpiSampleType.Name(kpi_descriptor.kpi_sample_type)))) - response = monitoring_client.GetInstantKpi(kpi_descriptor.kpi_id) - kpi_uuid = response.kpi_id.kpi_id.uuid - assert kpi_uuid == kpi_descriptor.kpi_id.kpi_id.uuid - kpi_value_type = response.kpi_value.WhichOneof('value') - if kpi_value_type is None: - MSG = ' KPI({:s}): No instant value found' - LOGGER.warning(MSG.format(str(kpi_uuid))) - else: - kpi_timestamp = response.timestamp.timestamp - assert kpi_timestamp > 0 - assert kpi_value_type == 'floatVal' - kpi_value = getattr(response.kpi_value, kpi_value_type) - MSG = ' KPI({:s}): timestamp={:s} value_type={:s} value={:s}' - LOGGER.info(MSG.format(str(kpi_uuid), str(kpi_timestamp), str(kpi_value_type), str(kpi_value))) diff --git a/src/tests/ofc24/tests/test_functional_create_service_unidir.py b/src/tests/ofc24/tests/test_functional_create_service_unidir.py new file mode 100644 index 000000000..35d9664f7 --- /dev/null +++ b/src/tests/ofc24/tests/test_functional_create_service_unidir.py @@ -0,0 +1,68 @@ +# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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 +from common.Constants import DEFAULT_CONTEXT_NAME +from common.proto.context_pb2 import ContextId, ServiceTypeEnum +from common.tools.descriptor.Loader import DescriptorLoader +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 tests.Fixtures import context_client, monitoring_client # pylint: disable=unused-import +from tests.tools.mock_osm.MockOSM import MockOSM +from .Fixtures import osm_wim # pylint: disable=unused-import +from .Objects import WIM_SERVICE_CONNECTION_POINTS, WIM_SERVICE_TYPE + +LOGGER = logging.getLogger(__name__) +LOGGER.setLevel(logging.DEBUG) + +DESCRIPTOR_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'descriptors', 'service-bidir.json') +ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME)) + +def test_service_creation_unidir(context_client : ContextClient, osm_wim : MockOSM): # pylint: disable=redefined-outer-name + # Load descriptors and validate the base scenario + descriptor_loader = DescriptorLoader(descriptors_file=DESCRIPTOR_FILE, context_client=context_client) + 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 + + # Create Connectivity Service + service_uuid = osm_wim.create_connectivity_service(WIM_SERVICE_TYPE, WIM_SERVICE_CONNECTION_POINTS) + osm_wim.get_connectivity_service_status(service_uuid) + + # Ensure slices and services are created + response = context_client.ListSlices(ADMIN_CONTEXT_ID) + LOGGER.info('Slices[{:d}] = {:s}'.format(len(response.slices), grpc_message_to_json_string(response))) + assert len(response.slices) == 1 # OSM slice + + response = context_client.ListServices(ADMIN_CONTEXT_ID) + LOGGER.info('Services[{:d}] = {:s}'.format(len(response.services), grpc_message_to_json_string(response))) + assert len(response.services) == 2 # 1xL3NM + 1xTAPI + + for service in response.services: + service_id = service.service_id + response = context_client.ListConnections(service_id) + LOGGER.info(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format( + grpc_message_to_json_string(service_id), len(response.connections), grpc_message_to_json_string(response))) + + if service.service_type == ServiceTypeEnum.SERVICETYPE_L3NM: + assert len(response.connections) == 1 # 1 connection per service + elif service.service_type == ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE: + assert len(response.connections) == 1 # 1 connection per service + else: + str_service = grpc_message_to_json_string(service) + raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) diff --git a/src/tests/ofc24/tests/test_functional_delete_service.py b/src/tests/ofc24/tests/test_functional_delete_service_bidir.py similarity index 95% rename from src/tests/ofc24/tests/test_functional_delete_service.py rename to src/tests/ofc24/tests/test_functional_delete_service_bidir.py index daff29064..64a6161f6 100644 --- a/src/tests/ofc24/tests/test_functional_delete_service.py +++ b/src/tests/ofc24/tests/test_functional_delete_service_bidir.py @@ -26,10 +26,10 @@ from .Fixtures import osm_wim # pylint: disable=unused-import LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.DEBUG) -DESCRIPTOR_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'descriptors_emulated.json') +DESCRIPTOR_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'descriptors', 'service-bidir.json') ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME)) -def test_service_removal(context_client : ContextClient, osm_wim : MockOSM): # pylint: disable=redefined-outer-name +def test_service_removal_bidir(context_client : ContextClient, osm_wim : MockOSM): # pylint: disable=redefined-outer-name # Ensure slices and services are created response = context_client.ListSlices(ADMIN_CONTEXT_ID) LOGGER.info('Slices[{:d}] = {:s}'.format(len(response.slices), grpc_message_to_json_string(response))) diff --git a/src/tests/ofc24/tests/test_functional_delete_service_unidir.py b/src/tests/ofc24/tests/test_functional_delete_service_unidir.py new file mode 100644 index 000000000..ebdb60255 --- /dev/null +++ b/src/tests/ofc24/tests/test_functional_delete_service_unidir.py @@ -0,0 +1,74 @@ +# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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 +from common.Constants import DEFAULT_CONTEXT_NAME +from common.proto.context_pb2 import ContextId, ServiceTypeEnum +from common.tools.descriptor.Loader import DescriptorLoader +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 tests.Fixtures import context_client # pylint: disable=unused-import +from tests.tools.mock_osm.MockOSM import MockOSM +from .Fixtures import osm_wim # pylint: disable=unused-import + +LOGGER = logging.getLogger(__name__) +LOGGER.setLevel(logging.DEBUG) + +DESCRIPTOR_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'descriptors', 'service-unidir.json') +ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME)) + +def test_service_removal_unidir(context_client : ContextClient, osm_wim : MockOSM): # pylint: disable=redefined-outer-name + # Ensure slices and services are created + response = context_client.ListSlices(ADMIN_CONTEXT_ID) + LOGGER.info('Slices[{:d}] = {:s}'.format(len(response.slices), grpc_message_to_json_string(response))) + assert len(response.slices) == 1 # OSM slice + + response = context_client.ListServices(ADMIN_CONTEXT_ID) + LOGGER.info('Services[{:d}] = {:s}'.format(len(response.services), grpc_message_to_json_string(response))) + assert len(response.services) == 2 # 1xL3NM + 1xTAPI + + service_uuids = set() + for service in response.services: + service_id = service.service_id + response = context_client.ListConnections(service_id) + LOGGER.info(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format( + grpc_message_to_json_string(service_id), len(response.connections), grpc_message_to_json_string(response))) + + if service.service_type == ServiceTypeEnum.SERVICETYPE_L3NM: + assert len(response.connections) == 1 # 1 connection per service + service_uuid = service_id.service_uuid.uuid + service_uuids.add(service_uuid) + osm_wim.conn_info[service_uuid] = {} + elif service.service_type == ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE: + assert len(response.connections) == 1 # 1 connection per service + else: + str_service = grpc_message_to_json_string(service) + raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) + + # Identify service to delete + assert len(service_uuids) == 1 # assume a single L3NM service has been created + service_uuid = set(service_uuids).pop() + + # Delete Connectivity Service + osm_wim.delete_connectivity_service(service_uuid) + + # 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 + + # Load descriptors and validate the base scenario + descriptor_loader = DescriptorLoader(descriptors_file=DESCRIPTOR_FILE, context_client=context_client) + descriptor_loader.validate() -- GitLab From 4bc7d644ffe03da28ee9882bda5faa786fe3b882 Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Fri, 5 Apr 2024 11:49:37 +0000 Subject: [PATCH 09/28] GitLab CI/CD pipeline - OFC'24: - Preliminar code for create/delete bidir and unidir services - Removed unneeded files in Dockerfile --- src/tests/ofc24/Dockerfile | 5 -- .../test_functional_create_service_bidir.py | 54 ++++++------ .../test_functional_create_service_unidir.py | 54 ++++++------ .../test_functional_delete_service_bidir.py | 82 +++++++++++-------- .../test_functional_delete_service_unidir.py | 82 +++++++++++-------- 5 files changed, 156 insertions(+), 121 deletions(-) diff --git a/src/tests/ofc24/Dockerfile b/src/tests/ofc24/Dockerfile index db1d1d9ef..f9db8c367 100644 --- a/src/tests/ofc24/Dockerfile +++ b/src/tests/ofc24/Dockerfile @@ -70,10 +70,6 @@ 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/monitoring/__init__.py monitoring/__init__.py -#COPY src/monitoring/client/. monitoring/client/ COPY src/e2e_orchestrator/__init__.py e2e_orchestrator/__init__.py COPY src/e2e_orchestrator/client/. e2e_orchestrator/client/ COPY src/service/__init__.py service/__init__.py @@ -86,7 +82,6 @@ COPY src/tests/ofc24/descriptors/topology.json ./tests/ofc24/descriptors/topolog COPY src/tests/ofc24/descriptors/service-unidir.json ./tests/ofc24/descriptors/service-unidir.json COPY src/tests/ofc24/descriptors/service-bidir.json ./tests/ofc24/descriptors/service-bidir.json COPY src/tests/ofc24/tests/. ./tests/ofc24/tests/ -COPY src/tests/tools/. ./tests/tools/ RUN tee ./run_tests.sh < Connections[{:d}] = {:s}'.format( + LOGGER.warning(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format( grpc_message_to_json_string(service_id), len(response.connections), grpc_message_to_json_string(response))) - if service.service_type == ServiceTypeEnum.SERVICETYPE_L3NM: - assert len(response.connections) == 1 # 1 connection per service - elif service.service_type == ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE: - assert len(response.connections) == 1 # 1 connection per service - else: - str_service = grpc_message_to_json_string(service) - raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) + #if service.service_type == ServiceTypeEnum.SERVICETYPE_L3NM: + # assert len(response.connections) == 1 # 1 connection per service + #elif service.service_type == ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE: + # assert len(response.connections) == 1 # 1 connection per service + #else: + # str_service = grpc_message_to_json_string(service) + # raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) diff --git a/src/tests/ofc24/tests/test_functional_create_service_unidir.py b/src/tests/ofc24/tests/test_functional_create_service_unidir.py index 35d9664f7..1cc0f43ce 100644 --- a/src/tests/ofc24/tests/test_functional_create_service_unidir.py +++ b/src/tests/ofc24/tests/test_functional_create_service_unidir.py @@ -15,14 +15,13 @@ import logging, os from common.Constants import DEFAULT_CONTEXT_NAME from common.proto.context_pb2 import ContextId, ServiceTypeEnum -from common.tools.descriptor.Loader import DescriptorLoader +from common.tools.descriptor.Loader import DescriptorLoader, check_descriptor_load_results 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 tests.Fixtures import context_client, monitoring_client # pylint: disable=unused-import -from tests.tools.mock_osm.MockOSM import MockOSM -from .Fixtures import osm_wim # pylint: disable=unused-import -from .Objects import WIM_SERVICE_CONNECTION_POINTS, WIM_SERVICE_TYPE +from device.client.DeviceClient import DeviceClient +from service.client.ServiceClient import ServiceClient +from tests.Fixtures import context_client, device_client, service_client # pylint: disable=unused-import LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.DEBUG) @@ -30,39 +29,44 @@ LOGGER.setLevel(logging.DEBUG) DESCRIPTOR_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'descriptors', 'service-bidir.json') ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME)) -def test_service_creation_unidir(context_client : ContextClient, osm_wim : MockOSM): # pylint: disable=redefined-outer-name +def test_service_creation_unidir( + context_client : ContextClient, # pylint: disable=redefined-outer-name + device_client : DeviceClient, # pylint: disable=redefined-outer-name + service_client : ServiceClient, # pylint: disable=redefined-outer-name +): # Load descriptors and validate the base scenario - descriptor_loader = DescriptorLoader(descriptors_file=DESCRIPTOR_FILE, context_client=context_client) + descriptor_loader = DescriptorLoader( + descriptors_file=DESCRIPTOR_FILE, context_client=context_client, device_client=device_client, + service_client=service_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 - - # Create Connectivity Service - service_uuid = osm_wim.create_connectivity_service(WIM_SERVICE_TYPE, WIM_SERVICE_CONNECTION_POINTS) - osm_wim.get_connectivity_service_status(service_uuid) + #assert len(response.service_ids) == 0 + #assert len(response.slice_ids) == 0 # Ensure slices and services are created response = context_client.ListSlices(ADMIN_CONTEXT_ID) - LOGGER.info('Slices[{:d}] = {:s}'.format(len(response.slices), grpc_message_to_json_string(response))) - assert len(response.slices) == 1 # OSM slice + LOGGER.warning('Slices[{:d}] = {:s}'.format(len(response.slices), grpc_message_to_json_string(response))) + #assert len(response.slices) == 1 # OSM slice response = context_client.ListServices(ADMIN_CONTEXT_ID) - LOGGER.info('Services[{:d}] = {:s}'.format(len(response.services), grpc_message_to_json_string(response))) - assert len(response.services) == 2 # 1xL3NM + 1xTAPI + LOGGER.warning('Services[{:d}] = {:s}'.format(len(response.services), grpc_message_to_json_string(response))) + #assert len(response.services) == 2 # 1xL3NM + 1xTAPI for service in response.services: service_id = service.service_id response = context_client.ListConnections(service_id) - LOGGER.info(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format( + LOGGER.warning(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format( grpc_message_to_json_string(service_id), len(response.connections), grpc_message_to_json_string(response))) - if service.service_type == ServiceTypeEnum.SERVICETYPE_L3NM: - assert len(response.connections) == 1 # 1 connection per service - elif service.service_type == ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE: - assert len(response.connections) == 1 # 1 connection per service - else: - str_service = grpc_message_to_json_string(service) - raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) + #if service.service_type == ServiceTypeEnum.SERVICETYPE_L3NM: + # assert len(response.connections) == 1 # 1 connection per service + #elif service.service_type == ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE: + # assert len(response.connections) == 1 # 1 connection per service + #else: + # str_service = grpc_message_to_json_string(service) + # raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) diff --git a/src/tests/ofc24/tests/test_functional_delete_service_bidir.py b/src/tests/ofc24/tests/test_functional_delete_service_bidir.py index 64a6161f6..ee0572df2 100644 --- a/src/tests/ofc24/tests/test_functional_delete_service_bidir.py +++ b/src/tests/ofc24/tests/test_functional_delete_service_bidir.py @@ -14,14 +14,14 @@ import logging, os from common.Constants import DEFAULT_CONTEXT_NAME -from common.proto.context_pb2 import ContextId, ServiceTypeEnum +from common.proto.context_pb2 import ContextId, ServiceId, ServiceTypeEnum from common.tools.descriptor.Loader import DescriptorLoader 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 tests.Fixtures import context_client # pylint: disable=unused-import -from tests.tools.mock_osm.MockOSM import MockOSM -from .Fixtures import osm_wim # pylint: disable=unused-import +from device.client.DeviceClient import DeviceClient +from service.client.ServiceClient import ServiceClient +from tests.Fixtures import context_client, device_client, service_client # pylint: disable=unused-import LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.DEBUG) @@ -29,46 +29,62 @@ LOGGER.setLevel(logging.DEBUG) DESCRIPTOR_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'descriptors', 'service-bidir.json') ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME)) -def test_service_removal_bidir(context_client : ContextClient, osm_wim : MockOSM): # pylint: disable=redefined-outer-name +def test_service_removal_bidir( + context_client : ContextClient, # pylint: disable=redefined-outer-name + device_client : DeviceClient, # pylint: disable=redefined-outer-name + service_client : ServiceClient, # pylint: disable=redefined-outer-name +): + # Load descriptors and validate the base scenario + descriptor_loader = DescriptorLoader( + descriptors_file=DESCRIPTOR_FILE, context_client=context_client, device_client=device_client, + service_client=service_client + ) + 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 + # Ensure slices and services are created response = context_client.ListSlices(ADMIN_CONTEXT_ID) - LOGGER.info('Slices[{:d}] = {:s}'.format(len(response.slices), grpc_message_to_json_string(response))) - assert len(response.slices) == 1 # OSM slice + LOGGER.warning('Slices[{:d}] = {:s}'.format(len(response.slices), grpc_message_to_json_string(response))) + #assert len(response.slices) == 1 # OSM slice response = context_client.ListServices(ADMIN_CONTEXT_ID) - LOGGER.info('Services[{:d}] = {:s}'.format(len(response.services), grpc_message_to_json_string(response))) - assert len(response.services) == 2 # 1xL3NM + 1xTAPI + LOGGER.warning('Services[{:d}] = {:s}'.format(len(response.services), grpc_message_to_json_string(response))) + #assert len(response.services) == 2 # 1xL3NM + 1xTAPI - service_uuids = set() + #service_uuids = set() for service in response.services: service_id = service.service_id response = context_client.ListConnections(service_id) - LOGGER.info(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format( + LOGGER.warning(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format( grpc_message_to_json_string(service_id), len(response.connections), grpc_message_to_json_string(response))) - if service.service_type == ServiceTypeEnum.SERVICETYPE_L3NM: - assert len(response.connections) == 1 # 1 connection per service - service_uuid = service_id.service_uuid.uuid - service_uuids.add(service_uuid) - osm_wim.conn_info[service_uuid] = {} - elif service.service_type == ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE: - assert len(response.connections) == 1 # 1 connection per service - else: - str_service = grpc_message_to_json_string(service) - raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) + #if service.service_type == ServiceTypeEnum.SERVICETYPE_L3NM: + # assert len(response.connections) == 1 # 1 connection per service + # service_uuid = service_id.service_uuid.uuid + # service_uuids.add(service_uuid) + # osm_wim.conn_info[service_uuid] = {} + #elif service.service_type == ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE: + # assert len(response.connections) == 1 # 1 connection per service + #else: + # str_service = grpc_message_to_json_string(service) + # raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) - # Identify service to delete - assert len(service_uuids) == 1 # assume a single L3NM service has been created - service_uuid = set(service_uuids).pop() + ## Identify service to delete + #assert len(service_uuids) == 1 # assume a single L3NM service has been created + #service_uuid = set(service_uuids).pop() - # Delete Connectivity Service - osm_wim.delete_connectivity_service(service_uuid) + ## Delete Service + #service_client.DeleteService(ServiceId(json_service_id(service_uuid, context_uuid))) - # 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 + ## 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 - # Load descriptors and validate the base scenario - descriptor_loader = DescriptorLoader(descriptors_file=DESCRIPTOR_FILE, context_client=context_client) - descriptor_loader.validate() + ## Load descriptors and validate the base scenario + #descriptor_loader = DescriptorLoader(descriptors_file=DESCRIPTOR_FILE, context_client=context_client) + #descriptor_loader.validate() diff --git a/src/tests/ofc24/tests/test_functional_delete_service_unidir.py b/src/tests/ofc24/tests/test_functional_delete_service_unidir.py index ebdb60255..0861b103c 100644 --- a/src/tests/ofc24/tests/test_functional_delete_service_unidir.py +++ b/src/tests/ofc24/tests/test_functional_delete_service_unidir.py @@ -14,14 +14,14 @@ import logging, os from common.Constants import DEFAULT_CONTEXT_NAME -from common.proto.context_pb2 import ContextId, ServiceTypeEnum +from common.proto.context_pb2 import ContextId, ServiceId, ServiceTypeEnum from common.tools.descriptor.Loader import DescriptorLoader 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 tests.Fixtures import context_client # pylint: disable=unused-import -from tests.tools.mock_osm.MockOSM import MockOSM -from .Fixtures import osm_wim # pylint: disable=unused-import +from device.client.DeviceClient import DeviceClient +from service.client.ServiceClient import ServiceClient +from tests.Fixtures import context_client, device_client, service_client # pylint: disable=unused-import LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.DEBUG) @@ -29,46 +29,62 @@ LOGGER.setLevel(logging.DEBUG) DESCRIPTOR_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'descriptors', 'service-unidir.json') ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME)) -def test_service_removal_unidir(context_client : ContextClient, osm_wim : MockOSM): # pylint: disable=redefined-outer-name +def test_service_removal_unidir( + context_client : ContextClient, # pylint: disable=redefined-outer-name + device_client : DeviceClient, # pylint: disable=redefined-outer-name + service_client : ServiceClient, # pylint: disable=redefined-outer-name +): + # Load descriptors and validate the base scenario + descriptor_loader = DescriptorLoader( + descriptors_file=DESCRIPTOR_FILE, context_client=context_client, device_client=device_client, + service_client=service_client + ) + 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 + # Ensure slices and services are created response = context_client.ListSlices(ADMIN_CONTEXT_ID) - LOGGER.info('Slices[{:d}] = {:s}'.format(len(response.slices), grpc_message_to_json_string(response))) - assert len(response.slices) == 1 # OSM slice + LOGGER.warning('Slices[{:d}] = {:s}'.format(len(response.slices), grpc_message_to_json_string(response))) + #assert len(response.slices) == 1 # OSM slice response = context_client.ListServices(ADMIN_CONTEXT_ID) - LOGGER.info('Services[{:d}] = {:s}'.format(len(response.services), grpc_message_to_json_string(response))) - assert len(response.services) == 2 # 1xL3NM + 1xTAPI + LOGGER.warning('Services[{:d}] = {:s}'.format(len(response.services), grpc_message_to_json_string(response))) + #assert len(response.services) == 2 # 1xL3NM + 1xTAPI - service_uuids = set() + #service_uuids = set() for service in response.services: service_id = service.service_id response = context_client.ListConnections(service_id) - LOGGER.info(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format( + LOGGER.warning(' ServiceId[{:s}] => Connections[{:d}] = {:s}'.format( grpc_message_to_json_string(service_id), len(response.connections), grpc_message_to_json_string(response))) - if service.service_type == ServiceTypeEnum.SERVICETYPE_L3NM: - assert len(response.connections) == 1 # 1 connection per service - service_uuid = service_id.service_uuid.uuid - service_uuids.add(service_uuid) - osm_wim.conn_info[service_uuid] = {} - elif service.service_type == ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE: - assert len(response.connections) == 1 # 1 connection per service - else: - str_service = grpc_message_to_json_string(service) - raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) + #if service.service_type == ServiceTypeEnum.SERVICETYPE_L3NM: + # assert len(response.connections) == 1 # 1 connection per service + # service_uuid = service_id.service_uuid.uuid + # service_uuids.add(service_uuid) + # osm_wim.conn_info[service_uuid] = {} + #elif service.service_type == ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE: + # assert len(response.connections) == 1 # 1 connection per service + #else: + # str_service = grpc_message_to_json_string(service) + # raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) - # Identify service to delete - assert len(service_uuids) == 1 # assume a single L3NM service has been created - service_uuid = set(service_uuids).pop() + ## Identify service to delete + #assert len(service_uuids) == 1 # assume a single L3NM service has been created + #service_uuid = set(service_uuids).pop() - # Delete Connectivity Service - osm_wim.delete_connectivity_service(service_uuid) + ## Delete Service + #service_client.DeleteService(ServiceId(json_service_id(service_uuid, context_uuid))) - # 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 + ## 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 - # Load descriptors and validate the base scenario - descriptor_loader = DescriptorLoader(descriptors_file=DESCRIPTOR_FILE, context_client=context_client) - descriptor_loader.validate() + ## Load descriptors and validate the base scenario + #descriptor_loader = DescriptorLoader(descriptors_file=DESCRIPTOR_FILE, context_client=context_client) + #descriptor_loader.validate() -- GitLab From c999bcf7a08f869d537072d9a9ff7f3729981cc4 Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Fri, 5 Apr 2024 11:54:39 +0000 Subject: [PATCH 10/28] GitLab CI/CD pipeline - OFC'24: - Updated destroy of pipeline manifest --- src/tests/ofc24/.gitlab-ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/tests/ofc24/.gitlab-ci.yml b/src/tests/ofc24/.gitlab-ci.yml index 6dc32a181..8ce528244 100644 --- a/src/tests/ofc24/.gitlab-ci.yml +++ b/src/tests/ofc24/.gitlab-ci.yml @@ -46,7 +46,7 @@ end2end_test ofc24: before_script: - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY - docker rm -f na-t1 na-t2 na-r1 na-r2 - - docker network rm na-br + - docker network rm -f na-br script: # Download Docker image to run the test @@ -149,7 +149,8 @@ end2end_test ofc24: - docker logs na-r2 # Destroy Optical Device Node Agents - - ./src/tests/${TEST_NAME}/destroy-node-agents.sh + - docker rm -f na-t1 na-t2 na-r1 na-r2 + - docker network rm -f na-br # Clean old docker images - docker images --filter="dangling=true" --quiet | xargs -r docker rmi -- GitLab From ceebb3b77688f54a1b53cfa2de45f6375aaac84d Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Fri, 5 Apr 2024 12:42:00 +0000 Subject: [PATCH 11/28] GitLab CI/CD pipeline - OFC'24: - Fixed wrong multi-line commands in pipeline descriptor --- src/tests/ofc24/.gitlab-ci.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/tests/ofc24/.gitlab-ci.yml b/src/tests/ofc24/.gitlab-ci.yml index 8ce528244..f169bf7ee 100644 --- a/src/tests/ofc24/.gitlab-ci.yml +++ b/src/tests/ofc24/.gitlab-ci.yml @@ -60,27 +60,27 @@ end2end_test ofc24: # Deploy Optical Device Node Agents - > - docker network create -d bridge --subnet=172.254.253.0/24 --gateway=172.254.253.254 \ + docker network create -d bridge --subnet=172.254.253.0/24 --gateway=172.254.253.254 --ip-range=172.254.253.0/24 na-br - > - docker run -dit --init --name na-t1 --network=na-br --ip 172.254.253.101 \ - --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/startNetconfAgent-tp.sh:/confd/examples.confd/OC23/startNetconfAgent.sh" \ - --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/platform_t1.xml:/confd/examples.confd/OC23/platform.xml" \ + docker run -dit --init --name na-t1 --network=na-br --ip 172.254.253.101 + --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/startNetconfAgent-tp.sh:/confd/examples.confd/OC23/startNetconfAgent.sh" + --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/platform_t1.xml:/confd/examples.confd/OC23/platform.xml" asgamb1/oc23bgp.img:latest /confd/examples.confd/OC23/startNetconfAgent.sh - > - docker run -dit --init --name na-t2 --network=na-br --ip 172.254.253.102 \ - --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/startNetconfAgent-tp.sh:/confd/examples.confd/OC23/startNetconfAgent.sh" \ - --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/platform_t2.xml:/confd/examples.confd/OC23/platform.xml" \ + docker run -dit --init --name na-t2 --network=na-br --ip 172.254.253.102 + --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/startNetconfAgent-tp.sh:/confd/examples.confd/OC23/startNetconfAgent.sh" + --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/platform_t2.xml:/confd/examples.confd/OC23/platform.xml" asgamb1/oc23bgp.img:latest /confd/examples.confd/OC23/startNetconfAgent.sh - > - docker run -dit --init --name na-r1 --network=na-br --ip 172.254.253.201 \ - --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/startNetconfAgent-mg-on.sh:/confd/examples.confd/OC23/startNetconfAgent.sh" \ - --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/platform_r1.xml:/confd/examples.confd/OC23/platform.xml" \ + docker run -dit --init --name na-r1 --network=na-br --ip 172.254.253.201 + --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/startNetconfAgent-mg-on.sh:/confd/examples.confd/OC23/startNetconfAgent.sh" + --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/platform_r1.xml:/confd/examples.confd/OC23/platform.xml" asgamb1/flexscale-node.img:latest /confd/examples.confd/OC23/startNetconfAgent.sh - > - docker run -dit --init --name na-r2 --network=na-br --ip 172.254.253.202 \ - --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/startNetconfAgent-mg-on.sh:/confd/examples.confd/OC23/startNetconfAgent.sh" \ - --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/platform_r2.xml:/confd/examples.confd/OC23/platform.xml" \ + docker run -dit --init --name na-r2 --network=na-br --ip 172.254.253.202 + --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/startNetconfAgent-mg-on.sh:/confd/examples.confd/OC23/startNetconfAgent.sh" + --volume "$PWD/src/tests/${TEST_NAME}/node-agents-config/platform_r2.xml:/confd/examples.confd/OC23/platform.xml" asgamb1/flexscale-node.img:latest /confd/examples.confd/OC23/startNetconfAgent.sh -- GitLab From 2d54c725320ceac1cf7be7d11418699654ecc2be Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Fri, 5 Apr 2024 13:14:49 +0000 Subject: [PATCH 12/28] GitLab CI/CD pipeline - OFC'22: - Corrected kubectl logs for ZTP component --- src/tests/ofc22/.gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/ofc22/.gitlab-ci.yml b/src/tests/ofc22/.gitlab-ci.yml index 013a389bc..810e59169 100644 --- a/src/tests/ofc22/.gitlab-ci.yml +++ b/src/tests/ofc22/.gitlab-ci.yml @@ -96,7 +96,7 @@ end2end_test ofc22: - kubectl --namespace $TFS_K8S_NAMESPACE logs deployment/sliceservice -c server - kubectl --namespace $TFS_K8S_NAMESPACE logs deployment/nbiservice -c server - kubectl --namespace $TFS_K8S_NAMESPACE logs deployment/monitoringservice -c server - - kubectl --namespace $TFS_K8S_NAMESPACE logs deployment/ztpservice -c server + - kubectl --namespace $TFS_K8S_NAMESPACE logs deployment/ztpservice -c ztpservice - if docker ps -a | grep ${TEST_NAME}; then docker rm -f ${TEST_NAME}; fi - docker images --filter="dangling=true" --quiet | xargs -r docker rmi #coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/' -- GitLab From 736b888aaec0de7cbe9cb8393e3b333713b163f0 Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Fri, 5 Apr 2024 14:07:26 +0000 Subject: [PATCH 13/28] GitLab CI/CD pipeline - OFC'22, ECOC'22, OFC'24: - Corrected Dockerfile required files --- src/tests/ecoc22/Dockerfile | 2 -- src/tests/ofc22/Dockerfile | 2 -- src/tests/ofc24/Dockerfile | 2 ++ 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/tests/ecoc22/Dockerfile b/src/tests/ecoc22/Dockerfile index 3ac134a38..28fc91d5e 100644 --- a/src/tests/ecoc22/Dockerfile +++ b/src/tests/ecoc22/Dockerfile @@ -72,8 +72,6 @@ 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/monitoring/__init__.py monitoring/__init__.py -COPY src/monitoring/client/. monitoring/client/ COPY src/e2e_orchestrator/__init__.py e2e_orchestrator/__init__.py COPY src/e2e_orchestrator/client/. e2e_orchestrator/client/ COPY src/service/__init__.py service/__init__.py diff --git a/src/tests/ofc22/Dockerfile b/src/tests/ofc22/Dockerfile index 4817bd93a..4cba83466 100644 --- a/src/tests/ofc22/Dockerfile +++ b/src/tests/ofc22/Dockerfile @@ -72,8 +72,6 @@ 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/monitoring/__init__.py monitoring/__init__.py -COPY src/monitoring/client/. monitoring/client/ COPY src/e2e_orchestrator/__init__.py e2e_orchestrator/__init__.py COPY src/e2e_orchestrator/client/. e2e_orchestrator/client/ COPY src/service/__init__.py service/__init__.py diff --git a/src/tests/ofc24/Dockerfile b/src/tests/ofc24/Dockerfile index f9db8c367..bef7d25fe 100644 --- a/src/tests/ofc24/Dockerfile +++ b/src/tests/ofc24/Dockerfile @@ -70,6 +70,8 @@ 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/e2e_orchestrator/__init__.py e2e_orchestrator/__init__.py COPY src/e2e_orchestrator/client/. e2e_orchestrator/client/ COPY src/service/__init__.py service/__init__.py -- GitLab From 0cf73ab700e789cb9b5f3fb0cc364acffb4a1226 Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Fri, 5 Apr 2024 17:24:35 +0000 Subject: [PATCH 14/28] NBI component: - Updated README.md file - Fixed libyang version in Dockerfile - Fixed libyang version in install_requirements.sh - Added folder libyang to global gitignore - Added generation of .gitignore file for libyang/build --- .gitignore | 3 +++ install_requirements.sh | 3 +++ src/nbi/Dockerfile | 3 +++ src/nbi/README.md | 3 +++ 4 files changed, 12 insertions(+) diff --git a/.gitignore b/.gitignore index a9144d669..20b98c30c 100644 --- a/.gitignore +++ b/.gitignore @@ -171,5 +171,8 @@ local_k8s_deployment.sh # asdf configuration .tool-versions +# libyang build files +libyang/ + # Other logs **/logs/*.log.* diff --git a/install_requirements.sh b/install_requirements.sh index c59ea7f13..65f60c121 100755 --- a/install_requirements.sh +++ b/install_requirements.sh @@ -32,8 +32,11 @@ sudo apt-get --yes --quiet --quiet update sudo apt-get --yes --quiet --quiet install build-essential cmake libpcre2-dev python3-dev python3-cffi mkdir libyang git clone https://github.com/CESNET/libyang.git libyang +git fetch +git checkout v2.1.148 mkdir libyang/build cd libyang/build +echo "*" > .gitignore cmake -D CMAKE_BUILD_TYPE:String="Release" .. make sudo make install diff --git a/src/nbi/Dockerfile b/src/nbi/Dockerfile index eda4d2956..cb81256da 100644 --- a/src/nbi/Dockerfile +++ b/src/nbi/Dockerfile @@ -61,6 +61,9 @@ RUN apt-get --yes --quiet --quiet update && \ rm -rf /var/lib/apt/lists/* RUN mkdir -p /var/libyang RUN git clone https://github.com/CESNET/libyang.git /var/libyang +WORKDIR /var/libyang +RUN git fetch +RUN git checkout v2.1.148 RUN mkdir -p /var/libyang/build WORKDIR /var/libyang/build RUN cmake -D CMAKE_BUILD_TYPE:String="Release" .. diff --git a/src/nbi/README.md b/src/nbi/README.md index c5ed72704..32902a0b3 100644 --- a/src/nbi/README.md +++ b/src/nbi/README.md @@ -18,6 +18,9 @@ sudo apt-get install python3-dev gcc python3-cffi ```bash mkdir ~/tfs-ctrl/libyang git clone https://github.com/CESNET/libyang.git ~/tfs-ctrl/libyang +cd ~/tfs-ctrl/libyang +git fetch +git checkout v2.1.148 mkdir ~/tfs-ctrl/libyang/build cd ~/tfs-ctrl/libyang/build cmake -D CMAKE_BUILD_TYPE:String="Release" .. -- GitLab From 50e456a0b6e1f69de9f6a3b4e3e4f1445acf3490 Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Fri, 5 Apr 2024 17:47:11 +0000 Subject: [PATCH 15/28] GitLab CI/CD pipeline - OFC'24: - Added missing script headers --- .../node-agents-config/startNetconfAgent-mg-on.sh | 13 +++++++++++++ .../node-agents-config/startNetconfAgent-tp.sh | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/tests/ofc24/node-agents-config/startNetconfAgent-mg-on.sh b/src/tests/ofc24/node-agents-config/startNetconfAgent-mg-on.sh index fe5ad5618..e54496b40 100755 --- a/src/tests/ofc24/node-agents-config/startNetconfAgent-mg-on.sh +++ b/src/tests/ofc24/node-agents-config/startNetconfAgent-mg-on.sh @@ -1,4 +1,17 @@ #!/bin/bash +# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. echo 'Cleaning...' make clean diff --git a/src/tests/ofc24/node-agents-config/startNetconfAgent-tp.sh b/src/tests/ofc24/node-agents-config/startNetconfAgent-tp.sh index afc28cee7..4e2ec0686 100755 --- a/src/tests/ofc24/node-agents-config/startNetconfAgent-tp.sh +++ b/src/tests/ofc24/node-agents-config/startNetconfAgent-tp.sh @@ -1,4 +1,17 @@ #!/bin/bash +# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. echo 'Cleaning...' make clean -- GitLab From 500bdb62becfcb4f7dad31a7a2883db167ac54f9 Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Fri, 5 Apr 2024 18:15:23 +0000 Subject: [PATCH 16/28] GitLab CI/CD pipeline - OFC'24: - Corrected IP addresses and ports of node agents in topology descriptor --- src/tests/ofc24/descriptors/topology.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/tests/ofc24/descriptors/topology.json b/src/tests/ofc24/descriptors/topology.json index 6ae521c76..85bbad55e 100644 --- a/src/tests/ofc24/descriptors/topology.json +++ b/src/tests/ofc24/descriptors/topology.json @@ -16,8 +16,8 @@ }} ], "device_config": {"config_rules": [ - {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "10.0.2.15"}}, - {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "2023"}}, + {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "172.254.253.101"}}, + {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "2022"}}, {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": { "username": "admin", "password": "admin", "force_running": false, "hostkey_verify": false, "look_for_keys": false, "allow_agent": false, "commit_per_rule": false, @@ -36,8 +36,8 @@ }} ], "device_config": {"config_rules": [ - {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "10.0.2.15"}}, - {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "2024"}}, + {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "172.254.253.102"}}, + {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "2022"}}, {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": { "username": "admin", "password": "admin", "force_running": false, "hostkey_verify": false, "look_for_keys": false, "allow_agent": false, "commit_per_rule": false, @@ -68,8 +68,8 @@ }} ], "device_config": {"config_rules": [ - {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "10.0.2.15"}}, - {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "2025"}}, + {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "172.254.253.201"}}, + {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "2022"}}, {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": { "username": "admin", "password": "admin", "force_running": false, "hostkey_verify": false, "look_for_keys": false, "allow_agent": false, "commit_per_rule": false, @@ -105,8 +105,8 @@ }} ], "device_config": {"config_rules": [ - {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "10.0.2.15"}}, - {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "2026"}}, + {"action": 1, "custom": {"resource_key": "_connect/address", "resource_value": "172.254.253.202"}}, + {"action": 1, "custom": {"resource_key": "_connect/port", "resource_value": "2022"}}, {"action": 1, "custom": {"resource_key": "_connect/settings", "resource_value": { "username": "admin", "password": "admin", "force_running": false, "hostkey_verify": false, "look_for_keys": false, "allow_agent": false, "commit_per_rule": false, -- GitLab From 60dd4d21c5ebdc626b202bf39d4fbd8538896ef1 Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Mon, 8 Apr 2024 15:40:33 +0000 Subject: [PATCH 17/28] Service component: - Enhanced collection of Optical Controller settings --- src/service/service/tools/OpticalTools.py | 75 +++++++++++++++-------- 1 file changed, 51 insertions(+), 24 deletions(-) diff --git a/src/service/service/tools/OpticalTools.py b/src/service/service/tools/OpticalTools.py index 206524371..20cd6b42a 100644 --- a/src/service/service/tools/OpticalTools.py +++ b/src/service/service/tools/OpticalTools.py @@ -13,35 +13,58 @@ # limitations under the License. # -import json -import requests -import uuid -from common.Constants import * +import functools, json, logging, requests, uuid from typing import List +from common.Constants import ServiceNameEnum from common.proto.context_pb2 import( Device, DeviceId, Service, Connection, EndPointId, TopologyId, ContextId, Uuid, ConfigRule, ConfigActionEnum, ConfigRule_Custom ) from common.proto.pathcomp_pb2 import PathCompReply from common.Settings import ( - ENVVAR_SUFIX_SERVICE_HOST, ENVVAR_SUFIX_SERVICE_PORT_GRPC, find_environment_variables, get_env_var_name + ENVVAR_SUFIX_SERVICE_BASEURL_HTTP, ENVVAR_SUFIX_SERVICE_HOST, ENVVAR_SUFIX_SERVICE_PORT_GRPC, + find_environment_variables, get_env_var_name +) +from service.service.tools.replies import ( + reply_uni_txt, optical_band_uni_txt, reply_bid_txt, optical_band_bid_txt ) -from service.service.tools.replies import reply_uni_txt, optical_band_uni_txt, reply_bid_txt, optical_band_bid_txt log = logging.getLogger(__name__) -testing = False +TESTING = False + +get_optical_controller_setting = functools.partial(get_env_var_name, ServiceNameEnum.OPTICALCONTROLLER) +VAR_NAME_OPTICAL_CTRL_BASEURL_HTTP = get_optical_controller_setting(ENVVAR_SUFIX_SERVICE_BASEURL_HTTP) +VAR_NAME_OPTICAL_CTRL_SCHEMA = get_optical_controller_setting('SCHEMA') +VAR_NAME_OPTICAL_CTRL_HOST = get_optical_controller_setting(ENVVAR_SUFIX_SERVICE_HOST) +VAR_NAME_OPTICAL_CTRL_PORT = get_optical_controller_setting(ENVVAR_SUFIX_SERVICE_PORT_GRPC) + +OPTICAL_CTRL_BASE_URL = '{:s}://{:s}:{:s}/OpticalTFS' + +def get_optical_controller_base_url() -> str: + settings = find_environment_variables([ + VAR_NAME_OPTICAL_CTRL_BASEURL_HTTP, + VAR_NAME_OPTICAL_CTRL_SCHEMA, + VAR_NAME_OPTICAL_CTRL_HOST, + VAR_NAME_OPTICAL_CTRL_PORT, + ]) + base_url = settings.get(VAR_NAME_OPTICAL_CTRL_BASEURL_HTTP) + if base_url is not None: + log.debug('Optical Controller: base_url={:s}'.format(str(base_url))) + return base_url + + host = settings.get(VAR_NAME_OPTICAL_CTRL_HOST) + port = int(settings.get(VAR_NAME_OPTICAL_CTRL_PORT, 80)) + + MSG = 'Optical Controller not found: settings={:s}' + if host is None: raise Exception(MSG.format(str(settings))) + if port is None: raise Exception(MSG.format(str(settings))) -VAR_NAME_OPTICAL_CONTROLLER_HOST = get_env_var_name(ServiceNameEnum.OPTICALCONTROLLER, ENVVAR_SUFIX_SERVICE_HOST) -VAR_NAME_OPTICAL_CONTROLLER_PORT = get_env_var_name(ServiceNameEnum.OPTICALCONTROLLER, ENVVAR_SUFIX_SERVICE_PORT_GRPC) + schema = settings.get(VAR_NAME_OPTICAL_CTRL_SCHEMA, 'http') + base_url = OPTICAL_CTRL_BASE_URL.format(schema, host, port) + log.debug('Optical Controller: base_url={:s}'.format(str(base_url))) + return base_url -opticalcontrollers_url = find_environment_variables([ - VAR_NAME_OPTICAL_CONTROLLER_HOST, - VAR_NAME_OPTICAL_CONTROLLER_PORT, -]) -OPTICAL_IP = opticalcontrollers_url.get(VAR_NAME_OPTICAL_CONTROLLER_HOST) -OPTICAL_PORT = opticalcontrollers_url.get(VAR_NAME_OPTICAL_CONTROLLER_PORT) -log.info(str(OPTICAL_IP), str(OPTICAL_PORT)) def get_uuids_from_names(devices: List[Device], device_name: str, port_name: str): device_uuid = "" @@ -79,17 +102,18 @@ def get_device_name_from_uuid(devices: List[Device], device_uuid: str): def add_lightpath(src, dst, bitrate, bidir, ob_band) -> str: - if not testing: + if not TESTING: urlx = "" headers = {"Content-Type": "application/json"} + base_url = get_optical_controller_base_url() if ob_band is None: if bidir is None: bidir = 1 - urlx = "http://{}:{}/OpticalTFS/AddFlexLightpath/{}/{}/{}/{}".format(OPTICAL_IP, OPTICAL_PORT, src, dst, bitrate, bidir) + urlx = "{:s}/AddFlexLightpath/{:s}/{:s}/{:s}/{:s}".format(base_url, src, dst, bitrate, bidir) else: if bidir is None: bidir = 1 - urlx = "http://{}:{}/OpticalTFS/AddFlexLightpath/{}/{}/{}/{}/{}".format(OPTICAL_IP, OPTICAL_PORT, src, dst, bitrate, bidir, ob_band) + urlx = "{:s}/AddFlexLightpath/{:s}/{:s}/{:s}/{:s}/{:s}".format(base_url, src, dst, bitrate, bidir, ob_band) r = requests.put(urlx, headers=headers) reply = r.text return reply @@ -101,8 +125,9 @@ def add_lightpath(src, dst, bitrate, bidir, ob_band) -> str: def get_optical_band(idx) -> str: - if not testing: - urlx = "http://{}:{}/OpticalTFS/GetOpticalBand/{}".format(OPTICAL_IP, OPTICAL_PORT, idx) + if not TESTING: + base_url = get_optical_controller_base_url() + urlx = "{:s}/GetOpticalBand/{:s}".format(base_url, idx) headers = {"Content-Type": "application/json"} r = requests.get(urlx, headers=headers) reply = r.text @@ -116,8 +141,9 @@ def get_optical_band(idx) -> str: def delete_lightpath(flow_id, src, dst, bitrate) -> str: reply = "200" - if not testing: - urlx = "http://{}:{}/OpticalTFS/DelLightpath/{}/{}/{}/{}".format(OPTICAL_IP, OPTICAL_PORT, flow_id, src, dst, bitrate) + if not TESTING: + base_url = get_optical_controller_base_url() + urlx = "{:s}/DelLightpath/{:s}/{:s}/{:s}/{:s}".format(base_url, flow_id, src, dst, bitrate) headers = {"Content-Type": "application/json"} r = requests.delete(urlx, headers=headers) @@ -126,7 +152,8 @@ def delete_lightpath(flow_id, src, dst, bitrate) -> str: def get_lightpaths() -> str: - urlx = "http://{}:{}/OpticalTFS/GetLightpaths".format(OPTICAL_IP, OPTICAL_PORT) + base_url = get_optical_controller_base_url() + urlx = "{:s}/GetLightpaths".format(base_url) headers = {"Content-Type": "application/json"} r = requests.get(urlx, headers=headers) -- GitLab From 5377075da4798b96b470a2f218bb0a7e55e2ee33 Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Mon, 8 Apr 2024 16:36:02 +0000 Subject: [PATCH 18/28] GitLab CI/CD pipeline - OFC'24: - Correct order of TFS components being deployed when optical controller is activated --- src/tests/ofc24/deploy_specs.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/tests/ofc24/deploy_specs.sh b/src/tests/ofc24/deploy_specs.sh index e7458dc9d..4ade75923 100755 --- a/src/tests/ofc24/deploy_specs.sh +++ b/src/tests/ofc24/deploy_specs.sh @@ -30,7 +30,14 @@ export TFS_COMPONENTS="context device pathcomp service slice nbi webui" #export TFS_COMPONENTS="${TFS_COMPONENTS} bgpls_speaker" # Uncomment to activate Optical Controller -export TFS_COMPONENTS="${TFS_COMPONENTS} opticalcontroller" +# 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" -- GitLab From c61310adfaea187e28a41c11f6811885050ec1b3 Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Mon, 8 Apr 2024 17:34:23 +0000 Subject: [PATCH 19/28] Service component: - Corrected format of optical controller URL's port number --- src/service/service/tools/OpticalTools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/service/service/tools/OpticalTools.py b/src/service/service/tools/OpticalTools.py index 20cd6b42a..ad2f8cbec 100644 --- a/src/service/service/tools/OpticalTools.py +++ b/src/service/service/tools/OpticalTools.py @@ -39,7 +39,7 @@ VAR_NAME_OPTICAL_CTRL_SCHEMA = get_optical_controller_setting('SCHEMA') VAR_NAME_OPTICAL_CTRL_HOST = get_optical_controller_setting(ENVVAR_SUFIX_SERVICE_HOST) VAR_NAME_OPTICAL_CTRL_PORT = get_optical_controller_setting(ENVVAR_SUFIX_SERVICE_PORT_GRPC) -OPTICAL_CTRL_BASE_URL = '{:s}://{:s}:{:s}/OpticalTFS' +OPTICAL_CTRL_BASE_URL = '{:s}://{:s}:{:d}/OpticalTFS' def get_optical_controller_base_url() -> str: settings = find_environment_variables([ -- GitLab From cd80faa13caddc80e552f8391081a3555d9e8bb5 Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Tue, 9 Apr 2024 13:25:48 +0000 Subject: [PATCH 20/28] Service component: - Corrected format of URLs in OpticalTools.py --- src/service/service/tools/OpticalTools.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/service/service/tools/OpticalTools.py b/src/service/service/tools/OpticalTools.py index ad2f8cbec..1837bf688 100644 --- a/src/service/service/tools/OpticalTools.py +++ b/src/service/service/tools/OpticalTools.py @@ -109,11 +109,11 @@ def add_lightpath(src, dst, bitrate, bidir, ob_band) -> str: if ob_band is None: if bidir is None: bidir = 1 - urlx = "{:s}/AddFlexLightpath/{:s}/{:s}/{:s}/{:s}".format(base_url, src, dst, bitrate, bidir) + urlx = "{:s}/AddFlexLightpath/{:s}/{:s}/{:s}/{:s}".format(base_url, src, dst, str(bitrate), str(bidir)) else: if bidir is None: bidir = 1 - urlx = "{:s}/AddFlexLightpath/{:s}/{:s}/{:s}/{:s}/{:s}".format(base_url, src, dst, bitrate, bidir, ob_band) + urlx = "{:s}/AddFlexLightpath/{:s}/{:s}/{:s}/{:s}/{:s}".format(base_url, src, dst, str(bitrate), str(bidir), str(ob_band)) r = requests.put(urlx, headers=headers) reply = r.text return reply @@ -127,7 +127,7 @@ def add_lightpath(src, dst, bitrate, bidir, ob_band) -> str: def get_optical_band(idx) -> str: if not TESTING: base_url = get_optical_controller_base_url() - urlx = "{:s}/GetOpticalBand/{:s}".format(base_url, idx) + urlx = "{:s}/GetOpticalBand/{:s}".format(base_url, str(idx)) headers = {"Content-Type": "application/json"} r = requests.get(urlx, headers=headers) reply = r.text @@ -143,7 +143,7 @@ def delete_lightpath(flow_id, src, dst, bitrate) -> str: reply = "200" if not TESTING: base_url = get_optical_controller_base_url() - urlx = "{:s}/DelLightpath/{:s}/{:s}/{:s}/{:s}".format(base_url, flow_id, src, dst, bitrate) + urlx = "{:s}/DelLightpath/{:s}/{:s}/{:s}/{:s}".format(base_url, str(flow_id), src, dst, str(bitrate)) headers = {"Content-Type": "application/json"} r = requests.delete(urlx, headers=headers) -- GitLab From f85eaa28fcf6dd586a15fbab371ca5164e135602 Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Tue, 9 Apr 2024 16:16:44 +0000 Subject: [PATCH 21/28] Context component: - Corrected case in *opticalconfig* symbols --- src/context/service/ContextServiceServicerImpl.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/context/service/ContextServiceServicerImpl.py b/src/context/service/ContextServiceServicerImpl.py index a102fa176..379705372 100644 --- a/src/context/service/ContextServiceServicerImpl.py +++ b/src/context/service/ContextServiceServicerImpl.py @@ -305,7 +305,7 @@ class ContextServiceServicerImpl(ContextServiceServicer, ContextPolicyServiceSer @safe_and_metered_rpc_method(METRICS_POOL, LOGGER) def GetOpticalConfig(self, request : Empty, context : grpc.ServicerContext) -> OpticalConfigList: result = get_opticalconfig(self.db_engine) - return OpticalConfigList(OpticalConfigs=result) + return OpticalConfigList(opticalconfigs=result) @safe_and_metered_rpc_method(METRICS_POOL, LOGGER) def SetOpticalConfig(self, request : OpticalConfig, context : grpc.ServicerContext) -> OpticalConfigId: @@ -315,6 +315,4 @@ class ContextServiceServicerImpl(ContextServiceServicer, ContextPolicyServiceSer @safe_and_metered_rpc_method(METRICS_POOL, LOGGER) def SelectOpticalConfig(self, request : OpticalConfigId, context : grpc.ServicerContext) -> OpticalConfig: result = select_opticalconfig(self.db_engine, request) - optical_config_id = OpticalConfigId() - optical_config_id.CopyFrom(result.OpticalConfig_id) - return OpticalConfig(config=result.config, OpticalConfig_id=optical_config_id) + return OpticalConfig(config=result.config, opticalconfig_id=result.opticalconfig_id) -- GitLab From f9fcd9ff532eadec1aed247a348470f4a49e1c27 Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Tue, 9 Apr 2024 16:32:27 +0000 Subject: [PATCH 22/28] GitLab CI/CD pipeline: - Deactivated unneeded tests --- .gitlab-ci.yml | 20 ++++++++++---------- src/tests/.gitlab-ci.yml | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2d7c2e21b..b33b5b3df 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,19 +22,19 @@ stages: # include the individual .gitlab-ci.yml of each micro-service and tests include: #- local: '/manifests/.gitlab-ci.yml' - - local: '/src/monitoring/.gitlab-ci.yml' + ###- local: '/src/monitoring/.gitlab-ci.yml' - local: '/src/nbi/.gitlab-ci.yml' - local: '/src/context/.gitlab-ci.yml' - local: '/src/device/.gitlab-ci.yml' - local: '/src/service/.gitlab-ci.yml' - - local: '/src/dbscanserving/.gitlab-ci.yml' - - local: '/src/opticalattackmitigator/.gitlab-ci.yml' - - local: '/src/opticalattackdetector/.gitlab-ci.yml' - - local: '/src/opticalattackmanager/.gitlab-ci.yml' + ###- local: '/src/dbscanserving/.gitlab-ci.yml' + ###- local: '/src/opticalattackmitigator/.gitlab-ci.yml' + ###- local: '/src/opticalattackdetector/.gitlab-ci.yml' + ###- local: '/src/opticalattackmanager/.gitlab-ci.yml' - local: '/src/opticalcontroller/.gitlab-ci.yml' - - local: '/src/ztp/.gitlab-ci.yml' - - local: '/src/policy/.gitlab-ci.yml' - - local: '/src/forecaster/.gitlab-ci.yml' + ###- local: '/src/ztp/.gitlab-ci.yml' + ###- local: '/src/policy/.gitlab-ci.yml' + ###- local: '/src/forecaster/.gitlab-ci.yml' #- local: '/src/webui/.gitlab-ci.yml' #- local: '/src/l3_distributedattackdetector/.gitlab-ci.yml' #- local: '/src/l3_centralizedattackdetector/.gitlab-ci.yml' @@ -43,8 +43,8 @@ include: #- local: '/src/interdomain/.gitlab-ci.yml' - local: '/src/pathcomp/.gitlab-ci.yml' #- local: '/src/dlt/.gitlab-ci.yml' - - local: '/src/load_generator/.gitlab-ci.yml' - - local: '/src/bgpls_speaker/.gitlab-ci.yml' + ###- local: '/src/load_generator/.gitlab-ci.yml' + ###- local: '/src/bgpls_speaker/.gitlab-ci.yml' # This should be last one: end-to-end integration tests - local: '/src/tests/.gitlab-ci.yml' diff --git a/src/tests/.gitlab-ci.yml b/src/tests/.gitlab-ci.yml index b7345bbd1..36bfd6636 100644 --- a/src/tests/.gitlab-ci.yml +++ b/src/tests/.gitlab-ci.yml @@ -14,9 +14,9 @@ # include the individual .gitlab-ci.yml of each end-to-end integration test include: - - local: '/src/tests/ofc22/.gitlab-ci.yml' + ###- local: '/src/tests/ofc22/.gitlab-ci.yml' #- local: '/src/tests/oeccpsc22/.gitlab-ci.yml' - - local: '/src/tests/ecoc22/.gitlab-ci.yml' + ###- local: '/src/tests/ecoc22/.gitlab-ci.yml' #- local: '/src/tests/nfvsdn22/.gitlab-ci.yml' #- local: '/src/tests/ofc23/.gitlab-ci.yml' - local: '/src/tests/ofc24/.gitlab-ci.yml' -- GitLab From 62093d79535c576c000d5038f8c8b5575c6b9af2 Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Wed, 10 Apr 2024 10:56:23 +0000 Subject: [PATCH 23/28] Optical Controller component: - Added log message to debug issue --- src/opticalcontroller/OpticalController.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/opticalcontroller/OpticalController.py b/src/opticalcontroller/OpticalController.py index c2805695a..ec8c4db2c 100644 --- a/src/opticalcontroller/OpticalController.py +++ b/src/opticalcontroller/OpticalController.py @@ -85,6 +85,7 @@ class AddFlexLightpath(Resource): if rsa is not None: flow_id, optical_band_id = rsa.rsa_fs_computation(src, dst, bitrate, bidir, band) print (f"flow_id {flow_id} and optical_band_id {optical_band_id} ") + LOGGER.warning('flow_id={:s} rsa.db_flows={:s}'.format(str(flow_id), str(rsa.db_flows))) if flow_id is not None: if rsa.db_flows[flow_id]["op-mode"] == 0: return 'No path found', 404 -- GitLab From bf8f0f3b38c3e4e94a08879f2f4f0a6a11a4fe0b Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Thu, 11 Apr 2024 15:44:26 +0000 Subject: [PATCH 24/28] Service component: - Corrected config generation in TaskExecutor::configure_optical_device() --- src/service/service/task_scheduler/TaskExecutor.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/service/service/task_scheduler/TaskExecutor.py b/src/service/service/task_scheduler/TaskExecutor.py index 5c5747970..fdfcb903b 100644 --- a/src/service/service/task_scheduler/TaskExecutor.py +++ b/src/service/service/task_scheduler/TaskExecutor.py @@ -122,17 +122,16 @@ class TaskExecutor: optical_config_id = OpticalConfigId() optical_config_id.opticalconfig_uuid = device.device_id.device_uuid.uuid optical_config = OpticalConfig() - setting = settings.value if settings else "" + setting = settings.value if settings else '' - new_config = {} try: result = self._context_client.SelectOpticalConfig(optical_config_id) - new_config = json.loads(result.config) - if result is not None : + if result is not None: + new_config = json.loads(result.config) new_config["new_config"] = setting new_config["is_opticalband"] = is_opticalband new_config["flow"] = flows - result.config = str(new_config) + result.config = json.dumps(new_config) optical_config.CopyFrom(result) self._device_client.ConfigureOpticalDevice(optical_config) self._store_grpc_object(CacheableObjectType.DEVICE, device_key, device) -- GitLab From 14db9b7c6317d021d29c88541593eb716a1804cf Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Thu, 11 Apr 2024 15:46:01 +0000 Subject: [PATCH 25/28] OFC'24 test: - Corrected tests create/delete service unidir/bidir - Added run-tests-locally.sh script - Removed unneeded README.md file --- src/tests/ofc24/README.md | 21 ----- src/tests/ofc24/run-tests-locally.sh | 22 ++++++ .../test_functional_create_service_bidir.py | 30 ++++---- .../test_functional_create_service_unidir.py | 30 ++++---- .../test_functional_delete_service_bidir.py | 76 ++++++++----------- .../test_functional_delete_service_unidir.py | 76 ++++++++----------- 6 files changed, 116 insertions(+), 139 deletions(-) delete mode 100644 src/tests/ofc24/README.md create mode 100755 src/tests/ofc24/run-tests-locally.sh diff --git a/src/tests/ofc24/README.md b/src/tests/ofc24/README.md deleted file mode 100644 index 93e95fc64..000000000 --- a/src/tests/ofc24/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# OFC'24 - Test scenario - -## Start Topology -Topology is composed of 2 transponders managed through OpenConfig and 2 Multi-granular ROAMDS -Strat the topology executing the following command: -```bash -sudo ./start_topo.sh -``` - -## Populate the TFS context and topology -Pushing the JSON files following the file indexes, i.e, 1, 2, 3, ... -The last JSON file with ID 7 is the service. -To check the service is onboarded successfully go into the TFS WebUI and check the `Service` tab. - -## Check configuration in devices -Check if the devices are configured properly. -To check that, run, for each device (X={1, 2, 3, 4}): -```bash -screen -r tX -``` -To release the terminal, press `Ctrl + A + D` diff --git a/src/tests/ofc24/run-tests-locally.sh b/src/tests/ofc24/run-tests-locally.sh new file mode 100755 index 000000000..14cf78500 --- /dev/null +++ b/src/tests/ofc24/run-tests-locally.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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/tfs_runtime_env_vars.sh +pytest --verbose --log-level=INFO ~/tfs-ctrl/ofc24/tests/test_functional_bootstrap.py +pytest --verbose --log-level=INFO ~/tfs-ctrl/ofc24/tests/test_functional_create_service_unidir.py +pytest --verbose --log-level=INFO ~/tfs-ctrl/ofc24/tests/test_functional_delete_service_unidir.py +pytest --verbose --log-level=INFO ~/tfs-ctrl/ofc24/tests/test_functional_create_service_bidir.py +pytest --verbose --log-level=INFO ~/tfs-ctrl/ofc24/tests/test_functional_delete_service_bidir.py +pytest --verbose --log-level=INFO ~/tfs-ctrl/ofc24/tests/test_functional_cleanup.py diff --git a/src/tests/ofc24/tests/test_functional_create_service_bidir.py b/src/tests/ofc24/tests/test_functional_create_service_bidir.py index 82408eaa5..e910c946d 100644 --- a/src/tests/ofc24/tests/test_functional_create_service_bidir.py +++ b/src/tests/ofc24/tests/test_functional_create_service_bidir.py @@ -14,7 +14,7 @@ import logging, os from common.Constants import DEFAULT_CONTEXT_NAME -from common.proto.context_pb2 import ContextId, ServiceTypeEnum +from common.proto.context_pb2 import ContextId, ServiceStatusEnum, ServiceTypeEnum from common.tools.descriptor.Loader import DescriptorLoader, check_descriptor_load_results from common.tools.grpc.Tools import grpc_message_to_json_string from common.tools.object_factory.Context import json_context_id @@ -41,32 +41,32 @@ def test_service_creation_bidir( ) results = descriptor_loader.process() check_descriptor_load_results(results, descriptor_loader) - descriptor_loader.validate() - # Verify the scenario has no services/slices + # Verify the scenario has 1 service and 0 slices response = context_client.GetContext(ADMIN_CONTEXT_ID) - #assert len(response.service_ids) == 0 - #assert len(response.slice_ids) == 0 + assert len(response.service_ids) == 1 + assert len(response.slice_ids) == 0 - # Ensure slices and services are created + # Check there are no slices response = context_client.ListSlices(ADMIN_CONTEXT_ID) LOGGER.warning('Slices[{:d}] = {:s}'.format(len(response.slices), grpc_message_to_json_string(response))) - #assert len(response.slices) == 1 # OSM slice + assert len(response.slices) == 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) == 2 # 1xL3NM + 1xTAPI + assert len(response.services) == 1 for service in response.services: service_id = service.service_id + assert service.service_status.service_status == ServiceStatusEnum.SERVICESTATUS_ACTIVE + 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))) - #if service.service_type == ServiceTypeEnum.SERVICETYPE_L3NM: - # assert len(response.connections) == 1 # 1 connection per service - #elif service.service_type == ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE: - # assert len(response.connections) == 1 # 1 connection per service - #else: - # str_service = grpc_message_to_json_string(service) - # raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) + if service.service_type == ServiceTypeEnum.SERVICETYPE_OPTICAL_CONNECTIVITY: + assert len(response.connections) == 2 + else: + str_service = grpc_message_to_json_string(service) + raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) diff --git a/src/tests/ofc24/tests/test_functional_create_service_unidir.py b/src/tests/ofc24/tests/test_functional_create_service_unidir.py index 1cc0f43ce..5b2550ae1 100644 --- a/src/tests/ofc24/tests/test_functional_create_service_unidir.py +++ b/src/tests/ofc24/tests/test_functional_create_service_unidir.py @@ -14,7 +14,7 @@ import logging, os from common.Constants import DEFAULT_CONTEXT_NAME -from common.proto.context_pb2 import ContextId, ServiceTypeEnum +from common.proto.context_pb2 import ContextId, ServiceStatusEnum, ServiceTypeEnum from common.tools.descriptor.Loader import DescriptorLoader, check_descriptor_load_results from common.tools.grpc.Tools import grpc_message_to_json_string from common.tools.object_factory.Context import json_context_id @@ -41,32 +41,32 @@ def test_service_creation_unidir( ) results = descriptor_loader.process() check_descriptor_load_results(results, descriptor_loader) - descriptor_loader.validate() - # Verify the scenario has no services/slices + # Verify the scenario has 1 service and 0 slices response = context_client.GetContext(ADMIN_CONTEXT_ID) - #assert len(response.service_ids) == 0 - #assert len(response.slice_ids) == 0 + assert len(response.service_ids) == 1 + assert len(response.slice_ids) == 0 - # Ensure slices and services are created + # Check there are no slices response = context_client.ListSlices(ADMIN_CONTEXT_ID) LOGGER.warning('Slices[{:d}] = {:s}'.format(len(response.slices), grpc_message_to_json_string(response))) - #assert len(response.slices) == 1 # OSM slice + assert len(response.slices) == 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) == 2 # 1xL3NM + 1xTAPI + assert len(response.services) == 1 for service in response.services: service_id = service.service_id + assert service.service_status.service_status == ServiceStatusEnum.SERVICESTATUS_ACTIVE + 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))) - #if service.service_type == ServiceTypeEnum.SERVICETYPE_L3NM: - # assert len(response.connections) == 1 # 1 connection per service - #elif service.service_type == ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE: - # assert len(response.connections) == 1 # 1 connection per service - #else: - # str_service = grpc_message_to_json_string(service) - # raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) + if service.service_type == ServiceTypeEnum.SERVICETYPE_OPTICAL_CONNECTIVITY: + assert len(response.connections) == 2 + else: + str_service = grpc_message_to_json_string(service) + raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) diff --git a/src/tests/ofc24/tests/test_functional_delete_service_bidir.py b/src/tests/ofc24/tests/test_functional_delete_service_bidir.py index ee0572df2..a337336a8 100644 --- a/src/tests/ofc24/tests/test_functional_delete_service_bidir.py +++ b/src/tests/ofc24/tests/test_functional_delete_service_bidir.py @@ -12,79 +12,67 @@ # See the License for the specific language governing permissions and # limitations under the License. -import logging, os +import logging +from typing import Set, Tuple from common.Constants import DEFAULT_CONTEXT_NAME -from common.proto.context_pb2 import ContextId, ServiceId, ServiceTypeEnum -from common.tools.descriptor.Loader import DescriptorLoader +from common.proto.context_pb2 import ContextId, ServiceId, ServiceStatusEnum, ServiceTypeEnum from common.tools.grpc.Tools import grpc_message_to_json_string from common.tools.object_factory.Context import json_context_id +from common.tools.object_factory.Service import json_service_id from context.client.ContextClient import ContextClient -from device.client.DeviceClient import DeviceClient from service.client.ServiceClient import ServiceClient -from tests.Fixtures import context_client, device_client, service_client # pylint: disable=unused-import +from tests.Fixtures import context_client, service_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__)), '..', 'descriptors', 'service-bidir.json') ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME)) def test_service_removal_bidir( context_client : ContextClient, # pylint: disable=redefined-outer-name - device_client : DeviceClient, # pylint: disable=redefined-outer-name service_client : ServiceClient, # pylint: disable=redefined-outer-name ): - # Load descriptors and validate the base scenario - descriptor_loader = DescriptorLoader( - descriptors_file=DESCRIPTOR_FILE, context_client=context_client, device_client=device_client, - service_client=service_client - ) - descriptor_loader.validate() - - # Verify the scenario has no services/slices + # Verify the scenario has 1 service and 0 slices response = context_client.GetContext(ADMIN_CONTEXT_ID) - #assert len(response.service_ids) == 0 - #assert len(response.slice_ids) == 0 + assert len(response.service_ids) == 1 + assert len(response.slice_ids) == 0 - # Ensure slices and services are created + # Check there are no slices response = context_client.ListSlices(ADMIN_CONTEXT_ID) LOGGER.warning('Slices[{:d}] = {:s}'.format(len(response.slices), grpc_message_to_json_string(response))) - #assert len(response.slices) == 1 # OSM slice + assert len(response.slices) == 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) == 2 # 1xL3NM + 1xTAPI + assert len(response.services) == 1 - #service_uuids = set() + context_service_uuids : Set[Tuple[str, str]] = set() for service in response.services: service_id = service.service_id + assert service.service_status.service_status == ServiceStatusEnum.SERVICESTATUS_ACTIVE + 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))) - #if service.service_type == ServiceTypeEnum.SERVICETYPE_L3NM: - # assert len(response.connections) == 1 # 1 connection per service - # service_uuid = service_id.service_uuid.uuid - # service_uuids.add(service_uuid) - # osm_wim.conn_info[service_uuid] = {} - #elif service.service_type == ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE: - # assert len(response.connections) == 1 # 1 connection per service - #else: - # str_service = grpc_message_to_json_string(service) - # raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) + if service.service_type == ServiceTypeEnum.SERVICETYPE_OPTICAL_CONNECTIVITY: + assert len(response.connections) == 2 + context_uuid = service_id.context_id.context_uuid.uuid + service_uuid = service_id.service_uuid.uuid + context_service_uuids.add((context_uuid, service_uuid)) + else: + str_service = grpc_message_to_json_string(service) + raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) - ## Identify service to delete - #assert len(service_uuids) == 1 # assume a single L3NM service has been created - #service_uuid = set(service_uuids).pop() + # Identify service to delete + assert len(context_service_uuids) == 1 + context_uuid, service_uuid = set(context_service_uuids).pop() - ## Delete Service - #service_client.DeleteService(ServiceId(json_service_id(service_uuid, context_uuid))) + # Delete Service + service_client.DeleteService(ServiceId(**json_service_id(service_uuid, json_context_id(context_uuid)))) - ## 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 - - ## Load descriptors and validate the base scenario - #descriptor_loader = DescriptorLoader(descriptors_file=DESCRIPTOR_FILE, context_client=context_client) - #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 diff --git a/src/tests/ofc24/tests/test_functional_delete_service_unidir.py b/src/tests/ofc24/tests/test_functional_delete_service_unidir.py index 0861b103c..9b0381c49 100644 --- a/src/tests/ofc24/tests/test_functional_delete_service_unidir.py +++ b/src/tests/ofc24/tests/test_functional_delete_service_unidir.py @@ -12,79 +12,67 @@ # See the License for the specific language governing permissions and # limitations under the License. -import logging, os +import logging +from typing import Set, Tuple from common.Constants import DEFAULT_CONTEXT_NAME -from common.proto.context_pb2 import ContextId, ServiceId, ServiceTypeEnum -from common.tools.descriptor.Loader import DescriptorLoader +from common.proto.context_pb2 import ContextId, ServiceId, ServiceStatusEnum, ServiceTypeEnum from common.tools.grpc.Tools import grpc_message_to_json_string from common.tools.object_factory.Context import json_context_id +from common.tools.object_factory.Service import json_service_id from context.client.ContextClient import ContextClient -from device.client.DeviceClient import DeviceClient from service.client.ServiceClient import ServiceClient -from tests.Fixtures import context_client, device_client, service_client # pylint: disable=unused-import +from tests.Fixtures import context_client, service_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__)), '..', 'descriptors', 'service-unidir.json') ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME)) def test_service_removal_unidir( context_client : ContextClient, # pylint: disable=redefined-outer-name - device_client : DeviceClient, # pylint: disable=redefined-outer-name service_client : ServiceClient, # pylint: disable=redefined-outer-name ): - # Load descriptors and validate the base scenario - descriptor_loader = DescriptorLoader( - descriptors_file=DESCRIPTOR_FILE, context_client=context_client, device_client=device_client, - service_client=service_client - ) - descriptor_loader.validate() - - # Verify the scenario has no services/slices + # Verify the scenario has 1 service and 0 slices response = context_client.GetContext(ADMIN_CONTEXT_ID) - #assert len(response.service_ids) == 0 - #assert len(response.slice_ids) == 0 + assert len(response.service_ids) == 1 + assert len(response.slice_ids) == 0 - # Ensure slices and services are created + # Check there are no slices response = context_client.ListSlices(ADMIN_CONTEXT_ID) LOGGER.warning('Slices[{:d}] = {:s}'.format(len(response.slices), grpc_message_to_json_string(response))) - #assert len(response.slices) == 1 # OSM slice + assert len(response.slices) == 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) == 2 # 1xL3NM + 1xTAPI + assert len(response.services) == 1 - #service_uuids = set() + context_service_uuids : Set[Tuple[str, str]] = set() for service in response.services: service_id = service.service_id + assert service.service_status.service_status == ServiceStatusEnum.SERVICESTATUS_ACTIVE + 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))) - #if service.service_type == ServiceTypeEnum.SERVICETYPE_L3NM: - # assert len(response.connections) == 1 # 1 connection per service - # service_uuid = service_id.service_uuid.uuid - # service_uuids.add(service_uuid) - # osm_wim.conn_info[service_uuid] = {} - #elif service.service_type == ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE: - # assert len(response.connections) == 1 # 1 connection per service - #else: - # str_service = grpc_message_to_json_string(service) - # raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) + if service.service_type == ServiceTypeEnum.SERVICETYPE_OPTICAL_CONNECTIVITY: + assert len(response.connections) == 2 + context_uuid = service_id.context_id.context_uuid.uuid + service_uuid = service_id.service_uuid.uuid + context_service_uuids.add((context_uuid, service_uuid)) + else: + str_service = grpc_message_to_json_string(service) + raise Exception('Unexpected ServiceType: {:s}'.format(str_service)) - ## Identify service to delete - #assert len(service_uuids) == 1 # assume a single L3NM service has been created - #service_uuid = set(service_uuids).pop() + # Identify service to delete + assert len(context_service_uuids) == 1 + context_uuid, service_uuid = set(context_service_uuids).pop() - ## Delete Service - #service_client.DeleteService(ServiceId(json_service_id(service_uuid, context_uuid))) + # Delete Service + service_client.DeleteService(ServiceId(**json_service_id(service_uuid, json_context_id(context_uuid)))) - ## 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 - - ## Load descriptors and validate the base scenario - #descriptor_loader = DescriptorLoader(descriptors_file=DESCRIPTOR_FILE, context_client=context_client) - #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 -- GitLab From 9790bd3c5bceb401161cf7c50a3edb58ac52cf85 Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Thu, 11 Apr 2024 16:13:11 +0000 Subject: [PATCH 26/28] GitLab CI/CD pipeline: - Reactivated tests --- .gitlab-ci.yml | 20 ++++++++++---------- src/tests/.gitlab-ci.yml | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b33b5b3df..2d7c2e21b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,19 +22,19 @@ stages: # include the individual .gitlab-ci.yml of each micro-service and tests include: #- local: '/manifests/.gitlab-ci.yml' - ###- local: '/src/monitoring/.gitlab-ci.yml' + - local: '/src/monitoring/.gitlab-ci.yml' - local: '/src/nbi/.gitlab-ci.yml' - local: '/src/context/.gitlab-ci.yml' - local: '/src/device/.gitlab-ci.yml' - local: '/src/service/.gitlab-ci.yml' - ###- local: '/src/dbscanserving/.gitlab-ci.yml' - ###- local: '/src/opticalattackmitigator/.gitlab-ci.yml' - ###- local: '/src/opticalattackdetector/.gitlab-ci.yml' - ###- local: '/src/opticalattackmanager/.gitlab-ci.yml' + - local: '/src/dbscanserving/.gitlab-ci.yml' + - local: '/src/opticalattackmitigator/.gitlab-ci.yml' + - local: '/src/opticalattackdetector/.gitlab-ci.yml' + - local: '/src/opticalattackmanager/.gitlab-ci.yml' - local: '/src/opticalcontroller/.gitlab-ci.yml' - ###- local: '/src/ztp/.gitlab-ci.yml' - ###- local: '/src/policy/.gitlab-ci.yml' - ###- local: '/src/forecaster/.gitlab-ci.yml' + - local: '/src/ztp/.gitlab-ci.yml' + - local: '/src/policy/.gitlab-ci.yml' + - local: '/src/forecaster/.gitlab-ci.yml' #- local: '/src/webui/.gitlab-ci.yml' #- local: '/src/l3_distributedattackdetector/.gitlab-ci.yml' #- local: '/src/l3_centralizedattackdetector/.gitlab-ci.yml' @@ -43,8 +43,8 @@ include: #- local: '/src/interdomain/.gitlab-ci.yml' - local: '/src/pathcomp/.gitlab-ci.yml' #- local: '/src/dlt/.gitlab-ci.yml' - ###- local: '/src/load_generator/.gitlab-ci.yml' - ###- local: '/src/bgpls_speaker/.gitlab-ci.yml' + - local: '/src/load_generator/.gitlab-ci.yml' + - local: '/src/bgpls_speaker/.gitlab-ci.yml' # This should be last one: end-to-end integration tests - local: '/src/tests/.gitlab-ci.yml' diff --git a/src/tests/.gitlab-ci.yml b/src/tests/.gitlab-ci.yml index 36bfd6636..b7345bbd1 100644 --- a/src/tests/.gitlab-ci.yml +++ b/src/tests/.gitlab-ci.yml @@ -14,9 +14,9 @@ # include the individual .gitlab-ci.yml of each end-to-end integration test include: - ###- local: '/src/tests/ofc22/.gitlab-ci.yml' + - local: '/src/tests/ofc22/.gitlab-ci.yml' #- local: '/src/tests/oeccpsc22/.gitlab-ci.yml' - ###- local: '/src/tests/ecoc22/.gitlab-ci.yml' + - local: '/src/tests/ecoc22/.gitlab-ci.yml' #- local: '/src/tests/nfvsdn22/.gitlab-ci.yml' #- local: '/src/tests/ofc23/.gitlab-ci.yml' - local: '/src/tests/ofc24/.gitlab-ci.yml' -- GitLab From a419c7b6e8457ad10a72c406c09822c568ff5b9f Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Thu, 11 Apr 2024 16:22:23 +0000 Subject: [PATCH 27/28] Deploy scripts: - Corrected deployment order in my_deploy.sh for opticalcontroller and service components --- my_deploy.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/my_deploy.sh b/my_deploy.sh index 7dd5e5c3e..4e705622b 100755 --- a/my_deploy.sh +++ b/my_deploy.sh @@ -29,7 +29,14 @@ export TFS_COMPONENTS="context device pathcomp service slice nbi webui load_gene #export TFS_COMPONENTS="${TFS_COMPONENTS} bgpls_speaker" # Uncomment to activate Optical Controller -#export TFS_COMPONENTS="${TFS_COMPONENTS} opticalcontroller" +# 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" -- GitLab From 62a30586927deb2442baa266f7386d49fd2a8ee7 Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Thu, 11 Apr 2024 16:23:47 +0000 Subject: [PATCH 28/28] Optical Controller component: - Reduced level of some debug log messages --- src/opticalcontroller/OpticalController.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opticalcontroller/OpticalController.py b/src/opticalcontroller/OpticalController.py index ec8c4db2c..326862f93 100644 --- a/src/opticalcontroller/OpticalController.py +++ b/src/opticalcontroller/OpticalController.py @@ -85,7 +85,7 @@ class AddFlexLightpath(Resource): if rsa is not None: flow_id, optical_band_id = rsa.rsa_fs_computation(src, dst, bitrate, bidir, band) print (f"flow_id {flow_id} and optical_band_id {optical_band_id} ") - LOGGER.warning('flow_id={:s} rsa.db_flows={:s}'.format(str(flow_id), str(rsa.db_flows))) + LOGGER.debug('flow_id={:s} rsa.db_flows={:s}'.format(str(flow_id), str(rsa.db_flows))) if flow_id is not None: if rsa.db_flows[flow_id]["op-mode"] == 0: return 'No path found', 404 -- GitLab