<?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="info"
    docName="draft-dsdt-nmda-guidelines-00" >
    <front>
    <title abbrev="">Guidelines for YANG Module Authors (NMDA)</title>

    <author initials="M" surname="Bjorklund" fullname='Martin Bjorklund' >
      <organization>Tail-f Systems</organization>
      <address>
        <email>mbj@tail-f.com</email>
      </address>
    </author>
    <author initials="J" surname="Schoenwaelder" fullname='Juergen Schoenwaelder' >
      <organization>Jacobs University</organization>
      <address>
        <email>j.schoenwaelder@jacobs-university.de</email>
      </address>
    </author>
    <author initials="P" surname="Shafer" fullname='Phil Shafer' >
      <organization>Juniper Networks</organization>
      <address>
        <email>phil@juniper.net</email>
      </address>
    </author>
    <author initials="K" surname="Watsen" fullname='Kent Watsen' >
      <organization>Juniper Networks</organization>
      <address>
        <email>kwatsen@juniper.net</email>
      </address>
    </author>
    <author initials="R" surname="Wilton" fullname='Rob Wilton' >
      <organization>Cisco Systems</organization>
      <address>
        <email>rwilton@cisco.com</email>
      </address>
    </author>
	<date/>
    <abstract>
	<t>
The &quot;Network Management Datastore Architecture&quot; (NMDA) adds the
ability to inspect the current operational values for configuration,
allowing clients to use identical paths for retrieving the configured
values and the operational values.  This change will simplify models
and help modelers, but will create a period of transition as NMDA
becomes a standard and is widely implemented.  During that interim,
the guidelines given in this document should help modelers find an
optimal path forward.
	</t>
</abstract>
</front>
<middle>
<section title="Introduction" anchor="introduction">
    <t>
This document provides advice and guidelines to help modelers plan for
the emerging &quot;Network Management Datastore Architecture&quot; (NMDA)
<xref target="I-D.ietf-netmod-revised-datastores"/>.  This architecture provides an
architectural framework for datastores as they are used by network
management protocols such as NETCONF <xref target="RFC6241"/>, RESTCONF <xref target="RFC8040"/> and
the YANG <xref target="RFC7950"/> data modeling language.  Datastores are a
fundamental concept binding network management data models to network
management protocols, enabling data models to be written in a network
management protocol agnostic way.
    </t>
<section title="Keywords" anchor="keywords">
    <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>
<section title="Terminology" anchor="terminology">
    <t>
This document uses the terminology defined by the NMDA
<xref target="I-D.ietf-netmod-revised-datastores"/>. 
    </t>
</section>
<section title="Executive Summary" anchor="executive-summary">
    <t>
The Network Management Datastore Architecture (NMDA) addresses the so
called &quot;OpState problem&quot; that has been the subject of much discussion
in the IETF.  NMDA is still in development and there will be a
transition period before NMDA solutions are universally available.
    </t>
    <t>
These guidelines are aimed to enable the creation of models that can
take advantage of the NMDA, while pragmatically allowing those models
to be used with the existing network configuration protocol
implementations.
    </t>
    <t>
It is the strong recommendation that models SHOULD move as quickly as
possible to the NMDA.  The specific approach to be taken for models
being developed now and during the NMDA transition period should be
based on both the expected usage and the maturity of the data model.
    </t>
<t>
 <list style="numbers">
 <t>
New models and models that are not concerned with the operational
state of configuration information SHOULD immediately be structured 
to be NMDA-compatible.
 </t>
 <t>
Models that require immediate support for &quot;in use&quot; and &quot;system
created&quot; information SHOULD be structured for NMDA.  A non-NMDA
version of these models SHOULD also be published, using either an
existing model or a model created either by hand or with suitable
tools that support current modeling strategies.  Both the NMDA and the
non-NMDA modules SHOULD be published in the same document, with NMDA
modules in the document main body and the non-NMDA modules in a
non-normative appendix.  The use of the non-NMDA model will allow
temporary bridging of the time period until NMDA implementations are
available.
 </t>
 </list>
</t>
    <t>
Additional details on these guidelines can be found below, notably in
<xref target="guidelines"/>.
    </t>
</section>
<section title="Background" anchor="background">
    <t>
NETCONF (<xref target="RFC6241"/>) was developed with a focus on configuration data,
and has unfortunate gaps in its treatment of operational data.  The
&lt;get&#8209;config&gt; operation can return configuration data (defined as nodes
with &quot;config true&quot;) stored in &lt;running&gt;.  This data is
typically the only data created by CLI users and NETCONF clients.  The
&lt;get&gt; operation is defined as returning all the data on the device,
including the contents of &lt;running&gt;, as well as any
operational state data.  While the NETCONF design envisioned models
merging &quot;config false&quot; nodes with the contents of running, there are
two issues involved.
    </t>
    <t>
First, the desire of clients to see the true operational (&quot;in use&quot;)
value of configuration data resulted in the need for data models to
have two distinct leafs, one to show the configured value and the
other to show the operational value.  An example would be the speed of
an interface, where the configured value may not be the value that is
currently used.
    </t>
    <t>
Second, devices often have &quot;system created&quot; resources that exist as
operational data even when there is no corresponding configuration
data.  An example would be built-in networking interfaces that always
appear in operational data.
    </t>
    <t>
A similar situation to the second issue discussed above exists while
the device is processing configuration data changes.  When configuration
data is deleted, the operational data will continue to exist during the
time period in which the device is releasing resources associated with
the data.  An example would be deleting a BGP peer, where the peer
continues to exist in operational data until the connection is closed
and any other resources are released.
    </t>
    <t>
To address these issues without requiring a protocol modification, two
distinct strategies have been adopted in YANG model design:
    </t>
    <t>
The first strategy makes two distinct top-level containers, one for
configuration and one for state.  These are sometimes referred to as
&quot;/foo&quot; and &quot;/foo&#8209;state&quot;.  An example would be the interface model
defined in <xref target="RFC7223"/>.  These models require two completely distinct
set of nodes, with repetition of both the interior containers, lists,
and key nodes, but also repetition of many other nodes to allow
visibility of the operational values of configured nodes.  This leads
to over-use of YANG groupings in ways that affect the readability of
the models, as well as creating opportunities to incorrectly mirror
the model&apos;s hierarchies.  Also this &quot;stitching together&quot; of data from
the two trees is merely a convention, not a formal relationship.
    </t>
    <t>
The second strategy uses two sibling containers, named &quot;config&quot; and
&quot;state&quot;, placed deeper within the model node hierarchy.  The &quot;config&quot;
container holds the configured values, while the &quot;state&quot; container
holds the operational values.  The duplication of interior nodes in
the hierarchies is removed, but the duplication of leafs representing
configuration remains.  Groupings can be used to avoid the repetition
of the leafs in the YANG file, but at the expense of readability.  In
addition, this strategy does not handle the existence of operational
data for which there is no configuration data, such as the
system-created data and deleted peers scenarios discussed above.
    </t>
</section>
<section title="Network Management Datastores Architecture" anchor="network-management-datastores-architecture">
    <t>
The Network Management Datastores Architecture (NMDA) addresses the
problems mentioned above by creating an architectural framework which
includes a distinct datastore for operational data, called
&lt;operational&gt;.  This datastore is defined as containing both config
true and config false nodes, with the formal understanding that the
&quot;in use&quot; values are returned for the config true nodes.  This allows
modelers to use a single hierarchy for all configuration and
operational data, which both improves readability and reduces the
possibility of modeling inconsistencies that might impact
programmatic access.
    </t>
    <t>
