decoupling extension types from of protocol
numbers renaming extension instruction to
extension treatment
Change-Id: Ie949d6235c2a5a984f7c7867262f8336721f1ee7
diff --git a/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java b/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java
index 4615a82..22bff7d 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java
@@ -30,7 +30,7 @@
import org.onosproject.net.DeviceId;
import org.onosproject.net.IndexedLambda;
import org.onosproject.net.PortNumber;
-import org.onosproject.net.flow.instructions.ExtensionInstruction;
+import org.onosproject.net.flow.instructions.ExtensionTreatment;
import org.onosproject.net.flow.instructions.Instruction;
import org.onosproject.net.flow.instructions.Instructions;
import org.onosproject.net.meter.MeterId;
@@ -489,7 +489,7 @@
}
@Override
- public TrafficTreatment.Builder extension(ExtensionInstruction extension,
+ public TrafficTreatment.Builder extension(ExtensionTreatment extension,
DeviceId deviceId) {
return add(Instructions.extension(extension, deviceId));
}
diff --git a/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java b/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java
index f1a676a..06b6ffa 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java
@@ -26,7 +26,7 @@
import org.onosproject.core.GroupId;
import org.onosproject.net.DeviceId;
import org.onosproject.net.PortNumber;
-import org.onosproject.net.flow.instructions.ExtensionInstruction;
+import org.onosproject.net.flow.instructions.ExtensionTreatment;
import org.onosproject.net.flow.instructions.Instruction;
import org.onosproject.net.flow.instructions.Instructions;
import org.onosproject.net.meter.MeterId;
@@ -430,7 +430,7 @@
* @param deviceId device ID
* @return a treatment builder
*/
- Builder extension(ExtensionInstruction extension, DeviceId deviceId);
+ Builder extension(ExtensionTreatment extension, DeviceId deviceId);
/**
* Builds an immutable traffic treatment descriptor.
diff --git a/core/api/src/main/java/org/onosproject/net/flow/instructions/AbstractExtensionInstruction.java b/core/api/src/main/java/org/onosproject/net/flow/instructions/AbstractExtensionTreatment.java
similarity index 96%
rename from core/api/src/main/java/org/onosproject/net/flow/instructions/AbstractExtensionInstruction.java
rename to core/api/src/main/java/org/onosproject/net/flow/instructions/AbstractExtensionTreatment.java
index 9f22f88..ac7c771 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/instructions/AbstractExtensionInstruction.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/instructions/AbstractExtensionTreatment.java
@@ -23,7 +23,7 @@
/**
* Abstract implementation of the set/get property methods of ExtensionInstruction.
*/
-public abstract class AbstractExtensionInstruction implements ExtensionInstruction {
+public abstract class AbstractExtensionTreatment implements ExtensionTreatment {
private static final String INVALID_KEY = "Invalid property key: ";
private static final String INVALID_TYPE = "Given type does not match field type: ";
diff --git a/core/api/src/main/java/org/onosproject/net/flow/instructions/ExtensionInstruction.java b/core/api/src/main/java/org/onosproject/net/flow/instructions/ExtensionTreatment.java
similarity index 96%
rename from core/api/src/main/java/org/onosproject/net/flow/instructions/ExtensionInstruction.java
rename to core/api/src/main/java/org/onosproject/net/flow/instructions/ExtensionTreatment.java
index 89e0cc5..0e8885e 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/instructions/ExtensionInstruction.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/instructions/ExtensionTreatment.java
@@ -21,14 +21,14 @@
/**
* An extensible instruction type.
*/
-public interface ExtensionInstruction {
+public interface ExtensionTreatment {
/**
* Gets the type of the extension instruction.
*
* @return type
*/
- ExtensionType type();
+ ExtensionTreatmentType type();
/**
* Sets a property on the extension instruction.
diff --git a/core/api/src/main/java/org/onosproject/net/flow/instructions/ExtensionType.java b/core/api/src/main/java/org/onosproject/net/flow/instructions/ExtensionTreatmentType.java
similarity index 74%
rename from core/api/src/main/java/org/onosproject/net/flow/instructions/ExtensionType.java
rename to core/api/src/main/java/org/onosproject/net/flow/instructions/ExtensionTreatmentType.java
index 3e1cb75..7eaebbe 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/instructions/ExtensionType.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/instructions/ExtensionTreatmentType.java
@@ -25,25 +25,26 @@
* Type of extension instructions.
*/
@Beta
-public final class ExtensionType {
+public final class ExtensionTreatmentType {
/**
* A list of well-known named extension instruction type codes.
+ * These numbers have no impact on the actual OF type id.
*/
- public enum ExtensionTypes {
+ public enum ExtensionTreatmentTypes {
// TODO fix type numbers to include experimenter id
- NICIRA_SET_TUNNEL_DST(31),
- NICIRA_RESUBMIT(32);
+ NICIRA_SET_TUNNEL_DST(0),
+ NICIRA_RESUBMIT(1);
- private ExtensionType type;
+ private ExtensionTreatmentType type;
/**
* Creates a new named extension instruction type.
*
* @param type type code
*/
- ExtensionTypes(int type) {
- this.type = new ExtensionType(type);
+ ExtensionTreatmentTypes(int type) {
+ this.type = new ExtensionTreatmentType(type);
}
/**
@@ -51,7 +52,7 @@
*
* @return extension type object
*/
- public ExtensionType type() {
+ public ExtensionTreatmentType type() {
return type;
}
}
@@ -63,7 +64,7 @@
*
* @param type type code
*/
- public ExtensionType(int type) {
+ public ExtensionTreatmentType(int type) {
this.type = type;
}
@@ -77,8 +78,8 @@
if (this == obj) {
return true;
}
- if (obj instanceof ExtensionType) {
- final ExtensionType that = (ExtensionType) obj;
+ if (obj instanceof ExtensionTreatmentType) {
+ final ExtensionTreatmentType that = (ExtensionTreatmentType) obj;
return this.type == that.type;
}
return false;
@@ -86,7 +87,7 @@
@Override
public String toString() {
- return MoreObjects.toStringHelper(ExtensionType.class)
+ return MoreObjects.toStringHelper(ExtensionTreatmentType.class)
.add("type", type)
.toString();
}
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 126e722..4643b31 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
@@ -489,7 +489,7 @@
* @param deviceId device ID
* @return extension instruction
*/
- public static ExtensionInstructionWrapper extension(ExtensionInstruction extension,
+ public static ExtensionInstructionWrapper extension(ExtensionTreatment extension,
DeviceId deviceId) {
checkNotNull(extension, "Extension instruction cannot be null");
checkNotNull(deviceId, "Device ID cannot be null");
@@ -858,16 +858,16 @@
* Extension instruction.
*/
public static class ExtensionInstructionWrapper implements Instruction {
- private final ExtensionInstruction extensionInstruction;
+ private final ExtensionTreatment extensionTreatment;
private final DeviceId deviceId;
- ExtensionInstructionWrapper(ExtensionInstruction extension, DeviceId deviceId) {
- extensionInstruction = extension;
+ ExtensionInstructionWrapper(ExtensionTreatment extension, DeviceId deviceId) {
+ extensionTreatment = extension;
this.deviceId = deviceId;
}
- public ExtensionInstruction extensionInstruction() {
- return extensionInstruction;
+ public ExtensionTreatment extensionInstruction() {
+ return extensionTreatment;
}
public DeviceId deviceId() {
@@ -882,14 +882,14 @@
@Override
public String toString() {
return toStringHelper(type().toString())
- .add("extension", extensionInstruction)
+ .add("extension", extensionTreatment)
.add("deviceId", deviceId)
.toString();
}
@Override
public int hashCode() {
- return Objects.hash(type().ordinal(), extensionInstruction, deviceId);
+ return Objects.hash(type().ordinal(), extensionTreatment, deviceId);
}
@Override
@@ -899,7 +899,7 @@
}
if (obj instanceof ExtensionInstructionWrapper) {
ExtensionInstructionWrapper that = (ExtensionInstructionWrapper) obj;
- return Objects.equals(extensionInstruction, that.extensionInstruction)
+ return Objects.equals(extensionTreatment, that.extensionTreatment)
&& Objects.equals(deviceId, that.deviceId);
}