Search in sources :

Example 26 with HostNetworkQos

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

the class EffectiveHostNetworkQosTest method testGetQosWithNullNetworkAttachmentAndNetworkWithQos.

@Test
public void testGetQosWithNullNetworkAttachmentAndNetworkWithQos() throws Exception {
    HostNetworkQos hostNetworkQos = createHostNetworkQos();
    Network network = createNetworkWithQos(hostNetworkQos);
    when(hostNetworkQosDao.get(network.getQosId())).thenReturn(hostNetworkQos);
    assertThat(effectiveHostNetworkQos.getQos(null, network), is(hostNetworkQos));
}
Also used : AnonymousHostNetworkQos(org.ovirt.engine.core.common.businessentities.network.AnonymousHostNetworkQos) HostNetworkQos(org.ovirt.engine.core.common.businessentities.network.HostNetworkQos) Network(org.ovirt.engine.core.common.businessentities.network.Network) Test(org.junit.Test)

Example 27 with HostNetworkQos

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

the class BaseNetworkImplementationDetailsUtilsTest method calculateNetworkImplementationDetailsOverriddenQosOutOfSync.

@Test
public void calculateNetworkImplementationDetailsOverriddenQosOutOfSync() throws Exception {
    HostNetworkQos qos = qosB;
    Network network = createNetwork(testIface.isBridged(), testIface.getMtu(), testIface.getVlanId());
    network.setQosId(qos.getId());
    when(hostNetworkQosDaoMock.get(qos.getId())).thenReturn(qos);
    calculateNetworkImplementationDetailsAndAssertSync(testIface, false, null, network);
}
Also used : AnonymousHostNetworkQos(org.ovirt.engine.core.common.businessentities.network.AnonymousHostNetworkQos) HostNetworkQos(org.ovirt.engine.core.common.businessentities.network.HostNetworkQos) Network(org.ovirt.engine.core.common.businessentities.network.Network) Test(org.junit.Test)

Example 28 with HostNetworkQos

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

the class InterfaceDaoImplTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    statsTest = new HostNetworkStatisticsDaoTest();
    dao = dbFacade.getInterfaceDao();
    existingVdsInterface = dao.get(FixturesTool.VDS_NETWORK_INTERFACE);
    newQos = new HostNetworkQos();
    newQos.setOutAverageLinkshare(30);
    newQos.setOutAverageUpperlimit(30);
    newQos.setOutAverageRealtime(30);
    newVdsInterface = new VdsNetworkInterface();
    newVdsInterface.setStatistics(new VdsNetworkStatistics());
    newVdsInterface.setId(Guid.newGuid());
    newVdsInterface.setName("eth77");
    newVdsInterface.setNetworkName("enginet");
    newVdsInterface.setSpeed(1000);
    newVdsInterface.setType(3);
    newVdsInterface.setMacAddress("01:C0:81:21:71:17");
    newVdsInterface.setIpv4BootProtocol(Ipv4BootProtocol.STATIC_IP);
    newVdsInterface.setIpv4Address("192.168.122.177");
    newVdsInterface.setIpv4Subnet("255.255.255.0");
    newVdsInterface.setIpv4Gateway("192.168.122.1");
    newVdsInterface.setIpv6BootProtocol(Ipv6BootProtocol.AUTOCONF);
    newVdsInterface.setIpv6Address("ipv6 address");
    newVdsInterface.setIpv6Prefix(666);
    newVdsInterface.setIpv6Gateway("ipv6 gateway");
    newVdsInterface.setMtu(1500);
    newVdsInterface.setQos(newQos);
    newVdsStatistics = newVdsInterface.getStatistics();
}
Also used : HostNetworkQos(org.ovirt.engine.core.common.businessentities.network.HostNetworkQos) VdsNetworkStatistics(org.ovirt.engine.core.common.businessentities.network.VdsNetworkStatistics) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)

Example 29 with HostNetworkQos

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

the class HostNetworkQosDaoTest method generateNewEntity.

@Override
protected HostNetworkQos generateNewEntity() {
    HostNetworkQos newQos = new HostNetworkQos();
    newQos.setId(new Guid("de956031-6be2-43d6-bb90-5191c9253321"));
    newQos.setName("host_network_qos_d");
    newQos.setStoragePoolId(FixturesTool.STORAGE_POOL_NO_DOMAINS);
    newQos.setOutAverageLinkshare(1000);
    newQos.setOutAverageUpperlimit(2000);
    newQos.setOutAverageRealtime(500);
    return newQos;
}
Also used : HostNetworkQos(org.ovirt.engine.core.common.businessentities.network.HostNetworkQos) Guid(org.ovirt.engine.core.compat.Guid)

