Removed obsoleted Graph-based Network Storage and associated interfaces:
  DeviceStorageImpl, LinkStorageImpl, SwitchStorageImpl
  TopoLinkServiceImpl, TopoSwitchServiceImpl

Change-Id: I09c9fcb9e268bed975b85d110a50f1806b070599
diff --git a/src/main/java/net/onrc/onos/graph/DBOperation.java b/src/main/java/net/onrc/onos/graph/DBOperation.java
index c291544..747e514 100644
--- a/src/main/java/net/onrc/onos/graph/DBOperation.java
+++ b/src/main/java/net/onrc/onos/graph/DBOperation.java
@@ -26,7 +26,6 @@
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IIpv4Address;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
-import net.onrc.onos.ofcontroller.core.ISwitchStorage;
 import net.onrc.onos.ofcontroller.util.FlowEntryId;
 import net.onrc.onos.ofcontroller.util.FlowId;
 
@@ -42,11 +41,13 @@
 	 */
 	@Override
 	public ISwitchObject searchActiveSwitch(String dpid) {
+	    /*
 	    ISwitchObject sw = searchSwitch(dpid);
 	    if ((sw != null)
 		    && sw.getState().equals(ISwitchStorage.SwitchState.ACTIVE.toString())) {
 		return sw;
 	    }
+	    */
 	    return null;
 	}
 
@@ -91,9 +92,11 @@
 	    List<ISwitchObject> inactiveSwitches = new ArrayList<ISwitchObject>();
 
 	    for (ISwitchObject sw : switches) {
+		/*
 		if (sw.getState().equals(ISwitchStorage.SwitchState.INACTIVE.toString())) {
 		    inactiveSwitches.add(sw);
 		}
+		*/
 	    }
 	    return inactiveSwitches;
 	}
@@ -250,9 +253,11 @@
 	    List<ISwitchObject> activeSwitches = new ArrayList<ISwitchObject>();
 
 	    for (ISwitchObject sw : switches) {
+		/*
 		if (sw.getState().equals(ISwitchStorage.SwitchState.ACTIVE.toString())) {
 		    activeSwitches.add(sw);
 		}
+		*/
 	    }
 	    return activeSwitches;
 	}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
index 501dbf0..a6aacf1 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
@@ -33,15 +33,9 @@
 import net.floodlightcontroller.topology.ITopologyService;
 import net.floodlightcontroller.util.MACAddress;
 import net.onrc.onos.ofcontroller.bgproute.RibUpdate.Operation;
-import net.onrc.onos.ofcontroller.core.IDeviceStorage;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
-import net.onrc.onos.ofcontroller.core.INetMapTopologyService.ITopoLinkService;
-import net.onrc.onos.ofcontroller.core.INetMapTopologyService.ITopoSwitchService;
 import net.onrc.onos.ofcontroller.core.config.IConfigInfoService;
-import net.onrc.onos.ofcontroller.core.internal.DeviceStorageImpl;
-import net.onrc.onos.ofcontroller.core.internal.TopoLinkServiceImpl;
-import net.onrc.onos.ofcontroller.core.internal.TopoSwitchServiceImpl;
 import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery;
 import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery.LDUpdate;
 import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
@@ -96,8 +90,6 @@
 	private ILinkDiscoveryService linkDiscoveryService;
 	private IRestApiService restApi;
 	private IProxyArpService proxyArp;
-	private IDeviceStorage deviceStorage;
-	private ITopoSwitchService topoSwitchService;
 
 	private IPatriciaTrie<RibEntry> ptree;
 	private IPatriciaTrie<Interface> interfacePtrie;
@@ -163,6 +155,8 @@
 			log.debug("Running topology change detection task");
 			synchronized (linkUpdates) {
 				//This is the model the REST API uses to retrieve network graph info
+			    // TODO: Fix the code below after topoLinkService was removed
+			    /*
 				ITopoLinkService topoLinkService = new TopoLinkServiceImpl();
 
 				List<Link> activeLinks = topoLinkService.getActiveLinks();
@@ -177,6 +171,7 @@
 						it.remove();
 					}
 				}
+			    */
 			}
 
 			if (!topologyReady) {
@@ -280,15 +275,10 @@
 		restApi = context.getServiceImpl(IRestApiService.class);
 		proxyArp = context.getServiceImpl(IProxyArpService.class);
 
-		deviceStorage = new DeviceStorageImpl();
-		deviceStorage.init("", "");
-
 		linkUpdates = new ArrayList<LDUpdate>();
 		ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
 		topologyChangeDetectorTask = new SingletonTask(executor, new TopologyChangeDetector());
 
-		topoSwitchService = new TopoSwitchServiceImpl();
-
 		pathsWaitingOnArp = new HashMap<InetAddress, Path>();
 		prefixesWaitingOnArp = Multimaps.synchronizedSetMultimap(
 				HashMultimap.<InetAddress, RibUpdate>create());
@@ -449,10 +439,12 @@
 		RibEntry rib = update.getRibEntry();
 
 		InetAddress dstIpAddress = rib.getNextHop();
-		MACAddress nextHopMacAddress;
+		MACAddress nextHopMacAddress = null;
 
 		// See if we know the MAC address of the next hop
 		// TODO if we do not treat the next hop as a device in the future, we need to update this
+		// TODO: Fix the code below after deviceStorage was removed
+		/*
 		IDeviceObject nextHopDevice =
 				deviceStorage.getDeviceByIP(InetAddresses.coerceToInteger(dstIpAddress));
 
@@ -465,6 +457,7 @@
 
 		}
 		nextHopMacAddress = MACAddress.valueOf(nextHopDevice.getMACAddress());
+		*/
 
 		// Find the attachment point (egress interface) of the next hop
 		Interface egressInterface = null;
@@ -705,7 +698,9 @@
 
 			//See if we know the MAC address of the peer. If not we can't
 			//do anything until we learn it
-			MACAddress macAddress;
+			// TODO: Fix the code below after deviceStorage was removed
+			MACAddress macAddress = null;
+			/*
 			IDeviceObject nextHopDevice =
 					deviceStorage.getDeviceByIP(InetAddresses.coerceToInteger(peer.getIpAddress()));
 
@@ -718,6 +713,7 @@
 			}
 
 			macAddress = MACAddress.valueOf(nextHopDevice.getMACAddress());
+			*/
 
 			if (macAddress == null) {
 				log.debug("Don't know MAC for {}", peer.getIpAddress().getHostAddress());
@@ -1172,6 +1168,8 @@
 	// whether all the switches in the configure file are discovered by onos.
 	private void checkSwitchesConnected(){
 		for (String dpid : switches){
+		    // TODO: Fix the code below after topoSwitchSerice was removed
+		    /*
 			Iterator<ISwitchObject> activeSwitches = topoSwitchService.
 					getActiveSwitches().iterator();
 			while(activeSwitches.hasNext())
@@ -1185,6 +1183,7 @@
 					return;
 				}
 			}
+		    */
 		}
 		switchesConnected = true;
 	}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/IDeviceStorage.java b/src/main/java/net/onrc/onos/ofcontroller/core/IDeviceStorage.java
deleted file mode 100644
index 53f515c..0000000
--- a/src/main/java/net/onrc/onos/ofcontroller/core/IDeviceStorage.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package net.onrc.onos.ofcontroller.core;
-
-import net.floodlightcontroller.devicemanager.IDevice;
-import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
-import net.onrc.onos.ofcontroller.devicemanager.OnosDevice;
-
-public interface IDeviceStorage extends INetMapStorage {
-	
-	public IDeviceObject addDevice(IDevice device);
-	public IDeviceObject updateDevice(IDevice device);
-	public void removeDevice(IDevice device);
-	public void removeDevice(IDeviceObject deviceObject);
-	public IDeviceObject getDeviceByMac(String mac);
-	public IDeviceObject getDeviceByIP(int ipv4Address);
-	public void changeDeviceAttachments(IDevice device);
-	public void changeDeviceIPv4Address(IDevice device);
-	public void rollback();
-	public void commit();
-
-	public void addOnosDevice(OnosDevice onosDevice);
-	public void deleteOnosDevice(OnosDevice onosDevice);
-}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/ILinkStorage.java b/src/main/java/net/onrc/onos/ofcontroller/core/ILinkStorage.java
deleted file mode 100644
index 6b285f4..0000000
--- a/src/main/java/net/onrc/onos/ofcontroller/core/ILinkStorage.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package net.onrc.onos.ofcontroller.core;
-
-import java.util.List;
-
-import net.floodlightcontroller.routing.Link;
-import net.onrc.onos.ofcontroller.linkdiscovery.LinkInfo;
-
-public interface ILinkStorage extends INetMapStorage {
-	
-    /*
-	 * Init with Storage conf
-	 */
-	public void init(final String dbStore, final String conf);
-	
-	/*
-	 * Generic operation method
-	 */
-	public boolean update(Link link, LinkInfo linkinfo, DM_OPERATION op);
-	
-	/*
-     * Link creation
-     */
-	public boolean addLink(Link link);
-	public boolean addLink(Link link, LinkInfo linfo);
-	public boolean addLinks(List<Link> links);
-	
-	/*
-	 * Link deletion
-	 */
-	public boolean deleteLink(Link link);
-	public boolean deleteLinks(List<Link> links);
-
-	/*
-	 * Utility method to delete links associated with dpid and port 
-	 * If only dpid is used, All links associated for switch are removed
-	 * Useful for port up/down and also switch join/remove events
-	 */ 
-	public boolean deleteLinksOnPort(Long dpid, short port);
-
-	/*
-	 * Get Links from Storage
-	 *  If dpid and port both are specified specific link is retrieved
-	 *  If only dpid is set all links associated with Switch are retrieved
-	 */
-	public List<Link> getLinks(Long dpid, short port);
-
-	/**
-	 * Get list of all reverse links connected to the port specified by given DPID and port number.
-	 * @param dpid DPID of desired port.
-	 * @param port Port number of desired port.
-	 * @return List of reverse links. Empty list if no port was found.
-	 */
-	public List<Link> getReverseLinks(Long dpid, short port);
-
-	public List<Link> getLinks(String dpid);
-
-	/**
-	 * Get list of all reverse links connected to the switch specified by
-	 * given DPID.
-	 * @param dpid DPID of desired switch.
-	 * @return List of reverse links. Empty list if no port was found.
-	 */
-
-        public List<Link> getReverseLinks(String dpid);
-
-	public List<Link> getActiveLinks();
-
-	public LinkInfo getLinkInfo(Link link);
-}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/INetMapService.java b/src/main/java/net/onrc/onos/ofcontroller/core/INetMapService.java
deleted file mode 100644
index 8392a32..0000000
--- a/src/main/java/net/onrc/onos/ofcontroller/core/INetMapService.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package net.onrc.onos.ofcontroller.core;
-
-public interface INetMapService {
-
-}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyService.java b/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyService.java
deleted file mode 100644
index f5ccc49..0000000
--- a/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyService.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package net.onrc.onos.ofcontroller.core;
-
-import java.util.List;
-
-import net.floodlightcontroller.routing.Link;
-import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
-import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
-import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
-
-public interface INetMapTopologyService extends INetMapService {
-
-	public interface ITopoSwitchService {
-		Iterable<ISwitchObject> getActiveSwitches();
-		Iterable<ISwitchObject> getAllSwitches();
-		Iterable<ISwitchObject> getInactiveSwitches();
-		Iterable<IPortObject> getPortsOnSwitch(String dpid);
-		IPortObject getPortOnSwitch(String dpid, short port_num);
-		void close();
-
-	}
-	
-	public interface ITopoLinkService {
-		List<Link> getActiveLinks();
-		List<Link> getLinksOnSwitch(String dpid);
-		void close();
-	}
-	public interface ITopoDeviceService {
-		Iterable<IDeviceObject> getActiveDevices();
-		Iterable<IDeviceObject> getDevicesOnSwitch(String dpid);
-		Iterable<IDeviceObject> getDevicesOnSwitch(String dpid, short port_num);
-	}
-}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/ISwitchStorage.java b/src/main/java/net/onrc/onos/ofcontroller/core/ISwitchStorage.java
deleted file mode 100644
index 36729a6..0000000
--- a/src/main/java/net/onrc/onos/ofcontroller/core/ISwitchStorage.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package net.onrc.onos.ofcontroller.core;
-
-import java.util.List;
-
-import net.floodlightcontroller.core.IOFSwitch;
-
-import org.openflow.protocol.OFPhysicalPort;
-
-public interface ISwitchStorage extends INetMapStorage {
-	
-	public enum SwitchState {
-		INACTIVE,
-		ACTIVE
-	}
-	
-	/*
-	 * Initialize
-	 */
-	public void init(final String dbStore, final String conf);
-
-	/*
-	 * Update the switch details
-	 */
-	public boolean updateSwitch(String dpid, SwitchState state, DM_OPERATION op);
-	/*
-	 * Add a switch and all its associated ports
-	 */
-	public boolean addSwitch(IOFSwitch sw);
-	/*
-	 * Add a switch
-	 */
-	public boolean addSwitch(String dpid);
-	/*
-	 * Delete switch and associated ports
-	 */
-	public boolean deleteSwitch(String dpid);
-	/*
-	 * Deactivate the switch and associated ports
-	 */
-	public boolean deactivateSwitch(String dpid);
-	/*
-	 * Update the port details
-	 */
-	public boolean updatePort(String dpid, short port, int state, String desc);
-	/*
-	 * Associate a port on switch
-	 */
-	public boolean addPort(String dpid, OFPhysicalPort port);
-	/*
-	 * Delete a port on a switch by num
-	 */
-	public boolean deletePort(String dpid, short port);
-	/**
-	 * Get list of all ports on the switch specified by given DPID.
-	 *
-	 * @param dpid DPID of desired switch.
-	 * @return List of port IDs. Empty list if no port was found.
-	 */
-	public List<Short> getPorts(String dpid);
-}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/internal/DeviceStorageImpl.java b/src/main/java/net/onrc/onos/ofcontroller/core/internal/DeviceStorageImpl.java
deleted file mode 100644
index f794a2b..0000000
--- a/src/main/java/net/onrc/onos/ofcontroller/core/internal/DeviceStorageImpl.java
+++ /dev/null
@@ -1,449 +0,0 @@
-package net.onrc.onos.ofcontroller.core.internal;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-import net.floodlightcontroller.devicemanager.IDevice;
-import net.floodlightcontroller.devicemanager.SwitchPort;
-import net.onrc.onos.graph.DBOperation;
-import net.onrc.onos.graph.GraphDBManager;
-import net.onrc.onos.ofcontroller.core.IDeviceStorage;
-import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
-import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IIpv4Address;
-import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
-import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
-import net.onrc.onos.ofcontroller.devicemanager.OnosDevice;
-
-import org.openflow.util.HexString;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.Lists;
-import com.google.common.net.InetAddresses;
-import com.thinkaurelius.titan.core.TitanException;
-/**
- * This is the class for storing the information of devices into CassandraDB
- * @author Pankaj
- */
-public class DeviceStorageImpl implements IDeviceStorage {
-	protected final static Logger log = LoggerFactory.getLogger(DeviceStorageImpl.class);
-
-	private DBOperation ope;
-	/***
-	 * Initialize function. Before you use this class, please call this method
-	 * @param conf configuration file for Cassandra DB
-	 */
-	@Override
-	public void init(final String dbStore, final String conf) {
-		try {
-			ope = GraphDBManager.getDBOperation();
-		} catch (Exception e) {
-			log.error("Couldn't open graph operation", e);
-		}
-	}
-
-	/***
-	 * Finalize/close function. After you use this class, please call this method.
-	 * It will close the DB connection.
-	 */
-	@Override
-	public void close() {
-		ope.close();
-	}
-
-	/***
-	 * Finalize/close function. After you use this class, please call this method.
-	 * It will close the DB connection. This is for Java garbage collection.
-	 */
-	@Override
-	protected void finalize() {
-		close();
-	}
-
-	/***
-	 * This function is for adding the device into the DB.
-	 * @param device The device you want to add into the DB.
-	 * @return IDeviceObject which was added in the DB.
-	 */
-	@Override
-	public IDeviceObject addDevice(IDevice device) {
-		IDeviceObject obj = null;
-		for (int i = 0; i < 6; i++) {
-	 		try {
-	 			if (i > 0) {
-	 				log.debug("Retrying add device: i is {}", i);
-	 			}
-	 			if ((obj = ope.searchDevice(device.getMACAddressString())) != null) {
-	 				log.debug("Adding device {}: found existing device", device.getMACAddressString());
-	            } else {
-	            	obj = ope.newDevice();
-	                log.debug("Adding device {}: creating new device", device.getMACAddressString());
-	            }
-
-	            if (obj == null) {
-	            	return null;
-	            }
-
-	            changeDeviceAttachments(device, obj);
-
-	            changeDeviceIpv4Addresses(device, obj);
-
-	 			obj.setMACAddress(device.getMACAddressString());
-	 			obj.setType("device");
-	 			obj.setState("ACTIVE");
-	 			ope.commit();
-
-	 			break;
-	 			//log.debug("Adding device {}",device.getMACAddressString());
-			} catch (TitanException e) {
-				ope.rollback();
-				log.error("Adding device {} failed", device.getMACAddressString(), e);
-				obj = null;
-			}
-		}
-
-		return obj;
-	}
-	/***
-	 * This function is for updating the Device properties.
-	 * @param device The device you want to add into the DB.
-	 * @return IDeviceObject which was added in the DB.
-	 */
-	@Override
-	public IDeviceObject updateDevice(IDevice device) {
-		return addDevice(device);
-	}
-
-	/***
-	 * This function is for removing the Device from the DB.
-	 * @param device The device you want to delete from the DB.
-	 */
-	@Override
-	public void removeDevice(IDevice device) {
-		//Not used
-		IDeviceObject dev;
-
-		if ((dev = ope.searchDevice(device.getMACAddressString())) != null) {
-			removeDevice(dev);
-		}
-	}
-
-	@Override
-	public void removeDevice(IDeviceObject deviceObject) {
-		String deviceMac = deviceObject.getMACAddress();
-
-		removeDeviceImpl(deviceObject);
-
-		try {
-			ope.commit();
-			log.debug("DeviceStorage:removeDevice mac:{} done", deviceMac);
-		} catch (TitanException e) {
-			ope.rollback();
-			log.error("DeviceStorage:removeDevice mac:{} failed", deviceMac);
-		}
-	}
-
-	public void removeDeviceImpl(IDeviceObject deviceObject) {
-		for (IIpv4Address ipv4AddressVertex : deviceObject.getIpv4Addresses()) {
-			ope.removeIpv4Address(ipv4AddressVertex);
-		}
-
-		ope.removeDevice(deviceObject);
-	}
-	/***
-	 * This function is for getting the Device from the DB by Mac address of the device.
-	 * @param mac The device mac address you want to get from the DB.
-	 * @return IDeviceObject you want to get.
-	 */
-	@Override
-	public IDeviceObject getDeviceByMac(String mac) {
-	    return ope.searchDevice(mac);
-	}
-
-
-	/***
-	 * This function is for closing the DB transaction properly.
-	 * After you use any DB operation, to clear the cache of transaction, it should be called.
-	 */
-	@Override
-	public void rollback() {
-		ope.rollback();
-	}
-	
-	@Override
-	public void commit(){
-		ope.commit();
-	}
-
-	/***
-	 * This function is for getting the Device from the DB by IP address of the device.
-	 * @param ip The device ip address you want to get from the DB.
-	 * @return IDeviceObject you want to get.
-	 */
-	@Override
-	public IDeviceObject getDeviceByIP(int ipv4Address) {
-		try {
-			IIpv4Address ipv4AddressVertex = ope.searchIpv4Address(ipv4Address);
-			if (ipv4AddressVertex != null) {
-				return ipv4AddressVertex.getDevice();
-			}
-			return null;
-		}
-		catch (TitanException e) {
-			log.error("DeviceStorage:getDeviceByIP:{} failed");
-			return null;
-		}
-	}
-
-	/***
-	 * This function is for changing the Device attachment point.
-	 * @param device The device you want change the attachment point
-	 */
-	@Override
-	public void changeDeviceAttachments(IDevice device) {
-		IDeviceObject obj = null;
-		try {
-			if ((obj = ope.searchDevice(device.getMACAddressString())) != null) {
-				log.debug("Changing device ports {}: found existing device", device.getMACAddressString());
-				changeDeviceAttachments(device, obj);
-				ope.commit();
-			} else {
-				log.debug("failed to search device...now adding {}", device.getMACAddressString());
-				addDevice(device);
-			}
-		} catch (TitanException e) {
-			ope.rollback();
-			log.error(":addDevice mac:{} failed", device.getMACAddressString());
-		}
-	}
-
-	/***
-	 * This function is for changing the Device attachment point.
-	 * @param device The new device you want change the attachment point
-	 * @param obj The old device IDeviceObject that is going to change the attachment point.
-	 */
-	public void changeDeviceAttachments(IDevice device, IDeviceObject obj) {
-		SwitchPort[] attachmentPoints = device.getAttachmentPoints();
-		List<IPortObject> attachedPorts = Lists.newArrayList(obj.getAttachedPorts());
-
-		for (SwitchPort ap : attachmentPoints) {
-			//Check if there is the port
-			IPortObject port = ope.searchPort(HexString.toHexString(ap.getSwitchDPID()),
-					(short) ap.getPort());
-			log.debug("New Switch Port is {},{}",
-					HexString.toHexString(ap.getSwitchDPID()), (short) ap.getPort());
-
-			if (port != null){
-				if (attachedPorts.contains(port)) {
-					log.debug("This is the port you already attached {}: do nothing", device.getMACAddressString());
-					//This port will be remained, so remove from the removed port lists.
-					attachedPorts.remove(port);
-				} else {
-					log.debug("Adding device {}: attaching to port", device.getMACAddressString());
-					port.setDevice(obj);
-				}
-
-				log.debug("port number is {}", port.getNumber());
-				log.debug("port desc is {}", port.getDesc());
-			}
-		}
-
-		for (IPortObject port: attachedPorts) {
-			log.debug("Detaching the device {}: detaching from port", device.getMACAddressString());
-			port.removeDevice(obj);
-
-			if (!obj.getAttachedPorts().iterator().hasNext()) {
-				// XXX If there are no more ports attached to the device,
-				// delete it. Otherwise we have a situation where the
-				// device remains forever with an IP address attached.
-				// When we implement device probing we should get rid of this.
-				removeDevice(obj);
-			}
-		}
-	}
-
-	/***
-	 * This function is for changing the Device IPv4 address.
-	 * @param device The new device you want change the ipaddress
-	 */
-	@Override
-	public void changeDeviceIPv4Address(IDevice device) {
-		log.debug("Changing IP address for {} to {}", device.getMACAddressString(),
-				device.getIPv4Addresses());
-		IDeviceObject obj;
-		try {
-			if ((obj = ope.searchDevice(device.getMACAddressString())) != null) {
-				changeDeviceIpv4Addresses(device, obj);
-				ope.commit();
-			} else {
-				log.error(":changeDeviceIPv4Address mac:{} failed", device.getMACAddressString());
-			}
-		} catch (TitanException e) {
-			ope.rollback();
-			log.error(":changeDeviceIPv4Address mac:{} failed due to exception {}", device.getMACAddressString(), e);
-		}
-	}
-
-	private void changeDeviceIpv4Addresses(IDevice device, IDeviceObject deviceObject) {
-		List<String> dbIpv4Addresses = new ArrayList<String>();
-		List<Integer> intDbIpv4Addresses = new ArrayList<Integer>();
-		for (IIpv4Address ipv4Vertex : deviceObject.getIpv4Addresses()) {
-			dbIpv4Addresses.add(InetAddresses.fromInteger(ipv4Vertex.getIpv4Address()).getHostAddress());
-			intDbIpv4Addresses.add(ipv4Vertex.getIpv4Address());
-		}
-
-		List<String> memIpv4Addresses = new ArrayList<String>();
-		for (int addr : device.getIPv4Addresses()) {
-			memIpv4Addresses.add(InetAddresses.fromInteger(addr).getHostAddress());
-		}
-
-		log.debug("Device IP addresses {}, database IP addresses {}",
-				memIpv4Addresses, dbIpv4Addresses);
-
-		for (int ipv4Address : device.getIPv4Addresses()) {
-			//if (deviceObject.getIpv4Address(ipv4Address) == null) {
-			if (!intDbIpv4Addresses.contains(ipv4Address)) {
-				IIpv4Address dbIpv4Address = ope.ensureIpv4Address(ipv4Address);
-
-				/*
-				IDeviceObject oldDevice = dbIpv4Address.getDevice();
-				if (oldDevice != null) {
-					oldDevice.removeIpv4Address(dbIpv4Address);
-				}
-				*/
-
-				log.debug("Adding IP address {}",
-						InetAddresses.fromInteger(ipv4Address).getHostAddress());
-				deviceObject.addIpv4Address(dbIpv4Address);
-			}
-		}
-
-		List<Integer> deviceIpv4Addresses = Arrays.asList(device.getIPv4Addresses());
-		for (IIpv4Address dbIpv4Address : deviceObject.getIpv4Addresses()) {
-			if (!deviceIpv4Addresses.contains(dbIpv4Address.getIpv4Address())) {
-				log.debug("Removing IP address {}",
-						InetAddresses.fromInteger(dbIpv4Address.getIpv4Address())
-						.getHostAddress());
-				deviceObject.removeIpv4Address(dbIpv4Address);
-			}
-		}
-	}
-
-	/**
-	 * Takes an {@link OnosDevice} and adds it into the database. There is no
-	 * checking of the database data and removing old data - an
-	 * {@link OnosDevice} basically corresponds to a packet we've just seen,
-	 * and we need to add that information into the database.
-	 */
-	@Override
-	public void addOnosDevice(OnosDevice onosDevice) {
-		String macAddress = HexString.toHexString(onosDevice.getMacAddress().toBytes());
-
-		//if the switch port we try to attach a new device already has a link, then stop adding device
-		IPortObject portObject1 = ope.searchPort(HexString.toHexString(
-				onosDevice.getSwitchDPID()), onosDevice.getSwitchPort());
-
-		if ((portObject1 != null) && portObject1.getLinkedPorts().iterator().hasNext()) {
-			if (log.isDebugEnabled()) {
-				log.debug("stop adding OnosDevice: {} due to there is a link to: {}",
-						onosDevice, portObject1.getLinkedPorts().iterator().next().getPortId());
-			}
-			return;
-		}
-
-		log.debug("addOnosDevice: {}", onosDevice);
-
-		try {
-			IDeviceObject device = ope.searchDevice(macAddress);
-
-			if (device == null) {
-				device = ope.newDevice();
-				device.setType("device");
-				device.setState("ACTIVE");
-				device.setMACAddress(macAddress);
-			}
-
-			// Check if the device has the IP address, add it if it doesn't
-			if (onosDevice.getIpv4Address() != null) {
-				boolean hasIpAddress = false;
-				for (IIpv4Address ipv4Address : device.getIpv4Addresses()) {
-					if (ipv4Address.getIpv4Address() == onosDevice.getIpv4Address().intValue()) {
-						hasIpAddress = true;
-						break;
-					}
-				}
-
-				if (!hasIpAddress) {
-					IIpv4Address ipv4Address = ope.ensureIpv4Address(onosDevice.getIpv4Address().intValue());
-					IDeviceObject oldDevice = ipv4Address.getDevice();
-					if (oldDevice != null && oldDevice.getMACAddress() != macAddress) {
-						oldDevice.removeIpv4Address(ipv4Address);
-					}
-					device.addIpv4Address(ipv4Address);
-				}
-			}
-
-			// Check if the device has the attachment point, add it if not
-			// TODO single attachment point for now, extend to multiple later
-			String switchDpid = HexString.toHexString(onosDevice.getSwitchDPID());
-			boolean hasAttachmentPoint = false;
-			Iterator<IPortObject> it = device.getAttachedPorts().iterator();
-			if (it.hasNext()) {
-				IPortObject existingPort = it.next();
-				if (existingPort != null) {
-					ISwitchObject existingSwitch = existingPort.getSwitch();
-					if (!existingSwitch.getDPID().equals(switchDpid) ||
-							existingPort.getNumber() != onosDevice.getSwitchPort()) {
-						existingPort.removeDevice(device);
-					}
-					else {
-						hasAttachmentPoint = true;
-					}
-				}
-			}
-
-			/*
-			for (IPortObject portObject : device.getAttachedPorts()) {
-				ISwitchObject switchObject = portObject.getSwitch();
-				if (switchObject.getDPID().equals(switchDpid)
-						&& portObject.getNumber() == onosDevice.getSwitchPort()) {
-					hasAttachmentPoint = true;
-					break;
-				}
-			}
-			*/
-
-			if (!hasAttachmentPoint) {
-				IPortObject portObject = ope.searchPort(switchDpid, onosDevice.getSwitchPort());
-				if (portObject != null) {
-					portObject.setDevice(device);
-				}
-			}
-
-			ope.commit();
-		}
-		catch (TitanException e) {
-			log.error("addOnosDevice {} failed:", macAddress, e);
-			ope.rollback();
-		}
-	}
-	
-	@Override
-	public void deleteOnosDevice(OnosDevice onosDevice){
-		String macAddress = HexString.toHexString(onosDevice.getMacAddress().toBytes());	
-		try {
-			IDeviceObject device = ope.searchDevice(macAddress);
-			if(device != null){
-				ope.removeDevice(device);
-			}
-			ope.commit();
-		}
-		catch (TitanException e){
-			log.error("deleteOnosDevice {} failed:", macAddress, e);
-			ope.rollback();
-		}
-	}
-
-}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/internal/LinkStorageImpl.java b/src/main/java/net/onrc/onos/ofcontroller/core/internal/LinkStorageImpl.java
deleted file mode 100644
index 32f0545..0000000
--- a/src/main/java/net/onrc/onos/ofcontroller/core/internal/LinkStorageImpl.java
+++ /dev/null
@@ -1,526 +0,0 @@
-package net.onrc.onos.ofcontroller.core.internal;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.floodlightcontroller.routing.Link;
-import net.onrc.onos.graph.DBOperation;
-import net.onrc.onos.ofcontroller.core.ILinkStorage;
-import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
-import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
-import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
-import net.onrc.onos.ofcontroller.linkdiscovery.LinkInfo;
-
-import org.openflow.util.HexString;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.tinkerpop.blueprints.impls.ramcloud.PerfMon;
-import net.onrc.onos.graph.GraphDBManager;
-
-/**
- * This is the class for storing the information of links into GraphDB
- */
-public class LinkStorageImpl implements ILinkStorage {
-
-	protected final static Logger log = LoggerFactory.getLogger(LinkStorageImpl.class);
-	protected DBOperation dbop;
-	private static PerfMon pm = PerfMon.getInstance();
-
-	/**
-	 * Initialize the object. Open LinkStorage using given configuration file.
-	 * @param conf Path (absolute path for now) to configuration file.
-	 */
-	@Override
-	public void init(final String dbStore, final String conf) {
-		this.dbop = GraphDBManager.getDBOperation();
-
-	}
-
-	// Method designing policy:
-	//  op.commit() and op.rollback() MUST called in public (first-class) methods.
-	//  A first-class method MUST NOT call other first-class method.
-	//  Routine process should be implemented in private method.
-	//  A private method MUST NOT call commit or rollback.
-
-
-	/**
-	 * Update a record in the LinkStorage in a way provided by dmop.
-	 * @param link Record of a link to be updated.
-	 * @param linkinfo Meta-information of a link to be updated.
-	 * @param dmop Operation to be done.
-	 */
-	@Override
-	public boolean update(Link link, LinkInfo linkinfo, DM_OPERATION dmop) {
-		boolean success = false;
-
-		switch (dmop) {
-		case CREATE:
-		case INSERT:
-			if (link != null) {
-				try {
-					if (addLinkImpl(link)) {
-						dbop.commit();
-						success = true;
-					}
-				} catch (Exception e) {
-					dbop.rollback();
-					e.printStackTrace();
-		        	log.error("LinkStorageImpl:update {} link:{} failed", dmop, link);
-				}
-			}
-			break;
-		case UPDATE:
-			if (link != null && linkinfo != null) {
-				try {
-					if (setLinkInfoImpl(link, linkinfo)) {
-						dbop.commit();
-						success = true;
-					}
-				} catch (Exception e) {
-					dbop.rollback();
-					e.printStackTrace();
-		        	log.error("LinkStorageImpl:update {} link:{} failed", dmop, link);
-				}
-			}
-			break;
-		case DELETE:
-			if (link != null) {
-				try {
-					if (deleteLinkImpl(link)) {
-						dbop.commit();
-						success = true;
-		            	log.debug("LinkStorageImpl:update {} link:{} succeeded", dmop, link);
-		            } else {
-						dbop.rollback();
-		            	log.debug("LinkStorageImpl:update {} link:{} failed", dmop, link);
-					}
-				} catch (Exception e) {
-					dbop.rollback();
-					e.printStackTrace();
-					log.error("LinkStorageImpl:update {} link:{} failed", dmop, link);
-				}
-			}
-			break;
-		}
-
-		return success;
-	}
-
-	@Override
-	public boolean addLink(Link link) {
-		return addLink(link, null);
-	}
-
-	private void deleteDeviceOnPort(Long dpid, Short number)
-	{
-		IPortObject srcPortObject = dbop.searchPort(HexString.toHexString(dpid), number);
-		if (srcPortObject == null)
-		    return;
-		Iterable<IDeviceObject> devices = srcPortObject.getDevices();
-		if (devices == null)
-		    return;
-		if (devices.iterator().hasNext()) {
-			for (IDeviceObject deviceObject: srcPortObject.getDevices()) {
-				srcPortObject.removeDevice(deviceObject);
-				log.debug("delete Device "+ deviceObject.getMACAddress() +
-						" from sw: {} port: {} due to a new link added",
-						dpid, number);
-			}
-		}
-	}
-
-	@Override
-	public boolean addLink(Link link, LinkInfo linfo) {
-		boolean success = false;
-
-		try {
-			//delete the Device attachment points for the related switch and port
-			deleteDeviceOnPort(link.getSrc(),link.getSrcPort());
-			deleteDeviceOnPort(link.getDst(),link.getDstPort());
-
-			pm.addlink_start();
-			if (addLinkImpl(link)) {
-				// Set LinkInfo only if linfo is non-null.
-				if (linfo != null && (! setLinkInfoImpl(link, linfo))) {
-					log.debug("Adding linkinfo failed: {}", link);
-					dbop.rollback();
-				}
-				dbop.commit();
-				pm.addlink_end();
-				success = true;
-			} else {
-				pm.addlink_end();
-				// If we fail here that's because the ports aren't added
-				// before we try to add the link
-				log.debug("Adding link failed: {}", link);
-				dbop.rollback();
-			}
-		} catch (Exception e) {
-			dbop.rollback();
-			e.printStackTrace();
-			log.error("LinkStorageImpl:addLink link:{} linfo:{} failed", link, linfo);
-		}
-
-		return success;
-	}
-
-	/**
-	 * Update multiple records in the LinkStorage in a way provided by op.
-	 * @param links List of records to be updated.
-	 * @param op Operation to be done.
-	 */
-	@Override
-	public boolean addLinks(List<Link> links) {
-		boolean success = false;
-
-		for (Link lt: links) {
-			if (! addLinkImpl(lt)) {
-				return false;
-			}
-		}
-
-		try {
-			dbop.commit();
-			success = true;
-		} catch (Exception e) {
-			dbop.rollback();
-			e.printStackTrace();
-			log.error("LinkStorageImpl:addLinks link:s{} failed", links);
-		}
-
-		return success;
-	}
-
-	/**
-	 * Delete a record in the LinkStorage.
-	 * @param lt Record to be deleted.
-	 */
-	@Override
-	public boolean deleteLink(Link lt) {
-		boolean success = false;
-
-		log.debug("LinkStorageImpl:deleteLink(): {}", lt);
-
-        try {
-         	if (deleteLinkImpl(lt)) {
-        		dbop.commit();
-        		success = true;
-            	log.debug("LinkStorageImpl:deleteLink(): deleted edges {}", lt);
-            } else {
-            	dbop.rollback();
-            	log.error("LinkStorageImpl:deleteLink(): failed invalid vertices {}", lt);
-            }
-        } catch (Exception e) {
-        	dbop.rollback();
-        	log.error("LinkStorageImpl:deleteLink(): failed {} {}",
-        			new Object[]{lt, e.toString()});
-        	e.printStackTrace();
-        }
-
-        return success;
-	}
-
-	/**
-	 * Delete multiple records in LinkStorage.
-	 * @param links List of records to be deleted.
-	 */
-	@Override
-	public boolean deleteLinks(List<Link> links) {
-		boolean success = false;
-
-		try {
-			for (Link lt : links) {
-				if (! deleteLinkImpl(lt)) {
-					dbop.rollback();
-					return false;
-				}
-			}
-			dbop.commit();
-			success = true;
-		} catch (Exception e) {
-        	dbop.rollback();
-			e.printStackTrace();
-        	log.error("LinkStorageImpl:deleteLinks failed invalid vertices {}", links);
-		}
-
-		return success;
-	}
-
-	/**
-	 * Get list of all links connected to the port specified by given DPID and port number.
-	 * @param dpid DPID of desired port.
-	 * @param port Port number of desired port.
-	 * @return List of links. Empty list if no port was found.
-	 */
-	@Override
-	public List<Link> getLinks(Long dpid, short port) {
-	    List<Link> links = new ArrayList<Link>();
-	    IPortObject srcPort = dbop.searchPort(HexString.toHexString(dpid), port);
-	    if (srcPort == null)
-		return links;
-	    ISwitchObject srcSw = srcPort.getSwitch();
-	    if (srcSw == null)
-		return links;
-
-	    for(IPortObject dstPort : srcPort.getLinkedPorts()) {
-		ISwitchObject dstSw = dstPort.getSwitch();
-		if (dstSw != null) {
-		    Link link = new Link(dpid, port,
-					 HexString.toLong(dstSw.getDPID()),
-					 dstPort.getNumber());
-		    links.add(link);
-		}
-	    }
-	    return links;
-	}
-
-	/**
-	 * Get list of all reverse links connected to the port specified by given DPID and port number.
-	 * @param dpid DPID of desired port.
-	 * @param port Port number of desired port.
-	 * @return List of reverse links. Empty list if no port was found.
-	 */
-	@Override
-	public List<Link> getReverseLinks(Long dpid, short port) {
-	    List<Link> links = new ArrayList<Link>();
-
-	    IPortObject srcPort = dbop.searchPort(HexString.toHexString(dpid), port);
-	    if (srcPort == null)
-		return links;
-	    ISwitchObject srcSw = srcPort.getSwitch();
-	    if (srcSw == null)
-		return links;
-
-	    for(IPortObject dstPort : srcPort.getReverseLinkedPorts()) {
-		ISwitchObject dstSw = dstPort.getSwitch();
-		if (dstSw != null) {
-		    Link link = new Link(HexString.toLong(dstSw.getDPID()),
-					 dstPort.getNumber(),
-					 dpid, port);
-		    links.add(link);
-		}
-	    }
-	    return links;
-	}
-
-	/**
-	 * Delete records of the links connected to the port specified by given DPID and port number.
-	 * @param dpid DPID of desired port.
-	 * @param port Port number of desired port.
-	 */
-	@Override
-	public boolean deleteLinksOnPort(Long dpid, short port) {
-		boolean success = false;
-
-		List<Link> linksToDelete = getLinks(dpid, port);
-		try {
-			for(Link l : linksToDelete) {
-				if (! deleteLinkImpl(l)) {
-					dbop.rollback();
-					log.error("LinkStorageImpl:deleteLinksOnPort dpid:{} port:{} failed", dpid, port);
-					return false;
-				}
-			}
-			dbop.commit();
-			success = true;
-		} catch (Exception e) {
-        	dbop.rollback();
-			e.printStackTrace();
-        	log.error("LinkStorageImpl:deleteLinksOnPort dpid:{} port:{} failed", dpid, port);
-		}
-
-		return success;
-	}
-
-	/**
-	 * Get list of all links connected to the switch specified by given DPID.
-	 * @param dpid DPID of desired switch.
-	 * @return List of links. Empty list if no port was found.
-	 */
-	@Override
-	public List<Link> getLinks(String dpid) {
-		List<Link> links = new ArrayList<Link>();
-		ISwitchObject srcSw = dbop.searchSwitch(dpid);
-
-		if(srcSw != null) {
-			for(IPortObject srcPort : srcSw.getPorts()) {
-				for(IPortObject dstPort : srcPort.getLinkedPorts()) {
-					ISwitchObject dstSw = dstPort.getSwitch();
-					if(dstSw != null) {
-					    Link link = new Link(HexString.toLong(dpid),
-		        				srcPort.getNumber(),
-		        				HexString.toLong(dstSw.getDPID()),
-							dstPort.getNumber());
-		        		links.add(link);
-					}
-				}
-			}
-		}
-
-		return links;
-	}
-
-	/**
-	 * Get list of all reverse links connected to the switch specified by
-	 * given DPID.
-	 * @param dpid DPID of desired switch.
-	 * @return List of reverse links. Empty list if no port was found.
-	 */
-	@Override
-	public List<Link> getReverseLinks(String dpid) {
-		List<Link> links = new ArrayList<Link>();
-
-		ISwitchObject srcSw = dbop.searchSwitch(dpid);
-
-		if(srcSw != null) {
-			for(IPortObject srcPort : srcSw.getPorts()) {
-				for(IPortObject dstPort : srcPort.getReverseLinkedPorts()) {
-					ISwitchObject dstSw = dstPort.getSwitch();
-					if(dstSw != null) {
-		        		Link link = new Link(
-							HexString.toLong(dstSw.getDPID()),
-							dstPort.getNumber(),
-
-							HexString.toLong(dpid),
-							srcPort.getNumber());
-		        		links.add(link);
-					}
-				}
-			}
-		}
-
-		return links;
-	}
-
-	/**
-	 * Get list of all links whose state is ACTIVE.
-	 * @return List of active links. Empty list if no port was found.
-	 */
-	@Override
-	public List<Link> getActiveLinks() {
-		Iterable<ISwitchObject> switches = dbop.getActiveSwitches();
-
-		List<Link> links = new ArrayList<Link>();
-
-		for (ISwitchObject srcSw : switches) {
-			for(IPortObject srcPort : srcSw.getPorts()) {
-				for(IPortObject dstPort : srcPort.getLinkedPorts()) {
-					ISwitchObject dstSw = dstPort.getSwitch();
-
-					if(dstSw != null && dstSw.getState().equals("ACTIVE")) {
-						links.add(new Link(HexString.toLong(srcSw.getDPID()),
-								srcPort.getNumber(),
-								HexString.toLong(dstSw.getDPID()),
-								dstPort.getNumber()));
-					}
-				}
-			}
-		}
-
-		return links;
-	}
-
-	@Override
-	public LinkInfo getLinkInfo(Link link) {
-		// TODO implement this
-		return null;
-	}
-
-	/**
-	 * Finalize the object.
-	 */
-	@Override
-	protected void finalize() {
-		close();
-	}
-
-	/**
-	 * Close LinkStorage.
-	 */
-	@Override
-	public void close() {
-		// TODO Auto-generated method stub
-//		graph.shutdown();
-	}
-
-	/**
-	 * Update a record of link with meta-information in the LinkStorage.
-	 * @param link Record of a link to update.
-	 * @param linkinfo Meta-information of a link to be updated.
-	 */
-	private boolean setLinkInfoImpl(Link link, LinkInfo linkinfo) {
-		// TODO implement this
-
-		return false;
-	}
-
-	private boolean addLinkImpl(Link lt) {
-		boolean success = false;
-
-		IPortObject vportSrc = null, vportDst = null;
-
-		// get source port vertex
-		String dpid = HexString.toHexString(lt.getSrc());
-		short port = lt.getSrcPort();
-		log.debug("addLinkImpl Src dpid : {} port : {}", dpid, port);
-		vportSrc = dbop.searchPort(dpid, port);
-
-		// get dest port vertex
-		dpid = HexString.toHexString(lt.getDst());
-		port = lt.getDstPort();
-		log.debug("addLinkImpl Dst dpid : {} port : {}", dpid, port);
-		vportDst = dbop.searchPort(dpid, port);
-
-		log.debug("addLinkImpl vportSrc : {} vportDst : {}", vportSrc, vportDst);
-
-		if (vportSrc != null && vportDst != null) {
-			IPortObject portExist = null;
-			// check if the link exists
-			for (IPortObject V : vportSrc.getLinkedPorts()) {
-			        log.debug("vportSrc.getLinkedPorts() :{}", V);
-				if (V.equals(vportDst)) {
-					portExist = V;
-					break;
-				}
-			}
-
-			if (portExist == null) {
-				vportSrc.setLinkPort(vportDst);
-				success = true;
-			} else {
-				log.error("LinkStorageImpl:addLinkImpl failed link exists {}",
-						new Object[]{lt});
-			}
-		} else {
-			log.error("Ports not found : {}", lt);
-		}
-
-		return success;
-	}
-
-	private boolean deleteLinkImpl(Link lt) {
-		boolean success = false;
-		IPortObject vportSrc = null, vportDst = null;
-
-	    // get source port vertex
-	 	String dpid = HexString.toHexString(lt.getSrc());
-	 	short port = lt.getSrcPort();
-	 	vportSrc = dbop.searchPort(dpid, port);
-
-	    // get dst port vertex
-	 	dpid = HexString.toHexString(lt.getDst());
-	 	port = lt.getDstPort();
-	 	vportDst = dbop.searchPort(dpid, port);
-
-		// FIXME: This needs to remove all edges
-		if (vportSrc != null && vportDst != null) {
-			vportSrc.removeLink(vportDst);
-			log.debug("deleteLinkImpl(): deleted edge {} src {} dst {}", new Object[]{
-				lt, vportSrc, vportDst});
-			success = true;
-		}
-
-		return success;
-	}
-}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImpl.java b/src/main/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImpl.java
deleted file mode 100644
index 1f3a626..0000000
--- a/src/main/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImpl.java
+++ /dev/null
@@ -1,559 +0,0 @@
-package net.onrc.onos.ofcontroller.core.internal;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.tinkerpop.blueprints.impls.ramcloud.PerfMon;
-
-import net.floodlightcontroller.core.IOFSwitch;
-import net.onrc.onos.graph.DBOperation;
-import net.onrc.onos.graph.GraphDBManager;
-import net.onrc.onos.ofcontroller.core.ISwitchStorage;
-import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
-import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
-import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
-import net.onrc.onos.ofcontroller.core.ISwitchStorage;
-
-import org.openflow.protocol.OFPhysicalPort;
-import org.openflow.protocol.OFPhysicalPort.OFPortConfig;
-import org.openflow.protocol.OFPhysicalPort.OFPortState;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This is the class for storing the information of switches into GraphDB
- */
-public class SwitchStorageImpl implements ISwitchStorage {
-
-	protected DBOperation op;
-	protected final static Logger log = LoggerFactory.getLogger(SwitchStorageImpl.class);
-	public final long measureONOSTimeProp = Long.valueOf(System.getProperty("benchmark.measureONOS", "0"));
-	public final long measureAllTimeProp = Long.valueOf(System.getProperty("benchmark.measureAll", "0"));
-
-	private static PerfMon pm = PerfMon.getInstance();
-
-	/***
-	 * Initialize function. Before you use this class, please call this method
-	 * @param conf configuration file for Cassandra DB
-	 */
-	@Override
-	public void init(final String dbStore, final String conf) {
-		op = GraphDBManager.getDBOperation();
-	}
-
-
-	/***
-	 * Finalize/close function. After you use this class, please call this method.
-	 * It will close the DB connection.
-	 */
-	@Override
-	protected void finalize() {
-		close();
-	}
-
-	/***
-	 * Finalize/close function. After you use this class, please call this method.
-	 * It will close the DB connection. This is for Java garbage collection.
-	 */
-	@Override
-	public void close() {
-		op.close();
-	}
-
-	// Method designing policy:
-	//  op.commit() and op.rollback() MUST called in public (first-class) methods.
-	//  A first-class method MUST NOT call other first-class method.
-	//  Routine process should be implemented in private method.
-	//  A private method MUST NOT call commit or rollback.
-
-	/***
-	 * This function is for updating the switch into the DB.
-	 * @param dpid The switch dpid you want to update from the DB
-	 * @param state The state of the switch like ACTIVE, INACTIVE
-	 * @param dmope	The DM_OPERATION of the switch
-	 */
-	/*
-	 * Jono, 11/8/2013
-	 * We don't need this update method that demultiplexes DM_OPERATIONS,
-	 * we can have clients just call the required methods directly.
-	 * We especially don't need this update method to re-implement
-	 * the functions of other methods.
-	 */
-	@Deprecated
-	@Override
-	public boolean updateSwitch(String dpid, SwitchState state, DM_OPERATION dmope) {
-		boolean success = false;
-		ISwitchObject sw = null;
-
-		log.info("SwitchStorage:update {} dpid:{}", dmope, dpid);
-	    switch(dmope) {
-	    	case UPDATE:
-            	try {
-		    		sw = op.searchSwitch(dpid);
-		    		if (sw != null) {
-			            	setSwitchStateImpl(sw, state);
-							op.commit();
-							success = true;
-		    		}
-				} catch (Exception e) {
-					op.rollback();
-					e.printStackTrace();
-					log.info("SwitchStorage:update {} dpid:{} failed", dmope, dpid);
-				}
-	    		break;
-	    	case INSERT:
-	    	case CREATE:
-            	try {
-		            sw = addSwitchImpl(dpid);
-		            if (sw != null) {
-			            if (state != SwitchState.ACTIVE) {
-			            	setSwitchStateImpl(sw, state);
-			            }
-						op.commit();
-						success = true;
-		            }
-				} catch (Exception e) {
-					op.rollback();
-					e.printStackTrace();
-					log.info("SwitchStorage:update {} dpid:{} failed", dmope, dpid);
-				}
-	            break;
-	    	case DELETE:
-	            try {
-		    		sw = op.searchSwitch(dpid);
-		    		if (sw != null) {
-				            deleteSwitchImpl(sw);
-							op.commit();
-							success = true;
-		    		}
-				} catch (Exception e) {
-					op.rollback();
-					e.printStackTrace();
-					log.info("SwitchStorage:update {} dpid:{} failed", dmope, dpid);
-				}
-	            break;
-	    	default:
-	    }
-
-	    return success;
-	}
-
-	@Override
-	public boolean addSwitch(IOFSwitch sw) {
-		boolean success = false;
-
-		String dpid = sw.getStringId();
-		log.info("SwitchStorage:addSwitch(): dpid {} ", dpid);
-                long startSwitchTime = 0, endSwitchTime = 0;
-                long startUpdSwitchTime = 0, endUpdSwitchTime=0;
-                long startPortTime = 0, endPortTime=0;
-                long totalStartTime =0, totalEndTime=0;
-                long Tstamp1=0;
-		
-		try {
-			if (measureONOSTimeProp == 1) {
-		            log.error("Performance: addSwitch dpid= {} Start", dpid);
-			    totalStartTime = System.nanoTime();
-			}
-			pm.addswitch_start();
-			ISwitchObject curr = op.searchSwitch(dpid);
-			if (measureONOSTimeProp == 1) {
-			    Tstamp1 = System.nanoTime();
-		            log.error("Performance: addSwitch dpid= {} searchSwitch done at {} took {}", dpid, Tstamp1, Tstamp1-totalStartTime);
-			}
-
-			if (curr != null) {
-				//If existing the switch. set The SW state ACTIVE.
-				log.info("SwitchStorage:addSwitch dpid:{} already exists", dpid);
-				if (measureONOSTimeProp == 1) {
-				    startUpdSwitchTime = System.nanoTime();
-				}
-				setSwitchStateImpl(curr, SwitchState.ACTIVE);
-				if (measureONOSTimeProp == 1) {
-				    endUpdSwitchTime = System.nanoTime();
-				}
-			} else {
-				if (measureONOSTimeProp == 1) {
-				    startSwitchTime = System.nanoTime();
-				}
-				curr = addSwitchImpl(dpid);
-			        pm.addswitch_end();
-				if (measureONOSTimeProp == 1) {
-				    endSwitchTime = System.nanoTime();
-		                    //log.error("Performance: addSwitch dpid= {} addSwitchImpl done at {} took {}", dpid, endSwitchTime, endSwitchTime-startSwitchTime);
-		                    log.error("Performance: addSwitch dpid= {} End searchSwitch {} addSwitchImpl {} total {} diff {}", dpid, Tstamp1-totalStartTime, endSwitchTime-startSwitchTime, endSwitchTime-totalStartTime,endSwitchTime-totalStartTime-(Tstamp1-totalStartTime)-(endSwitchTime-startSwitchTime)); 
-				}
-			}
-			if (measureONOSTimeProp == 1) {
-			    startPortTime = System.nanoTime();
-			}
-                        long noOfPorts = 0;
-			pm.addport_start();
-			for (OFPhysicalPort port: sw.getPorts()) {
-				//addPort(dpid, port);
-				addPortImpl(curr, port);
-                                noOfPorts++;
-			    	pm.addport_incr();
-			}
-			pm.addport_end();
-			if (measureONOSTimeProp == 1) {
-			    endPortTime = System.nanoTime();
-			}
-			// XXX for now delete devices when we change a port to prevent
-			// having stale devices.
-			DeviceStorageImpl deviceStorage = new DeviceStorageImpl();
-			deviceStorage.init("","");
-			for (IPortObject portObject : curr.getPorts()) {
-				for (IDeviceObject deviceObject : portObject.getDevices()) {
-					// The deviceStorage has to remove on the object gained by its own
-					// FramedGraph, it can't use our objects from here
-					deviceStorage.removeDeviceImpl(deviceStorage.getDeviceByMac(deviceObject.getMACAddress()));
-				}
-			}
-
-			op.commit();
-			if (measureONOSTimeProp == 1) {
-			    totalEndTime = System.nanoTime();
-			}
-                        if (startSwitchTime != 0) {
-                            //log.error("Performance -- switch add total time {}", endSwitchTime - startSwitchTime);
-                            log.error("Performance -- switch add total time {} including_search {}", endSwitchTime - startSwitchTime, endSwitchTime - totalStartTime);
-                        }
-                        if (startUpdSwitchTime != 0) {
-                            log.error("Performance -- switch update total time {} including_search {}", endUpdSwitchTime - startUpdSwitchTime, endUpdSwitchTime - totalStartTime);
-                        }
-                        if (startPortTime != 0) {
-                            log.error("Performance @@ port add total time {} no of ports written {}", endPortTime - startPortTime, noOfPorts);
-                        }
-			if (totalStartTime != 0) {
-			    log.error("Performance && total time for add switch {}", totalEndTime - totalStartTime);
-			}
-			success = true;
-		} catch (Exception e) {
-			op.rollback();
-			log.error("SwitchStorage:addSwitch dpid:"+dpid+" failed", e);
-		}
-
-		return success;
-	}
-
-	/***
-	 * This function is for adding the switch into the DB.
-	 * @param dpid The switch dpid you want to add into the DB.
-	 */
-	// This method is only called by tests, so we probably don't need it.
-	// If we need both addSwitch interfaces, one should call the other
-	// rather than implementing the same logic twice.
-	@Deprecated
-	@Override
-	public boolean addSwitch(String dpid) {
-		boolean success = false;
-
-		log.info("SwitchStorage:addSwitch(): dpid {} ", dpid);
-		try {
-			ISwitchObject sw = op.searchSwitch(dpid);
-			if (sw != null) {
-				//If existing the switch. set The SW state ACTIVE.
-				log.info("SwitchStorage:addSwitch dpid:{} already exists", dpid);
-				setSwitchStateImpl(sw, SwitchState.ACTIVE);
-			} else {
-				addSwitchImpl(dpid);
-			}
-			op.commit();
-			success = true;
-		} catch (Exception e) {
-			op.rollback();
-			e.printStackTrace();
-			log.error("SwitchStorage:addSwitch dpid:"+dpid+" failed", e);
-		}
-
-		return success;
-	}
-
-	/***
-	 * This function is for deleting the switch into the DB.
-	 * @param dpid The switch dpid you want to delete from the DB.
-	 */
-	@Override
-	public boolean deleteSwitch(String dpid) {
-		boolean success = false;
-
-		try {
-			ISwitchObject sw = op.searchSwitch(dpid);
-			if (sw != null) {
-				deleteSwitchImpl(sw);
-	        	op.commit();
-			}
-			success = true;
-		} catch (Exception e) {
-			op.rollback();
-			e.printStackTrace();
-			log.error("SwitchStorage:deleteSwitch {} failed", dpid);
-		}
-
-		return success;
-	}
-
-	@Override
-	public boolean deactivateSwitch(String dpid) {
-		boolean success = false;
-
-		try {
-			ISwitchObject switchObject = op.searchSwitch(dpid);
-			if (switchObject != null) {
-				setSwitchStateImpl(switchObject, SwitchState.INACTIVE);
-
-				for (IPortObject portObject : switchObject.getPorts()) {
-					portObject.setState("INACTIVE");
-				}
-				op.commit();
-				success = true;
-			}
-			else {
-				log.warn("Switch {} not found when trying to deactivate", dpid);
-			}
-		} catch (Exception e) {
-			// TODO what type of exception is thrown when we can't commit?
-			op.rollback();
-			log.error("SwitchStorage:deactivateSwitch "+dpid+" failed", e);
-		}
-
-		return success;
-	}
-
-	@Override
-	public boolean updatePort(String dpid, short portNum, int state, String desc) {
-		boolean success = false;
-
-		try {
-			ISwitchObject sw = op.searchSwitch(dpid);
-
-	        if (sw != null) {
-	        	IPortObject p = sw.getPort(portNum);
-	        	log.info("SwitchStorage:updatePort dpid:{} port:{}", dpid, portNum);
-	        	if (p != null) {
-	        		setPortStateImpl(p, state, desc);
-				op.commit();
-	        	}
-        		success = true;
-	        } else {
-	    		log.error("SwitchStorage:updatePort dpid:{} port:{} : failed switch does not exist", dpid, portNum);
-	        }
-		} catch (Exception e) {
-			op.rollback();
-			e.printStackTrace();
-			log.error("SwitchStorage:addPort dpid:{} port:{} failed", dpid, portNum);
-		}
-
-		return success;
-	}
-
-	/***
-	 * This function is for adding the switch port into the DB.
-	 * @param dpid The switch dpid that has the port.
-	 * @param phport The port you want to add the switch.
-	 */
-	@Override
-	public boolean addPort(String dpid, OFPhysicalPort phport) {
-		boolean success = false;
-
-		if(((OFPortConfig.OFPPC_PORT_DOWN.getValue() & phport.getConfig()) > 0) ||
-				((OFPortState.OFPPS_LINK_DOWN.getValue() & phport.getState()) > 0)) {
-			// just dispatch to deletePort()
-			// TODO This is wrong. We need to make sure the port is in the
-			// DB with the correct info and port state.
-			return deletePort(dpid, phport.getPortNumber());
-		}
-
-		try {
-			ISwitchObject sw = op.searchSwitch(dpid);
-
-	        if (sw != null) {
-	        	IPortObject portObject = addPortImpl(sw, phport);
-
-	        	// XXX for now delete devices when we change a port to prevent
-	    		// having stale devices.
-	    		DeviceStorageImpl deviceStorage = new DeviceStorageImpl();
-	    		deviceStorage.init("","");
-
-	    		for (IDeviceObject deviceObject : portObject.getDevices()) {
-	    			deviceStorage.removeDevice(deviceObject);
-	    		}
-
-        		op.commit();
-        		success = true;
-	        } else {
-	    		log.error("SwitchStorage:addPort dpid:{} port:{} : failed switch does not exist", dpid, phport.getPortNumber());
-	        }
-		} catch (Exception e) {
-			op.rollback();
-			e.printStackTrace();
-			log.error("SwitchStorage:addPort dpid:{} port:{} failed", dpid, phport.getPortNumber());
-		}
-
-		return success;
-	}
-
-	/***
-	 * This function is for deleting the switch port from the DB.
-	 * @param dpid The switch dpid that has the port.
-	 * @param port The port you want to delete the switch.
-	 */
-	@Override
-	public boolean deletePort(String dpid, short port) {
-		boolean success = false;
-
-		DeviceStorageImpl deviceStorage = new DeviceStorageImpl();
-		deviceStorage.init("","");
-
-		try {
-			ISwitchObject sw = op.searchSwitch(dpid);
-
-	        if (sw != null) {
-	        	IPortObject p = sw.getPort(port);
-	            if (p != null) {
-	        		log.info("SwitchStorage:deletePort dpid:{} port:{} found and set INACTIVE", dpid, port);
-	        		p.setState("INACTIVE");
-
-	        		// XXX for now delete devices when we change a port to prevent
-	        		// having stale devices.
-	        		for (IDeviceObject d : p.getDevices()) {
-	        			deviceStorage.removeDevice(d);
-	        		}
-	        		op.commit();
-	        	}
-	        }
-
-	        success = true;
-		} catch (Exception e) {
-			op.rollback();
-			e.printStackTrace();
-			log.error("SwitchStorage:deletePort dpid:{} port:{} failed", dpid, port);
-		}
-
-		return success;
-	}
-
-	/**
-	 * Get list of all ports on the switch specified by given DPID.
-	 *
-	 * @param dpid DPID of desired switch.
-	 * @return List of port IDs. Empty list if no port was found.
-	 */
-	@Override
-	public List<Short> getPorts(String dpid) {
-	    List<Short> ports = new ArrayList<Short>();
-
-	    ISwitchObject srcSw = op.searchSwitch(dpid);
-	    if (srcSw != null) {
-		for (IPortObject srcPort : srcSw.getPorts()) {
-		    ports.add(srcPort.getNumber());
-		}
-	    }
-
-	    return ports;
-	}
-
-	private ISwitchObject addSwitchImpl(String dpid) {
-		if (dpid != null) {
-			ISwitchObject sw = op.newSwitch(dpid);
-			sw.setState(SwitchState.ACTIVE.toString());
-			log.info("SwitchStorage:addSwitchImpl dpid:{} added", dpid);
-			return sw;
-		} else {
-			return null;
-		}
-	}
-
-	private void setSwitchStateImpl(ISwitchObject sw, SwitchState state) {
-		if (sw != null && state != null) {
-			sw.setState(state.toString());
-			log.info("SwitchStorage:setSwitchStateImpl dpid:{} updated {}",
-					sw.getDPID(), state);
-		}
-	}
-
-	private void deleteSwitchImpl(ISwitchObject sw) {
-        if (sw  != null) {
-        	op.removeSwitch(sw);
-        	log.info("SwitchStorage:DeleteSwitchImpl dpid:{} done",
-        			sw.getDPID());
-        }
-	}
-
-
-	private IPortObject addPortImpl(ISwitchObject sw, OFPhysicalPort phport) {
-		IPortObject portObject = op.searchPort(sw.getDPID(), phport.getPortNumber());
-
-    	log.info("SwitchStorage:addPort dpid:{} port:{}",
-    			sw.getDPID(), phport.getPortNumber());
-
-    	if (portObject != null) {
-    		setPortStateImpl(portObject, phport.getState(), phport.getName());
-    		portObject.setState("ACTIVE");
-
-    		// This a convoluted way of checking if the port is attached
-    		// or not, but doing it this way avoids using the
-    		// ISwitchObject.getPort method which uses GremlinGroovy query
-    		// and takes forever.
-    		boolean attached = false;
-    		for (IPortObject portsOnSwitch : sw.getPorts()) {
-    			if (portsOnSwitch.getPortId().equals( portObject.getPortId() )) {
-    				attached = true;
-    				break;
-    			}
-    		}
-
-    		if (!attached) {
-    			sw.addPort(portObject);
-    		}
-
-    		/*
-    		if (sw.getPort(phport.getPortNumber()) == null) {
-    			// The port exists but the switch has no "on" link to it
-    			sw.addPort(portObject);
-    		}*/
-
-    		log.info("SwitchStorage:addPort dpid:{} port:{} exists setting as ACTIVE",
-    				sw.getDPID(), phport.getPortNumber());
-    	} else {
-    		//addPortImpl(sw, phport.getPortNumber());
-    		portObject = op.newPort(sw.getDPID(), phport.getPortNumber());
-    		portObject.setState("ACTIVE");
-    		setPortStateImpl(portObject, phport.getState(), phport.getName());
-    		sw.addPort(portObject);
-        	log.info("SwitchStorage:addPort dpid:{} port:{} done",
-        			sw.getDPID(), phport.getPortNumber());
-    	}
-
-    	return portObject;
-	}
-	// TODO There's an issue here where a port with that ID could already
-	// exist when we try to add this one (because it's left over from an
-	// old topology). We need to remove an old port with the same ID when
-	// we add the new port. Also it seems that old ports like this are
-	// never cleaned up and will remain in the DB in the ACTIVE state forever.
-	/*private IPortObject addPortImpl(ISwitchObject sw, short portNum) {
-		IPortObject p = op.newPort(sw.getDPID(), portNum);
-		p.setState("ACTIVE");
-		sw.addPort(p);
-    	log.info("SwitchStorage:addPortImpl dpid:{} port:{} done",
-    			sw.getDPID(), portNum);
-
-		return p;
-	}*/
-
-	private void setPortStateImpl(IPortObject port, Integer state, String desc) {
-		if (port != null) {
-			if (state != null) {
-				port.setPortState(state);
-			}
-			if (desc != null) {
-				port.setDesc(desc);
-			}
-
-	    	log.info("SwitchStorage:setPortStateImpl port:{} state:{} desc:{} done",
-	    			new Object[] {port.getPortId(), state, desc});
-		}
-	}
-}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/internal/TopoLinkServiceImpl.java b/src/main/java/net/onrc/onos/ofcontroller/core/internal/TopoLinkServiceImpl.java
deleted file mode 100644
index 718816d..0000000
--- a/src/main/java/net/onrc/onos/ofcontroller/core/internal/TopoLinkServiceImpl.java
+++ /dev/null
@@ -1,101 +0,0 @@
-package net.onrc.onos.ofcontroller.core.internal;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.floodlightcontroller.routing.Link;
-import net.onrc.onos.graph.DBOperation;
-import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
-import net.onrc.onos.ofcontroller.core.INetMapTopologyService.ITopoLinkService;
-
-import org.openflow.util.HexString;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.tinkerpop.blueprints.Vertex;
-import com.tinkerpop.gremlin.java.GremlinPipeline;
-import net.onrc.onos.graph.GraphDBManager;
-import com.tinkerpop.pipes.PipeFunction;
-import com.tinkerpop.pipes.transform.PathPipe;
-
-public class TopoLinkServiceImpl implements ITopoLinkService {
-	
-	protected DBOperation dbop;
-	protected final static Logger log = LoggerFactory.getLogger(TopoLinkServiceImpl.class);
-
-	@Override
-	protected void finalize() {
-		close();
-	}
-
-	@Override
-	public void close() {
-		dbop.close();
-	}
-
-	@Override
-	public List<Link> getActiveLinks() {
-		dbop = GraphDBManager.getDBOperation();
-		Iterable<ISwitchObject> switches = dbop.getActiveSwitches();
-		List<Link> links = new ArrayList<Link>(); 
-		for (ISwitchObject sw : switches) {
-			GremlinPipeline<Vertex, Link> pipe = new GremlinPipeline<Vertex, Link>();
-			ExtractLink extractor = new ExtractLink();
-
-			pipe.start(sw.asVertex());
-			pipe.enablePath(true);
-			pipe.out("on").out("link").in("on").path().step(extractor);
-
-			while (pipe.hasNext() ) {
-				Link l = pipe.next();
-				links.add(l);
-			}
-
-		}
-		dbop.commit();
-		return links;
-	}
-
-	@Override
-	public List<Link> getLinksOnSwitch(String dpid) {
-		List<Link> links = new ArrayList<Link>(); 
-		ISwitchObject sw = dbop.searchSwitch(dpid);
-		GremlinPipeline<Vertex, Link> pipe = new GremlinPipeline<Vertex, Link>();
-		ExtractLink extractor = new ExtractLink();
-
-		pipe.start(sw.asVertex());
-		pipe.enablePath(true);
-		pipe.out("on").out("link").in("on").path().step(extractor);
-
-		while (pipe.hasNext() ) {
-			Link l = pipe.next();
-			links.add(l);
-		}
-		return links;
-
-	}
-
-	private static class ExtractLink implements PipeFunction<PathPipe<Vertex>, Link> {
-		@Override
-		public Link compute(PathPipe<Vertex> pipe) {
-			long s_dpid = 0;
-			long d_dpid = 0;
-			short s_port = 0;
-			short d_port = 0;
-
-			List<?> V = pipe.next();
-			Vertex src_sw = (Vertex)V.get(0);
-			Vertex dest_sw = (Vertex)V.get(3);
-			Vertex src_port = (Vertex)V.get(1);
-			Vertex dest_port = (Vertex)V.get(2);
-			s_dpid = HexString.toLong((String) src_sw.getProperty("dpid"));
-			d_dpid = HexString.toLong((String) dest_sw.getProperty("dpid"));
-			s_port = (Short) src_port.getProperty("number");
-			d_port = (Short) dest_port.getProperty("number");
-
-			Link l = new Link(s_dpid,s_port,d_dpid,d_port);
-
-			return l;
-		}
-	}
-}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/internal/TopoSwitchServiceImpl.java b/src/main/java/net/onrc/onos/ofcontroller/core/internal/TopoSwitchServiceImpl.java
deleted file mode 100644
index 56e6b73..0000000
--- a/src/main/java/net/onrc/onos/ofcontroller/core/internal/TopoSwitchServiceImpl.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package net.onrc.onos.ofcontroller.core.internal;
-
-import net.onrc.onos.graph.DBOperation;
-import net.onrc.onos.graph.GraphDBManager;
-import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
-import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
-import net.onrc.onos.ofcontroller.core.INetMapTopologyService.ITopoSwitchService;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TopoSwitchServiceImpl implements ITopoSwitchService {
-
-	private DBOperation op;
-	protected final static Logger log = LoggerFactory.getLogger(TopoSwitchServiceImpl.class);
-
-	public TopoSwitchServiceImpl(final String dbStore, String conf) {
-		op = GraphDBManager.getDBOperation();
-	}
-
-	public TopoSwitchServiceImpl() {
-		this("","");
-	}
-
-	@Override
-	protected void finalize() {
-		close();
-	}
-
-	@Override
-	public void close() {
-		op.close();
-	}
-
-	@Override
-	public Iterable<ISwitchObject> getActiveSwitches() {
-		// TODO Auto-generated method stub
-		//op.close(); //Commit to ensure we see latest data
-		return op.getActiveSwitches();
-	}
-
-	@Override
-	public Iterable<ISwitchObject> getAllSwitches() {
-		// TODO Auto-generated method stub
-		//op.close(); //Commit to ensure we see latest data
-		return op.getAllSwitches();
-	}
-
-	@Override
-	public Iterable<ISwitchObject> getInactiveSwitches() {
-		// TODO Auto-generated method stub
-		//op.close(); //Commit to ensure we see latest data
-		return op.getInactiveSwitches();
-	}
-
-	@Override
-	public Iterable<IPortObject> getPortsOnSwitch(String dpid) {
-		//op.close(); //Commit to ensure we see latest data
-		ISwitchObject switchObject = op.searchSwitch(dpid);
-		if (switchObject != null) {
-			return switchObject.getPorts();
-		}
-		return null;
-	}
-
-	@Override
-	public IPortObject getPortOnSwitch(String dpid, short port_num) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/devicemanager/OnosDeviceManager.java b/src/main/java/net/onrc/onos/ofcontroller/devicemanager/OnosDeviceManager.java
index 1ccc892..ef02577 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/devicemanager/OnosDeviceManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/devicemanager/OnosDeviceManager.java
@@ -29,8 +29,6 @@
 import net.floodlightcontroller.packet.UDP;
 import net.floodlightcontroller.util.MACAddress;
 import net.onrc.onos.datagrid.IDatagridService;
-import net.onrc.onos.ofcontroller.core.IDeviceStorage;
-import net.onrc.onos.ofcontroller.core.internal.DeviceStorageImpl;
 
 import org.openflow.protocol.OFMessage;
 import org.openflow.protocol.OFPacketIn;
@@ -44,7 +42,6 @@
 	private static final int CLEANUP_SECOND = 60*60;
 	private static final int AGEING_MILLSEC = 60*60*1000;
 
-	private IDeviceStorage deviceStorage;
 	private IFloodlightProviderService floodlightProvider;
 	private final static ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
 
@@ -66,11 +63,14 @@
 
 		@Override
 		public void dispatch() {
+		    // TODO: Fix the code below after deviceStorage was removed
+		    /*
 			if(type == OnosDeviceUpdateType.ADD) {
 				deviceStorage.addOnosDevice(device);
 			} else if (type == OnosDeviceUpdateType.DELETE){
 				deviceStorage.deleteOnosDevice(device);
 			}
+		    */
 		}
 	}
 
@@ -287,8 +287,6 @@
 			throws FloodlightModuleException {
 		floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class);
 		executor.scheduleAtFixedRate(new CleanDevice(), 30 ,CLEANUP_SECOND, TimeUnit.SECONDS);
-		deviceStorage = new DeviceStorageImpl();
-		deviceStorage.init("","");
 
 		datagrid = context.getServiceImpl(IDatagridService.class);
 	}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/NetworkGraphPublisher.java b/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/NetworkGraphPublisher.java
index c7f441a..c73a8e4 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/NetworkGraphPublisher.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/NetworkGraphPublisher.java
@@ -27,15 +27,9 @@
 import net.onrc.onos.datagrid.IDatagridService;
 import net.onrc.onos.graph.IDBConnection;
 import net.onrc.onos.graph.LocalTopologyEventListener;
-import net.onrc.onos.ofcontroller.core.IDeviceStorage;
-import net.onrc.onos.ofcontroller.core.ILinkStorage;
 import net.onrc.onos.ofcontroller.core.INetMapStorage.DM_OPERATION;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
 import net.onrc.onos.ofcontroller.core.IOFSwitchPortListener;
-import net.onrc.onos.ofcontroller.core.ISwitchStorage;
-import net.onrc.onos.ofcontroller.core.internal.DeviceStorageImpl;
-import net.onrc.onos.ofcontroller.core.internal.LinkStorageImpl;
-import net.onrc.onos.ofcontroller.core.internal.SwitchStorageImpl;
 import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryListener;
 import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
 import net.onrc.onos.ofcontroller.linkdiscovery.LinkInfo;
@@ -58,9 +52,6 @@
 					      ILinkDiscoveryListener,
 					      IFloodlightModule {
 
-	protected IDeviceStorage devStore;
-	protected ISwitchStorage swStore;
-	protected ILinkStorage linkStore;
 	protected final static Logger log = LoggerFactory.getLogger(NetworkGraphPublisher.class);
 	//protected IDeviceService deviceService;
 	protected IControllerRegistryService registryService;
@@ -103,6 +94,7 @@
 
 		@Override
 		public void controlChanged(long dpid, boolean hasControl) {
+		    /*
 			if (hasControl) {
 				log.debug("got control to set inactive sw {}", HexString.toHexString(dpid));
 				try {
@@ -124,7 +116,6 @@
 					    // notification to remove the
 					    // switch, because it is inactive
 					    //
-					    /*
 					    TopologyElement topologyElement =
 						new TopologyElement(dpid);
 					    datagridService.notificationSendTopologyElementRemoved(topologyElement);
@@ -144,12 +135,12 @@
 									link.getDstPort());
 						datagridService.notificationSendTopologyElementRemoved(topologyElementLink);
 					    }
-					    */
 					}
 				} catch (Exception e) {
 	                log.error("Error in SwitchCleanup:controlChanged ", e);
 				}
 			}
+		    */
 		}
     }
 
@@ -190,21 +181,22 @@
     	case LINK_REMOVED:
     		log.debug("LinkDiscoveryUpdate(): Removing link {}", lt);
 
+		/*
     		if (linkStore.deleteLink(lt)) {
     			// TODO publish DELETE_LINK event here
-		    /*
     			TopologyElement topologyElement =
     					new TopologyElement(update.getSrc(),
     							update.getSrcPort(),
     							update.getDst(),
     							update.getDstPort());
     			datagridService.notificationSendTopologyElementRemoved(topologyElement);
-		    */
     		}
+		*/
     		break;
     	case LINK_UPDATED:
     		log.debug("LinkDiscoveryUpdate(): Updating link {}", lt);
 
+		/*
     		LinkInfo linfo = linkStore.getLinkInfo(lt);
     		// TODO update "linfo" using portState derived using "update"
     		if (linkStore.update(lt, linfo, DM_OPERATION.UPDATE)) {
@@ -213,30 +205,29 @@
     			// TODO NOTE: Here we assume that updated
     			// link is UP.
     			//
-		    /*
     			TopologyElement topologyElement =
     					new TopologyElement(update.getSrc(),
     							update.getSrcPort(),
     							update.getDst(),
     							update.getDstPort());
     			datagridService.notificationSendTopologyElementUpdated(topologyElement);
-		    */
     		}
+		*/
     		break;
     	case LINK_ADDED:
     		log.debug("LinkDiscoveryUpdate(): Adding link {}", lt);
 
+		/*
     		if (linkStore.addLink(lt)) {
     			// TODO publish ADD_LINK event here
-		    /*
     			TopologyElement topologyElement =
     					new TopologyElement(update.getSrc(),
     							update.getSrcPort(),
     							update.getDst(),
     							update.getDstPort());
     			datagridService.notificationSendTopologyElementAdded(topologyElement);
-		    */
     		}
+		*/
 
     		break;
     	default:
@@ -247,10 +238,10 @@
 
 	@Override
 	public void addedSwitch(IOFSwitch sw) {
+	    /*
 		if (registryService.hasControl(sw.getId())) {
 			if (swStore.addSwitch(sw)) {
 			    // TODO publish ADD_SWITCH event here
-			    /*
 			    TopologyElement topologyElement =
 				new TopologyElement(sw.getId());
 			    datagridService.notificationSendTopologyElementAdded(topologyElement);
@@ -282,9 +273,9 @@
 							link.getDstPort());
 				datagridService.notificationSendTopologyElementAdded(topologyElementLink);
 			    }
-			    */
 			}
 		}
+	    */
 	}
 
 	@Override
@@ -333,13 +324,13 @@
 
 	@Override
 	public void switchPortAdded(Long switchId, OFPhysicalPort port) {
+	    /*
 		if (swStore.addPort(HexString.toHexString(switchId), port)) {
 			// Allow links to be discovered on this port now that it's
 			// in the database
 			linkDiscovery.RemoveFromSuppressLLDPs(switchId, port.getPortNumber());
 
 		    // TODO publish ADD_PORT event here
-			/*
 		    TopologyElement topologyElement =
 			new TopologyElement(switchId, port.getPortNumber());
 		    datagridService.notificationSendTopologyElementAdded(topologyElement);
@@ -359,13 +350,15 @@
 						link.getDstPort());
 			datagridService.notificationSendTopologyElementAdded(topologyElementLink);
 		    }
-		    */
 		}
+	    */
 	}
 
 	@Override
 	public void switchPortRemoved(Long switchId, OFPhysicalPort port) {
 		// Remove all links that might be connected already
+
+		/*
 		PerformanceMonitor.start("SwitchPortRemoved.DbAccess");
 
 		List<Link> links = linkStore.getLinks(switchId, port.getPortNumber());
@@ -377,7 +370,6 @@
 		    PerformanceMonitor.stop("SwitchPortRemoved.DbAccess");
 		    PerformanceMonitor.start("SwitchPortRemoved.NotificationSend");
 		    // TODO publish DELETE_PORT event here
-		    /*
 		    TopologyElement topologyElement =
 			new TopologyElement(switchId, port.getPortNumber());
 		    datagridService.notificationSendTopologyElementRemoved(topologyElement);
@@ -391,11 +383,11 @@
 						link.getDstPort());
 			datagridService.notificationSendTopologyElementRemoved(topologyElementLink);
 		    }
-		    */
 		    PerformanceMonitor.stop("SwitchPortRemoved.NotificationSend");
 		    PerformanceMonitor.report("SwitchPortRemoved.DbAccess");
 		    PerformanceMonitor.report("TopologyEntryRemoved.NotificationReceived");
 		}
+		*/
 	}
 
 	@Override
@@ -406,28 +398,30 @@
 	@Override
 	public void deviceAdded(IDevice device) {
 		log.debug("{}:deviceAdded(): Adding device {}",this.getClass(),device.getMACAddressString());
+		/*
 		devStore.addDevice(device);
 		for (int intIpv4Address : device.getIPv4Addresses()) {
 			datagridService.sendArpReplyNotification(new ArpReplyNotification(
 					InetAddresses.fromInteger(intIpv4Address), 
 					MACAddress.valueOf(device.getMACAddress())));
 		}
+		*/
 	}
 
 	@Override
 	public void deviceRemoved(IDevice device) {
 		// TODO Auto-generated method stub
-		devStore.removeDevice(device);
+		// devStore.removeDevice(device);
 	}
 
 	@Override
 	public void deviceMoved(IDevice device) {
-		devStore.changeDeviceAttachments(device);
+		// devStore.changeDeviceAttachments(device);
 	}
 
 	@Override
 	public void deviceIPV4AddrChanged(IDevice device) {
-		devStore.changeDeviceIPv4Address(device);
+		// devStore.changeDeviceIPv4Address(device);
 	}
 
 	@Override
@@ -474,15 +468,6 @@
 		registryService = context.getServiceImpl(IControllerRegistryService.class);
 		datagridService = context.getServiceImpl(IDatagridService.class);
 
-		devStore = new DeviceStorageImpl();
-		devStore.init(dbStore, conf);
-
-		swStore = new SwitchStorageImpl();
-		swStore.init(dbStore, conf);
-
-		linkStore = new LinkStorageImpl();
-		linkStore.init(dbStore, conf);
-
 		log.debug("Initializing NetworkGraphPublisher module with {}", conf);
 
 	}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/forwarding/Forwarding.java b/src/main/java/net/onrc/onos/ofcontroller/forwarding/Forwarding.java
index 884c717..97b3e28 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/forwarding/Forwarding.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/forwarding/Forwarding.java
@@ -20,11 +20,9 @@
 import net.floodlightcontroller.packet.Ethernet;
 import net.floodlightcontroller.util.MACAddress;
 import net.onrc.onos.datagrid.IDatagridService;
-import net.onrc.onos.ofcontroller.core.IDeviceStorage;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
-import net.onrc.onos.ofcontroller.core.internal.DeviceStorageImpl;
 import net.onrc.onos.ofcontroller.devicemanager.IOnosDeviceService;
 import net.onrc.onos.ofcontroller.flowprogrammer.IFlowPusherService;
 import net.onrc.onos.ofcontroller.proxyarp.BroadcastPacketOutNotification;
@@ -74,8 +72,6 @@
 	private IDatagridService datagrid;
 	private IControllerRegistryService controllerRegistryService;
 	
-	private IDeviceStorage deviceStorage;
-	
 	// TODO it seems there is a Guava collection that will time out entries.
 	// We should see if this will work here.
 	private Map<Path, PushedFlow> pendingFlows;
@@ -179,9 +175,6 @@
 
 		pendingFlows = new HashMap<Path, PushedFlow>();
 		waitingPackets = LinkedListMultimap.create();
-		
-		deviceStorage = new DeviceStorageImpl();
-		deviceStorage.init("","");
 	}
 	
 	@Override
@@ -252,6 +245,8 @@
 				HexString.toHexString(eth.getDestinationMACAddress()); 
 		
 		//FIXME getDeviceByMac() is a blocking call, so it may be better way to handle it to avoid the condition.
+		// TODO: Fix the code below after deviceStorage was removed
+		/*
 		try{	
 			IDeviceObject deviceObject = deviceStorage.getDeviceByMac(
 				destinationMac);
@@ -268,6 +263,7 @@
 		} finally {
 			deviceStorage.rollback();
 		}
+		*/
 	}
 	
 	private class WaitDeviceArp implements Runnable {
@@ -284,6 +280,8 @@
 
 		@Override
 		public void run() {
+			// TODO: Fix the code below after deviceStorage was removed
+			/*
 			try {
 				IDeviceObject deviceObject = deviceStorage.getDeviceByMac(HexString.toHexString(eth.getDestinationMACAddress()));
 					if(deviceObject == null){
@@ -296,6 +294,7 @@
 			} finally {
 				deviceStorage.rollback();
 			}
+			*/
 		}
 	}
 
diff --git a/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ProxyArpManager.java b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ProxyArpManager.java
index fd21265..f405e0f 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ProxyArpManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ProxyArpManager.java
@@ -29,14 +29,10 @@
 import net.floodlightcontroller.util.MACAddress;
 import net.onrc.onos.datagrid.IDatagridService;
 import net.onrc.onos.ofcontroller.bgproute.Interface;
-import net.onrc.onos.ofcontroller.core.IDeviceStorage;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
-import net.onrc.onos.ofcontroller.core.INetMapTopologyService.ITopoSwitchService;
 import net.onrc.onos.ofcontroller.core.config.IConfigInfoService;
-import net.onrc.onos.ofcontroller.core.internal.DeviceStorageImpl;
-import net.onrc.onos.ofcontroller.core.internal.TopoSwitchServiceImpl;
 import net.onrc.onos.ofcontroller.flowprogrammer.IFlowPusherService;
 import net.onrc.onos.ofcontroller.util.Dpid;
 import net.onrc.onos.ofcontroller.util.Port;
@@ -74,9 +70,6 @@
 	private IRestApiService restApi;
 	private IFlowPusherService flowPusher;
 	
-	private IDeviceStorage deviceStorage;
-	private volatile ITopoSwitchService topoSwitchService;
-	
 	private short vlan;
 	private static final short NO_VLAN = 0;
 	
@@ -179,7 +172,6 @@
 		arpRequests = Multimaps.synchronizedSetMultimap(
 				HashMultimap.<InetAddress, ArpRequest>create());
 		
-		topoSwitchService = new TopoSwitchServiceImpl();
 	}
 	
 	@Override
@@ -193,9 +185,6 @@
 		datagrid.registerPacketOutEventHandler(this);
 		datagrid.registerArpReplyEventHandler(this);
 		