In addition, another datastore named &lt;intended&gt; is defined to provide
a complete view of the configuration data, even in the presence of
device-specific features that expand or remove configuration data.
While such mechanisms are currently non-standard, the NMDA recognizes
they exist and need to be handled appropriately.  In the future, such
mechanisms may become standardized.
    </t>
    <t>
The NMDA allows the deprecation of NETCONF&apos;s &lt;get&gt; operation, removing
the source of these issues.  The new operations &lt;get&#8209;data&gt; and
&lt;edit&#8209;data&gt; will support a parameter indicating the target datastore.
Similar changes are planned for RESTCONF (<xref target="RFC8040"/>).
    </t>
</section>
</section>
<section title="Guidelines for YANG Modelers" anchor="guidelines">
    <t>
The following guidelines are meant to help modelers develop YANG
models that will maximize the utility of the model with both current
implementations and NMDA-capable implementations.  Any questions
regarding these guidelines can be sent to yang-doctors@ietf.org.
    </t>
    <t>
The direction taken should be based on both the maturity of the data
model, along with the number of concrete implementations of the model.
The intent is not to destabilize the IETF modeling community, but to
create models that can take advantage of the NMDA, while pragmatically
allowing those models to be used with the existing network
configuration protocol implementations.
    </t>
    <t>
It is the strong recommendation that models SHOULD move as quickly as
possible to the NMDA.  This is key to the future of these models.
The NETMOD WG will rework existing models to this architecture.  Given
the permanence and gravity of work published by the IETF, creating
future-proof data models is vital.
    </t>
    <t>
The two current strategies (&quot;/foo&#8209;state&quot; and &quot;config&quot;/&quot;state&quot;
containers) mix data retrieval details into the data model,
complicating the models and impairing their readability.  Rather than
maintain these details inside the data model, models can be
post-processed to add this derivative information, either manually or
using tools.
    </t>
    <t>
Tools can automatically produce the required derived modules.  The
suggested approach is to produce a &quot;state&quot; version of the module with
a distinct namespace, rather than using the &quot;/foo&#8209;state&quot; top-level
container.  Since the contents are identical, constraints in the data
model such as &quot;must&quot; statements should not need to change.  Only the
model name, namespace, and prefix should need to change.  This
simplifies the tooling needed to generate the derived model, as well
as reducing changes needed in client applications when transitioning
to the NMDA model.
    </t>
    <t>
These derived models use distinct module names and namespaces,
allowing servers to announce their support for the base or derived
models.
    </t>
    <t>
Consider the following trivial model:
    </t>
	<figure>
	    <artwork><![CDATA[
    module ietf-thermostat {
        namespace "tag:ietf:example:thermostat";
        prefix "thermo";

        container thermostat {
            leaf high-temperature {
                description "High temperature threshold";
                type int;
            }
            leaf low-temperature {
                description "Low temperature threshold";
                type int;
            }
            leaf current-temperature {
                description "Current temperature reading";
                type int;
                config false;
            }
        }
    }
	    ]]></artwork>
	</figure>
    <t>
In the derived model, the contents mirror the NMDA data model, but are
marked as &quot;config false&quot;, and the module name and namespace values
have a &quot;&#8209;state&quot; suffix:
    </t>
	<figure>
	    <artwork><![CDATA[
    module ietf-thermostat-state {
        namespace "tag:ietf:example:thermostat-state";
        prefix "thermo-state";

        container thermostat {
            config false;
            leaf high-temperature {
                description "High temperature threshold";
                type int;
            }
            leaf low-temperature {
                description "Low temperature threshold";
                type int;
            }
            leaf current-temperature {
                description "Current temperature reading";
                type int;
            }
        }
    }
	    ]]></artwork>
	</figure>
    <t>
By adopting a tools-based solution for supporting models that are
currently under development, models can be quickly restructured to be
NMDA-compatible while giving continuity to their community of
developers.  When NMDA-capable implementations become available, the
base data models can be used directly.
    </t>
    <t>
