blob: a103c5cca2c11ecda032560dffb7c69c4319be21 [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}
10Test Teardown Delete All Sessions
11
rajendrajaiswal47b64d72019-02-06 16:09:24 +000012
13*** Variables ***
rajendrajaiswal37452e42019-04-02 08:40:58 +000014${CLI_EXEC_CLI_CONFIG} { head -n 6 | tail -2;} < /tmp/pmmapper.log
rajendrajaiswal140bfd22019-02-14 14:47:15 +000015${CLI_EXEC_CLI_SUBS} curl -k https://${DR_PROV_IP}:8443/internal/prov
JoeOLeary4ec2b9d2019-02-25 10:14:53 +000016${PMMAPPER_BASE_URL} http://${PMMAPPER_IP}:8081
17${DELIVERY_ENDPOINT} /delivery
Gerard Hickey0e009032019-03-05 15:45:31 +000018${HEALTHCHECK_ENDPOINT} /healthcheck
rajendrajaiswal37452e42019-04-02 08:40:58 +000019${RECONFIGURE_ENDPOINT} /reconfigure
rajendrajaiswalb60c9ee2019-03-15 12:31:17 +000020${NO_MANAGED_ELEMENT_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/A_no_managed_element.xml
21${NO_MEASDATA_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/A_no_measdata.xml
Gerard Hickey0e009032019-03-05 15:45:31 +000022${VALID_METADATA_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/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
rajendrajaiswal3b202f02019-04-09 10:37:49 +000025${CLI_EXEC_CLI_PM_LOG} docker exec pmmapper /bin/sh -c "tail -15 /var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log"
rajendrajaiswal37452e42019-04-02 08:40:58 +000026${PUBLISH_NODE_URL} https://${DR_NODE_IP}:8443/publish/1
27${TYPE-A_PM_DATA_FILE_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml
28${TYPE-C_PM_DATA_FILE_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/C20190328.0000-0015.xml
rajendrajaiswalb60c9ee2019-03-15 12:31:17 +000029${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
30${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
rajendrajaiswalef684c82019-04-10 10:48:25 +000031${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 +000032${CLI_MR_LOG} cat /tmp/mr.log
rajendrajaiswal47b64d72019-02-06 16:09:24 +000033
Gerard Hickeyf5f5ee52019-04-11 06:47:48 +000034
rajendrajaiswal47b64d72019-02-06 16:09:24 +000035*** Test Cases ***
rajendrajaiswal140bfd22019-02-14 14:47:15 +000036Verify PM Mapper Receive Configuraton From Config Binding Service
rajendrajaiswal47b64d72019-02-06 16:09:24 +000037 [Tags] PM_MAPPER_01
rajendrajaiswal140bfd22019-02-14 14:47:15 +000038 [Documentation] Verify 3gpp pm mapper successfully receive config data from CBS
Gerard Hickeybf1ee242019-03-12 11:34:51 +000039 CheckLog ${CLI_EXEC_CLI_CONFIG} Received pm-mapper configuration
rajendrajaiswal140bfd22019-02-14 14:47:15 +000040
Gerard Hickey0e009032019-03-05 15:45:31 +000041Verify Health Check returns 200 when a REST GET request to healthcheck url
rajendrajaiswal37452e42019-04-02 08:40:58 +000042 [Tags] PM_MAPPER_02
Gerard Hickey0e009032019-03-05 15:45:31 +000043 [Documentation] Verify Health Check returns 200 when a REST GET request to healthcheck url
44 [Timeout] 1 minute
45 ${resp}= Get Request mapper_session ${HEALTHCHECK_ENDPOINT}
Gerard Hickeybf1ee242019-03-12 11:34:51 +000046 VerifyResponse ${resp.status_code} 200
Gerard Hickey0e009032019-03-05 15:45:31 +000047
JoeOLeary4ec2b9d2019-02-25 10:14:53 +000048Verify 3GPP PM Mapper responds appropriately when no metadata is provided
rajendrajaiswal37452e42019-04-02 08:40:58 +000049 [Tags] PM_MAPPER_03
JoeOLeary4ec2b9d2019-02-25 10:14:53 +000050 [Documentation] Verify 3GPP PM Mapper responds 400 with the message "Missing Metadata." when no metadata is provided
51 [Timeout] 1 minute
52 ${headers}= Create Dictionary X-ONAP-RequestID=1 Content-Type=application/xml
JoeOLeary667bd592019-03-05 09:21:26 +000053 ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/filename data='${EMPTY}' headers=${headers}
Gerard Hickeybf1ee242019-03-12 11:34:51 +000054 VerifyResponse ${resp.status_code} 400
55 VerifyResponse ${resp.content} Missing Metadata.
56 CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=1
JoeOLeary4ec2b9d2019-02-25 10:14:53 +000057
58Verify 3GPP PM Mapper responds appropriately when invalid metadata is provided
rajendrajaiswal37452e42019-04-02 08:40:58 +000059 [Tags] PM_MAPPER_04
JoeOLeary4ec2b9d2019-02-25 10:14:53 +000060 [Documentation] Verify 3GPP PM Mapper responds 400 with the message "Malformed Metadata." when invalid metadata is provided
61 [Timeout] 1 minute
rajendrajaiswal7572f8d2019-03-07 14:28:47 +000062 ${headers}= Create Dictionary X-ONAP-RequestID=2 X-DMAAP-DR-META='not metadata' Content-Type=application/xml
JoeOLeary667bd592019-03-05 09:21:26 +000063 ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/filename data='${EMPTY}' headers=${headers}
Gerard Hickeybf1ee242019-03-12 11:34:51 +000064 VerifyResponse ${resp.status_code} 400
65 VerifyResponse ${resp.content} Malformed Metadata.
66 CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=2
JoeOLeary4ec2b9d2019-02-25 10:14:53 +000067
rajendrajaiswalef684c82019-04-10 10:48:25 +000068Verify that PM Mapper logs successful when a file that contains no measdata is provided
rajendrajaiswal37452e42019-04-02 08:40:58 +000069 [Tags] PM_MAPPER_05
rajendrajaiswalef684c82019-04-10 10:48:25 +000070 [Documentation] Verify that PM Mapper logs successful when a file that contains no measdata is provided
rajendrajaiswal84f3d0c2019-03-06 11:47:06 +000071 [Timeout] 1 minute
rajendrajaiswalef684c82019-04-10 10:48:25 +000072 SendToDatarouter ${NO_MEASDATA_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=3
73 CheckLog ${CLI_EXEC_CLI_PM_LOG} MeasData is empty
Gerard Hickeybf1ee242019-03-12 11:34:51 +000074 CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=3
Gerard Hickey0e009032019-03-05 15:45:31 +000075
rajendrajaiswalef684c82019-04-10 10:48:25 +000076Verify that PM Mapper throws Event failed validation against schema error when no managed element content is provided
rajendrajaiswal37452e42019-04-02 08:40:58 +000077 [Tags] PM_MAPPER_06
rajendrajaiswalef684c82019-04-10 10:48:25 +000078 [Documentation] Verify 3gpp pm mapper responds with an error when no managed element content is provided
79 [Timeout] 1 minute
80 SendToDatarouter ${NO_MANAGED_ELEMENT_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=4
81 CheckLog ${CLI_EXEC_CLI_PM_LOG} XML validation failed
82 CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=4
83
84Verify that PM Mapper maps Type-C xml file and publish 3gpp perf VES evnets to message router
85 [Tags] PM_MAPPER_07
rajendrajaiswal37452e42019-04-02 08:40:58 +000086 [Documentation] Verify that PM Mapper maps Type-C xml file and publish 3gpp perf VES evnets to message router.
87 [Timeout] 1 minute
rajendrajaiswalef684c82019-04-10 10:48:25 +000088 SendToDatarouter ${TYPE-C_PM_DATA_FILE_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=5
rajendrajaiswal37452e42019-04-02 08:40:58 +000089 CheckLog ${CLI_EXEC_CLI_PM_LOG} Successfully published VES events to messagerouter
rajendrajaiswalef684c82019-04-10 10:48:25 +000090 CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=5
91 Run Process ${CLI_MESSAGE_ROUTER_TOPIC} shell=yes
rajendrajaiswal37452e42019-04-02 08:40:58 +000092 CheckLog ${CLI_MR_LOG} measInfoId1
93 CheckLog ${CLI_MR_LOG} measInfoId2
94 CheckLog ${CLI_MR_LOG} measInfoId3
95
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
103 SendToDatarouter ${TYPE-A_PM_DATA_FILE_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=6
104 CheckLog ${CLI_EXEC_CLI_PM_LOG} Successfully published VES events to messagerouter
rajendrajaiswal37452e42019-04-02 08:40:58 +0000105 CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=6
rajendrajaiswalef684c82019-04-10 10:48:25 +0000106 Run Process ${CLI_MESSAGE_ROUTER_TOPIC} shell=yes
107 CheckLog ${CLI_MR_LOG} attTCHSeizures
108 CheckLog ${CLI_MR_LOG} 234
109 CheckLog ${CLI_MR_LOG} 890
110 CheckLog ${CLI_MR_LOG} 456
111 CheckLog ${CLI_MR_LOG} succTCHSeizures2
112 CheckLog ${CLI_MR_LOG} 86,87,2,6,77,96,75,33,24
113 CheckLog ${CLI_MR_LOG} succImmediateAssignProcs8
114 CheckLog ${CLI_MR_LOG} 787
115 CheckLog ${CLI_MR_LOG} 238
116 CheckLog ${CLI_MR_LOG} 785
Gerard Hickey0e009032019-03-05 15:45:31 +0000117
Gerard Hickey80f8f462019-03-14 12:41:05 +0000118Verify that PM Mapper correctly identifies a file that should not be mapped based on metadata filtering.
rajendrajaiswal59a78502019-03-21 16:31:19 +0000119 [Tags] PM_MAPPER_09
Gerard Hickey80f8f462019-03-14 12:41:05 +0000120 [Documentation] Verify that PM Mapper correctly identifies a file that should not be mapped based on metadata filtering.
121 [Timeout] 1 minute
rajendrajaiswal37452e42019-04-02 08:40:58 +0000122 ${cli_cmd_output}= Run Process ${CLI_EXEC_VENDOR_FILTER} shell=yes
rajendrajaiswalb60c9ee2019-03-15 12:31:17 +0000123 Should Be Equal As Strings ${cli_cmd_output.rc} 0
rajendrajaiswal37452e42019-04-02 08:40:58 +0000124 ${resp}= Get Request mapper_session ${RECONFIGURE_ENDPOINT}
125 Sleep 5s
126 SendToDatarouter ${TYPE-A_PM_DATA_FILE_PATH} ${DIFF_VENDOR_METADATA} X-ONAP-RequestID=7
127 CheckLog ${CLI_EXEC_CLI_PM_LOG} Metadata does not match any filters
128 CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=7
Gerard Hickey80f8f462019-03-14 12:41:05 +0000129
Gerard Hickey67739262019-04-09 13:35:14 +0000130Verify that PM Mapper correctly identifies a non-xml file.
131 [Tags] PM_MAPPER_10
132 [Documentation] Verify that PM Mapper correctly identifies a non-xml file.
133 [Timeout] 1 minute
134 SendToDatarouter ${NON_XML_FILE} ${VALID_METADATA_PATH} X-ONAP-RequestID=8
135 CheckLog ${CLI_EXEC_CLI_PM_LOG} PM measurement file type not supported
136 CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=8
137
138
rajendrajaiswal8f0afd82019-02-11 12:30:26 +0000139*** Keywords ***
140
rajendrajaiswal37452e42019-04-02 08:40:58 +0000141SendToDatarouter
142 [Arguments] ${filepath} ${metadatapath} ${request_id}
143 ${pmdata}= Get File ${filepath}
144 ${metatdata} Get File ${metadatapath}
145 ${filename} Fetch From Right ${filepath} /
146 ${resp}= PutCall ${PUBLISH_NODE_URL}/${filename} ${request_id} ${pmdata} ${metatdata.replace("\n","")} pmmapper
147 VerifyResponse ${resp.status_code} 204
Gerard Hickeyf5f5ee52019-04-11 06:47:48 +0000148 Sleep 10s
rajendrajaiswal84f3d0c2019-03-06 11:47:06 +0000149
150PutCall
rajendrajaiswal37452e42019-04-02 08:40:58 +0000151 [Arguments] ${url} ${request_id} ${data} ${meta} ${user}
152 ${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=
153 ${resp}= Evaluate requests.put('${url}', data="""${data}""", headers=${headers}, verify=False, allow_redirects=False) requests
154 [Return] ${resp}
Gerard Hickeybf1ee242019-03-12 11:34:51 +0000155
Gerard Hickeybf1ee242019-03-12 11:34:51 +0000156CheckLog
rajendrajaiswal37452e42019-04-02 08:40:58 +0000157 [Arguments] ${cli_exec_log_Path} ${string_to_check_in_log}
Gerard Hickeybf1ee242019-03-12 11:34:51 +0000158 ${cli_cmd_output}= Run Process ${cli_exec_log_Path} shell=yes
159 Log ${cli_cmd_output.stdout}
160 Should Be Equal As Strings ${cli_cmd_output.rc} 0
161 Should Contain ${cli_cmd_output.stdout} ${string_to_check_in_log}
162
163VerifyResponse
164 [Arguments] ${actual_response_value} ${expected_response_value}
165 Should Be Equal As Strings ${actual_response_value} ${expected_response_value}