Work toward fixing ONOS-1031: Remove or comment-out references to the old TopologyManager

Removed or commented-out references to the old TopologyManager:
ofcontroller.topology.TopologyManager

 * BgpRoute.java
   OnosDeviceManager.java
   Comment-out references to the old TopologyManager and add TODO markers

 * NetworkGraphPublisher.java
   Comment-out references to the old TopologyManager
   NOTE: This file will go away in the near future.

 * Forwarding.java
   Removed a reference to the old TopologyManager, because it is not
   needed/used.

 * KryoFactory.java
   Removed references to the TopologyElement class, because it will go away

 * ControllerTest.java
   Removed reference to the TopologyManager

Change-Id: Ib94fa91b4a7795c9dca4037cf36399f75ea1d2c1
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
index 64e2447..501dbf0 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
@@ -47,9 +47,6 @@
 import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
 import net.onrc.onos.ofcontroller.proxyarp.IArpRequester;
 import net.onrc.onos.ofcontroller.proxyarp.IProxyArpService;
-import net.onrc.onos.ofcontroller.topology.ITopologyNetService;
-import net.onrc.onos.ofcontroller.topology.Topology;
-import net.onrc.onos.ofcontroller.topology.TopologyManager;
 import net.onrc.onos.ofcontroller.util.CallerId;
 import net.onrc.onos.ofcontroller.util.DataPath;
 import net.onrc.onos.ofcontroller.util.Dpid;
@@ -96,7 +93,6 @@
 
 	private IFloodlightProviderService floodlightProvider;
 	private ITopologyService topologyService;
-	private ITopologyNetService topologyNetService;
 	private ILinkDiscoveryService linkDiscoveryService;
 	private IRestApiService restApi;
 	private IProxyArpService proxyArp;
@@ -158,7 +154,8 @@
 
 	private FlowCache flowCache;
 
-	private volatile Topology topology = null;
+	// TODO: Fix for the new Topology Network Graph
+	// private volatile Topology topology = null;
 
 	private class TopologyChangeDetector implements Runnable {
 		@Override
@@ -290,7 +287,6 @@
 		ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
 		topologyChangeDetectorTask = new SingletonTask(executor, new TopologyChangeDetector());
 
-		topologyNetService = new TopologyManager(context);
 		topoSwitchService = new TopoSwitchServiceImpl();
 
 		pathsWaitingOnArp = new HashMap<InetAddress, Path>();
@@ -1149,7 +1145,8 @@
 
 	private void beginRouting(){
 		log.debug("Topology is now ready, beginning routing function");
-		topology = topologyNetService.newDatabaseTopology();
+		// TODO: Fix for the new Topology Network Graph
+		// topology = topologyNetService.newDatabaseTopology();
 
 		// Wait Pavlin's API. We need the following functions.
 		/*setupArpFlows();
@@ -1201,6 +1198,8 @@
 					continue;
 				}
 
+				// TODO: Fix for the new Topology Network Graph
+				/*
 				DataPath shortestPath = topologyNetService.getDatabaseShortestPath(
 						srcInterface.getSwitchPort(), dstInterface.getSwitchPort());
 
@@ -1209,6 +1208,7 @@
 							srcInterface.getSwitchPort(), dstInterface.getSwitchPort());
 					return;
 				}
+				*/
 			}
 		}
 		topologyReady = true;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/devicemanager/OnosDeviceManager.java b/src/main/java/net/onrc/onos/ofcontroller/devicemanager/OnosDeviceManager.java
index 7b2b29b..1ccc892 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/devicemanager/OnosDeviceManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/devicemanager/OnosDeviceManager.java
@@ -31,8 +31,6 @@
 import net.onrc.onos.datagrid.IDatagridService;
 import net.onrc.onos.ofcontroller.core.IDeviceStorage;
 import net.onrc.onos.ofcontroller.core.internal.DeviceStorageImpl;
-import net.onrc.onos.ofcontroller.topology.TopologyElement;
-import net.onrc.onos.ofcontroller.topology.TopologyElement.Type;
 
 import org.openflow.protocol.OFMessage;
 import org.openflow.protocol.OFPacketIn;
@@ -149,6 +147,8 @@
         }
 
         //If the switch port we try to attach a new device already has a link, then stop adding device
