示例#1
0
def _click_used_by_server_profile(sht_name):
    # check server hardware type information by server profile
    from FusionLibrary.ui.business_logic.servers.serverprofiles import CommonOperationServerProfile

    try:
        CommonOperationServerHardwareType.click_used_by_server_profile()
    except:
        logger.warn(
            "Server hardware type [ %s ] are not used by any server profile" %
            sht_name)
        return False

    server_profile_list = CommonOperationServerProfile.get_server_profile_list(
    )

    for sp_name in server_profile_list:
        CommonOperationServerProfile.click_server_profile(sp_name)
        FusionUIBase.select_view_by_name('General', fail_if_false=False)
        got_sht_name = CommonOperationServerProfile.get_server_hardware_type_of_server_profile(
            sp_name, fail_if_false=False)
        if got_sht_name != sht_name:
            ui_lib.get_s2l().capture_page_screenshot()
            logger.warn(
                "Server profile [%s] doesn't have server hardware type [%s]" %
                (sp_name, sht_name))
            return False
        logger.info("Server profile [%s] has server hardware type [%s]" %
                    (sp_name, sht_name))

    return True
示例#2
0
def add_latest_firmware_bundle(fwbundles):
    # Adding the latest firmware bundles to the appliance
    logger.debug("Adding the latest firmware bundles")
    navigate()
    uploaded = 0
    for fwbundle in fwbundles:
        spp_repo = fwbundle.repo
        spp_ext = fwbundle.ext
        spp_filter = fwbundle.filter
        logger.debug(
            "Adding the latest firmware bundle with repo [%s] extension [%s] and filter [%s]"
            % (spp_repo, spp_ext, spp_filter))
        fwbundle.spp = VsphereKeywords().get_LatestBuild_name(
            spp_repo, "", spp_ext, spp_filter)
        logger.debug("Latest firmware bundle is [%s]" % fwbundle.spp)
        uploaded = _add_firmware_bundle(fwbundle, uploaded)
        CommonOperationFirmwareBundle.refresh_browser_on_firmware_page()

    if len(fwbundles) == uploaded:
        logger.debug(
            "SUCCESS : Added all the Firmware bundles mentioned in the data file."
        )
        return True
    else:
        logger.warn(
            "FAILURE : Not able to add all Firmware Bundles as mentioned in the data file."
        )
        ui_lib.get_s2l().capture_page_screenshot()
        return False
示例#3
0
def _click_used_by_server_hardware(sht_name):

    from FusionLibrary.ui.business_logic.servers.serverhardware import CommonOperationServerHardware

    try:
        CommonOperationServerHardwareType.click_used_by_server_hardware()
    except:
        logger.warn(
            "Server hardware type [ %s ] are not used by any server hardware" %
            sht_name)
        return False

    server_name_list = CommonOperationServerHardware.get_server_hardware_list()
    for server_name in server_name_list:
        CommonOperationServerHardware.click_server_hardware(server_name)
        FusionUIBase.select_view_by_name(view_name='Hardware',
                                         timeout=8,
                                         fail_if_false=False)
        got_sht_name = CommonOperationServerHardware.get_server_hardware_type(
            server_name, fail_if_false=False)
        if got_sht_name != sht_name:
            ui_lib.get_s2l().capture_page_screenshot()
            logger.warn(
                "Server hardware [%s] doesn't have server hardware type [%s]" %
                (server_name, sht_name))
            return False

        logger.info("Server hardware [%s] has server hardware type [%s]" %
                    (server_name, sht_name))

    return True
 def input_license_key(cls, license_key, timeout=5):
     logger.debug("input [ %s ... ] into license key text box" %
                  license_key[0:10])
     ui_lib.wait_for_element_visible(
         AddLicensesElements.ID_INPUT_LICENSE_KEY,
         timeout,
         fail_if_false=True)
     element = ui_lib.get_s2l()._element_find(
         AddLicensesElements.ID_INPUT_LICENSE_KEY,
         first_only=True,
         required=True)
     ui_lib.get_s2l()._current_browser().execute_script(
         "$(arguments[0]).val('%s');return true;" % license_key, element)
示例#5
0
def select_power_delivery_device(pddname):
    """ This function is to Select Power Delivery Device
    select_power_delivery_device

        Example:
       select_power_delivery_device(pddname)
    """
    selenium2lib = ui_lib.get_s2l()
    navigate()

    if selenium2lib._is_element_present(
            FusionPowerDeliveryDevicePage.ID_PAGE_LABEL):
        """ check for Power Delivery Device exists """
        if not (selenium2lib._is_element_present(
                FusionPowerDeliveryDevicePage.ID_ELEMENT_PDD_NAME_BASE %
                pddname.strip())):
            logger._warn("Power Delivery Device '%s' is not present" % pddname)
            selenium2lib.capture_page_screenshot()
            return False
        else:
            """ Select if Power Delivery Device exists """
            ui_lib.wait_for_element_and_click(
                FusionPowerDeliveryDevicePage.ID_ELEMENT_PDD_NAME_BASE %
                pddname.strip())
            ui_lib.wait_for_element(
                FusionPowerDeliveryDevicePage.ID_ELEMENT_PDD_NAME_BASE %
                pddname.strip() +
                "/ancestor::tr[contains(@class, hp-selected)]")
            #             logger._log_to_console_and_log_file("Selected the Power Delivery Device %s successfully" % pddname)
            return True
    else:
        logger._log_to_console_and_log_file(
            "Fail in navigating to Power Delivery Device Page")
        selenium2lib.capture_page_screenshot()
        return False
示例#6
0
def help_on_this_page_header():
    """
    This function compare between header with respective sub menu page
    """
    # get a reference to the selenium lib
    s2l = ui_lib.get_s2l()

    # get current page_name using FusionUIBaseElements.ID_PAGE_LABEL
    page_name = get_page_name()

    # capture the title to come back
    prev_title = s2l.get_title()

    # get header of help page after clicking on "Help on this page"
    navigate_help_page(FusionUIBaseElements.ID_HELP_ON_THIS_PAGE)

    # replace white space by _, creating header string to find xpath from repository
    header = page_name.replace(" ", "_") + "_header"

    # get help file header using xpath in repos
    page_header = s2l.get_text("xpath=//h1[@class='firsttitle']")

    # return control back to main browser
    s2l.select_window(prev_title)

    # verify header of help file matched with page name
    if page_name == page_header:
        logger._log_to_console_and_log_file(
            ' Passed: Page name ("%s") and header of Help page ("%s")' %
            (page_name, page_header))
    else:
        ui_lib.fail_test(
            'Failed: Page name ("%s") and header of Help page ("%s")' %
            (page_name, page_header))
示例#7
0
def filter_by_label_logical_switch_groups(*net_obj):

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

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

    for net in net_obj:
        logger._log_to_console_and_log_file("Filtering LSG by label %s" %
                                            net.name)
        ui_lib.wait_for_element_and_click(FusionLSGPage.ID_FILTER_RESET)
        ui_lib.wait_for_element_and_click(FusionLSGPage.ID_FILTER_LABEL)
        ui_lib.wait_for_element_and_click(
            "//*[@id='cic-torswitchgroup-labels-filter']/ol/li[contains(.,'%s')]"
            % net.name)
        if ui_lib.wait_for_element(FusionLSGPage.ID_ELEMENT_LSG_NAME_BASE %
                                   net.lsgname):
            logger._log_to_console_and_log_file("LSG '%s' is present" %
                                                net.lsgname)
        else:
            return False
        ui_lib.wait_for_element_and_click(FusionLSGPage.ID_FILTER_RESET)
    return True
def verify_sanmanagers_count_dashboard(*sanmanager_obj):
    logger._log_to_console_and_log_file(
        "Function call to Add dashboard panel and validate sanmanagers count from Dashboard"
    )
    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_managers_count = ui_lib.get_text(
        FusionSANManagersPage.ID_SAN_MANAGERS_COUNT, 2)
    """ Retrieve data from datasheet """
    if isinstance(sanmanager_obj, test_data.DataObj):
        sanmanager_obj = [sanmanager_obj]
    elif isinstance(sanmanager_obj, tuple):
        sanmanager_obj = list(sanmanager_obj)
    """ Navigate to Dashboard Page  *sanmanager_obj """
    fusion_ui.dashboard.navigate()
    fusion_ui.dashboard.create_dashboard(sanmanager_obj)
    #    fusion_ui.dashboard.verify_dashboard_exist(sanmanager_obj)
    fusion_ui.dashboard.navigate()
    san_managers_count_dashboard = ui_lib.get_text(
        FusionSANManagersPage.ID_DASHBOARD_SAN_MANAGERS_COUNT, 1)
    if (san_managers_count == san_managers_count_dashboard):
        logger._log_to_console_and_log_file(
            "successfully verified dashboard san managers count")
        return True
    else:
        message = "Dashboard san managers count failed to match with actual sanmanagers count"
        raise AssertionError(message)
示例#9
0
def get_errors_on_form(form_id):
    '''
    Function to get all the errors seen on the form - Common for Create and edit operations
    Return error string separated by '\t' if errors are present else returns None
    '''

    # if errors are seen then return a string of errors separated by \t else None
    error_elements = []
    error_string = ''
    selenium2libObj = ui_lib.get_s2l()
    try:
        error_elements = selenium2libObj._current_browser().find_element_by_id(
            form_id).find_elements_by_class_name("hp-error")
    except:
        error_elements = []
    if error_elements:
        logger._warn("Displaying Following errors : ...")
        for errorelement in error_elements:
            if errorelement.text is not None and errorelement.text != "":
                logger._warn("Error - '{}' for element : '{}'".format(
                    errorelement.text, errorelement.get_attribute("for")))
                error_string += errorelement.text + '\t'
        return error_string
    else:
        return None
def close_add_san_manager_dialog():
    xpath_dialog_title = FusionSANManagersPage.ID_ADD_SAN_MANAGER_TITLE3
    xpath_cancel = FusionSANManagersPage.ID_BTN_SAN_MANAGER_CANCEL

    def is_dialog_open(self):
        if not ui_lib.wait_for_element_visible(xpath_dialog_title):
            return True
        try:
            logger._info('Clicking %s' % xpath_cancel)
            ui_lib.wait_for_element_and_click(xpath_cancel, 5)
            logger._info('Waiting for [Add SAN Manager] dialog close')


#            ui_base.wait_elt_disappear(xpath_dialog_title, 10)
#            if ui_lib.wait_for_element_visible(xpath_dialog_title):
#                return False
        except:
            return False
        return True

    selenium2lib = ui_lib.get_s2l()
    timeout = CONF_DICT['timeout'] or 10
    wait = WebDriverWait(selenium2lib._current_browser(), timeout,
                         CONF_DICT['speed'], StaleElementReferenceException)
    return wait.until(is_dialog_open)
def del_directory_server(dServer, fail_on_err):
    """ del directory server from the appliance
        Example:
        settings.del_directory_users_and_groups(dServer, fail_on_err)
    """

    # Navigate to the 'Settings' page
    navigate()
    selenium2lib = ui_lib.get_s2l()
    # Find the 'Security' Frame
    ui_lib.wait_for_element(FusionSettingsPage.ID_ELEMENT_SECURYTY_HEADER)
    # Does the server exist in 'Directories' field (list of existing directories).
    directories = selenium2lib.get_text(FusionSettingsPage.ID_ELEMENT_DIRECTORIES)
    if dServer.domainName in directories:
        logging._log_to_console_and_log_file("Removing directory server '%s'" % dServer.domainName)
        # Press the Edit Icon (next to Security).
        ui_lib.wait_for_element_and_click(FusionSettingsPage.ID_SECURITY_EDIT)
        # wait until table is visible
        ui_lib.wait_for_element(FusionSettingsPage.ID_BTN_ADD_DIRECTORY_SETTINGS)
        # click X to delete the server
        ui_lib.wait_for_element_and_click(FusionSettingsPage.ID_DIRECTORY_DEL % dServer.domainName)
        # confirm yes
        ui_lib.wait_for_element_and_click(FusionSettingsPage.ID_REMOVE_SERVER_YES_BUTTON)
        # validate server is deleted
        if ui_lib.wait_for_element(FusionSettingsPage.ID_ELEMENT_SERVER_ALREADY_ADDED):
            logging._log_to_console_and_log_file("ERROR deleting the directory server '%s' was not deleted" % dServer.domainName)
            return False
    else:
        if fail_on_err:
            logging._log_to_console_and_log_file("Cannot delete - directory server did not exist in the list: '%s'" % dServer.domainName)
            ui_lib.fail_test("Cannot delete - directory server did not exist: '%s'" % dServer.domainName)
        return False
