Implement missing equals() and hashCode() like LinkEvent

Change-Id: I8c6fe8fce831ad62ffcb1f0513a659f56e04101c
diff --git a/src/main/java/net/onrc/onos/core/topology/PortEvent.java b/src/main/java/net/onrc/onos/core/topology/PortEvent.java
index 39af378..57c648c 100644
--- a/src/main/java/net/onrc/onos/core/topology/PortEvent.java
+++ b/src/main/java/net/onrc/onos/core/topology/PortEvent.java
@@ -4,6 +4,7 @@
 import org.codehaus.jackson.map.annotate.JsonSerialize;
 
 import java.nio.ByteBuffer;
+import java.util.Objects;
 
 /**
  * Self-contained Port event Object.
@@ -108,6 +109,25 @@
     }
 
     @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+
+        if (!(o instanceof PortEvent)) {
+            return false;
+        }
+
+        PortEvent that = (PortEvent) o;
+        return Objects.equals(this.id, that.id);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(id);
+    }
+
+    @Override
     public String toString() {
         return "[PortEvent 0x" + Long.toHexString(id.dpid) + "@" + id.number + "]";
     }
diff --git a/src/main/java/net/onrc/onos/core/topology/SwitchEvent.java b/src/main/java/net/onrc/onos/core/topology/SwitchEvent.java
index 16475f0..554651e 100644
--- a/src/main/java/net/onrc/onos/core/topology/SwitchEvent.java
+++ b/src/main/java/net/onrc/onos/core/topology/SwitchEvent.java
@@ -3,6 +3,7 @@
 import net.onrc.onos.core.util.Dpid;
 
 import java.nio.ByteBuffer;
+import java.util.Objects;
 
 /**
  * Self-contained Switch Object.
@@ -29,6 +30,25 @@
     }
 
     @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+
+        if (!(o instanceof SwitchEvent)) {
+            return false;
+        }
+
+        SwitchEvent that = (SwitchEvent) o;
+        return Objects.equals(this.dpid, that.dpid);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(dpid);
+    }
+
+    @Override
     public String toString() {
         return "[SwitchEvent 0x" + Long.toHexString(dpid.value()) + "]";
     }