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