Fix a bug (race condition?) where a Flow Entry without a valid Flow Entry ID
is pushed into the FlowPusher.
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 2619243..01cca31 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
@@ -485,6 +485,18 @@
if (mySwitch == null)
continue;
+ //
+ // Assign Flow Entry IDs if missing.
+ //
+ // NOTE: This is an additional safeguard, in case the
+ // mySwitches set has changed (after the Flow Entry IDs
+ // assignments by the caller).
+ //
+ if (! flowEntry.isValidFlowEntryId()) {
+ long id = getNextFlowEntryId();
+ flowEntry.setFlowEntryId(new FlowEntryId(id));
+ }
+
log.debug("Pushing Flow Entry To Switch: {}", flowEntry.toString());
entries.add(new Pair<IOFSwitch, FlowEntry>(mySwitch, flowEntry));
}