def get_all_vms(do_not_navigate=False):
    """Returns list of all vms"""
    if not do_not_navigate:
        sel.force_navigate('infra_vms')
    vms = set([])

    # This is really stupid, but I cannot come up with better getting of the attributes :(
    if not paginator.page_controls_exist():
        for title in sel.elements(QUADICON_TITLE_LOCATOR):
            title_value = sel.get_attribute(title, "title")
            if not title_value:
                title_value = sel.get_attribute(title, "data-original-title")
            vms.add(title_value)
        return vms

    paginator.results_per_page(1000)
    for page in paginator.pages():
        try:
            for page in paginator.pages():
                for title in sel.elements(QUADICON_TITLE_LOCATOR):
                    title_value = sel.get_attribute(title, "title")
                    if not title_value:
                        title_value = sel.get_attribute(
                            title, "data-original-title")
                    vms.add(title_value)
        except sel.NoSuchElementException:
            pass
    return vms
Esempio n. 2
0
 def resetter(self):
     tb.refresh()
     tb.select('List View')
     # Ensure no rows are checked
     if paginator.page_controls_exist():
         sel.check(paginator.check_all())
         sel.uncheck(paginator.check_all())
Esempio n. 3
0
 def resetter(self):
     # Default list view
     tb.select('List View')
     if paginator.page_controls_exist():
         # Make sure nothing is selected
         sel.check(paginator.check_all())
         sel.uncheck(paginator.check_all())
Esempio n. 4
0
    def _find_quadicon(self, is_vm=True, do_not_navigate=False, mark=False, refresh=True):
        """Find and return a quadicon belonging to a specific vm

        Returns: :py:class:`cfme.web_ui.Quadicon` instance
        Raises: VmNotFound
        """
        quadicon = Quadicon(self.name, "vm")
        if not do_not_navigate:
            if is_vm:
                self.provider_crud.load_all_provider_vms()
            else:
                self.provider_crud.load_all_provider_templates()
            toolbar.set_vms_grid_view()
        elif refresh:
            sel.refresh()
        if not paginator.page_controls_exist():
            if is_vm:
                raise VmNotFound("VM '{}' not found in UI!".format(self.name))
            else:
                raise TemplateNotFound("Template '{}' not found in UI!".format(self.name))

        paginator.results_per_page(1000)
        for page in paginator.pages():
            if sel.is_displayed(quadicon):
                if mark:
                    sel.check(quadicon.checkbox())
                return quadicon
        else:
            raise VmNotFound("VM '{}' not found in UI!".format(self.name))
Esempio n. 5
0
 def step(self):
     if paginator.page_controls_exist():
         paginator.results_per_page(1000)
     list_tbl.click_row_by_cells({
         'Deployment Name': self.obj.name,
         'Server': self.obj.server.name
     })
Esempio n. 6
0
def get_all_vms(do_not_navigate=False):
    """Returns list of all vms"""
    if not do_not_navigate:
        sel.force_navigate('infra_vms')
    vms = set([])

    # This is really stupid, but I cannot come up with better getting of the attributes :(
    if not paginator.page_controls_exist():
        for title in sel.elements(QUADICON_TITLE_LOCATOR):
            title_value = sel.get_attribute(title, "title")
            if not title_value:
                title_value = sel.get_attribute(title, "data-original-title")
            vms.add(title_value)
        return vms

    paginator.results_per_page(1000)
    for page in paginator.pages():
        try:
            for page in paginator.pages():
                for title in sel.elements(QUADICON_TITLE_LOCATOR):
                    title_value = sel.get_attribute(title, "title")
                    if not title_value:
                        title_value = sel.get_attribute(title, "data-original-title")
                    vms.add(title_value)
        except sel.NoSuchElementException:
            pass
    return vms
Esempio n. 7
0
 def resetter(self):
     # Reset view and selection
     tb.select("Grid View")
     from cfme.web_ui import paginator
     if paginator.page_controls_exist():
         paginator.check_all()
         paginator.uncheck_all()
Esempio n. 8
0
    def find_quadicon(
            self, do_not_navigate=False, mark=False, refresh=True, from_any_provider=False):
        """Find and return a quadicon belonging to a specific instance

        Args:
            from_any_provider: Whether to look for it anywhere (root of the tree). Useful when
                looking up archived or orphaned VMs

        Returns: :py:class:`cfme.web_ui.Quadicon` instance
        Raises: InstanceNotFound
        """
        if not do_not_navigate:
            if from_any_provider:
                sel.force_navigate("clouds_instances")
            elif not self.provider_crud.load_all_provider_instances():
                raise InstanceNotFound("No instances for the provider!")
            toolbar.set_vms_grid_view()
        elif refresh:
            sel.refresh()
        if not paginator.page_controls_exist():
            raise InstanceNotFound("Instance '{}' not found in UI!".format(self.name))

        paginator.results_per_page(1000)
        for page in paginator.pages():
            quadicon = Quadicon(self.name, "instance")
            if sel.is_displayed(quadicon):
                if mark:
                    sel.check(quadicon.checkbox())
                return quadicon
        else:
            raise InstanceNotFound("Instance '{}' not found in UI!".format(self.name))
