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

Removed or commented-out references to the FlowManager, in preparation for
its removal:

 * BgpRoute.java
   Commented-out references to the FlowManager to add/delete flows.
   Those should be replaced by calls to the new Path Intent framework.
   Currently, we don't have the setup to test BgpRoute and the new Path Intent
   framework is not ready yet, hence those references are commented-out.

 * FlowProgrammer.java
   - Disabled the FlowSynchronizer, because it needs to be refactored,
     and probably now is not working as expected.
   - Removed a call to the FlowManager.flowEntryOnSwitchExpired(sw, id)
     and replaced it with a comment that the Forwarding module needs to be
     informed that a flow is expired.
     Currently, the Forwarding module is not functional and needs to be
     refactored, hence we cannot test any code refactoring around this.

 * FlowSynchronizer.java
   Commented-out a call and relevant code around
   FlowDatabaseOperation.extractFlowEntry()
   The FlowSyncronizer itself needs refactoring, and it is not clear what
   the next version is going to look like.

 * Forwarding.java
   Commented-out a call to flowService.addFlow(flowPath)
   This should be replaced by a call to the new Path Intent framework.
   Currently, the Forwarding module is not working, and the new Path Intent
   framework is not ready yet, hence the call is commented-out.

 * ControllerTest.java
   Removed reference to IFlowService.class because that class will be removed

 * FlowSyncronizerTest.java
   Commented out test code that refers to the FlowDatabaseOperation class.
   That class will be removed, and the test needs to be rewritten after
   the all the cleanup is completed.

Change-Id: I034636ba9c882220f71761a61ea9e6e10bc93357
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 a3cb17b..64e2447 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
@@ -42,7 +42,6 @@
 import net.onrc.onos.ofcontroller.core.internal.DeviceStorageImpl;
 import net.onrc.onos.ofcontroller.core.internal.TopoLinkServiceImpl;
 import net.onrc.onos.ofcontroller.core.internal.TopoSwitchServiceImpl;
-import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
 import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery;
 import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery.LDUpdate;
 import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
@@ -101,7 +100,6 @@
 	private ILinkDiscoveryService linkDiscoveryService;
 	private IRestApiService restApi;
 	private IProxyArpService proxyArp;
-	protected volatile IFlowService flowManagerService;
 	private IDeviceStorage deviceStorage;
 	private ITopoSwitchService topoSwitchService;
 
@@ -283,7 +281,6 @@
 		topologyService = context.getServiceImpl(ITopologyService.class);
 		linkDiscoveryService = context.getServiceImpl(ILinkDiscoveryService.class);
 		restApi = context.getServiceImpl(IRestApiService.class);
-		flowManagerService = context.getServiceImpl(IFlowService.class);
 		proxyArp = context.getServiceImpl(IProxyArpService.class);
 
 		deviceStorage = new DeviceStorageImpl();
@@ -590,6 +587,8 @@
 			flowPath.setFlowEntryActions(flowEntryActions);
 
 			// Flow Path installation, only to first hop switches
+			// TODO: Add the flow by using the new Path Intent framework
+			/*
 			if (flowManagerService.addFlow(flowPath) == null) {
 				log.error("Failed to install flow path to the first hop for " +
 						"prefix: {}, nextHopMacAddress: {}", prefix.getAddress(),
@@ -602,6 +601,7 @@
 
 				pushedFlowIds.put(prefix, flowPath.flowId());
 			}
+			*/
 		}
 	}
 
@@ -646,6 +646,8 @@
 
 		Collection<FlowId> flowIds = pushedFlowIds.removeAll(prefix);
 		for (FlowId flowId : flowIds) {
+		    // TODO: Delete the flow by using the new Path Intent framework
+		    /*
 			if (log.isTraceEnabled()) {
 				//Trace the flow status by flowPath in the switch before deleting it
 				log.trace("Pushing a DELETE flow mod to flowPath : {}",
@@ -660,6 +662,7 @@
 			{
 				log.debug("Failed to delete FlowId: {}",flowId);
 			}
+		    */
 		}
 	}
 
@@ -785,6 +788,8 @@
 			// NOTE: No need to add ACTION_OUTPUT. It is implied when creating
 			// Shortest Path Flow, and is always the last action for the Flow Entries
 			log.debug("FlowPath of MAC based forwarding: {}", flowPath.toString());
