Step 1: Move vm scripts to the right place
[integration/test.git] / test / csit / suites / openflowplugin / Maximum_Switches / 020__find_max_switches.robot
1 *** Settings ***
2 Documentation     Test suite to find maximum switches which can be connected to the controller
3 Suite Setup       Start Suite
4 Suite Teardown    Utils.Stop Suite
5 Library           SSHLibrary
6 Resource          ../../../libraries/Utils.robot
7 Variables         ../../../variables/Variables.py
8 Library           ../../../libraries/ScaleClient.py
9 Library           OperatingSystem
10
11 *** Variables ***
12 ${start}          sudo python DynamicMininet.py
13 ${max_sw}         500
14 ${step_sw}        10
15 ${init_sw}        10
16 ${max_found}      0
17 ${outfile}        max_found.csv
18
19 *** Test Cases ***
20 Find Max Switches
21     [Documentation]    Will find out max switches starting from ${start_sw} till reaching ${max_sw} with step defined by ${step_sw}
22     ${init_sw}    Convert to Integer    ${init_sw}
23     ${max_sw}    Convert to Integer    ${max_sw}
24     ${step_sw}    Convert to Integer    ${step_sw}
25     : FOR    ${exp_sw}    IN RANGE    ${init_sw}    ${max_sw+1}    ${step_sw}
26     \    BuiltIn.Wait Until Keyword Succeeds    35s    1s    Verify Switches Connected    ${exp_sw}
27     \    ${max_found}=    Set Variable    ${exp_sw}
28     \    Set Suite variable    ${max_found}
29     \    Add Switches    10
30     [Teardown]    Log Store Max Found
31
32 *** Keywords ***
33 Start Suite
34     [Documentation]    Starts mininet with requested number of switches
35     Log    Start the test on the base edition
36     ${mininet_conn_id}=    Open Connection    ${MININET}    prompt=>    timeout=1800
37     Set Suite Variable    ${mininet_conn_id}
38     Login With Public Key    ${MININET_USER}    ${USER_HOME}/.ssh/${SSH_KEY}    any
39     Put File    ${CURDIR}/../../../libraries/DynamicMininet.py    DynamicMininet.py
40     Execute Command    sudo ovs-vsctl set-manager ptcp:6644
41     Execute Command    sudo mn -c
42     Write    ${start}
43     Read Until    mininet>
44     Write    start ${CONTROLLER} ${init_sw}
45     Read Until    mininet>
46     Wait Until Keyword Succeeds    10s    1s    Verify Switches Connected    ${init_sw}
47
48 Add Switches
49     [Arguments]    ${nr_switches}
50     [Documentation]    Adds requested number of switches to the network
51     Write    add_switches ${nr_switches}
52     Read Until    mininet>
53
54 Verify Switches Connected
55     [Arguments]    ${exp_switches}
56     [Documentation]    Verifies if switches are connected/present in operational inventory
57     ${sw}    ${rep}    ${found}=    Flow Stats Collected    controller=${CONTROLLER}
58     Should Be Equal As Numbers    ${sw}    ${exp_switches}
59
60 Log Store Max Found
61     [Documentation]    Logs the found number
62     Log To Console    ${max_found}
63     Append To File    ${out_file}    Max\n${max_found}