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