<?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-02" >
    <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="Wrong Data Type 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 &quot;type&quot; XML attribute to indicate which of two
filter specification types they support, and a &quot;select&quot;
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 &quot;get&#8209;filter&#8209;element&#8209;attributes&quot; 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="Source of Operational Data Unknown">
    <t>
The operational data nodes returned by the
server can sometimes represent server state parameters which
may be derived from different sources.
    </t>
    <t>
For example, an operational node representing 
the current date and time in use on a system
might be derived from the Network Time Protocol (NTP) or
from an action operation to set the current time.
    </t>
    <t>
A list representing a routing entries 
in use in a router might include entries
learned from a routing protocol and entries
statically configured in the running datastore.
    </t>
    <t>
There is a need for standard mechanisms to:
    </t>
<t>
 <list style="symbols">
 <t>
identify data-model specific sources of operational data.
 </t>
 <t>
identify which nodes in a datastore that the server should 
maintain data source information
 </t>
 <t>
allow the client to retrieve the data source information.
 </t>
 </list>
</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>
non-configuration data node: a data node which is not a
configuration data node, i.e. config=false.
 </t>
 <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 data
nodes, as well as list keys for any list data nodes in this datastore.
 </t>
 <t>
operational data node: A data node which is is contained
within the operational datastore. Ancestor
container, list, and key leaf nodes for any nested non-configuration
nodes are only operational data nodes if they are also
non-configuration data nodes.
 </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 &quot;rpc&quot; 
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 &quot;last&#8209;modified&quot;
XML attributes are requested, encoded according to the schema
in <xref target="last-modified"/>.
 </t>
 <t>
with-data-sources: A leaf indicating that &quot;data&#8209;source&quot;
XML attributes are requested, encoded according to the schema
in <xref target="data-source"/>.
 </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 &quot;depth&quot; input parameter for
the &lt;get2&gt; protocol operation.  The default &quot;0&quot; indicates
that all levels from the requested subtrees should be returned.
    </t>
    <t>
A new level is started for each YANG data node
within the requested subtree.
All top level data nodes are considered to be
child nodes (level 1) of a conceptual &lt;config&gt; root.
    </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>
    <t>
If the depth requested is equal to &quot;1&quot;, then only the
requested data nodes (or top-level data nodes) will
be returned.  This mechanism can be used to detect
the existence of containers and list entries within
a particular subtree, without returning any of the
descendant nodes.
    </t>
    <t>
Higher depth values indicates the number of descendant nodes
to include in the response. For example, if the depth 
requested is equal to &quot;2&quot;, then only the
requested data nodes (or top-level data nodes) and
their immediate child data nodes will be returned.
    </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 &quot;if&#8209;modified&#8209;since&quot;
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 &quot;last&#8209;modified&quot; 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 &quot;last&#8209;modified&quot; timestamp
is maintained for a data node, then the server will use
the &quot;last&#8209;modified&quot; timestamp for its nearest ancestor,
or for the datastore itself if there are none.
    </t>
</section>
</section>
<section title="Operational Data Source Reporting">
    <t>
Operational data source reporting is supported
if the server advertises the &quot;data&#8209;source&quot; feature.
    </t>
    <t>
If the &quot;with&#8209;data&#8209;sources&quot; parameter is present in the &lt;get2&gt; request,
and the server supports the &quot;data&#8209;source&quot; feature, then
data source reporting will be done for the applicable nodes.
    </t>
    <t>
An operational data source applies only to operational data nodes,
and only if the &quot;data&#8209;source&quot; YANG extension statement
defined in <xref target="ds-module"/> is 
present in the YANG data definition statement for the data node.
    </t>
    <t>
If the &quot;data&#8209;source&quot; extension applies to a data node, then a server
that implements the &quot;data&#8209;source&quot; feature is expected to 
return the &quot;data&#8209;source&quot; XML attribute for that node.
    </t>
<section title="Identifying Data Sources">
    <t>
Operational data sources are defined with YANG identity statements.
The YANG module in <xref target="ds-module"/> contains the base
identity &quot;data&#8209;sources&quot;, and a few common data sources:
    </t>
<t>
 <list style="symbols">
 <t>
server: normal case: the server instrumentation is the
source of the operational data value.
 </t>
 <t>
running: the operational data value is derived from a
value in the running configuration datastore.
 </t>
 <t>
operation: the operational data value is derived from
a direct or side effect of a client-initiated protocol operation.
 </t>
 <t>
