Fix for NPE in TunnelInterfaceStateListener
[netvirt.git] / vpnmanager / impl / src / main / java / org / opendaylight / netvirt / vpnmanager / VpnInterfaceManager.java
index d4d937fabd8b555057271c6f8087ab13d7a30216..a55cd950f510d92d735c9ab1cc089f0c58e95bdc 100755 (executable)
@@ -13,6 +13,7 @@ import com.google.common.collect.Iterators;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.MoreExecutors;
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.math.BigInteger;
 import java.util.ArrayList;
@@ -23,7 +24,6 @@ import java.util.Map;
 import java.util.Objects;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.ExecutionException;
 import java.util.function.Consumer;
 import java.util.function.Predicate;
 import java.util.stream.Collectors;
@@ -34,11 +34,13 @@ import javax.inject.Singleton;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.genius.datastoreutils.AsyncDataTreeChangeListenerBase;
+import org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker;
 import org.opendaylight.genius.infra.ManagedNewTransactionRunner;
 import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
 import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
-import org.opendaylight.genius.mdsalutil.MDSALUtil;
 import org.opendaylight.genius.mdsalutil.NWUtil;
 import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.cache.InstanceIdDataObjectCache;
@@ -88,14 +90,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.adj
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.adjacency.list.AdjacencyBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.learnt.vpn.vip.to.port.data.LearntVpnVipToPort;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.neutron.router.dpns.RouterDpnList;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.neutron.router.dpns.RouterDpnListBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.neutron.router.dpns.RouterDpnListKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.neutron.router.dpns.router.dpn.list.DpnVpninterfacesList;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.neutron.router.dpns.router.dpn.list.DpnVpninterfacesListBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.neutron.router.dpns.router.dpn.list.DpnVpninterfacesListKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.neutron.router.dpns.router.dpn.list.dpn.vpninterfaces.list.RouterInterfaces;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.neutron.router.dpns.router.dpn.list.dpn.vpninterfaces.list.RouterInterfacesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.neutron.router.dpns.router.dpn.list.dpn.vpninterfaces.list.RouterInterfacesKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix.to._interface.vpn.ids.Prefixes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn._interface.op.data.VpnInterfaceOpDataEntry;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn._interface.op.data.VpnInterfaceOpDataEntryBuilder;
@@ -129,6 +126,7 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
     private final IVpnManager vpnManager;
     private final ArpResponderHandler arpResponderHandler;
     private final JobCoordinator jobCoordinator;
+    private final VpnUtil vpnUtil;
 
     private final ConcurrentHashMap<String, Runnable> vpnIntfMap = new ConcurrentHashMap<>();
 
@@ -149,7 +147,8 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
                                final IVpnManager vpnManager,
                                final ArpResponderHandler arpResponderHandler,
                                final JobCoordinator jobCoordinator,
