Merge branch 'master' of https://github.com/OPENNETWORKINGLAB/ONOS
diff --git a/conf/hazelcast.xml b/conf/hazelcast.xml
new file mode 100644
index 0000000..267cd58
--- /dev/null
+++ b/conf/hazelcast.xml
@@ -0,0 +1,102 @@
+<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config
+	http://www.hazelcast.com/schema/config/hazelcast-config-3.0.xsd"
+	xmlns="http://www.hazelcast.com/schema/config"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+  <map name="*">
+
+    <!--
+    Number of sync-backups. If 1 is set as the backup-count for example,
+    then all entries of the map will be copied to another JVM for
+    ail-safety. Valid numbers are 0 (no backup), 1, 2, 3.
+    -->
+    <backup-count>0</backup-count>
+
+    <!--
+    Number of async-backups. If 1 is set as the backup-count for example,
+    then all entries of the map will be copied to another JVM for
+    fail-safety. Valid numbers are 0 (no backup), 1, 2, 3.
+    -->
+    <async-backup-count>3</async-backup-count>
+
+    <!--
+    Can we read the local backup entries? Default value is false for
+    strong consistency. Being able to read backup data will give you
+    greater performance.
+    -->
+    <read-backup-data>true</read-backup-data>
+
+    <near-cache>
+      <!--
+	  Maximum size of the near cache. When max size is reached,
+	  cache is evicted based on the policy defined.
+	  Any integer between 0 and Integer.MAX_VALUE. 0 means
+	  Integer.MAX_VALUE. Default is 0.
+      -->
+      <max-size>0</max-size>
+      <!--
+	  Maximum number of seconds for each entry to stay in the near cache.
+	  Entries that are older than <time-to-live-seconds> will get
+	  automatically evicted from the near cache.
+	  Any integer between 0 and Integer.MAX_VALUE. 0 means infinite.
+	  Default is 0.
+      -->
+      <time-to-live-seconds>0</time-to-live-seconds>
+
+      <!--
+	  Maximum number of seconds each entry can stay in the near cache as
+	  untouched (not-read).
+	  Entries that are not read (touched) more than <max-idle-seconds>
+	  value will get removed from the near cache.
+	  Any integer between 0 and Integer.MAX_VALUE. 0 means
+	  Integer.MAX_VALUE. Default is 0.
+      -->
+      <max-idle-seconds>0</max-idle-seconds>
+
+      <!--
+	  Valid values are:
+	  NONE (no extra eviction, <time-to-live-seconds> may still apply),
+	  LRU (Least Recently Used),
+	  LFU (Least Frequently Used).
+	  LRU is the default.
+	  Regardless of the eviction policy used, <time-to-live-seconds> will
+	  still apply.
+      -->
+      <eviction-policy>NONE</eviction-policy>
+
+      <!--
+	  Should the cached entries get evicted if the entries are changed
+	  (updated or removed).
+	  true of false. Default is true.
+      -->
+      <invalidate-on-change>true</invalidate-on-change>
+
+    </near-cache>
+  </map>
+
+  <topic name="*">
+    <global-ordering-enabled>false</global-ordering-enabled>
+  </topic>
+
+  <network>
+    <port auto-increment="true">5701</port>
+    <join>
+      <multicast enabled="true">
+	<multicast-group>224.2.2.3</multicast-group>
+	<multicast-port>54327</multicast-port>
+      </multicast>
+      <!--                                                                     
+      <tcp-ip enabled="false">                                                 
+        <member>machine1</member>                                              
+        <member>machine2</member>                                              
+        <member>machine3:5799</member>                                         
+        <member>192.168.1.0-7</member>                                         
+        <member>192.168.1.21</member>                                          
+      </tcp-ip>                                                                
+      -->
+      <aws enabled="false">
+      </aws>
+    </join>
+  </network>
+
+</hazelcast>
diff --git a/conf/onos-embedded.properties b/conf/onos-embedded.properties
index ed85223..8bbf25d 100644
--- a/conf/onos-embedded.properties
+++ b/conf/onos-embedded.properties
@@ -7,6 +7,8 @@
 net.floodlightcontroller.counter.CounterStore,\
 net.floodlightcontroller.perfmon.PktInProcessingTime,\
 net.floodlightcontroller.ui.web.StaticWebRoutable,\
+net.onrc.onos.datagrid.HazelcastDatagrid,\
+net.onrc.onos.ofcontroller.flowmanager.FlowManager,\
 net.onrc.onos.registry.controller.ZookeeperRegistry
 net.floodlightcontroller.restserver.RestApiServer.port = 8080
 net.floodlightcontroller.core.FloodlightProvider.openflowport = 6633
@@ -14,4 +16,5 @@
 net.floodlightcontroller.forwarding.Forwarding.idletimeout = 5
 net.floodlightcontroller.forwarding.Forwarding.hardtimeout = 0
 net.onrc.onos.ofcontroller.floodlightlistener.NetworkGraphPublisher.dbconf = conf/titan-embedded.properties
+net.onrc.onos.datagrid.HazelcastDatagrid.datagridConfig = conf/hazelcast.xml
 
diff --git a/conf/onos.properties b/conf/onos.properties
index 283203a..c67b340 100644
--- a/conf/onos.properties
+++ b/conf/onos.properties
@@ -7,6 +7,8 @@
 net.floodlightcontroller.counter.CounterStore,\
 net.floodlightcontroller.perfmon.PktInProcessingTime,\
 net.floodlightcontroller.ui.web.StaticWebRoutable,\
+net.onrc.onos.datagrid.HazelcastDatagrid,\
+net.onrc.onos.ofcontroller.flowmanager.FlowManager,\
 net.onrc.onos.registry.controller.ZookeeperRegistry
 net.floodlightcontroller.restserver.RestApiServer.port = 8080
 net.floodlightcontroller.core.FloodlightProvider.openflowport = 6633
@@ -14,4 +16,4 @@
 net.floodlightcontroller.forwarding.Forwarding.idletimeout = 5
 net.floodlightcontroller.forwarding.Forwarding.hardtimeout = 0
 net.onrc.onos.ofcontroller.floodlightlistener.NetworkGraphPublisher.dbconf = /tmp/cassandra.titan
-
+net.onrc.onos.datagrid.HazelcastDatagrid.datagridConfig = conf/hazelcast.xml
diff --git a/pom.xml b/pom.xml
index 943133d..71e8192 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,7 +32,7 @@
   </repositories>
   <properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    <powermock.version>1.5</powermock.version>
+    <powermock.version>1.5.1</powermock.version>
     <restlet.version>2.1-RC1</restlet.version>
     <github.global.server>github</github.global.server>
   </properties>
@@ -240,6 +240,11 @@
     </dependency>
     -->
     <dependency>
+      <groupId>com.hazelcast</groupId>
+      <artifactId>hazelcast</artifactId>
+      <version>3.0.2</version>
+    </dependency>
+    <dependency>
       <groupId>net.sf.json-lib</groupId>
       <artifactId>json-lib</artifactId>
       <version>2.4</version>
@@ -344,7 +349,7 @@
     <dependency>
       <groupId>org.easymock</groupId>
       <artifactId>easymock</artifactId>
-      <version>3.1</version>
+      <version>3.2</version>
       <scope>test</scope>
     </dependency>
     <dependency>
diff --git a/src/main/java/net/floodlightcontroller/core/FloodlightProvider.java b/src/main/java/net/floodlightcontroller/core/FloodlightProvider.java
index c821339..95daf96 100644
--- a/src/main/java/net/floodlightcontroller/core/FloodlightProvider.java
+++ b/src/main/java/net/floodlightcontroller/core/FloodlightProvider.java
@@ -15,7 +15,6 @@
 import net.floodlightcontroller.restserver.IRestApiService;
 import net.floodlightcontroller.storage.IStorageSourceService;
 import net.floodlightcontroller.threadpool.IThreadPoolService;
-import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
 import net.onrc.onos.registry.controller.IControllerRegistryService;
 
 public class FloodlightProvider implements IFloodlightModule {
@@ -52,7 +51,6 @@
         dependencies.add(ICounterStoreService.class);
         dependencies.add(IThreadPoolService.class);
         // Following added by ONOS
-        dependencies.add(IFlowService.class);
         dependencies.add(IControllerRegistryService.class);
 
         return dependencies;
@@ -71,7 +69,6 @@
        controller.setThreadPoolService(
            context.getServiceImpl(IThreadPoolService.class));
        // Following added by ONOS
-       controller.setFlowService(context.getServiceImpl(IFlowService.class));
        controller.setMastershipService(
     		   context.getServiceImpl(IControllerRegistryService.class));
 
diff --git a/src/main/java/net/floodlightcontroller/core/internal/Controller.java b/src/main/java/net/floodlightcontroller/core/internal/Controller.java
index 21eceb3..44510a7 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/Controller.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/Controller.java
@@ -75,7 +75,6 @@
 import net.floodlightcontroller.storage.StorageException;
 import net.floodlightcontroller.threadpool.IThreadPoolService;
 import net.onrc.onos.ofcontroller.core.IOFSwitchPortListener;
-import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
 import net.onrc.onos.registry.controller.IControllerRegistryService;
 import net.onrc.onos.registry.controller.IControllerRegistryService.ControlChangeCallback;
 import net.onrc.onos.registry.controller.RegistryException;
@@ -146,7 +145,7 @@
  * - Detailed Port event: PORTCHANGED -> {PORTCHANGED, PORTADDED, PORTREMOVED} 
  *    Available as net.onrc.onos.ofcontroller.core.IOFSwitchPortListener
  * - Distributed ownership control of switch through RegistryService(IControllerRegistryService)
- * - Register ONOS services. (IFlowService, IControllerRegistryService)
+ * - Register ONOS services. (IControllerRegistryService)
  * - Additional DEBUG logs
  * - Try using hostname as controller ID, when ID was not explicitly given.
  */
@@ -188,7 +187,6 @@
     protected IStorageSourceService storageSource;
     protected IPktInProcessingTimeService pktinProcTime;
     protected IThreadPoolService threadPool;
-    protected IFlowService flowService;
     protected IControllerRegistryService registryService;
     
     // Configuration options
@@ -405,10 +403,6 @@
         this.threadPool = tp;
     }
 
