diff --git a/apps/odtn/api/src/test/resources/openconfig-device-link.json b/apps/odtn/api/src/test/resources/openconfig-device-link.json new file mode 100644 index 0000000000..9cbc0e375a --- /dev/null +++ b/apps/odtn/api/src/test/resources/openconfig-device-link.json @@ -0,0 +1,46 @@ +{ + "links": { + "netconf:127.0.0.1:11002/201-netconf:127.0.0.1:11003/201": { + "basic": { + "type": "OPTICAL", + "metric": 1, + "durable": true + } + }, + "netconf:127.0.0.1:11002/202-netconf:127.0.0.1:11003/202": { + "basic": { + "type": "OPTICAL", + "metric": 1, + "durable": true + } + }, + "netconf:127.0.0.1:11002/203-netconf:127.0.0.1:11003/203": { + "basic": { + "type": "OPTICAL", + "metric": 1, + "durable": true + } + }, + "netconf:127.0.0.1:11002/204-netconf:127.0.0.1:11003/204": { + "basic": { + "type": "OPTICAL", + "metric": 1, + "durable": true + } + }, + "netconf:127.0.0.1:11002/205-netconf:127.0.0.1:11003/205": { + "basic": { + "type": "OPTICAL", + "metric": 1, + "durable": true + } + }, + "netconf:127.0.0.1:11002/206-netconf:127.0.0.1:11003/206": { + "basic": { + "type": "OPTICAL", + "metric": 1, + "durable": true + } + } + } +} \ No newline at end of file diff --git a/apps/odtn/api/src/test/resources/openconfig-devices.json b/apps/odtn/api/src/test/resources/openconfig-devices.json index 95cc10bc95..12ef321ac5 100644 --- a/apps/odtn/api/src/test/resources/openconfig-devices.json +++ b/apps/odtn/api/src/test/resources/openconfig-devices.json @@ -2,7 +2,7 @@ "devices" : { "netconf:127.0.0.1:11002" : { "basic" : { - "driver":"infinera-xt3300" + "driver":"cassini-ocnos" }, "netconf" : { "ip" : "127.0.0.1", @@ -13,7 +13,7 @@ }, "netconf:127.0.0.1:11003" : { "basic" : { - "driver":"infinera-xt3300" + "driver":"cassini-ocnos" }, "netconf" : { "ip" : "127.0.0.1", @@ -23,4 +23,4 @@ } } } -} \ No newline at end of file +} 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 6af2517cf7..ece7ca27c0 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 @@ -310,6 +310,7 @@ public class NetconfControllerImpl implements NetconfController { netconfDevicedevice.getSession().addDeviceOutputListener(downListener); return netconfDevicedevice; } finally { + mutex.unlock(); } } @@ -423,7 +424,7 @@ public class NetconfControllerImpl implements NetconfController { } catch (NetconfException e) { log.error("The SSH connection with device {} couldn't be " + "reestablished due to {}. " + - "Marking the device as unreachable", e.getMessage()); + "Marking the device as unreachable", did, e.getMessage()); log.debug("Complete exception: ", e); removeDevice(did); } diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfStreamThread.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfStreamThread.java index c559a0349a..55bd659de6 100644 --- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfStreamThread.java +++ b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfStreamThread.java @@ -68,6 +68,7 @@ public class NetconfStreamThread extends Thread implements NetconfStreamHandler private static final Pattern CHUNKED_SIZE_PATTERN = Pattern.compile("\\n#([1-9][0-9]*)\\n"); private static final char HASH_CHAR = '#'; private static final char LF_CHAR = '\n'; + protected static final String ON_REQUEST = "on request"; private OutputStreamWriter outputStream; private final InputStream err; @@ -300,17 +301,19 @@ public class NetconfStreamThread extends Thread implements NetconfStreamHandler } public void close() { - close("on request"); + close(ON_REQUEST); } private void close(String deviceReply) { log.debug("Netconf device {} socketClosed = true DEVICE_UNREGISTERED {}", netconfDeviceInfo, deviceReply); - NetconfDeviceOutputEvent event = new NetconfDeviceOutputEvent( - NetconfDeviceOutputEvent.Type.DEVICE_UNREGISTERED, - null, null, Optional.of(-1), netconfDeviceInfo); - netconfDeviceEventListeners.forEach( - listener -> listener.event(event)); + if (!deviceReply.equals(ON_REQUEST)) { + NetconfDeviceOutputEvent event = new NetconfDeviceOutputEvent( + NetconfDeviceOutputEvent.Type.DEVICE_UNREGISTERED, + null, null, Optional.of(-1), netconfDeviceInfo); + netconfDeviceEventListeners.forEach( + listener -> listener.event(event)); + } this.interrupt(); }