Merge pull request #447 from y-higuchi/pluggable_path_computation
Preparation for Pluggable path computation
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowEventHandler.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowEventHandler.java
index 29deb94..0a6cd76 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowEventHandler.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowEventHandler.java
@@ -7,12 +7,10 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import net.onrc.onos.datagrid.IDatagridService;
-import net.onrc.onos.ofcontroller.topology.ShortestPath;
import net.onrc.onos.ofcontroller.topology.Topology;
import net.onrc.onos.ofcontroller.topology.TopologyElement;
import net.onrc.onos.ofcontroller.topology.TopologyManager;
@@ -33,7 +31,11 @@
import org.slf4j.LoggerFactory;
/**
- * Class for implementing the Path Computation and Path Maintenance.
+ * Class for FlowPath Maintenance.
+ * This class listens for FlowEvents to:
+ * - Maintain a local cache of the Network Topology.
+ * - Detect FlowPaths impacted by Topology change.
+ * - Recompute impacted FlowPath using cached Topology.
*/
class FlowEventHandler extends Thread implements IFlowEventHandlerService {
/** The logger. */
@@ -224,7 +226,7 @@
flowEntry.setFlowEntrySwitchState(FlowEntrySwitchState.FE_SWITCH_NOT_UPDATED);
}
- allFlowPaths.remove(existingFlowPath.flowId());
+ allFlowPaths.remove(existingFlowPath.flowId().value());
modifiedFlowPaths.add(existingFlowPath);
break;
@@ -240,10 +242,10 @@
TopologyElement topologyElement = eventEntry.eventData();
switch (eventEntry.eventType()) {
case ENTRY_ADD:
- isTopologyModified = topology.addTopologyElement(topologyElement);
+ isTopologyModified |= topology.addTopologyElement(topologyElement);
break;
case ENTRY_REMOVE:
- isTopologyModified = topology.removeTopologyElement(topologyElement);
+ isTopologyModified |= topology.removeTopologyElement(topologyElement);
break;
}
}
@@ -386,6 +388,8 @@
// Test whether the Flow Path needs to be recomputed
//
switch (flowPath.flowPathType()) {
+ case FP_TYPE_UNKNOWN:
+ return false; // Can't recompute on Unknown FlowType
case FP_TYPE_SHORTEST_PATH:
break;
case FP_TYPE_EXPLICIT_PATH:
diff --git a/src/main/java/net/onrc/onos/ofcontroller/topology/ShortestPath.java b/src/main/java/net/onrc/onos/ofcontroller/topology/ShortestPath.java
index dabe916..f187c27 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/topology/ShortestPath.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/topology/ShortestPath.java
@@ -24,7 +24,8 @@
import com.tinkerpop.blueprints.Vertex;
/**
- * A class for implementing the Shortest Path in a topology.
+ * Class to calculate a shortest DataPath between 2 SwitchPorts
+ * based on hops in Network Topology.
*/
public class ShortestPath {
/**
diff --git a/src/main/java/net/onrc/onos/ofcontroller/topology/TopologyManager.java b/src/main/java/net/onrc/onos/ofcontroller/topology/TopologyManager.java
index ffe806a..c0e04f2 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/topology/TopologyManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/topology/TopologyManager.java
@@ -24,7 +24,10 @@
import org.slf4j.LoggerFactory;
/**
- * A class for implementing Topology Network Service.
+ * A class for obtaining Topology Snapshot
+ * and PathComputation.
+ *
+ * TODO: PathComputation part should be refactored out to separate class.
*/
public class TopologyManager implements IFloodlightModule,
ITopologyNetService {