Search in sources :

Example 16 with NetworkQoS

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();
}
Also used : NetworkQoS(org.ovirt.engine.core.common.businessentities.network.NetworkQoS) Before(org.junit.Before)

Example 17 with NetworkQoS

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());
}
Also used : Network(org.ovirt.engine.core.common.businessentities.network.Network) NetworkQoS(org.ovirt.engine.core.common.businessentities.network.NetworkQoS) NetworkFilter(org.ovirt.engine.core.common.businessentities.network.NetworkFilter) VnicProfile(org.ovirt.engine.core.common.businessentities.network.VnicProfile)

Example 18 with NetworkQoS

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);
}
Also used : NetworkQoS(org.ovirt.engine.core.common.businessentities.network.NetworkQoS) Test(org.junit.Test)

Example 19 with NetworkQoS

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);
}
Also used : NetworkQoS(org.ovirt.engine.core.common.businessentities.network.NetworkQoS) Test(org.junit.Test)

Example 20 with NetworkQoS

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());
    }
}
Also used : NetworkQoS(org.ovirt.engine.core.common.businessentities.network.NetworkQoS)

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