-
Notifications
You must be signed in to change notification settings - Fork 73
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
Statements given in "load set" are order dependent #287
Comments
Side-note, I assume the yang has been patched as follows:
|
Yes, it has. |
This is problematic.
First, see openconfig-network-instance.yang:
Note that "fdb" is before "config" in the network-instances container. Clixon uses the order they are stated in YANG. Therefore, if the statements are given one-by-one as in the issue, the "when" statements will be evaluated before the config statements have been given and therefore fail. Therefore, a clixon workaround is to switch the order of config and fdb in the spec. The RFC is vague, the closest seem to be in 7.5.7:
which means clixon could use another order when encoding to xml, ie config before fdb. This may be very difficult in the general case, but could be done for very specific use-cases, such as this one (eg place statements with "when" statements last) Second,
So removing the check at edit-config time and only evaluate "when" conditions at validate time would violate the RFC. I find this requirement somewhat strange though, maybe one should deviate from the RFC in this respect. Another way would be to not dump single cli statements, ie group them all together in the same edit-config, so that the "config" and "fdb" are in the same edit-config. However this is not the way the generated CLI currently works, since each "CR" generates an edit-config message to the server. I dont know how to change that in an easy way. Concluding, I see the following solutions/workarounds:
|
* Some openconfig specs seem to have use/when before a "config" which it depends on. This leads to XML encoding being in the "wrong order. * When parsing, clixon now sorts container/list statements so that sub-statements with WHEN are put last. * See [Statements given in "load set" are order dependent](#287) * Fixed: [Statements given in "load set" are order dependent](#287)
Made a change to encoding order by putting sub-elements with "WHEN" conditions last, ie following proposal (2) above. |
Given the openconfig schema and a file comprised of the following set statements:
I receive an error response:
However, if I move the first statement to the end, I receive no error.
Additionally,
load set
can take quite some time with even small files. It would seem to me that theload_set_file
method is simply iterating the lines within the file and processing them like individual set commands given at the CLI, such that each set statement is an individualedit-config
operation complete with backend validation.Ideally, the contents would be processed as a single unit, perhaps mutating some in-memory copy of the candidate, and at validation time, only a single syntactic and semantic validation is performed.
The text was updated successfully, but these errors were encountered: