def wait_edit_storage_pool_dialog_close(cls, timeout=10, fail_if_false=True):
     '''
         wait for the edity storage pool dialog to close
     '''
     logger.debug("wait for [ Edit Storage Pool ] dialog to get closed")
     if ui_lib.wait_for_element_notvisible(cls.e.ID_DIALOG_EDIT_STORAGE_POOL, timeout, fail_if_false):
         logger.debug("successfully closed [ Add Storage Pool ] dialog")
         return True
     else:
         msg = "[ Add Storage Pool ] did NOT get closed"
         return FusionUIBase.fail_test_or_return_false(msg, fail_if_false=fail_if_false)
Ejemplo n.º 2
0
    def verify_edit_sans_error_message(cls, error_message, timeout=5, fail_if_false=True):
        logger.debug("Get Error Message From Edit SANs Dialog")
        msg = FusionUIBase.get_text(EditSANsElements.ID_ERROR_MESSAGE_EDIT_SANS, timeout, fail_if_false)
        logger.debug(msg)
        if error_message in msg:
            logger.debug("Verify Error Msg [%s] successfully" % error_message)
            return True

        else:
            logger.debug("Failed to verify Error Msg [%s]" % error_message)
            return False
 def wait_edit_storage_pool_dialog_open(cls, timeout=5, fail_if_false=True):
     '''
         Wait for the Edit storage pool dialog to open
     '''
     logger.debug("wait for [ Edit Storage Pool ] dialog to get opened")
     if ui_lib.wait_for_element_visible(cls.e.ID_DIALOG_EDIT_STORAGE_POOL, timeout, fail_if_false):
         logger.debug("successfully opened [ Edit Storage Pool ] dialog")
         return True
     else:
         msg = "[ Edit Storage Pool ] dialog did NOT get opened"
         return FusionUIBase.fail_test_or_return_false(msg, fail_if_false=fail_if_false)
def verify_general_section(de_obj):

    FusionUIBase.select_view_by_name('General')
    logger.info("Verifying configuration in General view...")

    if hasattr(de_obj, "state"):
        VerifyDriveEnclosures.verify_drive_enclosure_state(
            'General', de_obj.state)

    if hasattr(de_obj, "power"):
        VerifyDriveEnclosures.verify_drive_enclosure_power(
            'General', de_obj.power)

    if hasattr(de_obj, "logical_interconnect"):
        VerifyDriveEnclosures.verify_drive_enclosure_logical_interconnect(
            'General', de_obj.logical_interconnect)

    if hasattr(de_obj, "number_of_drives"):
        VerifyDriveEnclosures.verify_drive_enclosure_number_of_drives(
            'General', de_obj.number_of_drives)
Ejemplo n.º 5
0
def validate_user_privilege():
    """ validate user  """
    logger.info("navigating scope")
    navigate()

    if VerifyScopes.verify_create_scope_button_not_exist(fail_if_false=False) is True:
        logger.info("user has no privilege to create scope")
        VerifyScopes.verify_user_authorizaton(fail_if_false=False)
        return True
    else:
        return FusionUIBase.fail_test_or_return_false("Unexpected behaviour")
Ejemplo n.º 6
0
 def verify_available_fcupgrade_license(cls,
                                        expected_text,
                                        timeout=5,
                                        fail_if_false=True):
     logger.debug("verify '%s' license should display '<%s>'" %
                  (FusionUIConst.CONST_LICENSE_ONEVIEW_SYNERGY_FCUPGRADE,
                   expected_text))
     return FusionUIBase.verify_element_text(
         "Synergy 8Gb FC Upgrade",
         GeneralLicensesElements.ID_TEXT_ONEVIEW_FCLICENSE_AVAILABLE,
         expected_text, timeout, fail_if_false)
 def verify_logical_switch_group_should_not_exist(cls, lsg_name, timeout=5, fail_if_false=True):
     logger.debug("verify Logical Switch Group '%s' should NOT exist ..." % lsg_name)
     if ui_lib.wait_for_element_notvisible(cls.e.ID_TABLE_LOGICAL_SWITCH_GROUP % lsg_name, timeout=timeout, fail_if_false=fail_if_false):
         logger.debug("Logical Switch Group '%s' is successfully verified as invisible within %s second(s)" % (lsg_name, timeout))
         return True
     elif ui_lib.wait_for_element_visible(cls.e.ID_TABLE_LOGICAL_SWITCH_GROUP_NOT_FOUND % lsg_name, timeout=timeout, fail_if_false=fail_if_false):
         logger.debug("Logical Switch Group '%s' was deleted but not de-selected." % lsg_name)
         return True
     else:
         msg = "Logical Switch Group '%s' is failed to be verified as invisible within %s second(s)" % (lsg_name, timeout)
         return FusionUIBase.fail_test_or_return_false(message=msg, fail_if_false=fail_if_false)
