Update Robot Framework format - step 12
[integration/test.git] / csit / suites / openflowplugin / Clustering_Bulkomatic / 040__Cluster_Current_Term_Verification_3Node_Cluster.robot
1 *** Settings ***
2 Documentation       Test suite for OF-18 Spurious Leader Election verification of term change while flows are added/deleted    #
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}                    400s
19 ${restart_timeout}                      450s
20 ${flow_count_per_switch}                10000
21 ${flow_count_per_switch_ten_percent}    1000
22 ${switch_count}                         1
23 ${flow_count_after_add}                 10000
24 ${flow_count_after_del}                 0
25 ${flow_count_after_del_ten_percent}     9000
26 ${orig_json_config_add}                 sal_add_bulk_flow_config.json
27 ${orig_json_config_get}                 sal_get_bulk_flow_config.json
28 ${orig_json_config_del}                 sal_del_bulk_flow_config.json
29 ${orig_json_config_table_add}           add_table.json
30 ${shard_name}                           inventory
31 ${shard_type}                           config
32 ${verify_restconf}                      False
33
34
35 *** Test Cases ***
36 Check Shard And Get Inventory
37     [Documentation]    Check Status for all shards and Finding a leader and followers in the inventory config shard
38     Check Shards Status And Initialize Variables
39     Get Inventory Follower
40
41 Initial Current Term Verification
42     [Documentation]    Verifying current term for Leader Node Before
43     ${current_term_value_before}    Get_Current_Term_Of_Shard_At_Member
44     BuiltIn.Log to console    Current Term is ${current_term_value_before}
45     BuiltIn.Set Suite Variable    ${current_term_value_before}
46
47 Add Bulk Flow From Follower
48     [Documentation]    ${flow_count_after_add} Flows added via Follower Node1 and verify it gets applied in all instances.
49     BulkomaticKeywords.Add Bulk Flow In Node    ${temp_json_config_add}    ${Follower_Node_1}    ${operation_timeout}
50
51 Get Bulk Flows And Verify In Cluster
52     [Documentation]    Initiate get operation and check flow count across cluster nodes
53     BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster
54     ...    ${temp_json_config_get}
55     ...    ${operation_timeout}
56     ...    ${flow_count_after_add}
57     ...    ${Inventory_Leader_List}
58
59 Current Term Verification After Adding Bulk Flow
60     [Documentation]    Verifying current term for Leader Node after pushing the flows
61     ${current_term_value_after}    Get_Current_Term_Of_Shard_At_Member
62     BuiltIn.Set Suite Variable    ${current_term_value_after}
63
64 Current Term Comparison Before And After Addition Of Flow
65     [Documentation]    Comparison of Current Term Before and After Addition of Flows
66     BuiltIn.Log to console    Current Term after pushing the flows is ${current_term_value_after}
67     IF    ${current_term_value_before} == ${current_term_value_after}
68         Log    SUCCESS
69     ELSE
70         Log    FAILURE
71     END
72     Should Be Equal    ${current_term_value_before}    ${current_term_value_after}
73
74 Delete and Add ten percent of the flows for 5 iterations
75     [Documentation]    Performeing 5 iterations for Delete and Add ten Percentage of the flows
76     FOR    ${index}    IN RANGE    1    6
77         Log    ${index}
78         BulkomaticKeywords.Delete Bulk Flow In Node
79         ...    ${temp_json_config_del_ten_percent}
80         ...    ${Follower_Node_1}
81         ...    ${operation_timeout}
82         BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster
83         ...    ${temp_json_config_get}
84         ...    ${operation_timeout}
85         ...    ${flow_count_after_del_ten_percent}
86         ...    ${Inventory_Leader_List}
87         BulkomaticKeywords.Add Bulk Flow In Node
88         ...    ${temp_json_config_add_ten_percent}
89         ...    ${Follower_Node_1}
90         ...    ${operation_timeout}
91         BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster
92         ...    ${temp_json_config_get}
93         ...    ${operation_timeout}
94         ...    ${flow_count_after_add}
95         ...    ${Inventory_Leader_List}
96     END
97
98 Current Term Verification After Continuous Deletion and Addition Of Flows for 5 iterations
99     [Documentation]    Verifying current term for Leader Node after continuous deletion and addition of ten percent of the flows
100     ${current_term_value_after}    Get_Current_Term_Of_Shard_At_Member
101     BuiltIn.Set Suite Variable    ${current_term_value_after}
102
103 Current Term Comparison Before and After Continuous Deletion and Addition Of Flows for 5 iterations
104     [Documentation]    Comparison Current Term Before and After Continuous Deletion and Addition Of Flows for 5 iterations
105     BuiltIn.Log to console    Current Term after pushing the flows is ${current_term_value_after}
106     IF    ${current_term_value_before} == ${current_term_value_after}
107         Log    SUCCESS
108     ELSE
109         Log    FAILURE
110     END
111     Should Be Equal    ${current_term_value_before}    ${current_term_value_after}
112
113 Delete All Flows From Follower Node
114     [Documentation]    ${flow_count_after_add} Flows deleted via Leader Node and verify it gets applied in all instances.
115     BulkomaticKeywords.Delete Bulk Flow In Node
116     ...    ${temp_json_config_del}
117     ...    ${Follower_Node_1}
118     ...    ${operation_timeout}
119
120 Verify No Flows In Cluster After Flow Deletion
121     [Documentation]    Verifying No FLows in Cluster after Flows Deletion
122     BulkomaticKeywords.Get Bulk Flow And Verify Count In Cluster
123     ...    ${temp_json_config_get}
124     ...    ${operation_timeout}
125     ...    ${flow_count_after_del}
126     ...    ${Inventory_Leader_List}
127
128 PreLeader Verification
129     [Documentation]    Verifying LastIndex and LastApplied and compare both are equal
130     ${LastIndex}    Get_Last_Index_Of_Shard_At_Member
131     ${LastApplied}    Get_Last_Applied_Of_Shard_At_Member
132     Should Be Equal    ${LastIndex}    ${LastApplied}
133     BulkomaticKeywords.Add Table In Node    ${temp_json_config_table}    ${Follower_Node_1}    ${operation_timeout}
134     ${LastIndex}    Get_Last_Index_Of_Shard_At_Member
135     ${LastApplied}    Get_Last_Applied_Of_Shard_At_Member
136     Should Be Equal    ${LastIndex}    ${LastApplied}
137
138
139 *** Keywords ***
140 Check Shards Status And Initialize Variables
141     [Documentation]    Check Status for all shards in OpenFlow application.
142     ClusterOpenFlow.Check OpenFlow Shards Status
143     ${temp_json_config_add}    BulkomaticKeywords.Set DPN And Flow Count In Json Add
144     ...    ${orig_json_config_add}
145     ...    ${switch_count}
146     ...    ${flow_count_per_switch}
147     ${temp_json_config_get}    BulkomaticKeywords.Set DPN And Flow Count In Json Get
148     ...    ${orig_json_config_get}
149     ...    ${switch_count}
150     ...    ${flow_count_after_add}
151     ${temp_json_config_del}    BulkomaticKeywords.Set DPN And Flow Count In Json Del
152     ...    ${orig_json_config_del}
153     ...    ${switch_count}
154     ...    ${flow_count_per_switch}
155     ${temp_json_config_del_ten_percent}    BulkomaticKeywords.Set DPN And Flow Count In Json Del
156     ...    ${orig_json_config_del}
157     ...    ${switch_count}
158     ...    ${flow_count_per_switch_ten_percent}
159     ${temp_json_config_add_ten_percent}    BulkomaticKeywords.Set DPN And Flow Count In Json Add
160     ...    ${orig_json_config_add}
161     ...    ${switch_count}
162     ...    ${flow_count_per_switch_ten_percent}
163     ${temp_json_config_table}    BulkomaticKeywords.Set DPN And Flow Count In Json Add
164     ...    ${orig_json_config_table_add}
165     ...    ${switch_count}
166     ...    ${flow_count_per_switch}
167     Set Suite Variable    ${temp_json_config_add}
168     Set Suite Variable    ${temp_json_config_get}
169     Set Suite Variable    ${temp_json_config_del}
170     Set Suite Variable    ${temp_json_config_del_ten_percent}
171     Set Suite Variable    ${temp_json_config_add_ten_percent}
172     Set Suite Variable    ${temp_json_config_table}
173
174 Get Inventory Follower
175     [Documentation]    Find a leader and followers in the inventory config shard
176     ${inventory_leader}    ${inventory_followers}    ClusterOpenFlow.Get InventoryConfig Shard Status
177     ${Follower_Node_1}    Get From List    ${Inventory_Followers}    0
178     ${Follower_Node_2}    Get From List    ${Inventory_Followers}    1
179     ${Inventory_Leader_List}    Create List    ${inventory_leader}
180     ${Inventory_Follower_Node1_List}    Create List    ${Follower_Node_1}
181     BuiltIn.Log to console    ${\n}
182     BuiltIn.Log to console    The follower Node1 is ${Follower_Node_1}
183     BuiltIn.Log to console    The follower Node2 is ${Follower_Node_2}
184     BuiltIn.Log to console    The leader Node is ${Inventory_Leader}
185     BuiltIn.Set Suite Variable    ${Follower_Node_1}
186     BuiltIn.Set Suite Variable    ${Follower_Node_2}
187     BuiltIn.Set Suite Variable    ${Inventory_Leader}
188     BuiltIn.Set Suite Variable    ${Inventory_Leader_List}
189     BuiltIn.Set Suite Variable    ${Inventory_Follower_Node1_List}
190
191 Get_Current_Term_Of_Shard_At_Member
192     [Documentation]    Find a Raft Property Values From Shard Member
193     ${current_term_value}    ClusterManagement.Get_Raft_Property_From_Shard_Member
194     ...    CurrentTerm
195     ...    ${shard_name}
196     ...    ${shard_type}
197     ...    ${Inventory_Leader}
198     ...    ${verify_restconf}
199     RETURN    ${current_term_value}
200
201 Get_Last_Index_Of_Shard_At_Member
202     [Documentation]    Find a leader and followers in the inventory config shard
203     ${LastIndex}    ClusterManagement.Get_Raft_Property_From_Shard_Member
204     ...    LastIndex
205     ...    ${shard_name}
206     ...    ${shard_type}
207     ...    ${Inventory_Leader}
208     ...    ${verify_restconf}
209     RETURN    ${LastIndex}
210
211 Get_Last_Applied_Of_Shard_At_Member
212     [Documentation]    Find a leader and followers in the inventory config shard
213     ${LastApplied}    ClusterManagement.Get_Raft_Property_From_Shard_Member
214     ...    LastApplied
215     ...    ${shard_name}
216     ...    ${shard_type}
217     ...    ${Inventory_Leader}
218     ...    ${verify_restconf}
219     RETURN    ${LastApplied}