adding a scale test for statistic collection and its it's testplans
[integration/test.git] / test / csit / suites / openflowplugin / Performance_Flow_Config / 070_Stats_Collection_100k_WithMininetRestart.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
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 ${swspread}       linear
20 ${tabspread}      first
21 @{cntls}          ${CONTROLLER}
22 ${linux_prompt}    >
23 ${start_cmd}      sudo mn --controller=remote,ip=${CONTROLLER} --topo linear,${swnr} --switch ovsk,protocols=OpenFlow13
24 ${iperiod}        30s
25 ${imonitor}       600s
26 ${ichange}        120s
27
28 *** Test Cases ***
29 Connect Mininet
30     Connect Switches
31
32 Configure Flows
33     [Documentation]    Configuration of ${flnr} flows into config datastore
34     ${flows}    ${notes}=    Generate New Flow Details    flows=${flnr}    switches=${swnr}    swspread=${swspread}    tabspread=${tabspread}
35     Log    ${notes}
36     ${res}=    Configure Flows Bulk    flow_details=${flows}    controllers=@{cntls}    nrthreads=5    fpr=${fpr}
37     Log    ${res}
38     Set Suite Variable    ${flows}
39
40 Wait Stats Collected
41     [Documentation]    Waits till ${flnr} flows are initially collected
42     Inventory Change Reached    ${swnr}    ${flnr}
43
44 Stable State Monitoring
45     [Documentation]    Inventory check if all ${flnr} flows are present for specified time frame
46     Monitor Stable State    ${swnr}    ${flnr}
47
48 Stop Mininet
49     [Documentation]    Disconnect/Stop mininet
50     Stop Switches
51
52 Check No Flows In Operational After Disconnect
53     [Documentation]    With mininet stopped no switches in operational datastore sould be found
54     Inventory Change Reached    0    0
55
56 Connect Mininet Again
57     [Documentation]    Reconnection of the mininet
58     Connect Switches
59
60 Check Flows Are Operational Again
61     [Documentation]    All ${flnr} slows should be present in the operational datastore after mininet reconnection
62     Inventory Change Reached    ${swnr}    ${flnr}
63
64 Deconfigure Flows
65     [Documentation]    Flows deconfiguration
66     ${resp}=    Delete    session    ${CONFIG_NODES_API}
67     Should Be Equal As Numbers    ${resp.status_code}    200
68
69 Check No Flows In Operational Last
70     [Documentation]    Operational datastore to be without any flows
71     Inventory Change Reached    ${swnr}    0
72
73 Stop Mininet End
74     Stop Switches
75
76 *** Keywords ***
77 Connect Switches
78     [Documentation]    Starts mininet with requested number of switches (${swnr})
79     Log    Starting mininet with ${swnr} switches
80     Open Connection    ${MININET}    prompt=${linux_prompt}    timeout=600
81     Login With Public Key    ${MININET_USER}    ${USER_HOME}/.ssh/id_rsa    any
82     Execute Command    sudo ovs-vsctl set-manager ptcp:6644
83     Execute Command    sudo mn -c
84     Write    ${start_cmd}
85     Read Until    mininet>
86     Wait Until Keyword Succeeds    10s    1s    Are Switches Connected Topo
87
88 Create Http Session
89     Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
90
91 Stop Switches
92     [Documentation]    Stops mininet
93     Log    Stopping mininet
94     Read
95     Write    exit
96     Read Until    ${linux_prompt}
97     Close Connection
98
99 Delete Http Session
100     Delete All Sessions
101
102 Are Switches Connected Topo
103     [Documentation]    Checks wheather switches are connected to controller
104     ${resp}=    Get    session    ${OPERATIONAL_TOPO_API}/topology/flow:1    headers=${ACCEPT_XML}
105     Log    ${resp.content}
106     ${count}=    Get Element Count    ${resp.content}    xpath=node
107     Should Be Equal As Numbers    ${count}    ${swnr}
108
109 Check Flows Inventory
110     [Arguments]    ${rswitches}    ${rflows}
111     [Documentation]    Checks in inventory has required state
112     ${sw}    ${repf}    ${foundf}=    Flow Stats Collected    controller=${CONTROLLER}
113     Should Be Equal As Numbers    ${rswitches}    ${sw}
114     Should Be Equal As Numbers    ${rflows}    ${foundf}
115
116 Inventory Change Reached
117     [Arguments]    ${rswitches}    ${rflows}
118     [Documentation]    This keywordwaits till inventory reaches required state
119     Wait Until Keyword Succeeds    ${ichange}    ${iperiod}    Check Flows Inventory    ${rswitches}    ${rflows}
120
121 Monitor Stable State
122     [Arguments]    ${rswitches}    ${rflows}
123     [Documentation]    This keywordwaits till inventory reaches required state
124     Verify Keyword Does Not Fail Within Timeout    ${imonitor}    ${iperiod}    Check Flows Inventory    ${rswitches}    ${rflows}