コード例 #1
0
def refresh_san_managers(*sanmanager_obj):
    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))
        name = sanmanager.sanip
        logger.info("Refreshing a san manager with name '{0}'".format(name))
        if not select_san_manager(name):
            count += 1
            continue
        RefreshSANMangers.select_action_refresh()
        FusionUIBase.show_activity_sidebar()
        FusionUIBase.wait_activity_action_ok(name,
                                             "Refresh SAN manager",
                                             timeout=30)
        FusionUIBase.show_activity_sidebar()
        CommonOperationSANMangers.wait_san_manager_status_ok(name)
        logger.info("Refresh san manager {0} successfully".format(name))
    if count > 0:
        logger.warn(
            "Failure: Not able to refresh some of san managers, please check warning messages."
        )
        return False

    return True
コード例 #2
0
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!")
コード例 #3
0
def edit_san_managers(*sanmanager_obj):
    """ Edit san managers    """
    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("Editing a san manager with name '{0}'".format(
            sanmanager.sanip))
        if not select_san_manager(sanmanager.sanip):
            count += 1
            continue

        EditSANMangers.select_action_edit()
        EditSANMangers.wait_edit_san_manager_dialog_shown()
        if getattr(sanmanager, 'newsanip', '') != '':
            name = sanmanager.newsanip
            EditSANMangers.input_ip_address_or_host_name(sanmanager.newsanip)
        else:
            name = sanmanager.sanip
        if getattr(sanmanager, 'port', '') != '':
            EditSANMangers.input_port(sanmanager.port)
        if getattr(sanmanager, 'sanmanagerssl', '') != '':
            if sanmanager.sanmanagerssl.lower() == 'true':
                EditSANMangers.tick_use_ssl()
            else:
                EditSANMangers.untick_use_ssl()
        if getattr(sanmanager, 'username', '') != '':
            EditSANMangers.input_user_name(sanmanager.username)
        if getattr(sanmanager, 'password', '') != '':
            EditSANMangers.input_password(sanmanager.password)

        EditSANMangers.click_ok_button()
        status, msg = FusionUIBase.get_error_message_from_dialog(timeout=5)
        if status is True:
            ui_lib.fail_test(msg)
        EditSANMangers.wait_edit_san_manager_dialog_disappear(timeout=10)
        FusionUIBase.show_activity_sidebar()
        FusionUIBase.wait_activity_action_ok(sanmanager.sanip,
                                             "Update SAN manager",
                                             timeout=30)
        FusionUIBase.show_activity_sidebar()
        CommonOperationSANMangers.wait_san_manager_status_ok(name)
        logger.info("Edit san manager {0} successfully".format(
            sanmanager.sanip))
    if count > 0:
        logger.warn(
            "Not able to edit some of SAN managers, please check warning messages!"
        )
        return False
    return True
コード例 #4
0
def select_san_manager(name):
    """ Select san manager  """
    logger.info("Selecting a SAN manager with name {0}".format(name))
    if CommonOperationSANMangers.verify_san_manager_exist(name,
                                                          fail_if_false=False):
        CommonOperationSANMangers.click_san_manager(name)
        CommonOperationSANMangers.wait_san_manager_selected(name)
        return True
    else:
        logger.warn("SAN manager '{0}' does not exist".format(name))
        return False
コード例 #5
0
def remove_all_san_managers():
    logger.info("Function call to remove SAN managers")
    FusionUIBase.navigate_to_section(SectionType.SAN_MANAGERS)
    san_list = CommonOperationSANMangers.get_san_manager_list()
    san_obj_list = []
    for san_name in san_list:
        logger.info("Deleting SAN manager %s" % san_name)
        san_obj = test_data.DataObj()
        san_obj.add_property('name', san_name)
        san_obj_list.append(san_obj)
    return remove_san_managers(*san_obj_list)
コード例 #6
0
def add_san_managers(version, *sanmanager_obj):
    """
        add_san_manager function to add san manager to the appliance

        Example:
        | Add San Managers      | @{sanmanager_obj}    |
    """
    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
    new_sanmanager_obj = []
    logger.info("{0} PREPARATION  {0}".format('-' * 17))
    for n, sanmanager in enumerate(sanmanager_obj):
        name = sanmanager.sanip
        if getattr(sanmanager, 'remove_if_exists', 'true').lower() == 'true':
            remove_if_exists = True
        else:
            remove_if_exists = False

        if not CommonOperationSANMangers.verify_san_manager_not_exist(
                name, fail_if_false=False):
            logger.warn("SAN manager '{0}' already exists".format(name))
            if remove_if_exists is True:
                logger.info(
                    "Removing the SAN manager since 'remove_if_exists' is set to 'True'"
                )
                if not remove_san_manager(name, fail_if_false=False):
                    count += 1
                else:
                    new_sanmanager_obj.append(sanmanager)
            else:
                logger.warn(
                    "Error: Would not be able to create the existing san manager '%s'."
                    % name)
                count += 1
        else:
            new_sanmanager_obj.append(sanmanager)

    for n, sanmanager in enumerate(new_sanmanager_obj):
        logger.info("{2} No: {0} --- Total: {1} {2}".format(
            (n + 1), len(sanmanager_obj), '-' * 14))
        name = sanmanager.sanip
        logger.info("Adding a san manager with name '{0}'".format(name))
        if n == 0:
            FusionUIBase.show_activity_sidebar()
            AddSANMangers.click_add_san_manager_button()
        AddSANMangers.wait_add_san_manager_dialog_shown()
        AddSANMangers.select_san_manager_type(sanmanager.type)
        if sanmanager.type.lower().replace(
                ' ', '') == "Brocade Network Advisor".lower().replace(' ', ''):
            AddSANMangers.input_ip_address_or_host_name(name,
                                                        appversion=version)
            if getattr(sanmanager, 'port', '') != '':
                AddSANMangers.input_port(sanmanager.port)
            if sanmanager.sanmanagerssl.lower() == 'true':
                AddSANMangers.tick_use_ssl(appversion=version)
            else:
                AddSANMangers.untick_use_ssl(appversion=version)
            if getattr(sanmanager, 'username', '') != '':
                AddSANMangers.input_user_name(sanmanager.username,
                                              appversion=version)
            AddSANMangers.input_password(sanmanager.password,
                                         appversion=version)
        elif sanmanager.type.lower() == "cisco":
            AddSANMangers.input_ip_address_or_host_name_cisco(name)
            if getattr(sanmanager, 'snmpport', '') != '':
                AddSANMangers.input_snmp_port(sanmanager.snmpport)
            AddSANMangers.input_snmp_user_name(sanmanager.username)
            if getattr(sanmanager, 'securitylevel', '') != '':
                AddSANMangers.choose_security_level(sanmanager.securitylevel,
                                                    sanmanager.type)
            if getattr(sanmanager, 'authprotocol', '') != '':
                AddSANMangers.select_authentication_protocol(
                    sanmanager.authprotocol)
            AddSANMangers.input_authentication_password(
                sanmanager.authpassword)
        elif sanmanager.type.lower() == "hpe":
            AddSANMangers.input_ip_address_or_host_name_hpe(name)
            if getattr(sanmanager, 'snmpport', '') != '':
                AddSANMangers.input_snmp_port(sanmanager.snmpport)
            AddSANMangers.input_snmp_user_name(sanmanager.username)
            if getattr(sanmanager, 'securitylevel', '') != '':
                AddSANMangers.choose_security_level(sanmanager.securitylevel,
                                                    sanmanager.type)
            if getattr(sanmanager, 'authenticationprotocol', '') != '':
                AddSANMangers.select_authentication_protocol(
                    sanmanager.authenticationprotocol)
            if getattr(sanmanager, 'authenticationpassword', '') != '':
                AddSANMangers.input_authentication_password(
                    sanmanager.authenticationpassword)
            if getattr(sanmanager, 'privacypassword', '') != '':
                AddSANMangers.input_privacy_password(
                    sanmanager.privacypassword)
        else:
            ui_lib.fail_test(
                "unsupported san_manager type '%s', please specify 'Brocade Network Advisor', 'Cisco' or 'HPE'"
                % sanmanager.type)

        if n == (len(new_sanmanager_obj) - 1):
            AddSANMangers.click_add_button()
        else:
            AddSANMangers.click_add_plus_button()
        status, msg = FusionUIBase.get_error_message_from_dialog(timeout=5)
        if status is True:
            ui_lib.fail_test(msg)
        FusionUIBase.wait_activity_action_ok(name,
                                             message="Add SAN manager",
                                             timeout=30)
    AddSANMangers.wait_add_san_manager_dialog_disappear(timeout=5)
    FusionUIBase.show_activity_sidebar()
    logger.info("{0} VERIFICATION {0}".format('-' * 17))
    for n, sanmanager in enumerate(new_sanmanager_obj):
        name = sanmanager.sanip
        CommonOperationSANMangers.wait_san_manager_status_ok(name)
        logger.info("Add san manager {0} successfully".format(name))

    if count > 0:
        logger.warn(
            "Failure: Not able to add some of san managers, please check all warning messages"
        )
        return False

    return True