if (!Objects.equals(_ip, other.getIp())) { return false; if (!Objects.equals(_key, other.getKey())) { return false; if (!Objects.equals(_subnet, other.getSubnet())) { return false; if (!e.getValue().equals(other.getAugmentation(e.getKey()))) { return false;
public AddressBuilder(Address base) { this.key = base.key(); this._ip = base.getIp(); this._subnet = base.getSubnet(); if (base instanceof AddressImpl) { AddressImpl impl = (AddressImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") Map<Class<? extends Augmentation<Address>>, Augmentation<Address>> aug =((AugmentationHolder<Address>) base).augmentations(); if (!aug.isEmpty()) { this.augmentation = new HashMap<>(aug); } } }
public AddressBuilder(Address base) { if (base.getKey() == null) { this._key = new AddressKey( base.getIp() ); this._ip = base.getIp(); } else { this._key = base.getKey(); this._ip = _key.getIp(); } this._subnet = base.getSubnet(); if (base instanceof AddressImpl) { AddressImpl impl = (AddressImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") AugmentationHolder<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.Address> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.Address>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
if (!Objects.equals(_ip, other.getIp())) { return false; if (!Objects.equals(_subnet, other.getSubnet())) { return false; if (!e.getValue().equals(other.augmentation(e.getKey()))) { return false;
private static Function<Address, Short> toPrefixLength() { return (final Address address) -> { final Subnet subnet = address.getSubnet(); if (subnet instanceof PrefixLength) { return ((PrefixLength) subnet).getPrefixLength(); } if (address.getSubnet() instanceof Netmask) { return (short) Ipv4WriteUtils.getSubnetMaskLength( checkNotNull(((Netmask) subnet).getNetmask(), "No netmask defined for %s", subnet) .getValue()); } throw new IllegalArgumentException("Unsupported subnet : " + subnet); }; } }
private void setPrefixLengthSubnet(final boolean add, @Nonnull final InstanceIdentifier<Address> id, @Nonnull final String interfaceName, final int interfaceIndex, @Nonnull final Address address, @Nonnull final PrefixLength subnet) throws WriteFailedException { try { LOG.debug("Setting Subnet(prefix-length) for interface: {}(id={}). Subnet: {}, address: {}", interfaceName, interfaceIndex, subnet, address); Ipv4WriteUtils.addDelAddress(getFutureJVpp(), add, id, interfaceIndex, address.getIp(), subnet.getPrefixLength().byteValue()); LOG.debug("Subnet(prefix-length) set successfully for interface: {}(id={}). Subnet: {}, address: {}", interfaceName, interfaceIndex, subnet, address); } catch (VppBaseCallException e) { LOG.warn("Failed to set Subnet(prefix-length) for interface: {}(id={}). Subnet: {}, address: {}", interfaceName, interfaceIndex, subnet, address); throw new WriteFailedException(id, "Unable to handle subnet of type " + subnet.getClass(), e); } } }
public AddressBuilder(Address base) { if (base.getKey() == null) { this._key = new AddressKey( base.getIp() ); this._ip = base.getIp(); } else { this._key = base.getKey(); this._ip = _key.getIp(); } this._subnet = base.getSubnet(); if (base instanceof AddressImpl) { AddressImpl impl = (AddressImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") AugmentationHolder<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.Address> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.Address>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
if (!Objects.equals(_ip, other.getIp())) { return false; if (!Objects.equals(_subnet, other.getSubnet())) { return false; if (!e.getValue().equals(other.augmentation(e.getKey()))) { return false;
private void setAddress(boolean add, final InstanceIdentifier<Address> id, final String interfaceName, final int interfaceIndex, final Address address, final WriteContext writeContext) throws WriteFailedException { Subnet subnet = address.getSubnet(); if (subnet instanceof PrefixLength) { setPrefixLengthSubnet(add, id, interfaceName, interfaceIndex, address, (PrefixLength) subnet); } else if (subnet instanceof Netmask) { setNetmaskSubnet(add, id, interfaceName, interfaceIndex, address, (Netmask) subnet); } else { // FIXME how does choice extensibility work // FIXME it is not even possible to create a dedicated // customizer for Interconnection, since it's not a DataObject // FIXME we might need a choice customizer // THis choice is already from augment, so its probably not // possible to augment augmented choice LOG.error("Unable to handle subnet of type {}", subnet.getClass()); throw new WriteFailedException(id, "Unable to handle subnet of type " + subnet.getClass()); } }
private void setNetmaskSubnet(final boolean add, @Nonnull final InstanceIdentifier<Address> id, @Nonnull final String interfaceName, final int interfaceIndex, @Nonnull final Address address, @Nonnull final Netmask subnet) throws WriteFailedException { try { LOG.debug("Setting Subnet(subnet-mask) for interface: {}(id={}). Subnet: {}, address: {}", interfaceName, interfaceIndex, subnet, address); final DottedQuad netmask = subnet.getNetmask(); checkNotNull(netmask, "netmask value should not be null"); final byte subnetLength = Ipv4WriteUtils.getSubnetMaskLength(netmask.getValue()); Ipv4WriteUtils.addDelAddress(getFutureJVpp(), add, id, interfaceIndex, address.getIp(), subnetLength); } catch (VppBaseCallException e) { LOG.warn("Failed to set Subnet(subnet-mask) for interface: {}(id={}). Subnet: {}, address: {}", interfaceName, interfaceIndex, subnet, address); throw new WriteFailedException(id, "Unable to handle subnet of type " + subnet.getClass(), e); } }
if (!Objects.equals(_ip, other.getIp())) { return false; if (!Objects.equals(_key, other.getKey())) { return false; if (!Objects.equals(_subnet, other.getSubnet())) { return false; if (!e.getValue().equals(other.getAugmentation(e.getKey()))) { return false;
public AddressBuilder(Address base) { if (base.key() == null) { this.key = new AddressKey( base.getIp() ); this._ip = base.getIp(); } else { this.key = base.key(); this._ip = key.getIp(); } this._subnet = base.getSubnet(); if (base instanceof AddressImpl) { AddressImpl impl = (AddressImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") AugmentationHolder<Address> casted =(AugmentationHolder<Address>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }