81fc8e327f0cce3b120de888e93fb9f532ea321f
[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       Create Controller Sessions
4 Suite Teardown    Delete All Sessions
5 Resource          ../../../libraries/BulkomaticKeywords.robot
6 Resource          ../../../libraries/MininetKeywords.robot
7 Resource          ../../../libraries/ClusterKeywords.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_per_node}    1
17 ${flow_count_after_add}    1000
18 ${flow_count_after_del}    0
19 ${add_small_config}    sal_add_bulk_flow_small_config.json
20 ${get_small_config}    sal_get_bulk_flow_small_config.json
21 ${del_small_config}    sal_del_bulk_flow_small_config.json
22
23 *** Test Cases ***
24 Create Original Cluster List
25     [Documentation]    Create original cluster list.
26     ${original_cluster_list}    ClusterKeywords.Create Controller Index List
27     Set Suite Variable    ${original_cluster_list}
28
29 Check Shards Status Before Leader Restart
30     [Documentation]    Check Status for all shards in OpenFlow application.
31     ClusterOpenFlow.Check OpenFlow Shards Status    ${original_cluster_list}
32
33 Get Inventory Follower Before Cluster Restart
34     [Documentation]    Find a follower in the inventory config shard
35     ${inventory_leader}    ${inventory_followers}    ClusterOpenFlow.Get InventoryConfig Shard Status    ${original_cluster_list}
36     ${Follower_Node_1}=    Get From List    ${Inventory_Followers}    0
37     Set Suite Variable    ${Follower_Node_1}
38
39 Start Mininet Connect To Follower Node1
40     [Documentation]    Start mininet with connection to Follower Node1.
41     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${Follower_Node_1}_IP}
42     Set Suite Variable    ${mininet_conn_id}
43
44 Add Bulk Flow From Follower
45     [Documentation]    1000 Flows added via Follower Node1 and verify it gets applied in all instances.
46     BulkomaticKeywords.Add Bulk Flow In Node    ${Follower_Node_1}    ${add_small_config}    ${operation_timeout}
47
48 Get Bulk Flows and Verify In Cluster
49     BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster    ${original_cluster_list}    ${get_small_config}    ${operation_timeout}    ${flow_count_after_add}
50
51 Verify Flows In Switch Before Cluster Restart
52     [Documentation]    Verify flows are installed in switch before cluster restart.
53     MininetKeywords.Verify Aggregate Flow From Mininet Session    ${mininet_conn_id}    ${switch_count_per_node}    ${flow_count_per_switch}    ${operation_timeout}
54
55 Kill All Cluster Nodes
56     [Documentation]    Kill All Nodes.
57     ClusterKeywords.Kill Multiple Controllers    @{original_cluster_list}
58
59 Stop Mininet Connected To Follower Node1 and Exit
60     [Documentation]    Stop mininet and exit connection.
61     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
62     Utils.Clean Mininet System
63
64 Restart All Cluster Nodes
65     [Documentation]    Restart all cluster nodes.
66     ClusterKeywords.Start Multiple Controllers    ${restart_timeout}    @{original_cluster_list}
67
68 Verify Data Recovery After Cluster Restart
69     [Documentation]    1000 Flows preserved in all controller instances.
70     Wait Until Keyword Succeeds    ${restart_timeout}    2s    BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster    ${original_cluster_list}    ${get_small_config}    ${operation_timeout}
71     ...    ${flow_count_after_add}
72
73 Start Mininet Again Connect To Follower Node1
74     [Documentation]    Start mininet with connection to follower node1.
75     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${Follower_Node_1}_IP}
76     Set Suite Variable    ${mininet_conn_id}
77
78 Verify Flows In Switch After Cluster Restart
79     [Documentation]    Verify flows are installed in switch after cluster restart.
80     MininetKeywords.Verify Aggregate Flow From Mininet Session    ${mininet_conn_id}    ${switch_count_per_node}    ${flow_count_per_switch}    ${operation_timeout}
81
82 Stop Mininet Connected To Follower Node1
83     [Documentation]    Stop mininet and exit connection.
84     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
85     Utils.Clean Mininet System
86
87 Delete All Flows From Follower Node1
88     [Documentation]    Rest 1000 Flows deleted via Follower Node1 and verify it gets applied in all instances.
89     BulkomaticKeywords.Delete Bulk Flow In Node    ${Follower_Node_1}    ${del_small_config}    ${operation_timeout}
90
91 Verify No Flows In Cluster
92     BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster    ${original_cluster_list}    ${get_small_config}    ${operation_timeout}    ${flow_count_after_del}
93
94 Get Inventory Leader Before Leader Restart
95     [Documentation]    Find leader in the inventory config shard
96     ${inventory_leader}    ${inventory_followers}    ClusterOpenFlow.Get InventoryConfig Shard Status    ${original_cluster_list}
97     Set Suite Variable    ${Inventory_Leader}
98
99 Start Mininet Connect To Leader
100     [Documentation]    Start mininet with connection to Leader Node.
101     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${Inventory_Leader}_IP}
102     Set Suite Variable    ${mininet_conn_id}
103
104 Add Bulk Flow From Leader
105     [Documentation]    1000 Flows added via Follower Node1 and verify it gets applied in all instances.
106     BulkomaticKeywords.Add Bulk Flow In Node    ${Inventory_Leader}    ${add_small_config}    ${operation_timeout}
107
108 Get Bulk Flows and Verify In Cluster Before Leader Restart
109     BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster    ${original_cluster_list}    ${get_small_config}    ${operation_timeout}    ${flow_count_after_add}
110
111 Verify Flows In Switch Before Leader Restart
112     [Documentation]    Verify flows are installed in switch before leader restart.
113     MininetKeywords.Verify Aggregate Flow From Mininet Session    ${mininet_conn_id}    ${switch_count_per_node}    ${flow_count_per_switch}    ${operation_timeout}
114
115 Kill Leader From Cluster Node
116     [Documentation]    Kill Leader Node and Start it Up.
117     ClusterKeywords.Kill Multiple Controllers    ${Inventory_Leader}
118
119 Stop Mininet Connected To Leader Node
120     [Documentation]    Stop mininet and exit connection.
121     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
122     Utils.Clean Mininet System
123
124 Restart Leader from Cluster Node
125     [Documentation]    Start Leader Node Up.
126     ClusterKeywords.Start Multiple Controllers    ${restart_timeout}    ${Inventory_Leader}
127
128 Verify Data Recovery After Leader Restart
129     [Documentation]    1000 Flows preserved in all controller instances.
130     Wait Until Keyword Succeeds    ${restart_timeout}    2s    BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster    ${original_cluster_list}    ${get_small_config}    ${operation_timeout}
131     ...    ${flow_count_after_add}
132
133 Start Mininet Again Connect To Leader
134     [Documentation]    Start mininet with connection to Leader Node.
135     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${Inventory_Leader}_IP}
136     Set Suite Variable    ${mininet_conn_id}
137
138 Verify Flows In Switch After Leader Restart
139     [Documentation]    Verify flows are installed in switch after leader restart.
140     MininetKeywords.Verify Aggregate Flow From Mininet Session    ${mininet_conn_id}    ${switch_count_per_node}    ${flow_count_per_switch}    ${operation_timeout}
141
142 Stop Mininet Connected To Leader Node After Leader Restart
143     [Documentation]    Stop mininet and exit connection.
144     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
145     Utils.Clean Mininet System
146
147 Delete All Flows From Leader Node
148     [Documentation]    Rest 1000 Flows deleted via Leader Node and verify it gets applied in all instances.
149     BulkomaticKeywords.Delete Bulk Flow In Node    ${Inventory_Leader}    ${del_small_config}    ${operation_timeout}
150
151 Verify No Flows In Cluster After Leader Restart
152     BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster    ${original_cluster_list}    ${get_small_config}    ${operation_timeout}    ${flow_count_after_del}
153
154 Get Inventory Follower Before follower Restart
155     [Documentation]    Find follower in the inventory config shard
156     ${inventory_leader}    ${inventory_followers}    ClusterOpenFlow.Get InventoryConfig Shard Status    ${original_cluster_list}
157     ${Follower_Node_2}=    Get From List    ${Inventory_Followers}    1
158     Set Suite Variable    ${Follower_Node_2}
159
160 Start Mininet Connect To Follower Node2
161     [Documentation]    Start mininet with connection to Follower Node2.
162     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${Follower_Node_2}_IP}
163     Set Suite Variable    ${mininet_conn_id}
164
165 Add Bulk Flow From Follower Node2
166     [Documentation]    1000 Flows added via Follower Node2 and verify it gets applied in all instances.
167     BulkomaticKeywords.Add Bulk Flow In Node    ${Follower_Node_2}    ${add_small_config}    ${operation_timeout}
168
169 Get Bulk Flows and Verify In Cluster Before Follower Restart
170     BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster    ${original_cluster_list}    ${get_small_config}    ${operation_timeout}    ${flow_count_after_add}
171
172 Verify Flows In Switch Before Follower Restart
173     [Documentation]    Verify flows are installed in switch before follower restart.
174     MininetKeywords.Verify Aggregate Flow From Mininet Session    ${mininet_conn_id}    ${switch_count_per_node}    ${flow_count_per_switch}    ${operation_timeout}
175
176 Kill Follower Node2
177     [Documentation]    Kill Follower Node2.
178     ClusterKeywords.Kill Multiple Controllers    ${Follower_Node_2}
179
180 Stop Mininet Connected To Follower Node2 and Exit
181     [Documentation]    Stop mininet and exit connection.
182     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
183     Utils.Clean Mininet System
184
185 Restart Follower Node2
186     [Documentation]    Start Follower Node2 Up.
187     ClusterKeywords.Start Multiple Controllers    ${restart_timeout}    ${Follower_Node_2}
188
189 Verify Data Recovery After Follower Node2 Restart
190     [Documentation]    1000 Flows preserved in all controller instances.
191     Wait Until Keyword Succeeds    ${restart_timeout}    2s    BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster    ${original_cluster_list}    ${get_small_config}    ${operation_timeout}
192     ...    ${flow_count_after_add}
193
194 Start Mininet Again Connect To Follower Node2
195     [Documentation]    Start mininet with connection to follower node1.
196     ${mininet_conn_id}=    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_${Follower_Node_2}_IP}
197     Set Suite Variable    ${mininet_conn_id}
198
199 Verify Flows In Switch After Follower Node2 Restart
200     [Documentation]    Verify flows are installed in switch after follower restart.
201     MininetKeywords.Verify Aggregate Flow From Mininet Session    ${mininet_conn_id}    ${switch_count_per_node}    ${flow_count_per_switch}    ${operation_timeout}
202
203 Stop Mininet Connected To Follower Node2
204     [Documentation]    Stop mininet and exit connection.
205     MininetKeywords.Stop Mininet And Exit    ${mininet_conn_id}
206     Utils.Clean Mininet System
207
208 Delete All Flows From Follower Node 2
209     [Documentation]    Rest 1000 Flows deleted via Leader Node and verify it gets applied in all instances.
210     BulkomaticKeywords.Delete Bulk Flow In Node    ${Follower_Node_2}    ${del_small_config}    ${operation_timeout}
211
212 Verify No Flows In Cluster After Follower Node2 Restart
213     BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster    ${original_cluster_list}    ${get_small_config}    ${operation_timeout}    ${flow_count_after_del}