Exemple #1
0
def modify_ip_config(engine, host, network_name, ip_configuration):
    network_id = engine.networks_service().list(search=u'name={}'.format(
        test_utils.quote_search_string(network_name)).encode('utf-8'))[0].id

    attachment = _get_attachment_by_id(host, network_id)
    attachment.ip_address_assignments = ip_configuration

    return host.setup_networks(modified_network_attachments=[attachment],
                               check_connectivity=True)
Exemple #2
0
def set_network_usages_in_cluster(engine, network_name, cluster_name, usages):
    cluster_service = test_utils.get_cluster_service(engine, cluster_name)

    network = engine.networks_service().list(search=u'name={}'.format(
        test_utils.quote_search_string(network_name)).encode('utf-8'))[0]
    network_service = cluster_service.networks_service().network_service(
        id=network.id)

    network.usages = usages

    return network_service.update(network)
Exemple #3
0
def set_network_required_in_cluster(engine, network_name, cluster_name,
                                    required):
    cluster_service = test_utils.get_cluster_service(engine, cluster_name)
    query = u'name={}'.format(test_utils.quote_search_string(network_name))

    network = engine.networks_service().list(search=query)[0]
    network_service = cluster_service.networks_service().network_service(
        id=network.id)

    network.required = required

    return network_service.update(network)
def set_network_usages_in_cluster(engine, network_name, cluster_name, usages):
    cluster_service = test_utils.get_cluster_service(engine, cluster_name)

    network = engine.networks_service().list(
        search=u'name={}'.format(
            test_utils.quote_search_string(network_name)).encode('utf-8'))[0]
    network_service = cluster_service.networks_service().network_service(
        id=network.id)

    network.usages = usages

    return network_service.update(network)
Exemple #5
0
def detach_network_from_host(engine, host, network_name, bond_name=None):
    network_id = engine.networks_service().list(
        search=u'name={}'.format(
            test_utils.quote_search_string(network_name)).encode('utf-8'))[0].id

    attachment = _get_attachment_by_id(host, network_id)
    bonds = [nic for nic in host.nics_service().list() if bond_name and
             nic.name == bond_name]  # there is no more than one bond

    return host.setup_networks(
        removed_bonds=bonds,
        removed_network_attachments=[attachment],
        check_connectivity=True)
Exemple #6
0
def modify_ip_config(engine, host, network_name, ip_configuration):
    network_id = engine.networks_service().list(
        search=u'name={}'.format(
            test_utils.quote_search_string(network_name)).encode('utf-8'))[0].id

    attachment = _get_attachment_by_id(host, network_id)
    attachment.ip_address_assignments = ip_configuration

    testlib.assert_equals_within_short(
        lambda:
        _setup_host_networks_without_conflict(
            host=host,
            modified_network_attachments=[attachment],
            check_connectivity=True), True, [])
def set_network_usages_in_cluster(engine, network_name, cluster_name, usages):
    clusters_service = engine.clusters_service()
    cluster = clusters_service.list(search='name={}'.format(cluster_name))[0]
    cluster_service = clusters_service.cluster_service(cluster.id)

    network = engine.networks_service().list(
        search='name={}'.format(
            test_utils.quote_search_string(network_name)))[0]
    network_service = cluster_service.networks_service().network_service(
        id=network.id)

    network.usages = usages

    return network_service.update(network)
def modify_ip_config(engine, host, network_name, ip_configuration):
    network_id = engine.networks_service().list(
        search=u'name={}'.format(
            test_utils.quote_search_string(network_name)).encode('utf-8'))[0].id

    attachment = _get_attachment_by_id(host, network_id)
    attachment.ip_address_assignments = ip_configuration

    testlib.assert_equals_within_short(
        lambda:
        _setup_host_networks_without_conflict(
            host=host,
            modified_network_attachments=[attachment],
            check_connectivity=True), True, [])
Exemple #9
0
def detach_network_from_host(engine, host, network_name, bond_name=None):
    network_id = engine.networks_service().list(
        search=u'name={}'.format(
            test_utils.quote_search_string(network_name)).encode('utf-8'))[0].id

    attachment = _get_attachment_by_id(host, network_id)
    bonds = [nic for nic in host.nics_service().list() if bond_name and
             nic.name == bond_name]  # there is no more than one bond
    testlib.assert_equals_within_short(
        lambda:
        _setup_host_networks_without_conflict(
            host=host,
            removed_bonds=bonds,
            removed_network_attachments=[attachment],
            check_connectivity=True), True, [])
def detach_network_from_host(engine, host, network_name, bond_name=None):
    network_id = engine.networks_service().list(
        search=u'name={}'.format(
            test_utils.quote_search_string(network_name)).encode('utf-8'))[0].id

    attachment = _get_attachment_by_id(host, network_id)
    bonds = [nic for nic in host.nics_service().list() if bond_name and
             nic.name == bond_name]  # there is no more than one bond

    testlib.assert_equals_within_short(
        lambda:
        _setup_host_networks_without_conflict(
            host=host,
            removed_bonds=bonds,
            removed_network_attachments=[attachment],
            check_connectivity=True), True, [])