<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<?rfc toc="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes" ?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<?rfc linkmailto="no" ?>
<?rfc editing="no" ?>
<?rfc comments="yes" ?>
<?rfc inline="yes"?>
<?rfc rfcedstyle="yes"?>
<?rfc-ext allow-markup-in-artwork="yes" ?>
<?rfc-ext include-index="no" ?>
<!--<?rfc strict="no"?> -->
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" docName="draft-andersson-netconf-defaults-yang-00" category="std" consensus="true" updates="6243" ipr="trust200902" obsoletes="" submissionType="IETF" xml:lang="en" tocInclude="true" symRefs="true" sortRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.20.1 -->
  <front>
    <title abbrev="NETCONF default attribute YANG">
        YANG Model for the NETCONF default attribute
    </title>
    <seriesInfo name="Internet-Draft" value="draft-andersson-netconf-defaults-yang-00"/>
    <author fullname="Per Andersson" initials="P." surname="Andersson">
      <organization>Cisco Systems</organization>
      <address>
        <email>per.ietf@ionio.se</email>
      </address>
    </author>
    <date/>
    <area>OPS Area</area>
    <workgroup>NETCONF Working Group</workgroup>
    <abstract>
      <t>This document defines a YANG module with the "default" attribute using
        the namespace and prefix defined in <xref target="RFC6243" format="default"/>. This
        enables usage of the "default" attribute in e.g. YANG JSON encoding.</t>
    </abstract>
  </front>
  <middle>
    <section anchor="intro" numbered="true" toc="default">
      <name>Introduction</name>
      <t>YANG metadata <xref target="RFC7952" format="default"/> defines that attributes should
        be namespace-qualified, which for YANG JSON <xref target="RFC7951" format="default"/>
        means module-name:attribute. This becomes a problem since the "default"
        attribute defined in <xref target="RFC6243" format="default"/> doesn't define it in a
        YANG module, but instead defines the "default" attribute in XML Schema.
        The result is that it is impossible to emit the "default" attribute
        using YANG JSON encoding, since there is no corresponding YANG module
        name to use. For NETCONF this is not a problem since the prefix "wd" is
        defined with the corresponding namespace
        "urn:ietf:params:xml:ns:netconf:default:1.0".
      </t>
    </section>
    <section anchor="yang-module" numbered="true" toc="default">
      <name>The "ietf-defaults" Module</name>
      <t>The "ietf-defaults" module defines the "default" attribute.</t>
      <section numbered="true" toc="default">
        <name>YANG Module</name>
        <t>This YANG module has normative references to
          <xref target="RFC6243" format="default"/>, <xref target="RFC7951" format="default"/>, and
          <xref target="RFC7952" format="default"/>.</t>
        <t keepWithNext="true">&lt;CODE BEGINS&gt; file "ietf-defaults@2024-04-03.yang"</t>
        <artwork name="" type="" align="left" alt=""><![CDATA[
module ietf-defaults {
  yang-version 1.1;
  namespace
    "urn:ietf:params:xml:ns:netconf:default:1.0";
  prefix wd;

  import ietf-yang-metadata {
    prefix md;
    reference
      "RFC 7952: Defining and Using Metadata with YANG";
  }

  organization
    "IETF NETCONF (Network Configuration) Working Group";

  contact
    "WG Web:   https://datatracker.ietf.org/wg/netconf
     WG List:  NETCONF WG list <mailto:netconf@ietf.org>

     Authors:  Per Andersson <per.ietf@ionio.se>";

  description
    "This module defines the 'default' attribute in YANG
     previously only defined in XML Schema in RFC 6243 Section 6.

     Copyright (c) 2024 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 Revised
     BSD License set forth in Section 4.c of the IETF Trust's
     Legal Provisions Relating to IETF Documents
     (https://trustee.ietf.org/license-info).

     This version of this YANG module is part of RFC XXXX
     (https://www.rfc-editor.org/info/rfcXXXX); see the RFC
     itself for full legal notices.

     The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL',
     'SHALL NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED',
     'NOT RECOMMENDED', 'MAY', and 'OPTIONAL' in this document
     are to be interpreted as described in BCP 14 (RFC 2119)
     (RFC 8174) when, and only when, they appear in all
     capitals, as shown here.";

  revision 2024-04-03 {
    description
      "Initial revision.";
    reference
      "RFC XXXX: YANG Model for the NETCONF default attribute";
  }

  md:annotation default {
    type boolean;
    description
      "This annotation is only relevant if the server supports the
       'report-all-tagged' defaults retrieval mode. For details see
       RFC 6243.";
    reference
      "RFC 6243: With-defaults Capability for NETCONF";
  }
}
]]></artwork>
        <t keepWithPrevious="true">&lt;CODE ENDS&gt;</t>
      </section>
    </section>
    <section numbered="true" toc="default">
      <name>IANA Considerations</name>
      <section numbered="true" toc="default">
        <name>The "IETF XML" Registry</name>
        <t>This document registers one URI in the "ns" subregistry of
            the IETF XML Registry <xref target="RFC3688" format="default"/> maintained at
            <eref target="https://www.iana.org/assignments/xml-registry/xml-registry.xhtml#ns"/>.
            Following the format in <xref target="RFC3688" format="default"/>, the following
            registration is requested:</t>
        <artwork name="" type="" align="left" alt=""><![CDATA[
URI: urn:ietf:params:xml:ns:netconf:default:1.0
Registrant Contact: The IESG.
XML: N/A, the requested URI is an XML namespace.
Reference: RFC 6243, RFC XXXX
          ]]></artwork>
      </section>
      <section numbered="true" toc="default">
        <name>The "YANG Module Names" Registry</name>
        <t>This document registers one YANG module in the YANG
          Module Names registry <xref target="RFC6020" format="default"/> maintained at
          <eref target="https://www.iana.org/assignments/yang-parameters/yang-parameters.xhtml"/>.
          Following the format defined in <xref target="RFC6020" format="default"/>,
          the below registration is requested:</t>
        <artwork name="" type="" align="left" alt=""><![CDATA[
name: ietf-defaults
namespace: urn:ietf:params:xml:ns:netconf:default:1.0
prefix: wd
Reference: RFC XXXX
          ]]></artwork>
      </section>
    </section>
    <section anchor="security" numbered="true" toc="default">
      <name>Security Considerations</name>
      <section numbered="true" toc="default">
        <name>Regarding the "ietf-defaults" YANG Module</name>
        <t>This document defines an extension to existing NETCONF and RESTCONF
          protocol operations. It does not introdue any new or increased
          security risks into the management system.</t>
      </section>
    </section>
  </middle>
  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        <reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml">
          <front>
            <title>Key words for use in RFCs to Indicate Requirement Levels</title>
            <author fullname="S. Bradner" initials="S." surname="Bradner"/>
            <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. 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>
        <!-- MUSTs, etc. -->
      <reference anchor="RFC3688" target="https://www.rfc-editor.org/info/rfc3688" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.3688.xml">
          <front>
            <title>The IETF XML Registry</title>
            <author fullname="M. Mealling" initials="M." surname="Mealling"/>
            <date month="January" year="2004"/>
            <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"/>
          <seriesInfo name="DOI" value="10.17487/RFC3688"/>
        </reference>
        <!-- IETF XML Registry -->
      <reference anchor="RFC6241" target="https://www.rfc-editor.org/info/rfc6241" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6241.xml">
          <front>
            <title>Network Configuration Protocol (NETCONF)</title>
            <author fullname="R. Enns" initials="R." role="editor" surname="Enns"/>
            <author fullname="M. Bjorklund" initials="M." role="editor" surname="Bjorklund"/>
            <author fullname="J. Schoenwaelder" initials="J." role="editor" surname="Schoenwaelder"/>
            <author fullname="A. Bierman" initials="A." role="editor" surname="Bierman"/>
            <date month="June" year="2011"/>
            <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>
        <!-- NETCONF -->
      <reference anchor="RFC6242" target="https://www.rfc-editor.org/info/rfc6242" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6242.xml">
          <front>
            <title>Using the NETCONF Protocol over Secure Shell (SSH)</title>
            <author fullname="M. Wasserman" initials="M." surname="Wasserman"/>
            <date month="June" year="2011"/>
            <abstract>
              <t>This document describes a method for invoking and running the Network Configuration Protocol (NETCONF) within a Secure Shell (SSH) session as an SSH subsystem. This document obsoletes RFC 4742. [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="6242"/>
          <seriesInfo name="DOI" value="10.17487/RFC6242"/>
        </reference>
        <!-- NETCONF over SSH -->
      <reference anchor="RFC6243" target="https://www.rfc-editor.org/info/rfc6243" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6243.xml">
          <front>
            <title>With-defaults Capability for NETCONF</title>
            <author fullname="A. Bierman" initials="A." surname="Bierman"/>
            <author fullname="B. Lengyel" initials="B." surname="Lengyel"/>
            <date month="June" year="2011"/>
            <abstract>
              <t>The Network Configuration Protocol (NETCONF) defines ways to read and edit configuration data from a NETCONF server. In some cases, part of this data may not be set by the NETCONF client, but rather a default value known to the server is used instead. In many situations the NETCONF client has a priori knowledge about default data, so the NETCONF server does not need to save it in a NETCONF configuration datastore or send it to the client in a retrieval operation reply. In other situations the NETCONF client will need this data from the server. Not all server implementations treat this default data the same way. This document defines a capability-based extension to the NETCONF protocol that allows the NETCONF client to identify how defaults are processed by the server, and also defines new mechanisms for client control of server processing of default data. [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="6243"/>
          <seriesInfo name="DOI" value="10.17487/RFC6243"/>
        </reference>
        <!-- NETCONF with-defaults -->
      <reference anchor="RFC7950" target="https://www.rfc-editor.org/info/rfc7950" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7950.xml">
          <front>
            <title>The YANG 1.1 Data Modeling Language</title>
            <author fullname="M. Bjorklund" initials="M." role="editor" surname="Bjorklund"/>
            <date month="August" year="2016"/>
            <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>
        <!-- YANG (curr) -->
      <reference anchor="RFC7951" target="https://www.rfc-editor.org/info/rfc7951" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7951.xml">
          <front>
            <title>JSON Encoding of Data Modeled with YANG</title>
            <author fullname="L. Lhotka" initials="L." surname="Lhotka"/>
            <date month="August" year="2016"/>
            <abstract>
              <t>This document defines encoding rules for representing configuration data, state data, parameters of Remote Procedure Call (RPC) operations or actions, and notifications defined using YANG as JavaScript Object Notation (JSON) text.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="7951"/>
          <seriesInfo name="DOI" value="10.17487/RFC7951"/>
        </reference>
        <!-- YANG JSON -->
      <reference anchor="RFC7952" target="https://www.rfc-editor.org/info/rfc7952" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7952.xml">
          <front>
            <title>Defining and Using Metadata with YANG</title>
            <author fullname="L. Lhotka" initials="L." surname="Lhotka"/>
            <date month="August" year="2016"/>
            <abstract>
              <t>This document defines a YANG extension that allows for defining metadata annotations in YANG modules. The document also specifies XML and JSON encoding of annotations and other rules for annotating instances of YANG data nodes.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="7952"/>
          <seriesInfo name="DOI" value="10.17487/RFC7952"/>
        </reference>
        <!-- YANG Metadata -->
      <reference anchor="RFC8040" target="https://www.rfc-editor.org/info/rfc8040" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8040.xml">
          <front>
            <title>RESTCONF Protocol</title>
            <author fullname="A. Bierman" initials="A." surname="Bierman"/>
            <author fullname="M. Bjorklund" initials="M." surname="Bjorklund"/>
            <author fullname="K. Watsen" initials="K." surname="Watsen"/>
            <date month="January" year="2017"/>
            <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>
        <!-- RESTCONF -->
      <reference anchor="RFC8174" target="https://www.rfc-editor.org/info/rfc8174" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml">
          <front>
            <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
            <author fullname="B. Leiba" initials="B." surname="Leiba"/>
            <date month="May" year="2017"/>
            <abstract>
              <t>RFC 2119 specifies common key words that may be used in protocol specifications. This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the defined special meanings.</t>
            </abstract>
          </front>
          <seriesInfo name="BCP" value="14"/>
          <seriesInfo name="RFC" value="8174"/>
          <seriesInfo name="DOI" value="10.17487/RFC8174"/>
        </reference>
        <!-- rfc2119 update -->
      <reference anchor="RFC8341" target="https://www.rfc-editor.org/info/rfc8341" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8341.xml">
          <front>
            <title>Network Configuration Access Control Model</title>
            <author fullname="A. Bierman" initials="A." surname="Bierman"/>
            <author fullname="M. Bjorklund" initials="M." surname="Bjorklund"/>
            <date month="March" year="2018"/>
            <abstract>
              <t>The standardization of network configuration interfaces for use with the Network Configuration Protocol (NETCONF) or the RESTCONF protocol requires a structured and secure operating environment that promotes human usability and multi-vendor interoperability. There is a need for standard mechanisms to restrict NETCONF or RESTCONF protocol access for particular users to a preconfigured subset of all available NETCONF or RESTCONF protocol operations and content. This document defines such an access control model.</t>
              <t>This document obsoletes RFC 6536.</t>
            </abstract>
          </front>
          <seriesInfo name="STD" value="91"/>
          <seriesInfo name="RFC" value="8341"/>
          <seriesInfo name="DOI" value="10.17487/RFC8341"/>
        </reference>
        <!-- NACM -->
      <reference anchor="RFC8446" target="https://www.rfc-editor.org/info/rfc8446" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8446.xml">
          <front>
            <title>The Transport Layer Security (TLS) Protocol Version 1.3</title>
            <author fullname="E. Rescorla" initials="E." surname="Rescorla"/>
            <date month="August" year="2018"/>
            <abstract>
              <t>This document specifies version 1.3 of the Transport Layer Security (TLS) protocol. TLS allows client/server applications to communicate over the Internet in a way that is designed to prevent eavesdropping, tampering, and message forgery.</t>
              <t>This document updates RFCs 5705 and 6066, and obsoletes RFCs 5077, 5246, and 6961. This document also specifies new requirements for TLS 1.2 implementations.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="8446"/>
          <seriesInfo name="DOI" value="10.17487/RFC8446"/>
        </reference>
        <!-- TLS 1.3 -->
    </references>
      <references>
        <name>Informative References</name>
        <reference anchor="RFC6020" target="https://www.rfc-editor.org/info/rfc6020" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6020.xml">
          <front>
            <title>YANG - A Data Modeling Language for the Network Configuration Protocol (NETCONF)</title>
            <author fullname="M. Bjorklund" initials="M." role="editor" surname="Bjorklund"/>
            <date month="October" year="2010"/>
            <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"/>
          <seriesInfo name="DOI" value="10.17487/RFC6020"/>
        </reference>
        <!-- YANG (orig) -->
    </references>
    </references>
    <section numbered="true" toc="default">
      <name>YANG JSON Example</name>
      <t>The following example shows the example from Section A.3.2.
        &lt;with-defaults&gt; = 'report-all-tagged' in <xref target="RFC6243" format="default"/>
        encoded as YANG JSON encoded data. The request is adapted for
        RESTCONF <xref target="RFC8040" format="default"/>.</t>
      <artwork name="" type="" align="left" alt=""><![CDATA[
GET /restconf/data/example:interfaces?with-defaults=report-all-tagged
Accept: application/yang-data+json


HTTP/1.1 200 OK
Date: Wed, 03 Apr 2024 01:18:51 GMT
Server: example-server
Content-Type: application/yang-data+json

{
    "example:interfaces": [
        {
            "name": "eth0",
            "mtu": 8192,
            "status": "up",
            "@status": {
                 "ietf-defaults:default": true"
            }
        },
        {
            "name": "eth1",
            "mtu": 1500,
            "@mtu": {
                "ietf-defaults:default": true"
            }
            "status": "up",
            "@status": {
                "ietf-defaults:default": true"
            }
        },
        {
            "name": "eth2",
             "mtu": 9000,
             "status": "not feeling so good"
        },
        {
            "name": "eth3",
            "mtu": 1500,
            "@mtu": {
                "ietf-defaults:default": true"
            }
            "status": "waking up"
        }
    ]
}
]]></artwork>
      <t keepWithPrevious="true">YANG JSON encoded data with "default" attribute.</t>
    </section>
  </back>
</rfc>
