Skip to main content

YANG Types for DNS Classes and Resource Record Types
draft-ietf-dnsop-iana-class-type-yang-03

The information below is for an old version of the document.
Document Type
This is an older version of an Internet-Draft that was ultimately published as RFC 9108.
Authors Ladislav Lhotka , Petr Špaček
Last updated 2021-06-03 (Latest revision 2021-05-24)
Replaces draft-lhotka-dnsop-iana-class-type-yang
RFC stream Internet Engineering Task Force (IETF)
Formats
Reviews
Additional resources Mailing list discussion
Stream WG state Submitted to IESG for Publication
Document shepherd Benno Overeinder
Shepherd write-up Show Last changed 2021-05-07
IESG IESG state Became RFC 9108 (Proposed Standard)
Consensus boilerplate Yes
Telechat date (None)
Needs 2 more YES or NO OBJECTION positions to pass.
Responsible AD Warren "Ace" Kumari
Send notices to benno@NLnetLabs.nl
IANA IANA review state IANA OK - Actions Needed
IANA expert review state Expert Reviews OK
draft-ietf-dnsop-iana-class-type-yang-03
Lhotka & Spacek         Expires 25 November 2021                [Page 2]
Internet-Draft         iana-dns-class-rr-type-yang              May 2021

   translated into corresponding YANG types or other structures.  Such
   translations should be straightforward and relatively
   uncontroversial.

   This document provides a translation of two fundamental DNS-related
   IANA registries to YANG.  It contains the initial revision of the
   YANG module "iana-dns-class-rr-type" that defines derived types for
   the common parameters of DNS resource records (RR): class and type.
   These YANG types, "dns-class" and "rr-type", reflect the IANA
   registries "DNS CLASSes" and "Resource Record (RR) TYPEs"
   [IANA-DNS-PARAMETERS].

   Appendix A contains an XSLT 1.0 stylesheet that is intended to be
   used by IANA for generating the initial revision of the "iana-dns-
   class-rr-type" YANG module.  Subsequently, whenever a new class or RR
   type is added to the above registries, IANA will also update the
   "iana-dns-class-rr-type" YANG module, following the instructions in
   Section 4 below.

2.  Terminology

   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 [RFC2119] [RFC8174] when, and only when, they appear in all
   capitals, as shown here.

   The terminology for describing YANG data models is found in
   [RFC7950].

3.  YANG Design Considerations

   The IANA document "Domain Name System (DNS) Parameters"
   [IANA-DNS-PARAMETERS] contains altogether thirteen registries.  The
   YANG module "iana-dns-class-rr-type" defines derived types
   corresponding to only two of the registries that are essential for
   data models involving zone data, namely "DNS CLASSes" and "Resource
   Record (RR) TYPEs".  It is expected that the remaining registries in
   [IANA-DNS-PARAMETERS], as well as other DNS-related IANA registries,
   will be analogically reflected in future YANG modules as necessary.
   This way, an appropriate combination of YANG modules can be chosen
   depending on which YANG types are needed for a given data modeling
   purpose.

   The registries "DNS CLASSes" and "Resource Record (RR) TYPEs" are
   transformed into YANG enumeration types "dns-class-name" and "rr-
   type-name", respectively.  This is the initial fragment of the
   former:

Lhotka & Spacek         Expires 25 November 2021                [Page 3]
Internet-Draft         iana-dns-class-rr-type-yang              May 2021

     typedef dns-class-name {
       type enumeration {
         enum IN {
           value 1;
           description
             "Internet (IN)";
           reference
             "RFC 1035";
         }
         ...
       }
       ...
     }

   The other derived type, "rr-type-name", is defined analogically.

   [RFC3597] introduced the option of specifying a class or RR type via
   its assigned decimal number, as an alternative to the mnemonic name.
   For example, the "IN" class can be equivalently written as "CLASS1",
   and "AAAA" type can be written as "TYPE28".

   Accordingly, the derived types "dns-class" and "rr-type" are defined
   in the YANG module as a union of two member types:

   *  16-bit decimal integer ("uint16")

   *  mnemonic name belonging to the enumerations "dns-class-name" and
      "rr-type-name", respectively.

   For instance, the "rr-type" type is defined as follows:

     typedef rr-type {
       type union {
         type uint16;
         type rr-type-name;
       }
       description
         "This type allows for referring to a DNS resource record type
          using either the assigned mnemonic name or numeric value.";
     }

   As unassigned and reserved class and RR type values are not included
   in the mnemonic name enumerations, they can only be specified using
   their decimal values.

Lhotka & Spacek         Expires 25 November 2021                [Page 4]
Internet-Draft         iana-dns-class-rr-type-yang              May 2021

