<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rfc SYSTEM "rfc2629-xhtml.ent">

<rfc docName="draft-ietf-dnsop-iana-class-type-yang-05" number="9108" ipr="trust200902" xmlns:xi="http://www.w3.org/2001/XInclude" submissionType="IETF" category="std" consensus="true" tocInclude="true" tocDepth="3" symRefs="true" sortRefs="true" updates="" obsoletes="" xml:lang="en" version="3">

  <front>
    <title abbrev="YANG Types for DNS and RR">YANG Types for DNS
    Classes and Resource Record Types</title>
    <seriesInfo name="RFC" value="9108"/>
    <author fullname="Ladislav Lhotka" initials="L." surname="Lhotka">
      <organization>CZ.NIC</organization>
      <address>
	<postal>
	  <country>Czech Republic</country>
	</postal>
        <email>ladislav.lhotka@nic.cz</email>
      </address>
    </author>
    <author fullname="Petr Špaček" initials="P." surname="Špaček">
      <organization>Internet Systems Consortium</organization>
      <address>
	<postal>
	  <country>Czech Republic</country>
	</postal>
        <email>pspacek@isc.org</email>
      </address>
    </author>
    <date month="September" year="2021"/>
    
<area>Operations and Management</area>
<workgroup>DNSOP Working Group</workgroup>

<keyword>IANA registry</keyword>
<keyword>DNA Parameters</keyword>

    <abstract>
      <t>This document introduces the YANG
      module "iana-dns-class-rr-type", which contains derived types
      reflecting two IANA registries: DNS CLASSes and Resource Record
      (RR) TYPEs. These YANG types are intended as the minimum basis for
      future data modeling work.</t>
    </abstract>
  </front>

  <middle>
    <section anchor="introduction" title="Introduction">
      <t>YANG <xref target="RFC7950"/> has become a de facto standard
      as a language for modeling configuration and state data, as well
      as specifying management operations and asynchronous
      notifications. It is reasonable to expect that the approach
      based on utilizing such data models along with standard
      management protocols such as NETCONF&#xA0;<xref target="RFC6241"/>
      and RESTCONF&#xA0;<xref target="RFC8040"/> can be effectively used in
      DNS operations, too. In fact, several efforts are currently
      underway that attempt to use NETCONF or RESTCONF for configuring
      and managing</t>
      <ul>
        <li>authoritative servers,</li>
        <li>resolvers, and</li>
        <li>zone data.</li>
      </ul>
      <t>While it is possible to use the management protocols
      mentioned above with ad hoc or proprietary data models, their
      real potential can be realized only if there is a (completely or
      partly) unified data model supported by multiple DNS software
      implementations. Operators can then, for instance, run several
      DNS server implementations in parallel, and use a common
      configuration and management interface and data for all of
      them. Also, it becomes considerably easier to migrate to another
      implementation.</t>
      <t>Based on the previous experience from the IETF Routing Area,
      it is to be expected that the development of unified data models
      for DNS will be a lengthy and complicated process that will
      require active cooperation and compromise from the vendors and
      developers of major DNS server platforms. Nevertheless, it is
      likely that any DNS-related data modeling effort will need to
      use various DNS parameters and enumerations that are specified
      in several IANA registries. For use with YANG, these parameters
      and enumerations have to be translated into corresponding YANG
      types or other structures. Such translations should be
      straightforward and relatively uncontroversial.</t>
      <t>This document provides a translation of two fundamental
      DNS-related IANA registries to YANG. It contains the initial
      version of the YANG module "iana-dns-class-rr-type", which
      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" <xref target="IANA-DNS-PARAMETERS"/>.</t>
      <t><xref target="app.xslt"/> contains an XSLT 1.0 stylesheet
      that is intended to be used by IANA for generating the initial
      version 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 <xref target="iana"/> below.</t>
    </section>

    <section anchor="terminology" title="Terminology">
        <t>
    The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL
    NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
    "<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are to be interpreted as
    described in BCP&nbsp;14 <xref target="RFC2119"/> <xref target="RFC8174"/> 
    when, and only when, they appear in all capitals, as shown here.
        </t>


      <t>The terminology for describing YANG data models can be found
      in <xref target="RFC7950"/>. DNS terminology used in this
      document can be found in <xref target="RFC1035"/> and <xref target="RFC8499"/>.</t>

    </section>

    <section anchor="design" title="YANG Design Considerations">

      <t>At the time of writing, the "Domain Name System
      (DNS) Parameters" <xref target="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
      <xref target="IANA-DNS-PARAMETERS"/>, as well as other
      DNS-related IANA registries, will be analogously 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.</t>
      <t>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:</t>

      <sourcecode type="yang">
  typedef dns-class-name {
    type enumeration {
      enum IN {
        value 1;
        description
          "Internet (IN)";
        reference
          "RFC 1035";
      }
      ...
    }
    ...
  }
      </sourcecode>
      <t>The other derived type, "rr-type-name", is defined
      similarly.</t>

      <t><xref target="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".</t>
      <t>Accordingly, the derived types "dns-class" and "rr-type" are
      defined in the YANG module as a union of two member types:</t>
      <ul>
        <li>16-bit decimal integer ("uint16")</li>
        <li>mnemonic name belonging to the enumerations
        "dns-class-name" and "rr-type-name", respectively.</li>
      </ul>
      <t>For instance, the "rr-type" type is defined as follows:</t>
      <sourcecode type="yang">
  typedef rr-type {
    type union {
      type uint16;
      type rr-type-name;
    }
    description
      "This type allows reference to a DNS resource record type
       using either the assigned mnemonic name or numeric value.";
  }
      </sourcecode>
      <t>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.</t>
      
    </section>

    <section anchor="iana" title="IANA Considerations">

      <t>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 <xref target="IANA-DNS-PARAMETERS"/>. The most recent version of the
      YANG module is available from the "YANG Parameters" registry <xref target="IANA-YANG-PARAMETERS"/>.</t>

      <t>With the publication of this document, IANA has created and posted the initial version
