-
Notifications
You must be signed in to change notification settings - Fork 21
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
Let validate() treat RpcActionNode 'input' like 'config' and 'output' like 'nonconfig' #142
Comments
Perhaps you can validate it against the |
@kwatsen, on a more general note: I did some tests and I think that working with RPC payloads (and possibly notifications) is awkward in Yangson. It make little sense to me to validate RPCs together with config and state data, but actually also input and output data of the same RPC together. So what seems to be necessary is to treat the data model not as a single schema but as multiple schemas like this:
So the I have two questions for you:
|
Hi Lada, thank you for looking into this more. To answer your first question, I looked into using FWIW, below is a snippet of code that calls the aforementioned
|
Regarding the questions in your second response, here are my thoughts:
|
Ad 1. XPath context is actually more of an issue for instance data – if you want to validate RPC input/output payload containing XPath references to config or state data, then you also have to supply the main data tree somehow. It is OK e.g. for a RESTCONF server but not so much for offline validation, which is probably what you are doing now. I am not sure what typical use cases for RPC payload validation might be. Ad 2. Several encapsulation formats are possible, starting from
and a few other options:
Which one do you prefer? |
Ad 1. Actually, I am writing a RESTCONF server. That said, Yangson should be mindful of the needs of clients too. I understand the need for instance data, but my comment was more regarding Yangson being able to validate the Ad 2. Thank you for presenting the three options. My favorite is option 2. PROs:
CONs:
|
I also like option (2) best. I will now do some more testing and will try to come up with improvements that could make RPC validation easier. BTW, I found out that one of the tests for RPC (
I actually don't know what this test is good for, so I plan to remove it. |
I have a routine that attempts to convert any raw text string received from a client to a Python object:
It mostly works, but fails on RpcActionNode when the YANG defines an
output
statement containingmandatory true
leaves, because the client-input only contains theinput
child. As an example, see theconveyed-information
leaf here.If, for the purpose of validation, the
input
could be treated like "config" and theoutput
like "nonconfig", then acontent_type
parameter could be added to this routine to enable it to not throw an exception because theoutput
statement is missing...The text was updated successfully, but these errors were encountered: