bug 8257 handling back to back mcast mac updates
[ovsdb.git] / hwvtepsouthbound / hwvtepsouthbound-impl / src / main / java / org / opendaylight / ovsdb / hwvtepsouthbound / transact / AbstractTransactCommand.java
index 2688a20003946007766fa51ac13d13cf7684318d..32c07889ffeb4d18493e1501ba85c10399745b1d 100644 (file)
@@ -62,21 +62,25 @@ public abstract class AbstractTransactCommand<T extends Identifiable, Aug extend
 
     void updateCurrentTxData(Class<? extends Identifiable> cls, InstanceIdentifier key, UUID uuid, Object data) {
         operationalState.updateCurrentTxData(cls, key, uuid);
-        operationalState.getDeviceInfo().markKeyAsInTransit(cls, key);
         operationalState.getDeviceInfo().updateConfigData(cls, key, data);
     }
 
-    void processDependencies(UnMetDependencyGetter<T> unMetDependencyGetter,
-                             TransactionBuilder transaction,
+    void processDependencies(final UnMetDependencyGetter<T> unMetDependencyGetter,
+                             final TransactionBuilder transaction,
                              final InstanceIdentifier<Node> nodeIid,
                              final InstanceIdentifier key,
                              final T data, final Object... extraData) {
 
         HwvtepDeviceInfo deviceInfo = operationalState.getDeviceInfo();
-        Map inTransitDependencies = unMetDependencyGetter.getInTransitDependencies(operationalState, data);
-        Map confingDependencies = unMetDependencyGetter.getUnMetConfigDependencies(operationalState, data);
-        //we can skip the config termination point dependency as we can create them in device as part of this tx
-        confingDependencies.remove(TerminationPoint.class);
+        Map inTransitDependencies = Collections.EMPTY_MAP;
+        Map confingDependencies = Collections.EMPTY_MAP;
+
+        if (!isRemoveCommand() && unMetDependencyGetter != null) {
+            inTransitDependencies = unMetDependencyGetter.getInTransitDependencies(operationalState, data);
+            confingDependencies = unMetDependencyGetter.getUnMetConfigDependencies(operationalState, data);
+            //we can skip the config termination point dependency as we can create them in device as part of this tx
+            confingDependencies.remove(TerminationPoint.class);
+        }
 
         Type type = getClass().getGenericSuperclass();
         Type classType = ((ParameterizedType)type).getActualTypeArguments()[0];
@@ -88,7 +92,6 @@ public abstract class AbstractTransactCommand<T extends Identifiable, Aug extend
 
         if (HwvtepSouthboundUtil.isEmptyMap(confingDependencies) && HwvtepSouthboundUtil.isEmptyMap(inTransitDependencies)) {
             doDeviceTransaction(transaction, nodeIid, data, key, extraData);
-            //TODO put proper uuid
             updateCurrentTxData((Class<? extends Identifiable>) classType, key, new UUID("uuid"), data);
         }
         if (!HwvtepSouthboundUtil.isEmptyMap(confingDependencies)) {
@@ -299,4 +302,8 @@ public abstract class AbstractTransactCommand<T extends Identifiable, Aug extend
     protected boolean cascadeDelete() {
         return false;
     }
+
+    protected boolean isRemoveCommand() {
+        return false;
+    }
 }