Use the FlowPath Type to decide which Flow should be maintained by
ONOS (i.e., for shortest path re-computation), and remove the
overloading of the DataPathSummary string for the purpose
of deciding whether the path should be maintained by ONOS.
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowDatabaseOperation.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowDatabaseOperation.java
index 74cfcbe..5336520 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowDatabaseOperation.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowDatabaseOperation.java
@@ -35,14 +35,11 @@
* @param dbHandler the Graph Database handler to use.
* @param flowPath the Flow Path to install.
* @param flowId the return-by-reference Flow ID as assigned internally.
- * @param dataPathSummaryStr the data path summary string if the added
- * flow will be maintained internally, otherwise null.
* @return true on success, otherwise false.
*/
static boolean addFlow(FlowManager flowManager,
GraphDBOperation dbHandler,
- FlowPath flowPath, FlowId flowId,
- String dataPathSummaryStr) {
+ FlowPath flowPath, FlowId flowId) {
IFlowPath flowObj = null;
boolean found = false;
try {
@@ -140,12 +137,7 @@
if (! flowPath.flowEntryActions().actions().isEmpty()) {
flowObj.setActions(flowPath.flowEntryActions().toString());
}
-
- if (dataPathSummaryStr != null) {
- flowObj.setDataPathSummary(dataPathSummaryStr);
- } else {
- flowObj.setDataPathSummary("");
- }
+ flowObj.setDataPathSummary(flowPath.dataPath().dataPathSummary());
if (found)
flowObj.setUserState("FE_USER_MODIFY");
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 cd1c994..6926705 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
@@ -271,11 +271,11 @@
if (mySwitch == null)
continue; // Ignore: not my responsibility
- // Test the Data Path Summary string
- String dataPathSummaryStr = flowPathObj.getDataPathSummary();
- if (dataPathSummaryStr == null)
+ // Test whether we need to maintain this flow
+ String flowPathTypeStr = flowPathObj.getFlowPathType();
+ if (flowPathTypeStr == null)
continue; // Could be invalid entry?
- if (dataPathSummaryStr.isEmpty())
+ if (! flowPathTypeStr.equals("FP_TYPE_SHORTEST_PATH"))
continue; // No need to maintain this flow
//
@@ -292,15 +292,15 @@
}
// Fetch the fields needed to recompute the shortest path
+ String dataPathSummaryStr = flowPathObj.getDataPathSummary();
Short srcPortShort = flowPathObj.getSrcPort();
String dstDpidStr = flowPathObj.getDstSwitch();
Short dstPortShort = flowPathObj.getDstPort();
- String flowPathTypeStr = flowPathObj.getFlowPathType();
Long flowPathFlagsLong = flowPathObj.getFlowPathFlags();
- if ((srcPortShort == null) ||
+ if ((dataPathSummaryStr == null) ||
+ (srcPortShort == null) ||
(dstDpidStr == null) ||
(dstPortShort == null) ||
- (flowPathTypeStr == null) ||
(flowPathFlagsLong == null)) {
continue;
}
@@ -534,15 +534,11 @@
*
* @param flowPath the Flow Path to install.
* @param flowId the return-by-reference Flow ID as assigned internally.
- * @param dataPathSummaryStr the data path summary string if the added
- * flow will be maintained internally, otherwise null.
* @return true on success, otherwise false.
*/
@Override
- public boolean addFlow(FlowPath flowPath, FlowId flowId,
- String dataPathSummaryStr) {
- if (FlowDatabaseOperation.addFlow(this, dbHandler, flowPath, flowId,
- dataPathSummaryStr)) {
+ public boolean addFlow(FlowPath flowPath, FlowId flowId) {
+ if (FlowDatabaseOperation.addFlow(this, dbHandler, flowPath, flowId)) {
datagridService.notificationSendFlowAdded(flowPath);
return true;
}
@@ -705,31 +701,11 @@
// Instead, let the Flow reconciliation thread take care of it.
//
- // We need the DataPath to populate the Network MAP
- DataPath dataPath = new DataPath();
- dataPath.setSrcPort(flowPath.dataPath().srcPort());
- dataPath.setDstPort(flowPath.dataPath().dstPort());
-
- //
- // Prepare the computed Flow Path
- //
- FlowPath computedFlowPath = new FlowPath();
- computedFlowPath.setFlowId(new FlowId(flowPath.flowId().value()));
- computedFlowPath.setInstallerId(new CallerId(flowPath.installerId().value()));
- computedFlowPath.setFlowPathType(flowPath.flowPathType());
- computedFlowPath.setFlowPathFlags(new FlowPathFlags(flowPath.flowPathFlags().flags()));
- computedFlowPath.setDataPath(dataPath);
- computedFlowPath.setFlowEntryMatch(new FlowEntryMatch(flowPath.flowEntryMatch()));
- computedFlowPath.setFlowEntryActions(new FlowEntryActions(flowPath.flowEntryActions()));
-
FlowId flowId = new FlowId();
- String dataPathSummaryStr = dataPath.dataPathSummary();
- if (! addFlow(computedFlowPath, flowId, dataPathSummaryStr))
+ if (! addFlow(flowPath, flowId))
return null;
- // TODO: Mark the flow for maintenance purpose
-
- return (computedFlowPath);
+ return (flowPath);
}
/**
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 a15f56c..bd9819e 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/IFlowService.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/IFlowService.java
@@ -22,12 +22,9 @@
*
* @param flowPath the Flow Path to install.
* @param flowId the return-by-reference Flow ID as assigned internally.
- * @param dataPathSummaryStr the data path summary string if the added
- * flow will be maintained internally, otherwise null.
* @return true on success, otherwise false.
*/
- boolean addFlow(FlowPath flowPath, FlowId flowId,
- String dataPathSummaryStr);
+ boolean addFlow(FlowPath flowPath, FlowId flowId);
/**
* Delete all previously added flows.
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 d891374..0926f91 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,7 +64,7 @@
// Process the request
if (flowPath != null) {
- if (flowService.addFlow(flowPath, result, null) != true) {
+ if (flowService.addFlow(flowPath, result) != true) {
result = new FlowId(); // Error: Return empty Flow Id
}
}