def verify_if_ui_contents_matches_configuration(expected_converged_system):
    if (len(expected_converged_system.racks) == 0):
        is_contents_section_empty()
    else:
        # Read UI contents
        ui_contents = get_contents_from_UI()
        if (not compare_converged_systems_contents(expected_converged_system,
                                                   ui_contents)):
            ui_lib.fail_test(
                "Test has failed. The System Profile Contents does not corresponds to the expected."
            )

    return expected_converged_system
def navigateGeneral():
    logger._log_to_console_and_log_file("\t- Accessing 'General' View")
    ui_lib.wait_for_element_and_click(
        systemprofilesPage.ID_DROPDOWN_OPTION_OVERVIEW)
    ui_lib.wait_for_element_and_click(
        systemprofilesPage.ID_DROPDOWN_OPTION_GENERAL_VIEW)
    if ui_lib.wait_for_element_text(systemprofilesPage.ID_LABEL_GENERAL,
                                    "General"):
        logger._log_to_console_and_log_file(
            "\t- General View was correctly displayed")
        checkGeneralContents()
    else:
        ui_lib.fail_test("\t- Unable to change view to GENERAL perspective")
def verify_sanmanager_managedsans_count_link():
    logger._log_to_console_and_log_file(
        "Function call to validate managedsanscount link from Sanmanager")
    s2l = ui_lib.get_s2l()
    """ Navigate to SAN Manager Page """
    if not s2l._is_element_present(FusionSANManagersPage.ID_PAGE_LABEL):
        if not navigate():
            return False

    san_mangr_list = [
        ui_lib.get_webelement_attribute("text", el)
        for el in s2l._element_find(
            FusionSANManagersPage.ID_SAN_MANAGER_LIST_NAMES, False, False)
    ]
    for san_mangr in san_mangr_list:
        """ skip hp direct attach san manager - can not be deleted """
        if ((san_mangr.__contains__("OneView")
             or san_mangr.__contains__("Direct")) is False):
            logger._log_to_console_and_log_file("validating san manager %s" %
                                                san_mangr)
            ui_lib.wait_for_element_and_click(
                FusionSANManagersPage.ID_ELEMENT_SAN_MANAGER % san_mangr)
            xpath_section = FusionSANManagersPage.ID_LINK_SANSCOUNT
            try:
                ui_lib.wait_for_element_visible(xpath_section, 5)
            except:
                pass
            ui_lib.wait_for_element_and_click(xpath_section)
            san_page_title = FusionSANPage.ID_SAN_HEADING_TOP
            try:
                ui_lib.wait_for_element_visible(san_page_title, 5)
            except:
                pass
            title = "SANs"
            if ((ui_lib.get_text(san_page_title, 1)) == title):
                logger._log_to_console_and_log_file("Navigated to" + title +
                                                    "Page")
            else:
                ui_lib.fail_test("unable to navigate to" + title + "page")
            if not s2l._is_element_present(
                    FusionSANManagersPage.ID_PAGE_LABEL):
                if not navigate():
                    return False

        else:
            """ add to count so that len of list and count are equal """
            logger._log_to_console_and_log_file(
                "Flat san could not be validated")

    return True
def navigate():
    # Accessing "System Profile" page
    BuiltIn().sleep(1)
    logger._log_to_console_and_log_file(
        "\n- Accessing 'System Profile' Page...")
    ui_lib.wait_for_element_and_click(systemprofilesPage.ID_ONEVIEW_TAB)
    ui_lib.wait_for_element_and_click(
        systemprofilesPage.ID_LINK_SYSTEM_PROFILE)

    # Check if "System Profile" page was correctly displayed
    if ui_lib.wait_for_element_visible(systemprofilesPage.ID_PAGE_LABEL):
        logger._log_to_console_and_log_file("\t...Done.")
    else:
        ui_lib.fail_test("\t- Unable to access 'System Profile' page")
