Committed by
Gerrit Code Review
fix remaining signing issues in treatments.
Change-Id: Id5ae44e529a516a4b2593778491ea16ca8dc7937
Showing
4 changed files
with
13 additions
and
11 deletions
| ... | @@ -292,7 +292,7 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { | ... | @@ -292,7 +292,7 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { |
| 292 | } | 292 | } |
| 293 | 293 | ||
| 294 | @Override | 294 | @Override |
| 295 | - public Builder popMpls(Short etherType) { | 295 | + public Builder popMpls(int etherType) { |
| 296 | return add(Instructions.popMpls(etherType)); | 296 | return add(Instructions.popMpls(etherType)); |
| 297 | } | 297 | } |
| 298 | 298 | ... | ... |
| ... | @@ -190,7 +190,7 @@ public interface TrafficTreatment { | ... | @@ -190,7 +190,7 @@ public interface TrafficTreatment { |
| 190 | * @param etherType an ether type | 190 | * @param etherType an ether type |
| 191 | * @return a treatment builder. | 191 | * @return a treatment builder. |
| 192 | */ | 192 | */ |
| 193 | - Builder popMpls(Short etherType); | 193 | + Builder popMpls(int etherType); |
| 194 | 194 | ||
| 195 | /** | 195 | /** |
| 196 | * Sets the mpls label. | 196 | * Sets the mpls label. | ... | ... |
| ... | @@ -285,7 +285,7 @@ public final class Instructions { | ... | @@ -285,7 +285,7 @@ public final class Instructions { |
| 285 | * @param etherType Ethernet type to set | 285 | * @param etherType Ethernet type to set |
| 286 | * @return a L2 modification. | 286 | * @return a L2 modification. |
| 287 | */ | 287 | */ |
| 288 | - public static Instruction popMpls(Short etherType) { | 288 | + public static Instruction popMpls(int etherType) { |
| 289 | checkNotNull(etherType, "Ethernet type cannot be null"); | 289 | checkNotNull(etherType, "Ethernet type cannot be null"); |
| 290 | return new L2ModificationInstruction.PushHeaderInstructions( | 290 | return new L2ModificationInstruction.PushHeaderInstructions( |
| 291 | L2ModificationInstruction.L2SubType.MPLS_POP, etherType); | 291 | L2ModificationInstruction.L2SubType.MPLS_POP, etherType); | ... | ... |
| ... | @@ -145,16 +145,17 @@ public abstract class L2ModificationInstruction implements Instruction { | ... | @@ -145,16 +145,17 @@ public abstract class L2ModificationInstruction implements Instruction { |
| 145 | public static final class PushHeaderInstructions extends | 145 | public static final class PushHeaderInstructions extends |
| 146 | L2ModificationInstruction { | 146 | L2ModificationInstruction { |
| 147 | 147 | ||
| 148 | + private static final int MASK = 0xffff; | ||
| 148 | private final L2SubType subtype; | 149 | private final L2SubType subtype; |
| 149 | - private final short ethernetType; // uint16_t | 150 | + private final int ethernetType; // Ethernet type value: 16 bits |
| 150 | 151 | ||
| 151 | - PushHeaderInstructions(L2SubType subType, short ethernetType) { | 152 | + PushHeaderInstructions(L2SubType subType, int ethernetType) { |
| 152 | this.subtype = subType; | 153 | this.subtype = subType; |
| 153 | - this.ethernetType = ethernetType; | 154 | + this.ethernetType = ethernetType & MASK; |
| 154 | } | 155 | } |
| 155 | 156 | ||
| 156 | public int ethernetType() { | 157 | public int ethernetType() { |
| 157 | - return Short.toUnsignedInt(ethernetType); | 158 | + return ethernetType; |
| 158 | } | 159 | } |
| 159 | 160 | ||
| 160 | @Override | 161 | @Override |
| ... | @@ -239,10 +240,11 @@ public abstract class L2ModificationInstruction implements Instruction { | ... | @@ -239,10 +240,11 @@ public abstract class L2ModificationInstruction implements Instruction { |
| 239 | */ | 240 | */ |
| 240 | public static final class ModVlanPcpInstruction extends L2ModificationInstruction { | 241 | public static final class ModVlanPcpInstruction extends L2ModificationInstruction { |
| 241 | 242 | ||
| 242 | - private final Byte vlanPcp; | 243 | + private static final byte MASK = 0x7; |
| 244 | + private final byte vlanPcp; | ||
| 243 | 245 | ||
| 244 | - ModVlanPcpInstruction(Byte vlanPcp) { | 246 | + ModVlanPcpInstruction(byte vlanPcp) { |
| 245 | - this.vlanPcp = vlanPcp; | 247 | + this.vlanPcp = (byte) (vlanPcp & MASK); |
| 246 | } | 248 | } |
| 247 | 249 | ||
| 248 | @Override | 250 | @Override |
| ... | @@ -250,7 +252,7 @@ public abstract class L2ModificationInstruction implements Instruction { | ... | @@ -250,7 +252,7 @@ public abstract class L2ModificationInstruction implements Instruction { |
| 250 | return L2SubType.VLAN_PCP; | 252 | return L2SubType.VLAN_PCP; |
| 251 | } | 253 | } |
| 252 | 254 | ||
| 253 | - public Byte vlanPcp() { | 255 | + public byte vlanPcp() { |
| 254 | return this.vlanPcp; | 256 | return this.vlanPcp; |
| 255 | } | 257 | } |
| 256 | 258 | ... | ... |
-
Please register or login to post a comment