bug 8257 handling back to back ucast mac updates 20/55120/4
authorK.V Suneelu Verma <k.v.suneelu.verma@ericsson.com>
Mon, 17 Apr 2017 12:57:22 +0000 (18:27 +0530)
committerAnil Vishnoi <vishnoianil@gmail.com>
Fri, 19 May 2017 08:06:25 +0000 (08:06 +0000)
Making the ucast mac remove command participate in
dependency resolution workflow.

Change-Id: Icc27763e3fdca46d12be89218d4f17758a7e8d93
Signed-off-by: K.V Suneelu Verma <k.v.suneelu.verma@ericsson.com>
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsRemoteRemoveCommand.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsRemoteUpdateCommand.java

index 7f068b4279445b26412e68254b283bb65537bfd7..2492e7cbb431936cd3b215ff3494c8d66bf9cb38 100644 (file)
@@ -48,9 +48,32 @@ public class UcastMacsRemoteRemoveCommand extends AbstractTransactCommand<Remote
         }
     }
 
-    private void removeUcastMacRemote(TransactionBuilder transaction,
-            InstanceIdentifier<Node> instanceIdentifier, List<RemoteUcastMacs> macList) {
+
+    private void removeUcastMacRemote(final TransactionBuilder transaction,
+                                      final InstanceIdentifier<Node> instanceIdentifier,
+                                      final List<RemoteUcastMacs> macList) {
         for (RemoteUcastMacs mac: macList) {
+            onConfigUpdate(transaction, instanceIdentifier, mac, null);
+        }
+    }
+
+    @Override
+    public void onConfigUpdate(final TransactionBuilder transaction,
+                               final InstanceIdentifier<Node> nodeIid,
+                               final RemoteUcastMacs remoteUcastMacs,
+                               final InstanceIdentifier macKey,
+                               final Object... extraData) {
+        InstanceIdentifier<RemoteUcastMacs> macIid = nodeIid.augmentation(HwvtepGlobalAugmentation.class).
+                child(RemoteUcastMacs.class, remoteUcastMacs.getKey());
+        processDependencies(null, transaction, nodeIid, macIid, remoteUcastMacs);
+    }
+
+    @Override
+    public void doDeviceTransaction(final TransactionBuilder transaction,
+                                    final InstanceIdentifier<Node> instanceIdentifier,
+                                    final RemoteUcastMacs mac,
+                                    final InstanceIdentifier macKey,
+                                    final Object... extraData) {
             LOG.debug("Removing remoteUcastMacs, mac address: {}", mac.getMacEntryKey().getValue());
             InstanceIdentifier<RemoteUcastMacs> macIid = instanceIdentifier.augmentation(HwvtepGlobalAugmentation.class).
                     child(RemoteUcastMacs.class, mac.getKey());
@@ -66,12 +89,12 @@ public class UcastMacsRemoteRemoveCommand extends AbstractTransactCommand<Remote
                 transaction.add(op.delete(ucastMacsRemote.getSchema()).
                         where(ucastMacsRemote.getUuidColumn().getSchema().opEqual(macEntryUUID)).build());
                 transaction.add(op.comment("UcastMacRemote: Deleting " + mac.getMacEntryKey().getValue()));
+                getOperationalState().getDeviceInfo().markKeyAsInTransit(RemoteUcastMacs.class, macKey);
             } else {
                 LOG.warn("Unable to delete remoteUcastMacs {} because it was not found in the operational store",
                         mac.getMacEntryKey().getValue());
             }
             updateCurrentTxDeleteData(RemoteUcastMacs.class, macIid, mac);
-        }
     }
 
     protected List<RemoteUcastMacs> getData(HwvtepGlobalAugmentation augmentation) {
index 28c1a936c3443419f84ed8950bfa7245efa5a1b5..20ad6745ff3f7a843f1d3611a520915630599569 100644 (file)
@@ -52,9 +52,9 @@ public class UcastMacsRemoteUpdateCommand extends AbstractTransactCommand<Remote
         }
     }
 
-    private void updateUcastMacsRemote(TransactionBuilder transaction,
-                                       InstanceIdentifier<Node> instanceIdentifier,
-                                       List<RemoteUcastMacs> remoteUcastMacs) {
+    private void updateUcastMacsRemote(final TransactionBuilder transaction,
+                                       final InstanceIdentifier<Node> instanceIdentifier,
+                                       final List<RemoteUcastMacs> remoteUcastMacs) {
         if (remoteUcastMacs == null) {
             return;
         }
@@ -64,22 +64,22 @@ public class UcastMacsRemoteUpdateCommand extends AbstractTransactCommand<Remote
     }
 
     @Override
-    public void onConfigUpdate(TransactionBuilder transaction,
-                                  InstanceIdentifier<Node> nodeIid,
-                                  RemoteUcastMacs remoteUcastMacs,
-                                  InstanceIdentifier macKey,
-                                  Object... extraData) {
+    public void onConfigUpdate(final TransactionBuilder transaction,
+                               final InstanceIdentifier<Node> nodeIid,
+                               final RemoteUcastMacs remoteUcastMacs,
+                               final InstanceIdentifier macKey,
+                               final Object... extraData) {
         InstanceIdentifier<RemoteUcastMacs> macIid = nodeIid.augmentation(HwvtepGlobalAugmentation.class).
                 child(RemoteUcastMacs.class, remoteUcastMacs.getKey());
         processDependencies(UCAST_MAC_DATA_VALIDATOR, transaction, nodeIid, macIid, remoteUcastMacs);
     }
 
     @Override
-    public void doDeviceTransaction(TransactionBuilder transaction,
-                                   InstanceIdentifier<Node> instanceIdentifier,
-                                   RemoteUcastMacs remoteUcastMac,
-                                   InstanceIdentifier macKey,
-                                   Object... extraData) {
+    public void doDeviceTransaction(final TransactionBuilder transaction,
+                                    final InstanceIdentifier<Node> instanceIdentifier,
+                                    final RemoteUcastMacs remoteUcastMac,
+                                    final InstanceIdentifier macKey,
+                                    final Object... extraData) {
             LOG.debug("Creating remoteUcastMacs, mac address: {}", remoteUcastMac.getMacEntryKey().getValue());
             HwvtepDeviceInfo.DeviceData deviceData =
                     getOperationalState().getDeviceInfo().getDeviceOperData(RemoteUcastMacs.class, macKey);
@@ -92,7 +92,7 @@ public class UcastMacsRemoteUpdateCommand extends AbstractTransactCommand<Remote
                 setMac(ucastMacsRemote, remoteUcastMac);
                 LOG.trace("doDeviceTransaction: creating RemotUcastMac entry: {}", ucastMacsRemote);
                 transaction.add(op.insert(ucastMacsRemote));
-                transaction.add(op.comment("UcastMacRemote: Creating " + remoteUcastMac.getMacEntryKey().getValue()));
+                getOperationalState().getDeviceInfo().markKeyAsInTransit(RemoteUcastMacs.class, macKey);
             } else if (deviceData.getUuid() != null) {
                 UUID macEntryUUID = deviceData.getUuid();
                 UcastMacsRemote extraMac = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
@@ -102,7 +102,6 @@ public class UcastMacsRemoteUpdateCommand extends AbstractTransactCommand<Remote
                 transaction.add(op.update(ucastMacsRemote)
                         .where(extraMac.getUuidColumn().getSchema().opEqual(macEntryUUID))
                         .build());
-                transaction.add(op.comment("UcastMacRemote: Updating " + remoteUcastMac.getMacEntryKey().getValue()));
             } else {
                 LOG.warn("Unable to update remoteMcastMacs {} because uuid not found in the operational store",
                                 remoteUcastMac.getMacEntryKey().getValue());