Add testcase for PMMapper (Support 28.532 file naming convention)

Issue-ID: DCAEGEN2-2351
Signed-off-by: marcinrzepeckiwroc <marcin.rzepecki@nokia.com>
Change-Id: Ic2529d35d690dfce5a4519cccedaec7fb88a1a74
diff --git a/tests/dcaegen2-pmmapper/pmmapper/assets/new_radio/PM202007171301+020024C202007171207+0200-1215+0200_45678.xml b/tests/dcaegen2-pmmapper/pmmapper/assets/new_radio/PM202007171301+020024C202007171207+0200-1215+0200_45678.xml
new file mode 100644
index 0000000..8d42d62
--- /dev/null
+++ b/tests/dcaegen2-pmmapper/pmmapper/assets/new_radio/PM202007171301+020024C202007171207+0200-1215+0200_45678.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-stylesheet type="text/xsl" href="MeasDataCollection.xsl"?>
+<measDataFile xmlns="http://www.3gpp.org/ftp/specs/archive/28_series/28.532#measData"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xsi:schemaLocation="http://www.3gpp.org/ftp/specs/archive/28_series/28.532#measData http://www.3gpp.org/ftp/specs/archive/28_series/28.532#measData">
+    <fileHeader fileFormatVersion="28.532 V7.0" vendorName="Company NN" dnPrefix="DC=a1.companyNN.com,SubNetwork=1,IRPAgent=1">
+        <fileSender senderName="SubNetwork=CountryNN,MeContext=MEC-Gbg-1,ManagedElement=RNC-Gbg-1"/>
+        <measData beginTime="2000-03-01T14:00:00+02:00"/>
+    </fileHeader>
+    <measData>
+        <measEntity localDn="SubNetwork=CountryNN,MeContext=MEC-Gbg-1,ManagedElement=RNC-Gbg-1" userLabel="RNC Telecomville"/>
+        <measInfo>
+            <job jobId="1231"/>
+            <granPeriod duration="PT900S" endTime="2000-03-01T14:14:30+02:00"/>
+            <repPeriod duration="PT1800S"/>
+            <measType p="1">attTCHSeizures</measType>
+            <measType p="2">succTCHSeizures</measType>
+            <measType p="3">attImmediateAssignProcs</measType>
+            <measType p="4">succImmediateAssignProcs</measType>
+            <measValue measObjLdn="RncFunction=RF-1,UtranCell=Gbg-997">
+                <r p="1">234</r>
+                <r p="2">345</r>
+                <r p="3">567</r>
+                <r p="4">789</r>
+            </measValue>
+            <measValue measObjLdn="RncFunction=RF-1,UtranCell=Gbg-998">
+                <r p="1">890</r>
+                <r p="2">901</r>
+                <r p="3">123</r>
+                <r p="4">234</r>
+            </measValue>
+            <measValue measObjLdn="RncFunction=RF-1,UtranCell=Gbg-999">
+                <r p="1">456</r>
+                <r p="2">567</r>
+                <r p="3">678</r>
+                <r p="4">789</r>
+                <suspect>true</suspect>
+            </measValue>
+        </measInfo>
+        <measInfo measInfoId="ENodeBFunction">
+            <job jobId="1232"/>
+            <granPeriod duration="PT900S" endTime="2000-03-01T14:14:30+02:00"/>
+            <repPeriod duration="PT1800S"/>
+            <measType p="1">attTCHSeizures1</measType>
+            <measType p="2">succTCHSeizures2</measType>
+            <measType p="3">attImmediateAssignProcs3</measType>
+            <measType p="4">succImmediateAssignProcs4</measType>
+            <measValue measObjLdn="ManagedElement=RNC-Gbg-1,ENodeBFunction=1">
+                <r p="1">4</r>
+                <r p="2">86,87,2,6,77,96,75,33,24</r>
+                <r p="3">40</r>
+                <r p="4">90</r>
+                <suspect>false</suspect>
+            </measValue>
+        </measInfo>
+        <measInfo>
+            <job jobId="1233"/>
+            <granPeriod duration="PT900S" endTime="2000-03-01T14:14:30+02:00"/>
+            <repPeriod duration="PT1800S"/>
+            <measType p="1">attTCHSeizures5</measType>
+            <measType p="2">succTCHSeizures6</measType>
+            <measType p="3">attImmediateAssignProcs7</measType>
+            <measType p="4">succImmediateAssignProcs8</measType>
+            <measValue measObjLdn="RncFunction=RF-1,UtranCell=Gbg-997">
+                <r p="1">238</r>
+                <r p="2">344</r>
+                <r p="3">563</r>
+                <r p="4">787</r>
+            </measValue>
+            <measValue measObjLdn="RncFunction=RF-1,UtranCell=Gbg-998">
+                <r p="1">898</r>
+                <r p="2">905</r>
+                <r p="3">127</r>
+                <r p="4">238</r>
+            </measValue>
+            <measValue measObjLdn="RncFunction=RF-1,UtranCell=Gbg-999">
+                <r p="1">454</r>
+                <r p="2">569</r>
+                <r p="3">672</r>
+                <r p="4">785</r>
+                <suspect>true</suspect>
+            </measValue>
+        </measInfo>
+    </measData>
+    <fileFooter>
+        <measData endTime="2000-03-01T14:15:00+02:00"/>
+    </fileFooter>
+</measDataFile>
diff --git a/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot b/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot
index 0b18320..cd6f265 100644
--- a/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot
+++ b/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot
@@ -7,8 +7,7 @@
 Library           String
 
 Test Setup        Create Session  mapper_session  ${PMMAPPER_BASE_URL}
