diff --git a/keywords/cloud_platform/dcmanager/objects/dcmanager_subcloud_list_output.py b/keywords/cloud_platform/dcmanager/objects/dcmanager_subcloud_list_output.py index 60062e56..47d23e62 100644 --- a/keywords/cloud_platform/dcmanager/objects/dcmanager_subcloud_list_output.py +++ b/keywords/cloud_platform/dcmanager/objects/dcmanager_subcloud_list_output.py @@ -302,3 +302,20 @@ class DcManagerSubcloudListOutput: get_logger().log_exception(error_message) raise ValueError(error_message) return max(subclouds_by_type, key=lambda subcloud: int(subcloud.get_id())) + + def get_subcloud_with_lowest_id(self) -> DcManagerSubcloudListObject: + """Gets an instance of DcManagerSubcloudListObject with the lowest ID regardless of its state. + + Returns: + DcManagerSubcloudListObject: the instance of DcManagerSubcloudListObject with the lowest ID. + + """ + subclouds = self.get_dcmanager_subcloud_list_objects_filtered(None) + + if not subclouds: + error_message = "In this DC system, there are no subclouds." + get_logger().log_exception(error_message) + raise ValueError(error_message) + + lowest_subcloud = min(subclouds, key=lambda subcloud: int(subcloud.get_id())) + return lowest_subcloud diff --git a/testcases/cloud_platform/regression/dc/phased_deployment/test_subcloud_phased_deployment.py b/testcases/cloud_platform/regression/dc/phased_deployment/test_subcloud_phased_deployment.py index ba97fe7d..f75c36ec 100644 --- a/testcases/cloud_platform/regression/dc/phased_deployment/test_subcloud_phased_deployment.py +++ b/testcases/cloud_platform/regression/dc/phased_deployment/test_subcloud_phased_deployment.py @@ -36,7 +36,7 @@ def get_undeployed_subcloud_name(ssh_connection: SSHConnection) -> str: get_logger().log_info("No Undeployed Subcloud found deleting existing one") # Gets the lowest subcloud (the subcloud with the lowest id). get_logger().log_info("Obtaining subcloud with the lowest ID.") - lowest_subcloud = dcm_sc_list_kw.get_dcmanager_subcloud_list().get_healthy_subcloud_with_lowest_id() + lowest_subcloud = dcm_sc_list_kw.get_dcmanager_subcloud_list().get_subcloud_with_lowest_id() get_logger().log_info(f"Subcloud with the lowest ID obtained: ID={lowest_subcloud.get_id()}, Name={lowest_subcloud.get_name()}, Management state={lowest_subcloud.get_management()}") subcloud_name = lowest_subcloud.get_name() dcm_sc_manager_kw = DcManagerSubcloudManagerKeywords(ssh_connection)