def test_modify_vnic_sec_groups_on_ext_networks(running_vm_0, system,
                                                ovirt_external_network,
                                                default_ovn_provider_client):
    with netlib.create_vnic_profile(system, 'temporary',
                                    ovirt_external_network) as profile:
        with _create_security_group(default_ovn_provider_client, 'temporary',
                                    'temporary sec group') as sec_group:
            profile.custom_properties = [
                netlib.CustomProperty('SecurityGroups', sec_group.id)
            ]

            vnic = running_vm_0.get_vnic(VNIC0_NAME)
            def_group = default_ovn_provider_client.get_security_group(
                'Default')
            vnic.vnic_profile.custom_properties = [
                netlib.CustomProperty('SecurityGroups', def_group.id)
            ]

            with _setup_vnic_profile(vnic, profile):
                assert vnic.vnic_profile.name == 'temporary'
                assert [sec_group.id] == [
                    p.value for p in vnic.vnic_profile.custom_properties
                ]

                ovn_port = _lookup_port_by_device_id(
                    vnic.id, default_ovn_provider_client)
                assert ovn_port
                assert [sec_group.id] == ovn_port.security_groups
Exemplo n.º 2
0
def test_assign_network_filter(running_vm_0, system, ovirtmgmt_network):
    with netlib.create_vnic_profile(system, 'temporary',
                                    ovirtmgmt_network) as profile:
        network_filter = netlib.NetworkFilter(system)
        network_filter.import_by_name('allow-dhcp')
        profile.filter = network_filter

        vnic = next(running_vm_0.vnics())
        original_profile = vnic.vnic_profile

        try:
            vnic.vnic_profile = profile
            assert vnic.vnic_profile.name == 'temporary'
            assert vnic.vnic_profile.filter.name == 'allow-dhcp'
        finally:
            vnic.vnic_profile = original_profile
def test_setup_net_with_qos(system, default_data_center, default_cluster,
                            default_storage_domain, cluster_host_up,
                            qos_net, vm_qos):

    qos_configs = default_data_center.list_qos()
    assert len([qos for qos in qos_configs if qos.name in QOS_NAMES]) == 2

    with clusterlib.network_assignment(default_cluster, qos_net):
        attach_data = _create_net_attachment_data(qos_net)
        with hostlib.setup_networks(cluster_host_up, (attach_data,)):
            with netlib.create_vnic_profile(
                    system, QOS_VP, qos_net, vm_qos) as profile:
                with vm_down(
                        system, default_cluster, default_storage_domain) as vm:
                    vm.create_vnic(NIC2, profile)
                    vm.run()
                    vm.wait_for_powering_up_status()
Exemplo n.º 4
0
def test_setup_net_with_qos(system, default_data_center, default_cluster,
                            default_storage_domain, cluster_host_up,
                            qos_net, vm_qos):

    qos_configs = default_data_center.list_qos()
    assert len([qos for qos in qos_configs if qos.name in QOS_NAMES]) == 2

    with clusterlib.network_assignment(default_cluster, qos_net):
        attach_data = _create_net_attachment_data(qos_net)
        with hostlib.setup_networks(cluster_host_up, (attach_data,)):
            with netlib.create_vnic_profile(
                    system, QOS_VP, qos_net, vm_qos) as profile:
                with vm_down(
                        system, default_cluster, default_storage_domain) as vm:
                    vm.create_vnic(NIC2, profile)
                    vm.run()
                    vm.wait_for_powering_up_status()
def test_modify_vnic(running_vm_0, system, ovirtmgmt_network, engine):
    with netlib.create_vnic_profile(system,
                                    'temporary', ovirtmgmt_network) as profile:
        uuid = '4c9f6b27-87af-4ab2-b249-ddd97dde326f'
        profile.custom_properties = [
            netlib.CustomProperty('SecurityGroups', uuid)]

        network_filter = netlib.NetworkFilter(system)
        network_filter.import_by_name('allow-dhcp')
        profile.filter = network_filter

        vnic = next(running_vm_0.vnics())
        original_profile = vnic.vnic_profile

        try:
            vnic.vnic_profile = profile
            assert vnic.vnic_profile.name == 'temporary'
            assert [uuid] == [
                p.value for p in vnic.vnic_profile.custom_properties]
            assert vnic.vnic_profile.filter.name == 'allow-dhcp'
        finally:
            vnic.vnic_profile = original_profile