Exemple #1
0
    def cleanup_host():
        try:
            logger.info('Cleaning up host %s on provider %s', prov_host_name, provider.key)
            mgmt_system = provider.mgmt
            host_list = mgmt_system.list_host()
            if host_provisioning['ip_addr'] in host_list:
                wait_for(mgmt_system.is_host_connected, [host_provisioning['ip_addr']])
                mgmt_system.remove_host_from_cluster(host_provisioning['ip_addr'])

            ipmi = test_host.get_ipmi()
            ipmi.power_off()

            # During host provisioning,the host name gets changed from what's specified at creation
            # time.If host provisioning succeeds,the original name is reverted to,otherwise the
            # changed names are retained upon failure
            renamed_host_name1 = "{} ({})".format('IPMI', host_provisioning['ipmi_address'])
            renamed_host_name2 = "{} ({})".format('VMware ESXi', host_provisioning['ip_addr'])

            host_list_ui = host.get_all_hosts()
            if host_provisioning['hostname'] in host_list_ui:
                test_host.delete(cancel=False)
                host.wait_for_host_delete(test_host)
            elif renamed_host_name1 in host_list_ui:
                host_renamed_obj1 = host.Host(name=renamed_host_name1, provider=provider)
                host_renamed_obj1.delete(cancel=False)
                host.wait_for_host_delete(host_renamed_obj1)
            elif renamed_host_name2 in host_list_ui:
                host_renamed_obj2 = host.Host(name=renamed_host_name2, provider=provider)
                host_renamed_obj2.delete(cancel=False)
                host.wait_for_host_delete(host_renamed_obj2)
        except:
            # The mgmt_sys classes raise Exception :\
            logger.warning('Failed to clean up host %s on provider %s',
                prov_host_name, provider.key)
    def cleanup_host():
        try:
            logger.info('Cleaning up host %s on provider %s' % (prov_host_name, provider_crud.key))
            mgmt_system = provider_crud.get_mgmt_system()
            host_list = mgmt_system.list_host()
            if host_provisioning['ip_addr'] in host_list:
                wait_for(mgmt_system.is_host_connected, [host_provisioning['ip_addr']])
                mgmt_system.remove_host_from_cluster(host_provisioning['ip_addr'])

            ipmi = test_host.get_ipmi()
            ipmi.power_off()

            # During host provisioning,the host name gets changed from what's specified at creation
            # time.If host provisioning succeeds,the original name is reverted to,otherwise the
            # changed names are retained upon failure
            renamed_host_name1 = "{} ({})".format('IPMI', host_provisioning['ipmi_address'])
            renamed_host_name2 = "{} ({})".format('VMware ESXi', host_provisioning['ip_addr'])

            host_list_ui = host.get_all_hosts()
            if host_provisioning['hostname'] in host_list_ui:
                test_host.delete(cancel=False)
                host.wait_for_host_delete(test_host)
            elif renamed_host_name1 in host_list_ui:
                host_renamed_obj1 = host.Host(name=renamed_host_name1)
                host_renamed_obj1.delete(cancel=False)
                host.wait_for_host_delete(host_renamed_obj1)
            elif renamed_host_name2 in host_list_ui:
                host_renamed_obj2 = host.Host(name=renamed_host_name2)
                host_renamed_obj2.delete(cancel=False)
                host.wait_for_host_delete(host_renamed_obj2)
        except:
            # The mgmt_sys classes raise Exception :\
            logger.warning('Failed to clean up host %s on provider %s' %
                           (prov_host_name, provider_crud.key))
def hosts():
    """Ensure the infra providers are set up and get list of hosts"""
    sel.force_navigate("infrastructure_providers")
    for provider in providers.setup_infrastructure_providers():
        provider.validate()
    sel.force_navigate("infrastructure_hosts")
    search.ensure_no_filter_applied()
    return host.get_all_hosts()
Exemple #4
0
def hosts():
    """Ensure the infra providers are set up and get list of hosts"""
    sel.force_navigate("infrastructure_providers")
    for provider in providers.setup_infrastructure_providers():
        provider.validate()
    sel.force_navigate("infrastructure_hosts")
    search.ensure_no_filter_applied()
    return host.get_all_hosts()
