small fixes to ethtype pattern
Change-Id: Ic58c426821952f66aa21bc828d36fd4f83d8da0d
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 500ac1c..9703e1c 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
@@ -15,7 +15,7 @@
*/
package org.onosproject.net.flow.instructions;
-import org.onlab.packet.Ethernet;
+import org.onlab.packet.EthType;
import org.onlab.packet.IpAddress;
import org.onlab.packet.MacAddress;
import org.onlab.packet.MplsLabel;
@@ -265,7 +265,7 @@
public static Instruction pushMpls() {
return new L2ModificationInstruction.PushHeaderInstructions(
L2ModificationInstruction.L2SubType.MPLS_PUSH,
- Ethernet.MPLS_UNICAST);
+ EthType.EtherType.MPLS_UNICAST.ethType());
}
/**
@@ -276,7 +276,7 @@
public static Instruction popMpls() {
return new L2ModificationInstruction.PushHeaderInstructions(
L2ModificationInstruction.L2SubType.MPLS_POP,
- Ethernet.MPLS_UNICAST);
+ EthType.EtherType.MPLS_UNICAST.ethType());
}
/**
@@ -285,9 +285,23 @@
* @param etherType Ethernet type to set
* @return a L2 modification.
*/
+ @Deprecated
public static Instruction popMpls(int etherType) {
checkNotNull(etherType, "Ethernet type cannot be null");
return new L2ModificationInstruction.PushHeaderInstructions(
+ L2ModificationInstruction.L2SubType.MPLS_POP, new EthType(etherType));
+ }
+
+
+ /**
+ * Creates a pop MPLS header instruction with a particular ethertype.
+ *
+ * @param etherType Ethernet type to set
+ * @return a L2 modification.
+ */
+ public static Instruction popMpls(EthType etherType) {
+ checkNotNull(etherType, "Ethernet type cannot be null");
+ return new L2ModificationInstruction.PushHeaderInstructions(
L2ModificationInstruction.L2SubType.MPLS_POP, etherType);
}
@@ -308,7 +322,8 @@
*/
public static Instruction pushVlan() {
return new L2ModificationInstruction.PushHeaderInstructions(
- L2ModificationInstruction.L2SubType.VLAN_PUSH, Ethernet.TYPE_VLAN);
+ L2ModificationInstruction.L2SubType.VLAN_PUSH,
+ EthType.EtherType.VLAN.ethType());
}
/**