Library scope: | GLOBAL |
---|
Resource housing Keywords common to several suites for cluster functional testing.
Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved. Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html
This resource holds private state (in suite variables), which is generated once at Setup with ClusterManagement_Setup KW. The state includes member indexes, IP addresses and Http (RequestsLibrary) sessions. Cluster Keywords normally use member index, member list or nothing (all members) as argument.
All index lists returned should be sorted numerically, fix if not.
Requirements: odl-jolokia is assumed to be installed.
Keywords are ordered as follows:
TODO: Unify capitalization of Leaders and Followers.
Issues the karaf shell command showSvcStatus to verify the ready and service states are the same as the arguments passed
This keyword will verify whether all the services are operational in all the ODL nodes
Cycle through indices (or all), run bash command on each, using temporary SSH session and restoring the previously active one.
Open SSH session, call SSHKeywords.Execute_Command_Passes, close session, restore previously active session and return output.
Fail if no-sync is detected on a member from list (or any).
Send a GET with the supplied uri to all or some members defined in ${member_index_list}. Then check received for occurrences of items expressed in a dictionary ${dictionary}.
Send a GET with the supplied uri to all or some members defined in ${member_index_list}. Then check received data is = ${expected data}.
Verify new owner was elected comparing to ${old_owner}
Send a GET with the supplied uri to all or some members defined in ${member_index_list}. Then check there is no content.
Verify the owner remain the same as ${old_owner}
Obtain Ip address, open session, call SSHKeywords.Execute_Command_Passes, close session and return output. This affects which SSH session is active.
Clear @{directory_list} or @{ODL_DEFAULT_DATA_PATHS} for members in given list or all. Return None. If ${tmp_dir} is nonempty, use that location to preserve data/log/. This is intended to return Karaf (offline) to the state it was upon the first boot.
Delete journal and snapshots directories on every node listed (or all). BEWARE: If only a subset of members is cleaned, this causes RetiredGenerationException in Carbon after the affected node re-start. See https://bugs.opendaylight.org/show_bug.cgi?id=8138
For each relative path, remove files with respect to ${karaf_home}. Return None.
Construct index list, session list and IP mapping, publish them as suite variables.
Add a corresponding item based on index into the last three arguments. Create the Http session whose alias is added to list.
Return sync status parsed out of given text. Called twice by Get_Sync_Status_Of_Member.
Detect repeated call, or detect number of members and initialize derived suite variables. Http sessions are created with parameters to not waste time when ODL is no accepting connections properly.
Remotely execute grep for karaf process, return count as string.
Send a DELETE with the supplied uri to the member ${member_index}. Then check the data is removed from all members in ${member_index_list}.
Send a DELETE with the supplied uri to member ${member_index}.
Remove superfluous OpenFlow device data from Entity Owner printout.
Remove superfluous OVSDB device data from Entity Owner printout.
Remove superfluous device data from Entity Owner printout.
If the list is empty, flush IPTables in all ODL instances. Otherwise, flush member based on present indices.
If the list is empty, stops/runs all ODL instances. Otherwise stop/run members based on ${stop_index_list} For command parameter only ${NODE_FREEZE_COMMAND} and ${NODE_UNFREEZE_COMMAND} should be used
Convenience keyword that stops the specified member of the cluster by freezing the jvm.
Send a GET with the supplied uri to member ${member_index}.
Get role lists, validate there is one leader, return the leader and list of followers. Optionally, issue GET to a simple restconf URL to make sure subsequent operations will not encounter 503.
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}. If parsing as singleton failed, kw try to parse data in old way (without singleton). Candidates are all members that register to own a device, so the list of candiates includes the owner. The returned candidate list is sorted numerically. Note that "candidate list" definition currently differs between Beryllium and Boron. It is recommended to use Get_Owner_And_Successors_For_Device instead of this keyword, see documentation there.
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}. Candidates are all members that register to own a device, so the list of candiates includes the owner. The returned candidate list is sorted numerically. Note that "candidate list" definition currently differs between Beryllium and Boron. It is recommended to use Get_Owner_And_Successors_For_Device instead of this keyword, see documentation there.
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}.
Returns the owner and a list of candidates for entity specified by ${type} and ${id} Request is sent to member ${member_index}. Candidates are all members that register to own a device, so the list of candiates includes the owner. Bear in mind that for Boron and beyond, candidates are not removed on node down or isolation. If ${require_candidate_list} is not ${EMPTY}, check whether the actual list of candidates matches. Note that differs from "given list" semantics used in other keywords, namely you cannot use ${EMPTY} to stand for "full list" in this keyword.
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}. Successors are those device candidates not elected as owner. The list of successors = (list of candidates) - (owner). The returned successor list is sorted numerically. Note that "candidate list" definition currently differs between Beryllium and Boron. Use Verify_Owner_And_Successors_For_Device if you want the older semantics (inaccessible nodes not present in the list).
Send request to Jolokia on indexed member, return extracted Raft property. Optionally, check restconf works.
Send request to Jolokia on indexed member, return extracted Raft status. Optionally, check restconf works.
Get raft state of shard of all member nodes
Return lists of Leader and Follower member indices from a given member index list (or from the full list if empty). If ${shard_type} is not 'config', 'operational' is assumed. If ${validate}, Fail if raft state is not Leader or Follower (for example on Candidate). The biggest difference from Get_Leader_And_Followers_For_Shard is that no check on number of Leaders is performed.
Obtain IP, two GETs from jolokia URIs, return combined sync status as string.
Attempt installation on each member from list (or all). Then look for failures.
Run feature:install karaf command, fail if installation was not successful. Return output.
If the list is empty, isolate member from all ODL instances. Otherwise, isolate member based on present indices. The KW will return a list of available members: ${updated index_list}=${member_index_list}-${isolate_member_index}
If the list is empty, kill all ODL instances. Otherwise, kill members based on ${kill_index_list} If ${confirm} is True, sleep 1 second and verify killed instances are not there anymore. The KW will return a list of available members: ${updated index_list}=${original_index_list}-${member_index_list}
Convenience keyword that kills the specified member of the cluster. The KW will return a list of available members: ${updated index_list}=${original_index_list}-${member}
Create a new list of all indices.
Create a new list which contains indices from ${member_index_list} (or all) without ${member_index}.
Utility to allow ${EMPTY} as default argument value, as the internal list is computed at runtime. This keyword always returns a (shallow) copy of given or default list, so operations with the returned list should not affect other lists. Also note that this keyword does not consider empty list to be ${EMPTY}.
Send a POST with the supplied uri and data to member ${member_index}.
Send a PUT with the supplied uri ${uri} and body ${data} to member ${member_index}. Then check data is replicated in all or some members defined in ${member_index_list}.
Send a PUT with the supplied uri and data to member ${member_index}.
If the list is empty, rejoin member from all ODL instances. Otherwise, rejoin member based on present indices.
Return RequestsLibrary session alias pointing to node of given index.
Return node IP address of given index.
Return a list of IP address of given indexes.
Simple lookup for class name corresponding to desired type.
Places stored karaf.log to the ${karaf_home}/data/log for members in given list or all. Return None.
Return the IP address of the member given the member_index.
Cycle through indices (or all), run command on each.
Obtain IP, call Utils and return output. This keeps previous ssh session active.
Cycle through indices (or all), run karaf command on each.
Obtain IP address, call KarafKeywords and return output. This does not preserve active ssh session. This keyword is not used by Run_Karaf_Command_On_List_Or_All, but returned output may be useful.
Remember active ssh connection index, call With_Ssh_To_List_Or_All_Run_Keyword, return None. Restore the conection index on teardown.
If the list is empty, start all cluster members. Otherwise, start members based on present indices. If ${wait_for_sync}, wait for cluster sync on listed members. Optionally karaf_home can be overriden. Optionally specific JAVA_HOME is used for starting. Garbage collection is unconditionally logged to files. TODO: Make that reasonable conditional?
Convenience keyword that starts the specified member of the cluster.
If the list is empty, stops all ODL instances. Otherwise stop members based on ${stop_index_list} If ${confirm} is True, verify stopped instances are not there anymore. The KW will return a list of available members: ${updated index_list}=${original_index_list}-${member_index_list}
Convenience keyword that stops the specified member of the cluster. The KW will return a list of available members: ${updated index_list}=${original_index_list}-${member}
Saves karaf.log to the ${dst_dir} for members in given list or all. Return None.
Verify that cluster node is not in sync with others
Verify that cluster node is in sync with others
Convenience keyword that "continues" the specified member of the cluster by unfreezing the jvm.
Fail if non-zero karaf instances are counted on member of given index.
For each shard name, call Get_Leader_And_Followers_For_Shard. Not much logic there, but single Keyword is useful when using BuiltIn.Wait_Until_Keyword_Succeeds.
Verifies the specified readiness conditions for the given listed members after startup. If ${verify_cluster_sync}, verifies the datastores have synced with the rest of the cluster. If ${verify_restconf}, verifies RESTCONF is available. If ${verify_system_status}, verifies the system services are OPERATIONAL.
Returns the owner and successors for the SB device ${device_name} of type ${device_type}. Request is sent to member ${member_index}. For Boron and beyond, candidates are not removed on node down or isolation, so this keyword expects candidates to be all members from Boron on. Extra check is done to verify owner and successors are within the ${candidate_list}. This KW is useful when combined with WUKS. ${candidate_list} minus owner is returned as ${successor list}. Users can still use Get_Owner_And_Successors_For_Device if they are interested in downed candidates, or for testing heterogeneous clusters.
Verify new leader was elected or remained the same. Bool paramter ${new_elected} indicates if new leader is elected or should remained the same as ${old_leader}
Fail if number of karaf instances on member of given index is not one.
For each index in given list (or all): activate SSH connection, run given Keyword, close active connection. Return None. Beware that in order to avoid "got positional argument after named arguments", first two arguments in the call should not be named.