Fix python3 issues in OFP
[integration/test.git] / csit / suites / openflowplugin / MD_SAL_NSF_OF13 / 040_restconf_frm.robot
1 *** Settings ***
2 Documentation     Test suite for RESTCONF FRM
3 Suite Setup       Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
4 Suite Teardown    Delete All Sessions
5 Library           Collections
6 Library           RequestsLibrary
7 Library           ../../../libraries/Common.py
8 Variables         ../../../variables/Variables.py
9 Resource          ../../../libraries/Utils.robot
10
11 *** Variables ***
12 ${BODY1}          <flow xmlns="urn:opendaylight:flow:inventory"><priority>2</priority><flow-name>Foo</flow-name><match><ethernet-match><ethernet-type><type>2048</type></ethernet-type></ethernet-match><ipv4-destination>10.0.10.1/32</ipv4-destination></match><id>139</id><table_id>2</table_id><instructions><instruction><order>0</order><apply-actions><action><order>0</order><dec-nw-ttl/></action></apply-actions></instruction></instructions></flow>
13 ${BODY2}          <flow xmlns="urn:opendaylight:flow:inventory"><priority>2</priority><flow-name>Foo</flow-name><match><ethernet-match><ethernet-type><type>2048</type></ethernet-type></ethernet-match><ipv4-destination>10.0.20.1/32</ipv4-destination></match><id>139</id><table_id>2</table_id><instructions><instruction><order>0</order><apply-actions><action><order>0</order><output-action><output-node-connector>1</output-node-connector><max-length>60</max-length></output-action></action></apply-actions></instruction></instructions></flow>
14
15 *** Test Cases ***
16 Add a flow - Sending IPv4 Dest Address and Eth type
17     [Documentation]    Push a flow through REST-API
18     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_NODES_API}/node/openflow:1/table/2/flow/139    headers=${HEADERS_XML}    data=${BODY1}
19     BuiltIn.Should_Match    "${resp.status_code}"    "20?"
20
21 Verify after adding flow config - Sending IPv4 Dest Address and Eth type
22     [Documentation]    Verify the flow
23     ${resp}    RequestsLibrary.Get Request    session    ${CONFIG_NODES_API}/node/openflow:1/table/2
24     Should Be Equal As Strings    ${resp.status_code}    200
25     Should Contain    ${resp.text}    139
26
27 Verify after adding flow operational - Sending IPv4 Dest Address and Eth type
28     [Documentation]    Verify the flow
29     ${elements}=    Create List    10.0.10.1
30     Wait Until Keyword Succeeds    10s    2s    Check For Elements At URI    ${OPERATIONAL_NODES_API}/node/openflow:1/table/2/flow/139    ${elements}
31
32 Modify a flow - Output to physical port#
33     [Documentation]    Push a flow through REST-API
34     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_NODES_API}/node/openflow:1/table/2/flow/139    headers=${HEADERS_XML}    data=${BODY2}
35     Should Be Equal As Strings    ${resp.status_code}    200
36
37 Verify after modifying flow config - Output to physical port#
38     [Documentation]    Verify the flow
39     ${resp}    RequestsLibrary.Get Request    session    ${CONFIG_NODES_API}/node/openflow:1/table/2
40     Should Be Equal As Strings    ${resp.status_code}    200
41     Should Contain    ${resp.text}    10.0.20.1
42
43 Verify after modifying flow operational - Output to physical port#
44     [Documentation]    Verify the flow
45     ${elements}=    Create List    10.0.20.1
46     Wait Until Keyword Succeeds    10s    2s    Check For Elements At URI    ${OPERATIONAL_NODES_API}/node/openflow:1/table/2/flow/139    ${elements}
47
48 Remove a flow - Output to physical port#
49     [Documentation]    Remove a flow
50     ${resp}    RequestsLibrary.Delete Request    session    ${CONFIG_NODES_API}/node/openflow:1/table/2/flow/139
51     Should Be Equal As Strings    ${resp.status_code}    200
52
53 Verify after deleting flow config - Output to physical port#
54     [Documentation]    Verify the flow
55     ${resp}    RequestsLibrary.Get Request    session    ${CONFIG_NODES_API}/node/openflow:1/table/2
56     Should Be Equal As Strings    ${resp.status_code}    200
57     Should Not Contain    ${resp.text}    139
58
59 Verify after deleting flow operational - Output to physical port#
60     [Documentation]    Verify the flow
61     ${elements}=    Create List    10.0.20.1
62     Wait Until Keyword Succeeds    10s    2s    Check For Elements Not At URI    ${OPERATIONAL_NODES_API}/node/openflow:1/table/2    ${elements}