def verify_C7000_networking(networking_obj):
    FusionUIBase.navigate_to_section(SectionType.SETTINGS)
    EditNetworking.click_networking()
    VerifyNetworking.wait_host_name_shown(networking_obj.hostname, timeout=10)
    time.sleep(5)
    VerifyNetworking.verify_host_name(networking_obj.hostname)

    if networking_obj.ipv4assignment.lower().strip() == "manual":
        VerifyNetworking.verify_ipv4_assignment(networking_obj.ipv4assignment)
        VerifyNetworking.verify_ipv4_address(networking_obj.ipv4address)
        VerifyNetworking.verify_ipv4_subnet_mask_or_cidr(
            networking_obj.ipv4mask)
        VerifyNetworking.verify_ipv4_gateway_address(
            networking_obj.ipv4gateway)
    elif networking_obj.ipv4assignment.lower().strip() == "dhcp":
        VerifyNetworking.verify_ipv4_assignment(networking_obj.ipv4assignment)
        VerifyNetworking.verify_ipv4_subnet_mask_or_cidr(
            networking_obj.ipv4mask)
        VerifyNetworking.verify_ipv4_gateway_address(
            networking_obj.ipv4gateway)

    VerifyNetworking.verify_ipv6_assignment("not set")
    # if networking_obj.ipv6assignment.lower().strip() == "unassign":
    #     VerifyNetworking.verify_ipv6_assignment("not set")
    #     VerifyNetworking.verify_ipv6_address("not set")
    #     VerifyNetworking.verify_ipv6_subnet_mask_or_cidr("not set")
    #     VerifyNetworking.verify_ipv6_gateway_address("not set")
    # elif networking_obj.ipv6assignment.lower().strip() == "dhcpv6":
    #     VerifyNetworking.verify_ipv6_assignment(networking_obj.ipv6assignment)
    #     VerifyNetworking.verify_ipv6_subnet_mask_or_cidr(networking_obj.ipv6mask)
    #     VerifyNetworking.verify_ipv6_gateway_address(networking_obj.ipv6gateway)
    # else:
    #     VerifyNetworking.verify_ipv6_assignment(networking_obj.ipv6assignment)
    #     VerifyNetworking.verify_ipv6_address(networking_obj.ipv6address)
    #     VerifyNetworking.verify_ipv6_subnet_mask_or_cidr(networking_obj.ipv6mask)
    #     VerifyNetworking.verify_ipv6_gateway_address(networking_obj.ipv6gateway)
    VerifyNetworking.verify_preferred_dns_server(networking_obj.preferreddns)
    VerifyNetworking.verify_alternate_dns_server(networking_obj.alternatedns)
    EditNetworking.click_settings()
    EditNetworking.wait_networking_panel_disappear()
    return True
