New OpenFlow REST perf test
[integration/test.git] / csit / suites / openflowplugin / Clustering_Bulkomatic / 010__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 Suite Setup       ClusterManagement Setup
4 Suite Teardown    Delete All Sessions
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 *** Variables ***
13 ${operation_timeout}    100s
14 ${restart_timeout}    350s
15 ${flow_count_per_switch}    1000
16 ${switch_count}    1
17 ${flow_count_after_add}    1000
18 ${flow_count_after_del}    0
19 ${orig_json_config_add}    sal_add_bulk_flow_config.json
20 ${orig_json_config_get}    sal_get_bulk_flow_config.json
21 ${orig_json_config_del}    sal_del_bulk_flow_config.json
22
23 *** Test Cases ***
24 Check Shards Status And Initialize Variables
25     [Documentation]    Check Status for all shards in OpenFlow application.
26     ClusterOpenFlow.Check OpenFlow Shards Status
27     ${temp_json_config_add}    BulkomaticKeywords.Set DPN And Flow Count In Json Add    ${orig_json_config_add}    ${switch_count}    ${flow_count_per_switch}
28     ${temp_json_config_get}    BulkomaticKeywords.Set DPN And Flow Count In Json Get    ${orig_json_config_get}    ${switch_count}    ${flow_count_after_add}
29     ${temp_json_config_del}    BulkomaticKeywords.Set DPN And Flow Count In Json Del    ${orig_json_config_del}    ${switch_count}    ${flow_count_per_switch}
30     Set Suite Variable    ${temp_json_config_add}
31     Set Suite Variable    ${temp_json_config_get}
32     Set Suite Variable    ${temp_json_config_del}
33
34 Get Inventory Follower Before Cluster Restart
35     [Documentation]    Find a follower in the inventory config shard
36     ${inventory_leader}    ${inventory_followers}    ClusterOpenFlow.Get InventoryConfig Shard Status
37     ${Follower_Node_1}=    Get From List    ${Inventory_Followers}    0
38     Set Suite Variable    ${Follower_Node_1}
39
40 Start Mininet Connect To Follower Node1
41     [Documentation]    Start mininet with connection to Follower Node1.
42     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${Follower_Node_1}_IP}
43     Set Suite Variable    ${mininet_conn_id}
44
45 Add Bulk Flow From Follower
46     [Documentation]    1000 Flows added via Follower Node1 and verify it gets applied in all instances.
47     BulkomaticKeywords.Add Bulk Flow In Node    ${temp_json_config_add}    ${Follower_Node_1}    ${operation_timeout}
48
49 Get Bulk Flows and Verify In Cluster
50     [Documentation]    Initiate get operation and check flow count across cluster nodes
51     BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster    ${temp_json_config_get}    ${operation_timeout}    ${flow_count_after_add}
52
53 Verify Flows In Switch Before Cluster Restart
54     [Documentation]    Verify flows are installed in switch before cluster restart.
55     MininetKeywords.Verify Aggregate Flow From Mininet Session    ${mininet_conn_id}    ${flow_count_after_add}    ${operation_timeout}
56
57 Kill All Cluster Nodes
58     [Documentation]    Kill All Nodes.
59     ClusterManagement.Kill Members From List Or All
60
61 Stop Mininet Connected To Follower Node1 and Exit
62     [Documentation]    Stop mininet and exit connection.
63     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
64     Utils.Clean Mininet System
65
66 Restart All Cluster Nodes
67     [Documentation]    Restart all cluster nodes.
68     ClusterManagement.Start Members From List Or All
69
70 Verify Data Recovery After Cluster Restart
71     [Documentation]    1000 Flows preserved in all controller instances.
72     Wait Until Keyword Succeeds    ${restart_timeout}    2s    BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster    ${temp_json_config_get}    ${operation_timeout}    ${flow_count_after_add}
73
74 Start Mininet Again Connect To Follower Node1
75     [Documentation]    Start mininet with connection to follower node1.
76     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${Follower_Node_1}_IP}
77     Set Suite Variable    ${mininet_conn_id}
78
79 Verify Flows In Switch After Cluster Restart
80     [Documentation]    Verify flows are installed in switch after cluster restart.
81     MininetKeywords.Verify Aggregate Flow From Mininet Session    ${mininet_conn_id}    ${flow_count_after_add}    ${operation_timeout}
82
83 Stop Mininet Connected To Follower Node1
84     [Documentation]    Stop mininet and exit connection.
85     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
86     Utils.Clean Mininet System
87
88 Delete All Flows From Follower Node1
89     [Documentation]    1000 Flows deleted via Follower Node1 and verify it gets applied in all instances.
90     BulkomaticKeywords.Delete Bulk Flow In Node    ${temp_json_config_del}    ${Follower_Node_1}    ${operation_timeout}
91
92 Verify No Flows In Cluster
93     [Documentation]    Verify flow count is 0 across cluster nodes.
94     BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster    ${temp_json_config_get}    ${operation_timeout}    ${flow_count_after_del}
95
96 Get Inventory Leader Before Leader Restart
97     [Documentation]    Find leader in the inventory config shard
98     ${inventory_leader}    ${inventory_followers}    ClusterOpenFlow.Get InventoryConfig Shard Status
99     Set Suite Variable    ${Inventory_Leader}
100
101 Start Mininet Connect To Leader
102     [Documentation]    Start mininet with connection to Leader Node.
103     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${Inventory_Leader}_IP}
104     Set Suite Variable    ${mininet_conn_id}
105
106 Add Bulk Flow From Leader
107     [Documentation]    1000 Flows added via Follower Node1 and verify it gets applied in all instances.
108     BulkomaticKeywords.Add Bulk Flow In Node    ${temp_json_config_add}    ${Inventory_Leader}    ${operation_timeout}
109
110 Get Bulk Flows and Verify In Cluster Before Leader Restart
111     [Documentation]    Initiate get operation and check flow count across cluster nodes
112     BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster    ${temp_json_config_get}    ${operation_timeout}    ${flow_count_after_add}
113
114 Verify Flows In Switch Before Leader Restart
115     [Documentation]    Verify flows are installed in switch before leader restart.
116     MininetKeywords.Verify Aggregate Flow From Mininet Session    ${mininet_conn_id}    ${flow_count_after_add}    ${operation_timeout}
117
118 Kill Leader From Cluster Node
119     [Documentation]    Kill Leader Node.
120     ClusterManagement.Kill Single Member    ${Inventory_Leader}
121
122 Stop Mininet Connected To Leader Node
123     [Documentation]    Stop mininet and exit connection.
124     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
125     Utils.Clean Mininet System
126
127 Restart Leader from Cluster Node
128     [Documentation]    Start Leader Node Up.
129     ClusterManagement.Start Single Member    ${Inventory_Leader}
130
131 Verify Data Recovery After Leader Restart
132     [Documentation]    1000 Flows preserved in all controller instances.
133     Wait Until Keyword Succeeds    ${restart_timeout}    2s    BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster    ${temp_json_config_get}    ${operation_timeout}    ${flow_count_after_add}
134
135 Check No Network Operational Information After Leader Restart
136     [Documentation]    Check device is not in operational inventory or topology in all cluster instances.
137     ClusterOpenFlow.Check No OpenFlow Network Operational Information
138     [Teardown]    Report_Failure_Due_To_Bug    6459
139
140 Start Mininet Again Connect To Leader
141     [Documentation]    Start mininet with connection to Leader Node.
142     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${Inventory_Leader}_IP}
143     Set Suite Variable    ${mininet_conn_id}
144
145 Verify Flows In Switch After Leader Restart
146     [Documentation]    Verify flows are installed in switch after leader restart.
147     MininetKeywords.Verify Aggregate Flow From Mininet Session    ${mininet_conn_id}    ${flow_count_after_add}    ${operation_timeout}
148     [Teardown]    Report_Failure_Due_To_Bug    6459
149
150 Stop Mininet Connected To Leader Node After Leader Restart
151     [Documentation]    Stop mininet and exit connection.
152     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
153     Utils.Clean Mininet System
154
155 Delete All Flows From Leader Node
156     [Documentation]    1000 Flows deleted via Leader Node and verify it gets applied in all instances.
157     BulkomaticKeywords.Delete Bulk Flow In Node    ${temp_json_config_del}    ${Inventory_Leader}    ${operation_timeout}
158
159 Verify No Flows In Cluster After Leader Restart
160     [Documentation]    Verify flow count is 0 across cluster nodes.
161     BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster    ${temp_json_config_get}    ${operation_timeout}    ${flow_count_after_del}
162
163 Get Inventory Follower Before follower Restart
164     [Documentation]    Find follower in the inventory config shard
165     ${inventory_leader}    ${inventory_followers}    ClusterOpenFlow.Get InventoryConfig Shard Status
166     ${Follower_Node_2}=    Get From List    ${Inventory_Followers}    1
167     Set Suite Variable    ${Follower_Node_2}
168
169 Start Mininet Connect To Follower Node2
170     [Documentation]    Start mininet with connection to Follower Node2.
171     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${Follower_Node_2}_IP}
172     Set Suite Variable    ${mininet_conn_id}
173
174 Add Bulk Flow From Follower Node2
175     [Documentation]    1000 Flows added via Follower Node2 and verify it gets applied in all instances.
176     BulkomaticKeywords.Add Bulk Flow In Node    ${temp_json_config_add}    ${Follower_Node_2}    ${operation_timeout}
177
178 Get Bulk Flows and Verify In Cluster Before Follower Restart
179     [Documentation]    Initiate get operation and check flow count across cluster nodes.
180     BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster    ${temp_json_config_get}    ${operation_timeout}    ${flow_count_after_add}
181
182 Verify Flows In Switch Before Follower Restart
183     [Documentation]    Verify flows are installed in switch before follower restart.
184     MininetKeywords.Verify Aggregate Flow From Mininet Session    ${mininet_conn_id}    ${flow_count_after_add}    ${operation_timeout}
185
186 Kill Follower Node2
187     [Documentation]    Kill Follower Node2.
188     ClusterManagement.Kill Single Member    ${Follower_Node_2}
189
190 Stop Mininet Connected To Follower Node2 and Exit
191     [Documentation]    Stop mininet and exit connection.
192     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
193     Utils.Clean Mininet System
194
195 Restart Follower Node2
196     [Documentation]    Start Follower Node2 Up.
197     ClusterManagement.Start Single Member    ${Follower_Node_2}
198
199 Verify Data Recovery After Follower Node2 Restart
200     [Documentation]    1000 Flows preserved in all controller instances.
201     Wait Until Keyword Succeeds    ${restart_timeout}    2s    BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster    ${temp_json_config_get}    ${operation_timeout}    ${flow_count_after_add}
202
203 Check No Network Operational Information After Follower Node2 Restart
204     [Documentation]    Check device is not in operational inventory or topology in all cluster instances.
205     ClusterOpenFlow.Check No OpenFlow Network Operational Information
206     [Teardown]    Report_Failure_Due_To_Bug    6459
207
208 Start Mininet Again Connect To Follower Node2
209     [Documentation]    Start mininet with connection to follower node1.
210     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${Follower_Node_2}_IP}
211     Set Suite Variable    ${mininet_conn_id}
212
213 Verify Flows In Switch After Follower Node2 Restart
214     [Documentation]    Verify flows are installed in switch after follower restart.
215     MininetKeywords.Verify Aggregate Flow From Mininet Session    ${mininet_conn_id}    ${flow_count_after_add}    ${operation_timeout}
216     [Teardown]    Report_Failure_Due_To_Bug    6459
217
218 Stop Mininet Connected To Follower Node2
219     [Documentation]    Stop mininet and exit connection.
220     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
221     Utils.Clean Mininet System
222
223 Delete All Flows From Follower Node 2
224     [Documentation]    1000 Flows deleted via Leader Node and verify it gets applied in all instances.
225     BulkomaticKeywords.Delete Bulk Flow In Node    ${temp_json_config_del}    ${Follower_Node_2}    ${operation_timeout}
226
227 Verify No Flows In Cluster After Follower Node2 Restart
228     BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster    ${temp_json_config_get}    ${operation_timeout}    ${flow_count_after_del}