ygot
ygot copied to clipboard
Diff api does generate deletes for leaf list values
I changed a leaf list value from [1, 18, 25] to [18, 25, 34]. Ygot diff api generate an update with value [18, 25, 34] and no delete. This results in the final list of [1, 18, 25, 34] which is not expected.
Hi, ygot.Diff returns a Notification value. What did you do with the Notification value that caused the final list to occur?
I used the notification list to update device config. In the notification list, there is an update for [18, 25, 34] but no delete is generated for value 1 in the leaf list
Did you use gNMI.Set with an Update
message? If so, I believe setting a leaf-list should overwrite the value instead of appending to them.
That being said, taking a look at RFC7950, NETCONF insert seems to offer more flexible operations, while the gNMI spec doesn't explicitly talk about this scenario. @robshakir Do we have a stance on what happens with leaf-lists when gNMI.Set with Update
is executed? Since we don't have an insert operation it seems like replacement must be our behaviour to keep things simple? Esp. if a non-leaf update is made containing leaf-list values. If so I'll update the spec to make this clearer.
Yes, we do not allow partial update of leaf-lists in gNMI -- we declaratively require them to be entirely specified.
In this case, can I enhance the ygot diff api to return a replace gnmipb.Update slice along side the gnmi notification to be used together for the gnmi set request?
Not quite sure what enhancement you had in mind. Can you just call Set.Replace now instead of Set.Update? It seems like the device is not conforming to the right spec (I will make a PR to update the spec soon), and since Diff only returns leaves it seems like a safe thing to do.