blob: cbb77f934c6e7dce45acaf2eaa22d4d1b81d9e82 [file] [log] [blame]
rajendrajaiswal47b64d72019-02-06 16:09:24 +00001*** Settings ***
2Documentation Testing PM Mapper functionality
rajendrajaiswal47b64d72019-02-06 16:09:24 +00003Library Collections
rajendrajaiswal8f0afd82019-02-11 12:30:26 +00004Library OperatingSystem
5Library RequestsLibrary
rajendrajaiswal47b64d72019-02-06 16:09:24 +00006Library Process
7
JoeOLeary4ec2b9d2019-02-25 10:14:53 +00008Test Setup Create Session mapper_session ${PMMAPPER_BASE_URL}
9Test Teardown Delete All Sessions
10
rajendrajaiswal47b64d72019-02-06 16:09:24 +000011
12*** Variables ***
rajendrajaiswal7f7dab02019-02-15 10:23:53 +000013${CLI_EXEC_CLI_CONFIG} { head -n 5 | tail -1;} < /tmp/pmmapper.log
rajendrajaiswal140bfd22019-02-14 14:47:15 +000014${CLI_EXEC_CLI_SUBS} curl -k https://${DR_PROV_IP}:8443/internal/prov
JoeOLeary4ec2b9d2019-02-25 10:14:53 +000015${PMMAPPER_BASE_URL} http://${PMMAPPER_IP}:8081
16${DELIVERY_ENDPOINT} /delivery
Gerard Hickey0e009032019-03-05 15:45:31 +000017${HEALTHCHECK_ENDPOINT} /healthcheck
rajendrajaiswalb60c9ee2019-03-15 12:31:17 +000018${NO_MANAGED_ELEMENT_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/A_no_managed_element.xml
19${NO_MEASDATA_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/A_no_measdata.xml
Gerard Hickey0e009032019-03-05 15:45:31 +000020${VALID_METADATA_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/valid_metadata.json
Gerard Hickey80f8f462019-03-14 12:41:05 +000021${DIFF_VENDOR_METADATA} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/diff_vendor_metadata.json
Gerard Hickey0e009032019-03-05 15:45:31 +000022${CLI_EXEC_CLI_PM_LOG} docker exec pmmapper /bin/sh -c "tail -5 /var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log"
rajendrajaiswalb60c9ee2019-03-15 12:31:17 +000023${PUBLISH_NODE_URL} https://${DR_NODE_IP}:8443/publish/1/A20181002.0000-1000-0015-1000_5G.xml
rajendrajaiswal86cccfe2019-03-08 10:40:12 +000024${PM_DATA_FILE_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml
rajendrajaiswal84f3d0c2019-03-06 11:47:06 +000025${PUBLISH_CONTENT_TYPE} application/octet-stream
rajendrajaiswalb60c9ee2019-03-15 12:31:17 +000026${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
27${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
28${CLI_RESTART_PMMAPPER} docker restart pmmapper
29${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
30${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
rajendrajaiswal59a78502019-03-21 16:31:19 +000031${CLI_MESSAGE_ROUTER_TOPIC} curl http://${DMAAP_MR_IP}:3904/events/topic.org.onap.dmaap.mr.test1/CG1/C1?timeout=2000
rajendrajaiswal47b64d72019-02-06 16:09:24 +000032
33*** Test Cases ***
34
rajendrajaiswal140bfd22019-02-14 14:47:15 +000035Verify PM Mapper Receive Configuraton From Config Binding Service
rajendrajaiswal47b64d72019-02-06 16:09:24 +000036 [Tags] PM_MAPPER_01
rajendrajaiswal140bfd22019-02-14 14:47:15 +000037 [Documentation] Verify 3gpp pm mapper successfully receive config data from CBS
Gerard Hickeybf1ee242019-03-12 11:34:51 +000038 CheckLog ${CLI_EXEC_CLI_CONFIG} Received pm-mapper configuration
rajendrajaiswal140bfd22019-02-14 14:47:15 +000039
40Verify 3GPP PM Mapper Subscribes to Data Router
41 [Tags] PM_MAPPER_02
rajendrajaiswala1574702019-02-14 10:29:45 +000042 [Documentation] Verify 3gpp pm mapper subscribes to data router
Gerard Hickeybf1ee242019-03-12 11:34:51 +000043 CheckLog ${CLI_EXEC_CLI_SUBS} 3gpppmmapper
Gerard Hickey21d9ecb2019-03-12 15:00:50 +000044 CheckLog ${CLI_EXEC_CLI_SUBS} "privilegedSubscriber":true
45
Gerard Hickey0e009032019-03-05 15:45:31 +000046Verify Health Check returns 200 when a REST GET request to healthcheck url
47 [Tags] PM_MAPPER_03
48 [Documentation] Verify Health Check returns 200 when a REST GET request to healthcheck url
49 [Timeout] 1 minute
50 ${resp}= Get Request mapper_session ${HEALTHCHECK_ENDPOINT}
Gerard Hickeybf1ee242019-03-12 11:34:51 +000051 VerifyResponse ${resp.status_code} 200
Gerard Hickey0e009032019-03-05 15:45:31 +000052
JoeOLeary4ec2b9d2019-02-25 10:14:53 +000053Verify 3GPP PM Mapper responds appropriately when no metadata is provided
rajendrajaiswal7572f8d2019-03-07 14:28:47 +000054 [Tags] PM_MAPPER_04
JoeOLeary4ec2b9d2019-02-25 10:14:53 +000055 [Documentation] Verify 3GPP PM Mapper responds 400 with the message "Missing Metadata." when no metadata is provided
56 [Timeout] 1 minute
57 ${headers}= Create Dictionary X-ONAP-RequestID=1 Content-Type=application/xml
JoeOLeary667bd592019-03-05 09:21:26 +000058 ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/filename data='${EMPTY}' headers=${headers}
Gerard Hickeybf1ee242019-03-12 11:34:51 +000059 VerifyResponse ${resp.status_code} 400
60 VerifyResponse ${resp.content} Missing Metadata.
61 CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=1
JoeOLeary4ec2b9d2019-02-25 10:14:53 +000062
63Verify 3GPP PM Mapper responds appropriately when invalid metadata is provided
rajendrajaiswal7572f8d2019-03-07 14:28:47 +000064 [Tags] PM_MAPPER_05
JoeOLeary4ec2b9d2019-02-25 10:14:53 +000065 [Documentation] Verify 3GPP PM Mapper responds 400 with the message "Malformed Metadata." when invalid metadata is provided
66 [Timeout] 1 minute
rajendrajaiswal7572f8d2019-03-07 14:28:47 +000067 ${headers}= Create Dictionary X-ONAP-RequestID=2 X-DMAAP-DR-META='not metadata' Content-Type=application/xml
JoeOLeary667bd592019-03-05 09:21:26 +000068 ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/filename data='${EMPTY}' headers=${headers}
Gerard Hickeybf1ee242019-03-12 11:34:51 +000069 VerifyResponse ${resp.status_code} 400
70 VerifyResponse ${resp.content} Malformed Metadata.
71 CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=2
JoeOLeary4ec2b9d2019-02-25 10:14:53 +000072
rajendrajaiswal59a78502019-03-21 16:31:19 +000073Verify 3GPP PM Mapper received pushed PM data from data router and publishes to message router.
rajendrajaiswal7572f8d2019-03-07 14:28:47 +000074 [Tags] PM_MAPPER_06
rajendrajaiswal59a78502019-03-21 16:31:19 +000075 [Documentation] Verify 3GPP PM Mapper received pushed PM data from data router and publishes to message router.
rajendrajaiswal84f3d0c2019-03-06 11:47:06 +000076 [Timeout] 1 minute
77 ${PM_DATA}= Get File ${PM_DATA_FILE_PATH}
78 ${valid_metatdata} Get File ${VALID_METADATA_PATH}
rajendrajaiswal7572f8d2019-03-07 14:28:47 +000079 ${resp}= PutCall ${PUBLISH_NODE_URL} 3 ${PM_DATA} ${PUBLISH_CONTENT_TYPE} ${valid_metatdata.replace("\n","")} pmmapper
Gerard Hickeybf1ee242019-03-12 11:34:51 +000080 VerifyResponse ${resp.status_code} 204
rajendrajaiswalb60c9ee2019-03-15 12:31:17 +000081 Sleep 10s
rajendrajaiswal59a78502019-03-21 16:31:19 +000082 CheckLog ${CLI_EXEC_CLI_PM_LOG} Successfully published VES events to messagerouter
Gerard Hickeybf1ee242019-03-12 11:34:51 +000083 CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=3
rajendrajaiswal59a78502019-03-21 16:31:19 +000084 Sleep 10s
85 CheckLog ${CLI_MESSAGE_ROUTER_TOPIC} perf3gpp_gnb-Ericsson_pmMeasResult
Gerard Hickey0e009032019-03-05 15:45:31 +000086
rajendrajaiswal7572f8d2019-03-07 14:28:47 +000087Verify that PM Mapper logs successful when a file that contains no measdata is provided
rajendrajaiswal59a78502019-03-21 16:31:19 +000088 [Tags] PM_MAPPER_07
rajendrajaiswal7572f8d2019-03-07 14:28:47 +000089 [Documentation] Verify that PM Mapper logs successful when a file that contains no measdata is provided
90 [Timeout] 1 minute
91 ${valid_no_measdata_content}= Get File ${NO_MEASDATA_PATH}
92 ${valid_metatdata} Get File ${VALID_METADATA_PATH}
rajendrajaiswal59a78502019-03-21 16:31:19 +000093 ${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","")}
rajendrajaiswalb60c9ee2019-03-15 12:31:17 +000094 ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/A_no_measdata.xml data=${valid_no_measdata_content} headers=${headers}
Gerard Hickeybf1ee242019-03-12 11:34:51 +000095 VerifyResponse ${resp.status_code} 200
rajendrajaiswal59a78502019-03-21 16:31:19 +000096 CheckLog ${CLI_EXEC_CLI_PM_LOG} MeasData is empty
97 CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=4
rajendrajaiswal7572f8d2019-03-07 14:28:47 +000098
99Verify that PM Mapper throws Event failed validation against schema error when no managed element content is provided
rajendrajaiswal59a78502019-03-21 16:31:19 +0000100 [Tags] PM_MAPPER_08
rajendrajaiswal7572f8d2019-03-07 14:28:47 +0000101 [Documentation] Verify 3gpp pm mapper responds with an error when no managed element content is provided
102 [Timeout] 1 minute
103 ${no_managed_element_content}= Get File ${NO_MANAGED_ELEMENT_PATH}
104 ${valid_metatdata} Get File ${VALID_METADATA_PATH}
rajendrajaiswal59a78502019-03-21 16:31:19 +0000105 ${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","")}
rajendrajaiswalb60c9ee2019-03-15 12:31:17 +0000106 ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/A_no_managed_element.xml data=${no_managed_element_content} headers=${headers}
Gerard Hickeybf1ee242019-03-12 11:34:51 +0000107 VerifyResponse ${resp.status_code} 200
108 CheckLog ${CLI_EXEC_CLI_PM_LOG} XML validation failed
rajendrajaiswal59a78502019-03-21 16:31:19 +0000109 CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=5
Gerard Hickey0e009032019-03-05 15:45:31 +0000110
Gerard Hickey80f8f462019-03-14 12:41:05 +0000111Verify that PM Mapper correctly identifies a file that should not be mapped based on metadata filtering.
rajendrajaiswal59a78502019-03-21 16:31:19 +0000112 [Tags] PM_MAPPER_09
Gerard Hickey80f8f462019-03-14 12:41:05 +0000113 [Documentation] Verify that PM Mapper correctly identifies a file that should not be mapped based on metadata filtering.
114 [Timeout] 1 minute
rajendrajaiswalb60c9ee2019-03-15 12:31:17 +0000115 ${cli_cmd_output}= Run Process ${CLI_EXEC_VENDOR_FILTER} shell=yes
116 Should Be Equal As Strings ${cli_cmd_output.rc} 0
117 ${cli_cmd_output}= Run Process ${CLI_DELETE_SUB1} shell=yes
118 Should Be Equal As Strings ${cli_cmd_output.rc} 0
119 ${cli_cmd_output}= Run Process ${CLI_RESTART_PMMAPPER} shell=yes
120 Sleep 10s
rajendrajaiswal59a78502019-03-21 16:31:19 +0000121 ${pm_data}= Get File ${PM_DATA_FILE_PATH}
Gerard Hickey80f8f462019-03-14 12:41:05 +0000122 ${diff_vendor_metadata}= Get File ${DIFF_VENDOR_METADATA}
rajendrajaiswal59a78502019-03-21 16:31:19 +0000123 ${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","")}
124 ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/A20181002.0000-1000-0015-1000_5G.xml data=${pm_data} headers=${headers}
Gerard Hickey80f8f462019-03-14 12:41:05 +0000125 CheckLog ${CLI_EXEC_CLI_PM_LOG} Metadata does not match any filters,
rajendrajaiswal59a78502019-03-21 16:31:19 +0000126 CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=6
Gerard Hickey80f8f462019-03-14 12:41:05 +0000127
128
rajendrajaiswal8f0afd82019-02-11 12:30:26 +0000129*** Keywords ***
130
131PostCall
132 [Arguments] ${url} ${data}
133 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
134 ${resp}= Evaluate requests.post('${url}',data='${data}', headers=${headers},verify=False) requests
Gerard Hickey0e009032019-03-05 15:45:31 +0000135 [Return] ${resp}
rajendrajaiswal84f3d0c2019-03-06 11:47:06 +0000136
137PutCall
rajendrajaiswal7572f8d2019-03-07 14:28:47 +0000138 [Arguments] ${url} ${request_id} ${data} ${content_type} ${meta} ${user}
139 ${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=
rajendrajaiswal84f3d0c2019-03-06 11:47:06 +0000140 ${resp}= Evaluate requests.put('${url}', data="""${data}""", headers=${headers}, verify=False, allow_redirects=False) requests
141 [Return] ${resp}
Gerard Hickeybf1ee242019-03-12 11:34:51 +0000142
Gerard Hickeybf1ee242019-03-12 11:34:51 +0000143CheckLog
144 [Arguments] ${cli_exec_log_Path} ${string_to_check_in_log}
145 ${cli_cmd_output}= Run Process ${cli_exec_log_Path} shell=yes
146 Log ${cli_cmd_output.stdout}
147 Should Be Equal As Strings ${cli_cmd_output.rc} 0
148 Should Contain ${cli_cmd_output.stdout} ${string_to_check_in_log}
149
150VerifyResponse
151 [Arguments] ${actual_response_value} ${expected_response_value}
152 Should Be Equal As Strings ${actual_response_value} ${expected_response_value}