From cb853790e186fa66487b1a22042345af7163ce34 Mon Sep 17 00:00:00 2001 From: JvD_Ericsson Date: Fri, 15 Dec 2023 09:22:40 +0000 Subject: Move mount node after cps test during CSITs * Split test plans into cps and ncmp * Check sdnc moved to after cps tests * Moved mounting of node to after cps tests Issue-ID: CPS-2001 Signed-off-by: JvD_Ericsson Change-Id: I5a36238d8ee6c91087cd2712c69e169257d48faa --- csit/plans/cps/sdnc/check_sdnc_mount_node.sh | 82 ++++++++++++++++++++++++++++ csit/plans/cps/sdnc/sdnc_setup.sh | 24 +------- csit/plans/cps/setup.sh | 47 ---------------- csit/plans/cps/testplan.txt | 28 ---------- csit/plans/cps/testplanCps.txt | 21 +++++++ csit/plans/cps/testplanNcmp.txt | 25 +++++++++ 6 files changed, 129 insertions(+), 98 deletions(-) create mode 100644 csit/plans/cps/sdnc/check_sdnc_mount_node.sh delete mode 100644 csit/plans/cps/testplan.txt create mode 100644 csit/plans/cps/testplanCps.txt create mode 100644 csit/plans/cps/testplanNcmp.txt (limited to 'csit/plans') diff --git a/csit/plans/cps/sdnc/check_sdnc_mount_node.sh b/csit/plans/cps/sdnc/check_sdnc_mount_node.sh new file mode 100644 index 0000000000..9ea6670769 --- /dev/null +++ b/csit/plans/cps/sdnc/check_sdnc_mount_node.sh @@ -0,0 +1,82 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2023 Nordix Foundation +# ================================================================================ +# 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. +# ============LICENSE_END========================================================= + +# WAIT 10 minutes maximum and test every 30 seconds if SDNC is up using HealthCheck API +TIME_OUT=600 +INTERVAL=30 +TIME=0 +while [ "$TIME" -lt "$TIME_OUT" ]; do + response=$(curl --write-out '%{http_code}' --silent --output /dev/null -H "Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==" -X POST -H "X-FromAppId: csit-sdnc" -H "X-TransactionId: csit-sdnc" -H "Accept: application/json" -H "Content-Type: application/json" http://$SDNC_HOST:$SDNC_PORT/restconf/operations/SLI-API:healthcheck ); + echo $response + + if [ "$response" == "200" ]; then + echo SDNC started in $TIME seconds + break; + fi + + echo Sleep: $INTERVAL seconds before testing if SDNC is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds + sleep $INTERVAL + TIME=$(($TIME+$INTERVAL)) +done + +if [ "$TIME" -ge "$TIME_OUT" ]; then + echo TIME OUT: karaf session not started in $TIME_OUT seconds... Could cause problems for testing activities... +fi + +###################### mount pnf-sim as PNFDemo ########################## +SDNC_TIME_OUT=250 +SDNC_INTERVAL=10 +SDNC_TIME=0 + +while [ "$SDNC_TIME" -le "$SDNC_TIME_OUT" ]; do + + # Mount netconf node + curl --location --request PUT 'http://'$SDNC_HOST:$SDNC_PORT'/restconf/config/network-topology:network-topology/topology/topology-netconf/node/PNFDemo' \ + --header 'Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==' \ + --header 'Content-Type: application/json' \ + --data-raw '{ + "node": [ + { + "node-id": "PNFDemo", + "netconf-node-topology:protocol": { + "name": "TLS" + }, + "netconf-node-topology:host": "'$LOCAL_IP'", + "netconf-node-topology:key-based": { + "username": "netconf", + "key-id": "ODL_private_key_0" + }, + "netconf-node-topology:port": 6512, + "netconf-node-topology:tcp-only": false, + "netconf-node-topology:max-connection-attempts": 5 + } + ] + }' + + # Verify node has been mounted + + RESPONSE=$( curl --location --request GET 'http://'$SDNC_HOST:$SDNC_PORT'/restconf/config/network-topology:network-topology/topology/topology-netconf' --header 'Authorization: basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==') + + if [[ "$RESPONSE" == *"PNFDemo"* ]]; then + echo "Node mounted in $SDNC_TIME" + sleep 10 + break; + fi + + sleep $SDNC_INTERVAL + SDNC_TIME=$((SDNC_TIME + SDNC_INTERVAL)) + +done \ No newline at end of file diff --git a/csit/plans/cps/sdnc/sdnc_setup.sh b/csit/plans/cps/sdnc/sdnc_setup.sh index 9c17b836b0..61c61fc289 100644 --- a/csit/plans/cps/sdnc/sdnc_setup.sh +++ b/csit/plans/cps/sdnc/sdnc_setup.sh @@ -24,26 +24,4 @@ export SDNC_CERT_PATH=$WORKSPACE/plans/cps/sdnc/certs #start SDNC containers with docker compose and configuration from docker-compose.yml -docker-compose -f $WORKSPACE/plans/cps/sdnc/docker-compose.yml up -d - -# WAIT 10 minutes maximum and test every 30 seconds if SDNC is up using HealthCheck API -TIME_OUT=600 -INTERVAL=30 -TIME=0 -while [ "$TIME" -lt "$TIME_OUT" ]; do - response=$(curl --write-out '%{http_code}' --silent --output /dev/null -H "Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==" -X POST -H "X-FromAppId: csit-sdnc" -H "X-TransactionId: csit-sdnc" -H "Accept: application/json" -H "Content-Type: application/json" http://$SDNC_HOST:$SDNC_PORT/restconf/operations/SLI-API:healthcheck ); - echo $response - - if [ "$response" == "200" ]; then - echo SDNC started in $TIME seconds - break; - fi - - echo Sleep: $INTERVAL seconds before testing if SDNC is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds - sleep $INTERVAL - TIME=$(($TIME+$INTERVAL)) -done - -if [ "$TIME" -ge "$TIME_OUT" ]; then - echo TIME OUT: karaf session not started in $TIME_OUT seconds... Could cause problems for testing activities... -fi \ No newline at end of file +docker-compose -f $WORKSPACE/plans/cps/sdnc/docker-compose.yml up -d \ No newline at end of file diff --git a/csit/plans/cps/setup.sh b/csit/plans/cps/setup.sh index c4e5c153d9..80829eba14 100755 --- a/csit/plans/cps/setup.sh +++ b/csit/plans/cps/setup.sh @@ -72,53 +72,6 @@ source $WORKSPACE/plans/cps/sdnc/sdnc_setup.sh ###################### setup pnfsim ##################################### docker-compose -f $WORKSPACE/plans/cps/pnfsim/docker-compose.yml up -d -# Allow time for netconf-pnp-simulator & SDNC to come up fully -sleep 30s - -###################### mount pnf-sim as PNFDemo ########################## -SDNC_TIME_OUT=250 -SDNC_INTERVAL=10 -SDNC_TIME=0 - -while [ "$SDNC_TIME" -le "$SDNC_TIME_OUT" ]; do - - # Mount netconf node - curl --location --request PUT 'http://'$SDNC_HOST:$SDNC_PORT'/restconf/config/network-topology:network-topology/topology/topology-netconf/node/PNFDemo' \ - --header 'Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==' \ - --header 'Content-Type: application/json' \ - --data-raw '{ - "node": [ - { - "node-id": "PNFDemo", - "netconf-node-topology:protocol": { - "name": "TLS" - }, - "netconf-node-topology:host": "'$LOCAL_IP'", - "netconf-node-topology:key-based": { - "username": "netconf", - "key-id": "ODL_private_key_0" - }, - "netconf-node-topology:port": 6512, - "netconf-node-topology:tcp-only": false, - "netconf-node-topology:max-connection-attempts": 5 - } - ] - }' - - # Verify node has been mounted - - RESPONSE=$( curl --location --request GET 'http://'$SDNC_HOST:$SDNC_PORT'/restconf/config/network-topology:network-topology/topology/topology-netconf' --header 'Authorization: basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==') - - if [[ "$RESPONSE" == *"PNFDemo"* ]]; then - echo "Node mounted in $SDNC_TIME" - break; - fi - - sleep $SDNC_INTERVAL - SDNC_TIME=$((SDNC_TIME + SDNC_INTERVAL)) - -done - ###################### verify ncmp-cps health ########################## check_health $CPS_CORE_HOST:$CPS_CORE_PORT 'cps-ncmp' diff --git a/csit/plans/cps/testplan.txt b/csit/plans/cps/testplan.txt deleted file mode 100644 index 45e8381a1e..0000000000 --- a/csit/plans/cps/testplan.txt +++ /dev/null @@ -1,28 +0,0 @@ -# ============LICENSE_START======================================================= -# Copyright (C) 2021-2023 Nordix Foundation -# ================================================================================ -# 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. -# ============LICENSE_END========================================================= - -# Test suites are relative paths under csit/tests/. -# Place the suites in run order. -actuator -cps-admin -cps-data -cps-model-sync -cps-data-sync -cps-subscriptions -ncmp-passthrough -cm-handle-query -cps-trust-level -cps-data-operations \ No newline at end of file diff --git a/csit/plans/cps/testplanCps.txt b/csit/plans/cps/testplanCps.txt new file mode 100644 index 0000000000..8b0ad08980 --- /dev/null +++ b/csit/plans/cps/testplanCps.txt @@ -0,0 +1,21 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2023 Nordix Foundation +# ================================================================================ +# 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. +# ============LICENSE_END========================================================= + +# Test suites are relative paths under csit/tests/. +# Place the suites in run order. +actuator +cps-admin +cps-data \ No newline at end of file diff --git a/csit/plans/cps/testplanNcmp.txt b/csit/plans/cps/testplanNcmp.txt new file mode 100644 index 0000000000..81c5468618 --- /dev/null +++ b/csit/plans/cps/testplanNcmp.txt @@ -0,0 +1,25 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2023 Nordix Foundation +# ================================================================================ +# 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. +# ============LICENSE_END========================================================= + +# Test suites are relative paths under csit/tests/. +# Place the suites in run order. +cps-model-sync +cps-data-sync +cps-subscriptions +ncmp-passthrough +cm-handle-query +cps-trust-level +cps-data-operations \ No newline at end of file -- cgit