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