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 |
| 18 | ${NO_MANAGED_ELEMENT_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/no_managed_element.xml |
| 19 | ${NO_MEASDATA_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/no_measdata.xml |
| 20 | ${MEASD_RESULT_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/meas_result.xml |
| 21 | ${VALID_METADATA_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/valid_metadata.json |
| 22 | ${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 | 47b64d7 | 2019-02-06 16:09:24 +0000 | [diff] [blame] | 23 | |
| 24 | *** Test Cases *** |
| 25 | |
rajendrajaiswal | 140bfd2 | 2019-02-14 14:47:15 +0000 | [diff] [blame] | 26 | Verify PM Mapper Receive Configuraton From Config Binding Service |
rajendrajaiswal | 47b64d7 | 2019-02-06 16:09:24 +0000 | [diff] [blame] | 27 | [Tags] PM_MAPPER_01 |
rajendrajaiswal | 140bfd2 | 2019-02-14 14:47:15 +0000 | [diff] [blame] | 28 | [Documentation] Verify 3gpp pm mapper successfully receive config data from CBS |
| 29 | ${cli_cmd_output}= Run Process ${CLI_EXEC_CLI_CONFIG} shell=yes |
| 30 | Log ${cli_cmd_output.stdout} |
| 31 | Should Be Equal As Strings ${cli_cmd_output.rc} 0 |
rajendrajaiswal | 7f7dab0 | 2019-02-15 10:23:53 +0000 | [diff] [blame] | 32 | Should Contain ${cli_cmd_output.stdout} Received pm-mapper configuration |
rajendrajaiswal | 140bfd2 | 2019-02-14 14:47:15 +0000 | [diff] [blame] | 33 | |
| 34 | Verify 3GPP PM Mapper Subscribes to Data Router |
| 35 | [Tags] PM_MAPPER_02 |
rajendrajaiswal | a157470 | 2019-02-14 10:29:45 +0000 | [diff] [blame] | 36 | [Documentation] Verify 3gpp pm mapper subscribes to data router |
rajendrajaiswal | 140bfd2 | 2019-02-14 14:47:15 +0000 | [diff] [blame] | 37 | ${cli_cmd_output}= Run Process ${CLI_EXEC_CLI_SUBS} shell=yes |
rajendrajaiswal | 47b64d7 | 2019-02-06 16:09:24 +0000 | [diff] [blame] | 38 | Log ${cli_cmd_output.stdout} |
rajendrajaiswal | a157470 | 2019-02-14 10:29:45 +0000 | [diff] [blame] | 39 | Should Be Equal As Strings ${cli_cmd_output.rc} 0 |
rajendrajaiswal | 7f7dab0 | 2019-02-15 10:23:53 +0000 | [diff] [blame] | 40 | Should Contain ${cli_cmd_output.stdout} 3gpppmmapper |
rajendrajaiswal | 8f0afd8 | 2019-02-11 12:30:26 +0000 | [diff] [blame] | 41 | |
Gerard Hickey | 0e00903 | 2019-03-05 15:45:31 +0000 | [diff] [blame^] | 42 | Verify Health Check returns 200 when a REST GET request to healthcheck url |
| 43 | [Tags] PM_MAPPER_03 |
| 44 | [Documentation] Verify Health Check returns 200 when a REST GET request to healthcheck url |
| 45 | [Timeout] 1 minute |
| 46 | ${resp}= Get Request mapper_session ${HEALTHCHECK_ENDPOINT} |
| 47 | Should Be Equal As Strings ${resp.status_code} 200 |
| 48 | |
| 49 | |
JoeOLeary | 4ec2b9d | 2019-02-25 10:14:53 +0000 | [diff] [blame] | 50 | Verify 3GPP PM Mapper responds appropriately when no metadata is provided |
| 51 | [Tags] PM_MAPPER_10 |
| 52 | [Documentation] Verify 3GPP PM Mapper responds 400 with the message "Missing Metadata." when no metadata is provided |
| 53 | [Timeout] 1 minute |
| 54 | ${headers}= Create Dictionary X-ONAP-RequestID=1 Content-Type=application/xml |
JoeOLeary | 667bd59 | 2019-03-05 09:21:26 +0000 | [diff] [blame] | 55 | ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/filename data='${EMPTY}' headers=${headers} |
JoeOLeary | 4ec2b9d | 2019-02-25 10:14:53 +0000 | [diff] [blame] | 56 | Should Be Equal As Strings ${resp.status_code} 400 |
| 57 | Should Be Equal As Strings ${resp.content} Missing Metadata. |
| 58 | |
| 59 | Verify 3GPP PM Mapper responds appropriately when invalid metadata is provided |
| 60 | [Tags] PM_MAPPER_11 |
| 61 | [Documentation] Verify 3GPP PM Mapper responds 400 with the message "Malformed Metadata." when invalid metadata is provided |
| 62 | [Timeout] 1 minute |
JoeOLeary | 667bd59 | 2019-03-05 09:21:26 +0000 | [diff] [blame] | 63 | ${headers}= Create Dictionary X-ONAP-RequestID=1 X-DMAAP-DR-META='not metadata' Content-Type=application/xml |
| 64 | ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/filename data='${EMPTY}' headers=${headers} |
JoeOLeary | 4ec2b9d | 2019-02-25 10:14:53 +0000 | [diff] [blame] | 65 | Should Be Equal As Strings ${resp.status_code} 400 |
| 66 | Should Be Equal As Strings ${resp.content} Malformed Metadata. |
| 67 | |
Gerard Hickey | 0e00903 | 2019-03-05 15:45:31 +0000 | [diff] [blame^] | 68 | |
| 69 | Verify that PM Mapper throws Event failed validation against schema error when no managed element content is provided |
| 70 | [Tags] PM_MAPPER_12 |
| 71 | [Documentation] Verify 3gpp pm mapper responds with an error when no managed element content is provided |
| 72 | [Timeout] 1 minute |
| 73 | ${no_managed_element_content}= Get File ${NO_MANAGED_ELEMENT_PATH} |
| 74 | ${valid_metatdata} Get File ${VALID_METADATA_PATH} |
| 75 | ${headers}= Create Dictionary X-ONAP-RequestID=2 Content-Type=application/xml X-DMAAP-DR-PUBLISH-ID=2 X-DMAAP-DR-META=${valid_metatdata.replace("\n","")} |
| 76 | ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/filename data=${no_managed_element_content} headers=${headers} |
| 77 | Should Be Equal As Strings ${resp.status_code} 200 |
| 78 | ${cli_cmd_output}= Run Process ${CLI_EXEC_CLI_PM_LOG} shell=yes |
| 79 | Log ${cli_cmd_output.stdout} |
| 80 | Should Be Equal As Strings ${cli_cmd_output.rc} 0 |
| 81 | Should Contain ${cli_cmd_output.stdout} XML validation failed |
| 82 | |
| 83 | |
| 84 | Verify that PM Mapper logs successful when a file that contains no measdata is provided |
| 85 | [Tags] PM_MAPPER_13 |
| 86 | [Documentation] Verify that PM Mapper logs successful when a file that contains no measdata is provided |
| 87 | [Timeout] 1 minute |
| 88 | ${valid_no_measdata_content}= Get File ${NO_MEASDATA_PATH} |
| 89 | ${valid_metatdata} Get File ${VALID_METADATA_PATH} |
| 90 | ${headers}= Create Dictionary X-ONAP-RequestID=3 Content-Type=application/xml X-DMAAP-DR-PUBLISH-ID=3 X-DMAAP-DR-META=${valid_metatdata.replace("\n","")} |
| 91 | ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/filename data=${valid_no_measdata_content} headers=${headers} |
| 92 | Should Be Equal As Strings ${resp.status_code} 200 |
| 93 | ${cli_cmd_output}= Run Process ${CLI_EXEC_CLI_PM_LOG} shell=yes |
| 94 | Log ${cli_cmd_output.stdout} |
| 95 | Should Be Equal As Strings ${cli_cmd_output.rc} 0 |
| 96 | Should Contain ${cli_cmd_output.stdout} XML validation successful |
| 97 | |
| 98 | |
| 99 | Verify that PM Mapper logs successful when a file that contains measdata is provided |
| 100 | [Tags] PM_MAPPER_14 |
| 101 | [Documentation] Verify that PM Mapper logs successful when a file that contains measdata is provided |
| 102 | [Timeout] 1 minute |
| 103 | ${valid_meas_result_content}= Get File ${MEASD_RESULT_PATH} |
| 104 | ${valid_metatdata} Get File ${VALID_METADATA_PATH} |
| 105 | ${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","")} |
| 106 | ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/filename data=${valid_meas_result_content} headers=${headers} |
| 107 | Should Be Equal As Strings ${resp.status_code} 200 |
| 108 | ${cli_cmd_output}= Run Process ${CLI_EXEC_CLI_PM_LOG} shell=yes |
| 109 | Log ${cli_cmd_output.stdout} |
| 110 | Should Be Equal As Strings ${cli_cmd_output.rc} 0 |
| 111 | Should Contain ${cli_cmd_output.stdout} XML validation successful |
| 112 | |
| 113 | |
| 114 | |
rajendrajaiswal | 8f0afd8 | 2019-02-11 12:30:26 +0000 | [diff] [blame] | 115 | *** Keywords *** |
| 116 | |
| 117 | PostCall |
| 118 | [Arguments] ${url} ${data} |
| 119 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 120 | ${resp}= Evaluate requests.post('${url}',data='${data}', headers=${headers},verify=False) requests |
Gerard Hickey | 0e00903 | 2019-03-05 15:45:31 +0000 | [diff] [blame^] | 121 | [Return] ${resp} |