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/SwitchEvent.java b/src/main/java/net/onrc/onos/core/topology/SwitchEvent.java
new file mode 100644
index 0000000..b36eba2
--- /dev/null
+++ b/src/main/java/net/onrc/onos/core/topology/SwitchEvent.java
@@ -0,0 +1,51 @@
+package net.onrc.onos.core.topology;
+
+import java.nio.ByteBuffer;
+
+/**
+ * Self-contained Switch Object
+ *
+ * TODO: We probably want common base class/interface for Self-Contained Event Object
+ *
+ */
+public class SwitchEvent {
+ protected final Long dpid;
+
+ /**
+ * Default constructor for Serializer to use.
+ */
+ @Deprecated
+ public SwitchEvent() {
+ dpid = null;
+ }
+
+ public SwitchEvent(Long dpid) {
+ this.dpid = dpid;
+ }
+
+ public Long getDpid() {
+ return dpid;
+ }
+
+ @Override
+ public String toString() {
+ return "[SwitchEvent 0x" + Long.toHexString(dpid) + "]";
+ }
+
+ public static final int SWITCHID_BYTES = 2 + 8;
+
+ public static ByteBuffer getSwitchID(Long dpid) {
+ if (dpid == null) {
+ throw new IllegalArgumentException("dpid cannot be null");
+ }
+ return (ByteBuffer) ByteBuffer.allocate(SwitchEvent.SWITCHID_BYTES).putChar('S').putLong(dpid).flip();
+ }
+
+ public byte[] getID() {
+ return getSwitchID(dpid).array();
+ }
+
+ public ByteBuffer getIDasByteBuffer() {
+ return getSwitchID(dpid);
+ }
+}