Use FlowManager's flow ID service rather thanhave Forwarding generate its own IDs
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 e239ae9..c8e10c6 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
@@ -473,6 +473,7 @@
*
* @return the next Flow Entry ID to use.
*/
+ @Override
public synchronized long getNextFlowEntryId() {
//
// Generate the next Flow Entry ID.
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/IFlowService.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/IFlowService.java
index 8d362d1..f39acb5 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/IFlowService.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/IFlowService.java
@@ -120,4 +120,12 @@
* @return the network topology.
*/
Topology getTopology();
+
+ /**
+ * Get a globally unique flow ID from the flow service.
+ * NOTE: Not currently guaranteed to be globally unique.
+ *
+ * @return unique flow ID
+ */
+ public long getNextFlowEntryId();
}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/forwarding/Forwarding.java b/src/main/java/net/onrc/onos/ofcontroller/forwarding/Forwarding.java
index b9124e8..686bee0 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/forwarding/Forwarding.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/forwarding/Forwarding.java
@@ -1,6 +1,5 @@
package net.onrc.onos.ofcontroller.forwarding;
-import java.util.Collection;
import java.util.Iterator;
import net.floodlightcontroller.core.FloodlightContext;
@@ -45,9 +44,6 @@
private IDeviceStorage deviceStorage;
private TopologyManager topologyService;
- // TODO Flow IDs should be globally managed
- private long currentId = 1;
-
public Forwarding() {
}
@@ -155,7 +151,7 @@
dataPath.setSrcPort(srcSwitchPort);
dataPath.setDstPort(dstSwitchPort);
- FlowId flowId = new FlowId(currentId++); //dummy flow ID
+ FlowId flowId = new FlowId(flowService.getNextFlowEntryId());
FlowPath flowPath = new FlowPath();
flowPath.setFlowId(flowId);
flowPath.setInstallerId(new CallerId("Forwarding"));