use of org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface in project ovirt-engine by oVirt.
the class VfSchedulerImplTest method validVnicNotPlugged.
@Test
public void validVnicNotPlugged() {
VmNetworkInterface vnic = mockVnic(true);
when(vnic.isPlugged()).thenReturn(false);
initHostWithOneVfsConfig(Collections.singletonList(vnic), 0, true, false, false, false);
assertHostValid(Collections.singletonList(vnic));
}
use of org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface in project ovirt-engine by oVirt.
the class VfSchedulerImplTest method initHostWithOneVfsConfig.
private List<HostDevice> initHostWithOneVfsConfig(List<VmNetworkInterface> passthroughVnics, int numOfVfs, boolean allNetworksAllowed, boolean networkInSriovConfig, boolean labelInSriovConfig, boolean hasFreeVf, boolean freeVfShareIommuGroup, boolean vfDirectlyAttached) {
HostNicVfsConfig hostNicVfsConfig = new HostNicVfsConfig();
List<HostDevice> vfs = passthroughVnics.stream().map(vnic -> updateVfsConfig(hostNicVfsConfig, vnic, numOfVfs, allNetworksAllowed, networkInSriovConfig, labelInSriovConfig, hasFreeVf, freeVfShareIommuGroup, vfDirectlyAttached)).collect(Collectors.toList());
mockVfsConfigsOnHost(Collections.singletonList(hostNicVfsConfig));
return vfs;
}
use of org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface in project ovirt-engine by oVirt.
the class VfSchedulerImplTest method mockVnic.
private VmNetworkInterface mockVnic(boolean passthrough, String networkName) {
VmNetworkInterface vnic = mock(VmNetworkInterface.class);
when(vnic.getId()).thenReturn(Guid.newGuid());
when(vnic.getName()).thenReturn(getRandomString());
when(vnic.isPassthrough()).thenReturn(passthrough);
Network network = createNetwork(networkName);
when(vnic.getNetworkName()).thenReturn(network.getName());
when(vnic.isPlugged()).thenReturn(true);
when(vnic.getVmId()).thenReturn(vmId);
return vnic;
}
use of org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface in project ovirt-engine by oVirt.
the class VfSchedulerImplTest method cleanVmDataTest.
@Test
public void cleanVmDataTest() {
VmNetworkInterface vnic = mockVnic(true);
initHostWithOneVfsConfig(Collections.singletonList(vnic), 1, true, false, false, true);
assertHostValid(Collections.singletonList(vnic));
vfScheduler.cleanVmData(vmId);
assertNull(vfScheduler.getVnicToVfMap(vmId, hostId));
}
use of org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface in project ovirt-engine by oVirt.
the class VfSchedulerImplTest method hostNicNotHaveVfsOnSriovNic.
@Test
public void hostNicNotHaveVfsOnSriovNic() {
VmNetworkInterface vnic = mockVnic(true);
initHostWithOneVfsConfig(Collections.singletonList(vnic), 0, true, false, false, false);
assertHostNotValid(Collections.singletonList(vnic), Collections.singletonList(vnic.getName()));
}
Aggregations