Step 1: Move vm scripts to the right place
[integration/test.git] / csit / suites / openflowplugin / Performance_Flow_Config / 060_Stats_Collection_Basic16kScenario.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
14 *** Variables ***
15 ${swnr}           16
16 ${flnr}           16000
17 ${swspread}       linear
18 ${tabspread}      linear
19 @{cntls}          ${CONTROLLER}
20 ${start_cmd}      sudo mn --controller=remote,ip=${CONTROLLER} --topo linear,${swnr} --switch ovsk,protocols=OpenFlow13
21
22 *** Test Cases ***
23 Connect Mininet
24     Connect Switches
25
26 Configure Flows
27     [Documentation]    Configuration of 16k flows into config datastore
28     ${flows}    ${notes}=    Generate New Flow Details    flows=${flnr}    switches=${swnr}    swspread=${swspread}    tabspread=${tabspread}
29     Log    ${notes}
30     ${res}=    Configure Flows    flow_details=${flows}    controllers=@{cntls}    nrthreads=5
31     Log    ${res}
32     Set Suite Variable    ${flows}
33
34 Are Flows Operational
35     [Documentation]    Operational datastore check if all flows are present there
36     Wait Until Keyword Succeeds    110s    5s    Check Flows Inventory    ${flows}    ${CONTROLLER}
37
38 Deconfigure Flows
39     [Documentation]    Removal of 16k flows from config datastore
40     ${res}=    Deconfigure Flows    flow_details=${flows}    controllers=@{cntls}    nrthreads=5
41     Log    ${res}
42
43 Check No Flows In Operational
44     [Documentation]    Operational datastore to be without any flows
45     ${noflows}=    Create List
46     Wait Until Keyword Succeeds    110s    5s    Check Flows Inventory    ${noflows}    ${CONTROLLER}
47
48 Configure Flows Again
49     [Documentation]    Configuration of 16k flows into config datastore again
50     ${res}=    Configure Flows    flow_details=${flows}    controllers=@{cntls}    nrthreads=5
51     Log    ${res}
52
53 Are Flows Operational Again
54     [Documentation]    Operational datastore check if all flows are present there
55     Wait Until Keyword Succeeds    110s    5s    Check Flows Inventory    ${flows}    ${CONTROLLER}
56
57 Stop Mininet
58     [Documentation]    Disconnect/Stop mininet
59     Stop Switches
60
61 Check No Flows In Operational After Disconnect
62     [Documentation]    With mininet stopped no switches in operational datastore sould be found
63     Wait Until Keyword Succeeds    110s    5s    Check No Switches Inventory
64
65 Connect Mininet Again
66     [Documentation]    Reconnection of the mininet
67     Connect Switches
68
69 Check Flows Are Operational Again
70     [Documentation]    All 16k switches should be present in the operational datastore after mininet reconnection
71     Wait Until Keyword Succeeds    110s    5s    Check Flows Inventory    ${flows}    ${CONTROLLER}
72
73 Deconfigure Flows End
74     [Documentation]    Flows deconfiguration
75     ${res}=    Deconfigure Flows    flow_details=${flows}    controllers=@{cntls}    nrthreads=5
76     Log    ${res}
77
78 Check No Flows In Operational Last
79     [Documentation]    Operational datastore to be without any flows
80     ${noflows}=    Create List
81     Wait Until Keyword Succeeds    110s    5s    Check Flows Inventory    ${noflows}    ${CONTROLLER}
82
83 Stop Mininet End
84     Stop Switches
85
86 *** Keywords ***
87 Connect Switches
88     [Documentation]    Starts mininet with requested number of switches (${swnr})
89     Log    Starting mininet with ${swnr} switches
90     Open Connection    ${MININET}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=600
91     Login With Public Key    ${MININET_USER}    ${USER_HOME}/.ssh/${SSH_KEY}    any
92     Execute Command    sudo ovs-vsctl set-manager ptcp:6644
93     Execute Command    sudo mn -c
94     Write    ${start_cmd}
95     Read Until    mininet>
96     Wait Until Keyword Succeeds    10s    1s    Are Switches Connected Topo
97
98 Create Http Session
99     Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
100
101 Stop Switches
102     [Documentation]    Stops mininet
103     Log    Stopping mininet
104     Read
105     Write    exit
106     Read Until    ${DEFAULT_LINUX_PROMPT}
107     Close Connection
108
109 Delete Http Session
110     Delete All Sessions
111
112 Are Switches Connected Topo
113     [Documentation]    Checks wheather switches are connected to controller
114     ${resp}=    Get    session    ${OPERATIONAL_TOPO_API}/topology/flow:1    headers=${ACCEPT_XML}
115     Log    ${resp.content}
116     ${count}=    Get Element Count    ${resp.content}    xpath=node
117     Should Be Equal As Numbers    ${count}    ${swnr}
118
119 Check Flows Inventory
120     [Arguments]    ${fldets}    ${cntl}
121     ${res}=    Flow Stats Collected    flow_details=${fldets}    controller=${cntl}
122     Should Be True    ${res}
123
124 Check No Switches Inventory
125     ${resp}=    Get    session    ${OPERATIONAL_NODES_API}
126     Log    ${resp.content}
127     Should Be Equal As Strings    '${resp.content}'    '{"nodes":{}}'