Keywords (79)

Introduction

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:

  • Cluster Setup
  • Shard state, leader and followers
  • Entity Owner, candidates and successors
  • Kill, Stop and Start Member
  • Isolate and Rejoin Member
  • Run Commands On Member
  • REST requests and checks on Members

TODO: Unify capitalization of Leaders and Followers.

Keywords

Arguments

odl_ip system_ready_state service_state * service_list

Documentation

Issues the karaf shell command showSvcStatus to verify the ready and service states are the same as the arguments passed

Arguments

* service_list

Documentation

This keyword will verify whether all the services are operational in all the ODL nodes

Arguments

command member_index_list
= ${EMPTY}
return_success_only
= False
log_on_success
= True
log_on_failure
= True
stderr_must_be_empty
= True

Documentation

Cycle through indices (or all), run bash command on each, using temporary SSH session and restoring the previously active one.

Arguments

command member_index return_success_only
= False
log_on_success
= True
log_on_failure
= True
stderr_must_be_empty
= True

Documentation

Open SSH session, call SSHKeywords.Execute_Command_Passes, close session, restore previously active session and return output.

Arguments

member_index_list
= ${EMPTY}

Documentation

Fail if no-sync is detected on a member from list (or any).

Arguments

uri dictionary member_index_list
= ${EMPTY}

Documentation

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}.

Arguments

uri expected_data member_index_list
= ${EMPTY}

Documentation

Send a GET with the supplied uri to all or some members defined in ${member_index_list}. Then check received data is = ${expected data}.

Arguments

device_name device_type old_owner node_to_ask http_timeout
= ${EMPTY}

Documentation

Verify new owner was elected comparing to ${old_owner}

Arguments

uri member_index_list
= ${EMPTY}

Documentation

Send a GET with the supplied uri to all or some members defined in ${member_index_list}. Then check there is no content.

Arguments

device_name device_type old_owner node_to_ask http_timeout
= ${EMPTY}

Documentation

Verify the owner remain the same as ${old_owner}

Arguments

command member_index return_success_only
= False
log_on_success
= True
log_on_failure
= True
stderr_must_be_empty
= True

Documentation

Obtain Ip address, open session, call SSHKeywords.Execute_Command_Passes, close session and return output. This affects which SSH session is active.

Arguments

member_index_list
= ${EMPTY}
directory_list
= ${EMPTY}
karaf_home
= ${KARAF_HOME}
tmp_dir
= ${EMPTY}

Documentation

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.

Arguments

member_index_list
= ${EMPTY}
karaf_home
= ${KARAF_HOME}

Documentation

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

Arguments

relative_path_list karaf_home

Documentation

For each relative path, remove files with respect to ${karaf_home}. Return None.

Arguments

int_of_members http_timeout
= ${DEFAULT_TIMEOUT_HTTP}
http_retries
= 0

Documentation

Construct index list, session list and IP mapping, publish them as suite variables.

Arguments

index member_index_list session_list index_to_ip_mapping http_timeout
= ${DEFAULT_TIMEOUT_HTTP}
http_retries
= 0

Documentation

Add a corresponding item based on index into the last three arguments. Create the Http session whose alias is added to list.

Arguments

shard_manager_text

Documentation

Return sync status parsed out of given text. Called twice by Get_Sync_Status_Of_Member.

Arguments

http_timeout
= ${DEFAULT_TIMEOUT_HTTP}
http_retries
= 0

Documentation

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.

Arguments

member_index

Documentation

Remotely execute grep for karaf process, return count as string.

Arguments

uri member_index member_index_list
= ${EMPTY}

Documentation

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}.

Arguments

uri member_index

Documentation

Send a DELETE with the supplied uri to member ${member_index}.

Arguments

data

Documentation

Remove superfluous OpenFlow device data from Entity Owner printout.

Arguments

data

Documentation

Remove superfluous OVSDB device data from Entity Owner printout.

Arguments

data

Documentation

Remove superfluous device data from Entity Owner printout.

Arguments

member_index_list
= ${EMPTY}

Documentation

If the list is empty, flush IPTables in all ODL instances. Otherwise, flush member based on present indices.

Arguments

command member_index_list
= ${EMPTY}

Documentation

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

Arguments

member

Documentation

Convenience keyword that stops the specified member of the cluster by freezing the jvm.

Arguments

uri member_index access
= ${ACCEPT_EMPTY}

Documentation

Send a GET with the supplied uri to member ${member_index}.

Arguments

shard_name
= default
shard_type
= operational
validate
= True
member_index_list
= ${EMPTY}
verify_restconf
= True
http_timeout
= ${EMPTY}

Documentation

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.

Arguments

device_name device_type member_index http_timeout
= ${EMPTY}

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}. 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.

Arguments

device_name device_type member_index http_timeout
= ${EMPTY}

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}. 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.

Arguments

device_name device_type member_index http_timeout
= ${EMPTY}

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}.

Arguments

type id member_index require_candidate_list
= ${EMPTY}
http_timeout
= ${EMPTY}

Documentation

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.

Arguments

device_name device_type member_index http_timeout
= ${EMPTY}

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}. 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).

Arguments

property shard_name shard_type member_index verify_restconf
= False
http_timeout
= ${EMPTY}

Documentation

Send request to Jolokia on indexed member, return extracted Raft property. Optionally, check restconf works.

Arguments

shard_name shard_type member_index verify_restconf
= False
http_timeout
= ${EMPTY}

Documentation