-    public void setFlowService(IFlowService serviceImpl) {
-	this.flowService = serviceImpl;		
-    }
-
 	public void setMastershipService(IControllerRegistryService serviceImpl) {
 		this.registryService = serviceImpl;		
 	}
@@ -752,7 +746,7 @@
                     }
                     if (is_core_switch) {
                         sw.setAttribute(IOFSwitch.SWITCH_IS_CORE_SWITCH, 
-                                        new Boolean(true));
+                                        true);
                     }
                 }
                 sw.removeAttribute(IOFSwitch.SWITCH_DESCRIPTION_FUTURE);
@@ -2358,7 +2352,7 @@
                         // new controller node IP
                         addedControllerNodeIPs.put(controllerID, discoveredIP);
                     } 
-                    else if (curIP != discoveredIP) {
+                    else if (curIP.equals(discoveredIP)) {
                         // IP changed                    
                         removedControllerNodeIPs.put(controllerID, curIP);
                         addedControllerNodeIPs.put(controllerID, discoveredIP);
diff --git a/src/main/java/net/onrc/onos/datagrid/HazelcastDatagrid.java b/src/main/java/net/onrc/onos/datagrid/HazelcastDatagrid.java
new file mode 100644
index 0000000..7736880
--- /dev/null
+++ b/src/main/java/net/onrc/onos/datagrid/HazelcastDatagrid.java
@@ -0,0 +1,150 @@
+package net.onrc.onos.datagrid;
+
+import java.io.FileNotFoundException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import net.floodlightcontroller.core.IFloodlightProviderService;
+import net.floodlightcontroller.core.module.FloodlightModuleContext;
+import net.floodlightcontroller.core.module.FloodlightModuleException;
+import net.floodlightcontroller.core.module.IFloodlightModule;
+import net.floodlightcontroller.core.module.IFloodlightService;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.hazelcast.config.Config;
+import com.hazelcast.config.FileSystemXmlConfig;
+import com.hazelcast.core.Hazelcast;
+import com.hazelcast.core.HazelcastInstance;
+import com.hazelcast.instance.GroupProperties;
+
+/**
+ * A datagrid service that uses Hazelcast as a datagrid.
+ * The relevant data is stored in the Hazelcast datagrid and shared as
+ * appropriate in a multi-node cluster.
+ */
+public class HazelcastDatagrid implements IFloodlightModule, IDatagridService {
+    protected static Logger log =
+	LoggerFactory.getLogger(HazelcastDatagrid.class);
+
+    protected IFloodlightProviderService floodlightProvider;
+
+    protected static final String HazelcastConfigFile = "datagridConfig";
+    private HazelcastInstance hazelcast = null;
+    private Config hazelcastConfig = null;
+
+    /**
+     * Initialize the Hazelcast Datagrid operation.
+     *
+     * @param conf the configuration filename.
+     */
+    public void init(String configFilename) {
+	/*
+	System.setProperty("hazelcast.socket.receive.buffer.size", "32");
+	System.setProperty("hazelcast.socket.send.buffer.size", "32");
+	*/
+	// System.setProperty("hazelcast.heartbeat.interval.seconds", "100");
+	
+	// Init from configuration file
+	try {
+	    hazelcastConfig = new FileSystemXmlConfig(configFilename);
+	} catch (FileNotFoundException e) {
+	    log.error("Error opening Hazelcast XML configuration. File not found: " + configFilename, e);
+	}
+	/*
+	hazelcastConfig.setProperty(GroupProperties.PROP_IO_THREAD_COUNT, "1");
+	hazelcastConfig.setProperty(GroupProperties.PROP_OPERATION_THREAD_COUNT, "1");
+	hazelcastConfig.setProperty(GroupProperties.PROP_EVENT_THREAD_COUNT, "1");
+	*/
+	//
+	hazelcastConfig.setProperty(GroupProperties.PROP_EVENT_QUEUE_CAPACITY, "4000000");
+	hazelcastConfig.setProperty(GroupProperties.PROP_SOCKET_RECEIVE_BUFFER_SIZE, "4096");
+	hazelcastConfig.setProperty(GroupProperties.PROP_SOCKET_SEND_BUFFER_SIZE, "4096");
+    }
+
+    /**
+     * Shutdown the Hazelcast Datagrid operation.
+     */
+    public void finalize() {
+	close();
+    }
+
+    /**
+     * Shutdown the Hazelcast Datagrid operation.
+     */
+    public void close() {
+	Hazelcast.shutdownAll();
+    }
+
+    /**
+     * Get the collection of offered module services.
+     *
+     * @return the collection of offered module services.
+     */
+    @Override
+    public Collection<Class<? extends IFloodlightService>> getModuleServices() {
+        Collection<Class<? extends IFloodlightService>> l = 
+            new ArrayList<Class<? extends IFloodlightService>>();
+        l.add(IDatagridService.class);
+        return l;
+    }
+
+    /**
+     * Get the collection of implemented services.
+     *
+     * @return the collection of implemented services.
+     */
+    @Override
+    public Map<Class<? extends IFloodlightService>, IFloodlightService> 
+			       getServiceImpls() {
+        Map<Class<? extends IFloodlightService>,
+        IFloodlightService> m = 
+            new HashMap<Class<? extends IFloodlightService>,
+                IFloodlightService>();
+        m.put(IDatagridService.class, this);
+        return m;
+    }
+
+    /**
+     * Get the collection of modules this module depends on.
+     *
+     * @return the collection of modules this module depends on.
+     */
+    @Override
+    public Collection<Class<? extends IFloodlightService>> 
+                                                    getModuleDependencies() {
+	Collection<Class<? extends IFloodlightService>> l =
+	    new ArrayList<Class<? extends IFloodlightService>>();
+	l.add(IFloodlightProviderService.class);
+        return l;
+    }
+
+    /**
+     * Initialize the module.
+     *
+     * @param context the module context to use for the initialization.
+     */
+    @Override
+    public void init(FloodlightModuleContext context)
+	throws FloodlightModuleException {
+	floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class);
+
+	// Get the configuration file name and configure the Datagrid
+	Map<String, String> configMap = context.getConfigParams(this);
+	String configFilename = configMap.get(HazelcastConfigFile);
+	this.init(configFilename);
+    }
+
+    /**
+     * Startup module operation.
+     *
+     * @param context the module context to use for the startup.
+     */
+    @Override
+    public void startUp(FloodlightModuleContext context) {
+	hazelcast = Hazelcast.newHazelcastInstance(hazelcastConfig);
+    }
+}
diff --git a/src/main/java/net/onrc/onos/datagrid/IDatagridService.java b/src/main/java/net/onrc/onos/datagrid/IDatagridService.java
new file mode 100644
index 0000000..1c7f3ab
--- /dev/null
+++ b/src/main/java/net/onrc/onos/datagrid/IDatagridService.java
@@ -0,0 +1,10 @@
+package net.onrc.onos.datagrid;
+
+import net.floodlightcontroller.core.module.IFloodlightService;
+
+/**
+ * Interface for providing Datagrid Service to other modules.
+ */
+public interface IDatagridService extends IFloodlightService {
+    // TODO
+}
diff --git a/src/main/java/net/onrc/onos/flow/FlowManagerImpl.java b/src/main/java/net/onrc/onos/flow/FlowManagerImpl.java
index 2e2706c..a7cd02a 100644
--- a/src/main/java/net/onrc/onos/flow/FlowManagerImpl.java
+++ b/src/main/java/net/onrc/onos/flow/FlowManagerImpl.java
@@ -210,7 +210,7 @@
 		    String type = v.getProperty("type").toString();
 		    // System.out.println("type: " + type);
 		    if (type.equals("port")) {
-			String number = v.getProperty("number").toString();
+			//String number = v.getProperty("number").toString();
 			// System.out.println("number: " + number);
 
 			Object obj = v.getProperty("number");
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 826fd93..9b6ac53 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
@@ -34,7 +34,6 @@
 import net.floodlightcontroller.util.MACAddress;
 import net.onrc.onos.ofcontroller.bgproute.RibUpdate.Operation;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyService.ITopoLinkService;
-import net.onrc.onos.ofcontroller.core.INetMapTopologyService.ITopoRouteService;
 import net.onrc.onos.ofcontroller.core.internal.TopoLinkServiceImpl;
 import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery;
 import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery.LDUpdate;
@@ -42,7 +41,8 @@
 import net.onrc.onos.ofcontroller.proxyarp.IArpRequester;
 import net.onrc.onos.ofcontroller.proxyarp.IProxyArpService;
 import net.onrc.onos.ofcontroller.proxyarp.ProxyArpManager;
-import net.onrc.onos.ofcontroller.routing.TopoRouteService;
+import net.onrc.onos.ofcontroller.topology.ITopologyNetService;
+import net.onrc.onos.ofcontroller.topology.TopologyManager;
 import net.onrc.onos.ofcontroller.util.DataPath;
 import net.onrc.onos.ofcontroller.util.Dpid;
 import net.onrc.onos.ofcontroller.util.FlowEntry;
@@ -83,7 +83,7 @@
 
 	protected IFloodlightProviderService floodlightProvider;
 	protected ITopologyService topology;
-	protected ITopoRouteService topoRouteService;
+	protected ITopologyNetService topologyNetService;
 	protected ILinkDiscoveryService linkDiscoveryService;
 	protected IRestApiService restApi;
 	
@@ -142,7 +142,7 @@
 	
 	private FlowCache flowCache;
 	
-	protected volatile Map<Long, ?> topoRouteTopology = null;
+	protected volatile Map<Long, ?> shortestPathTopo = null;
 		
 	protected class TopologyChangeDetector implements Runnable {
 		@Override
@@ -272,7 +272,7 @@
 		ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
 		topologyChangeDetectorTask = new SingletonTask(executor, new TopologyChangeDetector());
 
-		topoRouteService = new TopoRouteService("");
+		topologyNetService = new TopologyManager("");
 		
 		pathsWaitingOnArp = new HashMap<InetAddress, Path>();
 		prefixesWaitingOnArp = Multimaps.synchronizedSetMultimap(
@@ -498,14 +498,14 @@
 		//Add a flow to rewrite mac for this prefix to all other border switches
 		for (Interface srcInterface : srcInterfaces.values()) {
 			DataPath shortestPath; 
-			if (topoRouteTopology == null) {
-				shortestPath = topoRouteService.getShortestPath(
+			if (shortestPathTopo == null) {
+				shortestPath = topologyNetService.getShortestPath(
 						srcInterface.getSwitchPort(),
 						egressInterface.getSwitchPort());
 			}
 			else {
-				shortestPath = topoRouteService.getTopoShortestPath(
-						topoRouteTopology, srcInterface.getSwitchPort(),
+				shortestPath = topologyNetService.getTopoShortestPath(
+						shortestPathTopo, srcInterface.getSwitchPort(),
 						egressInterface.getSwitchPort());
 			}
 			
@@ -697,12 +697,12 @@
 			}
 			
 			DataPath shortestPath;
-			if (topoRouteTopology == null) {
-				shortestPath = topoRouteService.getShortestPath(
+			if (shortestPathTopo == null) {
+				shortestPath = topologyNetService.getShortestPath(
 						srcInterface.getSwitchPort(), dstInterface.getSwitchPort());
 			}
 			else {
-				shortestPath = topoRouteService.getTopoShortestPath(topoRouteTopology, 
+				shortestPath = topologyNetService.getTopoShortestPath(shortestPathTopo, 
 						srcInterface.getSwitchPort(), dstInterface.getSwitchPort());
 			}
 			
@@ -771,7 +771,7 @@
 		for (BgpPeer bgpPeer : bgpPeers.values()){
 			Interface peerInterface = interfaces.get(bgpPeer.getInterfaceName());
 			
-			DataPath path = topoRouteService.getShortestPath(
+			DataPath path = topologyNetService.getShortestPath(
 					peerInterface.getSwitchPort(), bgpdAttachmentPoint);
 			
 			if (path == null){
@@ -1046,7 +1046,7 @@
 	
 	private void beginRouting(){
 		log.debug("Topology is now ready, beginning routing function");
-		topoRouteTopology = topoRouteService.prepareShortestPathTopo();
+		shortestPathTopo = topologyNetService.prepareShortestPathTopo();
 		
 		setupArpFlows();
 		setupDefaultDropFlows();
@@ -1086,7 +1086,7 @@
 					continue;
 				}
 				
-				DataPath shortestPath = topoRouteService.getShortestPath(
+				DataPath shortestPath = topologyNetService.getShortestPath(
 						srcInterface.getSwitchPort(), dstInterface.getSwitchPort());
 				
 				if (shortestPath == null){
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyService.java b/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyService.java
index 954515b..f5ccc49 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyService.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyService.java
@@ -1,16 +1,11 @@
 package net.onrc.onos.ofcontroller.core;
 
 import java.util.List;
-import java.util.Map;
 
-import net.floodlightcontroller.core.module.IFloodlightService;
 import net.floodlightcontroller.routing.Link;
-import net.floodlightcontroller.topology.NodePortTuple;
 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.util.DataPath;
-import net.onrc.onos.ofcontroller.util.SwitchPort;
 
 public interface INetMapTopologyService extends INetMapService {
 
@@ -34,90 +29,4 @@
 		Iterable<IDeviceObject> getDevicesOnSwitch(String dpid);
 		Iterable<IDeviceObject> getDevicesOnSwitch(String dpid, short port_num);
 	}
-	
-	public interface ITopoRouteService extends IFloodlightService {
-	    /**
-	     * Get the shortest path from a source to a destination.
-	     *
-	     * @param src the source in the shortest path computation.
-	     * @param dest the destination in the shortest path computation.
-	     * @return the data path with the computed shortest path if
-	     * found, otherwise null.
-	     */
-	    DataPath getShortestPath(SwitchPort src, SwitchPort dest);
-
-	    /**
-	     * Fetch the Switch and Ports info from the Titan Graph
-	     * and return it for fast access during the shortest path
-	     * computation.
-	     *
-	     * After fetching the state, method @ref getTopoShortestPath()
-	     * can be used for fast shortest path computation.
-	     *
-	     * Note: There is certain cost to fetch the state, hence it should
-	     * be used only when there is a large number of shortest path
-	     * computations that need to be done on the same topology.
-	     * Typically, a single call to @ref prepareShortestPathTopo()
-	     * should be followed by a large number of calls to
-	     * method @ref getTopoShortestPath().
-	     * After the last @ref getTopoShortestPath() call,
-	     * method @ref dropShortestPathTopo() should be used to release
-	     * the internal state that is not needed anymore:
-	     *
-	     *       Map<Long, ?> shortestPathTopo;
-	     *       shortestPathTopo = prepareShortestPathTopo();
-	     *       for (int i = 0; i < 10000; i++) {
-	     *           dataPath = getTopoShortestPath(shortestPathTopo, ...);
-	     *           ...
-	     *        }
-	     *        dropShortestPathTopo(shortestPathTopo);
-	     *
-	     * @return the Shortest Path info handler stored in a map.
-	     */
-	    Map<Long, ?> prepareShortestPathTopo();
-
-	    /**
-	     * Release the state that was populated by
-	     * method @ref prepareShortestPathTopo().
-	     *
-	     * See the documentation for method @ref prepareShortestPathTopo()
-	     * for additional information and usage.
-	     *
-	     * @param shortestPathTopo the Shortest Path info handler to release.
-	     */
-	    void dropShortestPathTopo(Map<Long, ?> shortestPathTopo);
-
-	    /**
-	     * Get the shortest path from a source to a destination by
-	     * using the pre-populated local topology state prepared
-	     * by method @ref prepareShortestPathTopo().
-	     *
-	     * See the documentation for method @ref prepareShortestPathTopo()
-	     * for additional information and usage.
-	     *
-	     * @param shortestPathTopo the Shortest Path info handler
-	     * to use.
-	     * @param src the source in the shortest path computation.
-	     * @param dest the destination in the shortest path computation.
-	     * @return the data path with the computed shortest path if
-	     * found, otherwise null.
-	     */
-	    DataPath getTopoShortestPath(Map<Long, ?> shortestPathTopo,
-					 SwitchPort src, SwitchPort dest);
-
-	    /**
-	     * Test whether a route exists from a source to a destination.
-	     *
-	     * @param src the source node for the test.
-	     * @param dest the destination node for the test.
-	     * @return true if a route exists, otherwise false.
-	     */
-	    Boolean routeExists(SwitchPort src, SwitchPort dest);
-	}
-	
-	public interface ITopoFlowService {
-		Boolean flowExists(NodePortTuple src, NodePortTuple dest);
-		List<NodePortTuple> getShortestFlowPath(NodePortTuple src, NodePortTuple dest);
-		
-	}
 }
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
index e5f2f58..8ee346b 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/core/internal/LinkStorageImpl.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/internal/LinkStorageImpl.java
@@ -144,7 +144,6 @@
 	@Override
 	public void deleteLink(Link lt) {
 		IPortObject vportSrc = null, vportDst = null;
-		int count = 0;
 		
 		log.debug("deleteLink(): {}", lt);
 		
@@ -161,15 +160,17 @@
      		// FIXME: This needs to remove all edges
          	
          	if (vportSrc != null && vportDst != null) {
-
-   /*      		for (Edge e : vportSrc.asVertex().getEdges(Direction.OUT)) {
+/*
+        		int count = 0;
+         		for (Edge e : vportSrc.asVertex().getEdges(Direction.OUT)) {
          			log.debug("deleteLink(): {} in {} out {}", 
          					new Object[]{e.getLabel(), e.getVertex(Direction.IN), e.getVertex(Direction.OUT)});
          			if (e.getLabel().equals("link") && e.getVertex(Direction.IN).equals(vportDst)) {
          				graph.removeEdge(e);
          				count++;
          			}
-         		}*/
+         		}
+*/
          		vportSrc.removeLink(vportDst);
         		dbop.commit();
             	log.debug("deleteLink(): deleted edges src {} dst {}", new Object[]{
@@ -303,6 +304,7 @@
 	
 	static class ExtractLink implements PipeFunction<PathPipe<Vertex>, Link> {
 	
+		@SuppressWarnings("unchecked")
 		@Override
 		public Link compute(PathPipe<Vertex> pipe ) {
 			// TODO Auto-generated method stub
@@ -311,7 +313,7 @@
 			short s_port = 0;
 			short d_port = 0;
 			List<Vertex> V = new ArrayList<Vertex>();
-			V = pipe.next();
+			V = (List<Vertex>)pipe.next();
 			Vertex src_sw = V.get(0);
 			Vertex dest_sw = V.get(3);
 			Vertex src_port = V.get(1);
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
index ce9941e..2c5f4ba 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
@@ -33,9 +33,9 @@
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowPath;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
-import net.onrc.onos.ofcontroller.core.INetMapTopologyService.ITopoRouteService;
 import net.onrc.onos.ofcontroller.flowmanager.web.FlowWebRoutable;
-import net.onrc.onos.ofcontroller.routing.TopoRouteService;
+import net.onrc.onos.ofcontroller.topology.ITopologyNetService;
+import net.onrc.onos.ofcontroller.topology.TopologyManager;
 import net.onrc.onos.ofcontroller.util.CallerId;
 import net.onrc.onos.ofcontroller.util.DataPath;
 import net.onrc.onos.ofcontroller.util.DataPathEndpoints;
@@ -73,7 +73,7 @@
 
     protected IRestApiService restApi;
     protected volatile IFloodlightProviderService floodlightProvider;
-    protected volatile ITopoRouteService topoRouteService;
+    protected volatile ITopologyNetService topologyNetService;
     protected FloodlightModuleContext context;
 
     protected OFMessageDamper messageDamper;
@@ -294,7 +294,7 @@
 		// Flow Paths this controller is responsible for.
 		//
 		Map<Long, ?> shortestPathTopo =
-		    topoRouteService.prepareShortestPathTopo();
+		    topologyNetService.prepareShortestPathTopo();
 		Iterable<IFlowPath> allFlowPaths = op.getAllFlowPaths();
 		for (IFlowPath flowPathObj : allFlowPaths) {
 		    counterAllFlowPaths++;
@@ -332,11 +332,7 @@
 		    if ((flowUserState != null)
 			&& flowUserState.equals("FE_USER_DELETE")) {
 			Iterable<IFlowEntry> flowEntries = flowPathObj.getFlowEntries();
-			boolean empty = true;	// TODO: an ugly hack
-			for (IFlowEntry flowEntryObj : flowEntries) {
-			    empty = false;
-			    break;
-			}
+			final boolean empty = !flowEntries.iterator().hasNext();
 			if (empty)
 			    deleteFlows.add(flowPathObj);
 		    }
@@ -372,9 +368,9 @@
 		    // to avoid closing the transaction.
 		    //
 		    DataPath dataPath =
-			topoRouteService.getTopoShortestPath(shortestPathTopo,
-							     srcSwitchPort,
-							     dstSwitchPort);
+			topologyNetService.getTopoShortestPath(shortestPathTopo,
+							       srcSwitchPort,
+							       dstSwitchPort);
 		    if (dataPath == null) {
 			// We need the DataPath to compare the paths
 			dataPath = new DataPath();
@@ -399,7 +395,7 @@
 		    op.removeFlowPath(flowPathObj);
 		}
 
-		topoRouteService.dropShortestPathTopo(shortestPathTopo);
+		topologyNetService.dropShortestPathTopo(shortestPathTopo);
 
 		op.commit();
 
@@ -433,7 +429,7 @@
     @Override
     public void init(String conf) {
     	op = new GraphDBOperation(conf);
-	topoRouteService = new TopoRouteService(conf);
+	topologyNetService = new TopologyManager(conf);
     }
 
     /**
@@ -878,7 +874,6 @@
      */
     @Override
     public boolean deleteAllFlows() {
-	List<Thread> threads = new LinkedList<Thread>();
 	final ConcurrentLinkedQueue<FlowId> concurrentAllFlowIds =
 	    new ConcurrentLinkedQueue<FlowId>();
 
@@ -906,6 +901,7 @@
 	//
 	// Create the threads to delete the Flow Paths
 	//
+	List<Thread> threads = new LinkedList<Thread>();
 	for (int i = 0; i < 10; i++) {
 	    Thread thread = new Thread(new Runnable() {
 		@Override
@@ -1333,7 +1329,6 @@
     public ArrayList<IFlowPath> getAllFlowsWithoutFlowEntries() {
     	Iterable<IFlowPath> flowPathsObj = null;
     	ArrayList<IFlowPath> flowPathsObjArray = new ArrayList<IFlowPath>();
-    	ArrayList<FlowPath> flowPaths = new ArrayList<FlowPath>();
 
     	op.commit();
     	
@@ -1356,6 +1351,7 @@
     		flowPathsObjArray.add(flowObj);
     	}
     	/*
+    	ArrayList<FlowPath> flowPaths = new ArrayList<FlowPath>();
     	for (IFlowPath flowObj : flowPathsObj) {
     	    //
     	    // Extract the Flow state
@@ -1606,7 +1602,6 @@
      * @return true on success, otherwise false.
      */
     public boolean reconcileFlow(IFlowPath flowObj, DataPath newDataPath) {
-	Map<Long, IOFSwitch> mySwitches = floodlightProvider.getSwitches();
 
 	//
 	// Set the incoming port matching and the outgoing port output
@@ -1647,7 +1642,6 @@
 	// Remove the old Flow Entries, and add the new Flow Entries
 	//
 	Iterable<IFlowEntry> flowEntries = flowObj.getFlowEntries();
-	LinkedList<IFlowEntry> deleteFlowEntries = new LinkedList<IFlowEntry>();
 	for (IFlowEntry flowEntryObj : flowEntries) {
 	    flowEntryObj.setUserState("FE_USER_DELETE");
 	    flowEntryObj.setSwitchState("FE_SWITCH_NOT_UPDATED");
diff --git a/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/web/LinksResource.java b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/web/LinksResource.java
index c522a05..3c97e6a 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/web/LinksResource.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/web/LinksResource.java
@@ -3,6 +3,7 @@
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Set;
 
 import net.floodlightcontroller.routing.Link;
@@ -23,8 +24,9 @@
 
         if (ld != null) {
             links.putAll(ld.getLinks());
-            for (Link link: links.keySet()) {
-                LinkInfo info = links.get(link);
+            for(Entry<Link, LinkInfo> e : links.entrySet()) {
+                Link link = e.getKey();
+                LinkInfo info = e.getValue();
                 LinkWithType lwt = new LinkWithType(link,
                                                     info.getSrcPortState(),
                                                     info.getDstPortState(),
diff --git a/src/main/java/net/onrc/onos/ofcontroller/topology/ITopologyNetService.java b/src/main/java/net/onrc/onos/ofcontroller/topology/ITopologyNetService.java
new file mode 100644
index 0000000..bd0ca38
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/topology/ITopologyNetService.java
@@ -0,0 +1,90 @@
+package net.onrc.onos.ofcontroller.topology;
+
+import java.util.Map;
+
+import net.floodlightcontroller.core.module.IFloodlightService;
+import net.onrc.onos.ofcontroller.util.DataPath;
+import net.onrc.onos.ofcontroller.util.SwitchPort;
+
+/**
+ * Interface for providing Topology Network Service to other modules.
+ */
+public interface ITopologyNetService extends IFloodlightService {
+    /**
+     * Get the shortest path from a source to a destination.
+     *
+     * @param src the source in the shortest path computation.
+     * @param dest the destination in the shortest path computation.
+     * @return the data path with the computed shortest path if
+     * found, otherwise null.
+     */
+    DataPath getShortestPath(SwitchPort src, SwitchPort dest);
+
+    /**
+     * Fetch the Switch and Ports info from the Titan Graph
+     * and return it for fast access during the shortest path
+     * computation.
+     *
+     * After fetching the state, method @ref getTopoShortestPath()
+     * can be used for fast shortest path computation.
+     *
+     * Note: There is certain cost to fetch the state, hence it should
+     * be used only when there is a large number of shortest path
+     * computations that need to be done on the same topology.
+     * Typically, a single call to @ref prepareShortestPathTopo()
+     * should be followed by a large number of calls to
+     * method @ref getTopoShortestPath().
+     * After the last @ref getTopoShortestPath() call,
+     * method @ref dropShortestPathTopo() should be used to release
+     * the internal state that is not needed anymore:
+     *
+     *       Map<Long, ?> shortestPathTopo;
+     *       shortestPathTopo = prepareShortestPathTopo();
+     *       for (int i = 0; i < 10000; i++) {
+     *           dataPath = getTopoShortestPath(shortestPathTopo, ...);
+     *           ...
+     *        }
+     *        dropShortestPathTopo(shortestPathTopo);
+     *
+     * @return the Shortest Path info handler stored in a map.
+     */
+    Map<Long, ?> prepareShortestPathTopo();
+
+    /**
+     * Release the state that was populated by
+     * method @ref prepareShortestPathTopo().
+     *
+     * See the documentation for method @ref prepareShortestPathTopo()
+     * for additional information and usage.
+     *
+     * @param shortestPathTopo the Shortest Path info handler to release.
+     */
+    void dropShortestPathTopo(Map<Long, ?> shortestPathTopo);
+
+    /**
+     * Get the shortest path from a source to a destination by
+     * using the pre-populated local topology state prepared
+     * by method @ref prepareShortestPathTopo().
+     *
+     * See the documentation for method @ref prepareShortestPathTopo()
+     * for additional information and usage.
+     *
+     * @param shortestPathTopo the Shortest Path info handler
+     * to use.
+     * @param src the source in the shortest path computation.
+     * @param dest the destination in the shortest path computation.
+     * @return the data path with the computed shortest path if
+     * found, otherwise null.
+     */
+    DataPath getTopoShortestPath(Map<Long, ?> shortestPathTopo,
+				 SwitchPort src, SwitchPort dest);
+
+    /**
+     * Test whether a route exists from a source to a destination.
+     *
+     * @param src the source node for the test.
+     * @param dest the destination node for the test.
+     * @return true if a route exists, otherwise false.
+     */
+    Boolean routeExists(SwitchPort src, SwitchPort dest);
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/routing/TopoRouteService.java b/src/main/java/net/onrc/onos/ofcontroller/topology/TopologyManager.java
similarity index 96%
rename from src/main/java/net/onrc/onos/ofcontroller/routing/TopoRouteService.java
rename to src/main/java/net/onrc/onos/ofcontroller/topology/TopologyManager.java
index 21381d9..618ae39 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/routing/TopoRouteService.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/topology/TopologyManager.java
@@ -1,4 +1,4 @@
-package net.onrc.onos.ofcontroller.routing;
+package net.onrc.onos.ofcontroller.topology;
 
 import java.util.Collections;
 import java.util.HashMap;
@@ -11,7 +11,6 @@
 
 import net.onrc.onos.graph.GraphDBOperation;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
-import net.onrc.onos.ofcontroller.core.INetMapTopologyService.ITopoRouteService;
 import net.onrc.onos.ofcontroller.core.ISwitchStorage.SwitchState;
 import net.onrc.onos.ofcontroller.util.DataPath;
 import net.onrc.onos.ofcontroller.util.Dpid;
@@ -87,13 +86,12 @@
 };
 
 /**
- * A class for implementing Topology Route Service.
+ * A class for implementing Topology Network Service.
  */
-public class TopoRouteService implements ITopoRouteService {
+public class TopologyManager implements ITopologyNetService {
 
     /** The logger. */
-    private static Logger log =
-	LoggerFactory.getLogger(TopoRouteService.class);
+    private static Logger log = LoggerFactory.getLogger(TopologyManager.class);
     
     protected GraphDBOperation op;
 
@@ -101,7 +99,7 @@
     /**
      * Default constructor.
      */
-    public TopoRouteService() {
+    public TopologyManager() {
     }
 
     /**
@@ -110,7 +108,7 @@
      * @param config the database configuration file to use for
      * the initialization.
      */
-    public TopoRouteService(String config) {
+    public TopologyManager(String config) {
 	this.init(config);
     }
 
@@ -284,7 +282,7 @@
     public DataPath getTopoShortestPath(Map<Long, ?> shortestPathTopoHandler,
 					SwitchPort src, SwitchPort dest) {
 	@SuppressWarnings("unchecked")
-	Map<Long, Node> shortestPathTopo = (Map)shortestPathTopoHandler;
+	Map<Long, Node> shortestPathTopo = (Map<Long, Node>)shortestPathTopoHandler;
 	DataPath result_data_path = new DataPath();
 
 	// Initialize the source and destination in the data path to return
@@ -505,7 +503,7 @@
 	    String type = v.getProperty("type").toString();
 	    // System.out.println("type: " + type);
 	    if (type.equals("port")) {
-		String number = v.getProperty("number").toString();
+		//String number = v.getProperty("number").toString();
 		// System.out.println("number: " + number);
 
 		Object obj = v.getProperty("number");
diff --git a/src/main/java/net/onrc/onos/ofcontroller/topology/web/RouteResource.java b/src/main/java/net/onrc/onos/ofcontroller/topology/web/RouteResource.java
index 659609d..a730719 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/topology/web/RouteResource.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/topology/web/RouteResource.java
@@ -1,7 +1,7 @@
 package net.onrc.onos.ofcontroller.topology.web;
 
-import net.onrc.onos.ofcontroller.core.INetMapTopologyService.ITopoRouteService;
-import net.onrc.onos.ofcontroller.routing.TopoRouteService;
+import net.onrc.onos.ofcontroller.topology.ITopologyNetService;
+import net.onrc.onos.ofcontroller.topology.TopologyManager;
 import net.onrc.onos.ofcontroller.util.DataPath;
 import net.onrc.onos.ofcontroller.util.Dpid;
 import net.onrc.onos.ofcontroller.util.Port;
@@ -18,9 +18,9 @@
 
     @Get("json")
     public DataPath retrieve() {
-        ITopoRouteService topoRouteService = new TopoRouteService("");
-	if (topoRouteService == null) {
-	    log.debug("Topology Route Service not found");
+        ITopologyNetService topologyNetService = new TopologyManager("");
+	if (topologyNetService == null) {
+	    log.debug("Topology Net Service not found");
 	    return null;
 	}
         
@@ -37,8 +37,8 @@
 	Port dstPort = new Port(Short.parseShort(dstPortStr));
         
 	DataPath result =
-	    topoRouteService.getShortestPath(new SwitchPort(srcDpid, srcPort),
-					     new SwitchPort(dstDpid, dstPort));
+	    topologyNetService.getShortestPath(new SwitchPort(srcDpid, srcPort),
+					       new SwitchPort(dstDpid, dstPort));
 	if (result != null) {
 	    return result;
 	} else {
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/DataPath.java b/src/main/java/net/onrc/onos/ofcontroller/util/DataPath.java
index dec70e3..e807b56 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/DataPath.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/DataPath.java
@@ -116,19 +116,18 @@
      * inPort/dpid/outPort;inPort/dpid/outPort;...
      */
     public String dataPathSummary() {
-	String resultStr = new String();
+	StringBuilder resultStr = new StringBuilder(5+1+20+1+5+1);
 	if (this.flowEntries != null) {
 	    for (FlowEntry flowEntry : this.flowEntries) {
 		// The data path summary string
-		resultStr = resultStr +
-		    flowEntry.inPort().toString() + "/"
-		    + flowEntry.dpid().toString() + "/" +
-		    flowEntry.outPort().toString() + ";";
+		resultStr.append(flowEntry.inPort().toString()).append('/')
+			.append(flowEntry.dpid().toString()).append('/')
+			.append(flowEntry.outPort().toString()).append(';');
 	    }
 	}
-	if (resultStr.isEmpty())
-	    resultStr = "X";		// Invalid shortest-path
-	return resultStr;
+	if (resultStr.length() == 0)
+	    resultStr.append("X");		// Invalid shortest-path
+	return resultStr.toString();
     }
 
     /**
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryAction.java b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryAction.java
index 1f8849a..a1163c8 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryAction.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryAction.java
@@ -48,7 +48,7 @@
     /**
      * Action structure for ACTION_OUTPUT: Output to switch port.
      */
-    public class ActionOutput {
+    public static class ActionOutput {
 	private Port port;	// Output port
 	private short maxLen;	// Max. length (in bytes) to send to controller
 				// if the port is set to PORT_CONTROLLER
@@ -198,7 +198,7 @@
     /**
      * Action structure for ACTION_SET_VLAN_VID: Set the 802.1q VLAN id
      */
-    public class ActionSetVlanId {
+    public static class ActionSetVlanId {
 	private short vlanId;		// The VLAN ID to set
 
 	/**
@@ -296,7 +296,7 @@
     /**
      * Action structure for ACTION_SET_VLAN_PCP: Set the 802.1q priority
      */
-    public class ActionSetVlanPriority {
+    public static class ActionSetVlanPriority {
 	private byte vlanPriority;	// The VLAN priority to set
 
 	/**
@@ -394,7 +394,7 @@
     /**
      * Action structure for ACTION_STRIP_VLAN: Strip the 802.1q header
      */
-    public class ActionStripVlan {
+    public static class ActionStripVlan {
 	private boolean stripVlan;	// If true, strip the VLAN header
 
 	/**
@@ -489,7 +489,7 @@
      * Action structure for ACTION_SET_DL_SRC and ACTION_SET_DL_DST:
      * Set the Ethernet source/destination address.
      */
-    public class ActionSetEthernetAddr {
+    public static class ActionSetEthernetAddr {
 	private MACAddress addr;	// The MAC address to set
 
 	/**
@@ -589,7 +589,7 @@
      * Action structure for ACTION_SET_NW_SRC and ACTION_SET_NW_DST:
      * Set the IPv4 source/destination address.
      */
-    public class ActionSetIPv4Addr {
+    public static class ActionSetIPv4Addr {
 	private IPv4 addr;		// The IPv4 address to set
 
 	/**
@@ -689,7 +689,7 @@
      * Action structure for ACTION_SET_NW_TOS:
      * Set the IP ToS (DSCP field, 6 bits).
      */
-    public class ActionSetIpToS {
+    public static class ActionSetIpToS {
 	private byte ipToS;	// The IP ToS to set DSCP field, 6 bits)
 
 	/**
@@ -788,7 +788,7 @@
      * Action structure for ACTION_SET_TP_SRC and ACTION_SET_TP_DST:
      * Set the TCP/UDP source/destination port.
      */
-    public class ActionSetTcpUdpPort {
+    public static class ActionSetTcpUdpPort {
 	private short port;		// The TCP/UDP port to set
 
 	/**
@@ -886,7 +886,7 @@
     /**
      * Action structure for ACTION_ENQUEUE: Output to queue on port.
      */
-    public class ActionEnqueue {
+    public static class ActionEnqueue {
 	private Port port;	// Port that queue belongs. Should
 				// refer to a valid physical port
 				// (i.e. < PORT_MAX) or PORT_IN_PORT
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryMatch.java b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryMatch.java
index a721ff2..fd41d09 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryMatch.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryMatch.java
@@ -16,7 +16,7 @@
     /**
      * A class for storing a value to match.
      */
-    class Field<T> {
+    static class Field<T> {
 	/**
 	 * Default constructor.
 	 */
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/FlowPathFlags.java b/src/main/java/net/onrc/onos/ofcontroller/util/FlowPathFlags.java
index 63241f0..4bbd399 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/FlowPathFlags.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowPathFlags.java
@@ -9,10 +9,10 @@
     private long flags;
 
     // Discard the first-hop Flow Entry
-    private final long DISCARD_FIRST_HOP_ENTRY		= (1 << 0);
+    private static final long DISCARD_FIRST_HOP_ENTRY   = (1 << 0);
 
     // Keep only the first-hop Flow Entry
-    private final long KEEP_ONLY_FIRST_HOP_ENTRY	= (1 << 1);
+    private static final long KEEP_ONLY_FIRST_HOP_ENTRY = (1 << 1);
 
     /**
      * Default constructor.
diff --git a/src/main/java/org/openflow/util/HexString.java b/src/main/java/org/openflow/util/HexString.java
index 5777612..07cc1f7 100644
--- a/src/main/java/org/openflow/util/HexString.java
+++ b/src/main/java/org/openflow/util/HexString.java
@@ -27,35 +27,35 @@
      */
     public static String toHexString(byte[] bytes) {
         int i;
-        String ret = "";
+        StringBuilder ret = new StringBuilder(8*2+7);
         String tmp;
         for(i=0; i< bytes.length; i++) {
             if(i> 0)
-                ret += ":";
+                ret.append(':');
             tmp = Integer.toHexString(U8.f(bytes[i]));
             if (tmp.length() == 1)
-                ret += "0";
-            ret += tmp; 
+                ret.append('0');
+            ret.append(tmp);
         }
-        return ret;
+        return ret.toString();
     }
     
     public static String toHexString(long val, int padTo) {
         char arr[] = Long.toHexString(val).toCharArray();
-        String ret = "";
+        StringBuilder ret = new StringBuilder(8*2+7);
         // prepend the right number of leading zeros
         int i = 0;
         for (; i < (padTo * 2 - arr.length); i++) {
-            ret += "0";
+            ret.append('0');
             if ((i % 2) == 1)
-                ret += ":";
+                ret.append(':');
         }
         for (int j = 0; j < arr.length; j++) {
-            ret += arr[j];
+            ret.append(arr[j]);
             if ((((i + j) % 2) == 1) && (j < (arr.length - 1)))
-                ret += ":";
+                ret.append(':');
         }
-        return ret;        
+        return ret.toString();
     }
    
     public static String toHexString(long val) {
diff --git a/src/main/resources/META-INF/services/net.floodlightcontroller.core.module.IFloodlightModule b/src/main/resources/META-INF/services/net.floodlightcontroller.core.module.IFloodlightModule
index f552de5..99ded31 100644
--- a/src/main/resources/META-INF/services/net.floodlightcontroller.core.module.IFloodlightModule
+++ b/src/main/resources/META-INF/services/net.floodlightcontroller.core.module.IFloodlightModule
@@ -18,8 +18,9 @@
 net.floodlightcontroller.devicemanager.test.MockDeviceManager
 net.floodlightcontroller.core.test.MockFloodlightProvider
 net.floodlightcontroller.core.test.MockThreadPoolService
+net.onrc.onos.datagrid.HazelcastDatagrid
 net.onrc.onos.ofcontroller.flowmanager.FlowManager
-net.onrc.onos.ofcontroller.routing.TopoRouteService
+net.onrc.onos.ofcontroller.topology.TopologyManager
 net.onrc.onos.ofcontroller.bgproute.BgpRoute
 net.onrc.onos.registry.controller.ZookeeperRegistry
 net.onrc.onos.registry.controller.StandaloneRegistry
diff --git a/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java b/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
index 4516ece..21788af 100644
--- a/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
+++ b/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
@@ -70,10 +70,10 @@
 import net.floodlightcontroller.test.FloodlightTestCase;
 import net.floodlightcontroller.threadpool.IThreadPoolService;
 import net.onrc.onos.ofcontroller.core.IOFSwitchPortListener;
-import net.onrc.onos.ofcontroller.core.INetMapTopologyService.ITopoRouteService;
 import net.onrc.onos.ofcontroller.flowmanager.FlowManager;
 import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
-import net.onrc.onos.ofcontroller.routing.TopoRouteService;
+import net.onrc.onos.ofcontroller.topology.ITopologyNetService;
+import net.onrc.onos.ofcontroller.topology.TopologyManager;
 import net.onrc.onos.registry.controller.IControllerRegistryService;
 import net.onrc.onos.registry.controller.StandaloneRegistry;
 
@@ -139,7 +139,7 @@
         // Following added by ONOS
         // TODO replace with mock if further testing is needed.
         fmc.addService(IFlowService.class, new FlowManager() );
-        fmc.addService(ITopoRouteService.class, new TopoRouteService() );
+        fmc.addService(ITopologyNetService.class, new TopologyManager() );
         StandaloneRegistry sr = new StandaloneRegistry();
         fmc.addService(IControllerRegistryService.class, sr );
 
diff --git a/src/test/java/net/floodlightcontroller/core/internal/TestDatabaseManager.java b/src/test/java/net/floodlightcontroller/core/internal/TestDatabaseManager.java
index f811c9d..4e6477b 100644
--- a/src/test/java/net/floodlightcontroller/core/internal/TestDatabaseManager.java
+++ b/src/test/java/net/floodlightcontroller/core/internal/TestDatabaseManager.java
@@ -8,9 +8,8 @@
 import java.util.Iterator;
 import java.util.Set;
 
-import junit.framework.Assert;
-
 import org.apache.commons.io.FileUtils;
+import org.junit.Assert;
 
 import com.thinkaurelius.titan.core.TitanFactory;
 import com.thinkaurelius.titan.core.TitanGraph;
@@ -18,6 +17,7 @@
 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";
 	
diff --git a/src/test/java/net/onrc/onos/graph/GraphDBConnectionTest.java b/src/test/java/net/onrc/onos/graph/GraphDBConnectionTest.java
index bee936d..397ed88 100644
--- a/src/test/java/net/onrc/onos/graph/GraphDBConnectionTest.java
+++ b/src/test/java/net/onrc/onos/graph/GraphDBConnectionTest.java
@@ -55,6 +55,7 @@
 	}
 
 	
+	@SuppressWarnings("unchecked")
 	private void expectDBConnectionAvailable() throws Exception {
 		isGraphOpen = false;
 		
@@ -62,7 +63,7 @@
 		mockStatic(TitanFactory.class);
 		mockStatic(EventTransactionalGraph.class);
 		graph = createMock(TitanGraph.class);
-		eg = createMock(EventTransactionalGraph.class);
+		eg = (EventTransactionalGraph<TitanGraph>)createMock(EventTransactionalGraph.class);
 		
 		// setup expectations
 		expect(graph.isOpen()).andAnswer(new IAnswer<Boolean>() {
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIDeviceObjectTest.java b/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIDeviceObjectTest.java
index 323a0eb..880335b 100644
--- a/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIDeviceObjectTest.java
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIDeviceObjectTest.java
@@ -111,7 +111,6 @@
 		IPortObject portObj = ope.newPort(dpid, number);
 		IPortObject portObj2 = ope.newPort(dpid, number2);
 		
-		String ipaddr = "192.168.0.1";
 		IDeviceObject devObj = ope.newDevice();
 		
 		portObj.setDevice(devObj);
@@ -141,11 +140,8 @@
 	public void testSetRemoveHostPort() {
 		String dpid = "00:00:00:00:00:00:0a:07";
 		Short number = 1;	
-		Short number2 = 2;
 		IPortObject portObj = ope.newPort(dpid, number);
-		IPortObject portObj2 = ope.newPort(dpid, number2);
 		
-		String ipaddr = "192.168.0.1";
 		IDeviceObject devObj = ope.newDevice();
 		
 		devObj.setHostPort(portObj);
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsISwitchObjectTest.java b/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsISwitchObjectTest.java
index c4dca4b..dacfdb5 100644
--- a/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsISwitchObjectTest.java
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsISwitchObjectTest.java
@@ -13,6 +13,7 @@
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
 import net.onrc.onos.ofcontroller.core.internal.SwitchStorageImpl;
 import net.onrc.onos.ofcontroller.core.internal.TestDatabaseManager;
+
 import org.easymock.EasyMock;
 import org.junit.After;
 import org.junit.Before;
@@ -146,16 +147,16 @@
 	public void testGetPorts() {
 		String dpid = "00:00:00:00:00:00:0a:07";
 		Short portNumber = 1;
-		int testSwitchPortNumber = 1;
+		final int testSwitchPortNumber = 1;
 		ISwitchObject swObj = ope.newSwitch(dpid);
 		IPortObject portObj = ope.newPort(dpid, portNumber);
 
 		swObj.addPort(portObj);
 		int i = 0;
-		for(IPortObject port : swObj.getPorts()){
+		for(@SuppressWarnings("unused") IPortObject port : swObj.getPorts()){
 			i++;
 		}
-		assertEquals(testSwitchPortNumber, 1);
+		assertEquals(testSwitchPortNumber, i);
 	}
 	
 	/**
@@ -225,7 +226,7 @@
 		portObj.setDevice(devObj);
 		
 		int i = 0;
-		for(IDeviceObject dev : swObj.getDevices()){
+		for(@SuppressWarnings("unused") IDeviceObject dev : swObj.getDevices()){
 			i++;
 		}
 		assertEquals(i, numOfDev);
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImplTest.java b/src/test/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImplTest.java
index f276680..24c17f4 100644
--- a/src/test/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImplTest.java
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImplTest.java
@@ -23,7 +23,6 @@
 import org.slf4j.LoggerFactory;
 
 import com.thinkaurelius.titan.core.TitanFactory;
-import com.thinkaurelius.titan.core.TitanGraph;
 
 //Add Powermock preparation
 @RunWith(PowerMockRunner.class)
@@ -35,8 +34,6 @@
 	String conf;
     private GraphDBConnection mockConn = null;
     private GraphDBOperation mockOpe = null;
-    private GraphDBOperation realOpe = null;
-    private TitanGraph titanGraph = null;
     ISwitchStorage swSt = null;
     
 	@Before
@@ -375,12 +372,10 @@
 	 * Expect:
 	 * 	Should call rollback.
 	 */
-	//@Ignore
 	@Test
 	public void testDeleteSwitchException() {
 		String dpid = "00:00:00:00:00:00:0a:07";
 		String state = "ACTIVE";
-		String type = "";
 		
 		//Mock Switch
 		ISwitchObject mockISw = createMock(ISwitchObject.class);
@@ -392,8 +387,8 @@
 		expect(mockOpe.newSwitch(dpid)).andReturn(mockISw);
 		mockOpe.commit();
 		expect(mockOpe.searchSwitch(dpid)).andReturn(mockISw);
-    	mockOpe.removeSwitch(mockISw);
-    	mockOpe.commit();
+		mockOpe.removeSwitch(mockISw);
+		mockOpe.commit();
 		expectLastCall().andThrow(new RuntimeException());
 		mockOpe.rollback();
 		mockOpe.close();
@@ -515,12 +510,10 @@
 	 * Expect:
 	 * 	Nothing happens.
 	 */
-	//@Ignore
 	@Test
 	public void testAddPortAbnormalNoSwitch() {
 		String dpid = "00:00:00:00:00:00:0a:01";
 		short portNumber = 5;
-		String state = "ACTIVE";
 		String name = "port 5 at SEA switch";
 		
 		OFPhysicalPort portToAdd = new OFPhysicalPort();
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
index 5b0a5b1..2fe5951 100644
--- a/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestDatabaseManager.java
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestDatabaseManager.java
@@ -8,9 +8,8 @@
 import java.util.Iterator;
 import java.util.Set;
 
-import junit.framework.Assert;
-
 import org.apache.commons.io.FileUtils;
+import org.junit.Assert;
 
 import com.thinkaurelius.titan.core.TitanFactory;
 import com.thinkaurelius.titan.core.TitanGraph;
@@ -18,6 +17,7 @@
 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";
 	
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableGraphDBOperation.java b/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableGraphDBOperation.java
index bcff36a..c695f8d 100644
--- a/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableGraphDBOperation.java
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableGraphDBOperation.java
@@ -918,13 +918,13 @@
 		public Short getMatchVlanId() {return matchVlanId; }
 	
 		@Override
-		public void setMatchVlanId(Short matchVlanId) { matchVlanId = matchVlanId; }
+		public void setMatchVlanId(Short matchVlanId) { matchVlanIdToUpdate = matchVlanId; }
 
 		@Override
 		public Byte getMatchVlanPriority() {return matchVlanPriority; }
 	
 		@Override
-		public void setMatchVlanPriority(Byte matchVlanPriority) { matchVlanPriority = matchVlanPriority; }
+		public void setMatchVlanPriority(Byte matchVlanPriority) { matchVlanPriorityToUpdate = matchVlanPriority; }
 		
 		@Override
 		public String getMatchSrcIPv4Net() { return matchSrcIpaddr; }
@@ -942,13 +942,13 @@
 		public Byte getMatchIpProto() {return matchIpProto; }
 	
 		@Override
-		public void setMatchIpProto(Byte matchIpProto) { matchIpProto = matchIpProto; }
+		public void setMatchIpProto(Byte matchIpProto) { matchIpProtoToUpdate = matchIpProto; }
 
 		@Override
 		public Byte getMatchIpToS() {return matchIpToS; }
 	
 		@Override
-		public void setMatchIpToS(Byte matchIpToS) { matchIpToS = matchIpToS; }
+		public void setMatchIpToS(Byte matchIpToS) { matchIpToSToUpdate = matchIpToS; }
 
 		@Override
 		public Short getMatchSrcTcpUdpPort() {return matchSrcTcpUdpPort; }
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
index 2f90d48..ecba546 100644
--- a/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableLinkStorageImpl.java
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableLinkStorageImpl.java
@@ -18,6 +18,7 @@
  *
  */
 
+@SuppressWarnings("deprecation")
 public class TestableLinkStorageImpl extends LinkStorageImpl {
 	protected TitanGraph graph;
 
diff --git a/src/test/java/net/onrc/onos/ofcontroller/devicemanager/internal/DeviceStorageImplTestBB.java b/src/test/java/net/onrc/onos/ofcontroller/devicemanager/internal/DeviceStorageImplTestBB.java
index e4053f4..552cb9c 100644
--- a/src/test/java/net/onrc/onos/ofcontroller/devicemanager/internal/DeviceStorageImplTestBB.java
+++ b/src/test/java/net/onrc/onos/ofcontroller/devicemanager/internal/DeviceStorageImplTestBB.java
@@ -214,11 +214,8 @@
 				{
 
 					String portNumFromDB = port.getNumber().toString();
-					assertEquals(String.valueOf(portNum), portNumFromDB);						
+					assertEquals(String.valueOf(portNum), portNumFromDB);
 
-					ISwitchObject sw = port.getSwitch();
-					String str = sw.getDPID();
-					log.debug("");
 				}
 			}	
 
diff --git a/src/test/java/net/onrc/onos/ofcontroller/flowmanager/FlowManagerTest.java b/src/test/java/net/onrc/onos/ofcontroller/flowmanager/FlowManagerTest.java
index 83a5fab..68e31ba 100644
--- a/src/test/java/net/onrc/onos/ofcontroller/flowmanager/FlowManagerTest.java
+++ b/src/test/java/net/onrc/onos/ofcontroller/flowmanager/FlowManagerTest.java
@@ -19,7 +19,7 @@
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowEntry;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowPath;
 import net.onrc.onos.ofcontroller.flowmanager.web.FlowWebRoutable;
-import net.onrc.onos.ofcontroller.routing.TopoRouteService;
+import net.onrc.onos.ofcontroller.topology.TopologyManager;
 import net.onrc.onos.ofcontroller.util.*;
 
 import org.easymock.EasyMock;
@@ -43,7 +43,7 @@
 public class FlowManagerTest {
 	private static FloodlightModuleContext context;
 	private static IFloodlightProviderService floodlightProvider;
-	private static TopoRouteService topoRouteService;
+	private static TopologyManager topologyManager;
 	private static IRestApiService restApi;
 	private static GraphDBOperation op;
 	
@@ -68,7 +68,7 @@
 		// create mock objects
 		context = createMock(FloodlightModuleContext.class);
 		floodlightProvider = createMock(IFloodlightProviderService.class);
-		topoRouteService = createMock(TopoRouteService.class);
+		topologyManager = createMock(TopologyManager.class);
 		restApi = createMock(IRestApiService.class);
 		op = createMock(GraphDBOperation.class);
 
@@ -76,7 +76,7 @@
 		expect(context.getServiceImpl(IFloodlightProviderService.class)).andReturn(floodlightProvider);
 		expect(context.getServiceImpl(IRestApiService.class)).andReturn(restApi);
 		expectNew(GraphDBOperation.class, new Class<?>[] {String.class}, EasyMock.isA(String.class)).andReturn(op);
-		expectNew(TopoRouteService.class, new Class<?>[] {String.class}, EasyMock.isA(String.class)).andReturn(topoRouteService);
+		expectNew(TopologyManager.class, new Class<?>[] {String.class}, EasyMock.isA(String.class)).andReturn(topologyManager);
 	}
 	
 	private IFlowPath createIFlowPathMock(long flowId, String installerID,
diff --git a/src/test/java/net/onrc/onos/ofcontroller/routing/TopoRouteServiceTest.java b/src/test/java/net/onrc/onos/ofcontroller/topology/TopologyManagerTest.java
similarity index 81%
rename from src/test/java/net/onrc/onos/ofcontroller/routing/TopoRouteServiceTest.java
rename to src/test/java/net/onrc/onos/ofcontroller/topology/TopologyManagerTest.java
index 7929eb1..fbec59e 100644
--- a/src/test/java/net/onrc/onos/ofcontroller/routing/TopoRouteServiceTest.java
+++ b/src/test/java/net/onrc/onos/ofcontroller/topology/TopologyManagerTest.java
@@ -1,4 +1,4 @@
-package net.onrc.onos.ofcontroller.routing;
+package net.onrc.onos.ofcontroller.topology;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
@@ -20,7 +20,7 @@
 import net.onrc.onos.graph.GraphDBConnection;
 import net.onrc.onos.graph.GraphDBOperation;
 import net.onrc.onos.ofcontroller.core.internal.TestDatabaseManager;
-import net.onrc.onos.ofcontroller.routing.TopoRouteService;
+import net.onrc.onos.ofcontroller.topology.TopologyManager;
 import net.onrc.onos.ofcontroller.util.DataPath;
 import net.onrc.onos.ofcontroller.util.Dpid;
 import net.onrc.onos.ofcontroller.util.FlowPathFlags;
@@ -28,17 +28,17 @@
 import net.onrc.onos.ofcontroller.util.SwitchPort;
 
 /**
- * A class for testing the TopoRouteService class.
- * @see net.onrc.onos.ofcontroller.routing.TopoRouteService
+ * A class for testing the TopologyManager class.
+ * @see net.onrc.onos.ofcontroller.topology.TopologyManager
  */
 @RunWith(PowerMockRunner.class)
-@PrepareForTest({TitanFactory.class, GraphDBConnection.class, GraphDBOperation.class, TopoRouteService.class})
-public class TopoRouteServiceTest {
+@PrepareForTest({TitanFactory.class, GraphDBConnection.class, GraphDBOperation.class, TopologyManager.class})
+public class TopologyManagerTest {
     String conf;
     private GraphDBConnection conn = null;
     private GraphDBOperation oper = null;
     private TitanGraph titanGraph = null;
-    private TopoRouteService topoRouteService = null;
+    private TopologyManager topologyManager = null;
 
     /**
      * Setup the tests.
@@ -63,9 +63,9 @@
 	// Populate the database
 	TestDatabaseManager.populateTestData(titanGraph);
 
-	// Prepare the TopoRouteService instance
-	topoRouteService = new TopoRouteService();
-	topoRouteService.setDbOperationHandler(oper);
+	// Prepare the TopologyManager instance
+	topologyManager = new TopologyManager();
+	topologyManager.setDbOperationHandler(oper);
     }
 
     /**
@@ -78,9 +78,9 @@
     }
 
     /**
-     * Test method TopoRouteService.getTopoShortestPath()
+     * Test method TopologyManager.getTopoShortestPath()
      *
-     * @see net.onrc.onos.ofcontroller.routing.TopoRouteService#getTopoShortestPath
+     * @see net.onrc.onos.ofcontroller.topology.TopologyManager#getTopoShortestPath
      */
     @Test
     public void test_getTopoShortestPath() {
@@ -104,10 +104,10 @@
 	// Test a valid Shortest-Path computation
 	//
 	Map<Long, ?> shortestPathTopo =
-	    topoRouteService.prepareShortestPathTopo();
-	dataPath = topoRouteService.getTopoShortestPath(shortestPathTopo,
-							srcSwitchPort,
-							dstSwitchPort);
+	    topologyManager.prepareShortestPathTopo();
+	dataPath = topologyManager.getTopoShortestPath(shortestPathTopo,
+						       srcSwitchPort,
+						       dstSwitchPort);
 	assertTrue(dataPath != null);
 	String dataPathSummaryStr = dataPath.dataPathSummary();
 	// System.out.println(dataPathSummaryStr);
@@ -134,18 +134,18 @@
 	String noSuchDpidStr = "ff:ff:00:00:00:00:0a:06";
 	Dpid noSuchDstDpid = new Dpid(noSuchDpidStr);
 	SwitchPort noSuchDstSwitchPort = new SwitchPort(noSuchDstDpid, dstPort);
-	dataPath = topoRouteService.getTopoShortestPath(shortestPathTopo,
-							srcSwitchPort,
-							noSuchDstSwitchPort);
+	dataPath = topologyManager.getTopoShortestPath(shortestPathTopo,
+						       srcSwitchPort,
+						       noSuchDstSwitchPort);
 	assertTrue(dataPath == null);
 
-	topoRouteService.dropShortestPathTopo(shortestPathTopo);
+	topologyManager.dropShortestPathTopo(shortestPathTopo);
     }
 
     /**
-     * Test method TopoRouteService.getShortestPath()
+     * Test method TopologyManager.getShortestPath()
      *
-     * @see net.onrc.onos.ofcontroller.routing.TopoRouteService#getShortestPath
+     * @see net.onrc.onos.ofcontroller.routing.TopologyManager#getShortestPath
      */
     @Test
     public void test_getShortestPath() {
@@ -168,8 +168,8 @@
 	//
 	// Test a valid Shortest-Path computation
 	//
-	dataPath = topoRouteService.getShortestPath(srcSwitchPort,
-						dstSwitchPort);
+	dataPath = topologyManager.getShortestPath(srcSwitchPort,
+						   dstSwitchPort);
 	assertTrue(dataPath != null);
 	String dataPathSummaryStr = dataPath.dataPathSummary();
 	// System.out.println(dataPathSummaryStr);
@@ -197,15 +197,15 @@
 	Dpid noSuchDstDpid = new Dpid(noSuchDpidStr);
 	SwitchPort noSuchDstSwitchPort = new SwitchPort(noSuchDstDpid, dstPort);
 
-	dataPath = topoRouteService.getShortestPath(srcSwitchPort,
-						    noSuchDstSwitchPort);
+	dataPath = topologyManager.getShortestPath(srcSwitchPort,
+						   noSuchDstSwitchPort);
 	assertTrue(dataPath == null);
     }
 
     /**
-     * Test method TopoRouteService.routeExists()
+     * Test method TopologyManager.routeExists()
      *
-     * @see net.onrc.onos.ofcontroller.routing.TopoRouteService#routeExists
+     * @see net.onrc.onos.ofcontroller.routing.TopologyManager#routeExists
      */
     @Test
     public void test_routeExists() {
@@ -228,7 +228,7 @@
 	//
 	// Test a valid route
 	//
-	result = topoRouteService.routeExists(srcSwitchPort, dstSwitchPort);
+	result = topologyManager.routeExists(srcSwitchPort, dstSwitchPort);
 	assertTrue(result == true);
 
 	//
@@ -237,8 +237,8 @@
 	String noSuchDpidStr = "ff:ff:00:00:00:00:0a:06";
 	Dpid noSuchDstDpid = new Dpid(noSuchDpidStr);
 	SwitchPort noSuchDstSwitchPort = new SwitchPort(noSuchDstDpid, dstPort);
-	result = topoRouteService.routeExists(srcSwitchPort,
-					      noSuchDstSwitchPort);
+	result = topologyManager.routeExists(srcSwitchPort,
+					     noSuchDstSwitchPort);
 	assertTrue(result != true);
     }
 }
diff --git a/src/test/java/net/onrc/onos/ofcontroller/util/FlowEntryActionTest.java b/src/test/java/net/onrc/onos/ofcontroller/util/FlowEntryActionTest.java
index 4db734c..d816517 100644
--- a/src/test/java/net/onrc/onos/ofcontroller/util/FlowEntryActionTest.java
+++ b/src/test/java/net/onrc/onos/ofcontroller/util/FlowEntryActionTest.java
@@ -19,7 +19,7 @@
 	@Test
 	public void testSetActionOutputActionOutput(){
 		FlowEntryAction act = new FlowEntryAction();
-		ActionOutput actout = act.new ActionOutput(new Port((short)42));
+		ActionOutput actout = new FlowEntryAction.ActionOutput(new Port((short)42));
 		act.setActionOutput(actout);
 
 		assertEquals("action output",FlowEntryAction.ActionValues.ACTION_OUTPUT , act.actionType());
@@ -68,7 +68,7 @@
 	@Test
 	public void testSetActionSetVlanIdActionSetVlanId(){
 		FlowEntryAction act = new FlowEntryAction();
-		ActionSetVlanId actVlan = act.new ActionSetVlanId((short)42);
+		ActionSetVlanId actVlan = new FlowEntryAction.ActionSetVlanId((short)42);
 		act.setActionSetVlanId(actVlan);
 
 		assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_VLAN_VID , act.actionType());
@@ -100,7 +100,7 @@
 	@Test
 	public void testSetActionSetVlanPriorityActionSetVlanPriority(){
 		FlowEntryAction act = new FlowEntryAction();
-		ActionSetVlanPriority actVlan = act.new ActionSetVlanPriority((byte)42);
+		ActionSetVlanPriority actVlan = new FlowEntryAction.ActionSetVlanPriority((byte)42);
 		act.setActionSetVlanPriority(actVlan);
 
 		assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_VLAN_PCP , act.actionType());
@@ -132,7 +132,7 @@
 	@Test
 	public void testSetActionStripVlanActionStripVlan(){
 		FlowEntryAction act = new FlowEntryAction();
-		ActionStripVlan actVlan = act.new ActionStripVlan();
+		ActionStripVlan actVlan = new FlowEntryAction.ActionStripVlan();
 		act.setActionStripVlan(actVlan);
 
 		assertEquals("action type",FlowEntryAction.ActionValues.ACTION_STRIP_VLAN , act.actionType());
@@ -165,7 +165,7 @@
 	public void testSetActionSetEthernetSrcAddrActionSetEthernetAddr(){
 		FlowEntryAction act = new FlowEntryAction();
 		byte[] mac = { 1, 2, 3, 4, 5, 6 };
-		ActionSetEthernetAddr setEth = act.new ActionSetEthernetAddr(new MACAddress(mac));
+		ActionSetEthernetAddr setEth = new FlowEntryAction.ActionSetEthernetAddr(new MACAddress(mac));
 		act.setActionSetEthernetSrcAddr( setEth );
 
 		assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_DL_SRC , act.actionType());
@@ -200,7 +200,7 @@
 	public void testSetActionSetEthernetDstAddrActionSetEthernetAddr(){
 		FlowEntryAction act = new FlowEntryAction();
 		byte[] mac = { 1, 2, 3, 4, 5, 6 };
-		ActionSetEthernetAddr setEth = act.new ActionSetEthernetAddr(new MACAddress(mac));
+		ActionSetEthernetAddr setEth = new FlowEntryAction.ActionSetEthernetAddr(new MACAddress(mac));
 		act.setActionSetEthernetDstAddr( setEth );
 
 		assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_DL_DST , act.actionType());
@@ -233,7 +233,7 @@
 	@Test
 	public void testSetActionSetIPv4SrcAddrActionSetIPv4Addr(){
 		FlowEntryAction act = new FlowEntryAction();
-		ActionSetIPv4Addr setIp = act.new ActionSetIPv4Addr(new IPv4("127.0.0.1"));
+		ActionSetIPv4Addr setIp = new FlowEntryAction.ActionSetIPv4Addr(new IPv4("127.0.0.1"));
 		act.setActionSetIPv4SrcAddr( setIp );
 
 		assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_NW_SRC , act.actionType());
@@ -266,7 +266,7 @@
 	@Test
 	public void testSetActionSetIPv4DstAddrActionSetIPv4Addr(){
 		FlowEntryAction act = new FlowEntryAction();
-		ActionSetIPv4Addr setIp = act.new ActionSetIPv4Addr(new IPv4("127.0.0.1"));
+		ActionSetIPv4Addr setIp = new FlowEntryAction.ActionSetIPv4Addr(new IPv4("127.0.0.1"));
 		act.setActionSetIPv4DstAddr( setIp );
 
 		assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_NW_DST , act.actionType());
@@ -298,7 +298,7 @@
 	@Test
 	public void testSetActionSetIpToSActionSetIpToS(){
 		FlowEntryAction act = new FlowEntryAction();
-		ActionSetIpToS setIpTos = act.new ActionSetIpToS((byte)42);
+		ActionSetIpToS setIpTos = new FlowEntryAction.ActionSetIpToS((byte)42);
 		act.setActionSetIpToS( setIpTos );
 
 		assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_NW_TOS , act.actionType());
@@ -330,7 +330,7 @@
 	@Test
 	public void testSetActionSetTcpUdpSrcPortActionSetTcpUdpPort(){
 		FlowEntryAction act = new FlowEntryAction();
-		ActionSetTcpUdpPort setPorts = act.new ActionSetTcpUdpPort((short)42);
+		ActionSetTcpUdpPort setPorts = new FlowEntryAction.ActionSetTcpUdpPort((short)42);
 		act.setActionSetTcpUdpSrcPort( setPorts );
 
 		assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_TP_SRC , act.actionType());
@@ -362,7 +362,7 @@
 	@Test
 	public void testSetActionSetTcpUdpDstPortActionSetTcpUdpPort(){
 		FlowEntryAction act = new FlowEntryAction();
-		ActionSetTcpUdpPort setPorts = act.new ActionSetTcpUdpPort((short)42);
+		ActionSetTcpUdpPort setPorts = new FlowEntryAction.ActionSetTcpUdpPort((short)42);
 		act.setActionSetTcpUdpDstPort( setPorts );
 
 		assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_TP_DST , act.actionType());
@@ -394,7 +394,7 @@
 	@Test
 	public void testSetActionEnqueueActionEnqueue(){
 		FlowEntryAction act = new FlowEntryAction();
-		ActionEnqueue enq = act.new ActionEnqueue(new Port((short)42), 1);
+		ActionEnqueue enq = new FlowEntryAction.ActionEnqueue(new Port((short)42), 1);
 		act.setActionEnqueue( enq );
 
 		assertEquals("action type",FlowEntryAction.ActionValues.ACTION_ENQUEUE , act.actionType());
diff --git a/start-onos-embedded.sh b/start-onos-embedded.sh
index f607c8e..8688f69 100755
--- a/start-onos-embedded.sh
+++ b/start-onos-embedded.sh
@@ -21,11 +21,12 @@
 JVM_OPTS="$JVM_OPTS -XX:CompileThreshold=1500 -XX:PreBlockSpin=8 \
 		-XX:+UseThreadPriorities \
 		-XX:ThreadPriorityPolicy=42 \
-                 -XX:+UseCompressedOops \
+		-XX:+UseCompressedOops \
 		-Dcassandra.compaction.priority=1 \
-            -Dcom.sun.management.jmxremote.port=7199 \
-              -Dcom.sun.management.jmxremote.ssl=false \
-              -Dcom.sun.management.jmxremote.authenticate=false"
+		-Dcom.sun.management.jmxremote.port=7199 \
+		-Dcom.sun.management.jmxremote.ssl=false \
+		-Dcom.sun.management.jmxremote.authenticate=false"
+JVM_OPTS="$JVM_OPTS -Dhazelcast.logging.type=slf4j"
 
 #JVM_OPTS="$JVM_OPTS -Dpython.security.respectJavaAccessibility=false"
 
diff --git a/start-onos.sh b/start-onos.sh
index 14adfb0..495141d 100755
--- a/start-onos.sh
+++ b/start-onos.sh
@@ -30,10 +30,11 @@
 JVM_OPTS="$JVM_OPTS -XX:CompileThreshold=1500 -XX:PreBlockSpin=8 \
 		-XX:+UseThreadPriorities \
 		-XX:ThreadPriorityPolicy=42 \
-                 -XX:+UseCompressedOops \
-            -Dcom.sun.management.jmxremote.port=7189 \
-              -Dcom.sun.management.jmxremote.ssl=false \
-              -Dcom.sun.management.jmxremote.authenticate=false"
+		-XX:+UseCompressedOops \
+		-Dcom.sun.management.jmxremote.port=7189 \
+		-Dcom.sun.management.jmxremote.ssl=false \
+		-Dcom.sun.management.jmxremote.authenticate=false"
+JVM_OPTS="$JVM_OPTS -Dhazelcast.logging.type=slf4j"
 
 # Set ONOS core main class
 MAIN_CLASS="net.onrc.onos.ofcontroller.core.Main"