X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=csit%2Flibraries%2FClusterManagement.robot;h=bac88b7dcf2c5c52b3e04b1e9245071e47fb6987;hb=d52fbd78f0ebe9674aa5506faf8f272f76031c71;hp=0d8a67bf35c126d2b0075169c7cbd4a81933796f;hpb=14d57f76229c0eb951f6c68fbeeee4ed69776058;p=integration%2Ftest.git diff --git a/csit/libraries/ClusterManagement.robot b/csit/libraries/ClusterManagement.robot index 0d8a67bf35..bac88b7dcf 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 @@ -43,8 +44,9 @@ ${GC_LOG_PATH} ${KARAF_HOME}/data/log ${JAVA_HOME} ${EMPTY} # releng/builder scripts should provide correct value ${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_CONFIG_LOCAL_SHARDS_URI} jolokia/read/org.opendaylight.controller:type=DistributedConfigDatastore,Category=ShardManager,name=shard-manager-config/LocalShards +${JOLOKIA_OPER_LOCAL_SHARDS_URI} jolokia/read/org.opendaylight.controller:type=DistributedOperationalDatastore,Category=ShardManager,name=shard-manager-operational/LocalShards ${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 @@ -52,8 +54,11 @@ ${SINGLETON_NETCONF_DEVICE_ID_PREFIX} /odl-general-entity:entity[odl-general- ${SINGLETON_NETCONF_DEVICE_ID_SUFFIX} ]]]]}'] ${SINGLETON_BGPCEP_DEVICE_ID_PREFIX} /odl-general-entity:entity[odl-general-entity:name=' ${SINGLETON_BGPCEP_DEVICE_ID_SUFFIX} -service-group'] +${SINGLETON_SXP_DEVICE_ID_PREFIX} /odl-general-entity:entity[odl-general-entity:name=' +${SINGLETON_SXP_DEVICE_ID_SUFFIX} '] ${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 @@ -151,7 +156,8 @@ Get_Raft_Property_From_Shard_Member # 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 @@ -276,6 +282,21 @@ Get_Owner_And_Candidates_For_Device_Singleton_Bgpcep BuiltIn.Should_Be_Equal_As_Integers ${owner_1} ${owner_2} Owners for device ${device_name} are not same [Return] ${owner_1} ${candidate_list_1} +Get_Owner_And_Candidates_For_Device_Singleton_Sxp + [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} + ${id} = BuiltIn.Set_Variable ${SINGLETON_SXP_DEVICE_ID_PREFIX}${device_name}${SINGLETON_SXP_DEVICE_ID_SUFFIX} + ${owner_1} ${candidate_list_1} = Get_Owner_And_Candidates_For_Type_And_Id ${type} ${id} ${member_index} http_timeout=${http_timeout} + # Get change ownership entity type results + ${type} = BuiltIn.Set_Variable ${SINGLETON_CHANGE_OWNERSHIP_ENTITY_TYPE} + ${id} = BuiltIn.Set_Variable ${SINGLETON_SXP_DEVICE_ID_PREFIX}${device_name}${SINGLETON_SXP_DEVICE_ID_SUFFIX} + ${owner_2} ${candidate_list_2} = Get_Owner_And_Candidates_For_Type_And_Id ${type} ${id} ${member_index} http_timeout=${http_timeout} + # Owners must be same, if not, there is still some election or change ownership in progress + BuiltIn.Should_Be_Equal_As_Integers ${owner_1} ${owner_2} Owners for device ${device_name} are not same + [Return] ${owner_1} ${candidate_list_1} + Get_Owner_And_Candidates_For_Device [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}. @@ -422,13 +443,14 @@ Stop_Members_From_List_Or_All [Return] ${updated_index_list} Start_Single_Member - [Arguments] ${member} ${wait_for_sync}=True ${timeout}=300s + [Arguments] ${member} ${wait_for_sync}=True ${timeout}=300s ${check_system_status}=False ${service_list}=@{EMPTY} [Documentation] Convenience keyword that starts the specified member of the cluster. ${index_list} = ClusterManagement__Build_List ${member} - Start_Members_From_List_Or_All ${index_list} ${wait_for_sync} ${timeout} + Start_Members_From_List_Or_All ${index_list} ${wait_for_sync} ${timeout} check_system_status=${check_system_status} service_list=@{service_list} Start_Members_From_List_Or_All [Arguments] ${member_index_list}=${EMPTY} ${wait_for_sync}=True ${timeout}=300s ${karaf_home}=${EMPTY} ${export_java_home}=${EMPTY} ${gc_log_dir}=${EMPTY} + ... ${check_system_status}=False ${service_list}=@{EMPTY} [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. @@ -441,7 +463,8 @@ Start_Members_From_List_Or_All Run_Bash_Command_On_List_Or_All command=${command} ${gc_options} member_index_list=${member_index_list} BuiltIn.Return_From_Keyword_If not ${wait_for_sync} BuiltIn.Wait_Until_Keyword_Succeeds ${timeout} 10s Check_Cluster_Is_In_Sync member_index_list=${member_index_list} - # TODO: Do we also want to check Shard Leaders here? + BuiltIn.Return_From_Keyword_If not ${check_system_status} + CompareStream.Run_Keyword_If_At_Least_Oxygen Wait Until Keyword Succeeds 60 2 ClusterManagement.Check Status Of Services Is OPERATIONAL @{service_list} [Teardown] Run_Bash_Command_On_List_Or_All command=netstat -pnatu | grep 2550 Freeze_Single_Member @@ -829,3 +852,18 @@ Return_Member_IP ${member_int} = BuiltIn.Convert_To_Integer ${member_index} ${member_ip} = Collections.Get_From_Dictionary dictionary=${ClusterManagement__index_to_ip_mapping} key=${member_int} [Return] ${member_ip} + +Check Service Status + [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 + ${service_status_output} = BuiltIn.Run Keyword If ${NUM_ODL_SYSTEM} > 1 KarafKeywords.Issue_Command_On_Karaf_Console showSvcStatus -n ${odl_ip} ${odl_ip} ${KARAF_SHELL_PORT} + ... ELSE KarafKeywords.Issue_Command_On_Karaf_Console showSvcStatus ${odl_ip} ${KARAF_SHELL_PORT} + BuiltIn.Should Contain ${service_status_output} ${system_ready_state} + : FOR ${service} IN @{service_list} + \ BuiltIn.Should Match Regexp ${service_status_output} ${service} +: ${service_state} + +Check Status Of Services Is OPERATIONAL + [Arguments] @{service_list} + [Documentation] This keyword will verify whether all the services are operational in all the ODL nodes + : FOR ${i} IN RANGE ${NUM_ODL_SYSTEM} + \ ClusterManagement.Check Service Status ${ODL_SYSTEM_${i+1}_IP} ACTIVE OPERATIONAL @{service_list}