of the "iana-dns-class-rr-type" YANG module by applying the XSLT stylesheet from 
<xref target="app.xslt"/> to the XML version of <xref target="IANA-DNS-PARAMETERS"/>.</t>

      <t>IANA has added this note to the "iana-dns-class-rr-type" item
      of the "YANG Module Names" registry <xref target="IANA-YANG-PARAMETERS"/>:</t>

      <blockquote>
        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.
      </blockquote>

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

      <dl indent="16">
        <dt>"value":</dt>
	<dd>Use the decimal value from the registry.</dd>
        <dt>"status":</dt>
	<dd>Include only if a class or type registration has been
	deprecated or obsoleted. IANA "deprecated" maps to YANG status
	"deprecated", and IANA "obsolete" maps to YANG status "obsolete".</dd>
        <dt>"description":</dt>
	<dd>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.</dd>
        <dt>"reference":</dt>
	<dd>Replicate the reference(s) from the registry.</dd>
      </dl>
      <t>Unassigned or reserved values <bcp14>SHALL NOT</bcp14> be included in the
      "dns-class-name" and "rr-type-name" enumeration types.</t>
      <t>Each time the "iana-dns-class-rr-type" YANG module is updated, a new
      "revision" statement <bcp14>SHALL</bcp14> be added before the existing
      "revision" statements.</t>
      
      <t>IANA has added this note to the "DNS CLASSes" and
      "Resource Record (RR) TYPEs" registries:</t>
      <blockquote>
	When this registry is modified, the YANG module
	"iana-dns-class-rr-type" must be updated as defined in [RFC9108].
      </blockquote>

      <t>The "Reference" text in the "DNS CLASSes" registry has been 
      updated as follows:</t>

<t>
OLD:</t>
      <blockquote>
  [RFC6895]     </blockquote>
<t>
NEW:</t>
    <blockquote>
  [RFC6895][RFC9108]
  </blockquote>
  

      <t>The "Reference" text in the "Resource Record (RR) TYPEs"
      registry has been updated as follows:</t>
<t>
OLD:</t>
      <blockquote>
  [RFC6895][RFC1035] </blockquote>
<t>
NEW:</t>
<blockquote>
  [RFC6895][RFC1035][RFC9108]       
      </blockquote>

      <section title="URI Registrations">

        <t>This document registers a URI in the "IETF XML Registry"
        <xref target="RFC3688"/>. The following registration has been
        made:</t>
<dl spacing="compact">
<dt>URI:</dt><dd>urn:ietf:params:xml:ns:yang:iana-dns-class-rr-type</dd>
<dt>Registrant Contact:</dt><dd>The IESG.</dd>
<dt>XML:</dt><dd>N/A; the requested URI is an XML namespace.</dd>
</dl>
      </section>

      <section title="YANG Module Registrations">
        <t>This document registers a YANG module in the "YANG Module
        Names" registry <xref target="RFC6020"/>. The following
        registration has been made:</t>
<dl spacing="compact">
<dt>Name:</dt><dd>iana-dns-class-rr-type</dd>
<dt>Namespace:</dt><dd>urn:ietf:params:xml:ns:yang:iana-dns-class-rr-type</dd>
<dt>Prefix:</dt><dd>dnsct</dd>
<dt>Reference:</dt><dd>RFC 9108</dd>
</dl>
      </section>

    </section>

    <section anchor="security" title="Security Considerations">
      
      <t>This document translates two IANA registries into YANG data
      types and otherwise introduces no technology or
      protocol. The definitions themselves have no security impact on
      the Internet, but their use in concrete YANG modules might
      have. The security considerations spelled out in the YANG
      specification&#xA0;<xref target="RFC7950"/> apply to this document
      as well.</t>

    </section>

  </middle>

  <back>
<references>
<name>References</name>
    <references title="Normative References">
      <reference anchor="IANA-DNS-PARAMETERS" target="https://www.iana.org/assignments/dns-parameters">
        <front>
          <title>Domain Name System (DNS) Parameters</title>
          <author>
            <organization>IANA</organization>
          </author>
        </front>
      </reference>
      <reference anchor="IANA-YANG-PARAMETERS" target="https://www.iana.org/assignments/yang-parameters">
        <front>
          <title>YANG Parameters</title>
          <author>
            <organization>IANA</organization>
          </author>
        </front>
      </reference>
      

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.3688.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6020.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7950.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
      
<reference anchor="W3C.REC-xslt-19991116" target="https://www.w3.org/TR/1999/REC-xslt-19991116">
<front>
<title>XSL Transformations (XSLT) Version 1.0</title>
<author initials="J." surname="Clark" fullname="James Clark">
    <organization/>
</author>
<date month="November" year="1999"/>
</front>
<seriesInfo name="W3C Recommendation" value="REC-xslt-19991116"/>
</reference>

    </references>

    <references title="Informative References">
      
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.1035.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.3597.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6241.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8040.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8499.xml"/>

    </references>
</references>
    <section anchor="app.xslt" title="XSLT Stylesheet">


      <t>This appendix contains an XSLT 1.0 stylesheet <xref target="W3C.REC-xslt-19991116"/> that is to be used to
      generate 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" <xref target="IANA-DNS-PARAMETERS"/> that was
      current at the time this document was published.</t>

      <t>Using the ubiquitous xsltproc tool, the YANG module text can
      be generated with this command:</t>
      <sourcecode type="bash">
    $ xsltproc iana-dns-class-rr-type.xsl dns-parameters.xml
      </sourcecode>

      <sourcecode markers="true" name="iana-dns-class-rr-type.xsl" type="xml"><![CDATA[
<?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="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
             12025 Waterfront Drive, Suite 300
             Los Angeles, CA 90094

     Tel:    +1 424 254 5300

     &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) 2021 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 version of this YANG module was generated from
     the corresponding IANA registries using an XSLT stylesheet
     from Appendix A of RFC 9108
     (https://www.rfc-editor.org/info/rfc9108); 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>

  <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 9108: 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
      "This type allows reference 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 reference 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>
  </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>

]]></sourcecode>

    </section>
    
  </back>
</rfc>
