diff options
31 files changed, 526 insertions, 302 deletions
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 2c2610a0..018f590a 100644 --- a/plans/dcaegen2-collectors-hv-ves/testsuites/collector/configuration/secure.json +++ b/plans/dcaegen2-collectors-hv-ves/testsuites/collector/configuration/secure.json @@ -6,7 +6,7 @@ "cbs.firstRequestDelaySec": 3, "cbs.requestIntervalSec": 5, "security.keys.keyStoreFile": "/etc/hv-ves/ssl/server.p12", - "security.keys.keyStorePassword": "onaponap", + "security.keys.keyStorePasswordFile": "/etc/hv-ves/ssl/server.pass", "security.keys.trustStoreFile": "/etc/hv-ves/ssl/trust.p12", - "security.keys.trustStorePassword": "onaponap" + "security.keys.trustStorePasswordFile": "/etc/hv-ves/ssl/trust.pass" }
\ No newline at end of file diff --git a/plans/dcaegen2-collectors-hv-ves/testsuites/collector/ssl/.gitignore b/plans/dcaegen2-collectors-hv-ves/testsuites/collector/ssl/.gitignore index 0729569c..955c17d1 100644 --- a/plans/dcaegen2-collectors-hv-ves/testsuites/collector/ssl/.gitignore +++ b/plans/dcaegen2-collectors-hv-ves/testsuites/collector/ssl/.gitignore @@ -4,3 +4,4 @@ *.csr *.pkcs12 *.p12 +*.pass diff --git a/plans/dcaegen2-collectors-hv-ves/testsuites/collector/ssl/gen-certs.sh b/plans/dcaegen2-collectors-hv-ves/testsuites/collector/ssl/gen-certs.sh index 9f6bea20..33e3b32b 100755 --- a/plans/dcaegen2-collectors-hv-ves/testsuites/collector/ssl/gen-certs.sh +++ b/plans/dcaegen2-collectors-hv-ves/testsuites/collector/ssl/gen-certs.sh @@ -41,6 +41,8 @@ function gen_key() { keytool -certreq -alias ${key_name} -keyalg RSA ${keystore} | \ keytool -alias ${ca} -gencert -ext "san=dns:${CN_PREFIX}-${ca}" ${store_opts} -keystore ${ca}.p12 | \ keytool -alias ${key_name} -importcert ${keystore} + + printf ${STORE_PASS} > ${key_name}.pass } @@ -54,10 +56,11 @@ function gen_truststore() { local name="$1" local trusted_ca="$2" keytool -import -trustcacerts -alias ca -file ${trusted_ca}.crt ${store_opts} -keystore ${name}.p12 + printf ${STORE_PASS} > ${name}.pass } function clean() { - rm -f *.crt *.p12 + rm -f *.crt *.p12 *.pass } if [[ $# -eq 0 ]]; then @@ -74,4 +77,3 @@ else echo "usage: $0 [clean]" exit 1 fi - diff --git a/plans/dcaegen2-collectors-hv-ves/testsuites/env.sh b/plans/dcaegen2-collectors-hv-ves/testsuites/env.sh index a5a0a4f0..05314841 100755 --- a/plans/dcaegen2-collectors-hv-ves/testsuites/env.sh +++ b/plans/dcaegen2-collectors-hv-ves/testsuites/env.sh @@ -18,7 +18,7 @@ # ============LICENSE_END========================================================= # using WORKSPACE variable defined in run-csit.sh -export ROBOT_VARIABLES="--pythonpath ${WORKSPACE}/tests/dcaegen2-collectors-hv-ves/testcases/libraries" +export ROBOT_VARIABLES="--pythonpath ${WORKSPACE}/tests/dcaegen2-collectors-hv-ves/testcases/libraries --noncritical non-critical" export JAVA_OPTS="-Dio.netty.leakDetection.level=paranoid" export CONSUL_HOST="consul-server" diff --git a/plans/dcaegen2-collectors-hv-ves/testsuites/env_local.sh b/plans/dcaegen2-collectors-hv-ves/testsuites/env_local.sh index 280f0c47..20b538b5 100755 --- a/plans/dcaegen2-collectors-hv-ves/testsuites/env_local.sh +++ b/plans/dcaegen2-collectors-hv-ves/testsuites/env_local.sh @@ -18,7 +18,7 @@ # ============LICENSE_END========================================================= export WORKSPACE=$(git rev-parse --show-toplevel) -export ROBOT_VARIABLES="--pythonpath ${WORKSPACE}/tests/dcaegen2-collectors-hv-ves/testcases/libraries" +export ROBOT_VARIABLES="--pythonpath ${WORKSPACE}/tests/dcaegen2-collectors-hv-ves/testcases/libraries --noncritical non-critical" export JAVA_OPTS="-Dio.netty.leakDetection.level=paranoid" export CONSUL_HOST="consul-server" diff --git a/plans/dmaap/mrpubsub/setup.sh b/plans/dmaap/mrpubsub/setup.sh index 5a670d28..c2c9b133 100755 --- a/plans/dmaap/mrpubsub/setup.sh +++ b/plans/dmaap/mrpubsub/setup.sh @@ -21,57 +21,9 @@ # =================================================================== # ECOMP is a trademark and service mark of AT&T Intellectual Property. # -# Place the scripts in run order: -source ${SCRIPTS}/common_functions.sh - -# Clone DMaaP Message Router repo -mkdir -p $WORKSPACE/archives/dmaapmr -cd $WORKSPACE/archives/dmaapmr -#unset http_proxy https_proxy -git clone --depth 1 http://gerrit.onap.org/r/dmaap/messagerouter/messageservice -b master -git pull -cd $WORKSPACE/archives/dmaapmr/messageservice/src/main/resources/docker-compose -cp $WORKSPACE/archives/dmaapmr/messageservice/bundleconfig-local/etc/appprops/MsgRtrApi.properties /var/tmp/ - - - -# Update kafkfa and zookeeper properties in MsgRtrApi.propeties which will be copied to DMaaP Container -sed -i -e 's/<zookeeper_host>/zookeeper/' /var/tmp/MsgRtrApi.properties -sed -i -e 's/<kafka_host>:<kafka_port>/kafka:9092/' /var/tmp/MsgRtrApi.properties - -# start DMaaP MR containers with docker compose and configuration from docker-compose.yml -docker-compose build -docker login -u docker -p docker nexus3.onap.org:10001 -docker-compose up -d - -# Wait for initialization of Docker containers -for i in {1..50}; do - if [ $(docker inspect --format '{{ .State.Running }}' dockercompose_dmaap_1) ] && \ - [ $(docker inspect --format '{{ .State.Running }}' dockercompose_zookeeper_1) ] && \ - [ $(docker inspect --format '{{ .State.Running }}' dockercompose_dmaap_1) ] - then - echo "DMaaP Service Running" - break - else - echo sleep $i - sleep $i - fi -done - -DMAAP_MR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_dmaap_1) -KAFKA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_kafka_1) -ZOOKEEPER_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockercompose_zookeeper_1) - -echo DMAAP_MR_IP=${DMAAP_MR_IP} -echo KAFKA_IP=${KAFKA_IP} -echo ZOOKEEPER_IP=${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 - echo sleep $i - sleep $i -done +source ${WORKSPACE}/scripts/dmaap-message-router/dmaap-mr-launch.sh +dmaap_mr_launch +DMAAP_MR_IP=${IP} #Pass any variables required by Robot test suites in ROBOT_VARIABLES ROBOT_VARIABLES="-v DMAAP_MR_IP:${DMAAP_MR_IP}" diff --git a/plans/dmaap/mrpubsub/teardown.sh b/plans/dmaap/mrpubsub/teardown.sh index 1b430324..4758163d 100755 --- a/plans/dmaap/mrpubsub/teardown.sh +++ b/plans/dmaap/mrpubsub/teardown.sh @@ -17,6 +17,5 @@ # Modifications copyright (c) 2017 AT&T Intellectual Property # -kill-instance.sh dockercompose_dmaap_1 -kill-instance.sh dockercompose_kafka_1 -kill-instance.sh dockercompose_zookeeper_1 +source ${WORKSPACE}/scripts/dmaap-message-router/dmaap-mr-teardown.sh +dmaap_mr_teardown diff --git a/plans/usecases/5G-bulkpm/assets/datafile_endpoints.json b/plans/usecases/5G-bulkpm/assets/datafile_endpoints.json index 2e2b67a8..d07e3d82 100644 --- a/plans/usecases/5G-bulkpm/assets/datafile_endpoints.json +++ b/plans/usecases/5G-bulkpm/assets/datafile_endpoints.json @@ -26,10 +26,10 @@ }, "ftp": { "ftpesConfiguration": { - "keyCert": "/config/ftpKey.jks", + "keyCert": "/config/dfc.jks", "keyPassword": "secret", - "trustedCA": "/config/ftpKey.jks", - "trustedCAPassword": "secret" + "trustedCa": "/config/ftp.jks", + "trustedCaPassword": "secret" } }, "security": { diff --git a/plans/usecases/5G-bulkpm/composefile/docker-compose-e2e.yml b/plans/usecases/5G-bulkpm/composefile/docker-compose-e2e.yml index 86c5fe3b..7880656b 100644 --- a/plans/usecases/5G-bulkpm/composefile/docker-compose-e2e.yml +++ b/plans/usecases/5G-bulkpm/composefile/docker-compose-e2e.yml @@ -22,6 +22,7 @@ services: retries: 5 extra_hosts: - "dmaap-dr-node:1.1.1.1" + - "dcae-pm-mapper:3.3.3.3" datarouter-node: image: nexus3.onap.org:10001/onap/dmaap/datarouter-node:2.1.0-SNAPSHOT-latest @@ -37,6 +38,7 @@ services: condition: service_healthy extra_hosts: - "dmaap-dr-prov:2.2.2.2" + - "dcae-pm-mapper:3.3.3.3" datarouter-subscriber: image: nexus3.onap.org:10001/onap/dmaap/datarouter-subscriber:2.1.0-SNAPSHOT-latest diff --git a/plans/usecases/5G-bulkpm/setup.sh b/plans/usecases/5G-bulkpm/setup.sh index 5d99b1c1..1bba4f30 100644 --- a/plans/usecases/5G-bulkpm/setup.sh +++ b/plans/usecases/5G-bulkpm/setup.sh @@ -70,8 +70,6 @@ cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/res mkdir docker-compose cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources/docker-compose cp $WORKSPACE/plans/usecases/5G-bulkpm/composefile/docker-compose-e2e.yml $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources/docker-compose/docker-compose.yml -cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/docker-databus-controller.conf /tmp/ -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 @@ -170,9 +168,6 @@ for i in {1..10}; do done sleep 10 -#Pass any variables required by Robot test suites in ROBOT_VARIABLES -ROBOT_VARIABLES="-v DR_PROV_IP:${DR_PROV_IP} -v DR_NODE_IP:${DR_NODE_IP} -v DMAAP_MR_IP:${DMAAP_MR_IP} -v VESC_IP:${VESC_IP} -v VESC_PORT:${VESC_PORT} -v DR_SUBSCIBER_IP:${DR_SUBSCIBER_IP} -v SFTP_IP:${SFTP_IP}" - pip install jsonschema uuid simplejson # Wait container ready sleep 2 @@ -182,6 +177,7 @@ cp $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotification. sed -i 's/sftpserver/'${SFTP_IP}'/g' $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotificationUpdated.json sed -i 's/sftpport/'${SFTP_PORT}'/g' $WORKSPACE/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotificationUpdated.json docker cp $WORKSPACE/plans/usecases/5G-bulkpm/assets/xNF.pm.xml.gz sftp:/home/admin/ +docker cp $WORKSPACE/tests/dcaegen2-pmmapper/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml.gz sftp:/home/admin/ # Data Router Configuration: # Create default feed and create file consumer subscriber on data router @@ -192,6 +188,56 @@ curl -v -X POST -H "Content-Type:application/vnd.dmaap-dr.subscription" -H "X-DM sleep 10 curl -k https://$DR_PROV_IP:8443/internal/prov +# Consul Configuration for PM Mapper +cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/cbs.json /tmp/cbs.json +sed -i 's/ipaddress/'${CBS_IP}'/g' /tmp/cbs.json +curl --request PUT --data @/tmp/cbs.json http://$CONSUL_IP:8500/v1/agent/service/register +curl 'http://'$CONSUL_IP':8500/v1/kv/pmmapper?dc=dc1' -X PUT -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' --data @$WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/config.json + +# PM Mapper startup and configuration +mkdir /tmp/docker-compose +cd /tmp/docker-compose +cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/composefile/docker-compose-pmmapper.yml /tmp/docker-compose/docker-compose.yml +CBS_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' cbs) +sed -i 's/CBSIP/'$CBS_IP'/g' docker-compose.yml +sed -i 's/1.1.1.1/'$DR_NODE_IP'/g' docker-compose.yml +sed -i 's/4.4.4.4/'$DMAAP_MR_IP'/g' docker-compose.yml +docker-compose up -d + +cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources/docker-compose +PMMAPPER_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' pmmapper) +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 +sed -i 's/3.3.3.3/'$PMMAPPER_IP'/g' docker-compose.yml +docker-compose up -d + +# Setting up PM Mapper certs. +docker cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/cert.jks.b64 pmmapper:opt/app/pm-mapper/etc/ +docker cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/jks.pass pmmapper:opt/app/pm-mapper/etc/ +docker cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/trust.jks.b64 pmmapper:opt/app/pm-mapper/etc/ +docker cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/trust.pass pmmapper:opt/app/pm-mapper/etc/ +docker restart pmmapper +sleep 5 + +# Create PM Mapper feed and create PM Mapper subscriber on data router +#curl -v -X POST -H "Content-Type:application/vnd.dmaap-dr.feed" -H "X-DMAAP-DR-ON-BEHALF-OF:pmmapper" --data-ascii @$WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/createFeed.json --post301 --location-trusted -k https://${DR_PROV_IP}:8443 +curl -v -X POST -H "Content-Type:application/vnd.dmaap-dr.subscription" -H "X-DMAAP-DR-ON-BEHALF-OF:pmmapper" --data-ascii @$WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/addSubscriber.json --post301 --location-trusted -k https://${DR_PROV_IP}:8443/subscribe/1 + +# Create PM Mapper tocic in Message Router +curl -v -X POST http://${DMAAP_MR_IP}:3904/topics/create -d @$WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/createTopic.json -H "Content-Type: application/json" +PMMAPPER_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' pmmapper) +docker exec pmmapper /bin/sh -c "cat /var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log" > /tmp/pmmapper.log +cat /tmp/pmmapper.log +docker exec -it datarouter-prov sh -c "curl http://dmaap-dr-node:8080/internal/fetchProv" +sleep 10 +curl -k https://$DR_PROV_IP:8443/internal/prov +curl http://${DMAAP_MR_IP}:3904/events/PM_MAPPER/CG1/C1?timeout=1000 + +#Pass any variables required by Robot test suites in ROBOT_VARIABLES +ROBOT_VARIABLES="-v DR_PROV_IP:${DR_PROV_IP} -v DR_NODE_IP:${DR_NODE_IP} -v DMAAP_MR_IP:${DMAAP_MR_IP} -v VESC_IP:${VESC_IP} -v VESC_PORT:${VESC_PORT} -v DR_SUBSCIBER_IP:${DR_SUBSCIBER_IP} -v SFTP_IP:${SFTP_IP}" + else ############################################################ ############################################################ diff --git a/plans/usecases/5G-bulkpm/teardown.sh b/plans/usecases/5G-bulkpm/teardown.sh index 78de7594..782a289c 100644 --- a/plans/usecases/5G-bulkpm/teardown.sh +++ b/plans/usecases/5G-bulkpm/teardown.sh @@ -1,9 +1,15 @@ #!/bin/bash echo "Starting teardown script" docker exec dfc /bin/sh -c "less /var/log/ONAP/application.log" > /tmp/dfc_docker.log +echo "===== DFC LOG ========" cat /tmp/dfc_docker.log sleep 3 -rm /tmp/dfc_docker.log.robot +echo "===== PM MAPPER LOG ========" +cat /tmp/pmmapper_docker.log.robot +sleep 2 +echo "===== MR LOG ========" +cat /tmp/mr.log +sleep 2 kill-instance.sh $DMAAP kill-instance.sh $KAFKA kill-instance.sh $ZOOKEEPER @@ -15,4 +21,5 @@ kill-instance.sh mariadb kill-instance.sh dfc kill-instance.sh sftp kill-instance.sh cbs -kill-instance.sh consul
\ No newline at end of file +kill-instance.sh consul +kill-instance.sh pmmapper
\ No newline at end of file diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot b/tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot index 1e574b0e..92b65cd6 100644 --- a/tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot +++ b/tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot @@ -34,23 +34,14 @@ HV-VES Collector Suites Setup Configure collector ${CONSUL_API_ACCESS}= Get Consul Api Access Url ${HTTP_METHOD_URL} ${CONSUL_CONTAINER_HOST} ${CONSUL_CONTAINER_PORT} ${CONSUL_API_URL}= Catenate SEPARATOR= ${CONSUL_API_ACCESS} ${CONSUL_HV_VES_CONFIGURATION_KEY_PATH} + Set Suite Variable ${CONSUL_API_URL} children=True Publish HV VES Configuration In Consul ${CONSUL_API_URL} ${HV_VES_CONFIGURATION_JSON_FILEPATH} Configure Dcae App - ${DCAE_APP_API_ACCESS}= Get Dcae App Api Access Url ${HTTP_METHOD_URL} ${DCAE_APP_CONTAINER_HOST} ${DCAE_APP_CONTAINER_PORT} - - ${DCAE_APP_API_MESSAGE_RESET_URL}= Catenate SEPARATOR= ${DCAE_APP_API_ACCESS} ${DCAE_APP_API_MESSAGES_RESET_PATH} - Set Suite Variable ${DCAE_APP_API_MESSAGE_RESET_URL} children=True - - ${DCAE_APP_API_MESSAGES_COUNT_URL}= Catenate SEPARATOR= ${DCAE_APP_API_ACCESS} ${DCAE_APP_API_MESSAGES_COUNT_PATH} - Set Suite Variable ${DCAE_APP_API_MESSAGES_COUNT_URL} children=True - - ${DCAE_APP_API_MESSAGES_VALIDATION_URL}= Catenate SEPARATOR= ${DCAE_APP_API_ACCESS} ${DCAE_APP_API_MESSAGES_VALIDATION_PATH} - Set Suite Variable ${DCAE_APP_API_MESSAGES_VALIDATION_URL} children=True - - ${DCAE_APP_API_TOPIC_CONFIGURATION_URL}= Catenate SEPARATOR= ${DCAE_APP_API_ACCESS} ${DCAE_APP_API_TOPIC_CONFIGURATION_PATH} Wait until keyword succeeds 10 sec 5 sec - ... Configure Dcae App Simulator To Consume Messages From Topics ${DCAE_APP_API_TOPIC_CONFIGURATION_URL} ${ROUTED_MESSAGES_TOPIC} + ... Configure Dcae App Simulator To Consume Messages From Topics ${DEFAULT_PERF3GPP_TOPIC},${SECOND_PERF3GPP_TOPIC} + Set Suite Variable ${DEFAULT_PERF3GPP_TOPIC} children=True + Set Suite Variable ${SECOND_PERF3GPP_TOPIC} children=True *** Variables *** @@ -60,15 +51,8 @@ ${CONSUL_CONTAINER_HOST} consul-server ${CONSUL_CONTAINER_PORT} 8500 ${CONSUL_HV_VES_CONFIGURATION_KEY_PATH} /v1/kv/dcae-hv-ves-collector -${DCAE_APP_CONTAINER_HOST} dcae-app-simulator -${DCAE_APP_CONTAINER_PORT} 6063 -${DCAE_APP_API_TOPIC_CONFIGURATION_PATH} /configuration/topics -${DCAE_APP_API_MESSAGES_RESET_PATH} /messages -${DCAE_APP_API_MESSAGES_PATH} /messages/all -${DCAE_APP_API_MESSAGES_COUNT_PATH} ${DCAE_APP_API_MESSAGES_PATH}/count -${DCAE_APP_API_MESSAGES_VALIDATION_PATH} ${DCAE_APP_API_MESSAGES_PATH}/validate - -${ROUTED_MESSAGES_TOPIC} TEST_HV_VES_PERF3GPP +${DEFAULT_PERF3GPP_TOPIC} TEST_HV_VES_PERF3GPP +${SECOND_PERF3GPP_TOPIC} TEST_HV_VES_PERF3GPP_BUT_WITH_EXTRA_WORDS ${HV_VES_RESOURCES} %{WORKSPACE}/tests/dcaegen2-collectors-hv-ves/testcases/resources ${HV_VES_CONFIGURATION_JSON_FILEPATH} ${HV_VES_RESOURCES}/hv-ves-configuration.json diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/authorization.robot b/tests/dcaegen2-collectors-hv-ves/testcases/authorization.robot index 4d13a6bf..537cb8c1 100644 --- a/tests/dcaegen2-collectors-hv-ves/testcases/authorization.robot +++ b/tests/dcaegen2-collectors-hv-ves/testcases/authorization.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. @@ -51,7 +51,7 @@ Authorization Send Messages From xNF Simulators ${XNF_WITH_INVALID_CERTIFICATES} ${XNF_VALID_MESSAGES_REQUEST} Wait until keyword succeeds 60 sec 5 sec - ... Assert Dcae App Consumed ${DCAE_APP_API_MESSAGES_COUNT_URL} ${AMOUNT_0} + ... Assert Dcae App Consumed ${DEFAULT_PERF3GPP_TOPIC} ${AMOUNT_0} Unencrypted connection from client [Documentation] VES-HV Collector should not authorize XNF trying to connect through unencrypted connection @@ -59,7 +59,7 @@ Unencrypted connection from client Send Messages From xNF Simulators ${XNF_WITHOUT_SSL} ${XNF_VALID_MESSAGES_REQUEST} Wait until keyword succeeds 60 sec 5 sec - ... Assert Dcae App Consumed ${DCAE_APP_API_MESSAGES_COUNT_URL} ${AMOUNT_0} + ... Assert Dcae App Consumed ${DEFAULT_PERF3GPP_TOPIC} ${AMOUNT_0} Unencrypted connection on both ends [Documentation] When run without SSL turned on, VES-HV Collector should route all valid messages @@ -68,7 +68,7 @@ Unencrypted connection on both ends Send Messages From xNF Simulators ${XNF_WITHOUT_SSL_CONNECTING_TO_UNENCRYPTED_HV_VES} ${XNF_VALID_MESSAGES_REQUEST} Wait until keyword succeeds 60 sec 5 sec - ... Assert Dcae App Consumed ${DCAE_APP_API_MESSAGES_COUNT_URL} ${AMOUNT_5000} + ... Assert Dcae App Consumed ${DEFAULT_PERF3GPP_TOPIC} ${AMOUNT_5000} *** Variables *** diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/configuration.robot b/tests/dcaegen2-collectors-hv-ves/testcases/configuration.robot new file mode 100644 index 00000000..945cb81e --- /dev/null +++ b/tests/dcaegen2-collectors-hv-ves/testcases/configuration.robot @@ -0,0 +1,83 @@ +# ============LICENSE_START======================================================= +# csit-dcaegen2-collectors-hv-ves +# ================================================================================ +# Copyright (C) 2019 NOKIA +# ================================================================================ +# 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========================================================= + +*** Settings *** +Library DcaeAppSimulatorLibrary +Library ConsulLibrary +Library BuiltIn + +Resource resources/common-keywords.robot + +Suite Setup Configuration Changes Suite Setup +Suite Teardown VES-HV Collector Suite Teardown +Test Teardown VES-HV Collector Test Shutdown + +*** Keywords *** +Configuration Changes Suite Setup + Log Started Suite: VES-HV Client Configuration Changes + Configure Single xNF Simulator + Log Suite setup finished + +Change Configuration + [Arguments] ${CONFIGURATION_JSON_FILEPATH} ${MESSAGES_TOPIC} + Publish HV VES Configuration In Consul ${CONSUL_API_URL} ${CONFIGURATION_JSON_FILEPATH} + # Assure configuration fetch in hv-ves + Sleep 10 + +*** Test Cases *** +Configuration change + [Tags] non-critical + [Documentation] VES-HV Collector should adapt to changing configuration + # Given + Change Configuration ${DIFFERENT_TOPIC_CONFIGURATION_JSON_FILEPATH} ${SECOND_PERF3GPP_TOPIC} + + # When + Send Messages From xNF Simulators ${XNF_SIMULATOR} ${XNF_VALID_MESSAGES_REQUEST} + + # Then they are published to this topic + Wait until keyword succeeds 30 sec 3 sec + ... Assert Dcae App Consumed ${SECOND_PERF3GPP_TOPIC} ${AMOUNT_1000} + Assert Dcae App Consumed ${DEFAULT_PERF3GPP_TOPIC} ${AMOUNT_0} + + Log First configuration change assertion passed + Reset DCAE App Simulator ${DEFAULT_PERF3GPP_TOPIC} + Reset DCAE App Simulator ${SECOND_PERF3GPP_TOPIC} + + # Given configuration change + Change Configuration ${HV_VES_CONFIGURATION_JSON_FILEPATH} ${DEFAULT_PERF3GPP_TOPIC} + + # When + Send Messages From xNF Simulators ${XNF_SIMULATOR} ${XNF_VALID_MESSAGES_REQUEST} + + # Then they are published to this topic + Wait until keyword succeeds 30 sec 3 sec + ... Assert Dcae App Consumed ${DEFAULT_PERF3GPP_TOPIC} ${AMOUNT_1000} + Assert Dcae App Consumed ${SECOND_PERF3GPP_TOPIC} ${AMOUNT_0} + + + +*** Variables *** +${AMOUNT_0} 0 +${AMOUNT_1000} 1000 + +${HV_VES_SCENARIOS} %{WORKSPACE}/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios +${XNF_VALID_MESSAGES_REQUEST} ${HV_VES_SCENARIOS}/configuration-change/xnf-valid-messages-request.json + +${HV_VES_RESOURCES} %{WORKSPACE}/tests/dcaegen2-collectors-hv-ves/testcases/resources +${HV_VES_CONFIGURATION_JSON_FILEPATH} ${HV_VES_RESOURCES}/hv-ves-configuration.json +${DIFFERENT_TOPIC_CONFIGURATION_JSON_FILEPATH} ${HV_VES_RESOURCES}/hv-ves-configuration-with-different-topic.json diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/libraries/DcaeAppSimulatorLibrary.py b/tests/dcaegen2-collectors-hv-ves/testcases/libraries/DcaeAppSimulatorLibrary.py index dd41c6a3..ccad4308 100644 --- a/tests/dcaegen2-collectors-hv-ves/testcases/libraries/DcaeAppSimulatorLibrary.py +++ b/tests/dcaegen2-collectors-hv-ves/testcases/libraries/DcaeAppSimulatorLibrary.py @@ -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. @@ -16,48 +16,56 @@ # limitations under the License. # ============LICENSE_END========================================================= import HttpRequests +from VesHvContainersUtilsLibrary import VesHvContainersUtilsLibrary from robot.api import logger +import json -DCAE_APP_NAME = "DCAE App" +DCAE_APP_NAME = "DCAE App Simulator" + +DCAE_APP_HOST = "dcae-app-simulator" +DCAE_APP_PORT = "6063" +DCAE_APP_ADDRESS = VesHvContainersUtilsLibrary().get_dcae_app_api_access_url("http://", DCAE_APP_HOST, DCAE_APP_PORT) + +TOPIC_CONFIGURATION_PATH = DCAE_APP_ADDRESS + "/configuration/topics" + +MESSAGES_PATH = "/messages/%s" +MESSAGES_RESET_PATH = DCAE_APP_ADDRESS + MESSAGES_PATH +MESSAGES_COUNT_PATH = DCAE_APP_ADDRESS + MESSAGES_PATH + "/count" +MESSAGES_VALIDATION_PATH = DCAE_APP_ADDRESS + MESSAGES_PATH + "/validate" class DcaeAppSimulatorLibrary: - def configure_dcae_app_simulator_to_consume_messages_from_topics(self, app_url, topics): - logger.info("PUT at: " + app_url) - resp = HttpRequests.session_without_env().put(app_url, data={'topics': topics}, timeout=10) + def configure_dcae_app_simulator_to_consume_messages_from_topics(self, topics): + app_url = TOPIC_CONFIGURATION_PATH + logger.info("PUT " + str(topics) + " at: " + app_url) + resp = HttpRequests.session_without_env().put(app_url, data=self.not_escaped(topics), timeout=10) HttpRequests.checkStatusCode(resp.status_code, DCAE_APP_NAME) - def assert_DCAE_app_consumed(self, app_url, expected_messages_amount): - logger.info("GET at: " + app_url) + def not_escaped(self, data): + return json.dumps(data) + + def assert_DCAE_app_consumed(self, topic, expected_messages_amount): + app_url = MESSAGES_COUNT_PATH % topic + logger.info("GET at: " + str(app_url)) resp = HttpRequests.session_without_env().get(app_url, timeout=10) HttpRequests.checkStatusCode(resp.status_code, DCAE_APP_NAME) assert int(resp.content) == int(expected_messages_amount), \ "Messages consumed by simulator: " + str(resp.content) + " expecting: " + str(expected_messages_amount) - def assert_DCAE_app_consumed_less_equal_than(self, app_url, messages_threshold): - logger.info("GET at: " + app_url) - resp = HttpRequests.session_without_env().get(app_url, timeout=10) - HttpRequests.checkStatusCode(resp.status_code, DCAE_APP_NAME) - - logger.debug("Messages consumed by simulator: " + resp.content + - " expecting more than 0 and less/equal than " + messages_threshold) - - assert 0 < int(resp.content) <= int(messages_threshold), \ - "Messages consumed by simulator: " + str(resp.content) + \ - " expecting more than 0 and less/equal than " + str(messages_threshold) - - def reset_DCAE_app_simulator(self, app_url): + def reset_DCAE_app_simulator(self, topic): + app_url = MESSAGES_RESET_PATH % topic logger.info("DELETE at: " + app_url) resp = HttpRequests.session_without_env().delete(app_url, timeout=10) HttpRequests.checkStatusCode(resp.status_code, DCAE_APP_NAME) - def assert_DCAE_app_consumed_proper_messages(self, app_url, message_filepath): - logger.info("POST at: " + app_url) + def assert_DCAE_app_consumed_proper_messages(self, topic, message_filepath): + app_url = MESSAGES_VALIDATION_PATH % topic file = open(message_filepath, "rb") data = file.read() file.close() + logger.info("POST " + str(data) + "at: " + app_url) resp = HttpRequests.session_without_env().post(app_url, data=data, timeout=10) HttpRequests.checkStatusCode(resp.status_code, DCAE_APP_NAME) diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/libraries/HttpRequests.py b/tests/dcaegen2-collectors-hv-ves/testcases/libraries/HttpRequests.py index 4aa55d6c..48205f2a 100644 --- a/tests/dcaegen2-collectors-hv-ves/testcases/libraries/HttpRequests.py +++ b/tests/dcaegen2-collectors-hv-ves/testcases/libraries/HttpRequests.py @@ -33,4 +33,4 @@ def session_without_env(): def checkStatusCode(status_code, server_name): if status_code not in valid_status_codes: logger.error("Response status code from " + server_name + ": " + str(status_code)) - raise (Exception(server_name + " returned status code " + status_code)) + raise (Exception(server_name + " returned status code " + str(status_code))) diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/libraries/XnfSimulatorLibrary.py b/tests/dcaegen2-collectors-hv-ves/testcases/libraries/XnfSimulatorLibrary.py index 789c0b69..ea225c53 100644 --- a/tests/dcaegen2-collectors-hv-ves/testcases/libraries/XnfSimulatorLibrary.py +++ b/tests/dcaegen2-collectors-hv-ves/testcases/libraries/XnfSimulatorLibrary.py @@ -158,8 +158,9 @@ class XnfSimulator: cert_name_prefix = "" if should_use_valid_certs else "untrusted" certificates_path_with_file_prefix = COLLECTOR_CERTS_LOOKUP_DIR + cert_name_prefix self.key_store_path = certificates_path_with_file_prefix + "client.p12" + self.key_store_passwd_path = certificates_path_with_file_prefix + "client.pass" self.trust_store_path = certificates_path_with_file_prefix + "trust.p12" - self.sec_store_passwd = "onaponap" + self.trust_store_passwd_path = certificates_path_with_file_prefix + "trust.pass" self.disable_ssl = should_disable_ssl self.hv_collector_host = UNENCRYPTED_HV_VES_SERVICE_NAME \ if should_connect_to_unencrypted_hv_ves else HV_VES_SERVICE_NAME @@ -171,8 +172,8 @@ class XnfSimulator: "--ves-port", "6061", "--key-store", self.key_store_path, "--trust-store", self.trust_store_path, - "--key-store-password", self.sec_store_passwd, - "--trust-store-password", self.sec_store_passwd] + "--key-store-password-file", self.key_store_passwd_path, + "--trust-store-password-file", self.trust_store_passwd_path] if self.disable_ssl: startup_command.append("--ssl-disable") return startup_command diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/message-routing.robot b/tests/dcaegen2-collectors-hv-ves/testcases/message-routing.robot index 985c3793..40923aab 100644 --- a/tests/dcaegen2-collectors-hv-ves/testcases/message-routing.robot +++ b/tests/dcaegen2-collectors-hv-ves/testcases/message-routing.robot @@ -42,8 +42,8 @@ Correct Messages Routing Send Messages From xNF Simulators ${XNF_SIMULATOR} ${XNF_FIXED_PAYLOAD_REQUEST} Wait until keyword succeeds 60 sec 5 sec - ... Assert Dcae App Consumed ${DCAE_APP_API_MESSAGES_COUNT_URL} ${AMOUNT_25000} - Assert Dcae App Consumed Proper Messages ${DCAE_APP_API_MESSAGES_VALIDATION_URL} ${DCAE_FIXED_PAYLOAD_REQUEST} + ... Assert Dcae App Consumed ${DEFAULT_PERF3GPP_TOPIC} ${AMOUNT_25000} + Assert Dcae App Consumed Proper Messages ${DEFAULT_PERF3GPP_TOPIC} ${DCAE_FIXED_PAYLOAD_REQUEST} Too big payload message handling @@ -52,8 +52,8 @@ Too big payload message handling Send Messages From xNF Simulators ${XNF_SIMULATOR} ${XNF_TOO_BIG_PAYLOAD_REQUEST} Wait until keyword succeeds 60 sec 5 sec - ... Assert Dcae App Consumed ${DCAE_APP_API_MESSAGES_COUNT_URL} ${AMOUNT_25000} - Assert Dcae App Consumed Proper Messages ${DCAE_APP_API_MESSAGES_VALIDATION_URL} ${DCAE_TOO_BIG_PAYLOAD_REQUEST} + ... Assert Dcae App Consumed ${DEFAULT_PERF3GPP_TOPIC} ${AMOUNT_25000} + Assert Dcae App Consumed Proper Messages ${DEFAULT_PERF3GPP_TOPIC} ${DCAE_TOO_BIG_PAYLOAD_REQUEST} Invalid wire frame message handling @@ -62,8 +62,8 @@ Invalid wire frame message handling Send Messages From xNF Simulators ${XNF_SIMULATOR} ${XNF_INVALID_WIRE_FRAME_REQUEST} Wait until keyword succeeds 60 sec 5 sec - ... Assert Dcae App Consumed ${DCAE_APP_API_MESSAGES_COUNT_URL} ${AMOUNT_50000} - Assert Dcae App Consumed Proper Messages ${DCAE_APP_API_MESSAGES_VALIDATION_URL} ${DCAE_INVALID_WIRE_FRAME_REQUEST} + ... Assert Dcae App Consumed ${DEFAULT_PERF3GPP_TOPIC} ${AMOUNT_50000} + Assert Dcae App Consumed Proper Messages ${DEFAULT_PERF3GPP_TOPIC} ${DCAE_INVALID_WIRE_FRAME_REQUEST} Invalid GPB data message handling @@ -72,8 +72,8 @@ Invalid GPB data message handling Send Messages From xNF Simulators ${XNF_SIMULATOR} ${XNF_INVALID_GPB_DATA_REQUEST} Wait until keyword succeeds 60 sec 5 sec - ... Assert Dcae App Consumed ${DCAE_APP_API_MESSAGES_COUNT_URL} ${AMOUNT_50000} - Assert Dcae App Consumed Proper Messages ${DCAE_APP_API_MESSAGES_VALIDATION_URL} ${DCAE_INVALID_GPB_DATA_REQUEST} + ... Assert Dcae App Consumed ${DEFAULT_PERF3GPP_TOPIC} ${AMOUNT_50000} + Assert Dcae App Consumed Proper Messages ${DEFAULT_PERF3GPP_TOPIC} ${DCAE_INVALID_GPB_DATA_REQUEST} Unsupported domain message handling @@ -82,8 +82,8 @@ Unsupported domain message handling Send Messages From xNF Simulators ${XNF_SIMULATOR} ${XNF_UNSUPPORTED_DOMAIN_REQUEST} Wait until keyword succeeds 60 sec 5 sec - ... Assert Dcae App Consumed ${DCAE_APP_API_MESSAGES_COUNT_URL} ${AMOUNT_50000} - Assert Dcae App Consumed Proper Messages ${DCAE_APP_API_MESSAGES_VALIDATION_URL} ${DCAE_UNSUPPORTED_DOMAIN_REQUEST} + ... Assert Dcae App Consumed ${DEFAULT_PERF3GPP_TOPIC} ${AMOUNT_50000} + Assert Dcae App Consumed Proper Messages ${DEFAULT_PERF3GPP_TOPIC} ${DCAE_UNSUPPORTED_DOMAIN_REQUEST} *** Variables *** ${HTTP_METHOD_URL} http:// diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/multiple-clients.robot b/tests/dcaegen2-collectors-hv-ves/testcases/multiple-clients.robot index 735a2085..109ec469 100644 --- a/tests/dcaegen2-collectors-hv-ves/testcases/multiple-clients.robot +++ b/tests/dcaegen2-collectors-hv-ves/testcases/multiple-clients.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. @@ -40,8 +40,8 @@ Handle Multiple Connections Send Messages From xNF Simulators ${SIMULATORS_LIST} ${XNF_SMALLER_PAYLOAD_REQUEST} Wait until keyword succeeds 60 sec 5 sec - ... Assert Dcae App Consumed ${DCAE_APP_API_MESSAGES_COUNT_URL} ${AMOUNT_15000} - Assert Dcae App Consumed Proper Messages ${DCAE_APP_API_MESSAGES_VALIDATION_URL} ${DCAE_SMALLER_PAYLOAD_REQUEST} + ... Assert Dcae App Consumed ${DEFAULT_PERF3GPP_TOPIC} ${AMOUNT_15000} + Assert Dcae App Consumed Proper Messages ${DEFAULT_PERF3GPP_TOPIC} ${DCAE_SMALLER_PAYLOAD_REQUEST} *** Variables *** 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 07e886a0..fee8bfd8 100644 --- a/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot +++ b/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot @@ -60,7 +60,8 @@ Send Messages From xNF Simulators VES-HV Collector Test Shutdown - Reset DCAE App Simulator ${DCAE_APP_API_MESSAGE_RESET_URL} + Reset DCAE App Simulator ${DEFAULT_PERF3GPP_TOPIC} + Reset DCAE App Simulator ${SECOND_PERF3GPP_TOPIC} VES-HV Collector Suite Teardown diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/resources/hv-ves-configuration-with-different-topic.json b/tests/dcaegen2-collectors-hv-ves/testcases/resources/hv-ves-configuration-with-different-topic.json new file mode 100644 index 00000000..d3d1f4c3 --- /dev/null +++ b/tests/dcaegen2-collectors-hv-ves/testcases/resources/hv-ves-configuration-with-different-topic.json @@ -0,0 +1,12 @@ +{ + "streams_publishes": { + "perf3gpp": { + "type": "kafka", + "kafka_info": { + "bootstrap_servers": "kafka:9092", + "topic_name": "TEST_HV_VES_PERF3GPP_BUT_WITH_EXTRA_WORDS" + } + } + } +} + diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/configuration-change/xnf-valid-messages-request.json b/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/configuration-change/xnf-valid-messages-request.json new file mode 100644 index 00000000..adbcf2ab --- /dev/null +++ b/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/configuration-change/xnf-valid-messages-request.json @@ -0,0 +1,24 @@ +[ + { + "commonEventHeader": { + "version": "sample-version", + "domain": "perf3gpp", + "sequence": 1, + "priority": 1, + "eventId": "sample-event-id", + "eventName": "sample-event-name", + "eventType": "sample-event-type", + "startEpochMicrosec": 120034455, + "lastEpochMicrosec": 120034455, + "nfNamingCode": "sample-nf-naming-code", + "nfcNamingCode": "sample-nfc-naming-code", + "reportingEntityId": "sample-reporting-entity-id", + "reportingEntityName": "sample-reporting-entity-name", + "sourceId": "sample-source-id", + "sourceName": "sample-source-name", + "vesEventListenerVersion": "7.2.0" + }, + "messageType": "VALID", + "messagesAmount": 1000 + } +]
\ No newline at end of file diff --git a/tests/dcaegen2-pmmapper/pmmapper/assets/.gitattributes b/tests/dcaegen2-pmmapper/pmmapper/assets/.gitattributes new file mode 100644 index 00000000..57cdc503 --- /dev/null +++ b/tests/dcaegen2-pmmapper/pmmapper/assets/.gitattributes @@ -0,0 +1 @@ +*.gz binary diff --git a/tests/dcaegen2-pmmapper/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml.gz b/tests/dcaegen2-pmmapper/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml.gz Binary files differnew file mode 100644 index 00000000..32865fc1 --- /dev/null +++ b/tests/dcaegen2-pmmapper/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml.gz diff --git a/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot b/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot index 9bba4817..a103c5cc 100644 --- a/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot +++ b/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot @@ -26,16 +26,12 @@ ${CLI_EXEC_CLI_PM_LOG} docker exec pmmapper /bin/sh -c "tail - ${PUBLISH_NODE_URL} https://${DR_NODE_IP}:8443/publish/1 ${TYPE-A_PM_DATA_FILE_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml ${TYPE-C_PM_DATA_FILE_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/C20190328.0000-0015.xml -${PUBLISH_CONTENT_TYPE} application/octet-stream ${CLI_EXEC_VENDOR_FILTER} curl 'http://${CONSUL_IP}:8500/v1/kv/pmmapper?dc=dc1' -X PUT -H 'Accept: application/^Con' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' --data @$WORKSPACE/tests/dcaegen2-pmmapper/pmmapper/assets/vendor_filter_config.json ${CLI_EXEC_PM_FILTER} curl 'http://${CONSUL_IP}:8500/v1/kv/pmmapper?dc=dc1' -X PUT -H 'Accept: application/^Con' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' --data @$WORKSPACE/tests/dcaegen2-pmmapper/pmmapper/assets/pm_filter_config.json -${CLI_RESTART_PMMAPPER} docker restart pmmapper -${CLI_DELETE_SUB1} curl -i -X DELETE -H "Content-Type:application/vnd.dmaap-dr.subscription" -H "X-DMAAP-DR-ON-BEHALF-OF:DGL" -k https://localhost:8443/subs/1 -${CLI_DELETE_SUB2} curl -i -X DELETE -H "Content-Type:application/vnd.dmaap-dr.subscription" -H "X-DMAAP-DR-ON-BEHALF-OF:DGL" -k https://localhost:8443/subs/2 -${CLI_MESSAGE_ROUTER_TOPIC} curl http://${DMAAP_MR_IP}:3904/events/PM_MAPPER/CG1/C1?timeout=1000 -${CLI_MR_EVENT_COUNT} curl http://${DMAAP_MR_IP}:3904/events/PM_MAPPER/CG1/C1?timeout=1000 | egrep -o 'measInfoId1|measInfoId2|measInfoId3' > /tmp/mr.log +${CLI_MESSAGE_ROUTER_TOPIC} curl http://${DMAAP_MR_IP}:3904/events/PM_MAPPER/CG1/C1?timeout=1000 > /tmp/mr.log ${CLI_MR_LOG} cat /tmp/mr.log + *** Test Cases *** Verify PM Mapper Receive Configuraton From Config Binding Service [Tags] PM_MAPPER_01 @@ -69,43 +65,55 @@ Verify 3GPP PM Mapper responds appropriately when invalid metadata is provided VerifyResponse ${resp.content} Malformed Metadata. CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=2 -Verify 3GPP PM Mapper maps Type-A file and publish 3gpp perf VES evnets to message router +Verify that PM Mapper logs successful when a file that contains no measdata is provided [Tags] PM_MAPPER_05 - [Documentation] Verify 3GPP PM Mapper maps Type-A file and publish 3gpp perf VES evnets to message router. + [Documentation] Verify that PM Mapper logs successful when a file that contains no measdata is provided [Timeout] 1 minute - SendToDatarouter ${TYPE-A_PM_DATA_FILE_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=3 - CheckLog ${CLI_EXEC_CLI_PM_LOG} Successfully published VES events to messagerouter + SendToDatarouter ${NO_MEASDATA_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=3 + CheckLog ${CLI_EXEC_CLI_PM_LOG} MeasData is empty CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=3 - Sleep 10s - CheckLog ${CLI_MESSAGE_ROUTER_TOPIC} perf3gpp_gnb-Ericsson_pmMeasResult -Verify that PM Mapper maps Type-C xml file and publish 3gpp perf VES evnets to message router. +Verify that PM Mapper throws Event failed validation against schema error when no managed element content is provided [Tags] PM_MAPPER_06 - [Documentation] Verify that PM Mapper maps Type-C xml file and publish 3gpp perf VES evnets to message router. + [Documentation] Verify 3gpp pm mapper responds with an error when no managed element content is provided [Timeout] 1 minute - SendToDatarouter ${TYPE-C_PM_DATA_FILE_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=4 - CheckLog ${CLI_EXEC_CLI_PM_LOG} Successfully published VES events to messagerouter + SendToDatarouter ${NO_MANAGED_ELEMENT_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=4 + CheckLog ${CLI_EXEC_CLI_PM_LOG} XML validation failed CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=4 - Run Process ${CLI_MR_EVENT_COUNT} shell=yes - CheckLog ${CLI_MR_LOG} measInfoId1 - CheckLog ${CLI_MR_LOG} measInfoId2 - CheckLog ${CLI_MR_LOG} measInfoId3 -Verify that PM Mapper logs successful when a file that contains no measdata is provided +Verify that PM Mapper maps Type-C xml file and publish 3gpp perf VES evnets to message router [Tags] PM_MAPPER_07 - [Documentation] Verify that PM Mapper logs successful when a file that contains no measdata is provided + [Documentation] Verify that PM Mapper maps Type-C xml file and publish 3gpp perf VES evnets to message router. [Timeout] 1 minute - SendToDatarouter ${NO_MEASDATA_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=5 - CheckLog ${CLI_EXEC_CLI_PM_LOG} MeasData is empty + SendToDatarouter ${TYPE-C_PM_DATA_FILE_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=5 + CheckLog ${CLI_EXEC_CLI_PM_LOG} Successfully published VES events to messagerouter CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=5 + Run Process ${CLI_MESSAGE_ROUTER_TOPIC} shell=yes + CheckLog ${CLI_MR_LOG} measInfoId1 + CheckLog ${CLI_MR_LOG} measInfoId2 + CheckLog ${CLI_MR_LOG} measInfoId3 -Verify that PM Mapper throws Event failed validation against schema error when no managed element content is provided +Verify 3GPP PM Mapper maps Type-A file based on counter filtering and publish 3gpp perf VES evnets to message router [Tags] PM_MAPPER_08 - [Documentation] Verify 3gpp pm mapper responds with an error when no managed element content is provided + [Documentation] Verify 3GPP PM Mapper maps Type-A file and publish 3gpp perf VES evnets to message router. [Timeout] 1 minute - SendToDatarouter ${NO_MANAGED_ELEMENT_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=6 - CheckLog ${CLI_EXEC_CLI_PM_LOG} XML validation failed + ${cli_cmd_output}= Run Process ${CLI_EXEC_PM_FILTER} shell=yes + ${resp}= Get Request mapper_session ${RECONFIGURE_ENDPOINT} + Sleep 5s + SendToDatarouter ${TYPE-A_PM_DATA_FILE_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=6 + CheckLog ${CLI_EXEC_CLI_PM_LOG} Successfully published VES events to messagerouter CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=6 + Run Process ${CLI_MESSAGE_ROUTER_TOPIC} shell=yes + CheckLog ${CLI_MR_LOG} attTCHSeizures + CheckLog ${CLI_MR_LOG} 234 + CheckLog ${CLI_MR_LOG} 890 + CheckLog ${CLI_MR_LOG} 456 + CheckLog ${CLI_MR_LOG} succTCHSeizures2 + CheckLog ${CLI_MR_LOG} 86,87,2,6,77,96,75,33,24 + CheckLog ${CLI_MR_LOG} succImmediateAssignProcs8 + CheckLog ${CLI_MR_LOG} 787 + CheckLog ${CLI_MR_LOG} 238 + CheckLog ${CLI_MR_LOG} 785 Verify that PM Mapper correctly identifies a file that should not be mapped based on metadata filtering. [Tags] PM_MAPPER_09 diff --git a/tests/dcaegen2/prh-testcases/resources/docker-compose.yml b/tests/dcaegen2/prh-testcases/resources/docker-compose.yml index f823b6a7..45c71dc8 100644 --- a/tests/dcaegen2/prh-testcases/resources/docker-compose.yml +++ b/tests/dcaegen2/prh-testcases/resources/docker-compose.yml @@ -2,14 +2,6 @@ version: "3" services: prh: image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.services.prh.prh-app-server:latest - command: > - --dmaap.dmaapConsumerConfiguration.dmaapHostName=dmaap-mr - --dmaap.dmaapConsumerConfiguration.dmaapPortNumber=2222 - --dmaap.dmaapProducerConfiguration.dmaapHostName=dmaap-mr - --dmaap.dmaapProducerConfiguration.dmaapPortNumber=2222 - --aai.aaiClientConfiguration.aaiHostPortNumber=3333 - --aai.aaiClientConfiguration.aaiHost=aai - --aai.aaiClientConfiguration.aaiProtocol=http ports: - "8100:8100" - "8433:8433" @@ -24,22 +16,6 @@ services: ssl_prh: image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.services.prh.prh-app-server:latest - command: > - --dmaap.dmaapConsumerConfiguration.dmaapHostName=dmaap-mr - --dmaap.dmaapConsumerConfiguration.dmaapPortNumber=2223 - --dmaap.dmaapConsumerConfiguration.dmaapProtocol=https - --dmaap.dmaapProducerConfiguration.dmaapHostName=dmaap-mr - --dmaap.dmaapProducerConfiguration.dmaapPortNumber=2223 - --dmaap.dmaapProducerConfiguration.dmaapProtocol=https - --aai.aaiClientConfiguration.aaiHostPortNumber=3334 - --aai.aaiClientConfiguration.aaiHost=aai - --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 ports: - "8200:8100" - "8533:8433" @@ -78,17 +54,17 @@ services: container_name: aai_simulator consul: - image: docker.io/consul:1.0.6 + image: consul:1.0.6 ports: - "8500:8500" - command: ["agent", "-bootstrap", "-client=0.0.0.0", "-server", "-config-dir=/consul/consul.d"] + command: ["agent", "-bootstrap", "-client=0.0.0.0", "-server", "-ui", "-config-dir=/consul/consul.d"] volumes: - ./consul.d/:/consul/consul.d consul-cfg: - image: docker.io/consul:1.0.6 + image: consul:1.0.6 restart: on-failure - command: ["kv", "put", "-http-addr=http://consul-server:8500", "dcae-prh", '{ + command: ["kv", "put", "-http-addr=http://consul:8500", "dcae-prh", '{ "dmaap.dmaapConsumerConfiguration.dmaapUrl":"http://dmaap-mr:2222/events/unauthenticated.VES_PNFREG_OUTPUT", "dmaap.dmaapConsumerConfiguration.dmaapHostName":"dmaap-mr", "dmaap.dmaapConsumerConfiguration.dmaapPortNumber":2223, @@ -147,11 +123,13 @@ services: "streams_publishes":{ "pnf-update":{ + "type": "message_router", "dmaap_info":{ "topic_url":"http://dmaap-mr:2222/events/unauthenticated.PNF_UPDATE" } }, "pnf-ready":{ + "type": "message_router", "dmaap_info":{ "topic_url":"http://dmaap-mr:2222/events/unauthenticated.PNF_READY" } @@ -159,6 +137,7 @@ services: }, "streams_subscribes":{ "ves-reg-output":{ + "type": "message_router", "dmaap_info":{ "topic_url":"http://dmaap-mr:2222/events/unauthenticated.VES_PNFREG_OUTPUT" } diff --git a/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py b/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py index baa81651..010c5231 100644 --- a/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py +++ b/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py @@ -4,6 +4,7 @@ import sys import re import time from http.server import BaseHTTPRequestHandler +from os.path import basename import httpServerLib ch = logging.StreamHandler(sys.stdout) @@ -16,72 +17,125 @@ logging.basicConfig( 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) +AAI_RESOURCE_NOT_FOUND = b'{}' +pnf_entries = {} +patched_pnf = AAI_RESOURCE_NOT_FOUND +created_logical_link = AAI_RESOURCE_NOT_FOUND class AAISetup(BaseHTTPRequestHandler): - def do_PUT(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) + def do_GET(self): + try: + if re.search('/setup/patched_pnf', self.path): + httpServerLib.set_response_200_ok(self, payload = patched_pnf) + logger.debug('AAISetup GET /setup/patched_pnf -> 200 OK') + elif re.search('/setup/created_logical_link', self.path): + httpServerLib.set_response_200_ok(self, payload = created_logical_link) + logger.debug('AAISetup GET /setup/created_logical_link -> 200 OK') + else: + httpServerLib.set_response_404_not_found(self) + logger.info('AAISetup GET ' + self.path + ' -> 404 Not found') + except Exception as e: + logger.error(e) + httpServerLib.set_response_500_server_error(self) - return + def do_PUT(self): + try: + if re.search('/setup/add_pnf_entry', self.path): + pnf_entry = httpServerLib.get_payload(self) + pnf_name = json.loads(pnf_entry).get("pnf-name") + if pnf_name == None: + raise Exception("Invalid PNF entry, could not extract `pnf-name`") + + global pnf_entries + pnf_entries[pnf_name] = pnf_entry + + httpServerLib.set_response_200_ok(self) + logger.debug('AAISetup PUT /setup/add_pnf_entry [' + pnf_name + '] -> 200 OK') + elif re.search('/set_pnf', self.path): + pnf_name = httpServerLib.get_payload(self).decode() + pnf_entries[pnf_name] = AAI_RESOURCE_NOT_FOUND + httpServerLib.set_response_200_ok(self) + else: + httpServerLib.set_response_404_not_found(self) + logger.info('AAISetup PUT ' + self.path + ' -> 404 Not found') + except Exception as e: + logger.error(e) + httpServerLib.set_response_500_server_error(self) def do_POST(self): - logger.info('AAI SIM Setup Post execution') - if re.search('/reset', self.path): - global pnf_name - pnf_name = 'Empty' - _mark_response_as_http_ok(self) - - return - - def _get_content_length(self): - return int(self.headers['Content-Length']) - + try: + if re.search('/reset', self.path): + global pnf_entries + global patched_pnf + global created_logical_link + pnf_entries = {} + patched_pnf = AAI_RESOURCE_NOT_FOUND + created_logical_link = AAI_RESOURCE_NOT_FOUND + + httpServerLib.set_response_200_ok(self) + logger.debug('AAISetup POST /reset -> 200 OK') + else: + httpServerLib.set_response_404_not_found(self) + logger.info('AAISetup POST ' + self.path + ' -> 404 Not found') + except Exception as e: + logger.error(e) + httpServerLib.set_response_500_server_error(self) 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 - + try: + if re.search('/aai/v12/network/pnfs/pnf/[^/]*$', self.path): + pnf_name = basename(self.path) + if pnf_name in pnf_entries: + httpServerLib.set_response_200_ok(self, payload = pnf_entries[pnf_name]) + logger.debug('AAIHandler GET /aai/v12/network/pnfs/pnf/' + pnf_name + ' -> 200 OK') + else: + httpServerLib.set_response_404_not_found(self) + logger.info('AAIHandler GET /aai/v12/network/pnfs/pnf/' + pnf_name + ' -> 404 Not found, actual entries: ' + str(pnf_entries.keys())) + else: + httpServerLib.set_response_404_not_found(self) + logger.info('AAIHandler GET ' + self.path + ' -> 404 Not found') + except Exception as e: + logger.error(e) + httpServerLib.set_response_500_server_error(self) def do_PATCH(self): - 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 + try: + if re.search('/aai/v12/network/pnfs/pnf/[^/]*$', self.path): + pnf_name = basename(self.path) + if pnf_name in pnf_entries: + global patched_pnf + patched_pnf = httpServerLib.get_payload(self) + + httpServerLib.set_response_200_ok(self) + logger.debug('AAIHandler PATCH /aai/v12/network/pnfs/pnf/' + pnf_name + ' -> 200 OK') + else: + httpServerLib.set_response_404_not_found(self) + logger.info('AAIHandler PATCH /aai/v12/network/pnfs/pnf/' + pnf_name + ' -> 404 Not found, actual entries: ' + str(pnf_entries.keys())) + else: + httpServerLib.set_response_404_not_found(self) + logger.info('AAIHandler PATCH ' + self.path + ' -> 404 Not found') + except Exception as e: + logger.error(e) + httpServerLib.set_response_500_server_error(self) + + def do_PUT(self): + try: + if re.search('/aai/v12/network/logical-links/logical-link/[^/]*$', self.path): + global created_logical_link + created_logical_link = httpServerLib.get_payload(self) + + httpServerLib.set_response_200_ok(self) + logger.debug('AAIHandler PUT /aai/v12/network/logical-links/logical-link/' + created_logical_link + ' -> 200 OK') + else: + httpServerLib.set_response_404_not_found(self) + logger.info('AAIHandler PUT ' + self.path + ' -> 404 Not found') + except Exception as e: + logger.error(e) + httpServerLib.set_response_500_server_error(self) def _main_(handler_class=AAIHandler, protocol="HTTP/1.0"): diff --git a/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py b/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py index da113e68..7f590a5b 100644 --- a/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py +++ b/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py @@ -15,62 +15,85 @@ logging.basicConfig( logger = logging.getLogger('DMaaP-simulator-logger') -posted_event_from_prh = b'Empty' -received_event_to_get_method = b'Empty' +DMAAP_EMPTY = b'[]' +ves_event = DMAAP_EMPTY +captured_prh_event = DMAAP_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']) - received_event_to_get_method = self.rfile.read(content_length) - httpServerLib.header_200_and_json(self) - - 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) + try: + if re.search('/setup/pnf_ready', self.path) or re.search('events/pnfReady', self.path): + global captured_prh_event + httpServerLib.set_response_200_ok(self, payload = captured_prh_event) + logger.debug('DmaapSetup GET /setup/pnf_ready -> 200 OK') + else: + httpServerLib.set_response_404_not_found(self) + logger.info('DmaapSetup GET ' + self.path + ' -> 404 Not found') + except Exception as e: + logger.error(e) + httpServerLib.set_response_500_server_error(self) - return + def do_PUT(self): + try: + if re.search('/setup/ves_event', self.path) or re.search('/set_get_event', self.path): + global ves_event + ves_event = httpServerLib.get_payload(self) + httpServerLib.set_response_200_ok(self) + logger.debug('DmaapSetup PUT /setup/ves_event -> 200 OK') + else: + httpServerLib.set_response_404_not_found(self) + logger.info('DmaapSetup PUT ' + self.path + ' -> 404 Not found') + except Exception as e: + logger.error(e) + httpServerLib.set_response_500_server_error(self) 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 - posted_event_from_prh = b'Empty' - received_event_to_get_method = b'Empty' - httpServerLib.header_200_and_json(self) - - return - + try: + if re.search('/reset', self.path): + global ves_event + global captured_prh_event + ves_event = DMAAP_EMPTY + captured_prh_event = DMAAP_EMPTY + httpServerLib.set_response_200_ok(self) + logger.debug('DmaapSetup POST /reset -> 200 OK') + else: + httpServerLib.set_response_404_not_found(self) + logger.info('DmaapSetup POST ' + self.path + ' -> 404 Not found') + except Exception as e: + logger.error(e) + httpServerLib.set_response_500_server_error(self) 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']) - posted_event_from_prh = self.rfile.read(content_length) - httpServerLib.header_200_and_json(self) - - return + try: + if re.search('/events/unauthenticated.PNF_READY', self.path): + global captured_prh_event + captured_prh_event = httpServerLib.get_payload(self) + httpServerLib.set_response_200_ok(self) + logger.debug('DMaaPHandler POST /events/unauthenticated.PNF_READY -> 200') + else: + httpServerLib.set_response_404_not_found(self) + logger.info('DMaaPHandler POST ' + self.path + ' -> 404 Not found') + except Exception as e: + logger.error(e) + httpServerLib.set_response_500_server_error(self) 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) - - return - + try: + if re.search('/events/unauthenticated.VES_PNFREG_OUTPUT/OpenDcae-c12/c12', self.path): + global ves_event + httpServerLib.set_response_200_ok(self, payload = ves_event) + ves_event = DMAAP_EMPTY + logger.debug('DMaaPHandler GET /events/unauthenticated.VES_PNFREG_OUTPUT/OpenDcae-c12/c12 -> 200') + else: + httpServerLib.set_response_404_not_found(self) + logger.info('DMaaPHandler GET ' + self.path + ' -> 404 Not found') + except Exception as e: + logger.error(e) + httpServerLib.set_response_500_server_error(self) def _main_(handler_class=DMaaPHandler, protocol="HTTP/1.0"): handler_class.protocol_version = protocol @@ -80,6 +103,5 @@ def _main_(handler_class=DMaaPHandler, protocol="HTTP/1.0"): while 1: time.sleep(10) - if __name__ == '__main__': - _main_() + _main_()
\ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/resources/simulator/httpServerLib.py b/tests/dcaegen2/prh-testcases/resources/simulator/httpServerLib.py index 7b54539a..e91927e3 100644 --- a/tests/dcaegen2/prh-testcases/resources/simulator/httpServerLib.py +++ b/tests/dcaegen2/prh-testcases/resources/simulator/httpServerLib.py @@ -2,32 +2,44 @@ import _thread import ssl from http.server import HTTPServer - -def header_200_and_json(self): +def set_response_200_ok(self, payload = None): self.send_response(200) self.send_header('Content-Type', 'application/json') self.end_headers() + if payload != None: + self.wfile.write(payload) + +def set_response_404_not_found(self): + self.send_response(404) + self.end_headers() + +def set_response_500_server_error(self): + self.send_response(500) + self.end_headers() +def get_payload(self): + if self.headers['Content-Length'] == None: + raise Exception('Invalid payload, Content-Length not defined') + + content_length = int(self.headers['Content-Length']) + return self.rfile.read(content_length) 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() + server.serve_forever()
\ No newline at end of file diff --git a/tests/usecases/5G-bulkpm/BulkpmE2E.robot b/tests/usecases/5G-bulkpm/BulkpmE2E.robot index dcf97210..84243cba 100644 --- a/tests/usecases/5G-bulkpm/BulkpmE2E.robot +++ b/tests/usecases/5G-bulkpm/BulkpmE2E.robot @@ -20,8 +20,12 @@ ${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/A20181002.0000-1000-0015-1000_5G.xml.M %{WORKSPACE} +${CLI_EXEC_RENAME_METADATA} mv %{WORKSPACE}/A20181002.0000-1000-0015-1000_5G.xml.M %{WORKSPACE}/metadata.json +${CLI_EXEC_CLI_PMMAPPER_LOG} docker exec pmmapper /bin/sh -c "cat /var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log" > /tmp/pmmapper_docker.log.robot +${CLI_EXEC_CLI_PMMAPPER_LOG_GREP} grep "XML validation successful Event" /tmp/pmmapper_docker.log.robot +${CLI_EXEC_MR_PMMAPPER_TOPIC} curl http://${DMAAP_MR_IP}:3904/events/PM_MAPPER/CG1/C1?timeout=1000 > /tmp/mr.log +${CLI_EXEC_CLI_PMMAPPER_TOPIC_LOG_GREP} grep "perf3gpp_RnNode-Ericsson_pmMeasResult" /tmp/mr.log ${metadataSchemaPath} %{WORKSPACE}/tests/usecases/5G-bulkpm/assets/metadata.schema.json ${metadataJsonPath} %{WORKSPACE}/metadata.json @@ -86,7 +90,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} xNF.pm.xml + Should Contain ${cli_cmd_output.stdout} A20181002.0000-1000-0015-1000_5G.xml Verify File Consumer Receive valid metadata from Data Router [Tags] Bulk_PM_E2E_06 @@ -94,8 +98,30 @@ 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} xNF.pm.xml.M + Should Contain ${cli_cmd_output.stdout} A20181002.0000-1000-0015-1000_5G.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} - Should Be Equal As Strings ${validation_result} 0
\ No newline at end of file + Should Be Equal As Strings ${validation_result} 0 + +Verify PM-Mapper successfully receives uncompressed the PM XML file + [Tags] Bulk_PM_E2E_07 + [Documentation] Check that PM-Mapper receives the uncompressed PM XML file + ${cli_cmd_output}= Run Process ${CLI_EXEC_CLI_PMMAPPER_LOG} shell=yes + Log ${cli_cmd_output.stdout} + Should Be Equal As Strings ${cli_cmd_output.rc} 0 + ${cli_cmd_output}= Run Process ${CLI_EXEC_CLI_PMMAPPER_LOG_GREP} shell=yes + Log ${cli_cmd_output.stdout} + Should Be Equal As Strings ${cli_cmd_output.rc} 0 + Should Contain ${cli_cmd_output.stdout} XML validation successful Event + +Verify PM-Mapper successfully publishes PMMeasResult VES onto the Message Router Topic PM_MAPPER + [Tags] Bulk_PM_E2E_08 + [Documentation] Check that PM-Mapper publishes VES onto the Message Router + ${cli_cmd_output}= Run Process ${CLI_EXEC_MR_PMMAPPER_TOPIC} shell=yes + Log ${cli_cmd_output.stdout} + Should Be Equal As Strings ${cli_cmd_output.rc} 0 + ${cli_cmd_output}= Run Process ${CLI_EXEC_CLI_PMMAPPER_TOPIC_LOG_GREP} shell=yes + Log ${cli_cmd_output.stdout} + Should Be Equal As Strings ${cli_cmd_output.rc} 0 + Should Contain ${cli_cmd_output.stdout} perf3gpp_RnNode-Ericsson_pmMeasResult
\ No newline at end of file diff --git a/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotification.json b/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotification.json index d5d8fd05..375dbd80 100644 --- a/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotification.json +++ b/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotification.json @@ -19,9 +19,9 @@ "changeType": "FileReady", "notificationFieldsVersion": "2.0", "arrayOfNamedHashMap": [ - { "name": "xNF.pm.xml.gz", + { "name": "A20181002.0000-1000-0015-1000_5G.xml.gz", "hashMap":{ - "location": "sftp://admin:admin@sftpserver:sftpport/xNF.pm.xml.gz", + "location": "sftp://admin:admin@sftpserver:sftpport/A20181002.0000-1000-0015-1000_5G.xml.gz", "compression": "gzip", "fileFormatType": "org.3GPP.32.435#measCollec", "fileFormatVersion": "V10" |