import org.opendaylight.controller.clustering.services.ICacheUpdateAware;
import org.opendaylight.controller.clustering.services.IClusterGlobalServices;
import org.opendaylight.controller.clustering.services.ICoordinatorChangeAware;
-import org.opendaylight.controller.connectionmanager.ConnectionLocality;
import org.opendaylight.controller.connectionmanager.ConnectionMgmtScheme;
import org.opendaylight.controller.connectionmanager.IConnectionManager;
import org.opendaylight.controller.connectionmanager.scheme.AbstractScheme;
import org.opendaylight.controller.connectionmanager.scheme.SchemeFactory;
import org.opendaylight.controller.sal.connection.ConnectionConstants;
+import org.opendaylight.controller.sal.connection.ConnectionLocality;
import org.opendaylight.controller.sal.connection.IConnectionListener;
import org.opendaylight.controller.sal.connection.IConnectionService;
import org.opendaylight.controller.sal.core.Node;
@Override
public Node connect(String connectionIdentifier, Map<ConnectionConstants, String> params) {
if (connectionService == null) return null;
- return connectionService.connect(connectionIdentifier, params);
+ Node node = connectionService.connect(connectionIdentifier, params);
+ AbstractScheme scheme = schemes.get(activeScheme);
+ if (scheme != null && node != null) scheme.addNode(node);
+ return node;
}
@Override
public Node connect(String type, String connectionIdentifier, Map<ConnectionConstants, String> params) {
if (connectionService == null) return null;
- return connectionService.connect(type, connectionIdentifier, params);
+ Node node = connectionService.connect(connectionIdentifier, params);
+ AbstractScheme scheme = schemes.get(activeScheme);
+ if (scheme != null && node != null) scheme.addNode(node);
+ return node;
}
@Override
public Status disconnect (Node node) {
+ if (node == null) return new Status(StatusCode.BADREQUEST);
if (connectionService == null) return new Status(StatusCode.NOSERVICE);
- return connectionService.disconnect(node);
+ Status status = connectionService.disconnect(node);
+ if (status.isSuccess()) {
+ AbstractScheme scheme = schemes.get(activeScheme);
+ if (scheme != null) scheme.removeNode(node);
+ }
+ return status;
}
@Override