ygot
ygot copied to clipboard
TogNMINotifications: Option to ignore unsupported fields
TogNMINotifications, returns an error of the form "unimplemented: keyless list cannot be output: ..." when the GoStruct contains a list without key/s. This is true even though the GoStruct do contain other supported forms. As the error returned is a list of errors occurred during the conversion, would it be make sense to have an option e.g., IgnoreUnsupported that will enable to have the notifications (partial) for the ones supported and receive errors for the unsupported ?
I think this could make sense as a workaround where YANG files use unsupported types.
Another solution would be to introduce an error type to distinguish these errors from other errors types. Then the user can simply ignore ygot.UnsupportedErrors. This can then be the first instance of a public error type being exported by ygot.
Having the partial notifications for the supported ones will help; since, if the API is used for the mix of data, it may not be easy to keep track of supported and unsupported content in there.
Btw, are there any sample tests/documents, showing how to encode a keyless list into gnmi notifications?
I think TogNMINotifications can encode the whole keyless list as a json/json_ietf blob instead of returning an error. Maybe GNMINotificationsConfig can include encoding and allow_aggregation flags to control this further. The openconfig style guide mandates setting the atomic extension for the parent container of keyless list. So, encoding full list as json should be okay here IMO.
Btw, are there any sample tests/documents, showing how to encode a keyless list into gnmi notifications?
Raised Clarification: keyless list handling; Looking for some clarifications on this front. @robshakir / @wenovus , any inputs ?