-
Notifications
You must be signed in to change notification settings - Fork 21
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
subscription: return parent node to oper_state callback #45
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Adrián,
thanks for your patch. I am not comfortable with breaking the API. Would it be possible to change the xpath argument to convey some information about the actual list item that is being refered?
In the linked issue sysrepo/sysrepo#1786 it mentions that it is possible to call lyd_path(*parent)
to get the actual requested node.
What do you think?
fd65512
to
f6de384
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #45 +/- ##
==========================================
- Coverage 66.93% 66.54% -0.40%
==========================================
Files 8 8
Lines 1113 1064 -49
==========================================
- Hits 745 708 -37
+ Misses 368 356 -12 ☔ View full report in Codecov by Sentry. |
Hi sorry for the very long delay. I had a second look and I am still not comfortable with breaking this API. I had an idea: we could add a What do you think? |
Hi! I had already forgotten about this issue 😅. I think that it would be enough to distinguish between different leafs in a list, yes. Another thing I mentioned in my initial comment is that the |
587f88c
to
0df4d2e
Compare
Hi! I have added requested changes, now the |
0df4d2e
to
19fa87b
Compare
The only way to differentiate two calls when there is a subscription on an internal element of a list is by using the parent node. Moreover, in these cases, it is on this parent node that the data structure to be returned must be built. Signed-off-by: Adrián Vázquez <[email protected]>
19fa87b
to
362f5b2
Compare
Hi @rjarry, any new comments on this? I'm not sure why the GitHub workflows are failing, but it seems more like a setup thing. |
We have a Sysrepo plugin that is subscribed as operational data provider to
/ietf-hardware:hardware/component/software
leaf, which generates a call for eachcomponent
when/ietf-hardware:hardware
node is requested (as expected). The problem is that with the parameters currently available inOperDataCallbackType
(xpath
,private_data
), it is not possible to distinguish between components. Similar problem withinterfaces-state
module is described here.The solution proposed in that issue consists of using the parent node that is returned, since in this case the state must also be built on this parent node. This parent node has the path with the key we need, so we can distinguish between components.
This pull request adds the parent node as parameter exposed in operational state request callback.