def reset_page():
    tb.select("Grid View")
    if sel.is_displayed(search_box.search_field):
        search.ensure_normal_search_empty()
    if paginator.page_controls_exist():
        # paginator.results_per_page(1000)
        sel.check(paginator.check_all())
        sel.uncheck(paginator.check_all())
Esempio n. 10
0
def reset_page():
    tb.select("Grid View")
    if sel.is_displayed(search_box.search_field):
        search.ensure_normal_search_empty()
    if paginator.page_controls_exist():
        # paginator.results_per_page(1000)
        sel.check(paginator.check_all())
        sel.uncheck(paginator.check_all())
Esempio n. 11
0
    def find_quadicon(self,
                      do_not_navigate=False,
                      mark=False,
                      refresh=True,
                      from_any_provider=False,
                      use_search=True):
        """Find and return a quadicon belonging to a specific vm

        Args:
            from_any_provider: Whether to look for it anywhere (root of the tree). Useful when
                looking up archived or orphaned VMs

        Returns: :py:class:`cfme.web_ui.Quadicon` instance
        Raises: VmOrInstanceNotFound
        """
        quadicon = Quadicon(self.name, self.quadicon_type)
        if not do_not_navigate:
            if from_any_provider:
                # TODO implement as navigate_to when cfme.infra.virtual_machines has destination
                navigate_to(self, 'All')
            elif self.is_vm:
                navigate_to(self, 'AllForProvider', use_resetter=False)
            else:
                navigate_to(self, 'AllForProvider', use_resetter=False)
            toolbar.select('Grid View')
        else:
            # Search requires navigation, we shouldn't use it then
            use_search = False
            if refresh:
                sel.refresh()
        if not paginator.page_controls_exist():
            if self.is_vm:
                raise VmOrInstanceNotFound("VM '{}' not found in UI!".format(
                    self.name))
            else:
                raise TemplateNotFound("Template '{}' not found in UI!".format(
                    self.name))

        paginator.results_per_page(1000)
        if use_search:
            try:
                if not search.has_quick_search_box():
                    # TODO rework search for archived/orphaned VMs
                    if self.is_vm:
                        navigate_to(self, 'AllForProvider', use_resetter=False)
                    else:
                        navigate_to(self, 'AllForProvider', use_resetter=False)
                search.normal_search(self.name)
            except Exception as e:
                logger.warning("Failed to use search: %s", str(e))
        for page in paginator.pages():
            if sel.is_displayed(quadicon, move_to=True):
                if mark:
                    sel.check(quadicon.checkbox())
                return quadicon
        else:
            raise VmOrInstanceNotFound("VM '{}' not found in UI!".format(
                self.name))
Esempio n. 12
0
 def resetter(self):
     accordion.tree('Containers', version.pick({
         version.LOWEST: 'All Containers',
         '5.7': 'All Containers (by Pods)',
     }))
     tb.select('List View')
     if paginator.page_controls_exist():
         sel.check(paginator.check_all())
         sel.uncheck(paginator.check_all())
Esempio n. 13
0
 def step(self):
     from cfme.web_ui import paginator
     if paginator.page_controls_exist():
         paginator.results_per_page(1000)
     list_tbl.click_row_by_cells({
         'Datasource Name': self.obj.name,
         'Server': self.obj.server.name,
         'Host Name': self.obj.hostname
     })
Esempio n. 14
0
 def resetter(self):
     if version.current_version() < '5.8':
         self.view.Filters.tree.click_path('All Containers')
     else:
         self.view.Filters.Navigation.select('ALL (Default)')
     tb.select('List View')
     if paginator.page_controls_exist():
         sel.check(paginator.check_all())
         sel.uncheck(paginator.check_all())
Esempio n. 15
0
 def resetter(self):
     if version.current_version() < '5.8':
         self.view.Filters.tree.click_path('All Containers')
     else:
         self.view.Filters.Navigation.select('ALL (Default)')
     tb.select('List View')
     from cfme.web_ui import paginator
     if paginator.page_controls_exist():
         paginator.check_all()
         paginator.uncheck_all()
