From a3f68d14609fc94ec89e3eb724664a62bc2b0210 Mon Sep 17 00:00:00 2001 From: Lasse Kaihlavirta Date: Fri, 21 May 2021 12:59:08 +0300 Subject: Move PM-Mapper CSIT to project repo Issue-ID: DCAEGEN2-2746 Signed-off-by: Lasse Kaihlavirta Change-Id: Ib96f8453fd7fecbaddaada1b11d3b8551bb7f8fa --- .../filesprocessingconfigpmmapper/__init__.robot | 2 + .../assets/.gitattributes | 1 + .../assets/ABigFile.xml | 163 +++++++++++++++++ .../assets/config_10_1.env | 3 + .../assets/config_1_1.env | 3 + .../assets/config_1_10.env | 3 + .../assets/valid_metadata.json | 12 ++ .../filesprocessingconfigpmmapper.robot | 149 +++++++++++++++ .../libraries/DockerContainerManager.py | 29 +++ .../libraries/DockerContainerManager.pyc | Bin 0 -> 1989 bytes .../libraries/EnvsReader.py | 11 ++ .../libraries/EnvsReader.pyc | Bin 0 -> 824 bytes .../libraries/LogReader.py | 22 +++ .../libraries/LogReader.pyc | Bin 0 -> 1953 bytes csit/tests/pmmapper/__init__.robot | 2 + csit/tests/pmmapper/assets/.gitattributes | 1 + .../assets/A20181002.0000-1000-0015-1000_5G.xml | 88 +++++++++ .../assets/A20181002.0000-1000-0015-1000_5G.xml.gz | Bin 0 -> 959 bytes .../tests/pmmapper/assets/A_no_managed_element.xml | 27 +++ csit/tests/pmmapper/assets/A_no_measdata.xml | 11 ++ csit/tests/pmmapper/assets/C20190328.0000-0015.xml | 49 +++++ .../pmmapper/assets/diff_vendor_metadata.json | 12 ++ .../new_radio/A20181004.0000-1000-0015-1000_5G.xml | 88 +++++++++ .../assets/new_radio/C20190329.0000-0015.xml | 49 +++++ ...01+020024C202007171207+0200-1215+0200_45678.xml | 88 +++++++++ .../pmmapper/assets/new_radio/valid_metadata.json | 12 ++ csit/tests/pmmapper/assets/pm_filter_config.json | 42 +++++ .../pmmapper/assets/pm_filter_regex_config.json | 42 +++++ csit/tests/pmmapper/assets/valid_metadata.json | 12 ++ .../pmmapper/assets/vendor_filter_config.json | 42 +++++ csit/tests/pmmapper/pmmapper.robot | 201 +++++++++++++++++++++ 31 files changed, 1164 insertions(+) create mode 100644 csit/tests/filesprocessingconfigpmmapper/__init__.robot create mode 100644 csit/tests/filesprocessingconfigpmmapper/assets/.gitattributes create mode 100644 csit/tests/filesprocessingconfigpmmapper/assets/ABigFile.xml create mode 100644 csit/tests/filesprocessingconfigpmmapper/assets/config_10_1.env create mode 100644 csit/tests/filesprocessingconfigpmmapper/assets/config_1_1.env create mode 100644 csit/tests/filesprocessingconfigpmmapper/assets/config_1_10.env create mode 100644 csit/tests/filesprocessingconfigpmmapper/assets/valid_metadata.json create mode 100644 csit/tests/filesprocessingconfigpmmapper/filesprocessingconfigpmmapper.robot create mode 100644 csit/tests/filesprocessingconfigpmmapper/libraries/DockerContainerManager.py create mode 100644 csit/tests/filesprocessingconfigpmmapper/libraries/DockerContainerManager.pyc create mode 100644 csit/tests/filesprocessingconfigpmmapper/libraries/EnvsReader.py create mode 100644 csit/tests/filesprocessingconfigpmmapper/libraries/EnvsReader.pyc create mode 100644 csit/tests/filesprocessingconfigpmmapper/libraries/LogReader.py create mode 100644 csit/tests/filesprocessingconfigpmmapper/libraries/LogReader.pyc create mode 100644 csit/tests/pmmapper/__init__.robot create mode 100644 csit/tests/pmmapper/assets/.gitattributes create mode 100644 csit/tests/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml create mode 100644 csit/tests/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml.gz create mode 100644 csit/tests/pmmapper/assets/A_no_managed_element.xml create mode 100644 csit/tests/pmmapper/assets/A_no_measdata.xml create mode 100644 csit/tests/pmmapper/assets/C20190328.0000-0015.xml create mode 100644 csit/tests/pmmapper/assets/diff_vendor_metadata.json create mode 100644 csit/tests/pmmapper/assets/new_radio/A20181004.0000-1000-0015-1000_5G.xml create mode 100644 csit/tests/pmmapper/assets/new_radio/C20190329.0000-0015.xml create mode 100644 csit/tests/pmmapper/assets/new_radio/PM202007171301+020024C202007171207+0200-1215+0200_45678.xml create mode 100644 csit/tests/pmmapper/assets/new_radio/valid_metadata.json create mode 100644 csit/tests/pmmapper/assets/pm_filter_config.json create mode 100644 csit/tests/pmmapper/assets/pm_filter_regex_config.json create mode 100644 csit/tests/pmmapper/assets/valid_metadata.json create mode 100644 csit/tests/pmmapper/assets/vendor_filter_config.json create mode 100644 csit/tests/pmmapper/pmmapper.robot (limited to 'csit/tests') diff --git a/csit/tests/filesprocessingconfigpmmapper/__init__.robot b/csit/tests/filesprocessingconfigpmmapper/__init__.robot new file mode 100644 index 0000000..9eda6de --- /dev/null +++ b/csit/tests/filesprocessingconfigpmmapper/__init__.robot @@ -0,0 +1,2 @@ +*** Settings *** +Documentation Files Processing Config PM Mapper Testcases diff --git a/csit/tests/filesprocessingconfigpmmapper/assets/.gitattributes b/csit/tests/filesprocessingconfigpmmapper/assets/.gitattributes new file mode 100644 index 0000000..57cdc50 --- /dev/null +++ b/csit/tests/filesprocessingconfigpmmapper/assets/.gitattributes @@ -0,0 +1 @@ +*.gz binary diff --git a/csit/tests/filesprocessingconfigpmmapper/assets/ABigFile.xml b/csit/tests/filesprocessingconfigpmmapper/assets/ABigFile.xml new file mode 100644 index 0000000..8a3bcf4 --- /dev/null +++ b/csit/tests/filesprocessingconfigpmmapper/assets/ABigFile.xml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + attTCHSeizures + succTCHSeizures + attImmediateAssignProcs + succImmediateAssignProcs + + 234 + 345 + 567 + 789 + + + 890 + 901 + 123 + 234 + + + 456 + 567 + 678 + 789 + true + + + + + + + attTCHSeizures1 + succTCHSeizures2 + attImmediateAssignProcs3 + succImmediateAssignProcs4 + + 4 + 86,87,2,6,77,96,75,33,24 + 40 + 90 + false + + + + + + + attTCHSeizures5 + succTCHSeizures6 + attImmediateAssignProcs7 + succImmediateAssignProcs8 + + 238 + 344 + 563 + 787 + + + 898 + 905 + 127 + 238 + + + 454 + 569 + 672 + 785 + true + + + + + + + + + + attTCHSeizures + succTCHSeizures + attImmediateAssignProcs + succImmediateAssignProcs + + 234 + 345 + 567 + 789 + + + 890 + 901 + 123 + 234 + + + 456 + 567 + 678 + 789 + true + + + + + + + attTCHSeizures1 + succTCHSeizures2 + attImmediateAssignProcs3 + succImmediateAssignProcs4 + + 4 + 86,87,2,6,77,96,75,33,24 + 40 + 90 + false + + + + + + + attTCHSeizures5 + succTCHSeizures6 + attImmediateAssignProcs7 + succImmediateAssignProcs8 + + 238 + 344 + 563 + 787 + + + 898 + 905 + 127 + 238 + + + 454 + 569 + 672 + 785 + true + + + + + + + diff --git a/csit/tests/filesprocessingconfigpmmapper/assets/config_10_1.env b/csit/tests/filesprocessingconfigpmmapper/assets/config_10_1.env new file mode 100644 index 0000000..050d2f2 --- /dev/null +++ b/csit/tests/filesprocessingconfigpmmapper/assets/config_10_1.env @@ -0,0 +1,3 @@ +PROCESSING_LIMIT_RATE=10 +THREADS_MULTIPLIER=1 +PROCESSING_THREADS_COUNT=1 diff --git a/csit/tests/filesprocessingconfigpmmapper/assets/config_1_1.env b/csit/tests/filesprocessingconfigpmmapper/assets/config_1_1.env new file mode 100644 index 0000000..c138912 --- /dev/null +++ b/csit/tests/filesprocessingconfigpmmapper/assets/config_1_1.env @@ -0,0 +1,3 @@ +PROCESSING_LIMIT_RATE=1 +THREADS_MULTIPLIER=1 +PROCESSING_THREADS_COUNT=1 diff --git a/csit/tests/filesprocessingconfigpmmapper/assets/config_1_10.env b/csit/tests/filesprocessingconfigpmmapper/assets/config_1_10.env new file mode 100644 index 0000000..b4c290e --- /dev/null +++ b/csit/tests/filesprocessingconfigpmmapper/assets/config_1_10.env @@ -0,0 +1,3 @@ +PROCESSING_LIMIT_RATE=1 +THREADS_MULTIPLIER=1 +PROCESSING_THREADS_COUNT=10 diff --git a/csit/tests/filesprocessingconfigpmmapper/assets/valid_metadata.json b/csit/tests/filesprocessingconfigpmmapper/assets/valid_metadata.json new file mode 100644 index 0000000..da809d7 --- /dev/null +++ b/csit/tests/filesprocessingconfigpmmapper/assets/valid_metadata.json @@ -0,0 +1,12 @@ +{ + "productName": "gnb", + "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/csit/tests/filesprocessingconfigpmmapper/filesprocessingconfigpmmapper.robot b/csit/tests/filesprocessingconfigpmmapper/filesprocessingconfigpmmapper.robot new file mode 100644 index 0000000..9648ef8 --- /dev/null +++ b/csit/tests/filesprocessingconfigpmmapper/filesprocessingconfigpmmapper.robot @@ -0,0 +1,149 @@ +*** Settings *** +Documentation Testing PM Mapper functionality +Library Collections +Library OperatingSystem +Library RequestsLibrary +Library Process +Library String +Library libraries/DockerContainerManager.py +Library libraries/LogReader.py + +*** Variables *** + +${ASSETS_PATH} %{WORKSPACE}/tests/filesprocessingconfigpmmapper/assets +${NR_VALID_METADATA_PATH} ${ASSETS_PATH}/valid_metadata.json +${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 +${CLI_EXEC_LOGS_LIST} docker exec datarouter-node /bin/sh -c "ls /opt/app/datartr/logs" +${DOCKER_CLIENT_IMAGE} nexus3.onap.org:10001/onap/org.onap.dcaegen2.services.pm-mapper:latest +${CLIENT_CONTAINER_NAME} pmmapper +${FILE_PATH} ${ASSETS_PATH}/ABigFile.xml +${CONFIG_ENVS_1_1} ${ASSETS_PATH}/config_1_1.env +${CONFIG_ENVS_4_1} ${ASSETS_PATH}/config_4_1.env +${CONFIG_ENVS_10_1} ${ASSETS_PATH}/config_10_1.env +${CONFIG_ENVS_1_10} ${ASSETS_PATH}/config_1_10.env + +*** Test Cases *** + +Verify that PM Mapper rejects 6-9 messages when limitRate is 1 and threads count is 1 + [Tags] FILES_PROCESSING_CONFIG_PM_MAPPER_1 + [Documentation] Verify that PM Mapper rejects 6-9/10 messages. Configuration: limitRate=1, threadsCount=1 + [Timeout] 15 minute + + RestartPmmapper ${CONFIG_ENVS_1_1} + + ${testname}= Set Variable Afirst- + + SendFilesToDatarouter ${testname} + ${alllogs}= GetLogsOutput + ${filtered_logs}= GetFilteredLogs ${alllogs} ${testname} + ${dropped_nr}= GetDroppedNumber ${filtered_logs} + + Sleep 40s + ${isCorrectDroppedCount}= Evaluate ${5} < ${dropped_nr} < ${10} + SavePmMapperLogsAndDroppedCount config_1_1 ${dropped_nr} + Should Be True ${isCorrectDroppedCount} Pm-mapper drop: ${dropped_nr} messages. Expected drop count: 6-9 + ClearLogs + +Verify that PM Mapper rejects 0 messages when limitRate is 10 and threads count is 1 + [Tags] FILES_PROCESSING_CONFIG_PM_MAPPER_2 + [Documentation] Verify that PM Mapper rejects 0/10 messages. Configuration: limitRate=10, threadsCount=1 + [Timeout] 25 minute + + RestartPmmapper ${CONFIG_ENVS_10_1} + + ${testname}= Set Variable Athird- + + SendFilesToDatarouter ${testname} + ${alllogs}= GetLogsOutput + ${filtered_logs}= GetFilteredLogs ${alllogs} ${testname} + ${dropped_nr}= GetDroppedNumber ${filtered_logs} + + Sleep 15s + SavePmMapperLogsAndDroppedCount config_10_1 ${dropped_nr} + Should Be Equal As Numbers ${dropped_nr} 0 Pm-mapper drop: ${dropped_nr} messages. Expected drop count: 0 + ClearLogs + +Verify that PM Mapper rejects 0 messages when limitRate is 1 and threads count is 10 + [Tags] FILES_PROCESSING_CONFIG_PM_MAPPER_3 + [Documentation] Verify that PM Mapper rejects 0/10 messages. Configuration: limitRate=1, threadsCount=10 + [Timeout] 25 minute + + RestartPmmapper ${CONFIG_ENVS_1_10} + + ${testname}= Set Variable Afourth- + + SendFilesToDatarouter ${testname} + ${alllogs}= GetLogsOutput + ${filtered_logs}= GetFilteredLogs ${alllogs} ${testname} + ${dropped_nr}= GetDroppedNumber ${filtered_logs} + + Sleep 15s + SavePmMapperLogsAndDroppedCount config_1_10 ${dropped_nr} + Should Be Equal As Numbers ${dropped_nr} 0 Pm-mapper drop: ${dropped_nr} messages. Expected drop count: 0 + ClearLogs + +*** Keywords *** + +SendFilesToDatarouter + [Arguments] ${testnr} + FOR ${i} IN RANGE 10 + SendToDatarouter ${FILE_PATH} ${NR_VALID_METADATA_PATH} X-ONAP-RequestID=${i} ${testnr} ${i} + END + Sleep 20s + +SendToDatarouter + [Arguments] ${filepath} ${metadatapath} ${request_id} ${testnr} ${i} + ${pmdata}= Get File ${filepath} + ${metatdata} Get File ${metadatapath} + ${newFilename} Catenate SEPARATOR= ${testnr} ${i} .xml + ${resp}= PutCall ${PUBLISH_NODE_URL}/${newFilename} ${request_id} ${pmdata} ${metatdata.replace("\n","")} pmmapper + VerifyResponse ${resp.status_code} 204 + +PutCall + [Arguments] ${url} ${request_id} ${data} ${meta} ${user} + ${headers}= Create Dictionary X-ONAP-RequestID=${request_id} X-DMAAP-DR-META=${meta} Content-Type=application/octet-stream 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} + +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 + +GetLogsOutput + ${filesString}= Run Process ${CLI_EXEC_LOGS_LIST} shell=yes + ${filesList}= Get Log Files List ${filesString.stdout} + ${output}= Set Variable ${EMPTY} + FOR ${file} IN @{filesList} + ${file_path}= Catenate SEPARATOR= "cat /opt/app/datartr/logs/ ${file} " + ${exec}= Catenate docker exec datarouter-node /bin/sh -c ${file_path} + ${single_file}= Run Process ${exec} shell=yes + ${output}= Catenate SEPARATOR=\n ${output} ${single_file.stdout} + END + [Return] ${output} + +GetFilteredLogs + [Arguments] ${all_logs} ${testname} + ${filtered_logs}= Filter Unique ${all_logs} ${testname} + [Return] ${filtered_logs} + +GetDroppedNumber + [Arguments] ${logs_output} + ${number}= Get Number Of Dropped Messages ${logs_output} + [Return] ${number} + +RestartPmmapper + [Arguments] ${envs} + Remove Container ${CLIENT_CONTAINER_NAME} + Sleep 5s + Run Pmmapper Container ${DOCKER_CLIENT_IMAGE} ${CLIENT_CONTAINER_NAME} ${envs} ${DR_NODE_IP} ${NODE_IP} + Sleep 15s + +SavePmMapperLogsAndDroppedCount + [Arguments] ${test_name} ${dropped_count} + Run Process echo "Dropped: ${dropped_count}" > %{WORKSPACE}/archives/${test_name}_dropped_count.log shell=yes + Run Process docker logs ${CLIENT_CONTAINER_NAME} > %{WORKSPACE}/archives/${test_name}_pm_mapper_container_logs.log shell=yes + diff --git a/csit/tests/filesprocessingconfigpmmapper/libraries/DockerContainerManager.py b/csit/tests/filesprocessingconfigpmmapper/libraries/DockerContainerManager.py new file mode 100644 index 0000000..3e3ae58 --- /dev/null +++ b/csit/tests/filesprocessingconfigpmmapper/libraries/DockerContainerManager.py @@ -0,0 +1,29 @@ +import docker +from EnvsReader import EnvsReader +from docker.types import Mount + +class DockerContainerManager: + + def run_pmmapper_container(self, client_image, container_name, path_to_env, dr_node_ip, mr_ip): + client = docker.from_env() + environment = EnvsReader().read_env_list_from_file(path_to_env) + environment.append("CONFIG_BINDING_SERVICE_SERVICE_HOST=172.18.0.5") + environment.append("CONFIG_BINDING_SERVICE_SERVICE_PORT=10000") + environment.append("HOSTNAME=pmmapper") + client.containers.run( + image=client_image, + name=container_name, + environment=environment, + ports={'8081': 8081}, + network='filesprocessingconfigpmmapper_pmmapper-network', + extra_hosts={'dmaap-dr-node': dr_node_ip, 'message-router': mr_ip}, + user='root', + mounts=[Mount(target='/opt/app/pm-mapper/etc/certs/', source='/var/tmp/', type='bind')], + detach=True + ) + + def remove_container(self, container_name): + client = docker.from_env() + container = client.containers.get(container_name) + container.stop() + container.remove() diff --git a/csit/tests/filesprocessingconfigpmmapper/libraries/DockerContainerManager.pyc b/csit/tests/filesprocessingconfigpmmapper/libraries/DockerContainerManager.pyc new file mode 100644 index 0000000..2bf62c3 Binary files /dev/null and b/csit/tests/filesprocessingconfigpmmapper/libraries/DockerContainerManager.pyc differ diff --git a/csit/tests/filesprocessingconfigpmmapper/libraries/EnvsReader.py b/csit/tests/filesprocessingconfigpmmapper/libraries/EnvsReader.py new file mode 100644 index 0000000..cc60eed --- /dev/null +++ b/csit/tests/filesprocessingconfigpmmapper/libraries/EnvsReader.py @@ -0,0 +1,11 @@ + +class EnvsReader: + + def read_env_list_from_file(self, path): + f = open(path, "r") + r_list = [] + for line in f: + line = line.strip() + if line[0] != "#": + r_list.append(line) + return r_list diff --git a/csit/tests/filesprocessingconfigpmmapper/libraries/EnvsReader.pyc b/csit/tests/filesprocessingconfigpmmapper/libraries/EnvsReader.pyc new file mode 100644 index 0000000..831aa34 Binary files /dev/null and b/csit/tests/filesprocessingconfigpmmapper/libraries/EnvsReader.pyc differ diff --git a/csit/tests/filesprocessingconfigpmmapper/libraries/LogReader.py b/csit/tests/filesprocessingconfigpmmapper/libraries/LogReader.py new file mode 100644 index 0000000..01718e3 --- /dev/null +++ b/csit/tests/filesprocessingconfigpmmapper/libraries/LogReader.py @@ -0,0 +1,22 @@ +import re + +class LogReader: + + def filter_unique(self, merged_logs_output, testname): + logs = merged_logs_output.splitlines() + del_logs = list(filter(lambda line: "|DEL|" in line, logs)) + nrs_set = set() + ret_logs = set() + for log in del_logs: + filename = re.findall(testname + "\d", log) + if len(filename) > 0 and filename[0] not in nrs_set: + ret_logs.add(log) + nrs_set.add(filename[0]) + return ret_logs + + def get_number_of_dropped_messages(self, logs_output): + return len(list(filter(lambda line: "|429|" in line, logs_output))) + + def get_log_files_list(self, fileNames): + files = fileNames.split() + return files diff --git a/csit/tests/filesprocessingconfigpmmapper/libraries/LogReader.pyc b/csit/tests/filesprocessingconfigpmmapper/libraries/LogReader.pyc new file mode 100644 index 0000000..d8e936c Binary files /dev/null and b/csit/tests/filesprocessingconfigpmmapper/libraries/LogReader.pyc differ diff --git a/csit/tests/pmmapper/__init__.robot b/csit/tests/pmmapper/__init__.robot new file mode 100644 index 0000000..3e4501c --- /dev/null +++ b/csit/tests/pmmapper/__init__.robot @@ -0,0 +1,2 @@ +*** Settings *** +Documentation PM Mapper Testcases diff --git a/csit/tests/pmmapper/assets/.gitattributes b/csit/tests/pmmapper/assets/.gitattributes new file mode 100644 index 0000000..57cdc50 --- /dev/null +++ b/csit/tests/pmmapper/assets/.gitattributes @@ -0,0 +1 @@ +*.gz binary diff --git a/csit/tests/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml b/csit/tests/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml new file mode 100644 index 0000000..fadc8a6 --- /dev/null +++ b/csit/tests/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + attTCHSeizures + succTCHSeizures + attImmediateAssignProcs + succImmediateAssignProcs + + 234 + 345 + 567 + 789 + + + 890 + 901 + 123 + 234 + + + 456 + 567 + 678 + 789 + true + + + + + + + attTCHSeizures1 + succTCHSeizures2 + attImmediateAssignProcs3 + succImmediateAssignProcs4 + + 4 + 86,87,2,6,77,96,75,33,24 + 40 + 90 + false + + + + + + + attTCHSeizures5 + succTCHSeizures6 + attImmediateAssignProcs7 + succImmediateAssignProcs8 + + 238 + 344 + 563 + 787 + + + 898 + 905 + 127 + 238 + + + 454 + 569 + 672 + 785 + true + + + + + + + diff --git a/csit/tests/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml.gz b/csit/tests/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml.gz new file mode 100644 index 0000000..32865fc Binary files /dev/null and b/csit/tests/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml.gz differ diff --git a/csit/tests/pmmapper/assets/A_no_managed_element.xml b/csit/tests/pmmapper/assets/A_no_managed_element.xml new file mode 100644 index 0000000..23e5c21 --- /dev/null +++ b/csit/tests/pmmapper/assets/A_no_managed_element.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + a + b + c + + 86 + 67 + 14 + false + + + + + + + \ No newline at end of file diff --git a/csit/tests/pmmapper/assets/A_no_measdata.xml b/csit/tests/pmmapper/assets/A_no_measdata.xml new file mode 100644 index 0000000..855b2e9 --- /dev/null +++ b/csit/tests/pmmapper/assets/A_no_measdata.xml @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/csit/tests/pmmapper/assets/C20190328.0000-0015.xml b/csit/tests/pmmapper/assets/C20190328.0000-0015.xml new file mode 100644 index 0000000..b6a3b43 --- /dev/null +++ b/csit/tests/pmmapper/assets/C20190328.0000-0015.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + z1 a1 zz1 b1 + + 1 11 111 1111 + false + + + + + + + + + + z2 a2 zz2 b2 + + 2 22 222 2222 + false + + + + + + + + + + z3 a3 zz3 b3 + + 3 33 333 3333 + false + + + + + + + diff --git a/csit/tests/pmmapper/assets/diff_vendor_metadata.json b/csit/tests/pmmapper/assets/diff_vendor_metadata.json new file mode 100644 index 0000000..0abf8e3 --- /dev/null +++ b/csit/tests/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/csit/tests/pmmapper/assets/new_radio/A20181004.0000-1000-0015-1000_5G.xml b/csit/tests/pmmapper/assets/new_radio/A20181004.0000-1000-0015-1000_5G.xml new file mode 100644 index 0000000..8d42d62 --- /dev/null +++ b/csit/tests/pmmapper/assets/new_radio/A20181004.0000-1000-0015-1000_5G.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + attTCHSeizures + succTCHSeizures + attImmediateAssignProcs + succImmediateAssignProcs + + 234 + 345 + 567 + 789 + + + 890 + 901 + 123 + 234 + + + 456 + 567 + 678 + 789 + true + + + + + + + attTCHSeizures1 + succTCHSeizures2 + attImmediateAssignProcs3 + succImmediateAssignProcs4 + + 4 + 86,87,2,6,77,96,75,33,24 + 40 + 90 + false + + + + + + + attTCHSeizures5 + succTCHSeizures6 + attImmediateAssignProcs7 + succImmediateAssignProcs8 + + 238 + 344 + 563 + 787 + + + 898 + 905 + 127 + 238 + + + 454 + 569 + 672 + 785 + true + + + + + + + diff --git a/csit/tests/pmmapper/assets/new_radio/C20190329.0000-0015.xml b/csit/tests/pmmapper/assets/new_radio/C20190329.0000-0015.xml new file mode 100644 index 0000000..9c1b985 --- /dev/null +++ b/csit/tests/pmmapper/assets/new_radio/C20190329.0000-0015.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + z1 a1 zz1 b1 + + 1 11 111 1111 + false + + + + + + + + + + attTCHSeizures succTCHSeizures2 zz2 b2 + + 2 22 222 2222 + false + + + + + + + + + + z3 a3 zz3 succImmediateAssignProcs8 + + 3 33 333 3333 + false + + + + + + + diff --git a/csit/tests/pmmapper/assets/new_radio/PM202007171301+020024C202007171207+0200-1215+0200_45678.xml b/csit/tests/pmmapper/assets/new_radio/PM202007171301+020024C202007171207+0200-1215+0200_45678.xml new file mode 100644 index 0000000..8d42d62 --- /dev/null +++ b/csit/tests/pmmapper/assets/new_radio/PM202007171301+020024C202007171207+0200-1215+0200_45678.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + attTCHSeizures + succTCHSeizures + attImmediateAssignProcs + succImmediateAssignProcs + + 234 + 345 + 567 + 789 + + + 890 + 901 + 123 + 234 + + + 456 + 567 + 678 + 789 + true + + + + + + + attTCHSeizures1 + succTCHSeizures2 + attImmediateAssignProcs3 + succImmediateAssignProcs4 + + 4 + 86,87,2,6,77,96,75,33,24 + 40 + 90 + false + + + + + + + attTCHSeizures5 + succTCHSeizures6 + attImmediateAssignProcs7 + succImmediateAssignProcs8 + + 238 + 344 + 563 + 787 + + + 898 + 905 + 127 + 238 + + + 454 + 569 + 672 + 785 + true + + + + + + + diff --git a/csit/tests/pmmapper/assets/new_radio/valid_metadata.json b/csit/tests/pmmapper/assets/new_radio/valid_metadata.json new file mode 100644 index 0000000..f75adb8 --- /dev/null +++ b/csit/tests/pmmapper/assets/new_radio/valid_metadata.json @@ -0,0 +1,12 @@ +{ + "productName": "gnb", + "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.28.532#measData", + "fileFormatVersion": "V9" +} diff --git a/csit/tests/pmmapper/assets/pm_filter_config.json b/csit/tests/pmmapper/assets/pm_filter_config.json new file mode 100644 index 0000000..79e3f98 --- /dev/null +++ b/csit/tests/pmmapper/assets/pm_filter_config.json @@ -0,0 +1,42 @@ +{ + "pm-mapper-filter": { + "filters":[{ + "pmDefVsn": "1.0", + "nfType": "gnb", + "vendor": "Ericsson", + "measTypes": ["attTCHSeizures","succTCHSeizures2","succImmediateAssignProcs8"] + }] + }, + "key_store_path": "/opt/app/pm-mapper/etc/cert.jks", + "key_store_pass_path": "/opt/app/pm-mapper/etc/jks.pass", + "trust_store_path": "/opt/app/pm-mapper/etc/trust.jks", + "trust_store_pass_path": "/opt/app/pm-mapper/etc/trust.pass", + "dmaap_dr_delete_endpoint": "https://dmaap-dr-node:8443/delete", + "dmaap_dr_feed_name": "1", + "aaf_identity": "aaf_admin@people.osaaf.org", + "aaf_password": "demo123456!", + "enable_http": true, + "streams_publishes": { + "dmaap_publisher": { + "type": "message_router", + "dmaap_info": { + "topic_url": "http://message-router:3904/events/org.onap.dmaap.mr.VES_PM", + "client_role": "org.onap.dcae.pmPublisher", + "location": "csit-pmmapper", + "client_id": "1562763644939" + } + } + }, + "streams_subscribes": { + "dmaap_subscriber": { + "type": "data_router", + "dmaap_info": { + "username": "username", + "password": "password", + "location": "csit-pmmapper", + "delivery_url": "http://dcae-pm-mapper:8081/delivery", + "subscriber_id": 1 + } + } + } +} \ No newline at end of file diff --git a/csit/tests/pmmapper/assets/pm_filter_regex_config.json b/csit/tests/pmmapper/assets/pm_filter_regex_config.json new file mode 100644 index 0000000..5cd7146 --- /dev/null +++ b/csit/tests/pmmapper/assets/pm_filter_regex_config.json @@ -0,0 +1,42 @@ +{ + "pm-mapper-filter": { + "filters":[{ + "pmDefVsn": "1.0", + "nfType": "gnb", + "vendor": "Ericsson", + "measTypes": ["att.*"] + }] + }, + "key_store_path": "/opt/app/pm-mapper/etc/cert.jks.b64", + "key_store_pass_path": "/opt/app/pm-mapper/etc/jks.pass", + "trust_store_path": "/opt/app/pm-mapper/etc/trust.jks.b64", + "trust_store_pass_path": "/opt/app/pm-mapper/etc/trust.pass", + "dmaap_dr_delete_endpoint": "https://dmaap-dr-node:8443/delete", + "dmaap_dr_feed_name": "1", + "aaf_identity": "aaf_admin@people.osaaf.org", + "aaf_password": "demo123456!", + "enable_http": true, + "streams_publishes": { + "dmaap_publisher": { + "type": "message_router", + "dmaap_info": { + "topic_url": "http://message-router:3904/events/org.onap.dmaap.mr.VES_PM", + "client_role": "org.onap.dcae.pmPublisher", + "location": "csit-pmmapper", + "client_id": "1562763644939" + } + } + }, + "streams_subscribes": { + "dmaap_subscriber": { + "type": "data_router", + "dmaap_info": { + "username": "username", + "password": "password", + "location": "csit-pmmapper", + "delivery_url": "http://dcae-pm-mapper:8081/delivery", + "subscriber_id": 1 + } + } + } +} \ No newline at end of file diff --git a/csit/tests/pmmapper/assets/valid_metadata.json b/csit/tests/pmmapper/assets/valid_metadata.json new file mode 100644 index 0000000..da809d7 --- /dev/null +++ b/csit/tests/pmmapper/assets/valid_metadata.json @@ -0,0 +1,12 @@ +{ + "productName": "gnb", + "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/csit/tests/pmmapper/assets/vendor_filter_config.json b/csit/tests/pmmapper/assets/vendor_filter_config.json new file mode 100644 index 0000000..94d0911 --- /dev/null +++ b/csit/tests/pmmapper/assets/vendor_filter_config.json @@ -0,0 +1,42 @@ +{ + "pm-mapper-filter": { + "filters":[{ + "pmDefVsn": "1.0", + "nfType": "gnb", + "vendor": "Ericsson", + "measTypes": [] + }] + }, + "key_store_path": "/opt/app/pm-mapper/etc/cert.jks", + "key_store_pass_path": "/opt/app/pm-mapper/etc/jks.pass", + "trust_store_path": "/opt/app/pm-mapper/etc/trust.jks", + "trust_store_pass_path": "/opt/app/pm-mapper/etc/trust.pass", + "dmaap_dr_delete_endpoint": "https://dmaap-dr-node:8443/delete", + "dmaap_dr_feed_name": "1", + "aaf_identity": "aaf_admin@people.osaaf.org", + "aaf_password": "demo123456!", + "enable_http": true, + "streams_publishes": { + "dmaap_publisher": { + "type": "message_router", + "dmaap_info": { + "topic_url": "http://message-router:3904/events/org.onap.dmaap.mr.VES_PM", + "client_role": "org.onap.dcae.pmPublisher", + "location": "csit-pmmapper", + "client_id": "1562763644939" + } + } + }, + "streams_subscribes": { + "dmaap_subscriber": { + "type": "data_router", + "dmaap_info": { + "username": "username", + "password": "password", + "location": "csit-pmmapper", + "delivery_url": "http://dcae-pm-mapper:8081/delivery", + "subscriber_id": 1 + } + } + } +} \ No newline at end of file diff --git a/csit/tests/pmmapper/pmmapper.robot b/csit/tests/pmmapper/pmmapper.robot new file mode 100644 index 0000000..f23d33c --- /dev/null +++ b/csit/tests/pmmapper/pmmapper.robot @@ -0,0 +1,201 @@ +*** Settings *** +Documentation Testing PM Mapper functionality +Library Collections +Library OperatingSystem +Library RequestsLibrary +Library Process +Library String + +Test Setup Create Session mapper_session ${PMMAPPER_BASE_URL} +Test Teardown CleanSessionsAndLogs + +*** Variables *** +${CLI_EXEC_CLI_CONFIG} { head -n 100 | tail -50;} < /tmp/pmmapper.log +${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 +${RECONFIGURE_ENDPOINT} /reconfigure +${ASSETS_PATH} %{WORKSPACE}/tests/pmmapper/assets +${NO_MANAGED_ELEMENT_PATH} ${ASSETS_PATH}/A_no_managed_element.xml +${NO_MEASDATA_PATH} ${ASSETS_PATH}/A_no_measdata.xml +${VALID_METADATA_PATH} ${ASSETS_PATH}/valid_metadata.json +${NR_VALID_METADATA_PATH} ${ASSETS_PATH}/new_radio/valid_metadata.json +${DIFF_VENDOR_METADATA} ${ASSETS_PATH}/diff_vendor_metadata.json +${NON_XML_FILE} ${ASSETS_PATH}/diff_vendor_metadata.json +${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} ${ASSETS_PATH}/A20181002.0000-1000-0015-1000_5G.xml +${TYPE-C_PM_DATA_FILE_PATH} ${ASSETS_PATH}/C20190328.0000-0015.xml +${NR-TYPE-A_PM_DATA_FILE_PATH} ${ASSETS_PATH}/new_radio/A20181004.0000-1000-0015-1000_5G.xml +${NR-TYPE-C_PM_DATA_FILE_PATH} ${ASSETS_PATH}/new_radio/C20190329.0000-0015.xml +${NR-TYPE-PM_DATA_FILE_PATH} ${ASSETS_PATH}/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 @${ASSETS_PATH}/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 @${ASSETS_PATH}/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 @${ASSETS_PATH}/pm_filter_regex_config.json +${CLI_MESSAGE_ROUTER_TOPIC} curl http://${DMAAP_MR_IP}:3904/events/PM_MAPPER/CG1/C1?timeout=1000 > /tmp/mr.log +${CLI_MR_LOG} cat /tmp/mr.log + + +*** 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 + CheckLog ${CLI_EXEC_CLI_CONFIG} Received pm-mapper configuration from ConfigBinding Service + +Verify Health Check returns 200 when a REST GET request to healthcheck url + [Tags] PM_MAPPER_02 + [Documentation] Verify Health Check returns 200 when a REST GET request to healthcheck url + [Timeout] 1 minute + ${resp}= Get Request mapper_session ${HEALTHCHECK_ENDPOINT} + VerifyResponse ${resp.status_code} 200 + +Verify 3GPP PM Mapper responds appropriately when no metadata is provided + [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=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=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=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=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=5 + CheckLog ${CLI_EXEC_CLI_PM_LOG} MeasData is empty + 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=6 + CheckLog ${CLI_EXEC_CLI_PM_LOG} XML validation failed + 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=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 + [Tags] PM_MAPPER_08 + [Documentation] Verify 3GPP PM Mapper maps Type-A file and publish 3gpp perf VES evnets to message router. + [Timeout] 1 minute + ${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=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. + [Tags] PM_MAPPER_09 + [Documentation] Verify that PM Mapper correctly identifies a file that should not be mapped based on metadata filtering. + [Timeout] 1 minute + ${cli_cmd_output}= Run Process ${CLI_EXEC_VENDOR_FILTER} shell=yes + 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=9 + CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=9 + CheckLog ${CLI_EXEC_CLI_PM_LOG} Metadata does not match any filters + +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=10 + CheckLog ${CLI_EXEC_CLI_PM_LOG} PM measurement file must have an extension of .xml + 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 + [Documentation] Verify 3GPP PM Mapper maps an NR Type-A file and publish 3gpp perf VES evnets to message router. + [Timeout] 1 minute + ${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 + 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 + +Verify 3GPP PM Mapper maps Type-A file based on counter filtering with regexp + [Tags] PM_MAPPER_13 + [Documentation] Verify 3GPP PM Mapper maps Type-A file based on counter filtering with wildcards/regexp and publish 3gpp perf VES evnets to message router. + [Timeout] 1 minute + ${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=13 + CheckLog ${CLI_EXEC_CLI_PM_LOG} Successfully published VES events to messagerouter + +Verify that password receive from CBS are successfully encrypted + [Tags] PM_MAPPER_14 + [Documentation] Verify that password receive from CBS are successfully encrypted. + 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 + [Arguments] ${filepath} ${metadatapath} ${request_id} + ${pmdata}= Get File ${filepath} + ${metatdata} Get File ${metadatapath} + ${filename} Fetch From Right ${filepath} / + ${resp}= PutCall ${PUBLISH_NODE_URL}/${filename} ${request_id} ${pmdata} ${metatdata.replace("\n","")} pmmapper + VerifyResponse ${resp.status_code} 204 + Sleep 10s + +PutCall + [Arguments] ${url} ${request_id} ${data} ${meta} ${user} + ${headers}= Create Dictionary X-ONAP-RequestID=${request_id} X-DMAAP-DR-META=${meta} Content-Type=application/octet-stream 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} + +ClearLogs + Run Process ${CLI_EXEC_CLI_PM_LOG_CLEAR} shell=yes + +CleanSessionsAndLogs + Delete All Sessions + ClearLogs -- cgit