+			// TODO: Add the flow by using the new Path Intent framework
+			/*
 			if (flowManagerService.addFlow(flowPath) == null) {
 				log.error("Failed to set up MAC based forwarding path to {}, {}",
 						path.getDstIpAddress().getHostAddress(),dstMacAddress);
@@ -793,6 +798,7 @@
 				log.debug("Successfully set up MAC based forwarding path to {}, {}",
 						path.getDstIpAddress().getHostAddress(),dstMacAddress);
 			}
+			*/
 		}
 	}
 
@@ -853,6 +859,8 @@
 
 			flowPath.setDataPath(dataPath);
 
+			// TODO: Add the flow by using the new Path Intent framework
+			/*
 			if (flowManagerService.addFlow(flowPath) == null) {
 				log.error("Failed to set up path BGP -> peer {}"+"; dst-TCP-port:179",
 						bgpPeer.getIpAddress().getHostAddress());
@@ -861,6 +869,7 @@
 				log.debug("Successfully set up path BGP -> peer {}"+"; dst-TCP-port:179",
 						bgpPeer.getIpAddress().getHostAddress());
 			}
+			*/
 
 			// Disable dst-TCP-port, and set src-TCP-port
 			flowEntryMatch.disableDstTcpUdpPort();
@@ -870,6 +879,8 @@
 			// Create a new FlowId
 			flowPath.setFlowId(new FlowId());
 
+			// TODO: Add the flow by using the new Path Intent framework
+			/*
 			if (flowManagerService.addFlow(flowPath) == null) {
 				log.error("Failed to set up path BGP -> Peer {}" + "; src-TCP-port:179",
 						bgpPeer.getIpAddress().getHostAddress());
@@ -878,6 +889,7 @@
 				log.debug("Successfully set up path BGP -> Peer {}" + "; src-TCP-port:179",
 						bgpPeer.getIpAddress().getHostAddress());
 			}
+			*/
 
 			/**
 			 * Create the DataPath: BGP <-BGP peer
@@ -905,6 +917,8 @@
 
 			log.debug("Reversed BGP FlowPath: {}", flowPath.toString());
 
+			// TODO: Add the flow by using the new Path Intent framework
+			/*
 			if (flowManagerService.addFlow(flowPath) == null) {
 
 				log.error("Failed to set up path BGP <- Peer {}" + "; src-TCP-port:179",
@@ -914,6 +928,7 @@
 				log.debug("Successfully set up path BGP <- Peer {}" + "; src-TCP-port:179",
 						bgpPeer.getIpAddress().getHostAddress());
 			}
+			*/
 
 			// Reversed BGP flow path for dst-TCP-port
 			flowPath.setFlowId(new FlowId());
@@ -925,6 +940,8 @@
 
 			log.debug("Reversed BGP FlowPath: {}", flowPath.toString());
 
+			// TODO: Add the flow by using the new Path Intent framework
+			/*
 			if (flowManagerService.addFlow(flowPath) == null) {
 				log.error("Failed to setting up path BGP <- Peer {}" + "; dst-TCP-port:179",
 						bgpPeer.getIpAddress().getHostAddress());
@@ -933,6 +950,7 @@
 				log.debug("Successfully setting up path BGP <- Peer {}" + "; dst-TCP-port:179",
 						bgpPeer.getIpAddress().getHostAddress());
 			}
+			*/
 
 			/**
 			 * ICMP paths between BGPd and its peers
@@ -950,6 +968,8 @@
 
 			log.debug("Reversed ICMP FlowPath: {}", flowPath.toString());
 
+			// TODO: Add the flow by using the new Path Intent framework
+			/*
 			if (flowManagerService.addFlow(flowPath) == null) {
 
 				log.error("Failed to set up ICMP path BGP <- Peer {}",
@@ -959,6 +979,7 @@
 				log.debug("Successfully set up ICMP path BGP <- Peer {}",
 						bgpPeer.getIpAddress().getHostAddress());
 			}
+			*/
 
 			//match ICMP protocol BGP -> Peer
 			flowPath.setFlowId(new FlowId());
@@ -971,7 +992,8 @@
 
 			log.debug("ICMP flowPath: {}", flowPath.toString());
 
-
+			// TODO: Add the flow by using the new Path Intent framework
+			/*
 			if (flowManagerService.addFlow(flowPath) == null) {
 
 				log.error("Failed to set up ICMP path BGP -> Peer {}",
@@ -981,6 +1003,7 @@
 				log.debug("Successfully set up ICMP path BGP -> Peer {}",
 						bgpPeer.getIpAddress().getHostAddress());
 			}
+			*/
 		}
 	}