Fix for bug ONOS-897:
Add support for specifying flow entry priority.
Now the default priority is 32768 (same as NOX)
The priority can be specified by add_flow.py script with the
"priority <flowPriority>" keyword.
Conflicts:
src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowDatabaseOperation.java
src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowPusher.java
src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIFlowEntryTest.java
src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIFlowPathTest.java
src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableGraphDBOperation.java
src/test/java/net/onrc/onos/ofcontroller/util/FlowPathTest.java
NOTE: The conflicts in file FlowDatabaseOperation.java and FlowPusher.java
have been resolved by hand.
The rest of the conflicts are because of missing test files and have been
ignored.
Change-Id: Ia8291fa321d250675850942ea6763f3770af711f
Fix the formatting of the help string.
Change-Id: I95f4c64d6960f7d66db3821210277fc91c2239e1
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/FlowPath.java b/src/main/java/net/onrc/onos/ofcontroller/util/FlowPath.java
index 7c87a10..0371046 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/FlowPath.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowPath.java
@@ -13,6 +13,8 @@
* The class representing the Flow Path.
*/
public class FlowPath implements Comparable<FlowPath> {
+ public static final int PRIORITY_DEFAULT = 32768; // Default Flow Priority
+
private FlowId flowId; // The Flow ID
private CallerId installerId; // The Caller ID of the path installer
private FlowPathType flowPathType; // The Flow Path type
@@ -20,6 +22,7 @@
private FlowPathFlags flowPathFlags; // The Flow Path flags
private int idleTimeout; // The Flow idle timeout
private int hardTimeout; // The Flow hard timeout
+ private int priority; // The Flow priority
private DataPath dataPath; // The data path
private FlowEntryMatch flowEntryMatch; // Common Flow Entry Match for all
// Flow Entries
@@ -33,6 +36,7 @@
flowPathType = FlowPathType.FP_TYPE_UNKNOWN;
flowPathUserState = FlowPathUserState.FP_USER_UNKNOWN;
flowPathFlags = new FlowPathFlags();
+ priority = FlowPath.PRIORITY_DEFAULT;
dataPath = new DataPath();
flowEntryActions = new FlowEntryActions();
}
@@ -49,6 +53,7 @@
this.setFlowPathFlags(new FlowPathFlags(flowObj.getFlowPathFlags()));
this.setIdleTimeout(flowObj.getIdleTimeout());
this.setHardTimeout(flowObj.getHardTimeout());
+ this.setPriority(flowObj.getPriority());
this.dataPath().srcPort().setDpid(new Dpid(flowObj.getSrcSwitch()));
this.dataPath().srcPort().setPort(new Port(flowObj.getSrcPort()));
this.dataPath().dstPort().setDpid(new Dpid(flowObj.getDstSwitch()));
@@ -347,6 +352,28 @@
}
/**
+ * Get the flow priority.
+ *
+ * It should be an unsigned integer in the interval [0, 65535].
+ *
+ * @return the flow priority.
+ */
+ @JsonProperty("priority")
+ public int priority() { return priority; }
+
+ /**
+ * Set the flow priority.
+ *
+ * It should be an unsigned integer in the interval [0, 65535].
+ *
+ * @param priority the flow priority to set.
+ */
+ @JsonProperty("priority")
+ public void setPriority(int priority) {
+ this.priority = 0xffff & priority;
+ }
+
+ /**
* Get the flow path's data path.
*
* @return the flow path's data path.
@@ -418,8 +445,8 @@
*
* The string has the following form:
* [flowId=XXX installerId=XXX flowPathType = XXX flowPathUserState = XXX
- * flowPathFlags=XXX idleTimeout=XXX hardTimeout=XXX dataPath=XXX
- * flowEntryMatch=XXX flowEntryActions=XXX]
+ * flowPathFlags=XXX idleTimeout=XXX hardTimeout=XXX priority=XXX
+ * dataPath=XXX flowEntryMatch=XXX flowEntryActions=XXX]
*
* @return the flow path as a string.
*/
@@ -432,6 +459,7 @@
ret += " flowPathFlags=" + this.flowPathFlags.toString();
ret += " idleTimeout=" + this.idleTimeout;
ret += " hardTimeout=" + this.hardTimeout;
+ ret += " priority=" + this.priority;
if (dataPath != null)
ret += " dataPath=" + this.dataPath.toString();
if (flowEntryMatch != null)