From dbffc043a6dbcc02ce9c5cbc35dd34b3d0c156e1 Mon Sep 17 00:00:00 2001 From: Anurag Chadha Date: Wed, 9 Feb 2022 21:12:55 +0530 Subject: [PATCH] [ONOS-8152] Adding new event in NetconfDeviceListener for netconf connection re-establishment after idle-timeout/session close received from device Change-Id: I13f9ba181a0512b7496b76c04df67d38a9cea7df --- .../org/onosproject/netconf/NetconfDeviceListener.java | 8 ++++++++ .../netconf/ctl/impl/NetconfControllerImpl.java | 3 +++ 2 files changed, 11 insertions(+) diff --git a/protocols/netconf/api/src/main/java/org/onosproject/netconf/NetconfDeviceListener.java b/protocols/netconf/api/src/main/java/org/onosproject/netconf/NetconfDeviceListener.java index beae1bf1da..30c531802e 100644 --- a/protocols/netconf/api/src/main/java/org/onosproject/netconf/NetconfDeviceListener.java +++ b/protocols/netconf/api/src/main/java/org/onosproject/netconf/NetconfDeviceListener.java @@ -37,4 +37,12 @@ public interface NetconfDeviceListener { */ void deviceRemoved(DeviceId deviceId); + + /** + * Notifies that netconf connection with device is reestablished. + * + * @param deviceId the device with which netconf connection is reestablished + */ + default void netconfConnectionReestablished(DeviceId deviceId) { + } } diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfControllerImpl.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfControllerImpl.java index 51e8913743..cbf12f4c23 100644 --- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfControllerImpl.java +++ b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfControllerImpl.java @@ -815,6 +815,9 @@ public class NetconfControllerImpl implements NetconfController { if (device != null) { device.getSession().checkAndReestablish(); log.info("Connection with device {} was reestablished", did); + for (NetconfDeviceListener l : netconfDeviceListeners) { + l.netconfConnectionReestablished(did); + } } else { log.warn("The device {} is not in the system", did); }