Esempio n. 16
0
    def find_quadicon(
            self, do_not_navigate=False, mark=False, refresh=True, from_any_provider=False,
            use_search=True):
        """Find and return a quadicon belonging to a specific vm

        Args:
            from_any_provider: Whether to look for it anywhere (root of the tree). Useful when
                looking up archived or orphaned VMs

        Returns: :py:class:`cfme.web_ui.Quadicon` instance
        Raises: VmOrInstanceNotFound
        """
        quadicon = Quadicon(self.name, self.quadicon_type)
        if not do_not_navigate:
            if from_any_provider:
                # TODO implement as navigate_to when cfme.infra.virtual_machines has destination
                sel.force_navigate(self.ALL_LIST_LOCATION)
            elif self.is_vm:
                self.provider.load_all_provider_vms()
            else:
                self.provider.load_all_provider_templates()
            toolbar.select('Grid View')
        else:
            # Search requires navigation, we shouldn't use it then
            use_search = False
            if refresh:
                sel.refresh()
        if not paginator.page_controls_exist():
            if self.is_vm:
                raise VmOrInstanceNotFound("VM '{}' not found in UI!".format(self.name))
            else:
                raise TemplateNotFound("Template '{}' not found in UI!".format(self.name))

        # this is causing some issues in 5.5.0.9, commenting out for a bit
        # paginator.results_per_page(1000)
        if use_search:
            try:
                if not search.has_quick_search_box():
                    # We don't use provider-specific page (vm_templates_provider_branch) here
                    # as those don't list archived/orphaned VMs
                    if self.is_vm:
                        navigate_to(self.provider, 'Instances')
                    else:
                        navigate_to(self.provider, self.provider.templates_destination_name)
                search.normal_search(self.name)
            except Exception as e:
                logger.warning("Failed to use search: %s", str(e))

        for page in paginator.pages():
            if sel.is_displayed(quadicon, move_to=True):
                if mark:
                    sel.check(quadicon.checkbox())
                return quadicon
        else:
            raise VmOrInstanceNotFound("VM '{}' not found in UI!".format(self.name))
Esempio n. 17
0
    def find_quadicon(
            self, do_not_navigate=False, mark=False, refresh=True, from_any_provider=False,
            use_search=True):
        """Find and return a quadicon belonging to a specific vm

        Args:
            from_any_provider: Whether to look for it anywhere (root of the tree). Useful when
                looking up archived or orphaned VMs

        Returns: :py:class:`cfme.web_ui.Quadicon` instance
        Raises: VmOrInstanceNotFound
        """
        quadicon = Quadicon(self.name, self.quadicon_type)
        if not do_not_navigate:
            if from_any_provider:
                sel.force_navigate(self.ALL_LIST_LOCATION)
            elif self.is_vm:
                self.provider.load_all_provider_vms()
            else:
                self.provider.load_all_provider_templates()
            toolbar.select('Grid View')
        else:
            # Search requires navigation, we shouldn't use it then
            use_search = False
            if refresh:
                sel.refresh()
        if not paginator.page_controls_exist():
            if self.is_vm:
                raise VmOrInstanceNotFound("VM '{}' not found in UI!".format(self.name))
            else:
                raise TemplateNotFound("Template '{}' not found in UI!".format(self.name))

        # this is causing some issues in 5.5.0.9, commenting out for a bit
        # paginator.results_per_page(1000)
        if use_search:
            try:
                if not search.has_quick_search_box():
                    # We don't use provider-specific page (vm_templates_provider_branch) here
                    # as those don't list archived/orphaned VMs
                    if self.is_vm:
                        sel.force_navigate(self.provider.instances_page_name)
                    else:
                        sel.force_navigate(self.provider.templates_page_name)
                search.normal_search(self.name)
            except Exception as e:
                logger.warning("Failed to use search: %s", str(e))

        for page in paginator.pages():
            if sel.is_displayed(quadicon, move_to=True):
                if mark:
                    sel.check(quadicon.checkbox())
                return quadicon
        else:
            raise VmOrInstanceNotFound("VM '{}' not found in UI!".format(self.name))
Esempio n. 18
0
 def resetter(self):
     accordion.tree(
         'Containers',
         version.pick({
             version.LOWEST: 'All Containers',
             '5.7': 'All Containers (by Pods)',
         }))
     tb.select('List View')
     if paginator.page_controls_exist():
         sel.check(paginator.check_all())
         sel.uncheck(paginator.check_all())
Esempio n. 19
0
 def remove_from_list(cls, datasource):
     _get_datasources_page(server=datasource.server)
     if paginator.page_controls_exist():
         paginator.results_per_page(1000)
     list_tbl.select_row_by_cells({
         'Datasource Name': datasource.name,
         'Server': datasource.server.name,
         'Host Name': datasource.hostname
     })
     operations_btn("Remove", invokes_alert=True)
     sel.handle_alert()
     flash.assert_success_message('The selected datasources were removed')
Esempio n. 20
0
 def resetter(self):
     # Reset view and selection
     if self.obj.appliance.version >= '5.7':
         accordion.tree('Datastores', 'All Datastores')
     else:
         # todo: there is unsupported accordion in 5.6.3.3. currently it isn't necessary
         # for existing tests
         pass
     tb.select("Grid View")
     if paginator.page_controls_exist():
         sel.check(paginator.check_all())
         sel.uncheck(paginator.check_all())
