Renamed networkgraph package to topology.
Moved NetworkGraphPublisher into new topology package.

net.onrc.onos.ofcontroller.networkgraph.* => net.onrc.onos.core.topology.*
net.onrc.onos.ofcontroller.floodlightlistener.NetworkGraphPublisher => net.onrc.onos.core.topology.NetworkGraphPublisher

Change-Id: I8b156d0fcbba520fee61e92ab659bb02cfa704ac
diff --git a/src/main/java/net/onrc/onos/core/topology/DeviceEvent.java b/src/main/java/net/onrc/onos/core/topology/DeviceEvent.java
new file mode 100644
index 0000000..f7331a0
--- /dev/null
+++ b/src/main/java/net/onrc/onos/core/topology/DeviceEvent.java
@@ -0,0 +1,104 @@
+package net.onrc.onos.core.topology;
+
+import java.net.InetAddress;
+import java.nio.ByteBuffer;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import net.floodlightcontroller.util.MACAddress;
+import net.onrc.onos.core.topology.PortEvent.SwitchPort;
+
+/**
+ * Self-contained Device event(s) Object
+ *
+ * Device event differ from other events.
+ * Device Event represent add/remove of attachmentPoint or ipAddress.
+ * Not add/remove of the DeviceObject itself.
+ *
+ * Multiple attachmentPoints can be specified to batch events into 1 object.
+ * Each should be treated as independent events.
+ *
+ * TODO: We probably want common base class/interface for Self-Contained Event Object
+ *
+ */
+public class DeviceEvent {
+    private final MACAddress mac;
+    protected List<SwitchPort> attachmentPoints;
+    protected Set<InetAddress> ipAddresses;
+    private long lastSeenTime;
+
+    /**
+     * Default constructor for Serializer to use.
+     */
+    @Deprecated
+    public DeviceEvent() {
+	mac = null;
+    }
+
+    public DeviceEvent(MACAddress mac) {
+	if (mac == null) {
+	    throw new IllegalArgumentException("Device mac cannot be null");
+	}
+	this.mac = mac;
+	this.attachmentPoints = new LinkedList<>();
+	this.ipAddresses = new HashSet<>();
+    }
+
+    public MACAddress getMac() {
+	return mac;
+    }
+
+    public List<SwitchPort> getAttachmentPoints() {
+	return attachmentPoints;
+    }
+
+    public Set<InetAddress> getIpAddresses() {
+        return ipAddresses;
+    }
+
+    public void setAttachmentPoints(List<SwitchPort> attachmentPoints) {
+	this.attachmentPoints = attachmentPoints;
+    }
+
+    public void addAttachmentPoint(SwitchPort attachmentPoint) {
+	// may need to maintain uniqness
+	this.attachmentPoints.add(0, attachmentPoint);
+    }
+
+
+    public boolean addIpAddress(InetAddress addr) {
+	return this.ipAddresses.add(addr);
+    }
+
+    public boolean removeIpAddress(InetAddress addr) {
+	return this.ipAddresses.remove(addr);
+    }
+
+    @Override
+    public String toString() {
+	return "[DeviceEvent " + mac + " attachmentPoints:" + attachmentPoints + " ipAddr:" + ipAddresses + "]";
+    }
+
+    // Assuming mac is unique cluster-wide
+    public static ByteBuffer getDeviceID(final byte[] mac) {
+	return (ByteBuffer) ByteBuffer.allocate(2 + mac.length).putChar('D').put(mac).flip();
+    }
+
+    public byte[] getID() {
+	return getDeviceID(mac.toBytes()).array();
+    }
+
+    public ByteBuffer getIDasByteBuffer() {
+	return getDeviceID(mac.toBytes());
+    }
+
+	public long getLastSeenTime() {
+		return lastSeenTime;
+	}
+
+	public void setLastSeenTime(long lastSeenTime) {
+		this.lastSeenTime = lastSeenTime;
+	}
+}