-
Notifications
You must be signed in to change notification settings - Fork 106
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
Uncompressed ordered map tests in mostly ygot
package.
#872
Conversation
When comparing two GoStructs where a YANG `ordered-by user` list is involved, it is not possible using a single Notification to represent the diff such that the Notification can do the following: 1. update a gNMI cache correctly with the atomic notification. 2. unmarshal the notification to the `orig` to get back the `modified` GoStruct. This function achieves this functionality, sharing the underlying implementation with Diff, where a disclaimer has been added to the doc comment. Other helpers have been created as well to be shared with `TogNMINotifications`. Other changes: - `TogNMINotifications` has been changed to follow the same convention of putting the non-atomic Notification as the first message instead of the last. The reason is that current code MAY be using `notifs[0]` and I don't want to break that, and this also seems slightly better from a usability perspective.
* Simplified `UnmarshalSetRequest` to always unmarshal w/r to the root node. This allows atomic Notifications to be deleted correctly.
ygot
package.ygot
package.
@@ -50,3 +50,52 @@ func GetDeviceWithOrderedMap(t *testing.T) *Device { | |||
}, | |||
} | |||
} | |||
|
|||
func GetOrderedMap2(t *testing.T) *Ctestschema_OrderedLists_OrderedList_OrderedMap { |
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.
godoc
nit: i don't like "2" suffix, it's unclear what makes this func different from other func without looking at the code
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.
Thanks for the feedback, I've added a godoc. I think in this case it's ok to leave it like this rather than GetOrderedMapWeeWoo
as the readers are mostly ygot maintainers and the code is fairly easy to understand. The "2" as a indicator for a different ordered map I think is sufficient. Let me know if you have other thoughts on this.
UnmarshalSetRequest
to always unmarshal w/r to the root node. This allows atomic Notifications to be deleted correctly.