<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt"?>
<!DOCTYPE rfc SYSTEM 'rfc2629.dtd'>
<?rfc toc="yes"?>
<?rfc compact="no"?>
<?rfc subcompact="no"?>
<?rfc symrefs="yes" ?>
<?rfc sortrefs="yes"?>
<?rfc iprnotified="no"?>
<?rfc strict="yes"?>
<rfc ipr="trust200902" category="std" docName="draft-bierman-netconf-get2-00" >
    <front>
    <title abbrev="&lt;get2&gt;">The NETCONF &lt;get2&gt; Operation</title>

    <author initials="A" surname="Bierman" fullname='Andy Bierman' >
      <organization>YumaWorks</organization>
      <address>
        <email>andy@yumaworks.com</email>
      </address>
    </author>
	<date/>
    <abstract>
	<t>
This document describes NETCONF protocol enhancements to improve 
data retrieval capabilities. 
	</t>
</abstract>
</front>
<middle>
<section title="Introduction">
    <t>
There is a need for standard mechanisms to
allow NETCONF <xref target="RFC6241"/> application designers to
retrieve data from NETCONF servers more efficiently.
    </t>
<section title="Problem Statement">
    <t>
This document attempts to address the following
problems with NETCONF data retrieval mechanisms.
    </t>
<section title="Too Much Data Returned">
    <t>
The NETCONF &lt;get&gt; operation allows a client to
retrieve data from the server but it returns all data,
including configuration datastore nodes. The &lt;get&#8209;config&gt;
operation already returns all configuration datastore nodes.
    </t>
    <t>
It was originally thought that &lt;get&gt; should return all nodes
so the client would not have to correlate configuration
and non-configuration data nodes, since they would be
mixed together in the reply.
    </t>
    <t>
Operational experience has shown that the &lt;get&gt; operation
without reasonable filters to reduce the returned data
can significantly degrade device performance and return
enormous XML instance documents in the &lt;rpc&#8209;reply&gt;.
    </t>
</section>
<section title="No Last-Modified Indication or Time Filtering">
    <t>
The NETCONF protocol has no standard mechanisms to indicate
to a client when a datastore was last modified, or to allow
a client to retrieve data only if it has been modified
since a specified time.  This makes polling applications
very inefficient because they will regularly burden the
server and the network and themselves with retrieval and
processing requests for data that has not changed.
    </t>
</section>
<section title="No Simple Instance Discovery Mechanism">
    <t>
Sometimes the client application wants to discover what
data exists on the server, particularly list entries.
There is a need for a simple mechanism to retrieve
just the key leaf nodes within a subtree.
    </t>
    <t>
The NETCONF subtree filtering mechanism does provide
a very complex way for the client to request just key leafs
for specific list entries.  A simpler mechanism is needed
which will allow the client to discover the list instances
present.
    </t>
</section>
<section title="No Subtree Depth Control">
    <t>
NETCONF filters allow the client to select specific
sub-trees within the conceptual datastore on the server.
However, sometimes the client does not really need the
entire subtree, which may contain many nested list entries,
and be very large.
    </t>
    <t>
There is sometimes a need to limit the depth of the sub-trees
retrieved from the server. A consistent and simple algorithm
for determining what data nodes start a new level is needed.
    </t>
</section>
<section title="Content Filter Specification is not Extensible">
    <t>
The NETCONF &lt;get&gt; and &lt;get&#8209;config&gt; operations use
a hard-coded content filtering mechanism.
They use a &apos;type&apos; XML attribute to indicate which of two
filter specification types they support, and a &apos;select&apos;
XML attribute if the :xpath capability is supported and
an XPath <xref target="XPATH"/> expression filter specification is provided.
    </t>
    <t>
This design does not allow additional content filter specification
types to be supported by an implementation.  It does not
allow the standard to be easily extended in a modular fashion.
    </t>
    <t>
In addition, this design does not allow YANG statements to be used
to properly describe the protocol operation. 
The special &apos;get&#8209;filter&#8209;element&#8209;attributes&apos; YANG extension in
the ietf-netconf module is not extensible, and it does not
really count as proper YANG, since this
extension is outside the YANG language definition.
    </t>