Ejemplo n.º 9
0
def edit_scope_for_networks(network_list):
    """ Edit scope for Networks
        This function is to edit scope for networks
        Example:
            edit_scope_for_networks(network_list)
    """
    logger.info("Function call to edit scope for networks ")
    navigate()
    for network in network_list:
        if not select_network(network.name):
            FusionUIBase.fail_test_or_return_false(
                "Failed to find target networks")
        FusionUIBase.select_view_by_name("Scopes")
        EditScopeForNetworks.click_edit_scope_button()
        EditScopeForNetworks.wait_edit_scope_dialog_open()
        if network.has_property("scopes"):
            scope_list = network.scopes.split(',')
            for scope in scope_list:
                if not VerifyNetworks.verify_scope_should_exist_in_edit_page(
                        scope, 2, fail_if_false=False):
                    EditScopeForNetworks.click_assign_button()
                    EditScopeForNetworks.wait_assign_scope_dialog_open()
                    EditScopeForNetworks.input_scope_name(scope)
                    EditScopeForNetworks.click_scope_name(scope)
                    EditScopeForNetworks.click_add_button()
                    EditScopeForNetworks.wait_assign_scope_dialog_close()
        if network.has_property("remove_scopes"):
            remove_scope_list = network.remove_scopes.split(',')
            for scope in remove_scope_list:
                if VerifyNetworks.verify_scope_should_exist_in_edit_page(
                        scope, timeout=5):
                    EditScopeForNetworks.click_remove_scope_icon(scope)
        EditScopeForNetworks.click_ok_button()
        EditScopeForNetworks.wait_edit_scope_dialog_close()
        FusionUIBase.show_activity_sidebar()
        FusionUIBase.wait_activity_action_ok(network.name,
                                             'Update',
                                             timeout=60,
                                             fail_if_false=True)
        FusionUIBase.show_activity_sidebar()
    return True
 def wait_storage_pool_status_disabled(cls, storage_pool, storage_system_name, timeout=10, fail_if_false=True):
     '''
         Wait for the storage pool status to be disabled
     '''
     start = datetime.now()
     logger.debug("wait for Storage Pool [ %s ] status to be [ disabled ]" % storage_pool)
     while (datetime.now() - start).total_seconds() < timeout:
         if ui_lib.wait_for_element_visible(GeneralStoragePoolElements.ID_STATUS_STORAGE_POOL_DISABLED % (storage_pool, storage_system_name), timeout=2, fail_if_false=False):
             logger.debug("retrieved status of Storage Pool [ %s ] is [ disabled ]" % storage_pool)
             return True
         elif ui_lib.wait_for_element_visible(GeneralStoragePoolElements.ID_STATUS_STORAGE_POOL_WARN % (storage_pool, storage_system_name), timeout=2, fail_if_false=False):
             err_msg = "retrieved status of Storage Pool [ %s ] is [ warning ], not an expected [ disabled ]" % storage_pool
             return FusionUIBase.fail_test_or_return_false(err_msg, fail_if_false=fail_if_false)
         elif ui_lib.wait_for_element_visible(GeneralStoragePoolElements.ID_STATUS_STORAGE_POOL_ERROR % (storage_pool, storage_system_name), timeout=2, fail_if_false=False):
             err_msg = "retrieved Storage Pool [ %s ] is [ error ], not an expected [ disabled ]" % storage_pool
             return FusionUIBase.fail_test_or_return_false(err_msg, fail_if_false=fail_if_false)
         else:
             logger.debug("retrieved stats of Storage Pool [ %s ] is [ unknown ]" % storage_pool)
             continue
     err_msg = "Timeout for waiting for the status of Storage Pool [ %s ] to change to [ disabled ]." % storage_pool
     return FusionUIBase.fail_test_or_return_false(err_msg, fail_if_false=fail_if_false)
def verify_component_view(drive_enclosure_object):
    for drive_enclosure in drive_enclosure_object:
        FusionUIBase.click_item_from_master_table(drive_enclosure.name)
        FusionUIBase.select_view_by_name('Overview')

        logger.info("Verifying Component View for Drive Enclosure: %s",
                    drive_enclosure.name)

        for drive in drive_enclosure.drives:
            VerifyDriveEnclosures.verify_bay_exists(drive)
            VerifyDriveEnclosures.verify_bay_displays_correct_capacity(drive)

            if drive.model == 'empty':
                logger.info(
                    'No more verification required for empty drive in bay %s' %
                    drive.bay)
            else:
                VerifyDriveEnclosures.verify_bay_status(drive)
                # Add back in after F636 is dev complete
                # VerifyDriveEnclosures.verify_bay_uid_toggle(drive)
                VerifyDriveEnclosures.verify_bay_hover_over(drive)
def remove_san_manager(name, fail_if_false=True):
    select_san_manager(name)
    RemoveSANMangers.select_action_remove()
    RemoveSANMangers.wait_remove_san_manager_dialog_shown()
    RemoveSANMangers.click_yes_remove()
    RemoveSANMangers.wait_remove_san_manager_dialog_disappear()
    FusionUIBase.show_activity_sidebar()
    FusionUIBase.wait_activity_action_ok(name,
                                         "Remove SAN manager",
                                         timeout=50)
    FusionUIBase.show_activity_sidebar()
    if CommonOperationSANMangers.wait_san_manager_show_not_found(
            name, timeout=15, fail_if_false=False):
        logger.info(
            "SAN manager status appear as 'not found', remove san manager {0} successfully."
            .format(name))
        return True
    elif CommonOperationSANMangers.verify_san_manager_not_exist(
            name, timeout=5, fail_if_false=False):
        logger.info("Remove SAN manager {0} successfully".format(name))
        return True
    else:
        if fail_if_false is True:
            ui_lib.fail_test("The SAN manager does not disappear in 20s!")
        else:
            logger.warn("The SAN manager does not disappear in 20s!")
