import akka.pattern.Patterns;
import akka.util.Timeout;
import com.google.common.annotations.VisibleForTesting;
-import io.netty.util.concurrent.EventExecutor;
-import java.util.concurrent.Executor;
-import org.opendaylight.controller.config.threadpool.ScheduledThreadPool;
-import org.opendaylight.controller.config.threadpool.ThreadPool;
-import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.dom.api.DOMMountPointService;
-import org.opendaylight.netconf.client.NetconfClientDispatcher;
-import org.opendaylight.netconf.client.mdsal.api.BaseNetconfSchemas;
import org.opendaylight.netconf.client.mdsal.api.DeviceActionFactory;
import org.opendaylight.netconf.client.mdsal.api.RemoteDeviceId;
import org.opendaylight.netconf.client.mdsal.api.SchemaResourceManager;
final class NetconfNodeContext implements AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(NetconfNodeContext.class);
- private final NetconfClientDispatcher clientDispatcher;
- private final EventExecutor eventExecutor;
private final DeviceActionFactory deviceActionFactory;
private final SchemaResourceManager schemaManager;
- private final BaseNetconfSchemas baseSchemas;
private final NetconfClientConfigurationBuilderFactory builderFactory;
- private final ScheduledThreadPool keepaliveExecutor;
- private final Executor processingExecutor;
- private final DataBroker dataBroker;
private final DOMMountPointService mountPointService;
private final RemoteDeviceId remoteDeviceId;
private final NetconfTopologySetup setup;
private NetconfNodeManager netconfNodeManager;
private NetconfNodeHandler nodeHandler;
- NetconfNodeContext(final NetconfClientDispatcher clientDispatcher, final EventExecutor eventExecutor,
- final ScheduledThreadPool keepaliveExecutor, final ThreadPool processingExecutor,
- final SchemaResourceManager schemaManager, final DataBroker dataBroker,
+ NetconfNodeContext(final NetconfTopologySetup setup, final SchemaResourceManager schemaManager,
final DOMMountPointService mountPointService, final NetconfClientConfigurationBuilderFactory builderFactory,
- final DeviceActionFactory deviceActionFactory, final BaseNetconfSchemas baseSchemas,
- final RemoteDeviceId remoteDeviceId, final NetconfTopologySetup setup,
+ final DeviceActionFactory deviceActionFactory, final RemoteDeviceId remoteDeviceId,
final Timeout actorResponseWaitTime) {
- this.clientDispatcher = requireNonNull(clientDispatcher);
- this.eventExecutor = requireNonNull(eventExecutor);
- this.keepaliveExecutor = requireNonNull(keepaliveExecutor);
- this.processingExecutor = processingExecutor.getExecutor();
+ this.setup = requireNonNull(setup);
this.schemaManager = requireNonNull(schemaManager);
- this.dataBroker = requireNonNull(dataBroker);
this.mountPointService = requireNonNull(mountPointService);
this.builderFactory = requireNonNull(builderFactory);
this.deviceActionFactory = deviceActionFactory;
- this.baseSchemas = requireNonNull(baseSchemas);
this.remoteDeviceId = requireNonNull(remoteDeviceId);
- this.setup = requireNonNull(setup);
this.actorResponseWaitTime = actorResponseWaitTime;
registerNodeManager();
}
// Instantiate the handler ...
masterSalFacade = createSalFacade(netconfNode.requireLockDatastore());
- nodeHandler = new NetconfNodeHandler(clientDispatcher, eventExecutor, keepaliveExecutor.getExecutor(),
- baseSchemas, schemaManager, processingExecutor, builderFactory, deviceActionFactory, masterSalFacade,
- remoteDeviceId, configNode.getNodeId(), netconfNode, nodeOptional);
+ nodeHandler = new NetconfNodeHandler(setup.getNetconfClientDispatcher(), setup.getEventExecutor(),
+ setup.getKeepaliveExecutor(), setup.getBaseSchemas(), schemaManager, setup.getProcessingExecutor(),
+ builderFactory, deviceActionFactory, masterSalFacade, remoteDeviceId, configNode.getNodeId(), netconfNode,
+ nodeOptional);
nodeHandler.connect();
}
@VisibleForTesting
MasterSalFacade createSalFacade(final boolean lockDatastore) {
return new MasterSalFacade(remoteDeviceId, setup.getActorSystem(), masterActorRef, actorResponseWaitTime,
- mountPointService, dataBroker, lockDatastore);
+ mountPointService, setup.getDataBroker(), lockDatastore);
}
}
import akka.util.Timeout;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.util.concurrent.ListenableFuture;
-import io.netty.util.concurrent.EventExecutor;
import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.controller.config.threadpool.ScheduledThreadPool;
-import org.opendaylight.controller.config.threadpool.ThreadPool;
-import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.dom.api.DOMMountPointService;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier;
-import org.opendaylight.netconf.client.NetconfClientDispatcher;
-import org.opendaylight.netconf.client.mdsal.api.BaseNetconfSchemas;
import org.opendaylight.netconf.client.mdsal.api.DeviceActionFactory;
import org.opendaylight.netconf.client.mdsal.api.RemoteDeviceId;
import org.opendaylight.netconf.client.mdsal.api.SchemaResourceManager;
private RemoteDeviceId remoteDeviceId;
- NetconfTopologyContext(final NetconfClientDispatcher clientDispatcher,
- final EventExecutor eventExecutor, final ScheduledThreadPool keepaliveExecutor,
- final ThreadPool processingExecutor, final SchemaResourceManager schemaManager,
- final DataBroker dataBroker, final DOMMountPointService mountPointService,
- final NetconfClientConfigurationBuilderFactory builderFactory,
- final DeviceActionFactory deviceActionFactory, final BaseNetconfSchemas baseSchemas,
- final Timeout actorResponseWaitTime, final ServiceGroupIdentifier serviceGroupIdent,
- final NetconfTopologySetup setup) {
+ NetconfTopologyContext(final SchemaResourceManager schemaManager,
+ final DOMMountPointService mountPointService, final NetconfClientConfigurationBuilderFactory builderFactory,
+ final DeviceActionFactory deviceActionFactory, final Timeout actorResponseWaitTime,
+ final ServiceGroupIdentifier serviceGroupIdent, final NetconfTopologySetup setup) {
this.serviceGroupIdent = requireNonNull(serviceGroupIdent);
remoteDeviceId = NetconfNodeUtils.toRemoteDeviceId(setup.getNode().getNodeId(),
setup.getNode().augmentation(NetconfNode.class));
- topologySingleton = new NetconfNodeContext(clientDispatcher,
- eventExecutor, keepaliveExecutor, processingExecutor, schemaManager, dataBroker, mountPointService,
- builderFactory, deviceActionFactory, baseSchemas, remoteDeviceId, setup, actorResponseWaitTime);
+ topologySingleton = new NetconfNodeContext(setup, schemaManager, mountPointService, builderFactory,
+ deviceActionFactory, remoteDeviceId, actorResponseWaitTime);
}
@VisibleForTesting
private final DOMRpcProviderService rpcProviderRegistry;
private final DOMActionProviderService actionProviderRegistry;
private final ClusterSingletonServiceProvider clusterSingletonServiceProvider;
- private final ScheduledThreadPool keepaliveExecutor;
private final ScheduledExecutorService keepaliveExecutorService;
- private final ThreadPool processingExecutor;
private final Executor processingExecutorService;
private final ActorSystem actorSystem;
private final EventExecutor eventExecutor;
this.rpcProviderRegistry = requireNonNull(rpcProviderRegistry);
actionProviderRegistry = requireNonNull(actionProviderService);
this.clusterSingletonServiceProvider = requireNonNull(clusterSingletonServiceProvider);
- this.keepaliveExecutor = keepaliveExecutor;
keepaliveExecutorService = keepaliveExecutor.getExecutor();
- this.processingExecutor = processingExecutor;
processingExecutorService = processingExecutor.getExecutor();
actorSystem = requireNonNull(actorSystemProvider).getActorSystem();
this.eventExecutor = requireNonNull(eventExecutor);
protected NetconfTopologyContext newNetconfTopologyContext(final NetconfTopologySetup setup,
final ServiceGroupIdentifier serviceGroupIdent, final Timeout actorResponseWaitTime,
final DeviceActionFactory deviceActionFact) {
- return new NetconfTopologyContext(setup.getNetconfClientDispatcher(),
- setup.getEventExecutor(), keepaliveExecutor,
- processingExecutor, resourceManager,
- dataBroker, mountPointService,
- builderFactory, deviceActionFactory,
- baseSchemas, actorResponseWaitTime,
- serviceGroupIdent, setup);
+ return new NetconfTopologyContext(resourceManager, mountPointService, builderFactory, deviceActionFactory,
+ actorResponseWaitTime, serviceGroupIdent, setup);
}
@Override