Migrate Get Requests invocations(libraries)
[integration/test.git] / csit / suites / openflowplugin / Performance_Flow_Config / 030_Stats_Collection_Linear.robot
1 *** Settings ***
2 Documentation       Suite checks if StatMngr is able to collect flows with linear spread over the switches and linear spread over tables within the switch
3
4 Library             OperatingSystem
5 Library             Collections
6 Library             XML
7 Library             SSHLibrary
8 Library             RequestsLibrary
9 Library             ../../../../csit/libraries/Common.py
10 Library             ../../../../csit/libraries/ScaleClient.py
11 Variables           ../../../../csit/variables/Variables.py
12 Resource            ../../../../csit/variables/openflowplugin/Variables.robot
13
14 Suite Setup         Connect Switches
15 Suite Teardown      Stop Switches
16
17
18 *** Variables ***
19 ${swnr}         17
20 ${flnr}         17000
21 ${swspread}     linear
22 ${tabspread}    linear
23 @{cntls}        ${ODL_SYSTEM_IP}
24
25
26 *** Test Cases ***
27 Configure Flows
28     ${flows}    ${notes}=    Generate New Flow Details
29     ...    flows=${flnr}
30     ...    switches=${swnr}
31     ...    swspread=${swspread}
32     ...    tabspread=${tabspread}
33     Log    ${notes}
34     ${res}=    Configure Flows    flow_details=${flows}    controllers=@{cntls}    nrthreads=5
35     Log    ${res}
36     Set Suite Variable    ${flows}
37
38 Check Configured Are Operational
39     Wait Until Keyword Succeeds    110s    20s    Check Flows Inventory    ${flows}    ${ODL_SYSTEM_IP}
40
41 Deconfigure Flows
42     ${res}=    Deconfigure Flows    flow_details=${flows}    controllers=@{cntls}    nrthreads=5
43     Log    ${res}
44
45 Check No Flows In Operational
46     ${noflows}=    Create List
47     Wait Until Keyword Succeeds    110s    20s    Check Flows Inventory    ${noflows}    ${ODL_SYSTEM_IP}
48
49
50 *** Keywords ***
51 Connect Switches
52     [Documentation]    Starts mininet with requested number of switches (${swnr})
53     Log    Starting mininet with ${swnr} switches
54     Open Connection    ${TOOLS_SYSTEM_IP}    prompt=${TOOLS_SYSTEM_PROMPT}    timeout=600
55     Login With Public Key    ${TOOLS_SYSTEM_USER}    ${USER_HOME}/.ssh/${SSH_KEY}    any
56     Execute Command    sudo ovs-vsctl set-manager ptcp:6644
57     Execute Command    sudo mn -c
58     Write    sudo mn --controller=remote,ip=${ODL_SYSTEM_IP} --topo linear,${swnr} --switch ovsk,protocols=OpenFlow13
59     Read Until    mininet>
60     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
61     Wait Until Keyword Succeeds    10s    1s    Are Switches Connected Topo
62
63 Stop Switches
64     [Documentation]    Stops mininet
65     Log    Stopping mininet
66     Delete All Sessions
67     Read
68     Write    exit
69     Read Until    ${TOOLS_SYSTEM_PROMPT}
70     Close Connection
71
72 Are Switches Connected Topo
73     [Documentation]    Checks wheather switches are connected to controller
74     ${resp}=    GET On Session    session    url=${RFC8040_OPERATIONAL_TOPO_FLOW1_API}    headers=${ACCEPT_XML}
75     Log    ${resp.content}
76     ${count}=    Get Element Count    ${resp.content}    xpath=node
77     Should Be Equal As Numbers    ${count}    ${swnr}
78
79 Check Flows Inventory
80     [Arguments]    ${fldets}    ${cntl}
81     ${res}=    Flow Stats Collected    flow_details=${fldets}    controller=${cntl}
82     Should Be True    ${res}