use of org.ovirt.engine.core.common.businessentities.network.VmNetworkStatistics in project ovirt-engine by oVirt.
the class VmNetworkInterfaceDaoTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
dao = dbFacade.getVmNetworkInterfaceDao();
existingVmInterface = dao.get(FixturesTool.VM_NETWORK_INTERFACE);
existingTemplateInterface = dao.get(FixturesTool.TEMPLATE_NETWORK_INTERFACE);
newVmInterface = new VmNetworkInterface();
newVmInterface.setStatistics(new VmNetworkStatistics());
newVmInterface.setId(Guid.newGuid());
newVmInterface.setVnicProfileId(FixturesTool.VM_NETWORK_INTERFACE_PROFILE);
newVmInterface.setName("eth77");
newVmInterface.setNetworkName("enginet");
newVmInterface.setLinked(true);
newVmInterface.setSpeed(1000);
newVmInterface.setType(3);
newVmInterface.setMacAddress("01:C0:81:21:71:17");
newVmDevice.setType(VmDeviceGeneralType.INTERFACE);
newVmDevice.setDevice("bridge");
newVmDevice.setAddress("sample");
newVmDevice.setManaged(true);
newVmDevice.setPlugged(true);
newVmDevice.setReadOnly(false);
Map<String, String> customProp = new LinkedHashMap<>();
customProp.put("prop1", "val1");
newVmDevice.setCustomProperties(customProp);
}
use of org.ovirt.engine.core.common.businessentities.network.VmNetworkStatistics in project ovirt-engine by oVirt.
the class VmNetworkStatisticsDaoTest method testGet.
/**
* Ensures that the network interface statistics entity is returned.
*/
@Test
public void testGet() {
VmNetworkStatistics result = dao.get(FixturesTool.VM_NETWORK_INTERFACE);
assertNotNull(result);
assertEquals(FixturesTool.VM_NETWORK_INTERFACE, result.getId());
}
use of org.ovirt.engine.core.common.businessentities.network.VmNetworkStatistics in project ovirt-engine by oVirt.
the class VmNetworkStatisticsDaoTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
dao = dbFacade.getVmNetworkStatisticsDao();
newVmStatistics = new VmNetworkStatistics();
newVmStatistics.setId(NEW_INTERFACE_ID);
newVmStatistics.setVmId(VM_ID);
newVmStatistics.setStatus(InterfaceStatus.DOWN);
newVmStatistics.setSampleTime(0.0);
newVmStatistics.setReceiveDropRate(0.0);
newVmStatistics.setReceiveRate(0.0);
newVmStatistics.setReceivedBytes(0L);
newVmStatistics.setReceivedBytesOffset(0L);
newVmStatistics.setTransmitDropRate(0.0);
newVmStatistics.setTransmitRate(0.0);
newVmStatistics.setTransmittedBytes(0L);
newVmStatistics.setTransmittedBytesOffset(0L);
}
use of org.ovirt.engine.core.common.businessentities.network.VmNetworkStatistics in project ovirt-engine by oVirt.
the class VmNetworkStatisticsDaoTest method testGetWithNonExistingId.
/**
* Ensures null is returned.
*/
@Test
public void testGetWithNonExistingId() {
VmNetworkStatistics result = dao.get(Guid.newGuid());
assertNull(result);
}
use of org.ovirt.engine.core.common.businessentities.network.VmNetworkStatistics in project ovirt-engine by oVirt.
the class ImportVmTemplateCommand method addVmInterfaces.
protected void addVmInterfaces() {
VnicProfileHelper vnicProfileHelper = new VnicProfileHelper(getVmTemplate().getClusterId(), getStoragePoolId(), AuditLogType.IMPORTEXPORT_IMPORT_TEMPLATE_INVALID_INTERFACES);
for (VmNetworkInterface iface : getVmTemplate().getInterfaces()) {
if (iface.getId() == null) {
iface.setId(Guid.newGuid());
}
iface.setVmId(getVmTemplateId());
VmNic nic = new VmNic();
nic.setId(iface.getId());
nic.setVmTemplateId(getVmTemplateId());
nic.setName(iface.getName());
nic.setLinked(iface.isLinked());
nic.setSpeed(iface.getSpeed());
nic.setType(iface.getType());
vnicProfileHelper.updateNicWithVnicProfileForUser(iface, getCurrentUser());
nic.setVnicProfileId(iface.getVnicProfileId());
vmNicDao.save(nic);
getCompensationContext().snapshotNewEntity(nic);
VmNetworkStatistics iStat = new VmNetworkStatistics();
nic.setStatistics(iStat);
iStat.setId(iface.getId());
iStat.setVmId(getVmTemplateId());
vmNetworkStatisticsDao.save(iStat);
getCompensationContext().snapshotNewEntity(iStat);
}
vnicProfileHelper.auditInvalidInterfaces(getVmTemplateName());
}
Aggregations