Search in sources :

Example 16 with HostNicVfsConfig

use of org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig in project ovirt-engine by oVirt.

the class HostNicVfsConfigDaoTest method testGetWithInvalidId.

/**
 * Ensures that a null hostNicVfsConfig is returned.
 */
@Test
public void testGetWithInvalidId() {
    HostNicVfsConfig result = dao.get(Guid.Empty);
    assertNull(result);
}
Also used : HostNicVfsConfig(org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig) Test(org.junit.Test)

Example 17 with HostNicVfsConfig

use of org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig in project ovirt-engine by oVirt.

the class HostNicVfsConfigDaoTest method testAddNetwork.

@Test
public void testAddNetwork() {
    HostNicVfsConfig vfsConfig = dao.get(FixturesTool.HOST_NIC_VFS_CONFIG_NOT_ALL_NETWORKS_ALLOWED_2);
    checkNetworks(vfsConfig, 1);
    dao.addNetwork(FixturesTool.HOST_NIC_VFS_CONFIG_NOT_ALL_NETWORKS_ALLOWED_2, FixturesTool.NETWORK_ENGINE_2);
    vfsConfig = dao.get(FixturesTool.HOST_NIC_VFS_CONFIG_NOT_ALL_NETWORKS_ALLOWED_2);
    checkNetworks(vfsConfig, 2);
}
Also used : HostNicVfsConfig(org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig) Test(org.junit.Test)

Example 18 with HostNicVfsConfig

use of org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig in project ovirt-engine by oVirt.

the class HostNicVfsConfigDaoTest method testAddLabel.

@Test
public void testAddLabel() {
    HostNicVfsConfig vfsConfig = dao.get(FixturesTool.HOST_NIC_VFS_CONFIG_NOT_ALL_NETWORKS_ALLOWED_2);
    checkLabels(vfsConfig, 3);
    String label = "newLbl";
    dao.addLabel(FixturesTool.HOST_NIC_VFS_CONFIG_NOT_ALL_NETWORKS_ALLOWED_2, label);
    vfsConfig = dao.get(FixturesTool.HOST_NIC_VFS_CONFIG_NOT_ALL_NETWORKS_ALLOWED_2);
    checkLabels(vfsConfig, 4);
}
Also used : HostNicVfsConfig(org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig) Test(org.junit.Test)

Example 19 with HostNicVfsConfig

use of org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig in project ovirt-engine by oVirt.

the class BackendVirtualFunctionAllowedNetworksResource method loadVfAllowedNetworks.

private Set<Guid> loadVfAllowedNetworks() {
    final BackendHostNicsResource hostNicsResource = getParent();
    final HostNicVfsConfig vfsConfig = hostNicsResource.findVfsConfig(nicId);
    if (vfsConfig == null) {
        return Collections.emptySet();
    }
    final Set<Guid> networkIds = vfsConfig.getNetworks();
    return networkIds;
}
Also used : HostNicVfsConfig(org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig) Guid(org.ovirt.engine.core.compat.Guid)

Example 20 with HostNicVfsConfig

use of org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig in project ovirt-engine by oVirt.

the class BackendVirtualFunctionAllowedLabelsResource method getHostNicLabels.

@Override
protected List<NetworkLabel> getHostNicLabels(Guid hostNicId) {
    final BackendHostNicsResource hostNicsResource = inject(new BackendHostNicsResource(hostId));
    final HostNicVfsConfig vfsConfig = hostNicsResource.findVfsConfig(hostNicId);
    if (vfsConfig == null) {
        return Collections.emptyList();
    }
    final Set<String> networkLabelIds = vfsConfig.getNetworkLabels();
    return networkLabelIds.stream().map(NetworkLabel::new).collect(toList());
}
Also used : HostNicVfsConfig(org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig)

Aggregations

HostNicVfsConfig (org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig)34 Test (org.junit.Test)13 Guid (org.ovirt.engine.core.compat.Guid)8 ArrayList (java.util.ArrayList)7 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)7 VmNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)6 HashMap (java.util.HashMap)5 Map (java.util.Map)5 HostDevice (org.ovirt.engine.core.common.businessentities.HostDevice)5 List (java.util.List)4 Network (org.ovirt.engine.core.common.businessentities.network.Network)4 Collections (java.util.Collections)3 HashSet (java.util.HashSet)3 Arrays (java.util.Arrays)2 Collectors (java.util.stream.Collectors)2 RandomStringUtils (org.apache.commons.lang.RandomStringUtils)2 Assert.assertEquals (org.junit.Assert.assertEquals)2 Assert.assertNotNull (org.junit.Assert.assertNotNull)2 Assert.assertNull (org.junit.Assert.assertNull)2 Before (org.junit.Before)2