private AnonymousHostNetworkQos asAnonymousHostNetworkQos(HostNetworkQos hostNetworkQos) { return AnonymousHostNetworkQos.fromHostNetworkQos(hostNetworkQos); }
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; }
@Override public String toString() { return ToStringBuilder.forInstance(this) .append("outAverageLinkshare", renderQosParameter(getOutAverageLinkshare())) .append("outAverageUpperlimit", renderQosParameter(getOutAverageUpperlimit())) .append("outAverageRealtime", renderQosParameter(getOutAverageRealtime())) .build(); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof AnonymousHostNetworkQos)) { return false; } AnonymousHostNetworkQos that = (AnonymousHostNetworkQos) o; return Objects.equals(getId(), that.getId()) && Objects.equals(hostNetworkQosProperties, that.hostNetworkQosProperties); }
public static AnonymousHostNetworkQos fromHostNetworkQos(HostNetworkQos hostNetworkQos) { if (hostNetworkQos == null) { return null; } AnonymousHostNetworkQos result = new AnonymousHostNetworkQos(); result.id = hostNetworkQos.getId(); result.hostNetworkQosProperties = hostNetworkQos.getHostNetworkQosProperties(); return result; }
/** * Check whether the network attachment has any QoS configured on it, whether via its network or overridden. * * @param networkAttachment * The network interface. * @param network * The network attached to the interface. * @return true iff any QoS is applied to the interface. */ public static boolean qosConfiguredOnInterface(NetworkAttachment networkAttachment, Network network) { if (networkAttachment != null && networkAttachment.isQosOverridden()) { return networkAttachment.getHostNetworkQos() != null && !networkAttachment.getHostNetworkQos().isEmpty(); } else { return network != null && network.getQosId() != null; } }
@Override public int hashCode() { return Objects.hash(getId(), hostNetworkQosProperties); } }
private void applyOnAttachmentParamsFrom(InterfacePropertiesAccessor interfacePropertiesAccessor, NetworkAttachment networkAttachment) { populateIpv4Details(interfacePropertiesAccessor, networkAttachment.getIpConfiguration().getIpv4PrimaryAddress()); populateIpv6Details(interfacePropertiesAccessor, networkAttachment.getIpConfiguration().getIpv6PrimaryAddress()); if (interfacePropertiesAccessor.isQosOverridden()) { AnonymousHostNetworkQos anonymousHostNetworkQos = AnonymousHostNetworkQos.fromHostNetworkQos(interfacePropertiesAccessor.getHostNetworkQos()); networkAttachment.setHostNetworkQos(anonymousHostNetworkQos); } networkAttachment.setProperties(interfacePropertiesAccessor.getCustomProperties()); networkAttachment.setDnsResolverConfiguration(interfacePropertiesAccessor.getDnsResolverConfiguration()); }
private void verifyRelationWithHostNetworkQos(NetworkAttachment entity) { AnonymousHostNetworkQos hostNetworkQos = entity.getHostNetworkQos(); if (hostNetworkQos != null && !Objects.equals(hostNetworkQos.getId(), entity.getId())) { throw new IllegalArgumentException( String.format("Overridden HostNetworkQos using id %s which does not related to given entity id %s", hostNetworkQos.getId(), entity.getId())); } }
HostNetworkQos overriddenQos = new HostNetworkQos(); networkAttachmentModel.getQosModel().flush(overriddenQos); AnonymousHostNetworkQos hostNetworkQos = fromHostNetworkQos(overriddenQos); networkAttachment.setHostNetworkQos(hostNetworkQos); } else {
entity.setHostNetworkQos(AnonymousHostNetworkQos.fromHostNetworkQos(hostNetworkQos));