Corrected equals & hashcode methods in extension keys 71/9271/1
authorMartin Sunal <msunal@cisco.com>
Wed, 23 Jul 2014 22:17:22 +0000 (00:17 +0200)
committerMartin Sunal <msunal@cisco.com>
Wed, 23 Jul 2014 22:17:22 +0000 (00:17 +0200)
- corrected equals & hashcode methods in keys
- tests for equals & hashcode methods in keys

Signed-off-by: Martin Sunal <msunal@cisco.com>
13 files changed:
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/MessageCodeKey.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/MessageTypeKey.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/ActionDeserializerKey.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/ActionSerializerKey.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/InstructionDeserializerKey.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/InstructionSerializerKey.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/MatchEntryDeserializerKey.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/MatchEntrySerializerKey.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/experimenter/ExperimenterActionDeserializerKey.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/experimenter/ExperimenterActionSerializerKey.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/experimenter/ExperimenterInstructionDeserializerKey.java
openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/experimenter/ExperimenterInstructionSerializerKey.java
openflow-protocol-api/src/test/java/org/opendaylight/openflowjava/protocol/api/keys/extensibility/KeysTest.java [new file with mode: 0644]

index b850eae99fc9560d76f913f9aa28d6ac0f568ac4..86d5a4d158133504413c65cfe9657224ba211dce 100644 (file)
@@ -34,6 +34,7 @@ public class MessageCodeKey {
         int result = 1;\r
         result = prime * result + ((clazz == null) ? 0 : clazz.hashCode());\r
         result = prime * result + msgType;\r
+        result = prime * result + msgVersion;\r
         return result;\r
     }\r
 \r
@@ -43,7 +44,7 @@ public class MessageCodeKey {
             return true;\r
         if (obj == null)\r
             return false;\r
-        if (getClass() != obj.getClass())\r
+        if (!(obj instanceof MessageCodeKey))\r
             return false;\r
         MessageCodeKey other = (MessageCodeKey) obj;\r
         if (clazz == null) {\r
@@ -62,4 +63,5 @@ public class MessageCodeKey {
     public String toString() {\r
         return "msgVersion: " + msgVersion + " objectClass: " + clazz.getName() + " msgType: " + msgType;\r
     }\r
+\r
 }
\ No newline at end of file
index 0ece4c61a194e81b69350bfcf24b1a1a01c57ff5..d5d303e48960e47ad605d391badf15f0f6383b67 100644 (file)
@@ -38,7 +38,8 @@ public class MessageTypeKey<E> {
     public int hashCode() {
         final int prime = 31;
         int result = 1;
-        result = prime * result + ((msgType == null) ? 0 : msgType.getName().hashCode());
+        result = prime * result + ((msgType == null) ? 0 : msgType.hashCode());
+        result = prime * result + msgVersion;
         return result;
     }
 
@@ -48,13 +49,13 @@ public class MessageTypeKey<E> {
             return true;
         if (obj == null)
             return false;
-        if (getClass() != obj.getClass())
+        if (!(obj instanceof MessageTypeKey))
             return false;
         MessageTypeKey<?> other = (MessageTypeKey<?>) obj;
         if (msgType == null) {
             if (other.msgType != null)
                 return false;
-        } else if (!other.msgType.getName().equals(msgType.getName()))
+        } else if (!msgType.equals(other.msgType))
             return false;
         if (msgVersion != other.msgVersion)
             return false;
index d329e7effa78d3874fa1cba70751b5b0bb1fe0d5..db17b3b5b647f057ca5ec8af2408dbc94d88cd96 100644 (file)
@@ -29,13 +29,21 @@ public class ActionDeserializerKey extends MessageCodeKey {
         this.experimenterId = experimenterId;\r
     }\r
 \r
+    @Override\r
+    public int hashCode() {\r
+        final int prime = 31;\r
+        int result = super.hashCode();\r
+        result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());\r
+        return result;\r
+    }\r
+\r
     @Override\r
     public boolean equals(Object obj) {\r
         if (this == obj)\r
             return true;\r
         if (!super.equals(obj))\r
             return false;\r
-        if (getClass() != obj.getClass())\r
+        if (!(obj instanceof ActionDeserializerKey))\r
             return false;\r
         ActionDeserializerKey other = (ActionDeserializerKey) obj;\r
         if (experimenterId == null) {\r
index 623bdea4b9bd238c99cf930b6ac07414f9405481..38b8cd498d075199a3b9f2d7ad294e757e317ed3 100644 (file)
@@ -33,16 +33,24 @@ public class ActionSerializerKey<TYPE extends ActionBase> extends MessageTypeKey
         this.experimenterId = experimenterId;\r
     }\r
 \r
+    @Override\r
+    public int hashCode() {\r
+        final int prime = 31;\r
+        int result = super.hashCode();\r
+        result = prime * result + ((actionType == null) ? 0 : actionType.hashCode());\r
+        result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());\r
+        return result;\r
+    }\r
+\r
     @Override\r
     public boolean equals(Object obj) {\r
         if (this == obj)\r
             return true;\r
         if (!super.equals(obj))\r
             return false;\r
-        if (getClass() != obj.getClass())\r
+        if (!(obj instanceof ActionSerializerKey))\r
             return false;\r
-        @SuppressWarnings("rawtypes")\r
-        ActionSerializerKey other = (ActionSerializerKey) obj;\r
+        ActionSerializerKey<?> other = (ActionSerializerKey<?>) obj;\r
         if (actionType == null) {\r
             if (other.actionType != null)\r
                 return false;\r
index 95a5715b80c465e02f83077697dff541d5a58cb3..91f8977a6b63ee0c3d0d19f508c9c78b20d90b03 100644 (file)
@@ -29,13 +29,21 @@ public class InstructionDeserializerKey extends MessageCodeKey {
         this.experimenterId = experimenterId;\r
     }\r
 \r
+    @Override\r
+    public int hashCode() {\r
+        final int prime = 31;\r
+        int result = super.hashCode();\r
+        result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());\r
+        return result;\r
+    }\r
+\r
     @Override\r
     public boolean equals(Object obj) {\r
         if (this == obj)\r
             return true;\r
         if (!super.equals(obj))\r
             return false;\r
-        if (getClass() != obj.getClass())\r
+        if (!(obj instanceof InstructionDeserializerKey))\r
             return false;\r
         InstructionDeserializerKey other = (InstructionDeserializerKey) obj;\r
         if (experimenterId == null) {\r
index 738156a079f82e0d561e2feaa4421f5b7f3f01ed..899568dc24ae3ac9457bc33f571f92a553eb8f26 100644 (file)
@@ -35,26 +35,34 @@ public class InstructionSerializerKey<TYPE extends InstructionBase>
         this.experimenterId = experimenterId;\r
     }\r
 \r
+    @Override\r
+    public int hashCode() {\r
+        final int prime = 31;\r
+        int result = super.hashCode();\r
+        result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());\r
+        result = prime * result + ((instructionType == null) ? 0 : instructionType.hashCode());\r
+        return result;\r
+    }\r
+\r
     @Override\r
     public boolean equals(Object obj) {\r
         if (this == obj)\r
             return true;\r
         if (!super.equals(obj))\r
             return false;\r
-        if (getClass() != obj.getClass())\r
-            return false;\r
-        @SuppressWarnings("rawtypes")\r
-        InstructionSerializerKey other = (InstructionSerializerKey) obj;\r
-        if (instructionType == null) {\r
-            if (other.instructionType != null)\r
-                return false;\r
-        } else if (!instructionType.equals(other.instructionType))\r
+        if (!(obj instanceof InstructionSerializerKey))\r
             return false;\r
+        InstructionSerializerKey<?> other = (InstructionSerializerKey<?>) obj;\r
         if (experimenterId == null) {\r
             if (other.experimenterId != null)\r
                 return false;\r
         } else if (!experimenterId.equals(other.experimenterId))\r
             return false;\r
+        if (instructionType == null) {\r
+            if (other.instructionType != null)\r
+                return false;\r
+        } else if (!instructionType.equals(other.instructionType))\r
+            return false;\r
         return true;\r
     }\r
 \r
index bf7035615f1a209cc78e9b2362de87f3f0c3defa..593ca8d65358eebe8017356a64d0f7777d4e3faa 100644 (file)
@@ -16,7 +16,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.
  * @author michal.polkorab\r
  *\r
  */\r
-public class MatchEntryDeserializerKey extends MessageCodeKey\r
+public final class MatchEntryDeserializerKey extends MessageCodeKey\r
         implements ExperimenterDeserializerKey {\r
 \r
     private int oxmField;\r
@@ -40,6 +40,15 @@ public class MatchEntryDeserializerKey extends MessageCodeKey
         this.experimenterId = experimenterId;\r
     }\r
 \r
+    @Override\r
+    public int hashCode() {\r
+        final int prime = 31;\r
+        int result = super.hashCode();\r
+        result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());\r
+        result = prime * result + oxmField;\r
+        return result;\r
+    }\r
+\r
     @Override\r
     public boolean equals(Object obj) {\r
         if (this == obj)\r
index 8ceb7ccb197b34b983fed511239268a79c176403..c7f07f6212fd516c23423526bfd01c5b19a784f8 100644 (file)
@@ -19,8 +19,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.
  * @param <OXM_CLASS> oxm_class (see specification)\r
  * @param <OXM_FIELD> oxm_field (see specification)\r
  */\r
-public class MatchEntrySerializerKey<OXM_CLASS extends OxmClassBase, OXM_FIELD extends MatchField>\r
-        extends MessageTypeKey<MatchEntries> implements ExperimenterSerializerKey{\r
+public final class MatchEntrySerializerKey<OXM_CLASS extends OxmClassBase, OXM_FIELD extends MatchField>\r
+        extends MessageTypeKey<MatchEntries> implements ExperimenterSerializerKey {\r
 \r
     private Class<OXM_CLASS> oxmClass;\r
     private Class<OXM_FIELD> oxmField;\r
@@ -46,6 +46,16 @@ public class MatchEntrySerializerKey<OXM_CLASS extends OxmClassBase, OXM_FIELD e
         this.experimenterId = experimenterId;\r
     }\r
 \r
+    @Override\r
+    public int hashCode() {\r
+        final int prime = 31;\r
+        int result = super.hashCode();\r
+        result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());\r
+        result = prime * result + ((oxmClass == null) ? 0 : oxmClass.hashCode());\r
+        result = prime * result + ((oxmField == null) ? 0 : oxmField.hashCode());\r
+        return result;\r
+    }\r
+\r
     @Override\r
     public boolean equals(Object obj) {\r
         if (this == obj)\r
@@ -54,8 +64,7 @@ public class MatchEntrySerializerKey<OXM_CLASS extends OxmClassBase, OXM_FIELD e
             return false;\r
         if (getClass() != obj.getClass())\r
             return false;\r
-        @SuppressWarnings("rawtypes")\r
-        MatchEntrySerializerKey other = (MatchEntrySerializerKey) obj;\r
+        MatchEntrySerializerKey<?, ?> other = (MatchEntrySerializerKey<?, ?>) obj;\r
         if (experimenterId == null) {\r
             if (other.experimenterId != null)\r
                 return false;\r
index 1b21379e79ddd15ace24867eb488ec8f9dbe9995..b700f04b3ee949da1a8259e2c32fb90f0305a895 100644 (file)
@@ -8,46 +8,22 @@
 \r
 package org.opendaylight.openflowjava.protocol.api.keys.experimenter;\r
 \r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
+import org.opendaylight.openflowjava.protocol.api.keys.ActionDeserializerKey;\r
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
 \r
 /**\r
  * @author michal.polkorab\r
  *\r
  */\r
-public class ExperimenterActionDeserializerKey extends MessageCodeKey \r
+public final class ExperimenterActionDeserializerKey extends ActionDeserializerKey \r
         implements ExperimenterDeserializerKey {\r
 \r
-    private Long experimenterId;\r
     /**\r
      * @param version protocol wire version\r
      * @param experimenterId experimenter / vendor ID\r
      */\r
     public ExperimenterActionDeserializerKey(short version, Long experimenterId) {\r
-        super(version, EncodeConstants.EXPERIMENTER_VALUE, Action.class);\r
-        this.experimenterId = experimenterId;\r
+        super(version, EncodeConstants.EXPERIMENTER_VALUE, experimenterId);\r
     }\r
 \r
-    @Override\r
-    public boolean equals(Object obj) {\r
-        if (this == obj)\r
-            return true;\r
-        if (!super.equals(obj))\r
-            return false;\r
-        if (getClass() != obj.getClass())\r
-            return false;\r
-        ExperimenterActionDeserializerKey other = (ExperimenterActionDeserializerKey) obj;\r
-        if (experimenterId == null) {\r
-            if (other.experimenterId != null)\r
-                return false;\r
-        } else if (!experimenterId.equals(other.experimenterId))\r
-            return false;\r
-        return true;\r
-    }\r
-\r
-    @Override\r
-    public String toString() {\r
-        return super.toString() + " experimenterID: " + experimenterId;\r
-    }\r
 }
\ No newline at end of file
index 23e4640cf718a1eef1c4cd618adb51839da24227..989e1ba769a8d3d2a8dfe653191406c8df897b49 100644 (file)
@@ -8,54 +8,21 @@
 \r
 package org.opendaylight.openflowjava.protocol.api.keys.experimenter;\r
 \r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
+import org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase;\r
 \r
 /**\r
  * @author michal.polkorab\r
  */\r
-public class ExperimenterActionSerializerKey extends MessageTypeKey<Action\r
+public final class ExperimenterActionSerializerKey extends ActionSerializerKey<Experimenter\r
         implements ExperimenterSerializerKey {\r
 \r
-    private Class<? extends ActionBase> actionType;\r
-    private Long experimenterId;\r
-\r
     /**\r
      * @param msgVersion protocol wire version\r
      * @param experimenterId experimenter / vendor ID\r
      */\r
     public ExperimenterActionSerializerKey(short msgVersion, Long experimenterId) {\r
-        super(msgVersion, Action.class);\r
-        this.actionType = Experimenter.class;\r
-        this.experimenterId = experimenterId;\r
-    }\r
-\r
-    @Override\r
-    public boolean equals(Object obj) {\r
-        if (this == obj)\r
-            return true;\r
-        if (!super.equals(obj))\r
-            return false;\r
-        if (getClass() != obj.getClass())\r
-            return false;\r
-        ExperimenterActionSerializerKey other = (ExperimenterActionSerializerKey) obj;\r
-        if (actionType == null) {\r
-            if (other.actionType != null)\r
-                return false;\r
-        } else if (!actionType.equals(other.actionType))\r
-            return false;\r
-        if (experimenterId == null) {\r
-            if (other.experimenterId != null)\r
-                return false;\r
-        } else if (!experimenterId.equals(other.experimenterId))\r
-            return false;\r
-        return true;\r
+        super(msgVersion, Experimenter.class, experimenterId);\r
     }\r
 \r
-    @Override\r
-    public String toString() {\r
-        return super.toString() + " action type: " + actionType.getName() + " experimenterID: " + experimenterId;\r
-    }\r
 }
\ No newline at end of file
index 12270310da3b0b8c5feac66123dd61c7d12c7c09..cfe995692ddad3b2f40daeec9177567687455c4b 100644 (file)
@@ -8,46 +8,22 @@
 \r
 package org.opendaylight.openflowjava.protocol.api.keys.experimenter;\r
 \r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
+import org.opendaylight.openflowjava.protocol.api.keys.InstructionDeserializerKey;\r
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
 \r
 /**\r
  * @author michal.polkorab\r
  *\r
  */\r
-public class ExperimenterInstructionDeserializerKey extends MessageCodeKey\r
+public final class ExperimenterInstructionDeserializerKey extends InstructionDeserializerKey\r
         implements ExperimenterDeserializerKey {\r
 \r
-    private Long experimenterId;\r
     /**\r
      * @param version protocol wire version\r
      * @param experimenterId \r
      */\r
     public ExperimenterInstructionDeserializerKey(short version, Long experimenterId) {\r
-        super(version, EncodeConstants.EXPERIMENTER_VALUE, Instruction.class);\r
-        this.experimenterId = experimenterId;\r
+        super(version, EncodeConstants.EXPERIMENTER_VALUE, experimenterId);\r
     }\r
 \r
-    @Override\r
-    public boolean equals(Object obj) {\r
-        if (this == obj)\r
-            return true;\r
-        if (!super.equals(obj))\r
-            return false;\r
-        if (getClass() != obj.getClass())\r
-            return false;\r
-        ExperimenterInstructionDeserializerKey other = (ExperimenterInstructionDeserializerKey) obj;\r
-        if (experimenterId == null) {\r
-            if (other.experimenterId != null)\r
-                return false;\r
-        } else if (!experimenterId.equals(other.experimenterId))\r
-            return false;\r
-        return true;\r
-    }\r
-\r
-    @Override\r
-    public String toString() {\r
-        return super.toString() + " experimenterID: " + experimenterId;\r
-    }\r
 }
\ No newline at end of file
index 0a4541b19ef0a713bf68875e4e27babae2f51634..28201506eef02b8a3a8749d02637ee85eb6efd45 100644 (file)
@@ -8,55 +8,21 @@
 \r
 package org.opendaylight.openflowjava.protocol.api.keys.experimenter;\r
 \r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
+import org.opendaylight.openflowjava.protocol.api.keys.InstructionSerializerKey;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Experimenter;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.InstructionBase;\r
 \r
 /**\r
  * @author michal.polkorab\r
  */\r
-public class ExperimenterInstructionSerializerKey extends MessageTypeKey<Instruction>\r
+public final class ExperimenterInstructionSerializerKey extends InstructionSerializerKey<Experimenter>\r
         implements ExperimenterSerializerKey {\r
 \r
-    private Class<? extends InstructionBase> instructionType;\r
-    private Long experimenterId;\r
-\r
     /**\r
      * @param msgVersion protocol wire version\r
      * @param experimenterId experimenter / vendor ID\r
      */\r
     public ExperimenterInstructionSerializerKey(short msgVersion, Long experimenterId) {\r
-        super(msgVersion, Instruction.class);\r
-        this.instructionType = Experimenter.class;\r
-        this.experimenterId = experimenterId;\r
-    }\r
-\r
-    @Override\r
-    public boolean equals(Object obj) {\r
-        if (this == obj)\r
-            return true;\r
-        if (!super.equals(obj))\r
-            return false;\r
-        if (getClass() != obj.getClass())\r
-            return false;\r
-        ExperimenterInstructionSerializerKey other = (ExperimenterInstructionSerializerKey) obj;\r
-        if (instructionType == null) {\r
-            if (other.instructionType != null)\r
-                return false;\r
-        } else if (!instructionType.equals(other.instructionType))\r
-            return false;\r
-        if (experimenterId == null) {\r
-            if (other.experimenterId != null)\r
-                return false;\r
-        } else if (!experimenterId.equals(other.experimenterId))\r
-            return false;\r
-        return true;\r
+        super(msgVersion, Experimenter.class, experimenterId);\r
     }\r
 \r
-    @Override\r
-    public String toString() {\r
-        return super.toString() + " instructionType type: " + instructionType.getName()\r
-                + " vendorID: " + experimenterId;\r
-    }\r
 }
\ No newline at end of file
diff --git a/openflow-protocol-api/src/test/java/org/opendaylight/openflowjava/protocol/api/keys/extensibility/KeysTest.java b/openflow-protocol-api/src/test/java/org/opendaylight/openflowjava/protocol/api/keys/extensibility/KeysTest.java
new file mode 100644 (file)
index 0000000..9b4cf74
--- /dev/null
@@ -0,0 +1,65 @@
+package org.opendaylight.openflowjava.protocol.api.keys.extensibility;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.keys.ActionDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.InstructionDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.InstructionSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterActionDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterActionSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterInstructionDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterInstructionSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;
+
+/**
+ * @author michal.polkorab
+ */
+public class KeysTest {
+
+    /**
+     * Testing equals() and hashcode() methods of extension deserializer's keys
+     */
+    @Test
+    public void testEqualsAndHashcodeOfDeserializerKeys() {
+        ActionDeserializerKey actionDeserializerKey = new ActionDeserializerKey(EncodeConstants.OF13_VERSION_ID,
+                EncodeConstants.EXPERIMENTER_VALUE, 1L);
+        ExperimenterActionDeserializerKey experimenterActionDeserializerKey = new ExperimenterActionDeserializerKey(
+                EncodeConstants.OF13_VERSION_ID, 1L);
+        Assert.assertEquals(actionDeserializerKey, experimenterActionDeserializerKey);
+        Assert.assertEquals(actionDeserializerKey.hashCode(), experimenterActionDeserializerKey.hashCode());
+
+        InstructionDeserializerKey instructionDeserializerKey = new InstructionDeserializerKey(
+                EncodeConstants.OF13_VERSION_ID, EncodeConstants.EXPERIMENTER_VALUE, 1L);
+        ExperimenterInstructionDeserializerKey experimenterInstructionDeserializerKey = new ExperimenterInstructionDeserializerKey(
+                EncodeConstants.OF13_VERSION_ID, 1L);
+        Assert.assertEquals(instructionDeserializerKey, experimenterInstructionDeserializerKey);
+        Assert.assertEquals(instructionDeserializerKey.hashCode(), experimenterInstructionDeserializerKey.hashCode());
+        
+        
+    }
+
+    /**
+     * Testing equals() and hashcode() methods of extension serializer's keys
+     */
+    @Test
+    public void testEqualsAndHashcodeOfActionDeserializerKeys() {
+        ActionSerializerKey<Experimenter> actionSerializerKey = new ActionSerializerKey<>(
+                EncodeConstants.OF13_VERSION_ID, Experimenter.class, 1L);
+        ExperimenterActionSerializerKey experimenterActionSerializerKey = new ExperimenterActionSerializerKey(
+                EncodeConstants.OF13_VERSION_ID, 1L);
+        Assert.assertEquals(actionSerializerKey, experimenterActionSerializerKey);
+        Assert.assertEquals(actionSerializerKey.hashCode(), experimenterActionSerializerKey.hashCode());
+
+        InstructionSerializerKey<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Experimenter> instructionSerializerKey = new InstructionSerializerKey<>(
+                EncodeConstants.OF13_VERSION_ID,
+                org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Experimenter.class,
+                1L);
+        ExperimenterInstructionSerializerKey experimenterInstructionSerializerKey = new ExperimenterInstructionSerializerKey(EncodeConstants.OF13_VERSION_ID, 1L);
+        Assert.assertEquals(instructionSerializerKey, experimenterInstructionSerializerKey);
+        Assert.assertEquals(instructionSerializerKey.hashCode(), experimenterInstructionSerializerKey.hashCode());
+    }
+
+}