Update Robot Framework format - step 12
[integration/test.git] / csit / suites / openflowplugin / Clustering_Bulkomatic / 030__Cluster_HA_Data_Recovery_BulkFlow_Single_Switch.robot
1 *** Settings ***
2 Documentation       Test suite for Cluster HA with Bulk Flows - Data consistency after cluster restart, leader restart and follower restart with one switch connected
3
4 Resource            ../../../libraries/SetupUtils.robot
5 Resource            ../../../libraries/BulkomaticKeywords.robot
6 Resource            ../../../libraries/MininetKeywords.robot
7 Resource            ../../../libraries/ClusterManagement.robot
8 Resource            ../../../libraries/ClusterOpenFlow.robot
9 Resource            ../../../libraries/Utils.robot
10 Variables           ../../../variables/Variables.py
11
12 Suite Setup         SetupUtils.Setup_Utils_For_Setup_And_Teardown
13 Suite Teardown      Delete All Sessions
14 Test Setup          SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
15
16
17 *** Variables ***
18 ${operation_timeout}        100s
19 ${restart_timeout}          350s
20 ${flow_count_per_switch}    1000
21 ${switch_count}             1
22 ${flow_count_after_add}     1000
23 ${flow_count_after_del}     0
24 ${orig_json_config_add}     sal_add_bulk_flow_config.json
25 ${orig_json_config_get}     sal_get_bulk_flow_config.json
26 ${orig_json_config_del}     sal_del_bulk_flow_config.json
27
28
29 *** Test Cases ***
30 Check Shards Status And Initialize Variables
31     [Documentation]    Check Status for all shards in OpenFlow application.
32     ClusterOpenFlow.Check OpenFlow Shards Status
33     ${temp_json_config_add}=    BulkomaticKeywords.Set DPN And Flow Count In Json Add
34     ...    ${orig_json_config_add}
35     ...    ${switch_count}
36     ...    ${flow_count_per_switch}
37     ${temp_json_config_get}=    BulkomaticKeywords.Set DPN And Flow Count In Json Get
38     ...    ${orig_json_config_get}
39     ...    ${switch_count}
40     ...    ${flow_count_after_add}
41     ${temp_json_config_del}=    BulkomaticKeywords.Set DPN And Flow Count In Json Del
42     ...    ${orig_json_config_del}
43     ...    ${switch_count}
44     ...    ${flow_count_per_switch}
45     Set Suite Variable    ${temp_json_config_add}
46     Set Suite Variable    ${temp_json_config_get}
47     Set Suite Variable    ${temp_json_config_del}
48
49 Get Inventory Follower Before Cluster Restart
50     [Documentation]    Find a follower in the inventory config shard
51     ${inventory_leader}    ${inventory_followers}=    ClusterOpenFlow.Get InventoryConfig Shard Status
52     ${Follower_Node_1}=    Get From List    ${Inventory_Followers}    0
53     Set Suite Variable    ${Follower_Node_1}
54
55 Start Mininet Connect To Follower Node1
56     [Documentation]    Start mininet with connection to Follower Node1.
57     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller
58     ...    ${TOOLS_SYSTEM_IP}
59     ...    ${ODL_SYSTEM_${Follower_Node_1}_IP}
60     Set Suite Variable    ${mininet_conn_id}
61
62 Add Bulk Flow From Follower
63     [Documentation]    1000 Flows added via Follower Node1 and verify it gets applied in all instances.
64     BulkomaticKeywords.Add Bulk Flow In Node    ${temp_json_config_add}    ${Follower_Node_1}    ${operation_timeout}
65
66 Get Bulk Flows and Verify In Cluster
67     [Documentation]    Initiate get operation and check flow count across cluster nodes
68     BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster
69     ...    ${temp_json_config_get}
70     ...    ${operation_timeout}
71     ...    ${flow_count_after_add}
72
73 Verify Flows In Switch Before Cluster Restart
74     [Documentation]    Verify flows are installed in switch before cluster restart.
75     MininetKeywords.Verify Aggregate Flow From Mininet Session
76     ...    ${mininet_conn_id}
77     ...    ${flow_count_after_add}
78     ...    ${operation_timeout}
79
80 Kill All Cluster Nodes
81     [Documentation]    Kill All Nodes.
82     ClusterManagement.Kill Members From List Or All
83
84 Stop Mininet Connected To Follower Node1 and Exit
85     [Documentation]    Stop mininet and exit connection.
86     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
87     Utils.Clean Mininet System
88
89 Restart All Cluster Nodes
90     [Documentation]    Restart all cluster nodes.
91     ClusterManagement.Start Members From List Or All
92
93 Verify Data Recovery After Cluster Restart
94     [Documentation]    1000 Flows preserved in all controller instances.
95     Wait Until Keyword Succeeds
96     ...    ${restart_timeout}
97     ...    2s
98     ...    BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster
99     ...    ${temp_json_config_get}
100     ...    ${operation_timeout}
101     ...    ${flow_count_after_add}
102
103 Start Mininet Again Connect To Follower Node1
104     [Documentation]    Start mininet with connection to follower node1.
105     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller
106     ...    ${TOOLS_SYSTEM_IP}
107     ...    ${ODL_SYSTEM_${Follower_Node_1}_IP}
108     Set Suite Variable    ${mininet_conn_id}
109
110 Verify Flows In Switch After Cluster Restart
111     [Documentation]    Verify flows are installed in switch after cluster restart.
112     MininetKeywords.Verify Aggregate Flow From Mininet Session
113     ...    ${mininet_conn_id}
114     ...    ${flow_count_after_add}
115     ...    ${operation_timeout}
116
117 Stop Mininet Connected To Follower Node1
118     [Documentation]    Stop mininet and exit connection.
119     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
120     Utils.Clean Mininet System
121
122 Delete All Flows From Follower Node1
123     [Documentation]    1000 Flows deleted via Follower Node1 and verify it gets applied in all instances.
124     BulkomaticKeywords.Delete Bulk Flow In Node
125     ...    ${temp_json_config_del}
126     ...    ${Follower_Node_1}
127     ...    ${operation_timeout}
128
129 Verify No Flows In Cluster
130     [Documentation]    Verify flow count is 0 across cluster nodes.
131     BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster
132     ...    ${temp_json_config_get}
133     ...    ${operation_timeout}
134     ...    ${flow_count_after_del}
135
136 Get Inventory Leader Before Leader Restart
137     [Documentation]    Find leader in the inventory config shard
138     ${inventory_leader}    ${inventory_followers}=    ClusterOpenFlow.Get InventoryConfig Shard Status
139     Set Suite Variable    ${Inventory_Leader}
140
141 Start Mininet Connect To Leader
142     [Documentation]    Start mininet with connection to Leader Node.
143     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller
144     ...    ${TOOLS_SYSTEM_IP}
145     ...    ${ODL_SYSTEM_${Inventory_Leader}_IP}
146     Set Suite Variable    ${mininet_conn_id}
147
148 Add Bulk Flow From Leader
149     [Documentation]    1000 Flows added via Follower Node1 and verify it gets applied in all instances.
150     BulkomaticKeywords.Add Bulk Flow In Node    ${temp_json_config_add}    ${Inventory_Leader}    ${operation_timeout}
151
152 Get Bulk Flows and Verify In Cluster Before Leader Restart
153     [Documentation]    Initiate get operation and check flow count across cluster nodes
154     BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster
155     ...    ${temp_json_config_get}
156     ...    ${operation_timeout}
157     ...    ${flow_count_after_add}
158
159 Verify Flows In Switch Before Leader Restart
160     [Documentation]    Verify flows are installed in switch before leader restart.
161     MininetKeywords.Verify Aggregate Flow From Mininet Session
162     ...    ${mininet_conn_id}
163     ...    ${flow_count_after_add}
164     ...    ${operation_timeout}
165
166 Kill Leader From Cluster Node
167     [Documentation]    Kill Leader Node.
168     ClusterManagement.Kill Single Member    ${Inventory_Leader}
169
170 Stop Mininet Connected To Leader Node
171     [Documentation]    Stop mininet and exit connection.
172     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
173     Utils.Clean Mininet System
174
175 Restart Leader from Cluster Node
176     [Documentation]    Start Leader Node Up.
177     ClusterManagement.Start Single Member    ${Inventory_Leader}
178
179 Verify Data Recovery After Leader Restart
180     [Documentation]    1000 Flows preserved in all controller instances.
181     Wait Until Keyword Succeeds
182     ...    ${restart_timeout}
183     ...    2s
184     ...    BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster
185     ...    ${temp_json_config_get}
186     ...    ${operation_timeout}
187     ...    ${flow_count_after_add}
188
189 Check No Network Operational Information After Leader Restart
190     [Documentation]    Check device is not in operational inventory or topology in all cluster instances.
191     [Tags]    exclude    opnflwplug-1052
192     ClusterOpenFlow.Check No OpenFlow Network Operational Information
193
194 Start Mininet Again Connect To Leader
195     [Documentation]    Start mininet with connection to Leader Node.
196     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller
197     ...    ${TOOLS_SYSTEM_IP}
198     ...    ${ODL_SYSTEM_${Inventory_Leader}_IP}
199     Set Suite Variable    ${mininet_conn_id}
200
201 Verify Flows In Switch After Leader Restart
202     [Documentation]    Verify flows are installed in switch after leader restart.
203     MininetKeywords.Verify Aggregate Flow From Mininet Session
204     ...    ${mininet_conn_id}
205     ...    ${flow_count_after_add}
206     ...    ${operation_timeout}
207
208 Stop Mininet Connected To Leader Node After Leader Restart
209     [Documentation]    Stop mininet and exit connection.
210     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
211     Utils.Clean Mininet System
212
213 Delete All Flows From Leader Node
214     [Documentation]    1000 Flows deleted via Leader Node and verify it gets applied in all instances.
215     BulkomaticKeywords.Delete Bulk Flow In Node
216     ...    ${temp_json_config_del}
217     ...    ${Inventory_Leader}
218     ...    ${operation_timeout}
219
220 Verify No Flows In Cluster After Leader Restart
221     [Documentation]    Verify flow count is 0 across cluster nodes.
222     BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster
223     ...    ${temp_json_config_get}
224     ...    ${operation_timeout}
225     ...    ${flow_count_after_del}
226
227 Get Inventory Follower Before follower Restart
228     [Documentation]    Find follower in the inventory config shard
229     ${inventory_leader}    ${inventory_followers}=    ClusterOpenFlow.Get InventoryConfig Shard Status
230     ${Follower_Node_2}=    Get From List    ${Inventory_Followers}    1
231     Set Suite Variable    ${Follower_Node_2}
232
233 Start Mininet Connect To Follower Node2
234     [Documentation]    Start mininet with connection to Follower Node2.
235     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller
236     ...    ${TOOLS_SYSTEM_IP}
237     ...    ${ODL_SYSTEM_${Follower_Node_2}_IP}
238     Set Suite Variable    ${mininet_conn_id}
239
240 Add Bulk Flow From Follower Node2
241     [Documentation]    1000 Flows added via Follower Node2 and verify it gets applied in all instances.
242     BulkomaticKeywords.Add Bulk Flow In Node    ${temp_json_config_add}    ${Follower_Node_2}    ${operation_timeout}
243
244 Get Bulk Flows and Verify In Cluster Before Follower Restart
245     [Documentation]    Initiate get operation and check flow count across cluster nodes.
246     BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster
247     ...    ${temp_json_config_get}
248     ...    ${operation_timeout}
249     ...    ${flow_count_after_add}
250
251 Verify Flows In Switch Before Follower Restart
252     [Documentation]    Verify flows are installed in switch before follower restart.
253     MininetKeywords.Verify Aggregate Flow From Mininet Session
254     ...    ${mininet_conn_id}
255     ...    ${flow_count_after_add}
256     ...    ${operation_timeout}
257
258 Kill Follower Node2
259     [Documentation]    Kill Follower Node2.
260     ClusterManagement.Kill Single Member    ${Follower_Node_2}
261
262 Stop Mininet Connected To Follower Node2 and Exit
263     [Documentation]    Stop mininet and exit connection.
264     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
265     Utils.Clean Mininet System
266
267 Restart Follower Node2
268     [Documentation]    Start Follower Node2 Up.
269     ClusterManagement.Start Single Member    ${Follower_Node_2}
270
271 Verify Data Recovery After Follower Node2 Restart
272     [Documentation]    1000 Flows preserved in all controller instances.
273     Wait Until Keyword Succeeds
274     ...    ${restart_timeout}
275     ...    2s
276     ...    BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster
277     ...    ${temp_json_config_get}
278     ...    ${operation_timeout}
279     ...    ${flow_count_after_add}
280
281 Check No Network Operational Information After Follower Node2 Restart
282     [Documentation]    Check device is not in operational inventory or topology in all cluster instances.
283     [Tags]    exclude    opnflwplug-1052
284     ClusterOpenFlow.Check No OpenFlow Network Operational Information
285
286 Start Mininet Again Connect To Follower Node2
287     [Documentation]    Start mininet with connection to follower node1.
288     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller
289     ...    ${TOOLS_SYSTEM_IP}
290     ...    ${ODL_SYSTEM_${Follower_Node_2}_IP}
291     Set Suite Variable    ${mininet_conn_id}
292
293 Verify Flows In Switch After Follower Node2 Restart
294     [Documentation]    Verify flows are installed in switch after follower restart.
295     MininetKeywords.Verify Aggregate Flow From Mininet Session
296     ...    ${mininet_conn_id}
297     ...    ${flow_count_after_add}
298     ...    ${operation_timeout}
299
300 Stop Mininet Connected To Follower Node2
301     [Documentation]    Stop mininet and exit connection.
302     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
303     Utils.Clean Mininet System
304
305 Delete All Flows From Follower Node 2
306     [Documentation]    1000 Flows deleted via Leader Node and verify it gets applied in all instances.
307     BulkomaticKeywords.Delete Bulk Flow In Node
308     ...    ${temp_json_config_del}
309     ...    ${Follower_Node_2}
310     ...    ${operation_timeout}
311
312 Verify No Flows In Cluster After Follower Node2 Restart
313     BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster
314     ...    ${temp_json_config_get}
315     ...    ${operation_timeout}
316     ...    ${flow_count_after_del}