aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dcaegen2-pmmapper/pmmapper
diff options
context:
space:
mode:
authorGerard Hickey <gerard.hickey@ericsson.com>2019-03-05 15:45:31 +0000
committerGerard Hickey <gerard.hickey@ericsson.com>2019-03-05 15:47:55 +0000
commit0e0090389628c7d225967ca40ccd06894eb3ffeb (patch)
treec9fc280b25132507addd3730eb45cd61a995b27b /tests/dcaegen2-pmmapper/pmmapper
parent667bd5989042cf27bfbe10d5d2c21b776502924a (diff)
New testcases to test xml validation
Change-Id: If1147eb8e7536d452092e9b716582dfb2a22e752 Signed-off-by: Gerard Hickey <gerard.hickey@ericsson.com> Issue-ID: INT-863
Diffstat (limited to 'tests/dcaegen2-pmmapper/pmmapper')
-rw-r--r--tests/dcaegen2-pmmapper/pmmapper/assets/meas_result.xml24
-rw-r--r--tests/dcaegen2-pmmapper/pmmapper/assets/no_managed_element.xml27
-rw-r--r--tests/dcaegen2-pmmapper/pmmapper/assets/no_measdata.xml11
-rw-r--r--tests/dcaegen2-pmmapper/pmmapper/assets/valid_metadata.json12
-rw-r--r--tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot63
5 files changed, 136 insertions, 1 deletions
diff --git a/tests/dcaegen2-pmmapper/pmmapper/assets/meas_result.xml b/tests/dcaegen2-pmmapper/pmmapper/assets/meas_result.xml
new file mode 100644
index 00000000..269fdf1d
--- /dev/null
+++ b/tests/dcaegen2-pmmapper/pmmapper/assets/meas_result.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<measCollecFile xmlns="http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec">
+ <fileHeader dnPrefix="some dnPrefix" vendorName="FooBar Ltd"
+ fileFormatVersion="32.435 V10.0">
+ <fileSender localDn="Dublin"/>
+ <measCollec beginTime="2018-10-02T12:00:00+01:00"/>
+ </fileHeader>
+ <measData>
+ <managedElement swVersion="r0.1" localDn="Dublin"/>
+ <measInfo measInfoId="some measInfoId">
+ <job jobId="jobId"/>
+ <granPeriod endTime="2018-10-02T12:15:00Z" duration="PT900S"/>
+ <repPeriod duration="PT900S"/>
+ <measTypes>a b c</measTypes>
+ <measValue measObjLdn="objLdn">
+ <measResults>76 27 98</measResults>
+ <suspect>false</suspect>
+ </measValue>
+ </measInfo>
+ </measData>
+ <fileFooter>
+ <measCollec endTime="2018-10-02T12:15:00+01:00"/>
+ </fileFooter>
+</measCollecFile>
diff --git a/tests/dcaegen2-pmmapper/pmmapper/assets/no_managed_element.xml b/tests/dcaegen2-pmmapper/pmmapper/assets/no_managed_element.xml
new file mode 100644
index 00000000..23e5c215
--- /dev/null
+++ b/tests/dcaegen2-pmmapper/pmmapper/assets/no_managed_element.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<measCollecFile xmlns="http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec">
+ <fileHeader dnPrefix="some dnPrefix" vendorName="FooBar Ltd"
+ fileFormatVersion="32.435 V10.0">
+ <fileSender localDn="Dublin"/>
+ <measCollec beginTime="2018-10-02T12:00:00+01:00"/>
+ </fileHeader>
+ <measData>
+ <measInfo measInfoId="some measInfoId">
+ <job jobId="some job Id"/>
+ <granPeriod endTime="2018-10-02T12:15:00Z" duration="some duration"/>
+ <repPeriod duration="PT900S"/>
+ <measType p="1">a</measType>
+ <measType p="2">b</measType>
+ <measType p="3">c</measType>
+ <measValue measObjLdn="some measObjLdn">
+ <r p="1">86</r>
+ <r p="2">67</r>
+ <r p="3">14</r>
+ <suspect>false</suspect>
+ </measValue>
+ </measInfo>
+ </measData>
+ <fileFooter>
+ <measCollec endTime="2018-10-02T12:15:00+01:00"/>
+ </fileFooter>
+</measCollecFile> \ No newline at end of file
diff --git a/tests/dcaegen2-pmmapper/pmmapper/assets/no_measdata.xml b/tests/dcaegen2-pmmapper/pmmapper/assets/no_measdata.xml
new file mode 100644
index 00000000..855b2e91
--- /dev/null
+++ b/tests/dcaegen2-pmmapper/pmmapper/assets/no_measdata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<measCollecFile xmlns="http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec">
+ <fileHeader dnPrefix="some dnPrefix" vendorName="FooBar Ltd"
+ fileFormatVersion="32.435 V10.0">
+ <fileSender localDn="Dublin"/>
+ <measCollec beginTime="2018-10-02T12:00:00+01:00"/>
+ </fileHeader>
+ <fileFooter>
+ <measCollec endTime="2018-10-02T12:15:00+01:00"/>
+ </fileFooter>
+</measCollecFile>
diff --git a/tests/dcaegen2-pmmapper/pmmapper/assets/valid_metadata.json b/tests/dcaegen2-pmmapper/pmmapper/assets/valid_metadata.json
new file mode 100644
index 00000000..3a2340f2
--- /dev/null
+++ b/tests/dcaegen2-pmmapper/pmmapper/assets/valid_metadata.json
@@ -0,0 +1,12 @@
+{
+ "productName": "NrRadio",
+ "vendorName": "Ericsson",
+ "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/pmmapper.robot b/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot
index 71344632..363c95c1 100644
--- a/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot
+++ b/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot
@@ -14,6 +14,12 @@ ${CLI_EXEC_CLI_CONFIG} { head -n 5 | tail -1;} < /tmp/pmmapper
${CLI_EXEC_CLI_SUBS} curl -k https://${DR_PROV_IP}:8443/internal/prov
${PMMAPPER_BASE_URL} http://${PMMAPPER_IP}:8081
${DELIVERY_ENDPOINT} /delivery
+${HEALTHCHECK_ENDPOINT} /healthcheck
+${NO_MANAGED_ELEMENT_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/no_managed_element.xml
+${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
+${CLI_EXEC_CLI_PM_LOG} docker exec pmmapper /bin/sh -c "tail -5 /var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log"
*** Test Cases ***
@@ -33,6 +39,14 @@ Verify 3GPP PM Mapper Subscribes to Data Router
Should Be Equal As Strings ${cli_cmd_output.rc} 0
Should Contain ${cli_cmd_output.stdout} 3gpppmmapper
+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
+
+
Verify 3GPP PM Mapper responds appropriately when no metadata is provided
[Tags] PM_MAPPER_10
[Documentation] Verify 3GPP PM Mapper responds 400 with the message "Missing Metadata." when no metadata is provided
@@ -51,10 +65,57 @@ Verify 3GPP PM Mapper responds appropriately when invalid metadata is provided
Should Be Equal As Strings ${resp.status_code} 400
Should Be Equal As Strings ${resp.content} Malformed Metadata.
+
+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
+ [Timeout] 1 minute
+ ${no_managed_element_content}= Get File ${NO_MANAGED_ELEMENT_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
+
+
+Verify that PM Mapper logs successful when a file that contains no measdata is provided
+ [Tags] PM_MAPPER_13
+ [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","")}
+ ${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
+
+
+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
+ [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}
+ 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
+
+
+
*** Keywords ***
PostCall
[Arguments] ${url} ${data}
${headers}= Create Dictionary Accept=application/json Content-Type=application/json
${resp}= Evaluate requests.post('${url}',data='${data}', headers=${headers},verify=False) requests
- [Return] ${resp} \ No newline at end of file
+ [Return] ${resp}