[NETCONF-80] RPC POST to yang-ext:mount doesn't support XML Attributes Created: 08/Oct/15  Updated: 04/Nov/21

Status: Confirmed
Project: netconf
Component/s: restconf-nb
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: James Gregory Hall Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


External issue ID: 4440

 Description   

Context:

I'm using the controller's ability to mount netconf devices to make it easy to script RESTCONF clients to access such devices's configuration. So I'd like to pass RPC get-config requests through RESTCONF yang-ext:mount which will only work if they include XML attributes and/or the json equivalent as per the NETCONF spec.

JSON Example:

1. Mount a netconf device, any will do
2. POST to http://localhost:8181/restconf/config/opendaylight-inventory:nodes/node/1-netconf-device/yang-ext:mount/ietf-netconf:get-config

with payload:

{
"ietf-netconf:input": {
"source":

{ "running": [null] }

,
"filter": {
},
"@filter":

{xpath,//users }

}
}

<errors
xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
<error>
<error-type>protocol</error-type>
<error-tag>malformed-message</error-tag>
<error-message>Error parsing input: Schema node with name @filter wasn't found under (urn:ietf:params:xml:ns:netconf:base:1.0?revision=2011-06-01)input.</error-message>
<error-info>java.lang.IllegalStateException: Schema node with name @filter wasn't found under (urn:ietf:params:xml:ns:netconf:base:1.0?revision=2011-06-01)input.
at org.opendaylight.yangtools.yang.data.codec.gson.JsonParserStream.resolveNamespace(JsonParserStream.java:253)
at org.opendaylight.yangtools.yang.data.codec.gson.JsonParserStream.read(JsonParserStream.java:154)
.
.
.

XML Example:

1. Mount a netconf device, any will do
2. POST to http://localhost:8181/restconf/config/opendaylight-inventory:nodes/node/1-netconf-device/yang-ext:mount/ietf-netconf:get-config

With payload:

<input xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<source>
<running/>
</source>
<filter type="xpath" select="//users"/>
</input>

This will strip the attributes and return the entire configuration instead of the filtered config.



 Comments   
Comment by James Gregory Hall [ 08/Oct/15 ]

Having read a similar NETCONF-52 there is a response:

"When editing configuration on a mounted Netconf device over Restconf, ODL hides the edit+commit rpcs to make Restconf behave as expected (you alse cannot choose which datastore to edit). And I dont think we should change that."

I belive it's clear that yang-ext:mount RPC's which use XML Attributes can't work without passing through the attributes.

Comment by Tony Tkacik [ 12/Oct/15 ]

{
"ietf-netconf:input": {
"source":

{ "running": [null] }

,
"filter": {
},
"@filter":

{xpath,//users }

}
}

Where (which draft) is @filter type of attributes specified?
Could you please provide pointer?

Comment by James Gregory Hall [ 15/Oct/15 ]

Apparently there is no "standard" for converting xml -> json. So we can put that issue aside temporarily ... if we accept that NETCONF RPC's can't be made through RESTCONF with json, you must use xml.

So lets focus on the issue of XML attributes & RESTCONF yang-ext:mount RPCs.

Comment by Robert Varga [ 04/Nov/21 ]

So the attributes/JSON gap is bridged via annotations on anyxml. The syntax is going to be slightly different, but that's not of import.

So when a device advertises the :xpath capability, we need to play pretend there is an RFC6241bis, which defines RFC7952 annotations to carry filter attributes, as per section 8.9.5.1:

         <!-- get the user named fred -->
         <filter xmlns:t="http://example.com/schema/1.2/config"
                 type="xpath"
                 select="/t:top/t:users/t:user[t:name='fred']"/>

When we bind to such a context, we will recognize the attributes on input and be able to translate them back and forth.

Alternatively, we can get this working by completely passing the request document to the NETCONF device without alteration. That should become possible once we have NETCONF-718 and its follow-ups done.

Generated at Wed Feb 07 20:14:07 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.