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));
}
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);
}
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);
}
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());
}
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);
}
Aggregations