Client should be added to cache before we push the 56/19956/1
authorAnil Vishnoi <vishnoianil@gmail.com>
Fri, 8 May 2015 21:56:55 +0000 (03:26 +0530)
committerAnil Vishnoi <vishnoianil@gmail.com>
Fri, 8 May 2015 22:03:51 +0000 (03:33 +0530)
info(OvsdbNodeAugmentation) to operational data store.
With the existing implementation we were putting task
in invoker queue to dump the data to operational data
store and then registtering for the connection callback.
After that it's adding client to cache. So if invoker
writes the data to operational data store before
it adds client to cache, any code listening to
OvsdbNodeAugmentaiton, might not be able to do any
operation if that key is not there in connection
manager cache. It works if invoker loose the race
of putting data to operational data store, it fails if
it succeed.

Change-Id: Ic73c5b7bbe0f94b04bf932b67b872099f2c27b5c
Signed-off-by: Anil Vishnoi <vishnoianil@gmail.com>
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionInstance.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionManager.java

index 22abd55e798eed6ae769596a51e77b224d31869b..d011aca6f561b066861a8514aea8bcd667517318 100644 (file)
@@ -56,8 +56,8 @@ public class OvsdbConnectionInstance implements OvsdbClient {
         this.connectionInfo = key;
         this.client = client;
         this.txInvoker = txInvoker;
-        txInvoker.invoke(new OvsdbNodeCreateCommand(key, null,null));
         registerCallBack();
+        txInvoker.invoke(new OvsdbNodeCreateCommand(key, null,null));
     }
 
     public void transact(TransactCommand command) {
index cf108de0c860b0d4845481b7b1ba7286ca4bf8a4..dbb523627d42f2d20af7a557307ae1ece9061515 100644 (file)
@@ -19,6 +19,7 @@ import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.ovsdb.lib.OvsdbClient;
 import org.opendaylight.ovsdb.lib.OvsdbConnectionListener;
 import org.opendaylight.ovsdb.lib.impl.OvsdbConnectionService;
+import org.opendaylight.ovsdb.southbound.transactions.md.OvsdbNodeCreateCommand;
 import org.opendaylight.ovsdb.southbound.transactions.md.OvsdbNodeRemoveCommand;
 import org.opendaylight.ovsdb.southbound.transactions.md.TransactionInvoker;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAttributes;
@@ -54,6 +55,7 @@ public class OvsdbConnectionManager implements OvsdbConnectionListener, AutoClos
         ConnectionInfo key = SouthboundMapper.createConnectionInfo(externalClient);
         OvsdbConnectionInstance client = new OvsdbConnectionInstance(key,externalClient,txInvoker);
         putConnectionInstance(key, client);
+        txInvoker.invoke(new OvsdbNodeCreateCommand(key, null,null));
     }
 
     @Override