Пример #5
0
def return_to_create_pspage():
    """ Return to the create PS page """
    if ui_lib.wait_for_element_visible(i3sPlanScriptPage.ID_CANCEL_PS_BUTTON):
        ui_lib.wait_for_element_and_click(
            i3sPlanScriptPage.ID_CANCEL_PS_BUTTON)
        if ui_lib.wait_for_element_visible(
                i3sPlanScriptPage.ID_CANCEL_CONFIRMATION_FORM
        ):  # Wait for form to visible
            ui_lib.wait_for_element_and_click(
                i3sPlanScriptPage.ID_CANCEL_BUTTON_YES)
            if not ui_lib.wait_for_element(i3sPlanScriptPage.ID_PAGE_LABEL):
                ui_lib.fail_test("Failed to navigate to plan script page",
                                 True)
    return
Пример #6
0
def verify_san_actions_unauthorized_users(user):
    xpath_tab = FusionSANPage.ID_SAN_MENU_ACTION_MAIN_BTN
    xpath_tab_option1 = FusionSANPage.ID_SAN_MENU_ACTION_NOAUTH
    try:
        ui_lib.wait_for_element_visible(xpath_tab, 10)
    except:
        pass

    ui_lib.wait_for_element_and_click(xpath_tab)
    msg_name = "No authorization"
    if ((ui_lib.get_text(xpath_tab_option1, 1)) == msg_name):
        logger._log_to_console_and_log_file(msg_name + " msg found")
    else:
        ui_lib.fail_test("unable to find the" + msg_name + " msg")
 def verify_general_state(cls, expect_value, timeout=5, fail_if_false=True):
     actual_value = FusionUIBase.get_text(
         GeneralSANMangersElements.ID_TEXT_GENERAL_STATE, timeout,
         fail_if_false)
     if actual_value.lower().strip() == expect_value.lower().strip():
         logger.debug("san manager state is '%s' as expected" %
                      actual_value)
         return True
     else:
         msg = "san manager state is '%s' not as expected" % actual_value
         if fail_if_false is True:
             ui_lib.fail_test(msg)
         else:
             logger.warn(msg)
             return False
Пример #8
0
 def get_port_vlan_data(cls, index, timeout=5):
     logger.debug("Get Vlan Network data")
     j = index + 1
     ui_lib.wait_for_element_and_click(GeneralSwitchesElements.ID_SWITCH_EXPAND_TABLE_ROW % index, 90)
     if not ui_lib.wait_for_element_and_click(GeneralSwitchesElements.ID_SWITCH_PORT_TABLE_VLAN_LABEL % j, 120):
         ui_lib.fail_test("Vlan ID Lable is not visible")
     vlan_data = ui_lib.get_text(GeneralSwitchesElements.ID_SWITCH_PORT_TABLE_VLAN_DATA % j, 180)
     if not vlan_data:
         vlan_data = ui_lib.get_text(GeneralSwitchesElements.ID_SWITCH_PORT_TABLE_VLAN_DATA % j, 240)
     if not ui_lib.wait_for_element_and_click(GeneralSwitchesElements.ID_SWITCH_PORT_TABLE_VLAN_LABEL % j, 180):
         logger.debug("retrying to collapse the expanded port...")
         ui_lib.wait_for_element_visible(GeneralSwitchesElements.ID_SWITCH_PORT_TABLE_VLAN_LABEL % j, 90)
         ui_lib.wait_for_element_and_click(GeneralSwitchesElements.ID_SWITCH_PORT_TABLE_VLAN_LABEL % j, 150)
     ui_lib.wait_for_element_and_click(GeneralSwitchesElements.ID_SWITCH_EXPAND_TABLE_ROW % index, 90)
     return vlan_data
