diff options
author | 2019-04-04 00:49:17 +0000 | |
---|---|---|
committer | 2019-04-04 00:49:17 +0000 | |
commit | 82ca043a58fe62d9d3e17139f8a6d772b5f9fb5a (patch) | |
tree | 75e3a2c84a85cfaa563a49f11724e610e04c8037 /tests | |
parent | 999743afc44f44a1a0dce38dd1ddc15a7655ab7d (diff) | |
parent | 37452e4b088d18cdd47e8c85628b86d95db390f2 (diff) |
Merge "Added support for publishing PM Mapper"
Diffstat (limited to 'tests')
4 files changed, 124 insertions, 72 deletions
diff --git a/tests/dcaegen2-pmmapper/pmmapper/assets/C20190328.0000-0015.xml b/tests/dcaegen2-pmmapper/pmmapper/assets/C20190328.0000-0015.xml new file mode 100644 index 00000000..b6a3b436 --- /dev/null +++ b/tests/dcaegen2-pmmapper/pmmapper/assets/C20190328.0000-0015.xml @@ -0,0 +1,49 @@ +<measCollecFile xmlns="http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec"> + <fileHeader dnPrefix="some dnPrefix" vendorName="FooBar Ltd" + fileFormatVersion="32.435 V10.0"> + <fileSender localDn="Dublin"/> + <measCollec beginTime="2018-10-02T12:00:00+01:00"/> + </fileHeader> + <measData> + <managedElement swVersion="r0.1" localDn="Dublin1"/> + <measInfo measInfoId="measInfoId1"> + <job jobId="jobId1"/> + <granPeriod endTime="2001-10-02T12:15:00Z" duration="PT100S"/> + <repPeriod duration="PT100S"/> + <measTypes>z1 a1 zz1 b1</measTypes> + <measValue measObjLdn="objLdn"> + <measResults>1 11 111 1111</measResults> + <suspect>false</suspect> + </measValue> + </measInfo> + </measData> + <measData> + <managedElement swVersion="r0.2" localDn="Dublin2"/> + <measInfo measInfoId="measInfoId2"> + <job jobId="jobId"/> + <granPeriod endTime="2002-10-02T12:15:00Z" duration="PT200S"/> + <repPeriod duration="PT200S"/> + <measTypes>z2 a2 zz2 b2</measTypes> + <measValue measObjLdn="objLdn"> + <measResults>2 22 222 2222</measResults> + <suspect>false</suspect> + </measValue> + </measInfo> + </measData> + <measData> + <managedElement swVersion="r0.3" localDn="Dublin3"/> + <measInfo measInfoId="measInfoId3"> + <job jobId="jobId"/> + <granPeriod endTime="2003-10-02T12:15:00Z" duration="PT300S"/> + <repPeriod duration="PT300S"/> + <measTypes>z3 a3 zz3 b3</measTypes> + <measValue measObjLdn="objLdn"> + <measResults>3 33 333 3333</measResults> + <suspect>false</suspect> + </measValue> + </measInfo> + </measData> + <fileFooter> + <measCollec endTime="2018-10-02T12:15:00+01:00"/> + </fileFooter> +</measCollecFile> diff --git a/tests/dcaegen2-pmmapper/pmmapper/assets/pm_filter_config.json b/tests/dcaegen2-pmmapper/pmmapper/assets/pm_filter_config.json index 4bd48839..544b6980 100644 --- a/tests/dcaegen2-pmmapper/pmmapper/assets/pm_filter_config.json +++ b/tests/dcaegen2-pmmapper/pmmapper/assets/pm_filter_config.json @@ -14,10 +14,10 @@ "aaf_password": null, "dmaap_info": { "location": "csit-pmmapper", - "delivery_url": "http://3gpppmmapper:8081/delivery", + "delivery_url": "http://dcae-pm-mapper.onap.svc.cluster.local:8081/delivery", "username": "username", "password": "password", - "subscriber_id": "subscriber_id" + "subscriber_id": "1" } } }, @@ -26,7 +26,7 @@ "type": "message_router", "aaf_password": null, "dmaap_info": { - "topic_url": "https://message-router:3904/events/org.onap.dmaap.onapCSIT.pm_mapper", + "topic_url": "http://message-router:3904/events/PM_MAPPER", "client_role": "org.onap.dmaap.client.pub", "location": "csit-pmmapper", "client_id": null @@ -34,8 +34,12 @@ "aaf_username": null } }, - "dmaap_dr_feed_id": "1", - "buscontroller_feed_subscription_endpoint": "http://dmaap-bc:8080/webapi/dr_subs", - "dmaap_dr_delete_endpoint": "http://dmaap-dr-node:8443/delete", - "services_calls": {} + "dmaap_dr_feed_name": "1", + "dmaap_dr_delete_endpoint": "https://dmaap-dr-node:8443/delete", + "services_calls": {}, + "enable_http": true, + "key_store_path": "/opt/app/pm-mapper/etc/cert/cert.jks.b64", + "key_store_pass_path": "/opt/app/pm-mapper/etc/cert/jks.pass", + "trust_store_path": "/opt/app/pm-mapper/etc/cert/trust.jks.b64", + "trust_store_pass_path": "/opt/app/pm-mapper/etc/cert/trust.pass" }
\ No newline at end of file diff --git a/tests/dcaegen2-pmmapper/pmmapper/assets/vendor_filter_config.json b/tests/dcaegen2-pmmapper/pmmapper/assets/vendor_filter_config.json index fff43a15..64fefa48 100644 --- a/tests/dcaegen2-pmmapper/pmmapper/assets/vendor_filter_config.json +++ b/tests/dcaegen2-pmmapper/pmmapper/assets/vendor_filter_config.json @@ -2,7 +2,7 @@ "pm-mapper-filter": { "filters":[{ "pmDefVsn": "1.0", - "nfType": "5G", + "nfType": "gnb", "vendor": "Ericsson", "measTypes": [] }] @@ -14,10 +14,10 @@ "aaf_password": null, "dmaap_info": { "location": "csit-pmmapper", - "delivery_url": "http://3gpppmmapper:8081/delivery", + "delivery_url": "http://dcae-pm-mapper.onap.svc.cluster.local:8081/delivery", "username": "username", "password": "password", - "subscriber_id": "subscriber_id" + "subscriber_id": "1" } } }, @@ -26,7 +26,7 @@ "type": "message_router", "aaf_password": null, "dmaap_info": { - "topic_url": "https://message-router:3904/events/org.onap.dmaap.onapCSIT.pm_mapper", + "topic_url": "http://message-router:3904/events/PM_MAPPER", "client_role": "org.onap.dmaap.client.pub", "location": "csit-pmmapper", "client_id": null @@ -34,8 +34,12 @@ "aaf_username": null } }, - "dmaap_dr_feed_id": "1", - "buscontroller_feed_subscription_endpoint": "http://dmaap-bc:8080/webapi/dr_subs", - "dmaap_dr_delete_endpoint": "http://dmaap-dr-node:8443/delete", - "services_calls": {} + "dmaap_dr_feed_name": "1", + "dmaap_dr_delete_endpoint": "https://dmaap-dr-node:8443/delete", + "services_calls": {}, + "enable_http": true, + "key_store_path": "/opt/app/pm-mapper/etc/cert/cert.jks.b64", + "key_store_pass_path": "/opt/app/pm-mapper/etc/cert/jks.pass", + "trust_store_path": "/opt/app/pm-mapper/etc/cert/trust.jks.b64", + "trust_store_pass_path": "/opt/app/pm-mapper/etc/cert/trust.pass" }
\ No newline at end of file diff --git a/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot b/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot index cbb77f93..5d217513 100644 --- a/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot +++ b/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot @@ -4,54 +4,52 @@ Library Collections Library OperatingSystem Library RequestsLibrary Library Process +Library String Test Setup Create Session mapper_session ${PMMAPPER_BASE_URL} Test Teardown Delete All Sessions *** Variables *** -${CLI_EXEC_CLI_CONFIG} { head -n 5 | tail -1;} < /tmp/pmmapper.log +${CLI_EXEC_CLI_CONFIG} { head -n 6 | tail -2;} < /tmp/pmmapper.log ${CLI_EXEC_CLI_SUBS} curl -k https://${DR_PROV_IP}:8443/internal/prov ${PMMAPPER_BASE_URL} http://${PMMAPPER_IP}:8081 ${DELIVERY_ENDPOINT} /delivery ${HEALTHCHECK_ENDPOINT} /healthcheck +${RECONFIGURE_ENDPOINT} /reconfigure ${NO_MANAGED_ELEMENT_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/A_no_managed_element.xml ${NO_MEASDATA_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/A_no_measdata.xml ${VALID_METADATA_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/valid_metadata.json ${DIFF_VENDOR_METADATA} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/diff_vendor_metadata.json -${CLI_EXEC_CLI_PM_LOG} docker exec pmmapper /bin/sh -c "tail -5 /var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log" -${PUBLISH_NODE_URL} https://${DR_NODE_IP}:8443/publish/1/A20181002.0000-1000-0015-1000_5G.xml -${PM_DATA_FILE_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml +${CLI_EXEC_CLI_PM_LOG} docker exec pmmapper /bin/sh -c "tail -10 /var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log" +${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/topic.org.onap.dmaap.mr.test1/CG1/C1?timeout=2000 +${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_MR_LOG} cat /tmp/mr.log *** Test Cases *** - Verify PM Mapper Receive Configuraton From Config Binding Service [Tags] PM_MAPPER_01 [Documentation] Verify 3gpp pm mapper successfully receive config data from CBS CheckLog ${CLI_EXEC_CLI_CONFIG} Received pm-mapper configuration -Verify 3GPP PM Mapper Subscribes to Data Router - [Tags] PM_MAPPER_02 - [Documentation] Verify 3gpp pm mapper subscribes to data router - CheckLog ${CLI_EXEC_CLI_SUBS} 3gpppmmapper - CheckLog ${CLI_EXEC_CLI_SUBS} "privilegedSubscriber":true - Verify Health Check returns 200 when a REST GET request to healthcheck url - [Tags] PM_MAPPER_03 + [Tags] PM_MAPPER_02 [Documentation] Verify Health Check returns 200 when a REST GET request to healthcheck url [Timeout] 1 minute ${resp}= Get Request mapper_session ${HEALTHCHECK_ENDPOINT} VerifyResponse ${resp.status_code} 200 Verify 3GPP PM Mapper responds appropriately when no metadata is provided - [Tags] PM_MAPPER_04 + [Tags] PM_MAPPER_03 [Documentation] Verify 3GPP PM Mapper responds 400 with the message "Missing Metadata." when no metadata is provided [Timeout] 1 minute ${headers}= Create Dictionary X-ONAP-RequestID=1 Content-Type=application/xml @@ -61,7 +59,7 @@ Verify 3GPP PM Mapper responds appropriately when no metadata is provided CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=1 Verify 3GPP PM Mapper responds appropriately when invalid metadata is provided - [Tags] PM_MAPPER_05 + [Tags] PM_MAPPER_04 [Documentation] Verify 3GPP PM Mapper responds 400 with the message "Malformed Metadata." when invalid metadata is provided [Timeout] 1 minute ${headers}= Create Dictionary X-ONAP-RequestID=2 X-DMAAP-DR-META='not metadata' Content-Type=application/xml @@ -70,78 +68,75 @@ 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 received pushed PM data from data router and publishes to message router. - [Tags] PM_MAPPER_06 - [Documentation] Verify 3GPP PM Mapper received pushed PM data from data router and publishes to message router. +Verify 3GPP PM Mapper maps Type-A file and publish 3gpp perf VES evnets to message router + [Tags] PM_MAPPER_05 + [Documentation] Verify 3GPP PM Mapper maps Type-A file and publish 3gpp perf VES evnets to message router. [Timeout] 1 minute - ${PM_DATA}= Get File ${PM_DATA_FILE_PATH} - ${valid_metatdata} Get File ${VALID_METADATA_PATH} - ${resp}= PutCall ${PUBLISH_NODE_URL} 3 ${PM_DATA} ${PUBLISH_CONTENT_TYPE} ${valid_metatdata.replace("\n","")} pmmapper - VerifyResponse ${resp.status_code} 204 - Sleep 10s + 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 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. + [Tags] PM_MAPPER_06 + [Documentation] Verify that PM Mapper maps Type-C xml file and publish 3gpp perf VES evnets to message router. + [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 + 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 [Tags] PM_MAPPER_07 [Documentation] Verify that PM Mapper logs successful when a file that contains no measdata is provided [Timeout] 1 minute - ${valid_no_measdata_content}= Get File ${NO_MEASDATA_PATH} - ${valid_metatdata} Get File ${VALID_METADATA_PATH} - ${headers}= Create Dictionary X-ONAP-RequestID=4 Content-Type=application/xml X-DMAAP-DR-PUBLISH-ID=3 X-DMAAP-DR-META=${valid_metatdata.replace("\n","")} - ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/A_no_measdata.xml data=${valid_no_measdata_content} headers=${headers} - VerifyResponse ${resp.status_code} 200 + SendToDatarouter ${NO_MEASDATA_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=5 CheckLog ${CLI_EXEC_CLI_PM_LOG} MeasData is empty - CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=4 + CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=5 Verify that PM Mapper throws Event failed validation against schema error when no managed element content is provided [Tags] PM_MAPPER_08 [Documentation] Verify 3gpp pm mapper responds with an error when no managed element content is provided [Timeout] 1 minute - ${no_managed_element_content}= Get File ${NO_MANAGED_ELEMENT_PATH} - ${valid_metatdata} Get File ${VALID_METADATA_PATH} - ${headers}= Create Dictionary X-ONAP-RequestID=5 Content-Type=application/xml X-DMAAP-DR-PUBLISH-ID=2 X-DMAAP-DR-META=${valid_metatdata.replace("\n","")} - ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/A_no_managed_element.xml data=${no_managed_element_content} headers=${headers} - VerifyResponse ${resp.status_code} 200 + SendToDatarouter ${NO_MANAGED_ELEMENT_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=6 CheckLog ${CLI_EXEC_CLI_PM_LOG} XML validation failed - CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=5 + CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=6 Verify that PM Mapper correctly identifies a file that should not be mapped based on metadata filtering. [Tags] PM_MAPPER_09 [Documentation] Verify that PM Mapper correctly identifies a file that should not be mapped based on metadata filtering. [Timeout] 1 minute - ${cli_cmd_output}= Run Process ${CLI_EXEC_VENDOR_FILTER} shell=yes - Should Be Equal As Strings ${cli_cmd_output.rc} 0 - ${cli_cmd_output}= Run Process ${CLI_DELETE_SUB1} shell=yes + ${cli_cmd_output}= Run Process ${CLI_EXEC_VENDOR_FILTER} shell=yes Should Be Equal As Strings ${cli_cmd_output.rc} 0 - ${cli_cmd_output}= Run Process ${CLI_RESTART_PMMAPPER} shell=yes - Sleep 10s - ${pm_data}= Get File ${PM_DATA_FILE_PATH} - ${diff_vendor_metadata}= Get File ${DIFF_VENDOR_METADATA} - ${headers}= Create Dictionary X-ONAP-RequestID=6 Content-Type=application/xml X-DMAAP-DR-PUBLISH-ID=2 X-DMAAP-DR-META=${diff_vendor_metadata.replace("\n","")} - ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/A20181002.0000-1000-0015-1000_5G.xml data=${pm_data} headers=${headers} - CheckLog ${CLI_EXEC_CLI_PM_LOG} Metadata does not match any filters, - CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=6 - + ${resp}= Get Request mapper_session ${RECONFIGURE_ENDPOINT} + Sleep 5s + SendToDatarouter ${TYPE-A_PM_DATA_FILE_PATH} ${DIFF_VENDOR_METADATA} X-ONAP-RequestID=7 + CheckLog ${CLI_EXEC_CLI_PM_LOG} Metadata does not match any filters + CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=7 *** Keywords *** -PostCall - [Arguments] ${url} ${data} - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= Evaluate requests.post('${url}',data='${data}', headers=${headers},verify=False) requests - [Return] ${resp} +SendToDatarouter + [Arguments] ${filepath} ${metadatapath} ${request_id} + ${pmdata}= Get File ${filepath} + ${metatdata} Get File ${metadatapath} + ${filename} Fetch From Right ${filepath} / + ${resp}= PutCall ${PUBLISH_NODE_URL}/${filename} ${request_id} ${pmdata} ${metatdata.replace("\n","")} pmmapper + VerifyResponse ${resp.status_code} 204 + Sleep 10s PutCall - [Arguments] ${url} ${request_id} ${data} ${content_type} ${meta} ${user} - ${headers}= Create Dictionary X-ONAP-RequestID=${request_id} X-DMAAP-DR-META=${meta} Content-Type=${content_type} X-DMAAP-DR-ON-BEHALF-OF=${user} Authorization=Basic cG1tYXBwZXI6cG1tYXBwZXI= - ${resp}= Evaluate requests.put('${url}', data="""${data}""", headers=${headers}, verify=False, allow_redirects=False) requests - [Return] ${resp} + [Arguments] ${url} ${request_id} ${data} ${meta} ${user} + ${headers}= Create Dictionary X-ONAP-RequestID=${request_id} X-DMAAP-DR-META=${meta} Content-Type=application/octet-stream X-DMAAP-DR-ON-BEHALF-OF=${user} Authorization=Basic cG1tYXBwZXI6cG1tYXBwZXI= + ${resp}= Evaluate requests.put('${url}', data="""${data}""", headers=${headers}, verify=False, allow_redirects=False) requests + [Return] ${resp} CheckLog - [Arguments] ${cli_exec_log_Path} ${string_to_check_in_log} + [Arguments] ${cli_exec_log_Path} ${string_to_check_in_log} ${cli_cmd_output}= Run Process ${cli_exec_log_Path} shell=yes Log ${cli_cmd_output.stdout} Should Be Equal As Strings ${cli_cmd_output.rc} 0 |