def open_add_san_manager_dialog_page():
    xpath_dialog_title = FusionSANManagersPage.ID_ADD_SAN_MANAGER_TITLE
    xpath_add_san_manager_link = FusionSANManagersPage.ID_ADD_SAN_MANAGER

    def is_dialog_open(self):
        if ui_lib.wait_for_element_visible(xpath_dialog_title):
            return True
        try:
            logger._info('Clicking %s' % xpath_add_san_manager_link)
            ui_lib.wait_for_element_and_click(xpath_add_san_manager_link, 5)
            logger._info('Waiting for [Add San Manager] dialog open')


#           ui_lib.wait_for_element_visible(xpath_dialog_title, 10)
#            if not ui_lib.wait_for_element_visible(xpath_dialog_title):
#                return False
        except:
            return False
        return True

    selenium2lib = ui_lib.get_s2l()
    timeout = CONF_DICT['timeout'] or 10
    wait = WebDriverWait(selenium2lib._current_browser(), timeout,
                         CONF_DICT['speed'], StaleElementReferenceException)
    return wait.until(is_dialog_open)
def check_availability_licenses(strlicense):
    """ check_availability_licenses

        Example:
        | check_availability_licenses("HP OneView")
    """

    s2l = ui_lib.get_s2l()

    """ Call function to navigate to licenses """
    if not ui_lib.wait_for_element(FusionSettingsPage.ID_PAGE_LABEL):
        _Navigate_To_Licenses()

    """ Check the availability of license in Licenses Page and get the License Number """
    if ui_lib.wait_for_element(FusionSettingsPage.ID_LICENSE_AVAILABILITY % strlicense):
        ui_lib.wait_for_element_and_click(FusionSettingsPage.ID_AVAILABLE_LICENSE % strlicense)
        intAvailableLicense = s2l._get_text(FusionSettingsPage.ID_AVAILABLE_LICENSE % strlicense)
        intAvlLicense = intAvailableLicense.split()

        if int(intAvlLicense[0].strip()) > 0:
            logger._log_to_console_and_log_file("License %s available with %s licenses" % (strlicense, str(intAvlLicense[0])))
            return True
        else:
            logger._log_to_console_and_log_file("License %s available with %s licenses" % (strlicense, str(intAvlLicense[0])))
            return False
    else:
        logger._log_to_console_and_log_file("License %s not available " % strlicense)
        return False
def _add_custom_range(addrange, table_locator):
    """
        _add_custom_range(addrange)
        function called when adding custom range while editing address and identifier on settings page
    """
    s2l = ui_lib.get_s2l()
    ui_lib.wait_for_element_and_input_text(FusionSettingsPage.ID_INPUT_ADD_CUSTOM_RANGE_FROM, addrange.rangefrom)
    ui_lib.wait_for_element_and_input_text(FusionSettingsPage.ID_INPUT_ADD_CUSTOM_RANGE_TO, addrange.to)
    ui_lib.wait_for_element_and_input_text(FusionSettingsPage.ID_INPUT_ADD_CUSTOM_RANGE_COUNT, addrange.count)

    # check for errors, if any !! click cancel and proceed for the next add custom WWN
    actual_xpath_count = len(s2l._element_find(FusionSettingsPage.ID_LABEL_ERROR_ADD_CUSTOM, False, False))
    if int(actual_xpath_count) != 0:
        logger._warn(" custom range add failed as there is error while filling info, Custom range from : '%s'" % addrange.rangefrom)
        ui_lib.wait_for_element_and_click(FusionSettingsPage.ID_BTN_CANCEL_MAC_CUSTOM_ADD)
        return False
    else:
        # No Error, Clicking on add
        ui_lib.wait_for_element_and_click(FusionSettingsPage.ID_BTN_ADD_CUSTOM_RANGE)
        if ui_lib.wait_for_element_visible(FusionSettingsPage.ID_LABEL_CUSTOM_ADD_OVERLAPPING_ERROR):
            ui_lib.wait_for_element_and_click(FusionSettingsPage.ID_BTN_CANCEL_MAC_CUSTOM_ADD)
            logger._warn(" Cannot create overlapping pool. Please select a different range, CURRENT RANGE PASSED - '%s'" % addrange.rangefrom)
            return False
        else:
            # check for custom range in table after addition.
            from_element = s2l._table_element_finder.find_by_content(s2l._current_browser(), table_locator, addrange.rangefrom)
            to_element = s2l._table_element_finder.find_by_content(s2l._current_browser(), table_locator, addrange.to)

            if from_element is None or to_element is None:
                logger._warn(" Custom Range not reflecting in table, range starting from %s" % addrange.rangefrom)
                return False
            else:
                logger._log_to_console_and_log_file("Added CUSTOM RANGE starting from %s" % addrange.rangefrom)
                return True
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
示例#16
0
def select_server_hardware_type(hardware_type_name):
    """ Select Hardware Type  """
    navigate()

    logger.info("Select server hardware type - %s" % hardware_type_name)
    if VerifyServerHardwareType.verify_sht_exist(hardware_type_name,
                                                 fail_if_false=False):
        CommonOperationServerHardwareType.click_sht(hardware_type_name)
        CommonOperationServerHardwareType.wait_sht_title_display(
            hardware_type_name)
        return True
    else:
        logger.warn("Server hardware type '{0}' does not exist".format(
            hardware_type_name))
        ui_lib.get_s2l().capture_page_screenshot()
        return False