Esempio n. 21
0
    def find_quadicon(
            self, do_not_navigate=False, mark=False, refresh=True, from_any_provider=False,
            use_search=True):
        """Find and return a quadicon belonging to a specific vm

        Args:
            from_any_provider: Whether to look for it anywhere (root of the tree). Useful when
                looking up archived or orphaned VMs

        Returns: :py:class:`cfme.web_ui.Quadicon` instance
        Raises: VmOrInstanceNotFound
        """
        quadicon = Quadicon(self.name, self.quadicon_type)
        if not do_not_navigate:
            if from_any_provider:
                # TODO implement as navigate_to when cfme.infra.virtual_machines has destination
                navigate_to(self, 'All')
            elif self.is_vm:
                navigate_to(self, 'AllForProvider', use_resetter=False)
            else:
                navigate_to(self, 'AllForProvider', use_resetter=False)
            toolbar.select('Grid View')
        else:
            # Search requires navigation, we shouldn't use it then
            use_search = False
            if refresh:
                sel.refresh()
        if not paginator.page_controls_exist():
            if self.is_vm:
                raise VmOrInstanceNotFound("VM '{}' not found in UI!".format(self.name))
            else:
                raise TemplateNotFound("Template '{}' not found in UI!".format(self.name))

        paginator.results_per_page(1000)
        if use_search:
            try:
                if not search.has_quick_search_box():
                    # TODO rework search for archived/orphaned VMs
                    if self.is_vm:
                        navigate_to(self, 'AllForProvider', use_resetter=False)
                    else:
                        navigate_to(self, 'AllForProvider', use_resetter=False)
                search.normal_search(self.name)
            except Exception as e:
                logger.warning("Failed to use search: %s", str(e))
        for page in paginator.pages():
            if sel.is_displayed(quadicon, move_to=True):
                if mark:
                    sel.check(quadicon.checkbox())
                return quadicon
        else:
            raise VmOrInstanceNotFound("VM '{}' not found in UI!".format(self.name))
Esempio n. 22
0
def navigate_and_select_all_hosts(host_names, provider_crud=None):
    """ Reduces some redundant code shared between methods """
    if isinstance(host_names, basestring):
        host_names = [host_names]

    if provider_crud:
        navigate_to(provider_crud, 'ProviderNodes')
    else:
        navigate_to(Host, 'All')
    if paginator.page_controls_exist():
        paginator.results_per_page(1000)
    for host_name in host_names:
        sel.check(Quadicon(host_name, 'host').checkbox())
def _method_setup(vm_names, provider_crud=None):
    """ Reduces some redundant code shared between methods """
    if isinstance(vm_names, basestring):
        vm_names = [vm_names]

    if provider_crud:
        provider_crud.load_all_provider_vms()
    else:
        sel.force_navigate('infra_vms')
    if paginator.page_controls_exist():
        paginator.results_per_page(1000)
    for vm_name in vm_names:
        sel.check(Quadicon(vm_name, 'vm').checkbox())
Esempio n. 24
0
def navigate_and_select_all_hosts(host_names, provider_crud=None):
    """ Reduces some redundant code shared between methods """
    if isinstance(host_names, basestring):
        host_names = [host_names]

    if provider_crud:
        navigate_to(provider_crud, 'ProviderNodes')
    else:
        navigate_to(Host, 'All')
    if paginator.page_controls_exist():
        paginator.results_per_page(1000)
    for host_name in host_names:
        sel.check(Quadicon(host_name, 'host').checkbox())
Esempio n. 25
0
def _method_setup(vm_names, provider_crud=None):
    """ Reduces some redundant code shared between methods """
    if isinstance(vm_names, basestring):
        vm_names = [vm_names]

    if provider_crud:
        provider_crud.load_all_provider_instances()
    else:
        sel.force_navigate('clouds_instances')
    if paginator.page_controls_exist():
        paginator.results_per_page(1000)
    for vm_name in vm_names:
        sel.check(Quadicon(vm_name, 'instance').checkbox())
Esempio n. 26
0
def get_number_of_vms(do_not_navigate=False):
    """
    Returns the total number of VMs visible to the user,
    including those archived or orphaned
    """
    logger.info("Getting number of vms")
    if not do_not_navigate:
        sel.force_navigate('infra_vms')
    if not paginator.page_controls_exist():
        logger.debug("No page controls")
        return 0
    total = paginator.rec_total()
    logger.debug("Number of VMs: {}".format(total))
    return int(total)
Esempio n. 27
0
def _method_setup(vm_names, provider_crud=None):
    """ Reduces some redundant code shared between methods """
    if isinstance(vm_names, basestring):
        vm_names = [vm_names]

    if provider_crud:
        provider_crud.load_all_provider_vms()
    else:
        navigate_to(Vm, 'VMsOnly')
    from cfme.web_ui import paginator
    if paginator.page_controls_exist():
        paginator.results_per_page(1000)
    for vm_name in vm_names:
        sel.check(Quadicon(vm_name, 'vm').checkbox())
Esempio n. 28
0
def _method_setup(vm_names, provider_crud=None):
    """ Reduces some redundant code shared between methods """
    if isinstance(vm_names, basestring):
        vm_names = [vm_names]

    if provider_crud:
        provider_crud.load_all_provider_vms()
    else:
        navigate_to(Vm, 'VMsOnly')
    from cfme.web_ui import paginator
    if paginator.page_controls_exist():
        paginator.results_per_page(1000)
    for vm_name in vm_names:
        sel.check(Quadicon(vm_name, 'vm').checkbox())
def get_number_of_vms(do_not_navigate=False):
    """
    Returns the total number of VMs visible to the user,
    including those archived or orphaned
    """
    logger.info("Getting number of vms")
    if not do_not_navigate:
        sel.force_navigate('infra_vms')
    if not paginator.page_controls_exist():
        logger.debug("No page controls")
        return 0
    total = paginator.rec_total()
    logger.debug("Number of VMs: %s", total)
    return int(total)
def get_number_of_vms(do_not_navigate=False):
    """
    Returns the total number of VMs visible to the user,
    including those archived or orphaned
    """
    logger.info("Getting number of vms")
    if not do_not_navigate:
        navigate_to(Vm, 'VMsOnly')
    if not paginator.page_controls_exist():
        logger.debug("No page controls")
        return 0
    total = paginator.rec_total()
    logger.debug("Number of VMs: %s", total)
    return int(total)
Esempio n. 31
0
def get_number_of_vms(do_not_navigate=False):
    """
    Returns the total number of VMs visible to the user,
    including those archived or orphaned
    """
    logger.info("Getting number of vms")
    if not do_not_navigate:
        navigate_to(Vm, 'VMsOnly')
    from cfme.web_ui import paginator
    if not paginator.page_controls_exist():
        logger.debug("No page controls")
        return 0
    total = paginator.rec_total()
    logger.debug("Number of VMs: %s", total)
    return int(total)
Esempio n. 32
0
def get_all_vms(do_not_navigate=False):
    """Returns list of all vms"""
    if not do_not_navigate:
        sel.force_navigate('infra_vms')
    vms = set([])
    if not paginator.page_controls_exist():
        return vms

    paginator.results_per_page(1000)
    for page in paginator.pages():
        try:
            for page in paginator.pages():
                for title in sel.elements(QUADICON_TITLE_LOCATOR):
                    vms.add(sel.get_attribute(title, "title"))
        except sel.NoSuchElementException:
            pass
    return vms
Esempio n. 33
0
def get_all_instances(do_not_navigate=False):
    """Returns list of all cloud instances"""
    if not do_not_navigate:
        sel.force_navigate('clouds_instances')
    vms = set([])
    if not paginator.page_controls_exist():
        return vms

    paginator.results_per_page(1000)
    for page in paginator.pages():
        try:
            for title in sel.elements(
                    "//div[@id='quadicon']/../../../tr/td/a[contains(@href,'vm_cloud/x_show')"
                    " or contains(@href, '/show/')]"):  # for provider specific vm/template page
                vms.add(sel.get_attribute(title, "title"))
        except sel.NoSuchElementException:
            pass
    return vms
Esempio n. 34
0
def get_all_instances(do_not_navigate=False):
    """Returns list of all cloud instances"""
    if not do_not_navigate:
        sel.force_navigate('clouds_instances')
    vms = set([])
    if not paginator.page_controls_exist():
        return vms

    paginator.results_per_page(1000)
    for page in paginator.pages():
        try:
            for title in sel.elements(
                    "//div[@id='quadicon']/../../../tr/td/a[contains(@href,'vm_cloud/x_show')"
                    " or contains(@href, '/show/')]"):  # for provider specific vm/template page
                vms.add(sel.get_attribute(title, "title"))
        except sel.NoSuchElementException:
            pass
    return vms
def test_relationships_tables(provider, cls):
    """  This module verifies the integrity of the Relationships table.
               clicking on each field in the Relationships table takes the user
              to either Summary page where we verify that the field that appears
             in the Relationships table also appears in the Properties table,
            or to the page where the number of rows is equal to the number
           that is displayed in the Relationships table.

    """
    navigate_to(cls, 'All')
    tb.select('List View')
    list_tbl = CheckboxTable(table_locator="//div[@id='list_grid']//table")
    cls_instances = [r.name.text for r in list_tbl.rows()]
    cls_instances_revised = [ch for ch in cls_instances
                             if 'nginx' not in ch and not ch.startswith('metrics')]
    for name in cls_instances_revised:
        navigate_to(cls, 'All')
        obj = cls(name, provider)
        rel_tbl = obj.summary.groups()['relationships']
        keys = [key for key in rel_tbl.keys]
        for key in keys:
            # reload summary to prevent StaleElementReferenceException:
            obj.summary.reload()
            rel_tbl = obj.summary.groups()['relationships']
            element = getattr(rel_tbl, key)
            value = element.value
            if value in rel_values:
                continue
            sel.click(element)

            try:
                value = int(value)
            except ValueError:
                assert value == details_page.infoblock.text(
                    'Properties', 'Name')
            else:
                # best effort to include all items from rel on one page
                if paginator.page_controls_exist():
                    paginator.results_per_page(1000)
                else:
                    logger.warning(
                        'Unable to increase results per page, '
                        'assertion against number of rows may fail.')
                assert len([r for r in list_tbl.rows()]) == value
