[ONOS-4718] Add toString, equals, hashCode for LISP control message

Change-Id: I722ab27f50074af26ea92503aac237dec0c64bcf
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapNotify.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapNotify.java
index 1020195..7d55e1e 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapNotify.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapNotify.java
@@ -15,6 +15,7 @@
  */
 package org.onosproject.lisp.msg.protocols;
 
+import com.google.common.base.Objects;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Lists;
 import io.netty.buffer.ByteBuf;
@@ -22,6 +23,8 @@
 
 import java.util.List;
 
+import static com.google.common.base.MoreObjects.toStringHelper;
+
 /**
  * Default LISP map notify message class.
  */
@@ -91,6 +94,36 @@
         return ImmutableList.copyOf(mapRecords);
     }
 
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("type", getType())
+                .add("nonce", nonce)
+                .add("recordCount", recordCount)
+                .add("keyId", keyId)
+                .add("mapRecords", mapRecords).toString();
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+        DefaultLispMapNotify that = (DefaultLispMapNotify) o;
+        return Objects.equal(nonce, that.nonce) &&
+                Objects.equal(recordCount, that.recordCount) &&
+                Objects.equal(keyId, that.keyId) &&
+                Objects.equal(authenticationData, that.authenticationData);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(nonce, recordCount, keyId, authenticationData);
+    }
+
     public static final class DefaultNotifyBuilder implements NotifyBuilder {
 
         private long nonce;
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRegister.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRegister.java
index 8363e83..bbfe3b9 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRegister.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRegister.java
@@ -15,6 +15,7 @@
  */
 package org.onosproject.lisp.msg.protocols;
 
+import com.google.common.base.Objects;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Lists;
 import io.netty.buffer.ByteBuf;
@@ -22,6 +23,8 @@
 
 import java.util.List;
 
+import static com.google.common.base.MoreObjects.toStringHelper;
+
 /**
  * Default LISP map register message class.
  */
@@ -109,6 +112,42 @@
         return ImmutableList.copyOf(mapRecords);
     }
 
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("type", getType())
+                .add("nonce", nonce)
+                .add("recordCount", recordCount)
+                .add("keyId", keyId)
+                .add("mapRecords", mapRecords)
+                .add("proxyMapReply", proxyMapReply)
+                .add("wantMapNotify", wantMapNotify).toString();
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+
+        DefaultLispMapRegister that = (DefaultLispMapRegister) o;
+        return Objects.equal(nonce, that.nonce) &&
+                Objects.equal(recordCount, that.recordCount) &&
+                Objects.equal(keyId, that.keyId) &&
+                Objects.equal(authenticationData, that.authenticationData) &&
+                Objects.equal(proxyMapReply, that.proxyMapReply) &&
+                Objects.equal(wantMapNotify, that.wantMapNotify);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(nonce, recordCount, keyId, authenticationData,
+                                proxyMapReply, wantMapNotify);
+    }
+
     public static final class DefaultRegisterBuilder implements RegisterBuilder {
 
         private long nonce;
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapReply.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapReply.java
index f2a5689..760d1ad 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapReply.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapReply.java
@@ -15,8 +15,11 @@
  */
 package org.onosproject.lisp.msg.protocols;
 
+import com.google.common.base.Objects;
 import io.netty.buffer.ByteBuf;
 
+import static com.google.common.base.MoreObjects.toStringHelper;
+
 /**
  * Default LISP map reply message class.
  */
@@ -86,6 +89,38 @@
         return this.nonce;
     }
 
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("type", getType())
+                .add("nonce", nonce)
+                .add("recordCount", recordCount)
+                .add("probe", probe)
+                .add("etr", etr)
+                .add("security", security).toString();
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+        DefaultLispMapReply that = (DefaultLispMapReply) o;
+        return Objects.equal(nonce, that.nonce) &&
+                Objects.equal(recordCount, that.recordCount) &&
+                Objects.equal(probe, that.probe) &&
+                Objects.equal(etr, that.etr) &&
+                Objects.equal(security, that.security);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(nonce, recordCount, probe, etr, security);
+    }
+
     public static final class DefaultReplyBuilder implements ReplyBuilder {
 
         private long nonce;
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRequest.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRequest.java
index 1ec7dc6..57732ca 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRequest.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRequest.java
@@ -15,6 +15,7 @@
  */
 package org.onosproject.lisp.msg.protocols;
 
+import com.google.common.base.Objects;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Lists;
 import io.netty.buffer.ByteBuf;
@@ -22,6 +23,8 @@
 
 import java.util.List;
 
+import static com.google.common.base.MoreObjects.toStringHelper;
+
 /**
  * Default LISP map request message class.
  */
@@ -141,6 +144,51 @@
         return ImmutableList.copyOf(eidRecords);
     }
 
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("type", getType())
+                .add("nonce", nonce)
+                .add("recordCount", recordCount)
+                .add("source EID", sourceEid)
+                .add("ITR rlocs", itrRlocs)
+                .add("EID records", eidRecords)
+                .add("authoritative", authoritative)
+                .add("mapDataPresent", mapDataPresent)
+                .add("probe", probe)
+                .add("SMR", smr)
+                .add("Proxy ITR", pitr)
+                .add("SMR Invoked", smrInvoked).toString();
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+        DefaultLispMapRequest that = (DefaultLispMapRequest) o;
+        return Objects.equal(nonce, that.nonce) &&
+                Objects.equal(recordCount, that.recordCount) &&
+                Objects.equal(sourceEid, that.sourceEid) &&
+                Objects.equal(itrRlocs, that.itrRlocs) &&
+                Objects.equal(eidRecords, that.eidRecords) &&
+                Objects.equal(authoritative, that.authoritative) &&
+                Objects.equal(mapDataPresent, that.mapDataPresent) &&
+                Objects.equal(probe, that.probe) &&
+                Objects.equal(smr, that.smr) &&
+                Objects.equal(pitr, that.pitr) &&
+                Objects.equal(smrInvoked, that.smrInvoked);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(nonce, recordCount, sourceEid, itrRlocs, eidRecords,
+                authoritative, mapDataPresent, probe, smr, pitr, smrInvoked);
+    }
+
     public static final class DefaultRequestBuilder implements RequestBuilder {
 
         private long nonce;