[YANGTOOLS-1531] Add DataTreeModification.netconfDelete() Created: 25/Jul/23  Updated: 09/Jan/24

Status: Confirmed
Project: yangtools
Component/s: data-api, data-impl
Affects Version/s: None
Fix Version/s: 14.0.0

Type: New Feature Priority: Highest
Reporter: Robert Varga Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: pt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Epic Link: MD-SAL patch

 Description   

One significant difference between DataTree and NETCONF WG semantics are delete operations. DataTreeModification has a delete() operation which is significantly different from NETCONF/RESTCONF delete operation.

The NETCONF WG model defines two operations:

  • remove, which behaves as DataTreeModification.delete() in that it ensures data is not present irrespective of whether it was present or not
  • delete, which requires data to be present for it to succeed, i.e. unlike DataTreeModification.delete() it has a precondition on the data existing

This is a rather sticky situation, as at some point we want delete() do the same thing as NETCONF delete does to keep things organized.

Update DataTreeModification with:

  • introduce remove(), which does exectly what delete() does today
  • deprecate delete() for removal, pointing to remove() as its replacement
  • netconfDelete(), which poses an existence precondition before deletion, enforced on transaction commit (or rebase that detects it early, if applicable)

The first two parts are trivial, the third is not. It requires a new LogicalOperation.DELETE_EXISTING, which has different semantics from LogicalOperation.DELETE: the operation requires that the targeted node has the same version (and, by extension, subtree version) as observed by the underlying DataTreeSnapshot.

The check for existence in DataTreeModification needs to be eager, i.e. fail immediately if the node is node present. Commit-time rebase needs to fail if the node has been removed, i.e. even when it exists but has a different version, i.e. commit validation needs to fail with a ModifiedNodeDoesNotExistException.


Generated at Wed Feb 07 20:56:25 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.