Subject: [Netconf] Query regarding "list" subelement XML Mapping rule

From: Rohit pobbathi <[email-masked]>
Date: Tue, 1 Mar 2016 10:00:38 +0000

Hi,

I have a query regarding "list" subelement XML Mapping rules - RFC 6020 Section 7.8.5.

For clarity, I am using the "example-jukebox" YANG model (from RESTCONF draft).
   +--rw jukebox!
      +--rw library
      |  +--rw artist* [name]
      |  |  +--rw name     string
      |  |  +--rw album* [name]
      |  |     +--rw name     string
      |  |     +--rw genre?   identityref
      |  |     +--rw year?    uint16
      |  |     +--rw admin
      |  |     |  +--rw label?              string
      |  |     |  +--rw catalogue-number?   string
      |  |     +--rw song* [name]
      |  |        +--rw name        string
      |  |        +--rw location    string
      |  |        +--rw format?     string
      |  |        +--rw length?     uint32
      |  +--ro artist-count?   uint32
      |  +--ro album-count?    uint32
      |  +--ro song-count?     uint32

Request from Client to Server:
     <rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
       <get>
         <filter type="subtree">
           <jukebox xmlns="http://example.com/ns/example-jukebox">
             <library>
               <artist>
                 <name>Foo Fighters</name>
                 <album>
                   <name>Wasting Light</name>
                   <song/>               ======> Request selection node order
                   <year/>
                   <genre>
                 </album>
               </artist>
             </library>
           </jukebox>
         </filter>
       </get>
     </rpc>

The selection nodes in above request are not in the same order as defined in the YANG model for "jukebox" module's "album" list.

I assume this is allowed as per the RFC 6020 section 7.8.5's below paragraph:
   The rest of the list's child nodes are encoded as subelements to the
   list element, after the keys.  If the list defines RPC input or
   output parameters, the subelements are encoded in the same order as
   they are defined within the "list" statement.  Otherwise, the
   subelements are encoded in any order.

Please confirm if the above <get> request's selection nodes order is valid ?

Response from Server to Client:
     <rpc-reply message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
       <data>
         <jukebox xmlns:t="http://example.com/ns/example-jukebox">
           <library>
             <artist>
               <name>Foo Fighters</name>
               <album>
                 <name>Wasting Light</name>
                 <genre>example-jukebox:alternative</genre>
                 <year>2011</year>
                 <song>
                   <name>Wasting Light</name>
                   <format>MP3</format>
                   <length>286</length>
                 </song>
                 <song>
                   <name>Rope</name>
                   <format>MP3</format>
                   <length>259</length>
                 </song>
               </album>
             </artist>
           </library>
         </jukebox>
       </data>
     </rpc-reply>

For the above request, is it fine for the Server to encode the response with list subelement order as per the defined YANG model ?
OR
Should the response follow the REQUEST's list subelement order ?

Regards,
Rohit P