Question from NETCONF working group

Rob Enns rpe at juniper.net
Fri Jun 25 21:37:28 UTC 2004


Hi,

The IETF's NETCONF WG is trying to select a retrieval filter mechanism
for use with <get-config> and <get> operations.  The fundamental
issue is whether to use a subset of the XPath language or
whether to define a mechanism based on XML subtree matching.
Your comments can help us decide which propsal to choose.

Here's the basic NETCONF <get> protocol operation exchange: 

  <rpc message-id="101" xmlns="netconf-uri">
    <get>
       <filter filter-type="filter-uri">
          ... filter data ...
       </filter>
    </get>
  </rpc>


  <rpc-reply message-id="101" xmlns="netconf-uri">
    <data>
       ... XML selected by the filter criteria ...
    </data>
  </rpc-reply>


There are two options under consideration for the mandatory
filter mechanism (i.e., standard values for the 'filter-type'
attribute).  If we can't get consensus on the mandatory
to implement filter, then we will probably make both optional.

A) XML sub-tree filtering
   A mechanism that allows exact match of element and attribute
   content, as well as the selection of specific subtrees.  (This is
   implemented in Junoscript.)

B) Xpath subset
   A small subset of the Xpath standard that provides essentially the
   same (or more) filtering functions as the subtree filter.
   (Note that full implementation of the Xpath 1.0 standard
   will be optional, and identified by the #xpath capability.)

Operator and application programmer preference is really the deciding
factor here.  Approach (A) uses XML encoding that looks like the data
model XML that will be returned in the response.  Approach (B) uses an
Xpath string encoding in the request, and the corresponding XML is
returned in the response.

Here are some example requests in both formats, followed by the response

that would be returned in both cases.

------------------------------------------------------------------------
-

E1) Select the entire <users> sub-tree

Request:

(A) subtree

  <rpc message-id="101" xmlns="netconf-uri">
    <get>
      <data>
        <filter filter-type="subtree-uri">
          <users xmlns="http://example.com/schema-1"/>
        </filter>
      </data>
    </get>
  </rpc>

(B) xpath

  <rpc message-id="101" xmlns="netconf-uri">
    <get>
      <data>
        <filter filter-type="xpath-subset-uri"
          xmlns:t="http://example.com/schema-1"/>
          t://users
        </filter>
      </data>
    </get>
  </rpc>

Reply:

  <rpc-reply message-id="101" xmlns="netconf-uri">
    <data>
      <users xmlns="http://example.com/schema-1">
        <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>
    </data>
  </rpc-reply>

------------------------------------------------------------------------
-

E2) Select all 'name' elements within the 'users' sub-tree

Request:

(A) subtree

  <rpc message-id="101" xmlns="netconf-uri">
    <get>
      <data>
        <filter filter-type="subtree-uri">
          <users xmlns="http://example.com/schema-1">
            <user>
              <name/>
            </user>
          </users>
        </filter>
      </data>
    </get>
  </rpc>

(B) xpath

  <rpc message-id="101" xmlns="netconf-uri">
    <get>
      <data>
        <filter filter-type="xpath-subset-uri"
            xmlns:t="http://example.com/schema-1">
           t://users/user/name
        </filter>
      </data>
    </get>
  </rpc>
Reply:

  <rpc-reply message-id="101" xmlns="netconf-uri">
    <data>
      <users xmlns="http://example.com/schema-1">
        <user>
          <name>root</name>
        </user>
        <user>
          <name>fred</name>
        </user>
        <user>
          <name>barney</name>
        </user>
      </users>
    </data>
  </rpc-reply>

------------------------------------------------------------------------
-

E3) One specific <user> entry

Request:

(A) subtree

  <rpc message-id="101" xmlns="netconf-uri">
    <get>
      <data>
        <filter filter-type="subtree">
          <users xmlns="http://example.com/schema-1">
            <user>
              <name>fred</name>
            </user>
          </users>
        </filter>
      </data>
    </get>
  </rpc>

(B) xpath

  <rpc message-id="101" xmlns="netconf-uri">
     <data>
        <filter filter-type="xpath-subset-uri"
            xmlns:t="http://example.com/schema-1">
           t://users/user[name="fred"]
        </filter>
     </data>
  </rpc>

