From 1c48d4d9765a0fabc1abce8e90ab263580a40870 Mon Sep 17 00:00:00 2001 From: "K.V Suneelu Verma" Date: Mon, 17 Apr 2017 16:55:13 +0530 Subject: [PATCH] bug 8257 handling back to back mcast mac updates Making the remove mcast mac participate in depenency resolution flow. Put the delete event on hold while the previous add/update on the same key is still in transit. Delete mcast mac event resumes after we receive the response for the previous create. Mark the state of the mcast mac key in transit while we execute its delete/add/update. Change-Id: I0b15d82dad346bd2c35c0368b4d7f63dc3bfa09d Signed-off-by: K.V Suneelu Verma --- .../transact/AbstractTransactCommand.java | 23 +++++++----- .../transact/LogicalSwitchRemoveCommand.java | 5 +++ .../transact/McastMacsLocalRemoveCommand.java | 5 +++ .../McastMacsRemoteRemoveCommand.java | 36 +++++++++++++++---- .../McastMacsRemoteUpdateCommand.java | 1 + .../transact/UcastMacsLocalRemoveCommand.java | 5 +++ .../UcastMacsRemoteRemoveCommand.java | 4 +++ 7 files changed, 65 insertions(+), 14 deletions(-) diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/AbstractTransactCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/AbstractTransactCommand.java index 2688a2000..32c07889f 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/AbstractTransactCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/AbstractTransactCommand.java @@ -62,21 +62,25 @@ public abstract class AbstractTransactCommand 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 unMetDependencyGetter, - TransactionBuilder transaction, + void processDependencies(final UnMetDependencyGetter unMetDependencyGetter, + final TransactionBuilder transaction, final InstanceIdentifier 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) classType, key, new UUID("uuid"), data); } if (!HwvtepSouthboundUtil.isEmptyMap(confingDependencies)) { @@ -299,4 +302,8 @@ public abstract class AbstractTransactCommand instanceIdentifier, List macList) { - for (RemoteMcastMacs mac: macList) { + private void removeMcastMacRemote(final TransactionBuilder transaction, + final InstanceIdentifier nodeIid, final List macList) { + for (RemoteMcastMacs mac : macList) { + InstanceIdentifier macKey = nodeIid.augmentation(HwvtepGlobalAugmentation.class). + child(RemoteMcastMacs.class, mac.getKey()); + onConfigUpdate(transaction, nodeIid, mac, macKey); + } + } + + @Override + public void onConfigUpdate(final TransactionBuilder transaction, + final InstanceIdentifier nodeIid, + final RemoteMcastMacs remoteMcastMac, + final InstanceIdentifier macKey, + final Object... extraData) { + processDependencies(null, transaction, nodeIid, macKey, remoteMcastMac); + } + + @Override + public void doDeviceTransaction(final TransactionBuilder transaction, + final InstanceIdentifier instanceIdentifier, + final RemoteMcastMacs mac, + final InstanceIdentifier macIid, + final Object... extraData) { LOG.debug("Removing remoteMcastMacs, mac address: {}", mac.getMacEntryKey().getValue()); Optional operationalMacOptional = getOperationalState().getRemoteMcastMacs(instanceIdentifier, mac.getKey()); @@ -86,14 +107,12 @@ public class McastMacsRemoteRemoveCommand extends AbstractTransactCommand macIid = instanceIdentifier.augmentation(HwvtepGlobalAugmentation.class). - child(RemoteMcastMacs.class, mac.getKey()); updateCurrentTxDeleteData(RemoteMcastMacs.class, macIid, mac); - } } @Override @@ -105,4 +124,9 @@ public class McastMacsRemoteRemoveCommand extends AbstractTransactCommand