Migrate Get Requests invocations(libraries)
[integration/test.git] / csit / suites / openflowplugin / Flows_Additional_TCs / 030_Flow_Update_Test.robot
1 *** Settings ***
2 Documentation       Test suite with independent flow tests
3
4 Library             String
5 Library             Collections
6 Library             XML
7 Library             RequestsLibrary
8 Library             SSHLibrary
9 Resource            ../../../libraries/Utils.robot
10 Resource            ../../../libraries/FlowLib.robot
11 Resource            ../../../variables/openflowplugin/Variables.robot
12 Variables           ../../../variables/Variables.py
13 Library             ../../../libraries/XmlComparator.py
14
15 Suite Setup         Initialization Phase
16 Suite Teardown      Final Phase
17
18
19 *** Variables ***
20 ${XmlsDir}          ${CURDIR}/../../../../csit/variables/xmls
21 ${flowfile}         f2.xml
22 ${switch_idx}       1
23 ${switch_name}      s${switch_idx}
24
25
26 *** Test Cases ***
27 Update With Delete And Add
28     [Documentation]    Updates a flow by changing priority which causes delete and add flow reaction
29     Create Flow Variables For Suite From XML File    ${XmlsDir}/${flowfile}
30     Add Flow Via Restconf    ${switch_idx}    ${table_id}    ${data}
31     Check Config Flow    ${True}    ${data}
32     Log Switch Flows
33     Wait Until Keyword Succeeds    30s    1s    Check Operational Flow    ${True}    ${data}
34     ${upddata}=    Replace String    ${data}    <priority>2</priority>    <priority>3</priority>
35     Update Flow Via Restconf    ${switch_idx}    ${table_id}    ${flow_id}    ${upddata}
36     Check Config Flow    ${True}    ${upddata}
37     Log Switch Flows
38     Wait Until Keyword Succeeds    30s    1s    Check Operational Flow    ${True}    ${upddata}
39     [Teardown]    Delete Flow
40
41
42 *** Keywords ***
43 Log Switch Flows
44     [Documentation]    Logs the switch content
45     Write    dpctl dump-flows -O OpenFlow13
46     ${switchouput}=    Read Until    mininet>
47     Log    ${switchouput}
48
49 Initialization Phase
50     [Documentation]    Starts mininet and verify if topology is in operational ds
51     Start Mininet
52     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
53     Wait Until Keyword Succeeds    10s    1s    FlowLib.Check Switches In Topology    1
54
55 Final Phase
56     [Documentation]    Stops mininet
57     Stop Mininet
58     Delete All Sessions
59
60 Delete Flow
61     [Documentation]    Removes used flow
62     ${resp}=    RequestsLibrary.DELETE On Session
63     ...    session
64     ...    url=${RFC8040_NODES_API}/node=openflow%3A${switch_idx}/flow-node-inventory:table=${table_id}/flow=${flow_id}
65     ...    expected_status=200
66     Log    ${resp.content}