diff options
Diffstat (limited to 'csit/tests')
7 files changed, 145 insertions, 11 deletions
diff --git a/csit/tests/filesprocessingconfigpmmapper/filesprocessingconfigpmmapper.robot b/csit/tests/filesprocessingconfigpmmapper/filesprocessingconfigpmmapper.robot index 5f026d1..11b19b7 100644 --- a/csit/tests/filesprocessingconfigpmmapper/filesprocessingconfigpmmapper.robot +++ b/csit/tests/filesprocessingconfigpmmapper/filesprocessingconfigpmmapper.robot @@ -38,11 +38,14 @@ Verify that PM Mapper rejects 6-9 messages when limitRate is 1 and threads count ${alllogs}= GetLogsOutput ${filtered_logs}= GetFilteredLogs ${alllogs} ${testname} ${dropped_nr}= GetDroppedNumber ${filtered_logs} + ${received_nr}= GetReceivedNumber ${filtered_logs} Sleep 40s ${isCorrectDroppedCount}= Evaluate ${5} < ${dropped_nr} < ${10} + ${isCorrectReceivedCount}= Evaluate ${0} < ${received_nr} < ${5} SavePmMapperLogsAndDroppedCount config_1_1 ${dropped_nr} Should Be True ${isCorrectDroppedCount} Pm-mapper drop: ${dropped_nr} messages. Expected drop count: 6-9 + Should Be True ${isCorrectReceivedCount} Pm-mapper received ${received_nr} messages. Expected received count: 1-4 ClearLogs Verify that PM Mapper rejects 0 messages when limitRate is 10 and threads count is 1 @@ -58,10 +61,12 @@ Verify that PM Mapper rejects 0 messages when limitRate is 10 and threads count ${alllogs}= GetLogsOutput ${filtered_logs}= GetFilteredLogs ${alllogs} ${testname} ${dropped_nr}= GetDroppedNumber ${filtered_logs} + ${received_nr}= GetReceivedNumber ${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 + Should Be Equal As Numbers ${received_nr} 10 Pm-mapper received ${received_nr} messages. Expected received count: 10 ClearLogs Verify that PM Mapper rejects 0 messages when limitRate is 1 and threads count is 10 @@ -77,10 +82,12 @@ Verify that PM Mapper rejects 0 messages when limitRate is 1 and threads count i ${alllogs}= GetLogsOutput ${filtered_logs}= GetFilteredLogs ${alllogs} ${testname} ${dropped_nr}= GetDroppedNumber ${filtered_logs} + ${received_nr}= GetReceivedNumber ${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 + Should Be Equal As Numbers ${received_nr} 10 Pm-mapper received ${received_nr} messages. Expected received count: 10 ClearLogs *** Keywords *** @@ -133,7 +140,12 @@ GetFilteredLogs GetDroppedNumber [Arguments] ${logs_output} - ${number}= Get Number Of Dropped Messages ${logs_output} + ${number}= Get Number Of Element Occurrences In Logs ${logs_output} |429| + [Return] ${number} + +GetReceivedNumber + [Arguments] ${logs_output} + ${number}= Get Number Of Element Occurrences In Logs ${logs_output} |200| [Return] ${number} RestartPmmapper @@ -145,6 +157,6 @@ RestartPmmapper 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 + 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 index 036a8a1..e3186ca 100644 --- a/csit/tests/filesprocessingconfigpmmapper/libraries/DockerContainerManager.py +++ b/csit/tests/filesprocessingconfigpmmapper/libraries/DockerContainerManager.py @@ -28,8 +28,7 @@ class DockerContainerManager: environment = EnvsReader().read_env_list_from_file(path_to_env) environment.append("CONFIG_BINDING_SERVICE_SERVICE_PORT=10000") environment.append("CONFIG_BINDING_SERVICE=172.18.0.5") - environment.append("CONSUL_HOST=172.18.0.5") - environment.append("HOSTNAME=pmmapper") + environment.append("CBS_CLIENT_CONFIG_PATH=/app-config-input/application_config.yaml") client.containers.run( image=client_image, name=container_name, @@ -38,7 +37,7 @@ class DockerContainerManager: 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')], + mounts=[Mount(target='/opt/app/pm-mapper/etc/certs/', source='/var/tmp/', type='bind'), Mount(target='/app-config-input/application_config.yaml', source='/var/tmp/config.yaml', type='bind')], detach=True ) diff --git a/csit/tests/filesprocessingconfigpmmapper/libraries/LogReader.py b/csit/tests/filesprocessingconfigpmmapper/libraries/LogReader.py index 01718e3..cc4bf22 100644 --- a/csit/tests/filesprocessingconfigpmmapper/libraries/LogReader.py +++ b/csit/tests/filesprocessingconfigpmmapper/libraries/LogReader.py @@ -1,3 +1,22 @@ +# ============LICENSE_START======================================================= +# org.onap.dcae +# ================================================================================ +# Copyright (c) 2021-2022 Nokia. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# + import re class LogReader: @@ -14,8 +33,8 @@ class LogReader: 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_number_of_element_occurrences_in_logs(self, logs_output, element): + return len(list(filter(lambda line: element in line, logs_output))) def get_log_files_list(self, fileNames): files = fileNames.split() diff --git a/csit/tests/pmmapper/assets/pm_filter_config.yaml b/csit/tests/pmmapper/assets/pm_filter_config.yaml new file mode 100644 index 0000000..aa7f6c4 --- /dev/null +++ b/csit/tests/pmmapper/assets/pm_filter_config.yaml @@ -0,0 +1,36 @@ +--- +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 diff --git a/csit/tests/pmmapper/assets/pm_filter_regex_config.yaml b/csit/tests/pmmapper/assets/pm_filter_regex_config.yaml new file mode 100644 index 0000000..5cb564a --- /dev/null +++ b/csit/tests/pmmapper/assets/pm_filter_regex_config.yaml @@ -0,0 +1,34 @@ +--- +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 diff --git a/csit/tests/pmmapper/assets/vendor_filter_config.yaml b/csit/tests/pmmapper/assets/vendor_filter_config.yaml new file mode 100644 index 0000000..9a622ab --- /dev/null +++ b/csit/tests/pmmapper/assets/vendor_filter_config.yaml @@ -0,0 +1,33 @@ +--- +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 diff --git a/csit/tests/pmmapper/pmmapper.robot b/csit/tests/pmmapper/pmmapper.robot index 72801d0..b7131a3 100644 --- a/csit/tests/pmmapper/pmmapper.robot +++ b/csit/tests/pmmapper/pmmapper.robot @@ -31,9 +31,10 @@ ${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_EXEC_VENDOR_FILTER} cp ${ASSETS_PATH}/vendor_filter_config.yaml /var/tmp/config.yaml +${CLI_EXEC_PM_FILTER} cp ${ASSETS_PATH}/pm_filter_config.yaml /var/tmp/config.yaml +${CLI_EXEC_PM_FILTER_regex} cp ${ASSETS_PATH}/pm_filter_regex_config.yaml /var/tmp/config.yaml + ${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 |