2 Documentation Test suite for OpenFlow meter
3 Suite Setup Create Session session http://${CONTROLLER}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS_XML}
4 Suite Teardown Delete All Sessions
7 Library OperatingSystem
8 Library ../../../libraries/RequestsLibrary.py
9 Library ../../../libraries/Common.py
10 Variables ../../../variables/Variables.py
11 Resource ../../../libraries/Utils.txt
14 ${REST_CONTEXT} /restconf/operational/opendaylight-inventory:nodes/
15 ${REST_CONTEXT_CF} /restconf/config/opendaylight-inventory:nodes/node/openflow:1
16 ${REST_CONTEXT_OP} /restconf/operational/opendaylight-inventory:nodes/node/openflow:1
17 ${METER} ${CURDIR}/../../../variables/xmls/m4.xml
18 ${FLOW} ${CURDIR}/../../../variables/xmls/f51.xml
24 [Documentation] Get the inventory to make sure openflow:1 comes up
25 ${resp} RequestsLibrary.Get session ${REST_CONTEXT}
27 Should Be Equal As Strings ${resp.status_code} 200
28 Should Contain ${resp.content} openflow:1
31 [Documentation] Add a meter using RESTCONF
33 ${body} OperatingSystem.Get File ${METER}
34 Set Suite Variable ${body}
35 ${resp} Putxml session ${REST_CONTEXT_CF}/meter/1 data=${body}
37 Should Be Equal As Strings ${resp.status_code} 200
39 Verify after adding meter config
40 [Documentation] Get the meter stat in config
41 ${resp} RequestsLibrary.Get session ${REST_CONTEXT_CF}/meter/1
43 Should Be Equal As Strings ${resp.status_code} 200
44 Should Contain ${resp.content} ${METER_NAME}
46 Verify after adding meter operational
47 [Documentation] Get the meter stat in operational
48 ${elements}= Create List meter-statistics meter-config-stats
49 Wait Until Keyword Succeeds 60s 2s Check For Elements At URI ${REST_CONTEXT_OP}/meter/1 ${elements}
51 Add a flow that includes a meter
52 [Documentation] Push a flow through RESTCONF
54 ${body} OperatingSystem.Get File ${FLOW}
55 Set Suite Variable ${body}
56 ${resp} Putxml session ${REST_CONTEXT_CF}/table/0/flow/2 data=${body}
58 Should Be Equal As Strings ${resp.status_code} 200
60 Verify after adding flow config
61 [Documentation] Verify the flow
63 ${resp} RequestsLibrary.Get session ${REST_CONTEXT_CF}/table/0/flow/2
65 Should Be Equal As Strings ${resp.status_code} 200
66 Should Contain ${resp.content} ${FLOW_NAME}
68 Verify after adding flow operational
69 [Documentation] Verify the flow
70 ${elements}= Create List meter-id flow
71 Wait Until Keyword Succeeds 60s 2s Check For Elements At URI ${REST_CONTEXT_OP}/table/0/flow/2 ${elements}
74 [Documentation] Remove the flow
75 ${resp} RequestsLibrary.Delete session ${REST_CONTEXT_CF}/table/0/flow/2
76 Should Be Equal As Strings ${resp.status_code} 200
78 Verify after deleting flow
79 [Documentation] Verify the flow removal
81 ${resp} RequestsLibrary.Get session ${REST_CONTEXT_CF}/table/0/flow/2
82 Should Not Contain ${resp.content} ${FLOW_NAME}
85 [Documentation] Remove the meter
87 ${resp} RequestsLibrary.Delete session ${REST_CONTEXT_CF}/meter/1
89 Should Be Equal As Strings ${resp.status_code} 200
91 Verify after deleting meter
92 [Documentation] Verify the flow removal
94 ${resp} RequestsLibrary.Get session ${REST_CONTEXT_CF}/meter/1
95 Should Not Contain ${resp.content} ${METER_NAME}