Re: [Netconf] Clarification about su tree filtering

Martin Bjorklund <mbj@tail-f.com> Mon, 28 May 2018 13:37 UTC

Return-Path: <mbj@tail-f.com>
X-Original-To: netconf@ietfa.amsl.com
Delivered-To: netconf@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id E54F6126BF3 for <netconf@ietfa.amsl.com>; Mon, 28 May 2018 06:37:52 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.901
X-Spam-Level:
X-Spam-Status: No, score=-1.901 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MDQfs_n0464y for <netconf@ietfa.amsl.com>; Mon, 28 May 2018 06:37:50 -0700 (PDT)
Received: from mail.tail-f.com (mail.tail-f.com [46.21.102.45]) by ietfa.amsl.com (Postfix) with ESMTP id A3CF4120227 for <netconf@ietf.org>; Mon, 28 May 2018 06:37:50 -0700 (PDT)
Received: from localhost (h-80-27.A165.priv.bahnhof.se [212.85.80.27]) by mail.tail-f.com (Postfix) with ESMTPSA id AB5861AE0455; Mon, 28 May 2018 15:37:48 +0200 (CEST)
Date: Mon, 28 May 2018 15:37:48 +0200
Message-Id: <20180528.153748.2044064270808262081.mbj@tail-f.com>
To: mjethanandani@gmail.com
Cc: netconf@ietf.org
From: Martin Bjorklund <mbj@tail-f.com>
In-Reply-To: <0F71DA52-A89C-41AF-96F7-312B5A8F89FF@gmail.com>
References: <CAJtYN8KKSGzUshaRDRds1SR7kxQyVH7T+WVErWhEbwcAZ2aFzw@mail.gmail.com> <0F71DA52-A89C-41AF-96F7-312B5A8F89FF@gmail.com>
X-Mailer: Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO)
Mime-Version: 1.0
Content-Type: Text/Plain; charset="utf-8"
Content-Transfer-Encoding: base64
Archived-At: <https://mailarchive.ietf.org/arch/msg/netconf/fkj1sxcMNAz0KwCHpulRqRPu5uk>
Subject: Re: [Netconf] Clarification about su tree filtering
X-BeenThere: netconf@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: Network Configuration WG mailing list <netconf.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netconf>, <mailto:netconf-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netconf/>
List-Post: <mailto:netconf@ietf.org>
List-Help: <mailto:netconf-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netconf>, <mailto:netconf-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 28 May 2018 13:37:53 -0000

Hi,

See answers inline.


Mahesh Jethanandani <mjethanandani@gmail.com> wrote:
> Forwarding to NETCONF WG mailing list.
> 
> Begin forwarded message:
> 
> > From: Shiva Kumar Pathori <pathori@gmail.com>
> > Date: May 28, 2018 at 5:27:19 AM EDT
> > To: Alex Campbell <Alex.Campbell@aviatnet.com>
> > Cc: netmod@ietf.org
> > Subject: Re: [netmod] Clarification about subtree filtering
> > 
> > Thanks Alex for the clarification. Can somebody please clarify about subtree filter behaviour or provide some pointers in RFC so that I can refer to it.
> > 
> >> On Thu 24 May, 2018, 5:56 AM Alex Campbell, <Alex.Campbell@aviatnet.com> wrote:
> >> Hi,
> >> 
> >> 
> >> Since nobody else has answered I'll have a go.
> >> I'm not familiar with subtree filtering, but I am with XPath. Assuming your XPath translation is accurate, it will return no data (response A).
> >> 
> >> From: netmod <netmod-bounces@ietf.org> on behalf of Shiva Kumar Pathori <pathori@gmail.com>
> >> Sent: Tuesday, 22 May 2018 8:38 p.m.
> >> To: netmod@ietf.org
> >> Subject: [netmod] Clarification about subtree filtering
> >>  
> >> 
> >>> Hi,
> >>> Can somebody clarify what could be the response for the <get-config> operation provided below.
> >>> 
> >>> Following is the user information in the datastore that is provided in the RFC 6241 as example.
> >>>> <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/>
> >>>>            </top>
> >>>>          </filter>
> >>>>        </get-config>
> >>>>      </rpc>
> >>> 
> >>>> <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>
> >>>>           <full-name>Charlie Root</full-name>
> >>>>           <company-info>
> >>>>             <dept>1</dept>
> >>>>             <id>1</id>
> >>>>           </company-info>
> >>>>         </user>
> >>>>         <user>
> >>>>           <name>fred</name>
> >>>>           <type>admin</type>
> >>>>           <full-name>Fred Flintstone</full-name>
> >>>>           <company-info>
> >>>>             <dept>2</dept>
> >>>>             <id>2</id>
> >>>>           </company-info>
> >>>>         </user>
> >>>>         <user>
> >>>>           <name>barney</name>
> >>>>           <type>admin</type>
> >>>>           <full-name>Barney Rubble</full-name>
> >>>>           <company-info>
> >>>>             <dept>2</dept>
> >>>>             <id>3</id>
> >>>>           </company-info>
> >>>>         </user>
> >>>>       </users>
> >>>>     </top>
> >>>>   </data>
> >>>> </rpc-reply>
> >>> 
> >>> 
> >>> The <get-config> operation with content-match at parent and child nodes;
> >>> 
> >>>> <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>
> >>>>             <type>admin</name>
> >>>>             <company-info>
> >>>>               <dept>1</dept>
> >>>>             </company-info>
> >>>>           </user>
> >>>>         </users>
> >>>>       </top>
> >>>>     </filter>
> >>>>   </get-config>
> >>>> </rpc>
> >>> 
> >>> The equivalent XPATH expression : 
> >>>> <rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
> >>>>   <get-config>
> >>>>     <source>
> >>>>       <running/>
> >>>>     </source>
> >>>>     <filter xmlns:t="http://example.com/schema/1.2/config" 
> >>>>                  type="xpath"
> >>>>                  select="/t:top/t:users/t:user[t:type='admin']/t:company-info[t:dept=’1’]"/>
> >>>>         </get-config>
> >>>>      </rpc>

This is not an equivalent expression, b/c a content-match node ("type")
is not AND:ed with a selection node ("company-info").

> >>> For this what could be the response
> >>> 
> >>> a) The response based on content-match nodes are AND-ed together
> >>>> <rpc-reply message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
> >>>>        <data>
> >>>>       </data>
> >>>>      </rpc-reply>
> >>> OR 
> >>> 
> >>> b)  The response based on content-match nodes treated separately
> >>>> <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>fred</name>
> >>>>           <type>admin</type>
> >>>>           <full-name>Fred Flintstone</full-name>
> >>>>         </user>
> >>>>         <user>
> >>>>           <name>barney</name>
> >>>>           <type>admin</type>
> >>>>           <full-name>Barney Rubble</full-name>
> >>>>         </user>
> >>>>       </users>
> >>>>     </top>
> >>>>   </data>
> >>>> </rpc-reply>

Sibling content-match nodes are AND:ed, but in this case "type" and
"dept" are not siblings.

The correct reply is:

   <data>
     <top xmlns="http://example.com/schema/1.2/config">
       <users>
         <user>
           <name>fred</name> (*)
           <type>admin</type>
         </user>
         <user>
           <name>barney</name> (*)
           <type>admin</type>
         </user>
       </users>
     </top>
   </data>

(*) note that if the name is the key, it MAY (or may not) be present
in the output, see 6.2.5 of RFC 6241:

   o  If any sibling nodes of the selection node are instance identifier
      components for a conceptual data structure (e.g., list key leaf),
      then they MAY also be included in the filter output.



/martin