X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=netconf%2Fnetconf-topology-singleton%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Ftopology%2Fsingleton%2Fimpl%2FNetconfTopologyManager.java;h=717607bd707263465c271f6ad73d06fb3fa1f0d9;hb=refs%2Fchanges%2F37%2F59537%2F12;hp=23a46aaa5a7a22e1bd710656ae28c2655b03d65a;hpb=f273cff9baab6d3bd6a93214b639ecab7061e242;p=netconf.git diff --git a/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/NetconfTopologyManager.java b/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/NetconfTopologyManager.java index 23a46aaa5a..717607bd70 100644 --- a/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/NetconfTopologyManager.java +++ b/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/NetconfTopologyManager.java @@ -17,6 +17,7 @@ import io.netty.util.concurrent.EventExecutor; import java.util.Collection; import java.util.HashMap; import java.util.Map; +import java.util.concurrent.TimeUnit; import javax.annotation.Nonnull; import org.opendaylight.controller.cluster.ActorSystemProvider; import org.opendaylight.controller.config.threadpool.ScheduledThreadPool; @@ -28,9 +29,8 @@ import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier; import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; import org.opendaylight.controller.md.sal.binding.api.WriteTransaction; import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; -import org.opendaylight.controller.sal.binding.api.BindingAwareBroker; +import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService; import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; -import org.opendaylight.controller.sal.core.api.Broker; import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider; import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration; import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier; @@ -40,6 +40,7 @@ import org.opendaylight.netconf.topology.singleton.impl.utils.NetconfTopologySet import org.opendaylight.netconf.topology.singleton.impl.utils.NetconfTopologySetup.NetconfTopologySetupBuilder; import org.opendaylight.netconf.topology.singleton.impl.utils.NetconfTopologyUtils; import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; +import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.topology.singleton.config.rev170419.Config; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopologyBuilder; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; @@ -63,37 +64,39 @@ public class NetconfTopologyManager private final Map, ClusterSingletonServiceRegistration> clusterRegistrations = new HashMap<>(); - private ListenerRegistration dataChangeListenerRegistration; - private final DataBroker dataBroker; private final RpcProviderRegistry rpcProviderRegistry; private final ClusterSingletonServiceProvider clusterSingletonServiceProvider; - private final BindingAwareBroker bindingAwareBroker; private final ScheduledThreadPool keepaliveExecutor; private final ThreadPool processingExecutor; - private final Broker domBroker; private final ActorSystem actorSystem; private final EventExecutor eventExecutor; private final NetconfClientDispatcher clientDispatcher; private final String topologyId; + private final Duration writeTxIdleTimeout; + private final DOMMountPointService mountPointService; + + private ListenerRegistration dataChangeListenerRegistration; + private String privateKeyPath; + private String privateKeyPassphrase; public NetconfTopologyManager(final DataBroker dataBroker, final RpcProviderRegistry rpcProviderRegistry, final ClusterSingletonServiceProvider clusterSingletonServiceProvider, - final BindingAwareBroker bindingAwareBroker, final ScheduledThreadPool keepaliveExecutor, final ThreadPool processingExecutor, - final Broker domBroker, final ActorSystemProvider actorSystemProvider, final EventExecutor eventExecutor, - final NetconfClientDispatcher clientDispatcher, final String topologyId) { + final ActorSystemProvider actorSystemProvider, final EventExecutor eventExecutor, + final NetconfClientDispatcher clientDispatcher, final String topologyId, + final Config config, final DOMMountPointService mountPointService) { this.dataBroker = Preconditions.checkNotNull(dataBroker); this.rpcProviderRegistry = Preconditions.checkNotNull(rpcProviderRegistry); this.clusterSingletonServiceProvider = Preconditions.checkNotNull(clusterSingletonServiceProvider); - this.bindingAwareBroker = Preconditions.checkNotNull(bindingAwareBroker); this.keepaliveExecutor = Preconditions.checkNotNull(keepaliveExecutor); this.processingExecutor = Preconditions.checkNotNull(processingExecutor); - this.domBroker = Preconditions.checkNotNull(domBroker); this.actorSystem = Preconditions.checkNotNull(actorSystemProvider).getActorSystem(); this.eventExecutor = Preconditions.checkNotNull(eventExecutor); this.clientDispatcher = Preconditions.checkNotNull(clientDispatcher); this.topologyId = Preconditions.checkNotNull(topologyId); + this.writeTxIdleTimeout = Duration.apply(config.getWriteTransactionIdleTimeout(), TimeUnit.SECONDS); + this.mountPointService = mountPointService; } // Blueprint init method @@ -150,9 +153,9 @@ public class NetconfTopologyManager final NetconfTopologyContext newNetconfTopologyContext = new NetconfTopologyContext(createSetup(instanceIdentifier, node), serviceGroupIdent, - actorResponseWaitTime); + actorResponseWaitTime, mountPointService); - final ClusterSingletonServiceRegistration clusterSingletonServiceRegistration = + final ClusterSingletonServiceRegistration clusterSingletonServiceRegistration = clusterSingletonServiceProvider.registerClusterSingletonService(newNetconfTopologyContext); clusterRegistrations.put(instanceIdentifier, clusterSingletonServiceRegistration); @@ -196,6 +199,20 @@ public class NetconfTopologyManager clusterRegistrations.clear(); } + /** + * Sets the private key path from location specified in configuration file using blueprint + */ + public void setPrivateKeyPath(String privateKeyPath){ + this.privateKeyPath = privateKeyPath; + } + + /** + * Sets the private key passphrase from location specified in configuration file using blueprint + */ + public void setPrivateKeyPassphrase(String privateKeyPassphrase){ + this.privateKeyPassphrase = privateKeyPassphrase; + } + private ListenerRegistration registerDataTreeChangeListener(final String topologyId) { final WriteTransaction wtx = dataBroker.newWriteOnlyTransaction(); initTopology(wtx, LogicalDatastoreType.CONFIGURATION, topologyId); @@ -214,8 +231,8 @@ public class NetconfTopologyManager LOG.debug("Registering datastore listener"); return dataBroker.registerDataTreeChangeListener( - new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, - NetconfTopologyUtils.createTopologyListPath(topologyId).child(Node.class)), this); + new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, + NetconfTopologyUtils.createTopologyListPath(topologyId).child(Node.class)), this); } private void initTopology(final WriteTransaction wtx, final LogicalDatastoreType datastoreType, final String topologyId) { @@ -235,14 +252,16 @@ public class NetconfTopologyManager .setInstanceIdentifier(instanceIdentifier) .setRpcProviderRegistry(rpcProviderRegistry) .setNode(node) - .setBindingAwareBroker(bindingAwareBroker) .setActorSystem(actorSystem) .setEventExecutor(eventExecutor) - .setDomBroker(domBroker) .setKeepaliveExecutor(keepaliveExecutor) .setProcessingExecutor(processingExecutor) .setTopologyId(topologyId) - .setNetconfClientDispatcher(clientDispatcher); + .setNetconfClientDispatcher(clientDispatcher) + .setSchemaResourceDTO(NetconfTopologyUtils.setupSchemaCacheDTO(node)) + .setIdleTimeout(writeTxIdleTimeout) + .setPrivateKeyPath(privateKeyPath) + .setPrivateKeyPassphrase(privateKeyPassphrase); return builder.build(); }