From 70d73b28bf67092efc4c7983ac04ad759f5056e9 Mon Sep 17 00:00:00 2001 From: Tomasz Wrobel Date: Wed, 1 Sep 2021 14:24:33 +0200 Subject: [PATCH] Align HV-VES tests to use mounted config file instead of Consul Issue-ID: DCAEGEN2-2718 Signed-off-by: Tomasz Wrobel Change-Id: Ia16192b432eadab6e2d10ed1435e888f3e700da1 --- .../configuration/hv-ves-configuration.yaml | 17 +++++++++++ .../testsuites/docker-compose.yml | 28 ++---------------- plans/dcaegen2-collectors-hv-ves/testsuites/env.sh | 1 + .../testsuites/env_local.sh | 1 + .../testcases/__init__.robot | 10 +++---- .../testcases/configuration.robot | 7 ++--- .../testcases/libraries/ConsulLibrary.py | 33 ---------------------- .../testcases/resources/common-keywords.robot | 7 +++++ .../hv-ves-configuration-with-different-topic.json | 16 ----------- .../hv-ves-configuration-with-different-topic.yaml | 9 ++++++ .../testcases/resources/hv-ves-configuration.json | 27 ------------------ .../testcases/resources/hv-ves-configuration.yaml | 17 +++++++++++ 12 files changed, 61 insertions(+), 112 deletions(-) create mode 100644 plans/dcaegen2-collectors-hv-ves/testsuites/collector/configuration/hv-ves-configuration.yaml delete mode 100644 tests/dcaegen2-collectors-hv-ves/testcases/libraries/ConsulLibrary.py delete mode 100644 tests/dcaegen2-collectors-hv-ves/testcases/resources/hv-ves-configuration-with-different-topic.json create mode 100644 tests/dcaegen2-collectors-hv-ves/testcases/resources/hv-ves-configuration-with-different-topic.yaml delete mode 100644 tests/dcaegen2-collectors-hv-ves/testcases/resources/hv-ves-configuration.json create mode 100644 tests/dcaegen2-collectors-hv-ves/testcases/resources/hv-ves-configuration.yaml diff --git a/plans/dcaegen2-collectors-hv-ves/testsuites/collector/configuration/hv-ves-configuration.yaml b/plans/dcaegen2-collectors-hv-ves/testsuites/collector/configuration/hv-ves-configuration.yaml new file mode 100644 index 00000000..0eb41f15 --- /dev/null +++ b/plans/dcaegen2-collectors-hv-ves/testsuites/collector/configuration/hv-ves-configuration.yaml @@ -0,0 +1,17 @@ +streams_publishes: + perf3gpp: + aaf_credentials: + password: admin_secret + username: admin + kafka_info: + bootstrap_servers: kafka:9092 + topic_name: TEST_HV_VES_PERF3GPP + type: kafka + ves-3gpp-heartbeat: + aaf_credentials: + password: admin_secret + username: admin + kafka_info: + bootstrap_servers: kafka:9092 + topic_name: TEST_SEC_3GPP_HEARTBEAT_OUTPUT + type: kafka diff --git a/plans/dcaegen2-collectors-hv-ves/testsuites/docker-compose.yml b/plans/dcaegen2-collectors-hv-ves/testsuites/docker-compose.yml index d89e82bb..441ad35c 100644 --- a/plans/dcaegen2-collectors-hv-ves/testsuites/docker-compose.yml +++ b/plans/dcaegen2-collectors-hv-ves/testsuites/docker-compose.yml @@ -70,30 +70,6 @@ services: networks: - hv-ves-default - # - # Consul / CBS - # - - consul-server: - image: docker.io/consul:1.0.6 - ports: - - "8500:8500" - volumes: - - ./consul/:/consul/config - networks: - - hv-ves-default - - config-binding-service: - image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.platform.configbinding:2.5.2 - ports: - - "10000:10000" - environment: - - CONSUL_HOST - depends_on: - - consul-server - networks: - - hv-ves-default - # # DCAE HV VES Collector # @@ -110,6 +86,7 @@ services: - CONSUL_HOST - CONFIG_BINDING_SERVICE - CONFIG_BINDING_SERVICE_SERVICE_PORT + - CBS_CLIENT_CONFIG_PATH healthcheck: interval: 10s timeout: 5s @@ -118,7 +95,6 @@ services: volumes: - ./collector/:/etc/ves-hv/ depends_on: - - config-binding-service - kafka networks: - hv-ves-default @@ -135,6 +111,7 @@ services: - CONSUL_HOST - CONFIG_BINDING_SERVICE - CONFIG_BINDING_SERVICE_SERVICE_PORT + - CBS_CLIENT_CONFIG_PATH healthcheck: interval: 10s timeout: 5s @@ -143,7 +120,6 @@ services: volumes: - ./collector/:/etc/ves-hv/ depends_on: - - config-binding-service - kafka networks: - hv-ves-default diff --git a/plans/dcaegen2-collectors-hv-ves/testsuites/env.sh b/plans/dcaegen2-collectors-hv-ves/testsuites/env.sh index e3e253b6..27d7e0f9 100755 --- a/plans/dcaegen2-collectors-hv-ves/testsuites/env.sh +++ b/plans/dcaegen2-collectors-hv-ves/testsuites/env.sh @@ -24,6 +24,7 @@ export JAVA_OPTS="-Dio.netty.leakDetection.level=paranoid" export CONSUL_HOST="consul-server" export CONFIG_BINDING_SERVICE="config-binding-service" export CONFIG_BINDING_SERVICE_SERVICE_PORT="10000" +export CBS_CLIENT_CONFIG_PATH=/etc/ves-hv/configuration/hv-ves-configuration.yaml export ONAP_NEXUS_REGISTRY="nexus3.onap.org:10001" export DOCKER_REGISTRY=${ONAP_NEXUS_REGISTRY} diff --git a/plans/dcaegen2-collectors-hv-ves/testsuites/env_local.sh b/plans/dcaegen2-collectors-hv-ves/testsuites/env_local.sh index 1bd0ba1f..88637a85 100755 --- a/plans/dcaegen2-collectors-hv-ves/testsuites/env_local.sh +++ b/plans/dcaegen2-collectors-hv-ves/testsuites/env_local.sh @@ -24,6 +24,7 @@ export JAVA_OPTS="-Dio.netty.leakDetection.level=paranoid" export CONSUL_HOST="consul-server" export CONFIG_BINDING_SERVICE="config-binding-service" export CONFIG_BINDING_SERVICE_SERVICE_PORT="10000" +export CBS_CLIENT_CONFIG_PATH=/etc/ves-hv/configuration/hv-ves-configuration.yaml export ONAP_NEXUS_REGISTRY="nexus3.onap.org:10001" export DOCKER_REGISTRY=${ONAP_NEXUS_REGISTRY} diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot b/tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot index df47b861..5c8258f3 100644 --- a/tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot +++ b/tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot @@ -18,9 +18,10 @@ *** Settings *** Library DcaeAppSimulatorLibrary -Library ConsulLibrary Library VesHvContainersUtilsLibrary +Resource resources/common-keywords.robot + Suite Setup HV-VES Collector Suites Setup *** Keywords *** @@ -32,10 +33,7 @@ HV-VES Collector Suites Setup Configure collector - ${CONSUL_API_ACCESS}= Get Consul Api Access Url ${HTTP_METHOD_URL} ${CONSUL_CONTAINER_HOST} ${CONSUL_CONTAINER_PORT} - ${CONSUL_API_URL}= Catenate SEPARATOR= ${CONSUL_API_ACCESS} ${CONSUL_HV_VES_CONFIGURATION_KEY_PATH} - Set Suite Variable ${CONSUL_API_URL} children=True - Publish HV VES Configuration In Consul ${CONSUL_API_URL} ${HV_VES_CONFIGURATION_JSON_FILEPATH} + Set New Mounted Configuration ${HV_VES_CONFIGURATION_JSON_FILEPATH} Configure Dcae App Wait until keyword succeeds 10 sec 5 sec @@ -58,4 +56,4 @@ ${SECOND_PERF3GPP_TOPIC} TEST_HV_VES_PERF3GPP_BUT_WITH_EXT ${DEFAULT_STNDDEFINED_3GPP_HEARTBEAT_TOPIC} TEST_SEC_3GPP_HEARTBEAT_OUTPUT ${HV_VES_RESOURCES} %{WORKSPACE}/tests/dcaegen2-collectors-hv-ves/testcases/resources -${HV_VES_CONFIGURATION_JSON_FILEPATH} ${HV_VES_RESOURCES}/hv-ves-configuration.json +${HV_VES_CONFIGURATION_JSON_FILEPATH} ${HV_VES_RESOURCES}/hv-ves-configuration.yaml diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/configuration.robot b/tests/dcaegen2-collectors-hv-ves/testcases/configuration.robot index 945cb81e..5f87f89b 100644 --- a/tests/dcaegen2-collectors-hv-ves/testcases/configuration.robot +++ b/tests/dcaegen2-collectors-hv-ves/testcases/configuration.robot @@ -18,7 +18,6 @@ *** Settings *** Library DcaeAppSimulatorLibrary -Library ConsulLibrary Library BuiltIn Resource resources/common-keywords.robot @@ -35,7 +34,7 @@ Configuration Changes Suite Setup Change Configuration [Arguments] ${CONFIGURATION_JSON_FILEPATH} ${MESSAGES_TOPIC} - Publish HV VES Configuration In Consul ${CONSUL_API_URL} ${CONFIGURATION_JSON_FILEPATH} + Set New Mounted Configuration ${CONFIGURATION_JSON_FILEPATH} # Assure configuration fetch in hv-ves Sleep 10 @@ -79,5 +78,5 @@ ${HV_VES_SCENARIOS} %{WORKSPACE}/tests/dcaegen2- ${XNF_VALID_MESSAGES_REQUEST} ${HV_VES_SCENARIOS}/configuration-change/xnf-valid-messages-request.json ${HV_VES_RESOURCES} %{WORKSPACE}/tests/dcaegen2-collectors-hv-ves/testcases/resources -${HV_VES_CONFIGURATION_JSON_FILEPATH} ${HV_VES_RESOURCES}/hv-ves-configuration.json -${DIFFERENT_TOPIC_CONFIGURATION_JSON_FILEPATH} ${HV_VES_RESOURCES}/hv-ves-configuration-with-different-topic.json +${HV_VES_CONFIGURATION_JSON_FILEPATH} ${HV_VES_RESOURCES}/hv-ves-configuration.yaml +${DIFFERENT_TOPIC_CONFIGURATION_JSON_FILEPATH} ${HV_VES_RESOURCES}/hv-ves-configuration-with-different-topic.yaml diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/libraries/ConsulLibrary.py b/tests/dcaegen2-collectors-hv-ves/testcases/libraries/ConsulLibrary.py deleted file mode 100644 index 295c4721..00000000 --- a/tests/dcaegen2-collectors-hv-ves/testcases/libraries/ConsulLibrary.py +++ /dev/null @@ -1,33 +0,0 @@ -# ============LICENSE_START======================================================= -# csit-dcaegen2-collectors-hv-ves -# ================================================================================ -# Copyright (C) 2018 NOKIA -# ================================================================================ -# 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========================================================= -from robot.api import logger -import HttpRequests - -CONSUL_NAME = "Consul" - -class ConsulLibrary: - - def publish_hv_ves_configuration_in_consul(self, consul_url, consul_configuration_filepath): - logger.info("Reading consul configuration file from: " + consul_configuration_filepath) - file = open(consul_configuration_filepath, "rb") - data = file.read() - file.close() - - logger.info("PUT at: " + consul_url) - resp = HttpRequests.session_without_env().put(consul_url, data=data, timeout=5) - HttpRequests.checkStatusCode(resp.status_code, CONSUL_NAME) \ No newline at end of file diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot b/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot index b943935d..fa7248a9 100644 --- a/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot +++ b/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot @@ -23,6 +23,8 @@ Library VesHvContainersUtilsLibrary Library KafkaLibrary Library Collections +Library OperatingSystem + *** Keywords *** Configure Single xNF Simulator ${XNF_PORTS_LIST}= Create List 7000 @@ -70,8 +72,13 @@ VES-HV Collector Suite Teardown Log Kafka Status Stop And Remove All Xnf Simulators ${SUITE NAME} +Set New Mounted Configuration + [Arguments] ${NEW_CONFIGURATION_FILE_PATH} + Copy File ${NEW_CONFIGURATION_FILE_PATH} ${HV_VES_MOUNTED_CONFIGURATION_FILE_PATH} + *** Variables *** ${HTTP_METHOD_URL} http:// ${XNF_SIM_API_PATH} /simulator/async +${HV_VES_MOUNTED_CONFIGURATION_FILE_PATH} %{WORKSPACE}/plans/dcaegen2-collectors-hv-ves/testsuites/collector/configuration/hv-ves-configuration.yaml diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/resources/hv-ves-configuration-with-different-topic.json b/tests/dcaegen2-collectors-hv-ves/testcases/resources/hv-ves-configuration-with-different-topic.json deleted file mode 100644 index 7cd830d6..00000000 --- a/tests/dcaegen2-collectors-hv-ves/testcases/resources/hv-ves-configuration-with-different-topic.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "streams_publishes": { - "perf3gpp": { - "type": "kafka", - "aaf_credentials": { - "username": "admin", - "password": "admin_secret" - }, - "kafka_info": { - "bootstrap_servers": "kafka:9092", - "topic_name": "TEST_HV_VES_PERF3GPP_BUT_WITH_EXTRA_WORDS" - } - } - } -} - diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/resources/hv-ves-configuration-with-different-topic.yaml b/tests/dcaegen2-collectors-hv-ves/testcases/resources/hv-ves-configuration-with-different-topic.yaml new file mode 100644 index 00000000..1b507c9b --- /dev/null +++ b/tests/dcaegen2-collectors-hv-ves/testcases/resources/hv-ves-configuration-with-different-topic.yaml @@ -0,0 +1,9 @@ +streams_publishes: + perf3gpp: + aaf_credentials: + password: admin_secret + username: admin + kafka_info: + bootstrap_servers: kafka:9092 + topic_name: TEST_HV_VES_PERF3GPP_BUT_WITH_EXTRA_WORDS + type: kafka diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/resources/hv-ves-configuration.json b/tests/dcaegen2-collectors-hv-ves/testcases/resources/hv-ves-configuration.json deleted file mode 100644 index 019e4680..00000000 --- a/tests/dcaegen2-collectors-hv-ves/testcases/resources/hv-ves-configuration.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "streams_publishes": { - "perf3gpp": { - "type": "kafka", - "aaf_credentials": { - "username": "admin", - "password": "admin_secret" - }, - "kafka_info": { - "bootstrap_servers": "kafka:9092", - "topic_name": "TEST_HV_VES_PERF3GPP" - } - }, - "ves-3gpp-heartbeat": { - "type": "kafka", - "aaf_credentials": { - "username": "admin", - "password": "admin_secret" - }, - "kafka_info": { - "bootstrap_servers": "kafka:9092", - "topic_name": "TEST_SEC_3GPP_HEARTBEAT_OUTPUT" - } - } - } -} - diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/resources/hv-ves-configuration.yaml b/tests/dcaegen2-collectors-hv-ves/testcases/resources/hv-ves-configuration.yaml new file mode 100644 index 00000000..0eb41f15 --- /dev/null +++ b/tests/dcaegen2-collectors-hv-ves/testcases/resources/hv-ves-configuration.yaml @@ -0,0 +1,17 @@ +streams_publishes: + perf3gpp: + aaf_credentials: + password: admin_secret + username: admin + kafka_info: + bootstrap_servers: kafka:9092 + topic_name: TEST_HV_VES_PERF3GPP + type: kafka + ves-3gpp-heartbeat: + aaf_credentials: + password: admin_secret + username: admin + kafka_info: + bootstrap_servers: kafka:9092 + topic_name: TEST_SEC_3GPP_HEARTBEAT_OUTPUT + type: kafka -- 2.16.6