2 Documentation Switch connections and cluster are restarted.
3 Suite Setup Initialization Phase
4 Suite Teardown Final Phase
5 Library RequestsLibrary
7 Resource ../../../libraries/ClusterManagement.robot
8 Resource ../../../libraries/ClusterOpenFlow.robot
9 Resource ../../../libraries/TemplatedRequests.robot
10 Resource ../../../libraries/MininetKeywords.robot
11 Resource ../../../libraries/Utils.robot
12 Resource ../../../libraries/OvsManager.robot
13 Resource ../../../variables/Variables.robot
18 ${VAR_DIR} ${CURDIR}/../../../variables/openflowplugin
22 [Documentation] Add ${ITER} groups 1&2 and flows in every switch.
23 Add Groups And Flows On Member ${ITER}
25 Start Mininet Multiple Connections
26 [Documentation] Start mininet linear with connection to all cluster instances.
27 ${cluster_index_list}= ClusterManagement.List All Indices
28 ${mininet_conn_id}= MininetKeywords.Start Mininet Multiple Controllers ${TOOLS_SYSTEM_IP} ${cluster_index_list} --topo linear,${SWITCHES} --switch ovsk,protocols=OpenFlow13
29 BuiltIn.Set Suite Variable ${cluster_index_list}
30 BuiltIn.Set Suite Variable ${mininet_conn_id}
31 BuiltIn.Wait Until Keyword Succeeds 10s 1s OVSDB.Check OVS OpenFlow Connections ${TOOLS_SYSTEM_IP} ${SWITCHES*3}
34 [Documentation] Check Linear Topology.
35 BuiltIn.Wait Until Keyword Succeeds 30s 1s ClusterOpenFlow.Check Linear Topology On Member ${SWITCHES}
37 Check Flows In Operational DS
38 [Documentation] Check Flows after mininet starts.
39 BuiltIn.Wait Until Keyword Succeeds 10s 1s ClusterOpenFlow.Check Number Of Flows On Member ${all_flows}
41 Check Stats Are Not Frozen
42 [Documentation] Check that duration flow stat is increasing
43 BuiltIn.Wait Until Keyword Succeeds 30s 1s Check Flow Stats Are Not Frozen
45 Check Groups In Operational DS
46 [Documentation] Check Groups after mininet starts.
47 BuiltIn.Wait Until Keyword Succeeds 10s 1s ClusterOpenFlow.Check Number Of Groups On Member ${all_groups}
50 [Documentation] Check Flows in switch after mininet starts.
51 MininetKeywords.Check Flows In Mininet ${mininet_conn_id} ${all_flows}
53 Check Entity Owner Status And Find Owner and Successor Before Fail
54 [Documentation] Check Entity Owner Status and identify owner and successor for first switch s1.
55 ${original_owner} ${original_successor_list} ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:1 1
56 BuiltIn.Set Suite Variable ${original_owner}
57 BuiltIn.Set Suite Variable ${new_cluster_list} ${original_successor_list}
59 Disconnect Mininet From Owner
60 [Documentation] Disconnect mininet from the owner
61 ${original_owner_list} BuiltIn.Create List ${original_owner}
62 MininetKeywords.Disconnect Cluster Mininet break ${original_owner_list}
63 BuiltIn.Set Suite Variable ${original_owner_list}
65 Check Entity Owner Status And Find Owner and Successor After Fail
66 [Documentation] Check Entity Owner Status and identify owner and successor for first switch s1.
67 ${new_owner} ${new_successor_list} BuiltIn.Wait Until Keyword Succeeds 10s 1s ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:1
68 ... 1 ${new_cluster_list} after_stop=True
69 BuiltIn.Set Suite Variable ${new_owner}
70 BuiltIn.Set Suite Variable ${new_successor_list}
72 Check Switch Moves To New Master
73 [Documentation] Check switch s1 is connected to new Master.
74 ${new_master}= BuiltIn.Set Variable ${ODL_SYSTEM_${new_owner}_IP}
75 BuiltIn.Wait Until Keyword Succeeds 10s 1s OvsManager.Should Be Master s1 ${new_master} update_data=${True}
77 Check Linear Topology After Disconnect
78 [Documentation] Check Linear Topology After Disconnecting mininet from owner.
79 BuiltIn.Wait Until Keyword Succeeds 30s 1s ClusterOpenFlow.Check Linear Topology On Member ${SWITCHES}
81 Check Stats Are Not Frozen After Disconnect
82 [Documentation] Check that duration flow stat is increasing
83 BuiltIn.Wait Until Keyword Succeeds 30s 1s Check Flow Stats Are Not Frozen
85 Remove Flows And Groups After Mininet Is Disconnected
86 [Documentation] Remove 1 group 1&2 and 1 flow in every switch.
87 Remove Single Group And Flow On Member
89 Check Flows In Operational DS After Mininet Is Disconnected
90 [Documentation] Check Flows in Operational DS after mininet is disconnected.
91 BuiltIn.Wait Until Keyword Succeeds 30s 1s ClusterOpenFlow.Check Number Of Flows On Member ${less_flows}
93 Check Groups In Operational DS After Mininet Is Disconnected
94 [Documentation] Check Groups in Operational DS after mininet is disconnected.
95 BuiltIn.Wait Until Keyword Succeeds 10s 1s ClusterOpenFlow.Check Number Of Groups On Member ${less_groups}
97 Check Flows In Switch After Mininet Is Disconnected
98 [Documentation] Check Flows in switch after mininet is disconnected
99 MininetKeywords.Check Flows In Mininet ${mininet_conn_id} ${less_flows}
101 Reconnect Mininet To Owner
102 [Documentation] Reconnect mininet to switch 1 owner.
103 MininetKeywords.Disconnect Cluster Mininet restore ${original_owner_list}
105 Check Entity Owner Status And Find Owner and Successor After Reconnect
106 [Documentation] Check Entity Owner Status and identify owner and successor for first switch s1.
107 ${owner} ${successor_list} BuiltIn.Wait Until Keyword Succeeds 10s 1s ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:1
110 Disconnect Mininet From Successor
111 [Documentation] Disconnect mininet from the Successor
112 MininetKeywords.Disconnect Cluster Mininet break ${new_successor_list}
114 Check Entity Owner Status And Find New Owner and Successor After Disconnect
115 [Documentation] Check Entity Owner Status and identify owner and successor for first switch s1.
116 ${owner_list}= BuiltIn.Create List ${original_owner} ${new_owner}
117 ${current_owner} ${current_successor_list} BuiltIn.Wait Until Keyword Succeeds 10s 1s ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:1
118 ... 1 ${owner_list} after_stop=True
119 BuiltIn.Set Suite Variable ${current_owner}
120 BuiltIn.Set Suite Variable ${current_successor_list}
122 Disconnect Mininet From Current Owner
123 [Documentation] Disconnect mininet from the owner
124 ${current_owner_list}= BuiltIn.Create List ${current_owner}
125 MininetKeywords.Disconnect Cluster Mininet break ${current_owner_list}
127 Check Entity Owner Status And Find Current Owner and Successor After Disconnect
128 [Documentation] Check Entity Owner Status and identify owner and successor for first switch s1.
129 ${current_new_owner} ${current_new_successor_list} BuiltIn.Wait Until Keyword Succeeds 10s 1s ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:1
130 ... 1 ${original_owner_list} after_stop=True
131 BuiltIn.Set Suite Variable ${current_new_owner}
132 BuiltIn.Set Suite Variable ${current_new_successor_list}
134 Check Switch Moves To Current Master
135 [Documentation] Check switch s1 is connected to new Master.
136 ${current_new_master}= BuiltIn.Set Variable ${ODL_SYSTEM_${current_new_owner}_IP}
137 BuiltIn.Wait Until Keyword Succeeds 10s 1s OvsManager.Should Be Master s1 ${current_new_master} update_data=${True}
138 BuiltIn.Should Be Equal ${current_new_owner} ${original_owner}
140 Reconnect Mininet To All Cluster Instances
141 [Documentation] Reconnect mininet to all cluster instances.
142 MininetKeywords.Disconnect Cluster Mininet restore ${new_cluster_list}
144 Check Linear Topology After Reconnect
145 [Documentation] Check Linear Topology After Reconnect.
146 BuiltIn.Wait Until Keyword Succeeds 10s 1s ClusterOpenFlow.Check Linear Topology On Member ${SWITCHES}
148 Add Flows And Groups After Reconnect
149 [Documentation] Add 1 group type 1&2 and 1 flow in every switch.
150 Add Single Group And Flow On Member
152 Check Stats Are Not Frozen After Reconnect
153 [Documentation] Check that duration flow stat is increasing
154 BuiltIn.Wait Until Keyword Succeeds 30s 1s Check Flow Stats Are Not Frozen
156 Check Flows After Reconnect In Operational DS
157 [Documentation] Check Flows in Operational DS after mininet is reconnected.
158 BuiltIn.Wait Until Keyword Succeeds 30s 1s ClusterOpenFlow.Check Number Of Flows On Member ${all_flows}
160 Check Groups After Reconnect In Operational DS
161 [Documentation] Check Groups in Operational DS after mininet is reconnected.
162 BuiltIn.Wait Until Keyword Succeeds 10s 1s ClusterOpenFlow.Check Number Of Groups On Member ${all_groups}
164 Check Flows After Reconnect In Switch
165 [Documentation] Check Flows in switch after mininet is reconnected.
166 MininetKeywords.Check Flows In Mininet ${mininet_conn_id} ${all_flows}
168 Disconnect Mininet From Cluster
169 [Documentation] Disconnect Mininet from Cluster.
170 MininetKeywords.Disconnect Cluster Mininet
172 Check No Switches After Disconnect
173 [Documentation] Check no switches in topology after disconnecting mininet from cluster.
174 BuiltIn.Wait Until Keyword Succeeds 30s 1s ClusterOpenFlow.Check No Switches On Member ${SWITCHES}
176 Check Switch Is Not Connected
177 [Documentation] Check switch s1 is not connected to any controller.
178 : FOR ${index} IN @{cluster_index_list}
179 \ BuiltIn.Wait Until Keyword Succeeds 10s 1s OvsManager.Should Be Disconnected s1 ${ODL_SYSTEM_${index}_IP}
180 \ ... update_data=${True}
182 Reconnect Mininet To Cluster
183 [Documentation] Reconnect mininet to cluster by removing Iptables drop rules that were used to disconnect
184 MininetKeywords.Disconnect Cluster Mininet restore
186 Check Entity Owner Status And Find Owner and Successor After Reconnect Cluster
187 [Documentation] Check Entity Owner Status and identify owner and successor for first switch s1.
188 ${owner} ${successor_list} BuiltIn.Wait Until Keyword Succeeds 10s 1s ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:1
191 Check Linear Topology After Mininet Reconnects
192 [Documentation] Check Linear Topology after reconnect.
193 BuiltIn.Wait Until Keyword Succeeds 10s 1s ClusterOpenFlow.Check Linear Topology On Member ${SWITCHES}
195 Remove Flows And Groups After Mininet Reconnects
196 [Documentation] Remove 1 group 1&2 and 1 flow in every switch.
197 Remove Single Group And Flow On Member
199 Check Flows In Operational DS After Mininet Reconnects
200 [Documentation] Check Flows in Operational DS after mininet is reconnected.
201 BuiltIn.Wait Until Keyword Succeeds 30s 1s ClusterOpenFlow.Check Number Of Flows On Member ${less_flows}
203 Check Groups In Operational DS After Mininet Reconnects
204 [Documentation] Check Groups in Operational DS after mininet is reconnected to cluster.
205 BuiltIn.Wait Until Keyword Succeeds 10s 1s ClusterOpenFlow.Check Number Of Groups On Member ${less_groups}
207 Check Flows In Switch After Mininet Reconnects
208 [Documentation] Check Flows in switch after mininet is reconnected to cluster.
209 MininetKeywords.Check Flows In Mininet ${mininet_conn_id} ${less_flows}
211 Check Entity Owner Status And Find Owner and Successor Before Stop
212 [Documentation] Check Entity Owner Status and identify owner and successor for first switch s1.
213 ${original_owner} ${original_successor_list} ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:1 1
214 ${original_successor}= Collections.Get From List ${original_successor_list} 0
215 BuiltIn.Set Suite Variable ${original_owner}
216 BuiltIn.Set Suite Variable ${original_successor_list}
217 BuiltIn.Set Suite Variable ${original_successor}
219 Check Shards Status before Stop
220 [Documentation] Check Status for all shards in OpenFlow application.
221 ClusterOpenFlow.Check OpenFlow Shards Status
224 [Documentation] Stop Owner Instance and verify it is shutdown
225 ClusterManagement.Stop Single Member ${original_owner}
226 BuiltIn.Set Suite Variable ${new_cluster_list} ${original_successor_list}
228 Check Shards Status After Stop
229 [Documentation] Check Status for all shards in OpenFlow application.
230 ClusterOpenFlow.Check OpenFlow Shards Status After Cluster Event ${new_cluster_list}
232 Check Entity Owner Status And Find Owner and Successor After Stop
233 [Documentation] Check Entity Owner Status and identify owner and successor.
234 ${new_owner} ${new_successor_list} ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:1 ${original_successor} ${new_cluster_list} after_stop=True
235 BuiltIn.Set Suite Variable ${new_owner}
237 Check Linear Topology After Owner Stop
238 [Documentation] Check Linear Topology.
239 BuiltIn.Wait Until Keyword Succeeds 10s 1s ClusterOpenFlow.Check Linear Topology On Member ${SWITCHES} ${new_owner}
241 Add Configuration In Owner and Verify After Fail
242 [Documentation] Add 1 group type 1&2 and 1 flow in every switch.
243 Add Single Group And Flow On Member ${new_owner}
245 Check Stats Are Not Frozen After Owner Stops
246 [Documentation] Check that duration flow stat is increasing
248 BuiltIn.Wait Until Keyword Succeeds 30s 1s Check Flow Stats Are Not Frozen ${new_owner}
250 Check Flows In Operational DS After Owner Is Stopped
251 [Documentation] Check Flows in Operational DS after Owner is Stopped.
252 BuiltIn.Wait Until Keyword Succeeds 30s 1s ClusterOpenFlow.Check Number Of Flows On Member ${all_flows} ${new_owner}
254 Check Groups In Operational DS After Owner Is Stopped
255 [Documentation] Check Groups in Operational DS after Owner is Stopped.
256 BuiltIn.Wait Until Keyword Succeeds 10s 1s ClusterOpenFlow.Check Number Of Groups On Member ${all_groups} ${new_owner}
258 Check Flows In Switch After Owner Is Stopped
259 [Documentation] Check Flows in switch after Owner is Stopped
260 MininetKeywords.Check Flows In Mininet ${mininet_conn_id} ${all_flows}
262 Start Old Owner Instance
263 [Documentation] Start old Owner Instance and verify it is up
264 ClusterManagement.Start Single Member ${original_owner}
266 Check Entity Owner Status And Find Owner and Successor After Start Owner
267 [Documentation] Check Entity Owner Status and identify owner and successor for first switch s1.
268 ${owner} ${successor_list} BuiltIn.Wait Until Keyword Succeeds 10s 1s ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:1
271 Check Linear Topology After Owner Restart
272 [Documentation] Check Linear Topology.
273 BuiltIn.Wait Until Keyword Succeeds 10s 1s ClusterOpenFlow.Check Linear Topology On Member ${SWITCHES}
275 Check Stats Are Not Frozen After Owner Restart
276 [Documentation] Check that duration flow stat is increasing
277 BuiltIn.Wait Until Keyword Succeeds 30s 1s Check Flow Stats Are Not Frozen
279 Remove Configuration In Owner and Verify After Owner Restart
280 [Documentation] Remove 1 group 1&2 and 1 flow in every switch.
281 Remove Single Group And Flow On Member ${new_owner}
283 Check Flows After Owner Restart In Operational DS
284 [Documentation] Check Flows in Operational DS after owner is restarted.
285 BuiltIn.Wait Until Keyword Succeeds 30s 1s ClusterOpenFlow.Check Number Of Flows On Member ${less_flows}
287 Check Groups After Owner Restart In Operational DS
288 [Documentation] Check Groups in Operational DS after owner is restarted.
289 BuiltIn.Wait Until Keyword Succeeds 10s 1s ClusterOpenFlow.Check Number Of Groups On Member ${less_groups}
291 Check Flows In Switch After Owner Is Restarted
292 [Documentation] Check Flows in switch after Owner is restarted
293 MininetKeywords.Check Flows In Mininet ${mininet_conn_id} ${less_flows}
296 [Documentation] Stop and Start cluster.
297 # Try to stop contoller, if stop does not work or takes too long, kill controller.
298 ${status} ${result}= BuiltIn.Run Keyword And Ignore Error ClusterManagement.Stop_Members_From_List_Or_All
299 BuiltIn.Run Keyword If '${status}' != 'PASS' ClusterManagement.Kill_Members_From_List_Or_All
300 ClusterManagement.Start_Members_From_List_Or_All wait_for_sync=False
302 Check Linear Topology After Controller Restarts
303 [Documentation] Check Linear Topology after controller restarts.
304 BuiltIn.Wait Until Keyword Succeeds 300s 2s ClusterOpenFlow.Check Linear Topology On Member ${SWITCHES}
306 Add Flow And Group After Restart
307 [Documentation] Add 1 group type 1&2 and 1 flow in every switch.
308 Add Single Group And Flow On Member
310 Check Stats Are Not Frozen After Cluster Restart
311 [Documentation] Check that duration flow stat is increasing
312 BuiltIn.Wait Until Keyword Succeeds 30s 1s Check Flow Stats Are Not Frozen
314 Check Flows In Operational DS After Controller Restarts
315 [Documentation] Check Flows in Operational DS after controller is restarted.
316 BuiltIn.Wait Until Keyword Succeeds 30s 1s ClusterOpenFlow.Check Number Of Flows On Member ${all_flows}
318 Check Groups In Operational DS After Controller Restarts
319 [Documentation] Check Groups in Operational DS after controller is restarted.
320 BuiltIn.Wait Until Keyword Succeeds 10s 1s ClusterOpenFlow.Check Number Of Groups On Member ${all_groups}
322 Check Flows In Switch After Controller Restarts
323 [Documentation] Check Flows in switch after controller is restarted..
324 MininetKeywords.Check Flows In Mininet ${mininet_conn_id} ${all_flows}
327 [Documentation] Stop Mininet.
328 MininetKeywords.Stop Mininet And Exit
331 [Documentation] Check no switches in topology.
332 BuiltIn.Wait Until Keyword Succeeds 5s 1s ClusterOpenFlow.Check No Switches On Member ${SWITCHES}
336 [Documentation] Create controller session and set variables.
337 ClusterManagement.ClusterManagement_Setup
338 RequestsLibrary.Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH}
339 ${switches} Convert To Integer ${SWITCHES}
340 ${iter} Convert To Integer ${ITER}
341 ${all_groups}= BuiltIn.Evaluate ${switches} * ${iter} * 2
342 ${less_groups}= BuiltIn.Evaluate ${all_groups} - ${switches} * 2
343 # Stale flows/groups feature enabled in Boron onwards.
344 ${less_groups}= CompareStream.Set Variable If At Least Boron ${less_groups} ${all_groups}
345 ${all_flows}= BuiltIn.Evaluate ${switches} * ${iter+1}
346 ${less_flows}= BuiltIn.Evaluate ${all_flows} - ${switches}
347 # Stale flows/groups feature enabled in Boron onwards.
348 ${less_flows}= CompareStream.Set Variable If At Least Boron ${less_flows} ${all_flows}
349 BuiltIn.Set Suite Variable ${switches}
350 BuiltIn.Set Suite Variable ${iter}
351 BuiltIn.Set Suite Variable ${all_groups}
352 BuiltIn.Set Suite Variable ${less_groups}
353 BuiltIn.Set Suite Variable ${all_flows}
354 BuiltIn.Set Suite Variable ${less_flows}
355 BuiltIn.Set Suite Variable ${no_flows} ${SWITCHES}
358 [Documentation] Delete all sessions.
359 ${command} = BuiltIn.Set Variable sudo iptables -v -F
360 BuiltIn.Run Keyword And Ignore Error ClusterManagement.Run_Bash_Command_On_List_Or_All ${command}
361 BuiltIn.Run Keyword And Ignore Error RequestsLibrary.Delete Request session ${CONFIG_NODES_API}
362 RequestsLibrary.Delete All Sessions
364 Add Groups And Flows On Member
365 [Arguments] ${iter}=1 ${member_index}=1
366 [Documentation] Add ${ITER} groups type 1 & 2 and flows in every switch.
367 ${session} = Resolve_Http_Session_For_Member member_index=${member_index}
368 : FOR ${switch} IN RANGE 1 ${switches+1}
369 \ TemplatedRequests.Post As Json Templated folder=${VAR_DIR}/add-group-1 mapping={"SWITCH":"${switch}"} session=${session} iterations=${iter}
370 \ TemplatedRequests.Post As Json Templated folder=${VAR_DIR}/add-group-2 mapping={"SWITCH":"${switch}"} session=${session} iterations=${iter}
371 \ TemplatedRequests.Post As Json Templated folder=${VAR_DIR}/add-flow mapping={"SWITCH":"${switch}"} session=${session} iterations=${iter}
373 Add Single Group And Flow On Member
374 [Arguments] ${member_index}=1
375 [Documentation] Add 1 group 1&2 and 1 flow in every switch.
376 Add Groups And Flows On Member 1 ${member_index}
378 Remove Single Group And Flow On Member
379 [Arguments] ${member_index}=1
380 [Documentation] Remove 1 group 1&2 and 1 flow in every switch.
381 ${session} = Resolve_Http_Session_For_Member member_index=${member_index}
382 : FOR ${switch} IN RANGE 1 ${switches+1}
383 \ RequestsLibrary.Delete Request ${session} ${CONFIG_NODES_API}/node/openflow:${switch}/table/0/flow/1
384 \ RequestsLibrary.Delete Request ${session} ${CONFIG_NODES_API}/node/openflow:${switch}/group/1
385 \ RequestsLibrary.Delete Request ${session} ${CONFIG_NODES_API}/node/openflow:${switch}/group/1000
387 Check Flow Stats Are Not Frozen
388 [Arguments] ${member_index}=1 ${period_in_seconds}=5
389 [Documentation] Verify flow stats are not frozen for flow 1 and switch 1.
390 ${duration_1} = Extract Flow Duration ${member_index}
391 ${duration_1} Builtin.Convert To Integer ${duration_1}
392 BuiltIn.Sleep ${period_in_seconds}
393 ${duration_2} = Extract Flow Duration ${member_index}
394 ${duration_2} Builtin.Convert To Integer ${duration_2}
395 Should Not Be Equal As Integers ${duration_1} ${duration_2}
397 Extract Flow Duration
398 [Arguments] ${member_index}
399 [Documentation] Extract duration for flow 1 in switch 1.
400 ${session} = Resolve_Http_Session_For_Member member_index=${member_index}
401 ${resp} RequestsLibrary.Get Request ${session} ${OPERATIONAL_NODES_API}/node/openflow:1/table/0/flow/1 headers=${headers}
403 ${json_resp} = RequestsLibrary.To_Json ${resp.content}
404 ${flow_list} = Collections.Get_From_Dictionary ${json_resp} flow-node-inventory:flow
405 ${flow_stats} = Collections.Get_From_Dictionary @{flow_list}[0] opendaylight-flow-statistics:flow-statistics
406 ${duration} = Collections.Get_From_Dictionary &{flow_stats}[duration] second
407 Return From Keyword ${duration}