Adding barrier message support with futures to IOFSwitch driver

Change-Id: I0f2de6c60165c2b6687d647850beb7ce23def83a
diff --git a/src/main/java/net/floodlightcontroller/core/internal/OFChannelHandler.java b/src/main/java/net/floodlightcontroller/core/internal/OFChannelHandler.java
index b011e6b..e0e0691 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/OFChannelHandler.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/OFChannelHandler.java
@@ -1241,6 +1241,7 @@
             @Override
             void processOFBarrierReply(OFChannelHandler h, OFBarrierReply m)
                     throws IOException {
+                h.sw.deliverBarrierReply(m);
                 h.dispatchMessage(m);
             }
 
@@ -1665,6 +1666,9 @@
             if ((h.sw.getRole() == Role.MASTER && role == Role.SLAVE) ||
                     (h.sw.getRole() == Role.MASTER && role == Role.EQUAL)) {
                 // the mastership has changed
+                if (role == Role.SLAVE) {
+                    role = Role.EQUAL;
+                }
                 h.sw.setRole(role);
                 h.setState(EQUAL);
                 h.controller.transitionToEqualSwitch(h.sw.getId());