Example 30 with HostNetworkQos

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

the class NetworkAttachmentMapper method map.

@Mapping(from = NetworkAttachment.class, to = org.ovirt.engine.core.common.businessentities.network.NetworkAttachment.class)
public static org.ovirt.engine.core.common.businessentities.network.NetworkAttachment map(NetworkAttachment model, org.ovirt.engine.core.common.businessentities.network.NetworkAttachment template) {
    org.ovirt.engine.core.common.businessentities.network.NetworkAttachment entity = template == null ? new org.ovirt.engine.core.common.businessentities.network.NetworkAttachment() : template;
    if (model.isSetId()) {
        entity.setId(GuidUtils.asGuid(model.getId()));
    }
    if (model.isSetNetwork()) {
        Network networkModel = model.getNetwork();
        if (networkModel.isSetId()) {
            entity.setNetworkId(GuidUtils.asGuid(networkModel.getId()));
        }
        if (networkModel.isSetName()) {
            entity.setNetworkName(networkModel.getName());
        }
    }
    if (model.isSetHostNic()) {
        HostNic hostNic = model.getHostNic();
        if (hostNic.isSetId()) {
            entity.setNicId(GuidUtils.asGuid(hostNic.getId()));
        } else {
            entity.setNicId(null);
        }
        if (hostNic.isSetName()) {
            entity.setNicName(hostNic.getName());
        } else {
            entity.setNicName(null);
        }
    }
    if (model.isSetProperties()) {
        entity.setProperties(CustomPropertiesParser.toMap(model.getProperties()));
    }
    if (model.isSetIpAddressAssignments()) {
        entity.setIpConfiguration(new org.ovirt.engine.core.common.businessentities.network.IpConfiguration());
        IpAddressAssignments ipAddressAssignments = model.getIpAddressAssignments();
        entity.getIpConfiguration().setIPv4Addresses(new ArrayList<>());
        entity.getIpConfiguration().setIpV6Addresses(new ArrayList<>());
        for (IpAddressAssignment ipAddressAssignment : ipAddressAssignments.getIpAddressAssignments()) {
            if (IpVersion.V6 == getIpVersion(ipAddressAssignment)) {
                entity.getIpConfiguration().getIpV6Addresses().add(mapIpv6AddressAssignment(ipAddressAssignment));
            } else {
                entity.getIpConfiguration().getIPv4Addresses().add(mapIpv4AddressAssignment(ipAddressAssignment));
            }
        }
    }
    if (model.isSetDnsResolverConfiguration()) {
        entity.setDnsResolverConfiguration(DnsResolverConfigurationMapper.map(entity.getDnsResolverConfiguration(), model.getDnsResolverConfiguration()));
    }
    if (model.isSetQos()) {
        HostNetworkQos hostNetworkQos = (HostNetworkQos) QosMapper.map(model.getQos(), null);
        entity.setHostNetworkQos(AnonymousHostNetworkQos.fromHostNetworkQos(hostNetworkQos));
    }
    return entity;
}
Also used : AnonymousHostNetworkQos(org.ovirt.engine.core.common.businessentities.network.AnonymousHostNetworkQos) HostNetworkQos(org.ovirt.engine.core.common.businessentities.network.HostNetworkQos) HostNic(org.ovirt.engine.api.model.HostNic) Network(org.ovirt.engine.api.model.Network) IpAddressAssignments(org.ovirt.engine.api.model.IpAddressAssignments) IpAddressAssignment(org.ovirt.engine.api.model.IpAddressAssignment)

Aggregations

HostNetworkQos (org.ovirt.engine.core.common.businessentities.network.HostNetworkQos)32 AnonymousHostNetworkQos (org.ovirt.engine.core.common.businessentities.network.AnonymousHostNetworkQos)11 Network (org.ovirt.engine.core.common.businessentities.network.Network)9 NetworkAttachment (org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)7 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)6 Test (org.junit.Test)5 DnsResolverConfiguration (org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration)5 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)3 List (java.util.List)3 Map (java.util.Map)3 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)3 Guid (org.ovirt.engine.core.compat.Guid)3 StringUtils (org.apache.commons.lang.StringUtils)2 Before (org.junit.Before)2 HostNic (org.ovirt.engine.api.model.HostNic)2 NameServer (org.ovirt.engine.core.common.businessentities.network.NameServer)2 VdsNetworkStatistics (org.ovirt.engine.core.common.businessentities.network.VdsNetworkStatistics)2 EffectiveHostNetworkQos (org.ovirt.engine.core.vdsbroker.EffectiveHostNetworkQos)2 Path (java.nio.file.Path)1