Removing Rest and Netconf devices when the providers are disabled
Change-Id: Icac7146fea1295c11972ae4cbf87f8ef9689c671
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfControllerImpl.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfControllerImpl.java
index cebe012..99ef8ce 100644
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfControllerImpl.java
+++ b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfControllerImpl.java
@@ -108,7 +108,7 @@
}
@Override
- public void removeDevice(NetconfDeviceInfo deviceInfo) {
+ public void disconnectDevice(NetconfDeviceInfo deviceInfo) {
if (!netconfDeviceMap.containsKey(deviceInfo.getDeviceId())) {
log.warn("Device {} is not present", deviceInfo);
} else {
@@ -116,6 +116,18 @@
}
}
+ @Override
+ public void removeDevice(NetconfDeviceInfo deviceInfo) {
+ if (!netconfDeviceMap.containsKey(deviceInfo.getDeviceId())) {
+ log.warn("Device {} is not present", deviceInfo);
+ } else {
+ netconfDeviceMap.remove(deviceInfo.getDeviceId());
+ for (NetconfDeviceListener l : netconfDeviceListeners) {
+ l.deviceRemoved(deviceInfo);
+ }
+ }
+ }
+
private NetconfDevice createDevice(NetconfDeviceInfo deviceInfo) throws NetconfException {
NetconfDevice netconfDevice = deviceFactory.createNetconfDevice(deviceInfo);
for (NetconfDeviceListener l : netconfDeviceListeners) {
@@ -138,6 +150,11 @@
return netconfDeviceMap;
}
+ @Override
+ public Set<DeviceId> getNetconfDevices() {
+ return netconfDeviceMap.keySet();
+ }
+
//Device factory for the specific NetconfDeviceImpl
private class DefaultNetconfDeviceFactory implements NetconfDeviceFactory {