2 Documentation Test suite for pushing/verify/remove a flow through RESTCONF
3 Suite Setup Create Session session http://${CONTROLLER}:8080 auth=${AUTH} headers=${HEADERS_XML}
4 Suite Teardown Delete All Sessions
6 Library ../../libraries/RequestsLibrary.py
7 Library ../../libraries/Common.py
8 Variables ../../variables/Variables.py
12 ${REST_CON} /restconf/config/opendaylight-inventory:nodes
13 ${REST_OPR} /restconf/operational/opendaylight-inventory:nodes
14 ${BODY} <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.2/24</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>
18 [Documentation] Push a flow through REST-API
20 ${resp} Putxml session ${REST_CON}/node/openflow:1/table/2/flow/139 data=${BODY}
21 Should Be Equal As Strings ${resp.status_code} 200
23 Verify after adding flow config
24 [Documentation] Verify the flow
26 ${resp} Get session ${REST_CON}/node/openflow:1/table/2
27 Should Be Equal As Strings ${resp.status_code} 200
28 Should Contain ${resp.content} 10.0.10.2/24
29 Should Contain ${resp.content} 2048
31 Verify after adding flow operational
32 [Documentation] Verify the flow
34 ${resp} Get session ${REST_OPR}/node/openflow:1/table/2
35 Should Be Equal As Strings ${resp.status_code} 200
36 Should Contain ${resp.content} "flow-node-inventory:id": 2
39 [Documentation] Remove a flow
41 ${resp} Delete session ${REST_CON}/node/openflow:1/table/2/flow/139
42 Should Be Equal As Strings ${resp.status_code} 200
44 Verify after deleting flow config
45 [Documentation] Verify the flow
47 ${resp} Get session ${REST_CON}/node/openflow:1/table/2
48 Should Be Equal As Strings ${resp.status_code} 404
49 Should Contain ${resp.content} No data exists
50 Should Not Contain ${resp.content} 10.0.10.2/24
51 Should Not Contain ${resp.content} 2048