Bug 7939 - CSIT Sporadic failures - Flow(s) missing in VPNService suite on 13/59613/3
authoreupakir <kiran.n.upadhyaya@ericsson.com>
Wed, 28 Jun 2017 11:23:28 +0000 (16:53 +0530)
committerVivekanandan Narasimhan <n.vivekanandan@ericsson.com>
Wed, 28 Jun 2017 14:17:16 +0000 (19:47 +0530)
compute node

Fix ensures that table-19 is completely cleaned up on swap, before add the
vpn and router interfaces to the bgpvpn/routervpn instance

Change-Id: I9b106492234caa80ba9b2d961bb05a728cf5af27
Signed-off-by: eupakir <kiran.n.upadhyaya@ericsson.com>
Signed-off-by: Vivekanandan Narasimhan <n.vivekanandan@ericsson.com>
vpnservice/neutronvpn/neutronvpn-impl/src/main/java/org/opendaylight/netvirt/neutronvpn/NeutronvpnManager.java

index d59be9e0e7d20480acaacd9a4cb4450d73e2966a..dae53b2f6d45be84502a91bcf8d71b2cf17ddd31 100644 (file)
@@ -1239,17 +1239,18 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
             return;
         }
 
-        final DataStoreJobCoordinator portDataStoreCoordinator = DataStoreJobCoordinator.getInstance();
-        if (sn.getRouterInterfacePortId() != null) {
-            portDataStoreCoordinator.enqueueJob("PORT-" + sn.getRouterInterfacePortId().getValue(), () -> {
-                WriteTransaction wrtConfigTxn = dataBroker.newWriteOnlyTransaction();
-                List<ListenableFuture<Void>> futures = new ArrayList<>();
-                updateVpnInterface(newVpnId, oldVpnId,
-                        NeutronvpnUtils.getNeutronPort(dataBroker, sn.getRouterInterfacePortId()),
-                        isBeingAssociated, true, wrtConfigTxn);
-                futures.add(wrtConfigTxn.submit());
-                return futures;
-            });
+        //Update Router Interface first synchronously.
+        //CAUTION:  Please DONOT make the router interface VPN Movement as an asynchronous commit again !
+        try {
+            WriteTransaction wrtConfigTxn = dataBroker.newWriteOnlyTransaction();
+            updateVpnInterface(newVpnId, oldVpnId,
+                    NeutronvpnUtils.getNeutronPort(dataBroker, sn.getRouterInterfacePortId()),
+                    isBeingAssociated, true, wrtConfigTxn);
+            wrtConfigTxn.submit().checkedGet();
+        } catch (TransactionCommitFailedException e) {
+            LOG.error("Failed to update router interface {} in subnet {} from oldVpnId {} to newVpnId {}, returning",
+                    sn.getRouterInterfacePortId().getValue(), subnet.getValue(), oldVpnId, newVpnId);
+            return;
         }
 
         // Check for ports on this subnet and update association of
@@ -1259,6 +1260,7 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
             for (Uuid port : portList) {
                 LOG.debug("Updating vpn-interface for port {} isBeingAssociated {}",
                     port.getValue(), isBeingAssociated);
+                final DataStoreJobCoordinator portDataStoreCoordinator = DataStoreJobCoordinator.getInstance();
                 portDataStoreCoordinator.enqueueJob("PORT-" + port.getValue(), () -> {
                     WriteTransaction wrtConfigTxn = dataBroker.newWriteOnlyTransaction();
                     List<ListenableFuture<Void>> futures = new ArrayList<>();