Reply:

  <rpc-reply message-id="101" xmlns="netconf-uri">
    <data>
      <users xmlns="http://example.com/schema-1">
        <user>
          <name>fred</name>
          <type>admin</type>
          <full-name>Fred Flintstone</full-name>
          <company-info>
            <dept>2</dept>
            <id>2</id>
          </company-info>
        </user>
      </users>
    </data>
  </rpc-reply>
    
------------------------------------------------------------------------
-
  
E4) Specific elements from a specific <user> entry

Request:

(A) subtree

  <rpc message-id="101" xmlns="netconf-uri">
    <get>
      <data>
        <filter filter-type="subtree">
          <users xmlns="http://example.com/schema-1">
            <user>
              <name>fred</name>
              <type/>
              <full-name/>
            </user>
          </users>
        </filter>
      </data>
    </get>
  </rpc>

(B) xpath

  <rpc message-id="101" xmlns="netconf-uri">
     <data>
        <filter filter-type="xpath-subset-uri"
            xmlns:t="http://example.com/schema-1">
           t://users/user[name="fred"]/name |
           t://users/user[name="fred"]/type |
           t://users/user[name="fred"]/full-name
        </filter>
     </data>
   </rpc>

Reply:

  <rpc-reply message-id="101" xmlns="netconf-uri">
    <data>
      <users xmlns="http://example.com/schema-1">
        <user>
          <name>fred</name>
          <type>admin</type>
          <full-name>Fred Flintstone</full-name>
        </user>
      </users>
    </data>
  </rpc-reply>

------------------------------------------------------------------------
-

C.7) Multiple sub-trees

Request:

(A) subtree

  <rpc message-id="101" xmlns="netconf-uri">
    <get>
      <data>
        <filter filter-type="subtree">
          <users xmlns="http://example.com/schema-1"/>
            <user>
              <name>root</name>
              <company-info/>
            </user>
            <user>
              <name>fred</name>
              <company-info>
                <id/>
              </company-info>
            </user>
            <user>
              <name>barney</name>
              <type>superuser</type>
              <company-info>
                <dept/>
              </company-info>
            </user>
          </users>
        </filter>
      </data>
    </get>
  </rpc>

(B) xpath

  <rpc message-id="101" xmlns="netconf-uri">
     <data>
        <filter filter-type="xpath-subset-uri"
            xmlns:t="http://example.com/schema-1">
          t://users/user[name="root"]/company-info |
          t://users/user[name="fred"]/company-info/id |
          t://users/user[name="barney" and
type="superuser"]/company-info
        </filter>
     </data>
   </rpc>

Reply:

  <rpc-reply message-id="101" xmlns="netconf-uri">
    <data>
      <users xmlns="http://example.com/schema-1"/>
        <user>
          <name>root</name>
          <company-info>
            <dept>1</dept>
            <id>1</id>
          </company-info>
        </user>
        <user>
          <name>fred</name>
          <company-info>
            <id>2</id>
          </company-info>
        </user>
      </users>
    </data>
  </rpc-reply>

------------------------------------------------------------------------
-

C.8) Table with attribute naming

Request:

(A) subtree

  <rpc message-id="101" xmlns="netconf-uri">
    <get>
      <data>
        <filter filter-type="subtree">
          <t:interfaces xmlns:t="http://example.com/schema-2"/>
            <t:interface t:ifName="eth0"/>
          </t:interfaces>
        </filter>
      </data>
    </get>
  </rpc>

(B) xpath

  <rpc message-id="101" xmlns="netconf-uri">
     <data>
        <filter filter-type="xpath-subset-uri"
            xmlns:t="http://example.com/schema-2">
           t://interfaces/interface/[@ifName="eth0"]
        </filter>
     </data>
   </rpc>

Reply:

  <rpc-reply message-id="101" xmlns="netconf-uri">
    <data>
      <t:interfaces xmlns:t="http://example.com/schema-2">
        <t:interface t:ifName="eth0">
          <t:ifInOctets>45621</t:ifInOctets>
          <t:ifOutOctets>774344</t:ifOutOctets>
        </t:interface>
      </t:interfaces>
    </data>
  </rpc-reply>



More information about the NANOG mailing list