Replies: 3 comments 2 replies
-
No, you cannot do anything like this but why don't you first get the state data, append them to the config data and then you can validate them all together. |
Beta Was this translation helpful? Give feedback.
-
I do not fully understand the question; in particular, when the input data refer to an extension, you really only have two options:
But maybe your extension is loaded and activated, and perhaps your extension implementation treats As you state, it is not possible to validate config data against state data; that's a design decision in the YANG standard. What you might try to do is adding a bunch of integrity checks to your state data to reference the config data; the downside is that the data paths which are reported as failing validation will lead to your state data and not to the config. Then, when it comes to validation, the NMDA starts to matter, and the In our internal use case where we have some devices with different, say, number of ports, we've introduced YANG-level features. That way we can do, say, an |
Beta Was this translation helpful? Give feedback.
-
@michalvasko @jktjkt: Thank you both for suggestions. It turned out that my primary issue was actually something totally different. It is related to bug which was fixed in #2230 |
Beta Was this translation helpful? Give feedback.
-
Hi,
I was asked to provide some sort of solution in my project for the following use-case. Here is a minimal data model to illustrate:
Based on the above we have web form created. Depending on value of
attr1
, our system should calculate and inject possible values of suboptions based on certain business logic, which is quite complex as in reality it doesn't just depends onattr1
, but many other attributes (so changing the YANG model in some way is not really an option). Once the options are calculated, they are injected in UI to read-only field and injected into data tree usinglyd_new_term()
API. And user should then be able to fill in theselected-suboptions
, be. Having all the data available, then I should store the final JSON value like this:so far everything is ok. But now let's try to load the JSON (e.g. user would like to perform some modifications).
When I load the JSON, using
lys_parse()
API, it is ok in regular YANG, but because of the extension, I am getting error as "attr1-suboptions" was not yet added into the data tree.So my question is how can I inject "config false;" data nodes into the tree during parsing of JSON data? Is this even possible? Or libyang supports only "parsing the input data" and only then add "config false" data nodes?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions