Removed leftover classes from link discovery.

* IOnosRemoteSwitch
* EventHistory classes
* A few other Floodlight classes we don't need

Change-Id: I035dc36f21d295f497a2345ac61a712fd676e632
diff --git a/src/main/java/net/floodlightcontroller/core/internal/OFSwitchImpl.java b/src/main/java/net/floodlightcontroller/core/internal/OFSwitchImpl.java
index 29b28bd..73f3076 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/OFSwitchImpl.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/OFSwitchImpl.java
@@ -44,7 +44,6 @@
 import net.floodlightcontroller.core.web.serializers.DPIDSerializer;
 import net.floodlightcontroller.threadpool.IThreadPoolService;
 import net.floodlightcontroller.util.TimedCache;
-import net.onrc.onos.core.main.IOnosRemoteSwitch;
 
 import org.codehaus.jackson.annotate.JsonIgnore;
 import org.codehaus.jackson.annotate.JsonProperty;
@@ -77,7 +76,7 @@
 /**
  * This is the internal representation of an openflow switch.
  */
-public class OFSwitchImpl implements IOFSwitch, IOnosRemoteSwitch {
+public class OFSwitchImpl implements IOFSwitch {
     // TODO: should we really do logging in the class or should we throw
     // exception that can then be handled by callers?
     protected final static Logger log = LoggerFactory.getLogger(OFSwitchImpl.class);
@@ -94,7 +93,7 @@
     protected String stringId;
     protected Channel channel;
     protected AtomicInteger transactionIdSource;
-    // Lock to protect modification of the port maps. We only need to 
+    // Lock to protect modification of the port maps. We only need to
     // synchronize on modifications. For read operations we are fine since
     // we rely on ConcurrentMaps which works for our use case.
     private Object portLock;
@@ -102,7 +101,7 @@
     protected ConcurrentHashMap<Short, OFPhysicalPort> portsByNumber;
     // Map port names to the appropriate OFPhyiscalPort
     // XXX: The OF spec doesn't specify if port names need to be unique but
-    //      according it's always the case in practice. 
+    //      according it's always the case in practice.
     protected ConcurrentHashMap<String, OFPhysicalPort> portsByName;
     protected Map<Integer, OFStatisticsFuture> statsFutureMap;
     protected Map<Integer, IOFMessageListener> iofMsgListenersMap;
@@ -723,8 +722,8 @@
         synchronized (pendingRoleRequests) {
             PendingRoleRequestEntry head = pendingRoleRequests.poll();
             if (head == null) {
-                // Maybe don't disconnect if the role reply we received is 
-                // for the same role we are already in. 
+                // Maybe don't disconnect if the role reply we received is
+                // for the same role we are already in.
                 log.error("Switch {}: received unexpected role reply for Role {}" +
                         " Disconnecting switch", this, role);
                 this.channel.close();
@@ -876,11 +875,4 @@
     public byte getTables() {
         return tables;
     }
-
-
-    @Override
-    public void setupRemoteSwitch(Long dpid) {
-        this.datapathId = dpid;
-        this.stringId = HexString.toHexString(this.datapathId);
-    }
 }
diff --git a/src/main/java/net/floodlightcontroller/core/util/MutableInteger.java b/src/main/java/net/floodlightcontroller/core/util/MutableInteger.java
deleted file mode 100644
index 6ac3231..0000000
--- a/src/main/java/net/floodlightcontroller/core/util/MutableInteger.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- *    Copyright 2011, Big Switch Networks, Inc.
- *    Originally created by David Erickson, Stanford University
- *
- *    Licensed under the Apache License, Version 2.0 (the "License"); you may
- *    not use this file except in compliance with the License. You may obtain
- *    a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- *    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- *    License for the specific language governing permissions and limitations
- *    under the License.
- **/
-
-package net.floodlightcontroller.core.util;
-
-public class MutableInteger extends Number {
-    private static final long serialVersionUID = 1L;
-    int mutableInt;
-
-    public MutableInteger(int value) {
-        this.mutableInt = value;
-    }
-
-    public void setValue(int value) {
-        this.mutableInt = value;
-    }
-
-    @Override
-    public double doubleValue() {
-        return (double) mutableInt;
-    }
-
-    @Override
-    public float floatValue() {
-        // TODO Auto-generated method stub
-        return (float) mutableInt;
-    }
-
-    @Override
-    public int intValue() {
-        // TODO Auto-generated method stub
-        return mutableInt;
-    }
-
-    @Override
-    public long longValue() {
-        // TODO Auto-generated method stub
-        return (long) mutableInt;
-    }
-
-}
diff --git a/src/main/java/net/floodlightcontroller/util/BundleAction.java b/src/main/java/net/floodlightcontroller/util/BundleAction.java
deleted file mode 100644
index ea797a8..0000000
--- a/src/main/java/net/floodlightcontroller/util/BundleAction.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- *    Copyright 2011, Big Switch Networks, Inc.
- *    Originally created by David Erickson, Stanford University
- *
- *    Licensed under the Apache License, Version 2.0 (the "License"); you may
- *    not use this file except in compliance with the License. You may obtain
- *    a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- *    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- *    License for the specific language governing permissions and limitations
- *    under the License.
- **/
-
-package net.floodlightcontroller.util;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * @author David Erickson (daviderickson@cs.stanford.edu)
- */
-public enum BundleAction {
-    START,
-    STOP,
-    UNINSTALL,
-    REFRESH;
-
-    public static List<BundleAction> getAvailableActions(BundleState state) {
-        List<BundleAction> actions = new ArrayList<BundleAction>();
-        if (Arrays.binarySearch(new BundleState[]{
-                BundleState.ACTIVE, BundleState.STARTING,
-                BundleState.UNINSTALLED}, state) < 0) {
-            actions.add(START);
-        }
-        if (Arrays.binarySearch(new BundleState[]{
-                BundleState.ACTIVE}, state) >= 0) {
-            actions.add(STOP);
-        }
-        if (Arrays.binarySearch(new BundleState[]{
-                BundleState.UNINSTALLED}, state) < 0) {
-            actions.add(UNINSTALL);
-        }
-
-        // Always capable of refresh?
-        actions.add(REFRESH);
-        return actions;
-    }
-}
diff --git a/src/main/java/net/floodlightcontroller/util/BundleState.java b/src/main/java/net/floodlightcontroller/util/BundleState.java
deleted file mode 100644
index ef32958..0000000
--- a/src/main/java/net/floodlightcontroller/util/BundleState.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- *    Copyright 2011, Big Switch Networks, Inc.
- *    Originally created by David Erickson, Stanford University
- *
- *    Licensed under the Apache License, Version 2.0 (the "License"); you may
- *    not use this file except in compliance with the License. You may obtain
- *    a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- *    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- *    License for the specific language governing permissions and limitations
- *    under the License.
- **/
-
-package net.floodlightcontroller.util;
-
-/**
- * @author David Erickson (daviderickson@cs.stanford.edu)
- */
-public enum BundleState {
-    ACTIVE(32),
-    INSTALLED(2),
-    RESOLVED(4),
-    STARTING(8),
-    STOPPING(16),
-    UNINSTALLED(1);
-
-    protected int value;
-
-    private BundleState(int value) {
-        this.value = value;
-    }
-
-    /**
-     * @return the value
-     */
-    public int getValue() {
-        return value;
-    }
-
-    public static BundleState getState(int value) {
-        switch (value) {
-            case 32:
-                return ACTIVE;
-            case 2:
-                return INSTALLED;
-            case 4:
-                return RESOLVED;
-            case 8:
-                return STARTING;
-            case 16:
-                return STOPPING;
-            case 1:
-                return UNINSTALLED;
-        }
-        return null;
-    }
-}
diff --git a/src/main/java/net/floodlightcontroller/util/ClusterDFS.java b/src/main/java/net/floodlightcontroller/util/ClusterDFS.java
deleted file mode 100644
index 3efd5bc..0000000
--- a/src/main/java/net/floodlightcontroller/util/ClusterDFS.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package net.floodlightcontroller.util;
-
-public class ClusterDFS {
-    long dfsIndex;
-    long parentDFSIndex;
-    long lowpoint;
-    boolean visited;
-
-    public ClusterDFS() {
-        visited = false;
-        dfsIndex = Long.MAX_VALUE;
-        parentDFSIndex = Long.MAX_VALUE;
-        lowpoint = Long.MAX_VALUE;
-    }
-
-    public long getDfsIndex() {
-        return dfsIndex;
-    }
-
-    public void setDfsIndex(long dfsIndex) {
-        this.dfsIndex = dfsIndex;
-    }
-
-    public long getParentDFSIndex() {
-        return parentDFSIndex;
-    }
-
-    public void setParentDFSIndex(long parentDFSIndex) {
-        this.parentDFSIndex = parentDFSIndex;
-    }
-
-    public long getLowpoint() {
-        return lowpoint;
-    }
-
-    public void setLowpoint(long lowpoint) {
-        this.lowpoint = lowpoint;
-    }
-
-    public boolean isVisited() {
-        return visited;
-    }
-
-    public void setVisited(boolean visited) {
-        this.visited = visited;
-    }
-}
diff --git a/src/main/java/net/floodlightcontroller/util/EventHistory.java b/src/main/java/net/floodlightcontroller/util/EventHistory.java
deleted file mode 100644
index d6e08d5..0000000
--- a/src/main/java/net/floodlightcontroller/util/EventHistory.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/**
- *
- */
-package net.floodlightcontroller.util;
-
-import java.util.ArrayList;
-
-/**
- * @author subrata
- */
-
-public class EventHistory<T> {
-    public static final int EV_HISTORY_DEFAULT_SIZE = 1024;
-
-    public String description;
-    public int event_history_size;
-    public int current_index;
-    public boolean full; // true if all are in use
-    public ArrayList<Event> events;
-
-    public String getDescription() {
-        return description;
-    }
-
-    public int getEvent_history_size() {
-        return event_history_size;
-    }
-
-    public int getCurrent_index() {
-        return current_index;
-    }
-
-    public boolean isFull() {
-        return full;
-    }
-
-    public ArrayList<Event> getEvents() {
-        return events;
-    }
-
-    public class Event {
-        public EventHistoryBaseInfo base_info;
-        public T info;
-    }
-
-    public enum EvState {
-        FREE,             // no valid event written yet
-        BEING_MODIFIED,   // event is being updated with new value, skip
-        ACTIVE,           // event is active and can be displayed
-    }
-
-    public enum EvAction {
-        ADDED,   // specific entry added
-        REMOVED, // specific entry removed
-        UPDATED, // Entry updated
-        BLOCKED, // Blocked - used for Attachment Points
-        UNBLOCKED,
-        CLEARED,  // All entries are removed
-        PKT_IN,
-        PKT_OUT,
-        SWITCH_CONNECTED,
-        SWITCH_DISCONNECTED,
-        LINK_ADDED,
-        LINK_DELETED,
-        LINK_PORT_STATE_UPDATED,
-        CLUSTER_ID_CHANGED_FOR_CLUSTER,
-        CLUSTER_ID_CHANGED_FOR_A_SWITCH,
-    }
-
-    // Constructor
-    public EventHistory(int maxEvents, String desc) {
-        events = new ArrayList<Event>(maxEvents);
-
-        for (int idx = 0; idx < maxEvents; idx++) {
-            Event evH = new Event();
-            evH.base_info = new EventHistoryBaseInfo();
-            evH.info = null;
-            evH.base_info.state = EvState.FREE;
-            evH.base_info.idx = idx;
-            events.add(idx, evH);
-        }
-
-        description = "Event-History:" + desc;
-        event_history_size = maxEvents;
-        current_index = 0;
-        full = false;
-    }
-
-    // Constructor for default size
-    public EventHistory(String desc) {
-        this(EV_HISTORY_DEFAULT_SIZE, desc);
-    }
-
-    // Copy constructor - copy latest k items of the event history
-    public EventHistory(EventHistory<T> eventHist, int latestK) {
-
-        if (eventHist == null) {
-            description = "No event found";
-            return;
-        }
-        int curSize = (eventHist.full) ? eventHist.event_history_size :
-                eventHist.current_index;
-        int size = (latestK < curSize) ? latestK : curSize;
-        int evIdx = eventHist.current_index;
-        int topSz = (evIdx >= size) ? size : evIdx;
-
-        // Need to create a new one since size is different
-        events = new ArrayList<Event>(size);
-
-        // Get the top part
-        int origIdx = evIdx;
-        for (int idx = 0; idx < topSz; idx++) {
-            Event evH = eventHist.events.get(--origIdx);
-            evH.base_info.idx = idx;
-            events.add(idx, evH);
-        }
-
-        // Get the bottom part
-        origIdx = eventHist.event_history_size;
-        for (int idx = topSz; idx < size; idx++) {
-            Event evH = eventHist.events.get(--origIdx);
-            evH.base_info.idx = idx;
-            events.add(idx, evH);
-        }
-
-        description = eventHist.description;
-        event_history_size = size;
-        current_index = 0; // since it is full
-        full = true;
-    }
-
-    // Get an index for writing a new event. This method is synchronized for
-    // this event history infra. to be thread-safe. Once the index is obtained
-    // by the caller event at the index is updated without any lock
-    public synchronized int NextIdx() {
-        // curIdx should be in the 0 to evArraySz-1
-        if (current_index == (event_history_size - 1)) {
-            current_index = 0;
-            full = true;
-            return (event_history_size - 1);
-        } else {
-            current_index++;
-            return (current_index - 1);
-        }
-    }
-
-    /**
-     * Add an event to the event history
-     * Eliminate java garbage cration by reusing the same object T
-     * Supplied object t is used to populate the event history array
-     * and the current object at that array location is returned to the
-     * calling process so that the calling process can use that object
-     * for the next event of the same type
-     *
-     * @param t
-     * @param action
-     * @return
-     */
-
-    public T put(T t, EvAction action) {
-        int idx = NextIdx();
-        Event evH = events.get(idx);
-        evH.base_info.state = EvState.BEING_MODIFIED;
-        evH.base_info.time_ms = System.currentTimeMillis();
-        evH.base_info.action = action;
-        T temp = evH.info;
-        evH.info = t;
-        evH.base_info.state = EvState.ACTIVE;
-        return temp;
-    }
-
-    /**
-     * Clear the event history, needs to be done under lock
-     */
-    public void clear() {
-        for (int idx = 0; idx < event_history_size; idx++) {
-            Event evH = events.get(idx);
-            evH.base_info.state = EvState.FREE;
-            current_index = 0;
-            full = false;
-        }
-    }
-}
diff --git a/src/main/java/net/floodlightcontroller/util/EventHistoryBaseInfo.java b/src/main/java/net/floodlightcontroller/util/EventHistoryBaseInfo.java
deleted file mode 100644
index 52b623d..0000000
--- a/src/main/java/net/floodlightcontroller/util/EventHistoryBaseInfo.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package net.floodlightcontroller.util;
-
-
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-@JsonSerialize(using = EventHistoryBaseInfoJSONSerializer.class)
-public class EventHistoryBaseInfo {
-    public int idx;
-    public long time_ms; // timestamp in milliseconds
-    public EventHistory.EvState state;
-    public EventHistory.EvAction action;
-
-    // Getters
-    public int getIdx() {
-        return idx;
-    }
-
-    public long getTime_ms() {
-        return time_ms;
-    }
-
-    public EventHistory.EvState getState() {
-        return state;
-    }
-
-    public EventHistory.EvAction getAction() {
-        return action;
-    }
-}
\ No newline at end of file
diff --git a/src/main/java/net/floodlightcontroller/util/EventHistoryBaseInfoJSONSerializer.java b/src/main/java/net/floodlightcontroller/util/EventHistoryBaseInfoJSONSerializer.java
deleted file mode 100644
index 0fe4b17..0000000
--- a/src/main/java/net/floodlightcontroller/util/EventHistoryBaseInfoJSONSerializer.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- *    Copyright 2011, Big Switch Networks, Inc.
- *
- *    Licensed under the Apache License, Version 2.0 (the "License"); you may
- *    not use this file except in compliance with the License. You may obtain
- *    a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- *    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- *    License for the specific language governing permissions and limitations
- *    under the License.
- **/
-
-package net.floodlightcontroller.util;
-
-import java.io.IOException;
-import java.sql.Timestamp;
-
-import org.codehaus.jackson.JsonGenerator;
-import org.codehaus.jackson.JsonProcessingException;
-import org.codehaus.jackson.map.JsonSerializer;
-import org.codehaus.jackson.map.SerializerProvider;
-
-
-/**
- * @author subrata
- */
-
-public class EventHistoryBaseInfoJSONSerializer extends
-        JsonSerializer<EventHistoryBaseInfo> {
-
-
-    /**
-     * Performs the serialization of a EventHistory.BaseInfo object
-     */
-    @Override
-    public void serialize(EventHistoryBaseInfo base_info, JsonGenerator jGen,
-                          SerializerProvider serializer)
-            throws IOException, JsonProcessingException {
-        jGen.writeStartObject();
-        jGen.writeNumberField("Idx", base_info.getIdx());
-        Timestamp ts = new Timestamp(base_info.getTime_ms());
-        String tsStr = ts.toString();
-        while (tsStr.length() < 23) {
-            tsStr = tsStr.concat("0");
-        }
-        jGen.writeStringField("Time", tsStr);
-        jGen.writeStringField("State", base_info.getState().name());
-        String acStr = base_info.getAction().name().toLowerCase();
-        // Capitalize the first letter
-        acStr = acStr.substring(0, 1).toUpperCase().concat(acStr.substring(1));
-        jGen.writeStringField("Action", acStr);
-        jGen.writeEndObject();
-    }
-
-    /**
-     * Tells SimpleModule that we are the serializer for OFMatch
-     */
-    @Override
-    public Class<EventHistoryBaseInfo> handledType() {
-        return EventHistoryBaseInfo.class;
-    }
-}
diff --git a/src/main/java/net/onrc/onos/core/main/IOnosRemoteSwitch.java b/src/main/java/net/onrc/onos/core/main/IOnosRemoteSwitch.java
deleted file mode 100644
index 54d9372..0000000
--- a/src/main/java/net/onrc/onos/core/main/IOnosRemoteSwitch.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- *
- */
-package net.onrc.onos.core.main;
-
-import net.floodlightcontroller.core.IOFSwitch;
-
-/**
- * Additional interface added to IOFSwitch by ONOS
- * to represent remote Switch.
- */
-public interface IOnosRemoteSwitch extends IOFSwitch {
-
-    /**
-     * Setup an unconnected switch with the info required.
-     *
-     * @param dpid of the switch
-     */
-    public void setupRemoteSwitch(Long dpid);
-
-}