def navigate_base(currentpage, menulink, itemcount):
    s2l = ui_lib.get_s2l()
    logger._log_to_console_and_log_file(
        'Navigating to "{0}"'.format(currentpage))
    if not s2l._is_element_present(currentpage):
        ui_lib.wait_for_element(i3SBasePage.ID_MAIN_MENU_CONTROL,
                                PerfConstants.DEFAULT_SYNC_TIME)
        ui_lib.wait_for_element_and_click(i3SBasePage.ID_MAIN_MENU_CONTROL,
                                          PerfConstants.DEFAULT_SYNC_TIME)
        ui_lib.wait_for_element(i3SBasePage.ID_MENU_LINK_DASHBOARD,
                                PerfConstants.DEFAULT_SYNC_TIME)
        ui_lib.wait_for_element_and_click(menulink,
                                          PerfConstants.DEFAULT_SYNC_TIME)
        s2l.wait_until_page_contains_element(currentpage,
                                             PerfConstants.DEFAULT_SYNC_TIME)
    # wait for the page to get loaded
    s2l.wait_until_page_contains_element(itemcount,
                                         PerfConstants.DEFAULT_SYNC_TIME)
    # added wait to remove int Base 10 conversion error while running with Selenium speed 0.0
    BuiltIn().sleep(1)
    for x in range(1, 5):
        try:
            el = int(s2l.get_text(itemcount))
        except ValueError:
            BuiltIn().sleep(1)
            pass
    while el >= 0:
        BuiltIn().sleep(0.1)
        tmp_el = int(s2l.get_text(itemcount))
        if el == tmp_el:
            break
示例#18
0
def _validate_general_information(hw_type, data_list):
    # Validating general tab information
    return_val = True
    selenium2lib = ui_lib.get_s2l()
    model = str(
        selenium2lib._get_text(FusionServerHardwareTypePage.ID_MODEL_TEXT))
    formfactor = str(
        selenium2lib._get_text(
            FusionServerHardwareTypePage.ID_FORMFACTOR_TEXT))
    if ([model, formfactor] == data_list):
        logger._log_to_console_and_log_file(
            "Values retrieved for the hardware type %s from appliance is %s and values from devices is %s"
            % (hw_type, str([model, formfactor]), str(data_list)))
        logger._log_to_console_and_log_file(
            "Server Hardware type general information is matching properly for the type: %s"
            % hw_type)
    else:
        logger._warn(
            "Values retrieved for the hardware type %s from appliance is %s and values from devices is %s"
            % (hw_type, str([model, formfactor]), str(data_list)))
        logger._warn(
            "Server Hardware type general information is mismatching for the type: %s"
            % hw_type)
        return_val = False
    return return_val
