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