2 Documentation Test suite for Flow Programmer
3 Suite Setup Create Session session http://${CONTROLLER}:${RESTPORT} auth=${AUTH} headers=${HEADERS}
4 Suite Teardown Delete All Sessions
6 Library RequestsLibrary
7 Library ../../../libraries/Common.py
8 Variables ../../../variables/Variables.py
9 Resource ../../../libraries/Utils.robot
13 ${node_id} 00:00:00:00:00:00:00:02
14 ${REST_CONTEXT} /controller/nb/v2/flowprogrammer
15 ${REST_CONTEXT_ST} /controller/nb/v2/statistics
19 [Documentation] Add a flow, list to validate the result.
21 ${body} Set Variable {"installInHw":"true","name":"flow1","node":{"id":"00:00:00:00:00:00:00:02","type":"OF"},"priority":"1","etherType":"0x800","nwDst":"10.0.0.1/32","actions":["OUTPUT=1"]}
22 ${expected_content} To JSON ${body}
23 ${resp} RequestsLibrary.Put session ${REST_CONTEXT}/${CONTAINER}/node/OF/${node_id}/staticFlow/${name} data=${body}
24 Should Be Equal As Strings ${resp.status_code} 201
25 ${resp} RequestsLibrary.Get session ${REST_CONTEXT}/${CONTAINER}
26 Should Be Equal As Strings ${resp.status_code} 200
27 ${result} To JSON ${resp.content}
28 ${resp_content} Get From Dictionary ${result} flowConfig
29 List Should Contain Value ${resp_content} ${expected_content}
31 Check flow in flow stats
32 [Documentation] Show flow stats and validate result
34 ${elements}= Create List 10.0.0.1
35 Wait Until Keyword Succeeds 90s 2s Check For Elements At URI ${REST_CONTEXT_ST}/${CONTAINER}/flow ${elements}
38 [Documentation] Remove a flow, list to validate the result.
40 ${node} Create Dictionary type=OF id=${node_id}
41 ${actions} Create List OUTPUT=1
42 ${expected_content} Create Dictionary name=${name} installInHw=true node=${node} priority=1 etherType=0x800
43 ... nwDst=10.0.0.1/32 actions=${actions}
44 ${resp} RequestsLibrary.Delete session ${REST_CONTEXT}/${CONTAINER}/node/OF/${node_id}/staticFlow/${name}
45 Should Be Equal As Strings ${resp.status_code} 204
46 ${resp} RequestsLibrary.Get session ${REST_CONTEXT}/${CONTAINER}
47 Should Be Equal As Strings ${resp.status_code} 200
48 ${result} To JSON ${resp.content}
49 ${resp_content} Get From Dictionary ${result} flowConfig
50 List Should Not Contain Value ${resp_content} ${expected_content}
52 Check flow is not in flow stats
53 [Documentation] Show flow stats and validate result
55 ${elements}= Create List 10.0.0.1
56 Wait Until Keyword Succeeds 60s 2s Check For Elements Not At URI ${REST_CONTEXT_ST}/${CONTAINER}/flow ${elements}