Resource ${CURDIR}/SSHKeywords.robot
Resource ${CURDIR}/TemplatedRequests.robot # for Get_As_Json_From_Uri
Resource ${CURDIR}/Utils.robot # for Run_Command_On_Controller
+Resource ../variables/Variables.robot
*** Variables ***
${ENTITY_OWNER_URI} restconf/operational/entity-owners:entity-owners
*** Keywords ***
ClusterManagement_Setup
- [Arguments] ${http_timeout}=1 ${http_retries}=0
+ [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.
# Avoid multiple initialization by several downstream libraries.
\ 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}
Get_Leader_And_Followers_For_Shard
- [Arguments] ${shard_name}=default ${shard_type}=operational ${validate}=True ${member_index_list}=${EMPTY} ${verify_restconf}=True ${http_timeout}=5
+ [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.
${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}
[Return] ${leader} ${follower_list}
Get_State_Info_For_Shard
- [Arguments] ${shard_name}=default ${shard_type}=operational ${validate}=False ${member_index_list}=${EMPTY} ${verify_restconf}=False ${http_timeout}=5
+ [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).
[Return] ${leader_list} ${follower_list}
Get_Raft_State_Of_Shard_At_Member
- [Arguments] ${shard_name} ${shard_type} ${member_index} ${verify_restconf}=False ${http_timeout}=5
+ [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.
${raft_state} = Get_Raft_Property_From_Shard_Member RaftState ${shard_name} ${shard_type} ${member_index} verify_restconf=${verify_restconf}
[Return] ${raft_state}
Get_Raft_Property_From_Shard_Member
- [Arguments] ${property} ${shard_name} ${shard_type} ${member_index} ${verify_restconf}=False ${http_timeout}=5
+ [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.
${session} = Resolve_Http_Session_For_Member member_index=${member_index}
[Return] ${owner_1} ${candidate_list_1}
Get_Owner_And_Candidates_For_Device_Singleton_Bgpcep
- [Arguments] ${device_name} ${member_index} ${http_timeout}=2
+ [Arguments] ${device_name} ${member_index} ${http_timeout}=${EMPTY}
[Documentation] Returns the owner and a list of candidates for the SB device ${device_name}. Request is sent to member ${member_index}.
# Get election entity type results
${type} = BuiltIn.Set_Variable ${SINGLETON_ELECTION_ENTITY_TYPE}
${freeze_index_list} = List_Indices_Or_All given_list=${member_index_list}
Run_Bash_Command_On_List_Or_All command=${command} member_index_list=${member_index_list}
-Clean_Journals_And_Snapshots_On_List_Or_All
+Clean_Journals_Data_And_Snapshots_On_List_Or_All
[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
${index_list} = List_Indices_Or_All given_list=${member_index_list}
- ${command} = Set Variable rm -rf "${karaf_home}/journal" "${karaf_home}/snapshots"
+ ${command} = Set Variable rm -rf "${karaf_home}/journal" "${karaf_home}/snapshots" "${karaf_home}/data"
: FOR ${index} IN @{index_list} # usually: 1, 2, 3.
\ Run_Bash_Command_On_Member command=${command} member_index=${index}
[Return] ${count}
Isolate_Member_From_List_Or_All
- [Arguments] ${isolate_member_index} ${member_index_list}=${EMPTY}
+ [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}
${index_list} = List_Indices_Or_All given_list=${member_index_list}
${source} = Collections.Get_From_Dictionary ${ClusterManagement__index_to_ip_mapping} ${isolate_member_index}
+ ${dport} = BuiltIn.Set_Variable_If '${port}' != '${EMPTY}' --dport ${port} ${EMPTY}
: FOR ${index} IN @{index_list}
\ ${destination} = Collections.Get_From_Dictionary ${ClusterManagement__index_to_ip_mapping} ${index}
- \ ${command} = BuiltIn.Set_Variable sudo /sbin/iptables -I OUTPUT -p all --source ${source} --destination ${destination} -j DROP
+ \ ${command} = BuiltIn.Set_Variable sudo /sbin/iptables -I OUTPUT -p ${protocol} ${dport} --source ${source} --destination ${destination} -j DROP
\ BuiltIn.Run_Keyword_If "${index}" != "${isolate_member_index}" Run_Bash_Command_On_Member command=${command} member_index=${isolate_member_index}
${command} = BuiltIn.Set_Variable sudo /sbin/iptables -L -n
${output} = Run_Bash_Command_On_Member command=${command} member_index=${isolate_member_index}
[Return] ${updated_index_list}
Rejoin_Member_From_List_Or_All
- [Arguments] ${rejoin_member_index} ${member_index_list}=${EMPTY}
+ [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.
${index_list} = List_Indices_Or_All given_list=${member_index_list}
${source} = Collections.Get_From_Dictionary ${ClusterManagement__index_to_ip_mapping} ${rejoin_member_index}
+ ${dport} = BuiltIn.Set_Variable_If '${port}' != '${EMPTY}' --dport ${port} ${EMPTY}
: FOR ${index} IN @{index_list}
\ ${destination} = Collections.Get_From_Dictionary ${ClusterManagement__index_to_ip_mapping} ${index}
- \ ${command} = BuiltIn.Set_Variable sudo /sbin/iptables -D OUTPUT -p all --source ${source} --destination ${destination} -j DROP
+ \ ${command} = BuiltIn.Set_Variable sudo /sbin/iptables -D OUTPUT -p ${protocol} ${dport} --source ${source} --destination ${destination} -j DROP
\ BuiltIn.Run_Keyword_If "${index}" != "${rejoin_member_index}" Run_Bash_Command_On_Member command=${command} member_index=${rejoin_member_index}
${command} = BuiltIn.Set_Variable sudo /sbin/iptables -L -n
${output} = Run_Bash_Command_On_Member command=${command} member_index=${rejoin_member_index}
BuiltIn.Log ${output}
+ BuiltIn.Wait_Until_Keyword_Succeeds ${timeout} 10s Check_Cluster_Is_In_Sync
Flush_Iptables_From_List_Or_All
[Arguments] ${member_index_list}=${EMPTY}
[Return] ${index_list}
ClusterManagement__Compute_Derived_Variables
- [Arguments] ${int_of_members} ${http_timeout}=1 ${http_retries}=0
+ [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.
@{member_index_list} = BuiltIn.Create_List
@{session_list} = BuiltIn.Create_List
BuiltIn.Set_Suite_Variable \${ClusterManagement__session_list} ${session_list}
ClusterManagement__Include_Member_Index
- [Arguments] ${index} ${member_index_list} ${session_list} ${index_to_ip_mapping} ${http_timeout}=1 ${http_retries}=0
+ [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.
Collections.Append_To_List ${member_index_list} ${index}