b943935d95c6e64a1b2184dcbda7e7cd28517e51
[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 *** Keywords ***
27 Configure Single xNF Simulator
28     ${XNF_PORTS_LIST}=    Create List    7000
29     ${XNF_SIMULATORS_ADDRESSES}=   Configure xNF Simulators   ${XNF_PORTS_LIST}
30     ${XNF_SIMULATOR}=   Get Slice From List   ${XNF_SIMULATORS_ADDRESSES}   0   1
31     Set Suite Variable   ${XNF_SIMULATOR}
32
33 Configure xNF Simulators Using Valid Certificates On Ports
34     [Arguments]    ${XNF_PORTS_LIST}
35     ${VALID_XNF_SIMULATORS_ADDRESSES}=   Configure xNF Simulators   ${XNF_PORTS_LIST}
36     Set Suite Variable    ${VALID_XNF_SIMULATORS_ADDRESSES}
37
38 Configure xNF Simulators
39     [Arguments]    ${XNF_PORTS_LIST}
40     ...            ${should_use_valid_certs}=${true}
41     ...            ${should_disable_ssl}=${false}
42     ...            ${should_connect_to_unencrypted_hv_ves}=${false}
43     ${XNF_SIMULATORS_ADDRESSES}=   Start Xnf Simulators   ${XNF_PORTS_LIST}
44     ...                                                           ${should_use_valid_certs}
45     ...                                                           ${should_disable_ssl}
46     ...                                                           ${should_connect_to_unencrypted_hv_ves}
47     [Return]   ${XNF_SIMULATORS_ADDRESSES}
48
49 Get xNF Simulators Using Valid Certificates
50     [Arguments]  ${AMOUNT}=1
51     ${SIMULATORS}=   Get Slice From List   ${VALID_XNF_SIMULATORS_ADDRESSES}   0   ${AMOUNT}
52     [Return]   ${SIMULATORS}
53
54
55 Send Messages From xNF Simulators
56     [Arguments]    ${XNF_HOSTS_LIST}   ${MESSAGE_FILEPATH}
57     FOR   ${HOST}   IN    @{XNF_HOSTS_LIST}
58         ${XNF_SIM_API_ACCESS}=   Get xNF Sim Api Access Url   ${HTTP_METHOD_URL}   ${HOST}
59         ${XNF_SIM_API_URL}=  Catenate   SEPARATOR=   ${XNF_SIM_API_ACCESS}   ${XNF_SIM_API_PATH}
60         Send messages   ${XNF_SIM_API_URL}   ${MESSAGE_FILEPATH}
61     END
62
63 VES-HV Collector Test Shutdown
64     Reset DCAE App Simulator  ${DEFAULT_PERF3GPP_TOPIC}
65     Reset DCAE App Simulator  ${SECOND_PERF3GPP_TOPIC}
66     Reset DCAE App Simulator  ${DEFAULT_STNDDEFINED_3GPP_HEARTBEAT_TOPIC}
67
68
69 VES-HV Collector Suite Teardown
70     Log Kafka Status
71     Stop And Remove All Xnf Simulators   ${SUITE NAME}
72
73 *** Variables ***
74 ${HTTP_METHOD_URL}                             http://
75
76 ${XNF_SIM_API_PATH}                            /simulator/async
77