private PortsImpl(PortsBuilder base) { if (base.getKey() == null) { this._key = new PortsKey( base.getPortName() ); this._portName = base.getPortName(); } else { this._key = base.getKey(); this._portName = _key.getPortName(); } this._ipMapping = base.getIpMapping(); switch (base.augmentation.size()) { case 0: this.augmentation = Collections.emptyMap(); break; case 1: final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.router.ports.Ports>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.router.ports.Ports>> e = base.augmentation.entrySet().iterator().next(); this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.router.ports.Ports>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.router.ports.Ports>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
public PortsBuilder(Ports base) { if (base.getKey() == null) { this._key = new PortsKey( base.getPortName() ); this._portName = base.getPortName(); } else { this._key = base.getKey(); this._portName = _key.getPortName(); } this._ipMapping = base.getIpMapping(); if (base instanceof PortsImpl) { PortsImpl impl = (PortsImpl) 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.opendaylight.netvirt.natservice.rev160111.floating.ip.info.router.ports.Ports> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.router.ports.Ports>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
private void processFloatingIPDel(final InstanceIdentifier<IpMapping> identifier, final IpMapping mapping) { LOG.trace("Del event - key: {}, value: {}", identifier, mapping); final String routerId = identifier.firstKeyOf(RouterPorts.class).getRouterId(); final PortsKey pKey = identifier.firstKeyOf(Ports.class); String interfaceName = pKey.getPortName(); InstanceIdentifier<RouterPorts> pIdentifier = identifier.firstIdentifierOf(RouterPorts.class); removeNATFlowEntries(interfaceName, mapping, pIdentifier, routerId); }
private void processFloatingIPAdd(final InstanceIdentifier<IpMapping> identifier, final IpMapping mapping) { LOG.trace("Add event - key: {}, value: {}", identifier, mapping); final String routerId = identifier.firstKeyOf(RouterPorts.class).getRouterId(); final PortsKey pKey = identifier.firstKeyOf(Ports.class); String interfaceName = pKey.getPortName(); InstanceIdentifier<RouterPorts> pIdentifier = identifier.firstIdentifierOf(RouterPorts.class); createNATFlowEntries(interfaceName, mapping, pIdentifier, routerId); }