Uploaded image for project: 'netconf'
  1. netconf
  2. NETCONF-497

Json restconf responses does not prepend module name at top level

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Medium Medium
    • Neon, Fluorine SR2
    • Fluorine, Neon, Fluorine SR1
    • restconf-nb
    • None
    • manual testing

      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

            tcere Tomas Cere
            vrpolak Vratko Polak
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: