*** Settings ***
Documentation Test suite for RESTCONF FRM
Suite Setup Create Session session http://${CONTROLLER}:${PORT} auth=${AUTH} headers=${HEADERS_XML}
Suite Teardown Delete All Sessions
Library Collections
Library ../../../libraries/RequestsLibrary.py
Library ../../../libraries/Common.py
Variables ../../../variables/Variables.py
*** Variables ***
${REST_CON} /restconf/config/opendaylight-inventory:nodes
${REST_OPR} /restconf/operational/opendaylight-inventory:nodes
${BODY1} 2Foo204810.0.10.1/32139200
${BODY2} 2Foo204810.0.20.1/32152200160
*** Test Cases ***
Add a flow - Sending IPv4 Dest Address and Eth type
[Documentation] Push a flow through REST-API
[Tags] Push
${resp} Putxml session ${REST_CON}/node/openflow:1/table/2/flow/139 data=${BODY1}
Should Be Equal As Strings ${resp.status_code} 200
Verify after adding flow config - Sending IPv4 Dest Address and Eth type
[Documentation] Verify the flow
[Tags] Get
${resp} Get session ${REST_CON}/node/openflow:1/table/2
Should Be Equal As Strings ${resp.status_code} 200
Should Contain ${resp.content} 139
Verify after adding flow operational - Sending IPv4 Dest Address and Eth type
[Documentation] Verify the flow
[Tags] Get
Sleep 30
${resp} Get session ${REST_OPR}/node/openflow:1/table/2
Should Be Equal As Strings ${resp.status_code} 200
Should Contain ${resp.content} 10.0.10.1
Remove a flow - - Sending IPv4 Dest Address and Eth type
[Documentation] Remove a flow
[Tags] remove
${resp} Delete session ${REST_CON}/node/openflow:1/table/2/flow/139
Should Be Equal As Strings ${resp.status_code} 200
Verify after deleting flow config - Sending IPv4 Dest Address and Eth type
[Documentation] Verify the flow
[Tags] Get
${resp} Get session ${REST_CON}/node/openflow:1/table/2
Should Be Equal As Strings ${resp.status_code} 200
Should Not Contain ${resp.content} 139
# Reason in using high time is, I used STOPWATCH to check the timer after deleting the flow config
Verify after deleting flow operational - Sending IPv4 Dest Address and Eth type
[Documentation] Verify the flow
[Tags] Get
Sleep 30
${resp} Get session ${REST_OPR}/node/openflow:1/table/2
Should Be Equal As Strings ${resp.status_code} 200
Should Not Contain ${resp.content} 10.0.10.1
Add a flow - Output to physical port#
[Documentation] Push a flow through REST-API
[Tags] Push
${resp} Putxml session ${REST_CON}/node/openflow:1/table/2/flow/152 data=${BODY2}
Should Be Equal As Strings ${resp.status_code} 200
Verify after adding flow config - Output to physical port#
[Documentation] Verify the flow
[Tags] Get
${resp} Get session ${REST_CON}/node/openflow:1/table/2
Should Be Equal As Strings ${resp.status_code} 200
Should Contain ${resp.content} 152
Verify after adding flow operational - Output to physical port#
[Documentation] Verify the flow
[Tags] Get
Sleep 30
${resp} Get session ${REST_OPR}/node/openflow:1/table/2
Should Be Equal As Strings ${resp.status_code} 200
Should Contain ${resp.content} 10.0.20.1
Remove a flow - Output to physical port#
[Documentation] Remove a flow
[Tags] remove
${resp} Delete session ${REST_CON}/node/openflow:1/table/2/flow/152
Should Be Equal As Strings ${resp.status_code} 200
Verify after deleting flow config - Output to physical port#
[Documentation] Verify the flow
[Tags] Get
${resp} Get session ${REST_CON}/node/openflow:1/table/2
Should Be Equal As Strings ${resp.status_code} 200
Should Not Contain ${resp.content} 152
Verify after deleting flow operational - Output to physical port#
[Documentation] Verify the flow
[Tags] Get
Sleep 40
${resp} Get session ${REST_OPR}/node/openflow:1/table/2
Should Be Equal As Strings ${resp.status_code} 200
Should Not Contain ${resp.content} 10.0.20.1