equals for {Device,Port,Link,Host}Description

Change-Id: Ia69a469ed7b3ef183e45b3fb4d110edcbb4f3aad
diff --git a/core/api/src/main/java/org/onosproject/net/device/DefaultDeviceDescription.java b/core/api/src/main/java/org/onosproject/net/device/DefaultDeviceDescription.java
index 0fcc800..9074792 100644
--- a/core/api/src/main/java/org/onosproject/net/device/DefaultDeviceDescription.java
+++ b/core/api/src/main/java/org/onosproject/net/device/DefaultDeviceDescription.java
@@ -24,6 +24,7 @@
 import static com.google.common.base.MoreObjects.toStringHelper;
 import static com.google.common.base.Preconditions.checkNotNull;
 import static org.onosproject.net.Device.Type;
+import com.google.common.base.Objects;
 
 /**
  * Default implementation of immutable device description entity.
@@ -132,6 +133,30 @@
                 .toString();
     }
 
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(super.hashCode(), uri, type, manufacturer,
+                                hwVersion, swVersion, serialNumber, chassisId);
+    }
+
+    @Override
+    public boolean equals(Object object) {
+        if (object instanceof DefaultDeviceDescription) {
+            if (!super.equals(object)) {
+                return false;
+            }
+            DefaultDeviceDescription that = (DefaultDeviceDescription) object;
+            return Objects.equal(this.uri, that.uri)
+                    && Objects.equal(this.type, that.type)
+                    && Objects.equal(this.manufacturer, that.manufacturer)
+                    && Objects.equal(this.hwVersion, that.hwVersion)
+                    && Objects.equal(this.swVersion, that.swVersion)
+                    && Objects.equal(this.serialNumber, that.serialNumber)
+                    && Objects.equal(this.chassisId, that.chassisId);
+        }
+        return false;
+    }
+
     // default constructor for serialization
     private DefaultDeviceDescription() {
         this.uri = null;