diff options
author | Marcin Przybysz <marcin.przybysz@nokia.com> | 2021-03-02 07:25:10 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-03-02 07:25:10 +0000 |
commit | f767caa1d32370f28917f243227f2292105c071e (patch) | |
tree | 4f56a7bab9e9cedd8442334f0389c75640d909dc /tests/dcaegen2-pmmapper | |
parent | 527b6f87106cef6651cd6800709c1f2368926a84 (diff) | |
parent | 59bad158d7dd96c157fb9387db2de8ecb9214914 (diff) |
Merge "Add CSITs for Pm-mapper files processing performance"
Diffstat (limited to 'tests/dcaegen2-pmmapper')
11 files changed, 397 insertions, 0 deletions
diff --git a/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/__init__.robot b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/__init__.robot new file mode 100644 index 00000000..9eda6de0 --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/__init__.robot @@ -0,0 +1,2 @@ +*** Settings *** +Documentation Files Processing Config PM Mapper Testcases diff --git a/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/.gitattributes b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/.gitattributes new file mode 100644 index 00000000..57cdc503 --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/.gitattributes @@ -0,0 +1 @@ +*.gz binary diff --git a/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/ABigFile.xml b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/ABigFile.xml new file mode 100644 index 00000000..8a3bcf4d --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/ABigFile.xml @@ -0,0 +1,163 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="MeasDataCollection.xsl"?> +<measCollecFile xmlns="http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec" +xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +xsi:schemaLocation="http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec"> + <fileHeader fileFormatVersion="32.435 V7.0" vendorName="Company NN" dnPrefix="DC=a1.companyNN.com,SubNetwork=1,IRPAgent=1"> + <fileSender localDn="SubNetwork=CountryNN,MeContext=MEC-Gbg-1,ManagedElement=RNC-Gbg-1" elementType="RNC"/> + <measCollec beginTime="2000-03-01T14:00:00+02:00"/> + </fileHeader> + <measData> + <managedElement 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> + <measData> + <managedElement 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> + <measCollec endTime="2000-03-01T14:15:00+02:00"/> + </fileFooter> +</measCollecFile> diff --git a/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_10_1.env b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_10_1.env new file mode 100644 index 00000000..050d2f2a --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_10_1.env @@ -0,0 +1,3 @@ +PROCESSING_LIMIT_RATE=10 +THREADS_MULTIPLIER=1 +PROCESSING_THREADS_COUNT=1 diff --git a/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_1_1.env b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_1_1.env new file mode 100644 index 00000000..c138912b --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_1_1.env @@ -0,0 +1,3 @@ +PROCESSING_LIMIT_RATE=1 +THREADS_MULTIPLIER=1 +PROCESSING_THREADS_COUNT=1 diff --git a/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_1_10.env b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_1_10.env new file mode 100644 index 00000000..b4c290e8 --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_1_10.env @@ -0,0 +1,3 @@ +PROCESSING_LIMIT_RATE=1 +THREADS_MULTIPLIER=1 +PROCESSING_THREADS_COUNT=10 diff --git a/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/valid_metadata.json b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/valid_metadata.json new file mode 100644 index 00000000..da809d7b --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-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/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/files-processing-config-pmmapper.robot b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/files-processing-config-pmmapper.robot new file mode 100644 index 00000000..09a7de4f --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/files-processing-config-pmmapper.robot @@ -0,0 +1,148 @@ +*** 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 *** + +${NR_VALID_METADATA_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/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} %{WORKSPACE}/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/ABigFile.xml +${CONFIG_ENVS_1_1} %{WORKSPACE}/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_1_1.env +${CONFIG_ENVS_4_1} %{WORKSPACE}/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_4_1.env +${CONFIG_ENVS_10_1} %{WORKSPACE}/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_10_1.env +${CONFIG_ENVS_1_10} %{WORKSPACE}/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/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/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/libraries/DockerContainerManager.py b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/libraries/DockerContainerManager.py new file mode 100644 index 00000000..3e3ae58e --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/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/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/libraries/EnvsReader.py b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/libraries/EnvsReader.py new file mode 100644 index 00000000..cc60eed6 --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/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/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/libraries/LogReader.py b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/libraries/LogReader.py new file mode 100644 index 00000000..01718e35 --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/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 |