From dcfccebc367687ba878674287a89c0b7834594af Mon Sep 17 00:00:00 2001 From: demskeq8 Date: Wed, 31 May 2023 14:26:25 +0200 Subject: [PATCH] [CSIT] fix /operations/GENERIC-RESOURCE-API path for RFC8040 conformance remove tailing '/' enable csit tests for GENERIC-RESOURCE-API Issue-ID: SDNC-1812 Signed-off-by: demskeq8 Change-Id: Ie6a82d18973b6e58fa20c1284640baed69eb577e --- csit/plans/sdnc/setup.sh | 4 +- csit/prepare-csit.sh | 2 +- csit/run-csit.sh | 7 +- csit/sdnc-csit-robot.env | 5 ++ csit/sdnc-csit.env | 3 + csit/tests/sdnc/resources/sdnc-keywords.robot | 6 +- csit/tests/sdnc/resources/sdnc-properties.robot | 18 ++--- csit/tests/sdnc/sdnc_csit.robot | 93 +++++++++++-------------- 8 files changed, 68 insertions(+), 70 deletions(-) create mode 100755 csit/sdnc-csit-robot.env diff --git a/csit/plans/sdnc/setup.sh b/csit/plans/sdnc/setup.sh index 91783582..3212f981 100644 --- a/csit/plans/sdnc/setup.sh +++ b/csit/plans/sdnc/setup.sh @@ -39,8 +39,10 @@ mkdir ${WORKSPACE}/archives/pnf-simulator git clone "https://gerrit.onap.org/r/integration/simulators/pnf-simulator" ${WORKSPACE}/archives/pnf-simulator # Fix docker-compose to add nexus repo for onap dockers +PNF_SIM_REGISTRY=nexus3.onap.org:10001 +PNF_SIM_VERSION=1.0.5 mv ${WORKSPACE}/archives/pnf-simulator/netconfsimulator/docker-compose.yml ${WORKSPACE}/archives/pnf-simulator/netconfsimulator/docker-compose.yml.orig -cat ${WORKSPACE}/archives/pnf-simulator/netconfsimulator/docker-compose.yml.orig | sed -e "s/image: onap/image: nexus3.onap.org:10001\/onap/" > ${WORKSPACE}/archives/pnf-simulator/netconfsimulator/docker-compose.yml +cat ${WORKSPACE}/archives/pnf-simulator/netconfsimulator/docker-compose.yml.orig | sed -re "s/image: onap\/org.onap.integration.simulators.(.*$)/image: $PNF_SIM_REGISTRY\/onap\/org.onap.integration.simulators.\1:$PNF_SIM_VERSION/" > ${WORKSPACE}/archives/pnf-simulator/netconfsimulator/docker-compose.yml # Remove carriage returns (if any) from netopeer start script mv ${WORKSPACE}/archives/pnf-simulator/netconfsimulator/netconf/initialize_netopeer.sh ${WORKSPACE}/archives/pnf-simulator/netconfsimulator/netconf/initialize_netopeer.sh.orig diff --git a/csit/prepare-csit.sh b/csit/prepare-csit.sh index dc59c58f..550a0233 100755 --- a/csit/prepare-csit.sh +++ b/csit/prepare-csit.sh @@ -43,7 +43,7 @@ fi # install eteutils mkdir -p ${ROBOT_VENV}/src/onap rm -rf ${ROBOT_VENV}/src/onap/testsuite -pip install --upgrade --extra-index-url="https://nexus3.onap.org/repository/PyPi.staging/simple" 'robotframework-onap==0.5.1.*' --pre +#pip install --upgrade --extra-index-url="https://nexus3.onap.org/repository/PyPi.staging/simple" 'robotframework-onap==0.5.1.*' --pre pip freeze diff --git a/csit/run-csit.sh b/csit/run-csit.sh index 31b8e29f..ba3fb9a9 100755 --- a/csit/run-csit.sh +++ b/csit/run-csit.sh @@ -157,10 +157,8 @@ source_safely "${WORKSPACE}/sdnc-csit.env" if [[ -z $ROBOT_IMAGE ]]; then # Run installation of prerequired libraries source_safely "${WORKSPACE}/prepare-csit.sh" - - -# Activate the virtualenv containing all the required libraries installed by prepare-csit.sh -source_safely "${ROBOT_VENV}/bin/activate" + # Activate the virtualenv containing all the required libraries installed by prepare-csit.sh + source_safely "${ROBOT_VENV}/bin/activate" fi WORKDIR=$(mktemp -d --suffix=-robot-workdir) @@ -211,6 +209,7 @@ if [[ -z $SDNC_RELEASE_WITHOUT_ROBOT ]] ; then else echo "*** TRACE **** python is running in a container" docker run --rm --net="host" \ + --env-file ${WORKSPACE}/sdnc-csit-robot.env \ -v ${WORKSPACE}:${WORKSPACE} -v ${WORKDIR}:${WORKDIR} $ROBOT_IMAGE \ python3 -B -m robot.run -N ${TESTPLAN} -v WORKSPACE:/tmp --outputdir ${WORKDIR} ${ROBOT_VARIABLES} ${TESTOPTIONS} ${SUITES} fi diff --git a/csit/sdnc-csit-robot.env b/csit/sdnc-csit-robot.env new file mode 100755 index 00000000..32ea0558 --- /dev/null +++ b/csit/sdnc-csit-robot.env @@ -0,0 +1,5 @@ +WORKSPACE +ODL_PASSWORD +ODL_USER +REQUEST_DATA_PATH +SDNC_CONTAINER_NAME diff --git a/csit/sdnc-csit.env b/csit/sdnc-csit.env index 5f3509d2..cd271f21 100755 --- a/csit/sdnc-csit.env +++ b/csit/sdnc-csit.env @@ -32,3 +32,6 @@ export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort if [ "$MTU" == "" ]; then export MTU="1450" fi +# Define ROBOT_IMAGE to run robot testcases within this container +# skips all robotframework related local python installation +export ROBOT_IMAGE=${ROBOT_IMAGE:-nexus3.onap.org:10001/onap/testsuite:1.12.1} diff --git a/csit/tests/sdnc/resources/sdnc-keywords.robot b/csit/tests/sdnc/resources/sdnc-keywords.robot index 76d11401..8c417bc3 100644 --- a/csit/tests/sdnc/resources/sdnc-keywords.robot +++ b/csit/tests/sdnc/resources/sdnc-keywords.robot @@ -5,7 +5,7 @@ Resource ./sdnc-properties.robot Library Collections Library RequestsLibrary Library OperatingSystem -Library HttpLibrary.HTTP +# Library HttpLibrary.HTTP *** Keywords *** @@ -21,9 +21,7 @@ Send Post File And Validate Response Create SDNC RESTCONF Session ${body}= Get File ${path} &{headers}= Create Dictionary Authorization=Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ== Content-Type=application/json Accept=application/json - ${resp}= POST On Session sdnc_restconf ${url} headers=${headers} data=${body} expected_status=200 - ${respjson}= Parse Json ${resp.content} - Should Be Equal As Strings ${respjson['output']['response-code']} ${resp_code} + ${resp}= POST On Session sdnc_restconf ${url} headers=${headers} data=${body} expected_status=${resp_code} Send Empty Post Request And Validate Response diff --git a/csit/tests/sdnc/resources/sdnc-properties.robot b/csit/tests/sdnc/resources/sdnc-properties.robot index 6be1225d..1480d67e 100644 --- a/csit/tests/sdnc/resources/sdnc-properties.robot +++ b/csit/tests/sdnc/resources/sdnc-properties.robot @@ -7,18 +7,18 @@ ${SDNC_CONTAINER_NAME} %{SDNC_CONTAINER_NAME} ${GRA_DATA_DIRECTORY} %{WORKSPACE}/tests/sdnc/resources/grafiles # ${SDNC_RESTCONF_URL} http://localhost:8282/restconf ${SDNC_RESTCONF_URL} http://localhost:8282/rests -${SDNC_HEALTHCHECK} /operations/SLI-API:healthcheck/ +${SDNC_HEALTHCHECK} /operations/SLI-API:healthcheck # ${SDNC_KEYSTORE_CONFIG_PATH} /config/netconf-keystore:keystore # ${SDNC_NETWORK_TOPOLOGY} /config/network-topology:network-topology # ${SDNC_MOUNT_PATH} /config/network-topology:network-topology/topology/topology-netconf/node/PNFDemo # ${PNFSIM_MOUNT_PATH} /config/network-topology:network-topology/topology/topology-netconf/node/PNFDemo/yang-ext:mount/turing-machine:turing-machine ${SDNC_KEYSTORE_CONFIG_PATH} /data/netconf-keystore:keystore?content=config ${SDNC_NETWORK_TOPOLOGY} /data/network-topology:network-topology?content=config -${SDNC_MOUNT_PATH} /data/network-topology:network-topology/topology/topology-netconf/node/PNFDemo?content=config -${PNFSIM_MOUNT_PATH} /data/network-topology:network-topology/topology/topology-netconf/node/PNFDemo/yang-ext:mount/turing-machine:turing-machine?content=config -${GRA_PRELOAD_NETWORK} /operations/GENERIC-RESOURCE-API:preload-network-topology-operation/ -${GRA_PRELOAD_VFMODULE} /operations/GENERIC-RESOURCE-API:preload-vf-module-topology-operation/ -${GRA_SERVICE_TOPOLOGY} /operations/GENERIC-RESOURCE-API:service-topology-operation/ -${GRA_NETWORK_TOPOLOGY} /operations/GENERIC-RESOURCE-API:network-topology-operation/ -${GRA_VNF_TOPOLOGY} /operations/GENERIC-RESOURCE-API:vnf-topology-operation/ -${GRA_VFMODULE_TOPOLOGY} /operations/GENERIC-RESOURCE-API:vf-module-topology-operation/ +${SDNC_MOUNT_PATH} /data/network-topology:network-topology/topology=topology-netconf/node=PNFDemo +${PNFSIM_MOUNT_PATH} /data/network-topology:network-topology/topology=topology-netconf/node=PNFDemo/yang-ext:mount/turing-machine:turing-machine?content=config +${GRA_PRELOAD_NETWORK} /operations/GENERIC-RESOURCE-API:preload-network-topology-operation +${GRA_PRELOAD_VFMODULE} /operations/GENERIC-RESOURCE-API:preload-vf-module-topology-operation +${GRA_SERVICE_TOPOLOGY} /operations/GENERIC-RESOURCE-API:service-topology-operation +${GRA_NETWORK_TOPOLOGY} /operations/GENERIC-RESOURCE-API:network-topology-operation +${GRA_VNF_TOPOLOGY} /operations/GENERIC-RESOURCE-API:vnf-topology-operation +${GRA_VFMODULE_TOPOLOGY} /operations/GENERIC-RESOURCE-API:vf-module-topology-operation diff --git a/csit/tests/sdnc/sdnc_csit.robot b/csit/tests/sdnc/sdnc_csit.robot index 63a1c126..6b49b0f7 100644 --- a/csit/tests/sdnc/sdnc_csit.robot +++ b/csit/tests/sdnc/sdnc_csit.robot @@ -26,57 +26,48 @@ Check SDNC NETCONF/TLS Connection to PNF Simulator Check Dropping NETCONF/TLS Connection [Tags] SDNC-PNFSIM-TLS-DISCONNECT-CHECK [Documentation] Checking PNF Simulator Mount Delete from SDNC - Send Delete Request And Validate PNF Mount Deleted ${SDNC_MOUNT_PATH} 200 - -#Load network preload data -# [Tags] SDNC-GRA-PRELOAD-NETWORK -# [Documentation] Loading network preload data -# Send Post File And Validate Response ${GRA_PRELOAD_NETWORK} ${GRA_DATA_DIRECTORY}/preload-network.json 200 - -#Load vf-module preload data -# [Tags] SDNC-GRA-PRELOAD-VF-MODULE -# [Documentation] Loading vf-module preload data -# Send Post File And Validate Response ${GRA_PRELOAD_VFMODULE} ${GRA_DATA_DIRECTORY}/preload-vf-module.json 200 - -#Check GRA service assign -# [Tags] SDNC-GRA-SERVICE-ASSIGN -# [Documentation] Testing GRA service assign -# Send Post File And Validate Response ${GRA_SERVICE_TOPOLOGY} ${GRA_DATA_DIRECTORY}/svc-topology-assign.json 200 - -#Check GRA network assign -# [Tags] SDNC-GRA-NETWORK-ASSIGN -# [Documentation] Testing GRA network assign -# Send Post File And Validate Response ${GRA_NETWORK_TOPOLOGY} ${GRA_DATA_DIRECTORY}/network-topology-assign.json 200 - -#Check GRA vnf assign -# [Tags] SDNC-GRA-VNF-ASSIGN -# [Documentation] Testing GRA vnf assign -# Send Post File And Validate Response ${GRA_VNF_TOPOLOGY} ${GRA_DATA_DIRECTORY}/vnf-topology-assign.json 200 - -#Check GRA vf-module assign -# [Tags] SDNC-GRA-VF-MODULE-ASSIGN -# [Documentation] Testing GRA vf-module assign -# Send Post File And Validate Response ${GRA_VFMODULE_TOPOLOGY} ${GRA_DATA_DIRECTORY}/vf-module-topology-assign.json 200 - -#Check GRA vf-module unassign -# [Tags] SDNC-GRA-VF-MODULE-UNASSIGN -# [Documentation] Testing GRA vf-module unassign -# Send Post File And Validate Response ${GRA_VFMODULE_TOPOLOGY} ${GRA_DATA_DIRECTORY}/vf-module-topology-unassign.json 200 - -#Check GRA vnf unassign -# [Tags] SDNC-GRA-VNF-UNASSIGN -# [Documentation] Testing GRA vnf unassign -# Send Post File And Validate Response ${GRA_VNF_TOPOLOGY} ${GRA_DATA_DIRECTORY}/vnf-topology-unassign.json 200 - -#Check GRA network unassign -# [Tags] SDNC-GRA-NETWORK-UNASSIGN -# [Documentation] Testing GRA network unassign -# Send Post File And Validate Response ${GRA_NETWORK_TOPOLOGY} ${GRA_DATA_DIRECTORY}/network-topology-unassign.json 200 - -#Check GRA service delete -# [Tags] SDNC-GRA-SERVICE-DELETE -# [Documentation] Testing GRA service delete -# Send Post File And Validate Response ${GRA_SERVICE_TOPOLOGY} ${GRA_DATA_DIRECTORY}/svc-topology-delete.json 200 + Send Delete Request And Validate PNF Mount Deleted ${SDNC_MOUNT_PATH} 204 + +Load network preload data + [Tags] SDNC-GRA-PRELOAD-NETWORK + [Documentation] Loading network preload data + Send Post File And Validate Response ${GRA_PRELOAD_NETWORK} ${GRA_DATA_DIRECTORY}/preload-network.json 200 +Load vf-module preload data + [Tags] SDNC-GRA-PRELOAD-VF-MODULE + [Documentation] Loading vf-module preload data + Send Post File And Validate Response ${GRA_PRELOAD_VFMODULE} ${GRA_DATA_DIRECTORY}/preload-vf-module.json 200 +Check GRA service assign + [Tags] SDNC-GRA-SERVICE-ASSIGN + [Documentation] Testing GRA service assign + Send Post File And Validate Response ${GRA_SERVICE_TOPOLOGY} ${GRA_DATA_DIRECTORY}/svc-topology-assign.json 200 +Check GRA network assign + [Tags] SDNC-GRA-NETWORK-ASSIGN + [Documentation] Testing GRA network assign + Send Post File And Validate Response ${GRA_NETWORK_TOPOLOGY} ${GRA_DATA_DIRECTORY}/network-topology-assign.json 200 +Check GRA vnf assign + [Tags] SDNC-GRA-VNF-ASSIGN + [Documentation] Testing GRA vnf assign + Send Post File And Validate Response ${GRA_VNF_TOPOLOGY} ${GRA_DATA_DIRECTORY}/vnf-topology-assign.json 200 +Check GRA vf-module assign + [Tags] SDNC-GRA-VF-MODULE-ASSIGN + [Documentation] Testing GRA vf-module assign + Send Post File And Validate Response ${GRA_VFMODULE_TOPOLOGY} ${GRA_DATA_DIRECTORY}/vf-module-topology-assign.json 200 +Check GRA vf-module unassign + [Tags] SDNC-GRA-VF-MODULE-UNASSIGN + [Documentation] Testing GRA vf-module unassign + Send Post File And Validate Response ${GRA_VFMODULE_TOPOLOGY} ${GRA_DATA_DIRECTORY}/vf-module-topology-unassign.json 200 +Check GRA vnf unassign + [Tags] SDNC-GRA-VNF-UNASSIGN + [Documentation] Testing GRA vnf unassign + Send Post File And Validate Response ${GRA_VNF_TOPOLOGY} ${GRA_DATA_DIRECTORY}/vnf-topology-unassign.json 200 +Check GRA network unassign + [Tags] SDNC-GRA-NETWORK-UNASSIGN + [Documentation] Testing GRA network unassign + Send Post File And Validate Response ${GRA_NETWORK_TOPOLOGY} ${GRA_DATA_DIRECTORY}/network-topology-unassign.json 200 +Check GRA service delete + [Tags] SDNC-GRA-SERVICE-DELETE + [Documentation] Testing GRA service delete + Send Post File And Validate Response ${GRA_SERVICE_TOPOLOGY} ${GRA_DATA_DIRECTORY}/svc-topology-delete.json 200 -- 2.16.6