Migrate Get Requests invocations(libraries)
[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
4 Library             OperatingSystem
5 Library             XML
6 Library             Process
7 Library             RequestsLibrary
8 Variables           ../../../variables/Variables.py
9 Resource            ../../../libraries/Utils.robot
10 Resource            ../../../variables/openflowplugin/Variables.robot
11
12 Suite Setup         Utils.Start Mininet
13 Suite Teardown      Utils.Stop Mininet
14
15
16 *** Variables ***
17 ${switches}         25
18 ${flows}            2000
19 ${threads}          5
20 ${start}
21 ...                 sudo mn --controller=remote,ip=${ODL_SYSTEM_IP} --topo linear,${switches},1 --switch ovsk,protocols=OpenFlow13
22 ${PERFSCRIPT}
23 ...                 ${CURDIR}/../../../../tools/odl-mdsal-clustering-tests/clustering-performance-test/flow_add_delete_test.py
24 ${PARSESCRIPT}
25 ...                 ${CURDIR}/../../../../tools/odl-mdsal-clustering-tests/clustering-performance-test/create_plot_data_files.py
26
27
28 *** Test Cases ***
29 Check Switches Connected
30     [Documentation]    Checks wheather switches are connected to controller.
31     [Setup]    Start Http Session
32     Wait Until Keyword Succeeds    5    1    Are Switches Connected    ${switches}
33     [Teardown]    Stop Http Session
34
35 Configure And Deconfigure Flows
36     [Documentation]    Runs the flow peformance script and the script that parses the results to csv file.
37     ${result}=    Process.Run Process    ${PERFSCRIPT}    --host    ${ODL_SYSTEM_IP}    --flows    ${flows}
38     ...    --threads    ${threads}    --auth    shell=yes
39     Log    ${result.stdout}
40     OperatingSystem.Create File    out.log.txt    content=${result.stdout}
41     Log    ${result.stderr}
42     Should Be Equal As Integers    ${result.rc}    0
43     ${result}=    Process.Run Process    python    ${PARSESCRIPT}
44
45
46 *** Keywords ***
47 Start Http Session
48     [Documentation]    Starts http session.
49     Log    http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS_XML}
50     RequestsLibrary.Create Session
51     ...    tcsession
52     ...    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}
53     ...    auth=${AUTH}
54     ...    headers=${HEADERS_XML}
55
56 Are Switches Connected
57     [Documentation]    Checks Topology Contains a fix number ${switches} of switces.
58     [Arguments]    ${switches}
59     ${resp}=    RequestsLibrary.GET On Session
60     ...    tcsession
61     ...    url=${RFC8040_OPERATIONAL_TOPO_FLOW1_API}
62     ...    headers=${ACCEPT_XML}
63     Log    ${resp.content}
64     ${count}=    XML.Get Element Count    ${resp.content}    xpath=node
65     Should Be Equal As Numbers    ${count}    ${switches}
66
67 Stop Http Session
68     [Documentation]    Stops http session.
69     RequestsLibrary.Delete All Sessions