ntp: the operational data value is derived from NTP information
 </t>
 <t>
dns: the operational data value is derived from DNS information
 </t>
 </list>
</t>
    <t>
Other modules can define new data source identities,
such as the &quot;thfp&quot; protocol in the &quot;example&#8209;get2&quot; module.
    </t>
    <t>
The &quot;data&#8209;source&quot; YANG extension is defined in <xref target="ds-module"/>.
It is used within other YANG modules to identify which operational
data nodes should have data source information maintained
by the server.
    </t>
</section>
</section>
<section title="XSD for the &quot;last&#8209;modified&quot; Attribute" anchor="last-modified">
    <t>
The following XML Schema document <xref target="XSD"/> defines 
the &quot;last&#8209;modified&quot; attribute, described within this document.
This XSD is only relevant if the server supports 
the &quot;timestamps&quot; YANG feature within the &quot;ietf&#8209;netconf&#8209;get2&quot;
YANG module.
    </t>
    <t>
The &quot;last&#8209;modified&quot; attribute uses the XSD data type &quot;dateTime&quot;,
in accordance with Section 3.2.7.1 of XML Schema Part 2: Datatypes.
This is equivalent to the YANG data type &quot;date&#8209;and&#8209;time&quot;.
    </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="XSD for the &quot;data&#8209;source&quot; Attribute" anchor="data-source">
    <t>
The following XML Schema document <xref target="XSD"/> defines 
the &quot;data&#8209;source&quot; attribute, described within this document.
This attribute uses the XSD data type &quot;QName&quot;,
in accordance with Section 3.2.18.1 of XML Schema Part 2: Datatypes.
    </t>
    <t>
This is an XML encoding of the YANG &quot;identityref&quot; data type:
    </t>
<t>
 <list style="symbols">
 <t>
the module namespace statement value for
the YANG module containing the identity statement is represented
in the&quot;namespace&#8209;name&quot; part.
 </t>
 <t>
the identity name is represented in the local part.
 </t>
 </list>
</t>
    <t>
&lt;CODE BEGINS&gt; file &quot;data&#8209;source.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:data-source:1.0"
   elementFormDefault="qualified"
   attributeFormDefault="unqualified"
   xml:lang="en">

  <xs:annotation>
    <xs:documentation>
      This schema defines the syntax for the "data-source" attribute
      described within this document.
    </xs:documentation>
  </xs:annotation>

  <!--
    data-source attribute
    -->
  <xs:attribute name="data-source" type="xs:QName">
    <xs:annotation>
      <xs:documentation>
        This attribute indicates the identity statement
        for the configuration source for the 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="data-source YANG Module" anchor="ds-module">
    <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-data-source@2012-10-09.yang"</t>
	<figure>
	    <artwork><![CDATA[
module ietf-netconf-data-source {

  namespace "urn:ietf:params:xml:ns:yang:ietf-netconf-data-source";
  prefix datasrc;

  organization
    "IETF NETCONF (Network Configuration Protocol) 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
     identifying the data source of operational data nodes.

     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-02.txt

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

  /* Extensions */ 

  extension data-source {
    description
      "This extension indicates that the data node containing it
       is expected to support the 'data-source' XML attribute
       in replies for the <get2> operation.

       This extension is ignored if it is not within a YANG
       data definition statement for an operational data node.";
  }

  /* Identities */

  identity data-sources {
    description 
      "Base identity for all data sources.";
  }

  identity server {
    base data-sources;
    description 
      "Indicates the server instrumentation as the data source.";
  }

  identity running {
    base data-sources;
    description 
      "Indicates the running datastore as the data source.";
  }

  identity operation {
    base data-sources;
    description 
      "Indicates a client-initiated protocol operation as
       the data source.";
  }

  identity ntp {
    base data-sources;
    description 
      "Indicates the NTP protocol as the data source.";
    reference 
      "RFC 5905: Network Time Protocol Version 4: 
       Protocol and Algorithms Specification";
  }

  identity dns {
    base data-sources;
    description 
      "Indicates the DNS protocol as the data source.";
    // reference TBD
  }

}
	    ]]></artwork>
	</figure>
<t>&lt;CODE ENDS></t>
</section>
<section title="&lt;get2&gt; YANG Module" anchor="module">
    <t>
