Try to use ModMplsHeaderInstruction and ModVlanHeaderInstruction

Change-Id: I0b486907ef718a6dfa3e92696397fe5a7e851aed
diff --git a/core/common/src/main/java/org/onosproject/codec/impl/EncodeInstructionCodecHelper.java b/core/common/src/main/java/org/onosproject/codec/impl/EncodeInstructionCodecHelper.java
index 3d1ed2f..d04acf5 100644
--- a/core/common/src/main/java/org/onosproject/codec/impl/EncodeInstructionCodecHelper.java
+++ b/core/common/src/main/java/org/onosproject/codec/impl/EncodeInstructionCodecHelper.java
@@ -142,9 +142,8 @@
                 result.put(InstructionCodec.MPLS_LABEL, modMplsLabelInstruction.label().toInt());
                 break;
             case MPLS_PUSH:
-                final L2ModificationInstruction.PushHeaderInstructions pushHeaderInstructions =
-                        (L2ModificationInstruction.PushHeaderInstructions) l2Instruction;
-
+                final L2ModificationInstruction.ModMplsHeaderInstruction pushHeaderInstructions =
+                        (L2ModificationInstruction.ModMplsHeaderInstruction) l2Instruction;
                 result.put(InstructionCodec.ETHERNET_TYPE,
                         pushHeaderInstructions.ethernetType().toShort());
                 break;
diff --git a/core/common/src/test/java/org/onosproject/codec/impl/FlowRuleCodecTest.java b/core/common/src/test/java/org/onosproject/codec/impl/FlowRuleCodecTest.java
index 2625db2..6b507e1 100644
--- a/core/common/src/test/java/org/onosproject/codec/impl/FlowRuleCodecTest.java
+++ b/core/common/src/test/java/org/onosproject/codec/impl/FlowRuleCodecTest.java
@@ -425,14 +425,14 @@
         instruction = getInstruction(Instruction.Type.L2MODIFICATION,
                 L2ModificationInstruction.L2SubType.MPLS_PUSH.name());
         assertThat(instruction.type(), is(Instruction.Type.L2MODIFICATION));
