<?xml version="1.0" encoding="US-ASCII"?>
<!-- This template is for creating an Internet Draft using xml2rfc,
     which is available here: http://xml.resource.org. -->
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!-- One method to get references from the online citation libraries.
     There has to be one entity for each item to be referenced. 
     An alternate method (rfc include) is described in the references. -->
]>
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<!-- used by XSLT processors -->
<!-- For a complete list and description of processing instructions (PIs), 
     please see http://xml.resource.org/authoring/README.html. -->
<!-- Below are generally applicable Processing Instructions (PIs) that most I-Ds might want to use.
     (Here they are set differently than their defaults in xml2rfc v1.32) -->
<?rfc strict="yes" ?>
<!-- give errors regarding ID-nits and DTD validation -->
<!-- control the table of contents (ToC) -->
<?rfc toc="yes"?>
<!-- generate a ToC -->
<?rfc tocdepth="4"?>
<!-- the number of levels of subsections in ToC. default: 3 -->
<!-- control references -->
<?rfc symrefs="yes"?>
<!-- use symbolic references tags, i.e, [RFC2119] instead of [1] -->
<?rfc sortrefs="yes" ?>
<!-- sort the reference entries alphabetically -->
<!-- control vertical white space 
     (using these PIs as follows is recommended by the RFC Editor) -->
