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 Resource ${CURDIR}/../ClusterManagement.robot
25 Resource ${CURDIR}/../MdsalLowlevel.robot
26 Resource ${CURDIR}/../ShardStability.robot
29 ${CONSTANT_PREFIX} constant-
34 [Documentation] Resouce initial keyword. Creates several suite variables which are
35 ... used in other keywords and should be used im the test suites.
36 ${all_indices} = ClusterManagement.List_All_Indices
37 BuiltIn.Set_Suite_Variable ${all_indices}
38 ${nonregistered_indices} = ClusterManagement.List_All_Indices
39 BuiltIn.Set_Suite_Variable ${nonregistered_indices}
40 ${active_indices} = ClusterManagement.List_All_Indices
41 BuiltIn.Set_Suite_Variable ${active_indices}
42 ${possible_constants} = BuiltIn.Create_List
43 BuiltIn.Set_Suite_Variable ${possible_constants}
44 ${registered_indices} = BuiltIn.Create_List
45 BuiltIn.Set_Suite_Variable ${registered_indices}
47 Register_Rpc_And_Update_Possible_Constants
48 [Arguments] ${member_index}
49 [Documentation] Register global rpc on given node of the cluster.
50 MdsalLowlevel.Register_Constant ${member_index} ${CONSTANT_PREFIX}${member_index}
51 DrbCommons__Add_Possible_Constant ${member_index}
52 DrbCommons__Register_Index ${member_index}
54 Unregister_Rpc_And_Update_Possible_Constants
55 [Arguments] ${member_index}
56 [Documentation] Unregister global rpc on given node of the cluster.
57 MdsalLowlevel.Unregister_Constant ${member_index}
58 DrbCommons__Rem_Possible_Constant ${member_index}
59 DrbCommons__Deregister_Index ${member_index}
61 Register_Action_And_Update_Possible_Constants
62 [Arguments] ${member_index}
63 [Documentation] Register routed rpc on given node of the cluster.
64 MdsalLowlevel.Register_Bound_Constant ${member_index} ${CONTEXT} ${CONSTANT_PREFIX}${member_index}
65 DrbCommons__Add_Possible_Constant ${member_index}
66 DrbCommons__Register_Index ${member_index}
68 Unregister_Action_And_Update_Possible_Constants
69 [Arguments] ${member_index}
70 [Documentation] Unregister routed rpc on given node of the cluster.
71 MdsalLowlevel.Unregister_Bound_Constant ${member_index} ${CONTEXT}
72 DrbCommons__Rem_Possible_Constant ${member_index}
73 DrbCommons__Deregister_Index ${member_index}
76 [Arguments] ${index_list}
77 [Documentation] Register global rpc on given nodes of the cluster.
78 : FOR ${index} IN @{index_list}
79 \ Register_Rpc_And_Update_Possible_Constants ${index}
81 Unregister_Rpc_On_Nodes
82 [Arguments] ${index_list}
83 [Documentation] Unregister global rpc on given nodes of the cluster.
84 : FOR ${index} IN @{index_list}
85 \ Unregister_Rpc_And_Update_Possible_Constants ${index}
87 Register_Action_On_Nodes
88 [Arguments] ${index_list}
89 [Documentation] Register global rpc on given nodes of the cluster.
90 : FOR ${index} IN @{index_list}
91 \ Register_Action_And_Update_Possible_Constants ${index}
93 Unregister_Action_On_Nodes
94 [Arguments] ${index_list}
95 [Documentation] Unregister global rpc on given nodes of the cluster.
96 : FOR ${index} IN @{index_list}
97 \ Unregister_Action_And_Update_Possible_Constants ${index}
99 Verify_Constant_On_Registered_Node
100 [Arguments] ${member_index}
101 [Documentation] Verify that the rpc response comes from the local node.
102 ${constant} = MdsalLowlevel.Get_Constant ${member_index}
103 BuiltIn.Should_Be_Equal_As_Strings ${CONSTANT_PREFIX}${member_index} ${constant}
104 BuiltIn.Return_From_Keyword ${constant}
106 Verify_Constant_On_Unregistered_Node
107 [Arguments] ${member_index}
108 [Documentation] Verify that the response comes from other nodes with rpc registered. Verification
109 ... passes for registered nodes too.
110 ${constant} = MdsalLowlevel.Get_Constant ${member_index}
111 Collections.List_Should_Contain_Value ${possible_constants} ${constant}
112 BuiltIn.Return_From_Keyword ${constant}
114 Verify_Contexted_Constant_On_Registered_Node
115 [Arguments] ${member_index}
116 [Documentation] Verify that the rpc response comes from the local node.
117 ${constant} = MdsalLowlevel.Get_Contexted_Constant ${member_index} ${CONTEXT}
118 BuiltIn.Should_Be_Equal_As_Strings ${CONSTANT_PREFIX}${member_index} ${constant}
119 BuiltIn.Return_From_Keyword ${constant}
121 Verify_Contexted_Constant_On_Unregistered_Node
122 [Arguments] ${member_index}
123 [Documentation] Verify that the response comes from other nodes with rpc registered. Verification
124 ... passes for registered nodes too.
125 ${constant} = MdsalLowlevel.Get_Contexted_Constant ${member_index} ${CONTEXT}
126 Collections.List_Should_Contain_Value ${possible_constants} ${constant}
127 BuiltIn.Return_From_Keyword ${constant}
129 Verify_Constant_On_Registered_Nodes
130 [Arguments] ${index_list}
131 [Documentation] Verify that the rpc response comes from the local node for every node in the list.
132 : FOR ${index} IN @{index_list}
133 \ Verify_Constant_On_Registered_Node ${index}
135 Verify_Contexted_Constant_On_Registered_Nodes
136 [Arguments] ${index_list}
137 [Documentation] Verify that the rpc response comes from the local node for every node in the list.
138 : FOR ${index} IN @{index_list}
139 \ Verify_Contexted_Constant_On_Registered_Node ${index}
141 Verify_Constant_On_Unregistered_Nodes
142 [Arguments] ${index_list}
143 [Documentation] Verify that the rpc response comes from the remote node for every node in the list.
144 : FOR ${index} IN @{index_list}
145 \ Verify_Constant_On_Unregistered_Node ${index}
147 Verify_Constant_On_Active_Nodes
148 [Documentation] Verify that the rpc response comes from the local node for every node in the list.
149 : FOR ${index} IN @{active_indices}
150 \ BuiltIn.Run_Keyword_If ${index} in ${registered_indices} Verify_Constant_On_Registered_Node ${index}
151 \ ... ELSE Verify_Constant_On_Unregistered_Node ${index}
153 Verify_Contexted_Constant_On_Active_Nodes
154 [Documentation] Verify that the rpc response comes from the local node for every node in the list.
155 : FOR ${index} IN @{active_indices}
156 \ BuiltIn.Run_Keyword_If ${index} in ${registered_indices} Verify_Contexted_Constant_On_Registered_Node ${index}
157 \ ... ELSE Verify_Contexted_Constant_On_Unregistered_Node ${index}
159 Verify_Expected_Constant_On_Nodes
160 [Arguments] ${index_list} ${exp_constant}
161 [Documentation] Verify that the rpc response comes only from one node only for every node in the list.
162 : FOR ${index} IN @{index_list}
163 \ ${const_index} = Get_Constant_Index_From_Node ${index}
164 \ BuiltIn.Should_Be_Equal_As_Strings ${exp_constant} ${CONSTANT_PREFIX}${const_index}
166 Get_Constant_Index_From_Node
167 [Arguments] ${member_index}
168 [Documentation] Ivoke get-constant rpc on given member index. Returns the index of
169 ... the node where the constant came from.
170 ${constant} = MdsalLowlevel.Get_Constant ${member_index}
171 ${index} = String.Replace_String ${constant} ${CONSTANT_PREFIX} ${EMPTY}
172 ${index} = BuiltIn.Convert_To_Integer ${index}
173 BuiltIn.Return_From_Keyword ${index}
175 Get_Contexted_Constant_Index_From_Node
176 [Arguments] ${member_index}
177 [Documentation] Ivoke get-contexted-constant rpc on given member index. Returns the index of
178 ... the node where the constant came from.
179 ${constant} = MdsalLowlevel.Get_Contexted_Constant ${member_index} ${CONTEXT}
180 ${index} = String.Replace_String ${constant} ${CONSTANT_PREFIX} ${EMPTY}
181 ${index} = BuiltIn.Convert_To_Integer ${index}
182 BuiltIn.Return_From_Keyword ${index}
185 [Arguments] ${member_index}
186 [Documentation] Isolate a member and update appropriate suite variables.
187 ClusterManagement.Isolate_Member_From_List_Or_All ${member_index}
188 DrbCommons__Upadte_Active_Nodes_List deactivate_idx=${member_index}
189 BuiltIn.Return_From_Keyword_If ${member_index} not in ${registered_indices}
190 DrbCommons__Rem_Possible_Constant ${member_index}
193 [Arguments] ${member_index}
194 [Documentation] Rejoin a member and update appropriate suite variables.
195 ClusterManagement.Rejoin_Member_From_List_Or_All ${member_index}
196 BuiltIn.Wait_Until_Keyword_Succeeds 70s 10s ShardStability.Shards_Stability_Get_Details ${DEFAULT_SHARD_LIST}
197 DrbCommons__Upadte_Active_Nodes_List activate_idx=${member_index}
198 BuiltIn.Return_From_Keyword_If ${member_index} not in ${registered_indices}
199 DrbCommons__Add_Possible_Constant ${member_index}
201 DrbCommons__Upadte_Active_Nodes_List
202 [Arguments] ${activate_idx}=${EMPTY} ${deactivate_idx}=${EMPTY}
203 [Documentation] Add or remove member index to/from the list of active nodes.
204 BuiltIn.Run_Keyword_If "${activate_idx}" != "${EMPTY}" Collections.Append_To_List ${active_indices} ${activate_idx}
205 BuiltIn.Run_Keyword_If "${deactivate_idx}" != "${EMPTY}" Collections.Remove_Values_From_List ${active_indices} ${deactivate_idx}
206 Collections.Sort_List ${active_indices}
208 DrbCommons__Register_Index
209 [Arguments] ${member_index}
210 [Documentation] Add member index to the list of indices with registered rpc.
211 ... Isolated nodes are included in the list.
212 Collections.Append_To_List ${registered_indices} ${member_index}
213 Collections.Remove_Values_From_List ${nonregistered_indices} ${member_index}
214 Collections.Sort_List ${registered_indices}
215 Collections.Sort_List ${nonregistered_indices}
217 DrbCommons__Deregister_Index
218 [Arguments] ${member_index}
219 [Documentation] Remove member index from the list of indices with registered rpc.
220 ... Isolated nodes are included in the list.
221 Collections.Remove_Values_From_List ${registered_indices} ${member_index}
222 Collections.Append_To_List ${nonregistered_indices} ${member_index}
223 Collections.Sort_List ${registered_indices}
224 Collections.Sort_List ${nonregistered_indices}
226 DrbCommons__Add_Possible_Constant
227 [Arguments] ${member_index}
228 [Documentation] Add a constant to the ${possible_constants} list. The list is about to maintain
229 ... all valid constants possibly responded from the odl cluster (excluding isolated nodes).
230 Collections.Append_To_List ${possible_constants} ${CONSTANT_PREFIX}${member_index}
231 Collections.Sort_List ${possible_constants}
233 DrbCommons__Rem_Possible_Constant
234 [Arguments] ${member_index}
235 [Documentation] Remove a constant from the ${possible_constants} list. The list is about to maintain
236 ... all valid constants possibly responded from the odl cluster (excluding isolated nodes).
237 Collections.Remove_Values_From_List ${possible_constants} ${CONSTANT_PREFIX}${member_index}