def navigate_to_san_managers_page_negative(renavigate=False):
    if not renavigate and ui_lib.wait_for_element_visible(
            FusionSANManagersPage.ID_PAGE_LABEL):
        logger._info('Label [SAN Managers] is shown')
        return True

    def page_navigated(self):
        xpath_main_menu = FusionUIBaseElements.ID_MAIN_MENU_CONTROL
        xpath_page_label = FusionSANManagersPage.ID_PAGE_LINK
        #       xpath_details_title = FusionSANManagersPage.DETAILS_TITLE
        try:
            style = ui_lib.get_webelement_attribute(locator=xpath_main_menu,
                                                    attribute='style')
            if 'width' not in style:
                logger._info('Clicking Main Menu [%s]' % xpath_main_menu)
                ui_lib.wait_for_element_and_click(xpath_main_menu)

            logger._info('Waiting for link [SAN Managers] shown')
            ui_lib.wait_for_element_visible(xpath_page_label, 5)
            logger._info('Clicking [SAN Managers] [%s]' % xpath_page_label)
            ui_lib.wait_for_element_and_click(xpath_page_label)
            logger._info('Waiting for page label [SAN Managers] shown')

        except:
            return False

        return True

    selenium2lib = ui_lib.get_s2l()
    timeout = CONF_DICT['timeout'] or 10
    wait = WebDriverWait(selenium2lib._current_browser(), timeout,
                         CONF_DICT['speed'], StaleElementReferenceException)
    logger._info('Waiting for navigation')
    return wait.until(page_navigated)
def validate_tab_required():
    logger._log_to_console_and_log_file(
        "Function call to validate tabs on SAN managers")
    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:
        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)

        if ((san_mangr.__contains__("OneView")
             or san_mangr.__contains__("Direct")) is False):
            '''validate_general_section_titles()'''
            logger._log_to_console_and_log_file("san manager= %s" % san_mangr)
            validate_general_section_titles()
            sanmanager_actions_validate()

        else:
            logger._log_to_console_and_log_file(
                "Flat san found as san manager")
            sanmanager_actions_flatsan_validate()

    return True
示例#21
0
def browse_help_page_header():
    """
        This function compare between header with respective sub menu page
    """
    # get a reference to the selenium lib
    s2l = ui_lib.get_s2l()

    # capture the title to come back
    prev_title = s2l.get_title()

    # get current page_name using FusionUIBaseElements.ID_PAGE_LABEL
    page_name = get_page_name()

    # get header of help page after clicking on "Browse help"
    navigate_help_page(FusionUIBaseElements.ID_BROWSE_HELP)

    page_header = s2l.get_text("xpath=//h1[@class='firsttitle']")

    # return control back to main browser
    s2l.select_window(prev_title)

    # verify header of help file matched with page name
    if page_name == page_header:
        logger._log_to_console_and_log_file(
            ' Passed: Page name ("%s") and header of Browse Help page ("%s")' %
            (page_name, page_header))
    else:
        ui_lib.fail_test(
            'Failed: Page name ("%s") and header of  Browse Help page ("%s")' %
            (page_name, page_header))
示例#22
0
def select_volume_set(volumesetname, storagesystemname):
    """
        On the Volume Sets Page, select a specific volumeset
    """
    logger.info("Selecting a volume set with name %s" % volumesetname)

    # Selecting the volume set
    if not CommonOperationVolumeSets.verify_volumeset_exist(volumesetname, storagesystemname, fail_if_false=False):
        logger.warn("Volume Set '%s' is not present" % volumesetname)
        ui_lib.get_s2l().capture_page_screenshot()
        return False
    else:
        CommonOperationVolumeSets.click_volumeset(volumesetname, storagesystemname)
        CommonOperationVolumeSets.wait_volumeset_selected(volumesetname, storagesystemname)
        logger.info("Selected the Volume Set %s successfully" % volumesetname)
        return True
示例#23
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)
示例#24
0
def navigate():
    s2l = ui_lib.get_s2l()
    if not s2l._is_element_present(FusionSettingsPage.ID_PAGE_LABEL):
        s2l.click_element(FusionUIBaseElements.ID_MAIN_MENU_CONTROL)
        s2l.wait_until_page_contains_element(FusionUIBaseElements.ID_MENU_LINK_USERS_AND_GROUPS)
        s2l.click_element(FusionUIBaseElements.ID_MENU_LINK_SETTINGS)
        s2l.wait_until_page_contains_element(FusionSettingsPage.ID_PAGE_LABEL)
def select_storage_pool(storagepoolname, storagesystemname):
    '''
        Select a specific pool on the storage pools page
    '''
    logger.info("Selecting a storage pool with name %s" % storagepoolname)

    # Selecting the storage pool
    if not CommonOperationStoragePools.verify_storage_pool_exist(storagepoolname, storagesystemname, fail_if_false=False):
        logger.warn("System Storage Pool '%s' is not present" % storagepoolname)
        ui_lib.get_s2l().capture_page_screenshot()
        return False
    else:
        CommonOperationStoragePools.click_storage_pool(storagepoolname, storagesystemname)
        CommonOperationStoragePools.wait_storage_pool_selected(storagepoolname, storagesystemname)
        logger.info("Selected the System Storage pool %s successfully" % storagepoolname)
        return True
def refresh_storage_pool(storagepoolname, storage_system_name):
    '''
       Refresh the storage pools
    '''
    navigate()
    logger.info("Function call to Refresh a storage pool with name %s" % storagepoolname)
    selenium2lib = ui_lib.get_s2l()
    if not select_storage_pool(storagepoolname, storage_system_name):
        logger.warn("FAILURE :Not able to select the requested storage pool - '%s', Exiting the refresh_storage_pool function" % storagepoolname)
        selenium2lib.capture_page_screenshot()
        return False

    # Action > Refresh
    RefreshStoragePools.select_actions_refresh()

    # check for notification and Status Bar for status.
    if RefreshStoragePools.wait_general_state_refreshing():
        CommonOperationStoragePools.wait_progress_ongoing_disappear()
        BuiltIn().sleep(6)
        logger.info("Status bar update completed -  %s" % storagepoolname)
        CommonOperationStoragePools.wait_progress_ok_shown()
        CommonOperationStoragePools.get_notification_message()
        if RefreshStoragePools.wait_general_state_configured():
            logger.info("SUCCESS : REFRESH completed detected for storage pool -  %s" % storagepoolname)
            return True
        else:
            logger.warn("FAILURE : REFRESH for STORAGE POOL -'%s' did not indiate completed" % storagepoolname)
            selenium2lib.capture_page_screenshot()
            return False
    else:
        logger.warn("FAILURE : Did not detect the pool state after REFRESH for STORAGE POOL -'%s' failed" % storagepoolname)
        selenium2lib.capture_page_screenshot()
        return False
示例#27
0
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 delete_all_vcenters():
    """ Delete all vCenters from appliance """
    """Example:
        | `delete vCenter `    """

    s2l = ui_lib.get_s2l()
    """ Navigate to vCenter Page """
    if not ui_lib.wait_for_element(FusionvCenterPage.ID_PAGE_LABEL):
        navigate()

    count = 0
    ui_lib.wait_for_element(FusionvCenterPage.ID_VCENTER_LIST)
    vCenter_list = [
        ui_lib.get_webelement_attribute("text", el)
        for el in s2l._element_find(FusionvCenterPage.ID_VCENTER_LIST_NAMES,
                                    False, False)
    ]

    for vcenter in vCenter_list:
        logger._log_to_console_and_log_file("Deleting vCenter %s" % vcenter)
        if delete_vCenter(vcenter):
            count = count + 1

    if len(vCenter_list) == count:
        logger._log_to_console_and_log_file(
            "SUCCESS: All vCenters are removed successfully")
        return True
    else:
        logger._log_to_console_and_log_file(
            "FAIL: Failed to remove few or all vCenters")
        return False
示例#29
0
    def element_is_visible(self, locator):
        """ Returns true if the element is visible on the page

        Example:
        | Element Is Visible | xpath="//a[@id='overridelink'] |
        """
        s2l = ui_lib.get_s2l()
        return s2l._is_visible(locator)
def get_page_name():
    # get a reference to the selenium lib
    s2l = ui_lib.get_s2l()

    # get the current page
    s2l.wait_until_page_contains_element(i3SBasePage.ID_PAGE_LABEL)
    page_name = s2l.get_text(i3SBasePage.ID_PAGE_LABEL)
    return page_name