aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dcaegen2-collectors-hv-ves/testcases
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dcaegen2-collectors-hv-ves/testcases')
-rw-r--r--tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot5
-rw-r--r--tests/dcaegen2-collectors-hv-ves/testcases/configuration.robot83
-rw-r--r--tests/dcaegen2-collectors-hv-ves/testcases/libraries/DcaeAppSimulatorLibrary.py2
-rw-r--r--tests/dcaegen2-collectors-hv-ves/testcases/libraries/HttpRequests.py2
-rw-r--r--tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot1
-rw-r--r--tests/dcaegen2-collectors-hv-ves/testcases/resources/hv-ves-configuration-with-different-topic.json12
-rw-r--r--tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/configuration-change/xnf-valid-messages-request.json24
7 files changed, 126 insertions, 3 deletions
diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot b/tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot
index 7fffd9c3..92b65cd6 100644
--- a/tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot
+++ b/tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot
@@ -34,12 +34,14 @@ 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}
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_CONTAINER_PORT} 8500
${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 00000000..945cb81e
--- /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 60c2c46d..ccad4308 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 @@ class DcaeAppSimulatorLibrary:
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 4aa55d6c..48205f2a 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 session_without_env():
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 ecf2d028..fee8bfd8 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 @@ Send Messages From xNF Simulators
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 00000000..d3d1f4c3
--- /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 00000000..adbcf2ab
--- /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