Align HV-VES tests to use mounted config file instead of Consul 63/123763/3
authorTomasz Wrobel <tomasz.wrobel@nokia.com>
Wed, 1 Sep 2021 12:24:33 +0000 (14:24 +0200)
committerTomasz Wrobel <tomasz.wrobel@nokia.com>
Wed, 1 Sep 2021 13:32:02 +0000 (15:32 +0200)
Issue-ID: DCAEGEN2-2718
Signed-off-by: Tomasz Wrobel <tomasz.wrobel@nokia.com>
Change-Id: Ia16192b432eadab6e2d10ed1435e888f3e700da1

12 files changed:
plans/dcaegen2-collectors-hv-ves/testsuites/collector/configuration/hv-ves-configuration.yaml [new file with mode: 0644]
plans/dcaegen2-collectors-hv-ves/testsuites/docker-compose.yml
plans/dcaegen2-collectors-hv-ves/testsuites/env.sh
plans/dcaegen2-collectors-hv-ves/testsuites/env_local.sh
tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot
tests/dcaegen2-collectors-hv-ves/testcases/configuration.robot
tests/dcaegen2-collectors-hv-ves/testcases/libraries/ConsulLibrary.py [deleted file]
tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot
tests/dcaegen2-collectors-hv-ves/testcases/resources/hv-ves-configuration-with-different-topic.json [deleted file]
tests/dcaegen2-collectors-hv-ves/testcases/resources/hv-ves-configuration-with-different-topic.yaml [new file with mode: 0644]
tests/dcaegen2-collectors-hv-ves/testcases/resources/hv-ves-configuration.json [deleted file]
tests/dcaegen2-collectors-hv-ves/testcases/resources/hv-ves-configuration.yaml [new file with mode: 0644]

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 (file)
index 0000000..0eb41f1
--- /dev/null
@@ -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
index d89e82b..441ad35 100644 (file)
@@ -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
index e3e253b..27d7e0f 100755 (executable)
@@ -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}
index 1bd0ba1..88637a8 100755 (executable)
@@ -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}
index df47b86..5c8258f 100644 (file)
 
 *** 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
index 945cb81..5f87f89 100644 (file)
@@ -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 (file)
index 295c472..0000000
+++ /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
index b943935..fa7248a 100644 (file)
@@ -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 (file)
index 7cd830d..0000000
+++ /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 (file)
index 0000000..1b507c9
--- /dev/null
@@ -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 (file)
index 019e468..0000000
+++ /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 (file)
index 0000000..0eb41f1
--- /dev/null
@@ -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