Deprecate PushHeaderInstructions and PopVlanInstruction
PushHeaderInstruction is used by mpls header push, pop, vlan header
push. Also PopVlanInstruction should be augmented to cover vlan
header push case.
Change-Id: Ic0da77b1f86e1e4a396080caa463d1d727b4c7dd
(cherry picked from commit ddfd2ebacc8db6ca9ce1fc53f85d2d0f5d91be10)
diff --git a/core/api/src/main/java/org/onosproject/net/flow/instructions/L2ModificationInstruction.java b/core/api/src/main/java/org/onosproject/net/flow/instructions/L2ModificationInstruction.java
index 2b11584..5f32a3c 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/instructions/L2ModificationInstruction.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/instructions/L2ModificationInstruction.java
@@ -148,7 +148,11 @@
}
}
- // TODO This instruction is reused for Pop-Mpls. Consider renaming.
+ /**
+ * @deprecated 1.6.0 Goldeneye release.
+ * Recommended to use ModMplsHeaderInstruction or ModVlanHeaderInstruction instead.
+ */
+ @Deprecated
public static final class PushHeaderInstructions extends
L2ModificationInstruction {
@@ -194,7 +198,51 @@
}
}
+ /**
+ * Represents a MPLS header modification instruction.
+ */
+ public static final class ModMplsHeaderInstruction extends L2ModificationInstruction {
+ private final L2SubType subtype;
+ private final EthType ethernetType; // Ethernet type value: 16 bits
+
+ ModMplsHeaderInstruction(L2SubType subType, EthType ethernetType) {
+ this.subtype = subType;
+ this.ethernetType = ethernetType;
+ }
+
+ public EthType ethernetType() {
+ return ethernetType;
+ }
+
+ @Override
+ public L2SubType subtype() {
+ return subtype;
+ }
+
+ @Override
+ public String toString() {
+ return subtype().toString() + SEPARATOR + ethernetType;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(type(), subtype, ethernetType);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof ModMplsHeaderInstruction) {
+ ModMplsHeaderInstruction that = (ModMplsHeaderInstruction) obj;
+ return Objects.equals(subtype, that.subtype) &&
+ Objects.equals(this.ethernetType, that.ethernetType);
+ }
+ return false;
+ }
+ }
/**
* Represents a VLAN id modification instruction.
@@ -285,7 +333,10 @@
/**
* Represents a VLAN POP modification instruction.
+ * @deprecated 1.6.0 Goldeneye release.
+ * Recommended to use ModVlanHeaderInstruction instead.
*/
+ @Deprecated
public static final class PopVlanInstruction extends L2ModificationInstruction {
private final L2SubType subtype;
@@ -322,6 +373,56 @@
}
/**
+ * Represents a VLAN Header modification instruction.
+ */
+ public static final class ModVlanHeaderInstruction extends L2ModificationInstruction {
+
+ private final L2SubType subtype;
+ private EthType ethernetType; // Ethernet type value: 16 bits
+
+ ModVlanHeaderInstruction(L2SubType subType, EthType ethernetType) {
+ this.subtype = subType;
+ this.ethernetType = ethernetType;
+ }
+
+ ModVlanHeaderInstruction(L2SubType subType) {
+ this(subType, EthType.EtherType.UNKNOWN.ethType());
+ }
+
+ public EthType ethernetType() {
+ return ethernetType;
+ }
+
+ @Override
+ public L2SubType subtype() {
+ return subtype;
+ }
+
+ @Override
+ public String toString() {
+ return subtype().toString() + SEPARATOR + ethernetType;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(type(), subtype, ethernetType);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof ModVlanHeaderInstruction) {
+ ModVlanHeaderInstruction that = (ModVlanHeaderInstruction) obj;
+ return Objects.equals(subtype, that.subtype) &&
+ Objects.equals(this.ethernetType, that.ethernetType);
+ }
+ return false;
+ }
+ }
+
+ /**
* Represents a MPLS label modification.
*/
public static final class ModMplsLabelInstruction