Subject: [Netconf] restconf example bug

From: Martin Bjorklund <[email-masked]>
Date: Fri, 09 Sep 2016 11:37:32 +0200 (CEST)

Hi,

It was pointed out to me that there's a small bug in the example in
D.3.5.  Since the request creates a new resource, it should return a
201 Created, not 204.

But there's actually a bigger problem with this example - it shows
how to use the 'point' query parameter to insert a new entry into an
ordered-by user list, but the list in the example is not ordered-by
user!

So I suggest to change the example so that is adds to the example in
D.3.4.  BUT, there's another problem with that one.  The "id" leaf is
a leafref in the data model, but in the examples it is a left over
from an early draft where it was a resource idenfifier.  In order to
fix this, I suggest the leaf type is changed to instance-identifier,
and that the "id" leaf is changed accordingly.

OLD (Section C.1):

            leaf id {
              type leafref {
                path "/jbox:jukebox/jbox:library/jbox:artist/" +
                     "jbox:album/jbox:song/jbox:name";
              }
              mandatory true;
              description
                "Song identifier. Must identify an instance of
                 /jukebox/library/artist/album/song/name.";
            }

NEW:

            leaf id {
              type instance-identifier;
              mandatory true;
              description
                "Song identifier. Must identify an instance of
                 /jukebox/library/artist/album/song/name.";
            }

Also change the YANG tree to reflect this.

OLD (Section D.3.4):

             "id" : "/example-jukebox:jukebox/library/\
                artist=Foo%20Fighters/album=Wasting%20Light/song=Rope"

NEW:

             "id" : "/example-jukebox:jukebox/library\
                /artist[name='Foo Figthers']\
                /album[name='Wasting Light']\
                /song[name=Rope']"

Replace Section D.3.5 with:

   In this example, the client is inserting a new song entry in the
   "Foo-One" playlist after the first song.

   Request from client:

      POST /restconf/data/example-jukebox:jukebox/\
          playlist=Foo-One?insert=after&point=\
          %2Fexample-jukebox%3Ajukebox\
          %2Fplaylist%3DFoo-One%2Fsong%3D1 HTTP/1.1
      Host: example.com
      Content-Type: application/yang-data+json

      {
        "example-jukebox:song" : [
           {
             "index" : 2,
             "id" : "/example-jukebox:jukebox/library\
                /artist[name='Foo Figthers']\
                /album[name='Wasting Light']\
                /song[name=Bridge Burning']"
           }
         ]
      }

   Response from server.

      HTTP/1.1 201 Created
      Date: Mon, 23 Apr 2016 13:01:20 GMT
      Server: example-server
      Last-Modified: Mon, 23 Apr 2016 13:01:20 GMT
      Location: https://example.com/restconf/data/\
          example-jukebox:jukebox/playlist=Foo-One/song=2
      ETag: "abcada438af"

Also change the example in D.3.2 to match these new ids.

Unless there are objections, I'll make these changes.

/martin