neutron-vpn-portip-port-data d.s not cleared 00/78500/6
authornithi thomas <nithi.t@altencalsoftlabs.com>
Thu, 6 Dec 2018 12:37:04 +0000 (18:07 +0530)
committerSam Hague <shague@redhat.com>
Mon, 10 Dec 2018 14:05:34 +0000 (14:05 +0000)
Issue:
======
Stale entry not removed for neutron-vpn-portip-port-data in NAT
use-case.

neutron-vpn-portip-port-data d.s has ipv4 ip's which is
not getting cleared after  all the configs are deleted.

Analysis:
=========
The root-cause is in case of NAT use-case when external gateway is
attached to  router, while looping through the list of ip's addition
of ipv4 ip's to vpn(internetbgpvpn) was not restricted but while
dissasociating the vpn this restriction   check is there.
        So ipv4 ip's were retained in data-store.
Added check in updateVpnInterface() in NeutronvpnManager.java
to not add ipv4 entries in neutron-vpn-portip-port-data in case of
internetbgvpn (passed the flag isInternetVpn) where isInternetVpn
flag will be true in this case.

Issue: NETVIRT-1406

Change-Id: I9ae2b1da04988aac461ff50c4a9ac5a9d80a370d
Signed-off-by: nithi thomas <nithi.t@altencalsoftlabs.com>
neutronvpn/impl/src/main/java/org/opendaylight/netvirt/neutronvpn/NeutronvpnManager.java

index d393085460878d717c984ab1b616829178b42d1e..01f69d98e3d1d6a8d5e742dc301106b3b587cfeb 100644 (file)
@@ -1057,7 +1057,8 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
 
     protected void updateVpnInterface(Uuid vpnId, @Nullable Uuid oldVpnId, Port port, boolean isBeingAssociated,
                                       boolean isSubnetIp,
-                                      TypedWriteTransaction<Configuration> writeConfigTxn) {
+                                      TypedWriteTransaction<Configuration> writeConfigTxn,
+                                      boolean isInternetVpn) {
         if (vpnId == null || port == null) {
             return;
         }
@@ -1117,6 +1118,11 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
                         neutronvpnUtils.removeVpnPortFixedIpToPort(oldVpnId.getValue(),
                                 ipValue, writeConfigTxn);
                     }
+                    if ((NeutronvpnUtils.getIpVersionFromString(ipValue) != IpVersionChoice.IPV6)
+                         && (isInternetVpn == true)) {
+                        continue;
+                    }
+
                     neutronvpnUtils.createVpnPortFixedIpToPort(vpnId.getValue(), ipValue, infName, port
                             .getMacAddress().getValue(), isSubnetIp, writeConfigTxn);
                 }
@@ -1739,7 +1745,7 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
             txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, wrtConfigTxn -> {
                 if (isBeingAssociated) {
                     updateVpnInterface(vpn, null, neutronvpnUtils.getNeutronPort(
-                            sm.getRouterInterfacePortId()), true, true, wrtConfigTxn);
+                            sm.getRouterInterfacePortId()), true, true, wrtConfigTxn, true);
                 } else {
                     removeInternetVpnFromVpnInterface(vpn,
                             neutronvpnUtils.getNeutronPort(sm.getRouterInterfacePortId()), wrtConfigTxn, sm);
@@ -1759,7 +1765,7 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
                         tx -> {
                             if (isBeingAssociated) {
                                 updateVpnInterface(vpn, null, neutronvpnUtils.getNeutronPort(port),
-                                        true, false, tx);
+                                        true, false, tx, true);
                             } else {
                                 removeInternetVpnFromVpnInterface(vpn, neutronvpnUtils.getNeutronPort(port), tx, sm);
                             }
@@ -1802,7 +1808,7 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
                 txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION,
                     tx -> updateVpnInterface(newVpnId, oldVpnId,
                         neutronvpnUtils.getNeutronPort(sn.getRouterInterfacePortId()),
-                        isBeingAssociated, true, tx));
+                        isBeingAssociated, true, tx, false));
         Futures.addCallback(future, new FutureCallback<Void>() {
             @Override
             public void onSuccess(Void result) {
@@ -1817,7 +1823,7 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
                                 txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION,
                                     tx -> updateVpnInterface(newVpnId, oldVpnId,
                                             neutronvpnUtils.getNeutronPort(port), isBeingAssociated, false,
-                                            tx))));
+                                            tx, false))));
                     }
                 }
             }