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/core/INetMapTopologyObjects.java b/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjects.java
index 65750e2..f237376 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjects.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjects.java
@@ -268,6 +268,13 @@
@Property("hard_timeout")
public void setHardTimeout(Integer hardTimeout);
+ @JsonProperty("priority")
+ @Property("priority")
+ public Integer getPriority();
+
+ @Property("priority")
+ public void setPriority(Integer priority);
+
@JsonProperty("srcDpid")
@Property("src_switch")
public String getSrcSwitch();
@@ -436,6 +443,13 @@
@Property("hard_timeout")
public void setHardTimeout(Integer hardTimeout);
+ @JsonProperty("priority")
+ @Property("priority")
+ public Integer getPriority();
+
+ @Property("priority")
+ public void setPriority(Integer priority);
+
@Property("switch_dpid")
public String getSwitchDpid();
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 cedfdfd..ec3064e 100755
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowDatabaseOperation.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowDatabaseOperation.java
@@ -5,6 +5,7 @@
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.LinkedList;
import java.util.Map;
import net.floodlightcontroller.core.IOFSwitch;
@@ -100,6 +101,9 @@
flowPathEntity.setProperty("hard_timeout", flowPath.hardTimeout());
flowProp.setHardTimeout(flowPath.hardTimeout());
+ flowPathEntity.setProperty("priority", flowPath.priority());
+ flowProp.setPriority(flowPath.priority());
+
flowPathEntity.setProperty("src_switch", flowPath.dataPath().srcPort().dpid().toString());
flowProp.setSrcSwitch(flowPath.dataPath().srcPort().dpid().toString());
@@ -208,6 +212,8 @@
flowEntryEntity.setProperty("hard_timeout", flowEntry.hardTimeout());
+ flowEntryEntity.setProperty("priority", flowEntry.priority());
+
flowEntryEntity.setProperty("switch_dpid", flowEntry.dpid().toString());
flowEntryEntity.addEdge(sw, Direction.OUT, "switch");
@@ -400,6 +406,7 @@
//
// - flowEntry.idleTimeout()
// - flowEntry.hardTimeout()
+ // - flowEntry.priority()
// - flowEntry.dpid()
// - flowEntry.flowEntryUserState()
// - flowEntry.flowEntrySwitchState()
@@ -429,6 +436,7 @@
flowProp.setIdleTimeout(flowEntry.idleTimeout());
flowProp.setHardTimeout(flowEntry.hardTimeout());
+ flowProp.setPriority(flowEntry.priority());
flowProp.setSwitchDpid(flowEntry.dpid().toString());
if (measureONOSFlowEntryTimeProp) {
numProperties += 3;
@@ -961,6 +969,7 @@
Long flowPathFlags;
Integer idleTimeout;
Integer hardTimeout;
+ Integer priority;
String srcSwitchStr;
Short srcPortShort;
String dstSwitchStr;
@@ -977,6 +986,7 @@
flowPathFlags = (Long)propMap.get("flow_path_flags");
idleTimeout = (Integer) propMap.get("idle_timeout");
hardTimeout = (Integer) propMap.get("hard_timeout");
+ priority = (Integer) propMap.get("priority");
srcSwitchStr = (String) propMap.get("src_switch");
srcPortShort = (Short)propMap.get("src_port");
dstSwitchStr = (String) propMap.get("dst_switch");
@@ -989,6 +999,7 @@
flowPathFlags = flowObj.getFlowPathFlags();
idleTimeout = flowObj.getIdleTimeout();
hardTimeout = flowObj.getHardTimeout();
+ priority = flowObj.getPriority();
srcSwitchStr = flowObj.getSrcSwitch();
srcPortShort = flowObj.getSrcPort();
dstSwitchStr = flowObj.getDstSwitch();
@@ -1002,6 +1013,7 @@
(flowPathFlags == null) ||
(idleTimeout == null) ||
(hardTimeout == null) ||
+ (priority == null) ||
(srcSwitchStr == null) ||
(srcPortShort == null) ||
(dstSwitchStr == null) ||
@@ -1019,6 +1031,7 @@
flowPath.setFlowPathFlags(new FlowPathFlags(flowPathFlags));
flowPath.setIdleTimeout(idleTimeout);
flowPath.setHardTimeout(hardTimeout);
+ flowPath.setPriority(priority);
flowPath.dataPath().srcPort().setDpid(new Dpid(srcSwitchStr));
flowPath.dataPath().srcPort().setPort(new Port(srcPortShort));
flowPath.dataPath().dstPort().setDpid(new Dpid(dstSwitchStr));
@@ -1076,6 +1089,7 @@
String flowEntryIdStr;
Integer idleTimeout;
Integer hardTimeout;
+ Integer priority;
String switchDpidStr;
String userState;
String switchState;
@@ -1086,6 +1100,7 @@
flowEntryIdStr = (String) propMap.get("flow_entry_id");
idleTimeout = (Integer) propMap.get("idle_timeout");
hardTimeout = (Integer) propMap.get("hard_timeout");
+ priority = (Integer) propMap.get("priority");
switchDpidStr = (String) propMap.get("switch_dpid");
userState = (String) propMap.get("user_state");
switchState = (String) propMap.get("switch_state");
@@ -1093,6 +1108,7 @@
flowEntryIdStr = flowEntryObj.getFlowEntryId();
idleTimeout = flowEntryObj.getIdleTimeout();
hardTimeout = flowEntryObj.getHardTimeout();
+ priority = flowEntryObj.getPriority();
switchDpidStr = flowEntryObj.getSwitchDpid();
userState = flowEntryObj.getUserState();
switchState = flowEntryObj.getSwitchState();
@@ -1102,6 +1118,7 @@
(flowEntryIdStr == null) ||
(idleTimeout == null) ||
(hardTimeout == null) ||
+ (priority == null) ||
(switchDpidStr == null) ||
(userState == null) ||
(switchState == null)) {
@@ -1116,6 +1133,7 @@
flowEntry.setDpid(new Dpid(switchDpidStr));
flowEntry.setIdleTimeout(idleTimeout);
flowEntry.setHardTimeout(hardTimeout);
+ flowEntry.setPriority(priority);
//
// Extract the match conditions
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowEntryProperty.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowEntryProperty.java
index b45f8ff..f893ac1 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowEntryProperty.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowEntryProperty.java
@@ -48,6 +48,10 @@
public void setHardTimeout(Integer value) {
map.put("hard_timeout", value);
}
+
+ public void setPriority(Integer value) {
+ map.put("priority", value);
+ }
public void setSwitchDpid(String value) {
map.put("switch_dpid", value);
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowEventHandler.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowEventHandler.java
index 5ff1dc5..1a2563d 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowEventHandler.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowEventHandler.java
@@ -1318,6 +1318,7 @@
//
newFlowEntry.setIdleTimeout(flowPath.idleTimeout());
newFlowEntry.setHardTimeout(flowPath.hardTimeout());
+ newFlowEntry.setPriority(flowPath.priority());
//
// Allocate the FlowEntryMatch by copying the default one
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowPathProperty.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowPathProperty.java
index 21db7bc..50bbcc8 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowPathProperty.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowPathProperty.java
@@ -41,6 +41,10 @@
map.put("hard_timeout", hardTimeout);
}
+ public void setPriority(Integer priority) {
+ map.put("priority", priority);
+ }
+
public void setSrcSwitch(String srcSwitch) {
map.put("src_switch", srcSwitch);
}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowPusher.java b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowPusher.java
index f2a1828..21be62c 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowPusher.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowPusher.java
@@ -66,9 +66,7 @@
// Number of messages sent to switch at once
protected static final int MAX_MESSAGE_SEND = 100;
- public static final short PRIORITY_DEFAULT = 100;
-
- public enum QueueState {
+ public enum QueueState {
READY,
SUSPENDED,
}
@@ -723,7 +721,7 @@
fm.setIdleTimeout((short)flowEntry.idleTimeout())
.setHardTimeout((short)flowEntry.hardTimeout())
- .setPriority(PRIORITY_DEFAULT)
+ .setPriority((short)flowEntry.priority())
.setBufferId(OFPacketOut.BUFFER_ID_NONE).setCookie(cookie)
.setCommand(flowModCommand).setMatch(match)
.setActions(openFlowActions)
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntry.java b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntry.java
index c8b206f..c6d6726 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntry.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntry.java
@@ -15,6 +15,7 @@
private FlowEntryId flowEntryId; // The Flow Entry ID
private int idleTimeout; // The Flow idle timeout
private int hardTimeout; // The Flow hard timeout
+ private int priority; // The Flow priority
private FlowEntryMatch flowEntryMatch; // The Flow Entry Match
private FlowEntryActions flowEntryActions; // The Flow Entry Actions
private Dpid dpid; // The Switch DPID
@@ -111,6 +112,7 @@
setFlowEntryActions(actions);
*/
+ priority = FlowPath.PRIORITY_DEFAULT;
flowEntryActions = new FlowEntryActions();
flowEntryUserState = FlowEntryUserState.FE_USER_UNKNOWN;
flowEntrySwitchState = FlowEntrySwitchState.FE_SWITCH_UNKNOWN;
@@ -224,6 +226,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 Entry Match.
*
* @return the Flow Entry Match.
@@ -393,7 +417,7 @@
* Convert the flow entry to a string.
*
* The string has the following form:
- * [flowEntryId=XXX idleTimeout=XXX hardTimeout=XXX
+ * [flowEntryId=XXX idleTimeout=XXX hardTimeout=XXX priority=XXX
* flowEntryMatch=XXX flowEntryActions=XXX dpid=XXX
* inPort=XXX outPort=XXX flowEntryUserState=XXX flowEntrySwitchState=XXX
* flowEntryErrorState=XXX]
@@ -412,6 +436,7 @@
}
ret.append(" idleTimeout=" + this.idleTimeout);
ret.append(" hardTimeout=" + this.hardTimeout);
+ ret.append(" priority=" + this.priority);
if ( flowEntryMatch != null ) {
ret.append(" flowEntryMatch=" + this.flowEntryMatch.toString());
}
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)
diff --git a/src/test/java/net/onrc/onos/ofcontroller/util/FlowEntryTest.java b/src/test/java/net/onrc/onos/ofcontroller/util/FlowEntryTest.java
index 696f9e5..cd1b553 100644
--- a/src/test/java/net/onrc/onos/ofcontroller/util/FlowEntryTest.java
+++ b/src/test/java/net/onrc/onos/ofcontroller/util/FlowEntryTest.java
@@ -15,6 +15,7 @@
FlowEntryId flowEntryId = new FlowEntryId(0x5678);
int idleTimeout = 5;
int hardTimeout = 10;
+ int priority = 15;
FlowEntryMatch match;
FlowEntryActions actions;
@@ -55,6 +56,7 @@
entry.setIdleTimeout(5);
entry.setHardTimeout(10);
+ entry.setPriority(15);
dpid = new Dpid("CA:FE");
entry.setDpid( dpid );
@@ -203,6 +205,11 @@
}
@Test
+ public void testPriority(){
+ assertEquals("priority", priority, entry.priority() );
+ }
+
+ @Test
public void testFlowEntryMatch(){
assertEquals("flowEntryMatch", match, entry.flowEntryMatch() );
}
@@ -252,8 +259,8 @@
@Test
public void testToString(){
FlowEntry def = new FlowEntry();
- assertEquals("toString", def.toString(), "[ idleTimeout=0 hardTimeout=0 flowEntryActions=[] flowEntryUserState=FE_USER_UNKNOWN flowEntrySwitchState=FE_SWITCH_UNKNOWN]" );
- assertEquals("toString", entry.toString(), "[flowEntryId=0x5678 flowId=0x1234 idleTimeout=5 hardTimeout=10 flowEntryMatch=[inPort=1 srcMac=01:02:03:04:05:06 dstMac=06:05:04:03:02:01 ethernetFrameType=2 vlanId=3 vlanPriority=4 srcIPv4Net=127.0.0.1/32 dstIPv4Net=127.0.0.2/32 ipProto=5 ipToS=6 srcTcpUdpPort=7 dstTcpUdpPort=8] flowEntryActions=[[type=ACTION_OUTPUT action=[port=9 maxLen=0]];[type=ACTION_OUTPUT action=[port=-3 maxLen=0]];[type=ACTION_SET_VLAN_VID action=[vlanId=3]];[type=ACTION_SET_VLAN_PCP action=[vlanPriority=4]];[type=ACTION_STRIP_VLAN action=[stripVlan=true]];[type=ACTION_SET_DL_SRC action=[addr=01:02:03:04:05:06]];[type=ACTION_SET_DL_DST action=[addr=06:05:04:03:02:01]];[type=ACTION_SET_NW_SRC action=[addr=127.0.0.3]];[type=ACTION_SET_NW_DST action=[addr=127.0.0.4]];[type=ACTION_SET_NW_TOS action=[ipToS=6]];[type=ACTION_SET_TP_SRC action=[port=7]];[type=ACTION_SET_TP_DST action=[port=8]];[type=ACTION_ENQUEUE action=[port=10 queueId=11]];] dpid=00:00:00:00:00:00:ca:fe inPort=1 outPort=9 flowEntryUserState=FE_USER_ADD flowEntrySwitchState=FE_SWITCH_UPDATED flowEntryErrorState=[type=12 code=13]]" );
+ assertEquals("toString", def.toString(), "[ idleTimeout=0 hardTimeout=0 priority=32768 flowEntryActions=[] flowEntryUserState=FE_USER_UNKNOWN flowEntrySwitchState=FE_SWITCH_UNKNOWN]" );
+ assertEquals("toString", entry.toString(), "[flowEntryId=0x5678 flowId=0x1234 idleTimeout=5 hardTimeout=10 priority=15 flowEntryMatch=[inPort=1 srcMac=01:02:03:04:05:06 dstMac=06:05:04:03:02:01 ethernetFrameType=2 vlanId=3 vlanPriority=4 srcIPv4Net=127.0.0.1/32 dstIPv4Net=127.0.0.2/32 ipProto=5 ipToS=6 srcTcpUdpPort=7 dstTcpUdpPort=8] flowEntryActions=[[type=ACTION_OUTPUT action=[port=9 maxLen=0]];[type=ACTION_OUTPUT action=[port=-3 maxLen=0]];[type=ACTION_SET_VLAN_VID action=[vlanId=3]];[type=ACTION_SET_VLAN_PCP action=[vlanPriority=4]];[type=ACTION_STRIP_VLAN action=[stripVlan=true]];[type=ACTION_SET_DL_SRC action=[addr=01:02:03:04:05:06]];[type=ACTION_SET_DL_DST action=[addr=06:05:04:03:02:01]];[type=ACTION_SET_NW_SRC action=[addr=127.0.0.3]];[type=ACTION_SET_NW_DST action=[addr=127.0.0.4]];[type=ACTION_SET_NW_TOS action=[ipToS=6]];[type=ACTION_SET_TP_SRC action=[port=7]];[type=ACTION_SET_TP_DST action=[port=8]];[type=ACTION_ENQUEUE action=[port=10 queueId=11]];] dpid=00:00:00:00:00:00:ca:fe inPort=1 outPort=9 flowEntryUserState=FE_USER_ADD flowEntrySwitchState=FE_SWITCH_UPDATED flowEntryErrorState=[type=12 code=13]]" );
}
}
diff --git a/web/add_flow.py b/web/add_flow.py
index 6ff250a..3066936 100755
--- a/web/add_flow.py
+++ b/web/add_flow.py
@@ -129,12 +129,13 @@
my_dst_port = my_args[5]
#
- # Extract the "flowPathFlags", "idleTimeout", "hardTimeout",
+ # Extract the "flowPathFlags", "idleTimeout", "hardTimeout", "priority",
# "match" and "action" arguments.
#
flowPathFlags = 0L
idleTimeout = 0
hardTimeout = 0
+ priority = 32768
match = {}
matchInPortEnabled = True # NOTE: Enabled by default
actions = []
@@ -162,6 +163,8 @@
idleTimeout = arg2
elif arg1 == "hardTimeout":
hardTimeout = arg2
+ elif arg1 == "priority":
+ priority = arg2
elif arg1 == "matchInPort":
# Just mark whether inPort matching is enabled
matchInPortEnabled = arg2 in ['True', 'true']
@@ -319,6 +322,7 @@
'flowPathFlags' : flowPathFlags,
'idleTimeout' : idleTimeout,
'hardTimeout' : hardTimeout,
+ 'priority' : priority,
'match' : match,
'matchInPortEnabled' : matchInPortEnabled,
'actions' : actions,
@@ -345,6 +349,7 @@
myFlowPathFlags = parsed_args['flowPathFlags']
myIdleTimeout = parsed_args['idleTimeout']
myHardTimeout = parsed_args['hardTimeout']
+ myPriority = parsed_args['priority']
match = parsed_args['match']
matchInPortEnabled = parsed_args['matchInPortEnabled']
actions = parsed_args['actions']
@@ -369,6 +374,7 @@
flow_path['flowPathFlags'] = flowPathFlags
flow_path['idleTimeout'] = myIdleTimeout
flow_path['hardTimeout'] = myHardTimeout
+ flow_path['priority'] = myPriority
if (len(match) > 0):
flow_path['flowEntryMatch'] = copy.deepcopy(match)
@@ -499,7 +505,7 @@
if __name__ == "__main__":
- usage_msg = "Usage: %s [Flags] <flow-id> <installer-id> <src-dpid> <src-port> <dest-dpid> <dest-port> [Flow Path Flags] [Match Conditions] [Actions]\n" % (sys.argv[0])
+ usage_msg = "Usage: %s [Flags] <flow-id> <installer-id> <src-dpid> <src-port> <dest-dpid> <dest-port> [Flow Attributes] [Match Conditions] [Actions]\n" % (sys.argv[0])
usage_msg = usage_msg + "\n"
usage_msg = usage_msg + " <flow-id> The Flow ID, or -1 if it should be assigned by ONOS\n"
usage_msg = usage_msg + "\n"
@@ -512,16 +518,18 @@
usage_msg = usage_msg + " -f <filename> Read the flow(s) to install from a file\n"
usage_msg = usage_msg + " File format: one line per flow starting with <flow-id>\n"
usage_msg = usage_msg + "\n"
- usage_msg = usage_msg + " Flow Path Flags:\n"
+ usage_msg = usage_msg + " Flow Attributes:\n"
usage_msg = usage_msg + " flowPathFlags <Flags> (flag names separated by ',')\n"
- usage_msg = usage_msg + "\n"
- usage_msg = usage_msg + " Known flags:\n"
+ usage_msg = usage_msg + " Known flags:\n"
usage_msg = usage_msg + " DISCARD_FIRST_HOP_ENTRY : Discard the first-hop flow entry\n"
usage_msg = usage_msg + " KEEP_ONLY_FIRST_HOP_ENTRY : Keep only the first-hop flow entry\n"
usage_msg = usage_msg + "\n"
- usage_msg = usage_msg + " Timeouts (in seconds in the [0, 65535] interval):\n"
- usage_msg = usage_msg + " idleTimeout <idleTimeoutInSeconds> (default to 0: no timeout)\n"
- usage_msg = usage_msg + " hardTimeout <hardTimeoutInSeconds> (default to 0: no timeout)\n"
+ usage_msg = usage_msg + " idleTimeout <idleTimeoutInSeconds> (in the [0, 65535] interval;\n"
+ usage_msg = usage_msg + " default to 0: no timeout)\n"
+ usage_msg = usage_msg + " hardTimeout <hardTimeoutInSeconds> (in the [0, 65535] interval;\n"
+ usage_msg = usage_msg + " default to 0: no timeout)\n"
+ usage_msg = usage_msg + "\n"
+ usage_msg = usage_msg + " priority <flowPriority> (in the [0, 65535] interval; default to 32768)\n"
usage_msg = usage_msg + "\n"
usage_msg = usage_msg + " Match Conditions:\n"
usage_msg = usage_msg + " matchInPort <True|False> (default to True)\n"
diff --git a/web/get_flow.py b/web/get_flow.py
index 382238f..bdf89df 100755
--- a/web/get_flow.py
+++ b/web/get_flow.py
@@ -166,6 +166,7 @@
flowPathFlags = parsedResult['flowPathFlags']['flags']
idleTimeout = parsedResult['idleTimeout']
hardTimeout = parsedResult['hardTimeout']
+ priority = parsedResult['priority']
srcSwitch = parsedResult['dataPath']['srcPort']['dpid']['value']
srcPort = parsedResult['dataPath']['srcPort']['port']['value']
dstSwitch = parsedResult['dataPath']['dstPort']['dpid']['value']
@@ -183,7 +184,7 @@
flowPathFlagsStr += ","
flowPathFlagsStr += "KEEP_ONLY_FIRST_HOP_ENTRY"
- print "FlowPath: (flowId = %s installerId = %s flowPathType = %s flowPathUserState = %s flowPathFlags = 0x%x(%s) src = %s/%s dst = %s/%s idleTimeout = %s hardTimeout = %s)" % (flowId, installerId, flowPathType, flowPathUserState, flowPathFlags, flowPathFlagsStr, srcSwitch, srcPort, dstSwitch, dstPort, idleTimeout, hardTimeout)
+ print "FlowPath: (flowId = %s installerId = %s flowPathType = %s flowPathUserState = %s flowPathFlags = 0x%x(%s) src = %s/%s dst = %s/%s idleTimeout = %s hardTimeout = %s priority = %s)" % (flowId, installerId, flowPathType, flowPathUserState, flowPathFlags, flowPathFlagsStr, srcSwitch, srcPort, dstSwitch, dstPort, idleTimeout, hardTimeout, priority)
#
# Print the common match conditions
@@ -209,13 +210,14 @@
flowEntryId = f['flowEntryId']
idleTimeout = f['idleTimeout']
hardTimeout = f['hardTimeout']
+ priority = f['priority']
dpid = f['dpid']['value']
userState = f['flowEntryUserState']
switchState = f['flowEntrySwitchState']
match = f['flowEntryMatch'];
actions = f['flowEntryActions']['actions']
- print " FlowEntry: (%s, %s, %s, %s, idleTimeout = %s, hardTimeout = %s)" % (flowEntryId, dpid, userState, switchState, idleTimeout, hardTimeout)
+ print " FlowEntry: (%s, %s, %s, %s, idleTimeout = %s, hardTimeout = %s, priority = %s)" % (flowEntryId, dpid, userState, switchState, idleTimeout, hardTimeout, priority)
#
# Print the match conditions