def delete_storage_volume_template(volume_template, fail_if_false=True):
    select_storage_template(volume_template)
    DeleteVolumeTemplates.select_actions_delete()
    DeleteVolumeTemplates.wait_delete_dialog_shown()
    DeleteVolumeTemplates.click_yes_delete_button()
    DeleteVolumeTemplates.wait_delete_dialog_disappear()
    FusionUIBase.show_activity_sidebar()
    FusionUIBase.wait_activity_action_ok(volume_template,
                                         message="Delete",
                                         timeout=20)
    FusionUIBase.show_activity_sidebar()
    if CommonOperationVolumeTemplates.wait_volume_template_show_not_found(
            volume_template, timeout=15, fail_if_false=False):
        logger.info(
            "Volume template status appear as 'not found', remove storage system {0} successfully."
            .format(volume_template))
        return True
    elif CommonOperationVolumeTemplates.verify_volume_template_not_exist(
            volume_template, timeout=5, fail_if_false=False):
        logger.info(
            "Remove volume template {0} successfully".format(volume_template))
        return True
    else:
        if fail_if_false is True:
            ui_lib.fail_test("The volume template does not disappear in 20s!")
        else:
            logger.warn("The volume template does not disappear in 20s!")
            return False
def edit_settings_storage_volume_template(reqdtemplatevolumecreation):
    FusionUIBase.navigate_to_section(SectionType.VOLUME_TEMPLATES)
    volume_template_list = CommonOperationVolumeTemplates.get_volume_template_list(
    )
    if len(volume_template_list) == 0:
        ui_lib.fail_test(
            "no volume template existing, not able to edit setting for volume template !"
        )
    else:
        name = volume_template_list[0]
    logger.info(
        "Editing settings for a volume template with name '{0}'".format(name))
    select_storage_template(name)
    EditVolumeTemplatesSettings.select_actions_edit_settings()
    EditVolumeTemplatesSettings.wait_edit_settings_dialog_shown()
    if reqdtemplatevolumecreation.lower() == 'true':
        EditVolumeTemplatesSettings.tick_require_template_for_volume_creation()
    elif reqdtemplatevolumecreation.lower() == 'false':
        EditVolumeTemplatesSettings.not_tick_require_template_for_volume_creation(
        )
    else:
        ui_lib.fail_test(
            "Invalid value '%s' for 'reqdtemplatevolumecreation', please specify 'True' or 'False'"
            % reqdtemplatevolumecreation)
    EditVolumeTemplatesSettings.click_ok()
    EditVolumeTemplatesSettings.wait_edit_settings_dialog_disappear()
    FusionUIBase.show_activity_sidebar()
    CommonOperationVolumeTemplates.wait_activity_edit_settings_ok(timeout=10)
    FusionUIBase.show_activity_sidebar()
    CommonOperationVolumeTemplates.wait_volume_template_status_ok(name)
    logger.info(
        "Edit setting for volume template {0} successfully".format(name))
    return True
Ejemplo n.º 15
0
def edit_C7000_networking(networking_obj):
    """  Edit C7000 networking """

    FusionUIBase.navigate_to_section(SectionType.SETTINGS)
    EditNetworking.click_networking()
    EditNetworking.select_action_edit()
    EditNetworking.wait_edit_networking_dialog_shown()
    logger.info("Editing networking")
    EditNetworking.input_appliance_host_name(networking_obj.hostname)

    if networking_obj.ipv4assignment.lower().strip() == "manual":
        EditNetworking.choose_ipv4_address_assignment("manual")
        EditNetworking.input_ipv4_address(networking_obj.ipv4address)
        EditNetworking.input_ipv4_subnet_mask_or_cidr(networking_obj.ipv4mask)
        EditNetworking.input_ipv4_gateway_address(networking_obj.ipv4gateway)

    else:
        EditNetworking.choose_ipv4_address_assignment("dhcp")

    EditNetworking.input_preferred_dns_server(networking_obj.preferreddns)
    EditNetworking.input_alternate_dns_server(networking_obj.alternatedns)

    if networking_obj.ipv6assignment.lower().strip() == "manual":
        EditNetworking.choose_ipv6_address_assignment("manual")
        EditNetworking.input_ipv6_address(networking_obj.ipv6address)
        EditNetworking.input_ipv6_subnet_mask_or_cidr(networking_obj.ipv6mask)
        EditNetworking.input_ipv6_gateway_address(networking_obj.ipv6gateway)

    elif networking_obj.ipv6assignment.lower().strip() == "unassign":
        EditNetworking.choose_ipv6_address_assignment("unassign")

    else:
        EditNetworking.choose_ipv6_address_assignment("dhcpv6")

    EditNetworking.click_networking_edit_ok()
    EditNetworking.wait_applying_network_settings_progress_bar_shown()
    EditNetworking.wait_applying_network_settings_progress_bar_disappear()
    EditNetworking.click_settings()
    EditNetworking.wait_networking_panel_disappear()
    return True