4.  IANA Considerations

   RFC Editor: In this section, replace all occurrences of "XXXX" with
   the actual RFC number (and remove this note).

   This section deals with actions and processes necessary for IANA to
   undertake to maintain the "iana-dns-class-rr-type" YANG module.  This
   YANG module is intended to reflect the "DNS CLASSes" and "Resource
   Record (RR) TYPEs" registries in [IANA-DNS-PARAMETERS].  The most
   recent revision of the YANG module is available from the "YANG
   Parameters" registry [IANA-YANG-PARAMETERS].

   Upon publication of this document, the initial revision of the "iana-
   dns-class-rr-type" YANG module SHALL be created by applying the XSLT
   stylesheet from Appendix A to the XML version of
   [IANA-DNS-PARAMETERS].

   IANA SHALL add this note to the "iana-dns-class-rr-type" item of the
   "YANG Module Names" registry [IANA-YANG-PARAMETERS]:

   |  Classes and types of DNS resource records must not be directly
   |  added to the "iana-dns-class-rr-type" YANG module.  They must
   |  instead be added to the "DNS CLASSes" and "Resource Record (RR)
   |  TYPEs" registries, respectively.

   When a new DNS class or RR type is added to the "DNS CLASSes" or
   "Resource Record (RR) TYPEs" registry, a new "enum" statement SHALL
   be added to the "dns-class-name" or "rr-type-name" type,
   respectively.  The assigned name defined by the "enum" statement
   SHALL be the same as the mnemonic name of the new class or type.  The
   following substatements to the "enum" statement SHALL be defined:

   "value":  Use the decimal value from the registry.

   "status":  Include only if a class or type registration has been
      deprecated or obsoleted.  In both cases, use the value "obsolete"
      as the argument of the "status" statement.

   "description":  Replicate the corresponding information from the
      registry, namely the full name of the new DNS class, or the
      meaning of the new RR type, if any.

   "reference":  Replicate the reference(s) from the registry.

   Unassigned or reserved values SHALL NOT be included in the "dns-
   class-name" and "rr-type-name" enumeration types.

Lhotka & Spacek         Expires 25 November 2021                [Page 5]
Internet-Draft         iana-dns-class-rr-type-yang              May 2021

   Each time the "iana-dns-class-rr-type" YANG module is updated, a new
   "revision" statement SHALL be added before the existing "revision"
   statements.

   IANA SHALL add this new note to the "DNS CLASSes" and "Resource
   Record (RR) TYPEs" registries:

   |  When this registry is modified, the YANG module "iana-dns-class-
   |  rr-type" must be updated as defined in RFC XXXX.

   The "Reference" text in the "DNS CLASSes" registry SHALL be updated
   as follows:

   |     OLD:
   |       [RFC6895]
   |  
   |     NEW:
   |       [RFC6895][RFCXXXX]

   The "Reference" text in the "Resource Record (RR) TYPEs" registry
   SHALL be updated as follows:

   |     OLD:
   |       [RFC6895][RFC1035]
   |  
   |     NEW:
   |       [RFC6895][RFC1035][RFCXXXX]

4.1.  URI Registrations

   This document registers a URI in the "IETF XML Registry" [RFC3688].
   The following registration has been made:

   |     URI: urn:ietf:params:xml:ns:yang:iana-dns-class-rr-type
   |     Registrant Contact: The IESG.
   |     XML: N/A, the requested URI is an XML namespace.

4.2.  YANG Module Registrations

   This document registers a YANG module in the "YANG Module Names"
   registry [RFC6020].  The following registration has been made:

   |     name:      iana-dns-class-rr-type
   |     namespace: urn:ietf:params:xml:ns:yang:iana-dns-class-rr-type
   |     prefix:    dnsct
   |     reference: RFC XXXX

Lhotka & Spacek         Expires 25 November 2021                [Page 6]
Internet-Draft         iana-dns-class-rr-type-yang              May 2021

5.  Security Considerations

   This documents translates two IANA registries into YANG data types
   and otherwise introduces no technology or protocol.  Consequently,
   there are no security issues to be considered for this document.

6.  Normative References

   [IANA-DNS-PARAMETERS]
              Internet Assigned Numbers Authority, "Domain Name System
              (DNS) Parameters",
              <https://www.iana.org/assignments/dns-parameters>.

   [IANA-YANG-PARAMETERS]
              Internet Assigned Numbers Authority, "YANG Parameters",
              <https://www.iana.org/assignments/yang-parameters>.

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119,
              DOI 10.17487/RFC2119, March 1997,
              <https://www.rfc-editor.org/info/rfc2119>.

   [RFC3688]  Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688,
              DOI 10.17487/RFC3688, January 2004,
              <https://www.rfc-editor.org/info/rfc3688>.

   [RFC6020]  Bjorklund, M., Ed., "YANG - A Data Modeling Language for
              the Network Configuration Protocol (NETCONF)", RFC 6020,
              DOI 10.17487/RFC6020, October 2010,
              <https://www.rfc-editor.org/info/rfc6020>.

   [RFC7950]  Bjorklund, M., Ed., "The YANG 1.1 Data Modeling Language",
              RFC 7950, DOI 10.17487/RFC7950, August 2016,
              <https://www.rfc-editor.org/info/rfc7950>.

   [RFC8174]  Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC
              2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,
              May 2017, <https://www.rfc-editor.org/info/rfc8174>.

   [W3C.REC-xslt-19991116]
              Clark, J., "XSL Transformations (XSLT) Version 1.0", World
              Wide Web Consortium Recommendation REC-xslt-19991116, 16
              November 1999,
              <https://www.w3.org/TR/1999/REC-xslt-19991116>.

7.  Informative References

Lhotka & Spacek         Expires 25 November 2021                [Page 7]
Internet-Draft         iana-dns-class-rr-type-yang              May 2021

   [RFC3597]  Gustafsson, A., "Handling of Unknown DNS Resource Record
              (RR) Types", RFC 3597, DOI 10.17487/RFC3597, September
              2003, <https://www.rfc-editor.org/info/rfc3597>.

Appendix A.  XSLT Stylesheet

   RFC Editor: In this section, replace all occurrences of "XXXX" with
   the actual RFC number (and remove this note).

   This appendix contains an XSLT 1.0 stylesheet [W3C.REC-xslt-19991116]
   that is intended to be used for generating the initial revision of
   the "iana-dns-class-rr-type" YANG module.  This is achieved by
   applying the stylesheet to the XML version of the IANA registry
   "Domain Name System (DNS) Parameters" [IANA-DNS-PARAMETERS] that was
   current at the time when this document was published.

   Using the ubiquitous xsltproc tool, the YANG module text can be
   generated with this command:

       $ xsltproc iana-dns-class-rr-type.xsl dns-parameters.xml

   <CODE BEGINS> file "iana-dns-class-rr-type.xsl"
   <?xml version="1.0" standalone="yes"?>
   <stylesheet xmlns="http://www.w3.org/1999/XSL/Transform"
               xmlns:iana="http://www.iana.org/assignments"
               version="1.0">
     <output method="text"/>
     <strip-space elements="*"/>

     <variable name="dq">"</variable>
     <variable name="sq">'</variable>
     <variable name="lf">&#xA;</variable>

     <variable name="module-intro">
       <text>module iana-dns-class-rr-type {
     yang-version 1.1;
     namespace "urn:ietf:params:xml:ns:yang:iana-dns-class-rr-type";
     prefix dnsct;

     organization
       "Internet Assigned Numbers Authority (IANA)";

     contact
       "        Internet Assigned Numbers Authority

        Postal: ICANN
                4676 Admiralty Way, Suite 330
                Marina del Rey, CA 90292

Lhotka & Spacek         Expires 25 November 2021                [Page 8]
Internet-Draft         iana-dns-class-rr-type-yang              May 2021

        Tel:    +1 310 823 9358

        &lt;mailto:iana@iana.org&gt;";

     description
       "This YANG module translates IANA registries 'DNS CLASSes' and
        'Resource Record (RR) TYPEs' to YANG derived types.

        Copyright (c) 2020 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
        (https://trustee.ietf.org/license-info).

        This initial version of this YANG module was generated from
        the corresponding IANA registries using a XSLT stylesheet
        from Appendix A of RFC XXXX
        (https://tools.ietf.org/html/rfcXXXX); see the RFC itself for
        full legal notices.";

     reference
       "IANA 'Domain Name System (DNS) Parameters' registry
        https://www.iana.org/assignments/dns-parameters";</text>
        <text>&#xA;&#xA;</text>
     </variable>

     <template name="enum">
       <param name="id"/>
       <value-of select="concat('      enum ', $id)"/>
       <text> {&#xA;        value </text>
       <value-of select="concat(iana:value, ';&#xA;')"/>
       <if test="contains(iana:description, 'OBSOLETE')">
         <text>        status obsolete;&#xA;</text>
       </if>
       <apply-templates select="iana:description"/>
       <variable name="xrefs" select="iana:xref[@type!='note']"/>
       <if test="$xrefs">
         <text>        reference&#xA;          "</text>
         <if test="count($xrefs)&gt;1">- </if>
         <apply-templates select="iana:xref[@type!='note']"/>
       </if>
       <text>      }&#xA;</text>
     </template>

Lhotka & Spacek         Expires 25 November 2021                [Page 9]
Internet-Draft         iana-dns-class-rr-type-yang              May 2021

     <template match="/">
       <value-of select="$module-intro"/>
       <apply-templates select="iana:registry[@id='dns-parameters']"/>
       <text>}&#xA;</text>
     </template>

     <template match="iana:registry[@id='dns-parameters']">
       <apply-templates select="iana:updated"/>
       <apply-templates
           select="iana:registry[@id='dns-parameters-2']"/>
       <apply-templates
           select="iana:registry[@id='dns-parameters-4']"/>
     </template>

     <template match="iana:updated">
       <value-of select="concat('  revision ', ., ' {')"/>
       <text>
       description
         "Initial revision.";
       reference
         "RFC XXXX: YANG Types for DNS Classes and Resource Record
          Types";
     }

     /* Typedefs */&#xA;&#xA;</text>
     </template>

     <template match="iana:registry[@id='dns-parameters-2']">
       <text>  typedef dns-class-name {&#xA;</text>
       <text>    type enumeration {&#xA;</text>
       <apply-templates
           select="iana:record[not(iana:description='Unassigned' or
                   starts-with(iana:description,'Reserved'))]"
           mode="class"/>
       <text>    }
       description
         "This enumeration type defines mnemonic names and corresponding
          numeric values of DNS classes.";
       reference
         "RFC 6895: Domain Name System (DNS) IANA Considerations";
     }

     typedef dns-class {
       type union {
         type uint16;
         type dns-class-name;
       }
       description

Lhotka & Spacek         Expires 25 November 2021               [Page 10]
Internet-Draft         iana-dns-class-rr-type-yang              May 2021

         "This type allows for referring to a DNS class using either the
          assigned mnemonic name or numeric value.";
     }&#xA;&#xA;</text>
     </template>

     <template match="iana:registry[@id='dns-parameters-4']">
       <text>  typedef rr-type-name {&#xA;</text>
       <text>    type enumeration {&#xA;</text>
       <apply-templates
           select="iana:record[iana:type!='Unassigned' and
                   iana:type!='Private use' and iana:type!='Reserved']"
           mode="rr-type"/>
       <text>    }
       description
         "This enumeration type defines mnemonic names and corresponding
          numeric values of DNS resource record types.";
       reference
         "- RFC 6895: Domain Name System (DNS) IANA Considerations

          - RFC 1035: Domain Names - Implementation and Specification";
     }

     typedef rr-type {
       type union {
         type uint16;
         type rr-type-name;
       }
       description
         "This type allows for referring to a DNS resource record type
          using either the assigned mnemonic name or numeric value.";
     }&#xA;</text>
     </template>

     <template match="iana:record" mode="class">
       <call-template name="enum">
         <with-param name="id">
           <choose>
             <when test="contains(iana:description,'(')">
               <value-of select="substring-before(substring-after(
                                 iana:description, '('), ')')"/>
             </when>
             <otherwise>
               <value-of
                   select="substring-after(iana:description, ' ')"/>
             </otherwise>
           </choose>
         </with-param>
       </call-template>

Lhotka & Spacek         Expires 25 November 2021               [Page 11]
Internet-Draft         iana-dns-class-rr-type-yang              May 2021

     </template>

     <template match="iana:record" mode="rr-type">
       <call-template name="enum">
         <with-param name="id" select="iana:type"/>
       </call-template>
     </template>

     <template match="iana:description">
       <text>        description&#xA;          </text>
       <value-of select="concat($dq, ., $dq, ';&#xA;')"/>
     </template>

     <template match="iana:xref">
       <choose>
         <when test="@type='rfc'">
           <value-of
               select="concat('RFC ', substring-after(@data, 'rfc'))"/>
         </when>
         <when test="@type='person'">
           <apply-templates
               select="/iana:registry/iana:people/iana:person[
                       @id=current()/@data]"/>
         </when>
         <when test="@type='text'">
           <value-of select="translate(., $dq, $sq)"/>
         </when>
         <otherwise>
           <value-of select="@data"/>
         </otherwise>
       </choose>
       <choose>
         <when test="position()=last()">
           <text>";&#xA;</text>
         </when>
         <otherwise>
           <text>&#xA;           - </text>
         </otherwise>
       </choose>
     </template>

     <template match="iana:person">
       <value-of select="concat(iana:name, ' &lt;', iana:uri, '&gt;')"/>
     </template>

   </stylesheet>
   <CODE ENDS>

Lhotka & Spacek         Expires 25 November 2021               [Page 12]
Internet-Draft         iana-dns-class-rr-type-yang              May 2021

Authors' Addresses

   Ladislav Lhotka
   CZ.NIC
   Czech Republic

   Email: ladislav.lhotka@nic.cz

   Petr Spacek
   Internet Systems Consortium
   Czech Republic

   Email: pspacek@isc.org

Lhotka & Spacek         Expires 25 November 2021               [Page 13]