* Added the skeleton for the Path Computation implementation.
* Refactor the interaction between the Datagrid Service and the Flow Manager:
Now the Path Computation service itself receives the notifications
from the Datagrid Service without using the Flow Manager as a middle-man.
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
index 6926705..31a6bf4 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
@@ -7,9 +7,7 @@
import java.util.LinkedList;
import java.util.Map;
import java.util.Random;
-import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Executors;
-import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@@ -50,6 +48,7 @@
protected volatile IDatagridService datagridService;
protected IRestApiService restApi;
protected FloodlightModuleContext context;
+ protected PathComputation pathComputation;
protected OFMessageDamper messageDamper;
@@ -73,14 +72,6 @@
private ScheduledExecutorService mapReaderScheduler;
private ScheduledExecutorService shortestPathReconcileScheduler;
- // The queue with Flow Path updates
- protected BlockingQueue<EventEntry<FlowPath>> flowPathEvents =
- new LinkedBlockingQueue<EventEntry<FlowPath>>();
-
- // The queue with Topology Element updates
- protected BlockingQueue<EventEntry<TopologyElement>> topologyEvents =
- new LinkedBlockingQueue<EventEntry<TopologyElement>>();
-
/**
* Periodic task for reading the Flow Entries and pushing changes
* into the switches.
@@ -393,7 +384,7 @@
*/
@Override
public void close() {
- datagridService.deregisterFlowService(this);
+ datagridService.deregisterPathComputationService(pathComputation);
dbHandler.close();
}
@@ -502,27 +493,15 @@
// Initialize the Flow Entry ID generator
nextFlowEntryIdPrefix = randomGenerator.nextInt();
- // Register with the Datagrid Service
- datagridService.registerFlowService(this);
+ //
+ // Create the Path Computation thread and register it with the
+ // Datagrid Service
+ //
+ pathComputation = new PathComputation(this, datagridService);
+ datagridService.registerPathComputationService(pathComputation);
- // Obtain the initial Topology state
- Collection<TopologyElement> topologyElements =
- datagridService.getAllTopologyElements();
- for (TopologyElement topologyElement : topologyElements) {
- EventEntry<TopologyElement> eventEntry =
- new EventEntry<TopologyElement>(EventEntry.Type.ENTRY_ADD, topologyElement);
- topologyEvents.add(eventEntry);
- }
-
- // Obtain the initial Flow state
- Collection<FlowPath> flowPaths = datagridService.getAllFlows();
- for (FlowPath flowPath : flowPaths) {
- EventEntry<FlowPath> eventEntry =
- new EventEntry<FlowPath>(EventEntry.Type.ENTRY_ADD, flowPath);
- flowPathEvents.add(eventEntry);
- }
-
- // Schedule the periodic tasks
+ // Schedule the threads and periodic tasks
+ pathComputation.start();
mapReaderScheduler.scheduleAtFixedRate(
mapReader, 3, 3, TimeUnit.SECONDS);
shortestPathReconcileScheduler.scheduleAtFixedRate(
@@ -830,64 +809,4 @@
//
return (installFlowEntry(mySwitch, flowPath, flowEntry));
}
-
- /**
- * Receive a notification that a Flow is added.
- *
- * @param flowPath the flow that is added.
- */
- @Override
- public void notificationRecvFlowAdded(FlowPath flowPath) {
- // TODO
- }
-
- /**
- * Receive a notification that a Flow is removed.
- *
- * @param flowPath the flow that is removed.
- */
- @Override
- public void notificationRecvFlowRemoved(FlowPath flowPath) {
- // TODO
- }
-
- /**
- * Receive a notification that a Flow is updated.
- *
- * @param flowPath the flow that is updated.
- */
- @Override
- public void notificationRecvFlowUpdated(FlowPath flowPath) {
- // TODO
- }
-
- /**
- * Receive a notification that a Topology Element is added.
- *
- * @param topologyElement the Topology Element that is added.
- */
- @Override
- public void notificationRecvTopologyElementAdded(TopologyElement topologyElement) {
- // TODO
- }
-
- /**
- * Receive a notification that a Topology Element is removed.
- *
- * @param topologyElement the Topology Element that is removed.
- */
- @Override
- public void notificationRecvTopologyElementRemoved(TopologyElement topologyElement) {
- // TODO
- }
-
- /**
- * Receive a notification that a Topology Element is updated.
- *
- * @param topologyElement the Topology Element that is updated.
- */
- @Override
- public void notificationRecvTopologyElementUpdated(TopologyElement topologyElement) {
- // TODO
- }
}