-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
lib: mgmtd: add xpath arg to YANG notification message #15381
Conversation
- call the new notification hooks when backends call the old notification posting API. Signed-off-by: Christian Hopps <[email protected]>
f030397
to
5eef322
Compare
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.
I left a couple of non-blocking comments.
|
||
if (!found) { | ||
zlog_err("Notification not found in the parsed tree"); | ||
if (set->count == 0) { |
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.
Should it be set->count != 1
instead? We don't expect more than one notification, at least until we start supporting notifications for datastore updates.
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.
I gave thought to this code when picking == 0
. I chose to follow Postel's Law here. The code I'm replacing just returned the first found notification (whether that was the correct one or not). Here I'm doing better and returning what matches the actual xpath. If for some reasons we get back multiple matches (we shoulnd't) we don't break and still do something that is functionally correct.
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.
Right, ok.
lib/mgmt_msg_native.h
Outdated
@@ -77,6 +77,11 @@ extern "C" { | |||
* mgmt_msg_native_get_msg_len() - Get the total length of the msg. | |||
* mgmt_msg_native_send_msg() - Send the message. | |||
* | |||
* mgmt_msg_native_xpath_data_encode() - Encode xpath in xpath, data format message. |
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.
There's no such function and it mentioned in several places in this header.
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.
Sigh.. yes, I did a search replace, odd that it missed some.
lib/mgmt_be_client.c
Outdated
notif = mgmt_msg_native_xpath_decode(notif_msg, msg_len); | ||
data = mgmt_msg_native_data_decode(notif_msg, msg_len); |
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.
Probably better to use mgmt_msg_native_xpath_data_decode
here? In addition to less code, this would be the first place where this function is used, which will improve code coverage when testing.
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.
ok
Signed-off-by: Christian Hopps <[email protected]>
5eef322
to
4a93d17
Compare
@Mergifyio backport stable/10.0 |
❌ No backport have been created
GitHub error: |
@Mergifyio backport dev/10.0 |
✅ Backports have been created
|
lib: mgmtd: add xpath arg to YANG notification message (backport #15381)
@mergify backport dev/10.0 |
✅ Backports have been created
|
No description provided.