import org.opendaylight.netconf.sal.connect.netconf.NetconfDeviceBuilder;
import org.opendaylight.netconf.sal.connect.netconf.SchemalessNetconfDevice;
import org.opendaylight.netconf.sal.connect.netconf.auth.DatastoreBackedPublicKeyAuth;
-import org.opendaylight.netconf.sal.connect.netconf.listener.NetconfDeviceCapabilities;
import org.opendaylight.netconf.sal.connect.netconf.listener.NetconfDeviceCommunicator;
import org.opendaylight.netconf.sal.connect.netconf.listener.NetconfSessionPreferences;
import org.opendaylight.netconf.sal.connect.netconf.listener.UserPreferences;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.schema.storage.YangLibrary;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
+import org.opendaylight.yangtools.yang.common.Empty;
import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
import org.opendaylight.yangtools.yang.model.repo.spi.PotentialSchemaSource;
}
@Override
- public ListenableFuture<NetconfDeviceCapabilities> connectNode(final NodeId nodeId, final Node configNode) {
+ public ListenableFuture<Empty> connectNode(final NodeId nodeId, final Node configNode) {
LOG.info("Connecting RemoteDevice{{}} , with config {}", nodeId, hideCredentials(configNode));
return setupConnection(nodeId, configNode);
}
}
@Override
- public ListenableFuture<Void> disconnectNode(final NodeId nodeId) {
+ public ListenableFuture<Empty> disconnectNode(final NodeId nodeId) {
LOG.debug("Disconnecting RemoteDevice{{}}", nodeId.getValue());
final NetconfConnectorDTO connectorDTO = activeConnectors.remove(nodeId);
}
connectorDTO.close();
- return Futures.immediateFuture(null);
+ return Futures.immediateFuture(Empty.value());
}
- protected ListenableFuture<NetconfDeviceCapabilities> setupConnection(final NodeId nodeId,
- final Node configNode) {
+ protected ListenableFuture<Empty> setupConnection(final NodeId nodeId, final Node configNode) {
final NetconfNode netconfNode = configNode.augmentation(NetconfNode.class);
final NetconfNodeAugmentedOptional nodeOptional = configNode.augmentation(NetconfNodeAugmentedOptional.class);
final NetconfClientSessionListener netconfClientSessionListener = deviceCommunicatorDTO.getSessionListener();
final NetconfReconnectingClientConfiguration clientConfig =
getClientConfig(netconfClientSessionListener, netconfNode, nodeId);
- final ListenableFuture<NetconfDeviceCapabilities> future =
+ final ListenableFuture<Empty> future =
deviceCommunicator.initializeRemoteConnection(clientDispatcher, clientConfig);
activeConnectors.put(nodeId, deviceCommunicatorDTO);
- Futures.addCallback(future, new FutureCallback<NetconfDeviceCapabilities>() {
+ Futures.addCallback(future, new FutureCallback<>() {
@Override
- public void onSuccess(final NetconfDeviceCapabilities result) {
+ public void onSuccess(final Empty result) {
LOG.debug("Connector for {} started succesfully", nodeId.getValue());
}
final RemoteDeviceId remoteDeviceId = NetconfNodeUtils.toRemoteDeviceId(nodeId, node);
final long keepaliveDelay = node.requireKeepaliveDelay().toJava();
- RemoteDeviceHandler<NetconfSessionPreferences> salFacade = createSalFacade(remoteDeviceId);
+ RemoteDeviceHandler salFacade = createSalFacade(remoteDeviceId);
if (keepaliveDelay > 0) {
LOG.info("Adding keepalive facade, for device {}", nodeId);
salFacade = new KeepaliveSalFacade(remoteDeviceId, salFacade, keepaliveExecutor.getExecutor(),
keepaliveDelay, node.requireDefaultRequestTimeoutMillis().toJava());
}
- final RemoteDevice<NetconfSessionPreferences, NetconfDeviceCommunicator> device;
+ final RemoteDevice<NetconfDeviceCommunicator> device;
final List<SchemaSourceRegistration<?>> yanglibRegistrations;
if (node.requireSchemaless()) {
device = new SchemalessNetconfDevice(baseSchemas, remoteDeviceId, salFacade);
yanglibRegistrations = List.of();
} else {
final boolean reconnectOnChangedSchema = node.requireReconnectOnChangedSchema();
- final SchemaResourcesDTO resources = schemaManager.getSchemaResources(node, nodeId.getValue());
+ final SchemaResourcesDTO resources = schemaManager.getSchemaResources(node.getSchemaCacheDirectory(),
+ nodeId.getValue());
device = new NetconfDeviceBuilder()
.setReconnectOnSchemasChange(reconnectOnChangedSchema)
.setSchemaResourcesDTO(resources)
throw new IllegalStateException("Unsupported credential type: " + credentials.getClass());
}
- protected abstract RemoteDeviceHandler<NetconfSessionPreferences> createSalFacade(RemoteDeviceId id);
+ protected abstract RemoteDeviceHandler createSalFacade(RemoteDeviceId id);
private static Optional<UserPreferences> getUserCapabilities(final NetconfNode node) {
// if none of yang-module-capabilities or non-module-capabilities is specified