Search in sources :

Example 11 with NetworkQoS

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

the class NetworkQosDaoTest method testGetNetworkQos.

/**
 * Ensures that retrieving VDS by ID works as expected.
 */
@Test
public void testGetNetworkQos() {
    NetworkQoS result = dao.get(qosAId);
    NetworkQoS trueA = new NetworkQoS();
    trueA.setId(qosAId);
    trueA.setName("network_qos_a");
    trueA.setStoragePoolId(FixturesTool.STORAGE_POOL_MIXED_TYPES);
    trueA.setInboundAverage(1000);
    trueA.setInboundPeak(2000);
    trueA.setInboundBurst(500);
    trueA.setOutboundAverage(1000);
    trueA.setOutboundPeak(2000);
    trueA.setOutboundBurst(500);
    assertNotNull(result);
    assertEquals(trueA, result);
}
Also used : NetworkQoS(org.ovirt.engine.core.common.businessentities.network.NetworkQoS) Test(org.junit.Test)

Example 12 with NetworkQoS

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

the class NetworkQosDaoTest method testUpdateNetworkQos.

/**
 * test update
 */
@Test
public void testUpdateNetworkQos() {
    NetworkQoS newB = new NetworkQoS();
    newB.setId(qosBId);
    newB.setName("newB");
    newB.setStoragePoolId(FixturesTool.STORAGE_POOL_MIXED_TYPES);
    newB.setInboundAverage(30);
    newB.setInboundPeak(30);
    newB.setInboundBurst(30);
    newB.setOutboundAverage(30);
    newB.setOutboundPeak(30);
    newB.setOutboundBurst(30);
    dao.update(newB);
    NetworkQoS afterUpdate = dao.get(qosBId);
    assertEquals(newB, afterUpdate);
}
Also used : NetworkQoS(org.ovirt.engine.core.common.businessentities.network.NetworkQoS) Test(org.junit.Test)

Example 13 with NetworkQoS

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

the class NetworkQosDaoTest method checkNameUniquness.

public void checkNameUniquness(String name) {
    NetworkQoS entity = new NetworkQoS();
    entity.setId(Guid.newGuid());
    entity.setName(name);
    entity.setStoragePoolId(FixturesTool.STORAGE_POOL_MIXED_TYPES);
    dao.save(entity);
    entity.setId(Guid.newGuid());
    dao.save(entity);
}
Also used : NetworkQoS(org.ovirt.engine.core.common.businessentities.network.NetworkQoS)

Example 14 with NetworkQoS

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

the class QosMapper method mapNetworkQosToModel.

private static void mapNetworkQosToModel(QosBase entity, Qos model) {
    NetworkQoS networkQos = verifyAndCast(entity, NetworkQoS.class);
    if (networkQos != null) {
        model.setInboundAverage(networkQos.getInboundAverage());
        model.setInboundPeak(networkQos.getInboundPeak());
        model.setInboundBurst(networkQos.getInboundBurst());
        model.setOutboundAverage(networkQos.getOutboundAverage());
        model.setOutboundPeak(networkQos.getOutboundPeak());
        model.setOutboundBurst(networkQos.getOutboundBurst());
    }
}
Also used : NetworkQoS(org.ovirt.engine.core.common.businessentities.network.NetworkQoS)

Example 15 with NetworkQoS

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

the class VmInfoBuildUtils method addQosForDevice.

private void addQosForDevice(Map<String, Object> struct, VnicProfile vnicProfile) {
    Guid qosId = vnicProfile.getNetworkQosId();
    @SuppressWarnings("unchecked") Map<String, Object> specParams = (Map<String, Object>) struct.get(VdsProperties.SpecParams);
    if (specParams == null) {
        specParams = new HashMap<>();
        struct.put(VdsProperties.SpecParams, specParams);
    }
    NetworkQoS networkQoS = (qosId == null) ? new NetworkQoS() : networkQosDao.get(qosId);
    NetworkQosMapper qosMapper = new NetworkQosMapper(specParams, VdsProperties.QOS_INBOUND, VdsProperties.QOS_OUTBOUND);
    qosMapper.serialize(networkQoS);
}
Also used : NetworkQoS(org.ovirt.engine.core.common.businessentities.network.NetworkQoS) NetworkQosMapper(org.ovirt.engine.core.vdsbroker.vdsbroker.NetworkQosMapper) Guid(org.ovirt.engine.core.compat.Guid) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

NetworkQoS (org.ovirt.engine.core.common.businessentities.network.NetworkQoS)21 Test (org.junit.Test)6 ArrayList (java.util.ArrayList)3 QosParametersBase (org.ovirt.engine.core.common.action.QosParametersBase)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)2 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)2 List (java.util.List)1 Default (javax.validation.groups.Default)1 Before (org.junit.Before)1 DataCenter (org.ovirt.engine.api.model.DataCenter)1 Qos (org.ovirt.engine.api.model.Qos)1 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)1 Network (org.ovirt.engine.core.common.businessentities.network.Network)1 NetworkFilter (org.ovirt.engine.core.common.businessentities.network.NetworkFilter)1 VnicProfile (org.ovirt.engine.core.common.businessentities.network.VnicProfile)1 VnicProfileView (org.ovirt.engine.core.common.businessentities.network.VnicProfileView)1 QosQueryParameterBase (org.ovirt.engine.core.common.queries.QosQueryParameterBase)1 QueryParametersBase (org.ovirt.engine.core.common.queries.QueryParametersBase)1