Upgrade RF syntax for v3.2 compatibility
[integration/test.git] / csit / suites / groupbasedpolicy / GBPSFC / 6-node / GBPSFC_6node.robot
1 *** Settings ***
2 Library           SSHLibrary
3 Resource          Variables.robot
4 Resource          ../../../../libraries/Utils.robot
5 Resource          ../../../../libraries/GBP/ConnUtils.robot
6 Variables         ../../../../variables/Variables.py
7
8 *** Keywords ***
9 Setup Node
10     [Arguments]    ${GBPSFC}    ${sw_index}    ${suite_dir}    ${timeout}=10s
11     [Documentation]    Configures underlying infrastructure composed of Docker containers and OVS switches on remote VM.
12     ...    Python and Bash scripts are used.
13     ConnUtils.Connect and Login    ${GBPSFC}    timeout=${timeout}
14     SSHLibrary.Put File    ${suite_dir}/*    ${VM_HOME_FOLDER}${/}${VM_SCRIPTS_FOLDER}/    mode=0755
15     ${stdout}    ${stderr}    ${rc}    Execute in VE    python ${VM_HOME_FOLDER}${/}${VM_SCRIPTS_FOLDER}/infrastructure_launch.py ${ODL} ${sw_index}    timeout=${timeout}
16     Should Be Equal As Numbers    ${rc}    0
17     ${stderr}    Set Variable
18     # Flows for GBPSFC3 and GBPSFC5 have to be written manually.
19     # GBPSFC2 is SFF for GBPSFC3 and GBPSFC4 is SFF for GBPSFC5
20     Run Keyword If    "${GBPSFC}" == "${GBPSFC3}"    Write SF Flows    ${GBPSFC2}    ${stderr}
21     ...    ELSE IF    "${GBPSFC}" == "${GBPSFC5}"    Write SF Flows    ${GBPSFC4}    ${stderr}
22     Should Be Empty    ${stderr}
23     SSHLibrary.Close Connection
24
25 Write SF Flows
26     [Arguments]    ${SFF}    ${stderr}
27     [Documentation]    Writes flows to SF node. SFF for given SF has to be specified in arguments.
28     ${stderr}    SSHLibrary.Execute Command    ${VM_HOME_FOLDER}${/}${VM_SCRIPTS_FOLDER}/sf-flows.sh ${SFF}    return_stderr=True    return_stdout=False
29
30 Teardown Node
31     [Arguments]    ${GBPSFC}    ${suite_dir}    ${timeout}=3s
32     [Documentation]    Clears underlying infrastructure composed of Docker containers and OVS switches from remote VM.
33     ...    Python and Bash scripts are used.
34     ConnUtils.Connect and Login    ${GBPSFC}    timeout=${timeout}
35     ${stderr}    SSHLibrary.Execute Command    rm ${VM_HOME_FOLDER}${/}${VM_SCRIPTS_FOLDER}/infrastructure_config.py    return_stderr=True    return_stdout=False
36     Should Be Empty    ${stderr}
37     ${stderr}    SSHLibrary.Execute Command    rm ${VM_HOME_FOLDER}${/}${VM_SCRIPTS_FOLDER}/sf-flows.sh    return_stderr=True    return_stdout=False
38     Should Be Empty    ${stderr}
39     ${stderr}    SSHLibrary.Execute Command    ${VM_HOME_FOLDER}${/}${VM_SCRIPTS_FOLDER}/clean-demo.sh    return_stderr=True    return_stdout=False
40     Should Be Empty    ${stderr}
41     SSHLibrary.Close Connection
42
43 Setup Nodes
44     [Arguments]    ${GBPSFCs}    ${init_scripts_dir}
45     ${sw_index}    Set Variable    0
46     FOR    ${GBPSFC}    IN    @{GBPSFCs}
47         Setup Node    ${GBPSFC}    ${sw_index}    ${init_scripts_dir}    timeout=10s
48         ${sw_index}    Evaluate    ${sw_index} + 1
49     END