+	// TODO: Fix/update this after we refactor the Device Discovery mechanism
+	/*
         Collection<TopologyElement> list = datagrid.getAllTopologyElements();
         for(TopologyElement elem: list) {
         	if(elem.getType() == Type.ELEMENT_LINK) {
@@ -162,6 +162,7 @@
         		}
         	}
         }
+	*/
 
         addOnosDevice(mac, srcDevice);
 
diff --git a/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/NetworkGraphPublisher.java b/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/NetworkGraphPublisher.java
index 5495ca0..c7f441a 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/NetworkGraphPublisher.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/NetworkGraphPublisher.java
@@ -40,7 +40,6 @@
 import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
 import net.onrc.onos.ofcontroller.linkdiscovery.LinkInfo;
 import net.onrc.onos.ofcontroller.proxyarp.ArpReplyNotification;
-import net.onrc.onos.ofcontroller.topology.TopologyElement;
 import net.onrc.onos.ofcontroller.util.PerformanceMonitor;
 import net.onrc.onos.registry.controller.IControllerRegistryService;
 import net.onrc.onos.registry.controller.IControllerRegistryService.ControlChangeCallback;
@@ -125,6 +124,7 @@
 					    // notification to remove the
 					    // switch, because it is inactive
 					    //
+					    /*
 					    TopologyElement topologyElement =
 						new TopologyElement(dpid);
 					    datagridService.notificationSendTopologyElementRemoved(topologyElement);
@@ -144,6 +144,7 @@
 									link.getDstPort());
 						datagridService.notificationSendTopologyElementRemoved(topologyElementLink);
 					    }
+					    */
 					}
 				} catch (Exception e) {
 	                log.error("Error in SwitchCleanup:controlChanged ", e);
@@ -191,12 +192,14 @@
 
     		if (linkStore.deleteLink(lt)) {
     			// TODO publish DELETE_LINK event here
+		    /*
     			TopologyElement topologyElement =
     					new TopologyElement(update.getSrc(),
     							update.getSrcPort(),
     							update.getDst(),
     							update.getDstPort());
     			datagridService.notificationSendTopologyElementRemoved(topologyElement);
+		    */
     		}
     		break;
     	case LINK_UPDATED:
@@ -210,12 +213,14 @@
     			// TODO NOTE: Here we assume that updated
     			// link is UP.
     			//
+		    /*
     			TopologyElement topologyElement =
     					new TopologyElement(update.getSrc(),
     							update.getSrcPort(),
     							update.getDst(),
     							update.getDstPort());
     			datagridService.notificationSendTopologyElementUpdated(topologyElement);
+		    */
     		}
     		break;
     	case LINK_ADDED:
@@ -223,12 +228,14 @@
 
     		if (linkStore.addLink(lt)) {
     			// TODO publish ADD_LINK event here
+		    /*
     			TopologyElement topologyElement =
     					new TopologyElement(update.getSrc(),
     							update.getSrcPort(),
     							update.getDst(),
     							update.getDstPort());
     			datagridService.notificationSendTopologyElementAdded(topologyElement);
+		    */
     		}
 
     		break;
@@ -243,6 +250,7 @@
 		if (registryService.hasControl(sw.getId())) {
 			if (swStore.addSwitch(sw)) {
 			    // TODO publish ADD_SWITCH event here
+			    /*
 			    TopologyElement topologyElement =
 				new TopologyElement(sw.getId());
 			    datagridService.notificationSendTopologyElementAdded(topologyElement);
@@ -274,6 +282,7 @@
 							link.getDstPort());
 				datagridService.notificationSendTopologyElementAdded(topologyElementLink);
 			    }
+			    */
 			}
 		}
 	}
@@ -330,6 +339,7 @@
 			linkDiscovery.RemoveFromSuppressLLDPs(switchId, port.getPortNumber());
 
 		    // TODO publish ADD_PORT event here
+			/*
 		    TopologyElement topologyElement =
 			new TopologyElement(switchId, port.getPortNumber());
 		    datagridService.notificationSendTopologyElementAdded(topologyElement);
@@ -349,6 +359,7 @@
 						link.getDstPort());
 			datagridService.notificationSendTopologyElementAdded(topologyElementLink);
 		    }
+		    */
 		}
 	}
 
@@ -366,6 +377,7 @@
 		    PerformanceMonitor.stop("SwitchPortRemoved.DbAccess");
 		    PerformanceMonitor.start("SwitchPortRemoved.NotificationSend");
 		    // TODO publish DELETE_PORT event here