Пример #9
0
def return_to_create_dppage():
    '''Return to OEDP UI by clicking Cancel in Create oedp UI'''
    if ui_lib.wait_for_element_visible(
            i3sDeploymentPlanPage.ID_CANCEL_DP_BUTTON):
        ui_lib.wait_for_element_and_click(
            i3sDeploymentPlanPage.ID_CANCEL_DP_BUTTON)
        if ui_lib.wait_for_element_visible(
                i3sDeploymentPlanPage.ID_CANCEL_CONFIRM_FORM):
            ui_lib.wait_for_element_and_click(
                i3sDeploymentPlanPage.ID_CANCEL_PROCEED_BUTTON)
            if not ui_lib.wait_for_element(
                    i3sDeploymentPlanPage.ID_PAGE_LABEL):
                ui_lib.fail_test("Failed to navigate to OE Deployment page",
                                 True)
    return
def validate_page_title(pagetitle):
    if (pagetitle == 'SAN Managers'):
        xpath_title = FusionSANManagersPage.ID_PAGE_LABEL
    else:
        xpath_title = FusionSANPage.ID_PAGE_LABEL

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

    if ((ui_lib.get_text(xpath_title, 1)) == pagetitle):
        logger._log_to_console_and_log_file(pagetitle + " page found")
    else:
        ui_lib.fail_test("unable to find the" + pagetitle + " page")
def wait_for_blade_to_be_added(encSettings):
    logger._log_to_console_and_log_file(" Waiting for the blade be added...")
    if ui_lib.wait_for_element_visible(enclosuresPage.ID_BLADE %
                                       str(encSettings.expansionBayNumber),
                                       timeout=300):
        # Waiting for the blade be added...
        if ui_lib.wait_for_element_visible(enclosuresPage.ID_BLADE_OK %
                                           str(encSettings.expansionBayNumber),
                                           timeout=300):
            logger._log_to_console_and_log_file(
                "- Blade was successfully added")
        else:
            ui_lib.fail_test("- After 5 minutes, the blade status is NOT OK")
    else:
        ui_lib.fail_test("- Bay is empty")
 def wait_san_manager_status_ok_or_warn(cls,
                                        san_manager,
                                        timeout=10,
                                        fail_if_false=True):
     start = datetime.now()
     logger.debug(
         "waiting for san manager '%s' status indicates to ok or warning" %
         san_manager)
     while (datetime.now() - start).total_seconds() < timeout:
         if ui_lib.wait_for_element_visible(
                 GeneralSANMangersElements.ID_STATUS_SAN_MANAGER_OK %
                 san_manager,
                 timeout=5,
                 fail_if_false=False):
             logger.debug("san manager '%s' status is ok as expected." %
                          san_manager)
             return True
         elif ui_lib.wait_for_element_visible(
                 GeneralSANMangersElements.ID_STATUS_SAN_MANAGER_WARN %
                 san_manager,
                 timeout=5,
                 fail_if_false=False):
             logger.debug(
                 "san manager '%s' status is warning as expected." %
                 san_manager)
             return True
         elif ui_lib.wait_for_element_visible(
                 GeneralSANMangersElements.ID_STATUS_SAN_MANAGER_ERROR %
                 san_manager,
                 timeout=5,
                 fail_if_false=False):
             err_msg = "san manager '%s' status is error not as expected." % san_manager
             if fail_if_false is False:
                 logger.warn(err_msg)
                 return False
             else:
                 ui_lib.fail_test(err_msg)
         else:
             logger.debug(
                 "san manager '%s' status is unknown, waiting ..." %
                 san_manager)
             continue
     err_msg = "Timeout to wait for san manager '%s' status indicates to ok or warn." % san_manager
     if fail_if_false is False:
         logger.warn(err_msg)
         return False
     else:
         ui_lib.fail_test(err_msg)
Пример #13
0
    def verify_bulk_resource(cls, scope_obj, timeout=5, fail_if_false=True):
        logger.debug("verify bulk resource")
        logger.debug("verify bulk resource %s" % scope_obj)

        if ui_lib.wait_for_element_and_click(
                GeneralScopesElements.ID_TABLE_SCOPE_NAME % scope_obj, timeout,
                fail_if_false):
            if ui_lib.wait_for_element(
                    GeneralScopesElements.ID_RESOURCE_TABLE):
                scope_list = ui_lib.get_multi_elements_text(
                    GeneralScopesElements.ID_RESOURCE_TABLE, timeout,
                    fail_if_false)
                logger.info("scopelist is %s" % scope_list)
                return scope_list
        else:
            ui_lib.fail_test("Failed to get resource list")
Пример #14
0
def validate_network_does_not_exist(net_obj, fail_if_false=True):
    """
        Verify that the network does not exist
    """
    if isinstance(net_obj, test_data.DataObj):
        net_obj = [net_obj]
    return_code = True
    for net in net_obj:
        logger.info("Validating network '%s' does not exist" % net.name)
        rc = CommonOperationNetworks.verify_network_not_exist(
            net.name, fail_if_false=False)
        if not rc:
            logger.warn("Network %s does exist" % net.name)
            return_code = return_code and rc
    if fail_if_false is True:
        ui_lib.fail_test("Error: Some of networks exist")
    return return_code
def subtrack_rack_configuration(rack_name, converged_system):
    index = None
    for rack in converged_system.racks:
        if (rack.name == rack_name):
            index = converged_system.racks.index(rack)
            break
    if (index is None):
        ui_lib.fail_test("Couldn't find rack %s in this configuration" %
                         rack_name)
    # Removing the rack from the list
    converged_system.racks.pop(index)

    if (len(converged_system.racks) == 0):
        converged_system.storage_system = {}
        converged_system.server_profile_templates = {}

    return converged_system
    def verify_drives_view_drive_firmware(cls, drive):
        drive_bay = drive.bay
        drive_firmware = drive.firmware

        text = ui_lib.get_text(
            DriveEnclosuresElements.ID_DRIVES_VIEW_DRIVE_BAY_BY_NUMBER %
            drive_bay + "/" +
            DriveEnclosuresElements.ID_DRIVES_VIEW_FIRMWARE_POSITION,
            fail_if_false=True)
        if text == drive_firmware:
            logger.info(
                "Successfully verified that Drive %s has expected Firmware of '%s'"
                % (drive_bay, drive_firmware))
        else:
            ui_lib.fail_test(
                "Firmware: %s of Drive: %s did not match expected Firmware: '%s'"
                % (text, drive_bay, drive_firmware))
def validate_choose_alert_criteria(*alert_obj):
    """ Choose between the alert criteria Pre-defined to Guided to Advanced and validate
        that the same alert criteria is displayed across.
    """
    navigate()
    if isinstance(alert_obj, test_data.DataObj):
        alert_obj = [alert_obj]
    elif isinstance(alert_obj, tuple):
        alert_obj = list(alert_obj[0])

    for alert in alert_obj:
        _navigate_to_add_alert_filter_page(alert.name, alert.email)
        CreateAlertNotificationFilter.click_predefined_criteria_for_alert_filter(
        )
        CreateAlertNotificationFilter.click_predefined_allalerts()
        CreateAlertNotificationFilter.click_predefined_from_list()
        VerifyAlertFilter.verify_predefined_criteria_is_displayed()
        CreateAlertNotificationFilter.click_guided_criteria_for_alert_filter()
        VerifyAlertFilter.verify_guided_criteria_displayed()

        if CreateAlertNotificationFilter.get_predefined_criteria_selected(
        ) in CreateAlertNotificationFilter.get_guided_criteria_selected():
            logger.info("Predefined and guided alert criteria has same values")
        else:
            ui_lib.fail_test("Pre-defined guided values differ")
        CreateAlertNotificationFilter.click_guided_criteria_drop_down()
        CreateAlertNotificationFilter.click_guided_criteria_from_list()
        VerifyAlertFilter.verify_guided_criteria_displayed()
        CreateAlertNotificationFilter.click_advanced_criteria_for_alert_filter(
        )
        newtext = CreateAlertNotificationFilter.get_guided_criteria_selected(
        ).split()
        word = " "
        for x in newtext:
            word = word + " " + x

        advancedtext = word.strip(" ")
        if advancedtext.lower(
        ) in CreateAlertNotificationFilter.get_advanced_criteria_displayed():
            logger.info("Alert is displayed as a query")
        else:
            ui_lib.fail_test("Pre-defined guided values differ")
        CreateAlertNotificationFilter.click_cancel_edit_alert_filter()
        CreateAlertNotificationFilter.click_cancel_edit_notification()
    return True
