945cb81eea6d8cfc021237c49c51b848b9cf38e5
[integration/csit.git] / tests / dcaegen2-collectors-hv-ves / testcases / configuration.robot
1 # ============LICENSE_START=======================================================
2 # csit-dcaegen2-collectors-hv-ves
3 # ================================================================================
4 # Copyright (C) 2019 NOKIA
5 # ================================================================================
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #      http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 # ============LICENSE_END=========================================================
18
19 *** Settings ***
20 Library       DcaeAppSimulatorLibrary
21 Library       ConsulLibrary
22 Library       BuiltIn
23
24 Resource      resources/common-keywords.robot
25
26 Suite Setup       Configuration Changes Suite Setup
27 Suite Teardown    VES-HV Collector Suite Teardown
28 Test Teardown     VES-HV Collector Test Shutdown
29
30 *** Keywords ***
31 Configuration Changes Suite Setup
32     Log   Started Suite: VES-HV Client Configuration Changes
33     Configure Single xNF Simulator
34     Log   Suite setup finished
35
36 Change Configuration
37     [Arguments]   ${CONFIGURATION_JSON_FILEPATH}   ${MESSAGES_TOPIC}
38     Publish HV VES Configuration In Consul    ${CONSUL_API_URL}   ${CONFIGURATION_JSON_FILEPATH}
39     # Assure configuration fetch in hv-ves
40     Sleep  10
41
42 *** Test Cases ***
43 Configuration change
44     [Tags]   non-critical
45     [Documentation]   VES-HV Collector should adapt to changing configuration
46     # Given
47     Change Configuration   ${DIFFERENT_TOPIC_CONFIGURATION_JSON_FILEPATH}   ${SECOND_PERF3GPP_TOPIC}
48
49     # When
50     Send Messages From xNF Simulators   ${XNF_SIMULATOR}   ${XNF_VALID_MESSAGES_REQUEST}
51
52     # Then they are published to this topic
53     Wait until keyword succeeds   30 sec   3 sec
54     ...     Assert Dcae App Consumed   ${SECOND_PERF3GPP_TOPIC}   ${AMOUNT_1000}
55     Assert Dcae App Consumed   ${DEFAULT_PERF3GPP_TOPIC}   ${AMOUNT_0}
56
57     Log   First configuration change assertion passed
58     Reset DCAE App Simulator  ${DEFAULT_PERF3GPP_TOPIC}
59     Reset DCAE App Simulator  ${SECOND_PERF3GPP_TOPIC}
60
61     # Given configuration change
62     Change Configuration   ${HV_VES_CONFIGURATION_JSON_FILEPATH}   ${DEFAULT_PERF3GPP_TOPIC}
63
64     # When
65     Send Messages From xNF Simulators   ${XNF_SIMULATOR}   ${XNF_VALID_MESSAGES_REQUEST}
66
67     # Then they are published to this topic
68     Wait until keyword succeeds   30 sec   3 sec
69     ...     Assert Dcae App Consumed   ${DEFAULT_PERF3GPP_TOPIC}   ${AMOUNT_1000}
70     Assert Dcae App Consumed   ${SECOND_PERF3GPP_TOPIC}   ${AMOUNT_0}
71
72
73
74 *** Variables ***
75 ${AMOUNT_0}                                         0
76 ${AMOUNT_1000}                                      1000
77
78 ${HV_VES_SCENARIOS}                                 %{WORKSPACE}/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios
79 ${XNF_VALID_MESSAGES_REQUEST}                       ${HV_VES_SCENARIOS}/configuration-change/xnf-valid-messages-request.json
80
81 ${HV_VES_RESOURCES}                                 %{WORKSPACE}/tests/dcaegen2-collectors-hv-ves/testcases/resources
82 ${HV_VES_CONFIGURATION_JSON_FILEPATH}               ${HV_VES_RESOURCES}/hv-ves-configuration.json
83 ${DIFFERENT_TOPIC_CONFIGURATION_JSON_FILEPATH}      ${HV_VES_RESOURCES}/hv-ves-configuration-with-different-topic.json