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
32 Resource ${CURDIR}/../ClusterManagement.robot
33 Resource ${CURDIR}/../MdsalLowlevel.robot
34 Resource ${CURDIR}/../ShardStability.robot
37 ${CONSTANT_PREFIX} constant-
39 ${BUG_8430_TOLERANCE} 10
43 [Documentation] Resouce initial keyword. Creates several suite variables which are
44 ... used in other keywords and should be used im the test suites.
45 ${all_indices} = ClusterManagement.List_All_Indices
46 BuiltIn.Set_Suite_Variable ${all_indices}
47 ${nonregistered_indices} = ClusterManagement.List_All_Indices
48 BuiltIn.Set_Suite_Variable ${nonregistered_indices}
49 ${active_indices} = ClusterManagement.List_All_Indices
50 BuiltIn.Set_Suite_Variable ${active_indices}
51 ${possible_constants} = BuiltIn.Create_List
52 BuiltIn.Set_Suite_Variable ${possible_constants}
53 ${registered_indices} = BuiltIn.Create_List
54 BuiltIn.Set_Suite_Variable ${registered_indices}
56 Register_Rpc_And_Update_Possible_Constants
57 [Arguments] ${member_index}
58 [Documentation] Register global rpc on given node of the cluster.
59 MdsalLowlevel.Register_Constant ${member_index} ${CONSTANT_PREFIX}${member_index}
60 DrbCommons__Add_Possible_Constant ${member_index}
61 DrbCommons__Register_Index ${member_index}
63 Unregister_Rpc_And_Update_Possible_Constants
64 [Arguments] ${member_index}
65 [Documentation] Unregister global rpc on given node of the cluster.
66 MdsalLowlevel.Unregister_Constant ${member_index}
67 DrbCommons__Rem_Possible_Constant ${member_index}
68 DrbCommons__Deregister_Index ${member_index}
70 Register_Action_And_Update_Possible_Constants
71 [Arguments] ${member_index}
72 [Documentation] Register routed rpc on given node of the cluster.
73 MdsalLowlevel.Register_Bound_Constant ${member_index} ${CONTEXT} ${CONSTANT_PREFIX}${member_index}
74 DrbCommons__Add_Possible_Constant ${member_index}
75 DrbCommons__Register_Index ${member_index}
77 Unregister_Action_And_Update_Possible_Constants
78 [Arguments] ${member_index}
79 [Documentation] Unregister routed rpc on given node of the cluster.
80 MdsalLowlevel.Unregister_Bound_Constant ${member_index} ${CONTEXT}
81 DrbCommons__Rem_Possible_Constant ${member_index}
82 DrbCommons__Deregister_Index ${member_index}
85 [Arguments] ${index_list}
86 [Documentation] Register global rpc on given nodes of the cluster.
87 : FOR ${index} IN @{index_list}
88 \ Register_Rpc_And_Update_Possible_Constants ${index}
90 Unregister_Rpc_On_Nodes
91 [Arguments] ${index_list}
92 [Documentation] Unregister global rpc on given nodes of the cluster.
93 : FOR ${index} IN @{index_list}
94 \ Unregister_Rpc_And_Update_Possible_Constants ${index}
96 Register_Action_On_Nodes
97 [Arguments] ${index_list}
98 [Documentation] Register global rpc on given nodes of the cluster.
99 : FOR ${index} IN @{index_list}
100 \ Register_Action_And_Update_Possible_Constants ${index}
102 Unregister_Action_On_Nodes
103 [Arguments] ${index_list}
104 [Documentation] Unregister global rpc on given nodes of the cluster.
105 : FOR ${index} IN @{index_list}
106 \ Unregister_Action_And_Update_Possible_Constants ${index}
108 Verify_Constant_On_Registered_Node
109 [Arguments] ${member_index}
110 [Documentation] Verify that the rpc response comes from the local node.
111 ${constant} = MdsalLowlevel.Get_Constant ${member_index}
112 BuiltIn.Should_Be_Equal_As_Strings ${CONSTANT_PREFIX}${member_index} ${constant}
113 BuiltIn.Return_From_Keyword ${constant}
115 Verify_Constant_On_Unregistered_Node
116 [Arguments] ${member_index}
117 [Documentation] Verify that the response comes from other nodes with rpc registered. Verification
118 ... passes for registered nodes too.
119 ${constant} = MdsalLowlevel.Get_Constant ${member_index}
120 Collections.List_Should_Contain_Value ${possible_constants} ${constant}
121 BuiltIn.Return_From_Keyword ${constant}
123 Verify_Contexted_Constant_On_Registered_Node
124 [Arguments] ${member_index}
125 [Documentation] Verify that the rpc response comes from the local node.
126 ${constant} = MdsalLowlevel.Get_Contexted_Constant ${member_index} ${CONTEXT}
127 BuiltIn.Should_Be_Equal_As_Strings ${CONSTANT_PREFIX}${member_index} ${constant}
128 BuiltIn.Return_From_Keyword ${constant}
130 Verify_Contexted_Constant_On_Unregistered_Node
131 [Arguments] ${member_index}
132 [Documentation] Verify that the response comes from other nodes with rpc registered. Verification
133 ... passes for registered nodes too.
134 ${constant} = MdsalLowlevel.Get_Contexted_Constant ${member_index} ${CONTEXT}
135 Collections.List_Should_Contain_Value ${possible_constants} ${constant}
136 BuiltIn.Return_From_Keyword ${constant}
138 Verify_Constant_On_Registered_Nodes
139 [Arguments] ${index_list}
140 [Documentation] Verify that the rpc response comes from the local node for every node in the list.
141 : FOR ${index} IN @{index_list}
142 \ Verify_Constant_On_Registered_Node ${index}
144 Verify_Contexted_Constant_On_Registered_Nodes
145 [Arguments] ${index_list}
146 [Documentation] Verify that the rpc response comes from the local node for every node in the list.
147 : FOR ${index} IN @{index_list}
148 \ Verify_Contexted_Constant_On_Registered_Node ${index}
150 Verify_Constant_On_Unregistered_Nodes
151 [Arguments] ${index_list}
152 [Documentation] Verify that the rpc response comes from the remote node for every node in the list.
153 : FOR ${index} IN @{index_list}
154 \ Verify_Constant_On_Unregistered_Node ${index}
156 Verify_Constant_On_Active_Nodes
157 [Arguments] ${tolerance}=${BUG_8430_TOLERANCE}
158 [Documentation] Verify that the rpc response comes from the local node for every node in the list.
159 ... As a workaround for Bug 8430, \${tolerance} can be set as duration (number of seconds) for WUKS.
160 # TODO: Rename most Verify_* keywords to Check_* and use the Verify prefix for the WUKS versions.
161 BuiltIn.Run_Keyword_And_Return_If ${tolerance} BuiltIn.Wait_Until_Keyword_Succeeds ${tolerance} 1s Verify_Constant_On_Active_Nodes tolerance=0
162 : FOR ${index} IN @{active_indices}
163 \ BuiltIn.Run_Keyword_If ${index} in ${registered_indices} Verify_Constant_On_Registered_Node ${index}
164 \ ... ELSE Verify_Constant_On_Unregistered_Node ${index}
166 Verify_Contexted_Constant_On_Active_Nodes
167 [Arguments] ${tolerance}=${BUG_8430_TOLERANCE}
168 [Documentation] Verify that the rpc response comes from the local node for every node in the list.
169 ... As a workaround for Bug 8430, \${tolerance} can be set as duration (number of seconds) for WUKS.
170 # TODO: Rename most Verify_* keywords to Check_* and use the Verify prefix for the WUKS versions.
171 BuiltIn.Run_Keyword_And_Return_If ${tolerance} BuiltIn.Wait_Until_Keyword_Succeeds ${tolerance} 1s Verify_Contexted_Constant_On_Active_Nodes tolerance=0
172 : FOR ${index} IN @{active_indices}
173 \ BuiltIn.Run_Keyword_If ${index} in ${registered_indices} Verify_Contexted_Constant_On_Registered_Node ${index}
174 \ ... ELSE Verify_Contexted_Constant_On_Unregistered_Node ${index}
176 Verify_Expected_Constant_On_Nodes
177 [Arguments] ${index_list} ${exp_constant}
178 [Documentation] Verify that the rpc response comes only from one node only for every node in the list.
179 : FOR ${index} IN @{index_list}
180 \ ${const_index} = Get_Constant_Index_From_Node ${index}
181 \ BuiltIn.Should_Be_Equal_As_Strings ${exp_constant} ${CONSTANT_PREFIX}${const_index}
183 Get_Constant_Index_From_Node
184 [Arguments] ${member_index}
185 [Documentation] Ivoke get-constant rpc on given member index. Returns the index of
186 ... the node where the constant came from.
187 ${constant} = MdsalLowlevel.Get_Constant ${member_index}
188 ${index} = String.Replace_String ${constant} ${CONSTANT_PREFIX} ${EMPTY}
189 ${index} = BuiltIn.Convert_To_Integer ${index}
190 BuiltIn.Return_From_Keyword ${index}
192 Get_Contexted_Constant_Index_From_Node
193 [Arguments] ${member_index}
194 [Documentation] Ivoke get-contexted-constant rpc on given member index. Returns the index of
195 ... the node where the constant came from.
196 ${constant} = MdsalLowlevel.Get_Contexted_Constant ${member_index} ${CONTEXT}
197 ${index} = String.Replace_String ${constant} ${CONSTANT_PREFIX} ${EMPTY}
198 ${index} = BuiltIn.Convert_To_Integer ${index}
199 BuiltIn.Return_From_Keyword ${index}
202 [Arguments] ${member_index}
203 [Documentation] Isolate a member and update appropriate suite variables.
204 ClusterManagement.Isolate_Member_From_List_Or_All ${member_index}
205 DrbCommons__Update_Active_Nodes_List deactivate_idx=${member_index}
206 BuiltIn.Return_From_Keyword_If ${member_index} not in ${registered_indices}
207 DrbCommons__Rem_Possible_Constant ${member_index}
210 [Arguments] ${member_index}
211 [Documentation] Rejoin a member and update appropriate suite variables.
212 ClusterManagement.Rejoin_Member_From_List_Or_All ${member_index}
213 BuiltIn.Wait_Until_Keyword_Succeeds 70s 10s ShardStability.Shards_Stability_Get_Details ${DEFAULT_SHARD_LIST}
214 DrbCommons__Update_Active_Nodes_List activate_idx=${member_index}
215 BuiltIn.Return_From_Keyword_If ${member_index} not in ${registered_indices}
216 DrbCommons__Add_Possible_Constant ${member_index}
218 DrbCommons__Update_Active_Nodes_List
219 [Arguments] ${activate_idx}=${EMPTY} ${deactivate_idx}=${EMPTY}
220 [Documentation] Add or remove member index to/from the list of active nodes.
221 BuiltIn.Run_Keyword_If "${activate_idx}" != "${EMPTY}" Collections.Append_To_List ${active_indices} ${activate_idx}
222 BuiltIn.Run_Keyword_If "${deactivate_idx}" != "${EMPTY}" Collections.Remove_Values_From_List ${active_indices} ${deactivate_idx}
223 Collections.Sort_List ${active_indices}
225 DrbCommons__Register_Index
226 [Arguments] ${member_index}
227 [Documentation] Add member index to the list of indices with registered rpc.
228 ... Isolated nodes are included in the list.
229 Collections.Append_To_List ${registered_indices} ${member_index}
230 Collections.Remove_Values_From_List ${nonregistered_indices} ${member_index}
231 Collections.Sort_List ${registered_indices}
232 Collections.Sort_List ${nonregistered_indices}
234 DrbCommons__Deregister_Index
235 [Arguments] ${member_index}
236 [Documentation] Remove member index from the list of indices with registered rpc.
237 ... Isolated nodes are included in the list.
238 Collections.Remove_Values_From_List ${registered_indices} ${member_index}
239 Collections.Append_To_List ${nonregistered_indices} ${member_index}
240 Collections.Sort_List ${registered_indices}
241 Collections.Sort_List ${nonregistered_indices}
243 DrbCommons__Add_Possible_Constant
244 [Arguments] ${member_index}
245 [Documentation] Add a constant to the ${possible_constants} list. The list is about to maintain
246 ... all valid constants possibly responded from the odl cluster (excluding isolated nodes).
247 Collections.Append_To_List ${possible_constants} ${CONSTANT_PREFIX}${member_index}
248 Collections.Sort_List ${possible_constants}
250 DrbCommons__Rem_Possible_Constant
251 [Arguments] ${member_index}
252 [Documentation] Remove a constant from the ${possible_constants} list. The list is about to maintain
253 ... all valid constants possibly responded from the odl cluster (excluding isolated nodes).
254 Collections.Remove_Values_From_List ${possible_constants} ${CONSTANT_PREFIX}${member_index}