Pavlin Radoslavov

MPLS-related bug fixes:

 - Use subtype() instead of type() inside method
   ModMplsLabelInstruction.toString()
 - Check whether the MPLS value is negative inside the MplsLabel()
   constructor.

Change-Id: I770194774219f0c919474928803e078226f2005d
......@@ -305,7 +305,7 @@ public abstract class L2ModificationInstruction implements Instruction {
@Override
public String toString() {
return toStringHelper(type().toString())
return toStringHelper(subtype().toString())
.add("mpls", mplsLabel).toString();
}
......
......@@ -32,8 +32,10 @@ public class MplsLabel {
public static MplsLabel mplsLabel(int value) {
if (value > MAX_MPLS) {
throw new IllegalArgumentException("value exceeds allowed maximum MPLS label value (0xFFFFF)");
if (value < 0 || value > MAX_MPLS) {
String errorMsg = "MPLS label value " + value +
" is not in the interval [0, 0xFFFFF]";
throw new IllegalArgumentException(errorMsg);
}
return new MplsLabel(value);
}
......