<?rfc compact="yes" ?>
<!-- do not start each main section on a new page -->
<?rfc subcompact="no" ?>
<!-- keep one blank line between list items -->
<!-- end of list of popular I-D processing instructions -->
<rfc category="std" docName="draft-wilton-netconf-opstate-metadata-00" ipr="trust200902">
    <!-- category values: std, bcp, info, exp, and historic
     ipr values: full3667, noModification3667, noDerivatives3667
     you can add the attributes updates="NNNN" and obsoletes="NNNN" 
     they will automatically be output with "(if approved)" -->
    <!-- ***** FRONT MATTER ***** -->
    <front>
        <!-- The abbreviated title is used in the page header - it is only necessary if the 
         full title is longer than 39 characters -->
        <title abbrev="Datastores with Metadata">Refined YANG datastores with Meta-data</title>
        <!-- add 'role="editor"' below for the editors if appropriate -->
        <!-- Another author who claims to be an editor -->
        <author fullname="Robert Wilton" initials="R.G." role="editor" surname="Wilton">
            <organization>Cisco Systems</organization>
            <address>
                <email>rwilton@cisco.com</email>
                <!-- uri and facsimile elements may also be added -->
            </address>
        </author>
        <!-- uri and facsimile elements may also be added -->
        <date month="July" year="2016"/>
        <!-- If the month and year are both specified and are the current ones, xml2rfc will fill 
         in the current day for you. If only the current year is specified, xml2rfc will fill 
	 in the current day and month for you. If the year is not the current one, it is 
	 necessary to specify at least a month (xml2rfc assumes day="1" if not specified for the 
	 purpose of calculating the expiry date).  With drafts it is normally sufficient to 
	 specify just the year. -->
        <!-- Meta-data Declarations -->
        <area>General</area>
        <workgroup>Internet Engineering Task Force</workgroup>
        <!-- WG name at the upperleft corner of the doc,
         IETF is fine for individual submissions.  
	 If this element is not present, the default is "Network Working Group",
         which is used by the RFC Editor as a nod to the history of the IETF. -->
        <keyword>template</keyword>
        <!-- Keywords will be incorporated into HTML output
         files in a meta tag but they have no effect on text or nroff
         output. If you submit your draft to the RFC Editor, the
         keywords will be used for the search engine. -->
        <abstract>
            <t>draft-wilton-netmod-refined-datastores defines refined YANG datastore definitions to provide an explicit Operational State Datastore and a clean separation between the 'intended configuration' for a device and the 'applied configuration' that is in effect on a device.  This draft builds on draft-wilton-netmod-refined-datastores by describing a YANG Metadata based extension that can be used by protocols such as NETCONF and RESTCONF to allow the key information from the various operational state related datatstores to be made available without requiring the client to explicitly read and monitor each abstract datastore separately.</t>
        </abstract>
    </front>
    <middle>
    <section title="Introduction">
        <t>This document describes an optional extension to NETCONF/RESTCONF, based on <xref target="RFC6243">With-defaults Capability for NETCONF</xref>, and <xref target="I-D.ietf-netmod-yang-metadata">Metadata with YANG</xref>, that allow servers to communicate the content of the Applied Configuration Abstract Datastore and Operational State Datastore defined in <xref target="I-D.wilton-netmod-refined-datastores"/> to clients in an efficient way.</t>
        <t>Operator requirements state that there needs to be a clear separation between the configuration that has been sent to the device and the actual configuration that the device is actually acting on.</t>
        <t>For some simple 'opstate unware' devices, if it is sufficient to assume that the configuration is applied instantaneously and also that none of the configuration can fail, then the intended and applied configuration can be regarded as being exactly the same, and a formal split between intended and applied configuration is unnecessary.</t>
        <t>For other more complex 'opstate aware' devices, the assumptions above do not always hold: Devices may take several minutes (or even tens of minutes) to apply the configuration, some of the configuration may fail, or it may not be possible to apply some of the configuration due to either insufficient resources or due to a requisite piece of hardware not being present in the device.</t>
        <t>This extension is primarily aimed at this latter class of opstate aware devices, but to improve interoperability it is anticipated that it could also fairly easily be implemented on opstate unaware devices as well.</t>
        <t>The extension uses YANG Metadata to allow a client to quickly determine whether the configuration has or has not been successfully applied.  Semantically, this is similar to performing a "diff" between two related configuration datastores, but with the content of the diff returned relative to one of those datastores.</t>        
        <section title="Definitions" anchor="definitions">
            <t>Definitions of the following terms are taken from <xref target="I-D.wilton-netmod-refined-datastores"/>:
                <list>
                    <t>opstate aware device - a device that implements the requirements specified in <xref target="I-D.ietf-netmod-opstate-reqs"/>, in particular the device must expose the split between the device's 'intended configuration' vs 'applied configuration'.</t>
                    <t>opstate unaware device - a device that is not an 'opstate aware device'. In particular, it does not draw a clear distinction between 'intended configuration' vs 'applied configuration', and generally treats them as having exactly the same contents.</t>
                    <t>abstract datastore - a new variant of YANG datastore that represents a particular common property of the contents (e.g. 'applied configuration').  Servers could allow it to be external referenced as a named datastore, but generally that is not expected or required.</t>
                </list>
            </t>
            <t>The following datastore definitions are taken from <xref target="RFC6241">NETCONF</xref>:
                <list style="symbols">
                    <t>candidate ds - represents candidate configuration</t>
                    <t>startup ds - represents startup configuration</t>
                </list>
            </t>
            <t>The following datastore definitions are taken from <xref target="I-D.wilton-netmod-refined-datastores"/>:
                <list style="symbols">
                     <t>Persistent Configuration - holds the client provided configuration that is written to the Startup Datastore and is recovered after device reboot.</t>
                     <t>Ephemeral Configuration - an optional datastore that holds client provided transient configuration that is discarded after device reboot.</t>
                     <t>Operational State - a read-only datastore that holds all of the operational state of the device.  Specifically it holds: the exact configuration that has been applied, along with any system controlled configuration, and all system state (including statistics and any ephemeral state).</t>
                     <t>Intended Configuration - abstractly represents the combined desired configuration of the device</t>
                     <t>Applied Configuration - abstractly represents the actual applied configuration of the device</t>
                     <t>Running Configuration - abstractly represents the combined intended and applied datastores, logically equivalent to the definition given in <xref target="RFC6241"/></t>
                </list>
            </t>
        </section>
         <section title="Objectives">
            <t>The objectives of this draft are:
                <list>
                    <t>to minimize the number of explicit datastores that NETCONF/RESTCONF servers must implement and clients must manage, whilst providing a clean separation between intended configuration, applied configuration, and operational state.</t>
                    <t>to provide an efficient mechanism to query and monitor whether all of the intended configuration has been applied, and view any configuration that has not been applied.</t>
                    <t>to provide an efficient mechanism to query and monitor the operational state of the device.</t>
                </list>
            </t>
        </section>
        <section title="Overview of a refined model of datastores" anchor="datastores_figure">
            <t>The following diagram, taken from <xref target="I-D.wilton-netmod-refined-datastores"/>, illustrates how all of the abstract and concrete datastores (except running) relate to each other:</t>
            <figure>
                <artwork>
                    <![CDATA[
   +-------------+                  +-----------+
   | <candidate> |                  | <startup> |
   |  (ct, rw)   |<---+        +--->| (ct, rw)  |
   +-------------+    |        |    +-----------+
          |           |        |          |
          |      .....|........|........  |
          |      . +-----------------+ .  |
          +------->|<persistent cfg> |<---+
                 . | (ct, rw)        | . 
   Intended      . +-----------------+ .
    Config   ==> .         v           .
   Datastore     . +-----------------+ .
   (abstract)    . |<ephemeral cfg>  |<--- Can override persistent
                 . | (ct, rw)        | .   cfg. Optional
                 . +-----------------+ .
                 ..........|............
                           |         
                 +---------v-----------+		 
                 | ................... |
                 | . <applied cfg>   .<--- Actual cfg in effect
  Operational    | . (ct, ro)        . |
     State   ==> | ................... |
   Datastore     |         +           |
                 |    system cfg      <--- System created config
                 |         +           |
                 |    system state    <--- All config false nodes
                 +---------------------+

 Key
 Solid boxes (-----) indicate normal datastores:
   (i.e Startup, Persistent Cfg, Ephemeral Cfg, Operational State)
   
 Dotted boxes (.....) indicate abstract datastores:
   (i.e. Intended Config and Applied Config)
   
 ct = config true, rw = read/write, ro = read/only
      ]]>
                </artwork>
            </figure>
            </section>
        </section>
    <section title="Applied Configuration Metadata Option to NETCONF and RESTCONF">
        <t>The applied configuration metadata option is an optional extension to NETCONF/RESTCONF, loosely based on <xref target="RFC6243">With-defaults Capability for NETCONF</xref>, that uses <xref target="I-D.ietf-netmod-yang-metadata">YANG Metadata</xref> to annotate the Persistent Configuration, Ephemeral Configuration, Operational State, or Running Configuration Datastores with additional metadata that partially reflects the contents of the abstract datastores illustrated in <xref target="datastores_figure"/>.</t>
        <t>Principally, the metadata annotations allow the client to see whether the configuration has been applied or failed; the reason for the failure if it has failed; or whether the configuration node only exists because it has been created by the system.  This is achieved without the client having to query or explicitly monitor any of the extra abstract datastores.</t>
        <section title="'with-applied-config-metadata' modes query parameter" anchor="config_modes">
            <t>The 'with-applied-config-metadata' option supports further refinement of the nodes and metadata that is returned through a query parameter that supports three modes.</t>
                <section title="selectively-annotate">
                    <t>For a given NETCONF/RESTCONF query, the 'selectively-annotate' option returns all the nodes what would have been returned for that query anyway, but with additional metadata annotations for any nodes in the request datastore that differ from the equivalent node in the applied configuration datastore (i.e. it would exclude metadata annotations for nodes that would be reported as "cfg-status=applied").</t>
                    <t>This is the default option and MUST be supported by all servers implementing the with-applied-config option.</t>
                    <t>This option allows a client to both monitor the exact configuration that the device is trying to converge to, and also the status of whether that configuration has been applied. This is achieved in a way that uses a single request, and in the context of a single datastore.  In the case that the applied configuration exactly matches the intended configuration then clearly no additional metadata annotations are returned.</t>
                </section>
                <section title="annotate-all">
                    <t>For a given NETCONF/RESTCONF query, the 'annotate-all' option returns all the nodes what would have been returned for that query anyway, but with opstate metadata annotations for all nodes that are returned.  I.e. this is the same data that would be returned using the 'selectively-annotate' option except that it also includes metadata for nodes that are reported as "cfg-status=applied".</t>
                    <t>This option MAY be supported by servers implementing the opstate metadata option.  It may be useful for clients that prefer explicit applied configuration annotations for every node.</t>
                </section>
                <section title="annotated-diff">
                    <t>For a given NETCONF/RESTCONF query, the 'annotated-diff' option filters the nodes returned in the standard query, so that only nodes that are not reported as "cfg-status=applied" are returned.  Applied configuration metadata annotations are included for all nodes that are returned.</t>
                    <t>This option makes it easy for clients to determine whether their configuration is fully applied in a concise way and SHOULD be supported by all servers implementing the with-applied-config option.</t>
                </section>
        </section>
        <section title="Datastore specific handling">
        <t>The Applied Configuration Metadata could be used with any of following configuration datastores (persistent, ephemeral, intended, applied, running), or the Operational State Datastore.  However, not all values of the "cfg-status" make sense for all datastores, so the values that may be used for particular datastores are restricted as follows:
        <list>
        <t>Persistent Cfg Ds - applying, applied, applied-deviation, overridden, blocked, failed</t>
        <t>Ephemeral Cfg Ds - applying, applied, applied-deviation, overridden, blocked, failed</t>
        <t>Intended Cfg Ds - applying, applied, applied-deviation, blocked, failed</t>
        <t>Applied Cfg Ds - applying, applied, applied-deviation, failed</t>
        <t>Operational State Ds - applying, applied, applied-deviation, system-controlled, failed</t>
        </list></t>
        <t>If the Running Configuration Datastore is handled as described in <xref target="I-D.wilton-netmod-refined-datastores"/>, then NETCONF &lt;get&gt; requests are handled as if they are against the Operational State Datastore, and &lt;get-config&gt; requests are handled as if they are made against the Intended Configuration Datastore, which indicates which metadata values can be used.</t>
        </section>
        <section title="Applied Configuration Metadata YANG Definition">
            <t>Defines the applied configuration datastore metadata that is used in both NETCONF and RESTCONF</t>
            <figure>
                <artwork>
                        <![CDATA[
<CODE BEGINS> file "ietf-yang-opstate-metadata@2016-07-06.yang"
module ietf-yang-opstate-metadata {
  namespace
    "urn:ietf:params:xml:ns:yang:ietf-yang-opstate-metadata";

  prefix "opstate";
  
  import ietf-yang-metadata {
    prefix "md";
  }
  
  organization
    "IETF NETCONF (Network Configuration Protocol) Working Group";

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

     WG List:  <netconf@ietf.org>

     WG Chair: Mahesh Jethanandani
               <mjethanandani@gmail.com>

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

     Editor:   Robert Wilton
               <rwilton@cisco.com>";

  description
    "This module defines YANG metadata to allow the reason why
     a config true node exists in the operational state datastore
     to be determined using YANG metadata. 
     
     Copyright (c) 2016 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
     draft-wilton-netconf-opstate-metadata-00; see the Internet
     draft itself for full legal notices.";

  revision 2016-07-06 {
    description "Initial revision";
    
    reference
      "Internet draft: draft-wilton-netconf-opstate-metadata-00";
  }
    
  md:annotation cfg-status {
    type enumeration {
      enum applying {
        description
          "The configuration for the annotated node is currently
           changing (i.e. being created, deleted or changing in
           value) as part of an ongoing configuration operation";
      }
      enum applied {
        description
          "The configuration is fully applied.  The node exists in
           both the intended and applied datastores and has exactly
           the same value in both.";
      }
      enum applied-deviation {
        description
          "The configuration has been applied to the extend the
           server is able to, but the value in the applied
           configuration datastore does not exactly match the value
           in the intended configuration datastore.";
      }
      enum overridden {
        description
          "The configuration node value has been overridden by the
           same node in another configuration datastore.";
      }
      enum system-controlled {
        description
          "The configuration node only exists in the Operational
           State Datastore because it is system controlled. It is
           not present in the abstract applied configuration
           datastore.";
      }
      enum blocked {
        description
          "The system cannot apply the configuration because
           the required hardware resources are not present.  The
           configuration node does not exist in the applied
           configuration datastore.";
      }
      enum failed {
        description
          "The system cannot apply the configuration due to an
           error.  The configuration node does not exist in the
           applied configuration datastore.";
      }
    }
    description
      "Status indicates why a configuration node (i.e. config=true)
       in the operational-state datastore does not match the
       corresponding node in the intended config datastore";
  }

  md:annotation cfg-status-reason {
    when "../status = 'blocked' or ../status = 'failed'" {
      description
        "An optional status reason can be provided for blocked or
         failed configuration";
    }
    type string;
    description
      "Indicates the reason why the applied configuration node is
       blocked or failed";
  }  
}
<CODE ENDS>
]]>
                </artwork>
            </figure>
        </section>
        <section title=":with-applied-cfg-metadata Capability">
           <t>The :with-applied-cfg-metadata capability for NETCONF and RESTCONF indicates that the server is capable of returning applied configuration metadata.</t>
           <section title="Capability Identifier">
               <t>Equivalent capabilities are defined for both NETCONF and RESTCONF:
                   <list>
                       <t>NETCONF: urn:ietf:params:netconf:capability:with-applied-cfg-metadata:1.0</t>
                       <t>RESTCONF: urn:ietf:params:restconf:capability:with-applied-cfg-metadata:1.0</t>
                   </list>
               </t>
               <t>Note that this protocol capability URI is separate from the YANG module capability URI for the YANG module is Section XXX.  A server that implements this module MUST also advertise a YANG module capability URI according to the rules specified in <xref target="RFC6020"/>.</t>
               <section title="datastore parameter">
               <t>The identifier MUST have a parameter: "supported-datastores".  This indicates which datastores the server allows the :with-applied-cfg-metadata option to be used on.</t>
               <t>The datastores that may be supported are described in <xref target="definitions" />.  The allowed values of this parameter include 'persistent', 'ephemeral', 'opstate', 'running', and any other appropriate configuration datastores supported by the server.  Both 'persistent' and 'operational state' datastores MUST be supported.</t>
               </section>
               <section title="supported-modes parameter">
               <t>The identifier MUST also have the parameter: "supported-modes". This indicates which particular operations are supported.</t>
               <t>Possible modes are 'selectively-annotate', 'annotate-all', and 'annotated-diff' as defined in <xref target="config_modes" />.  The 'selectively-annotate' option MUST be supported, and the 'annotated-diff' option SHOULD be supported.</t>
               </section>
               <section title="Examples">
               <t>NETCONF and RESTCONF capability examples:
                   <list>
                       <t>urn:ietf:params:netconf:capability:with-applied-cfg-metadata:1.0?supported-datastores=persistent,intended&amp;supported-modes=selectively-annotate</t>
                       <t>urn:ietf:params:restconf:capability:with-applied-cfg-metadata:1.0?supported-datastores=running&amp;supported-modes=selectively-annotate,annotated-diff</t>
                   </list>
               </t>
               </section>
           </section>
        </section>
        <section title="NETCONF specifics">
        <t>Further details for the &lt;with-applied-config-metadata&gt; option need to still be fleshed out here:
        <list>
          <t>The option would only be supported for NETCONF &lt;get&gt; and &lt;get-config&gt; requests.</t>
          <t>NETCONF would need to add support for the new datastores (as least "persistent", "opstate").</t>
        </list>
        </t>
        </section>
        <section title="RESTCONF specifics">
        <t>Further details for the &lt;with-applied-config-metadata&gt; option need to still be fleshed out here:
        <list>
          <t>The option would only be supported for RESTCONF GET requests.</t>
          <t>The option could be used when accessing the default combined datastore view, or with new datastore specific REST paths (e.g. as least "persistent", "opstate").</t>
        </list>
        </t>
        </section>
    </section>
    <section title="Discussion Points">
        <t>This section lists some points that may warrant further discussion:
        <list>
        <t>The proposal is written in terms of NETCONF/RESTCONF "get" requests but it is desirable if the metadata could also apply to YANG Pub/Sub as well.</t>
        <t>Should the extension target adding opstate specific metadata, or is it just applied configuration metadata?</t>
        <t>The proposed YANG model merges several different opstate properties into a single 'cfg-status' leaf, possibly these could be separated out into separate leaves.</t>
        <t>One of the aims of the approach described in <xref target="I-D.wilton-netmod-refined-datastores"/> and in this document is to allow opstate unaware servers to fairly easily add basic support for the operational state extensions.  This provides an opportunity to improve interoperability with NETCONF/RESTCONF clients because they can treat opstate aware and opstate aware servers in exactly the same way.  Does the approach in this draft achieve this goal?</t>
        </list>
        </t>
    </section>
        
    <!-- This PI places the pagebreak correctly (before the section title) in the text output. -->
    <?rfc needLines="8" ?>
    <section anchor="Acknowledgements" title="Acknowledgements">
        <t>This document arose through discussions to find a consensual solution to the operational state problem.  The following people were actively involved in the discussions that indirectly led to this document:
            <list style="symbols">
                <t>Lou Berger, Labn Consulting, &lt;lberger@labn.net&gt;</t>
                <t>Martin Bjorklund, Tail-f Systems, &lt;mbj@tail-f.com&gt;</t>
                <t>Christian Hopps, Deutsche Telekom, &lt;chopps@chopps.org&gt;</t>
                <t>Acee Lindem, Cisco Systems, &lt;acee@cisco.com&gt;</t>
                <t>Juergen Schoenwaelder, Jacobs University Bremen &lt;j.schoenwaelder@jacobs-university.de&gt;</t>
                <t>Rob Shakir, Jive Communications, &lt;rjs@rob.sh&gt;</t>
                <t>Kent Watsen, Juniper Networks, &lt;kwatsen@juniper.net&gt;</t>
            </list>
        </t>
        <t>The author would also like the thank the following people who have kindly provided feedback on this draft: Matt Hall, Einar Nilsen-Nygaard.</t>
    </section>
    <!-- Possibly a 'Contributors' section ... -->
    <section anchor="IANA" title="IANA Considerations">
        <t>None</t>
        <!--      <t>All drafts are required to have an IANA considerations section (see
      <xref target="I-D.narten-iana-considerations-rfc2434bis">the update of
      RFC 2434</xref> for a guide). If the draft does not require IANA to do
      anything, the section contains an explicit statement that this is the
      case (as above). If there are no requirements for IANA, the section will
      be removed during conversion into an RFC by the RFC Editor.</t>-->
    </section>
    <section anchor="Security" title="Security Considerations">
        <t>TBD.</t>
    </section>
