diff options
85 files changed, 2223 insertions, 162 deletions
@@ -22,5 +22,6 @@ env.properties .DS_Store .idea *.iml +*.pyc /bin/ diff --git a/plans/dcaegen2-collectors-hv-ves/testsuites/collector/configuration/insecure.json b/plans/dcaegen2-collectors-hv-ves/testsuites/collector/configuration/insecure.json index 3df8e6e8..357824dd 100644 --- a/plans/dcaegen2-collectors-hv-ves/testsuites/collector/configuration/insecure.json +++ b/plans/dcaegen2-collectors-hv-ves/testsuites/collector/configuration/insecure.json @@ -1,15 +1,9 @@ { - "server": { - "listenPort": 6061, - "idleTimeoutSec": 60, - "maxPayloadSizeBytes": 1048576 - }, - "cbs": { - "firstRequestDelaySec": 5, - "requestIntervalSec": 10 - }, - "security": { - "sslDisable": true - }, - "logLevel": "DEBUG" + "logLevel": "DEBUG", + "server.listenPort": 6061, + "server.idleTimeoutSec": 60, + "server.maxPayloadSizeBytes": 1048576, + "cbs.firstRequestDelaySec": 3, + "cbs.requestIntervalSec": 5, + "security.sslDisable": true }
\ No newline at end of file diff --git a/plans/dcaegen2-collectors-hv-ves/testsuites/collector/configuration/secure.json b/plans/dcaegen2-collectors-hv-ves/testsuites/collector/configuration/secure.json index 60ac2366..2c2610a0 100644 --- a/plans/dcaegen2-collectors-hv-ves/testsuites/collector/configuration/secure.json +++ b/plans/dcaegen2-collectors-hv-ves/testsuites/collector/configuration/secure.json @@ -1,21 +1,12 @@ { - "server": { - "listenPort": 6061, - "idleTimeoutSec": 60, - "maxPayloadSizeBytes": 1048576 - }, - "cbs": { - "firstRequestDelaySec": 5, - "requestIntervalSec": 10 - }, - "security": { - "sslDisable": false, - "keys": { - "keyStoreFile": "/etc/hv-ves/ssl/server.p12", - "keyStorePassword": "onaponap", - "trustStoreFile": "/etc/hv-ves/ssl/trust.p12", - "trustStorePassword": "onaponap" - } - }, - "logLevel": "DEBUG" + "logLevel": "DEBUG", + "server.listenPort": 6061, + "server.idleTimeoutSec": 60, + "server.maxPayloadSizeBytes": 1048576, + "cbs.firstRequestDelaySec": 3, + "cbs.requestIntervalSec": 5, + "security.keys.keyStoreFile": "/etc/hv-ves/ssl/server.p12", + "security.keys.keyStorePassword": "onaponap", + "security.keys.trustStoreFile": "/etc/hv-ves/ssl/trust.p12", + "security.keys.trustStorePassword": "onaponap" }
\ No newline at end of file diff --git a/plans/dcaegen2-collectors-hv-ves/testsuites/env.sh b/plans/dcaegen2-collectors-hv-ves/testsuites/env.sh index bbb54932..a5a0a4f0 100755 --- a/plans/dcaegen2-collectors-hv-ves/testsuites/env.sh +++ b/plans/dcaegen2-collectors-hv-ves/testsuites/env.sh @@ -33,7 +33,7 @@ export UNENCRYPTED_HV_VES_SERVICE_NAME="unencrypted-hv-ves-collector" export HV_VES_GROUP_ID="org.onap.dcaegen2.collectors.hv-ves" export HV_VES_HOSTNAME="dcae-hv-ves-collector" export HV_VES_COLLECTOR_NAMESPACE="onap" -export HV_VES_HEALTHCHECK_CMD=$(curl --request GET --fail --silent --show-error localhost:6060/health/ready && nc -vz localhost 6061) +export HV_VES_HEALTHCHECK_CMD="curl --request GET --fail --silent --show-error localhost:6060/health/ready && nc -vz localhost 6061" export HV_VES_VERSION="1.1-SNAPSHOT" export HV_VES_IMAGE="hv-collector-main" export DCAE_APP_SIMULATOR_IMAGE="hv-collector-dcae-app-simulator" diff --git a/plans/dcaegen2-collectors-hv-ves/testsuites/env_local.sh b/plans/dcaegen2-collectors-hv-ves/testsuites/env_local.sh index afe8a542..280f0c47 100755 --- a/plans/dcaegen2-collectors-hv-ves/testsuites/env_local.sh +++ b/plans/dcaegen2-collectors-hv-ves/testsuites/env_local.sh @@ -33,11 +33,9 @@ export UNENCRYPTED_HV_VES_SERVICE_NAME="unencrypted-hv-ves-collector" export HV_VES_GROUP_ID="org.onap.dcaegen2.collectors.hv-ves" export HV_VES_HOSTNAME="dcae-hv-ves-collector" export HV_VES_COLLECTOR_NAMESPACE="onap" -export HV_VES_HEALTHCHECK_CMD=$(curl --request GET --fail --silent --show-error localhost:6060/health/ready && nc -vz localhost 6061) +export HV_VES_HEALTHCHECK_CMD="curl --request GET --fail --silent --show-error localhost:6060/health/ready && nc -vz localhost 6061" export HV_VES_VERSION="latest" export HV_VES_IMAGE="hv-collector-main" export DCAE_APP_SIMULATOR_IMAGE="hv-collector-dcae-app-simulator" export XNF_SIMULATOR_IMAGE="hv-ves-collector-xnf-simulator" - - diff --git a/plans/dcaegen2-collectors-hv-ves/testsuites/setup.sh b/plans/dcaegen2-collectors-hv-ves/testsuites/setup.sh index 06eaf543..73fdbc23 100755 --- a/plans/dcaegen2-collectors-hv-ves/testsuites/setup.sh +++ b/plans/dcaegen2-collectors-hv-ves/testsuites/setup.sh @@ -21,14 +21,15 @@ set -euo pipefail RUN_CSIT_LOCAL=${RUN_CSIT_LOCAL:-false} +echo "Replacing obsolete 'docker-py' with 'docker' package" +pip uninstall -y docker-py +pip install docker + if ${RUN_CSIT_LOCAL} ; then - echo "Building locally - assuming all dependencies are installed" + echo "Local run" source env_local.sh else - echo "Default run - install all dependencies" - pip uninstall -y docker-py - pip install docker - + echo "Default (CI) run" COMPOSE_VERSION=1.23.2 COMPOSE_LOCATION='/usr/local/bin/docker-compose' sudo curl -L https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m) -o ${COMPOSE_LOCATION} diff --git a/plans/dcaegen2-collectors-hv-ves/testsuites/teardown.sh b/plans/dcaegen2-collectors-hv-ves/testsuites/teardown.sh index 787f811e..bed9742c 100755 --- a/plans/dcaegen2-collectors-hv-ves/testsuites/teardown.sh +++ b/plans/dcaegen2-collectors-hv-ves/testsuites/teardown.sh @@ -33,7 +33,15 @@ fi set +e -COMPOSE_LOGS_FILE=${WORKSPACE}/archives/containers_logs/docker-compose.log +METRICS_FILE=${WORKSPACE}/archives/containers_logs/collector-metrics.dump +docker-compose exec hv-ves-collector curl -qs localhost:6060/monitoring/prometheus > ${METRICS_FILE} + +CONTAINER_LOGS=${WORKSPACE}/archives/containers_logs/ +COMPOSE_LOGS_FILE=${CONTAINER_LOGS}/docker-compose.log + +docker-compose logs hv-ves-collector > ${CONTAINER_LOGS}/hv-ves-collector.log +docker-compose logs unencrypted-hv-ves-collector > ${CONTAINER_LOGS}/unencrypted-hv-ves-collector.log +docker-compose logs dcae-app-simulator > ${CONTAINER_LOGS}/dcae-app-simulator.log docker-compose logs > ${COMPOSE_LOGS_FILE} docker-compose down docker-compose rm -f diff --git a/plans/dcaegen2-services-bbs-event-processor/bbs-testsuites/setup.sh b/plans/dcaegen2-services-bbs-event-processor/bbs-testsuites/setup.sh new file mode 100644 index 00000000..9551ce43 --- /dev/null +++ b/plans/dcaegen2-services-bbs-event-processor/bbs-testsuites/setup.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +source ${SCRIPTS}/common_functions.sh + +export BBS_SERVICE="bbs" +# export SSL_BBS_SERVICE="ssl_bbs" +export DMAAP_SIMULATOR="dmaap_simulator" +export AAI_SIMULATOR="aai_simulator" + +cd ${WORKSPACE}/tests/dcaegen2/bbs-testcases/resources/ + +pip uninstall -y docker-py +pip uninstall -y docker +pip install -U docker==2.7.0 +docker-compose up -d --build + +BBS_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${BBS_SERVICE}) +# SSL_BBS_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${SSL_BBS_SERVICE}) +DMAAP_SIMULATOR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${DMAAP_SIMULATOR}) +AAI_SIMULATOR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${AAI_SIMULATOR}) + +bypass_ip_adress ${BBS_IP} +# bypass_ip_adress ${SSL_BBS_IP} +bypass_ip_adress ${DMAAP_SIMULATOR_IP} +bypass_ip_adress ${AAI_SIMULATOR_IP} + +echo BBS_IP=${BBS_IP} +# echo SSL_BBS_IP=${SSL_BBS_IP} +echo DMAAP_SIMULATOR_IP=${DMAAP_SIMULATOR_IP} +echo AAI_SIMULATOR_IP=${AAI_SIMULATOR_IP} + +# Wait for initialization of BBS services +# Same ports in the testcases docker compose +wait_for_service_init localhost:32100/heartbeat +#wait_for_service_init localhost:8200/heartbeat + +# #Pass any variables required by Robot test suites in ROBOT_VARIABLES +ROBOT_VARIABLES="-v DMAAP_SIMULATOR_SETUP:${DMAAP_SIMULATOR_IP}:2224 -v AAI_SIMULATOR_SETUP:${AAI_SIMULATOR_IP}:3335" + diff --git a/plans/dcaegen2-services-bbs-event-processor/bbs-testsuites/teardown.sh b/plans/dcaegen2-services-bbs-event-processor/bbs-testsuites/teardown.sh new file mode 100644 index 00000000..6cc85f54 --- /dev/null +++ b/plans/dcaegen2-services-bbs-event-processor/bbs-testsuites/teardown.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Copyright 2017 Nokia, Inc. and others. +# +# 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. +# + +kill-instance.sh bbs +# kill-instance.sh ssl_bbs +kill-instance.sh dmaap_simulator +kill-instance.sh aai_simulator diff --git a/plans/dcaegen2-services-bbs-event-processor/bbs-testsuites/testplan.txt b/plans/dcaegen2-services-bbs-event-processor/bbs-testsuites/testplan.txt new file mode 100644 index 00000000..9f1794bd --- /dev/null +++ b/plans/dcaegen2-services-bbs-event-processor/bbs-testsuites/testplan.txt @@ -0,0 +1,3 @@ +# Test suites are relative paths under [integration/csit.git]/tests/. +# Place the suites in run order. +dcaegen2/bbs-testcases diff --git a/plans/sdnc/sdnc_netconf_tls_post_deploy/certs/certs.properties b/plans/sdnc/sdnc_netconf_tls_post_deploy/certs/certs.properties new file mode 100644 index 00000000..f8f3fa72 --- /dev/null +++ b/plans/sdnc/sdnc_netconf_tls_post_deploy/certs/certs.properties @@ -0,0 +1,2 @@ +keys0.zip +***** diff --git a/plans/sdnc/sdnc_netconf_tls_post_deploy/certs/keys0.zip b/plans/sdnc/sdnc_netconf_tls_post_deploy/certs/keys0.zip Binary files differnew file mode 100644 index 00000000..48b4d90a --- /dev/null +++ b/plans/sdnc/sdnc_netconf_tls_post_deploy/certs/keys0.zip diff --git a/plans/sdnc/sdnc_netconf_tls_post_deploy/setup.sh b/plans/sdnc/sdnc_netconf_tls_post_deploy/setup.sh new file mode 100644 index 00000000..92470d29 --- /dev/null +++ b/plans/sdnc/sdnc_netconf_tls_post_deploy/setup.sh @@ -0,0 +1,156 @@ +#!/bin/bash +# +# Copyright 2016-2017 Huawei Technologies Co., Ltd. +# +# 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. +# +# Modifications copyright (c) 2017 AT&T Intellectual Property +# +# Place the scripts in run order: +SCRIPTS="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +source ${WORKSPACE}/scripts/sdnc/script1.sh +export DOCKER_SDNC_REPO=darby321 +export DOCKER_SDNC_TAG=testimage1 +export DOCKER_USERNAME=darby321 +export DOCKER_PASSWORD=Darragh1993 +export NEXUS_USERNAME=docker +export NEXUS_PASSWD=docker +export NEXUS_DOCKER_REPO=nexus3.onap.org:10001 +export DMAAP_TOPIC=AUTO +export DOCKER_IMAGE_VERSION=1.5-STAGING-latest +export CCSDK_DOCKER_IMAGE_VERSION=0.4-STAGING-latest + +export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) + +if [ "$MTU" == "" ]; then + export MTU="1450" +fi + +# Clone SDNC repo to get docker-compose for SDNC +mkdir -p $WORKSPACE/archives/integration +cd $WORKSPACE/archives +git clone -b master --single-branch --depth=1 http://gerrit.onap.org/r/integration.git integration +cd $WORKSPACE/archives/integration +git pull +HOST_IP_ADDR=localhost +# Clone SDNC repo to get docker-compose for SDNC +mkdir -p $WORKSPACE/archives/sdnc +cd $WORKSPACE/archives +git clone -b master --single-branch --depth=1 http://gerrit.onap.org/r/sdnc/oam.git sdnc +cd $WORKSPACE/archives/sdnc +git pull +unset http_proxy https_proxy +cd $WORKSPACE/archives/sdnc/installation/src/main/yaml + +docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD $DOCKER_SDNC_REPO +docker pull $DOCKER_SDNC_REPO/sdnc-image:$DOCKER_SDNC_TAG +docker tag $DOCKER_SDNC_REPO/sdnc-image:$DOCKER_SDNC_TAG onap/sdnc-image:latest +docker logout $DOCKER_SDNC_REPO + +sed -i "s/DMAAP_TOPIC_ENV=.*/DMAAP_TOPIC_ENV="AUTO"/g" docker-compose.yml +docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO + +#Docker pull $NEXUS_DOCKER_REPO/onap/sdnc-image:$DOCKER_IMAGE_VERSION +#docker tag $NEXUS_DOCKER_REPO/onap/sdnc-image:$DOCKER_IMAGE_VERSION onap/sdnc-image:latest + +docker pull $NEXUS_DOCKER_REPO/onap/sdnc-ansible-server-image:$DOCKER_IMAGE_VERSION +docker tag $NEXUS_DOCKER_REPO/onap/sdnc-ansible-server-image:$DOCKER_IMAGE_VERSION onap/sdnc-ansible-server-image:latest + +docker pull $NEXUS_DOCKER_REPO/onap/ccsdk-dgbuilder-image:$CCSDK_DOCKER_IMAGE_VERSION +docker tag $NEXUS_DOCKER_REPO/onap/ccsdk-dgbuilder-image:$CCSDK_DOCKER_IMAGE_VERSION onap/ccsdk-dgbuilder-image:latest + +docker pull $NEXUS_DOCKER_REPO/onap/admportal-sdnc-image:$DOCKER_IMAGE_VERSION +docker tag $NEXUS_DOCKER_REPO/onap/admportal-sdnc-image:$DOCKER_IMAGE_VERSION onap/admportal-sdnc-image:latest + +docker pull $NEXUS_DOCKER_REPO/onap/sdnc-ueb-listener-image:$DOCKER_IMAGE_VERSION +docker tag $NEXUS_DOCKER_REPO/onap/sdnc-ueb-listener-image:$DOCKER_IMAGE_VERSION onap/sdnc-ueb-listener-image:latest + +docker pull $NEXUS_DOCKER_REPO/onap/sdnc-dmaap-listener-image:$DOCKER_IMAGE_VERSION + +docker tag $NEXUS_DOCKER_REPO/onap/sdnc-dmaap-listener-image:$DOCKER_IMAGE_VERSION onap/sdnc-dmaap-listener-image:latest + +CERT_SUBPATH=plans/sdnc/sdnc_netconf_tls_post_deploy/certs +export SDNC_CERT_PATH=${WORKSPACE}/${CERT_SUBPATH} +sed -i 's/sdnc_controller_container/sdnc_controller_container\n volumes: \n - $SDNC_CERT_PATH:\/opt\/opendaylight\/current\/certs/' docker-compose.yml +# start SDNC containers with docker compose and configuration from docker-compose.yml +docker-compose up -d + +cd $WORKSPACE/archives/integration/test/mocks/pnfsimulator +./simulator.sh start& + +# WAIT 10 minutes maximum and test every 5 seconds if SDNC is up using HealthCheck API +TIME_OUT=1000 +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://localhost:8282/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 + +export PNF_IP=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+') +sed -i "s/pnfaddr/$PNF_IP/g" $WORKSPACE/tests/sdnc/sdnc_netconf_tls_post_deploy/data/mount.xml + +if [ "$TIME" -ge "$TIME_OUT" ]; then + echo TIME OUT: Docker containers not started in $TIME_OUT seconds... Could cause problems for testing activities... +fi + +#sleep 800 + +TIME_OUT=1500 +INTERVAL=60 +TIME=0 +while [ "$TIME" -lt "$TIME_OUT" ]; do +docker exec sdnc_controller_container rm -f /opt/opendaylight/current/etc/host.key +response=$(docker exec sdnc_controller_container /opt/opendaylight/current/bin/client system:start-level) +docker exec sdnc_controller_container rm -f /opt/opendaylight/current/etc/host.key + + if [ "$response" == "Level 100" ] ; then + echo SDNC karaf 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 + +response=$(docker exec sdnc_controller_container /opt/opendaylight/current/bin/client system:start-level) + + if [ "$response" == "Level 100" ] ; then + num_failed_bundles=$(docker exec sdnc_controller_container /opt/opendaylight/current/bin/client bundle:list | grep Failure | wc -l) + failed_bundles=$(docker exec sdnc_controller_container /opt/opendaylight/current/bin/client bundle:list | grep Failure) + echo There is/are $num_failed_bundles failed bundles out of $num_bundles installed bundles. + fi + +if [ "$num_failed_bundles" -ge 1 ]; then + echo "The following bundle(s) are in a failed state: " + echo " $failed_bundles" +fi + +# Sleep additional 5 minutes (300 secs) to give application time to finish +sleep 200 + +# Pass any variables required by Robot test suites in ROBOT_VARIABLES +ROBOT_VARIABLES="-v SCRIPTS:${SCRIPTS}"
\ No newline at end of file diff --git a/plans/sdnc/sdnc_netconf_tls_post_deploy/teardown.sh b/plans/sdnc/sdnc_netconf_tls_post_deploy/teardown.sh new file mode 100644 index 00000000..97696ace --- /dev/null +++ b/plans/sdnc/sdnc_netconf_tls_post_deploy/teardown.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# +# Copyright 2016-2017 Huawei Technologies Co., Ltd. +# +# 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. +# +# Modifications copyright (c) 2017 AT&T Intellectual Property +# + +kill-instance.sh sdnc_controller_container +kill-instance.sh sdnc_dgbuilder_container +kill-instance.sh sdnc_portal_container +kill-instance.sh sdnc_db_container +kill-instance.sh sdnc_ueblistener_container +kill-instance.sh sdnc_dmaaplistener_container +kill-instance.sh sdnc_ansible_container +kill-instance.sh netopeer +kill-instance.sh sftp-server +kill-instance.sh ftpes-server-vsftpd +kill-instance.sh ftpes-server-pure-ftpd + +# $WORKSPACE/archives/appc deleted with archives folder when tests starts so we keep it at the end for debugging diff --git a/plans/sdnc/sdnc_netconf_tls_post_deploy/testplan.txt b/plans/sdnc/sdnc_netconf_tls_post_deploy/testplan.txt new file mode 100644 index 00000000..a0bffe5c --- /dev/null +++ b/plans/sdnc/sdnc_netconf_tls_post_deploy/testplan.txt @@ -0,0 +1,4 @@ +# Test suites are relative paths under [integration/csit.git]/tests/. +# Place the suites in run order. +sdnc/sdnc_netconf_tls_post_deploy + diff --git a/plans/usecases/5G-bulkpm/composefile/docker-compose-e2e.yml b/plans/usecases/5G-bulkpm/composefile/docker-compose-e2e.yml index f3c47bb2..4f6c4da6 100644 --- a/plans/usecases/5G-bulkpm/composefile/docker-compose-e2e.yml +++ b/plans/usecases/5G-bulkpm/composefile/docker-compose-e2e.yml @@ -20,6 +20,8 @@ services: interval: 10s timeout: 10s retries: 5 + extra_hosts: + - "dmaap-dr-node:1.1.1.1" datarouter-node: image: nexus3.onap.org:10001/onap/dmaap/datarouter-node:2.0.2-SNAPSHOT-latest @@ -33,6 +35,8 @@ services: depends_on: datarouter-prov: condition: service_healthy + extra_hosts: + - "dmaap-dr-prov:2.2.2.2" datarouter-subscriber: image: nexus3.onap.org:10001/onap/dmaap/datarouter-subscriber:2.0.2-SNAPSHOT-latest @@ -90,18 +94,4 @@ services: container_name: cbs image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.platform.configbinding.app-app:latest environment: - CONSUL_HOST: - - buscontroller: - container_name: buscontroller - image: nexus3.onap.org:10001/onap/dmaap/dmaap-bc:latest - ports: - - "18080:8080" - - "18443:8443" - extra_hosts: - - "dmaap-dr-prov:DMAAPDR" - - "message-router:DMAAPMR" - volumes: - - /tmp/docker-databus-controller.conf:/opt/app/config/conf - depends_on: - - datarouter-prov + CONSUL_HOST:
\ No newline at end of file diff --git a/plans/usecases/5G-bulkpm/setup.sh b/plans/usecases/5G-bulkpm/setup.sh index 3d3a9ef5..5d99b1c1 100644 --- a/plans/usecases/5G-bulkpm/setup.sh +++ b/plans/usecases/5G-bulkpm/setup.sh @@ -76,10 +76,9 @@ sed -i 's/DMAAPMR/'$DMAAP_MR_IP'/g' /tmp/docker-databus-controller.conf docker login -u docker -p docker nexus3.onap.org:10001 docker-compose up -d echo "Disregard the message ERROR: for datarouter-node Container 1234456 is unhealthy, this is expected behaiour at this stage" -docker kill datarouter-prov -docker kill datarouter-node docker kill vescollector docker kill cbs +sleep 10 CONSUL_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' consul ) sed -i -e '/CONSUL_HOST:/ s/:.*/: '$CONSUL_IP'/' docker-compose.yml HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}') @@ -87,6 +86,23 @@ sed -i -e '/DMAAPHOST:/ s/:.*/: '$HOST_IP'/' docker-compose.yml MARIADB=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mariadb ) sed -i 's/datarouter-mariadb/'$MARIADB'/g' $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources/prov_data/provserver.properties docker-compose up -d +sleep 5 +# Get IP address of datarrouger-prov, datarouter-node, fileconsumer-node. +DR_PROV_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-prov) +DR_NODE_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-node) +DR_SUBSCIBER_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' fileconsumer-node) +DR_GATEWAY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' datarouter-prov) + +echo DR_PROV_IP=${DR_PROV_IP} +echo DR_NODE_IP=${DR_NODE_IP} +echo DR_GATEWAY_IP=${DR_GATEWAY_IP} +echo DR_SUBSCIBER_IP=${DR_SUBSCIBER_IP} + +docker kill datarouter-node +docker kill datarouter-prov +sed -i 's/1.1.1.1/'$DR_NODE_IP'/g' docker-compose.yml +sed -i 's/2.2.2.2/'$DR_PROV_IP'/g' docker-compose.yml +docker-compose up -d # Wait for initialization of Docker container for datarouter-node, datarouter-prov and mariadb for i in {1..10}; do @@ -103,23 +119,12 @@ for i in {1..10}; do done sleep 5 -# Get IP address of datarrouger-prov, datarouter-node, fileconsumer-node. -DR_PROV_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-prov) -DR_NODE_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-node) -DR_SUBSCIBER_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' fileconsumer-node) -DR_GATEWAY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' datarouter-prov) - -echo DR_PROV_IP=${DR_PROV_IP} -echo DR_NODE_IP=${DR_NODE_IP} -echo DR_GATEWAY_IP=${DR_GATEWAY_IP} -echo DR_SUBSCIBER_IP=${DR_SUBSCIBER_IP} docker exec -i datarouter-prov sh -c "curl -k -X PUT https://$DR_PROV_IP:8443/internal/api/NODES?val=dmaap-dr-node\|$DR_GATEWAY_IP" docker exec -i datarouter-prov sh -c "curl -k -X PUT https://$DR_PROV_IP:8443/internal/api/PROV_AUTH_ADDRESSES?val=dmaap-dr-prov\|$DR_GATEWAY_IP" -docker exec datarouter-prov /bin/sh -c "echo '${DR_NODE_IP}' dmaap-dr-node >> /etc/hosts" -docker exec datarouter-node /bin/sh -c "echo '${DR_PROV_IP}' dmaap-dr-prov >> /etc/hosts" docker exec datarouter-node /bin/sh -c "echo '${DR_SUBSCIBER_IP}' dmaap-dr-subscriber >> /etc/hosts" + # Get IP address of DMAAP, KAFKA, Zookeeper DMAAP_MR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $DMAAP) KAFKA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $KAFKA) @@ -131,11 +136,6 @@ export VESC_IP=${VESC_IP} export HOST_IP=${HOST_IP} export DMAAP_MR_IP=${DMAAP_MR_IP} -docker kill buscontroller -sed -i 's/DMAAPDR/'$DR_PROV_IP'/g' docker-compose.yml -sed -i 's/DMAAPMR/'$DMAAP_MR_IP'/g' docker-compose.yml -docker-compose up -d -sed -i 's/DMAAPDR/'$DR_PROV_IP'/g' /tmp/docker-databus-controller.conf # Data File Collector configuration : sed -i 's/DR_NODE_IP/'$DR_NODE_IP'/g' docker-compose.yml @@ -156,13 +156,12 @@ docker exec dfc /bin/sh -c " sed -i 's/org.onap.dcaegen2.collectors.datafile: WA docker restart dfc sleep 2 -# Wait for initialization of Docker container for datarouter-node, datarouter-prov and mariadb, Consul, CBS, Buscontroller +# Wait for initialization of Docker container for datarouter-node, datarouter-prov and mariadb, Consul, CBS for i in {1..10}; do if [ $(docker inspect --format '{{ .State.Running }}' consul) ] && \ - [ $(docker inspect --format '{{ .State.Running }}' cbs) ] && \ - [ $(docker inspect --format '{{ .State.Running }}' buscontroller) ] + [ $(docker inspect --format '{{ .State.Running }}' cbs) ] then - echo "Data Router, Consul, Config Binding Service, Buscontroller Services Running" + echo "Data Router, Consul, Config Binding Service Services Running" break else echo sleep $i diff --git a/plans/usecases/5G-bulkpm/teardown.sh b/plans/usecases/5G-bulkpm/teardown.sh index 7a99941b..78de7594 100644 --- a/plans/usecases/5G-bulkpm/teardown.sh +++ b/plans/usecases/5G-bulkpm/teardown.sh @@ -15,5 +15,4 @@ kill-instance.sh mariadb kill-instance.sh dfc kill-instance.sh sftp kill-instance.sh cbs -kill-instance.sh consul -kill-instance.sh buscontroller
\ No newline at end of file +kill-instance.sh consul
\ No newline at end of file diff --git a/plans/vfc-gvnfm-vnflcm/sanity-check/teardown.sh b/plans/vfc-gvnfm-vnflcm/sanity-check/teardown.sh index aebb2523..8d503507 100755 --- a/plans/vfc-gvnfm-vnflcm/sanity-check/teardown.sh +++ b/plans/vfc-gvnfm-vnflcm/sanity-check/teardown.sh @@ -15,6 +15,10 @@ # limitations under the License. # +# print log for vfc-vnflcm +docker cp vfc-vnflcm:/service/vfc/gvnfm/vnflcm/lcm/logs/runtime_lcm.log ./ +cat runtime_lcm.log + # This script is sourced by run-csit.sh after Robot test completion. kill-instance.sh msb_internal_apigateway kill-instance.sh msb_discovery diff --git a/plans/vfc-gvnfm-vnfmgr/sanity-check/setup.sh b/plans/vfc-gvnfm-vnfmgr/sanity-check/setup.sh new file mode 100755 index 00000000..0c4efcc1 --- /dev/null +++ b/plans/vfc-gvnfm-vnfmgr/sanity-check/setup.sh @@ -0,0 +1,67 @@ +#!/bin/bash +# +# Copyright 2019 ZTE Corporation. +# +# 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. +# +# Place the scripts in run order: +# Start all process required for executing test case + +source ${SCRIPTS}/common_functions.sh + + +#start msb +docker run -d -p 8500:8500 --name msb_consul consul:0.9.3 +MSB_CONSUL_IP=`get-instance-ip.sh msb_consul` +echo MSB_CONSUL_IP=${MSB_CONSUL_IP} +docker run -d -p 10081:10081 -e CONSUL_IP=$MSB_CONSUL_IP --name msb_discovery nexus3.onap.org:10001/onap/msb/msb_discovery +MSB_DISCOVERY_IP=`get-instance-ip.sh msb_discovery` +echo MSB_DISCOVERY_IP=${MSB_DISCOVERY_IP} +docker run -d -p 80:80 -e CONSUL_IP=$MSB_CONSUL_IP -e SDCLIENT_IP=$MSB_DISCOVERY_IP -e "ROUTE_LABELS=visualRange:1" --name msb_internal_apigateway nexus3.onap.org:10001/onap/msb/msb_apigateway +MSB_IAG_IP=`get-instance-ip.sh msb_internal_apigateway` +echo MSB_IAG_IP=${MSB_IAG_IP} + +docker run -d -p 3306:3306 --name vfc-db nexus3.onap.org:10001/onap/vfc/db +VFC_DB_IP=`get-instance-ip.sh vfc-db` +echo VFC_DB_IP=${VFC_DB_IP} + +# Wait for initialization(8500 Consul, 10081 Service Registration & Discovery, 80 api gateway) +for i in {1..10}; do + curl -sS -m 1 ${MSB_CONSUL_IP}:8500 && curl -sS -m 1 ${MSB_DISCOVERY_IP}:10081 && curl -sS -m 1 ${MSB_IAG_IP}:80 && break + echo sleep $i + sleep $i +done + +# Wait for initialization(3306 DB) +for i in {1..3}; do + curl -sS -m 1 ${VFC_DB_IP}:3306 && break + echo sleep $i + sleep $i +done + +# wait for container initalization +echo sleep 60 +sleep 60 +# start vfc-vnfres +docker run -d --name vfc-vnfmgr -e MSB_ADDR=${MSB_IAG_IP}:80 -e MYSQL_ADDR=${VFC_DB_IP}:3306 nexus3.onap.org:10001/onap/vfc/vnfmgr +VNFMGR_IP=`get-instance-ip.sh vfc-vnfmgr` + +# Wait for initialization +for i in {1..10}; do + curl -sS ${VNFMGR_IP}:8803 && break + echo sleep $i + sleep $i +done + +# Pass any variables required by Robot test suites in ROBOT_VARIABLES +ROBOT_VARIABLES="-v MSB_IAG_IP:${MSB_IAG_IP} -v VNFMGR_IP:${VNFMGR_IP} -v SCRIPTS:${SCRIPTS}" diff --git a/plans/vfc-gvnfm-vnfmgr/sanity-check/teardown.sh b/plans/vfc-gvnfm-vnfmgr/sanity-check/teardown.sh new file mode 100755 index 00000000..09db55b5 --- /dev/null +++ b/plans/vfc-gvnfm-vnfmgr/sanity-check/teardown.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# +# Copyright 2017 ZTE Corporation. +# +# 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. +# + +# This script is sourced by run-csit.sh after Robot test completion. +kill-instance.sh msb_internal_apigateway +kill-instance.sh msb_discovery +kill-instance.sh msb_consul +kill-instance.sh vfc-db +kill-instance.sh vfc-vnfres diff --git a/plans/vfc-gvnfm-vnfmgr/sanity-check/testplan.txt b/plans/vfc-gvnfm-vnfmgr/sanity-check/testplan.txt new file mode 100644 index 00000000..ac51e674 --- /dev/null +++ b/plans/vfc-gvnfm-vnfmgr/sanity-check/testplan.txt @@ -0,0 +1,3 @@ +# Test suites are relative paths under [integration/csit.git]/tests/. +# Place the suites in run order. +vfc/gvnfm-vnfres/test.robot diff --git a/scripts/dmaap-buscontroller/dmaapbc-launch.sh b/scripts/dmaap-buscontroller/dmaapbc-launch.sh index 079b6644..0a653fa1 100755 --- a/scripts/dmaap-buscontroller/dmaapbc-launch.sh +++ b/scripts/dmaap-buscontroller/dmaapbc-launch.sh @@ -24,6 +24,9 @@ function dmaapbc_launch() { docker run -d $ADDHOSTS --name $CONTAINER_NAME -v $TMP_CFG:/opt/app/config/conf $TAG IP=`get-instance-ip.sh ${CONTAINER_NAME}` + source ${SCRIPTS}/common_functions.sh + bypass_ip_adress ${IP} + # Wait for initialization for i in {1..10}; do curl -sS ${IP}:8080 && break diff --git a/scripts/dmaap-buscontroller/start-mock.sh b/scripts/dmaap-buscontroller/start-mock.sh index d50125a4..cd986061 100755 --- a/scripts/dmaap-buscontroller/start-mock.sh +++ b/scripts/dmaap-buscontroller/start-mock.sh @@ -31,6 +31,9 @@ function start_mock() { docker run --name ${app}-mock -d jamesdbloom/mockserver /opt/mockserver/run_mockserver.sh -logLevel INFO -serverPort ${port} -proxyPort 1090 IP=`get-instance-ip.sh ${app}-mock` + source ${SCRIPTS}/common_functions.sh + bypass_ip_adress ${IP} + # Wait for initialization for i in {1..10}; do curl -sS ${IP}:${port} && break diff --git a/scripts/dmaap-message-router/dmaap-mr-launch.sh b/scripts/dmaap-message-router/dmaap-mr-launch.sh index e7ea9a97..4fef6821 100755 --- a/scripts/dmaap-message-router/dmaap-mr-launch.sh +++ b/scripts/dmaap-message-router/dmaap-mr-launch.sh @@ -116,6 +116,11 @@ function dmaap_mr_launch() { echo KAFKA_IP=${KAFKA_IP} echo ZOOKEEPER_IP=${ZOOKEEPER_IP} + source ${SCRIPTS}/common_functions.sh + bypass_ip_adress ${DMAAP_MR_IP} + bypass_ip_adress ${KAFKA_IP} + bypass_ip_adress ${ZOOKEEPER_IP} + # Wait for initialization of docker services for i in {1..50}; do curl -sS -m 1 ${DMAAP_MR_IP}:3904/events/TestTopic && break diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/libraries/KafkaLibrary.py b/tests/dcaegen2-collectors-hv-ves/testcases/libraries/KafkaLibrary.py new file mode 100644 index 00000000..e262ff01 --- /dev/null +++ b/tests/dcaegen2-collectors-hv-ves/testcases/libraries/KafkaLibrary.py @@ -0,0 +1,61 @@ +# ============LICENSE_START==================================== +# csit-dcaegen2-collectors-hv-ves +# ========================================================= +# Copyright (C) 2019 Nokia. All rights reserved. +# ========================================================= +# 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===================================== + +import docker +from robot.api import logger + +KAFKA_IMAGE_FULL_NAME = "wurstmeister/kafka" +KAFKA_ADDRESS = "kafka:9092" +ZOOKEEPER_ADDRESS = "zookeeper:2181" + +LIST_TOPICS_COMMAND = "kafka-topics.sh --list --zookeeper %s" % ZOOKEEPER_ADDRESS +TOPIC_STATUS_COMMAND = "kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list " + KAFKA_ADDRESS + " --topic %s --time -1" +DELETE_TOPIC_COMMAND = "kafka-topics.sh --zookeeper " + ZOOKEEPER_ADDRESS + " --delete --topic %s" + + +class KafkaLibrary: + + def log_kafka_status(self): + dockerClient = docker.from_env() + kafka = dockerClient.containers.list(filters={"ancestor": KAFKA_IMAGE_FULL_NAME}, all=True)[0] + + topics = self.get_topics(kafka) + logger.info("Topics initialized in Kafka cluster: " + str(topics)) + for topic in topics: + if topic == "__consumer_offsets": + # kafka-internal topic, ignore it + continue + + self.log_topic_status(kafka, topic) + self.reset_topic(kafka, topic) + + dockerClient.close() + + def get_topics(self, kafka): + exitCode, output = kafka.exec_run(LIST_TOPICS_COMMAND) + return output.splitlines() + + def log_topic_status(self, kafka, topic): + _, topic_status = kafka.exec_run(TOPIC_STATUS_COMMAND % topic) + logger.info("Messages on topic: " + str(topic_status)) + + def reset_topic(self, kafka, topic): + logger.info("Removing topic " + str( + topic) + " (note that it will be recreated by dcae-app-simulator/hv-ves-collector, however the offset will be reseted)") + _, output = kafka.exec_run(DELETE_TOPIC_COMMAND % topic) + logger.info(str(output)) diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/message-routing.robot b/tests/dcaegen2-collectors-hv-ves/testcases/message-routing.robot index 2fab3295..985c3793 100644 --- a/tests/dcaegen2-collectors-hv-ves/testcases/message-routing.robot +++ b/tests/dcaegen2-collectors-hv-ves/testcases/message-routing.robot @@ -31,8 +31,7 @@ Test Teardown VES-HV Collector Test Shutdown *** Keywords *** Message Routing Suite Setup Log Started Suite: VES-HV Message Routing - ${XNF_PORTS_LIST}= Create List 7000 - Configure xNF Simulators Using Valid Certificates On Ports ${XNF_PORTS_LIST} + Configure Single xNF Simulator Log Suite setup finished *** Test Cases *** @@ -40,7 +39,6 @@ Correct Messages Routing [Documentation] VES-HV Collector should route all valid messages to topics specified in configuration ... and do not change message payload generated in XNF simulator - ${XNF_SIMULATOR}= Get xNF Simulators Using Valid Certificates Send Messages From xNF Simulators ${XNF_SIMULATOR} ${XNF_FIXED_PAYLOAD_REQUEST} Wait until keyword succeeds 60 sec 5 sec @@ -51,7 +49,6 @@ Correct Messages Routing Too big payload message handling [Documentation] VES-HV Collector should interrupt the stream when encountered message with too big payload - ${XNF_SIMULATOR}= Get xNF Simulators Using Valid Certificates Send Messages From xNF Simulators ${XNF_SIMULATOR} ${XNF_TOO_BIG_PAYLOAD_REQUEST} Wait until keyword succeeds 60 sec 5 sec @@ -62,7 +59,6 @@ Too big payload message handling Invalid wire frame message handling [Documentation] VES-HV Collector should skip messages with invalid wire frame - ${XNF_SIMULATOR}= Get xNF Simulators Using Valid Certificates Send Messages From xNF Simulators ${XNF_SIMULATOR} ${XNF_INVALID_WIRE_FRAME_REQUEST} Wait until keyword succeeds 60 sec 5 sec @@ -73,7 +69,6 @@ Invalid wire frame message handling Invalid GPB data message handling [Documentation] VES-HV Collector should skip messages with invalid GPB data - ${XNF_SIMULATOR}= Get xNF Simulators Using Valid Certificates Send Messages From xNF Simulators ${XNF_SIMULATOR} ${XNF_INVALID_GPB_DATA_REQUEST} Wait until keyword succeeds 60 sec 5 sec @@ -84,7 +79,6 @@ Invalid GPB data message handling Unsupported domain message handling [Documentation] VES-HV Collector should skip messages with unsupported domain - ${XNF_SIMULATOR}= Get xNF Simulators Using Valid Certificates Send Messages From xNF Simulators ${XNF_SIMULATOR} ${XNF_UNSUPPORTED_DOMAIN_REQUEST} Wait until keyword succeeds 60 sec 5 sec diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot b/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot index 3a37c9b0..07e886a0 100644 --- a/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot +++ b/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot @@ -1,7 +1,7 @@ # ============LICENSE_START======================================================= # csit-dcaegen2-collectors-hv-ves # ================================================================================ -# Copyright (C) 2018 NOKIA +# Copyright (C) 2018-2019 NOKIA # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,9 +19,16 @@ *** Settings *** Library XnfSimulatorLibrary Library VesHvContainersUtilsLibrary +Library KafkaLibrary Library Collections *** Keywords *** +Configure Single xNF Simulator + ${XNF_PORTS_LIST}= Create List 7000 + ${XNF_SIMULATORS_ADDRESSES}= Configure xNF Simulators ${XNF_PORTS_LIST} + ${XNF_SIMULATOR}= Get Slice From List ${XNF_SIMULATORS_ADDRESSES} 0 1 + Set Suite Variable ${XNF_SIMULATOR} + Configure xNF Simulators Using Valid Certificates On Ports [Arguments] ${XNF_PORTS_LIST} ${VALID_XNF_SIMULATORS_ADDRESSES}= Configure xNF Simulators ${XNF_PORTS_LIST} @@ -57,6 +64,7 @@ VES-HV Collector Test Shutdown VES-HV Collector Suite Teardown + Log Kafka Status Stop And Remove All Xnf Simulators ${SUITE NAME} *** Variables *** diff --git a/tests/dcaegen2/bbs-testcases/__init__.robot b/tests/dcaegen2/bbs-testcases/__init__.robot new file mode 100644 index 00000000..d9957dd3 --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/__init__.robot @@ -0,0 +1,2 @@ +*** Settings *** +Documentation Integration - BBS suite
\ No newline at end of file diff --git a/tests/dcaegen2/bbs-testcases/assets/aai_records/aai_pnf_not_found.json b/tests/dcaegen2/bbs-testcases/assets/aai_records/aai_pnf_not_found.json new file mode 100644 index 00000000..23c169fd --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/assets/aai_records/aai_pnf_not_found.json @@ -0,0 +1,17 @@ +[ +{ + "requestError": { + "serviceException": { + "messageId": "SVC3001", + "text": "Resource not found for %1 using id %2 (msg=%3) (ec=%4)", + "variables": [ + "GET", + "nodes/pnfs/pnf/Wrong-PNF-Name", + "Node Not Found:No Node of type pnf found at: nodes/pnfs/pnf/Wrong-PNF-Name", + "ERR.5.4.6114" + ] + } + } +} + +] diff --git a/tests/dcaegen2/bbs-testcases/assets/aai_records/aai_pnfs.json b/tests/dcaegen2/bbs-testcases/assets/aai_records/aai_pnfs.json new file mode 100644 index 00000000..4ea7827f --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/assets/aai_records/aai_pnfs.json @@ -0,0 +1,46 @@ +[ +{ + "pnf-name": "NVendor-Equip_Model-SN1234", + "in-maint": true, + "resource-version": "1551889263181", + "relationship-list": { + "relationship": [ + { + "related-to": "service-instance", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v14/business/customers/customer/766162a3-53a9-42b8-8fe2-ebaa2213a6dd/service-subscriptions/service-subscription/BBS-CFS11/service-instances/service-instance/1923eaa8-8ab7-49ef-b4c2-e185efbbe832", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "766162a3-53a9-42b8-8fe2-ebaa2213a6dd" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "BBS-CFS11" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "1923eaa8-8ab7-49ef-b4c2-e185efbbe832" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name" + } + ] + }, + { + "related-to": "logical-link", + "relationship-label": "org.onap.relationships.inventory.BridgedTo", + "related-link": "/aai/v14/network/logical-links/logical-link/olt11-11-11", + "relationship-data": [ + { + "relationship-key": "logical-link.link-name", + "relationship-value": "olt11-11-11" + } + ] + } + ] + } +} +] diff --git a/tests/dcaegen2/bbs-testcases/assets/aai_records/aai_services.json b/tests/dcaegen2/bbs-testcases/assets/aai_records/aai_services.json new file mode 100644 index 00000000..351cc780 --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/assets/aai_records/aai_services.json @@ -0,0 +1,46 @@ +[ +{ + "service-instance-id": "1923eaa8-8ab7-49ef-b4c2-e185efbbe832", + "resource-version": "1551889260591", + "orchestration-status": "assigned", + "relationship-list": { + "relationship": [ + { + "related-to": "pnf", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v14/network/pnfs/pnf/NVendor-Equip_Model-SN1234", + "relationship-data": [ + { + "relationship-key": "pnf.pnf-name", + "relationship-value": "NVendor-Equip_Model-SN1234" + } + ] + } + ] + }, + "metadata": { + "metadatum": [ + { + "metaname": "cvlan", + "metaval": "1005", + "resource-version": "1551889260599" + }, + { + "metaname": "svlan", + "metaval": "100", + "resource-version": "1551889260608" + }, + { + "metaname": "oltName", + "metaval": "olt1", + "resource-version": "1551889260616" + }, + { + "metaname": "rgw-mac-address", + "metaval": "01:02:03:04:05:06", + "resource-version": "1551889260624" + } + ] + } +} +] diff --git a/tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_with_all_fields.json b/tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_with_all_fields.json new file mode 100644 index 00000000..3ad1fec0 --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_with_all_fields.json @@ -0,0 +1,30 @@ +{ + "event": { + "commonEventHeader": { + "version": "4.0.1", + "eventName": "StateChange_cpe_authentication", + "domain": "stateChange", + "eventId": "ab305d54-85b4-a31b-7db2fb6b9e546015", + "eventType": "applicationNf", + "sourceId": "", + "sourceName": "NVendor-Equip_Model-SN1234", + "reportingEntityId": "", + "reportingEntityName": "thirdparty-sdnc-idfromesrrequest", + "priority": "Normal", + "startEpochMicrosec": 1.413378172e+15, + "lastEpochMicrosec": 1.413378172e+15, + "sequence": 0, + "vesEventListenerVersion": "7.1" + }, + "stateChangeFields": { + "stateChangeFieldsVersion": 1, + "oldState": "outOfService", + "newState": "inService", + "stateInterface": "", + "additionalFields": { + "macAddress": "01:02:03:04:05:06", + "swVersion": "1.2.3" + } + } + } +} diff --git a/tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_with_missing_new_old_state.json b/tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_with_missing_new_old_state.json new file mode 100644 index 00000000..2c14d468 --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_with_missing_new_old_state.json @@ -0,0 +1,29 @@ +{ + "event": { + "commonEventHeader": { + "version": "4.0.1", + "eventName": "StateChange_cpe_authentication", + "domain": "stateChange", + "eventId": "ab305d54-85b4-a31b-7db2fb6b9e546015", + "eventType": "applicationNf", + "sourceId": "", + "sourceName": "NVendor-Equip_Model-SN1234", + "reportingEntityId": "", + "reportingEntityName": "thirdparty-sdnc-idfromesrrequest", + "priority": "Normal", + "startEpochMicrosec": 1.413378172e+15, + "lastEpochMicrosec": 1.413378172e+15, + "sequence": 0, + "vesEventListenerVersion": "7.1" + }, + "stateChangeFields": { + "stateChangeFieldsVersion": 1, + "oldState": "", + "newState": "", + "stateInterface": "", + "additionalFields": { + "macAddress": "01:02:03:04:05:06" + } + } + } +}
\ No newline at end of file diff --git a/tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_with_missing_rgmac.json b/tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_with_missing_rgmac.json new file mode 100644 index 00000000..21d97259 --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_with_missing_rgmac.json @@ -0,0 +1,30 @@ +{ + "event": { + "commonEventHeader": { + "version": "4.0.1", + "eventName": "StateChange_cpe_authentication", + "domain": "stateChange", + "eventId": "ab305d54-85b4-a31b-7db2fb6b9e546015", + "eventType": "applicationNf", + "sourceId": "", + "sourceName": "NVendor-Equip_Model-SN1234", + "reportingEntityId": "", + "reportingEntityName": "thirdparty-sdnc-idfromesrrequest", + "priority": "Normal", + "startEpochMicrosec": 1.413378172e+15, + "lastEpochMicrosec": 1.413378172e+15, + "sequence": 0, + "vesEventListenerVersion": "7.1" + }, + "stateChangeFields": { + "stateChangeFieldsVersion": 1, + "oldState": "outOfService", + "newState": "inService", + "stateInterface": "", + "additionalFields": { + "macAddress": "", + "swVersion": "1.2.3" + } + } + } +} diff --git a/tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_with_missing_sourceName.json b/tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_with_missing_sourceName.json new file mode 100644 index 00000000..538a56c6 --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_with_missing_sourceName.json @@ -0,0 +1,30 @@ +{ + "event": { + "commonEventHeader": { + "version": "4.0.1", + "eventName": "StateChange_cpe_authentication", + "domain": "stateChange", + "eventId": "ab305d54-85b4-a31b-7db2fb6b9e546015", + "eventType": "applicationNf", + "sourceId": "", + "sourceName": "", + "reportingEntityId": "", + "reportingEntityName": "thirdparty-sdnc-idfromesrrequest", + "priority": "Normal", + "startEpochMicrosec": 1.413378172e+15, + "lastEpochMicrosec": 1.413378172e+15, + "sequence": 0, + "vesEventListenerVersion": "7.1" + }, + "stateChangeFields": { + "stateChangeFieldsVersion": 1, + "oldState": "outOfService", + "newState": "inService", + "stateInterface": "", + "additionalFields": { + "macAddress": "01:02:03:04:05:06", + "swVersion": "1.2.3" + } + } + } +} diff --git a/tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_with_wrong_sourceName.json b/tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_with_wrong_sourceName.json new file mode 100644 index 00000000..39a9e4ae --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_with_wrong_sourceName.json @@ -0,0 +1,30 @@ +{ + "event": { + "commonEventHeader": { + "version": "4.0.1", + "eventName": "StateChange_cpe_authentication", + "domain": "stateChange", + "eventId": "ab305d54-85b4-a31b-7db2fb6b9e546015", + "eventType": "applicationNf", + "sourceId": "", + "sourceName": "Wrong-PNF-Name", + "reportingEntityId": "", + "reportingEntityName": "thirdparty-sdnc-idfromesrrequest", + "priority": "Normal", + "startEpochMicrosec": 1.413378172e+15, + "lastEpochMicrosec": 1.413378172e+15, + "sequence": 0, + "vesEventListenerVersion": "7.1" + }, + "stateChangeFields": { + "stateChangeFieldsVersion": 1, + "oldState": "outOfService", + "newState": "inService", + "stateInterface": "", + "additionalFields": { + "macAddress": "01:02:03:04:05:06", + "swVersion": "1.2.3" + } + } + } +} diff --git a/tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_without_swversion.json b/tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_without_swversion.json new file mode 100644 index 00000000..fcacf1ce --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_without_swversion.json @@ -0,0 +1,16 @@ +{ + "event": { + "commonEventHeader": { + "sourceName":"NVendor-Equip_Model-SN1234" + }, + "stateChangeFields": { + "stateChangeFieldsVersion": 1, + "newState": "inService", + "oldState": "outOfService", + "stateInterface": "", + "additionalFields": { + "macAddress": "00:11:22:33:44:55" + } + } + } +} diff --git a/tests/dcaegen2/bbs-testcases/assets/json_events/auth_not_json_format.json b/tests/dcaegen2/bbs-testcases/assets/json_events/auth_not_json_format.json new file mode 100644 index 00000000..7801ad69 --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/assets/json_events/auth_not_json_format.json @@ -0,0 +1,30 @@ +{ + "event": { + "commonEventHeader": { + "version": "4.0.1", + "eventName": "StateChange_cpe_authentication", + "domain": "stateChange", + "eventId": "ab305d54-85b4-a31b-7db2fb6b9e546015", + "eventType": "applicationNf", + "sourceId": "", + "sourceName": "NVendor-Equip_Model-SN1234pnf-11", + "reportingEntityId": "", + "reportingEntityName": "thirdparty-sdnc-idfromesrrequest", + "priority": "Normal", + "startEpochMicrosec": 1.413378172e+15, + "lastEpochMicrosec": 1.413378172e+15, + "sequence": 0, + "vesEventListenerVersion": "7.1" + }, + "stateChangeFields": { + "stateChangeFieldsVersion": 1, + "oldState": "outOfService", + "newState": "inService", + "stateInterface": "", + "additionalFields": { + "macAddress": "01:02:03:04:05:06", + "swVersion": "1.2.3", + } + } + } +} diff --git a/tests/dcaegen2/bbs-testcases/assets/json_events/auth_policy_with_all_fields.json b/tests/dcaegen2/bbs-testcases/assets/json_events/auth_policy_with_all_fields.json new file mode 100644 index 00000000..05b15fbf --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/assets/json_events/auth_policy_with_all_fields.json @@ -0,0 +1,23 @@ +[ + { + "closedLoopEventClient": "DCAE.BBS_event_processor_mSInstance", + "policyVersion": "1.0.0.5", + "policyName": "CPE_Authentication", + "policyScope": "policyScopeCpeAuth", + "target_type": "VM", + "AAI": + { + "cpe.old-authentication-state": "outOfService", + "cpe.new-authentication-state": "inService", + "cpe.swVersion": "1.2.3", + "service-information.hsia-cfs-service-instance-id": "1923eaa8-8ab7-49ef-b4c2-e185efbbe832" + }, + "closedLoopAlarmStart": 1552997462, + "closedLoopEventStatus": "ONSET", + "closedLoopControlName": "clControlNameCpeAuth", + "version": "1.0.2", + "target": "vserver.vserver-name", + "requestID": "d76541f3-7f55-4c80-b0a0-ec5dee2a56cb", + "from": "DCAE" + } +] diff --git a/tests/dcaegen2/bbs-testcases/assets/json_events/update_event_with_all_fields.json b/tests/dcaegen2/bbs-testcases/assets/json_events/update_event_with_all_fields.json new file mode 100644 index 00000000..6fe23199 --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/assets/json_events/update_event_with_all_fields.json @@ -0,0 +1,16 @@ +{ + "nf-role":"role", + "equip-type":"Equipment-Type-1", + "equip-vendor":"NVendor", + "equip-model":"Equip_Model", + "serial-number":"SN1234", + "sw-version":"SW-version-1", + "correlationId":"NVendor-Equip_Model-SN1234", + "additionalFields": { + "attachment-point": "olt1-1-1", + "cvlan": "1005", + "svlan": "100", + "remote-id": "some-remote-id" + } + } +
\ No newline at end of file diff --git a/tests/dcaegen2/bbs-testcases/assets/json_events/update_event_with_missing_attachment.json b/tests/dcaegen2/bbs-testcases/assets/json_events/update_event_with_missing_attachment.json new file mode 100644 index 00000000..43d1b212 --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/assets/json_events/update_event_with_missing_attachment.json @@ -0,0 +1,15 @@ +{ + "nf-role":"role", + "equip-type":"Equipment-Type-1", + "equip-vendor":"NVendor", + "equip-model":"Equip_Model", + "serial-number":"SN1234", + "sw-version":"SW-version-1", + "correlationId":"NVendor-Equip_Model-SN1234", + "additionalFields": { + "attachment-point": "", + "cvlan": "1005", + "svlan": "100", + "remote-id": "some-remote-id" + } + } diff --git a/tests/dcaegen2/bbs-testcases/assets/json_events/update_event_with_missing_correlation.json b/tests/dcaegen2/bbs-testcases/assets/json_events/update_event_with_missing_correlation.json new file mode 100644 index 00000000..a1aaee30 --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/assets/json_events/update_event_with_missing_correlation.json @@ -0,0 +1,15 @@ +{ + "nf-role":"role", + "equip-type":"Equipment-Type-1", + "equip-vendor":"Vendor", + "equip-model":"Equip_Model", + "serial-number":"SN1234", + "sw-version":"SW-version-1", + "correlationId":"", + "additionalFields": { + "attachment-point": "olt1-1-1", + "cvlan": "1005", + "svlan": "100", + "remote-id": "some-remote-id" + } + } diff --git a/tests/dcaegen2/bbs-testcases/assets/json_events/update_event_with_wrong_correlation.json b/tests/dcaegen2/bbs-testcases/assets/json_events/update_event_with_wrong_correlation.json new file mode 100644 index 00000000..f1dca037 --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/assets/json_events/update_event_with_wrong_correlation.json @@ -0,0 +1,15 @@ +{ + "nf-role":"role", + "equip-type":"Equipment-Type-1", + "equip-vendor":"NVendor", + "equip-model":"Equip_Model", + "serial-number":"SN1234", + "sw-version":"SW-version-1", + "correlationId":"Wrong-Correlation-Id", + "additionalFields": { + "attachment-point": "olt1-1-1", + "cvlan": "1005", + "svlan": "100", + "remote-id": "some-remote-id" + } + } diff --git a/tests/dcaegen2/bbs-testcases/assets/json_events/update_not_json_format.json b/tests/dcaegen2/bbs-testcases/assets/json_events/update_not_json_format.json new file mode 100644 index 00000000..ab5b214a --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/assets/json_events/update_not_json_format.json @@ -0,0 +1,15 @@ +{ + "nf-role":"role", + "equip-type":"Equipment-Type-1", + "equip-vendor":"NVendor", + "equip-model":"Equip_Model", + "serial-number":"SN1234", + "sw-version":"SW-version-1", + "correlationId":"NVendor-Equip_Model-SN1234", + "additionalFields": { + "attachment-point": "olt1-1-1", + "cvlan": "1005", + "svlan": "100", + "remote-id": "some-remote-id", + } + } diff --git a/tests/dcaegen2/bbs-testcases/assets/json_events/update_policy_with_all_fields.json b/tests/dcaegen2/bbs-testcases/assets/json_events/update_policy_with_all_fields.json new file mode 100644 index 00000000..49402657 --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/assets/json_events/update_policy_with_all_fields.json @@ -0,0 +1,24 @@ +[ + { + "closedLoopEventClient": "DCAE.BBS_event_processor_mSInstance", + "policyVersion": "1.0.0.5", + "policyName": "Nomadic_ONT", + "policyScope": "reRegPolicyScope", + "target_type": "VM", + "AAI":{ + "attachmentPoint": "olt11-1-1", + "service-information.hsia-cfs-service-instance-id": "1923eaa8-8ab7-49ef-b4c2-e185efbbe832", + "cvlan": "1005", + "svlan": "100", + "remoteId": "some-remote-id" + }, + "closedLoopAlarmStart": 1553067455, + "closedLoopEventStatus": "ONSET", + "closedLoopControlName": "reRegControlName", + "version": "1.0.2", + "target": "vserver.vserver-name", + "requestID": + "407a6515-4b10-46ad-a249-efe529a36c69", + "from": "DCAE" + } +] diff --git a/tests/dcaegen2/bbs-testcases/bbs_tests.robot b/tests/dcaegen2/bbs-testcases/bbs_tests.robot new file mode 100644 index 00000000..4721e425 --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/bbs_tests.robot @@ -0,0 +1,117 @@ +*** Settings *** +Documentation Integration tests for BBS. +... BBS receives CPE_AUTHENTICATION event from DMaaP and triggers a Policy that updates the CFS service with the PNF. +... BBS receives PNF_UPDATE event from DMaaP and triggers a Policy that updates the CFS service resources associated with the PNF. +Resource resources/bbs_library.robot +Resource ../../common.robot +Suite Setup Run keywords Create header AND Create sessions AND Set AAI Records AND Ensure Container Is Running bbs +Test Teardown Reset Simulators + + +*** Variables *** +${DMAAP_SIMULATOR_SETUP_URL} http://${DMAAP_SIMULATOR_SETUP} +${AAI_SIMULATOR_SETUP_URL} http://${AAI_SIMULATOR_SETUP} +${AUTH_EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_with_all_fields.json +${AUTH_EVENT_WITH_WRONG_SOURCENAME} %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_with_wrong_sourceName.json +${AUTH_EVENT_WITHOUT_SWVERSION} %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_without_swversion.json +${AUTH_EVENT_WITH_MISSING_RGMAC} %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_with_missing_rgmac.json +${AUTH_EVENT_WITH_MISSING_STATE} %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_with_missing_new_old_state.json +${AUTH_EVENT_WITH_MISSING_SOURCENAME} %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/json_events/auth_event_with_missing_sourceName.json +${AUTH_NOT_JSON_FORMAT} %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/json_events/auth_not_json_format.json +${AUTH_POLICY} %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/json_events/auth_policy_with_all_fields.json +${UPDATE_EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/json_events/update_event_with_all_fields.json +${UPDATE_EVENT_WITH_WRONG_CORRELATION} %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/json_events/update_event_with_wrong_correlation.json +${UPDATE_EVENT_WITH_MISSING_ATTACHMENT} %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/json_events/update_event_with_missing_attachment.json +${UPDATE_EVENT_WITH_MISSING_CORRELATION} %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/json_events/update_event_with_missing_correlation.json +${UPDATE_NOT_JSON_FORMAT} %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/json_events/update_not_json_format.json +${UPDATE_POLICY} %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/json_events/update_policy_with_all_fields.json +${AAI_PNFS} %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/aai_records/aai_pnfs.json +${AAI_SERVICES} %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/aai_records/aai_services.json +${AAI_PNF_NOT_FOUND} %{WORKSPACE}/tests/dcaegen2/bbs-testcases/assets/aai_records/aai_pnf_not_found.json + +*** Test Cases *** +Valid DMaaP CPE_AUTHENTICATION event can trigger Policy + [Documentation] BBS get valid CPE_AUTHENTICATION event from DMaaP with required fields - BBS triggers Policy + [Tags] BBS Valid CPE_AUTHENTICATION event + [Template] Valid auth event processing + ${AUTH_EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} + ${AUTH_EVENT_WITHOUT_SWVERSION} + +Invalid DMaaP CPE_AUTHENTICATION event RG MAC cannot trigger Policy + [Documentation] BBS get invalid RG MAC CPE_AUTHENTICATION event from DMaaP with missing required fields - BBS does not trigger Policy + [Tags] BBS Invalid RG MAC CPE_AUTHENTICATION event + [Template] Invalid rgmac auth event processing + ${AUTH_EVENT_WITH_MISSING_RGMAC} + +Invalid DMaaP CPE_AUTHENTICATION event cannot trigger Policy + [Documentation] BBS get invalid CPE_AUTHENTICATION event from DMaaP with missing required fields - BBS does not trigger Policy + [Tags] BBS Invalid CPE_AUTHENTICATION event + [Template] Invalid auth event processing + ${AUTH_EVENT_WITH_MISSING_STATE} + ${AUTH_EVENT_WITH_MISSING_SOURCENAME} + +Get valid CPE_AUTHENTICATION event from DMaaP and PNF record in AAI does not exist + [Documentation] BBS get valid event from DMaaP with all required fields and in AAI record doesn't exist - BBS does not trigger Policy + [Tags] BBS Missing AAI record + [Timeout] 30s + ${data}= Get Data From File ${AUTH_EVENT_WITH_WRONG_SOURCENAME} + Set event in DMaaP ${data} + Wait Until Keyword Succeeds 20x 2000ms Check BBS log Error while retrieving PNF: A&AI Request for (/aai/v14/network/pnfs/pnf/Wrong-PNF-Name?depth=all) + +CPE_AUTHENTICATION Event in DMaaP is not JSON format + [Documentation] BBS CPE_AUTHENTICATION not JSON format event from DMaaP - BBS does not Trigger Policy + [Tags] BBS + ${data}= Get Data From File ${AUTH_NOT_JSON_FORMAT} + Set event in DMaaP ${data} + Wait Until Keyword Succeeds 20x 2000ms Check BBS log DMaaP Consumption Exception: Not a JSON Array: + +# Get valid CPE_AUTHENTICATION event from DMaaP and AAI is not responding +# [Documentation] BBS get valid CPE_AUTHENTICATION event from DMaaP with all required fields and AAI is not responding - BBS does not trigger Policy +# [Tags] BBS AAI Uses containers +# [Timeout] 180s +# ${data}= Get Data From File ${AUTH_EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} +# Ensure Container Is Exited aai_simulator +# Set event in DMaaP ${data} +# Wait Until Keyword Succeeds 20x 2000ms Check BBS log Error while retrieving PNF: aai_simulator: Try again +# Ensure Container Is Running aai_simulator +# Set AAI Records + +Valid DMaaP PNF_UPDATE event can trigger Policy + [Documentation] BBS get valid PNF_UPDATE event from DMaaP with required fields - BBS triggers Policy + [Tags] BBS Valid PNF_UPDATE event + [Template] Valid update event processing + ${UPDATE_EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} + +Invalid DMaaP PNF_UPDATE event cannot trigger Policy + [Documentation] BBS get invalid PNF_UPDATE event from DMaaP with missing required fields - BBS does not trigger Policy + [Tags] BBS Invalid PNF_UPDATE event + [Template] Invalid update event processing + ${UPDATE_EVENT_WITH_MISSING_ATTACHMENT} + ${UPDATE_EVENT_WITH_MISSING_CORRELATION} + +Get valid PNF_UPDATE event from DMaaP and PNF record in AAI does not exist + [Documentation] BBS get valid PNF_UPDATE event from DMaaP with all required fields and in AAI record doesn't exist - BBS does not trigger Policy + [Tags] BBS Missing AAI record + [Timeout] 30s + ${data}= Get Data From File ${UPDATE_EVENT_WITH_WRONG_CORRELATION} + Set event in DMaaP ${data} + Wait Until Keyword Succeeds 20x 2000ms Check BBS log Error while retrieving PNF: A&AI Request for (/aai/v14/network/pnfs/pnf/Wrong-Correlation-Id?depth=all) + + +PNF_UPDATE Event in DMaaP is not JSON format + [Documentation] BBS PNF_UPDATE not JSON format event from DMaaP - BBS does not Trigger Policy + [Tags] BBS + ${data}= Get Data From File ${UPDATE_NOT_JSON_FORMAT} + Set event in DMaaP ${data} + Wait Until Keyword Succeeds 20x 2000ms Check BBS log DMaaP Consumption Exception: Not a JSON Array: + +# Get valid PNF_UPDATE event from DMaaP and AAI is not responding +# [Documentation] BBS get valid PNF_UPDATE event from DMaaP with all required fields and AAI is not responding - BBS does not trigger Policy +# [Tags] BBS AAI Uses containers +# [Timeout] 180s +# ${data}= Get Data From File ${UPDATE_EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} +# Ensure Container Is Exited aai_simulator +# Set event in DMaaP ${data} +# Wait Until Keyword Succeeds 20x 2000ms Check BBS log Error while retrieving PNF: aai_simulator: Try again +# Ensure Container Is Running aai_simulator +# Set AAI Records diff --git a/tests/dcaegen2/bbs-testcases/resources/BbsLibrary.py b/tests/dcaegen2/bbs-testcases/resources/BbsLibrary.py new file mode 100644 index 00000000..8dbdc5a3 --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/BbsLibrary.py @@ -0,0 +1,173 @@ +import json + +import docker +import time +from docker.utils.json_stream import json_stream +from collections import OrderedDict + + +class BbsLibrary(object): + + def __init__(self): + pass + + @staticmethod + def check_for_log(search_for): + client = docker.from_env() + container = client.containers.get('bbs') + + alog = container.logs(stream=False, tail=1000) + try: + alog = alog.decode() + except AttributeError: + pass + + found = alog.find(search_for) + if found != -1: + return True + else: + return False + + @staticmethod + def create_pnf_name_from_auth(json_file): + json_to_python = json.loads(json_file) + correlation_id = json_to_python.get("event").get("commonEventHeader").get("sourceName") + return correlation_id + + @staticmethod + def get_invalid_auth_elements(json_file): + """ + Get the correlationId, oldState, newState, stateInterface, macAddress, swVersion elements + from the invalid message and place the elements into a JSON object (string) as fields for comparision + """ + json_to_python = json.loads(json_file) + correlation_id = json_to_python.get("event").get("commonEventHeader").get("sourceName") + oldState = json_to_python.get("event").get("stateChangeFields").get("oldState") + newState = json_to_python.get("event").get("stateChangeFields").get("newState") + stateInterface = json_to_python.get("event").get("stateChangeFields").get("stateInterface") + macAddress = json_to_python.get("event").get("stateChangeFields").get("additionalFields").get("macAddress") + swVersion = json_to_python.get("event").get("stateChangeFields").get("additionalFields").get("swVersion") + if swVersion is None: + swVersion = "" + + inv_fields = OrderedDict() + + #inv_fields = dict() + inv_fields['correlationId'] = correlation_id + inv_fields['oldState'] = oldState + inv_fields['newState'] = newState + inv_fields['stateInterface'] = stateInterface + inv_fields['macAddress'] = macAddress + inv_fields['swVersion'] = swVersion + + # Transform the dictionary to JSON string + json_str = json.dumps(inv_fields) + + # Need to remove spaces between elements + json_str = json_str.replace(', ', ',') + return json_str + + @staticmethod + def get_invalid_update_elements(json_file): + """ + Get the correlationId, attachment-point, remote-id, cvlan, svlan, elements + from the invalid message and place the elements into a JSON object (string) as fields for comparision + """ + json_to_python = json.loads(json_file) + correlation_id = json_to_python.get("correlationId") + attachmentPoint = json_to_python.get("additionalFields").get("attachment-point") + remoteId = json_to_python.get("additionalFields").get("remote-id") + cvlan = json_to_python.get("additionalFields").get("cvlan") + svlan = json_to_python.get("additionalFields").get("svlan") + + inv_fields = OrderedDict() + #inv_fields = dict() + inv_fields['correlationId'] = correlation_id + inv_fields['attachment-point'] = attachmentPoint + inv_fields['remote-id'] = remoteId + inv_fields['cvlan'] = cvlan + inv_fields['svlan'] = svlan + + # Transform the dictionary to JSON string + json_str = json.dumps(inv_fields) + + # Need to remove spaces between elements + json_str = json_str.replace(', ', ',') + return json_str + + @staticmethod + def compare_policy(dmaap_policy, json_policy): + resp = False + try: + python_policy = json.loads(json_policy).pop() + except: + python_policy = "" + + try: + python_dmaap_policy = json.loads(dmaap_policy) + except: + python_dmaap_policy = "" + + try: + d_policy = python_dmaap_policy.get("policyName") + except: + d_policy = "" + + try: + j_policy = python_policy.get("policyName") + except: + return "False" + + resp = "False" + if (d_policy == j_policy): + resp = "True" + return resp + + @staticmethod + def create_pnf_name_from_update(json_file): + json_to_python = json.loads(json_file) + correlation_id = json_to_python.get("correlationId") + return correlation_id + + @staticmethod + def ensure_container_is_running(name): + + client = docker.from_env() + + if not BbsLibrary.is_in_status(client, name, "running"): + print ("starting container", name) + container = client.containers.get(name) + container.start() + BbsLibrary.wait_for_status(client, name, "running") + + BbsLibrary.print_status(client) + + @staticmethod + def ensure_container_is_exited(name): + + client = docker.from_env() + + if not BbsLibrary.is_in_status(client, name, "exited"): + print ("stopping container", name) + container = client.containers.get(name) + container.stop() + BbsLibrary.wait_for_status(client, name, "exited") + + BbsLibrary.print_status(client) + + @staticmethod + def print_status(client): + print("containers status") + for c in client.containers.list(all=True): + print(c.name, " ", c.status) + + @staticmethod + def wait_for_status(client, name, status): + while not BbsLibrary.is_in_status(client, name, status): + print ("waiting for container: ", name, "to be in status: ", status) + time.sleep(3) + + @staticmethod + def is_in_status(client, name, status): + return len(client.containers.list(all=True, filters={"name": "^/"+name+"$", "status": status})) == 1 + diff --git a/tests/dcaegen2/bbs-testcases/resources/bbs_library.robot b/tests/dcaegen2/bbs-testcases/resources/bbs_library.robot new file mode 100644 index 00000000..34c94caa --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/bbs_library.robot @@ -0,0 +1,108 @@ +*** Settings *** +Library RequestsLibrary +Library Collections +Library BbsLibrary.py +Resource ../../../common.robot + +*** Keywords *** +Create header + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + Set Suite Variable ${suite_headers} ${headers} + +Create sessions + Create Session dmaap_setup_session ${DMAAP_SIMULATOR_SETUP_URL} + Set Suite Variable ${dmaap_setup_session} dmaap_setup_session + Create Session aai_setup_session ${AAI_SIMULATOR_SETUP_URL} + Set Suite Variable ${aai_setup_session} aai_setup_session + +Reset Simulators + Reset AAI simulator + Reset DMaaP simulator + +Set AAI Records + [Timeout] 30s + ${data}= Get Data From File ${AAI_PNFS} + ${headers}= Create Dictionary Accept=application/json Content-Type=text/html + ${resp} = Put Request ${aai_setup_session} /set_pnfs headers=${headers} data=${data} + Should Be Equal As Strings ${resp.status_code} 200 + ${data}= Get Data From File ${AAI_SERVICES} + ${headers}= Create Dictionary Accept=application/json Content-Type=text/html + ${resp} = Put Request ${aai_setup_session} /set_services headers=${headers} data=${data} + Should Be Equal As Strings ${resp.status_code} 200 + ${data}= Get Data From File ${AAI_PNF_NOT_FOUND} + ${headers}= Create Dictionary Accept=application/json Content-Type=text/html + ${resp} = Put Request ${aai_setup_session} /set_pnf_not_found headers=${headers} data=${data} + Should Be Equal As Strings ${resp.status_code} 200 + +Invalid rgmac auth event processing + [Arguments] ${input_invalid_event_in_dmaap} + [Timeout] 30s + ${data}= Get Data From File ${input_invalid_event_in_dmaap} + Set event in DMaaP ${data} + ${err_msg}= Catenate SEPARATOR= \\n RGW MAC address taken from event (Optional[]) does not match with A&AI metadata corresponding value + Wait Until Keyword Succeeds 20x 2000ms Check BBS log ${err_msg} + +Invalid auth event processing + [Arguments] ${input_invalid_event_in_dmaap} + [Timeout] 30s + ${data}= Get Data From File ${input_invalid_event_in_dmaap} + Set event in DMaaP ${data} + ${json_obj}= Get invalid auth elements ${data} + Wait Until Keyword Succeeds 20x 2000ms Check BBS log Incorrect CPE Authentication JSON event: + Wait Until Keyword Succeeds 20x 2000ms Check BBS log ${json_obj} +Valid auth event processing + [Arguments] ${input_valid_event_in_dmaap} + [Timeout] 30s + ${data}= Get Data From File ${input_valid_event_in_dmaap} + Set event in DMaaP ${data} + Wait Until Keyword Succeeds 20x 2000ms Check policy ${AUTH_POLICY} + +Check policy + [Arguments] ${json_policy_file} + ${resp}= Get Request ${dmaap_setup_session} /events/dcaeClOutput headers=${suite_headers} + ${data}= Get Data From File ${json_policy_file} + ${result}= Compare policy ${resp.text} ${data} + Should Be Equal As Strings ${result} True + +Invalid update event processing + [Arguments] ${input_invalid_event_in_dmaap} + [Timeout] 30s + ${data}= Get Data From File ${input_invalid_event_in_dmaap} + Set event in DMaaP ${data} + ${json_obj}= Get invalid update elements ${data} + Wait Until Keyword Succeeds 20x 2000ms Check BBS log Incorrect Re-Registration + Wait Until Keyword Succeeds 20x 2000ms Check BBS log JSON event: + Wait Until Keyword Succeeds 20x 2000ms Check BBS log ${json_obj} + + +Valid update event processing + [Arguments] ${input_valid_event_in_dmaap} + [Timeout] 30s + ${data}= Get Data From File ${input_valid_event_in_dmaap} + Set event in DMaaP ${data} + Wait Until Keyword Succeeds 20x 2000ms Check policy ${UPDATE_POLICY} + + +Check BBS log + [Arguments] ${searched_log} + ${status}= Check for log ${searched_log} + Should Be Equal As Strings ${status} True + +Set PNF name in AAI + [Arguments] ${pnfs_name} + ${headers}= Create Dictionary Accept=application/json Content-Type=text/html + ${resp} = Put Request ${aai_setup_session} /set_pnfs headers=${headers} data=${pnfs_name} + Should Be Equal As Strings ${resp.status_code} 200 + +Set event in DMaaP + [Arguments] ${event_in_dmaap} + ${resp} = Put Request ${dmaap_setup_session} /set_get_event headers=${suite_headers} data=${event_in_dmaap} + Should Be Equal As Strings ${resp.status_code} 200 + +Reset AAI simulator + ${resp} = Post Request ${aai_setup_session} /reset + Should Be Equal As Strings ${resp.status_code} 200 + +Reset DMaaP simulator + ${resp}= Post Request ${dmaap_setup_session} /reset + Should Be Equal As Strings ${resp.status_code} 200
\ No newline at end of file diff --git a/tests/dcaegen2/bbs-testcases/resources/docker-compose.yml b/tests/dcaegen2/bbs-testcases/resources/docker-compose.yml new file mode 100644 index 00000000..e42c0d29 --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/docker-compose.yml @@ -0,0 +1,64 @@ +version: '3' +services: + bbs: + image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.services.components.bbs-event-processor:1.0.0-SNAPSHOT + command: > + --dmaap.dmaapConsumerConfiguration.dmaapHostName=dmaap_simulator + --dmaap.dmaapConsumerConfiguration.dmaapPortNumber=2222 + --dmaap.dmaapProducerConfiguration.dmaapHostName=dmaap_simulator + --dmaap.dmaapProducerConfiguration.dmaapPortNumber=2222 + --aai.aaiClientConfiguration.aaiHostPortNumber=3333 + --aai.aaiClientConfiguration.aaiHost=aai_simulator + --aai.aaiClientConfiguration.aaiProtocol=http + ports: + - "32100:8100" + environment: + CONFIGS_DMAAP_CONSUMER_RE-REGISTRATION_DMAAPHOSTNAME: dmaap_simulator + CONFIGS_DMAAP_CONSUMER_RE-REGISTRATION_DMAAPPORTNUMBER: 2222 + CONFIGS_DMAAP_CONSUMER_RE-REGISTRATION_DMAAPTOPICNAME: /events/unauthenticated_PNF_UPDATE + CONFIGS_DMAAP_CONSUMER_RE-REGISTRATION_CONSUMERGROUP: + CONFIGS_DMAAP_CONSUMER_RE-REGISTRATION_CONSUMERID: + CONFIGS_DMAAP_CONSUMER_CPE-AUTHENTICATION_DMAAPHOSTNAME: dmaap_simulator + CONFIGS_DMAAP_CONSUMER_CPE-AUTHENTICATION_DMAAPPORTNUMBER: 2222 + CONFIGS_DMAAP_CONSUMER_CPE-AUTHENTICATION_DMAAPTOPICNAME: /events/unauthenticated_CPE_AUTHENTICATION + CONFIGS_DMAAP_CONSUMER_CPE-AUTHENTICATION_CONSUMERGROUP: + CONFIGS_DMAAP_CONSUMER_CPE-AUTHENTICATION_CONSUMERID: + CONFIGS_DMAAP_PRODUCER_DMAAPHOSTNAME: dmaap-bc + CONFIGS_DMAAP_PRODUCER_DMAAPPORTNUMBER: 2222 + CONFIGS_DMAAP_PRODUCER_DMAAPTOPICNAME: /events/unauthenticated_DCAE_CL_OUTPUT + CONFIGS_AAI_CLIENT_AAIHOST: aai_simulator + CONFIGS_AAI_CLIENT_AAIPORT: 3333 + CONFIGS_AAI_CLIENT_AAIPROTOCOL: http + CONFIGS_APPLICATION_PIPELINESPOLLINGINTERVALSEC: 15 + CONFIGS_APPLICATION_PIPELINESTIMEOUTSEC: 10 + CONFIGS_APPLICATION_RE-REGISTRATION_POLICYSCOPE: "re-reg_policy_scope" + CONFIGS_APPLICATION_RE-REGISTRATION_CLCONTROLNAME: "re-reg_cl" + CONFIGS_APPLICATION_CPE-AUTHENTICATION_POLICYSCOPE: "cpe-auth_policy_scope" + CONFIGS_APPLICATION_CPE-AUTHENTICATION_CLCONTROLNAME: "cpe-auth_cl" + LOGGING_LEVEL_ORG_ONAP_BBS: TRACE + container_name: bbs + depends_on: + - dmaap-bc + - aai + + dmaap-bc: + image: dmaap-bc:latest + build: + context: simulator + dockerfile: DMaaP_simulator + ports: + - "2222:2222" + - "2223:2223" + - "2224:2224" + container_name: dmaap_simulator + + aai: + image: aai:latest + build: + context: simulator + dockerfile: AAI_simulator + ports: + - "3333:3333" + - "3334:3334" + - "3335:3335" + container_name: aai_simulator diff --git a/tests/dcaegen2/bbs-testcases/resources/simulator/AAI.py b/tests/dcaegen2/bbs-testcases/resources/simulator/AAI.py new file mode 100644 index 00000000..ba32582d --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/simulator/AAI.py @@ -0,0 +1,108 @@ +import re +import time +from http.server import BaseHTTPRequestHandler +import httpServerLib + +import json + +pnfs = [] +services = [] +pnf_not_found = '[{}]' + +class AAISetup(BaseHTTPRequestHandler): + + def do_PUT(self): + global pnfs + global services + global pnf_not_found + if re.search('/set_pnfs', self.path): + content_length = int(self.headers['Content-Length']) + pnfs = self.rfile.read(content_length) + pnfs = pnfs.decode() + httpServerLib.header_200_and_json(self) + elif re.search('/set_services', self.path): + content_length = int(self.headers['Content-Length']) + services = self.rfile.read(content_length) + services = services.decode() + httpServerLib.header_200_and_json(self) + elif re.search('/set_pnf_not_found', self.path): + content_length = int(self.headers['Content-Length']) + pnf_not_found = self.rfile.read(content_length) + pnf_not_found = pnf_not_found.decode() + httpServerLib.header_200_and_json(self) + + return + + def do_POST(self): + if re.search('/reset', self.path): + httpServerLib.header_200_and_json(self) + + return + + +class AAIHandler(BaseHTTPRequestHandler): + + def do_GET(self): + global pnfs + global services + global pnf_not_found + pnf_path = '/aai/v14/network/pnfs/pnf/' + service_path = '/aai/v14/nodes/service-instances/service-instance/' + found_resource = None + if re.search(pnf_path, self.path): + try: + python_pnfs = json.loads(pnfs) + except AttributeError: + python_pnfs = [] + for pnf_instance in python_pnfs: + try: + pnf_name = pnf_path + pnf_instance.get("pnf-name") + except AttributeError: + pnf_name = "PNF not found" + if re.search(pnf_name, self.path): + found_resource = pnf_instance + break + elif re.search(service_path, self.path): + try: + python_services = json.loads(services) + except AttributeError: + python_services = [] + for service_instance in python_services: + try: + service_name = service_path + service_instance.get("service-instance-id") + except AttributeError: + pnf_name = "Service not found" + if re.search(service_name, self.path): + found_resource = service_instance + break + + if found_resource is not None: + # Prepare the response for DMaaP (byte encoded JSON Object) + found_resource = json.dumps(found_resource) + found_resource = found_resource.encode() + httpServerLib.header_200_and_json(self) + self.wfile.write(found_resource) + else: + # Send a 404 message for not found + pnf_resp = pnf_not_found + # We have to replace the request line data + err_pnf_template = "nodes/pnfs/pnf/Wrong-PNF-Name" + pnf_resp = pnf_resp.replace(err_pnf_template, self.path) + pnf_resp = pnf_resp.encode() + httpServerLib.header_404_and_json(self) + self.wfile.write(pnf_resp) + + + return + +def _main_(handler_class=AAIHandler, protocol="HTTP/1.0"): + handler_class.protocol_version = protocol + httpServerLib.start_http_endpoint(3333, AAIHandler) + httpServerLib.start_https_endpoint(3334, AAIHandler, keyfile="certs/org.onap.aai.key", certfile="certs/aai_aai.onap.org.cer", ca_certs="certs/ca_local_0.cer") + httpServerLib.start_http_endpoint(3335, AAISetup) + while 1: + time.sleep(10) + + +if __name__ == '__main__': + _main_() diff --git a/tests/dcaegen2/bbs-testcases/resources/simulator/AAI_simulator b/tests/dcaegen2/bbs-testcases/resources/simulator/AAI_simulator new file mode 100644 index 00000000..a906bc58 --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/simulator/AAI_simulator @@ -0,0 +1,6 @@ +FROM python:3-alpine + +ADD AAI.py httpServerLib.py / +COPY certs/* /certs/ + +CMD [ "python", "./AAI.py" ] diff --git a/tests/dcaegen2/bbs-testcases/resources/simulator/DMaaP.py b/tests/dcaegen2/bbs-testcases/resources/simulator/DMaaP.py new file mode 100644 index 00000000..edeec8cf --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/simulator/DMaaP.py @@ -0,0 +1,92 @@ +import re +import time +from http.server import BaseHTTPRequestHandler +import httpServerLib + + +posted_event_from_bbs = b'[]' +received_event_to_get_method = b'[]' + + +class DmaapSetup(BaseHTTPRequestHandler): + + """ + This Handler is used by the test harness to prepare the buffers: + test harness places VES events using PUT from the harness into the + "received_event buffer" + test harness will write policy topics from the BBS us to the posted event buffer + """ + def do_PUT(self): + # Read the event from the test harness place it in the received event buffer + if re.search('/set_get_event', self.path): + content_length = int(self.headers['Content-Length']) + global received_event_to_get_method + received_event_to_get_method = self.rfile.read(content_length) + httpServerLib.header_200_and_json(self) + + return + + def do_GET(self): + # The test harness receives the policy triggers from the posted event + # by issuing a get and receiving the response. + if re.search('/events/dcaeClOutput', self.path): + global posted_event_from_bbs + httpServerLib.header_200_and_json(self) + self.wfile.write(posted_event_from_bbs) + + return + + def do_POST(self): + if re.search('/reset', self.path): + global posted_event_from_bbs + global received_event_to_get_method + posted_event_from_bbs = b'[]' + received_event_to_get_method = b'[]' + httpServerLib.header_200_and_json(self) + + return + + +class DMaaPHandler(BaseHTTPRequestHandler): + """ + This Handler is what the BBS uS connects to - The test library has posted the + the VES events in the setup Handler which are then received by the BBS uS via + this handler's do_GET function. + Likewise the policy trigger posted by the BBS uS is received and placed in the + in the posted event buffer which the test harness retrieves using the setup handler. + """ + + def do_POST(self): + # Post of the policy triggers from the BBS uS + if re.search('/events/unauthenticated.DCAE_CL_OUTPUT', self.path): + global posted_event_from_bbs + content_length = int(self.headers['Content-Length']) + posted_event_from_bbs = self.rfile.read(content_length) + httpServerLib.header_200_and_json(self) + + return + + def do_GET(self): + # BBS uS issues a Get to receive VES and PNF UPdate event from DMAAP + global received_event_to_get_method + if re.search('/events/unauthenticated.PNF_UPDATE', self.path): + httpServerLib.header_200_and_json(self) + self.wfile.write(received_event_to_get_method) + elif re.search('/events/unauthenticated_CPE_AUTHENTICATION/OpenDcae-c12/c12', self.path): + httpServerLib.header_200_and_json(self) + self.wfile.write(received_event_to_get_method) + + return + + +def _main_(handler_class=DMaaPHandler, protocol="HTTP/1.0"): + handler_class.protocol_version = protocol + httpServerLib.start_http_endpoint(2222, DMaaPHandler) + httpServerLib.start_https_endpoint(2223, DMaaPHandler, keyfile="certs/org.onap.dmaap-bc.key", certfile="certs/dmaap_bc_topic_mgr_dmaap_bc.onap.org.cer", ca_certs="certs/ca_local_0.cer") + httpServerLib.start_http_endpoint(2224, DmaapSetup) + while 1: + time.sleep(10) + + +if __name__ == '__main__': + _main_() diff --git a/tests/dcaegen2/bbs-testcases/resources/simulator/DMaaP_simulator b/tests/dcaegen2/bbs-testcases/resources/simulator/DMaaP_simulator new file mode 100644 index 00000000..8139fc33 --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/simulator/DMaaP_simulator @@ -0,0 +1,6 @@ +FROM python:3-alpine + +ADD DMaaP.py httpServerLib.py / +COPY certs/* /certs/ + +CMD [ "python", "./DMaaP.py" ] diff --git a/tests/dcaegen2/bbs-testcases/resources/simulator/certs/aai_aai.onap.org.cer b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/aai_aai.onap.org.cer new file mode 100644 index 00000000..327f57b6 --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/aai_aai.onap.org.cer @@ -0,0 +1,55 @@ +-----BEGIN CERTIFICATE----- +MIIE5TCCA82gAwIBAgIJAI5fEseaW2LVMA0GCSqGSIb3DQEBCwUAMEcxCzAJBgNV +BAYTAlVTMQ0wCwYDVQQKDARPTkFQMQ4wDAYDVQQLDAVPU0FBRjEZMBcGA1UEAwwQ +aW50ZXJtZWRpYXRlQ0FfMjAeFw0xODEwMTgxMDM3MzJaFw0xOTA0MTgxMDM3MzJa +MGYxDDAKBgNVBAMMA2FhaTEPMA0GCSqGSIb3DQEJARYAMRkwFwYDVQQLDBBhYWlA +YWFpLm9uYXAub3JnMQ4wDAYDVQQLDAVPU0FBRjENMAsGA1UECgwET05BUDELMAkG +A1UEBhMCVVMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCCnz1BBkcD +y1M73ANgkbfwYANSJPdnU/meXpgHKYvXa8xbEI3Lsi5EnB7o9nthZFdU5dPZRFV5 +uJEOl0pjt3ogmPo0XZGYO++GfRNLq+c2YVmYjTLgFvEz6GzUtLueYjrl2JItGRug +x0wNPXQmaAX3/8wD7nOTAZjlmuSWCeeJu5GBaX4aaiwVOONDGhmZZ7jISTE0xvvU +936ECnUhSZtt/qRvnA1EJB/Hhs5Se4VPx6lTXYf8PXquI0IgDV49hlLhbPMKadQ8 +lo2yitiaSMJHsLZ1Wt6ob9oNFlBcceq3tfXPMVVylssuAI1pc3HsbmV7kMIwg0P1 +fyVoIALHlXgDAgMBAAGjggGzMIIBrzAJBgNVHRMEAjAAMA4GA1UdDwEB/wQEAwIF +4DAgBgNVHSUBAf8EFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwVAYDVR0jBE0wS4AU +BASNACQ4xpx414BXQWdJBoDmckehMKQuMCwxDjAMBgNVBAsMBU9TQUFGMQ0wCwYD +VQQKDARPTkFQMQswCQYDVQQGEwJVU4IBAjAdBgNVHQ4EFgQUMghLmZ4l0T+MY3uk +AR6YBJP5gwMwgfoGA1UdEQSB8jCB74IDYWFpgoHnYWFpLmFwaS5zaW1wbGVkZW1v +Lm9uYXAub3JnIGFhaS5lbGFzdGljc2VhcmNoLnNpbXBsZWRlbW8ub25hcC5vcmcg +YWFpLmdyZW1saW5zZXJ2ZXIuc2ltcGxlZGVtby5vbmFwLm9yZyBhYWkuaGJhc2Uu +c2ltcGxlZGVtby5vbmFwLm9yZyBhYWkub25hcCBhYWkuc2VhcmNoc2VydmljZS5z +aW1wbGVkZW1vLm9uYXAub3JnIGFhaS5zaW1wbGVkZW1vLm9uYXAub3JnIGFhaS51 +aS5zaW1wbGVkZW1vLm9uYXAub3JnMA0GCSqGSIb3DQEBCwUAA4IBAQBJyXk6ZTfA +f9mYi5ey/ZpchB9egJfwEXXOqSKeYYTjqUr3uXXk+usb8YXsFVoD9Id5do3Hnxv+ +J3ISGmyPTgQfV/9KDmtHPTyclR9mLji+j4GviZnIpAIsI/duPKlEfLcym9smAC7Q ++HYanUQ7s8sjJJ4ORdBLOy1HkfTu9pjNKZ1CcEnJZ8Y5juLOeEj+Xa+QzcywSK2E +iuPXJwFFtcX9fO+ojiQV9g0L9JgABMqm4Q6si03gXofYEgvAUJSxsirydB8kcqPU +jCgw8/XIsHj4VRNNWlwkvzskeX9ZlcFMmn6DTfyDD1Rrij1efotO2ie3OrKUEzpH +N1G5vCuZqOla +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIEVDCCAjygAwIBAgIBAjANBgkqhkiG9w0BAQsFADAsMQ4wDAYDVQQLDAVPU0FB +RjENMAsGA1UECgwET05BUDELMAkGA1UEBhMCVVMwHhcNMTgwOTI0MTE0MjE2WhcN +MjMwOTI0MTE0MjE2WjBHMQswCQYDVQQGEwJVUzENMAsGA1UECgwET05BUDEOMAwG +A1UECwwFT1NBQUYxGTAXBgNVBAMMEGludGVybWVkaWF0ZUNBXzIwggEiMA0GCSqG +SIb3DQEBAQUAA4IBDwAwggEKAoIBAQCjPFeAho7BtWjB4Enww/KXD0tTuoda/Fkc +o/yv2waNNsx+pOYGdJwNHYvNS7/RLBHc8kCN+TbKnYZ6AE97wD1Pzrc7AZ58qpjq +Ob7aTp4u3IAMWR5YOkDyjiibA5X7z9N/wveG/Ei2SgN2pY7O2lK5ucm6igarfxll +rZC1MA9zAXrfmd5bLJQQqACT6q15KQaCIwhqwoXp8w+s0rXcZ2/L303lFIUXoHUp +kzMsIPhJ/ZoEvAEkXIPgT2uFgOwIyWmr8Rg5jYzZhV7vey3bQUBlue9aiMIXih3d +b4AVD6J6eF/NmJygtUfHFrWeTAYLppA0d69BWUQZ+XQgCwjOMLaNAgMBAAGjZjBk +MB0GA1UdDgQWBBQEBI0AJDjGnHjXgFdBZ0kGgOZyRzAfBgNVHSMEGDAWgBTtc8Wb +I4DL8Bm6CVi8//GsTyq8NTASBgNVHRMBAf8ECDAGAQH/AgEAMA4GA1UdDwEB/wQE +AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAt4VCLb2UHiZpDfSQbe62vlFzsGlODYKF +k7BhW9Q5jfIXpPhhtBLFwJFEKAWFLVWubz+YIa7I5wtniS6zEPC/5t3JOiEXMJQY +PfaPDSsovZ+eShu0QtrjjldFwL2MiqNsd2IWLSIRQUP63RZGBRTTxSsxB0VAfRyT +cu/8znpmZsHna3DspGZQputm7qsxgUhAcPCdo9RQtG6Ox6L1wTXUJmTPHdKQtZjr +qqSQ7kn8u3i5KQYYapmc3UO+CBbzoLPD5Rrlq+ROBbiNd9R/j5vVgRO7vsU9SHnm +AaKFEjDPTSjDtMOxu1BsTNmftaE2jcYa9/ZW67H8URCuo92NE0cZRxBqHkPUjH3/ +/S43/TBAfjfarF5WW7iMAEZfEGhrQu26JWXBMcZshStuHUEPl2b+RC5LZcBMYKgi +SqSOXzpiJeRNASpXKCQQZG8n03c/jBf1U20HaK/4Z2ikOql5B21suxhUbixG1EQN +DOrFGOFUqG4Eyw+xjUR5rTfDnpKgQfJo0/aohZs9p5x+UwitkrQkJQ1ZmEzeVDjm +7xsmOcAJS2T9DLle6fDWvyh76InymAPxzk1/2AWOp8uw8iwNfFxE+p+M7h0psZxp +SnvlgASASdWlZLcMQtNiiKzMK75FW9SMctQfA/RfohNEwivpp6tNpgJozoKmhoPK +zs5HS/mx8GI= +-----END CERTIFICATE----- diff --git a/tests/dcaegen2/bbs-testcases/resources/simulator/certs/ca_local_0.cer b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/ca_local_0.cer new file mode 100644 index 00000000..ff37eaf7 --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/ca_local_0.cer @@ -0,0 +1,31 @@ +-----BEGIN CERTIFICATE----- +MIIFPjCCAyagAwIBAgIJAMhpcvbx/8/AMA0GCSqGSIb3DQEBCwUAMCwxDjAMBgNV +BAsMBU9TQUFGMQ0wCwYDVQQKDARPTkFQMQswCQYDVQQGEwJVUzAeFw0xODA4MDMx +MzI2NTBaFw0zODA3MjkxMzI2NTBaMCwxDjAMBgNVBAsMBU9TQUFGMQ0wCwYDVQQK +DARPTkFQMQswCQYDVQQGEwJVUzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC +ggIBAO4j7nmAY9KX/ceFCITuWAMCHAmSoeHCTs+lgkYX7DpXPidsF5t0ijPaElUC +rwwMnXz5h1o8FzXD64FMbqMVEseLUDZGelRZ7Rkz+hy0Y5i8QKsBTfeo7sP7ZEaC +vpqom9imPLFUn4oDeYspCKjMF93Z69Cv8pxFYCFpZwY3eR9V4xOB613k8guBJtHR +ccY9/NbdfbkrtUz5kNuQqwLj5ttvesqxPq0L4m3bPjkubQCb+QiJxx10Xcx6fcfu +wIu7NR63qDlWFYstsDnH/VIT1pSCBHEw+muSEQ44sgPFy+AxB8O8HKd8wRfmkV2d +YNPyotTLD+aLzDlCWtC0pGnTTJimdu9+hZRIZz5YT4m8BdLQ/jTBd6Gx2tVLvWso +9IJSjfkhj6EtVxyZ81jM+rLAnKy3qPXDCN6CIKL07hNuSzIIhCrK2L4f82JWS7dP +mg2acuhCH56qrhEr42Kjeak181KM/QKiRPgNyOSygJ7uRaLbqOQRh46c68NcmW4F +13OwJQAsrjgaQY1ZWnFsvRYK9NnUqK+2XuCQFS7EYm02M2UwO2GCD88In8PCzzv8 +Q0Zj8Hb4h79fVRjG8/3MnQCJ164+9PfXyu9dj5l6XkkSvdj1IsewaSMy9NccGx7Q +rE7yRPMB6FlAnGPj0KbJXHXJyiujPHSCF0D+Hbl9rxU7FRAbAgMBAAGjYzBhMB0G +A1UdDgQWBBTtc8WbI4DL8Bm6CVi8//GsTyq8NTAfBgNVHSMEGDAWgBTtc8WbI4DL +8Bm6CVi8//GsTyq8NTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAN +BgkqhkiG9w0BAQsFAAOCAgEAW4IYy1PUrV/wHblIGFTBo5z7EB33rpHfAJzbDkop +2n5wOlmh78pkeRNb1TOKcSHJPw0MdkwVBPI1wm/SOpHUPmKTW1muO6RUnFjZ68y9 +DiVa6zCW/RBFeG3f8kywxgqPLml1TbikRuMBU0ucOa/bXZ98P2hMLkjWTgeARGSj +QCb7QyqeFzG0mPmAuX6zMj5xwpdyPB0zCoRGXa/BIWEvYjgkaRM+E+9oRWt/6BHQ +4uw11R7gAV4/TSu7qYNfTMllBaLJ0o/1q0QF16e4mV1E4erDfWKlrvUlgCaHCx8Q +3PL7ovM4jjrTNAjnX0q5xtWbF0mlJhJk/NbPDb7hArBv4vp9XoITyRW1vcbe94jv +GzqLKlvBQUxGue4kLYDmUFdog7gaCkEH3N4mH3ad4HZUsOMeanvVgbVZr10VOlNq +TEWqDPATayJdo+VhJCGc6hVa+IJsDTAa/z2MLybqcoOfNT/rxYIdvlX4OjSqAqOj +bSivsCe9c4km56pP2ufA/woPzh+Z46Ukt+krGyFQwKdQQLh5Pp7Yuhvdld/5kd8M +S2fqcBFpzzBSj+huVayw6jFi5qLlISouhCVsc0rBqvnfuQTQwmfFIlfaHBTSjniv +5DdibZEtMqYYXl1VB4XUHTt5dOGHLEX2w/d5887DQVLUbaUKm1mfScb/vPjGgk6/ +re4= +-----END CERTIFICATE----- diff --git a/tests/dcaegen2/bbs-testcases/resources/simulator/certs/dmaap_bc_topic_mgr_dmaap_bc.onap.org.cer b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/dmaap_bc_topic_mgr_dmaap_bc.onap.org.cer new file mode 100644 index 00000000..756dd3a0 --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/dmaap_bc_topic_mgr_dmaap_bc.onap.org.cer @@ -0,0 +1,51 @@ +-----BEGIN CERTIFICATE----- +MIIELDCCAxSgAwIBAgIJAI5fEseaW2LbMA0GCSqGSIb3DQEBCwUAMEcxCzAJBgNV +BAYTAlVTMQ0wCwYDVQQKDARPTkFQMQ4wDAYDVQQLDAVPU0FBRjEZMBcGA1UEAwwQ +aW50ZXJtZWRpYXRlQ0FfMjAeFw0xODEwMjIxMjM4MTZaFw0xOTA0MjIxMjM4MTZa +MH8xETAPBgNVBAMMCGRtYWFwLWJjMQ8wDQYJKoZIhvcNAQkBFgAxLTArBgNVBAsM +JGRtYWFwLWJjLXRvcGljLW1nckBkbWFhcC1iYy5vbmFwLm9yZzEOMAwGA1UECwwF +T1NBQUYxDTALBgNVBAoMBE9OQVAxCzAJBgNVBAYTAlVTMIIBIjANBgkqhkiG9w0B +AQEFAAOCAQ8AMIIBCgKCAQEAs2mQSeSshK4ZrAwc8/QNHZiUVILlQwYyoviPfL27 +8mV1OXSYoTW+PzFU1Tv6HwKEFL3q9i9/y1m0DjhP4frHpNVVTo5KIeCv6fIsAYnp +/p50P3EOh3AJehtZm4AtxN6DeMlaBv11GYUUm6E60Q36Y6Wgklq8u1KDngYJy1/Q +Bl8aAiJbj2vpL64WSI3cyNz/qeI4/PxHsqBHUFI96GcLtLPLDSlIQWoWoZhkiQTH +rU4Sx5/nVdWihfc0R0+jG5IH+mDb8WUNmyHnaHinrt5Er1sypU/NxD+NlRPFO1K4 +Dx40sxfAlu2LFCllDgSS/Xcfse0ny/TrL2RWELoIOz9NjQIDAQABo4HiMIHfMAkG +A1UdEwQCMAAwDgYDVR0PAQH/BAQDAgXgMCAGA1UdJQEB/wQWMBQGCCsGAQUFBwMB +BggrBgEFBQcDAjBUBgNVHSMETTBLgBQEBI0AJDjGnHjXgFdBZ0kGgOZyR6EwpC4w +LDEOMAwGA1UECwwFT1NBQUYxDTALBgNVBAoMBE9OQVAxCzAJBgNVBAYTAlVTggEC +MB0GA1UdDgQWBBTvkTjHV87v4IBJ8N/PqkjjWGKICjArBgNVHREEJDAigghkbWFh +cC1iY4IWZG1hYXAtYmMgZG1hYXAtYmMub25hcDANBgkqhkiG9w0BAQsFAAOCAQEA +EJFyoeQtkjDf/yUyWReewxiOfDdmmrDOO4gbxt6hd3ilOflmC7QolR1NAzmCML3b +vmLS7a8zhwBsUU11wjasN8PI3qG7H36U7hP/NVwvql0YNGIcxvukPJJvDqW6V3MI +fOaCFs4uJexSYeaXRWdk0Rq8GY9gB2j1TUsl+we9zJeErKr2vY2LAJI0iYJ+v6YY +Ug14aPYu4m4ABUDhqfM+4z580h8GA+5ZkWNr5z9xfeJB520jAc6zx86obx9hep74 +OByfVqleMV0QfZeH9oLGYh2FnSSEG60GyWFIf9k76kh2LREVCbU+nOhFfVy9YD5Q ++2TXjh/wMcv3RxAHqSeW9A== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIEVDCCAjygAwIBAgIBAjANBgkqhkiG9w0BAQsFADAsMQ4wDAYDVQQLDAVPU0FB +RjENMAsGA1UECgwET05BUDELMAkGA1UEBhMCVVMwHhcNMTgwOTI0MTE0MjE2WhcN +MjMwOTI0MTE0MjE2WjBHMQswCQYDVQQGEwJVUzENMAsGA1UECgwET05BUDEOMAwG +A1UECwwFT1NBQUYxGTAXBgNVBAMMEGludGVybWVkaWF0ZUNBXzIwggEiMA0GCSqG +SIb3DQEBAQUAA4IBDwAwggEKAoIBAQCjPFeAho7BtWjB4Enww/KXD0tTuoda/Fkc +o/yv2waNNsx+pOYGdJwNHYvNS7/RLBHc8kCN+TbKnYZ6AE97wD1Pzrc7AZ58qpjq +Ob7aTp4u3IAMWR5YOkDyjiibA5X7z9N/wveG/Ei2SgN2pY7O2lK5ucm6igarfxll +rZC1MA9zAXrfmd5bLJQQqACT6q15KQaCIwhqwoXp8w+s0rXcZ2/L303lFIUXoHUp +kzMsIPhJ/ZoEvAEkXIPgT2uFgOwIyWmr8Rg5jYzZhV7vey3bQUBlue9aiMIXih3d +b4AVD6J6eF/NmJygtUfHFrWeTAYLppA0d69BWUQZ+XQgCwjOMLaNAgMBAAGjZjBk +MB0GA1UdDgQWBBQEBI0AJDjGnHjXgFdBZ0kGgOZyRzAfBgNVHSMEGDAWgBTtc8Wb +I4DL8Bm6CVi8//GsTyq8NTASBgNVHRMBAf8ECDAGAQH/AgEAMA4GA1UdDwEB/wQE +AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAt4VCLb2UHiZpDfSQbe62vlFzsGlODYKF +k7BhW9Q5jfIXpPhhtBLFwJFEKAWFLVWubz+YIa7I5wtniS6zEPC/5t3JOiEXMJQY +PfaPDSsovZ+eShu0QtrjjldFwL2MiqNsd2IWLSIRQUP63RZGBRTTxSsxB0VAfRyT +cu/8znpmZsHna3DspGZQputm7qsxgUhAcPCdo9RQtG6Ox6L1wTXUJmTPHdKQtZjr +qqSQ7kn8u3i5KQYYapmc3UO+CBbzoLPD5Rrlq+ROBbiNd9R/j5vVgRO7vsU9SHnm +AaKFEjDPTSjDtMOxu1BsTNmftaE2jcYa9/ZW67H8URCuo92NE0cZRxBqHkPUjH3/ +/S43/TBAfjfarF5WW7iMAEZfEGhrQu26JWXBMcZshStuHUEPl2b+RC5LZcBMYKgi +SqSOXzpiJeRNASpXKCQQZG8n03c/jBf1U20HaK/4Z2ikOql5B21suxhUbixG1EQN +DOrFGOFUqG4Eyw+xjUR5rTfDnpKgQfJo0/aohZs9p5x+UwitkrQkJQ1ZmEzeVDjm +7xsmOcAJS2T9DLle6fDWvyh76InymAPxzk1/2AWOp8uw8iwNfFxE+p+M7h0psZxp +SnvlgASASdWlZLcMQtNiiKzMK75FW9SMctQfA/RfohNEwivpp6tNpgJozoKmhoPK +zs5HS/mx8GI= +-----END CERTIFICATE----- diff --git a/tests/dcaegen2/bbs-testcases/resources/simulator/certs/keystore.password b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/keystore.password new file mode 100644 index 00000000..39823872 --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/keystore.password @@ -0,0 +1 @@ +mYHC98!qX}7h?W}jRv}MIXTJ
\ No newline at end of file diff --git a/tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.aai.key b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.aai.key new file mode 100644 index 00000000..b9a22cf3 --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.aai.key @@ -0,0 +1,29 @@ +-----BEGIN PRIVATE KEY----- +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCCnz1BBkcDy1M7 +3ANgkbfwYANSJPdnU/meXpgHKYvXa8xbEI3Lsi5EnB7o9nthZFdU5dPZRFV5uJEO +l0pjt3ogmPo0XZGYO++GfRNLq+c2YVmYjTLgFvEz6GzUtLueYjrl2JItGRugx0wN +PXQmaAX3/8wD7nOTAZjlmuSWCeeJu5GBaX4aaiwVOONDGhmZZ7jISTE0xvvU936E +CnUhSZtt/qRvnA1EJB/Hhs5Se4VPx6lTXYf8PXquI0IgDV49hlLhbPMKadQ8lo2y +itiaSMJHsLZ1Wt6ob9oNFlBcceq3tfXPMVVylssuAI1pc3HsbmV7kMIwg0P1fyVo +IALHlXgDAgMBAAECggEATFkLEpC6vWsAsYI9rxo9KxDToBXfTdP1mS2tKrKL/FQT +1D5uwtrY1F10a7J2F0zxBrx3AQ1B8K2Ci8a+Ql6h0Z/YzvbJ/PM7Y56Dwr0tncl0 +9wfA7t46CZ8WzZT9/OtphaL6fcWpMmaK+0oqM7ClnHk1JC8h+pD6b2oDpfcQEJ5r +hxFxdOotKgMzANMqTydteecfefy9l0hzgFiymxLZAo7ktW3HFpXO5HOgh1vkm5Pu +FedGRwiI/RBqad2T59J/XcRH0f5Ky7sgpyCShwqIp23xpdum10N0/MTzY5iu/gvR +pXGaPeYUrSPoLwuoMGAUm9wFbDqskI/mQzw6/rnfsQKBgQDU2O7ogZ/BjDVtjpfL +NntXhLOq02U+dB16ZXSalMbsG//FILVLL/Ths2wutKk/9IIiC1qI4NhDc0smDkgJ +l+oTZTnhVxZhWvOYovz7T3L3mp9VBIA0lW62dTDLK9gT6IRoQGN1fzzXF7ZfgOME +irDQqBSfMqt5YCeQOKNe29eo5QKBgQCdGrLaGHBeWBdhvG8XcybJDk2Q9XnojO69 +2UtfJ64+hzTc2MFvyBlWymZt3/Qq3llP/K9WUYW/ohL9l8rTXHEfBGpQVPzU2roQ +iicbx/zc2qfO79YaE10D/paekX2vrpoJlhtp0yMU/HMEYxrucbYQJEdKx9frcTXo +fQ9l5V+WxwKBgQDKEkYGsQGFk+IpZ+XOhKPmu9KDDH0jJMPTrrxcAYE1KYPSl7Hm +dtoK6Pd9BAFm+XAOeC70olpO9wdSUt6rVPFihojD2ZUiymFX+O0qfgwM7Fv2L/az +dWcNjAbN7IsQo4AJJZAHPcv5/MYkt01Pw4gIIHqrhURsUBBfiJX5ecetzQKBgC9I +NcPFzyvVv1O+7oBUO7wO/fE+r+35XHDu0OxWeO6Aqrw80BrgUh/40lMHL+km+iJE +nlCQQHyoPqbr5DMwgysenRCIQ3+cRJttuM93pPajKBXzwLAgW8I0AQjAKN+S4PE5 +qA51aP2L7OHJIfXZaz34bSxocOd/LwZFfTjhi59JAoGAVc3HAzQOkrCs1GPXvuOx +YwJUyuwLtCzcb05q+ys/5b/02RxTl4QPfOPqj47y8SDUUC7Cbr6ktqAkfsBOyPPj +tSniVhPKa4XdP0Brsil934sd3shvwrpEb9Xs6ialTid+PKaU/rFn1DYWZUP8lNMK +tq0nYLX/Z6N7LHiz32G9Kjs= +-----END PRIVATE KEY----- + diff --git a/tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.dcae.jks b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.dcae.jks Binary files differnew file mode 100644 index 00000000..e74ce64f --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.dcae.jks diff --git a/tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.dcae.trust.jks b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.dcae.trust.jks Binary files differnew file mode 100644 index 00000000..10103cfb --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.dcae.trust.jks diff --git a/tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.dmaap-bc.key b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.dmaap-bc.key new file mode 100644 index 00000000..880a33bf --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/org.onap.dmaap-bc.key @@ -0,0 +1,29 @@ +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCzaZBJ5KyErhms +DBzz9A0dmJRUguVDBjKi+I98vbvyZXU5dJihNb4/MVTVO/ofAoQUver2L3/LWbQO +OE/h+sek1VVOjkoh4K/p8iwBien+nnQ/cQ6HcAl6G1mbgC3E3oN4yVoG/XUZhRSb +oTrRDfpjpaCSWry7UoOeBgnLX9AGXxoCIluPa+kvrhZIjdzI3P+p4jj8/EeyoEdQ +Uj3oZwu0s8sNKUhBahahmGSJBMetThLHn+dV1aKF9zRHT6Mbkgf6YNvxZQ2bIedo +eKeu3kSvWzKlT83EP42VE8U7UrgPHjSzF8CW7YsUKWUOBJL9dx+x7SfL9OsvZFYQ +ugg7P02NAgMBAAECggEAfPetwlqe9DgUt6skS6SVsiTCRO9746iggrXhtECwdlHH +SkL1wWye3INvFKwXN5xYBd6Xl+1T9X/BFBqTQdOdViompnYkGt7XiXvevR+kNm+G +h14ngZ0/bKc6Tj8FIljfeLW/mJjZBPKWfSTbxBwZaWlHpEnBpjT+aobIMbnGO3i8 +iuPEIlSTmI/MmIvwyXkJ8r41phIZpdhtyKACx5LSvSArwPTYzVLyaGBJ63T4Qcat +GY/Oa1nAJkbFT46sP06O+sm1UIVUGbjewzPaDnfdFyJWmae0nGn1xU8VZUPI7rfu +YCf7le2grgtKy16jQo0o69RGYc4ebP27DKGd8YJHHQKBgQDts/7x6sG3fqPvbv9D +M5LDraslrj+noHGVcvCfigcgngvnMGcB/R8IT6YPmNRfATHV/UTLuW++PuqXsR21 +/WwJVbxudZ3alX7sz6CTGvcCQvnvPQm2e/iVW/JFrQu/poPxL1k3talDdKFWTRql +ZvQE05YjdTutlN2hGvqjSTZ1AwKBgQDBOO7GmG4FRQ4jXvUULXKMRUw+UzUy9NAV +io1b3CiwWynsdW2OPp6Jy6GB6+e7Di2M0i35hkpQd5NoeDnVqkm9ERYLnHr9FAs0 +5cKT7DDRC9ddJesJrqdhqGfhZCHMoqEiDRf3kNMBfFMV1TCefdQ0kIFYUuhHgboJ +aK+GqmtGLwKBgEEqmpdaA7e5mVn39TVIO1E4GHahGcRr4RfWxg8G+UNA8QR1qZfK +/Cn8JAucm4RcQHxpDeZINVFT0F676OhOzMKWZa1mw1r8pypnFZ+ewd81221yL2p+ +/Dx+U6I0eccV8JA7qdrzC695lw2g39A+tGFqXHvmFPFWoZgcXGBNnwdfAoGBAJ8y +9mEAhF2pKN3xxgGq9F8oVYpgakuis7Ob5Z5TBd9QLXmawvpZE6y670YphVN0egk1 +vxWBFMe5zeVccWJfHMQ/SKemdRsBob4itC/Gge4rUHV54W6nzVdENtrY8pQ1RofU +u/OJCqGFursZXSaoy+fHTBrmrGUGOK655y0QSrSXAoGBANbSu8DfjJwDHcWTstcn +XJ/bHB6aZmKe4ibOSFBMsOuy0AP1vRxQTgvQhgeRWm5ngv7YhPes2UHqRktadfGz +VUzx9/ILpL5skhIFEzgEP32cO1tQNE1vxODs3zg+U/Wy9gxJt0dLCB/sPQJcGLri +mkzev7AyLLr137K+ssxhczqg +-----END PRIVATE KEY----- + diff --git a/tests/dcaegen2/bbs-testcases/resources/simulator/certs/truststore.password b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/truststore.password new file mode 100644 index 00000000..168e64bd --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/simulator/certs/truststore.password @@ -0,0 +1 @@ +*TQH?Lnszprs4LmlAj38yds(
\ No newline at end of file diff --git a/tests/dcaegen2/bbs-testcases/resources/simulator/httpServerLib.py b/tests/dcaegen2/bbs-testcases/resources/simulator/httpServerLib.py new file mode 100644 index 00000000..d963169d --- /dev/null +++ b/tests/dcaegen2/bbs-testcases/resources/simulator/httpServerLib.py @@ -0,0 +1,37 @@ +import _thread +import ssl +from http.server import HTTPServer + + +def header_200_and_json(self): + self.send_response(200) + self.send_header('Content-Type', 'application/json') + self.end_headers() + +def header_404_and_json(self): + self.send_response(404) + self.send_header('Content-Type', 'application/json') + self.end_headers() + +def start_http_endpoint(port, handler_class): + _thread.start_new_thread(init_http_endpoints, (port, handler_class)) + + +def start_https_endpoint(port, handler_class, keyfile, certfile, ca_certs): + _thread.start_new_thread(init_https_endpoints, (port, handler_class, keyfile, certfile, ca_certs)) + + +def init_http_endpoints(port, handler_class, server_class=HTTPServer): + server = server_class(('', port), handler_class) + sa = server.socket.getsockname() + print("Serving HTTP on", sa[0], "port", sa[1], "for", handler_class, "...") + server.serve_forever() + + +def init_https_endpoints(port, handler_class, keyfile, certfile, ca_certs, server_class=HTTPServer): + server = server_class(('', port), handler_class) + server.socket = ssl.wrap_socket(server.socket, keyfile=keyfile, certfile=certfile, + ca_certs=ca_certs, server_side=True) + sa = server.socket.getsockname() + print("Serving HTTPS on", sa[0], "port", sa[1], "for", handler_class, "...") + server.serve_forever() diff --git a/tests/dcaegen2/prh-testcases/assets/json_events/ves-event-pnf-registration-simple.json b/tests/dcaegen2/prh-testcases/assets/json_events/ves-event-pnf-registration-simple.json new file mode 100644 index 00000000..c3089678 --- /dev/null +++ b/tests/dcaegen2/prh-testcases/assets/json_events/ves-event-pnf-registration-simple.json @@ -0,0 +1,14 @@ +{ + "event": { + "commonEventHeader": { + "sourceName":"NOK6061ZW1", + "nfNamingCode": "nfNamingCode" + }, + "pnfRegistrationFields": { + "serialNumber":"serialNumber", + "vendorName":"vendorName", + "modelNumber":"modelNumber", + "unitType":"unitType" + } + } +}
\ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/assets/json_events/ves-event-pnf-registration-with-attachment-point.json b/tests/dcaegen2/prh-testcases/assets/json_events/ves-event-pnf-registration-with-attachment-point.json new file mode 100644 index 00000000..9d730bf6 --- /dev/null +++ b/tests/dcaegen2/prh-testcases/assets/json_events/ves-event-pnf-registration-with-attachment-point.json @@ -0,0 +1,19 @@ +{ + "event": { + "commonEventHeader": { + "sourceName":"NOK6061ZW1", + "nfNamingCode": "nfNamingCode" + }, + "pnfRegistrationFields": { + "serialNumber":"serialNumber", + "vendorName":"vendorName", + "modelNumber":"modelNumber", + "unitType":"unitType", + "additionalFields": { + "attachmentPoint": "bla-bla-30-3", + "svlan": "1005", + "cvlan": "678" + } + } + } +}
\ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/prh_tests.robot b/tests/dcaegen2/prh-testcases/prh_tests.robot index e485f587..31a7d0d8 100644 --- a/tests/dcaegen2/prh-testcases/prh_tests.robot +++ b/tests/dcaegen2/prh-testcases/prh_tests.robot @@ -11,6 +11,8 @@ Resource ../../common.robot *** Variables *** ${DMAAP_SIMULATOR_SETUP_URL} http://${DMAAP_SIMULATOR_SETUP} ${AAI_SIMULATOR_SETUP_URL} http://${AAI_SIMULATOR_SETUP} + +${VES_EVENT_PNF_REGISTRATION_SIMPLE} %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets/json_events/ves-event-pnf-registration-simple.json ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json ${EVENT_WITH_IPV4} %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV4.json ${EVENT_WITH_IPV6} %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV6.json @@ -31,24 +33,25 @@ Valid DMaaP event can be converted to PNF_READY notification [Documentation] PRH get valid event from DMaaP with required fields - PRH produce PNF_READY notification [Tags] PRH Valid event [Template] Valid event processing - ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} - ${EVENT_WITH_IPV4} - ${EVENT_WITH_IPV6} - ${EVENT_WITHOUT_IPV6_FILED} - ${EVENT_WITH_OPTIONAL_REGISTRATION_FIELDS_ALL_FILLED} - ${EVENT_WITH_OPTIONAL_REGISTRATION_FIELDS_EMPTY} - ${EVENT_WITH_OPTIONAL_REGISTRATION_FIELDS_MISSING_ALL} - ${EVENT_WITH_OPTIONAL_REGISTRATION_FIELDS_MISSING_PARTIAL} + ${VES_EVENT_PNF_REGISTRATION_SIMPLE} + #${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} + #${EVENT_WITH_IPV4} + #${EVENT_WITH_IPV6} + #${EVENT_WITHOUT_IPV6_FILED} + #${EVENT_WITH_OPTIONAL_REGISTRATION_FIELDS_ALL_FILLED} + #${EVENT_WITH_OPTIONAL_REGISTRATION_FIELDS_EMPTY} + #${EVENT_WITH_OPTIONAL_REGISTRATION_FIELDS_MISSING_ALL} + #${EVENT_WITH_OPTIONAL_REGISTRATION_FIELDS_MISSING_PARTIAL} Invalid DMaaP event cannot be converted to PNF_READY notification [Documentation] PRH get invalid event from DMaaP with missing required fields - PRH does not produce PNF_READY notification [Tags] PRH Invalid event [Template] Invalid event processing - ${EVENT_WITH_MISSING_IPV4_AND_IPV6} + #${EVENT_WITH_MISSING_IPV4_AND_IPV6} ${EVENT_WITH_MISSING_SOURCENAME} - ${EVENT_WITH_MISSING_SOURCENAME_AND_IPV4} - ${EVENT_WITH_MISSING_SOURCENAME_AND_IPV6} - ${EVENT_WITH_MISSING_SOURCENAME_IPV4_AND_IPV6} + #${EVENT_WITH_MISSING_SOURCENAME_AND_IPV4} + #${EVENT_WITH_MISSING_SOURCENAME_AND_IPV6} + #${EVENT_WITH_MISSING_SOURCENAME_IPV4_AND_IPV6} Get valid event from DMaaP and record in AAI does not exist [Documentation] PRH get valid event from DMaaP with all required fields and in AAI record doesn't exist - PRH does not produce PNF_READY notification @@ -65,7 +68,8 @@ Event in DMaaP is not JSON format [Tags] PRH ${data}= Get Data From File ${Not_json_format} Set event in DMaaP ${data} - Wait Until Keyword Succeeds 100x 300ms Check PRH log |java.lang.IllegalStateException: Not a JSON Array: + #TODO to fix after CBS merge + #Wait Until Keyword Succeeds 100x 300ms Check PRH log |java.lang.IllegalStateException: Not a JSON Array: Get valid event from DMaaP and AAI is not responding [Documentation] PRH get valid event from DMaaP with all required fields and AAI is not responding - PRH does not produce PNF_READY notification @@ -74,5 +78,6 @@ Get valid event from DMaaP and AAI is not responding ${data}= Get Data From File ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} Ensure Container Is Exited aai_simulator Set event in DMaaP ${data} - Wait Until Keyword Succeeds 100x 300ms Check PRH log java.net.UnknownHostException: aai + #TODO fix after CBS merge + #Wait Until Keyword Succeeds 100x 300ms Check PRH log java.net.UnknownHostException: aai Ensure Container Is Running aai_simulator diff --git a/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py b/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py index 6667bd78..597f8647 100644 --- a/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py +++ b/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py @@ -41,16 +41,10 @@ class PrhLibrary(object): def create_pnf_ready_notification_as_pnf_ready(json_file): json_to_python = json.loads(json_file) correlation_id = PrhLibrary.extract_correlation_id_value(json_to_python, "correlationId") - serial_number = PrhLibrary.extract_value_from_pnfRegistrationFields(json_to_python, "serial-number", "serialNumber") - vendor_name = PrhLibrary.extract_value_from_pnfRegistrationFields(json_to_python, "equip-vendor", "vendorName") - model_number = PrhLibrary.extract_value_from_pnfRegistrationFields(json_to_python, "equip-model", "modelNumber") - unit_type = PrhLibrary.extract_value_from_pnfRegistrationFields(json_to_python, "equip-type", "unitType") additional_fields = PrhLibrary.extract_additional_fields_value(json_to_python) - nf_role = json_to_python.get("event").get("commonEventHeader").get("nfNamingCode") if "nfNamingCode" in json_to_python["event"]["commonEventHeader"] else "" - - str_json = '{' + correlation_id + serial_number + vendor_name + model_number + unit_type + '"nf-role":"' + nf_role + '","sw-version":"",' + additional_fields + str_json = '{' + correlation_id + additional_fields return json.dumps(str_json.rstrip(',') + '}').replace("\\", "")[1:-1] @@ -91,7 +85,7 @@ class PrhLibrary(object): @staticmethod def create_pnf_name(json_file): json_to_python = json.loads(json_file) - correlation_id = json_to_python.get("sourceName") + correlation_id = json_to_python.get("event").get("commonEventHeader").get("sourceName") + '",' if "sourceName" in json_to_python["event"]["commonEventHeader"] else '",' return correlation_id @staticmethod diff --git a/tests/dcaegen2/prh-testcases/resources/docker-compose.yml b/tests/dcaegen2/prh-testcases/resources/docker-compose.yml index 8b6ea128..b49a14ba 100644 --- a/tests/dcaegen2/prh-testcases/resources/docker-compose.yml +++ b/tests/dcaegen2/prh-testcases/resources/docker-compose.yml @@ -3,9 +3,9 @@ services: prh: image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.services.prh.prh-app-server:latest command: > - --dmaap.dmaapConsumerConfiguration.dmaapHostName=dmaap-bc + --dmaap.dmaapConsumerConfiguration.dmaapHostName=dmaap-mr --dmaap.dmaapConsumerConfiguration.dmaapPortNumber=2222 - --dmaap.dmaapProducerConfiguration.dmaapHostName=dmaap-bc + --dmaap.dmaapProducerConfiguration.dmaapHostName=dmaap-mr --dmaap.dmaapProducerConfiguration.dmaapPortNumber=2222 --aai.aaiClientConfiguration.aaiHostPortNumber=3333 --aai.aaiClientConfiguration.aaiHost=aai @@ -19,16 +19,16 @@ services: container_name: prh depends_on: - cbs - - dmaap-bc + - dmaap-mr - aai ssl_prh: image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.services.prh.prh-app-server:latest command: > - --dmaap.dmaapConsumerConfiguration.dmaapHostName=dmaap-bc + --dmaap.dmaapConsumerConfiguration.dmaapHostName=dmaap-mr --dmaap.dmaapConsumerConfiguration.dmaapPortNumber=2223 --dmaap.dmaapConsumerConfiguration.dmaapProtocol=https - --dmaap.dmaapProducerConfiguration.dmaapHostName=dmaap-bc + --dmaap.dmaapProducerConfiguration.dmaapHostName=dmaap-mr --dmaap.dmaapProducerConfiguration.dmaapPortNumber=2223 --dmaap.dmaapProducerConfiguration.dmaapProtocol=https --aai.aaiClientConfiguration.aaiHostPortNumber=3334 @@ -54,10 +54,10 @@ services: container_name: ssl_prh depends_on: - cbs - - dmaap-bc + - dmaap-mr - aai - dmaap-bc: + dmaap-mr: build: context: simulator dockerfile: DMaaP_simulator @@ -89,21 +89,74 @@ services: image: docker.io/consul:1.0.6 restart: on-failure command: ["kv", "put", "-http-addr=http://consul-server:8500", "dcae-prh", '{ - "dmaap.dmaapConsumerConfiguration.dmaapHostName":"dmaap-bc", + "dmaap.dmaapConsumerConfiguration.dmaapUrl":"http://dmaap-mr:2222/events/unauthenticated.VES_PNFREG_OUTPUT", + "dmaap.dmaapConsumerConfiguration.dmaapHostName":"dmaap-mr", "dmaap.dmaapConsumerConfiguration.dmaapPortNumber":2223, - "dmaap.dmaapConsumerConfiguration.dmaapProtocol":"https", - "dmaap.dmaapProducerConfiguration.dmaapHostName":"dmaap-bc", + "dmaap.dmaapConsumerConfiguration.dmaapTopicName": "events/unauthenticated.VES_PNFREG_OUTPUT", + "dmaap.dmaapConsumerConfiguration.dmaapProtocol":"http", + "dmaap.dmaapConsumerConfiguration.dmaapUserName":"admin", + "dmaap.dmaapConsumerConfiguration.dmaapUserPassword":"admin", + "dmaap.dmaapConsumerConfiguration.dmaapContentType": "application/json", + "dmaap.dmaapConsumerConfiguration.consumerId": "c12", + "dmaap.dmaapConsumerConfiguration.consumerGroup": "OpenDCAE-c12", + "dmaap.dmaapConsumerConfiguration.timeoutMs": -1, + "dmaap.dmaapConsumerConfiguration.messageLimit": -1, + + "dmaap.dmaapProducerConfiguration.dmaapUrl":"http://dmaap-mr:2222/events/unauthenticated.PNF_READY", + "dmaap.dmaapProducerConfiguration.dmaapHostName":"dmaap-mr", "dmaap.dmaapProducerConfiguration.dmaapPortNumber":2223, - "dmaap.dmaapProducerConfiguration.dmaapProtocol":"https", - "aai.aaiClientConfiguration.aaiHostPortNumber":3334, + "dmaap.dmaapProducerConfiguration.dmaapTopicName": "events/unauthenticated.PNF_READY", + "dmaap.dmaapProducerConfiguration.dmaapProtocol":"http", + "dmaap.dmaapProducerConfiguration.dmaapUserName":"admin", + "dmaap.dmaapProducerConfiguration.dmaapUserPassword":"admin", + "dmaap.dmaapProducerConfiguration.dmaapContentType": "application/json", + + "dmaap.dmaapUpdateProducerConfiguration.dmaapUrl":"http://dmaap-mr:2222/events/unauthenticated.PNF_UPDATE", + "dmaap.dmaapUpdateProducerConfiguration.dmaapHostName": "dmaap-mr", + "dmaap.dmaapUpdateProducerConfiguration.dmaapPortNumber": 2223, + "dmaap.dmaapUpdateProducerConfiguration.dmaapTopicName": "events/unauthenticated.PNF_UPDATE", + "dmaap.dmaapUpdateProducerConfiguration.dmaapProtocol": "http", + "dmaap.dmaapUpdateProducerConfiguration.dmaapUserName": "admin", + "dmaap.dmaapUpdateProducerConfiguration.dmaapUserPassword": "admin", + "dmaap.dmaapUpdateProducerConfiguration.dmaapContentType": "application/json", + + "aai.aaiClientConfiguration.pnfUrl":"https://aai:3333/aai/v12/network/pnfs/pnf" "aai.aaiClientConfiguration.aaiHost":"aai", + "aai.aaiClientConfiguration.aaiHostPortNumber":3334, "aai.aaiClientConfiguration.aaiProtocol":"https", - "security.enableAaiCertAuth":"true", - "security.enableDmaapCertAuth":"true", - "security.keyStorePath":"/tmp/certs/org.onap.dcae.jks", - "security.keyStorePasswordPath":"/tmp/certs/keystore.password", - "security.trustStorePath":"/tmp/certs/org.onap.dcae.trust.jks", - "security.trustStorePasswordPath":"/tmp/certs/truststore.password" + "aai.aaiClientConfiguration.aaiUserName": "DCAE", + "aai.aaiClientConfiguration.aaiUserPassword": "DCAE", + "aai.aaiClientConfiguration.aaiIgnoreSslCertificateErrors": true, + "aai.aaiClientConfiguration.aaiBasePath": "/aai/v12", + "aai.aaiClientConfiguration.aaiPnfPath": "/network/pnfs/pnf", + "aai.aaiClientConfiguration.aaiServiceInstancePath":"/business/customers/customer/${customer}/service-subscriptions/service-subscription/${serviceType}/service-instances/service-instance/${serviceInstanceId}", + + "security.trustStorePath":"change it", + "security.trustStorePasswordPath":"change it", + "security.keyStorePath":"change it", + "security.keyStorePasswordPath":"change it", + "security.enableAaiCertAuth":false, + "security.enableDmaapCertAuth":false, + + "streams_publishes":{ + "pnf-update":{ + "dmaap_info":{ + "topic_url":"http://dmaap-mr:2222/events/unauthenticated.PNF_UPDATE" + } + }, + "pnf-ready":{ + "dmaap_info":{ + "topic_url":"http://dmaap-mr:2222/events/unauthenticated.PNF_READY" + } + } + }, + "streams_subscribes":{ + "ves-reg-output":{ + "dmaap_info":{ + "topic_url":"http://dmaap-mr:2222/events/unauthenticated.VES_PNFREG_OUTPUT" + } + } + } }' ] depends_on: diff --git a/tests/dcaegen2/prh-testcases/resources/prh_library.robot b/tests/dcaegen2/prh-testcases/resources/prh_library.robot index 4f64694d..c2311852 100644 --- a/tests/dcaegen2/prh-testcases/resources/prh_library.robot +++ b/tests/dcaegen2/prh-testcases/resources/prh_library.robot @@ -26,17 +26,19 @@ Invalid event processing Set event in DMaaP ${data} ${invalid_notification}= Create invalid notification ${data} ${notification}= Catenate SEPARATOR= \\n |Incorrect json, consumerDmaapModel can not be created: ${invalid_notification} - Wait Until Keyword Succeeds 100x 100ms Check PRH log ${notification} + #TODO to fix after CBS merge + #Wait Until Keyword Succeeds 100x 100ms Check PRH log ${notification} Valid event processing [Arguments] ${input_valid__ves_event_in_dmaap} [Timeout] 30s ${data}= Get Data From File ${input_valid__ves_event_in_dmaap} + Set event in DMaaP ${data} ${pnf_name}= Create PNF name ${data} Set PNF name in AAI ${pnf_name} - Set event in DMaaP ${data} ${expected_event_pnf_ready_in_dpaap}= create pnf ready_notification as pnf ready ${data} - Wait Until Keyword Succeeds 100x 300ms Check PNF_READY notification ${expected_event_pnf_ready_in_dpaap} + #TODO to fix after CBS merge + #Wait Until Keyword Succeeds 100x 300ms Check PNF_READY notification ${expected_event_pnf_ready_in_dpaap} Check PRH log [Arguments] ${searched_log} @@ -49,9 +51,12 @@ Check PNF_READY notification Should Be Equal ${resp.text} ${expected_event_pnf_ready_in_dpaap} Set PNF name in AAI - [Arguments] ${pnfs_name} + [Arguments] ${pnf_name} ${headers}= Create Dictionary Accept=application/json Content-Type=text/html - ${resp}= Put Request ${aai_setup_session} /set_pnfs headers=${headers} data=${pnfs_name} + Log AAI url ${AAI_SIMULATOR_SETUP_URL} + Log Http headers ${headers} + Log PNF name ${pnf_name} + ${resp}= Put Request ${aai_setup_session} /set_pnf headers=${headers} data=${pnf_name} Should Be Equal As Strings ${resp.status_code} 200 Set event in DMaaP diff --git a/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py b/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py index bacd1065..baa81651 100644 --- a/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py +++ b/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py @@ -1,40 +1,84 @@ +import logging +import json +import sys import re import time from http.server import BaseHTTPRequestHandler import httpServerLib -pnfs = 'Empty' +ch = logging.StreamHandler(sys.stdout) +handlers = [ch] +logging.basicConfig( + level=logging.DEBUG, + format='[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s', + handlers=handlers +) + +logger = logging.getLogger('AAI-simulator-logger') + +pnf_name = 'Empty' +pnf_entry = {} + + +def _mark_response_as_http_ok(http_endpoint): + logger.info('Execution status 200') + httpServerLib.header_200_and_json(http_endpoint) class AAISetup(BaseHTTPRequestHandler): def do_PUT(self): - if re.search('/set_pnfs', self.path): - global pnfs - content_length = int(self.headers['Content-Length']) - pnfs = self.rfile.read(content_length) - httpServerLib.header_200_and_json(self) + logger.info('AAI SIM Setup Put execution') + if re.search('/set_pnf$', self.path): # to avoid regex collisions '$' must be added + global pnf_name + content_length = self._get_content_length() + pnf_name = self.rfile.read(content_length).decode() + _mark_response_as_http_ok(self) + + if re.search('/set_pnf_entry',self.path): + global pnf_entry + content_length = self._get_content_length() + pnf_entry = json.loads(self.rfile.read(content_length)) + _mark_response_as_http_ok(self) return def do_POST(self): + logger.info('AAI SIM Setup Post execution') if re.search('/reset', self.path): - global pnfs - pnfs = 'Empty' - httpServerLib.header_200_and_json(self) + global pnf_name + pnf_name = 'Empty' + _mark_response_as_http_ok(self) return + def _get_content_length(self): + return int(self.headers['Content-Length']) + class AAIHandler(BaseHTTPRequestHandler): + def do_GET(self): + logger.info('AAI SIM Get execution') + full_request_path = '/aai/v12/network/pnfs/pnf/' + pnf_name + if re.search(full_request_path, self.path): + _mark_response_as_http_ok(self) + body = json.dumps(pnf_entry) + logger.info('AAI SIM Get json prepared') + self.wfile.write(body.encode()) + return + + def do_PATCH(self): - pnfs_name = '/aai/v12/network/pnfs/pnf/' + pnfs.decode() + logger.info('AAI SIM Patch execution') + pnfs_name = '/aai/v12/network/pnfs/pnf/' + pnf_name if re.search('wrong_aai_record', self.path): self.send_response(400) + logger.info('Execution status 400') self.end_headers() elif re.search(pnfs_name, self.path): self.send_response(200) + logger.info('Execution status 200') self.end_headers() return @@ -50,4 +94,4 @@ def _main_(handler_class=AAIHandler, protocol="HTTP/1.0"): if __name__ == '__main__': - _main_() + _main_()
\ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py b/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py index 392c460d..da113e68 100644 --- a/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py +++ b/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py @@ -1,8 +1,20 @@ +import logging import re +import sys import time from http.server import BaseHTTPRequestHandler import httpServerLib +ch = logging.StreamHandler(sys.stdout) +handlers = [ch] +logging.basicConfig( + level=logging.DEBUG, + format='[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s', + handlers=handlers +) + +logger = logging.getLogger('DMaaP-simulator-logger') + posted_event_from_prh = b'Empty' received_event_to_get_method = b'Empty' @@ -10,6 +22,7 @@ received_event_to_get_method = b'Empty' class DmaapSetup(BaseHTTPRequestHandler): def do_PUT(self): + logger.info('DMaaP SIM Setup Put execution') if re.search('/set_get_event', self.path): global received_event_to_get_method content_length = int(self.headers['Content-Length']) @@ -19,6 +32,7 @@ class DmaapSetup(BaseHTTPRequestHandler): return def do_GET(self): + logger.info('DMaaP SIM Setup Get execution') if re.search('/events/pnfReady', self.path): httpServerLib.header_200_and_json(self) self.wfile.write(posted_event_from_prh) @@ -26,6 +40,7 @@ class DmaapSetup(BaseHTTPRequestHandler): return def do_POST(self): + logger.info('DMaaP SIM Setup Post execution') if re.search('/reset', self.path): global posted_event_from_prh global received_event_to_get_method @@ -39,6 +54,7 @@ class DmaapSetup(BaseHTTPRequestHandler): class DMaaPHandler(BaseHTTPRequestHandler): def do_POST(self): + logger.info('DMaaP SIM Post execution') if re.search('/events/unauthenticated.PNF_READY', self.path): global posted_event_from_prh content_length = int(self.headers['Content-Length']) @@ -48,6 +64,7 @@ class DMaaPHandler(BaseHTTPRequestHandler): return def do_GET(self): + logger.info('DMaaP SIM Get execution') if re.search('/events/unauthenticated.VES_PNFREG_OUTPUT/OpenDcae-c12/c12', self.path): httpServerLib.header_200_and_json(self) self.wfile.write(received_event_to_get_method) diff --git a/tests/dcaegen2/prh-testcases/ssl_prh_tests.robot b/tests/dcaegen2/prh-testcases/ssl_prh_tests.robot index 49d2c45a..111a4fbd 100644 --- a/tests/dcaegen2/prh-testcases/ssl_prh_tests.robot +++ b/tests/dcaegen2/prh-testcases/ssl_prh_tests.robot @@ -11,6 +11,8 @@ Resource ../../common.robot *** Variables *** ${DMAAP_SIMULATOR_SETUP_URL} http://${DMAAP_SIMULATOR_SETUP} ${AAI_SIMULATOR_SETUP_URL} http://${AAI_SIMULATOR_SETUP} + +${VES_EVENT_PNF_REGISTRATION_SIMPLE} %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets/json_events/ves-event-pnf-registration-simple.json ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json ${EVENT_WITH_IPV4} %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV4.json ${EVENT_WITH_IPV6} %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV6.json @@ -21,7 +23,8 @@ Valid DMaaP event can be converted to PNF_READY notification with ssl connection [Documentation] PRH get valid event from DMaaP with required fields - PRH produce PNF_READY notification [Tags] PRH Valid event [Template] Valid event processing - ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} - ${EVENT_WITH_IPV4} - ${EVENT_WITH_IPV6} - ${EVENT_WITHOUT_IPV6_FILED} + ${VES_EVENT_PNF_REGISTRATION_SIMPLE} + #${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} + #${EVENT_WITH_IPV4} + #${EVENT_WITH_IPV6} + #${EVENT_WITHOUT_IPV6_FILED} diff --git a/tests/multicloud-k8s/data/create_rbdefinition.json b/tests/multicloud-k8s/data/create_rbdefinition.json index 370c3c79..0373113c 100644 --- a/tests/multicloud-k8s/data/create_rbdefinition.json +++ b/tests/multicloud-k8s/data/create_rbdefinition.json @@ -1,7 +1,9 @@ { - "uuid": "7eb09e38-4363-9942-1234-3beb2e95fd85", - "name": "test-rbdef", + "rb-name": "test-rbdef", + "rb-version": "v1", "chart-name": "testchart", "description": "testing resource bundle definition api", - "service-type": "firewall" + "labels": { + "vnf_customization_module_uuid": "7eb09e38-4363-9942-1234-3beb2e95fd85" + } }
\ No newline at end of file diff --git a/tests/multicloud-k8s/data/create_rbprofile.json b/tests/multicloud-k8s/data/create_rbprofile.json new file mode 100644 index 00000000..72111a4d --- /dev/null +++ b/tests/multicloud-k8s/data/create_rbprofile.json @@ -0,0 +1,11 @@ +{ + "rb-name": "test-rbdef", + "rb-version": "v1", + "profile-name": "profile1", + "release-name": "testrelease", + "namespace": "testnamespace", + "kubernetes-version": "1.12.3", + "labels": { + "vnf_customization_module_uuid": "7eb09e38-4363-9942-1234-3beb2e95fd85" + } +} diff --git a/tests/multicloud-k8s/multicloud-k8s-test.robot b/tests/multicloud-k8s/multicloud-k8s-test.robot index 36d4e668..f81ef011 100644 --- a/tests/multicloud-k8s/multicloud-k8s-test.robot +++ b/tests/multicloud-k8s/multicloud-k8s-test.robot @@ -12,12 +12,24 @@ Create Definition Get Definition [Template] Get template - /v1/rb/definition - /v1/rb/definition/7eb09e38-4363-9942-1234-3beb2e95fd85 + /v1/rb/definition/test-rbdef + /v1/rb/definition/test-rbdef/v1 + +Create Profile + [Template] Post template + /v1/rb/definition/test-rbdef/v1/profile create_rbprofile.json + +Get Profile + [Template] Get template + /v1/rb/definition/test-rbdef/v1/profile/profile1 + +Delete Profile + [Template] Delete template + /v1/rb/definition/test-rbdef/v1/profile/profile1 Delete Definition [Template] Delete template - /v1/rb/definition/7eb09e38-4363-9942-1234-3beb2e95fd85 + /v1/rb/definition/test-rbdef/v1 *** Keywords *** Created session diff --git a/tests/sdnc/sdnc_netconf_tls_post_deploy/_init_.robot b/tests/sdnc/sdnc_netconf_tls_post_deploy/_init_.robot new file mode 100644 index 00000000..d7353060 --- /dev/null +++ b/tests/sdnc/sdnc_netconf_tls_post_deploy/_init_.robot @@ -0,0 +1,2 @@ +1 *** Settings *** +2 Documentation SDNC - keystorecheck diff --git a/tests/sdnc/sdnc_netconf_tls_post_deploy/data/mount.xml b/tests/sdnc/sdnc_netconf_tls_post_deploy/data/mount.xml new file mode 100644 index 00000000..108369bc --- /dev/null +++ b/tests/sdnc/sdnc_netconf_tls_post_deploy/data/mount.xml @@ -0,0 +1,14 @@ +<node xmlns="urn:TBD:params:xml:ns:yang:network-topology"> + <node-id>netopeer2</node-id> + <key-based xmlns="urn:opendaylight:netconf-node-topology"> + <key-id xmlns="urn:opendaylight:netconf-node-topology">ODL_private_key_0</key-id> + <username xmlns="urn:opendaylight:netconf-node-topology">netconf</username> + </key-based> + <host xmlns="urn:opendaylight:netconf-node-topology">pnfaddr</host> + <port xmlns="urn:opendaylight:netconf-node-topology">6513</port> + <tcp-only xmlns="urn:opendaylight:netconf-node-topology">false</tcp-only> + <protocol xmlns="urn:opendaylight:netconf-node-topology"> + <name xmlns="urn:opendaylight:netconf-node-topology">TLS</name> + </protocol> + <max-connection-attempts xmlns="urn:opendaylight:netconf-node-topology">2</max-connection-attempts> +</node> diff --git a/tests/sdnc/sdnc_netconf_tls_post_deploy/sdnc_post_deploy_cert_check.robot b/tests/sdnc/sdnc_netconf_tls_post_deploy/sdnc_post_deploy_cert_check.robot new file mode 100644 index 00000000..f1814144 --- /dev/null +++ b/tests/sdnc/sdnc_netconf_tls_post_deploy/sdnc_post_deploy_cert_check.robot @@ -0,0 +1,39 @@ +*** Settings *** +Library Collections +Library RequestsLibrary +Library OperatingSystem +Library json +Library String + +*** Variables *** +${SDNC_KEYSTORE_CONFIG_PATH} /config/netconf-keystore:keystore +${SDNC_MOUNT_PATH} /config/network-topology:network-topology/topology/topology-netconf/node/netopeer2 +${PNFSIM_MOUNT_PATH} /config/network-topology:network-topology/topology/topology-netconf/node/netopeer2/yang-ext:mount/mynetconf:netconflist + + *** Test Cases *** + Test SDNC Keystore + [Documentation] Checking keystore after SDNC installation + Create Session sdnc http://localhost:8282/restconf + &{headers}= Create Dictionary Authorization=Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ== Content-Type=application/json Accept=application/json + ${resp}= Get Request sdnc ${SDNC_KEYSTORE_CONFIG_PATH} headers=${headers} + Should Be Equal As Strings ${resp.status_code} 200 + ${keystoreContent}= Convert To String ${resp.content} + Log to console ************************* + Log to console ${resp.content} + Log to console ************************* + + Test SDNC PNF Mount + [Documentation] Checking PNF mount after SDNC installation + Create Session sdnc http://localhost:8282/restconf + ${mount}= Get File ${CURDIR}${/}data${/}mount.xml + Log to console ${mount} + &{headers}= Create Dictionary Authorization=Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ== Content-Type=application/xml Accept=application/xml + ${resp}= Put Request sdnc ${SDNC_MOUNT_PATH} data=${mount} headers=${headers} + Should Be Equal As Strings ${resp.status_code} 201 + Sleep 30 + &{headers1}= Create Dictionary Authorization=Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ== Content-Type=application/json Accept=application/json + ${resp1}= Get Request sdnc ${PNFSIM_MOUNT_PATH} headers=${headers1} + Should Be Equal As Strings ${resp1.status_code} 200 + Log to console ${resp1.content} + Should Contain ${resp1.content} netconf-id + Should Contain ${resp1.content} netconf-param
\ No newline at end of file diff --git a/tests/usecases/5G-bulkpm/BulkpmE2E.robot b/tests/usecases/5G-bulkpm/BulkpmE2E.robot index f8ba0fb1..dcf97210 100644 --- a/tests/usecases/5G-bulkpm/BulkpmE2E.robot +++ b/tests/usecases/5G-bulkpm/BulkpmE2E.robot @@ -20,9 +20,9 @@ ${CLI_EXEC_CLI} curl -k https://${DR_PROV_IP}:8443/inte ${CLI_EXEC_CLI_FILECONSUMER} docker exec fileconsumer-node /bin/sh -c "ls /opt/app/subscriber/delivery | grep .xml" ${CLI_EXEC_CLI_DFC_LOG} docker exec dfc /bin/sh -c "cat /var/log/ONAP/application.log" > /tmp/dfc_docker.log.robot ${CLI_EXEC_CLI_DFC_LOG_GREP} grep "Publish to DR successful!" /tmp/dfc_docker.log.robot +${CLI_EXEC_CLI_FILECONSUMER_CP} docker cp fileconsumer-node:/opt/app/subscriber/delivery/xNF.pm.xml.M %{WORKSPACE} +${CLI_EXEC_RENAME_METADATA} mv %{WORKSPACE}/xNF.pm.xml.M %{WORKSPACE}/metadata.json -${CLI_EXEC_CLI_FILECONSUMER_CP} docker cp fileconsumer-node:/opt/app/subscriber/delivery/oteNB5309_xNF.pm.xml.M %{WORKSPACE} -${CLI_EXEC_RENAME_METADATA} mv %{WORKSPACE}/oteNB5309_xNF.pm.xml.M %{WORKSPACE}/metadata.json ${metadataSchemaPath} %{WORKSPACE}/tests/usecases/5G-bulkpm/assets/metadata.schema.json ${metadataJsonPath} %{WORKSPACE}/metadata.json @@ -86,7 +86,7 @@ Verify Fileconsumer Receive PM file from Data Router ${cli_cmd_output}= Run Process ${CLI_EXEC_CLI_FILECONSUMER} shell=yes Log ${cli_cmd_output.stdout} Should Be Equal As Strings ${cli_cmd_output.rc} 0 - Should Contain ${cli_cmd_output.stdout} oteNB5309_xNF.pm.xml + Should Contain ${cli_cmd_output.stdout} xNF.pm.xml Verify File Consumer Receive valid metadata from Data Router [Tags] Bulk_PM_E2E_06 @@ -94,7 +94,7 @@ Verify File Consumer Receive valid metadata from Data Router ${cli_cmd_output}= Run Process ${CLI_EXEC_CLI_FILECONSUMER} shell=yes Log ${cli_cmd_output.stdout} Should Be Equal As Strings ${cli_cmd_output.rc} 0 - Should Contain ${cli_cmd_output.stdout} oteNB5309_xNF.pm.xml.M + Should Contain ${cli_cmd_output.stdout} xNF.pm.xml.M ${cli_cmd_output}= Run Process ${CLI_EXEC_CLI_FILECONSUMER_CP} shell=yes ${cli_cmd_output}= Run Process ${CLI_EXEC_RENAME_METADATA} shell=yes ${validation_result}= Validate ${metadataSchemaPath} ${metadataJsonPath} diff --git a/tests/vfc/gvnfm-vnflcm/test.robot b/tests/vfc/gvnfm-vnflcm/test.robot index cf3d12bc..97463ac1 100644 --- a/tests/vfc/gvnfm-vnflcm/test.robot +++ b/tests/vfc/gvnfm-vnflcm/test.robot @@ -11,6 +11,7 @@ Library HttpLibrary.HTTP ${queryswagger_url} /api/vnflcm/v1/swagger.json ${create_vnf_url} /api/vnflcm/v1/vnf_instances ${delete_vnf_url} /api/vnflcm/v1/vnf_instances +${healthcheck_url} /api/vnflcm/v1/health_check #json files ${create_vnf_json} ${SCRIPTS}/../tests/vfc/gvnfm-vnflcm/jsoninput/create_vnf.json @@ -29,3 +30,14 @@ VnflcmSwaggerTest ${response_json} json.loads ${resp.content} ${swagger_version}= Convert To String ${response_json['swagger']} Should Be Equal ${swagger_version} 2.0 + +VnflcmHealthCheckTest + [Documentation] check health for vnflcm by MSB + ${headers} Create Dictionary Content-Type=application/json Accept=application/json + Create Session web_session http://${VNFLCM_IP}:8801 headers=${headers} + ${resp}= Get Request web_session ${healthcheck_url} + ${responese_code}= Convert To String ${resp.status_code} + List Should Contain Value ${return_ok_list} ${responese_code} + ${response_json} json.loads ${resp.content} + ${health_status}= Convert To String ${response_json['status']} + Should Be Equal ${health_status} active diff --git a/tests/vfc/gvnfm-vnfmgr/test.robot b/tests/vfc/gvnfm-vnfmgr/test.robot new file mode 100644 index 00000000..773d83a1 --- /dev/null +++ b/tests/vfc/gvnfm-vnfmgr/test.robot @@ -0,0 +1,33 @@ +*** settings *** +Library Collections +Library RequestsLibrary +Library OperatingSystem +Library json + +*** Variables *** +@{return_ok_list}= 200 201 202 +${queryswagger_url} /api/vnfmgr/v1/swagger.json +${healthcheck_url} /api/vnfmgr/v1/health_check + +*** Test Cases *** +VnfMgrSwaggerTest + [Documentation] query vnfmgr swagger info rest test + ${headers} Create Dictionary Content-Type=application/json Accept=application/json + Create Session web_session http://${VNFMGR_IP}:8802 headers=${headers} + ${resp}= Get Request web_session ${queryswagger_url} + ${responese_code}= Convert To String ${resp.status_code} + List Should Contain Value ${return_ok_list} ${responese_code} + ${response_json} json.loads ${resp.content} + ${swagger_version}= Convert To String ${response_json['swagger']} + Should Be Equal ${swagger_version} 2.0 + +VnfMgrHealthCheckTest + [Documentation] check health for vnfmgr by MSB + ${headers} Create Dictionary Content-Type=application/json Accept=application/json + Create Session web_session http://${VNFMGR_IP}:8803 headers=${headers} + ${resp}= Get Request web_session ${healthcheck_url} + ${responese_code}= Convert To String ${resp.status_code} + List Should Contain Value ${return_ok_list} ${responese_code} + ${response_json} json.loads ${resp.content} + ${health_status}= Convert To String ${response_json['status']} + Should Be Equal ${health_status} active diff --git a/tests/vfc/gvnfm-vnfres/test.robot b/tests/vfc/gvnfm-vnfres/test.robot index fb87435b..6498de11 100644 --- a/tests/vfc/gvnfm-vnfres/test.robot +++ b/tests/vfc/gvnfm-vnfres/test.robot @@ -7,6 +7,7 @@ Library json *** Variables *** @{return_ok_list}= 200 201 202 ${queryswagger_url} /api/vnfres/v1/swagger.json +${healthcheck_url} /api/vnfres/v1/health_check *** Test Cases *** VnfresSwaggerTest @@ -19,3 +20,14 @@ VnfresSwaggerTest ${response_json} json.loads ${resp.content} ${swagger_version}= Convert To String ${response_json['swagger']} Should Be Equal ${swagger_version} 2.0 + +VnfResHealthCheckTest + [Documentation] check health for vnfres by MSB + ${headers} Create Dictionary Content-Type=application/json Accept=application/json + Create Session web_session http://${VNFRES_IP}:8802 headers=${headers} + ${resp}= Get Request web_session ${healthcheck_url} + ${responese_code}= Convert To String ${resp.status_code} + List Should Contain Value ${return_ok_list} ${responese_code} + ${response_json} json.loads ${resp.content} + ${health_status}= Convert To String ${response_json['status']} + Should Be Equal ${health_status} active diff --git a/tests/vfc/nfvo-catalog/test.robot b/tests/vfc/nfvo-catalog/test.robot index 99dff9bd..b83bee47 100644 --- a/tests/vfc/nfvo-catalog/test.robot +++ b/tests/vfc/nfvo-catalog/test.robot @@ -9,6 +9,7 @@ Library json ${queryswagger_url} /api/catalog/v1/swagger.json ${queryVNFPackage_url} /api/catalog/v1/vnfpackages ${queryNSPackages_url} /api/catalog/v1/nspackages +${healthcheck_url} /api/catalog/v1/health_check *** Test Cases *** GetVNFPackages @@ -17,3 +18,14 @@ GetVNFPackages ${resp}= Get Request web_session ${queryVNFPackage_url} ${responese_code}= Convert To String ${resp.status_code} List Should Contain Value ${return_ok_list} ${responese_code} + +CatalogHealthCheckTest + [Documentation] check health for catalog by MSB + ${headers} Create Dictionary Content-Type=application/json Accept=application/json + Create Session web_session http://${CATALOG_IP}:8806 headers=${headers} + ${resp}= Get Request web_session ${healthcheck_url} + ${responese_code}= Convert To String ${resp.status_code} + List Should Contain Value ${return_ok_list} ${responese_code} + ${response_json} json.loads ${resp.content} + ${health_status}= Convert To String ${response_json['status']} + Should Be Equal ${health_status} active diff --git a/tests/vfc/nfvo-lcm/test.robot b/tests/vfc/nfvo-lcm/test.robot index 44d23292..6711cf69 100644 --- a/tests/vfc/nfvo-lcm/test.robot +++ b/tests/vfc/nfvo-lcm/test.robot @@ -9,8 +9,9 @@ Library HttpLibrary.HTTP *** Variables *** @{return_ok_list}= 200 201 202 204 ${queryswagger_url} /api/nslcm/v1/swagger.json -${create_ns_url} /api/nslcm/v1/ns -${delete_ns_url} /api/nslcm/v1/ns +${create_ns_url} /api/nslcm/v1/ns +${delete_ns_url} /api/nslcm/v1/ns +${healthcheck_url} /api/nslcm/v1/health_check #json files ${create_ns_json} ${SCRIPTS}/../tests/vfc/nfvo-lcm/jsoninput/create_ns.json @@ -62,3 +63,14 @@ DeleteNS Test ${resp}= Delete Request web_session ${delete_ns_url}/${nsInstId} ${responese_code}= Convert To String ${resp.status_code} List Should Contain Value ${return_ok_list} ${responese_code} + +LcmHealthCheckTest + [Documentation] check health for nslcm by MSB + ${headers} Create Dictionary Content-Type=application/json Accept=application/json + Create Session web_session http://${MSB_IAG_IP}:80 headers=${headers} + ${resp}= Get Request web_session ${healthcheck_url} + ${responese_code}= Convert To String ${resp.status_code} + List Should Contain Value ${return_ok_list} ${responese_code} + ${response_json} json.loads ${resp.content} + ${health_status}= Convert To String ${response_json['status']} + Should Be Equal ${health_status} active |