From: Tim Rozet Date: Tue, 27 Nov 2018 16:44:53 +0000 (-0500) Subject: Fixes overwrite when adding termination point X-Git-Tag: release/neon~21 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=fd64436dde3a68ad265d84681f6fd38ee55e8bf5;p=ovsdb.git Fixes overwrite when adding termination point A race condition was observed where OVSDB had already added the VTEP TP to br-int, and following this Netvirt ELAN Manager added the patch port (br-ex-patch) to br-int. Upon ELAN manager adding this using SouthboundUtils addTerminationPoint, the previous VTEP was deleted. This change modifies the addTerminationPoint to use a merge in MDSAL rather than a put. JIRA: OVSDB-472 Change-Id: I2afa7dc33ef915856774f431dd4c3d9bcd029155 Signed-off-by: Tim Rozet --- diff --git a/utils/southbound-utils/src/main/java/org/opendaylight/ovsdb/utils/southbound/utils/SouthboundUtils.java b/utils/southbound-utils/src/main/java/org/opendaylight/ovsdb/utils/southbound/utils/SouthboundUtils.java index 645725024..2def225e1 100644 --- a/utils/southbound-utils/src/main/java/org/opendaylight/ovsdb/utils/southbound/utils/SouthboundUtils.java +++ b/utils/southbound-utils/src/main/java/org/opendaylight/ovsdb/utils/southbound/utils/SouthboundUtils.java @@ -757,8 +757,7 @@ public class SouthboundUtils { InstanceIdentifier tpIid = createTerminationPointInstanceIdentifier(bridgeNode, portName); tpBuilder.withKey(InstanceIdentifier.keyOf(tpIid)); tpBuilder.addAugmentation(OvsdbTerminationPointAugmentation.class, tpAugmentationBuilder.build()); - /* TODO SB_MIGRATION should this be merge or mdsalUtils.put */ - return mdsalUtils.put(LogicalDatastoreType.CONFIGURATION, tpIid, tpBuilder.build()); + return mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, tpIid, tpBuilder.build()); } public Boolean addTerminationPoint(Node bridgeNode, String portName, String type) { @@ -788,8 +787,7 @@ public class SouthboundUtils { InstanceIdentifier tpIid = createTerminationPointInstanceIdentifier(bridgeNode, portName); tpBuilder.withKey(InstanceIdentifier.keyOf(tpIid)); tpBuilder.addAugmentation(OvsdbTerminationPointAugmentation.class, tpAugmentationBuilder.build()); - /* TODO SB_MIGRATION should this be merge or mdsalUtils.put */ - return mdsalUtils.put(LogicalDatastoreType.CONFIGURATION, tpIid, tpBuilder.build()); + return mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, tpIid, tpBuilder.build()); } public Boolean addTerminationPoint(Node bridgeNode, String bridgeName, String portName, String type) { @@ -804,7 +802,7 @@ public class SouthboundUtils { TerminationPointBuilder tpBuilder = new TerminationPointBuilder(); tpBuilder.withKey(InstanceIdentifier.keyOf(tpIid)); tpBuilder.addAugmentation(OvsdbTerminationPointAugmentation.class, tpAugmentationBuilder.build()); - return mdsalUtils.put(LogicalDatastoreType.CONFIGURATION, tpIid, tpBuilder.build()); + return mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, tpIid, tpBuilder.build()); } public Boolean addPatchTerminationPoint(Node node, String bridgeName, String portName, String peerPortName) {