2 Suite Setup Create Controllers Sessions
3 Suite Teardown Delete All Sessions
4 Library OperatingSystem
8 Library ../../../libraries/XmlComparator.py
9 Variables ../../../variables/Variables.py
10 Library RequestsLibrary
11 Library ../../../libraries/Common.py
15 ${switch_name} s${switch_idx}
16 ${url_m1_shard} /jolokia/read/org.opendaylight.controller:Category=Shards,name=member-1-shard-inventory-config,type=DistributedConfigDatastore
17 ${url_m2_shard} /jolokia/read/org.opendaylight.controller:Category=Shards,name=member-2-shard-inventory-config,type=DistributedConfigDatastore
18 ${url_m3_shard} /jolokia/read/org.opendaylight.controller:Category=Shards,name=member-3-shard-inventory-config,type=DistributedConfigDatastore
19 ${get_pers_url} /restconf/config/network-topology:network-topology/topology/topology-netconf/node/controller-config/yang-ext:mount/config:modules/module/distributed-datastore-provider:distributed-config-datastore-provider/distributed-config-store-module
22 Logging Initial Cluster Information
23 ${resp}= Get Controller Response session1 /jolokia/read/org.opendaylight.controller:Category=Shards,name=member-1-shard-inventory-config,type=DistributedConfigDatastore
25 ${resp}= Get Controller Response session1 /jolokia/read/org.opendaylight.controller:Category=Shards,name=member-1-shard-inventory-operational,type=DistributedOperationalDatastore
27 ${resp}= Get Controller Response session1 /restconf/config/network-topology:network-topology/topology/topology-netconf/node/controller-config/yang-ext:mount/config:modules/module/distributed-datastore-provider:distributed-config-datastore-provider/distributed-config-store-module
29 ${resp}= Get Controller Response session1 /restconf/config/network-topology:network-topology/topology/topology-netconf/node/controller-config/yang-ext:mount/config:modules/module/distributed-datastore-provider:distributed-operational-datastore-provider/distributed-operational-store-module
31 ${resp}= Get Controller Response session2 /jolokia/read/org.opendaylight.controller:Category=Shards,name=member-2-shard-inventory-config,type=DistributedConfigDatastore
33 ${resp}= Get Controller Response session2 /jolokia/read/org.opendaylight.controller:Category=Shards,name=member-2-shard-inventory-operational,type=DistributedOperationalDatastore
35 ${resp}= Get Controller Response session2 /restconf/config/network-topology:network-topology/topology/topology-netconf/node/controller-config/yang-ext:mount/config:modules/module/distributed-datastore-provider:distributed-config-datastore-provider/distributed-config-store-module
37 ${resp}= Get Controller Response session2 /restconf/config/network-topology:network-topology/topology/topology-netconf/node/controller-config/yang-ext:mount/config:modules/module/distributed-datastore-provider:distributed-operational-datastore-provider/distributed-operational-store-module
39 ${resp}= Get Controller Response session3 /jolokia/read/org.opendaylight.controller:Category=Shards,name=member-3-shard-inventory-config,type=DistributedConfigDatastore
41 ${resp}= Get Controller Response session3 /jolokia/read/org.opendaylight.controller:Category=Shards,name=member-3-shard-inventory-operational,type=DistributedOperationalDatastore
43 ${resp}= Get Controller Response session3 /restconf/config/network-topology:network-topology/topology/topology-netconf/node/controller-config/yang-ext:mount/config:modules/module/distributed-datastore-provider:distributed-config-datastore-provider/distributed-config-store-module
45 ${resp}= Get Controller Response session3 /restconf/config/network-topology:network-topology/topology/topology-netconf/node/controller-config/yang-ext:mount/config:modules/module/distributed-datastore-provider:distributed-operational-datastore-provider/distributed-operational-store-module
48 Add Flow 1 To Controller1
49 Init Flow Variables 1 1 1
51 ${resp}= Put session1 ${CONFIG_NODES_API}/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} data=${data}
53 ${msg}= Set Variable Adding flow for ${CONFIG_NODES_API}/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} failed, http response ${resp.status_code} received.
54 Should Be Equal As Strings ${resp.status_code} 200 msg=${msg}
56 Add Flow 2 To Controller2
57 Init Flow Variables 1 2 2
59 ${resp}= Put session2 ${CONFIG_NODES_API}/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} data=${data}
61 ${msg}= Set Variable Adding flow for ${CONFIG_NODES_API}/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} failed, http response ${resp.status_code} received.
62 Should Be Equal As Strings ${resp.status_code} 200 msg=${msg}
64 Add Flow 3 To Controller3
65 Init Flow Variables 1 3 3
67 ${resp}= Put session3 ${CONFIG_NODES_API}/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} data=${data}
69 ${msg}= Set Variable Adding flow for ${CONFIG_NODES_API}/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} failed, http response ${resp.status_code} received.
70 Should Be Equal As Strings ${resp.status_code} 200 msg=${msg}
72 Show Switch Content After Add
74 Write sh ovs-vsctl show
76 Write sh ovs-ofctl dump-flows s1 -O OpenFlow13
79 Check Flow 1 Configured On Controller1
80 Init Flow Variables 1 1 1
81 ${resp}= Get Controller Response session1 ${CONFIG_NODES_API}/node/openflow:1/table/1/flow/1
83 Should Be Equal As Strings ${resp.status_code} 200
84 ${pres} ${msg}= Is Flow Configured ${data} ${resp.content}
85 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
86 Should Be Equal ${True} ${pres} msg=${msg}
88 Check Flow 1 Operational On Controller1
89 Init Flow Variables 1 1 1
90 ${resp}= Get Controller Response session1 ${OPERATIONAL_NODES_API}/node/openflow:1/table/1
92 Should Be Equal As Strings ${resp.status_code} 200
93 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
94 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
95 Should Be Equal ${True} ${pres} msg=${msg}
97 Check Flow 1 Configured On Controller2
98 Init Flow Variables 1 1 1
99 ${resp}= Get Controller Response session2 ${CONFIG_NODES_API}/node/openflow:1/table/1/flow/1
101 Should Be Equal As Strings ${resp.status_code} 200
102 ${pres} ${msg}= Is Flow Configured ${data} ${resp.content}
103 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
104 Should Be Equal ${True} ${pres} msg=${msg}
106 Check Flow 1 Operational On Controller2
107 Init Flow Variables 1 1 1
108 ${resp}= Get Controller Response session2 ${OPERATIONAL_NODES_API}/node/openflow:1/table/1
110 Should Be Equal As Strings ${resp.status_code} 200
111 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
112 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
113 Should Be Equal ${True} ${pres} msg=${msg}
115 Check Flow 1 Configured On Controller3
116 Init Flow Variables 1 1 1
117 ${resp}= Get Controller Response session3 ${CONFIG_NODES_API}/node/openflow:1/table/1/flow/1
119 Should Be Equal As Strings ${resp.status_code} 200
120 ${pres} ${msg}= Is Flow Configured ${data} ${resp.content}
121 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
122 Should Be Equal ${True} ${pres} msg=${msg}
124 Check Flow 1 Operational On Controller3
125 Init Flow Variables 1 1 1
126 ${resp}= Get Controller Response session3 ${OPERATIONAL_NODES_API}/node/openflow:1/table/1
128 Should Be Equal As Strings ${resp.status_code} 200
129 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
130 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
131 Should Be Equal ${True} ${pres} msg=${msg}
133 Check Flow 2 Configured On Controller1
134 Init Flow Variables 1 2 2
135 ${resp}= Get Controller Response session1 ${CONFIG_NODES_API}/node/openflow:1/table/1/flow/2
137 Should Be Equal As Strings ${resp.status_code} 200
138 ${pres} ${msg}= Is Flow Configured ${data} ${resp.content}
139 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
140 Should Be Equal ${True} ${pres} msg=${msg}
142 Check Flow 2 Operational On Controller1
143 Init Flow Variables 1 2 2
144 ${resp}= Get Controller Response session1 ${OPERATIONAL_NODES_API}/node/openflow:1/table/1
146 Should Be Equal As Strings ${resp.status_code} 200
147 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
148 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
149 Should Be Equal ${True} ${pres} msg=${msg}
151 Check Flow 2 Configured On Controller2
152 Init Flow Variables 1 2 2
153 ${resp}= Get Controller Response session2 ${CONFIG_NODES_API}/node/openflow:1/table/1/flow/2
155 Should Be Equal As Strings ${resp.status_code} 200
156 ${pres} ${msg}= Is Flow Configured ${data} ${resp.content}
157 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
158 Should Be Equal ${True} ${pres} msg=${msg}
160 Check Flow 2 Operational On Controller2
161 Init Flow Variables 1 2 2
162 ${resp}= Get Controller Response session2 ${OPERATIONAL_NODES_API}/node/openflow:1/table/1
164 Should Be Equal As Strings ${resp.status_code} 200
165 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
166 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
167 Should Be Equal ${True} ${pres} msg=${msg}
169 Check Flow 2 Configured On Controller3
170 Init Flow Variables 1 2 2
171 ${resp}= Get Controller Response session3 ${CONFIG_NODES_API}/node/openflow:1/table/1/flow/2
173 Should Be Equal As Strings ${resp.status_code} 200
174 ${pres} ${msg}= Is Flow Configured ${data} ${resp.content}
175 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
176 Should Be Equal ${True} ${pres} msg=${msg}
178 Check Flow 2 Operational On Controller3
179 Init Flow Variables 1 2 2
180 ${resp}= Get Controller Response session3 ${OPERATIONAL_NODES_API}/node/openflow:1/table/1
182 Should Be Equal As Strings ${resp.status_code} 200
183 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
184 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
185 Should Be Equal ${True} ${pres} msg=${msg}
187 Check Flow 3 Configured On Controller1
188 Init Flow Variables 1 3 3
189 ${resp}= Get Controller Response session1 ${CONFIG_NODES_API}/node/openflow:1/table/1/flow/3
191 Should Be Equal As Strings ${resp.status_code} 200
192 ${pres} ${msg}= Is Flow Configured ${data} ${resp.content}
193 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
194 Should Be Equal ${True} ${pres} msg=${msg}
196 Check Flow 3 Operational On Controller1
197 Init Flow Variables 1 3 3
198 ${resp}= Get Controller Response session1 ${OPERATIONAL_NODES_API}/node/openflow:1/table/1
200 Should Be Equal As Strings ${resp.status_code} 200
201 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
202 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
203 Should Be Equal ${True} ${pres} msg=${msg}
205 Check Flow 3 Configured On Controller2
206 Init Flow Variables 1 3 3
207 ${resp}= Get Controller Response session2 ${CONFIG_NODES_API}/node/openflow:1/table/1/flow/3
209 Should Be Equal As Strings ${resp.status_code} 200
210 ${pres} ${msg}= Is Flow Configured ${data} ${resp.content}
211 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
212 Should Be Equal ${True} ${pres} msg=${msg}
214 Check Flow 3 Operational On Controller2
215 Init Flow Variables 1 3 3
216 ${resp}= Get Controller Response session2 ${OPERATIONAL_NODES_API}/node/openflow:1/table/1
218 Should Be Equal As Strings ${resp.status_code} 200
219 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
220 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
221 Should Be Equal ${True} ${pres} msg=${msg}
223 Check Flow 3 Configured On Controller3
224 Init Flow Variables 1 3 3
225 ${resp}= Get Controller Response session3 ${CONFIG_NODES_API}/node/openflow:1/table/1/flow/3
227 Should Be Equal As Strings ${resp.status_code} 200
228 ${pres} ${msg}= Is Flow Configured ${data} ${resp.content}
229 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
230 Should Be Equal ${True} ${pres} msg=${msg}
232 Check Flow 3 Operational On Controller3
233 Init Flow Variables 1 3 3
234 ${resp}= Get Controller Response session3 ${OPERATIONAL_NODES_API}/node/openflow:1/table/1
236 Should Be Equal As Strings ${resp.status_code} 200
237 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
238 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
239 Should Be Equal ${True} ${pres} msg=${msg}
241 Delete Flow 1 On Controller1
242 Init Flow Variables 1 1 1
243 ${resp}= Delete session1 ${CONFIG_NODES_API}/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id}
245 ${msg}= Set Variable Delete flow for ${CONFIG_NODES_API}/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} failed, http response ${resp.status_code} received.
246 Should Be Equal As Strings ${resp.status_code} 200 msg=${msg}
248 Delete Flow 2 On Controller2
249 Init Flow Variables 1 2 2
250 ${resp}= Delete session2 ${CONFIG_NODES_API}/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id}
252 ${msg}= Set Variable Delete flow for ${CONFIG_NODES_API}/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} failed, http response ${resp.status_code} received.
253 Should Be Equal As Strings ${resp.status_code} 200 msg=${msg}
255 Delete Flow 3 On Controller3
256 Init Flow Variables 1 3 3
257 ${resp}= Delete session3 ${CONFIG_NODES_API}/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id}
259 ${msg}= Set Variable Delete flow for ${CONFIG_NODES_API}/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} failed, http response ${resp.status_code} received.
260 Should Be Equal As Strings ${resp.status_code} 200 msg=${msg}
262 Show Switch Content After Delete
264 Write sh ovs-ofctl dump-flows s1 -O OpenFlow13
267 Check Flow 1 Not Configured On Controller1
268 ${resp}= Get Controller Response session1 ${CONFIG_NODES_API}/node/openflow:1/table/1/flow/1
270 Should Be Equal As Strings ${resp.status_code} 404
272 Check Flow 1 Not Operational On Controller1
273 ${resp}= Get Controller Response session1 ${OPERATIONAL_NODES_API}/node/openflow:1/table/1
275 Should Be Equal As Strings ${resp.status_code} 200
276 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
277 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
278 Should Be Equal ${False} ${pres} msg=${msg}
280 Check Flow 1 Not Configured On Controller2
281 ${resp}= Get Controller Response session2 ${CONFIG_NODES_API}/node/openflow:1/table/1/flow/1
283 Should Be Equal As Strings ${resp.status_code} 404
285 Check Flow 1 Not Operational On Controller2
286 ${resp}= Get Controller Response session2 ${OPERATIONAL_NODES_API}/node/openflow:1/table/1
288 Should Be Equal As Strings ${resp.status_code} 200
289 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
290 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
291 Should Be Equal ${False} ${pres} msg=${msg}
293 Check Flow 1 Not Configured On Controller3
294 ${resp}= Get Controller Response session3 ${CONFIG_NODES_API}/node/openflow:1/table/1/flow/1
296 Should Be Equal As Strings ${resp.status_code} 404
298 Check Flow 1 Not Operational On Controller3
299 ${resp}= Get Controller Response session3 ${OPERATIONAL_NODES_API}/node/openflow:1/table/1
301 Should Be Equal As Strings ${resp.status_code} 200
302 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
303 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
304 Should Be Equal ${False} ${pres} msg=${msg}
306 Check Flow 2 Not Configured On Controller1
307 ${resp}= Get Controller Response session1 ${CONFIG_NODES_API}/node/openflow:1/table/1/flow/2
309 Should Be Equal As Strings ${resp.status_code} 404
311 Check Flow 2 Not Operational On Controller1
312 ${resp}= Get Controller Response session1 ${OPERATIONAL_NODES_API}/node/openflow:1/table/1
314 Should Be Equal As Strings ${resp.status_code} 200
315 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
316 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
317 Should Be Equal ${False} ${pres} msg=${msg}
319 Check Flow 2 Not Configured On Controller2
320 ${resp}= Get Controller Response session2 ${CONFIG_NODES_API}/node/openflow:1/table/1/flow/2
322 Should Be Equal As Strings ${resp.status_code} 404
324 Check Flow 2 Not Operational On Controller2
325 ${resp}= Get Controller Response session2 ${OPERATIONAL_NODES_API}/node/openflow:1/table/1
327 Should Be Equal As Strings ${resp.status_code} 200
328 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
329 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
330 Should Be Equal ${False} ${pres} msg=${msg}
332 Check Flow 2 Not Configured On Controller3
333 ${resp}= Get Controller Response session3 ${CONFIG_NODES_API}/node/openflow:1/table/1/flow/2
335 Should Be Equal As Strings ${resp.status_code} 404
337 Check Flow 2 Not Operational On Controller3
338 ${resp}= Get Controller Response session3 ${OPERATIONAL_NODES_API}/node/openflow:1/table/1
340 Should Be Equal As Strings ${resp.status_code} 200
341 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
342 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
343 Should Be Equal ${False} ${pres} msg=${msg}
345 Check Flow 3 Not Configured On Controller1
346 ${resp}= Get Controller Response session1 ${CONFIG_NODES_API}/node/openflow:1/table/1/flow/3
348 Should Be Equal As Strings ${resp.status_code} 404
350 Check Flow 3 Not Operational On Controller1
351 ${resp}= Get Controller Response session1 ${OPERATIONAL_NODES_API}/node/openflow:1/table/1
353 Should Be Equal As Strings ${resp.status_code} 200
354 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
355 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
356 Should Be Equal ${False} ${pres} msg=${msg}
358 Check Flow 3 Not Configured On Controller2
359 ${resp}= Get Controller Response session2 ${CONFIG_NODES_API}/node/openflow:1/table/1/flow/3
361 Should Be Equal As Strings ${resp.status_code} 404
363 Check Flow 3 Not Operational On Controller2
364 ${resp}= Get Controller Response session2 ${OPERATIONAL_NODES_API}/node/openflow:1/table/1
366 Should Be Equal As Strings ${resp.status_code} 200
367 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
368 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
369 Should Be Equal ${False} ${pres} msg=${msg}
371 Check Flow 3 Not Configured On Controller3
372 ${resp}= Get Controller Response session3 ${CONFIG_NODES_API}/node/openflow:1/table/1/flow/3
374 Should Be Equal As Strings ${resp.status_code} 404
376 Check Flow 3 Not Operational On Controller3
377 ${resp}= Get Controller Response session3 ${OPERATIONAL_NODES_API}/node/openflow:1/table/1
379 Should Be Equal As Strings ${resp.status_code} 200
380 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
381 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
382 Should Be Equal ${False} ${pres} msg=${msg}
386 [Arguments] ${tableid} ${flowid} ${priority}
387 ${data}= Get Flow Content ${tableid} ${flowid} ${priority}
388 ${xmlroot}= Parse Xml ${data}
389 ${table_id}= Set Variable ${tableid}
390 ${flow_id}= Set Variable ${flowid}
391 ${flow_priority}= Set Variable ${priority}
392 Set Suite Variable ${table_id}
393 Set Suite Variable ${flow_id}
394 Set Suite Variable ${flow_priority}
395 Set Suite Variable ${data}
396 Set Suite Variable ${xmlroot}
398 Create Controllers Sessions
399 Create Session session1 http://${CONTROLLER}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS_XML}
400 Create Session session2 http://${CONTROLLER1}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS_XML}
401 Create Session session3 http://${CONTROLLER2}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS_XML}
403 Get Controller Response
404 [Arguments] ${session} ${url}
405 ${headers}= Create Dictionary Accept application/xml
406 ${resp}= Get ${session} ${url} headers=${headers}
407 Return From Keyword ${resp}