aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot')
-rw-r--r--tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot119
1 files changed, 70 insertions, 49 deletions
diff --git a/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot b/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot
index 363c95c1..bc32673d 100644
--- a/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot
+++ b/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot
@@ -20,96 +20,99 @@ ${NO_MEASDATA_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pm
${MEASD_RESULT_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/meas_result.xml
${VALID_METADATA_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/valid_metadata.json
${CLI_EXEC_CLI_PM_LOG} docker exec pmmapper /bin/sh -c "tail -5 /var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log"
+${PUBLISH_NODE_URL} https://${DR_NODE_IP}:8443/publish/1/pm.xml
+${PM_DATA_FILE_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml
+${PUBLISH_CONTENT_TYPE} application/octet-stream
+
*** Test Cases ***
Verify PM Mapper Receive Configuraton From Config Binding Service
[Tags] PM_MAPPER_01
[Documentation] Verify 3gpp pm mapper successfully receive config data from CBS
- ${cli_cmd_output}= Run Process ${CLI_EXEC_CLI_CONFIG} shell=yes
- Log ${cli_cmd_output.stdout}
- Should Be Equal As Strings ${cli_cmd_output.rc} 0
- Should Contain ${cli_cmd_output.stdout} Received pm-mapper configuration
+ CheckLog ${CLI_EXEC_CLI_CONFIG} Received pm-mapper configuration
Verify 3GPP PM Mapper Subscribes to Data Router
[Tags] PM_MAPPER_02
[Documentation] Verify 3gpp pm mapper subscribes to data router
- ${cli_cmd_output}= Run Process ${CLI_EXEC_CLI_SUBS} shell=yes
- Log ${cli_cmd_output.stdout}
- Should Be Equal As Strings ${cli_cmd_output.rc} 0
- Should Contain ${cli_cmd_output.stdout} 3gpppmmapper
+ CheckLog ${CLI_EXEC_CLI_SUBS} 3gpppmmapper
+ CheckLog ${CLI_EXEC_CLI_SUBS} "privilegedSubscriber":true
+
Verify Health Check returns 200 when a REST GET request to healthcheck url
[Tags] PM_MAPPER_03
[Documentation] Verify Health Check returns 200 when a REST GET request to healthcheck url
[Timeout] 1 minute
${resp}= Get Request mapper_session ${HEALTHCHECK_ENDPOINT}
- Should Be Equal As Strings ${resp.status_code} 200
-
+ VerifyResponse ${resp.status_code} 200
Verify 3GPP PM Mapper responds appropriately when no metadata is provided
- [Tags] PM_MAPPER_10
+ [Tags] PM_MAPPER_04
[Documentation] Verify 3GPP PM Mapper responds 400 with the message "Missing Metadata." when no metadata is provided
[Timeout] 1 minute
${headers}= Create Dictionary X-ONAP-RequestID=1 Content-Type=application/xml
${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/filename data='${EMPTY}' headers=${headers}
- Should Be Equal As Strings ${resp.status_code} 400
- Should Be Equal As Strings ${resp.content} Missing Metadata.
+ VerifyResponse ${resp.status_code} 400
+ VerifyResponse ${resp.content} Missing Metadata.
+ CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=1
Verify 3GPP PM Mapper responds appropriately when invalid metadata is provided
- [Tags] PM_MAPPER_11
+ [Tags] PM_MAPPER_05
[Documentation] Verify 3GPP PM Mapper responds 400 with the message "Malformed Metadata." when invalid metadata is provided
[Timeout] 1 minute
- ${headers}= Create Dictionary X-ONAP-RequestID=1 X-DMAAP-DR-META='not metadata' Content-Type=application/xml
+ ${headers}= Create Dictionary X-ONAP-RequestID=2 X-DMAAP-DR-META='not metadata' Content-Type=application/xml
${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/filename data='${EMPTY}' headers=${headers}
- Should Be Equal As Strings ${resp.status_code} 400
- Should Be Equal As Strings ${resp.content} Malformed Metadata.
+ VerifyResponse ${resp.status_code} 400
+ VerifyResponse ${resp.content} Malformed Metadata.
+ CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=2
-
-Verify that PM Mapper throws Event failed validation against schema error when no managed element content is provided
- [Tags] PM_MAPPER_12
- [Documentation] Verify 3gpp pm mapper responds with an error when no managed element content is provided
+Verify 3GPP PM Mapper received pushed PM data from Data Router
+ [Tags] PM_MAPPER_06
+ [Documentation] Verify 3GPP PM Mapper received pushed PM data from Data Router
[Timeout] 1 minute
- ${no_managed_element_content}= Get File ${NO_MANAGED_ELEMENT_PATH}
+ ${PM_DATA}= Get File ${PM_DATA_FILE_PATH}
${valid_metatdata} Get File ${VALID_METADATA_PATH}
- ${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","")}
- ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/filename data=${no_managed_element_content} headers=${headers}
- Should Be Equal As Strings ${resp.status_code} 200
- ${cli_cmd_output}= Run Process ${CLI_EXEC_CLI_PM_LOG} shell=yes
- Log ${cli_cmd_output.stdout}
- Should Be Equal As Strings ${cli_cmd_output.rc} 0
- Should Contain ${cli_cmd_output.stdout} XML validation failed
+ ${resp}= PutCall ${PUBLISH_NODE_URL} 3 ${PM_DATA} ${PUBLISH_CONTENT_TYPE} ${valid_metatdata.replace("\n","")} pmmapper
+ VerifyResponse ${resp.status_code} 204
+ Sleep 10s
+ CheckLog ${CLI_EXEC_CLI_PM_LOG} XML validation successful
+ CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=3
+Verify that PM Mapper logs successful when a file that contains measdata is provided
+ [Tags] PM_MAPPER_07
+ [Documentation] Verify that PM Mapper logs successful when a file that contains measdata is provided
+ [Timeout] 1 minute
+ ${valid_meas_result_content}= Get File ${MEASD_RESULT_PATH}
+ ${valid_metatdata} Get File ${VALID_METADATA_PATH}
+ ${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","")}
+ ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/filename data=${valid_meas_result_content} headers=${headers}
+ VerifyResponse ${resp.status_code} 200
+ CheckLog ${CLI_EXEC_CLI_PM_LOG} XML validation successful
+ CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=4
Verify that PM Mapper logs successful when a file that contains no measdata is provided
- [Tags] PM_MAPPER_13
+ [Tags] PM_MAPPER_08
[Documentation] Verify that PM Mapper logs successful when a file that contains no measdata is provided
[Timeout] 1 minute
${valid_no_measdata_content}= Get File ${NO_MEASDATA_PATH}
${valid_metatdata} Get File ${VALID_METADATA_PATH}
- ${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","")}
+ ${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","")}
${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/filename data=${valid_no_measdata_content} headers=${headers}
- Should Be Equal As Strings ${resp.status_code} 200
- ${cli_cmd_output}= Run Process ${CLI_EXEC_CLI_PM_LOG} shell=yes
- Log ${cli_cmd_output.stdout}
- Should Be Equal As Strings ${cli_cmd_output.rc} 0
- Should Contain ${cli_cmd_output.stdout} XML validation successful
-
+ VerifyResponse ${resp.status_code} 200
+ CheckLog ${CLI_EXEC_CLI_PM_LOG} XML validation successful
+ CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=5
-Verify that PM Mapper logs successful when a file that contains measdata is provided
- [Tags] PM_MAPPER_14
- [Documentation] Verify that PM Mapper logs successful when a file that contains measdata is provided
+Verify that PM Mapper throws Event failed validation against schema error when no managed element content is provided
+ [Tags] PM_MAPPER_09
+ [Documentation] Verify 3gpp pm mapper responds with an error when no managed element content is provided
[Timeout] 1 minute
- ${valid_meas_result_content}= Get File ${MEASD_RESULT_PATH}
+ ${no_managed_element_content}= Get File ${NO_MANAGED_ELEMENT_PATH}
${valid_metatdata} Get File ${VALID_METADATA_PATH}
- ${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","")}
- ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/filename data=${valid_meas_result_content} headers=${headers}
- Should Be Equal As Strings ${resp.status_code} 200
- ${cli_cmd_output}= Run Process ${CLI_EXEC_CLI_PM_LOG} shell=yes
- Log ${cli_cmd_output.stdout}
- Should Be Equal As Strings ${cli_cmd_output.rc} 0
- Should Contain ${cli_cmd_output.stdout} XML validation successful
-
+ ${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","")}
+ ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/filename data=${no_managed_element_content} headers=${headers}
+ VerifyResponse ${resp.status_code} 200
+ CheckLog ${CLI_EXEC_CLI_PM_LOG} XML validation failed
+ CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=6
*** Keywords ***
@@ -119,3 +122,21 @@ PostCall
${headers}= Create Dictionary Accept=application/json Content-Type=application/json
${resp}= Evaluate requests.post('${url}',data='${data}', headers=${headers},verify=False) requests
[Return] ${resp}
+
+PutCall
+ [Arguments] ${url} ${request_id} ${data} ${content_type} ${meta} ${user}
+ ${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=
+ ${resp}= Evaluate requests.put('${url}', data="""${data}""", headers=${headers}, verify=False, allow_redirects=False) requests
+ [Return] ${resp}
+
+
+CheckLog
+ [Arguments] ${cli_exec_log_Path} ${string_to_check_in_log}
+ ${cli_cmd_output}= Run Process ${cli_exec_log_Path} shell=yes
+ Log ${cli_cmd_output.stdout}
+ Should Be Equal As Strings ${cli_cmd_output.rc} 0
+ Should Contain ${cli_cmd_output.stdout} ${string_to_check_in_log}
+
+VerifyResponse
+ [Arguments] ${actual_response_value} ${expected_response_value}
+ Should Be Equal As Strings ${actual_response_value} ${expected_response_value} \ No newline at end of file