def test_filter_without_user_input(hosts, hosts_with_vm_count, host_with_median_vm):
    navigate_to(Host, 'All')
    median_host, median_vm_count = host_with_median_vm
    # We will filter out hosts with less than median VMs
    more_than_median_hosts = list(dropwhile(lambda h: h[1] <= median_vm_count, hosts_with_vm_count))
    # Set up the filter
    search.fill_and_apply_filter(get_expression(False).format(median_vm_count))
    assert_no_cfme_exception()
    assert len(more_than_median_hosts) == len(host.get_all_hosts())
def hosts():
    """Ensure the infra providers are set up and get list of hosts"""
    try:
        setup_a_provider(prov_class="infra")
    except Exception:
        pytest.skip("It's not possible to set up any providers, therefore skipping")
    navigate_to(Host, 'All')
    search.ensure_no_filter_applied()
    return host.get_all_hosts()
Exemple #7
0
def test_filter_without_user_input(hosts, hosts_with_vm_count, host_with_median_vm):
    navigate_to(Host, 'All')
    median_host, median_vm_count = host_with_median_vm
    # We will filter out hosts with less than median VMs
    more_than_median_hosts = list(dropwhile(lambda h: h[1] <= median_vm_count, hosts_with_vm_count))
    # Set up the filter
    search.fill_and_apply_filter(get_expression(False).format(median_vm_count))
    assert_no_cfme_exception()
    assert len(more_than_median_hosts) == len(host.get_all_hosts(do_not_navigate=True))
def test_filter_without_user_input(hosts, hosts_with_vm_count, host_with_median_vm):
    pytest.sel.force_navigate("infrastructure_hosts")
    median_host, median_vm_count = host_with_median_vm
    # We will filter out hosts with less than median VMs
    more_than_median_hosts = list(dropwhile(lambda h: h[1] <= median_vm_count, hosts_with_vm_count))
    # Set up the filter
    search.fill_and_apply_filter(get_expression(False).format(median_vm_count))
    assert_no_cfme_exception()
    assert len(more_than_median_hosts) == len(host.get_all_hosts(do_not_navigate=True))
def hosts():
    """Ensure the infra providers are set up and get list of hosts"""
    try:
        setup_a_provider(prov_type="infra")
    except Exception:
        pytest.skip("It's not possible to set up any providers, therefore skipping")
    pytest.sel.force_navigate("infrastructure_hosts")
    search.ensure_no_filter_applied()
    return host.get_all_hosts()
def hosts():
    """Ensure the infra providers are set up and get list of hosts"""
    try:
        setup_a_provider(prov_type="infra")
    except Exception:
        pytest.skip(
            "It's not possible to set up any providers, therefore skipping")
    pytest.sel.force_navigate("infrastructure_hosts")
    search.ensure_no_filter_applied()
    return host.get_all_hosts()
def test_quick_search_without_filter(hosts, hosts_with_vm_count, host_with_median_vm):
    sel.force_navigate("infrastructure_hosts")
    search.ensure_no_filter_applied()
    assert_no_cfme_exception()
    median_host, median_vm_count = host_with_median_vm
    # Filter this host only
    search.normal_search(median_host)
    assert_no_cfme_exception()
    # Check it is there
    all_hosts_visible = host.get_all_hosts(do_not_navigate=True)
    assert len(all_hosts_visible) == 1 and median_host in all_hosts_visible
Exemple #12
0
def test_quick_search_without_filter(hosts, hosts_with_vm_count,
                                     host_with_median_vm):
    sel.force_navigate("infrastructure_hosts")
    search.ensure_no_filter_applied()
    assert_no_cfme_exception()
    median_host, median_vm_count = host_with_median_vm
    # Filter this host only
    search.normal_search(median_host)
    assert_no_cfme_exception()
    # Check it is there
    all_hosts_visible = host.get_all_hosts(do_not_navigate=True)
    assert len(all_hosts_visible) == 1 and median_host in all_hosts_visible
