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