Adding verify controller log to scalability test.
[integration/test.git] / test / csit / libraries / Scalability.txt
1 *** Settings ***
2 Library           SSHLibrary
3 Resource          Utils.txt
4
5 *** Variables ***
6 ${linux_prompt}    >
7
8 *** Keywords ***
9 Find Max Switches
10     [Arguments]    ${start}    ${stop}    ${step}
11     [Documentation]    Will find out max switches starting from ${start} till reaching ${stop} and in steps defined by ${step}
12     ${max-switches}    Set Variable    ${0}
13     ${start}    Convert to Integer    ${start}
14     ${stop}    Convert to Integer    ${stop}
15     ${step}    Convert to Integer    ${step}
16     : FOR    ${switches}    IN RANGE    ${start}    ${stop+1}    ${step}
17     \    Start Mininet Linear    ${switches}
18     \    ${status}    ${result}    Run Keyword And Ignore Error    Verify Controller Is Not Dead    ${CONTROLLER}
19     \    Exit For Loop If    '${status}' == 'FAIL'
20     \    ${status}    ${result}    Run Keyword And Ignore Error    Wait Until Keyword Succeeds    ${switches*2}    10s
21     \    ...    Check Every Switch    ${switches}
22     \    Exit For Loop If    '${status}' == 'FAIL'
23     \    ${status}    ${result}    Run Keyword And Ignore Error    Wait Until Keyword Succeeds    ${switches*2}    10s
24     \    ...    Check Linear Topology    ${switches}
25     \    Exit For Loop If    '${status}' == 'FAIL'
26     \    Stop Mininet
27     \    ${status}    ${result}    Run Keyword And Ignore Error    Wait Until Keyword Succeeds    ${switches*2}    10s
28     \    ...    Check No Switches    ${switches}
29     \    Exit For Loop If    '${status}' == 'FAIL'
30     \    ${status}    ${result}    Run Keyword And Ignore Error    Wait Until Keyword Succeeds    ${switches*2}    10s
31     \    ...    Check No Topology    ${switches}
32     \    Exit For Loop If    '${status}' == 'FAIL'
33     \    ${max-switches}    Convert To String    ${switches}
34     [Return]    ${max-switches}
35
36 Start Mininet Linear
37     [Arguments]    ${switches}
38     [Documentation]    Start mininet linear topology with ${switches} nodes
39     Log To Console    Starting mininet linear ${switches}
40     ${mininet_conn_id}=    Open Connection    ${MININET}    prompt=${linux_prompt}    timeout=${switches*3}
41     Set Suite Variable    ${mininet_conn_id}
42     Login With Public Key    ${MININET_USER}    ${USER_HOME}/.ssh/id_rsa    any
43     Write    sudo mn --controller=remote,ip=${CONTROLLER} --topo linear,${switches} --switch ovsk,protocols=OpenFlow13
44     Read Until    mininet>
45     Sleep    6
46
47 Check Every Switch
48     [Arguments]    ${switches}
49     [Documentation]    Check all switches and stats in operational inventory
50     : FOR    ${switch}    IN RANGE    1    ${switches+1}
51     \    ${resp}    RequestsLibrary.Get    session    /restconf/operational/opendaylight-inventory:nodes/node/openflow:${switch}
52     \    Log To Console    Checking Switch ${switch}
53     \    Should Be Equal As Strings    ${resp.status_code}    200
54     \    Should Contain    ${resp.content}    flow-capable-node-connector-statistics
55     \    Should Contain    ${resp.content}    flow-table-statistics
56
57 Check Linear Topology
58     [Arguments]    ${switches}
59     [Documentation]    Check Linear topology given ${switches}
60     ${resp}    RequestsLibrary.Get    session    /restconf/operational/network-topology:network-topology/
61     Log To Console    Checking Topology
62     Should Be Equal As Strings    ${resp.status_code}    200
63     : FOR    ${switch}    IN RANGE    1    ${switches+1}
64     \    Should Contain    ${resp.content}    "node-id":"openflow:${switch}"
65     \    Should Contain    ${resp.content}    "tp-id":"openflow:${switch}:1"
66     \    Should Contain    ${resp.content}    "tp-id":"openflow:${switch}:2"
67     \    Should Contain    ${resp.content}    "source-tp":"openflow:${switch}:2"
68     \    Should Contain    ${resp.content}    "dest-tp":"openflow:${switch}:2"
69     \    ${edge}    Evaluate    ${switch}==1 or ${switch}==${switches}
70     \    Run Keyword Unless    ${edge}    Should Contain    ${resp.content}    "tp-id":"openflow:${switch}:3"
71     \    Run Keyword Unless    ${edge}    Should Contain    ${resp.content}    "source-tp":"openflow:${switch}:3"
72     \    Run Keyword Unless    ${edge}    Should Contain    ${resp.content}    "dest-tp":"openflow:${switch}:3"
73
74 Check No Switches
75     [Arguments]    ${switches}
76     [Documentation]    Check no switch is in inventory
77     ${resp}    RequestsLibrary.Get    session    /restconf/operational/opendaylight-inventory:nodes
78     Log To Console    Checking No Switches
79     Should Be Equal As Strings    ${resp.status_code}    200
80     : FOR    ${switch}    IN RANGE    1    ${switches+1}
81     \    Should Not Contain    ${resp.content}    openflow:${switch}
82
83 Check No Topology
84     [Arguments]    ${switches}
85     [Documentation]    Check no switch is in topology
86     ${resp}    RequestsLibrary.Get    session    /restconf/operational/network-topology:network-topology/
87     Log To Console    Checking No Topology
88     Should Be Equal As Strings    ${resp.status_code}    200
89     : FOR    ${switch}    IN RANGE    1    ${switches+1}
90     \    Should Not Contain    ${resp.content}    openflow:${switch}
91
92 Stop Mininet
93     [Documentation]    Stop mininet
94     Log To Console    Stopping Mininet
95     Switch Connection    ${mininet_conn_id}
96     Read
97     Write    exit
98     Read Until    ${linux_prompt}
99     Close Connection