-
Notifications
You must be signed in to change notification settings - Fork 8
fix issue #363 mismatch xml values while deleting multiple key config #364
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
base: main
Are you sure you want to change the base?
Conversation
|
@steiler @alexandernorth I seem to remember vaguely we had some constraints around sorting? The ordering of keys could be defined by the YANG schema right? |
|
@steiler @alexandernorth @hansthienpondt I added a sort in the getSchemaKey method to fix the issue, thinking all the keys should be ordered in all cases. The other possible fix is to sort the keys only after the call of getSchemaKey when needed. Would you rather consider this alternative ? |
Exactly, we intend to use the order of the keys as defined in the schema as it is not necessarily alphabetical and it affects how the paths are constructed/parsed meaning sorting them would cause other issues.
Sorry I have not yet had a chance to analyse the issue fully yet - I will be working on that next and then I can see what caused this behaviour to happen - I hope to have time tomorrow and will assess and report back here |
|
My current theory is that in the XML generation we are sorting the keys when we should not be, causing the values to not match the key in the generated xml - this is what I will investigate first |
|
I will have to continue looking into this next week - appologies for that. |
|
I have been able to find the source of the issue: In the in-memory tree, the keys are sorted alphabetically, and not by the order defined in the schema. There is code in the function Sorry for the delay in the response |
|
Many thanks for your reviews ! I'll change the fix according to your analyses once @steiler is good with it. No worry about the delay, we can work with my current fix in the meantime. |
The xml produced while deleting a config including a multiple key item may display mismatched values, leading to errors from the targeted netconf device. Sorting the keys in the getSchemaKey method of the sharedEntryAttribute fix this issue.
The xml_test.go file is updated with a test case to describe the issue and test the fix (though the fix is not in xml.go file).