Modelers and reviewers can view the simple data model, published in
the body of document.  Tools can generate any required derived models,
and those models can be published in a non-normative appendix to allow
interoperability.
    </t>
    <t>
It is critical to consider the following guidelines, understanding
that our goal is to make models that will see continued use in the
long term, balancing short term needs against a desire for consistent,
usable models in the future:
    </t>
    <t>
(a) New models and models that are not concerned with the operational
state of configuration information SHOULD immediately be structured 
to be NMDA-compatible.
    </t>
    <t>
(b) Models that require immediate support for &quot;in use&quot; and &quot;system
created&quot; information SHOULD be structured for NMDA.  A non-NMDA
version of these models SHOULD exist, either an existing model or a
model created either by hand or with suitable tools that mirror the
current modeling strategies.  Both the NMDA and the non-NMDA modules
SHOULD be published in the same document, with NMDA modules in the
document main body and the non-NMDA modules in a non-normative
appendix.  The use of the non-NMDA model will allow temporary bridging
of the time period until NMDA implementations are available.
    </t>
    <t>
(c) For published models, the model should be republished with an
NMDA-compatible structure, deprecating non-NMDA constructs.  For
example, the &quot;ietf&#8209;interfaces&quot; model in <xref target="RFC7223"/> will be restructured
as an NMDA-compatible model.  The &quot;/interfaces&#8209;state&quot; hierarchy will
be marked &quot;status deprecated&quot;.  Models that mark their &quot;/foo&#8209;state&quot;
hierarchy with &quot;status deprecated&quot; will allow NMDA-capable
implementations to avoid the cost of duplicating the state nodes,
while enabling non-NMDA-capable implementations to utilize them for
access to the operational values.
    </t>
    <t>
(d) For models that augment models which have not been structured with
the NMDA, the modeler will have to consider the structure of the base
model and the guidelines listed above.  Where possible, such models
should move to new revisions of the base model that are
NMDA-compatible.  When that is not possible, augmenting &quot;state&quot;
containers SHOULD be avoided, with the expectation that the base model
will be re-released with the state containers marked as deprecated.
It is RECOMMENDED to augment only the &quot;/foo&quot; hierarchy of the base
model.  Where this recommendation cannot be followed, then any new
&quot;state&quot; elements SHOULD be included in their own module.
    </t>
</section>
<section title="IANA Considerations" anchor="iana-considerations">
    <t>
This document has no actions for IANA.
    </t>
</section>
<section title="Security Considerations" anchor="security-considerations">
    <t>
This document has no security considerations.
    </t>
</section>
</middle>
<back>
<references title="Informative References">
<reference anchor="RFC2119" target="http://www.rfc-editor.org/info/rfc2119">
  <front>
    <title>Key words for use in RFCs to Indicate Requirement Levels</title>
    <author initials="S." surname="Bradner" fullname="S. Bradner">
      <organization/>
    </author>
    <date year="1997" month="March"/>
    <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.  This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t>
    </abstract>
  </front>
  <seriesInfo name="BCP" value="14"/>
  <seriesInfo name="RFC" value="2119"/>
  <seriesInfo name="DOI" value="10.17487/RFC2119"/>
</reference>
<reference anchor="RFC6241" target="http://www.rfc-editor.org/info/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"/>
    <abstract>
      <t>The Network Configuration Protocol (NETCONF) defined in this document provides mechanisms to install, manipulate, and delete the configuration of network devices.  It uses an Extensible Markup Language (XML)-based data encoding for the configuration data as well as the protocol messages.  The NETCONF protocol operations are realized as remote procedure calls (RPCs).  This document obsoletes RFC 4741.  [STANDARDS-TRACK]</t>
    </abstract>
  </front>
  <seriesInfo name="RFC" value="6241"/>
  <seriesInfo name="DOI" value="10.17487/RFC6241"/>
</reference>
<reference anchor="RFC7223" target="http://www.rfc-editor.org/info/rfc7223">
  <front>
    <title>A YANG Data Model for Interface Management</title>
    <author initials="M." surname="Bjorklund" fullname="M. Bjorklund">
      <organization/>
    </author>
    <date year="2014" month="May"/>
    <abstract>
      <t>This document defines a YANG data model for the management of network interfaces.  It is expected that interface-type-specific data models augment the generic interfaces data model defined in this document. The data model includes configuration data and state data (status information and counters for the collection of statistics).</t>
    </abstract>
  </front>
  <seriesInfo name="RFC" value="7223"/>
  <seriesInfo name="DOI" value="10.17487/RFC7223"/>
</reference>
<reference anchor="RFC7950" target="http://www.rfc-editor.org/info/rfc7950">
  <front>
    <title>The YANG 1.1 Data Modeling Language</title>
    <author initials="M." surname="Bjorklund" fullname="M. Bjorklund" role="editor">
      <organization/>
    </author>
    <date year="2016" month="August"/>
    <abstract>
      <t>YANG is a data modeling language used to model configuration data, state data, Remote Procedure Calls, and notifications for network management protocols.  This document describes the syntax and semantics of version 1.1 of the YANG language.  YANG version 1.1 is a maintenance release of the YANG language, addressing ambiguities and defects in the original specification.  There are a small number of backward incompatibilities from YANG version 1.  This document also specifies the YANG mappings to the Network Configuration Protocol (NETCONF).</t>
    </abstract>
  </front>
  <seriesInfo name="RFC" value="7950"/>
  <seriesInfo name="DOI" value="10.17487/RFC7950"/>
</reference>
<reference anchor="RFC8040" target="http://www.rfc-editor.org/info/rfc8040">
  <front>
    <title>RESTCONF Protocol</title>
    <author initials="A." surname="Bierman" fullname="A. Bierman">
      <organization/>
    </author>
    <author initials="M." surname="Bjorklund" fullname="M. Bjorklund">
      <organization/>
    </author>
    <author initials="K." surname="Watsen" fullname="K. Watsen">
      <organization/>
    </author>
    <date year="2017" month="January"/>
    <abstract>
      <t>This document describes an HTTP-based protocol that provides a programmatic interface for accessing data defined in YANG, using the datastore concepts defined in the Network Configuration Protocol (NETCONF).</t>
    </abstract>
  </front>
  <seriesInfo name="RFC" value="8040"/>
  <seriesInfo name="DOI" value="10.17487/RFC8040"/>
</reference>
<reference anchor="I-D.ietf-netmod-revised-datastores">
  <front>
    <title>Network Management Datastore Architecture</title>
    <author initials="M" surname="Bjorklund" fullname="Martin Bjorklund">
      <organization/>
    </author>
    <author initials="J" surname="Schoenwaelder" fullname="Juergen Schoenwaelder">
      <organization/>
    </author>
    <author initials="P" surname="Shafer" fullname="Philip Shafer">
      <organization/>
    </author>
    <author initials="K" surname="Watsen" fullname="Kent Watsen">
      <organization/>
    </author>
    <author initials="R" surname="Wilton" fullname="Robert Wilton">
      <organization/>
    </author>
    <date month="March" day="13" year="2017"/>
    <abstract>
      <t>Datastores are a fundamental concept binding the data models written in the YANG data modeling language to network management protocols such as NETCONF and RESTCONF.  This document defines an architectural framework for datastores based on the experience gained with the initial simpler model, addressing requirements that were not well supported in the initial model.</t>
    </abstract>
  </front>
  <seriesInfo name="Internet-Draft" value="draft-ietf-netmod-revised-datastores-01"/>
  <format type="TXT" target="http://www.ietf.org/internet-drafts/draft-ietf-netmod-revised-datastores-01.txt"/>
</reference>
</references>
</back></rfc>
