Explictly cleanup all the bridges managed by the node
[ovsdb.git] / southbound / southbound-impl / src / main / java / org / opendaylight / ovsdb / southbound / OvsdbMonitorCallback.java
index ea50e9e73f587c7307bbcb0ce70f5da7115c020b..28a35f7cdcf4240500437fd07fa25251b3d96eba 100644 (file)
@@ -8,37 +8,34 @@
 package org.opendaylight.ovsdb.southbound;
 
 import org.opendaylight.ovsdb.lib.MonitorCallBack;
-import org.opendaylight.ovsdb.lib.message.TableUpdate;
 import org.opendaylight.ovsdb.lib.message.TableUpdates;
-import org.opendaylight.ovsdb.lib.notation.Row;
-import org.opendaylight.ovsdb.lib.notation.UUID;
-import org.opendaylight.ovsdb.lib.schema.ColumnSchema;
 import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
-import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.southbound.transactions.md.OvsdbOperationalCommandAggregator;
+import org.opendaylight.ovsdb.southbound.transactions.md.TransactionInvoker;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class OvsdbMonitorCallback implements MonitorCallBack {
 
     private static final Logger LOG = LoggerFactory.getLogger(OvsdbMonitorCallback.class);
+    private TransactionInvoker txInvoker;
+    private OvsdbConnectionInstance key;
+
+    OvsdbMonitorCallback(OvsdbConnectionInstance key,TransactionInvoker txInvoker) {
+        this.txInvoker = txInvoker;
+        this.key = key;
+    }
+
     @Override
     public void update(TableUpdates result, DatabaseSchema dbSchema) {
         LOG.debug("result: {} dbSchema: {}",result,dbSchema);
-        GenericTableSchema bridge = dbSchema.table("Bridge", GenericTableSchema.class);
-        ColumnSchema<GenericTableSchema, String> name = bridge.column("name", String.class);
-        TableUpdate<GenericTableSchema> update = result.getUpdate(bridge);
-        if (update != null) {
-            for (UUID uuid : update.getRows().keySet()) {
-                Row<GenericTableSchema> schemaRow = update.getNew(uuid);
-                String bridgeName = schemaRow.getColumn(name).getData();
-                LOG.trace("Bridge name: {}", bridgeName);
-            }
-        }
+        txInvoker.invoke(new OvsdbOperationalCommandAggregator(key, result, dbSchema));
+        LOG.trace("update exit");
     }
 
     @Override
-    public void exception(Throwable t) {
-        LOG.warn("exception {}",t);
+    public void exception(Throwable exception) {
+        LOG.warn("exception {}", exception);
     }
 
 }