Ejemplo n.º 16
0
def verify_volume_sets(*volumesets_obj):
    """
        On the Volume Sets Page, verify that the volumeset in the datafile exists on the screen
    """
    FusionUIBase.navigate_to_section(SectionType.VOLUME_SETS)
    if isinstance(volumesets_obj, test_data.DataObj):
        sets_obj = [volumesets_obj]
    elif isinstance(volumesets_obj, tuple):
        sets_obj = list(volumesets_obj)

    count = 0
    total_count = len(sets_obj)
    for n, volumeset in enumerate(sets_obj):  # pylint: disable=W0612
        name = volumeset.name
        system = volumeset.system
        logger.info("Verifying that volume set with name '{0}' exists".format(name))
        if not select_volume_set(name, system):
            continue
        else:
            count += 1
    if total_count != count:
        ui_lib.fail_test("Did not find all the volumesets")
Ejemplo n.º 17
0
def logout():
    # check the existing login status
    if FusionUIBase.logged_in():
        logger._log_to_console_and_log_file("Logging out of Fusion..")
        ui_lib.wait_for_element(FusionUIBaseElements.ID_MAIN_MENU_CONTROL,
                                PerfConstants.DEFAULT_SYNC_TIME)
        ui_lib.wait_for_element_visible(
            FusionUIBaseElements.ID_SESSION_CONTROL,
            PerfConstants.DEFAULT_SYNC_TIME)
        ui_lib.wait_for_element_and_click(
            FusionUIBaseElements.ID_SESSION_CONTROL,
            PerfConstants.DEFAULT_SYNC_TIME)
        ui_lib.wait_for_element_visible(FusionUIBaseElements.ID_SESSION_LOGOUT)
        ui_lib.wait_for_element_and_click(
            FusionUIBaseElements.ID_SESSION_LOGOUT,
            PerfConstants.DEFAULT_SYNC_TIME)
        ui_lib.wait_for_element_visible(FusionLoginPage.ID_INPUT_LOGIN_USER,
                                        PerfConstants.FUSION_LOGOUT_TIME)
        FusionUIBase.set_login_status(False)

        return True
    return False
def _first_time_login(password):
    logger._log_to_console_and_log_file("Login to Fusion..")
    env_data = test_data.get().envconfigs
    env_data = env_data[0]
    selenium2lib = ui_lib.get_s2l()
    if not ui_lib._get_browser_status():
        ui_lib.open_browser()

    if selenium2lib._is_element_present(FusionLoginPage.ID_BTN_EULA_AGREE):
        selenium2lib.click_button(FusionLoginPage.ID_BTN_EULA_AGREE)

    selenium2lib.wait_until_page_contains_element(
        FusionLoginPage.ID_BTN_LOGIN_BUTTON)
    selenium2lib.input_text(FusionLoginPage.ID_INPUT_LOGIN_USER,
                            env_data.appliance_username)
    selenium2lib.input_text(FusionLoginPage.ID_INPUT_LOGIN_PASSWORD, password)
    selenium2lib.click_button(FusionLoginPage.ID_BTN_LOGIN_BUTTON)
    if not ui_lib.wait_for_element_visible(
            FusionLoginPage.ID_INPUT_NEW_PASSWORD, 4):
        selenium2lib.wait_until_page_contains("Dashboard", 10,
                                              "Failed to load the Login Page")
    FusionUIBase.set_login_status(True)
Ejemplo n.º 19
0
 def click_firmware_bundle(cls, spp_name, firmware_version, timeout=5, fail_if_false=True):
     firmware_bundle_name = spp_name + ', ' + firmware_version
     logger.debug("Select firmware_bundle [%s]" % firmware_bundle_name)
     if not ui_lib.wait_for_element_and_click(FusionFirmwareBundlePage.ID_TABLE_FIRMWARE_BUNDLE % (spp_name, firmware_version), timeout=timeout, fail_if_false=fail_if_false):
         logger.warn("Failed to select firmware bundle")
         return False
     str_title = ui_lib.get_text(FusionFirmwareBundlePage.ID_FWDRIVER_TITLE, timeout=timeout, fail_if_false=fail_if_false)
     if firmware_bundle_name.strip() == str_title.strip():
         logger.info("Selected the Firmware Bundle %s  with version %s successfully" % (spp_name, firmware_version))
         return True
     else:
         msg = "Fail in selecting Firmware Bundle %s  with version %s" % (spp_name, firmware_version)
         return FusionUIBase.fail_test_or_return_false(msg, fail_if_false=fail_if_false)