</middle>
<!--  *****BACK MATTER ***** -->
<back>
    <!-- References split into informative and normative -->
    <!-- There are 2 ways to insert reference entries from the citation libraries:
     1. define an ENTITY at the top, and use "ampersand character"RFC2629; here (as shown)
     2. simply use a PI "less than character"?rfc include="reference.RFC.2119.xml"?> here
        (for I-Ds: include="reference.I-D.narten-iana-considerations-rfc2434bis.xml")

     Both are cited textually in the same manner: by using xref elements.
     If you use the PI option, xml2rfc will, by default, try to find included files in the same
     directory as the including file. You can also define the XML_LIBRARY environment variable
     with a value containing a set of directories to search.  These can be either in the local
     filing system or remote ones accessed by http (http://domain/dir/... ).-->
    <references title="Normative References">
        <?rfc include="reference.RFC.6020.xml"?>
        <?rfc include="reference.RFC.6241.xml"?> 
        <?rfc include="reference.RFC.7223.xml"?>
        <?rfc include="reference.I-D.ietf-netmod-opstate-reqs.xml"?>
    </references>
    <references title="Informative References">
        <?rfc include="reference.RFC.6242.xml"?>
        <?rfc include="reference.RFC.6243.xml"?>
        <?rfc include="reference.RFC.6244.xml"?>
        <?rfc include="reference.I-D.ietf-netmod-yang-metadata.xml"?>
        <?rfc include="reference.I-D.schoenw-netmod-revised-datastores.xml"?>
        <?rfc include="reference.I-D.wilton-netmod-refined-datastores.xml"?>
        <?rfc include="reference.I-D.ietf-i2rs-ephemeral-state.xml"?>
    </references>
    <!--    <section anchor="app-additional" title="Additional Stuff">
      <t>This becomes an Appendix.</t>
    </section>-->
  <section anchor="Examples" title="Usage examples">
  <t>A sample encoding of the &lt;with-applied-cfg-metadata&gt; enhancement is described below.</t>
  <t>A simple example module is provided to illustrate the subsequent examples. This is not a real module, and is not intended for any real use.</t>
  <figure><artwork><![CDATA[
module example-interfaces {

  namespace "http://example.com/ns/interfaces";

  prefix exam;

  container interfaces {
    description "Example interfaces group";

    list interface {
      key name;
      description "Example interface entry";

      leaf name {
        type string {
          length "1 .. max";
        }
        description
          "The administrative name of the interface.";
      }

      leaf mtu {
        type uint32;
        default 1514;
        description
          "The maximum transmission unit (MTU) value assigned to
           this interface.";
      }
      
      leaf enabled {
        type boolean;
        default "true";
        description "Enable the interface";
      }
      
      leaf oper-status {
        config false;
        type enumeration {
          enum up {
            description
              "Ready to pass packets.";
          }
          enum down; {
            description
                "The interface does not pass any packets.";
          }
        }
      }
    }
  }
}
]]></artwork></figure>
    <section title="NETCONF Persistent datastore get-config request using with-applied-cfg-metadata">
    <t>This example illustrates a &lt;get-config&gt; request made against the Persistent Configuration Datastore using the with-applied-cfg-metadata selectively-annotate option using the example YANG module above:</t>
    <figure><artwork><![CDATA[
<rpc message-id="101"
     xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <get-config>
    <source>
      <persistent/>
    </source>
    <filter type="subtree">
      <interfaces xmlns="http://example.com/ns/interfaces"/>
    </filter>
    <with-applied-cfg-metadata>
     xmlns="urn:...:ietf-netconf-with-applied-cfg-metadata">
      selectively-annotate
    </with-applied-cfg-metadata>
  </get-config>
</rpc>
]]></artwork></figure>
    <t>The response indicates that at the time of the reply:
    <list>
      <t>The system has failed to apply the MTU configuration of 9001 on eth0/0 due to a hardware programming error.</t>
      <t>The request to change the MTU leaf on eth0/1 to 9000 is still in the process of being applied.</t>
      <t>The MTU configuration on eth0/2 has been successfully applied.</t>
    </list></t>
<figure><artwork><![CDATA[
<rpc-reply message-id="101"
           xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"
           xmlns:opstate="urn:...:ietf-yang-opstate-metadata">
  <data>
    <interfaces xmlns="http://example.com/ns/interfaces">
      <interface>
        <name>eth0/0</name>
        <mtu opstate:cfg-status="failed"
             opstate:cfg-status-reason="hardware programming error">
          9001
        </mtu>
      </interface>
      <interface>
        <name>eth0/1</name>
        <mtu opstate:cfg-status="applying">
          9000
        </mtu>
      </interface>
      <interface>
        <name>eth0/2</name>
        <mtu>2000</mtu>
      </interface>
    </interfaces>
  </data>
</rpc-reply>
]]></artwork></figure>
  </section>
    <section title="NETCONF Operational State Datastore get request using with-applied-cfg-metadata">
    <t>This example illustrates a &lt;get&gt; request made against the Operational State Datastore using the with-applied-cfg-metadata selectively-annotate option using the example YANG module above:</t>
    <figure><artwork><![CDATA[
<rpc message-id="102"
     xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <get>
    <source>
      <opstate/>
    </source>
    <filter type="subtree">
      <interfaces xmlns="http://example.com/ns/interfaces"/>
    </filter>
    <with-applied-cfg-metadata>
     xmlns="urn:...:ietf-netconf-with-applied-cfg-metadata">
      selectively-annotate
    </with-applied-cfg-metadata>
  </get>
</rpc>
]]></artwork></figure>
<t>An example response is given below.  This response assumes that the device is in the same state as for the &lt;get-config&gt; example given above, and assumes that the device uses NETCONF with-default "explicit" mode.  The response indicates that at the time of the reply:
<list><t>The MTU on eth0/0 is still at the YANG default of 1514. This differs from the intended configuration because the configuration failed to be applied.</t>
      <t>The configuration request to change the MTU leaf on eth0/1 from 1514 to 9000 is still in the process of being applied, and the device is still currently using an MTU of 1514.</t>
      <t>The MTU configuration of 2000 on eth0/2 has been successfully applied.</t>
      <t>eth0/3 has not been configured, but exists in the Operational State Datastore because it is automatically created by the device.  The MTU leaf (which has the default value) must also be marked as system-controlled because there is no implicit or explicit MTU leaf in the intended configuration for eth0/3.  The enabled leaf is also system-controlled but with a non default value, since the device does not allow the interface to be enabled without being explicitly configured.</t>
</list></t><figure><artwork><![CDATA[
<rpc-reply message-id="101"
           xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"
           xmlns:opstate="urn:...:ietf-yang-opstate-metadata">
  <data>
    <interfaces xmlns="http://example.com/ns/interfaces">
      <interface>
        <name>eth0/0</name>
        <mtu opstate:cfg-status="failed"
             opstate:cfg-status-reason="hardware programming error">
          1514
        </mtu>
        <enabled>true</enabled>
        <oper-status>up</oper-status>
      </interface>
      <interface>
        <name>eth0/1</name>
        <mtu opstate:cfg-status="applying">
          1514
        </mtu>
        <enabled>true</enabled>
        <oper-status>up</oper-status>
      </interface>
      <interface>
        <name>eth0/2</name>
        <mtu>2000</mtu>
        <enabled>true</enabled>
        <oper-status>up</oper-status>
      </interface>
      <interface>
        <name opstate:cfg-status="system-controlled">
          eth0/3
        </name>
        <mtu opstate:cfg-status="system-controlled">
          1514
        </mtu>
        <enabled opstate:cfg-status="system-controlled">
          false
        </enabled>
        <oper-status>down</oper-status>
      </interface>
    </interfaces>
  </data>
</rpc-reply>
]]></artwork></figure>
  </section>
  </section>
</back>
</rfc>