Merge "Add type to topics definitions"
diff --git a/plans/dcaegen2-collectors-hv-ves/testsuites/env.sh b/plans/dcaegen2-collectors-hv-ves/testsuites/env.sh
index a5a0a4f..0531484 100755
--- a/plans/dcaegen2-collectors-hv-ves/testsuites/env.sh
+++ b/plans/dcaegen2-collectors-hv-ves/testsuites/env.sh
@@ -18,7 +18,7 @@
 # ============LICENSE_END=========================================================
 
 # using WORKSPACE variable defined in run-csit.sh
-export ROBOT_VARIABLES="--pythonpath ${WORKSPACE}/tests/dcaegen2-collectors-hv-ves/testcases/libraries"
+export ROBOT_VARIABLES="--pythonpath ${WORKSPACE}/tests/dcaegen2-collectors-hv-ves/testcases/libraries --noncritical non-critical"
 
 export JAVA_OPTS="-Dio.netty.leakDetection.level=paranoid"
 export CONSUL_HOST="consul-server"
diff --git a/plans/dcaegen2-collectors-hv-ves/testsuites/env_local.sh b/plans/dcaegen2-collectors-hv-ves/testsuites/env_local.sh
index 280f0c4..20b538b 100755
--- a/plans/dcaegen2-collectors-hv-ves/testsuites/env_local.sh
+++ b/plans/dcaegen2-collectors-hv-ves/testsuites/env_local.sh
@@ -18,7 +18,7 @@
 # ============LICENSE_END=========================================================
 
 export WORKSPACE=$(git rev-parse --show-toplevel)
-export ROBOT_VARIABLES="--pythonpath ${WORKSPACE}/tests/dcaegen2-collectors-hv-ves/testcases/libraries"
+export ROBOT_VARIABLES="--pythonpath ${WORKSPACE}/tests/dcaegen2-collectors-hv-ves/testcases/libraries --noncritical non-critical"
 
 export JAVA_OPTS="-Dio.netty.leakDetection.level=paranoid"
 export CONSUL_HOST="consul-server"
diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot b/tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot
index 7fffd9c..92b65cd 100644
--- a/tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot
+++ b/tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot
@@ -34,12 +34,14 @@
 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}
 
 Configure Dcae App
     Wait until keyword succeeds   10 sec   5 sec
-    ...    Configure Dcae App Simulator To Consume Messages From Topics   ${DEFAULT_PERF3GPP_TOPIC}
+    ...    Configure Dcae App Simulator To Consume Messages From Topics   ${DEFAULT_PERF3GPP_TOPIC},${SECOND_PERF3GPP_TOPIC}
     Set Suite Variable   ${DEFAULT_PERF3GPP_TOPIC}   children=True
+    Set Suite Variable   ${SECOND_PERF3GPP_TOPIC}    children=True
 
 
 *** Variables ***
@@ -50,6 +52,7 @@
 ${CONSUL_HV_VES_CONFIGURATION_KEY_PATH}        /v1/kv/dcae-hv-ves-collector
 
 ${DEFAULT_PERF3GPP_TOPIC}                      TEST_HV_VES_PERF3GPP
+${SECOND_PERF3GPP_TOPIC}                       TEST_HV_VES_PERF3GPP_BUT_WITH_EXTRA_WORDS
 
 ${HV_VES_RESOURCES}                            %{WORKSPACE}/tests/dcaegen2-collectors-hv-ves/testcases/resources
 ${HV_VES_CONFIGURATION_JSON_FILEPATH}          ${HV_VES_RESOURCES}/hv-ves-configuration.json
diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/configuration.robot b/tests/dcaegen2-collectors-hv-ves/testcases/configuration.robot
new file mode 100644
index 0000000..945cb81
--- /dev/null
+++ b/tests/dcaegen2-collectors-hv-ves/testcases/configuration.robot
@@ -0,0 +1,83 @@
+# ============LICENSE_START=======================================================
+# csit-dcaegen2-collectors-hv-ves
+# ================================================================================
+# Copyright (C) 2019 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=========================================================
+
+*** Settings ***
+Library       DcaeAppSimulatorLibrary
+Library       ConsulLibrary
+Library       BuiltIn
+
+Resource      resources/common-keywords.robot
+
+Suite Setup       Configuration Changes Suite Setup
+Suite Teardown    VES-HV Collector Suite Teardown
+Test Teardown     VES-HV Collector Test Shutdown
+
+*** Keywords ***
+Configuration Changes Suite Setup
+    Log   Started Suite: VES-HV Client Configuration Changes
+    Configure Single xNF Simulator
+    Log   Suite setup finished
+
+Change Configuration
+    [Arguments]   ${CONFIGURATION_JSON_FILEPATH}   ${MESSAGES_TOPIC}
+    Publish HV VES Configuration In Consul    ${CONSUL_API_URL}   ${CONFIGURATION_JSON_FILEPATH}
+    # Assure configuration fetch in hv-ves
+    Sleep  10
+
+*** Test Cases ***
+Configuration change
+    [Tags]   non-critical
+    [Documentation]   VES-HV Collector should adapt to changing configuration
+    # Given
+    Change Configuration   ${DIFFERENT_TOPIC_CONFIGURATION_JSON_FILEPATH}   ${SECOND_PERF3GPP_TOPIC}
+
+    # When
+    Send Messages From xNF Simulators   ${XNF_SIMULATOR}   ${XNF_VALID_MESSAGES_REQUEST}
+
+    # Then they are published to this topic
+    Wait until keyword succeeds   30 sec   3 sec
+    ...     Assert Dcae App Consumed   ${SECOND_PERF3GPP_TOPIC}   ${AMOUNT_1000}
+    Assert Dcae App Consumed   ${DEFAULT_PERF3GPP_TOPIC}   ${AMOUNT_0}
+
+    Log   First configuration change assertion passed
+    Reset DCAE App Simulator  ${DEFAULT_PERF3GPP_TOPIC}
+    Reset DCAE App Simulator  ${SECOND_PERF3GPP_TOPIC}
+
+    # Given configuration change
+    Change Configuration   ${HV_VES_CONFIGURATION_JSON_FILEPATH}   ${DEFAULT_PERF3GPP_TOPIC}
+
+    # When
+    Send Messages From xNF Simulators   ${XNF_SIMULATOR}   ${XNF_VALID_MESSAGES_REQUEST}
+
+    # Then they are published to this topic
+    Wait until keyword succeeds   30 sec   3 sec
+    ...     Assert Dcae App Consumed   ${DEFAULT_PERF3GPP_TOPIC}   ${AMOUNT_1000}
+    Assert Dcae App Consumed   ${SECOND_PERF3GPP_TOPIC}   ${AMOUNT_0}
+
+
+
+*** Variables ***
+${AMOUNT_0}                                         0
+${AMOUNT_1000}                                      1000
+
+${HV_VES_SCENARIOS}                                 %{WORKSPACE}/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios
+${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
diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/libraries/DcaeAppSimulatorLibrary.py b/tests/dcaegen2-collectors-hv-ves/testcases/libraries/DcaeAppSimulatorLibrary.py
index 60c2c46..ccad430 100644
--- a/tests/dcaegen2-collectors-hv-ves/testcases/libraries/DcaeAppSimulatorLibrary.py
+++ b/tests/dcaegen2-collectors-hv-ves/testcases/libraries/DcaeAppSimulatorLibrary.py
@@ -47,7 +47,7 @@
 
     def assert_DCAE_app_consumed(self, topic, expected_messages_amount):
         app_url = MESSAGES_COUNT_PATH % topic
-        logger.info("GET at: " + app_url)
+        logger.info("GET at: " + str(app_url))
         resp = HttpRequests.session_without_env().get(app_url, timeout=10)
         HttpRequests.checkStatusCode(resp.status_code, DCAE_APP_NAME)
 
diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/libraries/HttpRequests.py b/tests/dcaegen2-collectors-hv-ves/testcases/libraries/HttpRequests.py
index 4aa55d6..48205f2 100644
--- a/tests/dcaegen2-collectors-hv-ves/testcases/libraries/HttpRequests.py
+++ b/tests/dcaegen2-collectors-hv-ves/testcases/libraries/HttpRequests.py
@@ -33,4 +33,4 @@
 def checkStatusCode(status_code, server_name):
     if status_code not in valid_status_codes:
         logger.error("Response status code from " + server_name + ": " + str(status_code))
-        raise (Exception(server_name + " returned status code " + status_code))
+        raise (Exception(server_name + " returned status code " + str(status_code)))
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 ecf2d02..fee8bfd 100644
--- a/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot
+++ b/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot
@@ -61,6 +61,7 @@
 
 VES-HV Collector Test Shutdown
     Reset DCAE App Simulator  ${DEFAULT_PERF3GPP_TOPIC}
+    Reset DCAE App Simulator  ${SECOND_PERF3GPP_TOPIC}
 
 
 VES-HV Collector Suite Teardown
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
new file mode 100644
index 0000000..d3d1f4c
--- /dev/null
+++ b/tests/dcaegen2-collectors-hv-ves/testcases/resources/hv-ves-configuration-with-different-topic.json
@@ -0,0 +1,12 @@
+{
+  "streams_publishes": {
+    "perf3gpp": {
+      "type": "kafka",
+      "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/scenarios/configuration-change/xnf-valid-messages-request.json b/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/configuration-change/xnf-valid-messages-request.json
new file mode 100644
index 0000000..adbcf2a
--- /dev/null
+++ b/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/configuration-change/xnf-valid-messages-request.json
@@ -0,0 +1,24 @@
+[
+  {
+    "commonEventHeader": {
+      "version": "sample-version",
+      "domain": "perf3gpp",
+      "sequence": 1,
+      "priority": 1,
+      "eventId": "sample-event-id",
+      "eventName": "sample-event-name",
+      "eventType": "sample-event-type",
+      "startEpochMicrosec": 120034455,
+      "lastEpochMicrosec": 120034455,
+      "nfNamingCode": "sample-nf-naming-code",
+      "nfcNamingCode": "sample-nfc-naming-code",
+      "reportingEntityId": "sample-reporting-entity-id",
+      "reportingEntityName": "sample-reporting-entity-name",
+      "sourceId": "sample-source-id",
+      "sourceName": "sample-source-name",
+      "vesEventListenerVersion": "7.2.0"
+    },
+    "messageType": "VALID",
+    "messagesAmount": 1000
+  }
+]
\ No newline at end of file
diff --git a/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot b/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot
index 5315cc3..a103c5c 100644
--- a/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot
+++ b/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot
@@ -26,15 +26,12 @@
 ${PUBLISH_NODE_URL}                      https://${DR_NODE_IP}:8443/publish/1
 ${TYPE-A_PM_DATA_FILE_PATH}              %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml
 ${TYPE-C_PM_DATA_FILE_PATH}              %{WORKSPACE}/tests/dcaegen2-pmmapper/pmmapper/assets/C20190328.0000-0015.xml
-${PUBLISH_CONTENT_TYPE}                  application/octet-stream
 ${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 @$WORKSPACE/tests/dcaegen2-pmmapper/pmmapper/assets/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 @$WORKSPACE/tests/dcaegen2-pmmapper/pmmapper/assets/pm_filter_config.json
-${CLI_RESTART_PMMAPPER}                  docker restart pmmapper
-${CLI_DELETE_SUB1}                       curl -i -X DELETE -H "Content-Type:application/vnd.dmaap-dr.subscription" -H "X-DMAAP-DR-ON-BEHALF-OF:DGL" -k https://localhost:8443/subs/1
-${CLI_DELETE_SUB2}                       curl -i -X DELETE -H "Content-Type:application/vnd.dmaap-dr.subscription" -H "X-DMAAP-DR-ON-BEHALF-OF:DGL" -k https://localhost:8443/subs/2
 ${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
@@ -148,7 +145,7 @@
     ${filename}                     Fetch From Right                 ${filepath}                /
     ${resp}=                        PutCall                          ${PUBLISH_NODE_URL}/${filename}        ${request_id}    ${pmdata}    ${metatdata.replace("\n","")}    pmmapper
     VerifyResponse                  ${resp.status_code}              204
-    Sleep                           5s
+    Sleep                           10s
 
 PutCall
     [Arguments]                     ${url}                           ${request_id}              ${data}            ${meta}          ${user}