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

lib: mgmtd: add xpath arg to YANG notification message #15381

Merged
merged 2 commits into from
Feb 19, 2024

Conversation

choppsv1
Copy link
Contributor

No description provided.

- call the new notification hooks when backends call the old notification
posting API.

Signed-off-by: Christian Hopps <[email protected]>
@frrbot frrbot bot added the libfrr label Feb 15, 2024
@idryzhov idryzhov self-requested a review February 15, 2024 18:50
@choppsv1 choppsv1 force-pushed the chopps/nb-notif branch 4 times, most recently from f030397 to 5eef322 Compare February 17, 2024 02:23
Copy link
Contributor

@idryzhov idryzhov left a 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) {
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, ok.

lib/yang.c Outdated Show resolved Hide resolved
@@ -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.
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Comment on lines 933 to 934
notif = mgmt_msg_native_xpath_decode(notif_msg, msg_len);
data = mgmt_msg_native_data_decode(notif_msg, msg_len);
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@idryzhov idryzhov merged commit 5332e44 into FRRouting:master Feb 19, 2024
9 checks passed
@choppsv1 choppsv1 deleted the chopps/nb-notif branch February 19, 2024 15:12
@donaldsharp
Copy link
Member

@Mergifyio backport stable/10.0

Copy link

mergify bot commented Feb 20, 2024

backport stable/10.0

❌ No backport have been created

  • Backport to branch stable/10.0 failed

GitHub error: Branch not found

@idryzhov
Copy link
Contributor

idryzhov commented Feb 20, 2024

@Mergifyio backport dev/10.0

Copy link

mergify bot commented Feb 20, 2024

backport dev/10.0

✅ Backports have been created

idryzhov added a commit that referenced this pull request Feb 20, 2024
lib: mgmtd: add xpath arg to YANG notification message (backport #15381)
@choppsv1
Copy link
Contributor Author

@mergify backport dev/10.0

Copy link

mergify bot commented Feb 20, 2024

backport dev/10.0

✅ Backports have been created

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

Successfully merging this pull request may close these issues.

3 participants