def remove_unmanaged_device(*uds_obj):
    """ Delete Unmanaged device to appliance    """
    failed_times = 0
    selenium2lib = ui_lib.get_s2l()
    if not ui_lib.wait_for_element(FusionUnmanagedDevicePage.ID_PAGE_LABEL):
        navigate()

    if isinstance(uds_obj, test_data.DataObj):
        uds_obj = [uds_obj]
    elif isinstance(uds_obj, tuple):
        uds_obj = list(uds_obj[0])

    for uds in uds_obj:
        uds_list = [ui_lib.get_webelement_attribute("text", el) for el in selenium2lib._element_find(FusionUnmanagedDevicePage.ID_UDS_LIST_NAMES, False, False)]
        if uds.name not in uds_list:
            logger._warn("Unmanaged device '%s' does not exist" % uds.name)
            selenium2lib.capture_page_screenshot()
            failed_times = failed_times + 1
            continue

        logger._log_to_console_and_log_file("-----------------------------")
        logger._log_to_console_and_log_file("Removing Unmanaged device %s" % uds.name)
        logger._log_to_console_and_log_file("-----------------------------")

        ui_lib.wait_for_element_and_click(FusionUnmanagedDevicePage.ID_ELEMENT_UNAMANGED_DEVICE_BASE % uds.name)
        ui_lib.wait_for_element_and_click(FusionUnmanagedDevicePage.ID_MENU_ACTION_MAIN_BTN)
        ui_lib.wait_for_element_and_click(FusionUnmanagedDevicePage.ID_MENU_ACTION_REMOVE)
        ui_lib.wait_for_element_and_click(FusionUnmanagedDevicePage.ID_BTN_REMOVE_UD_CONFIRM)
        ui_lib.wait_for_element_remove(
            FusionUnmanagedDevicePage.ID_ELEMENT_UNAMANGED_DEVICE_BASE % uds.name, PerfConstants.DEFAULT_SYNC_TIME)

        logger._log_to_console_and_log_file("Checking whether Unmanaged device %s is Deleted or not" % uds.name)
        ui_lib.wait_for_element_visible(FusionUnmanagedDevicePage.ID_LINK_CREATE_UD)
        uds_list = [ui_lib.get_webelement_attribute("text", el) for el in selenium2lib._element_find(FusionUnmanagedDevicePage.ID_UDS_LIST_NAMES, False, False)]
        if uds.name not in uds_list:
            logger._log_to_console_and_log_file("Unmanaged device '%s' removed successfully" % uds.name)
        else:
            ui_lib.fail_test(" The Unmanaged device '%s' not removed successfully" % uds.name)
            selenium2lib.capture_page_screenshot()
            failed_times = failed_times + 1

    if failed_times > 0:
        return False
    else:
        return True
def __open_edit_system_profile_page():
    """
        Open Edit System Profile page through Actions>>Edit.
    """

    if not ui_lib.wait_for_element_visible(systemprofilesPage.ID_PAGE_LABEL):
        navigate()
    logger._log_to_console_and_log_file("\nGoing to Actions >> Edit...")
    ui_lib.wait_for_element_and_click(systemprofilesPage.ID_DROPDOWN_ACTIONS)
    ui_lib.wait_for_element_and_click(
        systemprofilesPage.ID_DROPDONW_OPTION_EDIT_ACTION)
    if not ui_lib.wait_for_element_visible(
            systemprofilesPage.ID_PAGE_TITLE_EDIT_SYSTEM_PROFILE):
        ui_lib.fail_test(
            "\nEdit System Profile page was not loaded correctly.",
            captureScreenshot=True)
    else:
        logger._log_to_console_and_log_file("\t... Done.")
