[NETCONF-497] Json restconf responses does not prepend module name at top level Created: 16/Jan/18  Updated: 16/Jan/19  Resolved: 16/Jan/19

Status: Resolved
Project: netconf
Component/s: restconf-nb
Affects Version/s: Fluorine, Neon, Fluorine SR1
Fix Version/s: Neon, Fluorine SR2

Type: Bug Priority: Medium
Reporter: Vratko Polak Assignee: Tomas Cere
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

manual testing


Issue Links:
Relates
relates to NETCONF-592 Restconf json rpc responses do not co... Resolved

 Description   

RFC 8040 refers [0] to RFC 7951 which states:
  "A namespace-qualified member name MUST be used for all members of a top-level JSON object"

Note that ODL already requires the module name in input (PUT, POST, input part of RPC) but this bug is about ODL not prefixing the module name in output (GET, output part of RPC). But examples in RFCs clearly show the MUST also applies on output.

To reproduce (on Nitrogen snapshot), start ODL, install odl-restconf and odl-netconf-topology, then:

Current:

$ curl -u admin:admin http://127.0.0.1:8181/restconf/config/network-topology:network-topology ;echo
  {"network-topology":{"topology":[{"topology-id":"topology-netconf"}]}}
$ curl -u admin:admin http://127.0.0.1:8181/restconf/operational/network-topology:network-topology/topology/topology-netconf ;echo
  {"topology":[{"topology-id":"topology-netconf"}]}

Expected:

$ curl -u admin:admin http://127.0.0.1:8181/restconf/config/network-topology:network-topology ;echo
  {"network-topology:network-topology":{"topology":[{"topology-id":"topology-netconf"}]}}
$ curl -u admin:admin http://127.0.0.1:8181/restconf/operational/network-topology:network-topology/topology/topology-netconf ;echo
  {"network-topology:topology":[{"topology-id":"topology-netconf"}]}

The same behavior is present both on draft02 and draft18 (URLs are different) and on Oxygen snapshots.

This seems to be an old bug, as Draft 02 [1] examples also do contain the prefix, but even old ODL test data [2] do not expect the prefix.
It is too late to change draft02 behavior as many tests are expecting that, but draft18 (and odl-restconf-nb-rfc8040 in Oxygen) should be fixed before users start to rely on this non-standard behavior.
It is possible that some users would prefer shorter responses, but the standard behavior should be the default.

[0] https://tools.ietf.org/html/rfc8040#section-11.3.2
[1] https://tools.ietf.org/html/draft-bierman-netconf-restconf-02
[2] https://github.com/opendaylight/integration-test/blob/release/lithium/test/csit/variables/bgpuser/empty.json



 Comments   
Comment by OpenDaylight Release [ 03/May/18 ]

Since the bug is unassigned I'm currently assigning it to you.

Please assign to the relevant person. 

Comment by Robert Varga [ 28/Aug/18 ]

JakubToth any update on this?

Comment by Attila Flach [ 03/Jan/19 ]

JakubToth, rovarga - I am also interested to know the progress on this, it is clearly a problem that ODL does not compy with RFC7951.

Are there any commits available to be tested?

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