+
+ public static void removeNat(ReadWriteTransaction rwTx, Floatingip removedFloatingIp) {
+ if (removedFloatingIp.getFixedIpAddress() == null) {
+ // NAT augmentation should have been already removed
+ return;
+ }
+ InstanceIdentifier<BaseEndpointByPort> baseEpByPortId =
+ NeutronGbpIidFactory.baseEndpointByPortIid(new UniqueId(removedFloatingIp.getPortId().getValue()));
+ Optional<BaseEndpointByPort> optional =
+ DataStoreHelper.readFromDs(LogicalDatastoreType.OPERATIONAL, baseEpByPortId, rwTx);
+ if (!optional.isPresent()) {
+ return;
+ }
+ AddressEndpointKey addrEpKey = new AddressEndpointKey(optional.get().getAddress(),
+ optional.get().getAddressType(), optional.get().getContextId(), optional.get().getContextType());
+ rwTx.delete(LogicalDatastoreType.OPERATIONAL,
+ IidFactory.addressEndpointIid(addrEpKey).augmentation(NatAddress.class));
+ }