def edit_services_access(isEnabled):
    """
    Edit Support Access: function to enable or disable support access

    """
    s2l = ui_lib.get_s2l()
    if not ui_lib.wait_for_element(FusionSettingsPage.ID_PAGE_LABEL):
        navigate()

    logger._log_to_console_and_log_file("Edit services access")
    ui_lib.wait_for_element_and_click(FusionSettingsPage.ID_MENU_ACTION_MAIN_BTN)
    ui_lib.wait_for_element_and_click(FusionSettingsPage.ID_MENU_ACTION_EDIT_SUPPORT_ACCESS)
    ui_lib.wait_for_element_visible(FusionSettingsPage.ID_LABEL_EDIT_SUPPORT_ACCESS)
    editoption = s2l.get_text(FusionSettingsPage.ID_TOGGLE_BTN_SERVICE_ACCESS)
    if editoption.lower() == isEnabled.lower():
        ui_lib.wait_for_element_and_click(FusionSettingsPage.ID_BTN_OK_SUPPORT_ACCESS)
    elif editoption == "Enabled" and isEnabled == "Disabled":
        ui_lib.wait_for_element_and_click(FusionSettingsPage.ID_TOGGLE_OFF)
        ui_lib.wait_for_element_and_click(FusionSettingsPage.ID_BTN_OK_SUPPORT_ACCESS)
    else:
        ui_lib.wait_for_element_and_click(FusionSettingsPage.ID_TOGGLE_ON)
        ui_lib.wait_for_element_and_click(FusionSettingsPage.ID_BTN_OK_SUPPORT_ACCESS)
    ui_lib.wait_for_element(FusionSettingsPage.ID_LABEL_STATUS)
    lablestatus = s2l.get_text(FusionSettingsPage.ID_LABEL_STATUS)
    if lablestatus.lower() == isEnabled.lower():
        logger._log_to_console_and_log_file("Services access is successfully updated from '%s' to '%s'" % (editoption, isEnabled))
        return True
    else:
        logger._warn("Failed to edit Services access ")
        return False
 def wait_storage_pool_status_ok(cls, storage_pool, storage_system_name, timeout=10, fail_if_false=True):
     '''
         wait for the storage pool status = OK
     '''
     start = datetime.now()
     logger.debug("wait for Storage Pool [ %s ] status to be [ ok ]" % storage_pool)
     while (datetime.now() - start).total_seconds() < timeout:
         if ui_lib.wait_for_element_visible(GeneralStoragePoolElements.ID_STATUS_STORAGE_POOL_OK % (storage_pool, storage_system_name), timeout=2, fail_if_false=False):
             logger.debug("Storage Pool [ %s ] status is [ ok ]" % 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 = "Storage Pool [ %s ] status is [ warning ], not an expected [ ok ]" % storage_pool
             logger.debug(err_msg)
             if fail_if_false is False:
                 logger.warn(err_msg)
                 return False
             else:
                 ui_lib.fail_test(err_msg)
         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 = "Storage Pool [ %s ] status is [ error ], not an expected [ ok ]" % storage_pool
             logger.debug(err_msg)
             if fail_if_false is False:
                 logger.warn(err_msg)
                 return False
             else:
                 ui_lib.fail_test(err_msg)
         else:
             logger.debug("Storage Pool [ %s ] status is [ unknown ]" % storage_pool)
             continue
     err_msg = "Timeout for waiting for the status of Storage Pool [ %s ] to change to [ ok ]." % storage_pool
     if fail_if_false is False:
         logger.warn(err_msg)
         return False
     else:
         ui_lib.fail_test(err_msg)
Exemple #3
0
 def wait_create_support_dump_dialog_shown(cls,
                                           timeout=5,
                                           fail_if_false=True):
     logger.debug("wait create support dump dialog shown")
     ui_lib.wait_for_element_visible(
         CreateSupportDumpElements.ID_DIALOG_CREATE_SUPPORT_DUMP, timeout,
         fail_if_false)
    def wait_storage_pool_status_error(cls, storage_pool, storage_system_name, timeout=10, fail_if_false=True):
        '''
            Wait for the storage pool status to be error
        '''
        start = datetime.now()
        logger.debug("wait storage system '%s' status is ok or warning" % storage_pool)
        while (datetime.now() - start).total_seconds() < timeout:
            if ui_lib.wait_for_element_visible(GeneralStoragePoolElements.ID_STATUS_STORAGE_POOL_OK % (storage_pool, storage_system_name), timeout=5, fail_if_false=False):
                logger.debug("storage system status is ok")
                return False
            elif ui_lib.wait_for_element_visible(GeneralStoragePoolElements.ID_STATUS_STORAGE_POOL_WARN % (storage_pool, storage_system_name), timeout=5, fail_if_false=False):
                logger.debug("storage system status is warning")
                return False
            elif ui_lib.wait_for_element_visible(GeneralStoragePoolElements.ID_STATUS_STORAGE_POOL_ERROR % (storage_pool, storage_system_name), timeout=5, fail_if_false=False):
                logger.debug("storage system status is error")
                return True
            else:
                logger.debug("storage system status is unknown")
                continue

        err_msg = "Timeout for waiting for the status of Storage Pool [ %s ] to change to [ error ]." % storage_pool
        if fail_if_false is False:
            logger.warn(err_msg)
            return False
        else:
            ui_lib.fail_test(err_msg)
 def wait_update_time_and_local_complete(cls,
                                         timeout=5,
                                         fail_if_false=True):
     logger.debug("wait progress bar - update time and local completed")
     ui_lib.wait_for_element_visible(
         EditTimeAndLocaleElements.ID_PROGRESS_BAR_COMPLETED, timeout,
         fail_if_false)
def shut_down():
    """ Shut Down

        Shutdown the fusion appliance

        Example:
        | `Shut Down`      |     |
    """
    if not ui_lib.wait_for_element(FusionSettingsPage.ID_PAGE_LABEL):
        navigate()
    logger._log_to_console_and_log_file("Shutdown Appliance")
    ui_lib.wait_for_element_and_click(FusionSettingsPage.ID_MENU_ACTION_MAIN_BTN)
    ui_lib.wait_for_element_and_click(FusionSettingsPage.ID_MENU_ACTION_SHUTDOWN)
    if ui_lib.wait_for_element_visible(FusionSettingsPage.ID_TEXT_SHUTDOWN):
        ui_lib.wait_for_element_and_click(FusionSettingsPage.ID_BTN_YES_CONFIRM_SHUTDOWN)
    else:
        ui_lib.fail_test('Failed: The message while shutting down the appliance is not displayed')
    # Checking whether the fusion appliance started shutting down or not
    if ui_lib.wait_for_element_visible(FusionSettingsPage.ID_LABEL_WAITING, PerfConstants.RESTART_LABEL_VISIBLE):
        logger._log_to_console_and_log_file("The fusion appliance is getting shutdown")
    else:
        ui_lib.fail_test('Failed: The fusion appliance failed to shutdown')
    # Checking whether the fusion appliance is shut down or not
    if ui_lib.wait_for_element_visible(FusionSettingsPage.ID_LABEL_UNAVAILABLE, PerfConstants.STARTING_PROGRESS_VISIBLE):
        logger._log_to_console_and_log_file("The fusion appliance is shutdown successfully ")
    else:
        ui_lib.fail_test('Failed: The fusion appliance failed to shutdown the appliance in the restart procedure')
Exemple #7
0
def _verify_activity_owner(actname, resource, timestamp, assignusername):
    """ This function is to verify the user name once the activity is assigned to any user.
    This function is written wrt E2E UC3.it will work only when we pass all the four parameters.
        Example:
        _verify_activity_owner('Update started for interconnect CC-2-LI', 'CC-2-LI', 'Today 10.45 am', 'NetAdmin')
    """
    selenium2lib = ui_lib.get_s2l()
    if not selenium2lib._is_element_present(FusionActivityPage.ID_PAGE_LABEL):
        selenium2lib.click_element(FusionUIBaseElements.ID_MAIN_MENU_CONTROL)
        ui_lib.wait_for_element_visible(
            FusionUIBaseElements.ID_MENU_LINK_ACTIVITY,
            PerfConstants.DEFAULT_SYNC_TIME)
        ui_lib.wait_for_element_and_click(
            FusionUIBaseElements.ID_MENU_LINK_ACTIVITY)
        ui_lib.wait_for_element_visible(FusionActivityPage.ID_PAGE_LABEL)

        actavailable = _is_element_present_activity_page_without_time(
            actname, resource)
        if actavailable:
            assignuser_name = selenium2lib.get_text(
                FusionActivityPage.ID_ASSIGNED_OWNER %
                (actname, resource, timestamp))
            if assignuser_name == assignusername:
                logger._log_to_console_and_log_file(
                    "Activity is available with assigned user name only")
            else:
                logger._warn(
                    "Activity is not available with assigned user name")
        else:
            logger._warn("Assigned activity is not visible to this user %s" %
                         assignusername)
def check_content_resource(content_category, content_resource):
    """
        Verify if a resource is displayed on System Profile Contents section.
        This function can also be used to verify the number of a specific resource.

        e.g.: check_content_element("Clusters", "4 Server Profiles")
              check_content_element("Clusters", "Server Profiles")
              check_content_element("Clusters", "4")
    """
    if not ui_lib.wait_for_element_visible(systemprofilesPage.ID_PAGE_LABEL):
        navigate()
    if not ui_lib.wait_for_element_visible(
            systemprofilesPage.ID_LABEL_CONTENTS):
        navigateOverview()
    logger._log_to_console_and_log_file(
        "\n -Verifying if category \"%s\" contains \"%s\" in Contents section."
        % (content_category, content_resource))
    if ui_lib.wait_for_element_visible(
            systemprofilesPage.MAP_CONTENT_RESOURCE_ITEM %
        (content_category, content_resource)):
        logger._log_to_console_and_log_file(
            "\t- Found \"%s\" for category \"%s\"!" %
            (content_resource, content_category))
    else:
        ui_lib.fail_test(
            "Resource and/or category not found in Contents section",
            captureScreenshot=True)
def open_san_action(action_name):
    xpath_action = FusionSANPage.ID_SAN_MENU_ACTION_MAIN_BTN

    logger._log_to_console_and_log_file("Choose %s from action menu" %
                                        action_name)

    if (action_name == 'Edit'):
        xpath_action2 = FusionSANPage.ID_SAN_MENU_ACTION_EDIT
    elif (action_name == 'Refresh'):
        xpath_action2 = FusionSANPage.ID_SAN_MENU_ACTION_REFRESH
    elif (action_name == 'Download'):
        xpath_action2 = FusionSANPage.ID_SAN_MENU_ACTION_DOWNLOAD
    elif (action_name == 'Report'):
        xpath_action2 = FusionSANPage.ID_SAN_MENU_ACTION_REPORT

    else:
        logger._log_to_console_and_log_file("Invalid action requested on san")
        return False
    try:
        ui_lib.wait_for_element_visible(xpath_action, 10)
    except:
        pass

    logger._log_to_console_and_log_file("Open SAN actions menu-%s" %
                                        action_name)
    ui_lib.wait_for_element_and_click(xpath_action, 10)
    ui_lib.wait_for_element_and_click(xpath_action2, 10)
def validate_for_edit_san_errors(err_type):
    xpath_unable_to_edit_error = FusionSANPage.ID_SAN_EDIT_ERROR_MESSAGE
    logger._log_to_console_and_log_file("Validate %s error" % err_type)
    msg1 = "Unable to edit SAN."
    msg2 = "This field is required."
    msg3 = "Resolution: "

    if (err_type == 'fielderr'):
        xpath_error_details = FusionSANPage.EDIT_SAN_ERR_ERR_FIELD
        xpath_error_resolution = (FusionSANPage.EDIT_SAN_ERR_ERR_FIELD +
                                  FusionSANPage.EDIT_SAN_ERR_RESOLUTION)
        xpath_required = FusionSANPage.EDIT_SAN_REQUIRED_ERR_MSG
        msg = "One or more fields have an invalid value."
    else:
        logger._log_to_console_and_log_file("Unknown error to validate")
        return False
    try:
        ui_lib.wait_for_element_visible(xpath_unable_to_edit_error, 10)
        ui_lib.wait_for_element_visible(xpath_error_details, 10)
        ui_lib.wait_for_element_visible(xpath_error_resolution, 10)

    except:
        pass

    logger._log_to_console_and_log_file("Validate '%s' message" % msg)
    BuiltIn().should_be_true(
        ui_lib.wait_for_element_visible(xpath_unable_to_edit_error), msg1)
    BuiltIn().should_be_true(
        ui_lib.wait_for_element_visible(xpath_error_details), msg)
    BuiltIn().should_be_true(
        ui_lib.wait_for_element_visible(xpath_error_resolution), msg3)
    if (xpath_required != ''):
        BuiltIn().should_be_true(
            ui_lib.wait_for_element_visible(xpath_required), msg2)
def clear_out_san_edit_input_box(field_name):
    logger._log_to_console_and_log_file("Clear %s textbox on edit san screen" %
                                        field_name)
    if (field_name == 'zonename'):
        xpath_name = FusionSANPage.ID_SAN_EDIT_ZONE_NAME
        xpath_name_label = FusionSANPage.ID_SAN_EDIT_ZONE_NAME_LABEL

    elif (field_name == 'initiatoralias'):
        xpath_name = FusionSANPage.ID_SAN_EDIT_INITIATOR_ALIAS
        xpath_name_label = FusionSANPage.ID_SAN_EDIT_INITIATOR_ALIAS_LABEL

    elif (field_name == 'targetalias'):
        xpath_name = FusionSANPage.ID_SAN_EDIT_TARGET_ALIAS
        xpath_name_label = FusionSANPage.ID_SAN_EDIT_TARGET_ALIAS_LABEL

    elif (field_name == 'targetgrpalias'):
        xpath_name = FusionSANPage.ID_SAN_EDIT_TARGET_GRP_ALIAS
        xpath_name_label = FusionSANPage.ID_SAN_EDIT_TARGET_GRP_ALIAS_LABEL

    else:
        return False

    try:
        ui_lib.wait_for_element_visible(xpath_name_label, 10)
    except:
        pass


#    ui_lib.wait_for_element_and_input_text(xpath_name, Keys.CLEAR)
    ui_lib.wait_for_element_and_input_text(xpath_name, Keys.END)
    ui_lib.wait_for_element_and_input_text(xpath_name, Keys.BACKSPACE)
    ui_lib.wait_for_element_and_input_text(xpath_name, Keys.BACKSPACE)
    ui_lib.wait_for_element_and_input_text(xpath_name, Keys.BACKSPACE)
def validate_all_states_filter():
    xpath_states = FusionSANPage.ID_SAN_ALL_STATES
    logger._log_to_console_and_log_file(
        "Validate All States Filter on the SAN Page  %s")
    try:
        ui_lib.wait_for_element_visible(xpath_states, 10)
    except:
        pass

    ui_lib.wait_for_element_and_click(xpath_states)

    if (ui_lib.get_text(FusionSANPage.ID_SAN_ALL_STATES_DISCOVERED,
                        1) == "Discovered"):
        logger._log_to_console_and_log_file("State Discovered found")
    else:
        ui_lib.fail_test(
            "unable to find the Discovered State, the value is" +
            ui_lib.get_text(FusionSANPage.ID_SAN_ALL_STATES_DISCOVERED, 1))
    if (ui_lib.get_text(FusionSANPage.ID_SAN_ALL_STATES_MANAGED,
                        1) == "Managed"):
        logger._log_to_console_and_log_file("Status Managed found")
    else:
        ui_lib.fail_test(
            "unable to find the Managed State, the value is" +
            ui_lib.get_text(FusionSANPage.ID_SAN_ALL_STATES_MANAGED, 1))
def add_user_input_filter(filter_name, values):
    logger._log_to_console_and_log_file(
        "Adding data to %s filter on san endpoints" % filter_name)
    selenium2lib = ui_lib.get_s2l()
    selenium2lib.maximize_browser_window()

    if (filter_name == 'endpoint'):
        xpath_filter = FusionSANPage.ID_SAN_ENDPOINTS_FILTER_ENDPOINT
    elif (filter_name == 'wwpn'):
        xpath_filter = FusionSANPage.ID_SAN_ENDPOINTS_FILTER_WWPN
    elif (filter_name == 'alias'):
        xpath_filter = FusionSANPage.ID_SAN_ENDPOINTS_FILTER_ALIAS
    elif (filter_name == 'online'):
        xpath_filter = FusionSANPage.ID_SAN_ENDPOINTS_FILTER_ONLINE
    elif (filter_name == 'zone'):
        xpath_filter = FusionSANPage.ID_SAN_ENDPOINTS_FILTER_ZONE

    else:
        logger._log_to_console_and_log_file(
            "Invalid action requested for san endpoints filter")
        return False

    try:
        ui_lib.wait_for_element_visible(xpath_filter, 20)
    except:
        pass

    ui_lib.wait_for_element_and_click(xpath_filter, 20)
    ui_lib.wait_for_element_and_input_text(xpath_filter, values)
def sanmanager_action_menu_set(action_option):
    xpath_action = FusionSANManagersPage.ID_MENU_ACTION_MAIN_BTN

    try:
        ui_lib.wait_for_element_visible(xpath_action, 5)
    except:
        pass

    ui_lib.wait_for_element_and_click(xpath_action)
    logger._log_to_console_and_log_file("Action= %s passed" % action_option)
    if (action_option == "Add"):
        ui_lib.wait_for_element_and_click(
            FusionSANManagersPage.ID_ACTIONS_ADD_SAN_MANAGER)
    elif (action_option == "Refresh"):
        ui_lib.wait_for_element_and_click(
            FusionSANManagersPage.ID_ACTIONS_REFRESH_SAN_MANAGER)
    elif (action_option == "Edit"):
        ui_lib.wait_for_element_and_click(
            FusionSANManagersPage.ID_ACTIONS_EDIT_SAN_MANAGER)
    else:
        logger._log_to_console_and_log_file(
            "Invalid action= %s passed for flatsan" % action_option)
        ui_lib.fail_test("unable to find the" + action_option + "action")

    return True
def validate_general_section_titles():
    xpath_section = FusionSANManagersPage.ID_MENU_VIEW_MAIN_BTN
    xpath_title1 = FusionSANManagersPage.ID_VIEW_GENERAL_SAN_MANAGER
    xpath_title3 = FusionSANManagersPage.ID_VIEW_ACTIVITY_SAN_MANAGER
    xpath_title4 = FusionSANManagersPage.ID_VIEW_MAP_SAN_MANAGER

    try:
        ui_lib.wait_for_element_visible(xpath_section, 5)
    except:
        pass
    ui_lib.wait_for_element_and_click(xpath_section)

    title = "General"
    if ((ui_lib.get_text(xpath_title1, 1)) == title):
        logger._log_to_console_and_log_file(title + "Section found")
    else:
        ui_lib.fail_test("unable to find the" + title + "section")

    title = "Activity"
    if ((ui_lib.get_text(xpath_title3, 1)) == title):
        logger._log_to_console_and_log_file(title + "Section found")
    else:
        ui_lib.fail_test("unable to find the" + title + "section")

    title = "Map"
    if ((ui_lib.get_text(xpath_title4, 1)) == title):
        logger._log_to_console_and_log_file(title + "Section found")
    else:
        ui_lib.fail_test("unable to find the" + title + "section")
    return True
 def wait_edit_time_and_locale_dialog_shown(cls,
                                            timeout=5,
                                            fail_if_false=True):
     logger.debug("wait edit time and locale dialog shown")
     ui_lib.wait_for_element_visible(
         EditTimeAndLocaleElements.ID_DIALOG_EDIT_TIME_AND_LOCALE, timeout,
         fail_if_false)
 def input_select_lig(cls, enc_no, switch_no, switch_lig, timeout=5):
     logger.debug("input and select logical interconnect group [ %s ] for <enclosure: %s, bay: %s>" % (switch_lig, enc_no, switch_no))
     ui_lib.wait_for_element_and_click(CreateEnclosureGroupElements.ID_COMBO_SEARCH_LIG % (enc_no, switch_no), timeout, fail_if_false=True)
     ui_lib.wait_for_element_and_click(CreateEnclosureGroupElements.ID_TBIRD_INPUT_LIG_CLEAR % (enc_no, switch_no), timeout, fail_if_false=True)
     ui_lib.wait_for_element_visible(CreateEnclosureGroupElements.ID_TBIRD_CHOOSE_LIG_LAYER % (enc_no, switch_no), timeout, fail_if_false=True)
     ui_lib.wait_for_element_and_click(CreateEnclosureGroupElements.ID_TBIRD_SELECT_OPTION_CHOOSE_LIG % (enc_no, switch_no, switch_lig), timeout, fail_if_false=True, js_click=True)
     ui_lib.wait_for_element_hidden(CreateEnclosureGroupElements.ID_TBIRD_CHOOSE_LIG_LAYER % (enc_no, switch_no), timeout, fail_if_false=True)
def edit_san_click_ok():
    xpath_edit = FusionSANPage.ID_SAN_EDIT_OK_BUTTON
    try:
        ui_lib.wait_for_element_visible(xpath_edit, 10)
    except:
        pass

    ui_lib.wait_for_element_and_click(xpath_edit)
def highlight_san(san_value):
    xpath_input = (FusionSANPage.ID_SAN_LIST + "[text()='%s']" % san_value)
    try:
        ui_lib.wait_for_element_visible(xpath_input, 5)
    except:
        pass
    logger._log_to_console_and_log_file("Highlighting san=%s" % san_value)
    ui_lib.wait_for_element_and_click(xpath_input)
def endpoints_click_download():
    xpath_download = FusionSANPage.ID_SAN_DOWNLOAD_ENDPOINTS
    try:
        ui_lib.wait_for_element_visible(xpath_download, 10)
    except:
        pass

    ui_lib.wait_for_element_and_click(xpath_download)
def edit_san_manager_click_cancel():
    xpath_cancel = FusionSANManagersPage.ID_BTN_EDIT_SAN_MANAGER_CANCEL
    try:
        ui_lib.wait_for_element_visible(xpath_cancel, 10)
    except:
        pass

    ui_lib.wait_for_element_and_click(xpath_cancel)
def edit_san_manager_click_ok():
    xpath_ok = FusionSANManagersPage.ID_BTN_EDIT_SAN_MANAGER_OK
    try:
        ui_lib.wait_for_element_visible(xpath_ok, 10)
    except:
        pass

    ui_lib.wait_for_element_and_click(xpath_ok)
def edit_user_input_pswd(password):
    xpath_password = FusionSANManagersPage.ID_SAN_EDIT_BNA_PSWD
    try:
        ui_lib.wait_for_element_visible(xpath_password, 10)
    except:
        pass

    ui_lib.wait_for_element_and_input_text(xpath_password, password)
def san_endpoints_click_update():
    xpath_update = FusionSANPage.ID_SAN_ENDPOINTS_UPDATE
    try:
        ui_lib.wait_for_element_visible(xpath_update, 10)
    except:
        pass

    ui_lib.wait_for_element_and_click(xpath_update)
def add_san_manager_click_type(stype):
    xpath_type = FusionSANManagersPage.ID_SELECT_BOX_LABEL + stype
    try:
        ui_lib.wait_for_element_visible(xpath_type, 10)
    except:
        pass

    ui_lib.wait_for_element_and_input_text(xpath_type, stype)
def add_user_input_port(port):
    xpath_port = FusionSANManagersPage.ID_SAN_MANAGER_BNA_PORT
    try:
        ui_lib.wait_for_element_visible(xpath_port, 10)
    except:
        pass

    ui_lib.wait_for_element_and_input_text(xpath_port, port)
def add_user_input_username(username):
    xpath_username = FusionSANManagersPage.ID_SAN_BNA_USER
    try:
        ui_lib.wait_for_element_visible(xpath_username, 10)
    except:
        pass

    ui_lib.wait_for_element_and_input_text(xpath_username, username)
def add_san_manager_click_add_plus():
    xpath_add_plus = FusionSANManagersPage.ID_BTN_SAN_MANAGER_ADD_PLUS
    try:
        ui_lib.wait_for_element_visible(xpath_add_plus, 10)
    except:
        pass

    ui_lib.wait_for_element_and_click(xpath_add_plus)
def add_user_input_host_name(host):
    xpath_host = FusionSANManagersPage.ID_SAN_BNA_HOST
    try:
        ui_lib.wait_for_element_visible(xpath_host, 10)
    except:
        pass

    ui_lib.wait_for_element_and_input_text(xpath_host, host)
def restore_from_backup(backupdirectory):
    """ Restore From Backup : restore backup for fusion appliance,

    NOTE : This code is dependent on download_backup function, execute download_backup then go for restore_from_backup

    PRE-REQUISITES :
        > AutoIT used to upload back-up file to the appliance.
          Steps to configure AUTOIT,
            1. Download autoit-v3-setup and pywin32-218.win-amd64-py2.7 (or pywin32-214.win32-py2.7) to your system
            2. register AUTOITX3 , type on cmd prompt:
                C:\Program Files (x86)\AutoIt3\AutoItX>regsvr32 AutoItX3_x64.dll
                OR
                C:\Program Files (x86)\AutoIt3\AutoItX>regsvr32 AutoItX3.dll
            3. Download and install AUTOIT module from robot framework website.

    """
    s2l = ui_lib.get_s2l()
    if not ui_lib.wait_for_element(FusionSettingsPage.ID_PAGE_LABEL):
        navigate()

    logger._log_to_console_and_log_file("Restore Backup")
    ui_lib.wait_for_element_and_click(FusionSettingsPage.ID_MENU_ACTION_MAIN_BTN)
    ui_lib.wait_for_element_and_click(FusionSettingsPage.ID_MENU_ACTION_RESTORE_FROM_BACKUP)
    ui_lib.wait_for_element_visible(FusionSettingsPage.ID_BTN_BROWSE_FILE, PerfConstants.RESTORE_BACKUP_CHOOSE_FILE)
    logger._log_to_console_and_log_file("Choose the restore backup file , " + backupdirectory + " from the path specified")
    # chooses the specific file
    for files in os.listdir(backupdirectory):
        filenamewithpath = os.path.join(backupdirectory, files)
        logger._log_to_console_and_log_file("File Name, along with the path  %s" % filenamewithpath)

    if not filenamewithpath:
        ui_lib.fail_test("Failed to find backup file ", True)

    s2l.choose_file(FusionSettingsPage.ID_BTN_BROWSE_FILE, filenamewithpath)
    ui_lib.wait_for_element_and_click(FusionSettingsPage.ID_BTN_BROWSE_FILE)

    # AutoIT code to click on open button
    # if os.name == "nt":
    # autoit = win32com.client.Dispatch("AutoItX3.Control")
    # autoit.ControlClick("File Upload", "", "Button1")

    s2l.wait_until_page_contains("This file is compatible", PerfConstants.FILE_COMPATIBILITY_CHECK)
    logger._log_to_console_and_log_file("uploaded backup file")
    s2l.select_checkbox(FusionSettingsPage.ID_CHECKBOX_RESTORE_CONFIRMATION)
    ui_lib.wait_for_element_and_click(FusionSettingsPage.ID_BTN_RESTORE_FROM_BACKUP)
    # need to confirm, by clicking the restore from backup button again
    ui_lib.wait_for_element_and_click(FusionSettingsPage.ID_BTN_RESTORE_FROM_BACKUP)

    # waiting for restore to finish
    ui_lib.wait_for_element(FusionSettingsPage.ID_LABEL_RESTORING_FROM_BACKUP, PerfConstants.RESTORING_LABEL_VISIBLE)
    ui_lib.wait_for_element_notvisible(FusionSettingsPage.ID_LABEL_RESTORING_FROM_BACKUP, PerfConstants.RESTORING_LABEL_VISIBLE)
    ui_lib.wait_for_element(FusionSettingsPage.ID_LABEL_RESTORING, PerfConstants.RESTORING_LABEL_VISIBLE)
    ui_lib.wait_for_element_notvisible(FusionSettingsPage.ID_LABEL_RESTORING, PerfConstants.RESTORE_DATA_FROM_BACKUP_TIME)
    logger._log_to_console_and_log_file("Restore Completed, checking if the login page is visible.")

    # final check for login page existence
    ui_lib.wait_for_element(FusionLoginPage.ID_BTN_LOGIN_BUTTON)
    logger._log_to_console_and_log_file("Restore Successful for Fusion Appliance")