Esempio n. 36
0
def find_quadicon(instance_name, do_not_navigate=False):
    """Find and return a quadicon belonging to a specific instance

    Args:
        instance_name: instance name as displayed at the quadicon
    Returns: :py:class:`cfme.web_ui.Quadicon` instance
    """
    if not do_not_navigate:
        sel.force_navigate('clouds_instances')
    if not paginator.page_controls_exist():
        raise InstanceNotFound("Instance '{}' not found in UI!".format(instance_name))

    paginator.results_per_page(1000)
    for page in paginator.pages():
        quadicon = Quadicon(instance_name, "instance")
        if sel.is_displayed(quadicon):
            return quadicon
    else:
        raise InstanceNotFound("Instance '{}' not found in UI!".format(instance_name))
Esempio n. 37
0
def find_quadicon(instance_name, do_not_navigate=False):
    """Find and return a quadicon belonging to a specific instance

    Args:
        instance_name: instance name as displayed at the quadicon
    Returns: :py:class:`cfme.web_ui.Quadicon` instance
    """
    if not do_not_navigate:
        sel.force_navigate('clouds_instances')
    if not paginator.page_controls_exist():
        raise InstanceNotFound("Instance '{}' not found in UI!".format(instance_name))

    paginator.results_per_page(1000)
    for page in paginator.pages():
        quadicon = Quadicon(instance_name, "instance")
        if sel.is_displayed(quadicon):
            return quadicon
    else:
        raise InstanceNotFound("Instance '{}' not found in UI!".format(instance_name))
Esempio n. 38
0
    def find_quadicon(self,
                      do_not_navigate=False,
                      mark=False,
                      refresh=True,
                      from_any_provider=False):
        """Find and return a quadicon belonging to a specific vm

        Args:
            from_any_provider: Whether to look for it anywhere (root of the tree). Useful when
                looking up archived or orphaned VMs

        Returns: :py:class:`cfme.web_ui.Quadicon` instance
        Raises: VmOrInstanceNotFound
        """
        quadicon = Quadicon(self.name, self.quadicon_type)
        if not do_not_navigate:
            if from_any_provider:
                sel.force_navigate(self.ALL_LIST_LOCATION)
            elif self.is_vm:
                self.provider.load_all_provider_vms()
            else:
                self.provider.load_all_provider_templates()
            toolbar.select('Grid View')
        elif refresh:
            sel.refresh()
        if not paginator.page_controls_exist():
            if self.is_vm:
                raise VmOrInstanceNotFound("VM '{}' not found in UI!".format(
                    self.name))
            else:
                raise TemplateNotFound("Template '{}' not found in UI!".format(
                    self.name))

        # this is causing some issues in 5.5.0.9, commenting out for a bit
        # paginator.results_per_page(1000)
        for page in paginator.pages():
            if sel.is_displayed(quadicon, move_to=True):
                if mark:
                    sel.check(quadicon.checkbox())
                return quadicon
        else:
            raise VmOrInstanceNotFound("VM '{}' not found in UI!".format(
                self.name))
def find_quadicon(vm_name, do_not_navigate=False):
    """Find and return a quadicon belonging to a specific vm

    Args:
        vm: vm name as displayed at the quadicon
    Returns: :py:class:`cfme.web_ui.Quadicon` instance
    """
    if not do_not_navigate:
        sel.force_navigate('infra_vms')
    if not paginator.page_controls_exist():
        raise VmNotFound("VM '{}' not found in UI!".format(vm_name))

    paginator.results_per_page(1000)
    for page in paginator.pages():
        quadicon = Quadicon(vm_name, "vm")
        if sel.is_displayed(quadicon):
            return quadicon
    else:
        raise VmNotFound("VM '{}' not found in UI!".format(vm_name))
def find_quadicon(vm_name, do_not_navigate=False):
    """Find and return a quadicon belonging to a specific vm

    Args:
        vm: vm name as displayed at the quadicon
    Returns: :py:class:`cfme.web_ui.Quadicon` instance
    """
    if not do_not_navigate:
        navigate_to(Vm, 'VMsOnly')
    if not paginator.page_controls_exist():
        raise VmNotFound("VM '{}' not found in UI!".format(vm_name))

    paginator.results_per_page(1000)
    for page in paginator.pages():
        quadicon = Quadicon(vm_name, "vm")
        if sel.is_displayed(quadicon):
            return quadicon
    else:
        raise VmNotFound("VM '{}' not found in UI!".format(vm_name))
