Bug 5542 - Southbound plugin doesn't allow controller initiated re-connection 79/36279/2
authorAnil Vishnoi <vishnoianil@gmail.com>
Wed, 16 Mar 2016 08:19:02 +0000 (01:19 -0700)
committerAnil Vishnoi <vishnoianil@gmail.com>
Wed, 16 Mar 2016 09:01:43 +0000 (09:01 +0000)
Change-Id: I90992a3132a5b85ff5bb115f562c9bc5989f277a
Signed-off-by: Anil Vishnoi <vishnoianil@gmail.com>
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionManager.java
southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionManagerTest.java

index acb665a98c23a6fa0e7c6fbba9ccd674ede58d9c..6f7f8595745acec5b96236bec85e50c0c21f7d03 100644 (file)
@@ -158,6 +158,10 @@ public class OvsdbConnectionManager implements OvsdbConnectionListener, AutoClos
             txInvoker.invoke(new OvsdbNodeRemoveCommand(ovsdbConnectionInstance, null, null));
 
             removeConnectionInstance(key);
+
+            //Controller initiated connection can be terminated from switch side.
+            //So cleanup the instance identifier cache.
+            removeInstanceIdentifier(key);
         } else {
             LOG.warn("disconnected : Connection instance not found for OVSDB Node {} ", key);
         }
index 8d3f625121bf715a626302ffef54e1aeed5a6332..e42998c3cfc724f93027a170bb8b146f940384c2 100644 (file)
@@ -156,6 +156,10 @@ public class OvsdbConnectionManagerTest {
 
       //TODO: Write unit tests for EntityOwnershipService
         MemberModifier.suppress(MemberMatcher.method(OvsdbConnectionManager.class, "unregisterEntityForOwnership", OvsdbConnectionInstance.class));
+        instanceIdentifiers = new ConcurrentHashMap<>();
+        MemberModifier.field(OvsdbConnectionManager.class, "instanceIdentifiers").set(ovsdbConnectionManager, instanceIdentifiers);
+
+
         ovsdbConnectionManager.disconnected(externalClient);
         Map<ConnectionInfo,OvsdbConnectionInstance> testClients = Whitebox.getInternalState(ovsdbConnectionManager, "clients");
         assertEquals("Error, size of the hashmap is incorrect", 0, testClients.size());