Refactor the FlowManager addFlow() API:
* It returns the FlowID on success, otherwise null
* If the FlowID of the FlowPath is not set (i.e., its value is -1),
the FlowManager will assign it.
* Modified the web/add_flow.py usage to explain the value of Flow ID of -1
* Removed method addAndMaintainShortestPathFlow() from the FlowManager,
because it is not needed anymore.
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/AddFlowResource.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/AddFlowResource.java
index 0926f91..9afaaec 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/AddFlowResource.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/AddFlowResource.java
@@ -64,9 +64,9 @@
// Process the request
if (flowPath != null) {
- if (flowService.addFlow(flowPath, result) != true) {
- result = new FlowId(); // Error: Return empty Flow Id
- }
+ FlowId addedFlowId = flowService.addFlow(flowPath);
+ if (addedFlowId != null)
+ result = addedFlowId;
}
return result;