Correctly space expected_status
[integration/test.git] / csit / suites / openflowplugin / Performance_Flow_Config / 090_BulkMaticConfigDsSetup_100k.robot
1 *** Settings ***
2 Documentation       Suite to measure flow setup rate using operation add-flows-ds
3
4 Library             OperatingSystem
5 Library             XML
6 Library             SSHLibrary
7 Variables           ../../../variables/Variables.py
8 Library             RequestsLibrary
9 Library             ../../../libraries/Common.py
10 Library             ../../../libraries/ScaleClient.py
11
12 Suite Setup         Create Http Session And Upload Files
13 Suite Teardown      Delete Http Session And Store Plot Data
14
15
16 *** Variables ***
17 ${swnr}         63
18 ${flnr}         100000
19 ${fpr}          25
20 ${nrthreads}    5
21 ${swspread}     linear
22 ${tabspread}    first
23 @{cntls}        ${ODL_SYSTEM_IP}
24 ${start_cmd}
25 ...             sudo mn --controller=remote,ip=${ODL_SYSTEM_IP} --topo linear,${swnr} --switch ovsk,protocols=OpenFlow13
26 ${getf_cmd}     sh ./get-total-found.sh
27 ${getr_cmd}     sh ./get-total-reported.sh
28 ${iperiod}      1s
29 ${ichange}      450s
30 ${outfile}      flows_setup_time.csv
31 ${setuptime}    0
32
33
34 *** Test Cases ***
35 Connect Mininet
36     Connect Switches
37
38 Configure Flows
39     [Documentation]    Setup of ${flnr} flows using add-flows-ds operation
40     ${flows}    ${notes}=    Generate New Flow Details
41     ...    flows=${flnr}
42     ...    switches=${swnr}
43     ...    swspread=${swspread}
44     ...    tabspread=${tabspread}
45     Log    ${notes}
46     ${starttime}=    Get Time    epoch
47     ${res}=    Operations Add Flows Ds
48     ...    flow_details=${flows}
49     ...    controllers=@{cntls}
50     ...    nrthreads=${nrthreads}
51     ...    fpr=${fpr}
52     Log    ${res}
53     Set Suite Variable    ${flows}
54     ${http200ok}=    Create List    ${200}
55     ${validation}=    Validate Responses    ${res}    ${http200ok}
56     Should Be True    ${validation}
57     [Teardown]    Save Setup Time    ${starttime}
58
59 Wait Stats Collected
60     [Documentation]    Waits till ${flnr} flows are initially collected
61     Inventory Change Reached    ${swnr}    ${flnr}
62     [Teardown]    Log Switch Details
63
64 Deconfigure Flows
65     [Documentation]    Flows deconfiguration
66     ${res}=    Operations Remove Flows Ds
67     ...    flow_details=${flows}
68     ...    controllers=@{cntls}
69     ...    nrthreads=${nrthreads}
70     ...    fpr=${fpr}
71     Log    ${res}
72     ${http200ok}=    Create List    ${200}
73     ${validation}=    Validate Responses    ${res}    ${http200ok}
74     Should Be True    ${validation}
75
76 Check No Flows In Operational After Remove
77     [Documentation]    No flows should be found after their removeal
78     Inventory Change Reached    ${swnr}    0
79     [Teardown]    Log Switch Details
80
81 Stop Mininet End
82     Stop Switches
83
84
85 *** Keywords ***
86 Connect Switches
87     [Documentation]    Starts mininet with requested number of switches (${swnr})
88     Log    Starting mininet with ${swnr} switches
89     Open Connection    ${TOOLS_SYSTEM_IP}    prompt=${TOOLS_SYSTEM_PROMPT}    timeout=600
90     Login With Public Key    ${TOOLS_SYSTEM_USER}    ${USER_HOME}/.ssh/${SSH_KEY}    any
91     Execute Command    sudo ovs-vsctl set-manager ptcp:6644
92     Execute Command    sudo mn -c
93     Write    ${start_cmd}
94     Read Until    mininet>
95     Wait Until Keyword Succeeds    10s    1s    Are Switches Connected Topo
96
97 Create Http Session And Upload Files
98     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
99     Open Connection    ${TOOLS_SYSTEM_IP}    prompt=${TOOLS_SYSTEM_PROMPT}    timeout=600
100     Login With Public Key    ${TOOLS_SYSTEM_USER}    ${USER_HOME}/.ssh/${SSH_KEY}    any
101     Put File    ${CURDIR}/../../../../tools/odl-mdsal-clustering-tests/clustering-performance-test/ovs-scripts/*    ./
102     Close Connection
103
104 Stop Switches
105     [Documentation]    Stops mininet
106     Log    Stopping mininet
107     Read
108     Write    exit
109     Read Until    ${TOOLS_SYSTEM_PROMPT}
110     Close Connection
111
112 Delete Http Session And Store Plot Data
113     Delete All Sessions
114     ${rate}=    Evaluate    (${flnr}/${setuptime})
115     Append To File    ${outfile}    FlowsSetupRate,FlowsSetupTime\n
116     Append To File    ${outfile}    ${rate},${setuptime}\n
117
118 Are Switches Connected Topo
119     [Documentation]    Checks wheather switches are connected to controller
120     ${resp}=    Get Request    session    ${OPERATIONAL_TOPO_API}/topology/flow:1    headers=${ACCEPT_XML}
121     Log    ${resp.content}
122     ${count}=    Get Element Count    ${resp.content}    xpath=node
123     Should Be Equal As Numbers    ${count}    ${swnr}
124
125 Check Flows Inventory
126     [Documentation]    Checks in inventory has required state
127     [Arguments]    ${rswitches}    ${rflows}
128     ${sw}    ${repf}    ${foundf}=    Flow Stats Collected    controller=${ODL_SYSTEM_IP}
129     Should Be Equal As Numbers    ${rswitches}    ${sw}
130     Should Be Equal As Numbers    ${rflows}    ${foundf}
131
132 Save Setup Time
133     [Documentation]    Count the difference and stores it
134     [Arguments]    ${starttime}
135     ${endtime}=    Get Time    epoch
136     Log    Stats collection finished at time ${endtime}
137     ${setuptime}=    Evaluate    int(${endtime})-int(${starttime})
138     Set Suite Variable    ${setuptime}
139
140 Inventory Change Reached
141     [Documentation]    This keywordwaits till inventory reaches required state
142     [Arguments]    ${rswitches}    ${rflows}
143     Wait Until Keyword Succeeds    ${ichange}    ${iperiod}    Check Flows Inventory    ${rswitches}    ${rflows}
144
145 Log Switch Details
146     Write    ${getf_cmd}
147     ${log}=    Read Until    mininet>
148     Log    ${log}
149     Write    ${getr_cmd}
150     ${log}=    Read Until    mininet>
151     Log    ${log}