Subject: Re: [netconf] [netmod] Question on Subtree Filtering Usage Example

From: Qin Wu <[email-masked]>
Date: Tue, 10 Aug 2021 14:17:34 +0000

Here is the instance example:
   YANG Example:
    container users {
	 presence "presence container users";
     list user {
       key "name";
       leaf name {
         type string;
       }
	   leaf type {
         type string;
       }
	   leaf full-name {
	     type string
	   }
     }
	}
	Note that users is presence container.
	In the RPC request, we want to request All <name> Elements together all <type> elements within the <users> Subtree
    the subtree filter example is as follows:
      <rpc message-id="101"
           xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
       <get-config>
         <source>
           <running/>
         </source>
         <filter type="subtree">
           <top xmlns="http://example.com/schema/1.2/config">
             <users selectable=true>
               <user>
                  <name/>
                  <type/>
                </user>
             </users>
            </top>
          </filter>
        </get-config>
      </rpc>
	It seems that section 6.2.5 of RFC6241
	   o  Multiple content match nodes (i.e., sibling nodes) are logically
      combined in an "AND" expression.
	 applies to this case.
   If both <name> and <leaf> are not configured, or there are no entry under <user> list.
   we will get the following response even though presence container <users> are defined in the yang file.
        <rpc-reply message-id="101"
           xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
        <data/>
  </rpc-reply>
Rather than
        <rpc-reply message-id="101"
           xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
        <data>
          <users/>
        </data>
  </rpc-reply>
 I think the server doesn't check whether <users> is presence container or not, becos
 the subtree filter is applied to xml file above unless there is some way in the subtree filter to indicate that users should be returned irrespective of whether child node under <users> has value.

-Qin
-----邮件原件-----
发件人: Jürgen Schönwälder [mailto:[email-masked]] 
发送时间: 2021年8月10日 16:57
收件人: Qin Wu <[email-masked]>
抄送: maqiufang (A) <[email-masked]>; [email-masked]
主题: Re: [netmod] [netconf] Question on Subtree Filtering Usage Example

Perhaps you can write down an instance tree to help us understand your question. I assume your question is whether a server has to prune empty fragments of the tree. I do not think that this is suggested by section 6.2.5., i.e., you might get <users><user/></users> if nothing is matching.

/js

On Tue, Aug 10, 2021 at 07:54:34AM +0000, Qin Wu wrote:
> What if <name>and<type> not configured under <users>?
> My understanding is subtree filter will not care about "users" parent 
> element is the container with presence substatement Since subtree filter is applicable to xml file rather than YANG file.
> 
> I am not sure how the server parses subtree filter? It looks weird to look up YANG filter for scheme first and then apply subtree filter to the xml file corresponding to yang file.
> Therefore if both <name>and<type> are not configured, the response I expect is return null irrespective of presence container "users".
> 
> -Qin
> -----邮件原件-----
> 发件人: netmod [mailto:[email-masked]] 代表 maqiufang (A)
> 发送时间: 2021年8月6日 19:12
> 收件人: Juergen Schoenwaelder <[email-masked]>
> 抄送: [email-masked]; [email-masked]
> 主题: Re: [netmod] [netconf] Question on Subtree Filtering Usage Example
> 
> Hi,
> Thanks for your reply. Cross posting to NETCONF list.
> 
> Best Regards,
> Qiufang Ma
> 
> -----Original Message-----
> From: Jürgen Schönwälder [mailto:[email-masked]]
> Sent: Friday, August 6, 2021 6:35 PM
> To: maqiufang (A) <[email-masked]>
> Cc: [email-masked]
> Subject: Re: [netmod] Question on Subtree Filtering Usage Example
> 
> Hi,
> 
> you may want to send your question to the netconf list since this is a 
> protocol question and not a YANG question. (Concerning your question, 
> please read section 6.2.4 "Selection Nodes". There is no restriction 
> to only one selection node as far as I can tell.)
> 
> /js
> 
> On Fri, Aug 06, 2021 at 09:29:50AM +0000, maqiufang (A) wrote:
> > Hi, all:
> > 
> > In RFC6241 section 6.4(https://datatracker.ietf.org/doc/html/rfc6241#section-6.4), several single subtree filtering examples are given.
> > I am wondering whether we can select multiple elements within the <users> Subtree.
> > Note that we also assume "users" parent element is the container with presence substatement.
> > Here is the RPC request message with specific subtree filtering :
> >      <rpc message-id="101"
> >           xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
> >        <get-config>
> >          <source>
> >            <running/>
> >          </source>
> >          <filter type="subtree">
> >            <top xmlns="http://example.com/schema/1.2/config">
> >              <users>
> >                <user>
> >                     <name/>
> >                      <type/>
> >                </user>
> >              </users>
> >            </top>
> >          </filter>
> >        </get-config>
> >      </rpc>
> > 
> > I am wondering what RPC response will look like? It will respond with null or it will respond as follows:
> >      <rpc-reply message-id="101"
> >           xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
> >        <data>
> >          <top xmlns="http://example.com/schema/1.2/config">
> >            <users>
> >              <user>
> >                <name>root</name>
> >                <type>superuser</type>
> >              </user>
> >              <user>
> >                <name>fred</name>
> >                <type>admin</type>
> >              </user>
> >           </users>
> >        </top>
> >    </data>
> > </rpc-reply>
> > 
> > 
> > 
> > Best Regards,
> > Qiufang Ma
> 
> > _______________________________________________
> > netmod mailing list
> > [email-masked]
> > https://www.ietf.org/mailman/listinfo/netmod
> 
> 
> -- 
> Juergen Schoenwaelder           Jacobs University Bremen gGmbH
> Phone: +49 421 200 3587         Campus Ring 1 | 28759 Bremen | Germany
> Fax:   +49 421 200 3103         <https://www.jacobs-university.de/>
> _______________________________________________
> netmod mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/netmod

-- 
Juergen Schoenwaelder           Jacobs University Bremen gGmbH
Phone: +49 421 200 3587         Campus Ring 1 | 28759 Bremen | Germany
Fax:   +49 421 200 3103         <https://www.jacobs-university.de/>

---

From: Jürgen Schönwälder <[email-masked]>
Date: Wed, 11 Aug 2021 09:16:12 +0200

Thanks, I now understand your question. Since NETCONF predates YANG
(and in principle is not bound to YANG), the handling of presence
containers is likely not well specified.

/js