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