-Test Teardown     Delete All Sessions
-
+Test Teardown     CleanSessionsAndLogs
 
 *** Variables ***
 ${CLI_EXEC_CLI_CONFIG}                   { head -n 10 | tail -5;} < /tmp/pmmapper.log
@@ -23,12 +22,14 @@
 ${NR_VALID_METADATA_PATH}                %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/new_radio/valid_metadata.json
 ${DIFF_VENDOR_METADATA}                  %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/diff_vendor_metadata.json
 ${NON_XML_FILE}                          %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/diff_vendor_metadata.json
-${CLI_EXEC_CLI_PM_LOG}                   docker exec pmmapper /bin/sh -c "tail -15 /var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log"
+${CLI_EXEC_CLI_PM_LOG}                   docker exec pmmapper /bin/sh -c "cat /var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log"
+${CLI_EXEC_CLI_PM_LOG_CLEAR}             docker exec pmmapper /bin/sh -c "echo -n "" > /var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log"
 ${PUBLISH_NODE_URL}                      https://${DR_NODE_IP}:8443/publish/1
 ${TYPE-A_PM_DATA_FILE_PATH}              %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml
 ${TYPE-C_PM_DATA_FILE_PATH}              %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/C20190328.0000-0015.xml
 ${NR-TYPE-A_PM_DATA_FILE_PATH}           %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/new_radio/A20181004.0000-1000-0015-1000_5G.xml
 ${NR-TYPE-C_PM_DATA_FILE_PATH}           %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/new_radio/C20190329.0000-0015.xml
