YANG Model for the NETCONF default attribute
Internet-Draft draft-andersson-netconf-defaults-yang-00
Per Andersson
Cisco Systems
per.ietf@ionio.se
OPS Area
NETCONF Working Group
This document defines a YANG module with the "default" attribute using the namespace and prefix defined in [RFC6243]. This enables usage of the "default" attribute in e.g. YANG JSON encoding.
Introduction
YANG metadata [RFC7952] defines that attributes should be namespace-qualified, which for YANG JSON [RFC7951] means module-name:attribute. This becomes a problem since the "default" attribute defined in [RFC6243] 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".
The "ietf-defaults" Module
The "ietf-defaults" module defines the "default" attribute.
YANG Module
This YANG module has normative references to [RFC6243], [RFC7951], and [RFC7952].
<CODE BEGINS> file "ietf-defaults@2024-04-03.yang"

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";
  }
}

<CODE ENDS>
IANA Considerations
The "IETF XML" Registry
This document registers one URI in the "ns" subregistry of the IETF XML Registry [RFC3688] maintained at https://www.iana.org/assignments/xml-registry/xml-registry.xhtml#ns. Following the format in [RFC3688], the following registration is requested:

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

The "YANG Module Names" Registry
This document registers one YANG module in the YANG Module Names registry [RFC6020] maintained at https://www.iana.org/assignments/yang-parameters/yang-parameters.xhtml. Following the format defined in [RFC6020], the below registration is requested:

name: ietf-defaults
namespace: urn:ietf:params:xml:ns:netconf:default:1.0
prefix: wd
Reference: RFC XXXX

Security Considerations
Regarding the "ietf-defaults" YANG Module
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.
References
Normative References
[RFC2119]

Key words for use in RFCs to Indicate Requirement Levels
S. Bradner
March 1997
BCP 14
RFC 2119
DOI 10.17487/RFC2119
[RFC3688]

The IETF XML Registry
M. Mealling
January 2004
BCP 81
RFC 3688
DOI 10.17487/RFC3688
[RFC6241]

Network Configuration Protocol (NETCONF)
R. Enns, Ed.
M. Bjorklund, Ed.
J. Schoenwaelder, Ed.
A. Bierman, Ed.
June 2011
RFC 6241
DOI 10.17487/RFC6241
[RFC6242]

Using the NETCONF Protocol over Secure Shell (SSH)
M. Wasserman
June 2011
RFC 6242
DOI 10.17487/RFC6242
[RFC6243]

With-defaults Capability for NETCONF
A. Bierman
B. Lengyel
June 2011
RFC 6243
DOI 10.17487/RFC6243
[RFC7950]

The YANG 1.1 Data Modeling Language
M. Bjorklund, Ed.
August 2016
RFC 7950
DOI 10.17487/RFC7950
[RFC7951]

JSON Encoding of Data Modeled with YANG
L. Lhotka
August 2016
RFC 7951
DOI 10.17487/RFC7951
[RFC7952]

Defining and Using Metadata with YANG
L. Lhotka
August 2016
RFC 7952
DOI 10.17487/RFC7952
[RFC8040]

RESTCONF Protocol
A. Bierman
M. Bjorklund
K. Watsen
January 2017
RFC 8040
DOI 10.17487/RFC8040
[RFC8174]

Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words
B. Leiba
May 2017
BCP 14
RFC 8174
DOI 10.17487/RFC8174
[RFC8341]

Network Configuration Access Control Model
A. Bierman
M. Bjorklund
March 2018
STD 91
RFC 8341
DOI 10.17487/RFC8341
[RFC8446]

The Transport Layer Security (TLS) Protocol Version 1.3
E. Rescorla
August 2018
RFC 8446
DOI 10.17487/RFC8446
Informative References
[RFC6020]

YANG - A Data Modeling Language for the Network Configuration Protocol (NETCONF)
M. Bjorklund, Ed.
October 2010
RFC 6020
DOI 10.17487/RFC6020
YANG JSON Example
The following example shows the example from Section A.3.2. <with-defaults> = 'report-all-tagged' in [RFC6243] encoded as YANG JSON encoded data. The request is adapted for RESTCONF [RFC8040].

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"
        }
    ]
}

YANG JSON encoded data with "default" attribute.