2 Documentation Testing PM Mapper functionality
4 Library OperatingSystem
5 Library RequestsLibrary
8 Test Setup Create Session mapper_session ${PMMAPPER_BASE_URL}
9 Test Teardown Delete All Sessions
13 ${CLI_EXEC_CLI_CONFIG} { head -n 5 | tail -1;} < /tmp/pmmapper.log
14 ${CLI_EXEC_CLI_SUBS} curl -k https://${DR_PROV_IP}:8443/internal/prov
15 ${PMMAPPER_BASE_URL} http://${PMMAPPER_IP}:8081
16 ${DELIVERY_ENDPOINT} /delivery
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"
23 ${PUBLISH_NODE_URL} https://${DR_NODE_IP}:8443/publish/1/pm.xml
24 ${PM_DATA_FILE_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml
25 ${PUBLISH_CONTENT_TYPE} application/octet-stream
30 Verify PM Mapper Receive Configuraton From Config Binding Service
32 [Documentation] Verify 3gpp pm mapper successfully receive config data from CBS
33 CheckLog ${CLI_EXEC_CLI_CONFIG} Received pm-mapper configuration
35 Verify 3GPP PM Mapper Subscribes to Data Router
37 [Documentation] Verify 3gpp pm mapper subscribes to data router
38 CheckLog ${CLI_EXEC_CLI_SUBS} 3gpppmmapper
39 CheckLog ${CLI_EXEC_CLI_SUBS} "privilegedSubscriber":true
42 Verify Health Check returns 200 when a REST GET request to healthcheck url
44 [Documentation] Verify Health Check returns 200 when a REST GET request to healthcheck url
46 ${resp}= Get Request mapper_session ${HEALTHCHECK_ENDPOINT}
47 VerifyResponse ${resp.status_code} 200
49 Verify 3GPP PM Mapper responds appropriately when no metadata is provided
51 [Documentation] Verify 3GPP PM Mapper responds 400 with the message "Missing Metadata." when no metadata is provided
53 ${headers}= Create Dictionary X-ONAP-RequestID=1 Content-Type=application/xml
54 ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/filename data='${EMPTY}' headers=${headers}
55 VerifyResponse ${resp.status_code} 400
56 VerifyResponse ${resp.content} Missing Metadata.
57 CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=1
59 Verify 3GPP PM Mapper responds appropriately when invalid metadata is provided
61 [Documentation] Verify 3GPP PM Mapper responds 400 with the message "Malformed Metadata." when invalid metadata is provided
63 ${headers}= Create Dictionary X-ONAP-RequestID=2 X-DMAAP-DR-META='not metadata' Content-Type=application/xml
64 ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/filename data='${EMPTY}' headers=${headers}
65 VerifyResponse ${resp.status_code} 400
66 VerifyResponse ${resp.content} Malformed Metadata.
67 CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=2
69 Verify 3GPP PM Mapper received pushed PM data from Data Router
71 [Documentation] Verify 3GPP PM Mapper received pushed PM data from Data Router
73 ${PM_DATA}= Get File ${PM_DATA_FILE_PATH}
74 ${valid_metatdata} Get File ${VALID_METADATA_PATH}
75 ${resp}= PutCall ${PUBLISH_NODE_URL} 3 ${PM_DATA} ${PUBLISH_CONTENT_TYPE} ${valid_metatdata.replace("\n","")} pmmapper
76 VerifyResponse ${resp.status_code} 204
78 CheckLog ${CLI_EXEC_CLI_PM_LOG} XML validation successful
79 CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=3
81 Verify that PM Mapper logs successful when a file that contains measdata is provided
83 [Documentation] Verify that PM Mapper logs successful when a file that contains measdata is provided
85 ${valid_meas_result_content}= Get File ${MEASD_RESULT_PATH}
86 ${valid_metatdata} Get File ${VALID_METADATA_PATH}
87 ${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","")}
88 ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/filename data=${valid_meas_result_content} headers=${headers}
89 VerifyResponse ${resp.status_code} 200
90 CheckLog ${CLI_EXEC_CLI_PM_LOG} XML validation successful
91 CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=4
93 Verify that PM Mapper logs successful when a file that contains no measdata is provided
95 [Documentation] Verify that PM Mapper logs successful when a file that contains no measdata is provided
97 ${valid_no_measdata_content}= Get File ${NO_MEASDATA_PATH}
98 ${valid_metatdata} Get File ${VALID_METADATA_PATH}
99 ${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","")}
100 ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/filename data=${valid_no_measdata_content} headers=${headers}
101 VerifyResponse ${resp.status_code} 200
102 CheckLog ${CLI_EXEC_CLI_PM_LOG} XML validation successful
103 CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=5
105 Verify that PM Mapper throws Event failed validation against schema error when no managed element content is provided
107 [Documentation] Verify 3gpp pm mapper responds with an error when no managed element content is provided
109 ${no_managed_element_content}= Get File ${NO_MANAGED_ELEMENT_PATH}
110 ${valid_metatdata} Get File ${VALID_METADATA_PATH}
111 ${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","")}
112 ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/filename data=${no_managed_element_content} headers=${headers}
113 VerifyResponse ${resp.status_code} 200
114 CheckLog ${CLI_EXEC_CLI_PM_LOG} XML validation failed
115 CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=6
121 [Arguments] ${url} ${data}
122 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
123 ${resp}= Evaluate requests.post('${url}',data='${data}', headers=${headers},verify=False) requests
127 [Arguments] ${url} ${request_id} ${data} ${content_type} ${meta} ${user}
128 ${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=
129 ${resp}= Evaluate requests.put('${url}', data="""${data}""", headers=${headers}, verify=False, allow_redirects=False) requests
134 [Arguments] ${cli_exec_log_Path} ${string_to_check_in_log}
135 ${cli_cmd_output}= Run Process ${cli_exec_log_Path} shell=yes
136 Log ${cli_cmd_output.stdout}
137 Should Be Equal As Strings ${cli_cmd_output.rc} 0
138 Should Contain ${cli_cmd_output.stdout} ${string_to_check_in_log}
141 [Arguments] ${actual_response_value} ${expected_response_value}
142 Should Be Equal As Strings ${actual_response_value} ${expected_response_value}