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