[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;