Search in sources :

Example 6 with HostNicVfsConfig

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

the class VfSchedulerImplTest method multipleVfsConfigsCommon.

private void multipleVfsConfigsCommon(boolean firstValid) {
    VmNetworkInterface vnic = mockVnic(true);
    HostNicVfsConfig hostNicVfsConfig1 = new HostNicVfsConfig();
    updateVfsConfig(hostNicVfsConfig1, vnic, firstValid, false, firstValid);
    HostNicVfsConfig hostNicVfsConfig2 = new HostNicVfsConfig();
    updateVfsConfig(hostNicVfsConfig2, vnic, !firstValid, false, !firstValid);
    mockVfsConfigsOnHost(Arrays.asList(hostNicVfsConfig1, hostNicVfsConfig2));
    assertHostValid(Collections.singletonList(vnic));
}
Also used : HostNicVfsConfig(org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig) VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)

Example 7 with HostNicVfsConfig

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

the class GetAllVfsConfigByHostIdQueryTest method testExecuteQuery.

@Test
public void testExecuteQuery() {
    doReturn(networkDeviceHelper).when(getQuery()).getNetworkDeviceHelper();
    Guid hostId = Guid.newGuid();
    IdQueryParameters paramsMock = getQueryParameters();
    when(paramsMock.getId()).thenReturn(hostId);
    List<HostNicVfsConfig> vfsConfigs = new ArrayList<>();
    vfsConfigs.add(new HostNicVfsConfig());
    when(networkDeviceHelper.getHostNicVfsConfigsWithNumVfsDataByHostId(hostId)).thenReturn(vfsConfigs);
    getQuery().executeQueryCommand();
    List<HostNicVfsConfig> result = getQuery().getQueryReturnValue().getReturnValue();
    assertEquals(vfsConfigs, result);
}
Also used : HostNicVfsConfig(org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ArrayList(java.util.ArrayList) Guid(org.ovirt.engine.core.compat.Guid) Test(org.junit.Test) AbstractQueryTest(org.ovirt.engine.core.bll.AbstractQueryTest)

Example 8 with HostNicVfsConfig

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

the class HostNicVfsConfigDaoTest method testGetById.

/**
 * Ensures that retrieving a hostNicVfsConfig by id works as expected.
 */
@Test
public void testGetById() {
    HostNicVfsConfig result = dao.get(FixturesTool.HOST_NIC_VFS_CONFIG);
    assertNotNull(result);
    assertEquals(FixturesTool.HOST_NIC_VFS_CONFIG, result.getId());
    checkNetworksAndLabels(result, 0, 0);
}
Also used : HostNicVfsConfig(org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig) Test(org.junit.Test)

Example 9 with HostNicVfsConfig

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

the class HostNicVfsConfigDaoTest method testGetByNicId.

/**
 * Ensures that retrieving a hostNicVfsConfig by id works as expected.
 */
@Test
public void testGetByNicId() {
    HostNicVfsConfig result = dao.getByNicId(FixturesTool.VDS_NETWORK_INTERFACE);
    assertNotNull(result);
    assertEquals(FixturesTool.VDS_NETWORK_INTERFACE, result.getNicId());
}
Also used : HostNicVfsConfig(org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig) Test(org.junit.Test)

Example 10 with HostNicVfsConfig

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

the class HostNicVfsConfigDaoTest method commonUpdate.

private void commonUpdate(Guid vfsConfigId, boolean allNetworksAllowed) {
    HostNicVfsConfig before = dao.get(vfsConfigId);
    before.setNicId(FixturesTool.VDS_NETWORK_INTERFACE_WITHOUT_QOS);
    before.setMaxNumOfVfs(before.getMaxNumOfVfs() + 1);
    before.setNumOfVfs(before.getNumOfVfs() + 1);
    before.setAllNetworksAllowed(allNetworksAllowed);
    if (allNetworksAllowed) {
        before.setNetworks(new HashSet<>());
        before.setNetworkLabels(new HashSet<>());
    } else {
        addNetworks(before);
        addLabels(before);
    }
    dao.update(before);
    HostNicVfsConfig after = dao.get(vfsConfigId);
    assertNotNull(after);
    assertHostNicVfsConfigEquals(before, after);
}
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