Bug 5542 - Southbound plugin doesn't allow controller initiated 83/36383/2
authorVishal Thapar <vishal.thapar@ericsson.com>
Thu, 17 Mar 2016 05:12:21 +0000 (10:42 +0530)
committerVishal Thapar <vishal.thapar@ericsson.com>
Thu, 17 Mar 2016 18:23:51 +0000 (18:23 +0000)
re-connection

HWVTEP fix based off similar fix in Southbound plugin
SB fix: https://git.opendaylight.org/gerrit/#/c/36278/

Change-Id: Iffab3b9d883bd0f4fd973d398b4e3b8c9dafd52d
Signed-off-by: Vishal Thapar <vishal.thapar@ericsson.com>
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepConnectionManager.java

index 76832944cc17e7034909c639f24c93cb371faf4f..79fb3a7aa021388ab601b9aa119c4a78bb1b3dd3 100644 (file)
@@ -120,12 +120,20 @@ public class HwvtepConnectionManager implements OvsdbConnectionListener, AutoClo
         ConnectionInfo key = HwvtepSouthboundMapper.createConnectionInfo(client);
         HwvtepConnectionInstance hwvtepConnectionInstance = getConnectionInstance(key);
         if (hwvtepConnectionInstance != null) {
+            // Unregister Entity ownership as soon as possible ,so this instance should
+            // not be used as a candidate in Entity election (given that this instance is
+            // about to disconnect as well), if current owner get disconnected from
+            // HWVTEP device.
+            unregisterEntityForOwnership(hwvtepConnectionInstance);
+
             //TODO: remove all the hwvtep nodes
             txInvoker.invoke(new HwvtepGlobalRemoveCommand(hwvtepConnectionInstance, null, null));
+
             removeConnectionInstance(key);
 
-            // Unregister Cluster Ownership for ConnectionInfo
-            unregisterEntityForOwnership(hwvtepConnectionInstance);
+            //Controller initiated connection can be terminated from switch side.
+            //So cleanup the instance identifier cache.
+            removeInstanceIdentifier(key);
         } else {
             LOG.warn("HWVTEP disconnected event did not find connection instance for {}", key);
         }