Esempio n. 41
0
def get_all_instances(do_not_navigate=False):
    """Returns list of all cloud instance names"""
    if not do_not_navigate:
        navigate_to(Instance, 'All')
    vms = set([])
    if not paginator.page_controls_exist():
        return vms

    # Cleaner to use list view and get names from rows than titles from Quadicons
    tb.select('List View')
    paginator.results_per_page(50)
    for page in paginator.pages():
        try:
            for row in list_table.rows():
                name = (row.__getattr__('Name')).text
                if name:
                    vms.add(name)
        except sel.NoSuchElementException:
            pass
    return vms
Esempio n. 42
0
def get_all_instances(do_not_navigate=False):
    """Returns list of all cloud instance names"""
    if not do_not_navigate:
        navigate_to(Instance, 'All')
    vms = set([])
    if not paginator.page_controls_exist():
        return vms

    # Cleaner to use list view and get names from rows than titles from Quadicons
    tb.select('List View')
    paginator.results_per_page(50)
    for page in paginator.pages():
        try:
            for row in list_table.rows():
                name = (row.__getattr__('Name')).text
                if name:
                    vms.add(name)
        except sel.NoSuchElementException:
            pass
    return vms
    def _find_quadicon(
            self, is_vm=True, do_not_navigate=False, mark=False, refresh=True,
            from_any_provider=False):
        """Find and return a quadicon belonging to a specific vm

        Args:
            from_any_provider: Whether to look for it anywhere (root of the tree). Useful when
                looking up archived or orphaned VMs

        Returns: :py:class:`cfme.web_ui.Quadicon` instance
        Raises: VmNotFound
        """
        quadicon = Quadicon(self.name, "vm")
        if not do_not_navigate:
            if from_any_provider:
                if is_vm:
                    sel.force_navigate("infra_vms")
                else:
                    sel.force_navigate("infra_templates")
            elif is_vm:
                self.provider_crud.load_all_provider_vms()
            else:
                self.provider_crud.load_all_provider_templates()
            toolbar.set_vms_grid_view()
        elif refresh:
            sel.refresh()
        if not paginator.page_controls_exist():
            if is_vm:
                raise VmNotFound("VM '{}' not found in UI!".format(self.name))
            else:
                raise TemplateNotFound("Template '{}' not found in UI!".format(self.name))

        paginator.results_per_page(1000)
        for page in paginator.pages():
            if sel.is_displayed(quadicon, move_to=True):
                if mark:
                    sel.check(quadicon.checkbox())
                return quadicon
        else:
            raise VmNotFound("VM '{}' not found in UI!".format(self.name))
def test_images_rel(provider, rel, detailfield):
    """ https://bugzilla.redhat.com/show_bug.cgi?id=1365878
    """
    # Nav to provider first
    navigate_to(provider, 'Details')

    # Then to container images for that provider
    # Locate Relationships table in provider details
    images_key = ({
        version.LOWEST: 'Images',
        '5.7': 'Container Images'
    })
    sel.click(InfoBlock.element('Relationships', version.pick(images_key)))

    # Get the names of all the container images from the table
    list_tbl_image = CheckboxTable(
        table_locator="//div[@id='list_grid']//table")
    ui_images = [r.name.text for r in list_tbl_image.rows()]

    for name in ui_images:
        img = Image(name, provider)
        navigate_to(img, 'Details')

        val = img.get_detail('Relationships', rel)
        assert val != 'Unknown image source'

        sel.click(InfoBlock.element('Relationships', rel))

        # Containers Provider and Image Registry are string values
        # Other rows in the table show the number of the given items
        if rel in ['Containers Provider', 'Image Registry']:
            assert val == InfoBlock.text('Properties', detailfield)
        else:
            val = int(val)
            # There might be more than 1 page of items
            if paginator.page_controls_exist():
                paginator.results_per_page(1000)
            assert len([r for r in list_tbl_image.rows()]) == val
Esempio n. 45
0
    def find_quadicon(
            self, do_not_navigate=False, mark=False, refresh=True, from_any_provider=False):
        """Find and return a quadicon belonging to a specific vm

        Args:
            from_any_provider: Whether to look for it anywhere (root of the tree). Useful when
                looking up archived or orphaned VMs

        Returns: :py:class:`cfme.web_ui.Quadicon` instance
        Raises: VmOrInstanceNotFound
        """
        quadicon = Quadicon(self.name, self.quadicon_type)
        if not do_not_navigate:
            if from_any_provider:
                sel.force_navigate(self.ALL_LIST_LOCATION)
            elif self.is_vm:
                self.provider.load_all_provider_vms()
            else:
                self.provider.load_all_provider_templates()
            toolbar.select('Grid View')
        elif refresh:
            sel.refresh()
        if not paginator.page_controls_exist():
            if self.is_vm:
                raise VmOrInstanceNotFound("VM '{}' not found in UI!".format(self.name))
            else:
                raise TemplateNotFound("Template '{}' not found in UI!".format(self.name))

        # this is causing some issues in 5.5.0.9, commenting out for a bit
        # paginator.results_per_page(1000)
        for page in paginator.pages():
            if sel.is_displayed(quadicon, move_to=True):
                if mark:
                    sel.check(quadicon.checkbox())
                return quadicon
        else:
            raise VmOrInstanceNotFound("VM '{}' not found in UI!".format(self.name))
