Fixes toward Bug #310 and Bug #318 (and might be Bug #328).
FlowManager refactoring to simplify and speedup the code and
eliminate Titan DB access bugs.
Removed the old/buggy implementation of FlowManager::reconcileFlows()
diff --git a/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java b/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java
index b150ced..b1578e9 100644
--- a/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java
+++ b/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java
@@ -1378,103 +1378,7 @@
public void reconcileFlows(Iterable<IFlowPath> flowObjSet) {
if (! flowObjSet.iterator().hasNext())
return;
-
- //
- // Remove the old Flow Entries, and add the new Flow Entries
- //
-
- Map<Long, IOFSwitch> mySwitches = floodlightProvider.getSwitches();
- LinkedList<FlowPath> flowPaths = new LinkedList<FlowPath>();
- for (IFlowPath flowObj : flowObjSet) {
- FlowPath flowPath = extractFlowPath(flowObj);
- if (flowPath == null)
- continue;
- flowPaths.add(flowPath);
-
- //
- // Remove the Flow Entries from the Network MAP
- //
- Iterable<IFlowEntry> flowEntries = flowObj.getFlowEntries();
- LinkedList<IFlowEntry> deleteFlowEntries = new LinkedList<IFlowEntry>();
- for (IFlowEntry flowEntryObj : flowEntries) {
- String dpidStr = flowEntryObj.getSwitchDpid();
- if (dpidStr == null)
- continue;
- Dpid dpid = new Dpid(dpidStr);
- /*
- IOFSwitch mySwitch = mySwitches.get(dpid.value());
- if (mySwitch == null)
- continue; // Ignore the entry: not my switch
- */
- deleteFlowEntries.add(flowEntryObj);
- }
- for (IFlowEntry flowEntryObj : deleteFlowEntries) {
- flowObj.removeFlowEntry(flowEntryObj);
- conn.utils().removeFlowEntry(conn, flowEntryObj);
- }
- }
-
- for (FlowPath flowPath : flowPaths) {
- //
- // Delete the flow entries from the switches
- //
- for (FlowEntry flowEntry : flowPath.dataPath().flowEntries()) {
- flowEntry.setFlowEntryUserState(FlowEntryUserState.FE_USER_DELETE);
- IOFSwitch mySwitch = mySwitches.get(flowEntry.dpid().value());
- if (mySwitch == null) {
- // Not my switch
- installRemoteFlowEntry(flowPath, flowEntry);
- } else {
- installFlowEntry(mySwitch, flowPath, flowEntry);
- }
- }
-
- //
- // Calculate the new shortest path and install it in the
- // Network MAP.
- //
- FlowPath addedFlowPath = addAndMaintainShortestPathFlow(flowPath);
- if (addedFlowPath == null) {
- log.error("Cannot add Shortest Path Flow from {} to {}: path not found?",
- flowPath.dataPath().srcPort().toString(),
- flowPath.dataPath().dstPort().toString());
- continue;
- }
-
- //
- // Add the flow entries to the switches
- //
- for (FlowEntry flowEntry : addedFlowPath.dataPath().flowEntries()) {
- flowEntry.setFlowEntryUserState(FlowEntryUserState.FE_USER_ADD);
- IOFSwitch mySwitch = mySwitches.get(flowEntry.dpid().value());
- if (mySwitch == null) {
- // Not my switch
- installRemoteFlowEntry(addedFlowPath, flowEntry);
- continue;
- }
-
- IFlowEntry flowEntryObj =
- conn.utils().searchFlowEntry(conn, flowEntry.flowEntryId());
- if (flowEntryObj == null) {
- //
- // TODO: Remove the "new Object[] wrapper in the statement
- // below after the SLF4J logger is upgraded to
- // Version 1.7.5
- //
- log.error("Cannot add Flow Entry to switch {} for Path Flow from {} to {} : Flow Entry not in the Network MAP",
- new Object[] {
- flowEntry.dpid(),
- flowPath.dataPath().srcPort(),
- flowPath.dataPath().dstPort()
- });
- continue;
- }
- // Update the Flow Entry Switch State in the Network MAP
- if (installFlowEntry(mySwitch, addedFlowPath, flowEntry)) {
- flowEntryObj.setSwitchState("FE_SWITCH_UPDATED");
- }
- }
- }
+ // TODO: Not implemented/used yet.
}
/**