diff options
author | Morgan Richomme <morgan.richomme@orange.com> | 2021-02-01 17:04:54 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-02-01 17:04:54 +0000 |
commit | 59e273488c6159dae28b7318bf2a4bbf26e6937b (patch) | |
tree | 18f94b89c072d12758811f216b8515bc1f009a29 | |
parent | 87a7fca8a3db019e191447526b3e291514aa0725 (diff) | |
parent | 830e11d024afa0b2ec22da42a12f103532fcf060 (diff) |
Merge "[PMSH] Update CSITs to use DMaaP MR"
14 files changed, 226 insertions, 273 deletions
diff --git a/plans/dcaegen2-services-pmsh/testsuite/assets/cbs_sim/cbs-initializer.json b/plans/dcaegen2-services-pmsh/testsuite/assets/cbs_sim/cbs-initializer.json index 8caf2001..5b6e6fea 100644 --- a/plans/dcaegen2-services-pmsh/testsuite/assets/cbs_sim/cbs-initializer.json +++ b/plans/dcaegen2-services-pmsh/testsuite/assets/cbs_sim/cbs-initializer.json @@ -86,7 +86,7 @@ "dmaap_info": { "client_id": "1475976809466", "client_role": "org.onap.dcae.pmPublisher", - "topic_url": "https://mr-sim:3095/events/unauthenticated.DCAE_CL_OUTPUT", + "topic_url": "http://dmaap:3904/events/unauthenticated.DCAE_CL_OUTPUT", "location": "san-francisco" }, "type": "message_router" @@ -98,14 +98,14 @@ "dmaap_info": { "client_id": "1575976809466", "client_role": "org.onap.dcae.aaiSub", - "topic_url": "https://mr-sim:3095/events/AAI_EVENT", + "topic_url": "http://dmaap:3904/events/AAI_EVENT", "location": "san-francisco" } }, "policy_pm_subscriber": { "dmaap_info": { "location": "san-francisco", - "topic_url": "https://mr-sim:3095/events/unauthenticated.PMSH_CL_INPUT", + "topic_url": "http://dmaap:3904/events/unauthenticated.PMSH_CL_INPUT", "client_role": "org.onap.dcae.pmSubscriber", "client_id": "1575876809456" }, diff --git a/plans/dcaegen2-services-pmsh/testsuite/assets/mr_sim/mr-initializer.json b/plans/dcaegen2-services-pmsh/testsuite/assets/mr_sim/mr-initializer.json deleted file mode 100644 index 6c2c4809..00000000 --- a/plans/dcaegen2-services-pmsh/testsuite/assets/mr_sim/mr-initializer.json +++ /dev/null @@ -1,53 +0,0 @@ -[ - { - "httpRequest": { - "path": "/events/AAI_EVENT/.*", - "queryStringParameters" : { - "timeout" : [ "1000" ] - } - }, - "httpResponse": { - "statusCode": 200, - "headers": { - "content-type": [ - "application/json" - ] - }, - "body": [] - } - }, - { - "httpRequest": { - "path": "/events/unauthenticated.DCAE_CL_OUTPUT", - "queryStringParameters" : { - "timeout" : [ "1000" ] - } - }, - "httpResponse": { - "statusCode": 200, - "headers": { - "content-type": [ - "application/json" - ] - }, - "body": [] - } - }, - { - "httpRequest": { - "path": "/events/unauthenticated.PMSH_CL_INPUT/.*", - "queryStringParameters" : { - "timeout" : [ "1000" ] - } - }, - "httpResponse": { - "statusCode": 200, - "headers": { - "content-type": [ - "application/json" - ] - }, - "body": [] - } - } -] diff --git a/plans/dcaegen2-services-pmsh/testsuite/assets/mr_sim/mr_mockserver.properties b/plans/dcaegen2-services-pmsh/testsuite/assets/mr_sim/mr_mockserver.properties deleted file mode 100644 index 9c592303..00000000 --- a/plans/dcaegen2-services-pmsh/testsuite/assets/mr_sim/mr_mockserver.properties +++ /dev/null @@ -1,26 +0,0 @@ -####################################### -# MockServer & Proxy Example Settings # -####################################### - -# Socket & Port Settings - -# socket timeout in milliseconds (default 120000) -mockserver.maxSocketTimeout=120000 - -# Certificate Generation - -# delete KeyStore file on JVM shutdown (default true) -mockserver.deleteGeneratedKeyStoreOnExit=true -# certificate domain name (default "localhost") -mockserver.sslCertificateDomainName=localhost -# comma separated list of domain names for Subject Alternative Name domain names (default empty list) -mockserver.sslSubjectAlternativeNameDomains=www.example.com,www.another.com -# comma separated list of ip addresses for Subject Alternative Name ips (default empty list) -mockserver.sslSubjectAlternativeNameIps=127.0.0.1 - -# CORS - -# enable CORS for MockServer REST API -mockserver.enableCORSForAPI=true -# enable CORS for all responses -mockserver.enableCORSForAllResponses=true diff --git a/plans/dcaegen2-services-pmsh/testsuite/docker-compose.yml b/plans/dcaegen2-services-pmsh/testsuite/docker-compose.yml index 6df60f1e..6541ddbf 100644 --- a/plans/dcaegen2-services-pmsh/testsuite/docker-compose.yml +++ b/plans/dcaegen2-services-pmsh/testsuite/docker-compose.yml @@ -9,7 +9,9 @@ services: POSTGRES_PASSWORD: $DB_PASSWORD POSTGRES_USER: $DB_USER networks: - pmsh-network: + dockercompose_net: + aliases: + - db aai: container_name: aai-sim @@ -24,7 +26,9 @@ services: - ./assets/ssl_certs/mock_server_cacert.pem:/var/tmp/mock_server_cacert.pem - ./assets/ssl_certs/mock_server_key.pem:/var/tmp/mock_server_key.pem networks: - pmsh-network: + dockercompose_net: + aliases: + - aai-sim cbs-sim: container_name: cbs-sim @@ -40,21 +44,9 @@ services: - ./assets/ssl_certs/mock_server_cacert.pem:/var/tmp/mock_server_cacert.pem - ./assets/ssl_certs/mock_server_key.pem:/var/tmp/mock_server_key.pem networks: - pmsh-network: - - mr-sim: - container_name: mr-sim - image: mockserver/mockserver:mockserver-5.9.0 - environment: - MOCKSERVER_PROPERTY_FILE: /config/mockserver.properties - MOCKSERVER_INITIALIZATION_JSON_PATH: /config/mr-initializer.json - LOG_LEVEL: "DEBUG" - SERVER_PORT: 3095 - volumes: - - ./assets/mr_sim/mr_mockserver.properties:/config/mockserver.properties - - ./assets/mr_sim/mr-initializer.json:/config/mr-initializer.json - networks: - pmsh-network: + dockercompose_net: + aliases: + - cbs-sim pmsh: container_name: pmsh @@ -74,8 +66,11 @@ services: AAI_SERVICE_PORT: 1080 DCAE_CA_CERTPATH: '/opt/app/pmsh/etc/certs/cacert.pem' networks: - pmsh-network: + dockercompose_net: + aliases: + - pmsh networks: - pmsh-network: - driver: bridge + dockercompose_net: + external: true + diff --git a/plans/dcaegen2-services-pmsh/testsuite/setup.sh b/plans/dcaegen2-services-pmsh/testsuite/setup.sh index 4b939fd0..d7b988e4 100644 --- a/plans/dcaegen2-services-pmsh/testsuite/setup.sh +++ b/plans/dcaegen2-services-pmsh/testsuite/setup.sh @@ -1,12 +1,16 @@ #!/bin/bash # Place the scripts in run order: +source ${WORKSPACE}/scripts/dmaap-message-router/dmaap-mr-launch.sh +dmaap_mr_launch +DMAAP_MR_IP=${IP} + export DB_USER=pmsh export DB_PASSWORD=pmsh TEST_PLANS_DIR=$WORKSPACE/plans/dcaegen2-services-pmsh/testsuite -docker-compose -f ${TEST_PLANS_DIR}/docker-compose.yml up -d db aai cbs-sim mr-sim +docker-compose -f ${TEST_PLANS_DIR}/docker-compose.yml up -d db aai cbs-sim # Slow machine running CSITs can affect db coming up in time for PMSH echo "Waiting for postgres db to come up..." @@ -82,7 +86,6 @@ for i in {0..5}; do fi if [[ $(docker inspect --format '{{ .State.Running }}' cbs-sim) ]] && \ [[ $(docker inspect --format '{{ .State.Running }}' aai-sim) ]] && \ - [[ $(docker inspect --format '{{ .State.Running }}' mr-sim) ]] && \ [[ $(docker inspect --format '{{ .State.Running }}' db) ]] && \ [[ $(docker inspect --format '{{ .State.Running }}' pmsh) ]] then @@ -91,9 +94,14 @@ for i in {0..5}; do done [[ "$containers_ok" == "false" ]] && echo "Error: required container not running." && exit 1 +# Create topics on MR +curl -X POST http://${DMAAP_MR_IP}:3904/events/AAI_EVENT --header 'Content-Type: application/json' --data-raw '{"message": "dummy message"}' +sleep 2 +curl -X POST http://${DMAAP_MR_IP}:3904/events/unauthenticated.PMSH_CL_INPUT --header 'Content-Type: application/json' --data-raw '{"message": "dummy message"}' + + DB_IP_ADDRESS=$(docker inspect -f "{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" db) -MR_SIM_IP_ADDRESS=$(docker inspect -f "{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" mr-sim) CBS_SIM_IP_ADDRESS=$(docker inspect -f "{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" cbs-sim) #Pass any variables required by Robot test suites in ROBOT_VARIABLES -ROBOT_VARIABLES="-v PMSH_IP:${PMSH_IP} -v MR_SIM_IP_ADDRESS:${MR_SIM_IP_ADDRESS} -v DB_IP_ADDRESS:${DB_IP_ADDRESS} -v CBS_SIM_IP_ADDRESS:${CBS_SIM_IP_ADDRESS}" +ROBOT_VARIABLES="-v PMSH_IP:${PMSH_IP} -v MR_IP_ADDRESS:${DMAAP_MR_IP} -v DB_IP_ADDRESS:${DB_IP_ADDRESS} -v CBS_SIM_IP_ADDRESS:${CBS_SIM_IP_ADDRESS}" diff --git a/plans/dcaegen2-services-pmsh/testsuite/teardown.sh b/plans/dcaegen2-services-pmsh/testsuite/teardown.sh index a01dfda0..75e624e5 100644 --- a/plans/dcaegen2-services-pmsh/testsuite/teardown.sh +++ b/plans/dcaegen2-services-pmsh/testsuite/teardown.sh @@ -1,5 +1,7 @@ #!/bin/bash echo "Starting teardown script" +source ${WORKSPACE}/scripts/dmaap-message-router/dmaap-mr-teardown.sh +dmaap_mr_teardown TEST_PLANS_DIR=$WORKSPACE/plans/dcaegen2-services-pmsh/testsuite mkdir -p $WORKSPACE/archives docker exec pmsh /bin/sh -c "cat /var/log/ONAP/dcaegen2/services/pmsh/*" diff --git a/tests/dcaegen2-services-pmsh/testcases/assets/aai-pnf-create.json b/tests/dcaegen2-services-pmsh/testcases/assets/aai-pnf-create.json new file mode 100644 index 00000000..534b7ce1 --- /dev/null +++ b/tests/dcaegen2-services-pmsh/testcases/assets/aai-pnf-create.json @@ -0,0 +1,63 @@ +{ + "cambria.partition":"AAI", + "event-header":{ + "severity":"NORMAL", + "entity-type":"pnf", + "top-entity-type":"pnf", + "entity-link":"/aai/v16/network/pnfs/pnf/pnf_newly_discovered", + "event-type":"AAI-EVENT", + "domain":"dev", + "action":"UPDATE", + "sequence-number":"0", + "id":"db09e090-196e-4f84-9645-e449b1cd3640", + "source-name":"dcae-curl", + "version":"v16", + "timestamp":"20200203-15:14:08:807" + }, + "entity":{ + "ipaddress-v4-oam":"10.10.10.37", + "nf-role":"gNB", + "equip-type":"val8", + "relationship-list":{ + "relationship":[ + { + "related-to":"service-instance", + "relationship-data":[ + { + "relationship-value":"Demonstration", + "relationship-key":"customer.global-customer-id" + }, + { + "relationship-value":"vCPE", + "relationship-key":"service-subscription.service-type" + }, + { + "relationship-value":"2c03b2a8-e31a-4749-9e99-3089ab441400", + "relationship-key":"service-instance.service-instance-id" + } + ], + "related-link":"/aai/v16/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vCPE/service-instances/service-instance/2c03b2a8-e31a-4749-9e99-3089ab441400", + "relationship-label":"org.onap.relationships.inventory.ComposedOf", + "related-to-property":[ + { + "property-key":"service-instance.service-instance-name", + "property-value":"Svc6_1" + } + ] + } + ] + }, + "equip-vendor":"Ericsson", + "serial-number":"6061ZW3", + "ipaddress-v6-oam":"2001:0db8:0:0:0:0:1428:57ab", + "equip-model":"val6", + "in-maint":false, + "resource-version":"1578668956804", + "sw-version":"val7", + "pnf-id":"eabcfaf7-b7f3-45fb-94e7-e6112fb3e8b8", + "pnf-name":"pnf_newly_discovered", + "model-invariant-id":"7129e420-d396-4efb-af02-6b83499b12f8", + "model-version-id":"e80a6ae3-cafd-4d24-850d-e14c084a5ca9", + "orchestration-status":"Active" + } +}
\ No newline at end of file diff --git a/tests/dcaegen2-services-pmsh/testcases/assets/aai-pnf-delete.json b/tests/dcaegen2-services-pmsh/testcases/assets/aai-pnf-delete.json new file mode 100644 index 00000000..f2ffd050 --- /dev/null +++ b/tests/dcaegen2-services-pmsh/testcases/assets/aai-pnf-delete.json @@ -0,0 +1,63 @@ +{ + "cambria.partition":"AAI", + "event-header":{ + "severity":"NORMAL", + "entity-type":"pnf", + "top-entity-type":"pnf", + "entity-link":"/aai/v16/network/pnfs/pnf/pnf_newly_discovered", + "event-type":"AAI-EVENT", + "domain":"dev", + "action":"DELETE", + "sequence-number":"0", + "id":"db09e090-196e-4f84-9645-e449b1cd3640", + "source-name":"dcae-curl", + "version":"v16", + "timestamp":"20200203-15:14:08:807" + }, + "entity":{ + "ipaddress-v4-oam":"10.10.10.37", + "nf-role":"gNB", + "equip-type":"val8", + "relationship-list":{ + "relationship":[ + { + "related-to":"service-instance", + "relationship-data":[ + { + "relationship-value":"Demonstration", + "relationship-key":"customer.global-customer-id" + }, + { + "relationship-value":"vCPE", + "relationship-key":"service-subscription.service-type" + }, + { + "relationship-value":"2c03b2a8-e31a-4749-9e99-3089ab441400", + "relationship-key":"service-instance.service-instance-id" + } + ], + "related-link":"/aai/v16/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vCPE/service-instances/service-instance/2c03b2a8-e31a-4749-9e99-3089ab441400", + "relationship-label":"org.onap.relationships.inventory.ComposedOf", + "related-to-property":[ + { + "property-key":"service-instance.service-instance-name", + "property-value":"Svc6_1" + } + ] + } + ] + }, + "equip-vendor":"Ericsson", + "serial-number":"6061ZW3", + "ipaddress-v6-oam":"2001:0db8:0:0:0:0:1428:57ab", + "equip-model":"val6", + "in-maint":false, + "resource-version":"1578668956804", + "sw-version":"val7", + "pnf-id":"eabcfaf7-b7f3-45fb-94e7-e6112fb3e8b8", + "pnf-name":"pnf_newly_discovered", + "model-invariant-id":"7129e420-d396-4efb-af02-6b83499b12f8", + "model-version-id":"e80a6ae3-cafd-4d24-850d-e14c084a5ca9", + "orchestration-status":"Active" + } +}
\ No newline at end of file diff --git a/tests/dcaegen2-services-pmsh/testcases/assets/cbs-expectation-unlocked-config.json b/tests/dcaegen2-services-pmsh/testcases/assets/cbs-expectation-unlocked-config.json index cd7aa28c..1e692d31 100644 --- a/tests/dcaegen2-services-pmsh/testcases/assets/cbs-expectation-unlocked-config.json +++ b/tests/dcaegen2-services-pmsh/testcases/assets/cbs-expectation-unlocked-config.json @@ -89,7 +89,7 @@ "dmaap_info": { "client_id": "1475976809466", "client_role": "org.onap.dcae.pmPublisher", - "topic_url": "https://mr-sim:3095/events/unauthenticated.DCAE_CL_OUTPUT", + "topic_url": "http://dmaap:3904/events/unauthenticated.DCAE_CL_OUTPUT", "location": "san-francisco" }, "type": "message_router" @@ -101,14 +101,14 @@ "dmaap_info": { "client_id": "1575976809466", "client_role": "org.onap.dcae.aaiSub", - "topic_url": "https://mr-sim:3095/events/AAI_EVENT", + "topic_url": "http://dmaap:3904/events/AAI_EVENT", "location": "san-francisco" } }, "policy_pm_subscriber": { "dmaap_info": { "location": "san-francisco", - "topic_url": "https://mr-sim:3095/events/unauthenticated.PMSH_CL_INPUT", + "topic_url": "http://dmaap:3904/events/unauthenticated.PMSH_CL_INPUT", "client_role": "org.onap.dcae.pmSubscriber", "client_id": "1575876809456" }, diff --git a/tests/dcaegen2-services-pmsh/testcases/assets/mr-expectation-aai-pnf-created.json b/tests/dcaegen2-services-pmsh/testcases/assets/mr-expectation-aai-pnf-created.json deleted file mode 100644 index b433892a..00000000 --- a/tests/dcaegen2-services-pmsh/testcases/assets/mr-expectation-aai-pnf-created.json +++ /dev/null @@ -1,42 +0,0 @@ -[ - { - "httpRequest": { - "path": "/events/AAI_EVENT/.*", - "queryStringParameters" : { - "timeout" : [ "1000" ] - } - }, - "httpResponse": { - "statusCode": 200, - "headers": { - "content-type": [ - "application/json" - ] - }, - "body": [ - "{\"cambria.partition\":\"AAI\",\"event-header\":{\"severity\":\"NORMAL\",\"entity-type\":\"pnf\",\"top-entity-type\":\"pnf\",\"entity-link\":\"/aai/v16/network/pnfs/pnf/pnf_newly_discovered\",\"event-type\":\"AAI-EVENT\",\"domain\":\"dev\",\"action\":\"UPDATE\",\"sequence-number\":\"0\",\"id\":\"db09e090-196e-4f84-9645-e449b1cd3640\",\"source-name\":\"dcae-curl\",\"version\":\"v16\",\"timestamp\":\"20200203-15:14:08:807\"},\"entity\":{\"ipaddress-v4-oam\":\"10.10.10.37\",\"nf-role\":\"gNB\",\"equip-type\":\"val8\",\"relationship-list\":{\"relationship\":[{\"related-to\":\"service-instance\",\"relationship-data\":[{\"relationship-value\":\"Demonstration\",\"relationship-key\":\"customer.global-customer-id\"},{\"relationship-value\":\"vCPE\",\"relationship-key\":\"service-subscription.service-type\"},{\"relationship-value\":\"2c03b2a8-e31a-4749-9e99-3089ab441400\",\"relationship-key\":\"service-instance.service-instance-id\"}],\"related-link\":\"/aai/v16/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vCPE/service-instances/service-instance/2c03b2a8-e31a-4749-9e99-3089ab441400\",\"relationship-label\":\"org.onap.relationships.inventory.ComposedOf\",\"related-to-property\":[{\"property-key\":\"service-instance.service-instance-name\",\"property-value\":\"Svc6_1\"}]}]},\"equip-vendor\":\"Ericsson\",\"serial-number\":\"6061ZW3\",\"ipaddress-v6-oam\":\"2001:0db8:0:0:0:0:1428:57ab\",\"equip-model\":\"val6\",\"in-maint\":false,\"resource-version\":\"1578668956804\",\"sw-version\":\"val7\",\"pnf-id\":\"eabcfaf7-b7f3-45fb-94e7-e6112fb3e8b8\",\"pnf-name\":\"pnf_newly_discovered\",\"model-invariant-id\":\"7129e420-d396-4efb-af02-6b83499b12f8\",\"model-version-id\":\"e80a6ae3-cafd-4d24-850d-e14c084a5ca9\",\"orchestration-status\":\"Active\"}}" - ] - }, - "times": { - "remainingTimes": 1, - "unlimited": false - } - }, - { - "httpRequest": { - "path": "/events/AAI_EVENT/.*", - "queryStringParameters" : { - "timeout" : [ "1000" ] - } - }, - "httpResponse": { - "statusCode": 200, - "headers": { - "content-type": [ - "application/json" - ] - }, - "body": [] - } - } -] diff --git a/tests/dcaegen2-services-pmsh/testcases/assets/mr-expectation-aai-pnf-deleted.json b/tests/dcaegen2-services-pmsh/testcases/assets/mr-expectation-aai-pnf-deleted.json deleted file mode 100644 index 3df66a61..00000000 --- a/tests/dcaegen2-services-pmsh/testcases/assets/mr-expectation-aai-pnf-deleted.json +++ /dev/null @@ -1,42 +0,0 @@ -[ - { - "httpRequest": { - "path": "/events/AAI_EVENT/.*", - "queryStringParameters" : { - "timeout" : [ "1000" ] - } - }, - "httpResponse": { - "statusCode": 200, - "headers": { - "content-type": [ - "application/json" - ] - }, - "body": [ - "{\"cambria.partition\":\"AAI\",\"event-header\":{\"severity\":\"NORMAL\",\"entity-type\":\"pnf\",\"top-entity-type\":\"pnf\",\"entity-link\":\"/aai/v16/network/pnfs/pnf/pnf_newly_discovered\",\"event-type\":\"AAI-EVENT\",\"domain\":\"dev\",\"action\":\"DELETE\",\"sequence-number\":\"0\",\"id\":\"db09e090-196e-4f84-9645-e449b1cd3640\",\"source-name\":\"dcae-curl\",\"version\":\"v16\",\"timestamp\":\"20200203-15:14:08:807\"},\"entity\":{\"ipaddress-v4-oam\":\"10.10.10.37\",\"nf-role\":\"gNB\",\"equip-type\":\"val8\",\"relationship-list\":{\"relationship\":[{\"related-to\":\"service-instance\",\"relationship-data\":[{\"relationship-value\":\"Demonstration\",\"relationship-key\":\"customer.global-customer-id\"},{\"relationship-value\":\"vCPE\",\"relationship-key\":\"service-subscription.service-type\"},{\"relationship-value\":\"2c03b2a8-e31a-4749-9e99-3089ab441400\",\"relationship-key\":\"service-instance.service-instance-id\"}],\"related-link\":\"/aai/v16/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vCPE/service-instances/service-instance/2c03b2a8-e31a-4749-9e99-3089ab441400\",\"relationship-label\":\"org.onap.relationships.inventory.ComposedOf\",\"related-to-property\":[{\"property-key\":\"service-instance.service-instance-name\",\"property-value\":\"Svc6_1\"}]}]},\"equip-vendor\":\"Ericsson\",\"serial-number\":\"6061ZW3\",\"ipaddress-v6-oam\":\"2001:0db8:0:0:0:0:1428:57ab\",\"equip-model\":\"val6\",\"in-maint\":false,\"resource-version\":\"1578668956804\",\"sw-version\":\"val7\",\"pnf-id\":\"eabcfaf7-b7f3-45fb-94e7-e6112fb3e8b8\",\"pnf-name\":\"pnf_newly_discovered\",\"model-invariant-id\":\"7129e420-d396-4efb-af02-6b83499b12f8\",\"model-version-id\":\"e80a6ae3-cafd-4d24-850d-e14c084a5ca9\",\"orchestration-status\":\"Active\"}}" - ] - }, - "times": { - "remainingTimes": 1, - "unlimited": false - } - }, - { - "httpRequest": { - "path": "/events/AAI_EVENT/.*", - "queryStringParameters" : { - "timeout" : [ "1000" ] - } - }, - "httpResponse": { - "statusCode": 200, - "headers": { - "content-type": [ - "application/json" - ] - }, - "body": [] - } - } -] diff --git a/tests/dcaegen2-services-pmsh/testcases/assets/mr-expectation-policy-subscription-created-pnf-existing.json b/tests/dcaegen2-services-pmsh/testcases/assets/mr-expectation-policy-subscription-created-pnf-existing.json deleted file mode 100644 index cd75deb3..00000000 --- a/tests/dcaegen2-services-pmsh/testcases/assets/mr-expectation-policy-subscription-created-pnf-existing.json +++ /dev/null @@ -1,42 +0,0 @@ -[ - { - "httpRequest": { - "path": "/events/unauthenticated.PMSH_CL_INPUT/.*", - "queryStringParameters" : { - "timeout" : [ "1000" ] - } - }, - "httpResponse": { - "statusCode": 200, - "headers": { - "content-type": [ - "application/json" - ] - }, - "body": [ - "{\"name\": \"ResponseEvent\", \"nameSpace\": \"org.onap.policy.apex.onap.pmcontrol\", \"source\": \"APEX\", \"target\": \"DCAE\", \"version\": \"0.0.1\", \"status\": {\"subscriptionName\": \"ExtraPM-All-gNB-R2B\", \"nfName\": \"pnf-existing\", \"changeType\": \"CREATE\", \"message\": \"success\"}}" - ] - }, - "times": { - "remainingTimes": 1, - "unlimited": false - } - }, - { - "httpRequest": { - "path": "/events/unauthenticated.PMSH_CL_INPUT/.*", - "queryStringParameters" : { - "timeout" : [ "1000" ] - } - }, - "httpResponse": { - "statusCode": 200, - "headers": { - "content-type": [ - "application/json" - ] - }, - "body": [] - } - } -] diff --git a/tests/dcaegen2-services-pmsh/testcases/assets/policy-sub-created-pnf-existing.json b/tests/dcaegen2-services-pmsh/testcases/assets/policy-sub-created-pnf-existing.json new file mode 100644 index 00000000..0d1c9081 --- /dev/null +++ b/tests/dcaegen2-services-pmsh/testcases/assets/policy-sub-created-pnf-existing.json @@ -0,0 +1,13 @@ +{ + "name":"ResponseEvent", + "nameSpace":"org.onap.policy.apex.onap.pmcontrol", + "source":"APEX", + "target":"DCAE", + "version":"0.0.1", + "status":{ + "subscriptionName":"ExtraPM-All-gNB-R2B", + "nfName":"pnf-existing", + "changeType":"CREATE", + "message":"success" + } +}
\ No newline at end of file diff --git a/tests/dcaegen2-services-pmsh/testcases/pmsh.robot b/tests/dcaegen2-services-pmsh/testcases/pmsh.robot index 2f0e5bf6..4b0dc6e4 100644 --- a/tests/dcaegen2-services-pmsh/testcases/pmsh.robot +++ b/tests/dcaegen2-services-pmsh/testcases/pmsh.robot @@ -15,14 +15,16 @@ Test Teardown Delete All Sessions *** Variables *** ${PMSH_BASE_URL} https://${PMSH_IP}:8443 -${MR_BASE_URL} https://${MR_SIM_IP_ADDRESS}:3095 +${MR_BASE_URL} http://${MR_IP_ADDRESS}:3904 ${CBS_BASE_URL} https://${CBS_SIM_IP_ADDRESS}:10443 ${SUBSCRIPTIONS_ENDPOINT} /subscriptions +${POLICY_PUBLISH_MR_TOPIC} /events/unauthenticated.PMSH_CL_INPUT +${AAI_MR_TOPIC} /events/AAI_EVENT -${MR_EXPECTATION_AAI_PNF_CREATED} %{WORKSPACE}/tests/dcaegen2-services-pmsh/testcases/assets/mr-expectation-aai-pnf-created.json -${MR_EXPECTATION_AAI_PNF_REMOVED} %{WORKSPACE}/tests/dcaegen2-services-pmsh/testcases/assets/mr-expectation-aai-pnf-deleted.json -${MR_EXPECTATION_POLICY_RESPONSE_PNF_EXISTING} %{WORKSPACE}/tests/dcaegen2-services-pmsh/testcases/assets/mr-expectation-policy-subscription-created-pnf-existing.json -${CBS_EXPECTATION_ADMIN_STATE_UNLOCKED} %{WORKSPACE}/tests/dcaegen2-services-pmsh/testcases/assets/cbs-expectation-unlocked-config.json +${MR_AAI_PNF_CREATED} %{WORKSPACE}/tests/dcaegen2-services-pmsh/testcases/assets/aai-pnf-create.json +${MR_AAI_PNF_REMOVED} %{WORKSPACE}/tests/dcaegen2-services-pmsh/testcases/assets/aai-pnf-delete.json +${MR_POLICY_RESPONSE_PNF_EXISTING} %{WORKSPACE}/tests/dcaegen2-services-pmsh/testcases/assets/policy-sub-created-pnf-existing.json +${CBS_EXPECTATION_ADMIN_STATE_UNLOCKED} %{WORKSPACE}/tests/dcaegen2-services-pmsh/testcases/assets/cbs-expectation-unlocked-config.json ${ADMIN_STATE_LOCKED_PATTERN} 'administrativeState': 'LOCKED' ${CLI_EXEC_GET_CBS_CONFIG_FIRST} docker exec pmsh /bin/sh -c "grep -m 1 'PMSH config from CBS' /var/log/ONAP/dcaegen2/services/pmsh/application.log" @@ -42,54 +44,54 @@ Verify database tables exist and are empty [Tags] PMSH_02 [Documentation] Verify database has been created and is empty [Timeout] 10 seconds - ${resp}= Get Request pmsh_session ${SUBSCRIPTIONS_ENDPOINT} + ${resp}= Get Request pmsh_session ${SUBSCRIPTIONS_ENDPOINT} Should Be True ${resp.status_code} == 200 Should Contain ${resp.text} [] Verify PNF detected in AAI when administrative state unlocked [Tags] PMSH_03 [Documentation] Verify PNF detected when administrative state unlocked - [Timeout] 40 seconds + [Timeout] 60 seconds SetAdministrativeStateToUnlocked Sleep 31 Allow PMSH time to pick up changes in CBS config - ${resp}= Get Request pmsh_session ${SUBSCRIPTIONS_ENDPOINT} - Should Be Equal As Strings ${resp.json()[0]['subscription_status']} UNLOCKED - Should Be Equal As Strings ${resp.json()[0]['network_functions'][0]['nf_name']} pnf-existing - Should Be Equal As Strings ${resp.json()[0]['network_functions'][0]['nf_sub_status']} PENDING_CREATE + ${resp}= Get Request pmsh_session ${SUBSCRIPTIONS_ENDPOINT} + Should Be Equal As Strings ${resp.json()[0]['subscription_status']} UNLOCKED + Should Be Equal As Strings ${resp.json()[0]['network_functions'][0]['nf_name']} pnf-existing + Should Be Equal As Strings ${resp.json()[0]['network_functions'][0]['nf_sub_status']} PENDING_CREATE Verify Policy response on MR is handled [Tags] PMSH_04 [Documentation] Verify policy response on MR is handled [Timeout] 60 seconds - SimulatePolicyResponse ${MR_EXPECTATION_POLICY_RESPONSE_PNF_EXISTING} + SimulatePolicyResponse ${MR_POLICY_RESPONSE_PNF_EXISTING} Sleep 31 seconds Ensure Policy response on MR is picked up - ${resp}= Get Request pmsh_session ${SUBSCRIPTIONS_ENDPOINT} - Should Be Equal As Strings ${resp.json()[0]['network_functions'][0]['nf_sub_status']} CREATED + ${resp}= Get Request pmsh_session ${SUBSCRIPTIONS_ENDPOINT} + Should Be Equal As Strings ${resp.json()[0]['network_functions'][0]['nf_sub_status']} CREATED Verify AAI event on MR detailing new PNF being detected is handled [Tags] PMSH_05 [Documentation] Verify PNF created AAI event on MR is handled [Timeout] 60 seconds - SimulateNewPNF + SimulateNewPNF ${MR_AAI_PNF_CREATED} Sleep 31 seconds Ensure AAI event on MR is picked up - ${resp}= Get Request pmsh_session ${SUBSCRIPTIONS_ENDPOINT} + ${resp}= Get Request pmsh_session ${SUBSCRIPTIONS_ENDPOINT} Should Be Equal As Strings ${resp.json()[0]['network_functions'][1]['nf_name']} pnf_newly_discovered - Should Be Equal As Strings ${resp.json()[0]['network_functions'][1]['nf_sub_status']} PENDING_CREATE + Should Be Equal As Strings ${resp.json()[0]['network_functions'][1]['nf_sub_status']} PENDING_CREATE Verify AAI event on MR detailing PNF being deleted is handled [Tags] PMSH_06 [Documentation] Verify PNF deleted AAI event on MR is handled [Timeout] 60 seconds - SimulateDeletedPNF + SimulateDeletedPNF ${MR_AAI_PNF_REMOVED} Sleep 31 seconds Ensure AAI event on MR is picked up - ${resp}= Get Request pmsh_session ${SUBSCRIPTIONS_ENDPOINT} - Should Not Contain ${resp.text} pnf_newly_discovered + ${resp}= Get Request pmsh_session ${SUBSCRIPTIONS_ENDPOINT} + Should Not Contain ${resp.text} pnf_newly_discovered *** Keywords *** CreateSessions - Create Session pmsh_session ${PMSH_BASE_URL} - Create Session mr_sim_session ${MR_BASE_URL} + Create Session pmsh_session ${PMSH_BASE_URL} + Create Session mr_sim_session ${MR_BASE_URL} Create Session cbs_sim_session ${CBS_BASE_URL} SetAdministrativeStateToUnlocked @@ -100,24 +102,36 @@ SetAdministrativeStateToUnlocked ${resp} = Put Request cbs_sim_session /expectation data=${data} Should Be True ${resp.status_code} == 201 -SimulateNewPNF - ${data}= Get Data From File ${MR_EXPECTATION_AAI_PNF_CREATED} - ${resp} = Put Request mr_sim_session /clear data={"path": "/events/AAI_EVENT/dcae_pmsh_cg/dcae_pmsh_aai_event"} - Should Be True ${resp.status_code} == 200 - ${resp} = Put Request mr_sim_session /expectation data=${data} - Should Be True ${resp.status_code} == 201 SimulatePolicyResponse [Arguments] ${expected_contents} - ${data}= Get Data From File ${expected_contents} - ${resp} = Put Request mr_sim_session /clear data={"path": "/events/unauthenticated.PMSH_CL_INPUT/dcae_pmsh_cg/dcae_pmsh_policy_cl_input"} - Should Be True ${resp.status_code} == 200 - ${resp} = Put Request mr_sim_session /expectation data=${data} - Should Be True ${resp.status_code} == 201 + ${json_value}= json_from_file ${expected_contents} + ${resp}= PostCall ${POLICY_PUBLISH_MR_TOPIC} ${json_value} + log ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 + ${count}= Evaluate $resp.json().get('count') + log 'JSON Response Code:'${resp} + +SimulateNewPNF + [Arguments] ${expected_contents} + ${json_value}= json_from_file ${expected_contents} + ${resp}= PostCall ${AAI_MR_TOPIC} ${json_value} + log ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 + ${count}= Evaluate $resp.json().get('count') + log 'JSON Response Code:'${resp} SimulateDeletedPNF - ${data}= Get Data From File ${MR_EXPECTATION_AAI_PNF_REMOVED} - ${resp} = Put Request mr_sim_session /clear data={"path": "/events/AAI_EVENT/dcae_pmsh_cg/dcae_pmsh_aai_event"} - Should Be True ${resp.status_code} == 200 - ${resp} = Put Request mr_sim_session /expectation data=${data} - Should Be True ${resp.status_code} == 201 + [Arguments] ${expected_contents} + ${json_value}= json_from_file ${expected_contents} + ${resp}= PostCall ${AAI_MR_TOPIC} ${json_value} + log ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 + ${count}= Evaluate $resp.json().get('count') + log 'JSON Response Code:'${resp} + +PostCall + [Arguments] ${url} ${data} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= Post Request mr_sim_session ${url} json=${data} headers=${headers} + [Return] ${resp} |