Re: [netmod] Clarification about subtree filtering

Alex Campbell <Alex.Campbell@Aviatnet.com> Thu, 24 May 2018 00:26 UTC

Return-Path: <Alex.Campbell@Aviatnet.com>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 1816512D7EC for <netmod@ietfa.amsl.com>; Wed, 23 May 2018 17:26:05 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.899
X-Spam-Level:
X-Spam-Status: No, score=-1.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=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 REll0ozdU9YB for <netmod@ietfa.amsl.com>; Wed, 23 May 2018 17:26:03 -0700 (PDT)
Received: from mail-send.aviatnet.com (mail-send.aviatnet.com [192.147.115.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id DDBF1126C2F for <netmod@ietf.org>; Wed, 23 May 2018 17:26:02 -0700 (PDT)
From: Alex Campbell <Alex.Campbell@Aviatnet.com>
To: Shiva Kumar Pathori <pathori@gmail.com>, "netmod@ietf.org" <netmod@ietf.org>
Thread-Topic: [netmod] Clarification about subtree filtering
Thread-Index: AQHT8ahUCbWE6C526UqWXZHs7TFZ/aQ+BoqT
Date: Thu, 24 May 2018 00:26:01 +0000
Message-ID: <1527121561343.62896@Aviatnet.com>
References: <CAJtYN8+WZjtjrhmGcNWTcpqFCcmwLNjT0LtRU_U8+x-EZhSwCA@mail.gmail.com>, <CAJtYN8LRJ0sXLWGDagpwiRDJSjgU70V+PW8yYdz9K7FNOJnUqw@mail.gmail.com>
In-Reply-To: <CAJtYN8LRJ0sXLWGDagpwiRDJSjgU70V+PW8yYdz9K7FNOJnUqw@mail.gmail.com>
Accept-Language: en-NZ, en-US
Content-Language: en-NZ
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-ms-exchange-transport-fromentityheader: Hosted
x-originating-ip: [10.15.6.10]
Content-Type: multipart/alternative; boundary="_000_152712156134362896Aviatnetcom_"
MIME-Version: 1.0
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/B88UGzNF37kv2TrRq2ZgGCPQ5gk>
Subject: Re: [netmod] Clarification about subtree filtering
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: NETMOD WG list <netmod.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netmod>, <mailto:netmod-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netmod/>
List-Post: <mailto:netmod@ietf.org>
List-Help: <mailto:netmod-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netmod>, <mailto:netmod-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 24 May 2018 00:26:05 -0000

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>

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>

Regards,
Shiva