mirror of
https://github.com/opennetworkinglab/onos.git
synced 2026-05-08 21:56:11 +02:00
Fix for Netconf device re-connection.
Unproprer issuing of Device_UNREGISTERED event was causing incorrect device removal during session re-establishment. Unconsistent state in ports and links resulted. Change-Id: Ie07d9077ff0b197a1cb8936b1f307807fae34aeb
This commit is contained in:
parent
6b5d4fd1b8
commit
c535b67566
46
apps/odtn/api/src/test/resources/openconfig-device-link.json
Normal file
46
apps/odtn/api/src/test/resources/openconfig-device-link.json
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user