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

NETCONF-based RPC/action replies cannot be parsed #140

Open
kwatsen opened this issue Sep 25, 2024 · 2 comments
Open

NETCONF-based RPC/action replies cannot be parsed #140

kwatsen opened this issue Sep 25, 2024 · 2 comments

Comments

@kwatsen
Copy link
Contributor

kwatsen commented Sep 25, 2024

RFC 7950 says in both Section 7.14.4 and Section 7.15.2:

If output parameters are returned, they are encoded as child elements to the <rpc-reply> element <snip/>

However, consistent with RFC 8040, Section 3.6.2, the various tests in test_model.py for rpc and action responses all expect an output container to be returned:

For NETCONF, it seems that the string "output" needs to be replaced with the name of the rpc or action.

Bonus issue/effort: the tests for rpc and action requests should be doublechecked as well.

@llhotka
Copy link
Member

llhotka commented Oct 3, 2024

Hmm, so do you suggest to remove the output container from instance data? This could work for JSON but probably not for XML, if there are multiple elements in reply data.

@kwatsen
Copy link
Contributor Author

kwatsen commented Oct 4, 2024

That is one option but, as you say, the XML would have an issue, unless we use a fake container like this one in list-pagination-rc.

My preferred option is to think about how to fix the problem in NETCONF (i.e., NETCONF-next). My recommendation would be to make the NETCONF-response be the same as the RESTCONF response. That is, have an output element under the rpc-reply element.

Looking at RFC 7950 for examples, I find that the rpc response example is unhelpful for this illustration. Thankfully, the action response example has output, and the same output is used for the rpc-response and action-response. This is the relevant part:

CURRENT:

     <rpc-reply message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
       <reset-finished-at xmlns="urn:example:server-farm">2014-07-29T13:42:12Z</reset-finished-at>
     </rpc-reply>

I proposal changing this to:

NEW:

     <rpc-reply message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
       <output xmlns="urn:example:server-farm">
           <reset-finished-at>2014-07-29T13:42:12Z</reset-finished-at>
       </output>
     </rpc-reply>

Note that the xmlns is moved to the output element.

If we can agree that this is a good/proper update for NETCONF-next, then we can discuss options for Yangson.

Some options:

  • document that the calling code is responsible for converting the XML to have the output container, before calling from_xml()
  • provide a "convenience" API to convert the XML to have the output container, before calling from_xml()
  • add a parameter to the from_xml method to convert the XML to have the output container.

Thoughts?

@kwatsen kwatsen changed the title Yangson expects malformed RPC/action-replies NETCONF-based RPC/action replies cannot be parsed Oct 5, 2024
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

No branches or pull requests

2 participants