blob: 4c9afb03db39d7554c80f6813a00d25b42b21bff [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
rajendrajaiswal37452e42019-04-02 08:40:58 +00007Library String
rajendrajaiswal47b64d72019-02-06 16:09:24 +00008
JoeOLeary4ec2b9d2019-02-25 10:14:53 +00009Test Setup Create Session mapper_session ${PMMAPPER_BASE_URL}
marcinrzepeckiwroc8380fca2020-08-03 14:43:52 +020010Test Teardown CleanSessionsAndLogs
rajendrajaiswal47b64d72019-02-06 16:09:24 +000011
12*** Variables ***
rajendrajaiswal627ad482019-04-26 14:02:10 +010013${CLI_EXEC_CLI_CONFIG} { head -n 10 | tail -5;} < /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
rajendrajaiswal37452e42019-04-02 08:40:58 +000018${RECONFIGURE_ENDPOINT} /reconfigure
rajendrajaiswalb60c9ee2019-03-15 12:31:17 +000019${NO_MANAGED_ELEMENT_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/A_no_managed_element.xml
20${NO_MEASDATA_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/A_no_measdata.xml
Gerard Hickey0e009032019-03-05 15:45:31 +000021${VALID_METADATA_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/valid_metadata.json
JoeOLearydf3c2632020-02-17 09:40:35 +000022${NR_VALID_METADATA_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/new_radio/valid_metadata.json
Gerard Hickey80f8f462019-03-14 12:41:05 +000023${DIFF_VENDOR_METADATA} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/diff_vendor_metadata.json
Gerard Hickey67739262019-04-09 13:35:14 +000024${NON_XML_FILE} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/diff_vendor_metadata.json
marcinrzepeckiwroc8380fca2020-08-03 14:43:52 +020025${CLI_EXEC_CLI_PM_LOG} docker exec pmmapper /bin/sh -c "cat /var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log"
26${CLI_EXEC_CLI_PM_LOG_CLEAR} docker exec pmmapper /bin/sh -c "echo -n "" > /var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log"
rajendrajaiswal37452e42019-04-02 08:40:58 +000027${PUBLISH_NODE_URL} https://${DR_NODE_IP}:8443/publish/1
28${TYPE-A_PM_DATA_FILE_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml
29${TYPE-C_PM_DATA_FILE_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/C20190328.0000-0015.xml
JoeOLearydf3c2632020-02-17 09:40:35 +000030${NR-TYPE-A_PM_DATA_FILE_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/new_radio/A20181004.0000-1000-0015-1000_5G.xml
31${NR-TYPE-C_PM_DATA_FILE_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/new_radio/C20190329.0000-0015.xml
marcinrzepeckiwroc8380fca2020-08-03 14:43:52 +020032${NR-TYPE-PM_DATA_FILE_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/new_radio/PM202007171301+020024C202007171207+0200-1215+0200_45678.xml
rajendrajaiswalb60c9ee2019-03-15 12:31:17 +000033${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
34${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
marcinrzepeckiwroc713b9ea2020-07-21 13:41:46 +020035${CLI_EXEC_PM_FILTER_regex} 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_regex_config.json
rajendrajaiswalef684c82019-04-10 10:48:25 +000036${CLI_MESSAGE_ROUTER_TOPIC} curl http://${DMAAP_MR_IP}:3904/events/PM_MAPPER/CG1/C1?timeout=1000 > /tmp/mr.log
rajendrajaiswal37452e42019-04-02 08:40:58 +000037${CLI_MR_LOG} cat /tmp/mr.log
rajendrajaiswal47b64d72019-02-06 16:09:24 +000038
Gerard Hickeyf5f5ee52019-04-11 06:47:48 +000039
rajendrajaiswal47b64d72019-02-06 16:09:24 +000040*** Test Cases ***
rajendrajaiswal140bfd22019-02-14 14:47:15 +000041Verify PM Mapper Receive Configuraton From Config Binding Service
rajendrajaiswal47b64d72019-02-06 16:09:24 +000042 [Tags] PM_MAPPER_01
rajendrajaiswal140bfd22019-02-14 14:47:15 +000043 [Documentation] Verify 3gpp pm mapper successfully receive config data from CBS
marcinrzepeckiwrocc59e79e2020-08-10 16:02:01 +020044 CheckLog ${CLI_EXEC_CLI_CONFIG} Received pm-mapper configuration from ConfigBinding Service
rajendrajaiswal140bfd22019-02-14 14:47:15 +000045
Gerard Hickey0e009032019-03-05 15:45:31 +000046Verify Health Check returns 200 when a REST GET request to healthcheck url
rajendrajaiswal37452e42019-04-02 08:40:58 +000047 [Tags] PM_MAPPER_02
Gerard Hickey0e009032019-03-05 15:45:31 +000048 [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
rajendrajaiswal37452e42019-04-02 08:40:58 +000054 [Tags] PM_MAPPER_03
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
marcinrzepeckiwroc8380fca2020-08-03 14:43:52 +020057 ${headers}= Create Dictionary X-ONAP-RequestID=3 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.
marcinrzepeckiwroc8380fca2020-08-03 14:43:52 +020061 CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=3
JoeOLeary4ec2b9d2019-02-25 10:14:53 +000062
63Verify 3GPP PM Mapper responds appropriately when invalid metadata is provided
rajendrajaiswal37452e42019-04-02 08:40:58 +000064 [Tags] PM_MAPPER_04
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
marcinrzepeckiwroc8380fca2020-08-03 14:43:52 +020067 ${headers}= Create Dictionary X-ONAP-RequestID=4 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.
marcinrzepeckiwroc8380fca2020-08-03 14:43:52 +020071 CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=4
JoeOLeary4ec2b9d2019-02-25 10:14:53 +000072
rajendrajaiswalef684c82019-04-10 10:48:25 +000073Verify that PM Mapper logs successful when a file that contains no measdata is provided
rajendrajaiswal37452e42019-04-02 08:40:58 +000074 [Tags] PM_MAPPER_05
rajendrajaiswalef684c82019-04-10 10:48:25 +000075 [Documentation] Verify that PM Mapper logs successful when a file that contains no measdata is provided
rajendrajaiswal84f3d0c2019-03-06 11:47:06 +000076 [Timeout] 1 minute
marcinrzepeckiwroc8380fca2020-08-03 14:43:52 +020077 SendToDatarouter ${NO_MEASDATA_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=5
rajendrajaiswalef684c82019-04-10 10:48:25 +000078 CheckLog ${CLI_EXEC_CLI_PM_LOG} MeasData is empty
marcinrzepeckiwroc8380fca2020-08-03 14:43:52 +020079 CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=5
Gerard Hickey0e009032019-03-05 15:45:31 +000080
rajendrajaiswalef684c82019-04-10 10:48:25 +000081Verify that PM Mapper throws Event failed validation against schema error when no managed element content is provided
rajendrajaiswal37452e42019-04-02 08:40:58 +000082 [Tags] PM_MAPPER_06
rajendrajaiswalef684c82019-04-10 10:48:25 +000083 [Documentation] Verify 3gpp pm mapper responds with an error when no managed element content is provided
84 [Timeout] 1 minute
marcinrzepeckiwroc8380fca2020-08-03 14:43:52 +020085 SendToDatarouter ${NO_MANAGED_ELEMENT_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=6
rajendrajaiswalef684c82019-04-10 10:48:25 +000086 CheckLog ${CLI_EXEC_CLI_PM_LOG} XML validation failed
marcinrzepeckiwroc8380fca2020-08-03 14:43:52 +020087 CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=6
rajendrajaiswalef684c82019-04-10 10:48:25 +000088
89Verify that PM Mapper maps Type-C xml file and publish 3gpp perf VES evnets to message router
90 [Tags] PM_MAPPER_07
rajendrajaiswal37452e42019-04-02 08:40:58 +000091 [Documentation] Verify that PM Mapper maps Type-C xml file and publish 3gpp perf VES evnets to message router.
92 [Timeout] 1 minute
marcinrzepeckiwroc8380fca2020-08-03 14:43:52 +020093 SendToDatarouter ${TYPE-C_PM_DATA_FILE_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=7
rajendrajaiswal37452e42019-04-02 08:40:58 +000094 CheckLog ${CLI_EXEC_CLI_PM_LOG} Successfully published VES events to messagerouter
rajendrajaiswal37452e42019-04-02 08:40:58 +000095
rajendrajaiswalef684c82019-04-10 10:48:25 +000096Verify 3GPP PM Mapper maps Type-A file based on counter filtering and publish 3gpp perf VES evnets to message router
rajendrajaiswal59a78502019-03-21 16:31:19 +000097 [Tags] PM_MAPPER_08
rajendrajaiswalef684c82019-04-10 10:48:25 +000098 [Documentation] Verify 3GPP PM Mapper maps Type-A file and publish 3gpp perf VES evnets to message router.
rajendrajaiswal7572f8d2019-03-07 14:28:47 +000099 [Timeout] 1 minute
rajendrajaiswalef684c82019-04-10 10:48:25 +0000100 ${cli_cmd_output}= Run Process ${CLI_EXEC_PM_FILTER} shell=yes
101 ${resp}= Get Request mapper_session ${RECONFIGURE_ENDPOINT}
102 Sleep 5s
marcinrzepeckiwroc8380fca2020-08-03 14:43:52 +0200103 SendToDatarouter ${TYPE-A_PM_DATA_FILE_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=8
rajendrajaiswalef684c82019-04-10 10:48:25 +0000104 CheckLog ${CLI_EXEC_CLI_PM_LOG} Successfully published VES events to messagerouter
Gerard Hickey0e009032019-03-05 15:45:31 +0000105
Gerard Hickey80f8f462019-03-14 12:41:05 +0000106Verify that PM Mapper correctly identifies a file that should not be mapped based on metadata filtering.
rajendrajaiswal59a78502019-03-21 16:31:19 +0000107 [Tags] PM_MAPPER_09
Gerard Hickey80f8f462019-03-14 12:41:05 +0000108 [Documentation] Verify that PM Mapper correctly identifies a file that should not be mapped based on metadata filtering.
109 [Timeout] 1 minute
rajendrajaiswal37452e42019-04-02 08:40:58 +0000110 ${cli_cmd_output}= Run Process ${CLI_EXEC_VENDOR_FILTER} shell=yes
rajendrajaiswalb60c9ee2019-03-15 12:31:17 +0000111 Should Be Equal As Strings ${cli_cmd_output.rc} 0
rajendrajaiswal37452e42019-04-02 08:40:58 +0000112 ${resp}= Get Request mapper_session ${RECONFIGURE_ENDPOINT}
113 Sleep 5s
marcinrzepeckiwroc8380fca2020-08-03 14:43:52 +0200114 SendToDatarouter ${TYPE-A_PM_DATA_FILE_PATH} ${DIFF_VENDOR_METADATA} X-ONAP-RequestID=9
115 CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=9
rajendrajaiswal37452e42019-04-02 08:40:58 +0000116 CheckLog ${CLI_EXEC_CLI_PM_LOG} Metadata does not match any filters
Gerard Hickey80f8f462019-03-14 12:41:05 +0000117
Gerard Hickey67739262019-04-09 13:35:14 +0000118Verify that PM Mapper correctly identifies a non-xml file.
119 [Tags] PM_MAPPER_10
120 [Documentation] Verify that PM Mapper correctly identifies a non-xml file.
121 [Timeout] 1 minute
marcinrzepeckiwroc8380fca2020-08-03 14:43:52 +0200122 SendToDatarouter ${NON_XML_FILE} ${VALID_METADATA_PATH} X-ONAP-RequestID=10
rajendrajaiswal117e5982019-07-30 09:54:29 +0000123 CheckLog ${CLI_EXEC_CLI_PM_LOG} PM measurement file must have an extension of .xml
marcinrzepeckiwroc8380fca2020-08-03 14:43:52 +0200124 CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=10
Gerard Hickey67739262019-04-09 13:35:14 +0000125
JoeOLearydf3c2632020-02-17 09:40:35 +0000126Verify that PM Mapper correctly maps an NR Type-A file based on counter filtering and publish 3gpp perf VES events to message router.
127 [Tags] PM_MAPPER_11
128 [Documentation] Verify 3GPP PM Mapper maps an NR Type-A file and publish 3gpp perf VES evnets to message router.
129 [Timeout] 1 minute
130 ${cli_cmd_output}= Run Process ${CLI_EXEC_PM_FILTER} shell=yes
131 ${resp}= Get Request mapper_session ${RECONFIGURE_ENDPOINT}
132 Sleep 5s
marcinrzepeckiwroc8380fca2020-08-03 14:43:52 +0200133 SendToDatarouter ${NR-TYPE-A_PM_DATA_FILE_PATH} ${NR_VALID_METADATA_PATH} X-ONAP-RequestID=11
JoeOLearydf3c2632020-02-17 09:40:35 +0000134 CheckLog ${CLI_EXEC_CLI_PM_LOG} Successfully published VES events to messagerouter
135
136Verify that PM Mapper correctly maps an NR Type-C file based on counter filtering and publish 3gpp perf VES events to message router.
137 [Tags] PM_MAPPER_12
138 [Documentation] Verify that PM Mapper maps an NR Type-C xml file and publish 3gpp perf VES evnets to message router.
139 [Timeout] 1 minute
marcinrzepeckiwroc8380fca2020-08-03 14:43:52 +0200140 SendToDatarouter ${NR-TYPE-C_PM_DATA_FILE_PATH} ${NR_VALID_METADATA_PATH} X-ONAP-RequestID=12
141 CheckLog ${CLI_EXEC_CLI_PM_LOG} Successfully published VES events to messagerouter
Gerard Hickey67739262019-04-09 13:35:14 +0000142
marcinrzepeckiwroc713b9ea2020-07-21 13:41:46 +0200143Verify 3GPP PM Mapper maps Type-A file based on counter filtering with regexp
144 [Tags] PM_MAPPER_13
145 [Documentation] Verify 3GPP PM Mapper maps Type-A file based on counter filtering with wildcards/regexp and publish 3gpp perf VES evnets to message router.
146 [Timeout] 1 minute
147 ${cli_cmd_output}= Run Process ${CLI_EXEC_PM_FILTER_regex} shell=yes
148 ${resp}= Get Request mapper_session ${RECONFIGURE_ENDPOINT}
149 Sleep 5s
marcinrzepeckiwroc8380fca2020-08-03 14:43:52 +0200150 SendToDatarouter ${TYPE-A_PM_DATA_FILE_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=13
marcinrzepeckiwroc713b9ea2020-07-21 13:41:46 +0200151 CheckLog ${CLI_EXEC_CLI_PM_LOG} Successfully published VES events to messagerouter
152
marcinrzepeckiwroc8ad7a892020-07-21 14:41:31 +0200153Verify that password receive from CBS are successfully encrypted
154 [Tags] PM_MAPPER_14
155 [Documentation] Verify that password receive from CBS are successfully encrypted.
156 CheckLog ${CLI_EXEC_CLI_CONFIG} "aaf_password": *****
157 CheckLog ${CLI_EXEC_CLI_CONFIG} "password": *****
158
marcinrzepeckiwroc8380fca2020-08-03 14:43:52 +0200159Verify that PM Mapper correctly maps an NR Type-PM file based on counter filtering and publish 3gpp perf VES events to message router.
160 [Tags] PM_MAPPER_15
161 [Documentation] Verify that PM Mapper maps an NR Type-PM xml file and publish 3gpp perf VES evnets to message router.
162 [Timeout] 1 minute
163 SendToDatarouter ${NR-TYPE-PM_DATA_FILE_PATH} ${NR_VALID_METADATA_PATH} X-ONAP-RequestID=15
164 CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=15
165 CheckLog ${CLI_EXEC_CLI_PM_LOG} Successfully published VES events to messagerouter
166
rajendrajaiswal8f0afd82019-02-11 12:30:26 +0000167*** Keywords ***
168
rajendrajaiswal37452e42019-04-02 08:40:58 +0000169SendToDatarouter
170 [Arguments] ${filepath} ${metadatapath} ${request_id}
171 ${pmdata}= Get File ${filepath}
172 ${metatdata} Get File ${metadatapath}
173 ${filename} Fetch From Right ${filepath} /
174 ${resp}= PutCall ${PUBLISH_NODE_URL}/${filename} ${request_id} ${pmdata} ${metatdata.replace("\n","")} pmmapper
175 VerifyResponse ${resp.status_code} 204
Gerard Hickeyf5f5ee52019-04-11 06:47:48 +0000176 Sleep 10s
rajendrajaiswal84f3d0c2019-03-06 11:47:06 +0000177
178PutCall
rajendrajaiswal37452e42019-04-02 08:40:58 +0000179 [Arguments] ${url} ${request_id} ${data} ${meta} ${user}
180 ${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=
181 ${resp}= Evaluate requests.put('${url}', data="""${data}""", headers=${headers}, verify=False, allow_redirects=False) requests
182 [Return] ${resp}
Gerard Hickeybf1ee242019-03-12 11:34:51 +0000183
Gerard Hickeybf1ee242019-03-12 11:34:51 +0000184CheckLog
rajendrajaiswal37452e42019-04-02 08:40:58 +0000185 [Arguments] ${cli_exec_log_Path} ${string_to_check_in_log}
Gerard Hickeybf1ee242019-03-12 11:34:51 +0000186 ${cli_cmd_output}= Run Process ${cli_exec_log_Path} shell=yes
187 Log ${cli_cmd_output.stdout}
188 Should Be Equal As Strings ${cli_cmd_output.rc} 0
189 Should Contain ${cli_cmd_output.stdout} ${string_to_check_in_log}
190
191VerifyResponse
192 [Arguments] ${actual_response_value} ${expected_response_value}
Krzysztof Gajewski18151c52020-07-15 08:45:51 +0200193 Should Be Equal As Strings ${actual_response_value} ${expected_response_value}
marcinrzepeckiwroc8380fca2020-08-03 14:43:52 +0200194
195ClearLogs
196 Run Process ${CLI_EXEC_CLI_PM_LOG_CLEAR} shell=yes
197
198CleanSessionsAndLogs
199 Delete All Sessions
200 ClearLogs