Fix a bug related to assigning the next available Flow Entry ID
on startup. Previously that value was always set to 1.
Now the FlowManager reads the network map, and assigns
the next available Flow Entry ID to be larger than the largest Flow Entry ID.

NOTE: This is not a complete solution, because it doesn't work
when the flows entries are installed by multiple controllers.
diff --git a/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java b/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java
index 2321d55..a00d5d9 100644
--- a/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java
+++ b/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java
@@ -447,6 +447,19 @@
     @Override
     public void startUp(FloodlightModuleContext context) {
 	restApi.addRestletRoutable(new FlowWebRoutable());
+
+	//
+	// Extract all flow entries and assign the next Flow Entry ID
+	// to be larger than the largest Flow Entry ID
+	//
+	Iterable<IFlowEntry> allFlowEntries = conn.utils().getAllFlowEntries(conn);
+	for (IFlowEntry flowEntryObj : allFlowEntries) {
+	    FlowEntryId flowEntryId =
+		new FlowEntryId(flowEntryObj.getFlowEntryId());
+	    if (flowEntryId.value() >= nextFlowEntryId)
+		nextFlowEntryId = flowEntryId.value() + 1;
+	}
+	conn.endTx(Transaction.COMMIT);
     }
 
     /**