@Override public HostNetworkQos createQosEntity(ResultSet rs) throws SQLException { HostNetworkQos entity = new HostNetworkQos(); entity.setOutAverageLinkshare(getInteger(rs, OUT_AVERAGE_LINKSHARE)); entity.setOutAverageUpperlimit(getInteger(rs, OUT_AVERAGE_UPPERLIMIT)); entity.setOutAverageRealtime(getInteger(rs, OUT_AVERAGE_REALTIME)); return entity; } }
@Test public void testIsNetworkInSyncWhenAverageLinkShareDifferent() { ifaceQos.setOutAverageLinkshare(1); networkQos.setOutAverageLinkshare(2); assertThat(createTestedInstanceWithSameNonQosValues().isNetworkInSync(), is(false)); }
private static void mapHostNetworkQosToEntity(Qos model, HostNetworkQos entity) { if (model.isSetOutboundAverageLinkshare()) { entity.setOutAverageLinkshare(model.getOutboundAverageLinkshare()); } if (model.isSetOutboundAverageUpperlimit()) { entity.setOutAverageUpperlimit(model.getOutboundAverageUpperlimit()); } if (model.isSetOutboundAverageRealtime()) { entity.setOutAverageRealtime(model.getOutboundAverageRealtime()); } }
@Test public void testReportConfigurationsOnHost() { NetworkInSyncWithVdsNetworkInterface testedInstanceWithSameNonQosValues = createTestedInstanceWithSameNonQosValues(); ifaceQos.setOutAverageLinkshare(1); ifaceQos.setOutAverageUpperlimit(1); ifaceQos.setOutAverageRealtime(1); ReportedConfigurations reportedConfigurations = testedInstanceWithSameNonQosValues.reportConfigurationsOnHost(); assertThat(reportedConfigurations.isNetworkInSync(), is(false)); List<ReportedConfiguration> reportedConfigurationList = reportedConfigurations.getReportedConfigurationList(); List<ReportedConfiguration> expectedReportedConfigurations = addReportedConfigurations( combineReportedConfigurations(createBasicReportedConfigurations(), reportQos(false)), defaultRouteReportedConfiguration(false) ); assertThat(reportedConfigurationList.containsAll(expectedReportedConfigurations), is(true)); assertThat(reportedConfigurationList.size(), is(expectedReportedConfigurations.size())); }
@Override protected void updateExistingEntity() { existingEntity.setName("host_network_qos_b"); existingEntity.setStoragePoolId(FixturesTool.STORAGE_POOL_MIXED_TYPES); existingEntity.setOutAverageLinkshare(1000); existingEntity.setOutAverageUpperlimit(2000); existingEntity.setOutAverageRealtime(500); }
@Override public void flush(HostNetworkQos qos) { qos.setOutAverageLinkshare(parseInteger(getOutAverageLinkshare().getEntity())); qos.setOutAverageUpperlimit(parseInteger(getOutAverageUpperlimit().getEntity())); qos.setOutAverageRealtime(parseInteger(getOutAverageRealtime().getEntity())); }
NetworkInSyncWithVdsNetworkInterface testedInstanceWithSameNonQosValues = createTestedInstanceWithSameNonQosValues(); networkQos.setOutAverageLinkshare(1); networkQos.setOutAverageUpperlimit(1); networkQos.setOutAverageRealtime(1);
@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; }
@BeforeEach @Override public void setUp() throws Exception { super.setUp(); 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(); }