+ void onChangeNotification(ChangeNotification notification) {
+ LOG.info("notification received from device {}: {}", this.nodeId, notification.toString());
+ if (notification.getEdit() == null) {
+ LOG.warn("unable to handle {} notificatin received - list of edit is null", ChangeNotification.QNAME);
+ return;
+ }
+ for (Edit edit : notification.getEdit()) {
+ if (edit.getTarget() == null) {
+ continue;
+ }
+ // 1. Detect the org-openroadm-device object modified
+ switch (edit.getTarget().getTargetType().getSimpleName()) {
+ case "Ports":
+ LinkedList<DataObjectStep<?>> path = new LinkedList<>();
+ edit.getTarget().getPathArguments().forEach(p -> path.add(p));
+ InstanceIdentifier<Ports> portIID = InstanceIdentifier.unsafeOf(path);
+ String portName = InstanceIdentifier.keyOf(portIID).getPortName();
+ path.removeLast();
+ InstanceIdentifier<CircuitPacks> cpIID = InstanceIdentifier.unsafeOf(path);
+ String cpName = InstanceIdentifier.keyOf(cpIID).getCircuitPackName();
+ LOG.info("port {} of circruit-pack {} modified on device {}", portName, cpName, this.nodeId);
+ Mapping oldMapping = portMapping.getMapping(nodeId, cpName, portName);
+ if (oldMapping == null) {
+ return;
+ }
+ Runnable handleNetconfEvent = new Runnable() {
+ @Override
+ public void run() {
+ portMapping.updateMapping(nodeId, oldMapping);
+ LOG.info("{} : mapping data for {} updated", nodeId,
+ oldMapping.getLogicalConnectionPoint());
+ }
+ };
+ Thread thread = new Thread(handleNetconfEvent);
+ thread.start();
+ break;
+ case "Interface":
+ LinkedList<DataObjectStep<?>> pathInter = new LinkedList<>();
+ edit.getTarget().getPathArguments().forEach(p -> pathInter.add(p));
+ InstanceIdentifier<Interface> interfIID = InstanceIdentifier.unsafeOf(pathInter);
+ String interfName = InstanceIdentifier.keyOf(interfIID).getName();
+ LOG.info("interface {} modified on device {}", interfName, this.nodeId);
+ Mapping oldMapping2 = portMapping.getMappingFromOtsInterface(nodeId, interfName);
+ if (oldMapping2 == null) {
+ return;
+ }
+ Runnable handleNetconfEvent2 = new Runnable() {
+ @Override
+ public void run() {
+ portMapping.updateMapping(nodeId, oldMapping2);
+ LOG.info("{} : mapping data for {} updated", nodeId,
+ oldMapping2.getLogicalConnectionPoint());
+ }
+ };
+ Thread thread2 = new Thread(handleNetconfEvent2);
+ thread2.start();
+ break;
+ default:
+ LOG.debug("modification of type {} not managed yet", edit.getTarget().getTargetType());
+ break;
+ }
+ }