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