-                               final CacheProvider cacheProvider) {
+                               final CacheProvider cacheProvider,
+                               final VpnUtil vpnUtil) {
         super(VpnInterface.class, VpnInterfaceManager.class);
 
         this.dataBroker = dataBroker;
@@ -164,6 +163,7 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
         this.vpnManager = vpnManager;
         this.arpResponderHandler = arpResponderHandler;
         this.jobCoordinator = jobCoordinator;
+        this.vpnUtil = vpnUtil;
 
         vpnInstanceOpDataEntryCache = new InstanceIdDataObjectCache<>(VpnInstanceOpDataEntry.class, dataBroker,
                 LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.builder(
@@ -257,59 +257,56 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
                     final InstanceIdentifier<VpnInterface> identifier, String vpnName) {
         final VpnInterfaceKey key = identifier.firstKeyOf(VpnInterface.class, VpnInterfaceKey.class);
         final String interfaceName = key.getName();
-        String primaryRd = VpnUtil.getPrimaryRd(dataBroker, vpnName);
-        if (!VpnUtil.isVpnPendingDelete(dataBroker, primaryRd)) {
+        String primaryRd = vpnUtil.getPrimaryRd(vpnName);
+        if (!vpnUtil.isVpnPendingDelete(primaryRd)) {
             Interface interfaceState = InterfaceUtils.getInterfaceStateFromOperDS(dataBroker, interfaceName);
-            boolean isBgpVpnInternetVpn = VpnUtil.isBgpVpnInternet(dataBroker, vpnName);
+            boolean isBgpVpnInternetVpn = vpnUtil.isBgpVpnInternet(vpnName);
             if (interfaceState != null) {
                 try {
                     final BigInteger dpnId = InterfaceUtils.getDpIdFromInterface(interfaceState);
                     final int ifIndex = interfaceState.getIfIndex();
                     jobCoordinator.enqueueJob("VPNINTERFACE-" + interfaceName, () -> {
-                        WriteTransaction writeConfigTxn = dataBroker.newWriteOnlyTransaction();
-                        WriteTransaction writeOperTxn = dataBroker.newWriteOnlyTransaction();
-                        WriteTransaction writeInvTxn = dataBroker.newWriteOnlyTransaction();
-                        LOG.info("addVpnInterface: VPN Interface add event - intfName {} vpnName {} on dpn {}" ,
-                                vpnInterface.getName(), vpnName, vpnInterface.getDpnId());
-                        processVpnInterfaceUp(dpnId, vpnInterface, primaryRd, ifIndex, false, writeConfigTxn,
-                                     writeOperTxn, writeInvTxn, interfaceState, vpnName);
-                        if (oldAdjs != null && !oldAdjs.equals(newAdjs)) {
-                            LOG.info("addVpnInterface: Adjacency changed upon VPNInterface {}"
-                                    + " Update for swapping VPN {} case.", interfaceName, vpnName);
-                            if (newAdjs != null) {
-                                for (Adjacency adj : newAdjs) {
-                                    if (oldAdjs.contains(adj)) {
-                                        oldAdjs.remove(adj);
-                                    } else {
-                                        if (!isBgpVpnInternetVpn || VpnUtil.isAdjacencyEligibleToVpnInternet(
-                                                                  dataBroker, adj)) {
-                                            addNewAdjToVpnInterface(vpnInterfaceOpIdentifier, primaryRd,
-                                                  adj, dpnId, writeOperTxn, writeConfigTxn);
-                                        }
-                                    }
-                                }
-                            }
-                            for (Adjacency adj : oldAdjs) {
-                                if (!isBgpVpnInternetVpn || VpnUtil.isAdjacencyEligibleToVpnInternet(
-                                                          dataBroker, adj)) {
-                                    delAdjFromVpnInterface(vpnInterfaceOpIdentifier, adj, dpnId,
-                                        writeOperTxn, writeConfigTxn);
-                                }
-                            }
-                        }
-                        ListenableFuture<Void> operFuture = writeOperTxn.submit();
-                        try {
-                            operFuture.get();
-                        } catch (ExecutionException e) {
-                            LOG.error("addVpnInterface: Exception encountered while submitting operational future for"
-                                    + " addVpnInterface {} on vpn {}", vpnInterface.getName(), vpnName, e);
-                            return null;
-                        }
+                        // TODO Deal with sequencing — the config tx must only submitted if the oper tx goes in
+                        // (the inventory tx goes in last)
                         List<ListenableFuture<Void>> futures = new ArrayList<>();
-                        ListenableFuture<Void> configFuture = writeConfigTxn.submit();
-                        futures.add(configFuture);
-                        Futures.addCallback(configFuture, new PostVpnInterfaceWorker(interfaceName, true, "Config"));
-                        futures.add(writeInvTxn.submit());
+                        ListenableFuture<Void> confFuture = txRunner.callWithNewWriteOnlyTransactionAndSubmit(
+                            confTx -> futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(
+                                operTx -> futures.add(
+                                        txRunner.callWithNewWriteOnlyTransactionAndSubmit(invTx -> {
+                                            LOG.info(
+                                                    "addVpnInterface: VPN Interface add event - intfName {} vpnName {}"
+                                                    + " on dpn {}",
+                                                    vpnInterface.getName(), vpnName, vpnInterface.getDpnId());
+                                            processVpnInterfaceUp(dpnId, vpnInterface, primaryRd, ifIndex, false,
+                                                    confTx, operTx, invTx, interfaceState, vpnName);
+                                            if (oldAdjs != null && !oldAdjs.equals(newAdjs)) {
+                                                LOG.info("addVpnInterface: Adjacency changed upon VPNInterface {}"
+                                                        + " Update for swapping VPN {} case.", interfaceName, vpnName);
+                                                if (newAdjs != null) {
+                                                    for (Adjacency adj : newAdjs) {
+                                                        if (oldAdjs.contains(adj)) {
+                                                            oldAdjs.remove(adj);
+                                                        } else {
+                                                            if (!isBgpVpnInternetVpn
+                                                                    || vpnUtil.isAdjacencyEligibleToVpnInternet(adj)) {
+                                                                addNewAdjToVpnInterface(vpnInterfaceOpIdentifier,
+                                                                        primaryRd, adj, dpnId, operTx, confTx);
+                                                            }
+                                                        }
+                                                    }
+                                                }
+                                                for (Adjacency adj : oldAdjs) {
+                                                    if (!isBgpVpnInternetVpn
+                                                            || vpnUtil.isAdjacencyEligibleToVpnInternet(adj)) {
+                                                        delAdjFromVpnInterface(vpnInterfaceOpIdentifier, adj, dpnId,
+                                                                operTx, confTx);
+                                                    }
+                                                }
+                                            }
+                                        })))));
+                        futures.add(confFuture);
+                        Futures.addCallback(confFuture, new PostVpnInterfaceWorker(interfaceName, true, "Config"),
+                                MoreExecutors.directExecutor());
                         LOG.info("addVpnInterface: Addition of interface {} in VPN {} on dpn {}"
                                 + " processed successfully", interfaceName, vpnName, dpnId);
                         return futures;
@@ -323,16 +320,15 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
             } else if (Boolean.TRUE.equals(vpnInterface.isRouterInterface())) {
                 jobCoordinator.enqueueJob("VPNINTERFACE-" + vpnInterface.getName(),
                     () -> {
-                        WriteTransaction writeConfigTxn = dataBroker.newWriteOnlyTransaction();
-                        createFibEntryForRouterInterface(primaryRd, vpnInterface, interfaceName,
-                                       writeConfigTxn, vpnName);
-                        LOG.info("addVpnInterface: Router interface {} for vpn {} on dpn {}", interfaceName,
-                                 vpnName, vpnInterface.getDpnId());
-                        ListenableFuture<Void> futures = writeConfigTxn.submit();
-                        String errorText = "addVpnInterfaceCall: Exception encountered while submitting writeConfigTxn"
-                             + " for interface " + vpnInterface.getName() + " on vpn " + vpnName;
-                        ListenableFutures.addErrorLogging(futures, LOG, errorText);
-                        return Collections.singletonList(futures);
+                        ListenableFuture<Void> future = txRunner.callWithNewWriteOnlyTransactionAndSubmit(confTx -> {
+                            createFibEntryForRouterInterface(primaryRd, vpnInterface, interfaceName,
+                                    confTx, vpnName);
+                            LOG.info("addVpnInterface: Router interface {} for vpn {} on dpn {}", interfaceName,
+                                    vpnName, vpnInterface.getDpnId());
+                        });
+                        ListenableFutures.addErrorLogging(future, LOG,
+                                "Error creating FIB entry for interface {} on VPN {}", vpnInterface.getName(), vpnName);
+                        return Collections.singletonList(future);
                     });
             } else {
                 LOG.info("addVpnInterface: Handling addition of VPN interface {} on vpn {} skipped as interfaceState"
@@ -356,14 +352,14 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
             Interface interfaceState,
             final String vpnName) {
         final String interfaceName = vpnInterface.getName();
-        Optional<VpnInterfaceOpDataEntry> optOpVpnInterface = VpnUtil.getVpnInterfaceOpDataEntry(dataBroker,
-                                                         interfaceName, vpnName);
+        Optional<VpnInterfaceOpDataEntry> optOpVpnInterface = vpnUtil.getVpnInterfaceOpDataEntry(interfaceName,
+                vpnName);
         VpnInterfaceOpDataEntry opVpnInterface = optOpVpnInterface.isPresent() ? optOpVpnInterface.get() : null;
-        boolean isBgpVpnInternetVpn = VpnUtil.isBgpVpnInternet(dataBroker, vpnName);
+        boolean isBgpVpnInternetVpn = vpnUtil.isBgpVpnInternet(vpnName);
         if (!isInterfaceUp) {
             LOG.info("processVpnInterfaceUp: Binding vpn service to interface {} onto dpn {} for vpn {}",
                      interfaceName, dpId, vpnName);
-            long vpnId = VpnUtil.getVpnId(dataBroker, vpnName);
+            long vpnId = vpnUtil.getVpnId(vpnName);
             if (vpnId == VpnConstants.INVALID_ID) {
                 LOG.warn("processVpnInterfaceUp: VpnInstance to VPNId mapping not available for VpnName {}"
                         + " processing vpninterface {} on dpn {}, bailing out now.", vpnName, interfaceName,
@@ -372,7 +368,7 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
             }
 
             boolean waitForVpnInterfaceOpRemoval = false;
-            if (opVpnInterface != null && !opVpnInterface.isScheduledForRemove()) {
+            if (opVpnInterface != null) {
                 String opVpnName = opVpnInterface.getVpnInstanceName();
                 String primaryInterfaceIp = null;
                 if (opVpnName.equals(vpnName)) {
@@ -380,7 +376,7 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
                     // If so, we have to process ADD, as this might be a DPN Restart with Remove and Add triggered
                     // back to back
                     // However, if the primary VRF Entry for this VPNInterface exists, please continue bailing out !
-                    List<Adjacency> adjs = VpnUtil.getAdjacenciesForVpnInterfaceFromConfig(dataBroker, interfaceName);
+                    List<Adjacency> adjs = vpnUtil.getAdjacenciesForVpnInterfaceFromConfig(interfaceName);
                     if (adjs == null) {
                         LOG.error("processVpnInterfaceUp: VPN Interface {} on dpn {} for vpn {} failed as adjacencies"
                                 + " for this vpn interface could not be obtained", interfaceName, dpId,
@@ -400,7 +396,7 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
                         return;
                     }
                     // Get the rd of the vpn instance
-                    VrfEntry vrf = VpnUtil.getVrfEntry(dataBroker, primaryRd, primaryInterfaceIp);
+                    VrfEntry vrf = vpnUtil.getVrfEntry(primaryRd, primaryInterfaceIp);
                     if (vrf != null) {
                         LOG.error("processVpnInterfaceUp: VPN Interface {} on dpn {} for vpn {} already provisioned ,"
                                 + " bailing out from here.", interfaceName, dpId, vpnName);
@@ -420,13 +416,12 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
                 processVpnInterfaceAdjacencies(dpId, lportTag, vpnName, primaryRd, interfaceName,
                         vpnId, writeConfigTxn, writeOperTxn, writeInvTxn, interfaceState);
                 if (!isBgpVpnInternetVpn) {
-                    VpnUtil.bindService(vpnName, interfaceName, dataBroker, false /*isTunnelInterface*/,
-                            jobCoordinator);
+                    vpnUtil.bindService(vpnName, interfaceName, false /*isTunnelInterface*/);
                 }
                 LOG.info("processVpnInterfaceUp: Plumbed vpn interface {} onto dpn {} for vpn {}", interfaceName,
                         dpId, vpnName);
                 if (interfaceManager.isExternalInterface(interfaceName)) {
-                    processExternalVpnInterface(interfaceName, vpnName, vpnId, dpId, lportTag, writeInvTxn,
+                    processExternalVpnInterface(interfaceName, vpnName, dpId, lportTag,
                         NwConstants.ADD_FLOW);
                 }
                 return;
@@ -458,7 +453,7 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
                 LOG.warn("processVpnInterfaceUp: VPN Interface {} removal on dpn {} for vpn {}"
                         + " by FIB did not complete on time," + " bailing addition ...", interfaceName,
                         dpId, vpnName);
-                VpnUtil.unsetScheduledToRemoveForVpnInterface(dataBroker, interfaceName);
+                vpnUtil.unsetScheduledToRemoveForVpnInterface(interfaceName);
                 return;
             }
             // VPNInterface got removed, proceed with Add
@@ -470,47 +465,52 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
             processVpnInterfaceAdjacencies(dpId, lportTag, vpnName, primaryRd, interfaceName,
                     vpnId, writeConfigTxn, writeOperTxn, writeInvTxn, interfaceState);
             if (!isBgpVpnInternetVpn) {
-                VpnUtil.bindService(vpnName, interfaceName, dataBroker, false/*isTunnelInterface*/, jobCoordinator);
+                vpnUtil.bindService(vpnName, interfaceName, false/*isTunnelInterface*/);
             }
             LOG.info("processVpnInterfaceUp: Plumbed vpn interface {} onto dpn {} for vpn {} after waiting for"
                     + " FIB to clean up", interfaceName, dpId, vpnName);
             if (interfaceManager.isExternalInterface(interfaceName)) {
-                processExternalVpnInterface(interfaceName, vpnName, vpnId, dpId,
-                               lportTag, writeInvTxn, NwConstants.ADD_FLOW);
+                processExternalVpnInterface(interfaceName, vpnName, dpId,
+                               lportTag, NwConstants.ADD_FLOW);
             }
         } else {
-            // Interface is retained in the DPN, but its Link Up.
-            // Advertise prefixes again for this interface to BGP
-            InstanceIdentifier<VpnInterface> identifier =
-                VpnUtil.getVpnInterfaceIdentifier(vpnInterface.getName());
-            InstanceIdentifier<VpnInterfaceOpDataEntry> vpnInterfaceOpIdentifier =
-                VpnUtil.getVpnInterfaceOpDataEntryIdentifier(interfaceName, vpnName);
-            advertiseAdjacenciesForVpnToBgp(primaryRd, dpId, vpnInterfaceOpIdentifier, vpnName, interfaceName);
-            // Perform similar operation as interface add event for extraroutes.
-            InstanceIdentifier<Adjacencies> path = identifier.augmentation(Adjacencies.class);
-            Optional<Adjacencies> optAdjacencies = VpnUtil.read(dataBroker, LogicalDatastoreType.CONFIGURATION, path);
-            if (!optAdjacencies.isPresent()) {
-                LOG.trace("No config adjacencies present for vpninterface {}", vpnInterface);
-                return;
-            }
-            List<Adjacency> adjacencies = optAdjacencies.get().getAdjacency();
-            for (Adjacency adjacency : adjacencies) {
-                if (adjacency.getAdjacencyType() == AdjacencyType.PrimaryAdjacency) {
-                    continue;
+            try {
+                // Interface is retained in the DPN, but its Link Up.
+                // Advertise prefixes again for this interface to BGP
+                InstanceIdentifier<VpnInterface> identifier =
+                        VpnUtil.getVpnInterfaceIdentifier(vpnInterface.getName());
+                InstanceIdentifier<VpnInterfaceOpDataEntry> vpnInterfaceOpIdentifier =
+                        VpnUtil.getVpnInterfaceOpDataEntryIdentifier(interfaceName, vpnName);
+                advertiseAdjacenciesForVpnToBgp(primaryRd, dpId, vpnInterfaceOpIdentifier, vpnName, interfaceName);
+                // Perform similar operation as interface add event for extraroutes.
+                InstanceIdentifier<Adjacencies> path = identifier.augmentation(Adjacencies.class);
+                Optional<Adjacencies> optAdjacencies = SingleTransactionDataBroker.syncReadOptional(dataBroker,
+                        LogicalDatastoreType.CONFIGURATION, path);
+                if (!optAdjacencies.isPresent()) {
+                    LOG.trace("No config adjacencies present for vpninterface {}", vpnInterface);
+                    return;
                 }
-                // if BGPVPN Internet, filter only IPv6 Adjacencies
-                if (isBgpVpnInternetVpn && !VpnUtil.isAdjacencyEligibleToVpnInternet(
-                                dataBroker, adjacency)) {
-                    continue;
+                List<Adjacency> adjacencies = optAdjacencies.get().getAdjacency();
+                for (Adjacency adjacency : adjacencies) {
+                    if (adjacency.getAdjacencyType() == AdjacencyType.PrimaryAdjacency) {
+                        continue;
+                    }
+                    // if BGPVPN Internet, filter only IPv6 Adjacencies
+                    if (isBgpVpnInternetVpn && !vpnUtil.isAdjacencyEligibleToVpnInternet(adjacency)) {
+                        continue;
+                    }
+                    addNewAdjToVpnInterface(vpnInterfaceOpIdentifier, primaryRd, adjacency,
+                            dpId, writeOperTxn, writeConfigTxn);
                 }
-                addNewAdjToVpnInterface(vpnInterfaceOpIdentifier, primaryRd, adjacency,
-                          dpId, writeOperTxn, writeConfigTxn);
+            } catch (ReadFailedException e) {
+                LOG.error("processVpnInterfaceUp: Failed to read data store for interface {} vpn {} rd {} dpn {}",
+                        interfaceName, vpnName, primaryRd, dpId);
             }
         }
     }
 
-    private void processExternalVpnInterface(String interfaceName, String vpnName, long vpnId, BigInteger dpId,
-            int lportTag, WriteTransaction writeInvTxn, int addOrRemove) {
+    private void processExternalVpnInterface(String interfaceName, String vpnName, BigInteger dpId,
+        int lportTag, int addOrRemove) {
         Uuid extNetworkId;
         try {
             // vpn instance of ext-net interface is the network-id
@@ -521,7 +521,7 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
             return;
         }
 
-        List<Uuid> routerIds = VpnUtil.getExternalNetworkRouterIds(dataBroker, extNetworkId);
+        List<Uuid> routerIds = vpnUtil.getExternalNetworkRouterIds(extNetworkId);
         if (routerIds == null || routerIds.isEmpty()) {
             LOG.info("processExternalVpnInterface: No router is associated with {}."
                     + " Bailing out of processing external vpn interface {} on dpn {} for vpn {}",
@@ -533,14 +533,14 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
                 + " for vpn {}", routerIds, interfaceName, dpId, vpnName);
         for (Uuid routerId : routerIds) {
             String routerName = routerId.getValue();
-            BigInteger primarySwitch = VpnUtil.getPrimarySwitchForRouter(dataBroker, routerName);
+            BigInteger primarySwitch = vpnUtil.getPrimarySwitchForRouter(routerName);
             if (Objects.equals(primarySwitch, dpId)) {
-                Routers router = VpnUtil.getExternalRouter(dataBroker, routerName);
+                Routers router = vpnUtil.getExternalRouter(routerName);
                 if (router != null) {
                     if (addOrRemove == NwConstants.ADD_FLOW) {
                         vpnManager.addArpResponderFlowsToExternalNetworkIps(routerName,
                                 VpnUtil.getIpsListFromExternalIps(router.getExternalIps()), router.getExtGwMacAddress(),
-                                dpId, interfaceName, lportTag, writeInvTxn);
+                                dpId, interfaceName, lportTag);
                     } else {
                         vpnManager.removeArpResponderFlowsToExternalNetworkIps(routerName,
                                 VpnUtil.getIpsListFromExternalIps(router.getExternalIps()),
@@ -582,48 +582,54 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
             return;
         }
 
-        //Read NextHops
-        InstanceIdentifier<AdjacenciesOp> path = identifier.augmentation(AdjacenciesOp.class);
-        Optional<AdjacenciesOp> adjacencies = VpnUtil.read(dataBroker, LogicalDatastoreType.OPERATIONAL, path);
-        if (adjacencies.isPresent()) {
-            List<Adjacency> nextHops = adjacencies.get().getAdjacency();
-
-            if (!nextHops.isEmpty()) {
-                LOG.debug("advertiseAdjacenciesForVpnToBgp:  NextHops are {} for interface {} on dpn {} for vpn {}"
-                        + " rd {}", nextHops, interfaceName, dpnId, vpnName, rd);
-                VpnInstanceOpDataEntry vpnInstanceOpData = VpnUtil.getVpnInstanceOpData(dataBroker, rd);
-                long l3vni = vpnInstanceOpData.getL3vni();
-                VrfEntry.EncapType encapType = VpnUtil.isL3VpnOverVxLan(l3vni)
-                        ? VrfEntry.EncapType.Vxlan : VrfEntry.EncapType.Mplsgre;
-                for (Adjacency nextHop : nextHops) {
-                    if (nextHop.getAdjacencyType() == AdjacencyType.ExtraRoute) {
-                        continue;
-                    }
-                    String gatewayMac = null;
-                    long label = 0;
-                    if (VpnUtil.isL3VpnOverVxLan(l3vni)) {
-                        final VpnPortipToPort gwPort = VpnUtil.getNeutronPortFromVpnPortFixedIp(dataBroker,
-                            vpnInstanceOpData.getVpnInstanceName(), nextHop.getIpAddress());
-                        gatewayMac = arpResponderHandler.getGatewayMacAddressForInterface(gwPort, interfaceName).get();
-                    } else {
-                        label = nextHop.getLabel();
-                    }
-                    try {
-                        LOG.info("VPN ADVERTISE: advertiseAdjacenciesForVpnToBgp: Adding Fib Entry rd {} prefix {}"
-                                + " nexthop {} label {}", rd, nextHop.getIpAddress(), nextHopIp, label);
-                        bgpManager.advertisePrefix(rd, nextHop.getMacAddress(), nextHop.getIpAddress(), nextHopIp,
-                                encapType, (int)label, l3vni, 0 /*l2vni*/,
-                                gatewayMac);
-                        LOG.info("VPN ADVERTISE: advertiseAdjacenciesForVpnToBgp: Added Fib Entry rd {} prefix {}"
-                                + " nexthop {} label {} for interface {} on dpn {} for vpn {}", rd,
-                                nextHop.getIpAddress(), nextHopIp, label, interfaceName, dpnId, vpnName);
-                    } catch (Exception e) {
-                        LOG.error("advertiseAdjacenciesForVpnToBgp: Failed to advertise prefix {} in vpn {} with rd {}"
-                                + " for interface {} on dpn {}", nextHop.getIpAddress(),
-                                  vpnName, rd, interfaceName, dpnId, e);
+        try {
+            //Read NextHops
+            InstanceIdentifier<AdjacenciesOp> path = identifier.augmentation(AdjacenciesOp.class);
+            Optional<AdjacenciesOp> adjacencies = SingleTransactionDataBroker.syncReadOptional(dataBroker,
+                    LogicalDatastoreType.OPERATIONAL, path);
+            if (adjacencies.isPresent()) {
+                List<Adjacency> nextHops = adjacencies.get().getAdjacency();
+                if (!nextHops.isEmpty()) {
+                    LOG.debug("advertiseAdjacenciesForVpnToBgp:  NextHops are {} for interface {} on dpn {} for vpn {}"
+                            + " rd {}", nextHops, interfaceName, dpnId, vpnName, rd);
+                    VpnInstanceOpDataEntry vpnInstanceOpData = vpnUtil.getVpnInstanceOpData(rd);
+                    long l3vni = vpnInstanceOpData.getL3vni();
+                    VrfEntry.EncapType encapType = VpnUtil.isL3VpnOverVxLan(l3vni)
+                            ? VrfEntry.EncapType.Vxlan : VrfEntry.EncapType.Mplsgre;
+                    for (Adjacency nextHop : nextHops) {
+                        if (nextHop.getAdjacencyType() == AdjacencyType.ExtraRoute) {
+                            continue;
+                        }
+                        String gatewayMac = null;
+                        long label = 0;
+                        if (VpnUtil.isL3VpnOverVxLan(l3vni)) {
+                            final VpnPortipToPort gwPort = vpnUtil.getNeutronPortFromVpnPortFixedIp(
+                                    vpnInstanceOpData.getVpnInstanceName(), nextHop.getIpAddress());
+                            gatewayMac = arpResponderHandler.getGatewayMacAddressForInterface(gwPort, interfaceName)
+                                    .get();
+                        } else {
+                            label = nextHop.getLabel();
+                        }
+                        try {
+                            LOG.info("VPN ADVERTISE: advertiseAdjacenciesForVpnToBgp: Adding Fib Entry rd {} prefix {}"
+                                    + " nexthop {} label {}", rd, nextHop.getIpAddress(), nextHopIp, label);
+                            bgpManager.advertisePrefix(rd, nextHop.getMacAddress(), nextHop.getIpAddress(), nextHopIp,
+                                    encapType, (int)label, l3vni, 0 /*l2vni*/,
+                                    gatewayMac);
+                            LOG.info("VPN ADVERTISE: advertiseAdjacenciesForVpnToBgp: Added Fib Entry rd {} prefix {}"
+                                            + " nexthop {} label {} for interface {} on dpn {} for vpn {}", rd,
+                                    nextHop.getIpAddress(), nextHopIp, label, interfaceName, dpnId, vpnName);
+                        } catch (Exception e) {
+                            LOG.error("advertiseAdjacenciesForVpnToBgp: Failed to advertise prefix {} in vpn {}"
+                                    + " with rd {} for interface {} on dpn {}", nextHop.getIpAddress(), vpnName, rd,
+                                    interfaceName, dpnId, e);
+                        }
                     }
                 }
             }
+        } catch (ReadFailedException e) {
+            LOG.error("advertiseAdjacenciesForVpnToBgp: Failed to read data store for interface {} dpn {} nexthop {}"
+                    + "vpn {} rd {}", interfaceName, dpnId, nextHopIp, vpnName, rd);
         }
     }
 
@@ -633,9 +639,7 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
                         String vpnName, String interfaceName, WriteTransaction writeConfigTxn) {
         //Read NextHops
         InstanceIdentifier<AdjacenciesOp> path = identifier.augmentation(AdjacenciesOp.class);
-        Optional<AdjacenciesOp> adjacencies = VpnUtil.read(dataBroker, LogicalDatastoreType.OPERATIONAL, path);
-
-        String rd = VpnUtil.getVpnRd(dataBroker, interfaceName);
+        String rd = vpnUtil.getVpnRd(interfaceName);
         if (rd == null) {
             LOG.error("withdrawAdjacenciesForVpnFromBgp: Unable to recover rd for interface {} in vpn {}",
                 interfaceName, vpnName);
@@ -650,6 +654,14 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
         }
         LOG.info("withdrawAdjacenciesForVpnFromBgp: For interface {} in vpn {} with rd {}", interfaceName,
                vpnName, rd);
+        Optional<AdjacenciesOp> adjacencies = Optional.absent();
+        try {
+            adjacencies = SingleTransactionDataBroker.syncReadOptional(dataBroker, LogicalDatastoreType.OPERATIONAL,
+                    path);
+        } catch (ReadFailedException e) {
+            LOG.error("withdrawAdjacenciesForVpnFromBgp: Failed to read data store for interface {} vpn {}",
+                    interfaceName, vpnName);
+        }
         if (adjacencies.isPresent()) {
             List<Adjacency> nextHops = adjacencies.get().getAdjacency();
 
@@ -693,13 +705,19 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
         InstanceIdentifier<VpnInterface> identifier = VpnUtil.getVpnInterfaceIdentifier(interfaceName);
         // Read NextHops
         InstanceIdentifier<Adjacencies> path = identifier.augmentation(Adjacencies.class);
-        Optional<Adjacencies> adjacencies = VpnUtil.read(dataBroker, LogicalDatastoreType.CONFIGURATION, path);
+        Optional<Adjacencies> adjacencies = Optional.absent();
+        try {
+            adjacencies = SingleTransactionDataBroker.syncReadOptional(dataBroker, LogicalDatastoreType.CONFIGURATION,
+                    path);
+        } catch (ReadFailedException e) {
+            LOG.error("processVpnInterfaceAdjacencies: Failed to read data store for interface {} vpn {} rd {}"
+                    + "dpn {}", interfaceName, vpnName, primaryRd, dpnId);
+        }
         if (!adjacencies.isPresent()) {
             addVpnInterfaceToOperational(vpnName, interfaceName, dpnId, null/*adjacencies*/, lportTag,
                     null/*gwMac*/, writeOperTxn);
             return;
         }
-
         // Get the rd of the vpn instance
         String nextHopIp = null;
         try {
@@ -716,7 +734,7 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
         }
         Optional<String> gwMac = Optional.absent();
         String vpnInterfaceSubnetGwMacAddress = null;
-        VpnInstanceOpDataEntry vpnInstanceOpData = VpnUtil.getVpnInstanceOpData(dataBroker, primaryRd);
+        VpnInstanceOpDataEntry vpnInstanceOpData = vpnUtil.getVpnInstanceOpData(primaryRd);
         Long l3vni = vpnInstanceOpData.getL3vni();
         boolean isL3VpnOverVxLan = VpnUtil.isL3VpnOverVxLan(l3vni);
         VrfEntry.EncapType encapType = isL3VpnOverVxLan ? VrfEntry.EncapType.Vxlan : VrfEntry.EncapType.Mplsgre;
@@ -743,14 +761,14 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
                 writeOperTxn.merge(
                     LogicalDatastoreType.OPERATIONAL,
                     VpnUtil.getPrefixToInterfaceIdentifier(
-                        VpnUtil.getVpnId(dataBroker, vpnName), prefix),
+                        vpnUtil.getVpnId(vpnName), prefix),
                     VpnUtil.getPrefixToInterface(dpnId, interfaceName, prefix, nextHop.getSubnetId(),
                             prefixCue), true);
                 final Uuid subnetId = nextHop.getSubnetId();
 
                 String gatewayIp = nextHop.getSubnetGatewayIp();
                 if (gatewayIp == null) {
-                    Optional<String> gatewayIpOptional = VpnUtil.getVpnSubnetGatewayIp(dataBroker, subnetId);
+                    Optional<String> gatewayIpOptional = vpnUtil.getVpnSubnetGatewayIp(subnetId);
                     if (gatewayIpOptional.isPresent()) {
                         gatewayIp = gatewayIpOptional.get();
                     }
@@ -773,15 +791,15 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
                         // VrfEntryProcessor to use this later to populate the L3_GW_MAC_TABLE.
                         gwMac = InterfaceUtils.getMacAddressFromInterfaceState(interfaceState);
                         if (gwMac.isPresent()) {
-                            VpnUtil.setupGwMacIfExternalVpn(dataBroker, mdsalManager, dpnId, interfaceName,
-                                    vpnId, writeInvTxn, NwConstants.ADD_FLOW, gwMac.get());
+                            vpnUtil.setupGwMacIfExternalVpn(dpnId, interfaceName, vpnId, writeInvTxn,
+                                    NwConstants.ADD_FLOW, gwMac.get());
                             arpResponderHandler.addArpResponderFlow(dpnId, lportTag, interfaceName,
                                     gatewayIp, gwMac.get());
                         } else {
-                            LOG.error("processVpnInterfaceAdjacencies: Gateway MAC for subnet could not be "
+                            LOG.error("processVpnInterfaceAdjacencies: Gateway MAC for subnet ID {} could not be "
                                 + "obtained, cannot create ARP responder flow for interface name {}, vpnName {}, "
                                 + "gwIp {}",
-                                interfaceName, vpnName, gatewayIp);
+                                subnetId, interfaceName, vpnName, gatewayIp);
                         }
                     }
                 } else {
@@ -797,9 +815,9 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
                 String prefix = VpnUtil.getIpPrefix(nextHop.getIpAddress());
                 String vpnPrefixKey = VpnUtil.getVpnNamePrefixKey(vpnName, prefix);
                 synchronized (vpnPrefixKey.intern()) {
-                    java.util.Optional<String> rdToAllocate = VpnUtil
-                            .allocateRdForExtraRouteAndUpdateUsedRdsMap(dataBroker, vpnId, null,
-                            prefix, vpnName, nextHop.getNextHopIpList().get(0), dpnId);
+                    java.util.Optional<String> rdToAllocate = vpnUtil
+                            .allocateRdForExtraRouteAndUpdateUsedRdsMap(vpnId, null, prefix, vpnName,
+                                    nextHop.getNextHopIpList().get(0), dpnId);
                     if (rdToAllocate.isPresent()) {
                         rd = rdToAllocate.get();
                         LOG.info("processVpnInterfaceAdjacencies: The rd {} is allocated for the extraroute {}",
@@ -859,7 +877,7 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
     private void addVpnInterfaceToOperational(String vpnName, String interfaceName, BigInteger dpnId, AdjacenciesOp aug,
                                               long lportTag, String gwMac, WriteTransaction writeOperTxn) {
         VpnInterfaceOpDataEntry opInterface =
-              VpnUtil.getVpnInterfaceOpDataEntry(interfaceName, vpnName, aug, dpnId, Boolean.FALSE, lportTag, gwMac);
+              VpnUtil.getVpnInterfaceOpDataEntry(interfaceName, vpnName, aug, dpnId, lportTag, gwMac);
         InstanceIdentifier<VpnInterfaceOpDataEntry> interfaceId = VpnUtil
             .getVpnInterfaceOpDataEntryIdentifier(interfaceName, vpnName);
         writeOperTxn.put(LogicalDatastoreType.OPERATIONAL, interfaceId, opInterface,
@@ -877,7 +895,7 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
 
         String srcTepIp = String.valueOf(stateTunnelList.getSrcInfo().getTepIp().getValue());
         BigInteger srcDpnId = new BigInteger(stateTunnelList.getSrcInfo().getTepDeviceId());
-        AdjacenciesOp adjacencies = vpnInterface.getAugmentation(AdjacenciesOp.class);
+        AdjacenciesOp adjacencies = vpnInterface.augmentation(AdjacenciesOp.class);
         List<Adjacency> adjList = adjacencies != null ? adjacencies.getAdjacency() : new ArrayList<>();
         if (adjList.isEmpty()) {
             LOG.trace("updateVpnInterfaceOnTepAdd: Adjacencies are empty for vpnInterface {} on dpn {}",
@@ -889,8 +907,8 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
         List<Adjacency> value = new ArrayList<>();
         boolean isNextHopAddReqd = false;
         String vpnName = vpnInterface.getVpnInstanceName();
-        long vpnId = VpnUtil.getVpnId(dataBroker, vpnName);
-        String primaryRd = VpnUtil.getPrimaryRd(dataBroker, vpnName);
+        long vpnId = vpnUtil.getVpnId(vpnName);
+        String primaryRd = vpnUtil.getPrimaryRd(vpnName);
         LOG.info("updateVpnInterfaceOnTepAdd: AdjacencyList for interface {} on dpn {} vpn {} is {}",
                 vpnInterface.getName(), vpnInterface.getDpnId(),
                 vpnInterface.getVpnInstanceName(), adjList);
@@ -903,7 +921,7 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
             List<String> nextHopList = adj.getNextHopIpList();
             // If TEP is added , update the nexthop of primary adjacency.
             // Secondary adj nexthop is already pointing to primary adj IP address.
-            if (nextHopList != null && !nextHopList.isEmpty() && nextHopList.get(0).equalsIgnoreCase(srcTepIp)) {
+            if (nextHopList != null && !nextHopList.isEmpty()) {
                 /* everything right already */
             } else {
                 isNextHopAddReqd = true;
@@ -935,8 +953,7 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
 
                 //Get the list of VPN's importing this route(prefix) .
                 // Then update the VRF entry with nhList
-                List<VpnInstanceOpDataEntry> vpnsToImportRoute =
-                           VpnUtil.getVpnsImportingMyRoute(dataBroker, vpnName);
+                List<VpnInstanceOpDataEntry> vpnsToImportRoute = vpnUtil.getVpnsImportingMyRoute(vpnName);
                 for (VpnInstanceOpDataEntry vpn : vpnsToImportRoute) {
                     String vpnRd = vpn.getVrfId();
                     if (vpnRd != null) {
@@ -968,7 +985,7 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
         }
         AdjacenciesOp aug = VpnUtil.getVpnInterfaceOpDataEntryAugmentation(value);
         VpnInterfaceOpDataEntry opInterface = new VpnInterfaceOpDataEntryBuilder(vpnInterface)
-                .setKey(new VpnInterfaceOpDataEntryKey(vpnInterface.getName(), vpnName))
+                .withKey(new VpnInterfaceOpDataEntryKey(vpnInterface.getName(), vpnName))
                 .addAugmentation(AdjacenciesOp.class, aug).build();
         InstanceIdentifier<VpnInterfaceOpDataEntry> interfaceId =
                 VpnUtil.getVpnInterfaceOpDataEntryIdentifier(vpnInterface.getName(), vpnName);
@@ -986,7 +1003,7 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
                                               WriteTransaction writeConfigTxn,
                                               WriteTransaction writeOperTxn) {
 
-        AdjacenciesOp adjacencies = vpnInterface.getAugmentation(AdjacenciesOp.class);
+        AdjacenciesOp adjacencies = vpnInterface.augmentation(AdjacenciesOp.class);
         List<Adjacency> adjList = adjacencies != null ? adjacencies.getAdjacency() : new ArrayList<>();
         String prefix = null;
         long label = 0;
@@ -994,8 +1011,8 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
         String srcTepIp = String.valueOf(stateTunnelList.getSrcInfo().getTepIp().getValue());
         BigInteger srcDpnId = new BigInteger(stateTunnelList.getSrcInfo().getTepDeviceId());
         String vpnName = vpnInterface.getVpnInstanceName();
-        long vpnId = VpnUtil.getVpnId(dataBroker, vpnName);
-        String primaryRd = VpnUtil.getVpnRd(dataBroker, vpnName);
+        long vpnId = vpnUtil.getVpnId(vpnName);
+        String primaryRd = vpnUtil.getVpnRd(vpnName);
         if (adjList != null) {
             List<Adjacency> value = new ArrayList<>();
             LOG.info("updateVpnInterfaceOnTepDelete: AdjacencyList for interface {} on dpn {} vpn {} is {}",
@@ -1040,8 +1057,7 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
 
                     //Get the list of VPN's importing this route(prefix) .
                     // Then update the VRF entry with nhList
-                    List<VpnInstanceOpDataEntry> vpnsToImportRoute =
-                          VpnUtil.getVpnsImportingMyRoute(dataBroker, vpnName);
+                    List<VpnInstanceOpDataEntry> vpnsToImportRoute = vpnUtil.getVpnsImportingMyRoute(vpnName);
                     for (VpnInstanceOpDataEntry vpn : vpnsToImportRoute) {
                         String vpnRd = vpn.getVrfId();
                         if (vpnRd != null) {
@@ -1073,7 +1089,7 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
             }
             AdjacenciesOp aug = VpnUtil.getVpnInterfaceOpDataEntryAugmentation(value);
             VpnInterfaceOpDataEntry opInterface = new VpnInterfaceOpDataEntryBuilder(vpnInterface)
-                    .setKey(new VpnInterfaceOpDataEntryKey(vpnInterface.getName(), vpnName))
+                    .withKey(new VpnInterfaceOpDataEntryKey(vpnInterface.getName(), vpnName))
                     .addAugmentation(AdjacenciesOp.class, aug).build();
             InstanceIdentifier<VpnInterfaceOpDataEntry> interfaceId =
                     VpnUtil.getVpnInterfaceOpDataEntryIdentifier(vpnInterface.getName(), vpnName);
@@ -1087,8 +1103,8 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
     private List<VpnInstanceOpDataEntry> getVpnsExportingMyRoute(final String vpnName) {
         List<VpnInstanceOpDataEntry> vpnsToExportRoute = new ArrayList<>();
 
-        String vpnRd = VpnUtil.getVpnRd(dataBroker, vpnName);
-        final VpnInstanceOpDataEntry vpnInstanceOpDataEntry = VpnUtil.getVpnInstanceOpData(dataBroker, vpnRd);
+        String vpnRd = vpnUtil.getVpnRd(vpnName);
+        final VpnInstanceOpDataEntry vpnInstanceOpDataEntry = vpnUtil.getVpnInstanceOpData(vpnRd);
         if (vpnInstanceOpDataEntry == null) {
             LOG.debug("getVpnsExportingMyRoute: Could not retrieve vpn instance op data for {}"
                     + " to check for vpns exporting the routes", vpnName);
@@ -1112,7 +1128,7 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
         };
 
         vpnsToExportRoute =
-                VpnUtil.getAllVpnInstanceOpData(dataBroker).stream().filter(excludeVpn).filter(matchRTs).collect(
+                vpnUtil.getAllVpnInstanceOpData().stream().filter(excludeVpn).filter(matchRTs).collect(
                         Collectors.toList());
         return vpnsToExportRoute;
     }
@@ -1122,47 +1138,48 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
     void handleVpnsExportingRoutes(String vpnName, String vpnRd) {
         List<VpnInstanceOpDataEntry> vpnsToExportRoute = getVpnsExportingMyRoute(vpnName);
         for (VpnInstanceOpDataEntry vpn : vpnsToExportRoute) {
-            List<VrfEntry> vrfEntries = VpnUtil.getAllVrfEntries(dataBroker, vpn.getVrfId());
-            WriteTransaction writeConfigTxn = dataBroker.newWriteOnlyTransaction();
+            List<VrfEntry> vrfEntries = vpnUtil.getAllVrfEntries(vpn.getVrfId());
             if (vrfEntries != null) {
-                for (VrfEntry vrfEntry : vrfEntries) {
-                    try {
-                        if (!FibHelper.isControllerManagedNonInterVpnLinkRoute(
-                                RouteOrigin.value(vrfEntry.getOrigin()))) {
-                            LOG.info("handleVpnsExportingRoutes: vrfEntry with rd {} prefix {}"
-                                    + " is not a controller managed non intervpn link route. Ignoring.",
-                                    vpn.getVrfId(), vrfEntry.getDestPrefix());
-                            continue;
-                        }
-                        String prefix = vrfEntry.getDestPrefix();
-                        String gwMac = vrfEntry.getGatewayMacAddress();
-                        vrfEntry.getRoutePaths().forEach(routePath -> {
-                            String nh = routePath.getNexthopAddress();
-                            int label = routePath.getLabel().intValue();
-                            if (FibHelper.isControllerManagedVpnInterfaceRoute(RouteOrigin.value(
-                                    vrfEntry.getOrigin()))) {
-                                LOG.info("handleVpnsExportingRoutesImporting: Importing fib entry rd {} prefix {}"
-                                        + " nexthop {} label {} to vpn {} vpnRd {}", vpn.getVrfId(), prefix, nh, label,
-                                        vpnName, vpnRd);
-                                fibManager.addOrUpdateFibEntry(vpnRd, null /*macAddress*/, prefix,
-                                        Collections.singletonList(nh), VrfEntry.EncapType.Mplsgre, label,
-                                        0 /*l3vni*/, gwMac,  null /*parentVpnRd*/, RouteOrigin.SELF_IMPORTED,
-                                        writeConfigTxn);
-                            } else {
-                                LOG.info("handleVpnsExportingRoutes: Importing subnet route fib entry rd {} prefix {}"
-                                        + " nexthop {} label {} to vpn {} vpnRd {}", vpn.getVrfId(), prefix, nh, label,
-                                        vpnName, vpnRd);
-                                SubnetRoute route = vrfEntry.getAugmentation(SubnetRoute.class);
-                                importSubnetRouteForNewVpn(vpnRd, prefix, nh, label, route, writeConfigTxn);
+                ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(confTx -> {
+                    for (VrfEntry vrfEntry : vrfEntries) {
+                        try {
+                            if (!FibHelper.isControllerManagedNonInterVpnLinkRoute(
+                                    RouteOrigin.value(vrfEntry.getOrigin()))) {
+                                LOG.info("handleVpnsExportingRoutes: vrfEntry with rd {} prefix {}"
+                                                + " is not a controller managed non intervpn link route. Ignoring.",
+                                        vpn.getVrfId(), vrfEntry.getDestPrefix());
+                                continue;
                             }
-                        });
-                    } catch (RuntimeException e) {
-                        LOG.error("getNextHopAddressList: Exception occurred while importing route with rd {}"
-                                + " prefix {} routePaths {} to vpn {} vpnRd {}", vpn.getVrfId(),
-                                vrfEntry.getDestPrefix(), vrfEntry.getRoutePaths(), vpnName, vpnRd);
+                            String prefix = vrfEntry.getDestPrefix();
+                            String gwMac = vrfEntry.getGatewayMacAddress();
+                            vrfEntry.getRoutePaths().forEach(routePath -> {
+                                String nh = routePath.getNexthopAddress();
+                                int label = routePath.getLabel().intValue();
+                                if (FibHelper.isControllerManagedVpnInterfaceRoute(RouteOrigin.value(
+                                        vrfEntry.getOrigin()))) {
+                                    LOG.info("handleVpnsExportingRoutesImporting: Importing fib entry rd {} prefix {}"
+                                                    + " nexthop {} label {} to vpn {} vpnRd {}",
+                                            vpn.getVrfId(), prefix, nh, label, vpnName, vpnRd);
+                                    fibManager.addOrUpdateFibEntry(vpnRd, null /*macAddress*/, prefix,
+                                            Collections.singletonList(nh), VrfEntry.EncapType.Mplsgre, label,
+                                            0 /*l3vni*/, gwMac,  vpn.getVrfId(), RouteOrigin.SELF_IMPORTED,
+                                            confTx);
+                                } else {
+                                    LOG.info("handleVpnsExportingRoutes: Importing subnet route fib entry rd {} "
+                                                    + "prefix {} nexthop {} label {} to vpn {} vpnRd {}",
+                                            vpn.getVrfId(), prefix, nh, label, vpnName, vpnRd);
+                                    SubnetRoute route = vrfEntry.augmentation(SubnetRoute.class);
+                                    importSubnetRouteForNewVpn(vpnRd, prefix, nh, label, route, vpn.getVrfId(),
+                                            confTx);
+                                }
+                            });
+                        } catch (RuntimeException e) {
+                            LOG.error("getNextHopAddressList: Exception occurred while importing route with rd {}"
+                                            + " prefix {} routePaths {} to vpn {} vpnRd {}", vpn.getVrfId(),
+                                    vrfEntry.getDestPrefix(), vrfEntry.getRoutePaths(), vpnName, vpnRd);
+                        }
                     }
-                }
-                writeConfigTxn.submit();
+                }), LOG, "Error handing VPN exporting routes");
             } else {
                 LOG.info("getNextHopAddressList: No vrf entries to import from vpn {} with rd {} to vpn {} with rd {}",
                         vpn.getVpnInstanceName(), vpn.getVrfId(), vpnName, vpnRd);
@@ -1170,7 +1187,6 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
         }
     }
 
-    @SuppressWarnings("checkstyle:IllegalCatch")
     @Override
     public void remove(InstanceIdentifier<VpnInterface> identifier, VpnInterface vpnInterface) {
         final VpnInterfaceKey key = identifier.firstKeyOf(VpnInterface.class, VpnInterfaceKey.class);
@@ -1186,14 +1202,13 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
                                 final String interfaceName) {
         if (Boolean.TRUE.equals(vpnInterface.isRouterInterface())) {
             jobCoordinator.enqueueJob("VPNINTERFACE-" + vpnInterface.getName(), () -> {
-                WriteTransaction writeConfigTxn = dataBroker.newWriteOnlyTransaction();
-                deleteFibEntryForRouterInterface(vpnInterface, writeConfigTxn, vpnName);
-                LOG.info("remove: Router interface {} for vpn {}", interfaceName, vpnName);
-                ListenableFuture<Void> futures = writeConfigTxn.submit();
-                String errorText = "removeVpnInterfaceCall: Exception encountered while submitting writeConfigTxn"
-                        + " for interface " + vpnInterface.getName() + " on vpn " + vpnName;
-                ListenableFutures.addErrorLogging(futures, LOG, errorText);
-                return Collections.singletonList(futures);
+                ListenableFuture<Void> future = txRunner.callWithNewWriteOnlyTransactionAndSubmit(confTx -> {
+                    deleteFibEntryForRouterInterface(vpnInterface, confTx, vpnName);
+                    LOG.info("remove: Router interface {} for vpn {}", interfaceName, vpnName);
+                });
+                ListenableFutures.addErrorLogging(future, LOG, "Error removing call for interface {} on VPN {}",
+                        vpnInterface.getName(), vpnName);
+                return Collections.singletonList(future);
             }, DJC_MAX_RETRIES);
         } else {
             Interface interfaceState = InterfaceUtils.getInterfaceStateFromOperDS(dataBroker, interfaceName);
@@ -1211,56 +1226,60 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
         jobCoordinator.enqueueJob("VPNINTERFACE-" + interfaceName,
             () -> {
                 List<ListenableFuture<Void>> futures = new ArrayList<>(3);
-                ListenableFuture<Void> configFuture = txRunner
-                        .callWithNewWriteOnlyTransactionAndSubmit(writeConfigTxn -> {
-                            futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(writeOperTxn -> {
-                                futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(writeInvTxn -> {
-                                    LOG.info("remove: - intfName {} onto vpnName {} running config-driven",
-                                            interfaceName, vpnName);
-                                    BigInteger dpId = BigInteger.ZERO;
-                                    int ifIndex = 0;
-                                    String gwMacAddress = null;
-                                    InstanceIdentifier<VpnInterfaceOpDataEntry> interfaceId =
-                                            VpnUtil.getVpnInterfaceOpDataEntryIdentifier(interfaceName, vpnName);
-                                    final Optional<VpnInterfaceOpDataEntry> optVpnInterface =
-                                            VpnUtil.read(dataBroker, LogicalDatastoreType.OPERATIONAL, interfaceId);
-                                    if (interfaceState != null) {
-                                        try {
-                                            dpId = InterfaceUtils.getDpIdFromInterface(interfaceState);
-                                        } catch (NumberFormatException | IllegalStateException e) {
-                                            LOG.error("remove: Unable to retrieve dpnId from interface operational"
-                                                    + " data store for interface {} on dpn {} for vpn {} Fetching"
-                                                            + " from vpn interface op data store. ", interfaceName,
-                                                    vpnInterface.getDpnId(), vpnName, e);
-                                            dpId = BigInteger.ZERO;
-                                        }
-                                        ifIndex = interfaceState.getIfIndex();
-                                        gwMacAddress = interfaceState.getPhysAddress().getValue();
-                                    } else {
-                                        LOG.info("remove: Interface state not available for {}. Trying to fetch data"
-                                                + " from vpn interface op.", interfaceName);
-                                        if (optVpnInterface.isPresent()) {
-                                            VpnInterfaceOpDataEntry vpnOpInterface = optVpnInterface.get();
-                                            dpId = vpnOpInterface.getDpnId();
-                                            ifIndex = vpnOpInterface.getLportTag().intValue();
-                                            gwMacAddress = vpnOpInterface.getGatewayMacAddress();
-                                        } else {
-                                            LOG.error("remove: Handling removal of VPN interface {} for vpn {} skipped"
-                                                            + " as interfaceState and vpn interface op is not"
-                                                    + " available", interfaceName, vpnName);
-                                            return;
-                                        }
-                                    }
-                                    processVpnInterfaceDown(dpId, interfaceName, ifIndex, gwMacAddress,
-                                            optVpnInterface.isPresent() ? optVpnInterface.get() : null, false,
-                                            writeConfigTxn, writeOperTxn, writeInvTxn);
-                                    LOG.info(
-                                            "remove: Removal of vpn interface {} on dpn {} for vpn {} processed "
-                                                    + "successfully",
-                                            interfaceName, vpnInterface.getDpnId(), vpnName);
-                                }));
-                            }));
-                        });
+                ListenableFuture<Void> configFuture = txRunner.callWithNewWriteOnlyTransactionAndSubmit(
+                    writeConfigTxn -> futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(
+                        writeOperTxn -> futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(writeInvTxn -> {
+                            LOG.info("remove: - intfName {} onto vpnName {} running config-driven",
+                                    interfaceName, vpnName);
+                            BigInteger dpId = BigInteger.ZERO;
+                            int ifIndex = 0;
+                            String gwMacAddress = null;
+                            InstanceIdentifier<VpnInterfaceOpDataEntry> interfaceId =
+                                    VpnUtil.getVpnInterfaceOpDataEntryIdentifier(interfaceName, vpnName);
+                            Optional<VpnInterfaceOpDataEntry> optVpnInterface = Optional.absent();
+                            try {
+                                optVpnInterface = SingleTransactionDataBroker.syncReadOptional(dataBroker,
+                                        LogicalDatastoreType.OPERATIONAL, interfaceId);
+                            } catch (ReadFailedException e) {
+                                LOG.error("remove: Failed to read data store for interface {} vpn {}", interfaceName,
+                                        vpnName);
+                                return;
+                            }
+                            if (interfaceState != null) {
+                                try {
+                                    dpId = InterfaceUtils.getDpIdFromInterface(interfaceState);
+                                } catch (NumberFormatException | IllegalStateException e) {
+                                    LOG.error("remove: Unable to retrieve dpnId from interface operational"
+                                            + " data store for interface {} on dpn {} for vpn {} Fetching"
+                                                    + " from vpn interface op data store. ", interfaceName,
+                                            vpnInterface.getDpnId(), vpnName, e);
+                                    dpId = BigInteger.ZERO;
+                                }
+                                ifIndex = interfaceState.getIfIndex();
+                                gwMacAddress = interfaceState.getPhysAddress().getValue();
+                            } else {
+                                LOG.info("remove: Interface state not available for {}. Trying to fetch data"
+                                        + " from vpn interface op.", interfaceName);
+                                if (optVpnInterface.isPresent()) {
+                                    VpnInterfaceOpDataEntry vpnOpInterface = optVpnInterface.get();
+                                    dpId = vpnOpInterface.getDpnId();
+                                    ifIndex = vpnOpInterface.getLportTag().intValue();
+                                    gwMacAddress = vpnOpInterface.getGatewayMacAddress();
+                                } else {
+                                    LOG.error("remove: Handling removal of VPN interface {} for vpn {} skipped"
+                                                    + " as interfaceState and vpn interface op is not"
+                                            + " available", interfaceName, vpnName);
+                                    return;
+                                }
+                            }
+                            processVpnInterfaceDown(dpId, interfaceName, ifIndex, gwMacAddress,
+                                    optVpnInterface.isPresent() ? optVpnInterface.get() : null, false,
+                                    writeConfigTxn, writeOperTxn, writeInvTxn);
+                            LOG.info(
+                                    "remove: Removal of vpn interface {} on dpn {} for vpn {} processed "
+                                            + "successfully",
+                                    interfaceName, vpnInterface.getDpnId(), vpnName);
+                        })))));
                 futures.add(configFuture);
                 Futures.addCallback(configFuture, new PostVpnInterfaceWorker(interfaceName, false, "Config"));
                 return futures;
@@ -1285,18 +1304,17 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
         InstanceIdentifier<VpnInterfaceOpDataEntry> identifier = VpnUtil.getVpnInterfaceOpDataEntryIdentifier(
                                                     interfaceName, vpnName);
         if (!isInterfaceStateDown) {
-            final long vpnId = VpnUtil.getVpnId(dataBroker, vpnName);
-            VpnUtil.scheduleVpnInterfaceForRemoval(dataBroker, interfaceName, dpId, vpnName, Boolean.TRUE,
-                    null);
-            final boolean isBgpVpnInternetVpn = VpnUtil.isBgpVpnInternet(dataBroker, vpnName);
+            final long vpnId = vpnUtil.getVpnId(vpnName);
+            vpnUtil.scheduleVpnInterfaceForRemoval(interfaceName, dpId, vpnName,  null);
+            final boolean isBgpVpnInternetVpn = vpnUtil.isBgpVpnInternet(vpnName);
             removeAdjacenciesFromVpn(dpId, lportTag, interfaceName, vpnName,
                     vpnId, gwMac, writeConfigTxn, writeOperTxn, writeInvTxn);
             if (interfaceManager.isExternalInterface(interfaceName)) {
-                processExternalVpnInterface(interfaceName, vpnName, vpnId, dpId, lportTag, writeInvTxn,
-                        NwConstants.DEL_FLOW);
+                processExternalVpnInterface(interfaceName, vpnName, dpId, lportTag,
+                    NwConstants.DEL_FLOW);
             }
             if (!isBgpVpnInternetVpn) {
-                VpnUtil.unbindService(dataBroker, interfaceName, isInterfaceStateDown, jobCoordinator);
+                vpnUtil.unbindService(interfaceName, isInterfaceStateDown);
             }
             LOG.info("processVpnInterfaceDown: Unbound vpn service from interface {} on dpn {} for vpn {}"
                     + " successful", interfaceName, dpId, vpnName);
@@ -1312,68 +1330,80 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
                                           WriteTransaction writeConfigTxn, final WriteTransaction writeOperTxn,
                                           final WriteTransaction writeInvTxn) {
         //Read NextHops
-        InstanceIdentifier<VpnInterfaceOpDataEntry> identifier = VpnUtil
-                .getVpnInterfaceOpDataEntryIdentifier(interfaceName, vpnName);
-        InstanceIdentifier<AdjacenciesOp> path = identifier.augmentation(AdjacenciesOp.class);
-        Optional<AdjacenciesOp> adjacencies = VpnUtil.read(dataBroker, LogicalDatastoreType.OPERATIONAL, path);
-
-        String primaryRd = VpnUtil.getVpnRd(dataBroker, vpnName);
-        LOG.info("removeAdjacenciesFromVpn: For interface {} on dpn {} RD recovered for vpn {} as rd {}",
-                interfaceName, dpnId, vpnName, primaryRd);
-        if (adjacencies.isPresent() && !adjacencies.get().getAdjacency().isEmpty()) {
-            List<Adjacency> nextHops = adjacencies.get().getAdjacency();
-            LOG.info("removeAdjacenciesFromVpn: NextHops for interface {} on dpn {} for vpn {} are {}",
-                    interfaceName, dpnId, vpnName, nextHops);
-            for (Adjacency nextHop : nextHops) {
-                if (nextHop.isPhysNetworkFunc()) {
-                    LOG.info("removeAdjacenciesFromVpn: Removing PNF FIB entry rd {} prefix {}",
-                            nextHop.getSubnetId().getValue(), nextHop.getIpAddress());
-                    fibManager.removeFibEntry(nextHop.getSubnetId().getValue(), nextHop.getIpAddress(),
-                            null/*writeCfgTxn*/);
-                } else {
-                    String rd = nextHop.getVrfId();
-                    List<String> nhList;
-                    if (nextHop.getAdjacencyType() != AdjacencyType.PrimaryAdjacency) {
-                        nhList = getNextHopForNonPrimaryAdjacency(nextHop, vpnName, dpnId, interfaceName);
+        try {
+            InstanceIdentifier<VpnInterfaceOpDataEntry> identifier = VpnUtil
+                    .getVpnInterfaceOpDataEntryIdentifier(interfaceName, vpnName);
+            InstanceIdentifier<AdjacenciesOp> path = identifier.augmentation(AdjacenciesOp.class);
+            Optional<AdjacenciesOp> adjacencies = SingleTransactionDataBroker.syncReadOptional(dataBroker,
+                    LogicalDatastoreType.OPERATIONAL, path);
+            String primaryRd = vpnUtil.getVpnRd(vpnName);
+            LOG.info("removeAdjacenciesFromVpn: For interface {} on dpn {} RD recovered for vpn {} as rd {}",
+                    interfaceName, dpnId, vpnName, primaryRd);
+            if (adjacencies.isPresent() && !adjacencies.get().getAdjacency().isEmpty()) {
+                List<Adjacency> nextHops = adjacencies.get().getAdjacency();
+                LOG.info("removeAdjacenciesFromVpn: NextHops for interface {} on dpn {} for vpn {} are {}",
+                        interfaceName, dpnId, vpnName, nextHops);
+                for (Adjacency nextHop : nextHops) {
+                    if (nextHop.isPhysNetworkFunc()) {
+                        LOG.info("removeAdjacenciesFromVpn: Removing PNF FIB entry rd {} prefix {}",
+                                nextHop.getSubnetId().getValue(), nextHop.getIpAddress());
+                        fibManager.removeFibEntry(nextHop.getSubnetId().getValue(), nextHop.getIpAddress(),
+                                null/*writeCfgTxn*/);
                     } else {
-                        // This is a primary adjacency
-                        nhList = nextHop.getNextHopIpList() != null ? nextHop.getNextHopIpList()
-                                : Collections.emptyList();
-                        removeGwMacAndArpResponderFlows(nextHop, vpnId, dpnId, lportTag, gwMac,
-                                interfaceName, writeInvTxn);
-                    }
-                    if (!nhList.isEmpty()) {
-                        if (rd.equals(vpnName)) {
-                            //this is an internal vpn - the rd is assigned to the vpn instance name;
-                            //remove from FIB directly
-                            nhList.forEach((nh) -> removeAdjacencyFromInternalVpn(nextHop, vpnName,
-                                    interfaceName, dpnId, writeConfigTxn));
+                        String rd = nextHop.getVrfId();
+                        List<String> nhList;
+                        if (nextHop.getAdjacencyType() != AdjacencyType.PrimaryAdjacency) {
+                            nhList = getNextHopForNonPrimaryAdjacency(nextHop, vpnName, dpnId, interfaceName);
                         } else {
-                            removeAdjacencyFromBgpvpn(nextHop, nhList, vpnName, primaryRd, dpnId, rd, interfaceName,
-                                    writeConfigTxn);
+                            // This is a primary adjacency
+                            nhList = nextHop.getNextHopIpList() != null ? nextHop.getNextHopIpList()
+                                    : Collections.emptyList();
+                            removeGwMacAndArpResponderFlows(nextHop, vpnId, dpnId, lportTag, gwMac,
+                                    interfaceName, writeInvTxn);
+                        }
+                        if (!nhList.isEmpty()) {
+                            if (rd.equals(vpnName)) {
+                                //this is an internal vpn - the rd is assigned to the vpn instance name;
+                                //remove from FIB directly
+                                nhList.forEach(removeAdjacencyFromInternalVpn(nextHop, vpnName,
+                                        interfaceName, dpnId, writeConfigTxn));
+                            } else {
+                                removeAdjacencyFromBgpvpn(nextHop, nhList, vpnName, primaryRd, dpnId, rd,
+                                        interfaceName, writeConfigTxn);
+                            }
+                        } else {
+                            LOG.error("removeAdjacenciesFromVpn: nextHop empty for ip {} rd {} adjacencyType {}"
+                                            + " interface {}", nextHop.getIpAddress(), rd,
+                                    nextHop.getAdjacencyType().toString(), interfaceName);
+                            bgpManager.withdrawPrefixIfPresent(rd, nextHop.getIpAddress());
+                            fibManager.removeFibEntry(primaryRd, nextHop.getIpAddress(), writeConfigTxn);
                         }
-                    } else {
-                        LOG.error("removeAdjacenciesFromVpn: nextHop empty for ip {} rd {} adjacencyType {}"
-                                        + " interface {}", nextHop.getIpAddress(), rd,
-                                nextHop.getAdjacencyType().toString(), interfaceName);
-                        bgpManager.withdrawPrefix(rd, nextHop.getIpAddress());
-                        fibManager.removeFibEntry(primaryRd, nextHop.getIpAddress(), writeConfigTxn);
+                    }
+                    String ip = nextHop.getIpAddress().split("/")[0];
+                    LearntVpnVipToPort vpnVipToPort = vpnUtil.getLearntVpnVipToPort(vpnName, ip);
+                    if (vpnVipToPort != null) {
+                        vpnUtil.removeLearntVpnVipToPort(vpnName, ip, null);
+                        LOG.info("removeAdjacenciesFromVpn: VpnInterfaceManager removed LearntVpnVipToPort entry"
+                                 + " for Interface {} ip {} on dpn {} for vpn {}",
+                                vpnVipToPort.getPortName(), ip, dpnId, vpnName);
+                    }
+                    VpnPortipToPort vpnPortipToPort = vpnUtil.getNeutronPortFromVpnPortFixedIp(vpnName, ip);
+                    if (vpnPortipToPort != null) {
+                        VpnUtil.removeVpnPortFixedIpToPort(dataBroker, vpnName, ip, null);
+                        LOG.info("removeAdjacenciesFromVpn: VpnInterfaceManager removed vpnPortipToPort entry for "
+                                 + "Interface {} ip {} on dpn {} for vpn {}",
+                            vpnPortipToPort.getPortName(), ip, dpnId, vpnName);
                     }
                 }
-                String ip = nextHop.getIpAddress().split("/")[0];
-                LearntVpnVipToPort vpnVipToPort = VpnUtil.getLearntVpnVipToPort(dataBroker, vpnName, ip);
-                if (vpnVipToPort != null) {
-                    VpnUtil.removeLearntVpnVipToPort(dataBroker, vpnName, ip);
-                    LOG.info("removeAdjacenciesFromVpn: VpnInterfaceManager removed adjacency for Interface {}"
-                                    + " ip {} on dpn {} for vpn {} from VpnPortData Entry", vpnVipToPort.getPortName(),
-                            ip, dpnId, vpnName);
-                }
+            } else {
+                // this vpn interface has no more adjacency left, so clean up the vpn interface from Operational DS
+                LOG.info("removeAdjacenciesFromVpn: Vpn Interface {} on vpn {} dpn {} has no adjacencies."
+                        + " Removing it.", interfaceName, vpnName, dpnId);
+                writeOperTxn.delete(LogicalDatastoreType.OPERATIONAL, identifier);
             }
-        } else {
-            // this vpn interface has no more adjacency left, so clean up the vpn interface from Operational DS
-            LOG.info("removeAdjacenciesFromVpn: Vpn Interface {} on vpn {} dpn {} has no adjacencies."
-                    + " Removing it.", interfaceName, vpnName, dpnId);
-            writeOperTxn.delete(LogicalDatastoreType.OPERATIONAL, identifier);
+        } catch (ReadFailedException e) {
+            LOG.error("removeAdjacenciesFromVpn: Failed to read data store for interface {} dpn {} vpn {}",
+                    interfaceName, dpnId, vpnName);
         }
     }
 
@@ -1393,7 +1423,7 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
                                            BigInteger dpnId, String rd, String interfaceName,
                                            WriteTransaction writeConfigTxn) {
         List<VpnInstanceOpDataEntry> vpnsToImportRoute =
-                VpnUtil.getVpnsImportingMyRoute(dataBroker, vpnName);
+                vpnUtil.getVpnsImportingMyRoute(vpnName);
         nhList.forEach((nh) -> {
             //IRT: remove routes from other vpns importing it
             vpnManager.removePrefixFromBGP(primaryRd, rd, vpnName, nextHop.getIpAddress(),
@@ -1420,8 +1450,7 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
             // A valid mac-address was not available for this subnet-gateway-ip
             // So a connected-mac-address was used for this subnet and we need
             // to remove the flows for the same here from the L3_GW_MAC_TABLE.
-            VpnUtil.setupGwMacIfExternalVpn(dataBroker, mdsalManager, dpnId, interfaceName,
-                    vpnId, writeInvTxn, NwConstants.DEL_FLOW, gwMac);
+            vpnUtil.setupGwMacIfExternalVpn(dpnId, interfaceName, vpnId, writeInvTxn, NwConstants.DEL_FLOW, gwMac);
         }
         arpResponderHandler.removeArpResponderFlow(dpnId, lportTag, interfaceName, nextHop.getSubnetGatewayIp(),
                 subnetId);
@@ -1445,7 +1474,7 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
     }
 
     private Optional<String> getMacAddressForSubnetIp(String vpnName, String ifName, String ipAddress) {
-        VpnPortipToPort gwPort = VpnUtil.getNeutronPortFromVpnPortFixedIp(dataBroker, vpnName, ipAddress);
+        VpnPortipToPort gwPort = vpnUtil.getNeutronPortFromVpnPortFixedIp(vpnName, ipAddress);
         //Check if a router gateway interface is available for the subnet gw is so then use Router interface
         // else use connected interface
         if (gwPort != null && gwPort.isSubnetIp()) {
@@ -1464,10 +1493,10 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
                 update.getVpnInstanceNames());
         final String vpnInterfaceName = update.getName();
         final BigInteger dpnId = InterfaceUtils.getDpnForInterface(ifaceMgrRpcService, vpnInterfaceName);
-        final Adjacencies origAdjs = original.getAugmentation(Adjacencies.class);
+        final Adjacencies origAdjs = original.augmentation(Adjacencies.class);
         final List<Adjacency> oldAdjs = origAdjs != null && origAdjs.getAdjacency()
             != null ? origAdjs.getAdjacency() : new ArrayList<>();
-        final Adjacencies updateAdjs = update.getAugmentation(Adjacencies.class);
+        final Adjacencies updateAdjs = update.augmentation(Adjacencies.class);
         final List<Adjacency> newAdjs = updateAdjs != null && updateAdjs.getAdjacency()
             != null ? updateAdjs.getAdjacency() : new ArrayList<>();
 
@@ -1485,58 +1514,80 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
             String newVpnName = vpnInterfaceVpnInstance.getVpnName();
             List<Adjacency> copyNewAdjs = new ArrayList<>(newAdjs);
             List<Adjacency> copyOldAdjs = new ArrayList<>(oldAdjs);
-            String primaryRd = VpnUtil.getPrimaryRd(dataBroker, newVpnName);
-            if (!VpnUtil.isVpnPendingDelete(dataBroker, primaryRd)) {
+            String primaryRd = vpnUtil.getPrimaryRd(newVpnName);
+            if (!vpnUtil.isVpnPendingDelete(primaryRd)) {
                 jobCoordinator.enqueueJob("VPNINTERFACE-" + vpnInterfaceName, () -> {
-                    WriteTransaction writeConfigTxn = dataBroker.newWriteOnlyTransaction();
-                    WriteTransaction writeOperTxn = dataBroker.newWriteOnlyTransaction();
-                    InstanceIdentifier<VpnInterfaceOpDataEntry> vpnInterfaceOpIdentifier =
-                        VpnUtil.getVpnInterfaceOpDataEntryIdentifier(vpnInterfaceName, newVpnName);
-                    LOG.info("VPN Interface update event - intfName {} onto vpnName {} running config-driven",
-                            update.getName(), newVpnName);
-                    //handle both addition and removal of adjacencies
-                    //currently, new adjacency may be an extra route
-                    boolean isBgpVpnInternetVpn = VpnUtil.isBgpVpnInternet(dataBroker, newVpnName);
-                    if (!oldAdjs.equals(newAdjs)) {
-                        for (Adjacency adj : copyNewAdjs) {
-                            if (copyOldAdjs.contains(adj)) {
-                                copyOldAdjs.remove(adj);
-                            } else {
-                                // add new adjacency - right now only extra route will hit this path
-                                if (!isBgpVpnInternetVpn || VpnUtil.isAdjacencyEligibleToVpnInternet(dataBroker, adj)) {
-                                    addNewAdjToVpnInterface(vpnInterfaceOpIdentifier, primaryRd, adj,
-                                             dpnId, writeOperTxn, writeConfigTxn);
+                    // 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 =
+                                    VpnUtil.getVpnInterfaceOpDataEntryIdentifier(vpnInterfaceName, newVpnName);
+                            LOG.info("VPN Interface update event - intfName {} onto vpnName {} running config-driven",
+                                    update.getName(), newVpnName);
+                            //handle both addition and removal of adjacencies
+                            //currently, new adjacency may be an extra route
+                            boolean isBgpVpnInternetVpn = vpnUtil.isBgpVpnInternet(newVpnName);
+                            if (!oldAdjs.equals(newAdjs)) {
+                                for (Adjacency adj : copyNewAdjs) {
+                                    if (copyOldAdjs.contains(adj)) {
+                                        copyOldAdjs.remove(adj);
+                                    } else {
+                                        // add new adjacency - right now only extra route will hit this path
+                                        if (!isBgpVpnInternetVpn || vpnUtil.isAdjacencyEligibleToVpnInternet(adj)) {
+                                            addNewAdjToVpnInterface(vpnInterfaceOpIdentifier, primaryRd, adj,
+                                                    dpnId, operTx, confTx);
+                                        }
+                                        LOG.info("update: new Adjacency {} with nextHop {} label {} subnet {} added to"
+                                                + " vpn interface {} on vpn {} dpnId {}",
+                                                adj.getIpAddress(), adj.getNextHopIpList(),
+                                                adj.getLabel(), adj.getSubnetId(), update.getName(),
+                                                newVpnName, dpnId);
+                                    }
+                                }
+                                for (Adjacency adj : copyOldAdjs) {
+                                    if (!isBgpVpnInternetVpn || vpnUtil.isAdjacencyEligibleToVpnInternet(adj)) {
+                                        if (adj.getAdjacencyType() == AdjacencyType.PrimaryAdjacency
+                                                && !adj.isPhysNetworkFunc()) {
+                                            delAdjFromVpnInterface(vpnInterfaceOpIdentifier, adj, dpnId,
+                                                    operTx, confTx);
+                                            Optional<VpnInterfaceOpDataEntry> optVpnInterface = operTx.read(
+                                                    LogicalDatastoreType.OPERATIONAL, vpnInterfaceOpIdentifier).get();
+                                            if (optVpnInterface.isPresent()) {
+                                                VpnInterfaceOpDataEntry vpnInterfaceOpDataEntry = optVpnInterface.get();
+                                                long vpnId = vpnUtil.getVpnId(newVpnName);
+                                                vpnUtil.removePrefixToInterfaceAdj(adj, vpnId,
+                                                        vpnInterfaceOpDataEntry, operTx);
+                                            } else {
+                                                LOG.info("update: Vpninterface {} not present in Operational",
+                                                        vpnInterfaceName);
+                                            }
+                                            //remove FIB entry
+                                            String vpnRd = vpnUtil.getVpnRd(newVpnName);
+                                            LOG.debug("update: remove prefix {} from the FIB and BGP entry "
+                                                    + "for the Vpn-Rd {} ", adj.getIpAddress(), vpnRd);
+                                            //remove BGP entry
+                                            fibManager.removeFibEntry(vpnRd, adj.getIpAddress(), confTx);
+                                            if (vpnRd != null && !vpnRd.equalsIgnoreCase(newVpnName)) {
+                                                bgpManager.withdrawPrefix(vpnRd, adj.getIpAddress());
+                                            }
+                                        } else {
+                                            delAdjFromVpnInterface(vpnInterfaceOpIdentifier, adj, dpnId,
+                                                    operTx, confTx);
+                                        }
+                                    }
+                                    LOG.info("update: Adjacency {} with nextHop {} label {} subnet {} removed from"
+                                                    + " vpn interface {} on vpn {}", adj.getIpAddress(), adj
+                                                    .getNextHopIpList(),
+                                            adj.getLabel(), adj.getSubnetId(), update.getName(), newVpnName);
                                 }
-                                LOG.info("update: new Adjacency {} with nextHop {} label {} subnet {} added to vpn "
-                                                + "interface {} on vpn {} dpnId {}",
-                                        adj.getIpAddress(), adj.getNextHopIpList(),
-                                        adj.getLabel(), adj.getSubnetId(), update.getName(),
-                                        newVpnName, dpnId);
-                            }
-                        }
-                        for (Adjacency adj : copyOldAdjs) {
-                            if (!isBgpVpnInternetVpn || VpnUtil.isAdjacencyEligibleToVpnInternet(dataBroker, adj)) {
-                                delAdjFromVpnInterface(vpnInterfaceOpIdentifier, adj, dpnId,
-                                       writeOperTxn, writeConfigTxn);
                             }
-                            LOG.info("update: Adjacency {} with nextHop {} label {} subnet {} removed from"
-                                + " vpn interface {} on vpn {}", adj.getIpAddress(), adj.getNextHopIpList(),
-                                adj.getLabel(), adj.getSubnetId(), update.getName(), newVpnName);
-                        }
+                        }));
+                    }));
+                    for (ListenableFuture<Void> future : futures) {
+                        ListenableFutures.addErrorLogging(future, LOG, "update: failed for interface {} on vpn {}",
+                                update.getName(), update.getVpnInstanceNames());
                     }
-                    ListenableFuture<Void> operFuture = writeOperTxn.submit();
-                    try {
-                        operFuture.get();
-                    } catch (ExecutionException e) {
-                        LOG.error("Exception encountered while submitting operational future for update"
-                                + " VpnInterface {} on vpn {}", vpnInterfaceName, newVpnName, e);
-                        return null;
-                    }
-                    List<ListenableFuture<Void>> futures = new ArrayList<>();
-                    futures.add(writeConfigTxn.submit());
-                    LOG.info("update: vpn interface updated for interface {} oldVpn(s) {} newVpn {}"
-                        + "processed successfully", update.getName(),
-                        VpnHelper.getVpnInterfaceVpnInstanceNamesString(original.getVpnInstanceNames()), newVpnName);
                     return futures;
                 });
             } else {
@@ -1558,63 +1609,76 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
         List<String> newVpnList = update.getVpnInstanceNames().stream()
             .map(VpnInstanceNames::getVpnName).collect(Collectors.toList());
         oldVpnList.removeAll(newVpnList);
-        for (String oldVpnName: oldVpnList) {
-            isSwap = Boolean.TRUE;
-            LOG.info("handleVpnSwapForVpnInterface: VPN Interface update event - intfName {} remove vpnName {} running"
-                     + " config-driven swap removal", interfaceName, oldVpnName);
-            removeVpnInterfaceCall(identifier, original, oldVpnName, interfaceName);
-            LOG.info("handleVpnSwapForVpnInterface: Processed Remove for update on VPNInterface {} upon VPN swap"
-                     + "from old vpn {} to newVpn(s) {}", interfaceName, oldVpnName, newVpnList);
-        }
-        //Wait for previous interface bindings to be removed
-        try {
-            Thread.sleep(2000);
-        } catch (InterruptedException e) {
-            //Ignore
-        }
         newVpnList.removeAll(oldVpnListCopy);
-        for (String newVpnName: newVpnList) {
-            String primaryRd = VpnUtil.getPrimaryRd(dataBroker, newVpnName);
-            isSwap = Boolean.TRUE;
-            if (!VpnUtil.isVpnPendingDelete(dataBroker, primaryRd)) {
-                LOG.info("handleVpnSwapForVpnInterface: VPN Interface update event - intfName {} onto vpnName {}"
-                         + "running config-driven swap addition", interfaceName, newVpnName);
-                final Adjacencies origAdjs = original.getAugmentation(Adjacencies.class);
-                final List<Adjacency> oldAdjs = (origAdjs != null && origAdjs.getAdjacency() != null)
-                                                ? origAdjs.getAdjacency() : new ArrayList<>();
-                final Adjacencies updateAdjs = update.getAugmentation(Adjacencies.class);
-                final List<Adjacency> newAdjs = (updateAdjs != null && updateAdjs.getAdjacency() != null)
-                                                ? updateAdjs.getAdjacency() : new ArrayList<>();
-
-                addVpnInterfaceCall(identifier, update, oldAdjs, newAdjs, newVpnName);
-                LOG.info("handleVpnSwapForVpnInterface: Processed Add for update on VPNInterface {}"
-                         + "from oldVpn(s) {} to newVpn {} upon VPN swap",
-                         interfaceName, oldVpnListCopy, newVpnName);
+        if (!oldVpnList.isEmpty() || !newVpnList.isEmpty()) {
+            for (String oldVpnName: oldVpnList) {
+                isSwap = Boolean.TRUE;
+                LOG.info("handleVpnSwapForVpnInterface: VPN Interface update event - intfName {} remove vpnName {}"
+                        + " running config-driven swap removal", interfaceName, oldVpnName);
+                removeVpnInterfaceCall(identifier, original, oldVpnName, interfaceName);
+                LOG.info("handleVpnSwapForVpnInterface: Processed Remove for update on VPNInterface {} upon VPN swap"
+                        + "from old vpn {} to newVpn(s) {}", interfaceName, oldVpnName, newVpnList);
+            }
+            //Wait for previous interface bindings to be removed
+            try {
+                Thread.sleep(2000);
+            } catch (InterruptedException e) {
+                //Ignore
+            }
+            for (String newVpnName: newVpnList) {
+                String primaryRd = vpnUtil.getPrimaryRd(newVpnName);
+                isSwap = Boolean.TRUE;
+                if (!vpnUtil.isVpnPendingDelete(primaryRd)) {
+                    LOG.info("handleVpnSwapForVpnInterface: VPN Interface update event - intfName {} onto vpnName {}"
+                            + "running config-driven swap addition", interfaceName, newVpnName);
+                    final Adjacencies origAdjs = original.augmentation(Adjacencies.class);
+                    final List<Adjacency> oldAdjs = (origAdjs != null && origAdjs.getAdjacency() != null)
+                            ? origAdjs.getAdjacency() : new ArrayList<>();
+                    final Adjacencies updateAdjs = update.augmentation(Adjacencies.class);
+                    final List<Adjacency> newAdjs = (updateAdjs != null && updateAdjs.getAdjacency() != null)
+                            ? updateAdjs.getAdjacency() : new ArrayList<>();
+
+                    addVpnInterfaceCall(identifier, update, oldAdjs, newAdjs, newVpnName);
+                    LOG.info("handleVpnSwapForVpnInterface: Processed Add for update on VPNInterface {}"
+                                    + "from oldVpn(s) {} to newVpn {} upon VPN swap",
+                            interfaceName, oldVpnListCopy, newVpnName);
+                }
             }
         }
         return isSwap;
     }
 
     private void updateLabelMapper(Long label, List<String> nextHopIpList) {
-        Preconditions.checkNotNull(label, "updateLabelMapper: label cannot be null or empty!");
-        synchronized (label.toString().intern()) {
-            InstanceIdentifier<LabelRouteInfo> lriIid = InstanceIdentifier.builder(LabelRouteMap.class)
-                    .child(LabelRouteInfo.class, new LabelRouteInfoKey(label)).build();
-            Optional<LabelRouteInfo> opResult = VpnUtil.read(dataBroker, LogicalDatastoreType.OPERATIONAL, lriIid);
-            if (opResult.isPresent()) {
-                LabelRouteInfo labelRouteInfo =
-                    new LabelRouteInfoBuilder(opResult.get()).setNextHopIpList(nextHopIpList).build();
-                MDSALUtil.syncWrite(dataBroker, LogicalDatastoreType.OPERATIONAL, lriIid, labelRouteInfo);
+        try {
+            Preconditions.checkNotNull(label, "updateLabelMapper: label cannot be null or empty!");
+            synchronized (label.toString().intern()) {
+                InstanceIdentifier<LabelRouteInfo> lriIid = InstanceIdentifier.builder(LabelRouteMap.class)
+                        .child(LabelRouteInfo.class, new LabelRouteInfoKey(label)).build();
+                Optional<LabelRouteInfo> opResult = SingleTransactionDataBroker.syncReadOptional(dataBroker,
+                        LogicalDatastoreType.OPERATIONAL, lriIid);
+                if (opResult.isPresent()) {
+                    LabelRouteInfo labelRouteInfo =
+                            new LabelRouteInfoBuilder(opResult.get()).setNextHopIpList(nextHopIpList).build();
+                    SingleTransactionDataBroker.syncWrite(dataBroker, LogicalDatastoreType.OPERATIONAL, lriIid,
+                            labelRouteInfo, VpnUtil.SINGLE_TRANSACTION_BROKER_NO_RETRY);
+                }
             }
+            LOG.info("updateLabelMapper: Updated label rotue info for label {} with nextHopList {}", label,
+                    nextHopIpList);
+        } catch (ReadFailedException e) {
+            LOG.error("updateLabelMapper: Failed to read data store for label {} nexthopList {}", label,
+                    nextHopIpList);
+        } catch (TransactionCommitFailedException e) {
+            LOG.error("updateLabelMapper: Failed to commit to data store for label {} nexthopList {}", label,
+                    nextHopIpList);
         }
-        LOG.info("updateLabelMapper: Updated label rotue info for label {} with nextHopList {}", label, nextHopIpList);
     }
 
     public synchronized void importSubnetRouteForNewVpn(String rd, String prefix, String nextHop, int label,
-        SubnetRoute route, WriteTransaction writeConfigTxn) {
+        SubnetRoute route, String parentVpnRd, WriteTransaction writeConfigTxn) {
 
         RouteOrigin origin = RouteOrigin.SELF_IMPORTED;
-        VrfEntry vrfEntry = FibHelper.getVrfEntryBuilder(prefix, label, nextHop, origin, null /* parentVpnRd */)
+        VrfEntry vrfEntry = FibHelper.getVrfEntryBuilder(prefix, label, nextHop, origin, parentVpnRd)
                 .addAugmentation(SubnetRoute.class, route).build();
         List<VrfEntry> vrfEntryList = Collections.singletonList(vrfEntry);
         InstanceIdentifierBuilder<VrfTables> idBuilder =
@@ -1624,7 +1688,7 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
         if (writeConfigTxn != null) {
             writeConfigTxn.merge(LogicalDatastoreType.CONFIGURATION, vrfTableId, vrfTableNew, true);
         } else {
-            VpnUtil.syncUpdate(dataBroker, LogicalDatastoreType.CONFIGURATION, vrfTableId, vrfTableNew);
+            vpnUtil.syncUpdate(LogicalDatastoreType.CONFIGURATION, vrfTableId, vrfTableNew);
         }
         LOG.info("SUBNETROUTE: importSubnetRouteForNewVpn: Created vrfEntry for rd {} prefix {} nexthop {} label {}"
                 + " and elantag {}", rd, prefix, nextHop, label, route.getElantag());
@@ -1633,175 +1697,188 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
     protected void addNewAdjToVpnInterface(InstanceIdentifier<VpnInterfaceOpDataEntry> identifier, String primaryRd,
                                            Adjacency adj, BigInteger dpnId, WriteTransaction writeOperTxn,
                                            WriteTransaction writeConfigTxn) {
-
-        Optional<VpnInterfaceOpDataEntry> optVpnInterface = VpnUtil.read(dataBroker,
-                                                LogicalDatastoreType.OPERATIONAL, identifier);
-
-        if (optVpnInterface.isPresent()) {
-            VpnInterfaceOpDataEntry currVpnIntf = optVpnInterface.get();
-            String prefix = VpnUtil.getIpPrefix(adj.getIpAddress());
-            String vpnName = currVpnIntf.getVpnInstanceName();
-            VpnInstanceOpDataEntry vpnInstanceOpData = VpnUtil.getVpnInstanceOpData(dataBroker, primaryRd);
-            InstanceIdentifier<AdjacenciesOp> adjPath = identifier.augmentation(AdjacenciesOp.class);
-            Optional<AdjacenciesOp> optAdjacencies = VpnUtil.read(dataBroker,
-                                            LogicalDatastoreType.OPERATIONAL, adjPath);
-            boolean isL3VpnOverVxLan = VpnUtil.isL3VpnOverVxLan(vpnInstanceOpData.getL3vni());
-            VrfEntry.EncapType encapType = VpnUtil.getEncapType(isL3VpnOverVxLan);
-            long l3vni = vpnInstanceOpData.getL3vni() == null ? 0L :  vpnInstanceOpData.getL3vni();
-            VpnPopulator populator = L3vpnRegistry.getRegisteredPopulator(encapType);
-            List<Adjacency> adjacencies;
-            if (optAdjacencies.isPresent()) {
-                adjacencies = optAdjacencies.get().getAdjacency();
-            } else {
-                // This code will be hit in case of first PNF adjacency
-                adjacencies = new ArrayList<>();
-            }
-            long vpnId = VpnUtil.getVpnId(dataBroker, vpnName);
-            L3vpnInput input = new L3vpnInput().setNextHop(adj).setVpnName(vpnName)
-                    .setInterfaceName(currVpnIntf.getName()).setPrimaryRd(primaryRd).setRd(primaryRd);
-            Adjacency operationalAdjacency = null;
-            if (adj.getNextHopIpList() != null && !adj.getNextHopIpList().isEmpty()) {
-                RouteOrigin origin = adj.getAdjacencyType() == AdjacencyType.PrimaryAdjacency ? RouteOrigin.LOCAL
-                        : RouteOrigin.STATIC;
-                String nh = adj.getNextHopIpList().get(0);
-                String vpnPrefixKey = VpnUtil.getVpnNamePrefixKey(vpnName, prefix);
-                synchronized (vpnPrefixKey.intern()) {
-                    java.util.Optional<String> rdToAllocate = VpnUtil.allocateRdForExtraRouteAndUpdateUsedRdsMap(
-                            dataBroker, vpnId, null, prefix, vpnName, nh, dpnId);
-                    if (rdToAllocate.isPresent()) {
-                        input.setRd(rdToAllocate.get());
-                        operationalAdjacency = populator.createOperationalAdjacency(input);
-                        int label = operationalAdjacency.getLabel().intValue();
-                        vpnManager.addExtraRoute(vpnName, adj.getIpAddress(), nh, rdToAllocate.get(),
-                                currVpnIntf.getVpnInstanceName(), l3vni, origin,
-                                currVpnIntf.getName(), operationalAdjacency, encapType, writeConfigTxn);
-                        LOG.info("addNewAdjToVpnInterface: Added extra route ip {} nh {} rd {} vpnname {} label {}"
-                                + " Interface {} on dpn {}", adj.getIpAddress(), nh, rdToAllocate.get(),
-                                vpnName, label, currVpnIntf.getName(), dpnId);
-                    } else {
-                        LOG.error("addNewAdjToVpnInterface: No rds to allocate extraroute vpn {} prefix {}", vpnName,
-                                prefix);
-                        return;
-                    }
-                    // iRT/eRT use case Will be handled in a new patchset for L3VPN Over VxLAN.
-                    // Keeping the MPLS check for now.
-                    if (encapType.equals(VrfEntryBase.EncapType.Mplsgre)) {
-                        final Adjacency opAdjacency = new AdjacencyBuilder(operationalAdjacency).build();
-                        List<VpnInstanceOpDataEntry> vpnsToImportRoute =
-                                VpnUtil.getVpnsImportingMyRoute(dataBroker, vpnName);
-                        vpnsToImportRoute.forEach(vpn -> {
-                            if (vpn.getVrfId() != null) {
-                                VpnUtil.allocateRdForExtraRouteAndUpdateUsedRdsMap(
-                                        dataBroker, vpn.getVpnId(), vpnId, prefix,
-                                        VpnUtil.getVpnName(dataBroker, vpn.getVpnId()), nh, dpnId)
-                                        .ifPresent(
-                                            rds -> vpnManager.addExtraRoute(
-                                                    VpnUtil.getVpnName(dataBroker, vpn.getVpnId()),
-                                                    adj.getIpAddress(), nh, rds,
-                                                    currVpnIntf.getVpnInstanceName(),
-                                                    l3vni, RouteOrigin.SELF_IMPORTED,
-                                                    currVpnIntf.getName(), opAdjacency, encapType, writeConfigTxn));
-                            }
-                        });
+        String interfaceName = identifier.firstKeyOf(VpnInterfaceOpDataEntry.class).getName();
+        String configVpnName = identifier.firstKeyOf(VpnInterfaceOpDataEntry.class).getVpnInstanceName();
+        try {
+            Optional<VpnInterfaceOpDataEntry> optVpnInterface = SingleTransactionDataBroker
+                    .syncReadOptional(dataBroker, LogicalDatastoreType.OPERATIONAL, identifier);
+            if (optVpnInterface.isPresent()) {
+                VpnInterfaceOpDataEntry currVpnIntf = optVpnInterface.get();
+                String prefix = VpnUtil.getIpPrefix(adj.getIpAddress());
+                String vpnName = currVpnIntf.getVpnInstanceName();
+                VpnInstanceOpDataEntry vpnInstanceOpData = vpnUtil.getVpnInstanceOpData(primaryRd);
+                InstanceIdentifier<AdjacenciesOp> adjPath = identifier.augmentation(AdjacenciesOp.class);
+                Optional<AdjacenciesOp> optAdjacencies = SingleTransactionDataBroker.syncReadOptional(dataBroker,
+                        LogicalDatastoreType.OPERATIONAL, adjPath);
+                boolean isL3VpnOverVxLan = VpnUtil.isL3VpnOverVxLan(vpnInstanceOpData.getL3vni());
+                VrfEntry.EncapType encapType = VpnUtil.getEncapType(isL3VpnOverVxLan);
+                long l3vni = vpnInstanceOpData.getL3vni() == null ? 0L :  vpnInstanceOpData.getL3vni();
+                VpnPopulator populator = L3vpnRegistry.getRegisteredPopulator(encapType);
+                List<Adjacency> adjacencies;
+                if (optAdjacencies.isPresent()) {
+                    adjacencies = optAdjacencies.get().getAdjacency();
+                } else {
+                    // This code will be hit in case of first PNF adjacency
+                    adjacencies = new ArrayList<>();
+                }
+                long vpnId = vpnUtil.getVpnId(vpnName);
+                L3vpnInput input = new L3vpnInput().setNextHop(adj).setVpnName(vpnName)
+                        .setInterfaceName(currVpnIntf.getName()).setPrimaryRd(primaryRd).setRd(primaryRd);
+                Adjacency operationalAdjacency = null;
+                //Handling dual stack neutron port primary adjacency
+                if (adj.getAdjacencyType() == AdjacencyType.PrimaryAdjacency && !adj.isPhysNetworkFunc()) {
+                    LOG.trace("addNewAdjToVpnInterface: Adding prefix {} to existing interface {} for vpn {}", prefix,
+                            currVpnIntf.getName(), vpnName);
+                    Interface interfaceState = InterfaceUtils.getInterfaceStateFromOperDS(dataBroker,
+                            currVpnIntf.getName());
+                    if (interfaceState != null) {
+                        processVpnInterfaceAdjacencies(dpnId, currVpnIntf.getLportTag().intValue(), vpnName, primaryRd,
+                                currVpnIntf.getName(),
+                                vpnId, writeConfigTxn, writeOperTxn, null, interfaceState);
                     }
                 }
-            } else if (adj.isPhysNetworkFunc()) { // PNF adjacency.
-                LOG.trace("addNewAdjToVpnInterface: Adding prefix {} to interface {} for vpn {}", prefix,
-                        currVpnIntf.getName(), vpnName);
+                if (adj.getNextHopIpList() != null && !adj.getNextHopIpList().isEmpty()
+                        && adj.getAdjacencyType() != AdjacencyType.PrimaryAdjacency) {
+                    RouteOrigin origin = adj.getAdjacencyType() == AdjacencyType.PrimaryAdjacency ? RouteOrigin.LOCAL
+                            : RouteOrigin.STATIC;
+                    String nh = adj.getNextHopIpList().get(0);
+                    String vpnPrefixKey = VpnUtil.getVpnNamePrefixKey(vpnName, prefix);
+                    synchronized (vpnPrefixKey.intern()) {
+                        java.util.Optional<String> rdToAllocate = vpnUtil.allocateRdForExtraRouteAndUpdateUsedRdsMap(
+                                vpnId, null, prefix, vpnName, nh, dpnId);
+                        if (rdToAllocate.isPresent()) {
+                            input.setRd(rdToAllocate.get());
+                            operationalAdjacency = populator.createOperationalAdjacency(input);
+                            int label = operationalAdjacency.getLabel().intValue();
+                            vpnManager.addExtraRoute(vpnName, adj.getIpAddress(), nh, rdToAllocate.get(),
+                                    currVpnIntf.getVpnInstanceName(), l3vni, origin,
+                                    currVpnIntf.getName(), operationalAdjacency, encapType, writeConfigTxn);
+                            LOG.info("addNewAdjToVpnInterface: Added extra route ip {} nh {} rd {} vpnname {} label {}"
+                                            + " Interface {} on dpn {}", adj.getIpAddress(), nh, rdToAllocate.get(),
+                                    vpnName, label, currVpnIntf.getName(), dpnId);
+                        } else {
+                            LOG.error("addNewAdjToVpnInterface: No rds to allocate extraroute vpn {} prefix {}",
+                                    vpnName, prefix);
+                            return;
+                        }
+                        // iRT/eRT use case Will be handled in a new patchset for L3VPN Over VxLAN.
+                        // Keeping the MPLS check for now.
+                        if (encapType.equals(VrfEntryBase.EncapType.Mplsgre)) {
+                            final Adjacency opAdjacency = new AdjacencyBuilder(operationalAdjacency).build();
+                            List<VpnInstanceOpDataEntry> vpnsToImportRoute =
+                                    vpnUtil.getVpnsImportingMyRoute(vpnName);
+                            vpnsToImportRoute.forEach(vpn -> {
+                                if (vpn.getVrfId() != null) {
+                                    vpnUtil.allocateRdForExtraRouteAndUpdateUsedRdsMap(vpn.getVpnId(), vpnId, prefix,
+                                            vpnUtil.getVpnName(vpn.getVpnId()), nh, dpnId)
+                                            .ifPresent(
+                                                rds -> vpnManager.addExtraRoute(
+                                                        vpnUtil.getVpnName(vpn.getVpnId()),
+                                                        adj.getIpAddress(), nh, rds,
+                                                        currVpnIntf.getVpnInstanceName(), l3vni,
+                                                        RouteOrigin.SELF_IMPORTED, currVpnIntf.getName(),
+                                                        opAdjacency, encapType, writeConfigTxn));
+                                }
+                            });
+                        }
+                    }
+                } else if (adj.isPhysNetworkFunc()) { // PNF adjacency.
+                    LOG.trace("addNewAdjToVpnInterface: Adding prefix {} to interface {} for vpn {}", prefix,
+                            currVpnIntf.getName(), vpnName);
 
-                String parentVpnRd = getParentVpnRdForExternalSubnet(adj);
+                    String parentVpnRd = getParentVpnRdForExternalSubnet(adj);
 
-                writeOperTxn.merge(
-                        LogicalDatastoreType.OPERATIONAL,
-                        VpnUtil.getPrefixToInterfaceIdentifier(VpnUtil.getVpnId(dataBroker,
-                                adj.getSubnetId().getValue()), prefix),
-                        VpnUtil.getPrefixToInterface(BigInteger.ZERO, currVpnIntf.getName(), prefix,
-                                adj.getSubnetId(), Prefixes.PrefixCue.PhysNetFunc), true);
+                    writeOperTxn.merge(
+                            LogicalDatastoreType.OPERATIONAL,
+                            VpnUtil.getPrefixToInterfaceIdentifier(vpnUtil.getVpnId(adj.getSubnetId().getValue()),
+                                    prefix), VpnUtil.getPrefixToInterface(BigInteger.ZERO, currVpnIntf.getName(),
+                                    prefix, adj.getSubnetId(), Prefixes.PrefixCue.PhysNetFunc), true);
 
-                fibManager.addOrUpdateFibEntry(adj.getSubnetId().getValue(), adj.getMacAddress(),
-                        adj.getIpAddress(), Collections.emptyList(), null /* EncapType */, 0 /* label */, 0 /*l3vni*/,
-                      null /* gw-mac */, parentVpnRd, RouteOrigin.LOCAL, writeConfigTxn);
+                    fibManager.addOrUpdateFibEntry(adj.getSubnetId().getValue(), adj.getMacAddress(),
+                            adj.getIpAddress(), Collections.emptyList(), null /* EncapType */, 0 /* label */,
+                            0 /*l3vni*/, null /* gw-mac */, parentVpnRd, RouteOrigin.LOCAL, writeConfigTxn);
 
-                input.setRd(adj.getVrfId());
-            }
-            if (operationalAdjacency == null) {
-                operationalAdjacency = populator.createOperationalAdjacency(input);
+                    input.setRd(adj.getVrfId());
+                }
+                if (operationalAdjacency == null) {
+                    operationalAdjacency = populator.createOperationalAdjacency(input);
+                }
+                adjacencies.add(operationalAdjacency);
+                AdjacenciesOp aug = VpnUtil.getVpnInterfaceOpDataEntryAugmentation(adjacencies);
+                VpnInterfaceOpDataEntry newVpnIntf =
+                        VpnUtil.getVpnInterfaceOpDataEntry(currVpnIntf.getName(), currVpnIntf.getVpnInstanceName(),
+                                aug, dpnId, currVpnIntf.getLportTag(),
+                                currVpnIntf.getGatewayMacAddress());
+
+                writeOperTxn.merge(LogicalDatastoreType.OPERATIONAL, identifier, newVpnIntf, true);
             }
-            adjacencies.add(operationalAdjacency);
-            AdjacenciesOp aug = VpnUtil.getVpnInterfaceOpDataEntryAugmentation(adjacencies);
-            VpnInterfaceOpDataEntry newVpnIntf =
-                VpnUtil.getVpnInterfaceOpDataEntry(currVpnIntf.getName(), currVpnIntf.getVpnInstanceName(),
-                    aug, dpnId, currVpnIntf.isScheduledForRemove(), currVpnIntf.getLportTag(),
-                        currVpnIntf.getGatewayMacAddress());
-
-            writeOperTxn.merge(LogicalDatastoreType.OPERATIONAL, identifier, newVpnIntf, true);
+        } catch (ReadFailedException e) {
+            LOG.error("addNewAdjToVpnInterface: Failed to read data store for interface {} dpn {} vpn {} rd {} ip "
+                    + "{}", interfaceName, dpnId, configVpnName, primaryRd, adj.getIpAddress());
         }
     }
 
     private String getParentVpnRdForExternalSubnet(Adjacency adj) {
-        Subnets subnets = VpnUtil.getExternalSubnet(dataBroker, adj.getSubnetId());
+        Subnets subnets = vpnUtil.getExternalSubnet(adj.getSubnetId());
         return subnets != null ? subnets.getExternalNetworkId().getValue() : null;
     }
 
     protected void delAdjFromVpnInterface(InstanceIdentifier<VpnInterfaceOpDataEntry> identifier, Adjacency adj,
             BigInteger dpnId, WriteTransaction writeOperTxn, WriteTransaction writeConfigTxn) {
-        Optional<VpnInterfaceOpDataEntry> optVpnInterface = VpnUtil.read(dataBroker,
-                                          LogicalDatastoreType.OPERATIONAL, identifier);
-
-        if (optVpnInterface.isPresent()) {
-            VpnInterfaceOpDataEntry currVpnIntf = optVpnInterface.get();
-
-            InstanceIdentifier<AdjacenciesOp> path = identifier.augmentation(AdjacenciesOp.class);
-            Optional<AdjacenciesOp> optAdjacencies = VpnUtil.read(dataBroker, LogicalDatastoreType.OPERATIONAL, path);
-            if (optAdjacencies.isPresent()) {
-                List<Adjacency> adjacencies = optAdjacencies.get().getAdjacency();
-
-                if (!adjacencies.isEmpty()) {
-                    LOG.trace("delAdjFromVpnInterface: Adjacencies are {}", adjacencies);
-                    Iterator<Adjacency> adjIt = adjacencies.iterator();
-                    while (adjIt.hasNext()) {
-                        Adjacency adjElem = adjIt.next();
-                        if (adjElem.getIpAddress().equals(adj.getIpAddress())) {
-                            String rd = adjElem.getVrfId();
-                            adjIt.remove();
-
-                            AdjacenciesOp aug = VpnUtil.getVpnInterfaceOpDataEntryAugmentation(adjacencies);
-                            VpnInterfaceOpDataEntry newVpnIntf = VpnUtil
-                                    .getVpnInterfaceOpDataEntry(currVpnIntf.getName(),
-                                    currVpnIntf.getVpnInstanceName(), aug, dpnId, currVpnIntf.isScheduledForRemove(),
-                                            currVpnIntf.getLportTag(), currVpnIntf.getGatewayMacAddress());
-
-                            writeOperTxn.merge(LogicalDatastoreType.OPERATIONAL, identifier, newVpnIntf, true);
-                            if (adj.getNextHopIpList() != null) {
-                                for (String nh : adj.getNextHopIpList()) {
-                                    deleteExtraRouteFromCurrentAndImportingVpns(
-                                        currVpnIntf.getVpnInstanceName(), adj.getIpAddress(), nh, rd,
-                                        currVpnIntf.getName(), writeConfigTxn);
+        String interfaceName = identifier.firstKeyOf(VpnInterfaceOpDataEntry.class).getName();
+        String vpnName = identifier.firstKeyOf(VpnInterfaceOpDataEntry.class).getVpnInstanceName();
+        try {
+            Optional<VpnInterfaceOpDataEntry> optVpnInterface = SingleTransactionDataBroker.syncReadOptional(
+                    dataBroker, LogicalDatastoreType.OPERATIONAL, identifier);
+            if (optVpnInterface.isPresent()) {
+                VpnInterfaceOpDataEntry currVpnIntf = optVpnInterface.get();
+                InstanceIdentifier<AdjacenciesOp> path = identifier.augmentation(AdjacenciesOp.class);
+                Optional<AdjacenciesOp> optAdjacencies = SingleTransactionDataBroker.syncReadOptional(dataBroker,
+                        LogicalDatastoreType.OPERATIONAL, path);
+                if (optAdjacencies.isPresent()) {
+                    List<Adjacency> adjacencies = optAdjacencies.get().getAdjacency();
+
+                    if (!adjacencies.isEmpty()) {
+                        LOG.trace("delAdjFromVpnInterface: Adjacencies are {}", adjacencies);
+                        Iterator<Adjacency> adjIt = adjacencies.iterator();
+                        while (adjIt.hasNext()) {
+                            Adjacency adjElem = adjIt.next();
+                            if (adjElem.getIpAddress().equals(adj.getIpAddress())) {
+                                String rd = adjElem.getVrfId();
+                                if (adj.getNextHopIpList() != null) {
+                                    for (String nh : adj.getNextHopIpList()) {
+                                        deleteExtraRouteFromCurrentAndImportingVpns(
+                                                currVpnIntf.getVpnInstanceName(), adj.getIpAddress(), nh, rd,
+                                                currVpnIntf.getName(), writeConfigTxn);
+                                    }
+                                } else if (adj.isPhysNetworkFunc()) {
+                                    LOG.info("delAdjFromVpnInterface: deleting PNF adjacency prefix {} subnet {}",
+                                            adj.getIpAddress(), adj.getSubnetId());
+                                    fibManager.removeFibEntry(adj.getSubnetId().getValue(), adj.getIpAddress(),
+                                            writeConfigTxn);
                                 }
-                            } else if (adj.isPhysNetworkFunc()) {
-                                LOG.info("delAdjFromVpnInterface: deleting PNF adjacency prefix {} subnet {}",
-                                        adj.getIpAddress(), adj.getSubnetId());
-                                fibManager.removeFibEntry(adj.getSubnetId().getValue(), adj.getIpAddress(),
-                                        writeConfigTxn);
+                                break;
                             }
-                            break;
-                        }
 
+                        }
                     }
+                    LOG.info("delAdjFromVpnInterface: Removed adj {} on dpn {} rd {}", adj.getIpAddress(),
+                            dpnId, adj.getVrfId());
+                } else {
+                    LOG.error("delAdjFromVpnInterface: Cannnot DEL adjacency, since operational interface is "
+                            + "unavailable dpnId {} adjIP {} rd {}", dpnId, adj.getIpAddress(), adj.getVrfId());
                 }
-                LOG.info("delAdjFromVpnInterface: Removed adj {} on dpn {} rd {}", adj.getIpAddress(),
-                        dpnId, adj.getVrfId());
-            } else {
-                LOG.error("delAdjFromVpnInterface: Cannnot DEL adjacency, since operational interface is "
-                        + "unavailable dpnId {} adjIP {} rd {}", dpnId, adj.getIpAddress(), adj.getVrfId());
             }
+        } catch (ReadFailedException e) {
+            LOG.error("delAdjFromVpnInterface: Failed to read data store for ip {} interface {} dpn {} vpn {}",
+                    adj.getIpAddress(), interfaceName, dpnId, vpnName);
         }
     }
 
     private void deleteExtraRouteFromCurrentAndImportingVpns(String vpnName, String destination, String nextHop,
         String rd, String intfName, WriteTransaction writeConfigTxn) {
         vpnManager.delExtraRoute(vpnName, destination, nextHop, rd, vpnName, intfName, writeConfigTxn);
-        List<VpnInstanceOpDataEntry> vpnsToImportRoute = VpnUtil.getVpnsImportingMyRoute(dataBroker, vpnName);
+        List<VpnInstanceOpDataEntry> vpnsToImportRoute = vpnUtil.getVpnsImportingMyRoute(vpnName);
         for (VpnInstanceOpDataEntry vpn : vpnsToImportRoute) {
             String vpnRd = vpn.getVrfId();
             if (vpnRd != null) {
@@ -1821,111 +1898,12 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
             .child(RouterDpnList.class, new RouterDpnListKey(routerName)).build();
     }
 
-    protected void addToNeutronRouterDpnsMap(String routerName, String vpnInterfaceName,
-        WriteTransaction writeOperTxn) {
-        BigInteger dpId = InterfaceUtils.getDpnForInterface(ifaceMgrRpcService, vpnInterfaceName);
-        if (dpId.equals(BigInteger.ZERO)) {
-            LOG.error("addToNeutronRouterDpnsMap: Could not retrieve dp id for interface {} to handle router {}"
-                    + " association model", vpnInterfaceName, routerName);
-
-            return;
-        }
-        InstanceIdentifier<DpnVpninterfacesList> routerDpnListIdentifier = getRouterDpnId(routerName, dpId);
-
-        Optional<DpnVpninterfacesList> optionalRouterDpnList = VpnUtil.read(dataBroker, LogicalDatastoreType
-            .OPERATIONAL, routerDpnListIdentifier);
-        RouterInterfaces routerInterface =
-            new RouterInterfacesBuilder().setKey(new RouterInterfacesKey(vpnInterfaceName)).setInterface(
-                vpnInterfaceName).build();
-        if (optionalRouterDpnList.isPresent()) {
-            writeOperTxn.merge(LogicalDatastoreType.OPERATIONAL, routerDpnListIdentifier.child(
-                RouterInterfaces.class, new RouterInterfacesKey(vpnInterfaceName)), routerInterface, true);
-        } else {
-            RouterDpnListBuilder builder = new RouterDpnListBuilder();
-            builder.setRouterId(routerName);
-            DpnVpninterfacesListBuilder dpnVpnList = new DpnVpninterfacesListBuilder().setDpnId(dpId);
-            builder.setDpnVpninterfacesList(Collections.singletonList(dpnVpnList.build()));
-            writeOperTxn.merge(LogicalDatastoreType.OPERATIONAL,
-                getRouterId(routerName),
-                builder.build(), true);
-        }
-    }
-
-    protected void removeFromNeutronRouterDpnsMap(String routerName, String vpnInterfaceName,
-        WriteTransaction writeOperTxn) {
-        BigInteger dpId = InterfaceUtils.getDpnForInterface(ifaceMgrRpcService, vpnInterfaceName);
-        if (dpId.equals(BigInteger.ZERO)) {
-            LOG.error("removeFromNeutronRouterDpnsMap: Could not retrieve dp id for interface {} to handle router {}"
-                    + " dissociation model", vpnInterfaceName, routerName);
-
-            return;
-        }
-        InstanceIdentifier<DpnVpninterfacesList> routerDpnListIdentifier = getRouterDpnId(routerName, dpId);
-        Optional<DpnVpninterfacesList> optionalRouterDpnList = VpnUtil.read(dataBroker, LogicalDatastoreType
-            .OPERATIONAL, routerDpnListIdentifier);
-        if (optionalRouterDpnList.isPresent()) {
-            List<RouterInterfaces> routerInterfaces = optionalRouterDpnList.get().getRouterInterfaces();
-            RouterInterfaces routerInterface =
-                new RouterInterfacesBuilder().setKey(new RouterInterfacesKey(vpnInterfaceName)).setInterface(
-                    vpnInterfaceName).build();
-
-            if (routerInterfaces != null && routerInterfaces.remove(routerInterface)) {
-                if (routerInterfaces.isEmpty()) {
-                    if (writeOperTxn != null) {
-                        writeOperTxn.delete(LogicalDatastoreType.OPERATIONAL, routerDpnListIdentifier);
-                    } else {
-                        MDSALUtil.syncDelete(dataBroker, LogicalDatastoreType.OPERATIONAL, routerDpnListIdentifier);
-                    }
-                } else {
-                    if (writeOperTxn != null) {
-                        writeOperTxn.delete(LogicalDatastoreType.OPERATIONAL, routerDpnListIdentifier.child(
-                            RouterInterfaces.class,
-                            new RouterInterfacesKey(vpnInterfaceName)));
-                    } else {
-                        MDSALUtil.syncDelete(dataBroker, LogicalDatastoreType.OPERATIONAL,
-                            routerDpnListIdentifier.child(
-                                RouterInterfaces.class,
-                                new RouterInterfacesKey(vpnInterfaceName)));
-                    }
-                }
-            }
-        }
-    }
-
-    protected void removeFromNeutronRouterDpnsMap(String routerName, String vpnInterfaceName, BigInteger dpId,
-        WriteTransaction writeOperTxn) {
-        if (dpId.equals(BigInteger.ZERO)) {
-            LOG.error("removeFromNeutronRouterDpnsMap: Could not retrieve dp id for interface {} to handle router {}"
-                    + " dissociation model", vpnInterfaceName, routerName);
-
-            return;
-        }
-        InstanceIdentifier<DpnVpninterfacesList> routerDpnListIdentifier = getRouterDpnId(routerName, dpId);
-        Optional<DpnVpninterfacesList> optionalRouterDpnList = VpnUtil.read(dataBroker, LogicalDatastoreType
-            .OPERATIONAL, routerDpnListIdentifier);
-        if (optionalRouterDpnList.isPresent()) {
-            List<RouterInterfaces> routerInterfaces = optionalRouterDpnList.get().getRouterInterfaces();
-            RouterInterfaces routerInterface =
-                new RouterInterfacesBuilder().setKey(new RouterInterfacesKey(vpnInterfaceName)).setInterface(
-                    vpnInterfaceName).build();
-            if (routerInterfaces != null && routerInterfaces.remove(routerInterface)) {
-                if (routerInterfaces.isEmpty()) {
-                    writeOperTxn.delete(LogicalDatastoreType.OPERATIONAL, routerDpnListIdentifier);
-                } else {
-                    writeOperTxn.delete(LogicalDatastoreType.OPERATIONAL, routerDpnListIdentifier.child(
-                        RouterInterfaces.class,
-                        new RouterInterfacesKey(vpnInterfaceName)));
-                }
-            }
-        }
-    }
-
     protected void createFibEntryForRouterInterface(String primaryRd, VpnInterface vpnInterface, String interfaceName,
                                                     WriteTransaction writeConfigTxn, String vpnName) {
         if (vpnInterface == null) {
             return;
         }
-        List<Adjacency> adjs = VpnUtil.getAdjacenciesForVpnInterfaceFromConfig(dataBroker, interfaceName);
+        List<Adjacency> adjs = vpnUtil.getAdjacenciesForVpnInterfaceFromConfig(interfaceName);
         if (adjs == null) {
             LOG.error("createFibEntryForRouterInterface: VPN Interface {} of router addition failed as adjacencies for"
                     + " this vpn interface could not be obtained. vpn {}", interfaceName, vpnName);
@@ -1937,8 +1915,8 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
                 String macAddress = adj.getMacAddress();
                 String prefix = VpnUtil.getIpPrefix(primaryInterfaceIp);
 
-                long label = VpnUtil.getUniqueId(idManager, VpnConstants.VPN_IDPOOL_NAME,
-                    VpnUtil.getNextHopLabelKey(primaryRd, prefix));
+                long label = vpnUtil.getUniqueId(VpnConstants.VPN_IDPOOL_NAME,
+                        VpnUtil.getNextHopLabelKey(primaryRd, prefix));
 
                 RouterInterface routerInt = new RouterInterfaceBuilder().setUuid(vpnName)
                         .setIpAddress(primaryInterfaceIp).setMacAddress(macAddress).build();
@@ -1957,8 +1935,8 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
 
     protected void deleteFibEntryForRouterInterface(VpnInterface vpnInterface,
                                                     WriteTransaction writeConfigTxn, String vpnName) {
-        Adjacencies adjs = vpnInterface.getAugmentation(Adjacencies.class);
-        String rd = VpnUtil.getVpnRd(dataBroker, vpnName);
+        Adjacencies adjs = vpnInterface.augmentation(Adjacencies.class);
+        String rd = vpnUtil.getVpnRd(vpnName);
         if (adjs != null) {
             List<Adjacency> adjsList = adjs.getAdjacency();
             for (Adjacency adj : adjsList) {
@@ -2007,11 +1985,11 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
     }
 
     public boolean isVpnInstanceReady(String vpnInstanceName) {
-        String vpnRd = VpnUtil.getVpnRd(dataBroker, vpnInstanceName);
+        String vpnRd = vpnUtil.getVpnRd(vpnInstanceName);
         if (vpnRd == null) {
             return false;
         }
-        VpnInstanceOpDataEntry vpnInstanceOpDataEntry = VpnUtil.getVpnInstanceOpData(dataBroker, vpnRd);
+        VpnInstanceOpDataEntry vpnInstanceOpDataEntry = vpnUtil.getVpnInstanceOpData(vpnRd);
 
         return vpnInstanceOpDataEntry != null;
     }
@@ -2113,8 +2091,8 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
     }
 
     public void updateVpnInterfacesForUnProcessAdjancencies(String vpnName) {
-        String primaryRd = VpnUtil.getVpnRd(dataBroker, vpnName);
-        VpnInstanceOpDataEntry vpnInstanceOpData = VpnUtil.getVpnInstanceOpData(dataBroker, primaryRd);
+        String primaryRd = vpnUtil.getVpnRd(vpnName);
+        VpnInstanceOpDataEntry vpnInstanceOpData = vpnUtil.getVpnInstanceOpData(primaryRd);
         if (vpnInstanceOpData == null) {
             return;
         }
@@ -2123,56 +2101,61 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
             return;
         }
         LOG.debug("Update the VpnInterfaces for Unprocessed Adjancencies for vpnName:{}", vpnName);
-        vpnToDpnLists.forEach(vpnToDpnList -> vpnToDpnList.getVpnInterfaces().forEach(vpnInterface -> {
-            InstanceIdentifier<VpnInterfaceOpDataEntry> existingVpnInterfaceId =
-                VpnUtil.getVpnInterfaceOpDataEntryIdentifier(vpnInterface.getInterfaceName(), vpnName);
-            Optional<VpnInterfaceOpDataEntry> vpnInterfaceOptional = VpnUtil.read(dataBroker,
-                    LogicalDatastoreType.OPERATIONAL, existingVpnInterfaceId);
-            if (!vpnInterfaceOptional.isPresent()) {
-                return;
-            }
-            List<Adjacency> configVpnAdjacencies = VpnUtil.getAdjacenciesForVpnInterfaceFromConfig(dataBroker,
-                    vpnInterface.getInterfaceName());
-            if (configVpnAdjacencies == null) {
-                LOG.debug("There is no adjacency available for vpnInterface:{}", vpnInterface);
+        vpnToDpnLists.forEach(vpnToDpnList -> {
+            if (vpnToDpnList.getVpnInterfaces() == null) {
                 return;
             }
-            List<Adjacency> operationVpnAdjacencies = vpnInterfaceOptional.get()
-                    .getAugmentation(AdjacenciesOp.class).getAdjacency();
-            // Due to insufficient rds,  some of the extra route wont get processed when it is added.
-            // The unprocessed adjacencies will be present in config vpn interface DS but will be missing
-            // in operational DS. These unprocessed adjacencies will be handled below.
-            // To obtain unprocessed adjacencies, filtering is done by which the missing adjacencies in operational
-            // DS are retrieved which is used to call addNewAdjToVpnInterface method.
-            configVpnAdjacencies.stream()
-                    .filter(adjacency -> operationVpnAdjacencies.stream()
-                            .noneMatch(operationalAdjacency ->
-                                    operationalAdjacency.getIpAddress().equals(adjacency.getIpAddress())))
-                    .forEach(adjacency -> {
-                        LOG.debug("Processing the vpnInterface{} for the Ajacency:{}", vpnInterface, adjacency);
-                        jobCoordinator.enqueueJob("VPNINTERFACE-" + vpnInterface.getInterfaceName(),
-                            () -> {
-                                WriteTransaction writeConfigTxn = dataBroker.newWriteOnlyTransaction();
-                                WriteTransaction writeOperTxn = dataBroker.newWriteOnlyTransaction();
-                                if (VpnUtil.isAdjacencyEligibleToVpn(dataBroker, adjacency, vpnName)) {
-                                    addNewAdjToVpnInterface(existingVpnInterfaceId, primaryRd, adjacency,
-                                            vpnInterfaceOptional.get().getDpnId(), writeConfigTxn, writeOperTxn);
-                                    ListenableFuture<Void> operFuture = writeOperTxn.submit();
-                                    try {
-                                        operFuture.get();
-                                    } catch (ExecutionException | InterruptedException e) {
-                                        LOG.error("Exception encountered while submitting operational"
-                                                + " future for vpnInterface {}", vpnInterface, e);
+            vpnToDpnList.getVpnInterfaces().forEach(vpnInterface -> {
+                try {
+                    InstanceIdentifier<VpnInterfaceOpDataEntry> existingVpnInterfaceId =
+                            VpnUtil.getVpnInterfaceOpDataEntryIdentifier(vpnInterface.getInterfaceName(), vpnName);
+                    Optional<VpnInterfaceOpDataEntry> vpnInterfaceOptional = SingleTransactionDataBroker
+                            .syncReadOptional(dataBroker, LogicalDatastoreType.OPERATIONAL, existingVpnInterfaceId);
+                    if (!vpnInterfaceOptional.isPresent()) {
+                        return;
+                    }
+                    List<Adjacency> configVpnAdjacencies = vpnUtil.getAdjacenciesForVpnInterfaceFromConfig(
+                            vpnInterface.getInterfaceName());
+                    if (configVpnAdjacencies == null) {
+                        LOG.debug("There is no adjacency available for vpnInterface:{}", vpnInterface);
+                        return;
+                    }
+                    List<Adjacency> operationVpnAdjacencies = vpnInterfaceOptional.get()
+                            .augmentation(AdjacenciesOp.class).getAdjacency();
+                    // Due to insufficient rds,  some of the extra route wont get processed when it is added.
+                    // The unprocessed adjacencies will be present in config vpn interface DS but will be missing
+                    // in operational DS. These unprocessed adjacencies will be handled below.
+                    // To obtain unprocessed adjacencies, filtering is done by which the missing adjacencies in
+                    // operational DS are retrieved which is used to call addNewAdjToVpnInterface method.
+                    configVpnAdjacencies.stream()
+                        .filter(adjacency -> operationVpnAdjacencies.stream()
+                                .noneMatch(operationalAdjacency ->
+                                        operationalAdjacency.getIpAddress().equals(adjacency.getIpAddress())))
+                        .forEach(adjacency -> {
+                            LOG.debug("Processing the vpnInterface{} for the Ajacency:{}", vpnInterface, adjacency);
+                            jobCoordinator.enqueueJob("VPNINTERFACE-" + vpnInterface.getInterfaceName(),
+                                () -> {
+                                    // TODO Deal with sequencing — the config tx must only submitted
+                                    // if the oper tx goes in
+                                    if (vpnUtil.isAdjacencyEligibleToVpn(adjacency, vpnName)) {
+                                        List<ListenableFuture<Void>> futures = new ArrayList<>();
+                                        futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(operTx ->
+                                            futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(
+                                                confTx -> addNewAdjToVpnInterface(existingVpnInterfaceId,
+                                                    primaryRd, adjacency, vpnInterfaceOptional.get()
+                                                        .getDpnId(), confTx, operTx)))));
+                                        return futures;
+                                    } else {
+                                        return Collections.emptyList();
                                     }
-                                    List<ListenableFuture<Void>> futures = new ArrayList<>();
-                                    futures.add(writeConfigTxn.submit());
-                                    return futures;
-                                }  else {
-                                    return Collections.emptyList();
-                                }
-                            });
-                    });
-        }));
+                                });
+                        });
+                } catch (ReadFailedException e) {
+                    LOG.error("updateVpnInterfacesForUnProcessAdjancencies: Failed to read data store for vpn {} rd {}",
+                            vpnName, primaryRd);
+                }
+            });
+        });
     }
 
     private class PostVpnInterfaceWorker implements FutureCallback<Void> {
@@ -2203,7 +2186,7 @@ public class VpnInterfaceManager extends AsyncDataTreeChangeListenerBase<VpnInte
                         interfaceName, txnDestination, throwable);
             } else {
                 LOG.error("VpnInterfaceManager: VrfEntries for {} removal failed", interfaceName, throwable);
-                VpnUtil.unsetScheduledToRemoveForVpnInterface(dataBroker, interfaceName);
+                vpnUtil.unsetScheduledToRemoveForVpnInterface(interfaceName);
             }
         }
     }