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}
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}
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}
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}
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 ... 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 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}
111 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}
112 ${resp_list} = MdsalLowlevelPy.Wait_For_Transactions
113 TemplatedRequests.Check_Status_Code @{resp_list}[0]
114 [Teardown] BuiltIn.Run_Keywords BuiltIn.Run_Keyword_And_Ignore_Error BuiltIn.Wait_Until_Keyword_Succeeds 30s 3s ClusterManagement.Get_Leader_And_Followers_For_Shard
115 ... shard_name=${shard_name}!! shard_type=${shard_type} member_index_list=${follower_list}
116 ... AND ClusterAdmin.Add_Prefix_Shard_Replica ${actual_leader} ${shard_name} ${shard_type}
117 ... AND BuiltIn.Wait_Until_Keyword_Succeeds 30s 3s ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name}!!
118 ... shard_type=${shard_type}
120 Get_Node_Indexes_For_Clean_Leader_Shutdown_Test
121 [Arguments] ${leader_location} ${shard_name} ${shard_type}
122 [Documentation] Return indexes for clean leader shudown test case, index where transaction producer shoudl be deployed and a shard leader index.
123 ${leader} ${follower_list} = ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name} shard_type=${shard_type}
124 ${follower_list_leangth} = BuiltIn.Evaluate ${NUM_ODL_SYSTEM}-1
125 BuiltIn.Length_Should_Be ${follower_list} ${follower_list_leangth}
126 ${producer_idx} = BuiltIn.Set_Variable_If "${leader_location}" == "local" ${leader} @{follower_list}[0]
127 BuiltIn.Return_From_Keyword ${producer_idx} ${leader} ${follower_list}
129 Leader_Isolation_Test_Templ
130 [Arguments] ${heal_timeout} ${shard_name}=${SHARD_NAME} ${shard_type}=${SHARD_TYPE}
131 [Documentation] Implements leader isolation test scenario.
132 ${li_isolated} BuiltIn.Set_Variable ${False}
133 ${producing_transactions_time} = BuiltIn.Set_Variable ${${heal_timeout}+60}
134 ${all_indices} = ClusterManagement.List_All_Indices
135 ${leader} ${follower_list} = ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name} shard_type=${shard_type} member_index_list=${all_indices}
136 ${all_ip_list} = ClusterManagement.Resolve_IP_Address_For_Members ${all_indices}
137 MdsalLowlevelPy.Start_Write_Transactions_On_Nodes ${all_ip_list} ${all_indices} ${ID_PREFIX} ${producing_transactions_time} ${TRANSACTION_RATE_1K} chained_flag=${CHAINED_TX}
138 ${date_start} = DateTime.Get_Current_Date
139 ${date_end} = DateTime.Add_Time_To_Date ${date_start} ${producing_transactions_time}
140 ClusterManagement.Isolate_Member_From_List_Or_All ${leader}
141 ${li_isolated} BuiltIn.Set_Variable ${True}
142 BuiltIn.Wait_Until_Keyword_Succeeds 45s 2s ClusterManagement.Verify_Shard_Leader_Elected ${shard_name} ${shard_type} ${True}
143 ... ${leader} member_index_list=${follower_list}
144 ${date_leader_elected} = DateTime.Get_Current_Date
145 ${delta} = DateTime.Subtract_Date_From_Date ${date_leader_elected} ${date_start}
146 # 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.
147 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.
148 ${resp} = MdsalLowlevelPy.Get_Next_Transactions_Response
149 BuiltIn.Should_Be_Equal ${resp} ${NONE} No response expected, received ${resp}
150 BuiltIn.Sleep ${heal_timeout}
151 ClusterManagement.Rejoin_Member_From_List_Or_All ${leader}
152 ${li_isolated} BuiltIn.Set_Variable ${False}
153 BuiltIn.Wait_Until_Keyword_Succeeds 60s 10s ShardStability.Shards_Stability_Get_Details ${DEFAULT_SHARD_LIST}
154 BuiltIn.Wait_Until_Keyword_Succeeds 15s 2s ClusterManagement.Get_Leader_And_Followers_For_Shard ${shard_name} ${shard_type}
155 ${time_to_finish} = Get_Seconds_To_Time ${date_end}
156 BuiltIn.Run_Keyword_If ${heal_timeout} < ${TRANSACTION_TIMEOUT} Leader_Isolation_Heal_Within_Tt
157 ... ELSE Module_Leader_Isolation_Heal_Default ${leader} ${time_to_finish}
158 [Teardown] BuiltIn.Run_Keyword_If ${li_isolated} BuiltIn.Run_Keywords ClusterManagement.Rejoin_Member_From_List_Or_All ${leader}
159 ... AND BuiltIn.Wait_Until_Keyword_Succeeds 60s 10s ShardStability.Shards_Stability_Get_Details ${DEFAULT_SHARD_LIST}
161 Leader_Isolation_PrefBasedShard_Test_Templ
162 [Arguments] ${heal_timeout} ${shard_name}=${PREF_BASED_SHARD} ${shard_type}=${SHARD_TYPE}
163 [Documentation] Implements leader isolation test scenario.
164 ${li_isolated} BuiltIn.Set_Variable ${False}
165 ${producing_transactions_time} = BuiltIn.Set_Variable ${${heal_timeout}+60}
166 ${all_indices} = ClusterManagement.List_All_Indices
167 ${leader} ${follower_list} = ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name}!! shard_type=${shard_type} member_index_list=${all_indices}
168 ${all_ip_list} = ClusterManagement.Resolve_IP_Address_For_Members ${all_indices}
169 MdsalLowlevelPy.Start_Produce_Transactions_On_Nodes ${all_ip_list} ${all_indices} ${ID_PREFIX} ${producing_transactions_time} ${TRANSACTION_RATE_1K}
170 ${date_start} = DateTime.Get_Current_Date
171 ${date_end} = DateTime.Add_Time_To_Date ${date_start} ${producing_transactions_time}
172 ClusterManagement.Isolate_Member_From_List_Or_All ${leader}
173 ${li_isolated} BuiltIn.Set_Variable ${True}
174 BuiltIn.Wait_Until_Keyword_Succeeds 45s 2s ClusterManagement.Verify_Shard_Leader_Elected ${shard_name}!! ${shard_type} ${True}
175 ... ${leader} member_index_list=${follower_list}
176 ${date_leader_elected} = DateTime.Get_Current_Date
177 ${delta} = DateTime.Subtract_Date_From_Date ${date_leader_elected} ${date_start}
178 # 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.
179 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.
180 ${resp} = MdsalLowlevelPy.Get_Next_Transactions_Response
181 BuiltIn.Should_Be_Equal ${resp} ${NONE} No response expected, received ${resp}
182 BuiltIn.Sleep ${heal_timeout}
183 ClusterManagement.Rejoin_Member_From_List_Or_All ${leader}
184 ${li_isolated} BuiltIn.Set_Variable ${False}
185 BuiltIn.Wait_Until_Keyword_Succeeds 60s 10s ShardStability.Shards_Stability_Get_Details ${DEFAULT_SHARD_LIST}
186 BuiltIn.Wait_Until_Keyword_Succeeds 15s 2s ClusterManagement.Get_Leader_And_Followers_For_Shard ${shard_name}!! ${shard_type}
187 ${time_to_finish} = Get_Seconds_To_Time ${date_end}
188 BuiltIn.Run_Keyword_If ${heal_timeout} < ${TRANSACTION_TIMEOUT} Leader_Isolation_Heal_Within_Tt
189 ... ELSE Prefix_Leader_Isolation_Heal_Default ${leader} ${time_to_finish}
190 [Teardown] BuiltIn.Run_Keyword_If ${li_isolated} BuiltIn.Run_Keywords ClusterManagement.Rejoin_Member_From_List_Or_All ${leader}
191 ... AND BuiltIn.Wait_Until_Keyword_Succeeds 60s 10s ShardStability.Shards_Stability_Get_Details ${DEFAULT_SHARD_LIST}
193 Leader_Isolation_Heal_Within_Tt
194 [Documentation] The leader isolation test case end if the heal happens within transaction timeout. All write transaction
195 ... producers shoudl finish without error.
196 ${resp_list} = MdsalLowlevelPy.Wait_For_Transactions
197 : FOR ${resp} IN @{resp_list}
198 \ TemplatedRequests.Check_Status_Code ${resp}
200 Module_Leader_Isolation_Heal_Default
201 [Arguments] ${isolated_node} ${time_to_finish}
202 [Documentation] The leader isolation test case end. The transaction producer on isolated node should fail and should be restarted.
203 ... Then all write transaction producers should finish without error.
204 ${resp} = MdsalLowlevelPy.Get_Next_Transactions_Response
206 # TODO: check on response status code
207 ${restart_producer_node_idx_as_list} BuiltIn.Create_List ${isolated_node}
208 ${restart_producer_node_ip} = ClusterManagement.Resolve_IP_Address_For_Member ${isolated_node}
209 ${restart_producer_node_ip_as_list} BuiltIn.Create_List ${restart_producer_node_ip}
210 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}
211 ... reset_globals=${False}
212 ${resp_list} = MdsalLowlevelPy.Wait_For_Transactions
213 : FOR ${resp} IN @{resp_list}
214 \ TemplatedRequests.Check_Status_Code ${resp}
216 Prefix_Leader_Isolation_Heal_Default
217 [Arguments] ${isolated_node} ${time_to_finish}
218 [Documentation] The leader isolation test case end. The transaction producer on isolated node shoudl fail and should be restarted.
219 Then all write transaction producers shoudl finish without error.
220 ${resp} = MdsalLowlevelPy.Get_Next_Transactions_Response
222 # TODO: check on response status code
223 ${restart_producer_node_idx_as_list} BuiltIn.Create_List ${isolated_node}
224 ${restart_producer_node_ip} = ClusterManagement.Resolve_IP_Address_For_Member ${isolated_node}
225 ${restart_producer_node_ip_as_list} BuiltIn.Create_List ${restart_producer_node_ip}
226 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}
227 ${resp_list} = MdsalLowlevelPy.Wait_For_Transactions
228 : FOR ${resp} IN @{resp_list}
229 \ TemplatedRequests.Check_Status_Code ${resp}
231 Client_Isolation_Test_Templ
232 [Arguments] ${listener_node_role} ${trans_chain_flag} ${shard_name}=${SHARD_NAME} ${shard_type}=${SHARD_TYPE}
233 [Documentation] Implements client isolation test scenario.
234 ${all_indices} = ClusterManagement.List_All_Indices
235 ${leader} ${follower_list} = ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name} shard_type=${shard_type} member_index_list=${all_indices}
236 ${follower1} = Collections.Get_From_List ${follower_list} ${0}
237 ${client_node_dst} = BuiltIn.Set_Variable_If "${listener_node_role}" == "leader" ${leader} ${follower1}
238 ${client_node_ip} = ClusterManagement.Resolve_IP_Address_For_Member ${client_node_dst}
239 ${client_node_ip_as_list} BuiltIn.Create_List ${client_node_ip}
240 ${client_node_idx_as_list} BuiltIn.Create_List ${client_node_dst}
241 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}
242 ${start_date} DateTime.Get_Current_Date
243 ${timeout_date} = DateTime.Add_Time_To_Date ${start_date} ${TRANSACTION_TIMEOUT}
244 ${abort_date} = DateTime.Add_Time_To_Date ${start_date} ${HARD_TIMEOUT}
245 ClusterManagement.Isolate_Member_From_List_Or_All ${client_node_dst}
246 ${trans_timeout} = Get_Seconds_To_Time ${timeout_date}
247 WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout ${trans_timeout} 1s Ongoing_Transactions_Not_Failed_Yet
248 ${hard_timeout} = Get_Seconds_To_Time ${abort_date}
249 WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout ${hard_timeout} 1s Ongoing_Transactions_Not_Failed_Yet
250 BuiltIn.Wait_Until_Keyword_Succeeds 20s 2s Ongoing_Transactions_Failed
251 [Teardown] BuiltIn.Run Keywords ClusterManagement.Rejoin_Member_From_List_Or_All ${client_node_dst}
252 ... AND BuiltIn.Wait_Until_Keyword_Succeeds 60s 10s ShardStability.Shards_Stability_Get_Details ${DEFAULT_SHARD_LIST}
253 ... AND MdsalLowlevelPy.Wait_For_Transactions
255 Client_Isolation_PrefBasedShard_Test_Templ
256 [Arguments] ${listener_node_role} ${isolated_transactions_flag} ${shard_name}=${PREF_BASED_SHARD} ${shard_type}=${SHARD_TYPE}
257 [Documentation] Implements client isolation test scenario.
258 ${all_indices} = ClusterManagement.List_All_Indices
259 ${leader} ${follower_list} = ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name}!! shard_type=${shard_type} member_index_list=${all_indices}
260 ${follower1} = Collections.Get_From_List ${follower_list} ${0}
261 ${client_node_dst} = BuiltIn.Set_Variable_If "${listener_node_role}" == "leader" ${leader} ${follower1}
262 ${client_node_ip} = ClusterManagement.Resolve_IP_Address_For_Member ${client_node_dst}
263 ${client_node_ip_as_list} BuiltIn.Create_List ${client_node_ip}
264 ${client_node_idx_as_list} BuiltIn.Create_List ${client_node_dst}
265 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}
266 ${start_date} DateTime.Get_Current_Date
267 ${timeout_date} = DateTime.Add_Time_To_Date ${start_date} ${TRANSACTION_TIMEOUT}
268 ${abort_date} = DateTime.Add_Time_To_Date ${start_date} ${HARD_TIMEOUT}
269 ClusterManagement.Isolate_Member_From_List_Or_All ${client_node_dst}
270 ${trans_timeout} = Get_Seconds_To_Time ${timeout_date}
271 WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout ${trans_timeout} 1s Ongoing_Transactions_Not_Failed_Yet
272 ${hard_timeout} = Get_Seconds_To_Time ${abort_date}
273 WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout ${hard_timeout} 1s Ongoing_Transactions_Not_Failed_Yet
274 BuiltIn.Wait_Until_Keyword_Succeeds 20s 2s Ongoing_Transactions_Failed
275 [Teardown] BuiltIn.Run Keywords ClusterManagement.Rejoin_Member_From_List_Or_All ${client_node_dst}
276 ... AND BuiltIn.Wait_Until_Keyword_Succeeds 60s 10s ShardStability.Shards_Stability_Get_Details ${DEFAULT_SHARD_LIST}
277 ... AND MdsalLowlevelPy.Wait_For_Transactions
279 Ongoing_Transactions_Not_Failed_Yet
280 [Documentation] Verify that no write-transaction rpc finished, means they are still running.
281 ${resp} = MdsalLowlevelPy.Get_Next_Transactions_Response
282 BuiltIn.Should_Be_Equal ${None} ${resp} ${resp} not expected.
284 Ongoing_Transactions_Failed
285 [Documentation] Verify if write-transaction failed.
286 ${resp} = MdsalLowlevelPy.Get_Next_Transactions_Response
287 Check_Status_Code ${resp} explicit_status_codes=${TRANSACTION_FAILED}
290 [Arguments] ${date_in_future}
291 [Documentation] Return number of seconds remaining to ${date_in_future}.
292 ${date_now} = DateTime.Get_Current_Date
293 ${duration} = DateTime.Subtract_Date_From_Date ${date_in_future} ${date_now}
294 BuiltIn.Run_Keyword_And_Return BuiltIn.Convert_To_Integer ${duration}
296 Remote_Listener_Test_Templ
297 [Arguments] ${listener_node_role} ${shard_name}=${SHARD_NAME} ${shard_type}=${SHARD_TYPE}
298 [Documentation] Implements remote listener test scenario.
299 ${subscribed} = BuiltIn.Set_Variable ${False}
300 ${all_indices} = ClusterManagement.List_All_Indices
301 ${leader} ${follower_list} = ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name} shard_type=${shard_type} member_index_list=${all_indices}
302 ${follower1} = Collections.Get_From_List ${follower_list} ${0}
303 ${follower2} = Collections.Get_From_List ${follower_list} ${1}
304 ${listener_node_dst} = BuiltIn.Set_Variable_If "${listener_node_role}" == "leader" ${leader} ${follower1}
305 MdsalLowlevel.Subscribe_Dtcl ${listener_node_dst}
306 ${subscribed} = BuiltIn.Set_Variable ${True}
307 ${all_ip_list} = ClusterManagement.Resolve_IP_Address_For_Members ${all_indices}
308 MdsalLowlevelPy.Start_Write_Transactions_On_Nodes ${all_ip_list} ${all_indices} ${ID_PREFIX} ${DURATION_10S} ${TRANSACTION_RATE_1K} chained_flag=${CHAINED_TX}
309 ClusterAdmin.Make_Leader_Local ${follower1} ${shard_name} ${shard_type}
310 BuiltIn.Wait_Until_Keyword_Succeeds 45s 2s ClusterManagement.Verify_Shard_Leader_Elected ${shard_name} ${shard_type} ${True}
312 ${resp_list} = MdsalLowlevelPy.Wait_For_Transactions
313 : FOR ${resp} IN @{resp_list}
314 \ TemplatedRequests.Check_Status_Code ${resp}
315 ${copy_matches} = MdsalLowlevel.Unsubscribe_Dtcl ${listener_node_dst}
316 ${subscribed} = BuiltIn.Set_Variable ${False}
317 BuiltIn.Should_Be_True ${copy_matches}
318 [Teardown] BuiltIn.Run_Keyword_If ${subscribed} MdsalLowlevel.Unsubscribe_Dtcl ${listener_node_dst}
320 Remote_Listener_PrefBasedShard_Test_Templ
321 [Arguments] ${listener_node_role} ${shard_name}=${PREF_BASED_SHARD} ${shard_type}=${SHARD_TYPE}
322 [Documentation] Implements listener isolation test scenario.
323 ${subscribed} = BuiltIn.Set_Variable ${False}
324 ${all_indices} = ClusterManagement.List_All_Indices
325 ${leader} ${follower_list} = ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name}!! shard_type=${shard_type} member_index_list=${all_indices}
326 ${follower1} = Collections.Get_From_List ${follower_list} ${0}
327 ${follower2} = Collections.Get_From_List ${follower_list} ${1}
328 ${listener_node_dst} = BuiltIn.Set_Variable_If "${listener_node_role}" == "leader" ${leader} ${follower1}
329 MdsalLowlevel.Subscribe_Ddtl ${listener_node_dst}
330 ${subscribed} = BuiltIn.Set_Variable ${True}
331 ${all_ip_list} = ClusterManagement.Resolve_IP_Address_For_Members ${all_indices}
332 MdsalLowlevelPy.Start_Produce_Transactions_On_Nodes ${all_ip_list} ${all_indices} ${ID_PREFIX} ${DURATION_10S} ${TRANSACTION_RATE_1K}
333 MdsalLowlevel.Become_Prefix_Leader ${follower1} ${shard_name} ${ID_PREFIX}
334 BuiltIn.Wait_Until_Keyword_Succeeds 45s 2s ClusterManagement.Verify_Shard_Leader_Elected ${shard_name}!! ${shard_type} ${True}
336 ${resp_list} = MdsalLowlevelPy.Wait_For_Transactions
337 : FOR ${resp} IN @{resp_list}
338 \ TemplatedRequests.Check_Status_Code ${resp}
339 ${copy_matches} = MdsalLowlevel.Unsubscribe_Ddtl ${listener_node_dst}
340 ${subscribed} = BuiltIn.Set_Variable ${False}
341 BuiltIn.Should_Be_True ${copy_matches}
342 [Teardown] BuiltIn.Run_Keyword_If ${subscribed} MdsalLowlevel.Unsubscribe_Ddtl ${listener_node_dst}
344 Create_Prefix_Based_Shard_And_Verify
345 [Arguments] ${prefix}=${PREF_BASED_SHARD}
346 [Documentation] Create prefix based shard with replicas on all nodes
347 ${all_indices} = ClusterManagement.List_All_Indices
348 ${node_to_trigger} = Collections.Get_From_List ${all_indices} ${0}
349 MdsalLowlevel.Create_Prefix_Shard ${node_to_trigger} ${prefix} ${all_indices}
350 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 Remove_Prefix_Based_Shard_And_Verify
353 [Arguments] ${prefix}=${PREF_BASED_SHARD}
354 [Documentation] Remove prefix based shard with all replicas
355 ${all_indices} = ClusterManagement.List_All_Indices
356 ${node_to_trigger} = Collections.Get_From_List ${all_indices} ${0}
357 MdsalLowlevel.Remove_Prefix_Shard ${node_to_trigger} ${prefix}
358 : FOR ${idx} IN @{all_indices}
359 \ BuiltIn.Wait_Until_Keyword_Succeeds 15s 2s Verify_Shard_Replica_Removed ${idx} ${prefix}!!
362 Verify_Shard_Replica_Removed
363 [Arguments] ${member_index} ${shard_name} ${shard_type}
364 [Documentation] Verify that shard is removed. Jolokia return 404 for shard memeber.
365 ${session} = Resolve_Http_Session_For_Member member_index=${member_index}
366 ${type_class} = Resolve_Shard_Type_Class shard_type=${shard_type}
367 ${uri} = BuiltIn.Set_Variable /jolokia/read/org.opendaylight.controller:Category=Shards,name=member-${member_index}-shard-${shard_name}-${shard_type},type=${type_class}
368 ${text} TemplatedRequests.Get_From_Uri uri=${uri} session=${session}
369 BuiltIn.Should_Contain ${text} "status":404 javax.management.InstanceNotFoundException