From 80f8f4636074a60294ec943229edcc5748526921 Mon Sep 17 00:00:00 2001 From: Gerard Hickey Date: Thu, 14 Mar 2019 12:41:05 +0000 Subject: Added test to verify Metdata filtering Change-Id: I3145c37896270209a7ef499a4b70f7fd1342ba7f Signed-off-by: Gerard Hickey Issue-ID: INT-863 --- plans/dcaegen2-pmmapper/pmmapper/assets/config.json | 2 +- .../pmmapper/assets/diff_vendor_metadata.json | 12 ++++++++++++ tests/dcaegen2-pmmapper/pmmapper/assets/valid_metadata.json | 2 +- tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot | 13 +++++++++++++ 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 tests/dcaegen2-pmmapper/pmmapper/assets/diff_vendor_metadata.json diff --git a/plans/dcaegen2-pmmapper/pmmapper/assets/config.json b/plans/dcaegen2-pmmapper/pmmapper/assets/config.json index 5eec4380..3a42e7c5 100644 --- a/plans/dcaegen2-pmmapper/pmmapper/assets/config.json +++ b/plans/dcaegen2-pmmapper/pmmapper/assets/config.json @@ -1,5 +1,5 @@ { - "pm-mapper-filter": { "filters":[]}, + "pm-mapper-filter": { "filters":[{"nfType": "gnb", "vendor": "Ericsson"}]}, "streams_subscribes": { "dmaap_subscriber": { "type": "data_router", diff --git a/tests/dcaegen2-pmmapper/pmmapper/assets/diff_vendor_metadata.json b/tests/dcaegen2-pmmapper/pmmapper/assets/diff_vendor_metadata.json new file mode 100644 index 00000000..0abf8e3e --- /dev/null +++ b/tests/dcaegen2-pmmapper/pmmapper/assets/diff_vendor_metadata.json @@ -0,0 +1,12 @@ +{ + "productName": "gnb", + "vendorName": "Anon", + "lastEpochMicrosec": "1538478000000", + "sourceName": "oteNB5309", + "startEpochMicrosec": "1538478900000", + "timeZoneOffset": "UTC+05.00", + "location": "ftpes://192.168.0.101:22/ftp/rop/A20161224.1045-1100.bin.gz", + "compression": "gzip", + "fileFormatType": "org.3GPP.32.435#measCollec", + "fileFormatVersion": "V9" + } \ No newline at end of file diff --git a/tests/dcaegen2-pmmapper/pmmapper/assets/valid_metadata.json b/tests/dcaegen2-pmmapper/pmmapper/assets/valid_metadata.json index 3a2340f2..da809d7b 100644 --- a/tests/dcaegen2-pmmapper/pmmapper/assets/valid_metadata.json +++ b/tests/dcaegen2-pmmapper/pmmapper/assets/valid_metadata.json @@ -1,5 +1,5 @@ { - "productName": "NrRadio", + "productName": "gnb", "vendorName": "Ericsson", "lastEpochMicrosec": "1538478000000", "sourceName": "oteNB5309", diff --git a/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot b/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot index bc32673d..a9474672 100644 --- a/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot +++ b/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot @@ -19,6 +19,7 @@ ${NO_MANAGED_ELEMENT_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pm ${NO_MEASDATA_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/no_measdata.xml ${MEASD_RESULT_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/meas_result.xml ${VALID_METADATA_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/valid_metadata.json +${DIFF_VENDOR_METADATA} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/diff_vendor_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 @@ -114,6 +115,18 @@ Verify that PM Mapper throws Event failed validation against schema error when n CheckLog ${CLI_EXEC_CLI_PM_LOG} XML validation failed CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=6 +Verify that PM Mapper correctly identifies a file that should not be mapped based on metadata filtering. + [Tags] PM_MAPPER_10 + [Documentation] Verify that PM Mapper correctly identifies a file that should not be mapped based on metadata filtering. + [Timeout] 1 minute + ${valid_meas_result_content}= Get File ${MEASD_RESULT_PATH} + ${diff_vendor_metadata}= Get File ${DIFF_VENDOR_METADATA} + ${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","")} + ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/filename data=${valid_meas_result_content} headers=${headers} + CheckLog ${CLI_EXEC_CLI_PM_LOG} Metadata does not match any filters, + CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=7 + + *** Keywords *** -- cgit 1.2.3-korg