2 Documentation Resource housing Keywords common to several suites for cluster functional testing.
4 ... Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
5 ... Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
7 ... This program and the accompanying materials are made available under the
8 ... terms of the Eclipse Public License v1.0 which accompanies this distribution,
9 ... and is available at http://www.eclipse.org/legal/epl-v10.html
12 ... This resource holds private state (in suite variables),
13 ... which is generated once at Setup with ClusterManagement_Setup KW.
14 ... The state includes member indexes, IP addresses and Http (RequestsLibrary) sessions.
15 ... Cluster Keywords normally use member index, member list or nothing (all members) as argument.
17 ... All index lists returned should be sorted numerically, fix if not.
20 ... odl-jolokia is assumed to be installed.
22 ... Keywords are ordered as follows:
24 ... - Shard state, leader and followers
25 ... - Entity Owner, candidates and successors
26 ... - Kill and Start Member
27 ... - Isolate and Rejoin Member
28 ... - Run Commands On Member
29 ... - REST requests and checks on Members
31 ... TODO: Unify capitalization of Leaders and Followers.
32 Library RequestsLibrary # for Create_Session and To_Json
34 Resource ${CURDIR}/CompareStream.robot
35 Resource ${CURDIR}/KarafKeywords.robot
36 Resource ${CURDIR}/SSHKeywords.robot
37 Resource ${CURDIR}/TemplatedRequests.robot # for Get_As_Json_From_Uri
38 Resource ${CURDIR}/Utils.robot # for Run_Command_On_Controller
41 ${ENTITY_OWNER_URI} restconf/operational/entity-owners:entity-owners
42 ${JAVA_HOME} ${EMPTY} # releng/builder scripts should provide correct value
43 ${JOLOKIA_CONF_SHARD_MANAGER_URI} jolokia/read/org.opendaylight.controller:Category=ShardManager,name=shard-manager-config,type=DistributedConfigDatastore
44 ${JOLOKIA_OPER_SHARD_MANAGER_URI} jolokia/read/org.opendaylight.controller:Category=ShardManager,name=shard-manager-operational,type=DistributedOperationalDatastore
45 ${JOLOKIA_READ_URI} jolokia/read/org.opendaylight.controller
46 ${KARAF_HOME} ${WORKSPACE}${/}${BUNDLEFOLDER} # TODO: Migrate to Variables.robot
47 @{ODL_DEFAULT_DATA_PATHS} tmp/ data/ cache/ snapshots/ journal/ etc/opendaylight/current/
48 ${RESTCONF_MODULES_DIR} ${CURDIR}/../variables/restconf/modules
49 ${SINGLETON_NETCONF_DEVICE_ID_PREFIX} /odl-general-entity:entity[odl-general-entity:name='KeyedInstanceIdentifier{targetType=interface org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node, path=[org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology, org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology[key=TopologyKey [_topologyId=Uri [_value=topology-netconf]]], org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node[key=NodeKey [_nodeId=Uri [_value=
50 ${SINGLETON_NETCONF_DEVICE_ID_SUFFIX} ]]]]}']
51 ${SINGLETON_ELECTION_ENTITY_TYPE} org.opendaylight.mdsal.ServiceEntityType
52 ${SINGLETON_CHANGE_OWNERSHIP_ENTITY_TYPE} org.opendaylight.mdsal.AsyncServiceCloseEntityType
55 ClusterManagement_Setup
56 [Documentation] Detect repeated call, or detect number of members and initialize derived suite variables.
57 # Avoid multiple initialization by several downstream libraries.
58 ${already_done} = BuiltIn.Get_Variable_Value \${ClusterManagement__has_setup_run} False
59 BuiltIn.Return_From_Keyword_If ${already_done}
60 BuiltIn.Set_Suite_Variable \${ClusterManagement__has_setup_run} True
61 ${cluster_size} = BuiltIn.Get_Variable_Value \${NUM_ODL_SYSTEM} 1
62 ${status} ${possibly_int_of_members} = BuiltIn.Run_Keyword_And_Ignore_Error BuiltIn.Convert_To_Integer ${cluster_size}
63 ${int_of_members} = BuiltIn.Set_Variable_If '${status}' != 'PASS' ${1} ${possibly_int_of_members}
64 ClusterManagement__Compute_Derived_Variables int_of_members=${int_of_members}
66 Check_Cluster_Is_In_Sync
67 [Arguments] ${member_index_list}=${EMPTY}
68 [Documentation] Fail if no-sync is detected on a member from list (or any).
69 ${index_list} = ClusterManagement__Given_Or_Internal_Index_List given_list=${member_index_list}
70 : FOR ${index} IN @{index_list} # usually: 1, 2, 3.
71 \ ${status} = Get_Sync_Status_Of_Member member_index=${index}
72 \ BuiltIn.Continue_For_Loop_If 'True' == '${status}'
73 \ BuiltIn.Fail Index ${index} has incorrect status: ${status}
75 Get_Sync_Status_Of_Member
76 [Arguments] ${member_index}
77 [Documentation] Obtain IP, two GETs from jolokia URIs, return combined sync status as string.
78 ${session} = Resolve_Http_Session_For_Member member_index=${member_index}
79 ${conf_text} = TemplatedRequests.Get_As_Json_From_Uri uri=${JOLOKIA_CONF_SHARD_MANAGER_URI} session=${session}
80 ${conf_status} = ClusterManagement__Parse_Sync_Status shard_manager_text=${conf_text}
81 BuiltIn.Return_From_Keyword_If 'False' == ${conf_status} False
82 ${oper_text} = TemplatedRequests.Get_As_Json_From_Uri uri=${JOLOKIA_OPER_SHARD_MANAGER_URI} session=${session}
83 ${oper_status} = ClusterManagement__Parse_Sync_Status shard_manager_text=${oper_text}
84 [Return] ${oper_status}
86 Verify_Leader_Exists_For_Each_Shard
87 [Arguments] ${shard_name_list} ${shard_type}=operational ${member_index_list}=${EMPTY} ${verify_restconf}=True
88 [Documentation] For each shard name, call Get_Leader_And_Followers_For_Shard.
89 ... Not much logic there, but single Keyword is useful when using BuiltIn.Wait_Until_Keyword_Succeeds.
90 : FOR ${shard_name} IN @{shard_name_list}
91 \ Get_Leader_And_Followers_For_Shard shard_name=${shard_name} shard_type=${shard_type} validate=True member_index_list=${member_index_list} verify_restconf=${verify_restconf}
93 Get_Leader_And_Followers_For_Shard
94 [Arguments] ${shard_name}=default ${shard_type}=operational ${validate}=True ${member_index_list}=${EMPTY} ${verify_restconf}=True
95 [Documentation] Get role lists, validate there is one leader, return the leader and list of followers.
96 ... Optionally, issue GET to a simple restconf URL to make sure subsequent operations will not encounter 503.
97 ${leader_list} ${follower_list} = Get_State_Info_For_Shard shard_name=${shard_name} shard_type=${shard_type} validate=True member_index_list=${member_index_list}
98 ... verify_restconf=${verify_restconf}
99 ${leader_count} = BuiltIn.Get_Length ${leader_list}
100 BuiltIn.Run_Keyword_If ${leader_count} < 1 BuiltIn.Fail No leader found.
101 BuiltIn.Length_Should_Be ${leader_list} ${1} Too many Leaders.
102 ${leader} = Collections.Get_From_List ${leader_list} 0
103 [Return] ${leader} ${follower_list}
105 Get_State_Info_For_Shard
106 [Arguments] ${shard_name}=default ${shard_type}=operational ${validate}=False ${member_index_list}=${EMPTY} ${verify_restconf}=False
107 [Documentation] Return lists of Leader and Follower member indices from a given member index list
108 ... (or from the full list if empty). If \${shard_type} is not 'config', 'operational' is assumed.
109 ... If \${validate}, Fail if raft state is not Leader or Follower (for example on Candidate).
110 ... The biggest difference from Get_Leader_And_Followers_For_Shard
111 ... is that no check on number of Leaders is performed.
112 ${index_list} = ClusterManagement__Given_Or_Internal_Index_List given_list=${member_index_list}
113 Collections.Sort_List ${index_list} # to guarantee return values are also sorted lists
114 # TODO: Support alternative capitalization of 'config'?
115 ${ds_type} = BuiltIn.Set_Variable_If '${shard_type}' != 'config' operational config
116 ${leader_list} = BuiltIn.Create_List
117 ${follower_list} = BuiltIn.Create_List
118 : FOR ${index} IN @{index_list} # usually: 1, 2, 3.
119 \ ${raft_state} = Get_Raft_State_Of_Shard_At_Member shard_name=${shard_name} shard_type=${ds_type} member_index=${index} verify_restconf=${verify_restconf}
120 \ BuiltIn.Run_Keyword_If 'Follower' == '${raft_state}' Collections.Append_To_List ${follower_list} ${index}
121 \ ... ELSE IF 'Leader' == '${raft_state}' Collections.Append_To_List ${leader_list} ${index}
122 \ ... ELSE IF ${validate} BuiltIn.Fail Unrecognized Raft state: ${raft_state}
123 [Return] ${leader_list} ${follower_list}
125 Get_Raft_State_Of_Shard_At_Member
126 [Arguments] ${shard_name} ${shard_type} ${member_index} ${verify_restconf}=False
127 [Documentation] Send request to Jolokia on indexed member, return extracted Raft status.
128 ... Optionally, check restconf works.
129 ${session} = Resolve_Http_Session_For_Member member_index=${member_index}
130 # TODO: Does the used URI tend to generate large data which floods log.html?
131 BuiltIn.Run_Keyword_If ${verify_restconf} TemplatedRequests.Get_As_Json_Templated session=${session} folder=${RESTCONF_MODULES_DIR} verify=False
132 ${type_class} = Resolve_Shard_Type_Class shard_type=${shard_type}
133 ${uri} = BuiltIn.Set_Variable ${JOLOKIA_READ_URI}:Category=Shards,name=member-${member_index}-shard-${shard_name}-${shard_type},type=${type_class}
134 ${data_text} = TemplatedRequests.Get_As_Json_From_Uri uri=${uri} session=${session}
135 ${data_object} = RequestsLibrary.To_Json ${data_text}
136 ${value} = Collections.Get_From_Dictionary ${data_object} value
137 ${raft_state} = Collections.Get_From_Dictionary ${value} RaftState
138 [Return] ${raft_state}
140 Verify_Owner_And_Successors_For_Device
141 [Arguments] ${device_name} ${device_type} ${member_index} ${candidate_list}=${EMPTY}
142 [Documentation] Returns the owner and successors for the SB device ${device_name} of type ${device_type}. Request is sent to member ${member_index}.
143 ... For Boron and beyond, candidates are not removed on node down or isolation,
144 ... so this keyword expects candidates to be all members from Boron on.
145 ... Extra check is done to verify owner and successors are within the ${candidate_list}. This KW is useful when combined with WUKS.
146 ... ${candidate_list} minus owner is returned as ${successor list}.
147 ... Users can still use Get_Owner_And_Successors_For_Device if they are interested in downed candidates,
148 ... or for testing heterogeneous clusters.
149 ${index_list} = ClusterManagement__Given_Or_Internal_Index_List given_list=${candidate_list}
150 ${owner} ${successor_list} = Get_Owner_And_Successors_For_Device device_name=${device_name} device_type=${device_type} member_index=${member_index}
151 Collections.List_Should_Contain_Value ${index_list} ${owner} Owner ${owner} is not in candidate list ${index_list}
152 ${expected_candidate_list_origin} = CompareStream.Set_Variable_If_At_Least_Boron ${ClusterManagement__member_index_list} ${index_list}
153 # We do not want to manipulate either origin list.
154 ${expected_successor_list} = BuiltIn.Create_List @{expected_candidate_list_origin}
155 Collections.Remove_Values_From_List ${expected_successor_list} ${owner}
156 Collections.Lists_Should_Be_Equal ${expected_successor_list} ${successor_list} Successor list ${successor_list} is not the came as expected ${expected_successor_list}
157 # User expects the returned successor list to be the provided candidate list minus the owner.
158 Collections.Remove_Values_From_List ${index_list} ${owner}
159 [Return] ${owner} ${index_list}
161 Get_Owner_And_Successors_For_Device
162 [Arguments] ${device_name} ${device_type} ${member_index}
163 [Documentation] Returns the owner and a list of successors for the SB device ${device_name} of type ${device_type}. Request is sent to member ${member_index}.
164 ... Successors are those device candidates not elected as owner. The list of successors = (list of candidates) - (owner).
165 ... The returned successor list is sorted numerically.
166 ... Note that "candidate list" definition currently differs between Beryllium and Boron.
167 ... Use Verify_Owner_And_Successors_For_Device if you want the older semantics (inaccessible nodes not present in the list).
168 ${owner} ${candidate_list} = Get_Owner_And_Candidates_For_Device device_name=${device_name} device_type=${device_type} member_index=${member_index}
169 ${successor_list} = BuiltIn.Create_List @{candidate_list} # Copy operation is not required, but new variable name requires a line anyway.
170 Collections.Remove_Values_From_List ${successor_list} ${owner}
171 [Return] ${owner} ${successor_list}
173 Get_Owner_And_Candidates_For_Device_Old
174 [Arguments] ${device_name} ${device_type} ${member_index}
175 [Documentation] Returns the owner and a list of candidates for the SB device ${device_name} of type ${device_type}. Request is sent to member ${member_index}.
176 ... Candidates are all members that register to own a device, so the list of candiates includes the owner.
177 ... The returned candidate list is sorted numerically.
178 ... Note that "candidate list" definition currently differs between Beryllium and Boron.
179 ... It is recommended to use Get_Owner_And_Successors_For_Device instead of this keyword, see documentation there.
180 BuiltIn.Comment TODO: Can this implementation be changed to call Get_Owner_And_Candidates_For_Type_And_Id?
181 ${session} = Resolve_Http_Session_For_Member member_index=${member_index}
182 ${data} = TemplatedRequests.Get_As_Json_From_Uri uri=${ENTITY_OWNER_URI} session=${session}
183 ${candidate_list} = BuiltIn.Create_List
184 ${entity_type} = BuiltIn.Set_Variable_If '${device_type}' == 'netconf' netconf-node/${device_name} ${device_type}
185 ${clear_data} = BuiltIn.Run_Keyword_If '${device_type}' == 'openflow' or '${device_type}' == 'netconf' Extract_OpenFlow_Device_Data ${data}
186 ... ELSE IF '${device_type}' == 'ovsdb' Extract_Ovsdb_Device_Data ${data}
187 ... ELSE IF '${device_type}' == 'org.opendaylight.mdsal.ServiceEntityType' Extract_Service_Entity_Type ${data}
188 ... ELSE Fail Not recognized device type: ${device_type}
189 ${json} = RequestsLibrary.To_Json ${clear_data}
190 ${entity_type_list} = Collections.Get_From_Dictionary &{json}[entity-owners] entity-type
191 ${entity_type_index} = Utils.Get_Index_From_List_Of_Dictionaries ${entity_type_list} type ${entity_type}
192 BuiltIn.Should_Not_Be_Equal_As_Integers ${entity_type_index} -1 No Entity Owner found for ${device_type}
193 ${entity_list} = Collections.Get_From_Dictionary @{entity_type_list}[${entity_type_index}] entity
194 ${entity_index} = Utils.Get_Index_From_List_Of_Dictionaries ${entity_list} id ${device_name}
195 BuiltIn.Should_Not_Be_Equal_As_Integers ${entity_index} -1 Device ${device_name} not found in Entity Owner ${device_type}
196 ${entity_owner} = Collections.Get_From_Dictionary @{entity_list}[${entity_index}] owner
197 BuiltIn.Should_Not_Be_Empty ${entity_owner} No owner found for ${device_name}
198 ${owner} = String.Replace_String ${entity_owner} member- ${EMPTY}
199 ${owner} = BuiltIn.Convert_To_Integer ${owner}
200 ${entity_candidates_list} = Collections.Get_From_Dictionary @{entity_list}[${entity_index}] candidate
201 : FOR ${entity_candidate} IN @{entity_candidates_list}
202 \ ${candidate} = String.Replace_String &{entity_candidate}[name] member- ${EMPTY}
203 \ ${candidate} = BuiltIn.Convert_To_Integer ${candidate}
204 \ Collections.Append_To_List ${candidate_list} ${candidate}
205 Collections.Sort_List ${candidate_list}
206 [Return] ${owner} ${candidate_list}
208 Get_Owner_And_Candidates_For_Device_Singleton
209 [Arguments] ${device_name} ${device_type} ${member_index}
210 [Documentation] Returns the owner and a list of candidates for the SB device ${device_name} of type ${device_type}. Request is sent to member ${member_index}.
211 ... Parsing method is selected by device type
212 ... Separate kw for every supported device type must be defined
213 BuiltIn.Keyword_Should_Exist Get_Owner_And_Candidates_For_Device_Singleton_${device_type}
214 BuiltIn.Run_Keyword_And_Return Get_Owner_And_Candidates_For_Device_Singleton_${device_type} ${device_name} ${member_index}
216 Get_Owner_And_Candidates_For_Device_Singleton_Netconf
217 [Arguments] ${device_name} ${member_index}
218 [Documentation] Returns the owner and a list of candidates for the SB device ${device_name} of type netconf. Request is sent to member ${member_index}.
219 ... Parsing method is set as netconf (using netconf device id prefix and suffix)
220 # Get election entity type results
221 ${type} = BuiltIn.Set_Variable ${SINGLETON_ELECTION_ENTITY_TYPE}
222 ${id} = BuiltIn.Set_Variable ${SINGLETON_NETCONF_DEVICE_ID_PREFIX}${device_name}${SINGLETON_NETCONF_DEVICE_ID_SUFFIX}
223 ${owner_1} ${candidate_list_1} = Get_Owner_And_Candidates_For_Type_And_Id ${type} ${id} ${member_index}
224 # Get change ownership entity type results
225 ${type} = BuiltIn.Set_Variable ${SINGLETON_CHANGE_OWNERSHIP_ENTITY_TYPE}
226 ${id} = BuiltIn.Set_Variable ${SINGLETON_NETCONF_DEVICE_ID_PREFIX}${device_name}${SINGLETON_NETCONF_DEVICE_ID_SUFFIX}
227 ${owner_2} ${candidate_list_2} = Get_Owner_And_Candidates_For_Type_And_Id ${type} ${id} ${member_index}
228 # Owners must be same, if not, there is still some election or change ownership in progress
229 BuiltIn.Should_Be_Equal_As_Integers ${owner_1} ${owner_2} Owners for device ${device_name} are not same
230 [Return] ${owner_1} ${candidate_list_1}
232 Get_Owner_And_Candidates_For_Device
233 [Arguments] ${device_name} ${device_type} ${member_index}
234 [Documentation] Returns the owner and a list of candidates for the SB device ${device_name} of type ${device_type}. Request is sent to member ${member_index}.
235 ... If parsing as singleton failed, kw try to parse data in old way (without singleton).
236 ... Candidates are all members that register to own a device, so the list of candiates includes the owner.
237 ... The returned candidate list is sorted numerically.
238 ... Note that "candidate list" definition currently differs between Beryllium and Boron.
239 ... It is recommended to use Get_Owner_And_Successors_For_Device instead of this keyword, see documentation there.
241 ${status} ${results} = BuiltIn.Run_Keyword_And_Ignore_Error Get_Owner_And_Candidates_For_Device_Singleton device_name=${device_name} device_type=${device_type} member_index=${member_index}
242 BuiltIn.Return_From_Keyword_If "${status}"=="PASS" ${results}
243 # If singleton failed, try parsing in old way
244 ${status} ${results} = BuiltIn.Run_Keyword_And_Ignore_Error Get_Owner_And_Candidates_For_Device_Old device_name=${device_name} device_type=${device_type} member_index=${member_index}
245 # previous 3 lines (BuilIn.Return.., # If singleton..., ${status}....) could be deleted when old way will not be supported anymore
246 BuiltIn.Run_Keyword_If '${status}'=='FAIL' BuiltIn.Fail Could not parse owner and candidates for device ${device_name}
249 Get_Owner_And_Candidates_For_Type_And_Id
250 [Arguments] ${type} ${id} ${member_index} ${require_candidate_list}=${EMPTY}
251 [Documentation] Returns the owner and a list of candidates for entity specified by ${type} and ${id}
252 ... Request is sent to member ${member_index}.
253 ... Candidates are all members that register to own a device, so the list of candiates includes the owner.
254 ... Bear in mind that for Boron and beyond, candidates are not removed on node down or isolation.
255 ... If ${require_candidate_list} is not \${EMPTY}, check whether the actual list of candidates matches.
256 ... Note that differs from "given list" semantics used in other keywords,
257 ... namely you cannot use \${EMPTY} to stand for "full list" in this keyword.
258 BuiltIn.Comment TODO: Find a way to unify and deduplicate code blocks in Get_Owner_And_Candidates_* keywords.
259 ${session} = Resolve_Http_Session_For_Member member_index=${member_index}
260 ${data} = TemplatedRequests.Get_As_Json_From_Uri uri=${ENTITY_OWNER_URI} session=${session}
261 ${candidate_list} = BuiltIn.Create_List
262 ${json} = RequestsLibrary.To_Json ${data}
263 ${entity_type_list} = Collections.Get_From_Dictionary &{json}[entity-owners] entity-type
264 ${entity_type_index} = Utils.Get_Index_From_List_Of_Dictionaries ${entity_type_list} type ${type}
265 BuiltIn.Should_Not_Be_Equal_As_Integers ${entity_type_index} -1 No Entity Owner found for ${type}
266 ${entity_list} = Collections.Get_From_Dictionary @{entity_type_list}[${entity_type_index}] entity
267 ${entity_index} = Utils.Get_Index_From_List_Of_Dictionaries ${entity_list} id ${id}
268 BuiltIn.Should Not_Be_Equal_As_Integers ${entity_index} -1 Id ${id} not found in Entity Owner ${type}
269 ${entity_owner} = Collections.Get_From_Dictionary @{entity_list}[${entity_index}] owner
270 BuiltIn.Should_Not_Be_Empty ${entity_owner} No owner found for type=${type} id=${id}
271 ${owner} = String.Replace_String ${entity_owner} member- ${EMPTY}
272 ${owner} = BuiltIn.Convert_To_Integer ${owner}
273 ${entity_candidates_list} = Collections.Get_From_Dictionary @{entity_list}[${entity_index}] candidate
274 : FOR ${entity_candidate} IN @{entity_candidates_list}
275 \ ${candidate} = String.Replace_String &{entity_candidate}[name] member- ${EMPTY}
276 \ ${candidate} = BuiltIn.Convert_To_Integer ${candidate}
277 \ Collections.Append_To_List ${candidate_list} ${candidate}
278 Collections.Sort_List ${candidate_list}
279 BuiltIn.Comment TODO: Separate check lines into Verify_Owner_And_Candidates_For_Type_And_Id
280 BuiltIn.Run_Keyword_If """${require_candidate_list}""" BuiltIn.Should_Be_Equal ${require_candidate_list} ${candidate_list} Candidate list does not match: ${candidate_list} is not ${require_candidate_list}
281 [Return] ${owner} ${candidate_list}
283 Extract_Service_Entity_Type
285 [Documentation] Remove superfluous device data from Entity Owner printout.
286 ${clear_data} = String.Replace_String ${data} /odl-general-entity:entity[odl-general-entity:name=' ${EMPTY}
287 ${clear_data} = String.Replace_String ${clear_data} -service-group'] ${EMPTY}
289 [Return] ${clear_data}
291 Extract_OpenFlow_Device_Data
293 [Documentation] Remove superfluous OpenFlow device data from Entity Owner printout.
294 ${clear_data} = BuiltIn.Run Keyword If '${ODL_STREAM}' != 'beryllium' and '${ODL_OF_PLUGIN}' == 'lithium' String.Replace_String ${data} org.opendaylight.mdsal.ServiceEntityType openflow
295 ... ELSE BuiltIn.Set_Variable ${data}
296 ${clear_data} = String.Replace_String ${clear_data} /odl-general-entity:entity[odl-general-entity:name=' ${EMPTY}
297 ${clear_data} = String.Replace_String ${clear_data} /general-entity:entity[general-entity:name=' ${EMPTY}
298 ${clear_data} = String.Replace_String ${clear_data} '] ${EMPTY}
300 [Return] ${clear_data}
302 Extract_Ovsdb_Device_Data
304 [Documentation] Remove superfluous OVSDB device data from Entity Owner printout.
305 ${clear_data} = String.Replace_String ${data} /network-topology:network-topology/network-topology:topology[network-topology:topology-id='ovsdb:1']/network-topology:node[network-topology:node-id=' ${EMPTY}
306 ${clear_data} = String.Replace_String ${clear_data} '] ${EMPTY}
308 [Return] ${clear_data}
311 [Arguments] ${member} ${original_index_list}=${EMPTY} ${confirm}=True
312 [Documentation] Convenience keyword that kills the specified member of the cluster.
313 ... The KW will return a list of available members: \${updated index_list}=\${original_index_list}-\${member}
314 ${index_list} = ClusterManagement__Build_List ${member}
315 ${updated_index_list} = Kill_Members_From_List_Or_All ${index_list} ${original_index_list} ${confirm}
316 [Return] ${updated_index_list}
318 Kill_Members_From_List_Or_All
319 [Arguments] ${member_index_list}=${EMPTY} ${original_index_list}=${EMPTY} ${confirm}=True
320 [Documentation] If the list is empty, kill all ODL instances. Otherwise, kill members based on \${kill_index_list}
321 ... If \${confirm} is True, sleep 1 second and verify killed instances are not there anymore.
322 ... The KW will return a list of available members: \${updated index_list}=\${original_index_list}-\${member_index_list}
323 ${kill_index_list} = ClusterManagement__Given_Or_Internal_Index_List given_list=${member_index_list}
324 ${index_list} = ClusterManagement__Given_Or_Internal_Index_List given_list=${original_index_list}
325 ${command} = BuiltIn.Set_Variable ps axf | grep karaf | grep -v grep | awk '{print \"kill -9 \" $1}' | sh
326 Run_Bash_Command_On_List_Or_All command=${command} member_index_list=${member_index_list}
327 ${updated_index_list} = BuiltIn.Create_List @{index_list}
328 Collections.Remove_Values_From_List ${updated_index_list} @{kill_index_list}
329 BuiltIn.Return_From_Keyword_If not ${confirm} ${updated_index_list}
330 # TODO: Convert to WUKS with configurable timeout if it turns out 1 second is not enough.
331 BuiltIn.Sleep 1s Kill -9 closes open files, which may take longer than ssh overhead, but not long enough to warrant WUKS.
332 : FOR ${index} IN @{kill_index_list}
333 \ Verify_Karaf_Is_Not_Running_On_Member member_index=${index}
334 [Return] ${updated_index_list}
337 [Arguments] ${member} ${wait_for_sync}=True ${timeout}=300s
338 [Documentation] Convenience keyword that starts the specified member of the cluster.
339 ${index_list} = ClusterManagement__Build_List ${member}
340 Start_Members_From_List_Or_All ${index_list} ${wait_for_sync} ${timeout}
342 Start_Members_From_List_Or_All
343 [Arguments] ${member_index_list}=${EMPTY} ${wait_for_sync}=True ${timeout}=300s ${karaf_home}=${KARAF_HOME} ${export_java_home}=${JAVA_HOME}
344 [Documentation] If the list is empty, start all cluster members. Otherwise, start members based on present indices.
345 ... If ${wait_for_sync}, wait for cluster sync on listed members.
346 ... Optionally karaf_home can be overriden. Optionally specific JAVA_HOME is used for starting.
347 ${base_command} = BuiltIn.Set_Variable ${karaf_home}/bin/start
348 ${command} = BuiltIn.Set_Variable_If "${export_java_home}" export JAVA_HOME="${export_java_home}"; ${base_command} ${base_command}
349 Run_Bash_Command_On_List_Or_All command=${command} member_index_list=${member_index_list}
350 BuiltIn.Return_From_Keyword_If not ${wait_for_sync}
351 BuiltIn.Wait_Until_Keyword_Succeeds ${timeout} 10s Check_Cluster_Is_In_Sync member_index_list=${member_index_list}
352 # TODO: Do we also want to check Shard Leaders here?
354 Clean_Journals_And_Snapshots_On_List_Or_All
355 [Arguments] ${member_index_list}=${EMPTY} ${karaf_home}=${KARAF_HOME}
356 [Documentation] Delete journal and snapshots directories on every node listed (or all).
357 ${index_list} = ClusterManagement__Given_Or_Internal_Index_List given_list=${member_index_list}
358 ${command} = Set Variable rm -rf "${karaf_home}/journal" "${karaf_home}/snapshots"
359 : FOR ${index} IN @{index_list} # usually: 1, 2, 3.
360 \ Run_Bash_Command_On_Member command=${command} member_index=${index}
362 Verify_Karaf_Is_Not_Running_On_Member
363 [Arguments] ${member_index}
364 [Documentation] Fail if non-zero karaf instances are counted on member of given index.
365 ${count} = Count_Running_Karafs_On_Member member_index=${member_index}
366 BuiltIn.Should_Be_Equal 0 ${count} Found running Karaf count: ${count}
368 Verify_Single_Karaf_Is_Running_On_Member
369 [Arguments] ${member_index}
370 [Documentation] Fail if number of karaf instances on member of given index is not one.
371 ${count} = Count_Running_Karafs_On_Member member_index=${member_index}
372 BuiltIn.Should_Be_Equal 1 ${count} Wrong number of Karafs running: ${count}
374 Count_Running_Karafs_On_Member
375 [Arguments] ${member_index}
376 [Documentation] Remotely execute grep for karaf process, return count as string.
377 ${command} = BuiltIn.Set_Variable ps axf | grep karaf | grep -v grep | wc -l
378 ${count} = Run_Bash_Command_On_Member command=${command} member_index=${member_index}
381 Isolate_Member_From_List_Or_All
382 [Arguments] ${isolate_member_index} ${member_index_list}=${EMPTY}
383 [Documentation] If the list is empty, isolate member from all ODL instances. Otherwise, isolate member based on present indices.
384 ... The KW will return a list of available members: \${updated index_list}=\${member_index_list}-\${isolate_member_index}
385 ${index_list} = ClusterManagement__Given_Or_Internal_Index_List given_list=${member_index_list}
386 ${source} = Collections.Get_From_Dictionary ${ClusterManagement__index_to_ip_mapping} ${isolate_member_index}
387 : FOR ${index} IN @{index_list}
388 \ ${destination} = Collections.Get_From_Dictionary ${ClusterManagement__index_to_ip_mapping} ${index}
389 \ ${command} = BuiltIn.Set_Variable sudo /sbin/iptables -I OUTPUT -p all --source ${source} --destination ${destination} -j DROP
390 \ BuiltIn.Run_Keyword_If "${index}" != "${isolate_member_index}" Run_Bash_Command_On_Member command=${command} member_index=${isolate_member_index}
391 ${command} = BuiltIn.Set_Variable sudo /sbin/iptables -L -n
392 ${output} = Run_Bash_Command_On_Member command=${command} member_index=${isolate_member_index}
393 BuiltIn.Log ${output}
394 ${updated_index_list} = BuiltIn.Create_List @{index_list}
395 Collections.Remove_Values_From_List ${updated_index_list} ${isolate_member_index}
396 [Return] ${updated_index_list}
398 Rejoin_Member_From_List_Or_All
399 [Arguments] ${rejoin_member_index} ${member_index_list}=${EMPTY}
400 [Documentation] If the list is empty, rejoin member from all ODL instances. Otherwise, rejoin member based on present indices.
401 ${index_list} = ClusterManagement__Given_Or_Internal_Index_List given_list=${member_index_list}
402 ${source} = Collections.Get_From_Dictionary ${ClusterManagement__index_to_ip_mapping} ${rejoin_member_index}
403 : FOR ${index} IN @{index_list}
404 \ ${destination} = Collections.Get_From_Dictionary ${ClusterManagement__index_to_ip_mapping} ${index}
405 \ ${command} = BuiltIn.Set_Variable sudo /sbin/iptables -D OUTPUT -p all --source ${source} --destination ${destination} -j DROP
406 \ BuiltIn.Run_Keyword_If "${index}" != "${rejoin_member_index}" Run_Bash_Command_On_Member command=${command} member_index=${rejoin_member_index}
407 ${command} = BuiltIn.Set_Variable sudo /sbin/iptables -L -n
408 ${output} = Run_Bash_Command_On_Member command=${command} member_index=${rejoin_member_index}
409 BuiltIn.Log ${output}
411 Flush_Iptables_From_List_Or_All
412 [Arguments] ${member_index_list}=${EMPTY}
413 [Documentation] If the list is empty, flush IPTables in all ODL instances. Otherwise, flush member based on present indices.
414 ${command} = BuiltIn.Set_Variable sudo iptables -v -F
415 ${output} = Run_Bash_Command_On_List_Or_All command=${command} member_index_list=${member_index_list}
417 Run_Bash_Command_On_List_Or_All
418 [Arguments] ${command} ${member_index_list}=${EMPTY}
419 [Documentation] Cycle through indices (or all), run command on each.
420 ${index_list} = ClusterManagement__Given_Or_Internal_Index_List given_list=${member_index_list}
421 : FOR ${index} IN @{index_list}
422 \ Run_Bash_Command_On_Member command=${command} member_index=${index}
424 Run_Bash_Command_On_Member
425 [Arguments] ${command} ${member_index}
426 [Documentation] Obtain IP, call Utils and return output. This does not preserve active ssh session.
427 # TODO: Rename these keyword to Run_Bash_Command_On_Member to distinguish from Karaf (or even Windows) commands.
428 ${member_ip} = Collections.Get_From_Dictionary dictionary=${ClusterManagement__index_to_ip_mapping} key=${member_index}
429 ${output} = SSHKeywords.Run_Keyword_Preserve_Connection Utils.Run_Command_On_Controller ${member_ip} ${command}
432 Run_Karaf_Command_On_List_Or_All
433 [Arguments] ${command} ${member_index_list}=${EMPTY} ${timeout}=10s
434 [Documentation] Cycle through indices (or all), run karaf command on each.
435 ${index_list} = ClusterManagement__Given_Or_Internal_Index_List given_list=${member_index_list}
436 : FOR ${index} IN @{index_list}
437 \ ${member_ip} = Collections.Get_From_Dictionary dictionary=${ClusterManagement__index_to_ip_mapping} key=${index}
438 \ KarafKeywords.Safe_Issue_Command_On_Karaf_Console ${command} ${member_ip} timeout=${timeout}
440 Run_Karaf_Command_On_Member
441 [Arguments] ${command} ${member_index} ${timeout}=10s
442 [Documentation] Obtain IP address, call KarafKeywords and return output. This does not preserve active ssh session.
443 ... This keyword is not used by Run_Karaf_Command_On_List_Or_All, but returned output may be useful.
444 ${member_ip} = Collections.Get_From_Dictionary dictionary=${ClusterManagement__index_to_ip_mapping} key=${member_index}
445 ${output} = KarafKeywords.Safe_Issue_Command_On_Karaf_Console ${command} controller=${member_ip} timeout=${timeout}
448 Install_Feature_On_List_Or_All
449 [Arguments] ${feature_name} ${member_index_list}=${EMPTY} ${timeout}=60s
450 [Documentation] Attempt installation on each member from list (or all). Then look for failures.
451 ${index_list} = ClusterManagement__Given_Or_Internal_Index_List given_list=${member_index_list}
452 ${status_list} = BuiltIn.Create_List
453 : FOR ${index} IN @{index_list}
454 \ ${status} ${text} = BuiltIn.Run_Keyword_And_Ignore_Error Install_Feature_On_Member feature_name=${feature_name} member_index=${index}
455 \ ... timeout=${timeout}
456 \ BuiltIn.Log ${text}
457 \ Collections.Append_To_List ${status_list} ${status}
458 : FOR ${status} IN @{status_list}
459 \ BuiltIn.Run_Keyword_If "${status}" != "PASS" BuiltIn.Fail ${feature_name} installation failed, see log.
461 Install_Feature_On_Member
462 [Arguments] ${feature_name} ${member_index} ${timeout}=60s
463 [Documentation] Run feature:install karaf command, fail if installation was not successful. Return output.
464 ${status} ${output} = BuiltIn.Run_Keyword_And_Ignore_Error Run_Karaf_Command_On_Member command=feature:install ${feature_name} member_index=${member_index} timeout=${timeout}
465 BuiltIn.Run_Keyword_If "${status}" != "PASS" BuiltIn.Fail Failed to install ${feature_name}: ${output}
466 BuiltIn.Should_Not_Contain ${output} Can't install Failed to install ${feature_name}: ${output}
469 With_Ssh_To_List_Or_All_Run_Keyword
470 [Arguments] ${member_index_list} ${keyword_name} @{args} &{kwargs}
471 [Documentation] For each index in given list (or all): activate SSH connection, run given Keyword, close active connection. Return None.
472 ... Note that if the Keyword affects SSH connections, results are still deterministic, but perhaps undesirable.
473 ... Beware that in order to avoid "got positional argument after named arguments", first two arguments in the call should not be named.
474 BuiltIn.Comment This keyword is experimental and there is high risk of being replaced by another approach.
475 # TODO: For_Index_From_List_Or_All_Run_Keyword applied to With_Ssh_To_Member_Run_Keyword?
476 ${index_list} = ClusterManagement__Given_Or_Internal_Index_List given_list=${member_index_list}
477 : FOR ${member_index} IN @{index_list}
478 \ ${member_ip} = Resolve_IP_Address_For_Member ${member_index}
479 \ SSHKeywords.Open_Connection_To_Odl_System ip_address=${member_ip}
480 \ BuiltIn.Run_Keyword ${keyword_name} @{args} &{kwargs}
481 \ SSHLibrary.Close_Connection
483 Safe_With_Ssh_To_List_Or_All_Run_Keyword
484 [Arguments] ${member_index_list} ${keyword_name} @{args} &{kwargs}
485 [Documentation] Remember active ssh connection index, call With_Ssh_To_List_Or_All_Run_Keyword, return None. Restore the conection index on teardown.
486 SSHKeywords.Run_Keyword_Preserve_Connection With_Ssh_To_List_Or_All_Run_Keyword ${member_index_list} ${keyword_name} @{args} &{kwargs}
488 Clean_Directories_On_List_Or_All
489 [Arguments] ${member_index_list}=${EMPTY} ${directory_list}=${EMPTY} ${karaf_home}=${KARAF_HOME}
490 [Documentation] Clear @{directory_list} or @{ODL_DEFAULT_DATA_PATHS} for members in given list or all. Return None.
491 ... This is intended to return Karaf (offline) to the state it was upon the first boot.
492 ${path_list} = Builtin.Set Variable If "${directory_list}" == "${EMPTY}" ${ODL_DEFAULT_DATA_PATHS} ${directory_list}
493 Safe_With_Ssh_To_List_Or_All_Run_Keyword ${member_index_list} ClusterManagement__Clean_Directories ${path_list} ${karaf_home}
495 Store_Karaf_Log_On_List_Or_All
496 [Arguments] ${member_index_list}=${EMPTY} ${dst_dir}=/tmp ${karaf_home}=${KARAF_HOME}
497 [Documentation] Saves karaf.log to the ${dst_dir} for members in given list or all. Return None.
498 Safe_With_Ssh_To_List_Or_All_Run_Keyword ${member_index_list} SSHKeywords.Execute_Command_Should_Pass cp ${karaf_home}/data/log/karaf.log ${dst_dir}
500 Restore_Karaf_Log_On_List_Or_All
501 [Arguments] ${member_index_list}=${EMPTY} ${src_dir}=/tmp ${karaf_home}=${KARAF_HOME}
502 [Documentation] Places stored karaf.log to the ${karaf_home}/data/log for members in given list or all. Return None.
503 Safe_With_Ssh_To_List_Or_All_Run_Keyword ${member_index_list} SSHKeywords.Execute_Command_Should_Pass cp ${src_dir}/karaf.log ${karaf_home}/data/log/
505 ClusterManagement__Clean_Directories
506 [Arguments] ${relative_path_list} ${karaf_home}
507 [Documentation] For each relative path, remove files with respect to ${karaf_home}. Return None.
508 : FOR ${relative_path} IN @{relative_path_list}
509 \ SSHLibrary.Execute_Command rm -rf ${karaf_home}${/}${relative_path}
511 Put_As_Json_And_Check_Member_List_Or_All
512 [Arguments] ${uri} ${data} ${member_index} ${member_index_list}=${EMPTY}
513 [Documentation] Send a PUT with the supplied uri ${uri} and body ${data} to member ${member_index}.
514 ... Then check data is replicated in all or some members defined in ${member_index_list}.
515 ${response_text} = Put_As_Json_To_Member uri=${uri} data=${data} member_index=${member_index}
516 Wait Until Keyword Succeeds 5s 1s Check_Json_Member_List_Or_All uri=${uri} expected_data=${data} member_index_list=${member_index_list}
517 [Return] ${response_text}
519 Put_As_Json_To_Member
520 [Arguments] ${uri} ${data} ${member_index}
521 [Documentation] Send a PUT with the supplied uri and data to member ${member_index}.
522 ${session} = Resolve_Http_Session_For_Member member_index=${member_index}
523 ${response_text} = TemplatedRequests.Put_As_Json_To_Uri uri=${uri} data=${data} session=${session}
524 [Return] ${response_text}
526 Post_As_Json_To_Member
527 [Arguments] ${uri} ${data} ${member_index}
528 [Documentation] Send a POST with the supplied uri and data to member ${member_index}.
529 ${session} = Resolve_Http_Session_For_Member member_index=${member_index}
530 ${response_text} = TemplatedRequests.Post_As_Json_To_Uri uri=${uri} data=${data} session=${session}
531 [Return] ${response_text}
533 Delete_And_Check_Member_List_Or_All
534 [Arguments] ${uri} ${member_index} ${member_index_list}=${EMPTY}
535 [Documentation] Send a DELETE with the supplied uri to the member ${member_index}.
536 ... Then check the data is removed from all members in ${member_index_list}.
537 ${response_text} = Delete_From_Member ${uri} ${member_index}
538 BuiltIn.Wait_Until_Keyword_Succeeds 5s 1s Check_No_Content_Member_List_Or_All uri=${uri} member_index_list=${member_index_list}
539 [Return] ${response_text}
542 [Arguments] ${uri} ${member_index}
543 [Documentation] Send a DELETE with the supplied uri to member ${member_index}.
544 ${session} = Resolve_Http_Session_For_Member member_index=${member_index}
545 ${response_text} = TemplatedRequests.Delete_From_Uri uri=${uri} session=${session}
546 [Return] ${response_text}
548 Check_Json_Member_List_Or_All
549 [Arguments] ${uri} ${expected_data} ${member_index_list}=${EMPTY}
550 [Documentation] Send a GET with the supplied uri to all or some members defined in ${member_index_list}.
551 ... Then check received data is = ${expected data}.
552 ${index_list} = ClusterManagement__Given_Or_Internal_Index_List given_list=${member_index_list}
553 : FOR ${index} IN @{index_list}
554 \ ${data} = Get_From_Member uri=${uri} member_index=${index}
555 \ TemplatedRequests.Normalize_Jsons_And_Compare ${expected_data} ${data}
557 Check_Item_Occurrence_Member_List_Or_All
558 [Arguments] ${uri} ${dictionary} ${member_index_list}=${EMPTY}
559 [Documentation] Send a GET with the supplied uri to all or some members defined in ${member_index_list}.
560 ... Then check received for occurrences of items expressed in a dictionary ${dictionary}.
561 ${index_list} = ClusterManagement__Given_Or_Internal_Index_List given_list=${member_index_list}
562 : FOR ${index} IN @{index_list}
563 \ ${data} = Get_From_Member uri=${uri} member_index=${index}
564 \ Utils.Check Item Occurrence ${data} ${dictionary}
566 Check_No_Content_Member_List_Or_All
567 [Arguments] ${uri} ${member_index_list}=${EMPTY}
568 [Documentation] Send a GET with the supplied uri to all or some members defined in ${member_index_list}.
569 ... Then check there is no content.
570 ${index_list} = ClusterManagement__Given_Or_Internal_Index_List given_list=${member_index_list}
571 : FOR ${index} IN @{index_list}
572 \ ${session} = Resolve_Http_Session_For_Member member_index=${index}
573 \ Utils.No_Content_From_URI ${session} ${uri}
576 [Arguments] ${uri} ${member_index} ${access}=${ACCEPT_EMPTY}
577 [Documentation] Send a GET with the supplied uri to member ${member_index}.
578 ${session} = Resolve_Http_Session_For_Member member_index=${member_index}
579 ${response_text} = TemplatedRequests.Get_From_Uri uri=${uri} accept=${access} session=${session}
580 [Return] ${response_text}
582 Resolve_IP_Address_For_Member
583 [Arguments] ${member_index}
584 [Documentation] Return node IP address of given index.
585 ${ip_address} = Collections.Get From Dictionary dictionary=${ClusterManagement__index_to_ip_mapping} key=${member_index}
586 [Return] ${ip_address}
588 Resolve_Http_Session_For_Member
589 [Arguments] ${member_index}
590 [Documentation] Return RequestsLibrary session alias pointing to node of given index.
591 ${session} = BuiltIn.Set_Variable ClusterManagement__session_${member_index}
594 Resolve_Shard_Type_Class
595 [Arguments] ${shard_type}
596 [Documentation] Simple lookup for class name corresponding to desired type.
597 BuiltIn.Run_Keyword_If '${shard_type}' == 'config' BuiltIn.Return_From_Keyword DistributedConfigDatastore
598 ... ELSE IF '${shard_type}' == 'operational' BuiltIn.Return_From_Keyword DistributedOperationalDatastore
599 BuiltIn.Fail Unrecognized shard type: ${shard_type}
601 ClusterManagement__Build_List
602 [Arguments] ${member}
603 ${member_int} = BuiltIn.Convert_To_Integer ${member}
604 ${index_list} = BuiltIn.Create_List ${member_int}
605 [Return] ${index_list}
607 ClusterManagement__Parse_Sync_Status
608 [Arguments] ${shard_manager_text}
609 [Documentation] Return sync status parsed out of given text. Called twice by Get_Sync_Status_Of_Member.
610 BuiltIn.Log ${shard_manager_text}
611 ${manager_object} = RequestsLibrary.To_Json ${shard_manager_text}
612 ${value_object} = Collections.Get_From_Dictionary dictionary=${manager_object} key=value
613 ${sync_status} = Collections.Get_From_Dictionary dictionary=${value_object} key=SyncStatus
614 [Return] ${sync_status}
616 List_Indices_Minus_Member
617 [Arguments] ${member_index} ${member_index_list}=${EMPTY}
618 [Documentation] Create a new list which contains indices from ${member_index_list} (or all) without ${member_index}.
619 ${index_list} = ClusterManagement__Given_Or_Empty_List ${member_index_list}
620 Collections.Remove Values From List ${index_list} ${member_index}
621 [Return] ${index_list}
623 ClusterManagement__Given_Or_Internal_Index_List
624 [Arguments] ${given_list}=${EMPTY}
625 [Documentation] Utility to allow \${EMPTY} as default argument value, as the internal list is computed at runtime.
626 ... This keyword always return a (shallow) copy of given or default list,
627 ... so operations with the returned list should not affect other lists.
628 ... Also note that this keyword does not consider empty list to be \${EMPTY}.
629 ... TODO: This keyword is frequently used for obtaining copy of ${ClusterManagement__member_index_list}. Give this keyword public name.
630 ${return_list_reference} = BuiltIn.Set_Variable_If """${given_list}""" != "" ${given_list} ${ClusterManagement__member_index_list}
631 ${return_list_copy} = BuiltIn.Create_List @{return_list_reference}
632 [Return] ${return_list_copy}
634 ClusterManagement__Given_Or_Empty_List
635 [Arguments] ${given_list}=${EMPTY}
636 [Documentation] Utility to allow \${EMPTY} as default argument value, as an empty list is computed at runtime.
637 ${empty_list} = BuiltIn.Create_List
638 ${given_length} = BuiltIn.Get_Length ${given_list}
639 ${return_list} = BuiltIn.Set_Variable_If ${given_length} > 0 ${given_list} ${empty_list}
640 [Return] ${return_list}
642 ClusterManagement__Compute_Derived_Variables
643 [Arguments] ${int_of_members}
644 [Documentation] Construct index list, session list and IP mapping, publish them as suite variables.
645 @{member_index_list} = BuiltIn.Create_List
646 @{session_list} = BuiltIn.Create_List
647 &{index_to_ip_mapping} = BuiltIn.Create_Dictionary
648 : FOR ${index} IN RANGE 1 ${int_of_members+1}
649 \ ClusterManagement__Include_Member_Index ${index} ${member_index_list} ${session_list} ${index_to_ip_mapping}
650 BuiltIn.Set_Suite_Variable \${ClusterManagement__member_index_list} ${member_index_list}
651 BuiltIn.Set_Suite_Variable \${ClusterManagement__index_to_ip_mapping} ${index_to_ip_mapping}
652 BuiltIn.Set_Suite_Variable \${ClusterManagement__session_list} ${session_list}
654 ClusterManagement__Include_Member_Index
655 [Arguments] ${index} ${member_index_list} ${session_list} ${index_to_ip_mapping}
656 [Documentation] Add a corresponding item based on index into the last three arguments.
657 ... Create the Http session whose alias is added to list.
658 Collections.Append_To_List ${member_index_list} ${index}
659 ${member_ip} = BuiltIn.Set_Variable ${ODL_SYSTEM_${index}_IP}
660 # ${index} is int (not string) so "key=value" syntax does not work in the following line.
661 Collections.Set_To_Dictionary ${index_to_ip_mapping} ${index} ${member_ip}
662 # Http session, with ${AUTH}, without headers.
663 ${session_alias} = Resolve_Http_Session_For_Member member_index=${index}
664 RequestsLibrary.Create_Session ${session_alias} http://${member_ip}:${RESTCONFPORT} auth=${AUTH} max_retries=0
665 Collections.Append_To_List ${session_list} ${session_alias}
667 Sync_Status_Should_Be_False
668 [Arguments] ${controller_index}
669 [Documentation] Verify that cluster node is not in sync with others
670 ${status} Get_Sync_Status_Of_Member ${controller_index}
671 BuiltIn.Should_Not_Be_True ${status}
673 Sync_Status_Should_Be_True
674 [Arguments] ${controller_index}
675 [Documentation] Verify that cluster node is in sync with others
676 ${status} Get_Sync_Status_Of_Member ${controller_index}
677 BuiltIn.Should_Be_True ${status}