Ejemplo n.º 20
0
def remove_storage_systems(*storagesys_obj):
    """ Remove Storage Systems

    Arguments:


    * Required Arguments

    Example:


    """
    FusionUIBase.navigate_to_section(SectionType.STORAGE_SYSTEMS)
    if isinstance(storagesys_obj, test_data.DataObj):
        storagesys_obj = [storagesys_obj]
    elif isinstance(storagesys_obj, tuple):
        storagesys_obj = list(storagesys_obj)

    count = 0
    for n, storage in enumerate(storagesys_obj):  # pylint: disable=W0612
        if getattr(storage, 'simplename', '') != '':
            storage_simple_name = storage.simplename
        else:
            storage_simple_name = storage.name.lower().split('.')[0]
        logger.info("Removing a storage system with name %s" %
                    storage_simple_name)
        if not select_storage_system(storage_simple_name):
            count += 1
            continue

        # storages_exists = CommonOperationStorageSystems.get_storage_system_list()
        # storages_exclude_self = [storage for storage in storages_exists if storage != storage_simple_name]
        remove_storage_system(storage_simple_name)
    if count > 0:
        logger.warn(
            "Failure: Not able to remove some of storage systems, please check all warning messages"
        )
        return False
    return True
def turn_off_drive_enclosure_uid(drive_enclosure_obj):
    """ Turn off UI for 1 or multiple drive_enclosure Hardware

    """
    FusionUIBase.navigate_to_section(SectionType.DRIVE_ENCLOSURES,
                                     time_for_loading=5)

    for drive_enclosure in drive_enclosure_obj:
        logger.info("Turning Off UID named '%s'" % drive_enclosure.name)
        select_drive_enclosure(drive_enclosure.name)
        VerifyDriveEnclosures.verify_drive_enclosure_uid(drive_enclosure.name,
                                                         expect_value='On',
                                                         timeout=10,
                                                         fail_if_false=True)
        TurnOffDriveEnclosureUID.click_uid_button()
        TurnOffDriveEnclosureUID.wait_until_uid_off(drive_enclosure.name,
                                                    timeout=120,
                                                    fail_if_false=True)
        VerifyDriveEnclosures.verify_drive_enclosure_uid(drive_enclosure.name,
                                                         expect_value='Off',
                                                         timeout=60,
                                                         fail_if_false=True)
def reset_drive_enclosure(drive_enclosure_obj):
    """ Reset 1 or multiple drive_enclosure Hardware

    """
    FusionUIBase.navigate_to_section(SectionType.DRIVE_ENCLOSURES,
                                     time_for_loading=5)

    for drive_enclosure in drive_enclosure_obj:
        logger.info("reset a drive_enclosure hardware named '%s'" %
                    drive_enclosure.name)
        VerifyDriveEnclosures.verify_drive_enclosures_exist(
            drive_enclosure.name, fail_if_false=False)
        select_drive_enclosure(drive_enclosure.name)
        FusionUIBase.select_view_by_name(view_name='Overview',
                                         timeout=5,
                                         fail_if_false=False)
        VerifyDriveEnclosures.verify_drive_enclosure_power('Overview',
                                                           expect_value='On',
                                                           timeout=10,
                                                           fail_if_false=True)
        ResetDriveEnclosure.select_action_reset()
        ResetDriveEnclosure.click_reset_button_confirm_yes()
        FusionUIBase.show_activity_sidebar()
        if FusionUIBase.wait_activity_action_ok_or_warn(
                drive_enclosure.name, 'Reset', timeout=300,
                fail_if_false=False) is True:
            FusionUIBase.show_activity_sidebar()
            if CommonOperationDriveEnclosure.wait_drive_enclosure_status_ok_or_warn(
                    drive_enclosure.name, timeout=180,
                    fail_if_false=False) is True:
                logger.info("drive_enclosure '%s' is successfully reset" %
                            drive_enclosure.name)
            else:
                logger.warn("drive_enclosure '%s' is NOT successfully reset" %
                            drive_enclosure.name)
                ui_lib.fail_test(
                    "drive enclosure '%s' is NOT successfully reset or error occurred due to its status is neither 'ok' nor 'warn'"
                    % drive_enclosure.name)
        else:
            logger.warn("drive enclosure '%s' is NOT successfully reset" %
                        drive_enclosure.name)
            ui_lib.fail_test(
                "drive enclosure '%s' is NOT successfully reset or error occurred due to its status is neither 'ok' nor 'warn'"
                % drive_enclosure.name)
