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

Problems with diff of YANG lists ordered-by user #496

Closed
olofhagsand opened this issue Feb 21, 2024 · 0 comments
Closed

Problems with diff of YANG lists ordered-by user #496

olofhagsand opened this issue Feb 21, 2024 · 0 comments

Comments

@olofhagsand
Copy link
Member

This issue may be specific to the clixon controller where the synch of multiple datastores is made, but may also appear in other circumstances, such as a local ACL list.

Consider a YANG ordered-by user list, eg:

list xlist {
  key x;
  leaf x { type string; }
  ordered-by user;
}

The problem occurs if you do iterative changes to this list, eg:

  1. add <x>2</x>
  2. add <x>1</x>

Suppose in the second case that you enter <x>1</x> first in the list, either using "insert before" or by rewriting the whole list, resulting in a candidate datastore:

<x>1</x>
<x>2</x>

Then the clixon diff algorithm (show diff) will show:

+ <x>1</x>

A backend may then send this new entry to a target (eg device driver/ remote device or some other system) to add/append to the list of existing entries, resulting in a list:

<x>2</x>
<x>1</x>  <--- New entry

But there has also been a reorder, what actually happened is that the entry was not only added but also inserted before the existing entry.
Therefore, a correct action of the diff algorithm would be to detect out-of-order elements. Or to replace the whole list with the new element order.

A sub-part of this problem was fixed in:
#475

olofhagsand added a commit to clicon/clixon-controller that referenced this issue Feb 23, 2024
olofhagsand added a commit to clicon/clixon-controller that referenced this issue Feb 25, 2024
Follow-up: [Problems with diff of YANG lists ordered-by user](clicon/clixon#496)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants