diff --git a/src/main/java/net/floodlightcontroller/core/internal/OFSwitchHandshakeHandler.java b/src/main/java/net/floodlightcontroller/core/internal/OFSwitchHandshakeHandler.java index 561ff3ff2240beabfc0b0fc9982a3fcf093bc0dd..aa9322d6442b5baec6863399decf5025d3cd2cf2 100644 --- a/src/main/java/net/floodlightcontroller/core/internal/OFSwitchHandshakeHandler.java +++ b/src/main/java/net/floodlightcontroller/core/internal/OFSwitchHandshakeHandler.java @@ -1332,10 +1332,11 @@ public class OFSwitchHandshakeHandler implements IOFConnectionListener { * If not defined there, the role will be set as MASTER */ OFControllerRole role = OFControllerRole.ROLE_MASTER; - if(OFSwitchManager.switchInitialRole.containsKey(mainConnection.getDatapathId())){ - role = OFSwitchManager.switchInitialRole.get(mainConnection.getDatapathId()); - log.info("Defining switch role from config file: {}", role); - } + if(OFSwitchManager.switchInitialRole != null) + if(OFSwitchManager.switchInitialRole.containsKey(mainConnection.getDatapathId())){ + role = OFSwitchManager.switchInitialRole.get(mainConnection.getDatapathId()); + log.info("Defining switch role from config file: {}", role); + } sendRoleRequest(role); } } diff --git a/src/main/java/net/floodlightcontroller/core/internal/OFSwitchManager.java b/src/main/java/net/floodlightcontroller/core/internal/OFSwitchManager.java index 530be7059f3f6a107d30995e09a1d0511ace4aa4..1450bc3160f5e6bfe77bf689f7ff60db489ca54e 100644 --- a/src/main/java/net/floodlightcontroller/core/internal/OFSwitchManager.java +++ b/src/main/java/net/floodlightcontroller/core/internal/OFSwitchManager.java @@ -118,9 +118,6 @@ public class OFSwitchManager implements IOFSwitchManager, INewOFConnectionListen private ConcurrentHashMap<DatapathId, IOFSwitchBackend> switches; private ConcurrentHashMap<DatapathId, IOFSwitch> syncedSwitches; - /** - * Tulio Ribeiro - */ protected static Map<DatapathId, OFControllerRole> switchInitialRole; private ISwitchDriverRegistry driverRegistry; @@ -735,13 +732,9 @@ public class OFSwitchManager implements IOFSwitchManager, INewOFConnectionListen } - /** - * Tulio Ribeiro - */ //Define initial role per switch String switchesInitialState = configParams.get("switchesInitialState"); switchInitialRole = jsonToSwitchInitialRoleMap(switchesInitialState); - log.debug("SwitchInitialRole: {}", switchInitialRole.entrySet()); /*