Beispiel #1
0
def host(provider):
    """Find a host for test scenario"""
    view = navigate_to(OpenstackNode, 'All')
    hosts = view.entities.get_all()
    # Find a compute host with no instances on it
    for h in hosts:
        if 'Compute' in h.name and h.data['no_vm'] == 0:
            return OpenstackNode(h.name, provider=provider)
    raise HostNotFound('There is no proper host for tests')
Beispiel #2
0
def host(provider):
    # TODO: Implement .filter() for OpenstackNode with all()
    """Find a host for test scenario"""
    host_collection = provider.appliance.collections.openstack_nodes
    hosts = host_collection.all(provider)
    # Find a compute host with no instances on it
    for host in hosts:
        view = navigate_to(host, 'Details')
        vms = int(view.entities.summary('Relationships').get_text_of('VMs'))
        if 'Compute' in host.name and vms == 0:
            return host
    raise HostNotFound('There is no proper host for tests')
Beispiel #3
0
def find_quadicon(host, do_not_navigate=False):
    """Find and return a quadicon belonging to a specific host

    Args:
        host: Host name as displayed at the quadicon
    Returns: :py:class:`cfme.web_ui.Quadicon` instance
    """
    if not do_not_navigate:
        navigate_to(Host, 'All')
    for page in paginator.pages():
        quadicon = Quadicon(host, "host")
        if sel.is_displayed(quadicon):
            return quadicon
    else:
        raise HostNotFound("Host '{}' not found in UI!".format(host))
Beispiel #4
0
def find_quadicon(host_name):
    """Find and return a quadicon belonging to a specific host.

    Args:
        host_name (str): A host name as displayed at the quadicon

    Returns: :py:class:`cfme.common.host_views.HostQuadIconItem` instance
    """
    view = navigate_to(Host, "All")
    if view.toolbar.view_selector.selected != "Grid View":
        view.toolbar.view_selector.select("Grid View")
    try:
        quad_icon = view.entities.get_first_entity(by_name=host_name)
    except ItemNotFound:
        raise HostNotFound("Host '{}' not found in UI!".format(host_name))
    else:
        return quad_icon