Netconf node tcp-only leaf defines if we should use SSH or TCP as an
underlying protocol for netconf session to a netconf device.
Currently it does not have any default value defined. That means if we
forgot to fill in tcp-only field when configuring netconf mount point,
netconf topology implementation will not know what protocol to use and
will throw NPE. However, it would be more user friendly to have some
default protocol defined. We should aim to use SSH by default as it is
more secure protocol than just plain TCP.
Make tcp-only field default to false.
JIRA: NETCONF-488
Change-Id: I99d17ad54db55089b9ec3e417d69e711058c760a
Signed-off-by: Jakub Morvay <jmorvay@frinx.io>
final NodeId nodeId = netconfTopologyDeviceSetup.getNode().getNodeId();
Preconditions.checkNotNull(netconfNode.getHost());
Preconditions.checkNotNull(netconfNode.getPort());
final NodeId nodeId = netconfTopologyDeviceSetup.getNode().getNodeId();
Preconditions.checkNotNull(netconfNode.getHost());
Preconditions.checkNotNull(netconfNode.getPort());
- Preconditions.checkNotNull(netconfNode.isTcpOnly());
this.deviceCommunicatorDTO = createDeviceCommunicator(nodeId, netconfNode, deviceHandler);
final NetconfDeviceCommunicator deviceCommunicator = deviceCommunicatorDTO.getCommunicator();
this.deviceCommunicatorDTO = createDeviceCommunicator(nodeId, netconfNode, deviceHandler);
final NetconfDeviceCommunicator deviceCommunicator = deviceCommunicatorDTO.getCommunicator();
? NetconfTopologyUtils.DEFAULT_MAX_CONNECTION_ATTEMPTS : node.getMaxConnectionAttempts();
final int betweenAttemptsTimeoutMillis = node.getBetweenAttemptsTimeoutMillis() == null
? NetconfTopologyUtils.DEFAULT_BETWEEN_ATTEMPTS_TIMEOUT_MILLIS : node.getBetweenAttemptsTimeoutMillis();
? NetconfTopologyUtils.DEFAULT_MAX_CONNECTION_ATTEMPTS : node.getMaxConnectionAttempts();
final int betweenAttemptsTimeoutMillis = node.getBetweenAttemptsTimeoutMillis() == null
? NetconfTopologyUtils.DEFAULT_BETWEEN_ATTEMPTS_TIMEOUT_MILLIS : node.getBetweenAttemptsTimeoutMillis();
+ final boolean isTcpOnly = node.isTcpOnly() == null
+ ? NetconfTopologyUtils.DEFAULT_IS_TCP_ONLY : node.isTcpOnly();
final BigDecimal sleepFactor = node.getSleepFactor() == null
? NetconfTopologyUtils.DEFAULT_SLEEP_FACTOR : node.getSleepFactor();
final BigDecimal sleepFactor = node.getSleepFactor() == null
? NetconfTopologyUtils.DEFAULT_SLEEP_FACTOR : node.getSleepFactor();
final NetconfReconnectingClientConfigurationBuilder reconnectingClientConfigurationBuilder;
final Protocol protocol = node.getProtocol();
final NetconfReconnectingClientConfigurationBuilder reconnectingClientConfigurationBuilder;
final Protocol protocol = node.getProtocol();
- if (node.isTcpOnly()) {
reconnectingClientConfigurationBuilder = NetconfReconnectingClientConfigurationBuilder.create()
.withProtocol(NetconfClientConfiguration.NetconfClientProtocol.TCP)
.withAuthHandler(getHandlerFromCredentials(node.getCredentials()));
reconnectingClientConfigurationBuilder = NetconfReconnectingClientConfigurationBuilder.create()
.withProtocol(NetconfClientConfiguration.NetconfClientProtocol.TCP)
.withAuthHandler(getHandlerFromCredentials(node.getCredentials()));
public static final long DEFAULT_REQUEST_TIMEOUT_MILLIS = 60000L;
public static final int DEFAULT_KEEPALIVE_DELAY = 0;
public static final boolean DEFAULT_RECONNECT_ON_CHANGED_SCHEMA = false;
public static final long DEFAULT_REQUEST_TIMEOUT_MILLIS = 60000L;
public static final int DEFAULT_KEEPALIVE_DELAY = 0;
public static final boolean DEFAULT_RECONNECT_ON_CHANGED_SCHEMA = false;
+ public static final boolean DEFAULT_IS_TCP_ONLY = false;
public static final int DEFAULT_CONCURRENT_RPC_LIMIT = 0;
public static final int DEFAULT_MAX_CONNECTION_ATTEMPTS = 0;
public static final int DEFAULT_BETWEEN_ATTEMPTS_TIMEOUT_MILLIS = 2000;
public static final int DEFAULT_CONCURRENT_RPC_LIMIT = 0;
public static final int DEFAULT_MAX_CONNECTION_ATTEMPTS = 0;
public static final int DEFAULT_BETWEEN_ATTEMPTS_TIMEOUT_MILLIS = 2000;
protected static final int DEFAULT_KEEPALIVE_DELAY = 0;
protected static final boolean DEFAULT_RECONNECT_ON_CHANGED_SCHEMA = false;
protected static final int DEFAULT_CONCURRENT_RPC_LIMIT = 0;
protected static final int DEFAULT_KEEPALIVE_DELAY = 0;
protected static final boolean DEFAULT_RECONNECT_ON_CHANGED_SCHEMA = false;
protected static final int DEFAULT_CONCURRENT_RPC_LIMIT = 0;
+ private static final boolean DEFAULT_IS_TCP_ONLY = false;
private static final int DEFAULT_MAX_CONNECTION_ATTEMPTS = 0;
private static final int DEFAULT_BETWEEN_ATTEMPTS_TIMEOUT_MILLIS = 2000;
private static final long DEFAULT_CONNECTION_TIMEOUT_MILLIS = 20000L;
private static final int DEFAULT_MAX_CONNECTION_ATTEMPTS = 0;
private static final int DEFAULT_BETWEEN_ATTEMPTS_TIMEOUT_MILLIS = 2000;
private static final long DEFAULT_CONNECTION_TIMEOUT_MILLIS = 20000L;
Preconditions.checkNotNull(netconfNode.getHost());
Preconditions.checkNotNull(netconfNode.getPort());
Preconditions.checkNotNull(netconfNode.getHost());
Preconditions.checkNotNull(netconfNode.getPort());
- Preconditions.checkNotNull(netconfNode.isTcpOnly());
final NetconfConnectorDTO deviceCommunicatorDTO = createDeviceCommunicator(nodeId, netconfNode);
final NetconfDeviceCommunicator deviceCommunicator = deviceCommunicatorDTO.getCommunicator();
final NetconfConnectorDTO deviceCommunicatorDTO = createDeviceCommunicator(nodeId, netconfNode);
final NetconfDeviceCommunicator deviceCommunicator = deviceCommunicatorDTO.getCommunicator();
? DEFAULT_MAX_CONNECTION_ATTEMPTS : node.getMaxConnectionAttempts();
final int betweenAttemptsTimeoutMillis = node.getBetweenAttemptsTimeoutMillis() == null
? DEFAULT_BETWEEN_ATTEMPTS_TIMEOUT_MILLIS : node.getBetweenAttemptsTimeoutMillis();
? DEFAULT_MAX_CONNECTION_ATTEMPTS : node.getMaxConnectionAttempts();
final int betweenAttemptsTimeoutMillis = node.getBetweenAttemptsTimeoutMillis() == null
? DEFAULT_BETWEEN_ATTEMPTS_TIMEOUT_MILLIS : node.getBetweenAttemptsTimeoutMillis();
+ final boolean useTcp = node.isTcpOnly() == null ? DEFAULT_IS_TCP_ONLY : node.isTcpOnly();
final BigDecimal sleepFactor = node.getSleepFactor() == null ? DEFAULT_SLEEP_FACTOR : node.getSleepFactor();
final InetSocketAddress socketAddress = getSocketAddress(node.getHost(), node.getPort().getValue());
final BigDecimal sleepFactor = node.getSleepFactor() == null ? DEFAULT_SLEEP_FACTOR : node.getSleepFactor();
final InetSocketAddress socketAddress = getSocketAddress(node.getHost(), node.getPort().getValue());
final NetconfReconnectingClientConfigurationBuilder reconnectingClientConfigurationBuilder;
final Protocol protocol = node.getProtocol();
final NetconfReconnectingClientConfigurationBuilder reconnectingClientConfigurationBuilder;
final Protocol protocol = node.getProtocol();
- if (node.isTcpOnly()) {
reconnectingClientConfigurationBuilder = NetconfReconnectingClientConfigurationBuilder.create()
.withProtocol(NetconfClientConfiguration.NetconfClientProtocol.TCP)
.withAuthHandler(getHandlerFromCredentials(node.getCredentials()));
reconnectingClientConfigurationBuilder = NetconfReconnectingClientConfigurationBuilder.create()
.withProtocol(NetconfClientConfiguration.NetconfClientProtocol.TCP)
.withAuthHandler(getHandlerFromCredentials(node.getCredentials()));
leaf tcp-only {
config true;
type boolean;
leaf tcp-only {
config true;
type boolean;