Mininet clean command to use "Execute Command" vs "Write"
[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}          ${ODL_SYSTEM_IP}
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}    ${ODL_SYSTEM_IP}
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}    ${ODL_SYSTEM_IP}
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    ${TOOLS_SYSTEM_IP}    prompt=${TOOLS_SYSTEM_PROMPT}    timeout=600
47     Login With Public Key    ${TOOLS_SYSTEM_USER}    ${USER_HOME}/.ssh/${SSH_KEY}    any
48     Execute Command    sudo ovs-vsctl set-manager ptcp:6644
49     Execute Command    sudo mn -c
50     Write    sudo mn --controller=remote,ip=${ODL_SYSTEM_IP} --topo linear,${swnr} --switch ovsk,protocols=OpenFlow13
51     Read Until    mininet>
52     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
53     Wait Until Keyword Succeeds    10s    1s    Are Switches Connected Topo
54
55 Stop Switches
56     [Documentation]    Stops mininet
57     Log    Stopping mininet
58     Delete All Sessions
59     Read
60     Write    exit
61     Read Until    ${TOOLS_SYSTEM_PROMPT}
62     Close Connection
63
64 Are Switches Connected Topo
65     [Documentation]    Checks wheather switches are connected to controller
66     ${resp}=    Get Request    session    /restconf/operational/network-topology:network-topology/topology/flow:1    headers=${ACCEPT_XML}
67     Log    ${resp.content}
68     ${count}=    Get Element Count    ${resp.content}    xpath=node
69     Should Be Equal As Numbers    ${count}    ${swnr}
70
71 Check Flows Inventory
72     [Arguments]    ${fldets}    ${cntl}
73     ${res}=    Flow Stats Collected    flow_details=${fldets}    controller=${cntl}
74     Should Be True    ${res}