rajendrajaiswal | 47b64d7 | 2019-02-06 16:09:24 +0000 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Testing PM Mapper functionality |
rajendrajaiswal | 47b64d7 | 2019-02-06 16:09:24 +0000 | [diff] [blame] | 3 | Library Collections |
rajendrajaiswal | 8f0afd8 | 2019-02-11 12:30:26 +0000 | [diff] [blame] | 4 | Library OperatingSystem |
| 5 | Library RequestsLibrary |
rajendrajaiswal | 47b64d7 | 2019-02-06 16:09:24 +0000 | [diff] [blame] | 6 | Library Process |
rajendrajaiswal | 37452e4 | 2019-04-02 08:40:58 +0000 | [diff] [blame] | 7 | Library String |
rajendrajaiswal | 47b64d7 | 2019-02-06 16:09:24 +0000 | [diff] [blame] | 8 | |
JoeOLeary | 4ec2b9d | 2019-02-25 10:14:53 +0000 | [diff] [blame] | 9 | Test Setup Create Session mapper_session ${PMMAPPER_BASE_URL} |
| 10 | Test Teardown Delete All Sessions |
| 11 | |
rajendrajaiswal | 47b64d7 | 2019-02-06 16:09:24 +0000 | [diff] [blame] | 12 | |
| 13 | *** Variables *** |
rajendrajaiswal | 627ad48 | 2019-04-26 14:02:10 +0100 | [diff] [blame] | 14 | ${CLI_EXEC_CLI_CONFIG} { head -n 10 | tail -5;} < /tmp/pmmapper.log |
rajendrajaiswal | 140bfd2 | 2019-02-14 14:47:15 +0000 | [diff] [blame] | 15 | ${CLI_EXEC_CLI_SUBS} curl -k https://${DR_PROV_IP}:8443/internal/prov |
JoeOLeary | 4ec2b9d | 2019-02-25 10:14:53 +0000 | [diff] [blame] | 16 | ${PMMAPPER_BASE_URL} http://${PMMAPPER_IP}:8081 |
| 17 | ${DELIVERY_ENDPOINT} /delivery |
Gerard Hickey | 0e00903 | 2019-03-05 15:45:31 +0000 | [diff] [blame] | 18 | ${HEALTHCHECK_ENDPOINT} /healthcheck |
rajendrajaiswal | 37452e4 | 2019-04-02 08:40:58 +0000 | [diff] [blame] | 19 | ${RECONFIGURE_ENDPOINT} /reconfigure |
rajendrajaiswal | b60c9ee | 2019-03-15 12:31:17 +0000 | [diff] [blame] | 20 | ${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 Hickey | 0e00903 | 2019-03-05 15:45:31 +0000 | [diff] [blame] | 22 | ${VALID_METADATA_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/valid_metadata.json |
Gerard Hickey | 80f8f46 | 2019-03-14 12:41:05 +0000 | [diff] [blame] | 23 | ${DIFF_VENDOR_METADATA} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/diff_vendor_metadata.json |
Gerard Hickey | 6773926 | 2019-04-09 13:35:14 +0000 | [diff] [blame] | 24 | ${NON_XML_FILE} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/diff_vendor_metadata.json |
rajendrajaiswal | 3b202f0 | 2019-04-09 10:37:49 +0000 | [diff] [blame] | 25 | ${CLI_EXEC_CLI_PM_LOG} docker exec pmmapper /bin/sh -c "tail -15 /var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log" |
rajendrajaiswal | 37452e4 | 2019-04-02 08:40:58 +0000 | [diff] [blame] | 26 | ${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 |
rajendrajaiswal | b60c9ee | 2019-03-15 12:31:17 +0000 | [diff] [blame] | 29 | ${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 |
rajendrajaiswal | ef684c8 | 2019-04-10 10:48:25 +0000 | [diff] [blame] | 31 | ${CLI_MESSAGE_ROUTER_TOPIC} curl http://${DMAAP_MR_IP}:3904/events/PM_MAPPER/CG1/C1?timeout=1000 > /tmp/mr.log |
rajendrajaiswal | 37452e4 | 2019-04-02 08:40:58 +0000 | [diff] [blame] | 32 | ${CLI_MR_LOG} cat /tmp/mr.log |
rajendrajaiswal | 47b64d7 | 2019-02-06 16:09:24 +0000 | [diff] [blame] | 33 | |
Gerard Hickey | f5f5ee5 | 2019-04-11 06:47:48 +0000 | [diff] [blame] | 34 | |
rajendrajaiswal | 47b64d7 | 2019-02-06 16:09:24 +0000 | [diff] [blame] | 35 | *** Test Cases *** |
rajendrajaiswal | 140bfd2 | 2019-02-14 14:47:15 +0000 | [diff] [blame] | 36 | Verify PM Mapper Receive Configuraton From Config Binding Service |
rajendrajaiswal | 47b64d7 | 2019-02-06 16:09:24 +0000 | [diff] [blame] | 37 | [Tags] PM_MAPPER_01 |
rajendrajaiswal | 140bfd2 | 2019-02-14 14:47:15 +0000 | [diff] [blame] | 38 | [Documentation] Verify 3gpp pm mapper successfully receive config data from CBS |
Gerard Hickey | bf1ee24 | 2019-03-12 11:34:51 +0000 | [diff] [blame] | 39 | CheckLog ${CLI_EXEC_CLI_CONFIG} Received pm-mapper configuration |
rajendrajaiswal | 140bfd2 | 2019-02-14 14:47:15 +0000 | [diff] [blame] | 40 | |
Gerard Hickey | 0e00903 | 2019-03-05 15:45:31 +0000 | [diff] [blame] | 41 | Verify Health Check returns 200 when a REST GET request to healthcheck url |
rajendrajaiswal | 37452e4 | 2019-04-02 08:40:58 +0000 | [diff] [blame] | 42 | [Tags] PM_MAPPER_02 |
Gerard Hickey | 0e00903 | 2019-03-05 15:45:31 +0000 | [diff] [blame] | 43 | [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 Hickey | bf1ee24 | 2019-03-12 11:34:51 +0000 | [diff] [blame] | 46 | VerifyResponse ${resp.status_code} 200 |
Gerard Hickey | 0e00903 | 2019-03-05 15:45:31 +0000 | [diff] [blame] | 47 | |
JoeOLeary | 4ec2b9d | 2019-02-25 10:14:53 +0000 | [diff] [blame] | 48 | Verify 3GPP PM Mapper responds appropriately when no metadata is provided |
rajendrajaiswal | 37452e4 | 2019-04-02 08:40:58 +0000 | [diff] [blame] | 49 | [Tags] PM_MAPPER_03 |
JoeOLeary | 4ec2b9d | 2019-02-25 10:14:53 +0000 | [diff] [blame] | 50 | [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 |
JoeOLeary | 667bd59 | 2019-03-05 09:21:26 +0000 | [diff] [blame] | 53 | ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/filename data='${EMPTY}' headers=${headers} |
Gerard Hickey | bf1ee24 | 2019-03-12 11:34:51 +0000 | [diff] [blame] | 54 | VerifyResponse ${resp.status_code} 400 |
| 55 | VerifyResponse ${resp.content} Missing Metadata. |
| 56 | CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=1 |
JoeOLeary | 4ec2b9d | 2019-02-25 10:14:53 +0000 | [diff] [blame] | 57 | |
| 58 | Verify 3GPP PM Mapper responds appropriately when invalid metadata is provided |
rajendrajaiswal | 37452e4 | 2019-04-02 08:40:58 +0000 | [diff] [blame] | 59 | [Tags] PM_MAPPER_04 |
JoeOLeary | 4ec2b9d | 2019-02-25 10:14:53 +0000 | [diff] [blame] | 60 | [Documentation] Verify 3GPP PM Mapper responds 400 with the message "Malformed Metadata." when invalid metadata is provided |
| 61 | [Timeout] 1 minute |
rajendrajaiswal | 7572f8d | 2019-03-07 14:28:47 +0000 | [diff] [blame] | 62 | ${headers}= Create Dictionary X-ONAP-RequestID=2 X-DMAAP-DR-META='not metadata' Content-Type=application/xml |
JoeOLeary | 667bd59 | 2019-03-05 09:21:26 +0000 | [diff] [blame] | 63 | ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/filename data='${EMPTY}' headers=${headers} |
Gerard Hickey | bf1ee24 | 2019-03-12 11:34:51 +0000 | [diff] [blame] | 64 | VerifyResponse ${resp.status_code} 400 |
| 65 | VerifyResponse ${resp.content} Malformed Metadata. |
| 66 | CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=2 |
JoeOLeary | 4ec2b9d | 2019-02-25 10:14:53 +0000 | [diff] [blame] | 67 | |
rajendrajaiswal | ef684c8 | 2019-04-10 10:48:25 +0000 | [diff] [blame] | 68 | Verify that PM Mapper logs successful when a file that contains no measdata is provided |
rajendrajaiswal | 37452e4 | 2019-04-02 08:40:58 +0000 | [diff] [blame] | 69 | [Tags] PM_MAPPER_05 |
rajendrajaiswal | ef684c8 | 2019-04-10 10:48:25 +0000 | [diff] [blame] | 70 | [Documentation] Verify that PM Mapper logs successful when a file that contains no measdata is provided |
rajendrajaiswal | 84f3d0c | 2019-03-06 11:47:06 +0000 | [diff] [blame] | 71 | [Timeout] 1 minute |
rajendrajaiswal | ef684c8 | 2019-04-10 10:48:25 +0000 | [diff] [blame] | 72 | SendToDatarouter ${NO_MEASDATA_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=3 |
| 73 | CheckLog ${CLI_EXEC_CLI_PM_LOG} MeasData is empty |
Gerard Hickey | bf1ee24 | 2019-03-12 11:34:51 +0000 | [diff] [blame] | 74 | CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=3 |
Gerard Hickey | 0e00903 | 2019-03-05 15:45:31 +0000 | [diff] [blame] | 75 | |
rajendrajaiswal | ef684c8 | 2019-04-10 10:48:25 +0000 | [diff] [blame] | 76 | Verify that PM Mapper throws Event failed validation against schema error when no managed element content is provided |
rajendrajaiswal | 37452e4 | 2019-04-02 08:40:58 +0000 | [diff] [blame] | 77 | [Tags] PM_MAPPER_06 |
rajendrajaiswal | ef684c8 | 2019-04-10 10:48:25 +0000 | [diff] [blame] | 78 | [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 | |
| 84 | Verify that PM Mapper maps Type-C xml file and publish 3gpp perf VES evnets to message router |
| 85 | [Tags] PM_MAPPER_07 |
rajendrajaiswal | 37452e4 | 2019-04-02 08:40:58 +0000 | [diff] [blame] | 86 | [Documentation] Verify that PM Mapper maps Type-C xml file and publish 3gpp perf VES evnets to message router. |
| 87 | [Timeout] 1 minute |
rajendrajaiswal | ef684c8 | 2019-04-10 10:48:25 +0000 | [diff] [blame] | 88 | SendToDatarouter ${TYPE-C_PM_DATA_FILE_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=5 |
rajendrajaiswal | 37452e4 | 2019-04-02 08:40:58 +0000 | [diff] [blame] | 89 | CheckLog ${CLI_EXEC_CLI_PM_LOG} Successfully published VES events to messagerouter |
rajendrajaiswal | 37452e4 | 2019-04-02 08:40:58 +0000 | [diff] [blame] | 90 | |
rajendrajaiswal | ef684c8 | 2019-04-10 10:48:25 +0000 | [diff] [blame] | 91 | Verify 3GPP PM Mapper maps Type-A file based on counter filtering and publish 3gpp perf VES evnets to message router |
rajendrajaiswal | 59a7850 | 2019-03-21 16:31:19 +0000 | [diff] [blame] | 92 | [Tags] PM_MAPPER_08 |
rajendrajaiswal | ef684c8 | 2019-04-10 10:48:25 +0000 | [diff] [blame] | 93 | [Documentation] Verify 3GPP PM Mapper maps Type-A file and publish 3gpp perf VES evnets to message router. |
rajendrajaiswal | 7572f8d | 2019-03-07 14:28:47 +0000 | [diff] [blame] | 94 | [Timeout] 1 minute |
rajendrajaiswal | ef684c8 | 2019-04-10 10:48:25 +0000 | [diff] [blame] | 95 | ${cli_cmd_output}= Run Process ${CLI_EXEC_PM_FILTER} shell=yes |
| 96 | ${resp}= Get Request mapper_session ${RECONFIGURE_ENDPOINT} |
| 97 | Sleep 5s |
| 98 | SendToDatarouter ${TYPE-A_PM_DATA_FILE_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=6 |
| 99 | CheckLog ${CLI_EXEC_CLI_PM_LOG} Successfully published VES events to messagerouter |
Gerard Hickey | 0e00903 | 2019-03-05 15:45:31 +0000 | [diff] [blame] | 100 | |
Gerard Hickey | 80f8f46 | 2019-03-14 12:41:05 +0000 | [diff] [blame] | 101 | Verify that PM Mapper correctly identifies a file that should not be mapped based on metadata filtering. |
rajendrajaiswal | 59a7850 | 2019-03-21 16:31:19 +0000 | [diff] [blame] | 102 | [Tags] PM_MAPPER_09 |
Gerard Hickey | 80f8f46 | 2019-03-14 12:41:05 +0000 | [diff] [blame] | 103 | [Documentation] Verify that PM Mapper correctly identifies a file that should not be mapped based on metadata filtering. |
| 104 | [Timeout] 1 minute |
rajendrajaiswal | 37452e4 | 2019-04-02 08:40:58 +0000 | [diff] [blame] | 105 | ${cli_cmd_output}= Run Process ${CLI_EXEC_VENDOR_FILTER} shell=yes |
rajendrajaiswal | b60c9ee | 2019-03-15 12:31:17 +0000 | [diff] [blame] | 106 | Should Be Equal As Strings ${cli_cmd_output.rc} 0 |
rajendrajaiswal | 37452e4 | 2019-04-02 08:40:58 +0000 | [diff] [blame] | 107 | ${resp}= Get Request mapper_session ${RECONFIGURE_ENDPOINT} |
| 108 | Sleep 5s |
| 109 | SendToDatarouter ${TYPE-A_PM_DATA_FILE_PATH} ${DIFF_VENDOR_METADATA} X-ONAP-RequestID=7 |
| 110 | CheckLog ${CLI_EXEC_CLI_PM_LOG} Metadata does not match any filters |
| 111 | CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=7 |
Gerard Hickey | 80f8f46 | 2019-03-14 12:41:05 +0000 | [diff] [blame] | 112 | |
Gerard Hickey | 6773926 | 2019-04-09 13:35:14 +0000 | [diff] [blame] | 113 | Verify that PM Mapper correctly identifies a non-xml file. |
| 114 | [Tags] PM_MAPPER_10 |
| 115 | [Documentation] Verify that PM Mapper correctly identifies a non-xml file. |
| 116 | [Timeout] 1 minute |
| 117 | SendToDatarouter ${NON_XML_FILE} ${VALID_METADATA_PATH} X-ONAP-RequestID=8 |
rajendrajaiswal | 117e598 | 2019-07-30 09:54:29 +0000 | [diff] [blame] | 118 | CheckLog ${CLI_EXEC_CLI_PM_LOG} PM measurement file must have an extension of .xml |
Gerard Hickey | 6773926 | 2019-04-09 13:35:14 +0000 | [diff] [blame] | 119 | CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=8 |
| 120 | |
| 121 | |
rajendrajaiswal | 8f0afd8 | 2019-02-11 12:30:26 +0000 | [diff] [blame] | 122 | *** Keywords *** |
| 123 | |
rajendrajaiswal | 37452e4 | 2019-04-02 08:40:58 +0000 | [diff] [blame] | 124 | SendToDatarouter |
| 125 | [Arguments] ${filepath} ${metadatapath} ${request_id} |
| 126 | ${pmdata}= Get File ${filepath} |
| 127 | ${metatdata} Get File ${metadatapath} |
| 128 | ${filename} Fetch From Right ${filepath} / |
| 129 | ${resp}= PutCall ${PUBLISH_NODE_URL}/${filename} ${request_id} ${pmdata} ${metatdata.replace("\n","")} pmmapper |
| 130 | VerifyResponse ${resp.status_code} 204 |
Gerard Hickey | f5f5ee5 | 2019-04-11 06:47:48 +0000 | [diff] [blame] | 131 | Sleep 10s |
rajendrajaiswal | 84f3d0c | 2019-03-06 11:47:06 +0000 | [diff] [blame] | 132 | |
| 133 | PutCall |
rajendrajaiswal | 37452e4 | 2019-04-02 08:40:58 +0000 | [diff] [blame] | 134 | [Arguments] ${url} ${request_id} ${data} ${meta} ${user} |
| 135 | ${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= |
| 136 | ${resp}= Evaluate requests.put('${url}', data="""${data}""", headers=${headers}, verify=False, allow_redirects=False) requests |
| 137 | [Return] ${resp} |
Gerard Hickey | bf1ee24 | 2019-03-12 11:34:51 +0000 | [diff] [blame] | 138 | |
Gerard Hickey | bf1ee24 | 2019-03-12 11:34:51 +0000 | [diff] [blame] | 139 | CheckLog |
rajendrajaiswal | 37452e4 | 2019-04-02 08:40:58 +0000 | [diff] [blame] | 140 | [Arguments] ${cli_exec_log_Path} ${string_to_check_in_log} |
Gerard Hickey | bf1ee24 | 2019-03-12 11:34:51 +0000 | [diff] [blame] | 141 | ${cli_cmd_output}= Run Process ${cli_exec_log_Path} shell=yes |
| 142 | Log ${cli_cmd_output.stdout} |
| 143 | Should Be Equal As Strings ${cli_cmd_output.rc} 0 |
| 144 | Should Contain ${cli_cmd_output.stdout} ${string_to_check_in_log} |
| 145 | |
| 146 | VerifyResponse |
| 147 | [Arguments] ${actual_response_value} ${expected_response_value} |
| 148 | Should Be Equal As Strings ${actual_response_value} ${expected_response_value} |