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));
}
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);
}
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();
}
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;
}
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;
}
Aggregations