</section>
<section title="Subtree Filtering is Mandatory">
    <t>
There is a mandatory-to-implement subtree filter mechanism
in NETCONF.  There are server environments where subtree
filtering cannot be supported or is not needed for the
specific device or supported management application(s).
    </t>
    <t>
A NETCONF server SHOULD support subtree filtering.
An implementation MAY omit subtree filtering support if
it is not applicable or not feasible on the device.
    </t>
</section>
</section>
<section title="Solution">
    <t>
This document defines a new NETCONF protocol operation
called &lt;get2&gt; to address the deficiencies described in
the previous section.  It can be implemented existing
NETCONF servers without requiring a change in the protocol
version.
    </t>
</section>
<section title="Terminology">
    <t>
The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;,
&quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and
&quot;OPTIONAL&quot; in this document are to be interpreted as described in BCP
14, <xref target="RFC2119"/>.
    </t>
<section title="NETCONF">
    <t>
The following terms are defined in <xref target="RFC6241"/>:
    </t>
<t>
 <list style="symbols">
 <t>
candidate configuration datastore
 </t>
 <t>
client
 </t>
 <t>
configuration data
 </t>
 <t>
datastore
 </t>
 <t>
configuration datastore
 </t>
 <t>
protocol operation
 </t>
 <t>
running configuration datastore
 </t>
 <t>
server
 </t>
 <t>
startup configuration datastore
 </t>
 </list>
</t>
</section>
<section title="YANG">
    <t>
The following terms are defined in <xref target="RFC6020"/>:
    </t>
<t>
 <list style="symbols">
 <t>
anyxml
 </t>
 <t>
container
 </t>
 <t>
data node
 </t>
 <t>
key leaf
 </t>
 <t>
leaf
 </t>
 <t>
leaf-list
 </t>
 <t>
list
 </t>
 <t>
presence container (or P-container)
 </t>
 <t>
non-presence container (or NP-container)
 </t>
 </list>
</t>
</section>
<section title="Terms">
    <t>
The following terms are defined:
    </t>
<t>
 <list style="symbols">
 <t>
operational datastore: the collection of all
conceptual YANG data nodes which represent non-configuration
data. This conceptual datastore also includes ancestor
container and list nodes for any nested non-configuration
nodes, as well as list keys for any list nodes in this datastore.
 </t>
 <t>
depth filter: A mechanism implemented within the NETCONF
server to allow a client to retrieve only a limited number
of levels within the a subtree, instead of retrieving
the entire subtree.
 </t>
 <t>
time filter: A mechanism implemented within the NETCONF
server to allow a client to retrieve only data that has been
modified since a specified data and time.
 </t>
 </list>
</t>
</section>
</section>
</section>
<section title="&lt;get2&gt; Operation">
    <t>
The &lt;get2&gt; operation is defined with a YANG &apos;rpc&apos; 
statement. A specific datastore is selected for
the source of the retrieval operation.  Several
different types of filters are provided.  Filters
are combined in a conceptual &quot;logical&#8209;AND&quot; operation,
and are optional to use by the client.  Not all filtering
mechanisms are mandatory-to-implement for the server.
    </t>
    <t>
The &lt;get2&gt; protocol operation
contains the following input parameters:
    </t>
<t>
 <list style="symbols">
 <t>
source: A container indicating the conceptual
datastore for the retrieval request.
 </t>
 <t>
filter-spec: A choice indicating the content filter
specification for the retrieval request.
 </t>
 <t>
keys-only: A leaf indicating that only the key leafs,
combined with other filtering criteria, should be returned.
 </t>
 <t>
if-modified-since: A leaf indicating the time filter
specification for the retrieval request, according to
the procedures in <xref target="time-filter"/>.
 </t>
 <t>
depth: A leaf indicating the subtree depth level
for the retrieval request, according to the procedures
in <xref target="depth"/>.
 </t>
 <t>
with-defaults: A leaf indicating the type of defaults
handling requested, according to procedures in <xref target="RFC6243"/>.
 </t>
 <t>
with-timestamps: A leaf indicating that &apos;last&#8209;modified&apos;
XML attributes are requested, according to procedure 
in <xref target="last-modified"/>.
 </t>
 </list>
