Removing fixed ssh timout on netconf session, if not otherwise specified it will default to INFINITE
Re-Adding down listener to thread upon session re-establishment. Enables re-opening every time.
Change-Id: I4c236cb5ff91a0a0fa6c5f70de79728415c2e63a
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfSessionMinaImpl.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfSessionMinaImpl.java
index c7870b8..9a70597 100644
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfSessionMinaImpl.java
+++ b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfSessionMinaImpl.java
@@ -224,10 +224,12 @@
deviceInfo.getDeviceId());
client = SshClient.setUpDefaultClient();
- client.getProperties().putIfAbsent(FactoryManager.IDLE_TIMEOUT,
- TimeUnit.SECONDS.toMillis(idleTimeout));
- client.getProperties().putIfAbsent(FactoryManager.NIO2_READ_TIMEOUT,
- TimeUnit.SECONDS.toMillis(idleTimeout + 15L));
+ if (idleTimeout != NetconfControllerImpl.netconfIdleTimeout) {
+ client.getProperties().putIfAbsent(FactoryManager.IDLE_TIMEOUT,
+ TimeUnit.SECONDS.toMillis(idleTimeout));
+ client.getProperties().putIfAbsent(FactoryManager.NIO2_READ_TIMEOUT,
+ TimeUnit.SECONDS.toMillis(idleTimeout + 15L));
+ }
client.start();
client.setKeyPairProvider(new SimpleGeneratorHostKeyProvider());
startSession();
@@ -294,6 +296,7 @@
streamHandler = new NetconfStreamThread(channel.getInvertedOut(), channel.getInvertedIn(),
channel.getInvertedErr(), deviceInfo,
new NetconfSessionDelegateImpl(), replies);
+ primaryListeners.forEach(l -> streamHandler.addDeviceEventListener(l));
} else {
throw new NetconfException("Failed to open channel with device " +
deviceInfo);