-		deviceStorage = new DeviceStorageImpl();
-		deviceStorage.init("","");
-		
 		Timer arpTimer = new Timer("arp-processing");
 		arpTimer.scheduleAtFixedRate(new TimerTask() {
 			@Override
@@ -231,6 +220,8 @@
 		
 					// If the ARP request is expired and then delete the device
 					// TODO check whether this is OK from this thread
+					// TODO: Fix the code below after deviceStorage was removed
+					/*
 					IDeviceObject targetDevice = 
 							deviceStorage.getDeviceByIP(InetAddresses.coerceToInteger(entry.getKey()));
 					if (targetDevice != null) {
@@ -239,6 +230,7 @@
 							log.debug("RemoveDevice: {} due to no have not recieve the ARP reply", targetDevice);
 						}
 					}
+					*/
 					
 					it.remove();
 					
@@ -348,8 +340,12 @@
 		arpRequests.put(target, new ArpRequest(
 				new HostArpRequester(arp, sw.getId(), pi.getInPort()), false));
 
+		// TODO: Fix the code below after deviceStorage was removed
+		/*
 		IDeviceObject targetDevice = 
 				deviceStorage.getDeviceByIP(InetAddresses.coerceToInteger(target));
+		*/
+		IDeviceObject targetDevice = null;
 		
 		if (targetDevice == null) {
 			if (log.isTraceEnabled()) {
@@ -626,7 +622,9 @@
 			.setPacketData(arpRequest);
 			
 			List<OFAction> actions = new ArrayList<OFAction>();
-			
+
+			// TODO: Fix the code below after topoSwitchService was removed
+			/*
 			Iterable<IPortObject> ports 
 				= topoSwitchService.getPortsOnSwitch(sw.getStringId());
 			if (ports == null) {
@@ -648,6 +646,7 @@
 					actions.add(new OFActionOutput(portNumber));
 				}
 			}
+			*/
 			
 			po.setActions(actions);
 			short actionsLength = (short) 
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestDatabaseManager.java b/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestDatabaseManager.java
deleted file mode 100644
index 2fe5951..0000000
--- a/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestDatabaseManager.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package net.onrc.onos.ofcontroller.core.internal;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.apache.commons.io.FileUtils;
-import org.junit.Assert;
-
-import com.thinkaurelius.titan.core.TitanFactory;
-import com.thinkaurelius.titan.core.TitanGraph;
-import com.tinkerpop.blueprints.TransactionalGraph.Conclusion;
-import com.tinkerpop.blueprints.Vertex;
-import com.tinkerpop.blueprints.util.io.graphml.GraphMLReader;
-
-@SuppressWarnings("deprecation")
-public class TestDatabaseManager {
-	private static final String testDbLocation = "/tmp/onos-testdb";
-	
-	//private static final String testDbGraphML = "<?xml version=\"1.0\" ?><graphml xmlns=\"http://graphml.graphdrawing.org/xmlns\">    <key id=\"id\" for=\"node\" attr.name=\"id\" attr.type=\"string\"></key>    <key id=\"type\" for=\"node\" attr.name=\"type\" attr.type=\"string\"></key>    <key id=\"dpid\" for=\"node\" attr.name=\"dpid\" attr.type=\"string\"></key>    <key id=\"desc\" for=\"node\" attr.name=\"desc\" attr.type=\"string\"></key>    <key id=\"number\" for=\"node\" attr.name=\"number\" attr.type=\"int\"></key>    <key id=\"dl_addr\" for=\"node\" attr.name=\"dl_addr\" attr.type=\"string\"></key>    <key id=\"nw_addr\" for=\"node\" attr.name=\"nw_addr\" attr.type=\"string\"></key>    <key id=\"id\" for=\"edge\" attr.name=\"id\" attr.type=\"string\"></key>    <key id=\"source\" for=\"edge\" attr.name=\"source\" attr.type=\"string\"></key>    <key id=\"target\" for=\"edge\" attr.name=\"target\" attr.type=\"string\"></key>    <key id=\"label\" for=\"edge\" attr.name=\"label\" attr.type=\"string\"></key>    <graph id=\"G\" edgedefault=\"directed\">        <node id=\"1\">            <data key=\"type\">switch</data>            <data key=\"dpid\">00:00:00:00:00:00:0a:01</data>            <data key=\"desc\">OpenFlow Switch at SEA</data>        </node>        <node id=\"2\">            <data key=\"type\">switch</data>            <data key=\"dpid\">00:00:00:00:00:00:0a:02</data>            <data key=\"desc\">OpenFlow Switch at LAX</data>        </node>        <node id=\"3\">            <data key=\"type\">switch</data>            <data key=\"dpid\">00:00:00:00:00:00:0a:03</data>            <data key=\"desc\">OpenFlow Switch at CHI</data>        </node>        <node id=\"4\">            <data key=\"type\">switch</data>            <data key=\"dpid\">00:00:00:00:00:00:0a:04</data>            <data key=\"desc\">OpenFlow Switch at IAH</data>        </node>        <node id=\"5\">            <data key=\"type\">switch</data>            <data key=\"dpid\">00:00:00:00:00:00:0a:05</data>            <data key=\"desc\">OpenFlow Switch at NYC</data>        </node>        <node id=\"6\">            <data key=\"type\">switch</data>            <data key=\"dpid\">00:00:00:00:00:00:0a:06</data>            <data key=\"desc\">OpenFlow Switch at ATL</data>        </node>        <node id=\"100\">            <data key=\"type\">port</data>            <data key=\"number\">1</data>            <data key=\"desc\">port 1 at SEA Switch</data>        </node>        <node id=\"101\">            <data key=\"type\">port</data>            <data key=\"number\">2</data>            <data key=\"desc\">port 2 at SEA Switch</data>        </node>        <node id=\"102\">            <data key=\"type\">port</data>            <data key=\"number\">3</data>            <data key=\"desc\">port 3 at SEA Switch</data>        </node>        <node id=\"103\">            <data key=\"type\">port</data>            <data key=\"number\">4</data>            <data key=\"desc\">port 4 at SEA Switch</data>        </node>        <node id=\"104\">            <data key=\"type\">port</data>            <data key=\"number\">1</data>            <data key=\"desc\">port 1 at LAX Switch</data>        </node>        <node id=\"105\">            <data key=\"type\">port</data>            <data key=\"number\">2</data>            <data key=\"desc\">port 2 at LAX Switch</data>        </node>        <node id=\"106\">            <data key=\"type\">port</data>            <data key=\"number\">3</data>            <data key=\"desc\">port 3 at LAX Switch</data>        </node>        <node id=\"107\">            <data key=\"type\">port</data>            <data key=\"number\">1</data>            <data key=\"desc\">port 1 at CHI Switch</data>        </node>        <node id=\"108\">            <data key=\"type\">port</data>            <data key=\"number\">2</data>            <data key=\"desc\">port 2 at CHI Switch</data>        </node>        <node id=\"109\">            <data key=\"type\">port</data>            <data key=\"number\">3</data>            <data key=\"desc\">port 3 at CHI Switch</data>        </node>        <node id=\"110\">            <data key=\"type\">port</data>            <data key=\"number\">4</data>            <data key=\"desc\">port 4 at CHI Switch</data>        </node>        <node id=\"111\">            <data key=\"type\">port</data>            <data key=\"number\">1</data>            <data key=\"desc\">port 1 at IAH Switch</data>        </node>        <node id=\"112\">            <data key=\"type\">port</data>            <data key=\"number\">2</data>            <data key=\"desc\">port 2 at IAH Switch</data>        </node>        <node id=\"113\">            <data key=\"type\">port</data>            <data key=\"number\">3</data>            <data key=\"desc\">port 3 at IAH Switch</data>        </node>        <node id=\"114\">            <data key=\"type\">port</data>            <data key=\"number\">1</data>            <data key=\"desc\">port 1 at NYC Switch</data>        </node>        <node id=\"115\">            <data key=\"type\">port</data>            <data key=\"number\">2</data>            <data key=\"desc\">port 2 at NYC Switch</data>        </node>        <node id=\"116\">            <data key=\"type\">port</data>            <data key=\"number\">3</data>            <data key=\"desc\">port 3 at NYC Switch</data>        </node>        <node id=\"117\">            <data key=\"type\">port</data>            <data key=\"number\">1</data>            <data key=\"desc\">port 1 at ATL Switch</data>        </node>        <node id=\"118\">            <data key=\"type\">port</data>            <data key=\"number\">2</data>            <data key=\"desc\">port 2 at ATL Switch</data>        </node>        <node id=\"119\">            <data key=\"type\">port</data>            <data key=\"number\">3</data>            <data key=\"desc\">port 3 at ATL Switch</data>        </node>        <node id=\"1000\">            <data key=\"type\">device</data>            <data key=\"dl_addr\">20:c9:d0:4a:e1:73</data>            <data key=\"nw_addr\">192.168.10.101</data>        </node>        <node id=\"1001\">            <data key=\"type\">device</data>            <data key=\"dl_addr\">20:c9:d0:4a:e1:62</data>            <data key=\"nw_addr\">192.168.20.101</data>        </node>        <node id=\"1002\">            <data key=\"type\">device</data>            <data key=\"dl_addr\">10:40:f3:e6:8d:55</data>            <data key=\"nw_addr\">192.168.10.1</data>        </node>        <node id=\"1003\">            <data key=\"type\">device</data>            <data key=\"dl_addr\">a0:b3:cc:9c:c6:88</data>            <data key=\"nw_addr\">192.168.20.1</data>        </node>        <node id=\"1004\">            <data key=\"type\">device</data>            <data key=\"dl_addr\">00:04:20:e2:50:a2</data>            <data key=\"nw_addr\">192.168.30.1</data>        </node>        <node id=\"1005\">            <data key=\"type\">device</data>            <data key=\"dl_addr\">58:55:ca:c4:1b:a0</data>            <data key=\"nw_addr\">192.168.40.1</data>        </node>        <edge id=\"10000\" source=\"1\" target=\"101\" label=\"on\"></edge>        <edge id=\"10001\" source=\"1\" target=\"102\" label=\"on\"></edge>        <edge id=\"10002\" source=\"1\" target=\"103\" label=\"on\"></edge>        <edge id=\"10003\" source=\"2\" target=\"104\" label=\"on\"></edge>        <edge id=\"10004\" source=\"2\" target=\"105\" label=\"on\"></edge>        <edge id=\"10005\" source=\"2\" target=\"106\" label=\"on\"></edge>        <edge id=\"10006\" source=\"3\" target=\"107\" label=\"on\"></edge>        <edge id=\"10007\" source=\"3\" target=\"108\" label=\"on\"></edge>        <edge id=\"10008\" source=\"3\" target=\"109\" label=\"on\"></edge>        <edge id=\"10009\" source=\"3\" target=\"110\" label=\"on\"></edge>        <edge id=\"10010\" source=\"4\" target=\"111\" label=\"on\"></edge>        <edge id=\"10011\" source=\"4\" target=\"112\" label=\"on\"></edge>        <edge id=\"10012\" source=\"4\" target=\"113\" label=\"on\"></edge>        <edge id=\"10013\" source=\"5\" target=\"114\" label=\"on\"></edge>        <edge id=\"10014\" source=\"5\" target=\"115\" label=\"on\"></edge>        <edge id=\"10015\" source=\"5\" target=\"116\" label=\"on\"></edge>        <edge id=\"10016\" source=\"6\" target=\"117\" label=\"on\"></edge>        <edge id=\"10017\" source=\"6\" target=\"118\" label=\"on\"></edge>        <edge id=\"10018\" source=\"6\" target=\"119\" label=\"on\"></edge>        <edge id=\"11000\" source=\"101\" target=\"107\" label=\"link\"></edge>         <edge id=\"11003\" source=\"105\" target=\"111\" label=\"link\"></edge>        <edge id=\"11004\" source=\"107\" target=\"101\" label=\"link\"></edge>        <edge id=\"11005\" source=\"108\" target=\"112\" label=\"link\"></edge>        <edge id=\"11006\" source=\"109\" target=\"114\" label=\"link\"></edge>        <edge id=\"11007\" source=\"111\" target=\"105\" label=\"link\"></edge>        <edge id=\"11008\" source=\"112\" target=\"108\" label=\"link\"></edge>        <edge id=\"11009\" source=\"113\" target=\"117\" label=\"link\"></edge>        <edge id=\"11010\" source=\"114\" target=\"109\" label=\"link\"></edge>        <edge id=\"11011\" source=\"115\" target=\"118\" label=\"link\"></edge>        <edge id=\"11012\" source=\"117\" target=\"113\" label=\"link\"></edge>        <edge id=\"11013\" source=\"118\" target=\"115\" label=\"link\"></edge>        <edge id=\"12000\" source=\"103\" target=\"1000\" label=\"host\"></edge>        <edge id=\"12001\" source=\"103\" target=\"1001\" label=\"host\"></edge>        <edge id=\"12002\" source=\"110\" target=\"1002\" label=\"host\"></edge>        <edge id=\"12003\" source=\"116\" target=\"1003\" label=\"host\"></edge>        <edge id=\"12004\" source=\"106\" target=\"1004\" label=\"host\"></edge>        <edge id=\"12005\" source=\"119\" target=\"1005\" label=\"host\"></edge>      </graph>    </graphml>";
-	
-	private static final String testDataLocation = "titan/schema/test-network.xml";
-	
-	public static TitanGraph getTestDatabase(){
-		//return TitanFactory.open(testDbLocation);
-//		return TitanFactory.openInMemoryGraph();
-		return TitanFactory.open(testDbLocation);
-	}
-	
-	public static void populateTestData(TitanGraph titanGraph){
-		Set<String> s = titanGraph.getIndexedKeys(Vertex.class);
-        if (!s.contains("dpid")) {
-           titanGraph.createKeyIndex("dpid", Vertex.class);
-           titanGraph.stopTransaction(Conclusion.SUCCESS);
-        }
-        if (!s.contains("type")) {
-        	titanGraph.createKeyIndex("type", Vertex.class);
-        	titanGraph.stopTransaction(Conclusion.SUCCESS);
-        }
-        
-        //InputStream graphMLStream = new ByteArrayInputStream(testDbGraphML.getBytes());
-        
-        try {
-        	InputStream graphMLStream = new FileInputStream(testDataLocation);
-			GraphMLReader.inputGraph(titanGraph, graphMLStream);
-		} catch (FileNotFoundException e) {
-			Assert.fail("Test data file not found: " + testDataLocation);
-		} catch (IOException e) {
-			e.printStackTrace();
-			Assert.fail("IOException thrown");
-		}
-        
-        //Change the type of all port numbers to short in the database
-        Iterator<Vertex> it = titanGraph.getVertices("type", "port").iterator();
-
-        while (it.hasNext()){
-        	Vertex port = it.next();
-
-        	if(port.getProperty("number") instanceof Short)
-        	{
-        		Short portNum = (Short) port.getProperty("number");
-        		port.setProperty("number", portNum.shortValue());
-        	}
-        	else{
-        		Integer portNum = (Integer) port.getProperty("number");	
-        		port.setProperty("number", portNum.shortValue());
-        	}
-
-        }
-        
-        titanGraph.stopTransaction(Conclusion.SUCCESS);
-	}
-	
-	public static void deleteTestDatabase(){
-		try {
-			FileUtils.deleteDirectory(new File(testDbLocation));
-		} catch (IOException e) {
-			System.out.println("delete failed");
-			e.printStackTrace();
-		}
-	}
-	
-}
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableLinkStorageImpl.java b/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableLinkStorageImpl.java
deleted file mode 100644
index 8411b22..0000000
--- a/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableLinkStorageImpl.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package net.onrc.onos.ofcontroller.core.internal;
-
-import java.util.Set;
-
-
-import com.thinkaurelius.titan.core.TitanGraph;
-import com.tinkerpop.blueprints.TransactionalGraph.Conclusion;
-import com.tinkerpop.blueprints.Vertex;
-
-/**
- * Seam that allows me to set up a testable instance of LinkStorageImpl that 
- * writes to a file database rather than a Cassandra cluster. 
- * It seems the init() API on LinkStorageImpl might change so I won't rely
- * on it yet.
- * 
- * @author jono
- *
- */
-
-@SuppressWarnings("deprecation")
-public class TestableLinkStorageImpl extends LinkStorageImpl {
-	protected TitanGraph graph;
-
-	public TestableLinkStorageImpl(TitanGraph graph){
-		this.graph = graph;
-	}
-	
-	@Override
-	public void init(final String dbStore, final String conf){
-        Set<String> s = graph.getIndexedKeys(Vertex.class);
-        if (!s.contains("dpid")) {
-           graph.createKeyIndex("dpid", Vertex.class);
-           graph.stopTransaction(Conclusion.SUCCESS);
-        }
-        if (!s.contains("type")) {
-        	graph.createKeyIndex("type", Vertex.class);
-        	graph.stopTransaction(Conclusion.SUCCESS);
-        }
-		
-	}
-}
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableSwitchStorageImpl.java b/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableSwitchStorageImpl.java
deleted file mode 100644
index 82d1faf..0000000
--- a/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableSwitchStorageImpl.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package net.onrc.onos.ofcontroller.core.internal;
-
-import net.onrc.onos.ofcontroller.core.internal.SwitchStorageImpl;
-
-/**
- * Seam that allows me to set up a testable instance of SwitchStorageImpl that 
- * writes to a file database rather than a Cassandra cluster. 
- * It seems the init() API on SwitchStorageImpl might change so I won't rely
- * on it yet.
- * 
- * @author jono
- *
- */
-
-public class TestableSwitchStorageImpl extends SwitchStorageImpl {
-	
-	public TestableSwitchStorageImpl(){
-	}
-	
-	@Override
-	public void init(final String dbStore, final String conf){
-        
-		super.init(dbStore, conf);
-		
-	}
-}