def test_nodes_rel(provider, rel):
    navigate_to(provider, 'Details')

    sel.click(InfoBlock.element('Relationships', 'Nodes'))

    list_tbl_node = CheckboxTable(
        table_locator="//div[@id='list_grid']//table")
    ui_nodes = [r.name.text for r in list_tbl_node.rows()]
    mgmt_objs = provider.mgmt.list_node()

    assert set(ui_nodes).issubset(
        [obj.name for obj in mgmt_objs]), 'Missing objects'

    for name in ui_nodes:
        node = Node(name, provider)

        val = node.get_detail('Relationships', rel)
        if val == '0':
            # the row can't be clicked when there are no items, and has class 'no-hover'
            logger.info('No items for node relationship: {}'.format(rel))
            continue
        # Should already be here, but just in case
        navigate_to(node, 'Details')
        sel.click(InfoBlock.element('Relationships', rel))

        try:
            val = int(val)
            # best effort to include all items from rel in one page
            if paginator.page_controls_exist():
                logger.info('Setting results per page to 1000 for {}'.format(rel))
                paginator.results_per_page(1000)
            else:
                logger.warning('Unable to increase results per page, '
                               'assertion against number of rows may fail.')
            assert len([r for r in list_tbl_node.rows()]) == val
        except ValueError:  # if the conversion to integer failed, its a non-scalar relationship
            assert val == InfoBlock.text('Properties', 'Name')
Esempio n. 47
0
    def find_quadicon(self,
                      do_not_navigate=False,
                      mark=False,
                      refresh=True,
                      from_any_provider=False):
        """Find and return a quadicon belonging to a specific instance

        Args:
            from_any_provider: Whether to look for it anywhere (root of the tree). Useful when
                looking up archived or orphaned VMs

        Returns: :py:class:`cfme.web_ui.Quadicon` instance
        Raises: InstanceNotFound
        """
        if not do_not_navigate:
            if from_any_provider:
                sel.force_navigate("clouds_instances")
            elif not self.provider_crud.load_all_provider_instances():
                raise InstanceNotFound("No instances for the provider!")
            toolbar.set_vms_grid_view()
        elif refresh:
            sel.refresh()
        if not paginator.page_controls_exist():
            raise InstanceNotFound("Instance '{}' not found in UI!".format(
                self.name))

        paginator.results_per_page(1000)
        for page in paginator.pages():
            quadicon = Quadicon(self.name, "instance")
            if sel.is_displayed(quadicon):
                if mark:
                    sel.check(quadicon.checkbox())
                return quadicon
        else:
            raise InstanceNotFound("Instance '{}' not found in UI!".format(
                self.name))
Esempio n. 48
0
 def resetter(self):
     from cfme.web_ui import paginator
     tb.select('List View')
     if paginator.page_controls_exist():
         paginator.check_all()
         paginator.uncheck_all()
Esempio n. 49
0
 def step(self):
     from cfme.web_ui import paginator
     if paginator.page_controls_exist():
         paginator.results_per_page(1000)
     list_tbl.click_row_by_cells({'Deployment Name': self.obj.name,
                                  'Server': self.obj.server.name})
def reset_page():
    tb.select("Grid View")
    if paginator.page_controls_exist():
        # paginator.results_per_page(1000)
        sel.check(paginator.check_all())
        sel.uncheck(paginator.check_all())
Esempio n. 51
0
 def resetter(self):
     from cfme.web_ui import paginator
     tb.select('List View')
     if paginator.page_controls_exist():
         paginator.check_all()
         paginator.uncheck_all()
Esempio n. 52
0
 def resetter(self):
     tb.select('List View')
     if paginator.page_controls_exist():
         sel.check(paginator.check_all())
         sel.uncheck(paginator.check_all())
Esempio n. 53
0
 def step(self):
     # Best effort to make sure the catalog is in the list
     if paginator.page_controls_exist():
         paginator.results_per_page(1000)
     listview_table.click_row_by_cells(
         {'Name': self.obj.name, 'Description': self.obj.description})
Esempio n. 54
0
 def resetter(self):
     # Reset view and selection
     tb.select("Grid View")
     if paginator.page_controls_exist():
         sel.check(paginator.check_all())
         sel.uncheck(paginator.check_all())