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