fix remaining signing issues in treatments.
Change-Id: Id5ae44e529a516a4b2593778491ea16ca8dc7937
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 a551f79..049f49a 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
@@ -292,7 +292,7 @@
}
@Override
- public Builder popMpls(Short etherType) {
+ public Builder popMpls(int etherType) {
return add(Instructions.popMpls(etherType));
}
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 08266a7..281e395 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
@@ -190,7 +190,7 @@
* @param etherType an ether type
* @return a treatment builder.
*/
- Builder popMpls(Short etherType);
+ Builder popMpls(int etherType);
/**
* Sets the mpls label.
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 9fdd98a..c673ae0 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
@@ -285,7 +285,7 @@
* @param etherType Ethernet type to set
* @return a L2 modification.
*/
- public static Instruction popMpls(Short etherType) {
+ public static Instruction popMpls(int etherType) {
checkNotNull(etherType, "Ethernet type cannot be null");
return new L2ModificationInstruction.PushHeaderInstructions(
L2ModificationInstruction.L2SubType.MPLS_POP, etherType);
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 d2ea862..b993848 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
@@ -145,16 +145,17 @@
public static final class PushHeaderInstructions extends
L2ModificationInstruction {
+ private static final int MASK = 0xffff;
private final L2SubType subtype;
- private final short ethernetType; // uint16_t
+ private final int ethernetType; // Ethernet type value: 16 bits
- PushHeaderInstructions(L2SubType subType, short ethernetType) {
+ PushHeaderInstructions(L2SubType subType, int ethernetType) {
this.subtype = subType;
- this.ethernetType = ethernetType;
+ this.ethernetType = ethernetType & MASK;
}
public int ethernetType() {
- return Short.toUnsignedInt(ethernetType);
+ return ethernetType;
}
@Override
@@ -239,10 +240,11 @@
*/
public static final class ModVlanPcpInstruction extends L2ModificationInstruction {
- private final Byte vlanPcp;
+ private static final byte MASK = 0x7;
+ private final byte vlanPcp;
- ModVlanPcpInstruction(Byte vlanPcp) {
- this.vlanPcp = vlanPcp;
+ ModVlanPcpInstruction(byte vlanPcp) {
+ this.vlanPcp = (byte) (vlanPcp & MASK);
}
@Override
@@ -250,7 +252,7 @@
return L2SubType.VLAN_PCP;
}
- public Byte vlanPcp() {
+ public byte vlanPcp() {
return this.vlanPcp;
}