Implement OFActionSetQueue (OpenFlow 1.3 only)
Action "Set-Queue" (OFPAT_SET_QUEUE) is not yet implemented.
This patch adds such a QUEUE Treatment and implements it using the Set-Queue
action of OpenFlow 1.3.
The --setQueue parameter can be used when defining intents so that flows with
the respective Set-Queue action are installed.
This includes contributions by Michael Jarschel and Arne Schwabe and is the
result of our ONOS Hackaton project at EWSDN 2015.
Change-Id: Ie7bf01e8fd90fe68977477327ac4f53d7930e186
diff --git a/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java b/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
index 26981e5..8868bf7 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
@@ -94,6 +94,17 @@
return new GroupInstruction(groupId);
}
+ /**
+ * Creates a set-queue instruction.
+ *
+ * @param queueId Queue Id
+ * @return set-queue instruction
+ */
+ public static SetQueueInstruction setQueue(final long queueId) {
+ checkNotNull(queueId, "queue ID cannot be null");
+ return new SetQueueInstruction(queueId);
+ }
+
public static MeterInstruction meterTraffic(final MeterId meterId) {
checkNotNull(meterId, "meter id cannot be null");
return new MeterInstruction(meterId);
@@ -625,6 +636,50 @@
}
/**
+ * Set-Queue Instruction.
+ */
+ public static final class SetQueueInstruction implements Instruction {
+ private final long queueId;
+
+ private SetQueueInstruction(long queueId) {
+ this.queueId = queueId;
+ }
+
+ public long queueId() {
+ return queueId;
+ }
+
+ @Override
+ public Type type() {
+ return Type.QUEUE;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(type().toString())
+ .add("queueId", queueId).toString();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(type().ordinal(), queueId);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof SetQueueInstruction) {
+ SetQueueInstruction that = (SetQueueInstruction) obj;
+ return Objects.equals(queueId, that.queueId);
+
+ }
+ return false;
+ }
+ }
+
+ /**
* A meter instruction.
*/
public static final class MeterInstruction implements Instruction {