Ejemplo n.º 23
0
def create_scope(*scopes_obj):
    """ Create Scope
        Example:
        | `Create Scope`      | ${myScopeList}    |
    """

    logger.info("Create Scope")
    navigate()
    if isinstance(scopes_obj, test_data.DataObj):
        scopes_obj = [scopes_obj]
    elif isinstance(scopes_obj, tuple):
        scopes_obj = list(scopes_obj[0])

    fail_if_exist = 0

    for scope in scopes_obj:
        if VerifyScopes.verify_scope_existed(scope.name, 5, False):
            fail_if_exist += 1
            logger.warn("scope %s already exists" % scope.name)
            continue
        have_resource = False
        CreateScopes.click_create_scope_button()
        logger.info("Creating scope %s" % scope.name)
        CreateScopes.wait_create_scope_dialog_open()
        CreateScopes.input_name(scope.name)
        if hasattr(scope, 'description'):
            CreateScopes.input_description(scope.description)
        if hasattr(scope, 'resources'):
            for n, resource in enumerate(scope.resources):
                have_resource = True
                _Add_Resource_To_Scope_Add(resource)
        CreateScopes.click_create_plus_button()
        VerifyScopes.verify_create_plus_complete()
        CreateScopes.click_cancel_button()
        CreateScopes.wait_create_scope_dialog_close()

        FusionUIBase.show_activity_sidebar()
        FusionUIBase.wait_activity_action_ok(scope.name, 'Create', timeout=60, fail_if_false=True)
        if have_resource:
            FusionUIBase.wait_activity_action_ok(scope.name, 'Update Resource Assignments', timeout=60, fail_if_false=True)
        FusionUIBase.show_activity_sidebar()

        CommonOperationScopes.select_scope(scope.name)
        VerifyScopes.verify_scope_created(scope.name)

    if fail_if_exist > 0:
        return False
    return True
def delete_storage_volume_templates(*volumetemplates_obj):
    FusionUIBase.navigate_to_section(SectionType.VOLUME_TEMPLATES)
    if isinstance(volumetemplates_obj, test_data.DataObj):
        volumetemplates_obj = [volumetemplates_obj]
    elif isinstance(volumetemplates_obj, tuple):
        volumetemplates_obj = list(volumetemplates_obj)
    count = 0
    for n, volume_template in enumerate(volumetemplates_obj):
        logger.info("{2} No: {0} --- Total: {1} {2}".format(
            (n + 1), len(volumetemplates_obj), '-' * 14))
        name = volume_template.name
        logger.info("Removing a volume template with name %s" % name)
        if not select_storage_template(name):
            count += 1
            continue

        delete_storage_volume_template(name)
    if count > 0:
        logger.warn(
            "Failure: Not able to delete some of storage volume templates, please check all warning messages"
        )
        return False
    return True
def remove_san_managers(*sanmanager_obj):
    logger.info("Function call to remove san manager")
    FusionUIBase.navigate_to_section(SectionType.SAN_MANAGERS)
    if isinstance(sanmanager_obj, test_data.DataObj):
        sanmanager_obj = [sanmanager_obj]
    elif isinstance(sanmanager_obj, tuple):
        sanmanager_obj = list(sanmanager_obj)

    count = 0
    for n, sanmanager in enumerate(sanmanager_obj):
        logger.info("{2} No: {0} --- Total: {1} {2}".format(
            (n + 1), len(sanmanager_obj), '-' * 14))
        logger.info("Removing a SAN manager with name %s" % sanmanager.sanip)
        if not select_san_manager(sanmanager.sanip):
            count += 1
            continue
        remove_san_manager(sanmanager.sanip)
    if count > 0:
        logger.warn(
            "Not able to remove some of SAN managers, please check warning messages!"
        )
        return False
    return True
Ejemplo n.º 26
0
 def get_network_sets_list(cls, timeout=5, fail_if_false=True):
     logger.debug("Get all network sets names from table")
     network_sets_list = []
     if ui_lib.wait_for_element(
             GeneralNetworkSetsElements.ID_TABLE_NETWORKSET_NAME_LIST,
             timeout, fail_if_false):
         network_sets_list = FusionUIBase.get_multi_elements_text(
             GeneralNetworkSetsElements.ID_TABLE_NETWORKSET_NAME_LIST,
             timeout, fail_if_false)
         logger.debug("network_set list %s" % network_sets_list)
         return network_sets_list
     else:
         logger.debug("failed to get network_set list")
         return False
