Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace (PUT) Operation on parent container doesn't clear child object's instance which are not provided in request (common app) #149

Open
Verma-Anukul opened this issue Oct 2, 2024 · 1 comment

Comments

@Verma-Anukul
Copy link

We are using common app and transformer approach to implement translib support for a openconfig module.
For replace operation we are seeing an issue.

Consider following test objects

container A {
container B {
list C {
key id;
leaf id {
type uint;
}
}
}
}

Current DB content

A/B/C/1
A/B/C/2

Two instance of object C exists in DB.

Request Payload for PUT operations

url = /A/B
url_body = { B { C [{ 1, {}}, {3, {}}] }

So, We are trying to replace object /A/B with two instances of C (1 & 3)

Expectation

As requested payload as only instance 1 & 3
And DB has instance 1 & 2

So, framework should delete instance 2, keep instance 1 as it is and Create instance 3.

Current Behaviour

Instance 1 is kept as it is (Expected)
Instance 3 is Created. (Expected)
Instance 2 is not deleted (Not expected)

Observation

From the processReplace code, looks like currently only dbMapCreate is handled for Replace operation, IMO dbMapDelete should also be handled here

@kwangsuk
Copy link
Contributor

kwangsuk commented Oct 3, 2024

@Verma-Anukul
We're planning to upstream the enhancement to the 2025 May release.
The enhancement will include 1) data replacement using PUT, 2) delete over data tree traversal.
For now, you can implement the post-transformer callback to delete descendant instances.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants