Test cases for GBP-SFC integration demo
[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
10 Setup Node
11     [Documentation]    Configures underlying infrastructure composed of Docker containers and OVS switches on remote VM.
12     ...    Python and Bash scripts are used.
13     [Arguments]    ${GBPSFC}    ${sw_index}    ${suite_dir}    ${timeout}=10s
14     ConnUtils.Connect and Login    ${GBPSFC}    timeout=${timeout}
15     SSHLibrary.Put File    ${suite_dir}/*    ${VM_HOME_FOLDER}${/}${VM_SCRIPTS_FOLDER}/    mode=0755
16     ${stdout}    ${stderr}    ${rc}    Execute in VE    python ${VM_HOME_FOLDER}${/}${VM_SCRIPTS_FOLDER}/infrastructure_launch.py ${ODL} ${sw_index}
17     ...    timeout=${timeout}
18     Should Be Equal As Numbers    ${rc}    0
19     ${stderr}    Set Variable
20     # Flows for GBPSFC3 and GBPSFC5 have to be written manually.
21     # GBPSFC2 is SFF for GBPSFC3 and GBPSFC4 is SFF for GBPSFC5
22     Run Keyword If    "${GBPSFC}" == "${GBPSFC3}"
23     ...    Write SF Flows    ${GBPSFC2}    ${stderr}
24     ...    ELSE IF    "${GBPSFC}" == "${GBPSFC5}"
25     ...    Write SF Flows    ${GBPSFC4}    ${stderr}
26     Should Be Empty    ${stderr}
27     SSHLibrary.Close Connection
28
29 Write SF Flows
30     [Documentation]    Writes flows to SF node. SFF for given SF has to be specified in arguments.
31     [Arguments]    ${SFF}    ${stderr}
32     ${stderr}    SSHLibrary.Execute Command    ${VM_HOME_FOLDER}${/}${VM_SCRIPTS_FOLDER}/sf-flows.sh ${SFF}
33     ...    return_stderr=True    return_stdout=False
34
35 Teardown Node
36     [Documentation]    Clears underlying infrastructure composed of Docker containers and OVS switches from remote VM.
37     ...    Python and Bash scripts are used.
38     [Arguments]    ${GBPSFC}    ${suite_dir}    ${timeout}=3s
39     ConnUtils.Connect and Login    ${GBPSFC}    timeout=${timeout}
40     ${stderr}    SSHLibrary.Execute Command    rm ${VM_HOME_FOLDER}${/}${VM_SCRIPTS_FOLDER}/infrastructure_config.py
41     ...    return_stderr=True    return_stdout=False
42     Should Be Empty    ${stderr}
43     ${stderr}    SSHLibrary.Execute Command    rm ${VM_HOME_FOLDER}${/}${VM_SCRIPTS_FOLDER}/sf-flows.sh
44     ...    return_stderr=True    return_stdout=False
45     Should Be Empty    ${stderr}
46     ${stderr}    SSHLibrary.Execute Command    ${VM_HOME_FOLDER}${/}${VM_SCRIPTS_FOLDER}/clean-demo.sh
47     ...    return_stderr=True    return_stdout=False
48     Should Be Empty    ${stderr}
49     SSHLibrary.Close Connection
50
51 Setup Nodes
52     [Arguments]    ${GBPSFCs}    ${init_scripts_dir}
53     ${sw_index}    Set Variable    0
54     :FOR    ${GBPSFC}    IN    @{GBPSFCs}
55     \    Setup Node    ${GBPSFC}    ${sw_index}    ${init_scripts_dir}    timeout=10s
56     \    ${sw_index}    Evaluate    ${sw_index} + 1
57