X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=csit%2Flibraries%2FClusterManagement.robot;h=1edbc8f1fdf3dab0df68a5b7d3c682ff762fbcc1;hb=ffcf2d80b43d78104f6350821d5a81838a8aa815;hp=079f0fe7a5e6c377b128002280cac6ece1e7fd5f;hpb=93609e00c80447b4b812be0a94084e5368a204ab;p=integration%2Ftest.git diff --git a/csit/libraries/ClusterManagement.robot b/csit/libraries/ClusterManagement.robot index 079f0fe7a5..1edbc8f1fd 100644 --- a/csit/libraries/ClusterManagement.robot +++ b/csit/libraries/ClusterManagement.robot @@ -36,6 +36,7 @@ Resource ${CURDIR}/KarafKeywords.robot 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 @@ -44,7 +45,6 @@ ${JAVA_HOME} ${EMPTY} # releng/builder scripts should provide correct va ${JOLOKIA_CONF_SHARD_MANAGER_URI} jolokia/read/org.opendaylight.controller:Category=ShardManager,name=shard-manager-config,type=DistributedConfigDatastore ${JOLOKIA_OPER_SHARD_MANAGER_URI} jolokia/read/org.opendaylight.controller:Category=ShardManager,name=shard-manager-operational,type=DistributedOperationalDatastore ${JOLOKIA_READ_URI} jolokia/read/org.opendaylight.controller -${KARAF_HOME} ${WORKSPACE}${/}${BUNDLEFOLDER} # TODO: Migrate to Variables.robot # Bug 9044 workaround: delete etc/host.key before restart. @{ODL_DEFAULT_DATA_PATHS} tmp/ data/ cache/ snapshots/ journal/ etc/opendaylight/current/ etc/host.key ${RESTCONF_MODULES_DIR} ${CURDIR}/../variables/restconf/modules @@ -54,6 +54,7 @@ ${SINGLETON_BGPCEP_DEVICE_ID_PREFIX} /odl-general-entity:entity[odl-general-e ${SINGLETON_BGPCEP_DEVICE_ID_SUFFIX} -service-group'] ${SINGLETON_ELECTION_ENTITY_TYPE} org.opendaylight.mdsal.ServiceEntityType ${SINGLETON_CHANGE_OWNERSHIP_ENTITY_TYPE} org.opendaylight.mdsal.AsyncServiceCloseEntityType +${NODE_ROLE_INDEX_START} 1 ${NODE_START_COMMAND} ${KARAF_HOME}/bin/start ${NODE_STOP_COMMAND} ${KARAF_HOME}/bin/stop ${NODE_KARAF_COUNT_COMMAND} ps axf | grep org.apache.karaf | grep -v grep | wc -l @@ -63,7 +64,7 @@ ${NODE_UNFREEZE_COMMAND} ps axf | grep org.apache.karaf | grep -v grep | awk *** Keywords *** ClusterManagement_Setup - [Arguments] ${http_timeout}=5 ${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. @@ -103,7 +104,7 @@ Verify_Leader_Exists_For_Each_Shard \ 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} @@ -115,7 +116,7 @@ Get_Leader_And_Followers_For_Shard [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). @@ -136,7 +137,7 @@ Get_State_Info_For_Shard [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} @@ -144,14 +145,15 @@ Get_Raft_State_Of_Shard_At_Member [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} # TODO: Does the used URI tend to generate large data which floods log.html? BuiltIn.Run_Keyword_If ${verify_restconf} TemplatedRequests.Get_As_Json_Templated session=${session} folder=${RESTCONF_MODULES_DIR} verify=False http_timeout=${http_timeout} ${type_class} = Resolve_Shard_Type_Class shard_type=${shard_type} - ${uri} = BuiltIn.Set_Variable ${JOLOKIA_READ_URI}:Category=Shards,name=member-${member_index}-shard-${shard_name}-${shard_type},type=${type_class} + ${cluster_index} = Evaluate ${member_index}+${NODE_ROLE_INDEX_START}-1 + ${uri} = BuiltIn.Set_Variable ${JOLOKIA_READ_URI}:Category=Shards,name=member-${cluster_index}-shard-${shard_name}-${shard_type},type=${type_class} ${data_text} = TemplatedRequests.Get_As_Json_From_Uri uri=${uri} session=${session} http_timeout=${http_timeout} ${data_object} = RequestsLibrary.To_Json ${data_text} ${value} = Collections.Get_From_Dictionary ${data_object} value @@ -262,7 +264,7 @@ Get_Owner_And_Candidates_For_Device_Singleton_Netconf [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} @@ -464,13 +466,13 @@ Freeze_Or_Unfreeze_Members_From_List_Or_All ${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} @@ -512,7 +514,7 @@ Isolate_Member_From_List_Or_All [Return] ${updated_index_list} Rejoin_Member_From_List_Or_All - [Arguments] ${rejoin_member_index} ${member_index_list}=${EMPTY} ${protocol}=all ${port}=${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} @@ -524,6 +526,7 @@ Rejoin_Member_From_List_Or_All ${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} @@ -785,7 +788,7 @@ List_Indices_Minus_Member [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 @@ -798,7 +801,7 @@ ClusterManagement__Compute_Derived_Variables 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}