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