Ejemplo n.º 27
0
def verify_sans(*sans_obj):
    """Verify SANs """
    FusionUIBase.navigate_to_section(SectionType.SANS)
    if isinstance(sans_obj, DataObj):
        sans_obj = [sans_obj]
    elif isinstance(sans_obj, tuple):
        sans_obj = list(sans_obj)

    for n, sans in enumerate(sans_obj):
        CommonOperationSANs.wait_for_sans_shown(sans.name)
        CommonOperationSANs.select_sans(sans.name)
        CommonOperationSANs.wait_for_sans_title_shown(sans.name)
        VerifySANs.verify_general_state(sans.state)
        VerifySANs.verify_general_type(sans.type)
        VerifySANs.verify_principal_switch(sans.principalswitch)
        VerifySANs.verify_san_manager(sans.sanmanager)
        VerifySANs.verify_associated_networks(sans.associatednetworks)
        VerifySANs.verify_zoned(sans.zoned)
        VerifySANs.verify_automate_zoning(sans.automatezoning)
        # VerifySANs.verify_use_aliases(sans.usealiases)
        logger.debug("%s verify completed" % sans.name)

    return True
def verify_de_from_enclosure_page(de_obj):
    """  Reset 1 or multiple drive_enclosure Hardware

    """

    FusionUIBase.navigate_to_section(SectionType.ENCLOSURES,
                                     time_for_loading=5)
    logger.info("Verifying Drive enclosure link '%s' from Enclosure's page" %
                de_obj.name)
    enclosure = de_obj.name.split(',')
    enclosure = enclosure[0]
    TBirdCommonOperationEnclosures.click_enclosure(enclosure, timeout=10)
    TBirdCommonOperationEnclosures.wait_enclosure_selected(enclosure,
                                                           timeout=10,
                                                           fail_if_false=True)
    VerifyDriveEnclosures.click_drive_enclosure_link(de_obj.name,
                                                     timeout=10,
                                                     fail_if_false=True)
    VerifyDriveEnclosures.verify_drive_enclosure_title(de_obj.name,
                                                       timeout=10,
                                                       fail_if_false=True)
    VerifyDriveEnclosures.verify_drive_enclosure_is_selected(
        de_obj.name, timeout=10, fail_if_false=True)
def edit_time_and_locale(time_and_locale_obj):
    """Edit time and locale"""
    FusionUIBase.navigate_to_section(SectionType.SETTINGS)
    EditTimeAndLocale.click_time_and_locale()
    EditTimeAndLocale.wait_time_and_local_panel_shown()
    EditTimeAndLocale.select_action_edit()
    EditTimeAndLocale.wait_edit_time_and_locale_dialog_shown()
    logger.info("Edit time and locale")

    if time_and_locale_obj.synchronizetype.lower().strip() == "vm host":
        EditTimeAndLocale.choose_synchronize_with_vm_host()
    elif time_and_locale_obj.synchronizetype.lower().strip() == "time server":
        EditTimeAndLocale.choose_synchronize_with_time_server()
        if getattr(time_and_locale_obj, 'timeserver1', '') != '':
            EditTimeAndLocale.input_network_time_server1(
                time_and_locale_obj.timeserver1)
        if getattr(time_and_locale_obj, 'timeserver2', '') != '':
            EditTimeAndLocale.input_network_time_server2(
                time_and_locale_obj.timeserver2)
        if getattr(time_and_locale_obj, 'timeserver3', '') != '':
            EditTimeAndLocale.input_network_time_server3(
                time_and_locale_obj.timeserver3)
        if getattr(time_and_locale_obj, 'timeserver4', '') != '':
            EditTimeAndLocale.input_network_time_server4(
                time_and_locale_obj.timeserver4)

    else:
        logger.warn("the time synchronize type is not correct ")
        return False
    EditTimeAndLocale.input_select_default_language_locale(
        time_and_locale_obj.defaultlanguagelocale)
    EditTimeAndLocale.click_time_and_locale_edit_ok()
    EditTimeAndLocale.wait_edit_time_and_locale_dialog_disappear(timeout=10)
    EditTimeAndLocale.wait_update_time_and_local_complete(timeout=10)
    EditTimeAndLocale.click_settings()
    EditTimeAndLocale.wait_edit_time_and_locale_dialog_disappear()
    return True
def verify_drives_link(drive_enclosure_object):
    for drive_enclosure in drive_enclosure_object:
        logger.info("Verifying Drives View for Drive Enclosure: %s",
                    drive_enclosure.name)

        FusionUIBase.click_item_from_master_table(drive_enclosure.name)
        FusionUIBase.select_view_by_name('Overview')
        ui_lib.wait_for_element_and_click("link=Drives", fail_if_false=True)
        FusionUIBase.verify_view_by_name('Drives')