alshabib
Committed by Gerrit Code Review

fix remaining signing issues in treatments.

Change-Id: Id5ae44e529a516a4b2593778491ea16ca8dc7937
......@@ -292,7 +292,7 @@ public final class DefaultTrafficTreatment implements TrafficTreatment {
}
@Override
public Builder popMpls(Short etherType) {
public Builder popMpls(int etherType) {
return add(Instructions.popMpls(etherType));
}
......
......@@ -190,7 +190,7 @@ public interface TrafficTreatment {
* @param etherType an ether type
* @return a treatment builder.
*/
Builder popMpls(Short etherType);
Builder popMpls(int etherType);
/**
* Sets the mpls label.
......
......@@ -285,7 +285,7 @@ public final class Instructions {
* @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);
......
......@@ -145,16 +145,17 @@ public abstract class L2ModificationInstruction implements Instruction {
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 abstract class L2ModificationInstruction implements Instruction {
*/
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 @@ public abstract class L2ModificationInstruction implements Instruction {
return L2SubType.VLAN_PCP;
}
public Byte vlanPcp() {
public byte vlanPcp() {
return this.vlanPcp;
}
......