@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; }
@Override protected MapSqlParameterSource createFullParametersMapper(HostNetworkQos obj) { MapSqlParameterSource map = super.createFullParametersMapper(obj); map.addValue(OUT_AVERAGE_LINKSHARE, obj.getOutAverageLinkshare()); map.addValue(OUT_AVERAGE_UPPERLIMIT, obj.getOutAverageUpperlimit()); map.addValue(OUT_AVERAGE_REALTIME, obj.getOutAverageRealtime()); return map; }
private HostNetworkQos asHostNetworkQos(AnonymousHostNetworkQos anonymousHostNetworkQos) { return HostNetworkQos.fromAnonymousHostNetworkQos(anonymousHostNetworkQos); }
@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; } }
@Override public String toString() { return ToStringBuilder.forInstance(this) .append("outAverageLinkshare", renderQosParameter(getOutAverageLinkshare())) .append("outAverageUpperlimit", renderQosParameter(getOutAverageUpperlimit())) .append("outAverageRealtime", renderQosParameter(getOutAverageRealtime())) .build(); }
@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); }
NetworkInSyncWithVdsNetworkInterface testedInstanceWithSameNonQosValues = createTestedInstanceWithSameNonQosValues(); networkQos.setOutAverageLinkshare(1); networkQos.setOutAverageUpperlimit(1); networkQos.setOutAverageRealtime(1); networkQos.getOutAverageLinkshare(), false), new ReportedConfiguration(ReportedConfigurationType.OUT_AVERAGE_REAL_TIME, null, networkQos.getOutAverageRealtime(), false), new ReportedConfiguration(ReportedConfigurationType.OUT_AVERAGE_UPPER_LIMIT, null, networkQos.getOutAverageUpperlimit(), false) );
@Override public void init(HostNetworkQos qos) { if (qos == null) { qos = new HostNetworkQos(); } getOutAverageLinkshare().setEntity(render(qos.getOutAverageLinkshare())); getOutAverageUpperlimit().setEntity(render(qos.getOutAverageUpperlimit())); getOutAverageRealtime().setEntity(render(qos.getOutAverageRealtime())); }
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()); } }
public static HostNetworkQos createEmptyHostNetworkQos() { HostNetworkQos qos = new HostNetworkQos(); qos.setName(ConstantsManager.getInstance().getConstants().unlimitedQoSTitle()); qos.setId(Guid.Empty); return qos; }
public NewHostNetworkQosModel(Model sourceModel, StoragePool dataCenter) { super(new HostNetworkQos(), new SharedHostNetworkQosParametersModel(), sourceModel, dataCenter); }
public static HostNetworkQos fromAnonymousHostNetworkQos(AnonymousHostNetworkQos hostNetworkQos) { if (hostNetworkQos == null) { return null; } HostNetworkQos result = new HostNetworkQos(); result.setId(hostNetworkQos.getId()); result.hostNetworkQosProperties = new HostNetworkQosProperties(hostNetworkQos.getHostNetworkQosProperties()); return result; }
private static Integer getOutAverageUpperlimit(HostNetworkQos qos) { return qos == null ? null : qos.getOutAverageUpperlimit(); }
private static Integer getOutAverageRealtime(HostNetworkQos qos) { return qos == null ? null : qos.getOutAverageRealtime(); }
private static Integer getOutAverageLinkshare(HostNetworkQos qos) { return qos == null ? null : qos.getOutAverageLinkshare(); }
@Override public void persistQosChanges(Guid qosId, HostNetworkQos qos) { HostNetworkQos oldQos = get(qosId); boolean qosOfGivenIdAlreadyExist = oldQos != null; if (qos == null) { if (qosOfGivenIdAlreadyExist) { remove(qosId); } } else { qos.setId(qosId); if (!qosOfGivenIdAlreadyExist) { save(qos); } else { boolean qosChanged = !qos.equals(oldQos); if (qosChanged) { update(qos); } } } }
@Test public void testIsNetworkInSyncWhenAverageUpperLimitDifferent() { ifaceQos.setOutAverageUpperlimit(1); networkQos.setOutAverageUpperlimit(2); assertThat(createTestedInstanceWithSameNonQosValues().isNetworkInSync(), is(false)); }
@Test public void testIsNetworkInSyncWhenAverageLinkShareDifferent() { ifaceQos.setOutAverageLinkshare(1); networkQos.setOutAverageLinkshare(2); assertThat(createTestedInstanceWithSameNonQosValues().isNetworkInSync(), is(false)); }
@Test public void testIsNetworkInSyncWhenAverageRealTimeDifferent() { ifaceQos.setOutAverageRealtime(1); networkQos.setOutAverageRealtime(2); assertThat(createTestedInstanceWithSameNonQosValues().isNetworkInSync(), is(false)); }
@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(); }