Re: [Netconf] about subtree filtering
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Netconf] about subtree filtering



WashamFan <Washam.Fan at huaweisymantec.com> wrote:
> Well, the data model might like this:
> 
>    container users {
>      list user {
>        container basic {
>           leaf name { ...}
>           leaf type {...}
>           leaf full-name { ... }
>        }
>        leaf role { ... }
>      }
>    }
> 
> So, the filter
> 
>    <users>
>       <user>
>         <basic>
>            <name>fred</name>
>            <type/>
>            <full-name/>
>         </basic>
>         <role/>
>       </user>
>     </users>
> 
> will help return what I want?

Assuming this is config, the data model is not quite correct - the
list lacks a key.  So if we do:

    container users {
      list user {
        key name;
        leaf name { ...}
        container basic {
           leaf type {...}
           leaf full-name { ... }
        }
        leaf role { ... }
      }
    }

Then the filter:

    <users>
       <user>
         <name>fred</name>
         <basic>
            <type/>
            <full-name/>
         </basic>
         <role/>
       </user>
     </users>

will return the type, full-name, and role of "fred", if they exist,
which is what you want.

However, the filter:

    <users>
       <user>
         <basic>
            <type/>
            <full-name>Fred Flintstone</full-name>
         </basic>
         <role/>
       </user>
     </users>

will return the role of *all* users, and the type of Fred.


/martin

Note: Messages sent to this list are the opinions of the senders and do not imply endorsement by the IETF.