</t>
<section title="Depth Filters" anchor="depth">
    <t>
A depth filter indicates how many subtree levels
should be returned in the &lt;rpc&#8209;reply&gt;.  This filter
is specified with the &apos;depth&apos; input parameter for
the &lt;get2&gt; protocol operation.  The default &apos;0&apos; indicates
that all levels from the requested subtrees should be returned.
    </t>
    <t>
A new level is started for each YANG P-container or list
within the descendant nodes of the requested subtree.
    </t>
    <t>
For purposes of counting levels, NP-containers are
transparent.  The contents of an NP container
are considered to be at the same level as the 
NP-container itself.
    </t>
    <t>
YANG data nodes of type &apos;leaf&apos;,
&apos;leaf&#8209;list&apos;, and &apos;anyxml&apos; are considered to be at the same
level as their parent container or list.
    </t>
    <t>
If no content filters are provided, then level 1 is
considered to include all top-level data nodes
within the source datastore.  Otherwise only the
levels in selected subtrees will be considered,
and not any additional top-level data nodes.
    </t>
</section>
<section title="Time Filters" anchor="time-filter">
    <t>
A time filter indicates that only data which has been modified
since the indicated date and time should be included in the reply.
    </t>
    <t>
If this feature is supported, then the server will maintain
a last-modified timestamp for the source datastore.  It MAY
support additional nested timestamps for data nodes within
the datastore.
    </t>
    <t>
When a request containing the &apos;if&#8209;modified&#8209;since&apos;
parameter is received, the server will compare that
timestamp to the last-modified timestamp for the source
datastore. If it is greater than the specified value then
data may be returned (depending on other filters).
If the datastore timestamp value is less than or 
equal to the specified value,
then an empty &lt;data&gt; element will be returned in the &lt;rpc&#8209;reply&gt;.
    </t>
    <t>
If the server maintains &apos;last&#8209;modified&apos; timestamps for any data nodes
within the source datastore then the same type of comparison
will be done for the data node to determine if it should be
included in the response.  If no &apos;last&#8209;modified&apos; timestamp
is maintained for a data node, then the server will use
the &apos;last&#8209;modified&apos; timestamp for its nearest ancestor,
or for the datastore itself if there are none.
    </t>
</section>
</section>
<section title="XSD for the &apos;last&#8209;modified&apos; Attribute" anchor="last-modified">
    <t>
The following XML Schema document <xref target="XSD"/> defines 
the &apos;last&#8209;modified&apos; attribute, described within this document.
This XSD is only relevant if the server supports 
the &apos;timestamps&apos; YANG feature within the &apos;ietf&#8209;netconf&#8209;get2&apos;
YANG module.
    </t>
    <t>
The &apos;last&#8209;modified&apos; attribute uses the XSD data type &apos;dateTime&apos;,
in accordance with Section 3.2.7.1 of XML Schema Part 2: Datatypes.
This is equivalent to the YANG data type &apos;date&#8209;and&#8209;time&apos;.
    </t>
    <t>
&lt;CODE BEGINS&gt; file=&quot;last&#8209;modified.xsd&quot;
    </t>
	<figure>
	    <artwork><![CDATA[
 <?xml version="1.0" encoding="UTF-8"?>
 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns="urn:ietf:params:xml:ns:netconf:default:1.0"
   targetNamespace="urn:ietf:params:xml:ns:netconf:last-modified:1.0"
   elementFormDefault="qualified"
   attributeFormDefault="unqualified"
   xml:lang="en">

  <xs:annotation>
    <xs:documentation>
      This schema defines the syntax for the 'last-modified' attribute
      described within this document.
    </xs:documentation>
  </xs:annotation>

  <!--
    last-modified attribute
    -->
  <xs:attribute name="last-modified" type="xs:dateTime">
    <xs:annotation>
      <xs:documentation>
        This attribute indicates the date and time when
        a modification was last detected by the server
        for the datastore or data node corresponding to
        the XML element containing this attribute.
      </xs:documentation>
    </xs:annotation>
  </xs:attribute>
 </xs:schema>
	    ]]></artwork>
	</figure>
    <t>
