2 Library OperatingSystem
6 Library ../../../../csit/libraries/XmlComparator.py
7 Variables ../../../../csit/variables/Variables.py
8 Library ../../../../csit/libraries/RequestsLibrary.py
9 Library ../../../../csit/libraries/Common.py
10 Library SanityLibrary.py
11 Suite Setup Create Controllers Sessions
12 Suite Teardown Delete All Sessions
19 ${switch_name}= s${switch_idx}
20 ${url_m1_shard}= /jolokia/read/org.opendaylight.controller:Category=Shards,name=member-1-shard-inventory-config,type=DistributedConfigDatastore
21 ${url_m2_shard}= /jolokia/read/org.opendaylight.controller:Category=Shards,name=member-2-shard-inventory-config,type=DistributedConfigDatastore
22 ${url_m3_shard}= /jolokia/read/org.opendaylight.controller:Category=Shards,name=member-3-shard-inventory-config,type=DistributedConfigDatastore
23 ${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
26 Logging Initial Cluster Information
27 ${resp}= Get Controller Response session1 /jolokia/read/org.opendaylight.controller:Category=Shards,name=member-1-shard-inventory-config,type=DistributedConfigDatastore
29 ${resp}= Get Controller Response session1 /jolokia/read/org.opendaylight.controller:Category=Shards,name=member-1-shard-inventory-operational,type=DistributedOperationalDatastore
31 ${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
33 ${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
35 ${resp}= Get Controller Response session2 /jolokia/read/org.opendaylight.controller:Category=Shards,name=member-2-shard-inventory-config,type=DistributedConfigDatastore
37 ${resp}= Get Controller Response session2 /jolokia/read/org.opendaylight.controller:Category=Shards,name=member-2-shard-inventory-operational,type=DistributedOperationalDatastore
39 ${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
41 ${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
43 ${resp}= Get Controller Response session3 /jolokia/read/org.opendaylight.controller:Category=Shards,name=member-3-shard-inventory-config,type=DistributedConfigDatastore
45 ${resp}= Get Controller Response session3 /jolokia/read/org.opendaylight.controller:Category=Shards,name=member-3-shard-inventory-operational,type=DistributedOperationalDatastore
47 ${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
49 ${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
51 Add Flow 1 To Controller1
52 Init Flow Variables 1 1 1
54 ${resp}= Putxml session1 /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} data=${data}
56 ${msg}= Set Variable Adding flow for /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} failed, http response ${resp.status_code} received.
57 Should Be Equal As Strings ${resp.status_code} 200 msg=${msg}
58 Add Flow 2 To Controller2
59 Init Flow Variables 1 2 2
61 ${resp}= Putxml session2 /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} data=${data}
63 ${msg}= Set Variable Adding flow for /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} failed, http response ${resp.status_code} received.
64 Should Be Equal As Strings ${resp.status_code} 200 msg=${msg}
65 Add Flow 3 To Controller3
66 Init Flow Variables 1 3 3
68 ${resp}= Putxml session3 /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} data=${data}
70 ${msg}= Set Variable Adding flow for /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} failed, http response ${resp.status_code} received.
71 Should Be Equal As Strings ${resp.status_code} 200 msg=${msg}
72 Show Switch Content After Add
74 Write dpctl dump-flows -O OpenFlow13
78 Check Flow 1 Configured On Controller1
79 Init Flow Variables 1 1 1
80 ${resp}= Get Controller Response session1 /restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/1/flow/1
82 Should Be Equal As Strings ${resp.status_code} 200
83 ${pres} ${msg}= Is Flow Configured ${data} ${resp.content}
84 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
85 Should Be Equal ${True} ${pres} msg=${msg}
86 Check Flow 1 Operational On Controller1
87 Init Flow Variables 1 1 1
88 ${resp}= Get Controller Response session1 /restconf/operational/opendaylight-inventory:nodes/node/openflow:1/table/1
90 Should Be Equal As Strings ${resp.status_code} 200
91 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
92 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
93 Should Be Equal ${True} ${pres} msg=${msg}
94 Check Flow 1 Configured On Controller2
95 Init Flow Variables 1 1 1
96 ${resp}= Get Controller Response session2 /restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/1/flow/1
98 Should Be Equal As Strings ${resp.status_code} 200
99 ${pres} ${msg}= Is Flow Configured ${data} ${resp.content}
100 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
101 Should Be Equal ${True} ${pres} msg=${msg}
102 Check Flow 1 Operational On Controller2
103 Init Flow Variables 1 1 1
104 ${resp}= Get Controller Response session2 /restconf/operational/opendaylight-inventory:nodes/node/openflow:1/table/1
106 Should Be Equal As Strings ${resp.status_code} 200
107 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
108 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
109 Should Be Equal ${True} ${pres} msg=${msg}
110 Check Flow 1 Configured On Controller3
111 Init Flow Variables 1 1 1
112 ${resp}= Get Controller Response session3 /restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/1/flow/1
114 Should Be Equal As Strings ${resp.status_code} 200
115 ${pres} ${msg}= Is Flow Configured ${data} ${resp.content}
116 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
117 Should Be Equal ${True} ${pres} msg=${msg}
118 Check Flow 1 Operational On Controller3
119 Init Flow Variables 1 1 1
120 ${resp}= Get Controller Response session3 /restconf/operational/opendaylight-inventory:nodes/node/openflow:1/table/1
122 Should Be Equal As Strings ${resp.status_code} 200
123 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
124 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
125 Should Be Equal ${True} ${pres} msg=${msg}
126 Check Flow 2 Configured On Controller1
127 Init Flow Variables 1 2 2
128 ${resp}= Get Controller Response session1 /restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/1/flow/2
130 Should Be Equal As Strings ${resp.status_code} 200
131 ${pres} ${msg}= Is Flow Configured ${data} ${resp.content}
132 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
133 Should Be Equal ${True} ${pres} msg=${msg}
134 Check Flow 2 Operational On Controller1
135 Init Flow Variables 1 2 2
136 ${resp}= Get Controller Response session1 /restconf/operational/opendaylight-inventory:nodes/node/openflow:1/table/1
138 Should Be Equal As Strings ${resp.status_code} 200
139 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
140 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
141 Should Be Equal ${True} ${pres} msg=${msg}
142 Check Flow 2 Configured On Controller2
143 Init Flow Variables 1 2 2
144 ${resp}= Get Controller Response session2 /restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/1/flow/2
146 Should Be Equal As Strings ${resp.status_code} 200
147 ${pres} ${msg}= Is Flow Configured ${data} ${resp.content}
148 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
149 Should Be Equal ${True} ${pres} msg=${msg}
150 Check Flow 2 Operational On Controller2
151 Init Flow Variables 1 2 2
152 ${resp}= Get Controller Response session2 /restconf/operational/opendaylight-inventory:nodes/node/openflow:1/table/1
154 Should Be Equal As Strings ${resp.status_code} 200
155 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
156 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
157 Should Be Equal ${True} ${pres} msg=${msg}
158 Check Flow 2 Configured On Controller3
159 Init Flow Variables 1 2 2
160 ${resp}= Get Controller Response session3 /restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/1/flow/2
162 Should Be Equal As Strings ${resp.status_code} 200
163 ${pres} ${msg}= Is Flow Configured ${data} ${resp.content}
164 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
165 Should Be Equal ${True} ${pres} msg=${msg}
166 Check Flow 2 Operational On Controller3
167 Init Flow Variables 1 2 2
168 ${resp}= Get Controller Response session3 /restconf/operational/opendaylight-inventory:nodes/node/openflow:1/table/1
170 Should Be Equal As Strings ${resp.status_code} 200
171 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
172 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
173 Should Be Equal ${True} ${pres} msg=${msg}
174 Check Flow 3 Configured On Controller1
175 Init Flow Variables 1 3 3
176 ${resp}= Get Controller Response session1 /restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/1/flow/3
178 Should Be Equal As Strings ${resp.status_code} 200
179 ${pres} ${msg}= Is Flow Configured ${data} ${resp.content}
180 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
181 Should Be Equal ${True} ${pres} msg=${msg}
182 Check Flow 3 Operational On Controller1
183 Init Flow Variables 1 3 3
184 ${resp}= Get Controller Response session1 /restconf/operational/opendaylight-inventory:nodes/node/openflow:1/table/1
186 Should Be Equal As Strings ${resp.status_code} 200
187 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
188 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
189 Should Be Equal ${True} ${pres} msg=${msg}
190 Check Flow 3 Configured On Controller2
191 Init Flow Variables 1 3 3
192 ${resp}= Get Controller Response session2 /restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/1/flow/3
194 Should Be Equal As Strings ${resp.status_code} 200
195 ${pres} ${msg}= Is Flow Configured ${data} ${resp.content}
196 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
197 Should Be Equal ${True} ${pres} msg=${msg}
198 Check Flow 3 Operational On Controller2
199 Init Flow Variables 1 3 3
200 ${resp}= Get Controller Response session2 /restconf/operational/opendaylight-inventory:nodes/node/openflow:1/table/1
202 Should Be Equal As Strings ${resp.status_code} 200
203 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
204 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
205 Should Be Equal ${True} ${pres} msg=${msg}
206 Check Flow 3 Configured On Controller3
207 Init Flow Variables 1 3 3
208 ${resp}= Get Controller Response session3 /restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/1/flow/3
210 Should Be Equal As Strings ${resp.status_code} 200
211 ${pres} ${msg}= Is Flow Configured ${data} ${resp.content}
212 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
213 Should Be Equal ${True} ${pres} msg=${msg}
214 Check Flow 3 Operational On Controller3
215 Init Flow Variables 1 3 3
216 ${resp}= Get Controller Response session3 /restconf/operational/opendaylight-inventory:nodes/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}
222 Delete Flow 1 On Controller1
223 Init Flow Variables 1 1 1
224 ${resp}= Delete session1 /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id}
226 ${msg}= Set Variable Delete flow for /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} failed, http response ${resp.status_code} received.
227 Should Be Equal As Strings ${resp.status_code} 200 msg=${msg}
228 Delete Flow 2 On Controller2
229 Init Flow Variables 1 2 2
230 ${resp}= Delete session2 /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id}
232 ${msg}= Set Variable Delete flow for /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} failed, http response ${resp.status_code} received.
233 Should Be Equal As Strings ${resp.status_code} 200 msg=${msg}
234 Delete Flow 3 On Controller3
235 Init Flow Variables 1 3 3
236 ${resp}= Delete session3 /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id}
238 ${msg}= Set Variable Delete flow for /restconf/config/opendaylight-inventory:nodes/node/openflow:${switch_idx}/table/${table_id}/flow/${flow_id} failed, http response ${resp.status_code} received.
239 Should Be Equal As Strings ${resp.status_code} 200 msg=${msg}
240 Show Switch Content After Delete
242 Write dpctl dump-flows -O OpenFlow13
246 Check Flow 1 Not Configured On Controller1
247 ${resp}= Get Controller Response session1 /restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/1/flow/1
249 Should Be Equal As Strings ${resp.status_code} 404
250 Check Flow 1 Not Operational On Controller1
251 ${resp}= Get Controller Response session1 /restconf/operational/opendaylight-inventory:nodes/node/openflow:1/table/1
253 Should Be Equal As Strings ${resp.status_code} 200
254 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
255 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
256 Should Be Equal ${False} ${pres} msg=${msg}
257 Check Flow 1 Not Configured On Controller2
258 ${resp}= Get Controller Response session2 /restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/1/flow/1
260 Should Be Equal As Strings ${resp.status_code} 404
261 Check Flow 1 Not Operational On Controller2
262 ${resp}= Get Controller Response session2 /restconf/operational/opendaylight-inventory:nodes/node/openflow:1/table/1
264 Should Be Equal As Strings ${resp.status_code} 200
265 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
266 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
267 Should Be Equal ${False} ${pres} msg=${msg}
268 Check Flow 1 Not Configured On Controller3
269 ${resp}= Get Controller Response session3 /restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/1/flow/1
271 Should Be Equal As Strings ${resp.status_code} 404
272 Check Flow 1 Not Operational On Controller3
273 ${resp}= Get Controller Response session3 /restconf/operational/opendaylight-inventory:nodes/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}
279 Check Flow 2 Not Configured On Controller1
280 ${resp}= Get Controller Response session1 /restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/1/flow/2
282 Should Be Equal As Strings ${resp.status_code} 404
283 Check Flow 2 Not Operational On Controller1
284 ${resp}= Get Controller Response session1 /restconf/operational/opendaylight-inventory:nodes/node/openflow:1/table/1
286 Should Be Equal As Strings ${resp.status_code} 200
287 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
288 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
289 Should Be Equal ${False} ${pres} msg=${msg}
290 Check Flow 2 Not Configured On Controller2
291 ${resp}= Get Controller Response session2 /restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/1/flow/2
293 Should Be Equal As Strings ${resp.status_code} 404
294 Check Flow 2 Not Operational On Controller2
295 ${resp}= Get Controller Response session2 /restconf/operational/opendaylight-inventory:nodes/node/openflow:1/table/1
297 Should Be Equal As Strings ${resp.status_code} 200
298 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
299 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
300 Should Be Equal ${False} ${pres} msg=${msg}
301 Check Flow 2 Not Configured On Controller3
302 ${resp}= Get Controller Response session3 /restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/1/flow/2
304 Should Be Equal As Strings ${resp.status_code} 404
305 Check Flow 2 Not Operational On Controller3
306 ${resp}= Get Controller Response session3 /restconf/operational/opendaylight-inventory:nodes/node/openflow:1/table/1
308 Should Be Equal As Strings ${resp.status_code} 200
309 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
310 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
311 Should Be Equal ${False} ${pres} msg=${msg}
312 Check Flow 3 Not Configured On Controller1
313 ${resp}= Get Controller Response session1 /restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/1/flow/3
315 Should Be Equal As Strings ${resp.status_code} 404
316 Check Flow 3 Not Operational On Controller1
317 ${resp}= Get Controller Response session1 /restconf/operational/opendaylight-inventory:nodes/node/openflow:1/table/1
319 Should Be Equal As Strings ${resp.status_code} 200
320 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
321 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
322 Should Be Equal ${False} ${pres} msg=${msg}
323 Check Flow 3 Not Configured On Controller2
324 ${resp}= Get Controller Response session2 /restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/1/flow/3
326 Should Be Equal As Strings ${resp.status_code} 404
327 Check Flow 3 Not Operational On Controller2
328 ${resp}= Get Controller Response session2 /restconf/operational/opendaylight-inventory:nodes/node/openflow:1/table/1
330 Should Be Equal As Strings ${resp.status_code} 200
331 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
332 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
333 Should Be Equal ${False} ${pres} msg=${msg}
334 Check Flow 3 Not Configured On Controller3
335 ${resp}= Get Controller Response session3 /restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/1/flow/3
337 Should Be Equal As Strings ${resp.status_code} 404
338 Check Flow 3 Not Operational On Controller3
339 ${resp}= Get Controller Response session3 /restconf/operational/opendaylight-inventory:nodes/node/openflow:1/table/1
341 Should Be Equal As Strings ${resp.status_code} 200
342 ${pres} ${msg}= Is Flow Operational2 ${data} ${resp.content}
343 Run Keyword If '''${msg}'''!='${EMPTY}' Log ${msg}
344 Should Be Equal ${False} ${pres} msg=${msg}
346 Init Flow Variables [Arguments] ${tableid} ${flowid} ${priority}
347 ${data}= Get Flow Content ${tableid} ${flowid} ${priority}
348 ${xmlroot}= Parse Xml ${data}
349 ${table_id}= Set Variable ${tableid}
350 ${flow_id}= Set Variable ${flowid}
351 ${flow_priority}= Set Variable ${priority}
352 Set Suite Variable ${table_id}
353 Set Suite Variable ${flow_id}
354 Set Suite Variable ${flow_priority}
355 Set Suite Variable ${data}
356 Set Suite Variable ${xmlroot}
357 Create Controllers Sessions
358 Create Session session1 http://${CONTROLLER1}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS_XML}
359 Create Session session2 http://${CONTROLLER2}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS_XML}
360 Create Session session3 http://${CONTROLLER3}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS_XML}
361 Get Controller Response [Arguments] ${session} ${url}
362 ${headers}= Create Dictionary Accept application/xml
363 ${resp}= Get ${session} ${url} headers=${headers}
364 Return From Keyword ${resp}