Gather topology element info to TopologyImpl

- Moved all the self-contained topology elements (*Event) to
  TopologyImpl. (ONOS-1651)
  Now {Switch, Port, Link, Host}Impl is just a handler attached to
  TopologyImpl.
- BugFix: TopologyManager.addHost(HostEvent)
  HostEvent could be pushed to reorder queue multiple times,
  if multiple attachment point was given.
- BugFix: TopologyManager.{addLink, removePort}
  Properly handle if Host attachment point was removed as side-effect.
- BugFix: Copy HostEvent#lastSeenTime
- BugFix: Event instance notified to listeners (api*Events) should be
  the event which was/will be in the replica. (TopologyManager)
- Added/Modified debug log in TopologyManager so that log will be in
  same format for each event type.
  "{Added, Update, Removed} <Self-contained>"
- Removed backdoor method and use TestUtils instead.

Change-Id: If053d6f11f39574a188e7a52cb6194114f8afe5d
diff --git a/src/main/java/net/onrc/onos/core/topology/TopologyInternal.java b/src/main/java/net/onrc/onos/core/topology/TopologyInternal.java
new file mode 100644
index 0000000..10b008e
--- /dev/null
+++ b/src/main/java/net/onrc/onos/core/topology/TopologyInternal.java
@@ -0,0 +1,64 @@
+package net.onrc.onos.core.topology;
+
+import java.util.Collection;
+
+import net.floodlightcontroller.util.MACAddress;
+import net.onrc.onos.core.util.Dpid;
+import net.onrc.onos.core.util.LinkTuple;
+import net.onrc.onos.core.util.SwitchPort;
+
+/**
+ * Interface to reference internal self-contained elements.
+ */
+public interface TopologyInternal extends Topology {
+
+    /**
+     * Gets a SwitchEvent.
+     *
+     * @param dpid Switch DPID
+     * @return the SwitchEvent for the Switch DPID if found, otherwise null
+     */
+    public SwitchEvent getSwitchEvent(Dpid dpid);
+
+    /**
+     * Gets a PortEvent.
+     *
+     * @param port Port identifier
+     * @return the PortEvent for the Port identifier if found, otherwise null
+     */
+    public PortEvent getPortEvent(SwitchPort port);
+
+    /**
+     * Gets a LinkEvent.
+     *
+     * @param linkId Link identifier
+     * @return the LinkEvent for the Link identifier if found, otherwise null
+     */
+    public LinkEvent getLinkEvent(LinkTuple linkId);
+
+    /**
+     * Gets a LinkEvent.
+     *
+     * @param linkId Link identifier
+     * @param type type
+     * @return the LinkEvent for the Link identifier and type if found, otherwise null
+     */
+    public LinkEvent getLinkEvent(final LinkTuple linkId, final String type);
+
+    /**
+     * Gets a LinkEvent.
+     *
+     * @param linkId Link identifier
+     * @return Collection of LinkEvent
+     */
+    public Collection<LinkEvent> getLinkEvents(LinkTuple linkId);
+
+    /**
+     * Gets a HostEvent.
+     *
+     * @param mac MACAddress of the host
+     * @return the HostEvent for the MACAddress if found, otherwise null
+     */
+    public HostEvent getHostEvent(MACAddress mac);
+
+}