2 Documentation DOMDataBroker testing: Common keywords
4 ... Copyright (c) 2017 Cisco Systems, Inc. and others. All rights reserved.
6 ... This program and the accompanying materials are made available under the
7 ... terms of the Eclipse Public License v1.0 which accompanies this distribution,
8 ... and is available at http://www.eclipse.org/legal/epl-v10.html
10 ... This resource file implements various test cases templates.
11 ... FIXME: add a link to a document (when published) where the scenarios are defined
12 Library ${CURDIR}/../MdsalLowlevelPy.py
13 Resource ${CURDIR}/../ClusterAdmin.robot
14 Resource ${CURDIR}/../ClusterManagement.robot
15 Resource ${CURDIR}/../MdsalLowlevel.robot
16 Resource ${CURDIR}/../TemplatedRequests.robot
17 Resource ${CURDIR}/../ShardStability.robot
18 Resource ${CURDIR}/../WaitForFailure.robot
23 ${TRANSACTION_RATE_1K} ${1000}
24 ${DURATION_90S} ${90} #TODO: Rename to hint at the goal of waiting, instead of its default value.
28 ${TRANSACTION_TIMEOUT} ${30}
29 ${TRANSACTION_TIMEOUT_2X} ${2*${TRANSACTION_TIMEOUT}}
32 ${ISOLATED_TRANS_TRUE} ${True}
33 ${ISOLATED_TRANS_FALSE} ${False}
34 ${HARD_TIMEOUT} ${2*${TRANSACTION_TIMEOUT}}
35 @{TRANSACTION_FAILED} ${500}
36 ${PREF_BASED_SHARD} id-ints
37 ${TEST_LOG_LEVEL} info
38 @{TEST_LOG_COMPONENTS} org.opendaylight.controller.cluster.sharding org.opendaylight.controller.cluster.datastore
39 ${HEAL_WITHIN_TRANS_TIMEOUT} ${0}
42 Explicit_Leader_Movement_Test_Templ
43 [Arguments] ${leader_from} ${leader_to} ${shard_name}=${SHARD_NAME} ${shard_type}=${SHARD_TYPE}
44 [Documentation] Implements explicit leader movement test scenario.
45 ${idx_from} ${idx_to} ${idx_trans} = Get_Node_Indexes_For_The_ELM_Test ${leader_from} ${leader_to} ${shard_name}
47 ${ip_trans_as_list} = BuiltIn.Create_List ${ODL_SYSTEM_${idx_trans}_IP}
48 ${idx_trans_as_list} = BuiltIn.Create_List ${idx_trans}
49 MdsalLowlevelPy.Start_Write_Transactions_On_Nodes ${ip_trans_as_list} ${idx_trans_as_list} ${ID_PREFIX} ${DURATION_30S} ${TRANSACTION_RATE_1K} chained_flag=${CHAINED_TX}
50 ClusterAdmin.Make_Leader_Local ${idx_to} ${shard_name} ${shard_type}
51 ${new_leader} ${new_followers} = BuiltIn.Wait_Until_Keyword_Succeeds 30s 5s ClusterManagement.Verify_Shard_Leader_Elected ${shard_name}
52 ... ${shard_type} ${True} ${idx_from} verify_restconf=False
53 BuiltIn.Should_Be_Equal ${idx_to} ${new_leader}
54 ${resp_list} = MdsalLowlevelPy.Wait_For_Transactions
55 TemplatedRequests.Check_Status_Code @{resp_list}[0]
57 Explicit_Leader_Movement_PrefBasedShard_Test_Templ
58 [Arguments] ${leader_from} ${leader_to} ${shard_name}=${PREF_BASED_SHARD} ${shard_type}=${SHARD_TYPE}
59 [Documentation] Implements explicit leader movement test scenario.
60 ${idx_from} ${idx_to} ${idx_trans} = Get_Node_Indexes_For_The_ELM_Test ${leader_from} ${leader_to} ${shard_name}!!
62 ${ip_trans_as_list} = BuiltIn.Create_List ${ODL_SYSTEM_${idx_trans}_IP}
63 ${idx_trans_as_list} = BuiltIn.Create_List ${idx_trans}
64 MdsalLowlevelPy.Start_Produce_Transactions_On_Nodes ${ip_trans_as_list} ${idx_trans_as_list} ${ID_PREFIX} ${DURATION_30S} ${TRANSACTION_RATE_1K}
65 MdsalLowlevel.Become_Prefix_Leader ${idx_to} ${shard_name} ${ID_PREFIX}
66 ${new_leader} ${new_followers} = BuiltIn.Wait_Until_Keyword_Succeeds 30s 5s ClusterManagement.Verify_Shard_Leader_Elected ${shard_name}!!
67 ... ${shard_type} ${True} ${idx_from} verify_restconf=False
68 BuiltIn.Should_Be_Equal ${idx_to} ${new_leader}
69 ${resp_list} = MdsalLowlevelPy.Wait_For_Transactions
70 TemplatedRequests.Check_Status_Code @{resp_list}[0]
72 Get_Node_Indexes_For_The_ELM_Test
73 [Arguments] ${leader_from} ${leader_to} ${shard_name} ${shard_type}
74 [Documentation] Return indexes for explicit leader movement test case, indexes of present to next leader node and index where transaction
75 ... producer should be deployed.
76 ${leader} ${follower_list} = ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name} shard_type=${shard_type} verify_restconf=False
77 ${idx_from} = BuiltIn.Set_Variable ${leader}
78 ${idx_to} = BuiltIn.Set_Variable @{follower_list}[0]
79 ${idx_trans} = BuiltIn.Set_Variable_If "${leader_from}" == "remote" and "${leader_to}" == "remote" @{follower_list}[1] "${leader_from}" == "local" ${leader} "${leader_to}" == "local"
80 ... @{follower_list}[0]
81 BuiltIn.Return_From_Keyword ${idx_from} ${idx_to} ${idx_trans}
83 Clean_Leader_Shutdown_Test_Templ
84 [Arguments] ${leader_location} ${shard_name}=${SHARD_NAME} ${shard_type}=${SHARD_TYPE}
85 [Documentation] Implements clean leader shutdown test scenario.
86 ${removed} = BuiltIn.Set_Variable ${False}
87 ${producer_idx} ${actual_leader} ${follower_list} = Get_Node_Indexes_For_Clean_Leader_Shutdown_Test ${leader_location} ${shard_name} ${shard_type}
88 ${producer_ip_as_list} = BuiltIn.Create_List ${ODL_SYSTEM_${producer_idx}_IP}
89 ${producer_idx_as_list} = BuiltIn.Create_List ${producer_idx}
90 MdsalLowlevelPy.Start_Write_Transactions_On_Nodes ${producer_ip_as_list} ${producer_idx_as_list} ${ID_PREFIX} ${DURATION_30S} ${TRANSACTION_RATE_1K} chained_flag=${CHAINED_TX}
91 ClusterAdmin.Remove_Shard_Replica ${actual_leader} ${shard_name} member-${actual_leader} ${shard_type}
92 ${removed} = BuiltIn.Set_Variable ${True}
93 ${resp_list} = MdsalLowlevelPy.Wait_For_Transactions
94 TemplatedRequests.Check_Status_Code @{resp_list}[0]
95 [Teardown] BuiltIn.Run_Keywords BuiltIn.Run_Keyword_And_Ignore_Error BuiltIn.Wait_Until_Keyword_Succeeds 30s 3s ClusterManagement.Get_Leader_And_Followers_For_Shard
96 ... shard_name=${shard_name} shard_type=${shard_type} member_index_list=${follower_list} verify_restconf=False
97 ... AND ClusterAdmin.Add_Shard_Replica ${actual_leader} ${shard_name} ${shard_type}
98 ... AND BuiltIn.Wait_Until_Keyword_Succeeds 30s 3s ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name}
99 ... verify_restconf=False shard_type=${shard_type}
101 Clean_Leader_Shutdown_PrefBasedShard_Test_Templ
102 [Arguments] ${leader_location} ${shard_name}=${PREF_BASED_SHARD} ${shard_type}=${SHARD_TYPE}
103 [Documentation] Implements clean leader shutdown test scenario.
104 ${producer_idx} ${actual_leader} ${follower_list} = Get_Node_Indexes_For_Clean_Leader_Shutdown_Test ${leader_location} ${shard_name}!! ${shard_type}
105 ${producer_ip_as_list} = BuiltIn.Create_List ${ODL_SYSTEM_${producer_idx}_IP}
106 ${producer_idx_as_list} = BuiltIn.Create_List ${producer_idx}
107 MdsalLowlevelPy.Start_Produce_Transactions_On_Nodes ${producer_ip_as_list} ${producer_idx_as_list} ${ID_PREFIX} ${DURATION_30S} ${TRANSACTION_RATE_1K}
108 ClusterAdmin.Remove_Prefix_Shard_Replica ${actual_leader} ${shard_name} member-${actual_leader} ${shard_type}
109 BuiltIn.Wait_Until_Keyword_Succeeds 15s 2s ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name}!! shard_type=${shard_type} member_index_list=${follower_list}
110 ... verify_restconf=False
111 BuiltIn.Run_Keyword_And_Ignore_Error ClusterManagement.Get_Raft_State_Of_Shard_At_Member shard_name=${shard_name}!! shard_type=${shard_type} member_index=${actual_leader}
112 WaitForFailure.Confirm_Keyword_Fails_Within_Timeout 10s 2s ClusterManagement.Get_Raft_State_Of_Shard_At_Member shard_name=${shard_name}!! shard_type=${shard_type} member_index=${actual_leader}
113 ${resp_list} = MdsalLowlevelPy.Wait_For_Transactions
114 TemplatedRequests.Check_Status_Code @{resp_list}[0]
115 [Teardown] BuiltIn.Run_Keywords BuiltIn.Run_Keyword_And_Ignore_Error BuiltIn.Wait_Until_Keyword_Succeeds 30s 3s ClusterManagement.Get_Leader_And_Followers_For_Shard
116 ... shard_name=${shard_name}!! shard_type=${shard_type} member_index_list=${follower_list} verify_restconf=False
117 ... AND ClusterAdmin.Add_Prefix_Shard_Replica ${actual_leader} ${shard_name} ${shard_type}
118 ... AND BuiltIn.Wait_Until_Keyword_Succeeds 30s 3s ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name}!!
119 ... verify_restconf=False shard_type=${shard_type}
121 Get_Node_Indexes_For_Clean_Leader_Shutdown_Test
122 [Arguments] ${leader_location} ${shard_name} ${shard_type}
123 [Documentation] Return indexes for clean leader shudown test case, index where transaction producer shoudl be deployed and a shard leader index.
124 ${leader} ${follower_list} = ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name} shard_type=${shard_type} verify_restconf=False
125 ${follower_list_leangth} = BuiltIn.Evaluate ${NUM_ODL_SYSTEM}-1
126 BuiltIn.Length_Should_Be ${follower_list} ${follower_list_leangth}
127 ${producer_idx} = BuiltIn.Set_Variable_If "${leader_location}" == "local" ${leader} @{follower_list}[0]
128 BuiltIn.Return_From_Keyword ${producer_idx} ${leader} ${follower_list}
130 Leader_Isolation_Test_Templ
131 [Arguments] ${heal_timeout} ${shard_name}=${SHARD_NAME} ${shard_type}=${SHARD_TYPE}
132 [Documentation] Implements leader isolation test scenario.
133 ${li_isolated} BuiltIn.Set_Variable ${False}
134 ${producing_transactions_time} = BuiltIn.Set_Variable ${${heal_timeout}+60}
135 ${all_indices} = ClusterManagement.List_All_Indices
136 ${leader} ${follower_list} = ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name} shard_type=${shard_type} member_index_list=${all_indices} verify_restconf=False
137 ${all_ip_list} = ClusterManagement.Resolve_IP_Address_For_Members ${all_indices}
138 MdsalLowlevelPy.Start_Write_Transactions_On_Nodes ${all_ip_list} ${all_indices} ${ID_PREFIX} ${producing_transactions_time} ${TRANSACTION_RATE_1K} chained_flag=${CHAINED_TX}
139 ${date_start} = DateTime.Get_Current_Date
140 ${date_end} = DateTime.Add_Time_To_Date ${date_start} ${producing_transactions_time}
141 ClusterManagement.Isolate_Member_From_List_Or_All ${leader}
142 ${li_isolated} BuiltIn.Set_Variable ${True}
143 BuiltIn.Wait_Until_Keyword_Succeeds 45s 2s ClusterManagement.Verify_Shard_Leader_Elected ${shard_name} ${shard_type} ${True}
144 ... ${leader} member_index_list=${follower_list}
145 ${date_leader_elected} = DateTime.Get_Current_Date
146 ${delta} = DateTime.Subtract_Date_From_Date ${date_leader_elected} ${date_start}
147 # TODO: Consider extracting the block which depends on ${heal_timeout} value into two keywords, and have just one If to decide which one to call.
148 BuiltIn.Run_Keyword_If ${heal_timeout}==${HEAL_WITHIN_TRANS_TIMEOUT} and ${delta} > ${TRANSACTION_TIMEOUT} BuiltIn.Fail We are not able to heal the cluster within transaction timout because new leader election took more time.
149 ${resp} = MdsalLowlevelPy.Get_Next_Transactions_Response
150 BuiltIn.Should_Be_Equal ${resp} ${NONE} No response expected, received ${resp}
151 BuiltIn.Sleep ${heal_timeout}
152 ClusterManagement.Rejoin_Member_From_List_Or_All ${leader}
153 ${li_isolated} BuiltIn.Set_Variable ${False}
154 BuiltIn.Wait_Until_Keyword_Succeeds 60s 10s ShardStability.Shards_Stability_Get_Details ${DEFAULT_SHARD_LIST}
155 BuiltIn.Wait_Until_Keyword_Succeeds 15s 2s ClusterManagement.Get_Leader_And_Followers_For_Shard ${shard_name} ${shard_type} verify_restconf=False
156 ${time_to_finish} = Get_Seconds_To_Time ${date_end}
157 BuiltIn.Run_Keyword_If ${heal_timeout} < ${TRANSACTION_TIMEOUT} Leader_Isolation_Heal_Within_Tt
158 ... ELSE Module_Leader_Isolation_Heal_Default ${leader} ${time_to_finish}
159 [Teardown] BuiltIn.Run_Keyword_If ${li_isolated} BuiltIn.Run_Keywords ClusterManagement.Rejoin_Member_From_List_Or_All ${leader}
160 ... AND BuiltIn.Wait_Until_Keyword_Succeeds 60s 10s ShardStability.Shards_Stability_Get_Details ${DEFAULT_SHARD_LIST}
162 Leader_Isolation_PrefBasedShard_Test_Templ
163 [Arguments] ${heal_timeout} ${shard_name}=${PREF_BASED_SHARD} ${shard_type}=${SHARD_TYPE}
164 [Documentation] Implements leader isolation test scenario.
165 ${li_isolated} BuiltIn.Set_Variable ${False}
166 ${producing_transactions_time} = BuiltIn.Set_Variable ${${heal_timeout}+60}
167 ${all_indices} = ClusterManagement.List_All_Indices
168 ${leader} ${follower_list} = ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name}!! shard_type=${shard_type} member_index_list=${all_indices} verify_restconf=False
169 ${all_ip_list} = ClusterManagement.Resolve_IP_Address_For_Members ${all_indices}
170 MdsalLowlevelPy.Start_Produce_Transactions_On_Nodes ${all_ip_list} ${all_indices} ${ID_PREFIX} ${producing_transactions_time} ${TRANSACTION_RATE_1K}
171 ${date_start} = DateTime.Get_Current_Date
172 ${date_end} = DateTime.Add_Time_To_Date ${date_start} ${producing_transactions_time}
173 ClusterManagement.Isolate_Member_From_List_Or_All ${leader}
174 ${li_isolated} BuiltIn.Set_Variable ${True}
175 BuiltIn.Wait_Until_Keyword_Succeeds 45s 2s ClusterManagement.Verify_Shard_Leader_Elected ${shard_name}!! ${shard_type} ${True}
176 ... ${leader} member_index_list=${follower_list}
177 ${date_leader_elected} = DateTime.Get_Current_Date
178 ${delta} = DateTime.Subtract_Date_From_Date ${date_leader_elected} ${date_start}
179 # TODO: Consider extracting the block which depends on ${heal_timeout} value into two keywords, and have just one If to decide which one to call.
180 BuiltIn.Run_Keyword_If ${heal_timeout}==${HEAL_WITHIN_TRANS_TIMEOUT} and ${delta} > ${TRANSACTION_TIMEOUT} BuiltIn.Fail We are not able to heal the cluster within transaction timout because new leader election took more time.
181 ${resp} = MdsalLowlevelPy.Get_Next_Transactions_Response
182 BuiltIn.Should_Be_Equal ${resp} ${NONE} No response expected, received ${resp}
183 BuiltIn.Sleep ${heal_timeout}
184 ClusterManagement.Rejoin_Member_From_List_Or_All ${leader}
185 ${li_isolated} BuiltIn.Set_Variable ${False}
186 BuiltIn.Wait_Until_Keyword_Succeeds 60s 10s ShardStability.Shards_Stability_Get_Details ${DEFAULT_SHARD_LIST}
187 BuiltIn.Wait_Until_Keyword_Succeeds 15s 2s ClusterManagement.Get_Leader_And_Followers_For_Shard ${shard_name}!! ${shard_type} verify_restconf=False
188 ${time_to_finish} = Get_Seconds_To_Time ${date_end}
189 BuiltIn.Run_Keyword_If ${heal_timeout} < ${TRANSACTION_TIMEOUT} Leader_Isolation_Heal_Within_Tt
190 ... ELSE Prefix_Leader_Isolation_Heal_Default ${leader} ${time_to_finish}
191 [Teardown] BuiltIn.Run_Keyword_If ${li_isolated} BuiltIn.Run_Keywords ClusterManagement.Rejoin_Member_From_List_Or_All ${leader}
192 ... AND BuiltIn.Wait_Until_Keyword_Succeeds 60s 10s ShardStability.Shards_Stability_Get_Details ${DEFAULT_SHARD_LIST}
194 Leader_Isolation_Heal_Within_Tt
195 [Documentation] The leader isolation test case end if the heal happens within transaction timeout. All write transaction
196 ... producers shoudl finish without error.
197 ${resp_list} = MdsalLowlevelPy.Wait_For_Transactions
198 : FOR ${resp} IN @{resp_list}
199 \ TemplatedRequests.Check_Status_Code ${resp}
201 Module_Leader_Isolation_Heal_Default
202 [Arguments] ${isolated_node} ${time_to_finish}
203 [Documentation] The leader isolation test case end. The transaction producer on isolated node should fail and should be restarted.
204 ... Then all write transaction producers should finish without error.
205 ${resp} = MdsalLowlevelPy.Get_Next_Transactions_Response
207 # TODO: check on response status code
208 ${restart_producer_node_idx_as_list} BuiltIn.Create_List ${isolated_node}
209 ${restart_producer_node_ip} = ClusterManagement.Resolve_IP_Address_For_Member ${isolated_node}
210 ${restart_producer_node_ip_as_list} BuiltIn.Create_List ${restart_producer_node_ip}
211 MdsalLowlevelPy.Start_Write_Transactions_On_Nodes ${restart_producer_node_ip_as_list} ${restart_producer_node_idx_as_list} ${ID_PREFIX} ${time_to_finish} ${TRANSACTION_RATE_1K} chained_flag=${CHAINED_TX}
212 ... reset_globals=${False}
213 ${resp_list} = MdsalLowlevelPy.Wait_For_Transactions
214 : FOR ${resp} IN @{resp_list}
215 \ TemplatedRequests.Check_Status_Code ${resp}
217 Prefix_Leader_Isolation_Heal_Default
218 [Arguments] ${isolated_node} ${time_to_finish}
219 [Documentation] The leader isolation test case end. The transaction producer on isolated node shoudl fail and should be restarted.
220 Then all write transaction producers shoudl finish without error.
221 ${resp} = MdsalLowlevelPy.Get_Next_Transactions_Response
223 # TODO: check on response status code
224 ${restart_producer_node_idx_as_list} BuiltIn.Create_List ${isolated_node}
225 ${restart_producer_node_ip} = ClusterManagement.Resolve_IP_Address_For_Member ${isolated_node}
226 ${restart_producer_node_ip_as_list} BuiltIn.Create_List ${restart_producer_node_ip}
227 MdsalLowlevelPy.Start_Produce_Transactions_On_Nodes ${restart_producer_node_ip_as_list} ${restart_producer_node_idx_as_list} ${ID_PREFIX} ${time_to_finish} ${TRANSACTION_RATE_1K} reset_globals=${False}
228 ${resp_list} = MdsalLowlevelPy.Wait_For_Transactions
229 : FOR ${resp} IN @{resp_list}
230 \ TemplatedRequests.Check_Status_Code ${resp}
232 Client_Isolation_Test_Templ
233 [Arguments] ${listener_node_role} ${trans_chain_flag} ${shard_name}=${SHARD_NAME} ${shard_type}=${SHARD_TYPE}
234 [Documentation] Implements client isolation test scenario.
235 ${all_indices} = ClusterManagement.List_All_Indices
236 ${leader} ${follower_list} = ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name} shard_type=${shard_type} member_index_list=${all_indices} verify_restconf=False
237 ${follower1} = Collections.Get_From_List ${follower_list} ${0}
238 ${client_node_dst} = BuiltIn.Set_Variable_If "${listener_node_role}" == "leader" ${leader} ${follower1}
239 ${client_node_ip} = ClusterManagement.Resolve_IP_Address_For_Member ${client_node_dst}
240 ${client_node_ip_as_list} BuiltIn.Create_List ${client_node_ip}
241 ${client_node_idx_as_list} BuiltIn.Create_List ${client_node_dst}
242 MdsalLowlevelPy.Start_Write_Transactions_On_Nodes ${client_node_ip_as_list} ${client_node_idx_as_list} ${ID_PREFIX} ${DURATION_90S} ${TRANSACTION_RATE_1K} chained_flag=${trans_chain_flag}
243 ${start_date} DateTime.Get_Current_Date
244 ${timeout_date} = DateTime.Add_Time_To_Date ${start_date} ${TRANSACTION_TIMEOUT}
245 ${abort_date} = DateTime.Add_Time_To_Date ${start_date} ${HARD_TIMEOUT}
246 ClusterManagement.Isolate_Member_From_List_Or_All ${client_node_dst}
247 ${trans_timeout} = Get_Seconds_To_Time ${timeout_date}
248 WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout ${trans_timeout} 1s Ongoing_Transactions_Not_Failed_Yet
249 ${hard_timeout} = Get_Seconds_To_Time ${abort_date}
250 WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout ${hard_timeout} 1s Ongoing_Transactions_Not_Failed_Yet
251 BuiltIn.Wait_Until_Keyword_Succeeds 20s 2s Ongoing_Transactions_Failed
252 [Teardown] BuiltIn.Run Keywords ClusterManagement.Rejoin_Member_From_List_Or_All ${client_node_dst}
253 ... AND BuiltIn.Wait_Until_Keyword_Succeeds 60s 10s ShardStability.Shards_Stability_Get_Details ${DEFAULT_SHARD_LIST}
254 ... AND MdsalLowlevelPy.Wait_For_Transactions
256 Client_Isolation_PrefBasedShard_Test_Templ
257 [Arguments] ${listener_node_role} ${isolated_transactions_flag} ${shard_name}=${PREF_BASED_SHARD} ${shard_type}=${SHARD_TYPE}
258 [Documentation] Implements client isolation test scenario.
259 ${all_indices} = ClusterManagement.List_All_Indices
260 ${leader} ${follower_list} = ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name}!! shard_type=${shard_type} member_index_list=${all_indices} verify_restconf=False
261 ${follower1} = Collections.Get_From_List ${follower_list} ${0}
262 ${client_node_dst} = BuiltIn.Set_Variable_If "${listener_node_role}" == "leader" ${leader} ${follower1}
263 ${client_node_ip} = ClusterManagement.Resolve_IP_Address_For_Member ${client_node_dst}
264 ${client_node_ip_as_list} BuiltIn.Create_List ${client_node_ip}
265 ${client_node_idx_as_list} BuiltIn.Create_List ${client_node_dst}
266 MdsalLowlevelPy.Start_Produce_Transactions_On_Nodes ${client_node_ip_as_list} ${client_node_idx_as_list} ${ID_PREFIX} ${DURATION_90S} ${TRANSACTION_RATE_1K} isolated_transactions_flag=${isolated_transactions_flag}
267 ${start_date} DateTime.Get_Current_Date
268 ${timeout_date} = DateTime.Add_Time_To_Date ${start_date} ${TRANSACTION_TIMEOUT}
269 ${abort_date} = DateTime.Add_Time_To_Date ${start_date} ${HARD_TIMEOUT}
270 ClusterManagement.Isolate_Member_From_List_Or_All ${client_node_dst}
271 ${trans_timeout} = Get_Seconds_To_Time ${timeout_date}
272 WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout ${trans_timeout} 1s Ongoing_Transactions_Not_Failed_Yet
273 ${hard_timeout} = Get_Seconds_To_Time ${abort_date}
274 WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout ${hard_timeout} 1s Ongoing_Transactions_Not_Failed_Yet
275 BuiltIn.Wait_Until_Keyword_Succeeds 20s 2s Ongoing_Transactions_Failed
276 [Teardown] BuiltIn.Run Keywords ClusterManagement.Rejoin_Member_From_List_Or_All ${client_node_dst}
277 ... AND BuiltIn.Wait_Until_Keyword_Succeeds 60s 10s ShardStability.Shards_Stability_Get_Details ${DEFAULT_SHARD_LIST}
278 ... AND MdsalLowlevelPy.Wait_For_Transactions
280 Ongoing_Transactions_Not_Failed_Yet
281 [Documentation] Verify that no write-transaction rpc finished, means they are still running.
282 ${resp} = MdsalLowlevelPy.Get_Next_Transactions_Response
283 BuiltIn.Should_Be_Equal ${None} ${resp} ${resp} not expected.
285 Ongoing_Transactions_Failed
286 [Documentation] Verify if write-transaction failed.
287 ${resp} = MdsalLowlevelPy.Get_Next_Transactions_Response
288 Check_Status_Code ${resp} explicit_status_codes=${TRANSACTION_FAILED}
291 [Arguments] ${date_in_future}
292 [Documentation] Return number of seconds remaining to ${date_in_future}.
293 ${date_now} = DateTime.Get_Current_Date
294 ${duration} = DateTime.Subtract_Date_From_Date ${date_in_future} ${date_now}
295 BuiltIn.Run_Keyword_And_Return BuiltIn.Convert_To_Integer ${duration}
297 Remote_Listener_Test_Templ
298 [Arguments] ${listener_node_role} ${shard_name}=${SHARD_NAME} ${shard_type}=${SHARD_TYPE}
299 [Documentation] Implements remote listener test scenario.
300 ${subscribed} = BuiltIn.Set_Variable ${False}
301 ${all_indices} = ClusterManagement.List_All_Indices
302 ${leader} ${follower_list} = ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name} shard_type=${shard_type} member_index_list=${all_indices} verify_restconf=False
303 ${follower1} = Collections.Get_From_List ${follower_list} ${0}
304 ${follower2} = Collections.Get_From_List ${follower_list} ${1}
305 ${listener_node_dst} = BuiltIn.Set_Variable_If "${listener_node_role}" == "leader" ${leader} ${follower1}
306 MdsalLowlevel.Subscribe_Dtcl ${listener_node_dst}
307 ${subscribed} = BuiltIn.Set_Variable ${True}
308 ${all_ip_list} = ClusterManagement.Resolve_IP_Address_For_Members ${all_indices}
309 MdsalLowlevelPy.Start_Write_Transactions_On_Nodes ${all_ip_list} ${all_indices} ${ID_PREFIX} ${DURATION_10S} ${TRANSACTION_RATE_1K} chained_flag=${CHAINED_TX}
310 ClusterAdmin.Make_Leader_Local ${follower1} ${shard_name} ${shard_type}
311 BuiltIn.Wait_Until_Keyword_Succeeds 45s 2s ClusterManagement.Verify_Shard_Leader_Elected ${shard_name} ${shard_type} ${True}
313 ${resp_list} = MdsalLowlevelPy.Wait_For_Transactions
314 : FOR ${resp} IN @{resp_list}
315 \ TemplatedRequests.Check_Status_Code ${resp}
316 ${copy_matches} = MdsalLowlevel.Unsubscribe_Dtcl ${listener_node_dst}
317 ${subscribed} = BuiltIn.Set_Variable ${False}
318 BuiltIn.Should_Be_True ${copy_matches}
319 [Teardown] BuiltIn.Run_Keyword_If ${subscribed} MdsalLowlevel.Unsubscribe_Dtcl ${listener_node_dst}
321 Remote_Listener_PrefBasedShard_Test_Templ
322 [Arguments] ${listener_node_role} ${shard_name}=${PREF_BASED_SHARD} ${shard_type}=${SHARD_TYPE}
323 [Documentation] Implements listener isolation test scenario.
324 ${subscribed} = BuiltIn.Set_Variable ${False}
325 ${all_indices} = ClusterManagement.List_All_Indices
326 ${leader} ${follower_list} = ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name}!! shard_type=${shard_type} member_index_list=${all_indices} verify_restconf=False
327 ${follower1} = Collections.Get_From_List ${follower_list} ${0}
328 ${follower2} = Collections.Get_From_List ${follower_list} ${1}
329 ${listener_node_dst} = BuiltIn.Set_Variable_If "${listener_node_role}" == "leader" ${leader} ${follower1}
330 MdsalLowlevel.Subscribe_Ddtl ${listener_node_dst}
331 ${subscribed} = BuiltIn.Set_Variable ${True}
332 ${all_ip_list} = ClusterManagement.Resolve_IP_Address_For_Members ${all_indices}
333 MdsalLowlevelPy.Start_Produce_Transactions_On_Nodes ${all_ip_list} ${all_indices} ${ID_PREFIX} ${DURATION_10S} ${TRANSACTION_RATE_1K}
334 MdsalLowlevel.Become_Prefix_Leader ${follower1} ${shard_name} ${ID_PREFIX}
335 BuiltIn.Wait_Until_Keyword_Succeeds 45s 2s ClusterManagement.Verify_Shard_Leader_Elected ${shard_name}!! ${shard_type} ${True}
337 ${resp_list} = MdsalLowlevelPy.Wait_For_Transactions
338 : FOR ${resp} IN @{resp_list}
339 \ TemplatedRequests.Check_Status_Code ${resp}
340 ${copy_matches} = MdsalLowlevel.Unsubscribe_Ddtl ${listener_node_dst}
341 ${subscribed} = BuiltIn.Set_Variable ${False}
342 BuiltIn.Should_Be_True ${copy_matches}
343 [Teardown] BuiltIn.Run_Keyword_If ${subscribed} MdsalLowlevel.Unsubscribe_Ddtl ${listener_node_dst}
345 Create_Prefix_Based_Shard_And_Verify
346 [Arguments] ${prefix}=${PREF_BASED_SHARD}
347 [Documentation] Create prefix based shard with replicas on all nodes
348 ${all_indices} = ClusterManagement.List_All_Indices
349 ${node_to_trigger} = Collections.Get_From_List ${all_indices} ${0}
350 MdsalLowlevel.Create_Prefix_Shard ${node_to_trigger} ${prefix} ${all_indices}
351 BuiltIn.Wait_Until_Keyword_Succeeds 30s 3s ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${prefix}!! shard_type=${SHARD_TYPE} member_index_list=${all_indices}
352 ... verify_restconf=False
354 Remove_Prefix_Based_Shard_And_Verify
355 [Arguments] ${prefix}=${PREF_BASED_SHARD}
356 [Documentation] Remove prefix based shard with all replicas
357 ${all_indices} = ClusterManagement.List_All_Indices
358 ${node_to_trigger} = Collections.Get_From_List ${all_indices} ${0}
359 MdsalLowlevel.Remove_Prefix_Shard ${node_to_trigger} ${prefix}
360 : FOR ${idx} IN @{all_indices}
361 \ BuiltIn.Wait_Until_Keyword_Succeeds 15s 2s Verify_Shard_Replica_Removed ${idx} ${prefix}!!
364 Verify_Shard_Replica_Removed
365 [Arguments] ${member_index} ${shard_name} ${shard_type}
366 [Documentation] Verify that shard is removed. Jolokia return 404 for shard memeber.
367 ${session} = Resolve_Http_Session_For_Member member_index=${member_index}
368 ${type_class} = Resolve_Shard_Type_Class shard_type=${shard_type}
369 ${uri} = BuiltIn.Set_Variable /jolokia/read/org.opendaylight.controller:Category=Shards,name=member-${member_index}-shard-${shard_name}-${shard_type},type=${type_class}
370 ${text} TemplatedRequests.Get_From_Uri uri=${uri} session=${session}
371 BuiltIn.Should_Contain ${text} "status":404 javax.management.InstanceNotFoundException
374 [Documentation] Kill every odl node and start again.
375 ClusterManagement.Kill_Members_From_List_Or_All
376 ClusterManagement.Clean_Directories_On_List_Or_All tmp_dir=/tmp
377 ClusterManagement.Start_Members_From_List_Or_All
378 BuiltIn.Wait_Until_Keyword_Succeeds 300s 10s ShardStability.Shards_Stability_Get_Details ${DEFAULT_SHARD_LIST} verify_restconf=True
379 ClusterManagement.Run_Bash_Command_On_List_Or_All ps -ef | grep java