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); } } }
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 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()); } }
return false; if (!Objects.equals(_subnet, other.getSubnet())) { return false;
return false; if (!Objects.equals(_subnet, other.getSubnet())) { return false;
return false; if (!Objects.equals(_subnet, other.getSubnet())) { return false;
return false; if (!Objects.equals(_subnet, other.getSubnet())) { return false;
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()); } } }
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()); } } }
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()); } } }