Adding modify timezone dc testcase
Adding new sanity test Change-Id: I14930f01a16ebc6b8de8db50e872d99abb52da5b
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
from keywords.base_keyword import BaseKeyword
|
||||
from keywords.cloud_platform.command_wrappers import source_openrc
|
||||
from keywords.cloud_platform.dcmanager.objects.dcmanager_subcloud_show_output import DcManagerSubcloudShowOutput
|
||||
|
||||
|
||||
class DcManagerSubcloudUpdateKeywords(BaseKeyword):
|
||||
"""
|
||||
This class contains all the keywords related to the 'dcmanager subcloud update' commands.
|
||||
"""
|
||||
|
||||
def __init__(self, ssh_connection):
|
||||
"""
|
||||
Constructor
|
||||
Args:
|
||||
ssh_connection:
|
||||
|
||||
"""
|
||||
self.ssh_connection = ssh_connection
|
||||
|
||||
def dcmanager_subcloud_update(self, subcloud_name: str, update_attr: str, update_value: str) -> DcManagerSubcloudShowOutput:
|
||||
"""
|
||||
Updates the subcloud attr using'dcmanager subcloud update <subcloud name> --<update_attr> <update_value>' output.
|
||||
Args: subcloud_name (str): a str representing a subcloud's name.
|
||||
update_attr (str): the attribute to update (ex. description)
|
||||
update_value (str): the value to update the attribute to (ex. this is a new description)
|
||||
|
||||
Returns: DcManagerSubcloudShowOutput
|
||||
|
||||
"""
|
||||
output = self.ssh_connection.send(source_openrc(f"dcmanager subcloud update {subcloud_name} --{update_attr} '{update_value}'"))
|
||||
self.validate_success_return_code(self.ssh_connection)
|
||||
dcmanager_subcloud_show_output = DcManagerSubcloudShowOutput(output)
|
||||
|
||||
return dcmanager_subcloud_show_output
|
||||
@@ -1,4 +1,5 @@
|
||||
from config.configuration_manager import ConfigurationManager
|
||||
from config.lab.objects.lab_config import LabConfig
|
||||
from config.lab.objects.node import Node
|
||||
from framework.exceptions.keyword_exception import KeywordException
|
||||
from framework.ssh.ssh_connection import SSHConnection
|
||||
@@ -118,4 +119,33 @@ class LabConnectionKeywords(BaseKeyword):
|
||||
jump_host=jump_host_config,
|
||||
)
|
||||
|
||||
return connection
|
||||
return connection
|
||||
|
||||
def get_subcloud_ssh(self, subcloud_name: str) -> SSHConnection:
|
||||
"""
|
||||
Gets an SSH connection to the 'Subcloud' node whose name is specified by the argument 'subcloud_name'.
|
||||
Args:
|
||||
subcloud_name (string): The name of the 'subcloud' node.
|
||||
|
||||
Returns: the SSH connection to the 'subcloud' node whose name is specified by the argument 'subcloud_name'.
|
||||
|
||||
"""
|
||||
lab_config = ConfigurationManager.get_lab_config()
|
||||
subcloud_config: LabConfig = lab_config.get_subcloud(subcloud_name)
|
||||
|
||||
if not subcloud_config:
|
||||
raise ValueError(f"There is no 'subcloud' node named {subcloud_name} defined in your config file.")
|
||||
|
||||
jump_host_config = None
|
||||
if lab_config.is_use_jump_server():
|
||||
jump_host_config = lab_config.get_jump_host_configuration()
|
||||
|
||||
connection = SSHConnectionManager.create_ssh_connection(
|
||||
subcloud_config.get_floating_ip(),
|
||||
lab_config.get_admin_credentials().get_user_name(),
|
||||
lab_config.get_admin_credentials().get_password(),
|
||||
ssh_port=lab_config.get_ssh_port(),
|
||||
jump_host=jump_host_config,
|
||||
)
|
||||
|
||||
return connection
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
from keywords.base_keyword import BaseKeyword
|
||||
from keywords.cloud_platform.command_wrappers import source_openrc
|
||||
from keywords.cloud_platform.fault_management.alarms.alarm_list_keywords import AlarmListKeywords
|
||||
from keywords.cloud_platform.fault_management.alarms.objects.alarm_list_object import AlarmListObject
|
||||
from keywords.cloud_platform.system.show.objects.system_show_output import SystemShowOutput
|
||||
|
||||
|
||||
class SystemModifyKeywords(BaseKeyword):
|
||||
|
||||
def __init__(self, ssh_connection):
|
||||
"""
|
||||
Constructor
|
||||
Args:
|
||||
ssh_connection:
|
||||
"""
|
||||
self.ssh_connection = ssh_connection
|
||||
|
||||
def system_modify_timezone(self, timezone: str) -> SystemShowOutput:
|
||||
"""
|
||||
Runs system command system modify --timezone
|
||||
"""
|
||||
output = self.ssh_connection.send(source_openrc(f'system modify --timezone="{timezone}"'))
|
||||
self.validate_success_return_code(self.ssh_connection)
|
||||
system_show_output = SystemShowOutput(output)
|
||||
|
||||
# config alarms will appear, wait for them to be gone
|
||||
alarm_list_object = AlarmListObject()
|
||||
alarm_list_object.set_alarm_id('250.001')
|
||||
AlarmListKeywords(self.ssh_connection).wait_for_alarms_cleared([alarm_list_object])
|
||||
|
||||
return system_show_output
|
||||
@@ -0,0 +1,268 @@
|
||||
class SystemShowObject:
|
||||
"""
|
||||
This class represents a System Show as an object.
|
||||
This is typically a line in the system show output vertical table.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self.contact = None
|
||||
self.created_at = None
|
||||
self.description = None
|
||||
self.distributed_cloud_role = None
|
||||
self.https_enabled: bool = True
|
||||
self.latitude = None
|
||||
self.location = None
|
||||
self.longitude = None
|
||||
self.name = None
|
||||
self.region_name = None
|
||||
self.sdn_enabled: bool = False
|
||||
self.security_feature = None
|
||||
self.service_project_name = None
|
||||
self.software_version = None
|
||||
self.system_mode = None
|
||||
self.system_type = None
|
||||
self.timezone = None
|
||||
self.updated_at = None
|
||||
self.uuid = None
|
||||
self.vswitch_type = None
|
||||
|
||||
def set_contact(self, contact: str):
|
||||
"""
|
||||
Setter for the contact
|
||||
"""
|
||||
self.contact = contact
|
||||
|
||||
def get_contact(self) -> str:
|
||||
"""
|
||||
Getter for this contact
|
||||
"""
|
||||
return self.contact
|
||||
|
||||
def set_created_at(self, created_at: str):
|
||||
"""
|
||||
Setter for the created_at
|
||||
"""
|
||||
self.created_at = created_at
|
||||
|
||||
def get_created_at(self) -> str:
|
||||
"""
|
||||
Getter for the created_at
|
||||
"""
|
||||
return self.created_at
|
||||
|
||||
def set_description(self, description: str):
|
||||
"""
|
||||
Setter for the description
|
||||
"""
|
||||
self.description = description
|
||||
|
||||
def get_description(self) -> str:
|
||||
"""
|
||||
Getter for the description.
|
||||
"""
|
||||
return self.description
|
||||
|
||||
def set_distributed_cloud_role(self, distributed_cloud_role: str):
|
||||
"""
|
||||
Setter for the distributed_cloud_role
|
||||
"""
|
||||
self.distributed_cloud_role = distributed_cloud_role
|
||||
|
||||
def get_distributed_cloud_role(self) -> str:
|
||||
"""
|
||||
Getter for the distributed_cloud_role
|
||||
"""
|
||||
return self.distributed_cloud_role
|
||||
|
||||
def set_https_enabled(self, https_enabled: bool):
|
||||
"""
|
||||
Setter for the https_enabled
|
||||
"""
|
||||
self.https_enabled = https_enabled
|
||||
|
||||
def get_https_enabled(self) -> bool:
|
||||
"""
|
||||
Getter for the https_enabled
|
||||
"""
|
||||
return self.https_enabled
|
||||
|
||||
def set_latitude(self, latitude: str):
|
||||
"""
|
||||
Setter for the latitude
|
||||
"""
|
||||
self.latitude = latitude
|
||||
|
||||
def get_latitude(self) -> str:
|
||||
"""
|
||||
Getter for the latitude
|
||||
"""
|
||||
return self.latitude
|
||||
|
||||
def set_location(self, location: str):
|
||||
"""
|
||||
Setter for the location.
|
||||
"""
|
||||
self.location = location
|
||||
|
||||
def get_location(self) -> str:
|
||||
"""
|
||||
Getter for the location.
|
||||
"""
|
||||
return self.location
|
||||
|
||||
def set_longitude(self, longitude: str):
|
||||
"""
|
||||
Setter for the longitude.
|
||||
"""
|
||||
self.longitude = longitude
|
||||
|
||||
def get_longitude(self) -> str:
|
||||
"""
|
||||
Getter for the longitude.
|
||||
"""
|
||||
return self.longitude
|
||||
|
||||
def set_name(self, name: str):
|
||||
"""
|
||||
Setter for the name.
|
||||
"""
|
||||
self.name = name
|
||||
|
||||
def get_name(self) -> str:
|
||||
"""
|
||||
Getter for the name.
|
||||
"""
|
||||
return self.name
|
||||
|
||||
def set_region_name(self, region_name: str):
|
||||
"""
|
||||
Setter for the region_name.
|
||||
"""
|
||||
self.region_name = region_name
|
||||
|
||||
def get_region_name(self) -> str:
|
||||
"""
|
||||
Getter for the region_name.
|
||||
"""
|
||||
return self.region_name
|
||||
|
||||
def set_sdn_enabled(self, sdn_enabled: bool):
|
||||
"""
|
||||
Setter for the sdn_enabled.
|
||||
"""
|
||||
self.sdn_enabled = sdn_enabled
|
||||
|
||||
def get_sdn_enabled(self) -> bool:
|
||||
"""
|
||||
Getter for the sdn_enabled.
|
||||
"""
|
||||
return self.sdn_enabled
|
||||
|
||||
def set_security_feature(self, security_feature: str):
|
||||
"""
|
||||
Setter for the security_feature.
|
||||
"""
|
||||
self.security_feature = security_feature
|
||||
|
||||
def get_security_feature(self) -> str:
|
||||
"""
|
||||
Getter for the security_feature.
|
||||
"""
|
||||
return self.security_feature
|
||||
|
||||
def set_service_project_name(self, service_project_name: str):
|
||||
"""
|
||||
Setter for the service_project_name.
|
||||
"""
|
||||
self.service_project_name = service_project_name
|
||||
|
||||
def get_service_project_name(self) -> str:
|
||||
"""
|
||||
Getter for the service_project_name.
|
||||
"""
|
||||
return self.service_project_name
|
||||
|
||||
def set_software_version(self, software_version: str):
|
||||
"""
|
||||
Setter for the software_version.
|
||||
"""
|
||||
self.software_version = software_version
|
||||
|
||||
def get_software_version(self) -> str:
|
||||
"""
|
||||
Getter for the software_version.
|
||||
"""
|
||||
return self.software_version
|
||||
|
||||
def set_system_mode(self, system_mode: str):
|
||||
"""
|
||||
Setter for the system_mode.
|
||||
"""
|
||||
self.system_mode = system_mode
|
||||
|
||||
def get_system_mode(self) -> str:
|
||||
"""
|
||||
Getter for the system_mode.
|
||||
"""
|
||||
return self.system_mode
|
||||
|
||||
def set_system_type(self, system_type: str):
|
||||
"""
|
||||
Setter for the system_type.
|
||||
"""
|
||||
self.system_type = system_type
|
||||
|
||||
def get_system_type(self) -> str:
|
||||
"""
|
||||
Getter for the system_type.
|
||||
"""
|
||||
return self.system_type
|
||||
|
||||
def set_timezone(self, timezone: str):
|
||||
"""
|
||||
Setter for the timezone.
|
||||
"""
|
||||
self.timezone = timezone
|
||||
|
||||
def get_timezone(self) -> str:
|
||||
"""
|
||||
Getter for the timezone.
|
||||
"""
|
||||
return self.timezone
|
||||
|
||||
def set_updated_at(self, updated_at: str):
|
||||
"""
|
||||
Setter for the updated_at.
|
||||
"""
|
||||
self.updated_at = updated_at
|
||||
|
||||
def get_updated_at(self) -> str:
|
||||
"""
|
||||
Getter for the updated_at.
|
||||
"""
|
||||
return self.updated_at
|
||||
|
||||
def set_uuid(self, uuid: str):
|
||||
"""
|
||||
Setter for the uuid.
|
||||
"""
|
||||
self.uuid = uuid
|
||||
|
||||
def get_uuid(self) -> str:
|
||||
"""
|
||||
Getter for the uuid.
|
||||
"""
|
||||
return self.uuid
|
||||
|
||||
def set_vswitch_type(self, vswitch_type: str):
|
||||
"""
|
||||
Setter for the vswitch_type.
|
||||
"""
|
||||
self.vswitch_type = vswitch_type
|
||||
|
||||
def get_vswitch_type(self) -> str:
|
||||
"""
|
||||
Getter for the vswitch_type.
|
||||
"""
|
||||
return self.vswitch_type
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
from keywords.cloud_platform.system.show.objects.system_show_object import SystemShowObject
|
||||
from keywords.cloud_platform.system.system_vertical_table_parser import SystemVerticalTableParser
|
||||
|
||||
|
||||
class SystemShowOutput:
|
||||
"""
|
||||
This class parses the output of 'system show' command into an object of type SystemShowObject.
|
||||
"""
|
||||
|
||||
def __init__(self, system_show_output):
|
||||
"""
|
||||
Constructor
|
||||
|
||||
Args:
|
||||
system_show_output: output of 'system show' command as a list of strings.
|
||||
"""
|
||||
|
||||
system_vertical_table_parser = SystemVerticalTableParser(system_show_output)
|
||||
output_values = system_vertical_table_parser.get_output_values_dict()
|
||||
|
||||
self.system_host_show_object = SystemShowObject()
|
||||
|
||||
if 'contact' in output_values:
|
||||
self.system_host_show_object.set_contact(output_values['contact'])
|
||||
|
||||
if 'created_at' in output_values:
|
||||
self.system_host_show_object.set_created_at(output_values['created_at'])
|
||||
|
||||
if 'description' in output_values:
|
||||
self.system_host_show_object.set_description(output_values['description'])
|
||||
|
||||
if 'distributed_cloud_role' in output_values:
|
||||
self.system_host_show_object.set_description(output_values['distributed_cloud_role'])
|
||||
|
||||
if 'https_enabled' in output_values:
|
||||
self.system_host_show_object.set_https_enabled(output_values['https_enabled'])
|
||||
|
||||
if 'latitude' in output_values:
|
||||
self.system_host_show_object.set_latitude(output_values['latitude'])
|
||||
|
||||
if 'location' in output_values:
|
||||
self.system_host_show_object.set_location(output_values['location'])
|
||||
|
||||
if 'longitude' in output_values:
|
||||
self.system_host_show_object.set_longitude(output_values['longitude'])
|
||||
|
||||
if 'name' in output_values:
|
||||
self.system_host_show_object.set_name(output_values['name'])
|
||||
|
||||
if 'region_name' in output_values:
|
||||
self.system_host_show_object.set_region_name(output_values['region_name'])
|
||||
|
||||
if 'sdn_enabled' in output_values:
|
||||
self.system_host_show_object.set_sdn_enabled(output_values['sdn_enabled'])
|
||||
|
||||
if 'security_feature' in output_values:
|
||||
self.system_host_show_object.set_security_feature(output_values['security_feature'])
|
||||
|
||||
if 'service_project_name' in output_values:
|
||||
self.system_host_show_object.set_service_project_name(output_values['service_project_name'])
|
||||
|
||||
if 'software_version' in output_values:
|
||||
self.system_host_show_object.set_software_version(output_values['software_version'])
|
||||
|
||||
if 'system_mode' in output_values:
|
||||
self.system_host_show_object.set_system_mode(output_values['system_mode'])
|
||||
|
||||
if 'system_type' in output_values:
|
||||
self.system_host_show_object.set_system_type(output_values['system_type'])
|
||||
|
||||
if 'timezone' in output_values:
|
||||
self.system_host_show_object.set_timezone(output_values['timezone'])
|
||||
|
||||
if 'updated_at' in output_values:
|
||||
self.system_host_show_object.set_updated_at(output_values['updated_at'])
|
||||
|
||||
if 'uuid' in output_values:
|
||||
self.system_host_show_object.set_uuid(output_values['uuid'])
|
||||
|
||||
if 'vswitch_type' in output_values:
|
||||
self.system_host_show_object.set_vswitch_type(output_values['vswitch_type'])
|
||||
|
||||
def get_system_show_object(self) -> SystemShowObject:
|
||||
"""
|
||||
Get system show object
|
||||
|
||||
Returns: system show object
|
||||
|
||||
"""
|
||||
return self.system_host_show_object
|
||||
28
keywords/cloud_platform/system/show/system_show_keywords.py
Normal file
28
keywords/cloud_platform/system/show/system_show_keywords.py
Normal file
@@ -0,0 +1,28 @@
|
||||
from framework.ssh.ssh_connection import SSHConnection
|
||||
from keywords.base_keyword import BaseKeyword
|
||||
from keywords.cloud_platform.command_wrappers import source_openrc
|
||||
from keywords.cloud_platform.system.show.objects.system_show_output import SystemShowOutput
|
||||
|
||||
|
||||
class SystemShowKeywords(BaseKeyword):
|
||||
"""
|
||||
System Show Keywords class
|
||||
"""
|
||||
|
||||
def __init__(self, ssh_connection: SSHConnection):
|
||||
"""
|
||||
Constructor
|
||||
Args:
|
||||
ssh_connection:
|
||||
"""
|
||||
self.ssh_connection = ssh_connection
|
||||
|
||||
def system_show(self) -> SystemShowOutput:
|
||||
"""
|
||||
Gets the output from the command system show
|
||||
"""
|
||||
output = self.ssh_connection.send(source_openrc(f'system show'))
|
||||
self.validate_success_return_code(self.ssh_connection)
|
||||
system_show_output = SystemShowOutput(output)
|
||||
|
||||
return system_show_output
|
||||
21
keywords/linux/date/date_keywords.py
Normal file
21
keywords/linux/date/date_keywords.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from framework.ssh.ssh_connection import SSHConnection
|
||||
from keywords.base_keyword import BaseKeyword
|
||||
|
||||
|
||||
class DateKeywords(BaseKeyword):
|
||||
"""
|
||||
Date Keywords class
|
||||
"""
|
||||
|
||||
def __init__(self, ssh_connection: SSHConnection):
|
||||
self.ssh_connection = ssh_connection
|
||||
|
||||
def get_timezone(self):
|
||||
"""
|
||||
Returns the timezone using a linux system command
|
||||
"""
|
||||
date = self.ssh_connection.send('date +%Z')
|
||||
self.validate_success_return_code(self.ssh_connection)
|
||||
|
||||
# can only be one line in the response + remove any trailing \n
|
||||
return date[0].strip()
|
||||
@@ -9,12 +9,16 @@ from framework.ssh.secure_transfer_file.secure_transfer_file import SecureTransf
|
||||
from framework.ssh.secure_transfer_file.secure_transfer_file_enum import TransferDirection
|
||||
from framework.ssh.secure_transfer_file.secure_transfer_file_input_object import SecureTransferFileInputObject
|
||||
from framework.ssh.ssh_connection import SSHConnection
|
||||
from framework.validation.validation import validate_equals
|
||||
from framework.web.webdriver_core import WebDriverCore
|
||||
from keywords.cloud_platform.dcmanager.dcmanager_alarm_summary_keywords import DcManagerAlarmSummaryKeywords
|
||||
from keywords.cloud_platform.dcmanager.dcmanager_subcloud_list_keywords import DcManagerSubcloudListKeywords
|
||||
from keywords.cloud_platform.dcmanager.dcmanager_subcloud_manager_keywords import DcManagerSubcloudManagerKeywords
|
||||
from keywords.cloud_platform.dcmanager.dcmanager_subcloud_show_keywords import DcManagerSubcloudShowKeywords
|
||||
from keywords.cloud_platform.dcmanager.dcmanager_subcloud_update_keywords import DcManagerSubcloudUpdateKeywords
|
||||
from keywords.cloud_platform.dcmanager.objects.dcmanager_subcloud_list_object_filter import DcManagerSubcloudListObjectFilter
|
||||
from keywords.cloud_platform.fault_management.alarms.alarm_list_keywords import AlarmListKeywords
|
||||
from keywords.cloud_platform.fault_management.alarms.objects.alarm_list_object import AlarmListObject
|
||||
from keywords.cloud_platform.fault_management.fm_client_cli.fm_client_cli_keywords import FaultManagementClientCLIKeywords
|
||||
from keywords.cloud_platform.fault_management.fm_client_cli.object.fm_client_cli_object import FaultManagementClientCLIObject
|
||||
from keywords.cloud_platform.ssh.lab_connection_keywords import LabConnectionKeywords
|
||||
@@ -31,6 +35,8 @@ from keywords.cloud_platform.system.host.system_host_list_keywords import System
|
||||
from keywords.cloud_platform.system.host.system_host_lock_keywords import SystemHostLockKeywords
|
||||
from keywords.cloud_platform.system.host.system_host_reboot_keywords import SystemHostRebootKeywords
|
||||
from keywords.cloud_platform.system.host.system_host_swact_keywords import SystemHostSwactKeywords
|
||||
from keywords.cloud_platform.system.modify.system_modify_keywords import SystemModifyKeywords
|
||||
from keywords.cloud_platform.system.show.system_show_keywords import SystemShowKeywords
|
||||
from keywords.cloud_platform.system.storage.system_storage_backend_keywords import SystemStorageBackendKeywords
|
||||
from keywords.files.file_keywords import FileKeywords
|
||||
from keywords.k8s.deployments.kubectl_delete_deployments_keywords import KubectlDeleteDeploymentsKeywords
|
||||
@@ -38,6 +44,8 @@ from keywords.k8s.pods.kubectl_create_pods_keywords import KubectlCreatePodsKeyw
|
||||
from keywords.k8s.pods.kubectl_delete_pods_keywords import KubectlDeletePodsKeywords
|
||||
from keywords.k8s.pods.kubectl_get_pods_keywords import KubectlGetPodsKeywords
|
||||
from pytest import mark
|
||||
|
||||
from keywords.linux.date.date_keywords import DateKeywords
|
||||
from web_pages.horizon.admin.platform.horizon_host_inventory_page import HorizonHostInventoryPage
|
||||
from web_pages.horizon.login.horizon_login_page import HorizonLoginPage
|
||||
|
||||
@@ -280,23 +288,23 @@ def test_horizon_host_inventory_display_active_controller(request):
|
||||
# Compare the values in the active controller in the Host Inventory table with the output of system host-list.
|
||||
horizon_host_information = host_inventory.get_controller_host_information(active_host_name)
|
||||
assert (
|
||||
active_controller_output.get_host_name().lower() == horizon_host_information.get_host_name().lower()
|
||||
active_controller_output.get_host_name().lower() == horizon_host_information.get_host_name().lower()
|
||||
), f"Host Name mismatch. Expecting: {active_controller_output.get_host_name().lower()}, Observed: {horizon_host_information.get_host_name().lower()}"
|
||||
assert "Controller-Active" == horizon_host_information.get_personality(), f"Expecting Personality: Controller-Active, Observed: {horizon_host_information.get_personality()}"
|
||||
assert (
|
||||
active_controller_output.get_administrative().lower() == horizon_host_information.get_admin_state().lower()
|
||||
active_controller_output.get_administrative().lower() == horizon_host_information.get_admin_state().lower()
|
||||
), f"Admin State mismatch. Expecting: {active_controller_output.get_administrative().lower()}, Observed: {horizon_host_information.get_admin_state().lower()}"
|
||||
assert (
|
||||
active_controller_output.get_operational().lower() == horizon_host_information.get_operational_state().lower()
|
||||
active_controller_output.get_operational().lower() == horizon_host_information.get_operational_state().lower()
|
||||
), f"Operational State mismatch. Expecting: {active_controller_output.get_operational().lower()}, Observed: {horizon_host_information.get_operational_state().lower()}"
|
||||
assert (
|
||||
active_controller_output.get_availability().lower() == horizon_host_information.get_availability_state().lower()
|
||||
active_controller_output.get_availability().lower() == horizon_host_information.get_availability_state().lower()
|
||||
), f"Availability State mismatch. Expecting: {active_controller_output.get_availability().lower()}, Observed: {horizon_host_information.get_availability_state().lower()}"
|
||||
assert (
|
||||
'minute' in horizon_host_information.get_uptime()
|
||||
or 'hour' in horizon_host_information.get_uptime()
|
||||
or 'day' in horizon_host_information.get_uptime()
|
||||
or 'week' in horizon_host_information.get_uptime()
|
||||
'minute' in horizon_host_information.get_uptime()
|
||||
or 'hour' in horizon_host_information.get_uptime()
|
||||
or 'day' in horizon_host_information.get_uptime()
|
||||
or 'week' in horizon_host_information.get_uptime()
|
||||
), f"Uptime doesn't follow the expected format '* weeks, * days, * hours, * minutes'. Observed: {horizon_host_information.get_uptime()}"
|
||||
assert horizon_host_information.get_status() is None, "Status Column should be empty."
|
||||
assert horizon_host_information.get_actions() == "Edit Host", f"Actions button should have a label of 'Edit Host' - Observed: {horizon_host_information.get_actions()}"
|
||||
@@ -550,7 +558,7 @@ def test_dc_install_custom_app():
|
||||
assert system_application_object is not None, f"Expecting 'system_application_object' as not None, Observed: {system_application_object}."
|
||||
assert system_application_object.get_name() == app_name, f"Expecting 'app_name' = {app_name}, Observed: {system_application_object.get_name()}."
|
||||
assert (
|
||||
system_application_object.get_status() == SystemApplicationStatusEnum.UPLOADED.value
|
||||
system_application_object.get_status() == SystemApplicationStatusEnum.UPLOADED.value
|
||||
), f"Expecting 'system_application_object.get_status()' = {SystemApplicationStatusEnum.UPLOADED.value}, Observed: {system_application_object.get_status()}."
|
||||
|
||||
# Step 3: Apply the custom app on the active controller
|
||||
@@ -563,7 +571,7 @@ def test_dc_install_custom_app():
|
||||
assert system_application_object is not None, f"Expecting 'system_application_object' as not None, Observed: {system_application_object}."
|
||||
assert system_application_object.get_name() == app_name, f"Expecting 'app_name' = {app_name}, Observed: {system_application_object.get_name()}."
|
||||
assert (
|
||||
system_application_object.get_status() == SystemApplicationStatusEnum.APPLIED.value
|
||||
system_application_object.get_status() == SystemApplicationStatusEnum.APPLIED.value
|
||||
), f"Expecting 'system_application_object.get_status()' = {SystemApplicationStatusEnum.APPLIED.value}, Observed: {system_application_object.get_status()}."
|
||||
|
||||
# Step 4: Clean the active controller
|
||||
@@ -574,7 +582,7 @@ def test_dc_install_custom_app():
|
||||
system_application_remove_input.set_force_removal(True)
|
||||
system_application_output = SystemApplicationRemoveKeywords(ssh_connection).system_application_remove(system_application_remove_input)
|
||||
assert (
|
||||
system_application_output.get_system_application_object().get_status() == SystemApplicationStatusEnum.UPLOADED.value
|
||||
system_application_output.get_system_application_object().get_status() == SystemApplicationStatusEnum.UPLOADED.value
|
||||
), f"Expecting 'system_application_output.get_system_application_object().get_status()' = {SystemApplicationStatusEnum.UPLOADED.value}, Observed: {system_application_output.get_system_application_object().get_status()}."
|
||||
|
||||
# Deletes the application
|
||||
@@ -597,7 +605,6 @@ def test_dc_install_custom_app():
|
||||
|
||||
# Tests each filtered subcloud.
|
||||
for subcloud_list_object in dcmanager_subcloud_list_objects_filtered:
|
||||
|
||||
# Step 5: Transfers the app file to the current subcloud.
|
||||
|
||||
# Opens an SSH connection to the current subcloud.
|
||||
@@ -628,7 +635,7 @@ def test_dc_install_custom_app():
|
||||
assert system_application_object is not None, f"Expecting 'system_application_object' as not None, Observed: {system_application_object}"
|
||||
assert system_application_object.get_name() == app_name, f"Expecting 'app_name' = {app_name}, Observed: {system_application_object.get_name()}"
|
||||
assert (
|
||||
system_application_object.get_status() == SystemApplicationStatusEnum.UPLOADED.value
|
||||
system_application_object.get_status() == SystemApplicationStatusEnum.UPLOADED.value
|
||||
), f"Expecting 'system_application_object.get_status()' = {SystemApplicationStatusEnum.UPLOADED.value}, Observed: {system_application_object.get_status()}"
|
||||
|
||||
# Step 7: Apply the custom app on the current subcloud.
|
||||
@@ -641,7 +648,7 @@ def test_dc_install_custom_app():
|
||||
assert system_application_object is not None, f"Expecting 'system_application_object' as not None, Observed: {system_application_object}."
|
||||
assert system_application_object.get_name() == app_name, f"Expecting app_name = {app_name}, Observed: {system_application_object.get_name()}."
|
||||
assert (
|
||||
system_application_object.get_status() == SystemApplicationStatusEnum.APPLIED.value
|
||||
system_application_object.get_status() == SystemApplicationStatusEnum.APPLIED.value
|
||||
), f"Expecting 'system_application_object.get_status()' = {SystemApplicationStatusEnum.APPLIED.value}, Observed: {system_application_object.get_status()}."
|
||||
|
||||
# Step 8: Clean the current subcloud.
|
||||
@@ -652,7 +659,7 @@ def test_dc_install_custom_app():
|
||||
system_application_remove_input.set_force_removal(True)
|
||||
system_application_output = SystemApplicationRemoveKeywords(ssh_subcloud_connection).system_application_remove(system_application_remove_input)
|
||||
assert (
|
||||
system_application_output.get_system_application_object().get_status() == SystemApplicationStatusEnum.UPLOADED.value
|
||||
system_application_output.get_system_application_object().get_status() == SystemApplicationStatusEnum.UPLOADED.value
|
||||
), f"Expecting 'system_application_output.get_system_application_object().get_status()' = {SystemApplicationStatusEnum.UPLOADED.value}, Observed: {system_application_output.get_system_application_object().get_status()}."
|
||||
|
||||
# Deletes the application
|
||||
@@ -761,10 +768,10 @@ def test_dc_swact_host(request):
|
||||
|
||||
# Asserts that the swact was done as expected.
|
||||
assert (
|
||||
active_controller.get_id() == standby_controller_after_swact.get_id()
|
||||
active_controller.get_id() == standby_controller_after_swact.get_id()
|
||||
), f"The ID of the standby controller ({standby_controller_after_swact.get_id()}) after the execution of the 'swact' operation is not the same as the ID of the active controller ({active_controller.get_id()}) before that execution, as expected. It seems the 'swact' operation did not execute successfully."
|
||||
assert (
|
||||
standby_controller.get_id() == active_controller_after_swact.get_id()
|
||||
standby_controller.get_id() == active_controller_after_swact.get_id()
|
||||
), f"The ID of the active controller ({active_controller_after_swact.get_id()}) after the execution of the 'swact' operation is not the same as the ID of the standby controller ({standby_controller.get_id()}) before that execution, as expected. It seems the 'swact' operation did not execute successfully."
|
||||
|
||||
# Registers the controllers configuration in the log file.
|
||||
@@ -805,7 +812,7 @@ def test_dc_swact_host(request):
|
||||
dcmanager_subcloud_list_filter.set_id(lowest_subcloud.get_id())
|
||||
lowest_subcloud_after_swact = dcmanager_subcloud_list_keywords.get_dcmanager_subcloud_list().get_dcmanager_subcloud_list_objects_filtered(dcmanager_subcloud_list_filter)[0]
|
||||
assert (
|
||||
lowest_subcloud_after_swact.get_management() == 'unmanaged'
|
||||
lowest_subcloud_after_swact.get_management() == 'unmanaged'
|
||||
), f"The management state of subcloud {lowest_subcloud} is not 'unmanaged', as expected. Current management state of subcloud {lowest_subcloud}: '{lowest_subcloud.get_management()}'."
|
||||
|
||||
# Registers the management state of lowest_subcloud in the log file.
|
||||
@@ -922,7 +929,8 @@ def test_dc_unmanage_manage_subclouds(request):
|
||||
dcmanager_subcloud_list = dcmanager_subcloud_list_keywords.get_dcmanager_subcloud_list()
|
||||
subcloud = dcmanager_subcloud_list.get_healthy_subcloud_with_lowest_id()
|
||||
subcloud_name = subcloud.get_name()
|
||||
get_logger().log_info(f"The subcloud with the lowest ID will be considered in this test case. There is no special reason for that. It could be any subcloud. Subcloud chosen: name = {subcloud.get_name()}, ID = {subcloud.get_id()}.")
|
||||
get_logger().log_info(
|
||||
f"The subcloud with the lowest ID will be considered in this test case. There is no special reason for that. It could be any subcloud. Subcloud chosen: name = {subcloud.get_name()}, ID = {subcloud.get_id()}.")
|
||||
|
||||
# Object responsible for set the subclouds to 'managed'/'unmanaged' management state.
|
||||
dcmanager_subcloud_manage_keywords = DcManagerSubcloudManagerKeywords(ssh_connection)
|
||||
@@ -936,7 +944,8 @@ def test_dc_unmanage_manage_subclouds(request):
|
||||
dcmanager_subcloud_manage_keywords.get_dcmanager_subcloud_manage(teardown_subcloud.get_name(), change_state_timeout)
|
||||
get_logger().log_info(f"Teardown: The original management state of the subcloud '{teardown_subcloud.get_name()}' was reestablished to '{teardown_subcloud.get_management()}'.")
|
||||
else:
|
||||
get_logger().log_info(f"Teardown: There's no need to reestablish the original management state of the subcloud '{teardown_subcloud.get_name()}', as it is already in the 'managed' state. Current management state: '{teardown_subcloud.get_management()}'")
|
||||
get_logger().log_info(
|
||||
f"Teardown: There's no need to reestablish the original management state of the subcloud '{teardown_subcloud.get_name()}', as it is already in the 'managed' state. Current management state: '{teardown_subcloud.get_management()}'")
|
||||
|
||||
request.addfinalizer(teardown)
|
||||
|
||||
@@ -1060,6 +1069,84 @@ def test_dc_central_compute_lock_unlock(request):
|
||||
get_logger().log_info(f"The 'Compute' node {compute_name} was successfully set to 'unlocked' state.")
|
||||
|
||||
|
||||
@mark.p0
|
||||
@mark.lab_has_subcloud
|
||||
def test_dc_subcloud_update_description(request):
|
||||
"""
|
||||
Verify subcloud update description
|
||||
|
||||
Test Steps:
|
||||
- log onto active controller
|
||||
- Get original description
|
||||
- Run dcmanager subcloud update <subcloud_name> --description <new_description>
|
||||
- validate that subcloud has new description
|
||||
- Reset description back to old description
|
||||
"""
|
||||
ssh_connection = LabConnectionKeywords().get_active_controller_ssh()
|
||||
|
||||
test_description = 'test description'
|
||||
|
||||
lab_config = ConfigurationManager.get_lab_config()
|
||||
subclouds = lab_config.get_subclouds()
|
||||
assert len(subclouds) != 0, 'Failed. No subclouds were found'
|
||||
|
||||
# Get the first subcloud from the list
|
||||
subcloud = subclouds[0]
|
||||
subcloud_name = subcloud.get_lab_name()
|
||||
|
||||
subcloud_show_object = DcManagerSubcloudShowKeywords(ssh_connection).get_dcmanager_subcloud_show(subcloud_name).get_dcmanager_subcloud_show_object()
|
||||
original_description = subcloud_show_object.get_description()
|
||||
|
||||
subcloud_update_output = DcManagerSubcloudUpdateKeywords(ssh_connection).dcmanager_subcloud_update(subcloud_name, 'description', test_description)
|
||||
new_description = subcloud_update_output.get_dcmanager_subcloud_show_object().get_description()
|
||||
|
||||
def teardown():
|
||||
DcManagerSubcloudUpdateKeywords(ssh_connection).dcmanager_subcloud_update(subcloud_name, 'description', original_description)
|
||||
|
||||
request.addfinalizer(teardown)
|
||||
|
||||
validate_equals(new_description, test_description, 'Validate that the description has been changed')
|
||||
|
||||
|
||||
@mark.p0
|
||||
@mark.lab_has_subcloud
|
||||
def test_dc_subcloud_update_location(request):
|
||||
"""
|
||||
Verify subcloud update location
|
||||
|
||||
Test Steps:
|
||||
- log onto active controller
|
||||
- Get original location
|
||||
- Run dcmanager subcloud update <subcloud_name> --location <new_description>
|
||||
- validate that subcloud has new location
|
||||
- Reset location back to old location
|
||||
"""
|
||||
ssh_connection = LabConnectionKeywords().get_active_controller_ssh()
|
||||
|
||||
test_location = 'test location'
|
||||
|
||||
lab_config = ConfigurationManager.get_lab_config()
|
||||
subclouds = lab_config.get_subclouds()
|
||||
assert len(subclouds) != 0, 'Failed. No subclouds were found'
|
||||
|
||||
# Get the first subcloud from the list
|
||||
subcloud = subclouds[0]
|
||||
subcloud_name = subcloud.get_lab_name()
|
||||
|
||||
subcloud_show_object = DcManagerSubcloudShowKeywords(ssh_connection).get_dcmanager_subcloud_show(subcloud_name).get_dcmanager_subcloud_show_object()
|
||||
original_location = subcloud_show_object.get_location()
|
||||
|
||||
subcloud_update_output = DcManagerSubcloudUpdateKeywords(ssh_connection).dcmanager_subcloud_update(subcloud_name, 'location', test_location)
|
||||
new_location = subcloud_update_output.get_dcmanager_subcloud_show_object().get_location()
|
||||
|
||||
def teardown():
|
||||
DcManagerSubcloudUpdateKeywords(ssh_connection).dcmanager_subcloud_update(subcloud_name, 'location', original_location)
|
||||
|
||||
request.addfinalizer(teardown)
|
||||
|
||||
validate_equals(new_location, test_location, 'Validate that the location has been changed')
|
||||
|
||||
|
||||
@mark.p0
|
||||
@mark.lab_has_subcloud
|
||||
def test_dc_central_force_reboot_host_active_controller():
|
||||
@@ -1140,3 +1227,45 @@ def wait_for_reboot_to_start(host_name: str, ssh_connection: SSHConnection, time
|
||||
time.sleep(refresh_time)
|
||||
|
||||
return False
|
||||
|
||||
|
||||
@mark.p0
|
||||
@mark.lab_has_subcloud
|
||||
def test_dc_modify_timezone(request):
|
||||
"""
|
||||
Verify modifying the timezone and ensure change it not propagated to Subcloud
|
||||
|
||||
Test Steps:
|
||||
- log onto system
|
||||
- Ensure that lab is already in UTC
|
||||
- run system modify --timezone="America/Los_Angeles"
|
||||
- Run linux command to ensure that the timezone was changed
|
||||
- Check that the subcloud has not changed
|
||||
- Reset lab back to UTC
|
||||
"""
|
||||
# Opens an SSH session to active controller.
|
||||
ssh_connection = LabConnectionKeywords().get_active_controller_ssh()
|
||||
|
||||
system_modify_keywords = SystemModifyKeywords(ssh_connection)
|
||||
# ensure we are in UTC to start
|
||||
system_show_object = SystemShowKeywords(ssh_connection).system_show().get_system_show_object()
|
||||
if system_show_object.get_timezone() is not 'UTC':
|
||||
system_modify_output = system_modify_keywords.system_modify_timezone('UTC')
|
||||
validate_equals(system_modify_output.get_system_show_object().get_timezone(), 'UTC', "Update the timezone to UTC.")
|
||||
|
||||
def teardown():
|
||||
system_modify_output = system_modify_keywords.system_modify_timezone('UTC')
|
||||
validate_equals(system_modify_output.get_system_show_object().get_timezone(), "UTC" "Update the timezone to UTC.")
|
||||
|
||||
request.addfinalizer(teardown)
|
||||
|
||||
system_modify_output = system_modify_keywords.system_modify_timezone("America/Los_Angeles")
|
||||
validate_equals(system_modify_output.get_system_show_object().get_timezone(), "America/Los_Angeles", "Update the timezone to America/Los_Angeles.")
|
||||
validate_equals(DateKeywords(ssh_connection).get_timezone(), 'PST', 'validate that the system timezone is now PST')
|
||||
|
||||
# check the subcloud to ensure the time zone change does not propagate
|
||||
dcmanager_subcloud_list = DcManagerSubcloudListKeywords(ssh_connection).get_dcmanager_subcloud_list()
|
||||
subcloud_name = dcmanager_subcloud_list.get_healthy_subcloud_with_lowest_id().get_name()
|
||||
subcloud_ssh = LabConnectionKeywords().get_subcloud_ssh(subcloud_name)
|
||||
system_show_object = SystemShowKeywords(subcloud_ssh).system_show().get_system_show_object()
|
||||
validate_equals(system_show_object.get_timezone(), 'UTC', "Subcloud timezone is still UTC.")
|
||||
|
||||
Reference in New Issue
Block a user