-        assertThat(((L2ModificationInstruction.PushHeaderInstructions) instruction)
+        assertThat(((L2ModificationInstruction.ModMplsHeaderInstruction) instruction)
                         .ethernetType().toShort(),
                 is(Ethernet.MPLS_UNICAST));
 
         instruction = getInstruction(Instruction.Type.L2MODIFICATION,
                 L2ModificationInstruction.L2SubType.MPLS_POP.name());
         assertThat(instruction.type(), is(Instruction.Type.L2MODIFICATION));
-        assertThat(((L2ModificationInstruction.PushHeaderInstructions) instruction)
+        assertThat(((L2ModificationInstruction.ModMplsHeaderInstruction) instruction)
                         .ethernetType().toShort(),
                 is(Ethernet.MPLS_UNICAST));
 
@@ -444,12 +444,12 @@
         instruction = getInstruction(Instruction.Type.L2MODIFICATION,
                 L2ModificationInstruction.L2SubType.VLAN_POP.name());
         assertThat(instruction.type(), is(Instruction.Type.L2MODIFICATION));
-        assertThat(instruction, instanceOf(L2ModificationInstruction.PopVlanInstruction.class));
+        assertThat(instruction, instanceOf(L2ModificationInstruction.ModVlanHeaderInstruction.class));
 
         instruction = getInstruction(Instruction.Type.L2MODIFICATION,
                 L2ModificationInstruction.L2SubType.VLAN_PUSH.name());
         assertThat(instruction.type(), is(Instruction.Type.L2MODIFICATION));
-        assertThat(instruction, instanceOf(L2ModificationInstruction.PushHeaderInstructions.class));
+        assertThat(instruction, instanceOf(L2ModificationInstruction.ModVlanHeaderInstruction.class));
 
         instruction = getInstruction(Instruction.Type.L2MODIFICATION,
                 L2ModificationInstruction.L2SubType.TUNNEL_ID.name());
diff --git a/core/common/src/test/java/org/onosproject/codec/impl/InstructionCodecTest.java b/core/common/src/test/java/org/onosproject/codec/impl/InstructionCodecTest.java
index 1168a5b..c42d83a 100644
--- a/core/common/src/test/java/org/onosproject/codec/impl/InstructionCodecTest.java
+++ b/core/common/src/test/java/org/onosproject/codec/impl/InstructionCodecTest.java
@@ -15,10 +15,7 @@
  */
 package org.onosproject.codec.impl;
 
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.notNullValue;
-import static org.onosproject.codec.impl.InstructionJsonMatcher.matchesInstruction;
-
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import org.junit.Before;
 import org.junit.Test;
 import org.onlab.packet.Ip4Address;
@@ -40,7 +37,9 @@
 import org.onosproject.net.flow.instructions.L2ModificationInstruction;
 import org.onosproject.net.flow.instructions.L3ModificationInstruction;
 
-import com.fasterxml.jackson.databind.node.ObjectNode;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.notNullValue;
+import static org.onosproject.codec.impl.InstructionJsonMatcher.matchesInstruction;
 
 /**
  * Unit tests for Instruction codec.
@@ -60,12 +59,12 @@
     }
 
     /**
-     * Tests the encoding of push header instructions.
+     * Tests the encoding of push mpls header instructions.
      */
     @Test
     public void pushHeaderInstructionsTest() {
-        final L2ModificationInstruction.PushHeaderInstructions instruction =
-                (L2ModificationInstruction.PushHeaderInstructions) Instructions.pushMpls();
+        final L2ModificationInstruction.ModMplsHeaderInstruction instruction =
+                (L2ModificationInstruction.ModMplsHeaderInstruction) Instructions.pushMpls();
         final ObjectNode instructionJson = instructionCodec.encode(instruction, context);
 
         assertThat(instructionJson, matchesInstruction(instruction));
diff --git a/core/common/src/test/java/org/onosproject/codec/impl/InstructionJsonMatcher.java b/core/common/src/test/java/org/onosproject/codec/impl/InstructionJsonMatcher.java
index d501522..51a9759 100644
--- a/core/common/src/test/java/org/onosproject/codec/impl/InstructionJsonMatcher.java
+++ b/core/common/src/test/java/org/onosproject/codec/impl/InstructionJsonMatcher.java
@@ -29,10 +29,10 @@
 import org.onosproject.net.flow.instructions.L0ModificationInstruction.ModOchSignalInstruction;
 import org.onosproject.net.flow.instructions.L1ModificationInstruction.ModOduSignalIdInstruction;
 import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModEtherInstruction;
+import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModMplsHeaderInstruction;
 import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModMplsLabelInstruction;
 import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanIdInstruction;
 import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanPcpInstruction;
-import org.onosproject.net.flow.instructions.L2ModificationInstruction.PushHeaderInstructions;
 import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPInstruction;
 import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPv6FlowLabelInstruction;
 
@@ -54,10 +54,10 @@
      * @param description Description object used for recording errors
      * @return true if contents match, false otherwise
      */
-    private boolean matchPushHeaderInstruction(JsonNode instructionJson,
-                                               Description description) {
-        PushHeaderInstructions instructionToMatch =
-                (PushHeaderInstructions) instruction;
+    private boolean matchModMplsHeaderInstruction(JsonNode instructionJson,
+                                                  Description description) {
+        ModMplsHeaderInstruction instructionToMatch =
+                (ModMplsHeaderInstruction) instruction;
         final String jsonSubtype = instructionJson.get("subtype").textValue();
         if (!instructionToMatch.subtype().name().equals(jsonSubtype)) {
             description.appendText("subtype was " + jsonSubtype);
@@ -84,6 +84,8 @@
         return true;
     }
 
+    // TODO: need to add matchModVlanHeaderInstruction
+
     /**
      * Matches the contents of an output instruction.
      *
@@ -513,8 +515,8 @@
                 return false;
         }
 
-        if (instruction instanceof PushHeaderInstructions) {
-            return matchPushHeaderInstruction(jsonInstruction, description);
+        if (instruction instanceof ModMplsHeaderInstruction) {
+            return matchModMplsHeaderInstruction(jsonInstruction, description);
         } else if (instruction instanceof OutputInstruction) {
             return matchOutputInstruction(jsonInstruction, description);
         } else if (instruction instanceof GroupInstruction) {