boolean create = false;
ReadWriteTransaction tx = broker.newReadWriteTransaction();
if (LogicalDatastoreType.OPERATIONAL == datastoreType.getDatastoreType()) {
- copyToParent(identifier, dataRemoved, create, tx);
+ if (isNodeConnected(identifier, tx)) {
+ //Do not process the remove from disconnected child node
+ copyToParent(identifier, dataRemoved, create, tx);
+ }
} else {
copyToChild(identifier, dataRemoved, create, tx);
}
});
}
+ protected boolean isNodeConnected(InstanceIdentifier<T> identifier, ReadWriteTransaction tx)
+ throws ReadFailedException {
+ return tx.read(LogicalDatastoreType.OPERATIONAL, identifier.firstIdentifierOf(Node.class))
+ .checkedGet().isPresent();
+ }
+
<T extends DataObject> boolean isDataUpdated(Optional<T> existingDataOptional, T newData) {
return !existingDataOptional.isPresent() || !Objects.equals(existingDataOptional.get(), newData);
}