+${NR-TYPE-PM_DATA_FILE_PATH}             %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/new_radio/PM202007171301+020024C202007171207+0200-1215+0200_45678.xml
 ${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
 ${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
 ${CLI_EXEC_PM_FILTER_regex}              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_regex_config.json
@@ -53,43 +54,43 @@
     [Tags]                          PM_MAPPER_03
     [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
+    ${headers}=                     Create Dictionary               X-ONAP-RequestID=3  Content-Type=application/xml
     ${resp}=                        Put Request                     mapper_session  ${DELIVERY_ENDPOINT}/filename    data='${EMPTY}'    headers=${headers}
     VerifyResponse                  ${resp.status_code}             400
     VerifyResponse                  ${resp.content}                 Missing Metadata.
-    CheckLog                        ${CLI_EXEC_CLI_PM_LOG}          RequestID=1
+    CheckLog                        ${CLI_EXEC_CLI_PM_LOG}          RequestID=3
 
 Verify 3GPP PM Mapper responds appropriately when invalid metadata is provided
     [Tags]                          PM_MAPPER_04
     [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=2  X-DMAAP-DR-META='not metadata'  Content-Type=application/xml
+    ${headers}=                     Create Dictionary               X-ONAP-RequestID=4  X-DMAAP-DR-META='not metadata'  Content-Type=application/xml
     ${resp}=                        Put Request                     mapper_session  ${DELIVERY_ENDPOINT}/filename  data='${EMPTY}'  headers=${headers}
     VerifyResponse                  ${resp.status_code}             400
     VerifyResponse                  ${resp.content}                 Malformed Metadata.
-    CheckLog                        ${CLI_EXEC_CLI_PM_LOG}          RequestID=2
+    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_05
     [Documentation]                 Verify that PM Mapper logs successful when a file that contains no measdata is provided
     [Timeout]                       1 minute
-    SendToDatarouter                ${NO_MEASDATA_PATH}              ${VALID_METADATA_PATH}            X-ONAP-RequestID=3
+    SendToDatarouter                ${NO_MEASDATA_PATH}              ${VALID_METADATA_PATH}            X-ONAP-RequestID=5
     CheckLog                        ${CLI_EXEC_CLI_PM_LOG}           MeasData is empty
-    CheckLog                        ${CLI_EXEC_CLI_PM_LOG}           RequestID=3
+    CheckLog                        ${CLI_EXEC_CLI_PM_LOG}           RequestID=5
 
 Verify that PM Mapper throws Event failed validation against schema error when no managed element content is provided
     [Tags]                          PM_MAPPER_06
     [Documentation]                 Verify 3gpp pm mapper responds with an error when no managed element content is provided
     [Timeout]                       1 minute
-    SendToDatarouter                ${NO_MANAGED_ELEMENT_PATH}       ${VALID_METADATA_PATH}             X-ONAP-RequestID=4
+    SendToDatarouter                ${NO_MANAGED_ELEMENT_PATH}       ${VALID_METADATA_PATH}             X-ONAP-RequestID=6
     CheckLog                        ${CLI_EXEC_CLI_PM_LOG}           XML validation failed
-    CheckLog                        ${CLI_EXEC_CLI_PM_LOG}           RequestID=4
+    CheckLog                        ${CLI_EXEC_CLI_PM_LOG}           RequestID=6
 
 Verify that PM Mapper maps Type-C xml file and publish 3gpp perf VES evnets to message router
     [Tags]                          PM_MAPPER_07
     [Documentation]                 Verify that PM Mapper maps Type-C xml file and publish 3gpp perf VES evnets to message router.
     [Timeout]                       1 minute
-    SendToDatarouter                ${TYPE-C_PM_DATA_FILE_PATH}      ${VALID_METADATA_PATH}           X-ONAP-RequestID=5
+    SendToDatarouter                ${TYPE-C_PM_DATA_FILE_PATH}      ${VALID_METADATA_PATH}           X-ONAP-RequestID=7
     CheckLog                        ${CLI_EXEC_CLI_PM_LOG}           Successfully published VES events to messagerouter
 
 Verify 3GPP PM Mapper maps Type-A file based on counter filtering and publish 3gpp perf VES evnets to message router
@@ -99,7 +100,7 @@
     ${cli_cmd_output}=              Run Process                      ${CLI_EXEC_PM_FILTER}             shell=yes
     ${resp}=                        Get Request                      mapper_session                    ${RECONFIGURE_ENDPOINT}
     Sleep                           5s
-    SendToDatarouter                ${TYPE-A_PM_DATA_FILE_PATH}      ${VALID_METADATA_PATH}            X-ONAP-RequestID=6
+    SendToDatarouter                ${TYPE-A_PM_DATA_FILE_PATH}      ${VALID_METADATA_PATH}            X-ONAP-RequestID=8
     CheckLog                        ${CLI_EXEC_CLI_PM_LOG}           Successfully published VES events to messagerouter
 
 Verify that PM Mapper correctly identifies a file that should not be mapped based on metadata filtering.
@@ -110,17 +111,17 @@
     Should Be Equal As Strings      ${cli_cmd_output.rc}             0
     ${resp}=                        Get Request                      mapper_session                    ${RECONFIGURE_ENDPOINT}
     Sleep                           5s
-    SendToDatarouter                ${TYPE-A_PM_DATA_FILE_PATH}      ${DIFF_VENDOR_METADATA}           X-ONAP-RequestID=7
+    SendToDatarouter                ${TYPE-A_PM_DATA_FILE_PATH}      ${DIFF_VENDOR_METADATA}           X-ONAP-RequestID=9
+    CheckLog                        ${CLI_EXEC_CLI_PM_LOG}           RequestID=9
     CheckLog                        ${CLI_EXEC_CLI_PM_LOG}           Metadata does not match any filters
-    CheckLog                        ${CLI_EXEC_CLI_PM_LOG}           RequestID=7
 
 Verify that PM Mapper correctly identifies a non-xml file.
     [Tags]                          PM_MAPPER_10
     [Documentation]                 Verify that PM Mapper correctly identifies a non-xml file.
     [Timeout]                       1 minute
-    SendToDatarouter                ${NON_XML_FILE}                  ${VALID_METADATA_PATH}             X-ONAP-RequestID=8
+    SendToDatarouter                ${NON_XML_FILE}                  ${VALID_METADATA_PATH}             X-ONAP-RequestID=10
     CheckLog                        ${CLI_EXEC_CLI_PM_LOG}           PM measurement file must have an extension of .xml
-    CheckLog                        ${CLI_EXEC_CLI_PM_LOG}           RequestID=8
+    CheckLog                        ${CLI_EXEC_CLI_PM_LOG}           RequestID=10
 
 Verify that PM Mapper correctly maps an NR Type-A file based on counter filtering and publish 3gpp perf VES events to message router.
     [Tags]                          PM_MAPPER_11
@@ -129,15 +130,15 @@
     ${cli_cmd_output}=              Run Process                      ${CLI_EXEC_PM_FILTER}             shell=yes
     ${resp}=                        Get Request                      mapper_session                    ${RECONFIGURE_ENDPOINT}
     Sleep                           5s
-    SendToDatarouter                ${NR-TYPE-A_PM_DATA_FILE_PATH}      ${NR_VALID_METADATA_PATH}            X-ONAP-RequestID=11
+    SendToDatarouter                ${NR-TYPE-A_PM_DATA_FILE_PATH}   ${NR_VALID_METADATA_PATH}            X-ONAP-RequestID=11
     CheckLog                        ${CLI_EXEC_CLI_PM_LOG}           Successfully published VES events to messagerouter
 
 Verify that PM Mapper correctly maps an NR Type-C file based on counter filtering and publish 3gpp perf VES events to message router.
     [Tags]                          PM_MAPPER_12
     [Documentation]                 Verify that PM Mapper maps an NR Type-C xml file and publish 3gpp perf VES evnets to message router.
     [Timeout]                       1 minute
-    SendToDatarouter                ${NR-TYPE-C_PM_DATA_FILE_PATH}      ${NR_VALID_METADATA_PATH}           X-ONAP-RequestID=12
-    CheckLog                        ${CLI_EXEC_CLI_PM_LOG}           Successfully published VES events to messagerouter
+    SendToDatarouter                ${NR-TYPE-C_PM_DATA_FILE_PATH}    ${NR_VALID_METADATA_PATH}           X-ONAP-RequestID=12
+    CheckLog                        ${CLI_EXEC_CLI_PM_LOG}            Successfully published VES events to messagerouter
 
 Verify 3GPP PM Mapper maps Type-A file based on counter filtering with regexp
     [Tags]                          PM_MAPPER_13
@@ -146,7 +147,7 @@
     ${cli_cmd_output}=              Run Process                      ${CLI_EXEC_PM_FILTER_regex}             shell=yes
     ${resp}=                        Get Request                      mapper_session                    ${RECONFIGURE_ENDPOINT}
     Sleep                           5s
-    SendToDatarouter                ${TYPE-A_PM_DATA_FILE_PATH}      ${VALID_METADATA_PATH}            X-ONAP-RequestID=6
+    SendToDatarouter                ${TYPE-A_PM_DATA_FILE_PATH}      ${VALID_METADATA_PATH}            X-ONAP-RequestID=13
     CheckLog                        ${CLI_EXEC_CLI_PM_LOG}           Successfully published VES events to messagerouter
 
 Verify that password receive from CBS are successfully encrypted
@@ -155,6 +156,14 @@
     CheckLog                        ${CLI_EXEC_CLI_CONFIG}           "aaf_password": *****
     CheckLog                        ${CLI_EXEC_CLI_CONFIG}           "password": *****
 
+Verify that PM Mapper correctly maps an NR Type-PM file based on counter filtering and publish 3gpp perf VES events to message router.
+    [Tags]                          PM_MAPPER_15
+    [Documentation]                 Verify that PM Mapper maps an NR Type-PM xml file and publish 3gpp perf VES evnets to message router.
+    [Timeout]                       1 minute
+    SendToDatarouter                ${NR-TYPE-PM_DATA_FILE_PATH}      ${NR_VALID_METADATA_PATH}           X-ONAP-RequestID=15
+    CheckLog                        ${CLI_EXEC_CLI_PM_LOG}            RequestID=15
+    CheckLog                        ${CLI_EXEC_CLI_PM_LOG}            Successfully published VES events to messagerouter
+
 *** Keywords ***
 
 SendToDatarouter
@@ -182,3 +191,10 @@
 VerifyResponse
     [Arguments]                     ${actual_response_value}         ${expected_response_value}
     Should Be Equal As Strings      ${actual_response_value}         ${expected_response_value}
+
+ClearLogs
+    Run Process                     ${CLI_EXEC_CLI_PM_LOG_CLEAR}                     shell=yes
+
+CleanSessionsAndLogs
+    Delete All Sessions
+    ClearLogs