L2/L3 modification instruction bug fixes

- Fixed instanceOf with wrong type (ONOS-974)
- Aligned #toString() format to be the same as other instructions

Change-Id: I526c2ef8d92660e0b821a10f0cf87ee72a84cdf3
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 b005bfc..c6dd282 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
@@ -304,13 +304,13 @@
 
         @Override
         public String toString() {
-            return toStringHelper(type().toString())
+            return toStringHelper(subtype().toString())
                     .add("mpls", mplsLabel.intValue()).toString();
         }
 
         @Override
         public int hashCode() {
-            return Objects.hash(mplsLabel);
+            return Objects.hash(type(), subtype(), mplsLabel);
         }
 
         @Override
@@ -330,7 +330,7 @@
     }
 
     /**
-     * Represents a MPLS label modification.
+     * Represents a MPLS TTL modification.
      */
     public static final class ModMplsTtlInstruction extends
             L2ModificationInstruction {
@@ -345,12 +345,13 @@
 
         @Override
         public String toString() {
-            return type().toString();
+            return toStringHelper(subtype().toString())
+                    .toString();
         }
 
         @Override
         public int hashCode() {
-            return Objects.hash(type(), L2SubType.DEC_MPLS_TTL);
+            return Objects.hash(type(), subtype());
         }
 
         @Override
@@ -358,9 +359,8 @@
             if (this == obj) {
                 return true;
             }
-            if (obj instanceof ModMplsLabelInstruction) {
-                ModMplsTtlInstruction that = (ModMplsTtlInstruction) obj;
-                return Objects.equals(this.type(), that.type());
+            if (obj instanceof ModMplsTtlInstruction) {
+                return true;
             }
             return false;
         }
diff --git a/core/api/src/main/java/org/onosproject/net/flow/instructions/L3ModificationInstruction.java b/core/api/src/main/java/org/onosproject/net/flow/instructions/L3ModificationInstruction.java
index 139cc18..93e85ef 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/instructions/L3ModificationInstruction.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/instructions/L3ModificationInstruction.java
@@ -119,6 +119,9 @@
         }
     }
 
+    /**
+     * Represents a L3 TTL modification instruction.
+     */
     public static final class ModTtlInstruction extends L3ModificationInstruction {
 
         private final L3SubType subtype;
@@ -134,7 +137,8 @@
 
         @Override
         public String toString() {
-            return subtype().toString();
+            return toStringHelper(subtype().toString())
+                    .toString();
         }
 
         @Override
@@ -147,10 +151,10 @@
             if (this == obj) {
                 return true;
             }
-            if (obj instanceof ModIPInstruction) {
-                ModIPInstruction that = (ModIPInstruction) obj;
-                return  Objects.equals(this.type(), that.type()) &&
-                        Objects.equals(this.subtype(), that.subtype());
+            if (obj instanceof ModTtlInstruction) {
+                ModTtlInstruction that = (ModTtlInstruction) obj;
+                return  Objects.equals(this.subtype(), that.subtype()) &&
+                        Objects.equals(this.type(), that.type());
 
             }
             return false;