package org.opendaylight.controller.connectionmanager.scheme;
-import java.net.InetAddress;
-import java.util.Set;
import org.opendaylight.controller.clustering.services.IClusterGlobalServices;
import org.opendaylight.controller.connectionmanager.ConnectionMgmtScheme;
import org.opendaylight.controller.sal.core.Node;
class SingleControllerScheme extends AbstractScheme {
- private static AbstractScheme myScheme= null;
+ private static AbstractScheme myScheme = null;
protected SingleControllerScheme(IClusterGlobalServices clusterServices) {
super(clusterServices, ConnectionMgmtScheme.SINGLE_CONTROLLER);
return myScheme;
}
- @SuppressWarnings("deprecation")
@Override
public boolean isConnectionAllowedInternal(Node node) {
- if (nodeConnections == null) return true;
- for (Node existingNode : nodeConnections.keySet()) {
- Set<InetAddress> controllers = nodeConnections.get(existingNode);
- if (controllers == null || controllers.size() == 0) continue;
- if (!controllers.contains(clusterServices.getMyAddress())) return false;
- }
- return true;
+ // Lets make it simple. The Cluster Coordinator is the master
+ return clusterServices.amICoordinator();
}
-}
+}
\ No newline at end of file