VPN-to-Router Associate/Disas Performance Improve 54/74454/4
authorKarthikeyan Krishnan <karthikeyangceb007@gmail.com>
Wed, 25 Jul 2018 13:47:48 +0000 (19:17 +0530)
committerSam Hague <shague@redhat.com>
Fri, 27 Jul 2018 20:09:24 +0000 (20:09 +0000)
Addressing few review comments which got it
from existing merged patch[0].

[0]:https://git.opendaylight.org/gerrit/#/c/74317/

Issue: NETVIRT-1182

Change-Id: I98ca89e082c3f339e75b8de3f1ad2eb83cebfbbc
Signed-off-by: Karthikeyan Krishnan <karthikeyangceb007@gmail.com>
vpnmanager/impl/src/main/java/org/opendaylight/netvirt/vpnmanager/VpnInterfaceManager.java

index be53435b8e66263cf869f83c40f4a0574e1342d4..8dbff5f3e0eb3cfd43bb4dbe9cbfd5119ba5de73 100755 (executable)
@@ -1541,6 +1541,7 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
                         VpnHelper.getVpnInterfaceVpnInstanceNamesString(update.getVpnInstanceNames()));
                 return Collections.emptyList();
             }
+            List<ListenableFuture<Void>> futures = new ArrayList<>();
             for (VpnInstanceNames vpnInterfaceVpnInstance : update.getVpnInstanceNames()) {
                 String newVpnName = vpnInterfaceVpnInstance.getVpnName();
                 List<Adjacency> copyNewAdjs = new ArrayList<>(newAdjs);
@@ -1548,7 +1549,6 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
                 String primaryRd = vpnUtil.getPrimaryRd(newVpnName);
                 if (!vpnUtil.isVpnPendingDelete(primaryRd)) {
                     // TODO Deal with sequencing — the config tx must only submitted if the oper tx goes in
-                    List<ListenableFuture<Void>> futures = new ArrayList<>();
                     futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(confTx -> {
                         futures.add(txRunner.callWithNewReadWriteTransactionAndSubmit(operTx -> {
                             InstanceIdentifier<VpnInterfaceOpDataEntry> vpnInterfaceOpIdentifier =
@@ -1618,13 +1618,12 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
                         ListenableFutures.addErrorLogging(future, LOG, "update: failed for interface {} on vpn {}",
                                 update.getName(), update.getVpnInstanceNames());
                     }
-                    return futures;
                 } else {
                     LOG.error("update: Ignoring update of vpnInterface {}, as newVpnInstance {} with primaryRd {}"
                             + " is already marked for deletion", vpnInterfaceName, newVpnName, primaryRd);
                 }
             }
-            return Collections.emptyList();
+            return futures;
         });
     }
 
@@ -1663,7 +1662,6 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
             final Adjacencies updateAdjs = update.augmentation(Adjacencies.class);
             final List<Adjacency> newAdjs = (updateAdjs != null && updateAdjs.getAdjacency() != null)
                     ? updateAdjs.getAdjacency() : new ArrayList<>();
-
             for (String newVpnName: newVpnList) {
                 String primaryRd = vpnUtil.getPrimaryRd(newVpnName);
                 isSwap = Boolean.TRUE;