commit | 3ebe170d8707cc559e786e075f0e1f74b53b142c | [log] [tgz] |
---|---|---|
author | Pavlin Radoslavov <pavlin@onlab.us> | Tue Feb 17 09:53:17 2015 -0800 |
committer | Pavlin Radoslavov <pavlin@onlab.us> | Tue Feb 17 21:13:24 2015 +0000 |
tree | 02b38c33147709a53c35418e831fbf61672f27e3 | |
parent | e97fec4ffba7ffaa80222dd9e10da53dd3185995 [diff] |
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
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 6147551..5135557 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
@@ -305,7 +305,7 @@ @Override public String toString() { - return toStringHelper(type().toString()) + return toStringHelper(subtype().toString()) .add("mpls", mplsLabel).toString(); }
diff --git a/utils/misc/src/main/java/org/onlab/packet/MplsLabel.java b/utils/misc/src/main/java/org/onlab/packet/MplsLabel.java index 631325e..1c84945 100644 --- a/utils/misc/src/main/java/org/onlab/packet/MplsLabel.java +++ b/utils/misc/src/main/java/org/onlab/packet/MplsLabel.java
@@ -32,8 +32,10 @@ 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); }