Use Dpid class to represent DPID instead of Long for type safety

- Signatures of public methods are not changed
- Only private fields are changed to keep compatibility

Change-Id: I1d54fa54ede9b09439944cfb5f53564ff22ac339
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 36cf8cf..16475f0 100644
--- a/src/main/java/net/onrc/onos/core/topology/SwitchEvent.java
+++ b/src/main/java/net/onrc/onos/core/topology/SwitchEvent.java
@@ -1,5 +1,7 @@
 package net.onrc.onos.core.topology;
 
+import net.onrc.onos.core.util.Dpid;
+
 import java.nio.ByteBuffer;
 
 /**
@@ -8,7 +10,7 @@
  * TODO: We probably want common base class/interface for Self-Contained Event Object.
  */
 public class SwitchEvent {
-    protected final Long dpid;
+    protected final Dpid dpid;
 
     /**
      * Default constructor for Serializer to use.
@@ -19,16 +21,16 @@
     }
 
     public SwitchEvent(Long dpid) {
-        this.dpid = dpid;
+        this.dpid = new Dpid(dpid);
     }
 
     public Long getDpid() {
-        return dpid;
+        return dpid.value();
     }
 
     @Override
     public String toString() {
-        return "[SwitchEvent 0x" + Long.toHexString(dpid) + "]";
+        return "[SwitchEvent 0x" + Long.toHexString(dpid.value()) + "]";
     }
 
     public static final int SWITCHID_BYTES = 2 + 8;
@@ -41,10 +43,10 @@
     }
 
     public byte[] getID() {
-        return getSwitchID(dpid).array();
+        return getSwitchID(dpid.value()).array();
     }
 
     public ByteBuffer getIDasByteBuffer() {
-        return getSwitchID(dpid);
+        return getSwitchID(dpid.value());
     }
 }
diff --git a/src/main/java/net/onrc/onos/core/topology/SwitchImpl.java b/src/main/java/net/onrc/onos/core/topology/SwitchImpl.java
index 5d287a8..ee0eebd 100644
--- a/src/main/java/net/onrc/onos/core/topology/SwitchImpl.java
+++ b/src/main/java/net/onrc/onos/core/topology/SwitchImpl.java
@@ -1,5 +1,7 @@
 package net.onrc.onos.core.topology;
 
+import net.onrc.onos.core.util.Dpid;
+
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -18,12 +20,16 @@
  */
 public class SwitchImpl extends TopologyObject implements Switch {
 
-    private Long dpid;
+    private Dpid dpid;
     // These needs to be ConcurrentCollecton if allowing the topology to be
     // accessed concurrently
     private final Map<Long, Port> ports;
 
     public SwitchImpl(Topology topology, Long dpid) {
+        this(topology, new Dpid(dpid));
+    }
+
+    public SwitchImpl(Topology topology, Dpid dpid) {
         super(topology);
         this.dpid = dpid;
         ports = new HashMap<Long, Port>();
@@ -31,7 +37,7 @@
 
     @Override
     public Long getDpid() {
-        return dpid;
+        return dpid.value();
     }
 
     @Override