a28ceedf3c2a57f64cbac16543f6d8cd387b55f5
[integration/test.git] / csit / suites / openflowplugin / Performance_Flow_Config / 010_Rest_Config_Flows.robot
1 *** Settings ***
2 Documentation     Test suite with connection of multiple switches
3 Suite Setup       Utils.Start Mininet
4 Suite Teardown    Utils.Stop Mininet
5 Library           OperatingSystem
6 Library           XML
7 Library           Process
8 Library           RequestsLibrary
9 Resource          ../../../libraries/Utils.robot
10 Variables         ../../../variables/Variables.py
11
12 *** Variables ***
13 ${switches}       25
14 ${flows}          2000
15 ${threads}        5
16 ${start}          sudo mn --controller=remote,ip=${ODL_SYSTEM_IP} --topo linear,${switches},1 --switch ovsk,protocols=OpenFlow13
17 ${PERFSCRIPT}     ${CURDIR}/../../../../tools/odl-mdsal-clustering-tests/clustering-performance-test/flow_add_delete_test.py
18 ${PARSESCRIPT}    ${CURDIR}/../../../../tools/odl-mdsal-clustering-tests/clustering-performance-test/create_plot_data_files.py
19
20 *** Test Cases ***
21 Check Switches Connected
22     [Documentation]    Checks wheather switches are connected to controller.
23     [Setup]    Start Http Session
24     Wait Until Keyword Succeeds    5    1    Are Switches Connected    ${switches}
25     [Teardown]    Stop Http Session
26
27 Configure And Deconfigure Flows
28     [Documentation]    Runs the flow peformance script and the script that parses the results to csv file.
29     ${result}=    Process.Run Process    ${PERFSCRIPT}    --host    ${ODL_SYSTEM_IP}    --flows    ${flows}
30     ...    --threads    ${threads}    --auth    shell=yes
31     Log    ${result.stdout}
32     OperatingSystem.Create File    out.log.txt    content=${result.stdout}
33     Log    ${result.stderr}
34     Should Be Equal As Integers    ${result.rc}    0
35     ${result}=    Process.Run Process    python    ${PARSESCRIPT}
36
37 *** Keywords ***
38 Start Http Session
39     [Documentation]    Starts http session.
40     Log    http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS_XML}
41     RequestsLibrary.Create Session    tcsession    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
42
43 Are Switches Connected
44     [Arguments]    ${switches}
45     [Documentation]    Checks Topology Contains a fix number ${switches} of switces.
46     ${resp}=    RequestsLibrary.Get Request    tcsession    /restconf/operational/network-topology:network-topology/topology/flow:1    headers=${ACCEPT_XML}
47     Log    ${resp.content}
48     ${count}=    XML.Get Element Count    ${resp.content}    xpath=node
49     Should Be Equal As Numbers    ${count}    ${switches}
50
51 Stop Http Session
52     [Documentation]    Stops http session.
53     RequestsLibrary.Delete All Sessions