Upgrade RF syntax for v3.2 compatibility
[integration/test.git] / 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 Mininet
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    120s    1s    Verify Switches Connected    ${exp_sw}
27         ${max_found}=    Set Variable    ${exp_sw}
28         Set Suite variable    ${max_found}
29         Add Switches    10
30     END
31     [Teardown]    Log Store Max Found
32
33 *** Keywords ***
34 Start Suite
35     [Documentation]    Starts mininet with requested number of switches
36     Log    Start the test on the base edition
37     ${mininet_conn_id}=    Open Connection    ${TOOLS_SYSTEM_IP}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=1800
38     Set Suite Variable    ${mininet_conn_id}
39     Login With Public Key    ${TOOLS_SYSTEM_USER}    ${USER_HOME}/.ssh/${SSH_KEY}    any
40     Put File    ${CURDIR}/../../../libraries/DynamicMininet.py    DynamicMininet.py
41     Execute Command    sudo ovs-vsctl set-manager ptcp:6644
42     Execute Command    sudo mn -c
43     Write    ${start}
44     Read Until    mininet>
45     Write    start ${ODL_SYSTEM_IP} ${init_sw}
46     Read Until    mininet>
47     Wait Until Keyword Succeeds    10s    1s    Verify Switches Connected    ${init_sw}
48
49 Add Switches
50     [Arguments]    ${nr_switches}
51     [Documentation]    Adds requested number of switches to the network
52     Write    add_switches ${nr_switches}
53     Read Until    mininet>
54
55 Verify Switches Connected
56     [Arguments]    ${exp_switches}
57     [Documentation]    Verifies if switches are connected/present in operational inventory
58     ${sw}    ${rep}    ${found}=    Flow Stats Collected    controller=${ODL_SYSTEM_IP}
59     Should Be Equal As Numbers    ${sw}    ${exp_switches}
60
61 Log Store Max Found
62     [Documentation]    Logs the found number
63     Log To Console    ${max_found}
64     Log    ${max_found}
65     Append To File    ${out_file}    Max\n${max_found}