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 |
| 7 | |
JoeOLeary | 4ec2b9d | 2019-02-25 10:14:53 +0000 | [diff] [blame] | 8 | Test Setup Create Session mapper_session ${PMMAPPER_BASE_URL} |
| 9 | Test Teardown Delete All Sessions |
| 10 | |
rajendrajaiswal | 47b64d7 | 2019-02-06 16:09:24 +0000 | [diff] [blame] | 11 | |
| 12 | *** Variables *** |
rajendrajaiswal | 7f7dab0 | 2019-02-15 10:23:53 +0000 | [diff] [blame] | 13 | ${CLI_EXEC_CLI_CONFIG} { head -n 5 | tail -1;} < /tmp/pmmapper.log |
rajendrajaiswal | 140bfd2 | 2019-02-14 14:47:15 +0000 | [diff] [blame] | 14 | ${CLI_EXEC_CLI_SUBS} curl -k https://${DR_PROV_IP}:8443/internal/prov |
JoeOLeary | 4ec2b9d | 2019-02-25 10:14:53 +0000 | [diff] [blame] | 15 | ${PMMAPPER_BASE_URL} http://${PMMAPPER_IP}:8081 |
| 16 | ${DELIVERY_ENDPOINT} /delivery |
Gerard Hickey | 0e00903 | 2019-03-05 15:45:31 +0000 | [diff] [blame] | 17 | ${HEALTHCHECK_ENDPOINT} /healthcheck |
rajendrajaiswal | b60c9ee | 2019-03-15 12:31:17 +0000 | [diff] [blame] | 18 | ${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 |
| 20 | ${MEASD_RESULT_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/A_meas_result.xml |
Gerard Hickey | 0e00903 | 2019-03-05 15:45:31 +0000 | [diff] [blame] | 21 | ${VALID_METADATA_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/valid_metadata.json |
Gerard Hickey | 80f8f46 | 2019-03-14 12:41:05 +0000 | [diff] [blame] | 22 | ${DIFF_VENDOR_METADATA} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/diff_vendor_metadata.json |
Gerard Hickey | 0e00903 | 2019-03-05 15:45:31 +0000 | [diff] [blame] | 23 | ${CLI_EXEC_CLI_PM_LOG} docker exec pmmapper /bin/sh -c "tail -5 /var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log" |
rajendrajaiswal | b60c9ee | 2019-03-15 12:31:17 +0000 | [diff] [blame] | 24 | ${PUBLISH_NODE_URL} https://${DR_NODE_IP}:8443/publish/1/A20181002.0000-1000-0015-1000_5G.xml |
rajendrajaiswal | 86cccfe | 2019-03-08 10:40:12 +0000 | [diff] [blame] | 25 | ${PM_DATA_FILE_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml |
rajendrajaiswal | 84f3d0c | 2019-03-06 11:47:06 +0000 | [diff] [blame] | 26 | ${PUBLISH_CONTENT_TYPE} application/octet-stream |
rajendrajaiswal | b60c9ee | 2019-03-15 12:31:17 +0000 | [diff] [blame] | 27 | ${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 |
| 28 | ${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 |
| 29 | ${CLI_RESTART_PMMAPPER} docker restart pmmapper |
| 30 | ${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 |
| 31 | ${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 |
rajendrajaiswal | 47b64d7 | 2019-02-06 16:09:24 +0000 | [diff] [blame] | 32 | |
| 33 | *** Test Cases *** |
| 34 | |
rajendrajaiswal | 140bfd2 | 2019-02-14 14:47:15 +0000 | [diff] [blame] | 35 | Verify PM Mapper Receive Configuraton From Config Binding Service |
rajendrajaiswal | 47b64d7 | 2019-02-06 16:09:24 +0000 | [diff] [blame] | 36 | [Tags] PM_MAPPER_01 |
rajendrajaiswal | 140bfd2 | 2019-02-14 14:47:15 +0000 | [diff] [blame] | 37 | [Documentation] Verify 3gpp pm mapper successfully receive config data from CBS |
Gerard Hickey | bf1ee24 | 2019-03-12 11:34:51 +0000 | [diff] [blame] | 38 | CheckLog ${CLI_EXEC_CLI_CONFIG} Received pm-mapper configuration |
rajendrajaiswal | 140bfd2 | 2019-02-14 14:47:15 +0000 | [diff] [blame] | 39 | |
| 40 | Verify 3GPP PM Mapper Subscribes to Data Router |
| 41 | [Tags] PM_MAPPER_02 |
rajendrajaiswal | a157470 | 2019-02-14 10:29:45 +0000 | [diff] [blame] | 42 | [Documentation] Verify 3gpp pm mapper subscribes to data router |
Gerard Hickey | bf1ee24 | 2019-03-12 11:34:51 +0000 | [diff] [blame] | 43 | CheckLog ${CLI_EXEC_CLI_SUBS} 3gpppmmapper |
Gerard Hickey | 21d9ecb | 2019-03-12 15:00:50 +0000 | [diff] [blame] | 44 | CheckLog ${CLI_EXEC_CLI_SUBS} "privilegedSubscriber":true |
| 45 | |
rajendrajaiswal | 8f0afd8 | 2019-02-11 12:30:26 +0000 | [diff] [blame] | 46 | |
Gerard Hickey | 0e00903 | 2019-03-05 15:45:31 +0000 | [diff] [blame] | 47 | Verify Health Check returns 200 when a REST GET request to healthcheck url |
| 48 | [Tags] PM_MAPPER_03 |
| 49 | [Documentation] Verify Health Check returns 200 when a REST GET request to healthcheck url |
| 50 | [Timeout] 1 minute |
| 51 | ${resp}= Get Request mapper_session ${HEALTHCHECK_ENDPOINT} |
Gerard Hickey | bf1ee24 | 2019-03-12 11:34:51 +0000 | [diff] [blame] | 52 | VerifyResponse ${resp.status_code} 200 |
Gerard Hickey | 0e00903 | 2019-03-05 15:45:31 +0000 | [diff] [blame] | 53 | |
JoeOLeary | 4ec2b9d | 2019-02-25 10:14:53 +0000 | [diff] [blame] | 54 | Verify 3GPP PM Mapper responds appropriately when no metadata is provided |
rajendrajaiswal | 7572f8d | 2019-03-07 14:28:47 +0000 | [diff] [blame] | 55 | [Tags] PM_MAPPER_04 |
JoeOLeary | 4ec2b9d | 2019-02-25 10:14:53 +0000 | [diff] [blame] | 56 | [Documentation] Verify 3GPP PM Mapper responds 400 with the message "Missing Metadata." when no metadata is provided |
| 57 | [Timeout] 1 minute |
| 58 | ${headers}= Create Dictionary X-ONAP-RequestID=1 Content-Type=application/xml |
JoeOLeary | 667bd59 | 2019-03-05 09:21:26 +0000 | [diff] [blame] | 59 | ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/filename data='${EMPTY}' headers=${headers} |
Gerard Hickey | bf1ee24 | 2019-03-12 11:34:51 +0000 | [diff] [blame] | 60 | VerifyResponse ${resp.status_code} 400 |
| 61 | VerifyResponse ${resp.content} Missing Metadata. |
| 62 | CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=1 |
JoeOLeary | 4ec2b9d | 2019-02-25 10:14:53 +0000 | [diff] [blame] | 63 | |
| 64 | Verify 3GPP PM Mapper responds appropriately when invalid metadata is provided |
rajendrajaiswal | 7572f8d | 2019-03-07 14:28:47 +0000 | [diff] [blame] | 65 | [Tags] PM_MAPPER_05 |
JoeOLeary | 4ec2b9d | 2019-02-25 10:14:53 +0000 | [diff] [blame] | 66 | [Documentation] Verify 3GPP PM Mapper responds 400 with the message "Malformed Metadata." when invalid metadata is provided |
| 67 | [Timeout] 1 minute |
rajendrajaiswal | 7572f8d | 2019-03-07 14:28:47 +0000 | [diff] [blame] | 68 | ${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] | 69 | ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/filename data='${EMPTY}' headers=${headers} |
Gerard Hickey | bf1ee24 | 2019-03-12 11:34:51 +0000 | [diff] [blame] | 70 | VerifyResponse ${resp.status_code} 400 |
| 71 | VerifyResponse ${resp.content} Malformed Metadata. |
| 72 | CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=2 |
JoeOLeary | 4ec2b9d | 2019-02-25 10:14:53 +0000 | [diff] [blame] | 73 | |
rajendrajaiswal | 84f3d0c | 2019-03-06 11:47:06 +0000 | [diff] [blame] | 74 | Verify 3GPP PM Mapper received pushed PM data from Data Router |
rajendrajaiswal | 7572f8d | 2019-03-07 14:28:47 +0000 | [diff] [blame] | 75 | [Tags] PM_MAPPER_06 |
rajendrajaiswal | 84f3d0c | 2019-03-06 11:47:06 +0000 | [diff] [blame] | 76 | [Documentation] Verify 3GPP PM Mapper received pushed PM data from Data Router |
| 77 | [Timeout] 1 minute |
| 78 | ${PM_DATA}= Get File ${PM_DATA_FILE_PATH} |
| 79 | ${valid_metatdata} Get File ${VALID_METADATA_PATH} |
rajendrajaiswal | 7572f8d | 2019-03-07 14:28:47 +0000 | [diff] [blame] | 80 | ${resp}= PutCall ${PUBLISH_NODE_URL} 3 ${PM_DATA} ${PUBLISH_CONTENT_TYPE} ${valid_metatdata.replace("\n","")} pmmapper |
Gerard Hickey | bf1ee24 | 2019-03-12 11:34:51 +0000 | [diff] [blame] | 81 | VerifyResponse ${resp.status_code} 204 |
rajendrajaiswal | b60c9ee | 2019-03-15 12:31:17 +0000 | [diff] [blame] | 82 | Sleep 10s |
| 83 | CheckLog ${CLI_EXEC_CLI_PM_LOG} Event Processed |
Gerard Hickey | bf1ee24 | 2019-03-12 11:34:51 +0000 | [diff] [blame] | 84 | CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=3 |
Gerard Hickey | 0e00903 | 2019-03-05 15:45:31 +0000 | [diff] [blame] | 85 | |
Gerard Hickey | 0e00903 | 2019-03-05 15:45:31 +0000 | [diff] [blame] | 86 | Verify that PM Mapper logs successful when a file that contains measdata is provided |
rajendrajaiswal | 7572f8d | 2019-03-07 14:28:47 +0000 | [diff] [blame] | 87 | [Tags] PM_MAPPER_07 |
Gerard Hickey | 0e00903 | 2019-03-05 15:45:31 +0000 | [diff] [blame] | 88 | [Documentation] Verify that PM Mapper logs successful when a file that contains measdata is provided |
| 89 | [Timeout] 1 minute |
| 90 | ${valid_meas_result_content}= Get File ${MEASD_RESULT_PATH} |
| 91 | ${valid_metatdata} Get File ${VALID_METADATA_PATH} |
| 92 | ${headers}= Create Dictionary X-ONAP-RequestID=4 Content-Type=application/xml X-DMAAP-DR-PUBLISH-ID=4 X-DMAAP-DR-META=${valid_metatdata.replace("\n","")} |
rajendrajaiswal | b60c9ee | 2019-03-15 12:31:17 +0000 | [diff] [blame] | 93 | ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/A_meas_result.xml data=${valid_meas_result_content} headers=${headers} |
Gerard Hickey | bf1ee24 | 2019-03-12 11:34:51 +0000 | [diff] [blame] | 94 | VerifyResponse ${resp.status_code} 200 |
| 95 | CheckLog ${CLI_EXEC_CLI_PM_LOG} XML validation successful |
| 96 | CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=4 |
Gerard Hickey | 0e00903 | 2019-03-05 15:45:31 +0000 | [diff] [blame] | 97 | |
rajendrajaiswal | 7572f8d | 2019-03-07 14:28:47 +0000 | [diff] [blame] | 98 | Verify that PM Mapper logs successful when a file that contains no measdata is provided |
| 99 | [Tags] PM_MAPPER_08 |
| 100 | [Documentation] Verify that PM Mapper logs successful when a file that contains no measdata is provided |
| 101 | [Timeout] 1 minute |
| 102 | ${valid_no_measdata_content}= Get File ${NO_MEASDATA_PATH} |
| 103 | ${valid_metatdata} Get File ${VALID_METADATA_PATH} |
| 104 | ${headers}= Create Dictionary X-ONAP-RequestID=5 Content-Type=application/xml X-DMAAP-DR-PUBLISH-ID=3 X-DMAAP-DR-META=${valid_metatdata.replace("\n","")} |
rajendrajaiswal | b60c9ee | 2019-03-15 12:31:17 +0000 | [diff] [blame] | 105 | ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/A_no_measdata.xml data=${valid_no_measdata_content} headers=${headers} |
Gerard Hickey | bf1ee24 | 2019-03-12 11:34:51 +0000 | [diff] [blame] | 106 | VerifyResponse ${resp.status_code} 200 |
| 107 | CheckLog ${CLI_EXEC_CLI_PM_LOG} XML validation successful |
| 108 | CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=5 |
rajendrajaiswal | 7572f8d | 2019-03-07 14:28:47 +0000 | [diff] [blame] | 109 | |
| 110 | Verify that PM Mapper throws Event failed validation against schema error when no managed element content is provided |
| 111 | [Tags] PM_MAPPER_09 |
| 112 | [Documentation] Verify 3gpp pm mapper responds with an error when no managed element content is provided |
| 113 | [Timeout] 1 minute |
| 114 | ${no_managed_element_content}= Get File ${NO_MANAGED_ELEMENT_PATH} |
| 115 | ${valid_metatdata} Get File ${VALID_METADATA_PATH} |
| 116 | ${headers}= Create Dictionary X-ONAP-RequestID=6 Content-Type=application/xml X-DMAAP-DR-PUBLISH-ID=2 X-DMAAP-DR-META=${valid_metatdata.replace("\n","")} |
rajendrajaiswal | b60c9ee | 2019-03-15 12:31:17 +0000 | [diff] [blame] | 117 | ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/A_no_managed_element.xml data=${no_managed_element_content} headers=${headers} |
Gerard Hickey | bf1ee24 | 2019-03-12 11:34:51 +0000 | [diff] [blame] | 118 | VerifyResponse ${resp.status_code} 200 |
| 119 | CheckLog ${CLI_EXEC_CLI_PM_LOG} XML validation failed |
| 120 | CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=6 |
Gerard Hickey | 0e00903 | 2019-03-05 15:45:31 +0000 | [diff] [blame] | 121 | |
Gerard Hickey | 80f8f46 | 2019-03-14 12:41:05 +0000 | [diff] [blame] | 122 | Verify that PM Mapper correctly identifies a file that should not be mapped based on metadata filtering. |
| 123 | [Tags] PM_MAPPER_10 |
| 124 | [Documentation] Verify that PM Mapper correctly identifies a file that should not be mapped based on metadata filtering. |
| 125 | [Timeout] 1 minute |
rajendrajaiswal | b60c9ee | 2019-03-15 12:31:17 +0000 | [diff] [blame] | 126 | ${cli_cmd_output}= Run Process ${CLI_EXEC_VENDOR_FILTER} shell=yes |
| 127 | Should Be Equal As Strings ${cli_cmd_output.rc} 0 |
| 128 | ${cli_cmd_output}= Run Process ${CLI_DELETE_SUB1} shell=yes |
| 129 | Should Be Equal As Strings ${cli_cmd_output.rc} 0 |
| 130 | ${cli_cmd_output}= Run Process ${CLI_RESTART_PMMAPPER} shell=yes |
| 131 | Sleep 10s |
Gerard Hickey | 80f8f46 | 2019-03-14 12:41:05 +0000 | [diff] [blame] | 132 | ${valid_meas_result_content}= Get File ${MEASD_RESULT_PATH} |
| 133 | ${diff_vendor_metadata}= Get File ${DIFF_VENDOR_METADATA} |
| 134 | ${headers}= Create Dictionary X-ONAP-RequestID=7 Content-Type=application/xml X-DMAAP-DR-PUBLISH-ID=2 X-DMAAP-DR-META=${diff_vendor_metadata.replace("\n","")} |
rajendrajaiswal | b60c9ee | 2019-03-15 12:31:17 +0000 | [diff] [blame] | 135 | ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/A_meas_result.xml data=${valid_meas_result_content} headers=${headers} |
Gerard Hickey | 80f8f46 | 2019-03-14 12:41:05 +0000 | [diff] [blame] | 136 | CheckLog ${CLI_EXEC_CLI_PM_LOG} Metadata does not match any filters, |
| 137 | CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=7 |
| 138 | |
| 139 | |
rajendrajaiswal | 8f0afd8 | 2019-02-11 12:30:26 +0000 | [diff] [blame] | 140 | *** Keywords *** |
| 141 | |
| 142 | PostCall |
| 143 | [Arguments] ${url} ${data} |
| 144 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 145 | ${resp}= Evaluate requests.post('${url}',data='${data}', headers=${headers},verify=False) requests |
Gerard Hickey | 0e00903 | 2019-03-05 15:45:31 +0000 | [diff] [blame] | 146 | [Return] ${resp} |
rajendrajaiswal | 84f3d0c | 2019-03-06 11:47:06 +0000 | [diff] [blame] | 147 | |
| 148 | PutCall |
rajendrajaiswal | 7572f8d | 2019-03-07 14:28:47 +0000 | [diff] [blame] | 149 | [Arguments] ${url} ${request_id} ${data} ${content_type} ${meta} ${user} |
| 150 | ${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= |
rajendrajaiswal | 84f3d0c | 2019-03-06 11:47:06 +0000 | [diff] [blame] | 151 | ${resp}= Evaluate requests.put('${url}', data="""${data}""", headers=${headers}, verify=False, allow_redirects=False) requests |
| 152 | [Return] ${resp} |
Gerard Hickey | bf1ee24 | 2019-03-12 11:34:51 +0000 | [diff] [blame] | 153 | |
Gerard Hickey | bf1ee24 | 2019-03-12 11:34:51 +0000 | [diff] [blame] | 154 | CheckLog |
| 155 | [Arguments] ${cli_exec_log_Path} ${string_to_check_in_log} |
| 156 | ${cli_cmd_output}= Run Process ${cli_exec_log_Path} shell=yes |
| 157 | Log ${cli_cmd_output.stdout} |
| 158 | Should Be Equal As Strings ${cli_cmd_output.rc} 0 |
| 159 | Should Contain ${cli_cmd_output.stdout} ${string_to_check_in_log} |
| 160 | |
| 161 | VerifyResponse |
| 162 | [Arguments] ${actual_response_value} ${expected_response_value} |
| 163 | Should Be Equal As Strings ${actual_response_value} ${expected_response_value} |