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

Submodels #68

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open

Submodels #68

wants to merge 23 commits into from

Conversation

HRogge
Copy link
Contributor

@HRogge HRogge commented Dec 1, 2020

This extension of yangson allows the user to hook multiple YANG trees together into a larger schemata without manually joining them. This make it easy to add IETF defined subtrees like "ietf-yang-library:modules-state" and process incoming requests in one yangson call.

@llhotka
Copy link
Member

llhotka commented Dec 1, 2020

Hmm, this is quite a substantial change. Can you be more specific about its purpose? Is it similar to schema mount [RFC 8528]?

@kwatsen
Copy link
Contributor

kwatsen commented Dec 1, 2020

I don’t support adding more features to Yangson until the XML-feature is solid.

I’m concerned about what XML-testing has been performed. What is needed are for XML-oriented test cases to be added to test/test_module.py, such as:

  1. convert the configuration to/from XML (add support for anydata/anyxml? - a callback function?)
  2. convert the “action” statement’s input/output to/from XML (add an ‘input’ statement?)
  3. convert the “rpc” statement’s input/output to/from XML
  4. convert the “notification” statement input to/from XML

It may be that this PR is needed in order to process the nodes from the "subtest" module, but I don't see it yet.

@HRogge
Copy link
Contributor Author

HRogge commented Dec 1, 2020

I was unaware of RFC 8528, but I think it should be the same or similar...

I am using it to multiple YANG definition files into a larger YANG specification without any need to edit them.

In my server I ususe the "[email protected]" unified model as a base... then hook in (at the "data" node) the users YANG model... than add the RPCs under the "operations" node (and so forth with "ietf-restconf-monitoring:restconf-state" and "ietf-yang-library:modules-state").

This makes it very easy to construct a representation of all Restconf nodes the server uses, which makes input and output checking very easy. No need to parse the incoming GET/PUT/POST Paths by hand to decide that I have to add the modules-state to the output, I can just add it to the instance data.

@HRogge
Copy link
Contributor Author

HRogge commented Dec 1, 2020

I don’t support adding more features to Yangson until the XML-feature is solid.

I’m concerned about what XML-testing has been performed. What is needed are for XML-oriented test cases to be added to test/test_module.py, such as:

I have a set of (machine readable) XML and JSON testcases I collected from the RFCs that I use to verify me servercode at https://github.com/fkie/ietf-restconf-testcases .

  1. convert the configuration to/from XML (add support for anydata/anyxml? - a callback function?)
    anydata/anyxml is a mess... I am not even sure how to resolve this in general.
  1. convert the “action” statement’s input/output to/from XML (add an ‘input’ statement?)
    I am already doing this with the XML code in place.
  1. convert the “rpc” statement’s input/output to/from XML
    I am already doing this with the XML code in place.
  1. convert the “notification” statement input to/from XML
    My server lacks the notification support, so I am not sure about this one.

@kwatsen
Copy link
Contributor

kwatsen commented Dec 1, 2020

It is comforting to see the testing that exists for your server. But I think that XML-oriented tests need to exist in the Yangson tree as well.

Regarding #1, yes, anydata/anyxml is a mess. It's okay for Yangson's XML-oriented tests to skip the anydata/anyxml nodes for now...at least until everything else is working. FWIW, my app does have/use anydata (e.g., ietf-restconf:errors/error-info), so this isn't something I can ignore for long.

Regarding #4, a Yangson test would just serialize/deserialise a known-good instance document - no other "processing" needs to occur, AFAICT.

@HRogge
Copy link
Contributor Author

HRogge commented Dec 2, 2020

I wonder what would be needed to use the same kind of tests with Yangson... maybe each test could have a JSON and a XML version of input output and we could test Yangson by converting between the two?

An alternative would be to build a Yangson Data instance object "by hand" (in python code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants