use of org.ovirt.engine.core.common.businessentities.network.NetworkQoS in project ovirt-engine by oVirt.
the class NetworkQosValidatorTest method setup.
@Before
public void setup() {
qos = new NetworkQoS();
oldQos = new NetworkQoS();
allQos = new ArrayList<>();
validator = spy(new NetworkQosValidator(qos));
doReturn(oldQos).when(validator).getOldQos();
doReturn(allQos).when(validator).getAllQosInDcByType();
nullValidator = spy(new NetworkQosValidator(null));
doReturn(oldQos).when(nullValidator).getOldQos();
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkQoS in project ovirt-engine by oVirt.
the class VnicProfileModel method flush.
public void flush() {
if (vnicProfile == null) {
vnicProfile = new VnicProfile();
}
vnicProfile.setName(getName().getEntity());
Network network = getNetwork().getSelectedItem();
vnicProfile.setNetworkId(network != null ? network.getId() : null);
NetworkQoS networkQoS = getNetworkQoS().getSelectedItem();
vnicProfile.setNetworkQosId(networkQoS != null && networkQoS.getId() != null && !networkQoS.getId().equals(Guid.Empty) ? networkQoS.getId() : null);
NetworkFilter networkFilter = getNetworkFilter().getSelectedItem();
vnicProfile.setNetworkFilterId(networkFilter != null ? networkFilter.getId() : null);
vnicProfile.setPortMirroring(getPortMirroring().getEntity());
vnicProfile.setPassthrough(getPassthrough().getEntity());
if (vnicProfile.isPassthrough()) {
vnicProfile.setMigratable(getMigratable().getEntity());
}
if (customPropertiesVisible) {
vnicProfile.setCustomProperties(KeyValueModel.convertProperties(getCustomPropertySheet().serialize()));
} else {
vnicProfile.setCustomProperties(null);
}
vnicProfile.setDescription(getDescription().getEntity());
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkQoS in project ovirt-engine by oVirt.
the class NetworkQosDaoTest method testGetWithInvalidId.
/**
* Ensures that retrieving with an invalid ID returns null.
*/
@Test
public void testGetWithInvalidId() {
NetworkQoS result = dao.get(Guid.newGuid());
assertNull(result);
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkQoS in project ovirt-engine by oVirt.
the class NetworkQosDaoTest method testSaveNetworkQos.
/**
* test save
*/
@Test
public void testSaveNetworkQos() {
NetworkQoS qosD = new NetworkQoS();
qosD.setId(qosDId);
qosD.setName("qos_d");
qosD.setStoragePoolId(FixturesTool.STORAGE_POOL_MIXED_TYPES);
qosD.setInboundAverage(200);
qosD.setInboundPeak(200);
qosD.setInboundBurst(200);
qosD.setOutboundAverage(200);
qosD.setOutboundPeak(200);
qosD.setOutboundBurst(200);
dao.save(qosD);
NetworkQoS returnedD = dao.get(qosDId);
assertEquals(qosD, returnedD);
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkQoS in project ovirt-engine by oVirt.
the class BaseNetworkQosModel method init.
public void init(NetworkQoS qos) {
if (qos == null) {
networkQoS = new NetworkQoS();
} else {
networkQoS = qos;
}
if (networkQoS.getInboundAverage() == null || networkQoS.getInboundPeak() == null || networkQoS.getInboundBurst() == null) {
getInbound().getEnabled().setEntity(false);
} else {
getInbound().getAverage().setEntity(networkQoS.getInboundAverage());
getInbound().getPeak().setEntity(networkQoS.getInboundPeak());
getInbound().getBurst().setEntity(networkQoS.getInboundBurst());
}
if (networkQoS.getOutboundAverage() == null || networkQoS.getOutboundPeak() == null || networkQoS.getOutboundBurst() == null) {
getOutbound().getEnabled().setEntity(false);
} else {
getOutbound().getAverage().setEntity(networkQoS.getOutboundAverage());
getOutbound().getPeak().setEntity(networkQoS.getOutboundPeak());
getOutbound().getBurst().setEntity(networkQoS.getOutboundBurst());
}
}
Aggregations