ONOS-631 #Initial MPLS intent implementation

Change-Id: I6f906b953f06f395cc67e612648802e333c0e581
diff --git a/web/api/src/main/java/org/onosproject/codec/impl/CriterionCodec.java b/web/api/src/main/java/org/onosproject/codec/impl/CriterionCodec.java
index d270555..0be03d8 100644
--- a/web/api/src/main/java/org/onosproject/codec/impl/CriterionCodec.java
+++ b/web/api/src/main/java/org/onosproject/codec/impl/CriterionCodec.java
@@ -285,7 +285,7 @@
         public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) {
             final Criteria.MplsCriterion mplsCriterion =
                     (Criteria.MplsCriterion) criterion;
-            return root.put("label", mplsCriterion.label());
+            return root.put("label", mplsCriterion.label().toInt());
         }
     }
 
diff --git a/web/api/src/test/java/org/onosproject/codec/impl/CriterionCodecTest.java b/web/api/src/test/java/org/onosproject/codec/impl/CriterionCodecTest.java
index 873424b..a8dc560 100644
--- a/web/api/src/test/java/org/onosproject/codec/impl/CriterionCodecTest.java
+++ b/web/api/src/test/java/org/onosproject/codec/impl/CriterionCodecTest.java
@@ -22,6 +22,7 @@
 import org.onlab.packet.Ip6Address;
 import org.onlab.packet.IpPrefix;
 import org.onlab.packet.MacAddress;
+import org.onlab.packet.MplsLabel;
 import org.onlab.packet.VlanId;
 import org.onosproject.codec.CodecContext;
 import org.onosproject.codec.JsonCodec;
@@ -374,7 +375,7 @@
      */
     @Test
     public void matchMplsLabelTest() {
-        Criterion criterion = Criteria.matchMplsLabel(0xffffe);
+        Criterion criterion = Criteria.matchMplsLabel(MplsLabel.mplsLabel(0xffffe));
         ObjectNode result = criterionCodec.encode(criterion, context);
         assertThat(result, matchesCriterion(criterion));
     }
diff --git a/web/api/src/test/java/org/onosproject/codec/impl/CriterionJsonMatcher.java b/web/api/src/test/java/org/onosproject/codec/impl/CriterionJsonMatcher.java
index 3c5f119..beb9545 100644
--- a/web/api/src/test/java/org/onosproject/codec/impl/CriterionJsonMatcher.java
+++ b/web/api/src/test/java/org/onosproject/codec/impl/CriterionJsonMatcher.java
@@ -397,7 +397,7 @@
      * @return true if the JSON matches the criterion, false otherwise.
      */
     private boolean matchCriterion(Criteria.MplsCriterion criterion) {
-        final int label = criterion.label();
+        final int label = criterion.label().toInt();
         final int jsonLabel = jsonCriterion.get("label").intValue();
         if (label != jsonLabel) {
             description.appendText("label was " + Integer.toString(jsonLabel));
diff --git a/web/api/src/test/java/org/onosproject/codec/impl/InstructionCodecTest.java b/web/api/src/test/java/org/onosproject/codec/impl/InstructionCodecTest.java
index 923573e..78685c1 100644
--- a/web/api/src/test/java/org/onosproject/codec/impl/InstructionCodecTest.java
+++ b/web/api/src/test/java/org/onosproject/codec/impl/InstructionCodecTest.java
@@ -20,6 +20,7 @@
 import org.onlab.packet.Ip4Address;
 import org.onlab.packet.Ip6Address;
 import org.onlab.packet.MacAddress;
+import org.onlab.packet.MplsLabel;
 import org.onlab.packet.VlanId;
 import org.onosproject.codec.CodecContext;
 import org.onosproject.codec.JsonCodec;
@@ -220,7 +221,7 @@
     public void modMplsLabelInstructionTest() {
         final L2ModificationInstruction.ModMplsLabelInstruction instruction =
                 (L2ModificationInstruction.ModMplsLabelInstruction)
-                        Instructions.modMplsLabel(99);
+                        Instructions.modMplsLabel(MplsLabel.mplsLabel(99));
         final ObjectNode instructionJson =
                 instructionCodec.encode(instruction, context);
         assertThat(instructionJson, matchesInstruction(instruction));
diff --git a/web/api/src/test/java/org/onosproject/codec/impl/IntentCodecTest.java b/web/api/src/test/java/org/onosproject/codec/impl/IntentCodecTest.java
index 8814add..919d25d 100644
--- a/web/api/src/test/java/org/onosproject/codec/impl/IntentCodecTest.java
+++ b/web/api/src/test/java/org/onosproject/codec/impl/IntentCodecTest.java
@@ -21,6 +21,7 @@
 import org.junit.Test;
 import org.onlab.packet.IpPrefix;
 import org.onlab.packet.MacAddress;
+import org.onlab.packet.MplsLabel;
 import org.onosproject.codec.CodecContext;
 import org.onosproject.codec.JsonCodec;
 import org.onosproject.core.ApplicationId;
@@ -54,8 +55,6 @@
 import static org.onosproject.codec.impl.IntentJsonMatcher.matchesIntent;
 import static org.onosproject.net.NetTestTools.did;
 import static org.onosproject.net.NetTestTools.hid;
-
-
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.notNullValue;
 
@@ -123,7 +122,7 @@
         DeviceId did3 = did("device3");
         final TrafficSelector selector = DefaultTrafficSelector.builder()
                 .matchIPProtocol((byte) 3)
-                .matchMplsLabel(4)
+                .matchMplsLabel(MplsLabel.mplsLabel(4))
                 .matchOpticalSignalType((short) 5)
                 .matchLambda((short) 6)
                 .matchEthDst(MacAddress.BROADCAST)
@@ -131,7 +130,7 @@
                 .build();
         final TrafficTreatment treatment = DefaultTrafficTreatment.builder()
                 .setLambda((short) 33)
-                .setMpls(44)
+                .setMpls(MplsLabel.mplsLabel(44))
                 .setOutput(PortNumber.CONTROLLER)
                 .setEthDst(MacAddress.BROADCAST)
                 .build();