+		    /*
 		    TopologyElement topologyElement =
 			new TopologyElement(switchId, port.getPortNumber());
 		    datagridService.notificationSendTopologyElementRemoved(topologyElement);
@@ -379,6 +391,7 @@
 						link.getDstPort());
 			datagridService.notificationSendTopologyElementRemoved(topologyElementLink);
 		    }
+		    */
 		    PerformanceMonitor.stop("SwitchPortRemoved.NotificationSend");
 		    PerformanceMonitor.report("SwitchPortRemoved.DbAccess");
 		    PerformanceMonitor.report("TopologyEntryRemoved.NotificationReceived");
diff --git a/src/main/java/net/onrc/onos/ofcontroller/forwarding/Forwarding.java b/src/main/java/net/onrc/onos/ofcontroller/forwarding/Forwarding.java
index a220c43..e846155 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/forwarding/Forwarding.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/forwarding/Forwarding.java
@@ -29,7 +29,6 @@
 import net.onrc.onos.ofcontroller.flowprogrammer.IFlowPusherService;
 import net.onrc.onos.ofcontroller.proxyarp.BroadcastPacketOutNotification;
 import net.onrc.onos.ofcontroller.proxyarp.IProxyArpService;
-import net.onrc.onos.ofcontroller.topology.TopologyManager;
 import net.onrc.onos.ofcontroller.util.CallerId;
 import net.onrc.onos.ofcontroller.util.DataPath;
 import net.onrc.onos.ofcontroller.util.Dpid;
@@ -76,7 +75,6 @@
 	private IControllerRegistryService controllerRegistryService;
 	
 	private IDeviceStorage deviceStorage;
-	private TopologyManager topologyService;
 	
 	// TODO it seems there is a Guava collection that will time out entries.
 	// We should see if this will work here.
@@ -184,8 +182,6 @@
 		
 		deviceStorage = new DeviceStorageImpl();
 		deviceStorage.init("","");
-		topologyService = new TopologyManager();
-		topologyService.init("","");
 	}
 	
 	@Override
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/KryoFactory.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/KryoFactory.java
index f020a8f..68e34fe 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/KryoFactory.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/KryoFactory.java
@@ -2,7 +2,6 @@
 
 import java.net.InetAddress;
 import java.util.ArrayList;
-import java.util.TreeMap;
 
 import net.floodlightcontroller.util.MACAddress;
 import net.onrc.onos.intent.ConstrainedShortestPathIntent;
@@ -19,7 +18,6 @@
 import net.onrc.onos.ofcontroller.networkgraph.PortEvent;
 import net.onrc.onos.ofcontroller.networkgraph.SwitchEvent;
 import net.onrc.onos.ofcontroller.networkgraph.TopologyEvent;
-import net.onrc.onos.ofcontroller.topology.TopologyElement;
 import net.onrc.onos.ofcontroller.util.CallerId;
 import net.onrc.onos.ofcontroller.util.DataPath;
 import net.onrc.onos.ofcontroller.util.DataPathEndpoints;
@@ -163,11 +161,6 @@
 	kryo.register(Switch.class);
 	// kryo.register(SwitchPort.class);
 
-	// Topology-related classes
-	kryo.register(TopologyElement.class);
-	kryo.register(TopologyElement.Type.class);
-	kryo.register(TreeMap.class);
-
 	// New data model-related classes
 	kryo.register(DeviceEvent.class);
 	kryo.register(InetAddress.class);
diff --git a/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java b/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
index 5ab79ed..9c7b820 100644
--- a/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
+++ b/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
@@ -62,8 +62,6 @@
 import net.onrc.onos.ofcontroller.core.IOFSwitchPortListener;
 import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
 import net.onrc.onos.ofcontroller.linkdiscovery.internal.LinkDiscoveryManager;
-import net.onrc.onos.ofcontroller.topology.ITopologyNetService;
-import net.onrc.onos.ofcontroller.topology.TopologyManager;
 import net.onrc.onos.registry.controller.IControllerRegistryService;
 import net.onrc.onos.registry.controller.StandaloneRegistry;
 
@@ -119,7 +117,6 @@
         
         // Following added by ONOS
         // TODO replace with mock if further testing is needed.
-        fmc.addService(ITopologyNetService.class, new TopologyManager() );
         StandaloneRegistry sr = new StandaloneRegistry();
         fmc.addService(IControllerRegistryService.class, sr );
         LinkDiscoveryManager linkDiscovery = new LinkDiscoveryManager();