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