&lt;CODE ENDS&gt;
    </t>
</section>
<section title="YANG Module" anchor="module">
    <t>
This module imports the &apos;with&#8209;defaults&#8209;parameters&apos; grouping
from <xref target="RFC6243"/>.
    </t>
    <t>
Several YANG features are imported from <xref target="RFC6241"/>.
    </t>
    <t>
Some data types are imported from <xref target="RFC6021"/>.
    </t>
    <t>
RFC Ed.: update the date below with the date of RFC publication and
remove this note.
    </t>
<t>&lt;CODE BEGINS> file "ietf-netconf-get2@2012-09-08.yang"</t>
	<figure>
	    <artwork><![CDATA[
module ietf-netconf-get2 {

  namespace "urn:ietf:params:xml:ns:yang:ietf-netconf-get2";
  prefix get2;

  import ietf-inet-types {
    prefix inet;
  }

  import ietf-netconf {
    prefix nc;
  }

  import ietf-netconf-with-defaults {
    prefix ncwd;
  }

  import ietf-yang-types {
    prefix yang;
  }

  organization
    "IETF NETMOD (NETCONF Data Modeling Language) Working Group";

  contact
    "WG Web:   <http://tools.ietf.org/wg/netconf/>
     WG List:  <mailto:netconf@ietf.org>

     WG Chair: Mehmet Ersue
               <mailto:mehmet.ersue@nsn.com>

     WG Chair: Bert Wijnen
               <mailto:bertietf@bwijnen.net>

     Editor:   Andy Bierman
               <mailto:andy@yumaworks.com>";
  
  description
    "This module contains a collection of YANG definitions for the
     retrieval of information from a NETCONF server.

     Copyright (c) 2012 IETF Trust and the persons identified as
     authors of the code.  All rights reserved.

     Redistribution and use in source and binary forms, with or
     without modification, is permitted pursuant to, and subject
     to the license terms contained in, the Simplified BSD License
     set forth in Section 4.c of the IETF Trust's Legal Provisions
     Relating to IETF Documents
     (http://trustee.ietf.org/license-info).

     This version of this YANG module is part of RFC XXXX; see
     the RFC itself for full legal notices.";

  // RFC Ed.: replace XXXX with actual RFC number and remove this
  // note.

  // RFC Ed.: remove this note
  // Note: extracted from draft-bierman-netconf-get2-00.txt

  // RFC Ed.: update the date below with the date of RFC publication
  // and remove this note.
  revision "2012-09-08" {
    description
      "Initial revision.";
    reference
      "RFC XXXX: The NETCONF <get2> Operation";
  }

  /* Features */ 

  feature timestamps {
    description
      "This feature indicates that the server implements
       the <get2> operations parameters which require
       last modification timestamps to be maintained by
       the server.

       If this feature is advertised then one global
       'last-modified' timestamp for the entire
       running datastore MUST be supported.

       The server MAY support additional timestamps
       for additional datastores and data nodes 
       within a datastore.  The 'with-timestamps' 
       parameter can be used to identify
       which data nodes support a last-modified-time
       timestamp.";
  }

  feature with-defaults {
    description
      "This feature indicates that the server supports the
       'with-defaults' parameter for the <get2> operation.
       A NETCONF server SHOULD support this feature.";
    reference
      "RFC 6243: With-defaults Capability for NETCONF";
  }

  feature subtree-filter {
    description
      "This feature indicates that the server supports the
       subtree filtering mechanism for selecting portions
       of the selected source datastore.
       A NETCONF server SHOULD support this feature.";
    reference
      "RFC 6241: NETCONF Protocol, section 6.";
  }

  /* Protocol Operations */

  rpc get2 {
    description
      "Retrieve NETCONF datastore information";
    input {
      container source {
        choice datastore-source {
          default running;
          description
            "The configuration source for the retrieval operation.
             The running configuration is the default choice if
             this parameter is not present.";
          leaf candidate {
            if-feature nc:candidate;
            type empty;
            description
              "The candidate configuration datastore is the 
               retrieval source.";
          }
          leaf running {
            type empty;
            description
              "The running configuration datastore is the
               retrieval source.";
          }
          leaf operational {
            type empty;
            description
              "The collection of non-configuration
               data nodes supported by the server is the
               retrieval source.";
          }
          leaf startup {
            if-feature nc:startup;
            type empty;
            description
              "The startup configuration datastore is the
               retrieval source.";
          }
          leaf url {
            if-feature nc:url;
            type inet:uri;
            description
              "The URL-based configuration is the 
               retrieval source.";
          }
        }
      }

      choice filter-spec {
        anyxml filter {
          if-feature subtree-filter;
          description
            "This parameter identifies the portions of the
             target datastore to retrieve.";
          reference "RFC 6241, Section 6.";
        }
        leaf select {
          if-feature nc:xpath;
          type yang:xpath1.0;
          description
            "This parameter contains an XPath expression
             identifying the portions of the target 
             datastore to retrieve.";
        }
      }

      leaf keys-only {
        type empty;
        description
          "This parameter selects only data nodes which
           are key leaf nodes.  Parent container and 
           list nodes are also returned, but no other leafs,
           or any leaf-lists will be included in the reply.";
      }

      leaf if-modified-since {
        if-feature timestamps;
        type yang:date-and-time;
        description
          "This parameter selects only data nodes which
           have been modified since the specified time.";
      }

      leaf depth {
        type uint32;
        default 0;
        description
          "This parameter selects how many conceptual
           sub-tree levels should be returned in the
           <rpc-reply>.

           If this parameter is equal to '0', then entire
           subtrees will be returned.

           If this parameter is greater than '0', then
           only the specified number of subtree levels will
           be returned.";
        reference "RFC XXXX, section 2.1.";
      }

      uses ncwd:with-defaults-parameters {
        if-feature with-defaults;
        description
          "This parameter controls the retrieval of
           default values.";
         reference
           "RFC 6243: With-defaults Capability for NETCONF";
      }

      leaf with-timestamps {
        if-feature timestamps;
        type empty;
        description
          "This parameter will cause the server to return
           XML attributes identifying the last modification
           time within one or more elements within the
           <rpc-reply>.";
        reference "RFC XXXX, sections 2.2 and 3.";
      }
    }

    output {
      anyxml data {
        description
          "Copy of the requested datastore subset which 
           matched the filter criteria (if any).
           An empty data container indicates that the
           request did not produce any results.";
      }
    }
  }  

}
	    ]]></artwork>
	</figure>
<t>&lt;CODE ENDS></t>
</section>
<section title="IANA Considerations" anchor="iana">
    <t>
This document registers a URI in the IETF XML registry
<xref target="RFC3688"/>. Following the format in RFC 3688, the following
registration is requested to be made.
    </t>
	<figure>
	    <artwork><![CDATA[
     URI: urn:ietf:params:xml:ns:yang:ietf-netconf-get2

     Registrant Contact: The NETCONF WG of the IETF.

     XML: N/A, the requested URI is an XML namespace.
	    ]]></artwork>
	</figure>
    <t>
This document registers a YANG module in the YANG Module Names
registry <xref target="RFC6020"/>.
    </t>
	<figure>
	    <artwork><![CDATA[
  name:         ietf-netconf-get2
  namespace:    urn:ietf:params:xml:ns:yang:ietf-netconf-get2
  prefix:       get2
  reference:    RFC XXXX
	    ]]></artwork>
	</figure>
</section>
<section title="Security Considerations">
    <t>
This document does not introduce any new security concerns
in addition to those specified in <xref target="RFC6241"/>, section 9.
    </t>
</section>
</middle>
<back>
<references title="Normative References">

    <reference anchor="RFC2119">
      <front>
        <title>Key words for use in RFCs to Indicate Requirement Levels</title>
        <author initials="S." surname="Bradner" fullname="S.  Bradner">
          <organization>Harvard University</organization>
        </author>
        <date month="March" year="1997"/>
        <abstract>
          <t>In many standards track documents several words are used to signify the requirements in the specification.  These words are often capitalized.  This document defines these words as they should be interpreted in IETF documents.</t>
        </abstract>
      </front>
      <seriesInfo name="BCP" value="14"/>
      <seriesInfo name="RFC" value="2119"/>
      <format type="TXT" octets="4723" target="ftp://ftp.isi.edu/in-notes/rfc2119.txt"/>
    </reference>

<reference anchor="RFC6020">
  <front>
    <title>YANG - A Data Modeling Language for the Network Configuration Protocol (NETCONF)</title>
    <author initials="M." surname="Bjorklund" fullname="M. Bjorklund">
      <organization/>
    </author>
    <date year="2010" month="October"/>
    <abstract>
      <t>YANG is a data modeling language used to model configuration and state data manipulated by the Network Configuration Protocol (NETCONF), NETCONF remote procedure calls, and NETCONF notifications. [STANDARDS TRACK]</t>
    </abstract>
  </front>
  <seriesInfo name="RFC" value="6020"/>
  <format type="TXT" octets="324178" target="http://www.rfc-editor.org/rfc/rfc6020.txt"/>
</reference>

<reference anchor='RFC6021'>
  <front>
    <title>Common YANG Data Types</title>
    <author initials='J.' surname='Schoenwaelder' fullname='J. Schoenwaelder'>
      <organization/>
    </author>
    <date year='2010' month='October'/>
  </front>
  <seriesInfo name='RFC' value='6021'/>
</reference>

<reference anchor='RFC6241'>
  <front>
    <title>Network Configuration Protocol (NETCONF)</title>
    <author initials='R.' surname='Enns' fullname='R. Enns' role="editor">
      <organization/>
    </author>
    <author initials='M.' surname='Bjorklund' fullname='M. Bjorklund' role="editor">
      <organization/>
    </author>
    <author initials='J.' surname='Schoenwaelder' fullname='J. Schoenwaelder' role="editor">
      <organization/>
    </author>
    <author initials='A.' surname='Bierman' fullname='A. Bierman' role="editor">
      <organization/>
    </author>
    <date year='2011' month='June'/>
  </front>
  <seriesInfo name='RFC' value='6241'/>
</reference>

<reference anchor="RFC6243">
  <front>
    <title>With-defaults Capability for NETCONF</title>
    <author initials="A." surname="Bierman" fullname="A. Bierman">
      <organization/>
    </author>
    <author initials="B." surname="Lengyel" fullname="B. Lengyel">
      <organization/>
    </author>
    <date year="2011" month="June"/>
  </front>
  <seriesInfo name="RFC" value="6243"/>
  <format type="TXT" octets="51568" 
          target="http://www.rfc-editor.org/rfc/rfc6243.txt"/>
</reference>

<reference anchor="XPATH" target="http://www.w3.org/TR/1999/REC-xpath-19991116">
      <front>
        <title>XML Path Language (XPath) Version 1.0</title>
        <author initials="J." surname="Clark" fullname="James Clark">
          <organization/>
        </author>
        <author initials="S." surname="DeRose" fullname="Steven DeRose">
          <organization/>
        </author>
        <date month="November" day="16" year="1999"/>
      </front>
      <seriesInfo name="World Wide Web Consortium Recommendation" value="REC-xpath-19991116"/>
      <format type="HTML" target="http://www.w3.org/TR/1999/REC-xpath-19991116"/>
</reference>

<reference anchor="XSD" 
           target="http://www.w3.org/TR/2004/REC-xmlschema-2-20041028">
<front>
  <title>XML Schema Part 2: Datatypes Second Edition</title>
  <author initials="A." surname="Malhotra" fullname="Ashok Malhotra">
    <organization/>
  </author>
  <author initials="P." surname="Biron" fullname="Paul V. Biron">
    <organization/>
  </author>
  <date month="October" day="28" year="2004"/>
</front>
<seriesInfo name="World Wide Web Consortium Recommendation" 
            value="REC-xmlschema-2-20041028"/>
<format type="HTML" 
        target="http://www.w3.org/TR/2004/REC-xmlschema-2-20041028"/>
</reference>

</references>

<references title="Informative References">

<reference anchor='RFC3688'>
<front>
<title>The IETF XML Registry</title>
<author initials='M.' surname='Mealling' fullname='M. Mealling'>
<organization /></author>
<date year='2004' month='January' />
<abstract>
<t>This document describes an IANA maintained registry for IETF standards which use Extensible Markup Language (XML) related items such as Namespaces, Document Type Declarations (DTDs), Schemas, and Resource Description Framework (RDF) Schemas.</t></abstract></front>
<seriesInfo name='BCP' value='81' />
<seriesInfo name='RFC' value='3688' />
<format type='TXT' octets='17325' target='http://www.rfc-editor.org/rfc/rfc3688.txt' />
</reference>


</references>

<section title="Examples">
<section title="YANG Module Used in Examples">
	<figure>
	    <artwork><![CDATA[
module example-get2 {

  namespace "http://example.com/ns/example-get2";
  prefix exget2;

  revision 2012-09-08;

  container forests {
    list forest {
      key name;

      leaf name {
        type string;
      }

      leaf tree-count {
        config false;
        type uint32;
      }

      container trees {
        list tree {
          key name;

          leaf name {
            type string;
          }
          leaf location {
            type string;
          }
          leaf height {
            config false;
            type decimal64 {
              fraction-digits 3;
            }
            units meters;
          }
        }  // list tree
      }  // container trees
    } // list forest
  }  // container forests
}
	    ]]></artwork>
	</figure>
</section>
<section title="YANG Data Used in Examples">
    <t>
The follow instances are assumed in the following examples.
    </t>
	<figure>
	    <artwork><![CDATA[
  list forest: 'north':
    list tree: 'birch', 'ash', 'maple'

  list forest: 'south':
    list tree: 'banyan', 'palm'
	    ]]></artwork>
	</figure>
</section>
<section title="Example: Operational Datastore">
    <t>
This example simply retrieves the &apos;forests&apos; subtree
data from the operational datastore.
    </t>
	<figure>
	    <artwork><![CDATA[
  <rpc message-id="101"
    xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <get2 xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-get2">
      <source>
        <operational />
      </source>
      <filter>
        <forests xmlns="http://example.com/ns/example-get2" />
      </filter>
    </get2>
  </rpc>

  <rpc-reply message-id="101"
    xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <data xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-get2">
      <forests xmlns="http://example.com/ns/example-get2">
        <forest>
          <name>north</name>
          <tree-count>3</tree-count>
          <trees>
            <tree>
              <name>birch</name>
              <height>41.013</height>
            </tree>
            <tree>
              <name>ash</name>
              <height>16.523</height>
            </tree>
            <tree>
              <name>maple</name>
              <height>51.204</height>
            </tree>
          </trees>
        </forest>
        <forest>
          <name>south</name>
          <tree-count>2</tree-count>
          <trees>
            <tree>
              <name>banyan</name>
              <height>91.433</height>
            </tree>
            <tree>
              <name>palm</name>
              <height>83.439</height>
            </tree>
          </trees>
        </forest>
      </forests>
    </data>
  </rpc-reply>
	    ]]></artwork>
	</figure>
</section>
<section title="Example: If-Modified-Since Non-Empty Filter Retrieval">
    <t>
In this example, the running datastore was last
modified at &apos;2012&#8209;09&#8209;09T01:43:27Z&apos; because the
forest named &apos;north&apos; was modified at this time.
    </t>
    <t>
The forest named &apos;north&apos; was last modified after
the specified &apos;if&#8209;modified&#8209;since&apos; timestamp.
The forest named &apos;south&apos; was last modified before
the specified &apos;if&#8209;modified&#8209;since&apos; timestamp.
    </t>
    <t>
The server maintains a last-modified timestamp for
the running datastore and the &apos;forest&apos; list entries.
    </t>
    <t>
The client is also requesting that timestamps be
returned for the nodes that have been modified.
If any part of the &apos;forest&apos; subtree is modified
then this timestamp will be updated.
    </t>
	<figure>
	    <artwork><![CDATA[
  <rpc message-id="102"
    xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <get2 xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-get2">
      <filter>
        <forests xmlns="http://example.com/ns/example-get2" />
      </filter>
      <if-modified-since>2012-09-09T01:43:27Z</if-modified-since>
      <with-timestamps />
    </get2>
  </rpc>

  <rpc-reply message-id="102"
    xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"
    xmlns:lm="urn:ietf:params:xml:ns:netconf:last-modified:1.0">
    <data 
      xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-get2"
      lm:last-modified="2012-09-09T02:00:00Z">

      <forests xmlns="http://example.com/ns/example-get2">
        <forest lm:last-modified="2012-09-09T02:00:00Z">
          <name>north</name>
          <trees>
            <tree>
              <name>birch</name>
              <location>hillside</location>
            </tree>
            <tree>
              <name>ash</name>
              <location>southwest pasture</location>
            </tree>
            <tree>
              <name>maple</name>
              <location>east meadow</location>
            </tree>
          </trees>
        </forest>
    </data>
  </rpc-reply>
	    ]]></artwork>
	</figure>
</section>
<section title="Example: If-Modified-Since Empty Filter Retrieval">
    <t>
In this example the client has changed the
if-modified-since timestamp to a time in the future.
No &apos;forest&apos; list entry has been modified since
this time so an empty data node is returned.
Note that the last-modified timestamp is returned for
the node representing the datastore, even though
no data nodes have been modified since the specified
time.  This allows the client to easily retrieve the
last-modified timestamp for the entire datastore.
    </t>
	<figure>
	    <artwork><![CDATA[
  <rpc message-id="103"
    xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <get2 xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-get2">
      <filter>
        <forests xmlns="http://example.com/ns/example-get2" />
      </filter>
      <if-modified-since>2012-09-09T03:43:27Z</if-modified-since>
      <with-timestamps />
    </get2>
  </rpc>

  <rpc-reply message-id="103"
    xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"
    xmlns:lm="urn:ietf:params:xml:ns:netconf:last-modified:1.0">
    <data xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-get2"
      lm:last-modified="2012-09-09T02:00:00Z" />
  </rpc-reply>
	    ]]></artwork>
	</figure>
</section>
<section title="Example: Keys Only Filter Retrieval">
    <t>
This example retrieves the names-only
from the &apos;forests&apos; subtree in the running
datastore.  Only one subtree level is requested,
instead of the default of all levels.
The default source (running) is used.
The default depth=&apos;0&apos; is used to retrieve all subtree
levels.
    </t>
	<figure>
	    <artwork><![CDATA[
  <rpc message-id="105"
    xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <get2 xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-get2">
      <filter>
        <forests xmlns="http://example.com/ns/example-get2" />
      </filter>
      <keys-only />
    </get2>
  </rpc>

  <rpc-reply message-id="105"
    xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <data xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-get2">
      <forests xmlns="http://example.com/ns/example-get2">
        <forest>
          <name>north</name>
          <trees>
            <tree>
              <name>birch</name>
            </tree>
            <tree>
              <name>ash</name>
            </tree>
            <tree>
              <name>maple</name>
            </tree>
          </trees>
        </forest>
        <forest>
          <name>south</name>
          <trees>
            <tree>
              <name>banyan</name>
            </tree>
            <tree>
              <name>palm</name>
            </tree>
          </trees>
        </forest>
      </forests>
    </data>
  </rpc-reply>
	    ]]></artwork>
	</figure>
</section>
<section title="Example: Keys Only Filter Retrieval with Depth=1">
    <t>
This example retrieves the names-only
from the &apos;forests&apos; subtree in the running
datastore.  Only one subtree level is requested,
instead of the default of all levels.
The default source (running) is used.
The depth parameter is set to &apos;1&apos; to only retrieve
the first layer, which includes the &apos;forests&apos; 
NP container and the &apos;forest&apos; list.
    </t>
	<figure>
	    <artwork><![CDATA[
  <rpc message-id="105"
    xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <get2 xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-get2">
      <filter>
        <forests xmlns="http://example.com/ns/example-get2" />
      </filter>
      <keys-only />
      <depth>1</depth>
    </get2>
  </rpc>

  <rpc-reply message-id="105"
    xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <data xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-get2">
      <forests xmlns="http://example.com/ns/example-get2">
        <forest>
          <name>north</name>
        </forest>
        <forest>
          <name>south</name>
        </forest>
      </forests>
    </data>
  </rpc-reply>
	    ]]></artwork>
	</figure>
</section>
</section>
</back></rfc>