This module imports the &quot;with&#8209;defaults&#8209;parameters&quot; 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-10-09.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 NETCONF (Network Configuration Protocol) 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-02.txt

  // RFC Ed.: update the date below with the date of RFC publication
  // and remove this note.
  revision "2012-10-09" {
    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 data-sources {
    description
      "This feature indicates that the server supports the
       'with-data-sources' parameter for the <get2> operation.
       A NETCONF server SHOULD support this feature.";
    reference
      "RFC XXXX: The NETCONF <get2> Operation";
  }

  /* 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 subtree-filter {
          description
            "This parameter identifies the portions of the
             target datastore to retrieve.";
          reference "RFC 6241, Section 6.";
        }
        leaf xpath-filter {
          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.";
      }

      leaf with-data-sources {
        if-feature data-sources;
        when "../source/operational";
        type empty;
        description
          "This parameter will cause the server to return
           XML attributes identifying the operational
           data sources for elements within the
           <rpc-reply> that support the 'data-source'
           YANG extension statement.";
        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
2 registrations are requested to be made.
    </t>
	<figure>
	    <artwork><![CDATA[
     URI: urn:ietf:params:xml:ns:yang:ietf-netconf-data-source
     Registrant Contact: The NETCONF WG of the IETF.
     XML: N/A, the requested URI is an XML namespace.

     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 2 YANG modules in the YANG Module Names
registry <xref target="RFC6020"/>.
    </t>
	<figure>
	    <artwork><![CDATA[
  name:         ietf-netconf-data-source
  namespace:    urn:ietf:params:xml:ns:yang:ietf-netconf-data-source
  prefix:       cfgsrc
  reference:    RFC XXXX

  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>
<section title="Change Log">
	<figure>
	    <artwork><![CDATA[
    -- RFC Ed.: remove this section before publication.  
	    ]]></artwork>
	</figure>
<section title="00-01">
<t>
 <list style="symbols">
 <t>
removed subtree-filter YANG feature
 </t>
 <t>
changed depth filter to exactly match the XML layering
 </t>
 <t>
renamed filter to subtree-filter
 </t>
 <t>
renamed select to xpath-filter
 </t>
 <t>
added some new examples
 </t>
 </list>
</t>
</section>
<section title="01-02">
<t>
 <list style="symbols">
 <t>
added operational data source support
 </t>
 <t>
added &apos;ietf&#8209;netconf&#8209;data&#8209;source&apos; module
 </t>
 <t>
clarified terminology
 </t>
 </list>
</t>
</section>
</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>

  <reference anchor="I-D.ietf-netmod-system-mgmt">
    <front>
      <title>YANG Data Model for System Management</title>
      <author initials="A." surname="Bierman" fullname="A. Bierman">
        <organization>YumaWorks</organization>
      </author>
      <author initials="B." surname="Bjorklund" fullname="M. Bjorklund">
        <organization>Tail-f Systems</organization>
      </author>
      <date year="2012" month="September"/>
    </front>
    <seriesInfo name="Internet-Draft"
                value="draft-ietf-netmod-system-mgmt-03"/>
    <format type='TXT'
      target='http://www.ietf.org/internet-drafts/draft-ietf-netmod-system-mgmt-03.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;

  import ietf-netconf-data-source { prefix datasrc; }

  revision 2012-10-09;

  identity thfp {
    base datasrc:data-sources;
    description
      "The Tree Height Finder Protocol is 
       the source of the operational data.";
  }

  identity manual {
    base datasrc:data-sources;
    description
      "The height was derived manually by on-site 
        measurement crews.";
  }

  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 {
            datasrc:data-source;

            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>
    <t>
The forests and trees are configured, which represent
trees the company has planted and growing over time.
    </t>
    <t>
The operational data (tree height) represents the
data that the company monitors for each tree over time.
    </t>
    <t>
There are 2 operational data sources for tree height data
in this example:
    </t>
<t>
 <list style="symbols">
 <t>
thfp: Tree Height Finder Protocol
 </t>
 <t>
manual: Manual measurement by work crews
 </t>
 </list>
</t>
    <t>
The north forest was measured with the mythical
Tree Height Finder protocol and the south forest
was measured manually.
    </t>
</section>
<section title="Example: Operational Datastore">
    <t>
This example simply retrieves the &quot;forests&quot; 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>
      <subtree-filter>
        <forests xmlns="http://example.com/ns/example-get2" />
      </subtree-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 &quot;2012&#8209;09&#8209;09T01:43:27Z&quot; because the
forest named &quot;north&quot; was modified at this time.
    </t>
<t>
 <list style="symbols">
 <t>
The forest named &quot;north&quot; was last modified after
the specified &quot;if&#8209;modified&#8209;since&quot; timestamp.
 </t>
 <t>
The forest named &quot;south&quot; was last modified before
the specified &quot;if&#8209;modified&#8209;since&quot; timestamp.
 </t>
 <t>
The server maintains a last-modified timestamp for
the running datastore and the &quot;forest&quot; 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 &quot;forest&quot; subtree is modified
then this timestamp will be updated.
 </t>
 </list>
</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">
      <subtree-filter>
        <forests xmlns="http://example.com/ns/example-get2" />
      </subtree-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>
      </forests>
    </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.
    </t>
<t>
 <list style="symbols">
 <t>
No &quot;forest&quot; list entry has been modified since
this time so an empty data node is returned.
 </t>
 <t>
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>
 </list>
</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">
      <subtree-filter>
        <forests xmlns="http://example.com/ns/example-get2" />
      </subtree-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 &quot;forests&quot; subtree in the running
datastore.
    </t>
<t>
 <list style="symbols">
 <t>
The default source (running) is used.
 </t>
 <t>
The default depth=&quot;0&quot; is used to retrieve all subtree
levels.
 </t>
 <t>
The xpath-filter is used instead of the subtree-filter
 </t>
 <t>
Whitespace added to xpath-filter element for display
purposes only
 </t>
 </list>
</t>
	<figure>
	    <artwork><![CDATA[
  <rpc message-id="104"
    xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <get2 xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-get2">
      <xpath-filter xmlns:ex=http://example.com/ns/example-get2">
        /ex:forests
      </xpath-filter>
      <keys-only />
    </get2>
  </rpc>

  <rpc-reply message-id="104"
    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: Testing for Node Existence with Depth=1">
    <t>
This example retrieves the &quot;trees&quot; node to determine
which forests have any trees.
    </t>
<t>
 <list style="symbols">
 <t>
Only 1 subtree level is requested,
instead of the default of all levels.
 </t>
 <t>
The default source (running) is used.
 </t>
 <t>
The depth parameter is set to &quot;1&quot; to only retrieve
the requested layer (trees) and its ancestor nodes
and the configuration leaf nodes from each &quot;forest&quot; entry.
 </t>
 </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">
      <subtree-filter>
        <forests xmlns="http://example.com/ns/example-get2">
          <forest>
            <trees />
          </forest>
        </forests>
      </subtree-filter>
      <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>
          <trees />
        </forest>
        <forest>
          <name>south</name>
          <trees />
        </forest>
      </forests>
    </data>
  </rpc-reply>
	    ]]></artwork>
	</figure>
</section>
<section title="Example: Keys Only Filter Retrieval with Depth=3">
    <t>
This example retrieves the names-only
from the &quot;forest&quot; list within the &quot;forests&quot; subtree, in the running
datastore.  
    </t>
<t>
 <list style="symbols">
 <t>
Only 3 subtree levels are requested,
instead of the default of all levels.
 </t>
 <t>
The default source (running) is used.
 </t>
 <t>
The depth parameter is set to &quot;3&quot; to only retrieve
the requested layer (forests), its child nodes (forest),
and the key leaf nodes from each &quot;forest&quot; entry.
Without the &quot;keys&#8209;only&quot; parameter, other leafs from the &quot;forest&quot; list
would be returned as well.
 </t>
 </list>
</t>
	<figure>
	    <artwork><![CDATA[
  <rpc message-id="106"
    xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <get2 xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-get2">
      <subtree-filter>
        <forests xmlns="http://example.com/ns/example-get2" />
      </subtree-filter>
      <keys-only />
      <depth>3</depth>
    </get2>
  </rpc>

  <rpc-reply message-id="106"
    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 title="Example: Operational Data Sources (tree height)">
    <t>
This example simply retrieves the &quot;forests&quot; subtree
data from the operational datastore, but requesting
that data-source XML attributes be added as required
in the reply.
    </t>
	<figure>
	    <artwork><![CDATA[
  <rpc message-id="107"
    xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <get2 xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-get2">
      <source>
        <operational />
      </source>
      <subtree-filter>
        <forests xmlns="http://example.com/ns/example-get2" />
      </subtree-filter>
      <with-data-sources />
    </get2>
  </rpc>

  <rpc-reply message-id="107"
    xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"
    xmlns:ds="urn:ietf:params:xml:ns:netconf:data-source:1.0">
    <data xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-get2">
      <forests xmlns="http://example.com/ns/example-get2"
        xmlns:ex="http://example.com/ns/example-get2">
        <forest>
          <name>north</name>
          <tree-count>3</tree-count>
          <trees>
            <tree>
              <name>birch</name>
              <height ds:data-source="ex:thfp">41.013</height>
            </tree>
            <tree>
              <name>ash</name>
              <height ds:data-source="ex:thfp">16.523</height>
            </tree>
            <tree>
              <name ds:data-source="ex:thfp">maple</name>
              <height>51.204</height>
            </tree>
          </trees>
        </forest>
        <forest>
          <name>south</name>
          <tree-count>2</tree-count>
          <trees>
            <tree>
              <name>banyan</name>
              <height ds:data-source="ex:manual">91.433</height>
            </tree>
            <tree>
              <name>palm</name>
              <height ds:data-source="ex:manual">83.439</height>
            </tree>
          </trees>
        </forest>
      </forests>
    </data>
  </rpc-reply>
	    ]]></artwork>
	</figure>
</section>
<section title="Example: Operational Data Sources (ietf-system)">
    <t>
This example shows how the data-source reporting
can be used with a real YANG module.
The ietf-system module defined in <xref target="I-D.ietf-netmod-system-mgmt"/>
contains an operational data node called &quot;current&#8209;datetime&quot;.
The data source for this node can either be NTP or the
&quot;set&#8209;current&#8209;datetime&quot; operation defined in the module.
    </t>
    <t>
To implement data source reporting, the &quot;data&#8209;source&quot;
extension needs to added to the &quot;current&#8209;datetime&quot; leaf
as follows:
    </t>
	<figure>
	    <artwork><![CDATA[
   leaf current-datetime {
      datasrc:data-source;
      type yang:date-and-time;
      config false;
      description
        "The current system date and time.";
   }
	    ]]></artwork>
	</figure>
    <t>
The following example shows the retrieval of the
&quot;current&#8209;datetime&quot; leaf if the data source is NTP.
The extra whitespace shown for the &quot;current&#8209;datetime&quot; leaf
is for display purposes only.
    </t>
	<figure>
	    <artwork><![CDATA[
  <rpc message-id="108"
    xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <get2 xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-get2">
      <source>
        <operational />
      </source>
      <subtree-filter>
        <system xmlns="urn:ietf:params:xml:ns:yang:ietf-system">
          <clock>
            <current-datetime />
          </clock>
        </system>
      </subtree-filter>
      <with-data-sources />
    </get2>
  </rpc>

  <rpc-reply message-id="108"
    xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"
    xmlns:ds="urn:ietf:params:xml:ns:netconf:data-source:1.0">
    <data xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-get2">
      <system xmlns="urn:ietf:params:xml:ns:yang:ietf-system">
        <clock>
          <current-datetime ds:data-source="ds:ntp">
            2012-09-09T01:11:27Z
          </current-datetime>
        </clock>
      </system>
    </data>
  </rpc-reply>
	    ]]></artwork>
	</figure>
    <t>
The following example shows the retrieval of the
&quot;current&#8209;datetime&quot; leaf if the data source is the
&quot;set&#8209;current&#8209;datetime&quot; operation. The extra whitespace
shown for the &quot;current&#8209;datetime&quot; leaf is for display 
purposes only.
    </t>
	<figure>
	    <artwork><![CDATA[
  <rpc message-id="109"
    xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <get2 xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-get2">
      <source>
        <operational />
      </source>
      <subtree-filter>
        <system xmlns="urn:ietf:params:xml:ns:yang:ietf-system">
          <clock>
            <current-datetime />
          </clock>
        </system>
      </subtree-filter>
      <with-data-sources />
    </get2>
  </rpc>

  <rpc-reply message-id="109"
    xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"
    xmlns:ds="urn:ietf:params:xml:ns:netconf:data-source:1.0">
    <data xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-get2">
      <system xmlns="urn:ietf:params:xml:ns:yang:ietf-system">
        <clock>
          <current-datetime ds:data-source="ds:operation">
            2012-09-09T01:11:27Z
          </current-datetime>
        </clock>
      </system>
    </data>
  </rpc-reply>
	    ]]></artwork>
	</figure>
</section>
</section>
</back></rfc>