def rename_system_profile(new_system_profile_name):
    """
        Rename a system profile.
    """

    __open_edit_system_profile_page()
    logger._log_to_console_and_log_file(
        "\n-Renaming system profile to \"%s\"." % new_system_profile_name)
    ui_lib.wait_for_element_and_input_text(
        systemprofilesPage.ID_INPUT_SYSTEM_PROFILE_NAME,
        new_system_profile_name)
    ui_lib.wait_for_element_and_click(
        systemprofilesPage.ID_BUTTON_EDIT_SYSTEM_PROFILE)
    if not ui_lib.wait_for_element_hidden(
            systemprofilesPage.ID_BUTTON_EDIT_SYSTEM_PROFILE,
            mantraSyncConstants.SYSTEM_PROFILE_TASK_TIMEOUT):
        ui_lib.fail_test("Update system profile failed!",
                         captureScreenshot=True)
Пример #21
0
def create_backup():
    """
    Create Backup : function to create fusion appliance backup
    """
    if not ui_lib.wait_for_element(FusionSettingsPage.ID_PAGE_LABEL):
        navigate()

    logger._log_to_console_and_log_file("Create 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_CREATE_BACKUP)
    ui_lib.wait_for_element_visible(FusionSettingsPage.ID_LABEL_BACKUP_NOTIFICATION)
    ui_lib.wait_for_element_and_click(FusionSettingsPage.ID_LABEL_BACKUP_NOTIFICATION)
    ui_lib.wait_for_element_and_click(FusionSettingsPage.ID_LABEL_CREATE_BACKUP)
    # waiting for the backup to be completed
    if ui_lib.wait_for_element_text(FusionSettingsPage.ID_LABEL_BACKUP_DETAILS, "Backup completed", PerfConstants.CREATE_BACKUP_TIMEOUT):
        logger._log_to_console_and_log_file("Create Backup Completed")
    else:
        ui_lib.fail_test("Failed to Create Backup", True)
Пример #22
0
def checkDashboardPage():

    if not ui_lib.wait_for_element_visible(DashboardPage.ID_PAGE_LABEL):
        navigate()

    FAILURE = False

    # Checking "Dashboard" page label
    logger._log_to_console_and_log_file("")
    if ui_lib.wait_for_element_visible(DashboardPage.ID_PAGE_LABEL):
        logger._log_to_console_and_log_file("- Dashboard page: OK ")
    else:
        logger._log_to_console_and_log_file("- Unable to access 'Dashboard' page")
        FAILURE = True

    # Check test result
    if FAILURE:
        ui_lib.fail_test("At least one page element was not found.")
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)
Пример #24
0
def validate_all_statuses_filter():
    xpath_statuses = FusionSANPage.ID_SAN_ALL_STATUSES
    logger._log_to_console_and_log_file(
        "Validate All Statuses Filter on the SAN Page  %s")
    try:
        ui_lib.wait_for_element_visible(xpath_statuses, 10)
    except:
        pass

    ui_lib.wait_for_element_and_click(xpath_statuses)

    if (ui_lib.get_text(FusionSANPage.ID_SAN_STATUSES_CRITICAL,
                        1) == "Critical"):
        logger._log_to_console_and_log_file("Status Critical found")
    else:
        ui_lib.fail_test(
            "unable to find the Critical Status, the value is" +
            ui_lib.get_text(FusionSANPage.ID_SAN_STATUSES_CRITICAL, 1))
    if (ui_lib.get_text(FusionSANPage.ID_SAN_STATUSES_WARNING,
                        1) == "Warning"):
        logger._log_to_console_and_log_file("Status Warning found")
    else:
        ui_lib.fail_test(
            "unable to find the Warning Status, the value is" +
            ui_lib.get_text(FusionSANPage.ID_SAN_STATUSES_WARNING, 1))
    if (ui_lib.get_text(FusionSANPage.ID_SAN_STATUSES_OK, 1) == "OK"):
        logger._log_to_console_and_log_file("Status OK found")
    else:
        ui_lib.fail_test("unable to find the OK Status, the value is" +
                         ui_lib.get_text(FusionSANPage.ID_SAN_STATUSES_OK, 1))
    if (ui_lib.get_text(FusionSANPage.ID_SAN_STATUSES_UNKNOWN,
                        1) == "Unknown"):
        logger._log_to_console_and_log_file("Status Unknown found")
    else:
        ui_lib.fail_test(
            "unable to find the Unknown Status, the value is" +
            ui_lib.get_text(FusionSANPage.ID_SAN_STATUSES_UNKNOWN, 1))
    if (ui_lib.get_text(FusionSANPage.ID_SAN_STATUSES_DISABLED,
                        1) == "Disabled"):
        logger._log_to_console_and_log_file("Status Disabled found")
    else:
        ui_lib.fail_test(
            "unable to find the Disabled Status, the value is" +
            ui_lib.get_text(FusionSANPage.ID_SAN_STATUSES_DISABLED, 1))
def login(user_name):
    s2l = ui_lib.get_s2l()
    logger._log_to_console('Login status = {0}'.format(str(base_page.logged_in())))

    if base_page.logged_in():
        base_page.logout()

    user = test_data.get_user_by_name(user_name)

    # check the existing login status
    logger._log_to_console_and_log_file("Logging into i3S as {0}/{1}".format(user.name, user.password))
    if s2l._is_element_present(i3SLoginPage.ID_BTN_EULA_AGREE):
        s2l.click_button(i3SLoginPage.ID_BTN_EULA_AGREE)

    s2l.wait_until_page_contains_element(i3SLoginPage.ID_BTN_LOGIN_BUTTON)
    s2l.input_text(i3SLoginPage.ID_INPUT_LOGIN_USER, user.name)
    s2l.input_text(i3SLoginPage.ID_INPUT_LOGIN_PASSWORD, user.password)

    # code to login as  active directory user
    if(user.has_property("domainName")):
        s2l.click_element(i3SLoginPage.ID_ELEMENT_AUTHN_PROVIDER)
        dirListObj = i3SLoginPage.ID_ELEMENT_DIR % user.domainName.strip()

        s2l.click_element(dirListObj)
        activedir = s2l.get_text(i3SLoginPage.ID_COMBO_AUTHN_PROVIDER)
        if not activedir == user.domainName.strip():
            logger._warn("Not able to login to the appliance with active directory users ..")
            ui_lib.fail_test("not able to login as active directory users... verify AD users and groups is added to the appliance")

    s2l.click_button(i3SLoginPage.ID_BTN_LOGIN_BUTTON)
    # These elements may not exist if the login page is transitioning to the dashboard
    # page.  In order to avoid failing conditions, we will catch any exceptions
    try:
        s2l.element_should_not_be_visible(i3SLoginPage.ID_ALL_ERROR_FIELDS)
        s2l.element_text_should_be(i3SLoginPage.ID_LABEL_LOGIN_STATUS, "")
    except:
        pass

    s2l.wait_until_page_contains_element(i3SDashboardPage.ID_PAGE_LABEL,
                                         UiConstants.i3S_LOGIN_TIME,
                                         "Failed to load the Login Page")
    base_page.set_logged_user(user_name)
    logger._log_to_console_and_log_file("Logged into i3S as {0}".format(base_page.get_logged_user()))
    return True
    def click_collapser_and_verify_expanded(cls, drive):
        drive_bay = drive.bay

        ui_lib.wait_for_element_and_click(
            DriveEnclosuresElements.
            ID_DRIVES_VIEW_COLLAPSER_BY_DRIVE_BAY_NUMBER % drive_bay,
            fail_if_false=True)

        expand_was_successful = ui_lib.wait_for_element(
            DriveEnclosuresElements.
            ID_DRIVES_VIEW_EXPANDED_COLLAPSER_BY_DRIVE_BAY_NUMBER % drive_bay)

        if expand_was_successful:
            logger.info("Collapser expanded successfully for Drive: %s" %
                        drive_bay)
        else:
            ui_lib.fail_test(
                "Collapser did not expand successfully for Drive: %s" %
                drive_bay)
def is_contents_section_empty():
    """
        Verify if the Rack Table in System Profile Edit page is empty
    """

    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\t- Verifying if contents section is empty,\n\t once there are no racks associated to the System Profile."
    )
    if not (ui_lib.wait_for_element_text_match(
            systemprofilesPage.OVERVIEW_CONTENTS,
            mantraConstants.EMPTY_OVERVIEW_CONTENTS_MESSAGE)):
        ui_lib.fail_test(
            "System Profile Contents was not empty or was not able to retrieve data. Check the screenshot.",
            captureScreenshot=True)
def validate_system_profile_name(system_profile_name):
    """
        Verify if a System Profile Title is according to the name provided.
    """

    if not ui_lib.wait_for_element_visible(systemprofilesPage.ID_PAGE_LABEL):
        navigate()
    logger._log_to_console_and_log_file(
        "\nVerifying if system profile name is \"%s\" as expected..." %
        system_profile_name)
    if ui_lib.element_text_matches(
            systemprofilesPage.ID_LABEL_SYSTEM_PROFILE_NAME,
            system_profile_name):
        logger._log_to_console_and_log_file(
            "\tSystem profile correctly checked!")
    else:
        ui_lib.fail_test(
            "\tThe system profile name provided does not match. The System Profile name displayed was \"%s\"."
            % ui_lib.get_text(systemprofilesPage.ID_LABEL_SYSTEM_PROFILE_NAME))
Пример #29
0
def check_ok():
    # While we have enclosure in the list, check the status
    enc_number = 1
    while enc_number:
        # Setting the enclosure number
        enclosure_xpath = "xpath=//html/body/div[2]/div[3]/div/div[2]/div[1]/div[1]/div/div[2]/table/tbody/tr[" + str(enc_number) + "]/td[2]"
        # Check if the enclosure is present
        if ui_lib.wait_for_element_and_click(enclosure_xpath):
            BuiltIn().sleep(1)
            # Checking if the status is OK
            if ui_lib.wait_for_element_text(MantraCompliancePage.ID_EXPECTED_VALUE, "= 1"):
                logger._log_to_console_and_log_file("Enclosure " + str(enc_number) + " is OK")
            else:
                logger._log_to_console_and_log_file("Enclosure " + str(enc_number) + " is NOT OK")
                ui_lib.fail_test("Test FAILED")
            enc_number += 1
        else:
            logger._log_to_console_and_log_file("No more enclosures")
            break
Пример #30
0
 def verify_filter_by_scope(cls,
                            xpath_id,
                            name,
                            timeout=5,
                            fail_if_false=True):
     logger.debug("select scope %s" % name)
     if not ui_lib.wait_for_element_and_click(
             VerifyScopesElements.ID_SCOPE_TABLE % xpath_id, timeout,
             fail_if_false):
         return ui_lib.fail_test("failed to find the element")
     ui_lib.wait_for_element_and_click(
         VerifyScopesElements.ID_ALL_SCOPE % xpath_id, timeout,
         fail_if_false)
     if not ui_lib.wait_for_element_and_click(
             VerifyScopesElements.ID_FILTER_BY_TABLE_ITEM %
         (xpath_id, name), timeout, fail_if_false):
         return ui_lib.fail_test("failed to find element")
     CommonOperationScopes.set_allscope_as_default(xpath_id)
     return True