Align HV-VES tests to use mounted config file instead of Consul
[integration/csit.git] / tests / dcaegen2-collectors-hv-ves / testcases / resources / common-keywords.robot
1 # ============LICENSE_START=======================================================
2 # csit-dcaegen2-collectors-hv-ves
3 # ================================================================================
4 # Copyright (C) 2018-2021 NOKIA
5 # Modification copyright (C) 2021 Samsung Electronics Co., Ltd.
6 # ================================================================================
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #      http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 # ============LICENSE_END=========================================================
19
20 *** Settings ***
21 Library       XnfSimulatorLibrary
22 Library       VesHvContainersUtilsLibrary
23 Library       KafkaLibrary
24 Library       Collections
25
26 Library       OperatingSystem
27
28 *** Keywords ***
29 Configure Single xNF Simulator
30     ${XNF_PORTS_LIST}=    Create List    7000
31     ${XNF_SIMULATORS_ADDRESSES}=   Configure xNF Simulators   ${XNF_PORTS_LIST}
32     ${XNF_SIMULATOR}=   Get Slice From List   ${XNF_SIMULATORS_ADDRESSES}   0   1
33     Set Suite Variable   ${XNF_SIMULATOR}
34
35 Configure xNF Simulators Using Valid Certificates On Ports
36     [Arguments]    ${XNF_PORTS_LIST}
37     ${VALID_XNF_SIMULATORS_ADDRESSES}=   Configure xNF Simulators   ${XNF_PORTS_LIST}
38     Set Suite Variable    ${VALID_XNF_SIMULATORS_ADDRESSES}
39
40 Configure xNF Simulators
41     [Arguments]    ${XNF_PORTS_LIST}
42     ...            ${should_use_valid_certs}=${true}
43     ...            ${should_disable_ssl}=${false}
44     ...            ${should_connect_to_unencrypted_hv_ves}=${false}
45     ${XNF_SIMULATORS_ADDRESSES}=   Start Xnf Simulators   ${XNF_PORTS_LIST}
46     ...                                                           ${should_use_valid_certs}
47     ...                                                           ${should_disable_ssl}
48     ...                                                           ${should_connect_to_unencrypted_hv_ves}
49     [Return]   ${XNF_SIMULATORS_ADDRESSES}
50
51 Get xNF Simulators Using Valid Certificates
52     [Arguments]  ${AMOUNT}=1
53     ${SIMULATORS}=   Get Slice From List   ${VALID_XNF_SIMULATORS_ADDRESSES}   0   ${AMOUNT}
54     [Return]   ${SIMULATORS}
55
56
57 Send Messages From xNF Simulators
58     [Arguments]    ${XNF_HOSTS_LIST}   ${MESSAGE_FILEPATH}
59     FOR   ${HOST}   IN    @{XNF_HOSTS_LIST}
60         ${XNF_SIM_API_ACCESS}=   Get xNF Sim Api Access Url   ${HTTP_METHOD_URL}   ${HOST}
61         ${XNF_SIM_API_URL}=  Catenate   SEPARATOR=   ${XNF_SIM_API_ACCESS}   ${XNF_SIM_API_PATH}
62         Send messages   ${XNF_SIM_API_URL}   ${MESSAGE_FILEPATH}
63     END
64
65 VES-HV Collector Test Shutdown
66     Reset DCAE App Simulator  ${DEFAULT_PERF3GPP_TOPIC}
67     Reset DCAE App Simulator  ${SECOND_PERF3GPP_TOPIC}
68     Reset DCAE App Simulator  ${DEFAULT_STNDDEFINED_3GPP_HEARTBEAT_TOPIC}
69
70
71 VES-HV Collector Suite Teardown
72     Log Kafka Status
73     Stop And Remove All Xnf Simulators   ${SUITE NAME}
74
75 Set New Mounted Configuration
76     [Arguments]   ${NEW_CONFIGURATION_FILE_PATH}
77     Copy File   ${NEW_CONFIGURATION_FILE_PATH}    ${HV_VES_MOUNTED_CONFIGURATION_FILE_PATH}
78
79 *** Variables ***
80 ${HTTP_METHOD_URL}                             http://
81
82 ${XNF_SIM_API_PATH}                            /simulator/async
83
84 ${HV_VES_MOUNTED_CONFIGURATION_FILE_PATH}      %{WORKSPACE}/plans/dcaegen2-collectors-hv-ves/testsuites/collector/configuration/hv-ves-configuration.yaml