diff --git a/src/main/java/net/floodlightcontroller/core/OFSwitch.java b/src/main/java/net/floodlightcontroller/core/OFSwitch.java
index b1298f8697128574e4d71c3e95438a3603903b30..d6749324f0a2539d5002560359ba6c69d5f60c8f 100644
--- a/src/main/java/net/floodlightcontroller/core/OFSwitch.java
+++ b/src/main/java/net/floodlightcontroller/core/OFSwitch.java
@@ -867,14 +867,14 @@ public class OFSwitch implements IOFSwitchBackend {
     public boolean portEnabled(OFPort portNumber) {
         OFPortDesc p = portManager.getPort(portNumber);
         if (p == null) return false;
-        return p.getState().contains(OFPortState.LIVE);
+        return (!p.getState().contains(OFPortState.BLOCKED) && !p.getState().contains(OFPortState.LINK_DOWN) && !p.getState().contains(OFPortState.STP_BLOCK));
     }
 
     @Override
     public boolean portEnabled(String portName) {
         OFPortDesc p = portManager.getPort(portName);
         if (p == null) return false;
-        return p.getState().contains(OFPortState.LIVE);
+        return (!p.getState().contains(OFPortState.BLOCKED) && !p.getState().contains(OFPortState.LINK_DOWN) && !p.getState().contains(OFPortState.STP_BLOCK));
     }
 
     @Override
diff --git a/src/main/java/net/floodlightcontroller/devicemanager/IEntityClassifierService.java b/src/main/java/net/floodlightcontroller/devicemanager/IEntityClassifierService.java
index 2569a7df54ed892464810ca415b12a52d1ea76a7..f3e17ccfea12f90ff7136f79eb78a19d4bc94d1a 100644
--- a/src/main/java/net/floodlightcontroller/devicemanager/IEntityClassifierService.java
+++ b/src/main/java/net/floodlightcontroller/devicemanager/IEntityClassifierService.java
@@ -80,8 +80,7 @@ public interface IEntityClassifierService extends IFloodlightService {
     * @param entity the entity to reclassify
     * @return the IEntityClass resulting from the classification
     */
-   IEntityClass reclassifyEntity(IDevice curDevice,
-                                             Entity entity);
+   IEntityClass reclassifyEntity(IDevice curDevice, Entity entity);
 
    /**
     * Once reclassification is complete for a device, this method will be
@@ -95,8 +94,7 @@ public interface IEntityClassifierService extends IFloodlightService {
     * @param newDevices all the new devices derived from the entities of the
     * old device.  If null, the old device was unchanged.
     */
-   void deviceUpdate(IDevice oldDevice, 
-                     Collection<? extends IDevice> newDevices);
+   void deviceUpdate(IDevice oldDevice, Collection<? extends IDevice> newDevices);
 
    /**
     * Adds a listener to listen for IEntityClassifierServices notifications
diff --git a/src/main/java/net/floodlightcontroller/devicemanager/internal/DefaultEntityClassifier.java b/src/main/java/net/floodlightcontroller/devicemanager/internal/DefaultEntityClassifier.java
index faed0d4016147080ce254122b02fa6b8f5c4975f..ea55f8cac2bba0f33746375ff96b40a8ad6825f4 100644
--- a/src/main/java/net/floodlightcontroller/devicemanager/internal/DefaultEntityClassifier.java
+++ b/src/main/java/net/floodlightcontroller/devicemanager/internal/DefaultEntityClassifier.java
@@ -68,8 +68,7 @@ public class DefaultEntityClassifier implements
     static {
         keyFields = EnumSet.of(DeviceField.MAC, DeviceField.VLAN);
     }
-    protected static DefaultEntityClass entityClass =
-        new DefaultEntityClass("DefaultEntityClass");
+    protected static DefaultEntityClass entityClass = new DefaultEntityClass("DefaultEntityClass");
 
     @Override
     public IEntityClass classifyEntity(Entity entity) {
@@ -77,14 +76,12 @@ public class DefaultEntityClassifier implements
     }
 
     @Override
-    public IEntityClass reclassifyEntity(IDevice curDevice,
-                                                     Entity entity) {
+    public IEntityClass reclassifyEntity(IDevice curDevice, Entity entity) {
         return entityClass;
     }
 
     @Override
-    public void deviceUpdate(IDevice oldDevice, 
-                             Collection<? extends IDevice> newDevices) {
+    public void deviceUpdate(IDevice oldDevice, Collection<? extends IDevice> newDevices) {
         // no-op
     }
 
@@ -95,8 +92,7 @@ public class DefaultEntityClassifier implements
 
     @Override
     public Collection<Class<? extends IFloodlightService>> getModuleServices() {
-        Collection<Class<? extends IFloodlightService>> l = 
-                new ArrayList<Class<? extends IFloodlightService>>();
+        Collection<Class<? extends IFloodlightService>> l =  new ArrayList<Class<? extends IFloodlightService>>();
         l.add(IEntityClassifierService.class);
         return l;
     }
@@ -104,24 +100,20 @@ public class DefaultEntityClassifier implements
     @Override
     public Map<Class<? extends IFloodlightService>, IFloodlightService> getServiceImpls() {
         Map<Class<? extends IFloodlightService>,
-        IFloodlightService> m = 
-        new HashMap<Class<? extends IFloodlightService>,
-                    IFloodlightService>();
+        IFloodlightService> m = new HashMap<Class<? extends IFloodlightService>, IFloodlightService>();
         // We are the class that implements the service
         m.put(IEntityClassifierService.class, this);
         return m;
     }
 
     @Override
-    public Collection<Class<? extends IFloodlightService>>
-            getModuleDependencies() {
+    public Collection<Class<? extends IFloodlightService>> getModuleDependencies() {
         // No dependencies
         return null;
     }
 
     @Override
-    public void init(FloodlightModuleContext context)
-                                                 throws FloodlightModuleException {
+    public void init(FloodlightModuleContext context) throws FloodlightModuleException {
         // no-op
     }
 
diff --git a/src/main/java/net/floodlightcontroller/devicemanager/internal/Device.java b/src/main/java/net/floodlightcontroller/devicemanager/internal/Device.java
index bc4e8addbbd7cbf258f2017af735188630a8b800..318ff60c555fcec2fda79fbe4d49a5166ac38bc5 100755
--- a/src/main/java/net/floodlightcontroller/devicemanager/internal/Device.java
+++ b/src/main/java/net/floodlightcontroller/devicemanager/internal/Device.java
@@ -95,7 +95,7 @@ public class Device implements IDevice {
         this.deviceManager = deviceManager;
         this.deviceKey = deviceKey;
         this.entities = new Entity[] {entity};
-        this.macAddressString = entity.getMacAddress().toString(); //TODO @Ryan the toString() methods for of13-loxi appear to format use HexString already
+        this.macAddressString = entity.getMacAddress().toString();
         this.entityClass = entityClass;
         Arrays.sort(this.entities);
 
@@ -103,8 +103,7 @@ public class Device implements IDevice {
         this.oldAPs = null;
         this.attachmentPoints = null;
 
-        if (entity.getSwitchDPID() != null &&
-                entity.getSwitchPort() != null){
+        if (entity.getSwitchDPID() != null && entity.getSwitchPort() != null) {
             DatapathId sw = entity.getSwitchDPID();
             OFPort port = entity.getSwitchPort();
 
diff --git a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceIndex.java b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceIndex.java
index 0d8ea75dd42466600e9abf24637903750479985c..0c5100498a87c1c94736a90e793d1968c282283e 100644
--- a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceIndex.java
+++ b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceIndex.java
@@ -71,8 +71,9 @@ public abstract class DeviceIndex {
      * update will not fail because of a concurrent update 
      * @param device the device to update
      * @param deviceKey the device key for the device
+     * @return 
      */
-    public abstract void updateIndex(Entity entity, Long deviceKey);
+    public abstract boolean updateIndex(Entity entity, Long deviceKey);
 
     /**
      * Remove the entry for the given entity
diff --git a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceIterator.java b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceIterator.java
index ee7724399e3ae471a8ad7e2d28beef5c4e51b53a..7d4d0c35a9c141eb08a82ea52e7283993bdbafaa 100644
--- a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceIterator.java
+++ b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceIterator.java
@@ -87,7 +87,7 @@ public class DeviceIterator extends FilterIterator<Device> {
             if (!match) return false;                
         }
         if (macAddress != null) {
-            if (macAddress.equals(value.getMACAddress()))
+            if (!macAddress.equals(value.getMACAddress()))
                 return false;
         }
         if (vlan != null) {
diff --git a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java
index f63390287150a4c689ff2d6263bf2657e44b3dbd..9f2b942d5bf0efd387780d09892c7e32cc24b5a4 100755
--- a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java
+++ b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java
@@ -119,14 +119,8 @@ import org.slf4j.LoggerFactory;
  * within the network.
  * @author readams
  */
-public class DeviceManagerImpl implements
-IDeviceService, IOFMessageListener, ITopologyListener,
-IFloodlightModule, IEntityClassListener,
-IFlowReconcileListener, IInfoProvider {
-    protected static Logger logger =
-            LoggerFactory.getLogger(DeviceManagerImpl.class);
-
-
+public class DeviceManagerImpl implements IDeviceService, IOFMessageListener, ITopologyListener, IFloodlightModule, IEntityClassListener, IFlowReconcileListener, IInfoProvider {
+    protected static Logger logger = LoggerFactory.getLogger(DeviceManagerImpl.class);
     protected IFloodlightProviderService floodlightProvider;
     protected ITopologyService topology;
     protected IStorageSourceService storageSource;
@@ -136,7 +130,7 @@ IFlowReconcileListener, IInfoProvider {
     protected IFlowReconcileEngineService flowReconcileEngine;
     protected IDebugCounterService debugCounters;
     private ISyncService syncService;
-    private IStoreClient<String,DeviceSyncRepresentation> storeClient;
+    private IStoreClient<String, DeviceSyncRepresentation> storeClient;
     private DeviceSyncManager deviceSyncManager;
 
     /**
@@ -188,8 +182,7 @@ IFlowReconcileListener, IInfoProvider {
      * Time interval between writes of entries for the same device to
      * the sync store.
      */
-    static final int DEFAULT_SYNC_STORE_WRITE_INTERVAL_MS =
-            5*60*1000; // 5 min
+    static final int DEFAULT_SYNC_STORE_WRITE_INTERVAL_MS = 5*60*1000; // 5 min
     private int syncStoreWriteIntervalMs = DEFAULT_SYNC_STORE_WRITE_INTERVAL_MS;
 
     /**
@@ -773,8 +766,7 @@ IFlowReconcileListener, IInfoProvider {
         switch (msg.getType()) {
             case PACKET_IN:
                 cntIncoming.increment();
-                return this.processPacketInMessage(sw,
-                                                   (OFPacketIn) msg, cntx);
+                return this.processPacketInMessage(sw, (OFPacketIn) msg, cntx);
             default:
                 break;
         }
@@ -997,6 +989,7 @@ IFlowReconcileListener, IInfoProvider {
     	if (debugCounters == null) {
     		logger.error("Debug Counter Service not found.");
     	}
+    	debugCounters.registerModule(PACKAGE);
     	cntIncoming = debugCounters.registerCounter(PACKAGE, "incoming",
     			"All incoming packets seen by this module");
     	cntReconcileRequest = debugCounters.registerCounter(PACKAGE,
@@ -1155,15 +1148,11 @@ IFlowReconcileListener, IInfoProvider {
     // Internal methods
     // ****************
 
-    protected Command processPacketInMessage(IOFSwitch sw, OFPacketIn pi,
-                                             FloodlightContext cntx) {
-        Ethernet eth =
-                IFloodlightProviderService.bcStore.
-                get(cntx,IFloodlightProviderService.CONTEXT_PI_PAYLOAD);
+    protected Command processPacketInMessage(IOFSwitch sw, OFPacketIn pi, FloodlightContext cntx) {
+        Ethernet eth = IFloodlightProviderService.bcStore.get(cntx,IFloodlightProviderService.CONTEXT_PI_PAYLOAD);
 
         // Extract source entity information
-        Entity srcEntity =
-                getSourceEntityFromPacket(eth, sw.getId(), pi.getInPort());
+        Entity srcEntity = getSourceEntityFromPacket(eth, sw.getId(), pi.getMatch().get(MatchField.IN_PORT));
         if (srcEntity == null) {
             cntInvalidSource.increment();
             return Command.STOP;
@@ -1175,7 +1164,7 @@ IFlowReconcileListener, IInfoProvider {
         // the IP to MAC mapping of the VRRP IP address.  The source
         // entity will not have that information.  Hence, a separate call
         // to learn devices in such cases.
-        learnDeviceFromArpResponseData(eth, sw.getId(), pi.getInPort());
+        learnDeviceFromArpResponseData(eth, sw.getId(), pi.getMatch().get(MatchField.IN_PORT));
 
         // Learn/lookup device information
         Device srcDevice = learnDeviceByEntity(srcEntity);
@@ -1196,8 +1185,7 @@ IFlowReconcileListener, IInfoProvider {
         Entity dstEntity = getDestEntityFromPacket(eth);
         Device dstDevice = null;
         if (dstEntity != null) {
-            dstDevice =
-                    findDestByEntity(srcDevice.getEntityClass(), dstEntity);
+            dstDevice = findDestByEntity(srcDevice.getEntityClass(), dstEntity);
             if (dstDevice != null)
                 fcStore.put(cntx, CONTEXT_DST_DEVICE, dstDevice);
             else
@@ -1209,7 +1197,7 @@ IFlowReconcileListener, IInfoProvider {
        if (logger.isTraceEnabled()) {
            logger.trace("Received PI: {} on switch {}, port {} *** eth={}" +
                         " *** srcDev={} *** dstDev={} *** ",
-                        new Object[] { pi, sw.getStringId(), pi.getInPort(), eth,
+                        new Object[] { pi, sw.getStringId(), pi.getMatch().get(MatchField.IN_PORT), eth,
                         srcDevice, dstDevice });
        }
 
@@ -1273,8 +1261,7 @@ IFlowReconcileListener, IInfoProvider {
     private IPv4Address getSrcNwAddr(Ethernet eth, MacAddress dlAddr) {
         if (eth.getPayload() instanceof ARP) {
             ARP arp = (ARP) eth.getPayload();
-            if ((arp.getProtocolType() == ARP.PROTO_TYPE_IP) &&
-                    (MacAddress.of(arp.getSenderHardwareAddress()).equals(dlAddr))) {
+            if ((arp.getProtocolType() == ARP.PROTO_TYPE_IP) && (MacAddress.of(arp.getSenderHardwareAddress()).equals(dlAddr))) {
                 return IPv4Address.of(arp.getSenderProtocolAddress());
             }
         }
@@ -1288,9 +1275,7 @@ IFlowReconcileListener, IInfoProvider {
      * @param pi the original packetin
      * @return the entity from the packet
      */
-    protected Entity getSourceEntityFromPacket(Ethernet eth,
-                                             DatapathId swdpid,
-                                             OFPort port) {
+    protected Entity getSourceEntityFromPacket(Ethernet eth, DatapathId swdpid, OFPort port) {
         MacAddress dlAddr = MacAddress.of(eth.getSourceMACAddress());
         
         // Ignore broadcast/multicast source
@@ -1326,7 +1311,7 @@ IFlowReconcileListener, IInfoProvider {
 
         MacAddress senderAddr = MacAddress.of(arp.getSenderHardwareAddress());
 
-        if (dlAddr.equals(senderAddr)) return;
+        if (dlAddr.equals(senderAddr)) return; // arp request
 
         // Ignore broadcast/multicast source
         if (senderAddr.isBroadcast() || senderAddr.isMulticast())
@@ -1457,8 +1442,7 @@ IFlowReconcileListener, IInfoProvider {
             ClassState classState = getClassState(entityClass);
 
             if (classState.classIndex != null) {
-                deviceKey =
-                        classState.classIndex.findByEntity(entity);
+                deviceKey = classState.classIndex.findByEntity(entity);
             }
         }
         if (deviceKey == null) return null;
@@ -1554,8 +1538,7 @@ IFlowReconcileListener, IInfoProvider {
                 ClassState classState = getClassState(entityClass);
 
                 if (classState.classIndex != null) {
-                    deviceKey =
-                            classState.classIndex.findByEntity(entity);
+                    deviceKey = classState.classIndex.findByEntity(entity);
                 }
             }
             if (deviceKey != null) {
@@ -1579,9 +1562,7 @@ IFlowReconcileListener, IInfoProvider {
                 // create a new Device object containing the entity, and
                 // generate a new device ID if the the entity is on an
                 // attachment point port. Otherwise ignore.
-                if (entity.hasSwitchPort() &&
-                        !topology.isAttachmentPointPort(entity.getSwitchDPID(),
-                                                 entity.getSwitchPort())) {
+                if (entity.hasSwitchPort() && !topology.isAttachmentPointPort(entity.getSwitchDPID(), entity.getSwitchPort())) {
                     cntDeviceOnInternalPortNotLearned.increment();
                     if (logger.isDebugEnabled()) {
                         logger.debug("Not learning new device on internal"
@@ -1607,7 +1588,6 @@ IFlowReconcileListener, IInfoProvider {
 
                 // Add the new device to the primary map with a simple put
                 deviceMap.put(deviceKey, device);
-
                 // update indices
                 if (!updateIndices(device, deviceKey)) {
                     if (deleteQueue == null)
@@ -1627,9 +1607,7 @@ IFlowReconcileListener, IInfoProvider {
                                  new Object[]{device, deviceKey, entity});
                 }
                 // generate new device update
-                deviceUpdates =
-                        updateUpdates(deviceUpdates,
-                                      new DeviceUpdate(device, ADD, null));
+                deviceUpdates = updateUpdates(deviceUpdates, new DeviceUpdate(device, ADD, null));
 
                 break;
             }
@@ -1645,9 +1623,7 @@ IFlowReconcileListener, IInfoProvider {
             // If this is not an attachment point port we don't learn the new entity
             // and don't update indexes. But we do allow the device to continue up
             // the chain.
-            if (entity.hasSwitchPort() &&
-                    !topology.isAttachmentPointPort(entity.getSwitchDPID(),
-                                                 entity.getSwitchPort())) {
+            if (entity.hasSwitchPort() && !topology.isAttachmentPointPort(entity.getSwitchDPID(), entity.getSwitchPort())) {
                 cntPacketOnInternalPortForKnownDevice.increment();
                 break;
             }
@@ -1670,8 +1646,7 @@ IFlowReconcileListener, IInfoProvider {
                 Device newDevice = allocateDevice(device, entity, entityindex);
 
                 // generate updates
-                EnumSet<DeviceField> changedFields =
-                        findChangedFields(device, entity);
+                EnumSet<DeviceField> changedFields = findChangedFields(device, entity);
 
                 // update the device map with a replace call
                 boolean res = deviceMap.replace(deviceKey, device, newDevice);
@@ -1705,8 +1680,7 @@ IFlowReconcileListener, IInfoProvider {
             // Update attachment point (will only be hit if the device
             // already existed and no concurrent modification)
             if (entity.hasSwitchPort()) {
-                boolean moved =
-                        device.updateAttachmentPoint(entity.getSwitchDPID(),
+                boolean moved = device.updateAttachmentPoint(entity.getSwitchDPID(),
                                 entity.getSwitchPort(),
                                 entity.getLastSeenTimestamp());
                 // TODO: use update mechanism instead of sending the
@@ -1737,7 +1711,6 @@ IFlowReconcileListener, IInfoProvider {
                 this.deleteDevice(dev);
             }
         }
-
         processUpdates(deviceUpdates);
         deviceSyncManager.storeDeviceThrottled(device);
 
@@ -1801,10 +1774,11 @@ IFlowReconcileListener, IInfoProvider {
             if (logger.isTraceEnabled()) {
                 logger.trace("Dispatching device update: {}", update);
             }
-            if (update.change == DeviceUpdate.Change.DELETE)
+            if (update.change == DeviceUpdate.Change.DELETE) {
                 deviceSyncManager.removeDevice(update.device);
-            else
+            } else {
                 deviceSyncManager.storeDevice(update.device);
+            }
             List<IDeviceListener> listeners = deviceListeners.getOrderedListeners();
             notifyListeners(listeners, update);
         }
@@ -1881,8 +1855,7 @@ IFlowReconcileListener, IInfoProvider {
         return true;
     }
 
-    private LinkedList<DeviceUpdate>
-    updateUpdates(LinkedList<DeviceUpdate> list, DeviceUpdate update) {
+    private LinkedList<DeviceUpdate> updateUpdates(LinkedList<DeviceUpdate> list, DeviceUpdate update) {
         if (update == null) return list;
         if (list == null)
             list = new LinkedList<DeviceUpdate>();
@@ -2315,8 +2288,7 @@ IFlowReconcileListener, IInfoProvider {
     private class DeviceSyncManager  {
         // maps (opaque) deviceKey to the time in System.nanoTime() when we
         // last wrote the device to the sync store
-        private final ConcurrentMap<Long, Long> lastWriteTimes =
-                new ConcurrentHashMap<Long, Long>();
+        private final ConcurrentMap<Long, Long> lastWriteTimes = new ConcurrentHashMap<Long, Long>();
 
         /**
          * Write the given device to storage if we are MASTER.
@@ -2349,8 +2321,7 @@ IFlowReconcileListener, IInfoProvider {
                 return;
             long now = System.nanoTime();
             Long last = lastWriteTimes.get(d.getDeviceKey());
-            if (last == null ||
-                    now - last > intervalNs) {
+            if (last == null || (now - last) > intervalNs) {
                 writeUpdatedDeviceToStorage(d);
                 lastWriteTimes.put(d.getDeviceKey(), now);
             } else {
@@ -2453,8 +2424,7 @@ IFlowReconcileListener, IInfoProvider {
             try {
                 cntDeviceStrored.increment();
                 // FIXME: use a versioned put
-                DeviceSyncRepresentation storeDevice =
-                        new DeviceSyncRepresentation(device);
+                DeviceSyncRepresentation storeDevice = new DeviceSyncRepresentation(device);
                 storeClient.put(storeDevice.getKey(), storeDevice);
             } catch (ObsoleteVersionException e) {
                 // FIXME: what's the right behavior here. Can the store client
@@ -2463,6 +2433,8 @@ IFlowReconcileListener, IInfoProvider {
                 cntSyncException.increment();
                 logger.error("Could not write device " + device +
                           " to sync store:", e);
+            } catch (Exception e) {
+            	logger.error("Count not write device to sync storage " + e.getMessage());
             }
         }
 
diff --git a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceMultiIndex.java b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceMultiIndex.java
index c6aa9808e78a598c350ad388a7f5c06711ee8436..df47d32b2558df200cf8f02154cbde6444411ff4 100644
--- a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceMultiIndex.java
+++ b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceMultiIndex.java
@@ -74,11 +74,11 @@ public class DeviceMultiIndex extends DeviceIndex {
     }
     
     @Override
-    public void updateIndex(Entity entity, Long deviceKey) {
+    public boolean updateIndex(Entity entity, Long deviceKey) {
         Collection<Long> devices = null;
 
         IndexedEntity ie = new IndexedEntity(keyFields, entity);
-        if (!ie.hasNonNullKeys()) return;
+        if (!ie.hasNonNullKeys()) return false;
 
         devices = index.get(ie);
         if (devices == null) {
@@ -90,6 +90,7 @@ public class DeviceMultiIndex extends DeviceIndex {
         }
         
         devices.add(deviceKey);
+        return true;
     }
 
     @Override
diff --git a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceUniqueIndex.java b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceUniqueIndex.java
index 4811013e77258654c9577b0271a51f72c31bfd8d..e373018bff2bc02a02a41384ae58daadaf45cb0b 100644
--- a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceUniqueIndex.java
+++ b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceUniqueIndex.java
@@ -78,10 +78,11 @@ public class DeviceUniqueIndex extends DeviceIndex {
     }
 
     @Override
-    public void updateIndex(Entity entity, Long deviceKey) {
+    public boolean updateIndex(Entity entity, Long deviceKey) {
         IndexedEntity ie = new IndexedEntity(keyFields, entity);
-        if (!ie.hasNonNullKeys()) return;
+        if (!ie.hasNonNullKeys()) return false;
         index.put(ie, deviceKey);
+        return true;
     }
 
     @Override
diff --git a/src/main/java/net/floodlightcontroller/forwarding/Forwarding.java b/src/main/java/net/floodlightcontroller/forwarding/Forwarding.java
index 093b9e7d514805ab5db4573e1fbacc0121fdb9a1..229931ada3b9d18e0372ecbcf8c953a399c0bbeb 100644
--- a/src/main/java/net/floodlightcontroller/forwarding/Forwarding.java
+++ b/src/main/java/net/floodlightcontroller/forwarding/Forwarding.java
@@ -49,6 +49,7 @@ import net.floodlightcontroller.util.MatchMaskUtils;
 
 import org.projectfloodlight.openflow.protocol.OFFlowMod;
 import org.projectfloodlight.openflow.protocol.match.Match;
+import org.projectfloodlight.openflow.protocol.match.MatchField;
 import org.projectfloodlight.openflow.protocol.OFFlowModCommand;
 import org.projectfloodlight.openflow.protocol.OFPacketIn;
 import org.projectfloodlight.openflow.protocol.OFPacketOut;
@@ -178,7 +179,7 @@ public class Forwarding extends ForwardingBase implements IFloodlightModule {
 			}
 			if (srcIsland == null) {
 				log.debug("No openflow island found for source {}/{}",
-						sw.getStringId(), pi.getInPort());
+						sw.getStringId(), pi.getMatch().get(MatchField.IN_PORT));
 				return;
 			}
 
@@ -191,7 +192,7 @@ public class Forwarding extends ForwardingBase implements IFloodlightModule {
 				DatapathId dstIsland = topologyService.getL2DomainId(dstSwDpid);
 				if ((dstIsland != null) && dstIsland.equals(srcIsland)) {
 					on_same_island = true;
-					if ((sw.getId().equals(dstSwDpid)) && (pi.getInPort().equals(dstDap.getPort()))) {
+					if ((sw.getId().equals(dstSwDpid)) && (pi.getMatch().get(MatchField.IN_PORT).equals(dstDap.getPort()))) {
 						on_same_if = true;
 					}
 					break;
@@ -212,7 +213,7 @@ public class Forwarding extends ForwardingBase implements IFloodlightModule {
 				if (log.isTraceEnabled()) {
 					log.trace("Both source and destination are on the same " +
 							"switch/port {}/{}, Action = NOP",
-							sw.toString(), pi.getInPort());
+							sw.toString(), pi.getMatch().get(MatchField.IN_PORT));
 				}
 				return;
 			}
@@ -304,12 +305,11 @@ public class Forwarding extends ForwardingBase implements IFloodlightModule {
 							"out message to the switch",
 							recommendation=LogMessageDoc.CHECK_SWITCH)
 	protected void doFlood(IOFSwitch sw, OFPacketIn pi, FloodlightContext cntx) {
-		if (topologyService.isIncomingBroadcastAllowed(sw.getId(),
-				pi.getInPort()) == false) {
+		if (topologyService.isIncomingBroadcastAllowed(sw.getId(), pi.getMatch().get(MatchField.IN_PORT)) == false) {
 			if (log.isTraceEnabled()) {
 				log.trace("doFlood, drop broadcast packet, pi={}, " +
 						"from a blocked port, srcSwitch=[{},{}], linkInfo={}",
-						new Object[] {pi, sw.getId(),pi.getInPort()});
+						new Object[] {pi, sw.getId(),pi.getMatch().get(MatchField.IN_PORT)});
 			}
 			return;
 		}
@@ -326,7 +326,7 @@ public class Forwarding extends ForwardingBase implements IFloodlightModule {
 
 		// set buffer-id, in-port and packet-data based on packet-in
 		pob.setBufferId(OFBufferId.NO_BUFFER);
-		pob.setInPort(pi.getInPort());
+		pob.setInPort(pi.getMatch().get(MatchField.IN_PORT));
 		pob.setData(pi.getData());
 
 		try {
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
index 34cd6072dd4435c246d25c19910a47ac79901f7e..9e25c824f1785db145137aa1c5a7329714a738eb 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
+++ b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
@@ -104,6 +104,7 @@ import org.projectfloodlight.openflow.types.OFPort;
 import org.projectfloodlight.openflow.util.HexString;
 import org.projectfloodlight.openflow.protocol.OFType;
 import org.projectfloodlight.openflow.protocol.action.OFAction;
+import org.projectfloodlight.openflow.protocol.match.MatchField;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -593,7 +594,7 @@ IFloodlightModule, IInfoProvider {
 		}
 
 		// If packet-in is from a quarantine port, stop processing.
-		NodePortTuple npt = new NodePortTuple(sw, pi.getInPort());
+		NodePortTuple npt = new NodePortTuple(sw, pi.getMatch().get(MatchField.IN_PORT));
 		if (quarantineQueue.contains(npt)) {
 			ctrQuarantineDrops.increment();
 			return Command.STOP;
@@ -2083,6 +2084,7 @@ IFloodlightModule, IInfoProvider {
 		if (debugCounterService == null) {
 			log.error("Debug Counter Service not found.");
 		}
+		debugCounterService.registerModule(PACKAGE);
 		ctrIncoming = debugCounterService.registerCounter(PACKAGE, "incoming",
 				"All incoming packets seen by this module");
 		ctrLldpEol  = debugCounterService.registerCounter(PACKAGE, "lldp-eol",
diff --git a/src/main/java/net/floodlightcontroller/topology/TopologyManager.java b/src/main/java/net/floodlightcontroller/topology/TopologyManager.java
index 1116f61d1f7128ee6ce699827799fe5ccf77b978..91079108da337e754688b2f66d2a125540152b4e 100644
--- a/src/main/java/net/floodlightcontroller/topology/TopologyManager.java
+++ b/src/main/java/net/floodlightcontroller/topology/TopologyManager.java
@@ -70,6 +70,7 @@ import org.projectfloodlight.openflow.protocol.OFPacketIn;
 import org.projectfloodlight.openflow.protocol.OFPacketOut;
 import org.projectfloodlight.openflow.protocol.OFType;
 import org.projectfloodlight.openflow.protocol.action.OFAction;
+import org.projectfloodlight.openflow.protocol.match.MatchField;
 import org.projectfloodlight.openflow.types.DatapathId;
 import org.projectfloodlight.openflow.types.OFBufferId;
 import org.projectfloodlight.openflow.types.OFPort;
@@ -348,8 +349,7 @@ public class TopologyManager implements IFloodlightModule, ITopologyService, IRo
 	}
 
 	@Override
-	public boolean isAttachmentPointPort(DatapathId switchid, OFPort port,
-			boolean tunnelEnabled) {
+	public boolean isAttachmentPointPort(DatapathId switchid, OFPort port, boolean tunnelEnabled) {
 
 		// If the switch port is 'tun-bsn' port, it is not
 		// an attachment point port, irrespective of whether
@@ -898,6 +898,7 @@ public class TopologyManager implements IFloodlightModule, ITopologyService, IRo
 		if (debugCounterService == null) {
 			log.error("debugCounterService should not be null. Has IDebugEventService been loaded previously?");
 		}
+		debugCounterService.registerModule(PACKAGE);
 		ctrIncoming = debugCounterService.registerCounter(
 				PACKAGE, "incoming",
 				"All incoming packets seen by this module");
@@ -922,7 +923,7 @@ public class TopologyManager implements IFloodlightModule, ITopologyService, IRo
 	protected Command dropFilter(DatapathId sw, OFPacketIn pi,
 			FloodlightContext cntx) {
 		Command result = Command.CONTINUE;
-		OFPort port = pi.getInPort();
+		OFPort port = pi.getMatch().get(MatchField.IN_PORT);
 
 		// If the input port is not allowed for data traffic, drop everything.
 		// BDDP packets will not reach this stage.
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 673c92bd2440fbea47f8d76f40a4c97c15fb5b11..40d0cd1bc7e878267c1a195708b9c5ef1094809b 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,4 +18,9 @@ org.sdnplatform.sync.internal.SyncManager
 org.sdnplatform.sync.internal.SyncTorture
 net.floodlightcontroller.hub.Hub
 net.floodlightcontroller.staticflowentry.StaticFlowEntryPusher
-net.floodlightcontroller.testmodule.TestModule
\ No newline at end of file
+net.floodlightcontroller.testmodule.TestModule
+net.floodlightcontroller.topology.TopologyManager
+net.floodlightcontroller.forwarding.Forwarding
+net.floodlightcontroller.loadbalancer.LoadBalancer
+net.floodlightcontroller.linkdiscovery.internal.LinkDiscoveryManager
+net.floodlightcontroller.devicemanager.internal.DeviceManagerImpl
\ No newline at end of file
diff --git a/src/main/resources/floodlightdefault.properties b/src/main/resources/floodlightdefault.properties
index b132d195aa7422ac61236633b745bfca068db0a4..3dbacb7bae8f06c048021048013811e26471de85 100644
--- a/src/main/resources/floodlightdefault.properties
+++ b/src/main/resources/floodlightdefault.properties
@@ -6,10 +6,13 @@ net.floodlightcontroller.threadpool.ThreadPool,\
 net.floodlightcontroller.debugcounter.DebugCounterServiceImpl,\
 net.floodlightcontroller.restserver.RestApiServer,\
 net.floodlightcontroller.perfmon.PktInProcessingTime,\
-net.floodlightcontroller.testmodule.TestModule,\
 net.floodlightcontroller.debugevent.DebugEventService,\
 net.floodlightcontroller.staticflowentry.StaticFlowEntryPusher,\
-net.floodlightcontroller.restserver.RestApiServer
+net.floodlightcontroller.restserver.RestApiServer,\
+net.floodlightcontroller.topology.TopologyManager,\
+net.floodlightcontroller.forwarding.Forwarding,\
+net.floodlightcontroller.linkdiscovery.internal.LinkDiscoveryManager,\
+net.floodlightcontroller.devicemanager.internal.DeviceManagerImpl
 org.sdnplatform.sync.internal.SyncManager.authScheme=CHALLENGE_RESPONSE
 org.sdnplatform.sync.internal.SyncManager.keyStorePath=/etc/floodlight/auth_credentials.jceks
 org.sdnplatform.sync.internal.SyncManager.dbPath=/var/lib/floodlight/
diff --git a/src/main/resources/logback-test.xml b/src/main/resources/logback-test.xml
index e3f2a4fcf21aaf13d7faa25ccbc97da54459a7c5..4bdf5bb7646a55a1eb0aecd6806be4725aaefad7 100644
--- a/src/main/resources/logback-test.xml
+++ b/src/main/resources/logback-test.xml
@@ -6,13 +6,13 @@
   </appender>
   <appender name="EV_WARN_ERR" class="net.floodlightcontroller.debugevent.DebugEventAppender">
   </appender>
-  <root level="INFO">
+  <root level="DEBUG">
     <appender-ref ref="STDOUT" />
     <appender-ref ref="EV_WARN_ERR" />
   </root>
-  <logger name="org" level="WARN"/>
-  <logger name="LogService" level="WARN"/> <!-- Restlet access logging -->
+  <logger name="org" level="DEBUG"/>
+  <logger name="LogService" level="DEBUG"/> <!-- Restlet access logging -->
   <logger name="net.bigdb" level="INFO"/>
-  <logger name="net.floodlightcontroller" level="INFO"/>
-  <logger name="org.sdnplatform" level="INFO"/>
+  <logger name="net.floodlightcontroller" level="DEBUG"/>
+  <logger name="org.sdnplatform" level="INFO"></logger>
 </configuration>
diff --git a/src/test/java/com/bigswitch/floodlight/vendor/OFActionNiciraTtlDecrementTest.java b/src/test/java/com/bigswitch/floodlight/vendor/OFActionNiciraTtlDecrementTest.java
deleted file mode 100644
index a8214b6dfc47b5e8c34c52184aa09397e952ccd4..0000000000000000000000000000000000000000
--- a/src/test/java/com/bigswitch/floodlight/vendor/OFActionNiciraTtlDecrementTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package com.bigswitch.floodlight.vendor;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.jboss.netty.buffer.ChannelBuffers;
-import org.junit.Test;
-import org.openflow.protocol.action.OFAction;
-import org.openflow.protocol.action.OFActionType;
-import org.openflow.protocol.action.OFActionVendor;
-
-import static org.junit.Assert.*;
-
-public class OFActionNiciraTtlDecrementTest {
-    protected static byte[] expectedWireFormat = { 
-                (byte) 0xff, (byte) 0xff,          // action vendor
-                0x00, 0x10,                        // length 
-                0x00, 0x00, 0x23, 0x20,            // nicira
-                0x00, 0x12,                        // subtype 18 == 0x12
-                0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // pad 
-    };
-    
-    @Test
-    public void testAction() {
-        ChannelBuffer buf = ChannelBuffers.buffer(32);
-        
-        OFActionNiciraTtlDecrement act = new OFActionNiciraTtlDecrement();
-        
-        assertEquals(true, act instanceof OFActionNiciraVendor);
-        assertEquals(true, act instanceof OFActionVendor);
-        assertEquals(true, act instanceof OFAction);
-        
-        act.writeTo(buf);
-        
-        ChannelBuffer buf2 = buf.copy();
-        
-        assertEquals(16, buf.readableBytes());
-        byte fromBuffer[] = new byte[16]; 
-        buf.readBytes(fromBuffer);
-        assertArrayEquals(expectedWireFormat, fromBuffer);
-        
-        // Test parsing. TODO: we don't really have the proper parsing
-        // infrastructure....
-        OFActionNiciraVendor act2 = new OFActionNiciraTtlDecrement();
-        act2.readFrom(buf2);
-        assertEquals(act, act2);
-        assertNotSame(act, act2);
-        
-        assertEquals(OFActionType.VENDOR, act2.getType());
-        assertEquals(16, act2.getLength());
-        assertEquals(OFActionNiciraVendor.NICIRA_VENDOR_ID, act2.getVendor());
-        assertEquals((short)18, act2.getSubtype());
-    }
-
-}
diff --git a/src/test/java/com/bigswitch/floodlight/vendor/OFActionTunnelDstIPTest.java b/src/test/java/com/bigswitch/floodlight/vendor/OFActionTunnelDstIPTest.java
deleted file mode 100644
index 38daa746ef6d310a1ce14f02e4e5c21f5f897b4e..0000000000000000000000000000000000000000
--- a/src/test/java/com/bigswitch/floodlight/vendor/OFActionTunnelDstIPTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package com.bigswitch.floodlight.vendor;
-
-import net.floodlightcontroller.packet.IPv4;
-import net.floodlightcontroller.test.FloodlightTestCase;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.jboss.netty.buffer.ChannelBuffers;
-import org.junit.Test;
-import org.openflow.protocol.action.OFActionType;
-
-import static org.junit.Assert.*;
-
-public class OFActionTunnelDstIPTest extends FloodlightTestCase{
-    protected static byte[] expectedWireFormat1 = { 
-            (byte) 0xff, (byte) 0xff,       // ActionVendor
-            0x00, 0x10,                     // 16 bytes
-            0x00, 0x5c, 0x16, (byte)0xc7,   // VendorId BSN
-            0x00, 0x00, 0x00, 0x02,         // subtype 2 (32 bit)
-            0x11, 0x21, 0x31, 0x41          // IP 17.33.49.65
-    };
-
-    @Test
-    public void testAction() {
-        OFActionTunnelDstIP tunnAct1 = new OFActionTunnelDstIP();
-        assertEquals(0, tunnAct1.dstIPAddr);
-
-        OFActionTunnelDstIP tunnAct2 = new OFActionTunnelDstIP(1);
-        
-        assertEquals(false, tunnAct1.equals(tunnAct2));
-        tunnAct1.setTunnelDstIP(1);
-        assertEquals(tunnAct1, tunnAct2);
-        
-        testAll(tunnAct1);
-        testAll(tunnAct2);
-    }
-    
-    private void testAll(OFActionTunnelDstIP tip) {
-        assertEquals(OFActionType.VENDOR, tip.getType());
-        assertEquals(2, tip.getSubtype());
-        assertEquals(16, tip.getLength());
-        assertEquals(0x005c16c7, tip.getVendor());
-
-        tip.setTunnelDstIP(24);
-        assertEquals(24, tip.getTunnelDstIP());
-        
-        // Test wire format
-        int ip = IPv4.toIPv4Address("17.33.49.65");
-        tip.setTunnelDstIP(ip);
-        ChannelBuffer buf = ChannelBuffers.buffer(32);
-        tip.writeTo(buf);
-        ChannelBuffer buf2 = buf.copy();
-        assertEquals(16, buf.readableBytes());
-        byte fromBuffer[] = new byte[16]; 
-        buf.readBytes(fromBuffer);
-        assertArrayEquals(expectedWireFormat1, fromBuffer);
-        
-        OFActionTunnelDstIP act2 = new OFActionTunnelDstIP();
-        act2.readFrom(buf2);
-        assertEquals(tip, act2);
-        
-        
-    }
-    
-    
-}
diff --git a/src/test/java/com/bigswitch/floodlight/vendor/OFBsnPktinSupressionSetRequestVendorDataTest.java b/src/test/java/com/bigswitch/floodlight/vendor/OFBsnPktinSupressionSetRequestVendorDataTest.java
deleted file mode 100644
index 2be162e1ca457c6f03e41ef03c9bbd84cb708f16..0000000000000000000000000000000000000000
--- a/src/test/java/com/bigswitch/floodlight/vendor/OFBsnPktinSupressionSetRequestVendorDataTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package com.bigswitch.floodlight.vendor;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.jboss.netty.buffer.ChannelBuffers;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-public class OFBsnPktinSupressionSetRequestVendorDataTest {
-    protected static byte[] expectedWireFormat = {
-            0x00, 0x00, 0x00, 0x0b, // type == 11
-            0x01,                   // enabled
-            0x00,                   // pad
-            0x00, 0x5a,             // idle timeout
-            (byte) 0xf0, (byte) 0xe0,  // hard timeout
-            0x12, 0x34,             // priority
-            0x33, 0x33, 0x66, 0x66,
-            0x77, 0x77, (byte) 0x99, (byte) 0x99  // cookie
-    };
-
-    @Test
-    public void test() {
-        ChannelBuffer buf = ChannelBuffers.buffer(32);
-
-        OFBsnPktinSuppressionSetRequestVendorData vendorData =
-                new OFBsnPktinSuppressionSetRequestVendorData(
-                                                     true,
-                                                     (short)0x5a,
-                                                     (short)0xf0e0,
-                                                     (short)0x1234,
-                                                     0x3333666677779999L);
-        assertEquals(11, vendorData.getDataType());
-
-        assertEquals(true, vendorData instanceof OFBigSwitchVendorData);
-
-        vendorData.writeTo(buf);
-
-        ChannelBuffer buf2 = buf.copy();
-        assertEquals(20, buf.readableBytes());
-        byte fromBuffer[] = new byte[20];
-        buf.readBytes(fromBuffer);
-        assertArrayEquals(expectedWireFormat, fromBuffer);
-
-        OFBsnPktinSuppressionSetRequestVendorData vendorData2 =
-                new OFBsnPktinSuppressionSetRequestVendorData();
-
-        assertEquals(11, vendorData2.getDataType());
-
-        vendorData2.setIdleTimeout((short)1);
-        assertEquals((short)1, vendorData2.getIdleTimeout());
-
-        vendorData2.setHardTimeout((short)2);
-        assertEquals((short)2, vendorData2.getHardTimeout());
-
-        vendorData2.setPriority((short)3);
-        assertEquals((short)3, vendorData2.getPriority());
-
-        vendorData2.setCookie(12345678901234L);
-        assertEquals(12345678901234L, vendorData2.getCookie());
-
-        vendorData2.readFrom(buf2, buf2.readableBytes());
-        assertEquals(vendorData, vendorData2);
-    }
-
-
-}
diff --git a/src/test/java/com/bigswitch/floodlight/vendor/OFVendorActionFactoriesTest.java b/src/test/java/com/bigswitch/floodlight/vendor/OFVendorActionFactoriesTest.java
deleted file mode 100644
index 4ba390bf5cd35c97312a1cfd77b0d0e4b5fd5e22..0000000000000000000000000000000000000000
--- a/src/test/java/com/bigswitch/floodlight/vendor/OFVendorActionFactoriesTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package com.bigswitch.floodlight.vendor;
-
-import static org.junit.Assert.assertEquals;
-
-import java.beans.BeanInfo;
-import java.beans.IntrospectionException;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.InvocationTargetException;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.jboss.netty.buffer.ChannelBuffers;
-import org.junit.Test;
-import org.openflow.protocol.action.OFActionVendor;
-import org.openflow.protocol.factory.OFVendorActionFactory;
-
-public class OFVendorActionFactoriesTest {
-
-    @Test
-    public void testNiciraVendorActionFactory() {
-        OFNiciraVendorActionFactory factory =
-                new OFNiciraVendorActionFactory();
-
-        OFActionNiciraTtlDecrement ttl = new OFActionNiciraTtlDecrement();
-        rereadAndCheck(factory, ttl);
-    }
-
-    @Test
-    public void testBSNVendorActionFactory() {
-        OFBigSwitchVendorActionFactory factory =
-                new OFBigSwitchVendorActionFactory();
-
-        OFActionMirror mirror = new OFActionMirror((short) 12);
-        mirror.setCopyStage((byte) 96);
-        mirror.setDestPort(123);
-        mirror.setVlanTag(42);
-        rereadAndCheck(factory, mirror);
-
-        OFActionTunnelDstIP dstIP = new OFActionTunnelDstIP((short) 12);
-        dstIP.setTunnelDstIP(0x01020304);
-        rereadAndCheck(factory, dstIP);
-
-    }
-
-
-    protected void rereadAndCheck(OFVendorActionFactory factory, OFActionVendor action) {
-        ChannelBuffer buf= ChannelBuffers.buffer(action.getLengthU());
-        action.writeTo(buf);
-        OFActionVendor readAction = factory.readFrom(buf);
-        assertBeansEqual(action, readAction);
-    }
-
-    public void assertBeansEqual(Object expected, Object actual) {
-        BeanInfo beanInfo;
-        try {
-            beanInfo = Introspector.getBeanInfo(expected.getClass());
-            for (PropertyDescriptor propertyDesc : beanInfo.getPropertyDescriptors()) {
-                Object srcValue = propertyDesc.getReadMethod().invoke(expected);
-                Object dstValue = propertyDesc.getReadMethod().invoke(actual);
-                assertEquals("Bean Value: "+propertyDesc.getName() + " expected: "+srcValue + " != actual: "+dstValue, srcValue, dstValue);
-            }
-        } catch (IntrospectionException e) {
-            throw new RuntimeException(e);
-        } catch (IllegalArgumentException e) {
-            throw new RuntimeException(e);
-        } catch (IllegalAccessException e) {
-            throw new RuntimeException(e);
-        } catch (InvocationTargetException e) {
-            throw new RuntimeException(e);
-        }
-    }
-}
diff --git a/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java b/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
index a7d5a1d019c3322f7ba08988f4105652d1f73583..2148b14df8e3299728d094e332243e0361a541ac 100644
--- a/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
+++ b/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
@@ -20,6 +20,11 @@ package net.floodlightcontroller.core.internal;
 import static org.easymock.EasyMock.*;
 import static org.junit.Assert.*;
 
+import org.junit.Before;
+import org.junit.Test;
+
+import net.floodlightcontroller.test.FloodlightTestCase;
+
 import java.util.List;
 
 import net.floodlightcontroller.core.FloodlightContext;
@@ -34,8 +39,6 @@ import net.floodlightcontroller.core.RoleInfo;
 import net.floodlightcontroller.core.SwitchDescription;
 import net.floodlightcontroller.core.module.FloodlightModuleContext;
 import net.floodlightcontroller.core.test.MockThreadPoolService;
-import net.floodlightcontroller.counter.CounterStore;
-import net.floodlightcontroller.counter.ICounterStoreService;
 import net.floodlightcontroller.debugcounter.IDebugCounterService;
 import net.floodlightcontroller.debugcounter.DebugCounterServiceImpl;
 import net.floodlightcontroller.debugevent.DebugEventService;
@@ -48,17 +51,12 @@ import net.floodlightcontroller.perfmon.IPktInProcessingTimeService;
 import net.floodlightcontroller.perfmon.PktInProcessingTime;
 import net.floodlightcontroller.restserver.IRestApiService;
 import net.floodlightcontroller.restserver.RestApiServer;
-//import net.floodlightcontroller.restserver.IRestApiService;
-//import net.floodlightcontroller.restserver.RestApiServer;
 import net.floodlightcontroller.storage.IStorageSourceService;
 import net.floodlightcontroller.storage.memory.MemoryStorageSource;
-import net.floodlightcontroller.test.FloodlightTestCase;
 import net.floodlightcontroller.threadpool.IThreadPoolService;
 import net.floodlightcontroller.threadpool.ThreadPool;
 
 import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
 
 import net.floodlightcontroller.core.IShutdownListener;
 import net.floodlightcontroller.core.IShutdownService;
@@ -126,9 +124,6 @@ public class ControllerTest extends FloodlightTestCase {
         MockSwitchManager switchService = new MockSwitchManager();
         fmc.addService(IOFSwitchService.class, switchService);
 
-        CounterStore cs = new CounterStore();
-        fmc.addService(ICounterStoreService.class, cs);
-
         PktInProcessingTime ppt = new PktInProcessingTime();
         fmc.addService(IPktInProcessingTimeService.class, ppt);
 
@@ -201,7 +196,6 @@ public class ControllerTest extends FloodlightTestCase {
 
     }
 
-    @Override
     @After
     public void tearDown() {
         tp.getScheduledExecutor().shutdownNow();
diff --git a/src/test/java/net/floodlightcontroller/core/internal/OFSwitchHandshakeHandlerVer13Test.java b/src/test/java/net/floodlightcontroller/core/internal/OFSwitchHandshakeHandlerVer13Test.java
index c205646395b16f2abfb9e752275c4ec3ed2f819f..caf061b1d2fb1574710bdacc3a92319d3222991a 100644
--- a/src/test/java/net/floodlightcontroller/core/internal/OFSwitchHandshakeHandlerVer13Test.java
+++ b/src/test/java/net/floodlightcontroller/core/internal/OFSwitchHandshakeHandlerVer13Test.java
@@ -19,13 +19,11 @@ import org.easymock.Capture;
 import org.hamcrest.CoreMatchers;
 import org.hamcrest.Matchers;
 import org.junit.Test;
-import net.floodlightcontroller.core.GenTableMap;
 import net.floodlightcontroller.core.IOFSwitchBackend;
 import net.floodlightcontroller.core.OFConnection;
 import net.floodlightcontroller.core.SwitchDescription;
 import net.floodlightcontroller.core.internal.OFSwitchAppHandshakePlugin.PluginResultType;
 import net.floodlightcontroller.core.internal.OFSwitchHandshakeHandler.WaitAppHandshakeState;
-import net.floodlightcontroller.core.internal.OFSwitchHandshakeHandler.WaitControllerCxnsReplyState;
 import net.floodlightcontroller.core.util.URIUtil;
 import org.projectfloodlight.openflow.protocol.OFBsnControllerConnection;
 import org.projectfloodlight.openflow.protocol.OFBsnControllerConnectionState;
diff --git a/src/test/java/net/floodlightcontroller/core/internal/RoleManagerTest.java b/src/test/java/net/floodlightcontroller/core/internal/RoleManagerTest.java
index fed8a1a608af0b299820a7fce529523e0bb617ae..861574b29ce04bde74fbfb1e220f45e559ead3ca 100644
--- a/src/test/java/net/floodlightcontroller/core/internal/RoleManagerTest.java
+++ b/src/test/java/net/floodlightcontroller/core/internal/RoleManagerTest.java
@@ -18,6 +18,13 @@
 package net.floodlightcontroller.core.internal;
 
 import static org.easymock.EasyMock.anyObject;
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import net.floodlightcontroller.test.FloodlightTestCase;
+
 import static org.easymock.EasyMock.createMock;
 import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.expectLastCall;
@@ -28,8 +35,7 @@ import static org.easymock.EasyMock.verify;
 import java.util.HashMap;
 
 import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+
 import net.floodlightcontroller.core.HARole;
 import net.floodlightcontroller.core.IOFSwitch;
 import net.floodlightcontroller.core.IOFSwitchBackend;
@@ -39,7 +45,6 @@ import net.floodlightcontroller.core.test.MockSwitchManager;
 import net.floodlightcontroller.debugcounter.IDebugCounterService;
 import net.floodlightcontroller.debugcounter.MockDebugCounterService;
 import org.projectfloodlight.openflow.types.DatapathId;
-import net.floodlightcontroller.test.FloodlightTestCase;
 
 public class RoleManagerTest extends FloodlightTestCase {
     private Controller controller;
@@ -142,12 +147,12 @@ public class RoleManagerTest extends FloodlightTestCase {
         replay(controller);
 
         // Test ACTIVE
-        roleManager.notifyFollower();
+        roleManager.notify();
 
         assertTrue(roleManager.getRole() == HARole.STANDBY);
 
         // Test STANDBY
-        roleManager.notifyFollower();
+        roleManager.notify();
 
         assertTrue(roleManager.getRole() == HARole.STANDBY);
 
@@ -160,7 +165,7 @@ public class RoleManagerTest extends FloodlightTestCase {
         // Another master does NOT exist
         setupSwitchesForNotifyLeader(false);
 
-        roleManager.notifyLeader();
+        roleManager.notify();
 
         assertTrue(roleManager.getRole() == HARole.ACTIVE);
     }
@@ -172,7 +177,7 @@ public class RoleManagerTest extends FloodlightTestCase {
         // Another master exists
         setupSwitchesForNotifyLeader(true);
 
-        roleManager.notifyLeader();
+        roleManager.notify();
 
         assertTrue(roleManager.getRole() == HARole.STANDBY);
     }
@@ -186,7 +191,7 @@ public class RoleManagerTest extends FloodlightTestCase {
          */
         setupSwitchesForNotifyLeader(true);
 
-        roleManager.notifyLeader();
+        roleManager.notify();
 
         assertTrue(roleManager.getRole() == HARole.STANDBY);
 
diff --git a/src/test/java/net/floodlightcontroller/core/test/PacketFactory.java b/src/test/java/net/floodlightcontroller/core/test/PacketFactory.java
index 3a9cc471d3f1e726c8d82bce0dc12fcdfa7684b1..a4779c1d3af0f30b520a3f195979ffeb4fe1b0d8 100644
--- a/src/test/java/net/floodlightcontroller/core/test/PacketFactory.java
+++ b/src/test/java/net/floodlightcontroller/core/test/PacketFactory.java
@@ -20,11 +20,14 @@ import java.util.ArrayList;
 import java.util.List;
 
 import net.floodlightcontroller.core.IOFSwitch;
+
 import org.projectfloodlight.openflow.protocol.OFFactory;
 import org.projectfloodlight.openflow.protocol.OFPacketIn;
 import org.projectfloodlight.openflow.protocol.OFPacketInReason;
+import org.projectfloodlight.openflow.types.IpProtocol;
 import org.projectfloodlight.openflow.types.MacAddress;
 import org.projectfloodlight.openflow.types.OFPort;
+
 import net.floodlightcontroller.packet.DHCP;
 import net.floodlightcontroller.packet.DHCPOption;
 import net.floodlightcontroller.packet.Ethernet;
@@ -132,7 +135,7 @@ public class PacketFactory {
                 .setFlags((byte)0)
                 .setFragmentOffset((short)0)
                 .setTtl((byte)250)
-                .setProtocol(IPv4.PROTOCOL_UDP)
+                .setProtocol(IpProtocol.UDP)
                 .setChecksum((short)0)
                 .setSourceAddress(0)
                 .setDestinationAddress(broadcastIp)
diff --git a/src/test/java/net/floodlightcontroller/core/util/MessageDispatcherTest.java b/src/test/java/net/floodlightcontroller/core/util/MessageDispatcherTest.java
index 5458f3d2a73f1bd34743153eaf81b615cd2bef75..9ea34ce70933726c08a9fa3e695a70216b64b680 100644
--- a/src/test/java/net/floodlightcontroller/core/util/MessageDispatcherTest.java
+++ b/src/test/java/net/floodlightcontroller/core/util/MessageDispatcherTest.java
@@ -18,6 +18,12 @@
 package net.floodlightcontroller.core.util;
 
 import static org.easymock.EasyMock.createNiceMock;
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import net.floodlightcontroller.test.FloodlightTestCase;
+
 import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.replay;
 import static org.easymock.EasyMock.verify;
@@ -26,11 +32,9 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Random;
 
-import org.junit.Test;
 import org.projectfloodlight.openflow.protocol.OFType;
 import net.floodlightcontroller.core.IOFMessageListener;
 import net.floodlightcontroller.core.util.ListenerDispatcher;
-import net.floodlightcontroller.test.FloodlightTestCase;
 
 public class MessageDispatcherTest extends FloodlightTestCase {
 
diff --git a/src/test/java/net/floodlightcontroller/core/util/SingletonTaskTest.java b/src/test/java/net/floodlightcontroller/core/util/SingletonTaskTest.java
index 2534475a0927c7d5c9ea1a5face31ff91d569a36..70560cc312d347b7c1f6ae02e55b79e025d4570c 100644
--- a/src/test/java/net/floodlightcontroller/core/util/SingletonTaskTest.java
+++ b/src/test/java/net/floodlightcontroller/core/util/SingletonTaskTest.java
@@ -17,12 +17,15 @@
 
 package net.floodlightcontroller.core.util;
 
+import static org.junit.Assert.*;
+
 import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
 
 import org.junit.Before;
 import org.junit.Test;
+
 import net.floodlightcontroller.test.FloodlightTestCase;
 
 public class SingletonTaskTest extends FloodlightTestCase {
diff --git a/src/test/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImplTest.java b/src/test/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImplTest.java
index ecd145f969176aafb8e7a0ede3dcbc87bd5fb731..43317cc8d84152149e0781378f014fb83fa3cb19 100644
--- a/src/test/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImplTest.java
+++ b/src/test/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImplTest.java
@@ -53,8 +53,8 @@ import net.floodlightcontroller.core.FloodlightContext;
 import net.floodlightcontroller.core.IFloodlightProviderService;
 import net.floodlightcontroller.core.IListener.Command;
 import net.floodlightcontroller.core.IOFSwitch;
-import net.floodlightcontroller.core.IFloodlightProviderService.Role;
-import net.floodlightcontroller.core.ImmutablePort;
+import net.floodlightcontroller.core.internal.RoleManager;
+import net.floodlightcontroller.core.HARole;
 import net.floodlightcontroller.core.module.FloodlightModuleContext;
 import net.floodlightcontroller.core.module.FloodlightModuleException;
 import net.floodlightcontroller.core.test.MockThreadPoolService;
@@ -90,11 +90,12 @@ import net.floodlightcontroller.topology.ITopologyService;
 import org.easymock.EasyMock;
 import org.junit.Before;
 import org.junit.Test;
-import org.openflow.protocol.OFPacketIn;
-import org.openflow.protocol.OFPacketIn.OFPacketInReason;
-import org.openflow.protocol.OFPort;
-import org.openflow.protocol.OFType;
-import org.openflow.util.HexString;
+import org.projectfloodlight.openflow.protocol.OFPacketIn;
+import org.projectfloodlight.openflow.protocol.OFPacketInReason;
+import org.projectfloodlight.openflow.protocol.OFPortDesc;
+import org.projectfloodlight.openflow.types.DatapathId;
+import org.projectfloodlight.openflow.types.OFPort;
+import org.projectfloodlight.openflow.protocol.OFType;
 import org.sdnplatform.sync.IClosableIterator;
 import org.sdnplatform.sync.IStoreClient;
 import org.sdnplatform.sync.ISyncService;
@@ -121,14 +122,12 @@ public class DeviceManagerImplTest extends FloodlightTestCase {
     MemoryStorageSource storageSource;
     FlowReconcileManager flowReconcileMgr;
 
-    private IOFSwitch makeSwitchMock(long id) {
+    private IOFSwitch makeSwitchMock(DatapathId id) {
         IOFSwitch mockSwitch = createMock(IOFSwitch.class);
-        ImmutablePort port = ImmutablePort.create("p1", (short)1);
+        OFPort port = OFPort.of(1);
         expect(mockSwitch.getId()).andReturn(id).anyTimes();
-        expect(mockSwitch.getStringId())
-                .andReturn(HexString.toHexString(id, 6)).anyTimes();
-        expect(mockSwitch.getPort(anyShort()))
-                .andReturn(port).anyTimes();
+        expect(mockSwitch.getStringId()).andReturn(id.toString()).anyTimes();
+        expect(mockSwitch.getPort(OFPort.of(anyShort())).getPortNo()).andReturn(port).anyTimes();
         return mockSwitch;
     }
 
@@ -141,16 +140,15 @@ public class DeviceManagerImplTest extends FloodlightTestCase {
      */
     private ITopologyService makeMockTopologyAllPortsAp() {
         ITopologyService mockTopology = createMock(ITopologyService.class);
-        mockTopology.isAttachmentPointPort(anyLong(), anyShort());
+        mockTopology.isAttachmentPointPort(DatapathId.of(anyLong()), OFPort.of(anyShort()));
         expectLastCall().andReturn(true).anyTimes();
-        mockTopology.getL2DomainId(anyLong());
+        mockTopology.getL2DomainId(DatapathId.of(anyLong()));
         expectLastCall().andReturn(1L).anyTimes();
-        mockTopology.isBroadcastDomainPort(anyLong(), anyShort());
+        mockTopology.isBroadcastDomainPort(DatapathId.of(anyLong()), OFPort.of(anyShort()));
         expectLastCall().andReturn(false).anyTimes();
-        mockTopology.isConsistent(anyLong(), anyShort(), anyLong(), anyShort());
+        mockTopology.isConsistent(DatapathId.of(anyLong()), OFPort.of(anyShort()), DatapathId.of(anyLong()), OFPort.of(anyShort()));
         expectLastCall().andReturn(false).anyTimes();
-        mockTopology.isInSameBroadcastDomain(anyLong(), anyShort(),
-                                             anyLong(), anyShort());
+        mockTopology.isInSameBroadcastDomain(DatapathId.of(anyLong()), OFPort.of(anyShort()), DatapathId.of(anyLong()), OFPort.of(anyShort()));
         expectLastCall().andReturn(false).anyTimes();
         return mockTopology;
     }
@@ -158,10 +156,10 @@ public class DeviceManagerImplTest extends FloodlightTestCase {
     @Override
     @Before
     public void setUp() throws Exception {
-        doSetUp(Role.MASTER);
+        doSetUp(HARole.ACTIVE);
     }
 
-    public void doSetUp(Role initialRole) throws Exception {
+    public void doSetUp(HARole initialRole) throws Exception {
         super.setUp();
 
         this.syncService = new MockSyncService();
@@ -173,6 +171,7 @@ public class DeviceManagerImplTest extends FloodlightTestCase {
         fmc.addService(IThreadPoolService.class, tp);
         mockFloodlightProvider = getMockFloodlightProvider();
         mockFloodlightProvider.setRole(initialRole, "");
+        
 
         deviceManager = new DeviceManagerImpl();
         flowReconcileMgr = new FlowReconcileManager();
@@ -209,15 +208,15 @@ public class DeviceManagerImplTest extends FloodlightTestCase {
         expectLastCall().anyTimes();
         replay(topology);
 
-        IOFSwitch mockSwitch1 = makeSwitchMock(1L);
-        IOFSwitch mockSwitch10 = makeSwitchMock(10L);
-        IOFSwitch mockSwitch5 = makeSwitchMock(5L);
-        IOFSwitch mockSwitch50 = makeSwitchMock(50L);
-        Map<Long, IOFSwitch> switches = new HashMap<Long,IOFSwitch>();
-        switches.put(1L, mockSwitch1);
-        switches.put(10L, mockSwitch10);
-        switches.put(5L, mockSwitch5);
-        switches.put(50L, mockSwitch50);
+        IOFSwitch mockSwitch1 = makeSwitchMock(DatapathId.of(1L));
+        IOFSwitch mockSwitch10 = makeSwitchMock(DatapathId.of(10L));
+        IOFSwitch mockSwitch5 = makeSwitchMock(DatapathId.of(5L));
+        IOFSwitch mockSwitch50 = makeSwitchMock(DatapathId.of(50L));
+        Map<DatapathId, IOFSwitch> switches = new HashMap<DatapathId, IOFSwitch>();
+        switches.put(DatapathId.of(1L), mockSwitch1);
+        switches.put(DatapathId.of(10L), mockSwitch10);
+        switches.put(DatapathId.of(5L), mockSwitch5);
+        switches.put(DatapathId.of(50L), mockSwitch50);
         mockFloodlightProvider.setSwitches(switches);
 
         replay(mockSwitch1, mockSwitch5, mockSwitch10, mockSwitch50);