Remove plugin dependencies
[ovsdb.git] / openstack / net-virt / src / main / java / org / opendaylight / ovsdb / openstack / netvirt / SouthboundHandler.java
index 5b6d3be8b444af4c304430fb1dd01c2f4ba5f838..ea46784489c5e57f60074afb7ec29d0d065615e7 100644 (file)
@@ -15,14 +15,13 @@ import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.openstack.netvirt.api.Action;
 import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager;
 import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService;
+import org.opendaylight.ovsdb.openstack.netvirt.api.MdsalConsumer;
+import org.opendaylight.ovsdb.openstack.netvirt.api.MdsalConsumerListener;
 import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProvider;
 import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProviderManager;
 import org.opendaylight.ovsdb.openstack.netvirt.api.NodeCacheListener;
 import org.opendaylight.ovsdb.openstack.netvirt.api.TenantNetworkManager;
 import org.opendaylight.ovsdb.openstack.netvirt.impl.NeutronL3Adapter;
-import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
-import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
-import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryListener;
 import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
 import org.opendaylight.ovsdb.schema.openvswitch.Interface;
 import org.opendaylight.ovsdb.schema.openvswitch.OpenVSwitch;
@@ -40,7 +39,7 @@ import java.util.Set;
 import java.util.concurrent.ConcurrentMap;
 
 public class SouthboundHandler extends AbstractHandler
-        implements NodeCacheListener, OvsdbInventoryListener {
+        implements NodeCacheListener, /*OvsdbInventoryListener,*/ MdsalConsumerListener {
     static final Logger logger = LoggerFactory.getLogger(SouthboundHandler.class);
     //private Thread eventThread;
 
@@ -49,25 +48,28 @@ public class SouthboundHandler extends AbstractHandler
     private volatile BridgeConfigurationManager bridgeConfigurationManager;
     private volatile TenantNetworkManager tenantNetworkManager;
     private volatile NetworkingProviderManager networkingProviderManager;
-    private volatile OvsdbConfigurationService ovsdbConfigurationService;
-    private volatile OvsdbConnectionService connectionService;
+    //private volatile OvsdbConfigurationService ovsdbConfigurationService;
+    //private volatile OvsdbConnectionService connectionService;
+    private volatile MdsalConsumer mdsalConsumer; // TODO SB_MIGRATION
     private volatile NeutronL3Adapter neutronL3Adapter;
 
     void init() {
+        logger.info(">>>>> init");
     }
 
     void start() {
-        this.triggerUpdates();
+        logger.info(">>>>> started");
+        this.triggerUpdates(); // TODO SB_MIGRATION
     }
 
     @Override
-    public void nodeAdded(Node node, InetAddress address, int port) {
+    public void ovsdbNodeAdded(Node node) {
         logger.info("nodeAdded: {}", node);
         this.enqueueEvent(new SouthboundEvent(node, Action.ADD));
     }
 
     @Override
-    public void nodeRemoved(Node node) {
+    public void ovsdbNodeRemoved(Node node) {
         this.enqueueEvent(new SouthboundEvent(node, Action.DELETE));
     }
 
@@ -89,6 +91,7 @@ public class SouthboundHandler extends AbstractHandler
      */
 
     private boolean isUpdateOfInterest(Node node, Row oldRow, Row newRow) {
+        /* TODO SB_MIGRATION
         if (oldRow == null) return true;
         if (newRow.getTableSchema().getName().equals(ovsdbConfigurationService.getTableName(node, Interface.class))) {
             // We are NOT interested in Stats only updates
@@ -110,10 +113,10 @@ public class SouthboundHandler extends AbstractHandler
         } else if (newRow.getTableSchema().getName().equals(ovsdbConfigurationService.getTableName(node, OpenVSwitch.class))) {
             OpenVSwitch oldOpenvSwitch = ovsdbConfigurationService.getTypedRow(node, OpenVSwitch.class, oldRow);
             if (oldOpenvSwitch.getOtherConfigColumn()== null) {
-                /* we are only interested in other_config field change */
+                *//* we are only interested in other_config field change *//*
                 return false;
             }
-        }
+        }*/
         return true;
     }
 
@@ -130,6 +133,7 @@ public class SouthboundHandler extends AbstractHandler
 
     private void processRowUpdate(Node node, String tableName, String uuid, Row row,
                                   Object context, Action action) {
+        /* TODO SB_MIGRATION
         if (action == Action.DELETE) {
             if (tableName.equalsIgnoreCase(ovsdbConfigurationService.getTableName(node, Interface.class))) {
                 logger.debug("Processing update of {}. Deleted node: {}, uuid: {}, row: {}", tableName, node, uuid, row);
@@ -146,7 +150,7 @@ public class SouthboundHandler extends AbstractHandler
                 if (deletedIntf.getTypeColumn().getData().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VXLAN) ||
                     deletedIntf.getTypeColumn().getData().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_GRE) ||
                     phyIfName.contains(deletedIntf.getName())) {
-                    /* delete tunnel interfaces or physical interfaces */
+                    *//* delete tunnel interfaces or physical interfaces *//*
                     this.handleInterfaceDelete(node, uuid, deletedIntf, false, null);
                 } else if (network != null && !network.getRouterExternal()) {
                     logger.debug("Processing update of {}:{} node {} intf {} network {}",
@@ -242,7 +246,7 @@ public class SouthboundHandler extends AbstractHandler
                     networkingProvider.notifyFlowCapableNodeEvent(StringConvertor.dpidStringToLong(dpid), action);
                 }
             }
-        }
+        }*/
     }
 
     private void handleInterfaceUpdate (Node node, String uuid, Interface intf) {
@@ -284,6 +288,7 @@ public class SouthboundHandler extends AbstractHandler
     }
 
     private String getPortIdForInterface (Node node, String uuid, Interface intf) {
+        /* TODO SB_MIGRATION
         try {
             Map<String, Row> ports = this.ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Port.class));
             if (ports == null) return null;
@@ -300,11 +305,12 @@ public class SouthboundHandler extends AbstractHandler
             }
         } catch (Exception e) {
             logger.debug("Failed to get Port tag for for Intf " + intf, e);
-        }
+        }*/
         return null;
     }
 
     private void triggerUpdates() {
+        /* TODO SB_MIGRATION
         List<Node> nodes = connectionService.getNodes();
         if (nodes == null) return;
         for (Node node : nodes) {
@@ -322,7 +328,7 @@ public class SouthboundHandler extends AbstractHandler
             } catch (Exception e) {
                 logger.error("Exception during OVSDB Southbound update trigger", e);
             }
-        }
+        }*/
     }
 
     /**