Subject: [Netconf] subtree filter for list within a list (with no key specified for the 1st list)

From: "Sterne, Jason (Nokia - CA/Ottawa)" <[email-masked]>
Date: Thu, 1 Jun 2017 23:14:23 +0000

Hi all,

I'm uncertain about how to interpret a few statements in RFC6241 about subtree filtering (especially statements about nested elements and list content).

If I have this model:
------------------------

list first {
    key "k1";
    leaf k1 { type uint8; }
    list second {
        key "k2"
        leaf k2 { type string; }
        leaf color { type string; }
    }
}

and this instance data in the server:
------------------------------------

<first>
   <k1>55</k1>
   <second>
        <k2>test1</k2>
        <color>red</color>
   </second>
   <second>
        <k2>test2</k2>
        <color>blue</color>
   </second>
</first>
<first>
   <k1>88</k1>
   <second>
        <k2>test1</k2>
        <color>yellow</color>
   </second>
   <second>
        <k2>test3</k2>
        <color>green</color>
   </second>
</first>

will this subtree filter:
-------------------------------

<filter type="subtree">
    <first>
        <second>
            <k2>test1</k2>
        </second>
    </first>
</filter>

return the following data ?
-----------------------------
<first>
   <k1>55</k1>
   <second>
        <k2>test1</k2>
        <color>red</color>
   </second>
</first>
<first>
   <k1>88</k1>
   <second>
        <k2>test1</k2>
        <color>yellow</color>
   </second>
</first>

(i.e. is a {*, value} match for keys of nested lists supported with subtree filtering ?)

I assume I could extend this further and have any combination of 'wildcards' and specific values for keys across N embedded lists ?  i.e. {*, value, *, value, etc}

In xpath this would be /first/second[k2='test1']   (no predicate for k1)

Rgds,
Jason

---

From: "Xiang Li" <[email-masked]>
Date: Mon, 5 Jun 2017 12:03:36 -0500

Hi 

I think with your filter string, the response might also be:

<first>
   <second>
        <k2>test1</k2>
        <color>red</color>
   </second>
</first>
<first>
   <second>
        <k2>test1</k2>
        <color>yellow</color>
   </second>
</first>

That is, an implementation might choose to exclude 'k1' in the response
because the existence of the sibling "second" in the subtree filter.

I think if you want to make sure 'k1'(outer list's key)  be included in the
response, the filter would have been:

<filter type="subtree">
    <first>
        <k1> 
        <second>
            <k2>test1</k2>
        </second>
    </first>
</filter>

-Xiang

From: Netconf [mailto:[email-masked]] On Behalf Of Sterne, Jason
(Nokia - CA/Ottawa)
Sent: Thursday, June 1, 2017 6:14 PM
To: Netconf <[email-masked]>
Subject: [Netconf] subtree filter for list within a list (with no key
specified for the 1st list)

Hi all,

I’m uncertain about how to interpret a few statements in RFC6241 about
subtree filtering (especially statements about nested elements and list
content).

If I have this model:
------------------------

list first {
    key “k1”;
    leaf k1 { type uint8; }
    list second {
        key “k2”
        leaf k2 { type string; }

<first>
   <k1>55</k1>
   <second>
        <k2>test1</k2>
        <color>red</color>
   </second>
   <second>
        <k2>test2</k2>
        <color>blue</color>
   </second>
</first>
<first>
   <k1>88</k1>
   <second>
        <k2>test1</k2>
        <color>yellow</color>
   </second>
   <second>
        <k2>test3</k2>
        <color>green</color>
   </second>
</first>

<filter type="subtree">
    <first>
        <second>
            <k2>test1</k2>
        </second>
    </first>
</filter>

(i.e. is a {*, value} match for keys of nested lists supported with subtree
filtering ?)

I assume I could extend this further and have any combination of ‘wildcards’
and specific values for keys across N embedded lists ?  i.e. {*, value, *,
value, etc}

In xpath this would be /first/second[k2=’test1’]   (no predicate for k1)

Rgds,
Jason