Exemple #13
0
def test_quick_search_with_filter(request, hosts, hosts_with_vm_count, host_with_median_vm):
    navigate_to(Host, 'All')
    median_host, median_vm_count = host_with_median_vm
    search.fill_and_apply_filter(get_expression(False, ">=").format(median_vm_count))
    assert_no_cfme_exception()
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    search.normal_search(median_host)
    assert_no_cfme_exception()
    # Check it is there
    all_hosts_visible = host.get_all_hosts(do_not_navigate=True)
    assert len(all_hosts_visible) == 1 and median_host in all_hosts_visible
Exemple #14
0
def test_filter_without_user_input(hosts, hosts_with_vm_count,
                                   host_with_median_vm):
    sel.force_navigate("infrastructure_hosts")
    median_host, median_vm_count = host_with_median_vm
    # We will filter out hosts with less than median VMs
    more_than_median_hosts = list(
        dropwhile(lambda h: h[1] <= median_vm_count, hosts_with_vm_count))
    # Set up the filter
    search.fill_and_apply_filter("fill_count(Host.VMs, >, %d)" %
                                 median_vm_count)
    assert_no_cfme_exception()
    assert len(more_than_median_hosts) == len(
        host.get_all_hosts(do_not_navigate=True))
Exemple #15
0
def test_quick_search_with_filter(hosts, hosts_with_vm_count,
                                  host_with_median_vm):
    sel.force_navigate("infrastructure_hosts")
    median_host, median_vm_count = host_with_median_vm
    search.fill_and_apply_filter("fill_count(Host.VMs, >=, %d)" %
                                 median_vm_count)
    assert_no_cfme_exception()
    # Filter this host only
    search.normal_search(median_host)
    assert_no_cfme_exception()
    # Check it is there
    all_hosts_visible = host.get_all_hosts(do_not_navigate=True)
    assert len(all_hosts_visible) == 1 and median_host in all_hosts_visible
def test_quick_search_without_filter(request, hosts, hosts_with_vm_count, host_with_median_vm):
    navigate_to(Host, 'All')
    search.ensure_no_filter_applied()
    assert_no_cfme_exception()
    median_host, median_vm_count = host_with_median_vm
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    search.normal_search(median_host)
    assert_no_cfme_exception()
    # Check it is there
    all_hosts_visible = host.get_all_hosts()
    assert len(all_hosts_visible) == 1 and median_host in all_hosts_visible
def test_quick_search_with_filter(request, hosts, hosts_with_vm_count, host_with_median_vm):
    pytest.sel.force_navigate("infrastructure_hosts")
    median_host, median_vm_count = host_with_median_vm
    search.fill_and_apply_filter(get_expression(False, ">=").format(median_vm_count))
    assert_no_cfme_exception()
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    search.normal_search(median_host)
    assert_no_cfme_exception()
    # Check it is there
    all_hosts_visible = host.get_all_hosts(do_not_navigate=True)
    assert len(all_hosts_visible) == 1 and median_host in all_hosts_visible
def test_quick_search_without_filter(request, hosts, hosts_with_vm_count, host_with_median_vm):
    navigate_to(Host, 'All')
    search.ensure_no_filter_applied()
    assert_no_cfme_exception()
    median_host, median_vm_count = host_with_median_vm
    # Make sure that we empty the regular search field after the test
    request.addfinalizer(search.ensure_normal_search_empty)
    # Filter this host only
    search.normal_search(median_host)
    assert_no_cfme_exception()
    # Check it is there
    all_hosts_visible = host.get_all_hosts(do_not_navigate=True)
    assert len(all_hosts_visible) == 1 and median_host in all_hosts_visible
def test_quick_search_with_filter(hosts, hosts_with_vm_count, host_with_median_vm):
    sel.force_navigate("infrastructure_hosts")
    median_host, median_vm_count = host_with_median_vm
    search.fill_and_apply_filter(
        "fill_count(Host.VMs, >=, %d)" % median_vm_count
    )
    assert_no_cfme_exception()
    # Filter this host only
    search.normal_search(median_host)
    assert_no_cfme_exception()
    # Check it is there
    all_hosts_visible = host.get_all_hosts(do_not_navigate=True)
    assert len(all_hosts_visible) == 1 and median_host in all_hosts_visible
Exemple #20
0
def test_perf_ui_infra_hosts(ui_worker_pid, soft_assert):
    pages, prod_tail = standup_perf_ui(ui_worker_pid, soft_assert)

    nav_limit = 0
    if 'hosts' in perf_tests['ui']['page_check']['infrastructure']:
        nav_limit = perf_tests['ui']['page_check']['infrastructure']['hosts']

    acc_bars = ['Properties', 'Relationships', 'Security', 'Configuration']

    pages.extend(navigate_quadicons(get_all_hosts(), 'host', 'infrastructure_hosts', nav_limit,
        ui_worker_pid, prod_tail, soft_assert, acc_bars))

    pages_to_csv(pages, 'perf_ui_infra_hosts.csv')
    pages_to_statistics_csv(pages, host_filters, 'ui-statistics.csv')
Exemple #21
0
def test_filter_save_and_load(request, hosts, hosts_with_vm_count, host_with_median_vm):
    navigate_to(Host, 'All')
    median_host, median_vm_count = host_with_median_vm
    # We will filter out hosts with less than median VMs
    more_than_median_hosts = list(dropwhile(lambda h: h[1] <= median_vm_count, hosts_with_vm_count))

    filter_name = fauxfactory.gen_alphanumeric()
    # Try save filter
    search.save_filter(get_expression(True), filter_name)
    assert_no_cfme_exception()
    search.reset_filter()

    search.load_and_apply_filter(filter_name, fill_callback={"COUNT": median_vm_count})
    assert_no_cfme_exception()
    request.addfinalizer(search.delete_filter)
    assert len(more_than_median_hosts) == len(host.get_all_hosts(do_not_navigate=True))
def test_filter_save_and_load(request, hosts, hosts_with_vm_count, host_with_median_vm):
    pytest.sel.force_navigate("infrastructure_hosts")
    median_host, median_vm_count = host_with_median_vm
    # We will filter out hosts with less than median VMs
    more_than_median_hosts = list(dropwhile(lambda h: h[1] <= median_vm_count, hosts_with_vm_count))

    filter_name = fauxfactory.gen_alphanumeric()
    # Try save filter
    search.save_filter(get_expression(True), filter_name)
    assert_no_cfme_exception()
    search.reset_filter()

    search.load_and_apply_filter(filter_name, fill_callback={"COUNT": median_vm_count})
    assert_no_cfme_exception()
    request.addfinalizer(search.delete_filter)
    assert len(more_than_median_hosts) == len(host.get_all_hosts(do_not_navigate=True))
Exemple #23
0
def test_delete_host(host, provider, has_mistral_service):
    """Remove host from appliance and Ironic service
    Metadata:
        test_flag: openstack_scale"""
    def is_host_disappeared():
        return host.name not in [
            h.uuid for h in provider.mgmt.iapi.node.list()
        ]

    host.delete(cancel=False)
    wait_for(is_host_disappeared, timeout=300, delay=5)
    wait_for(provider.is_refreshed,
             func_kwargs=dict(refresh_delta=10),
             timeout=600)
    host.browser.refresh()
    assert host.name not in get_all_hosts()
Exemple #24
0
def test_filter_save_and_load(request, hosts, hosts_with_vm_count,
                              host_with_median_vm):
    sel.force_navigate("infrastructure_hosts")
    median_host, median_vm_count = host_with_median_vm
    # We will filter out hosts with less than median VMs
    more_than_median_hosts = list(
        dropwhile(lambda h: h[1] <= median_vm_count, hosts_with_vm_count))

    filter_name = generate_random_string()
    # Try save filter
    search.save_filter("fill_count(Host.VMs, >)", filter_name)
    assert_no_cfme_exception()
    search.reset_filter()

    search.load_and_apply_filter(filter_name,
                                 fill_callback={"COUNT": median_vm_count})
    assert_no_cfme_exception()
    request.addfinalizer(search.delete_filter)
    assert len(more_than_median_hosts) == len(
        host.get_all_hosts(do_not_navigate=True))
def hosts(infra_provider):
    navigate_to(Host, 'All')
    search.ensure_no_filter_applied()
    return host.get_all_hosts()
def hosts(infra_provider):
    navigate_to(Host, 'All')
    search.ensure_no_filter_applied()
    return host.get_all_hosts()