- new TimedReconnectStrategyFactory(netconfTopologyDeviceSetup.getEventExecutor(), maxConnectionAttempts,
- betweenAttemptsTimeoutMillis, sleepFactor);
- final ReconnectStrategy strategy = sf.createReconnectStrategy();
+ new TimedReconnectStrategyFactory(netconfTopologyDeviceSetup.getEventExecutor(), maxConnectionAttempts,
+ betweenAttemptsTimeoutMillis, BigDecimal.valueOf(sleepFactor.unscaledValue(), sleepFactor.scale()));
+
+
+ final NetconfReconnectingClientConfigurationBuilder reconnectingClientConfigurationBuilder;
+ final Protocol protocol = node.getProtocol();
+ if (isTcpOnly) {
+ reconnectingClientConfigurationBuilder = NetconfReconnectingClientConfigurationBuilder.create()
+ .withProtocol(NetconfClientConfiguration.NetconfClientProtocol.TCP)
+ .withAuthHandler(getHandlerFromCredentials(node.getCredentials()));
+ } else if (protocol == null || protocol.getName() == Protocol.Name.SSH) {
+ reconnectingClientConfigurationBuilder = NetconfReconnectingClientConfigurationBuilder.create()
+ .withProtocol(NetconfClientConfiguration.NetconfClientProtocol.SSH)
+ .withAuthHandler(getHandlerFromCredentials(node.getCredentials()));
+ } else if (protocol.getName() == Protocol.Name.TLS) {
+ reconnectingClientConfigurationBuilder = NetconfReconnectingClientConfigurationBuilder.create()
+ .withSslHandlerFactory(new SslHandlerFactoryImpl(keystoreAdapter, protocol.getSpecification()))
+ .withProtocol(NetconfClientConfiguration.NetconfClientProtocol.TLS);
+ } else {
+ throw new IllegalStateException("Unsupported protocol type: " + protocol.getName());
+ }