Send request to Jolokia on indexed member, return extracted Raft status. Optionally, check restconf works.

Arguments

shard_name
= default
shard_type
= config
member_index_list
= ${EMPTY}

Documentation

Get raft state of shard of all member nodes

Arguments

shard_name
= default
shard_type
= operational
validate
= False
member_index_list
= ${EMPTY}
verify_restconf
= False
http_timeout
= ${EMPTY}

Documentation

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.

Arguments

member_index

Documentation

Obtain IP, two GETs from jolokia URIs, return combined sync status as string.

Arguments

feature_name member_index_list
= ${EMPTY}
timeout
= 60s

Documentation

Attempt installation on each member from list (or all). Then look for failures.

Arguments

feature_name member_index timeout
= 60s

Documentation

Run feature:install karaf command, fail if installation was not successful. Return output.

Arguments

isolate_member_index member_index_list
= ${EMPTY}
protocol
= all
port
= ${EMPTY}

Documentation

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}

Arguments

member_index_list
= ${EMPTY}
original_index_list
= ${EMPTY}
confirm
= True

Documentation

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}

Arguments

member original_index_list
= ${EMPTY}
confirm
= True

Documentation

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}

Documentation

Create a new list of all indices.

Arguments

member_index member_index_list
= ${EMPTY}

Documentation

Create a new list which contains indices from ${member_index_list} (or all) without ${member_index}.

Arguments

given_list
= ${EMPTY}

Documentation

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}.

Arguments

uri data member_index

Documentation

Send a POST with the supplied uri and data to member ${member_index}.

Arguments

uri data member_index member_index_list
= ${EMPTY}

Documentation

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}.

Arguments

uri data member_index

Documentation

Send a PUT with the supplied uri and data to member ${member_index}.

Arguments

rejoin_member_index member_index_list
= ${EMPTY}
protocol
= all
port
= ${EMPTY}
timeout
= 60s

Documentation

If the list is empty, rejoin member from all ODL instances. Otherwise, rejoin member based on present indices.

Arguments

member_index

Documentation

Return RequestsLibrary session alias pointing to node of given index.

Arguments

member_index

Documentation

Return node IP address of given index.

Arguments

member_index_list

Documentation

Return a list of IP address of given indexes.

Arguments

shard_type

Documentation

Simple lookup for class name corresponding to desired type.

Arguments

member_index_list
= ${EMPTY}
src_dir
= /tmp
karaf_home
= ${KARAF_HOME}

Documentation

Places stored karaf.log to the ${karaf_home}/data/log for members in given list or all. Return None.

Arguments

member_index

Documentation

Return the IP address of the member given the member_index.

Arguments

command member_index_list
= ${EMPTY}

Documentation

Cycle through indices (or all), run command on each.

Arguments

command member_index

Documentation

Obtain IP, call Utils and return output. This keeps previous ssh session active.

Arguments

command member_index_list
= ${EMPTY}
timeout
= 10s

Documentation

Cycle through indices (or all), run karaf command on each.

Arguments

command member_index timeout
= 10s

Documentation

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.

Arguments

member_index_list keyword_name * args ** kwargs

Documentation

Remember active ssh connection index, call With_Ssh_To_List_Or_All_Run_Keyword, return None. Restore the conection index on teardown.

Arguments

member_index_list
= ${EMPTY}
wait_for_sync
= True
timeout
= 360s
karaf_home
= ${EMPTY}
export_java_home
= ${EMPTY}
gc_log_dir
= ${EMPTY}
check_system_status
= False
verify_restconf
= True
service_list
= ${EMPTY_LIST}

Documentation

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?

Arguments

member wait_for_sync
= True
timeout
= 300s
msg
= ${EMPTY}
check_system_status
= False
verify_restconf
= True
service_list
= ${EMPTY_LIST}

Documentation

Convenience keyword that starts the specified member of the cluster.

Arguments

member_index_list
= ${EMPTY}
original_index_list
= ${EMPTY}
confirm
= True
timeout
= 360s

Documentation

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}

Arguments

member original_index_list
= ${EMPTY}
confirm
= True
msg
= ${EMPTY}

Documentation

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}

Arguments

member_index_list
= ${EMPTY}
dst_dir
= /tmp
karaf_home
= ${KARAF_HOME}

Documentation

Saves karaf.log to the ${dst_dir} for members in given list or all. Return None.

Arguments

controller_index

Documentation

Verify that cluster node is not in sync with others

Arguments

controller_index

Documentation

Verify that cluster node is in sync with others

Arguments

member wait_for_sync
= True
timeout
= 60s

Documentation

Convenience keyword that "continues" the specified member of the cluster by unfreezing the jvm.

Arguments

member_index

Documentation

Fail if non-zero karaf instances are counted on member of given index.

Arguments

shard_name_list shard_type
= operational
member_index_list
= ${EMPTY}
verify_restconf
= True

Documentation

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.

Arguments

member_index_list verify_cluster_sync verify_restconf verify_system_status service_list

Documentation

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.

Arguments

device_name device_type member_index candidate_list
= ${EMPTY}
after_stop
= False

Documentation

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.

Arguments

member_index_list

Arguments

shard_name shard_type new_elected old_leader member_index_list
= ${EMPTY}
verify_restconf
= True

Documentation

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}

Arguments

member_index

Documentation

Fail if number of karaf instances on member of given index is not one.

Arguments

member_index_list keyword_name * args ** kwargs

Documentation

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.

ClusterManagement

image/svg+xml