1 package org.opendaylight.controller.connectionmanager.scheme;
3 import java.net.InetAddress;
5 import org.opendaylight.controller.clustering.services.IClusterGlobalServices;
6 import org.opendaylight.controller.connectionmanager.ConnectionMgmtScheme;
7 import org.opendaylight.controller.sal.core.Node;
9 class SingleControllerScheme extends AbstractScheme {
11 private static AbstractScheme myScheme= null;
13 protected SingleControllerScheme(IClusterGlobalServices clusterServices) {
14 super(clusterServices, ConnectionMgmtScheme.SINGLE_CONTROLLER);
17 public static AbstractScheme getScheme(IClusterGlobalServices clusterServices) {
18 if (myScheme == null) {
19 myScheme = new SingleControllerScheme(clusterServices);
24 @SuppressWarnings("deprecation")
26 public boolean isConnectionAllowedInternal(Node node) {
27 if (nodeConnections == null) return true;
28 for (Node existingNode : nodeConnections.keySet()) {
29 Set<InetAddress> controllers = nodeConnections.get(existingNode);
30 if (controllers == null || controllers.size() == 0) continue;
31 if (!controllers.contains(clusterServices.getMyAddress())) return false;