2 Documentation DOMRpcBroker 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 ... The aim of this resource is to groups reusable blocks of commands into
11 ... keywords. It should be initiated by DrbCommons_Init. It creates
12 ... ${all_indices}, ${registered_indices}, ${nonregistered_indices} and
13 ... ${possible_constants} suite variables.
14 ... ${registered_indices} - list of indexes where rpc is registered; including
15 ... isolated mebers; exluding killed/stopped members
16 ... ${nonregistered_indices} - list of indexes where rpc is not registrated;
17 ... including isolated mebers; exluding killed/stopped
19 ... ${possible_constants} - list of valid constants responded from the cluster;
20 ... constant from isolated node with regirered rpc is
22 ... ${active_indices} - list of indexes of non-isolated, non-stopped/killed nodes
24 ... Akka can create spurious UnreachableMember events, see
25 ... https://bugs.opendaylight.org/show_bug.cgi?id=8430
26 ... so some keywords contain "tolerance" argument which applies BuiltIn.Wait_Until_Keyword_Succeeds.
28 ... The delay before subsequent ReachableMember is significantly higher than
29 ... RPC registration delay documented at
30 ... http://docs.opendaylight.org/en/latest/developer-guide/controller.html#rpcs-and-cluster
33 Resource ${CURDIR}/../ClusterManagement.robot
34 Resource ${CURDIR}/../MdsalLowlevel.robot
35 Resource ${CURDIR}/../ShardStability.robot
39 ${CONSTANT_PREFIX} constant-
41 ${BUG_8430_TOLERANCE} 10
46 [Documentation] Resouce initial keyword. Creates several suite variables which are
47 ... used in other keywords and should be used im the test suites.
48 ${all_indices} = ClusterManagement.List_All_Indices
49 BuiltIn.Set_Suite_Variable ${all_indices}
50 ${nonregistered_indices} = ClusterManagement.List_All_Indices
51 BuiltIn.Set_Suite_Variable ${nonregistered_indices}
52 ${active_indices} = ClusterManagement.List_All_Indices
53 BuiltIn.Set_Suite_Variable ${active_indices}
54 ${possible_constants} = BuiltIn.Create_List
55 BuiltIn.Set_Suite_Variable ${possible_constants}
56 ${registered_indices} = BuiltIn.Create_List
57 BuiltIn.Set_Suite_Variable ${registered_indices}
59 Register_Rpc_And_Update_Possible_Constants
60 [Documentation] Register global rpc on given node of the cluster.
61 [Arguments] ${member_index}
62 MdsalLowlevel.Register_Constant ${member_index} ${CONSTANT_PREFIX}${member_index}
63 DrbCommons__Add_Possible_Constant ${member_index}
64 DrbCommons__Register_Index ${member_index}
66 Unregister_Rpc_And_Update_Possible_Constants
67 [Documentation] Unregister global rpc on given node of the cluster.
68 [Arguments] ${member_index}
69 MdsalLowlevel.Unregister_Constant ${member_index}
70 DrbCommons__Rem_Possible_Constant ${member_index}
71 DrbCommons__Deregister_Index ${member_index}
73 Register_Action_And_Update_Possible_Constants
74 [Documentation] Register routed rpc on given node of the cluster.
75 [Arguments] ${member_index}
76 MdsalLowlevel.Register_Bound_Constant ${member_index} ${CONTEXT} ${CONSTANT_PREFIX}${member_index}
77 DrbCommons__Add_Possible_Constant ${member_index}
78 DrbCommons__Register_Index ${member_index}
80 Unregister_Action_And_Update_Possible_Constants
81 [Documentation] Unregister routed rpc on given node of the cluster.
82 [Arguments] ${member_index}
83 MdsalLowlevel.Unregister_Bound_Constant ${member_index} ${CONTEXT}
84 DrbCommons__Rem_Possible_Constant ${member_index}
85 DrbCommons__Deregister_Index ${member_index}
88 [Documentation] Register global rpc on given nodes of the cluster.
89 [Arguments] ${index_list}
90 FOR ${index} IN @{index_list}
91 Register_Rpc_And_Update_Possible_Constants ${index}
94 Unregister_Rpc_On_Nodes
95 [Documentation] Unregister global rpc on given nodes of the cluster.
96 [Arguments] ${index_list}
97 FOR ${index} IN @{index_list}
98 Unregister_Rpc_And_Update_Possible_Constants ${index}
101 Register_Action_On_Nodes
102 [Documentation] Register global rpc on given nodes of the cluster.
103 [Arguments] ${index_list}
104 FOR ${index} IN @{index_list}
105 Register_Action_And_Update_Possible_Constants ${index}
108 Unregister_Action_On_Nodes
109 [Documentation] Unregister global rpc on given nodes of the cluster.
110 [Arguments] ${index_list}
111 FOR ${index} IN @{index_list}
112 Unregister_Action_And_Update_Possible_Constants ${index}
115 Verify_Constant_On_Registered_Node
116 [Documentation] Verify that the rpc response comes from the local node.
117 [Arguments] ${member_index}
118 ${constant} = MdsalLowlevel.Get_Constant ${member_index}
119 BuiltIn.Should_Be_Equal_As_Strings ${CONSTANT_PREFIX}${member_index} ${constant}
122 Verify_Constant_On_Unregistered_Node
123 [Documentation] Verify that the response comes from other nodes with rpc registered. Verification
124 ... passes for registered nodes too.
125 [Arguments] ${member_index}
126 ${constant} = MdsalLowlevel.Get_Constant ${member_index}
127 Collections.List_Should_Contain_Value ${possible_constants} ${constant}
130 Verify_Contexted_Constant_On_Registered_Node
131 [Documentation] Verify that the rpc response comes from the local node.
132 [Arguments] ${member_index}
133 ${constant} = MdsalLowlevel.Get_Contexted_Constant ${member_index} ${CONTEXT}
134 BuiltIn.Should_Be_Equal_As_Strings ${CONSTANT_PREFIX}${member_index} ${constant}
137 Verify_Contexted_Constant_On_Unregistered_Node
138 [Documentation] Verify that the response comes from other nodes with rpc registered. Verification
139 ... passes for registered nodes too.
140 [Arguments] ${member_index}
141 ${constant} = MdsalLowlevel.Get_Contexted_Constant ${member_index} ${CONTEXT}
142 Collections.List_Should_Contain_Value ${possible_constants} ${constant}
145 Verify_Constant_On_Registered_Nodes
146 [Documentation] Verify that the rpc response comes from the local node for every node in the list.
147 [Arguments] ${index_list}
148 FOR ${index} IN @{index_list}
149 Verify_Constant_On_Registered_Node ${index}
152 Verify_Contexted_Constant_On_Registered_Nodes
153 [Documentation] Verify that the rpc response comes from the local node for every node in the list.
154 [Arguments] ${index_list}
155 FOR ${index} IN @{index_list}
156 Verify_Contexted_Constant_On_Registered_Node ${index}
159 Verify_Constant_On_Unregistered_Nodes
160 [Documentation] Verify that the rpc response comes from the remote node for every node in the list.
161 [Arguments] ${index_list}
162 FOR ${index} IN @{index_list}
163 Verify_Constant_On_Unregistered_Node ${index}
166 Verify_Constant_On_Active_Nodes
167 [Documentation] Verify that the rpc response comes from the local node for every node in the list.
168 ... As a workaround for Bug 8430, \${tolerance} can be set as duration (number of seconds) for WUKS.
169 [Arguments] ${tolerance}=${BUG_8430_TOLERANCE}
170 # TODO: Rename most Verify_* keywords to Check_* and use the Verify prefix for the WUKS versions.
171 BuiltIn.Run_Keyword_And_Return_If
173 ... BuiltIn.Wait_Until_Keyword_Succeeds
176 ... Verify_Constant_On_Active_Nodes
178 FOR ${index} IN @{active_indices}
179 IF ${index} in ${registered_indices}
180 Verify_Constant_On_Registered_Node ${index}
182 Verify_Constant_On_Unregistered_Node ${index}
186 Verify_Contexted_Constant_On_Active_Nodes
187 [Documentation] Verify that the rpc response comes from the local node for every node in the list.
188 ... As a workaround for Bug 8430, \${tolerance} can be set as duration (number of seconds) for WUKS.
189 [Arguments] ${tolerance}=${BUG_8430_TOLERANCE}
190 # TODO: Rename most Verify_* keywords to Check_* and use the Verify prefix for the WUKS versions.
191 BuiltIn.Run_Keyword_And_Return_If
193 ... BuiltIn.Wait_Until_Keyword_Succeeds
196 ... Verify_Contexted_Constant_On_Active_Nodes
198 FOR ${index} IN @{active_indices}
199 IF ${index} in ${registered_indices}
200 Verify_Contexted_Constant_On_Registered_Node ${index}
202 Verify_Contexted_Constant_On_Unregistered_Node ${index}
206 Verify_Expected_Constant_On_Nodes
207 [Documentation] Verify that the rpc response comes only from one node only for every node in the list.
208 [Arguments] ${index_list} ${exp_constant}
209 FOR ${index} IN @{index_list}
210 ${const_index} = Get_Constant_Index_From_Node ${index}
211 BuiltIn.Should_Be_Equal_As_Strings ${exp_constant} ${CONSTANT_PREFIX}${const_index}
214 Get_Constant_Index_From_Node
215 [Documentation] Ivoke get-constant rpc on given member index. Returns the index of
216 ... the node where the constant came from.
217 [Arguments] ${member_index}
218 ${constant} = MdsalLowlevel.Get_Constant ${member_index}
219 ${index} = String.Replace_String ${constant} ${CONSTANT_PREFIX} ${EMPTY}
220 ${index} = BuiltIn.Convert_To_Integer ${index}
223 Get_Contexted_Constant_Index_From_Node
224 [Documentation] Ivoke get-contexted-constant rpc on given member index. Returns the index of
225 ... the node where the constant came from.
226 [Arguments] ${member_index}
227 ${constant} = MdsalLowlevel.Get_Contexted_Constant ${member_index} ${CONTEXT}
228 ${index} = String.Replace_String ${constant} ${CONSTANT_PREFIX} ${EMPTY}
229 ${index} = BuiltIn.Convert_To_Integer ${index}
233 [Documentation] Isolate a member and update appropriate suite variables.
234 [Arguments] ${member_index}
235 ClusterManagement.Isolate_Member_From_List_Or_All ${member_index}
236 DrbCommons__Update_Active_Nodes_List deactivate_idx=${member_index}
237 IF ${member_index} not in ${registered_indices} RETURN
238 DrbCommons__Rem_Possible_Constant ${member_index}
241 [Documentation] Rejoin a member and update appropriate suite variables.
242 [Arguments] ${member_index}
243 ClusterManagement.Rejoin_Member_From_List_Or_All ${member_index}
244 BuiltIn.Wait_Until_Keyword_Succeeds
247 ... ShardStability.Shards_Stability_Get_Details
248 ... ${DEFAULT_SHARD_LIST}
249 DrbCommons__Update_Active_Nodes_List activate_idx=${member_index}
250 IF ${member_index} not in ${registered_indices} RETURN
251 DrbCommons__Add_Possible_Constant ${member_index}
253 DrbCommons__Update_Active_Nodes_List
254 [Documentation] Add or remove member index to/from the list of active nodes.
255 [Arguments] ${activate_idx}=${EMPTY} ${deactivate_idx}=${EMPTY}
256 IF "${activate_idx}" != "${EMPTY}"
257 Collections.Append_To_List ${active_indices} ${activate_idx}
259 IF "${deactivate_idx}" != "${EMPTY}"
260 Collections.Remove_Values_From_List ${active_indices} ${deactivate_idx}
262 Collections.Sort_List ${active_indices}
264 DrbCommons__Register_Index
265 [Documentation] Add member index to the list of indices with registered rpc.
266 ... Isolated nodes are included in the list.
267 [Arguments] ${member_index}
268 Collections.Append_To_List ${registered_indices} ${member_index}
269 Collections.Remove_Values_From_List ${nonregistered_indices} ${member_index}
270 Collections.Sort_List ${registered_indices}
271 Collections.Sort_List ${nonregistered_indices}
273 DrbCommons__Deregister_Index
274 [Documentation] Remove member index from the list of indices with registered rpc.
275 ... Isolated nodes are included in the list.
276 [Arguments] ${member_index}
277 Collections.Remove_Values_From_List ${registered_indices} ${member_index}
278 Collections.Append_To_List ${nonregistered_indices} ${member_index}
279 Collections.Sort_List ${registered_indices}
280 Collections.Sort_List ${nonregistered_indices}
282 DrbCommons__Add_Possible_Constant
283 [Documentation] Add a constant to the ${possible_constants} list. The list is about to maintain
284 ... all valid constants possibly responded from the odl cluster (excluding isolated nodes).
285 [Arguments] ${member_index}
286 Collections.Append_To_List ${possible_constants} ${CONSTANT_PREFIX}${member_index}
287 Collections.Sort_List ${possible_constants}
289 DrbCommons__Rem_Possible_Constant
290 [Documentation] Remove a constant from the ${possible_constants} list. The list is about to maintain
291 ... all valid constants possibly responded from the odl cluster (excluding isolated nodes).
292 [Arguments] ${member_index}
293 Collections.Remove_Values_From_List ${possible_constants} ${CONSTANT_PREFIX}${member_index}