<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
  ]>
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<?rfc toc="yes" ?>
<?rfc symrefs="yes" ?>
<?rfc sortrefs="yes"?>
<?rfc iprnotified="no" ?>
<?rfc strict="yes" ?>
<rfc category="std" ipr="trust200902"
     docName="draft-ietf-netmod-module-tags-00"
     updates="rfc6087bis">
  <front>
    <title abbrev="YANG Module Tags">YANG Module Tags</title>
    <author initials='C.' surname="Hopps" fullname='Christan Hopps'>
      <organization>Deutsche Telekom</organization>
      <address>
        <email>chopps@chopps.org</email>
      </address>
    </author>
    <author initials='L.' surname="Berger" fullname='Lou Berger'>
      <organization>LabN Consulting, L.L.C.</organization>
      <address>
        <email>lberger@labn.net</email>
      </address>
    </author>
    <author initials='D.' surname="Bogdanovic" fullname='Dean Bogdanovic'>
      <organization></organization>
      <address>
        <email>ivandean@gmail.com</email>
      </address>
    </author>
    <date/>
    <abstract>
      <t>
        This document provides for the association of tags with YANG
        modules. The expectation is for such tags to be used to help
        classify and organize modules. A method for defining, reading
        and writing a modules tags is provided, as well as an
        augmentation to YANG library. Tags may be standardized and
        assigned during module definition; assigned by implementations;
        or dynamically defined and set by users. This document provides
        guidance to future model writers and, as such, this document
        updates <xref target="I-D.ietf-netmod-rfc6087bis"/>.
      </t>
    </abstract>
  </front>
  <middle>
    <section anchor="sec-intro" title="Introduction">
      <t>
        The use of tags for classification and organization is fairly
        ubiquitous not only within IETF protocols, but in the internet
        itself (e.g., #hashtags). Tags can be usefully standardized, but
        they can also serve as a non-standardized mechanism available
        for users to define themselves. Our solution provides for both
        cases allowing for the most flexibility. In particular, tags may
        be standardized as well as assigned during module definition;
        assigned by implementations; or dynamically defined and set by
        users.
      </t>
      <t>
        This document defines two modules. The first module defines a
        list of module entries to allow for adding or removing of tags.
        It also defines an RPC to reset a modules tags to the original
        values. The second module defines an augmentation to YANG
        Library <xref target="RFC7895"/> to allow for reading a modules
        tags.
      </t>
      <t>
        This document also defines an IANA registry for tag prefixes
        as well as a set of globally assigned tags.
      </t>
      <t>
        <xref target="sec-guide"/> provides guidelines for
        authors of YANG data models.  This section updates <xref
        target="I-D.ietf-netmod-rfc6087bis"/>. 
      </t>
    </section>
    <section anchor="sec-conventions" title="Conventions Used in This Document">
      <t>
        The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
        "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
        document are to be interpreted as described in <xref target="RFC2119"/>.
      </t>
      <t>
        Note that lower case versions of these key words are used in
        section <xref target="sec-guide"/> where guidance is provided to
        future document authors.
      </t>
    </section>
    <section anchor="sec-tag-location" title="Tag Locations">
      <t>
        Each module has only one logical tag list; however, that tag
        list may be accessed from multiple locations.
      </t>
      <t>
        We define two tag list locations. The first location is used
        for configuration and is a top level list of module entries
        where each entry contain the list of tags. The second read-only
        location is through the yang library under the module entry.
      </t>
    </section>
    <section anchor="sec-prefixes" title="Tag Prefixes">
      <t>
        All tags have a prefix indicating who owns their definition. An
        IANA registry is used to support standardizing tag prefixes.
        Currently 3 prefixes are defined with all others reserved.
      </t>
      <section anchor="sec-std-tags" title="IETF Standard Tags">
        <t>
          An IETF standard tag is a tag that has the prefix "ietf:". All
          IETF standard tags are registered with IANA in a registry
          defined later in this document.
        </t>
      </section>
      <section anchor="sec-vendor-tags" title="Vendor Tags">
        <t>
          A vendor tag is a tag that has the prefix "vendor:". These
          tags are defined by the vendor that implements the module, and
          are not standardized; however, it is recommended that the
          vendor consider including extra identification in the tag name
          to avoid collisions (e.g., vendor:super-duper-company:...).
        </t>
      </section>
      <section anchor="sec-local-tags" title="Local Tags">
        <t>
          A local tag is any tag that has the prefix "local:". These tags
          are defined by the local user/administrator and will never be
          standardized.
        </t>
      </section>
      <section anchor="sec-resv-tags" title="Reserved Tags">
        <t>
          Any tag not starting with the prefix "ietf:", "vendor:" or
          "local:" is reserved for future standardization.
        </t>
      </section>
    </section>
  <section anchor="sec-mod-tag-mgmnt" title="Tag Management">
    <t>
      Tags can become associated with a module in a number of ways. Tags
      may be defined and associated at model design time, at
      implementation time, or via user administrative control. As the
      main consumer of tags are users, users may also remove any tag, no
      matter how the tag became associated with a module.
    </t>
    <section anchor="sec-module-tags" title="Module Definition Association">
      <t>
        A module definition SHOULD indicate a set of tags to be
        automatically added by the module implementer. These tags MUST
        be standard tags (<xref target="sec-std-tags"/>). This does
        imply that new modules may also drive the addition of new
        standard tags to the IANA registry.
      </t>
    </section>
    <section anchor="sec-imp-tags" title="Implementation Association">
      <t>
        An implementation MAY include additional tags associated with a
        module.  These tags may be standard or vendor specific tags. 
      </t>
    </section>
    <section anchor="sec-admin-tags" title="Administrative Tagging">
      <t>
        Tags of any kind can be assigned and removed with normal
        configuration mechanisms. Additionally we define an RPC to reset
        a module's tag list to the implementation default.
      </t>
      <t>
        Implementations MUST ensure that a modules tag list is
        consistent across any location from which the list is
        accessible. So if a user adds a tag through configuration that
        tag should also be seen when using the yang library
        augmentation.
      </t>
      <t>
        Implementations that do not support the reset rpc statement
        (whether at all, or just for a particular rpc or module) MUST
        respond with an YANG transport protocol-appropriate rpc layer
        error when such a statement is received.
      </t>
      <section anchor="sec-reset-tags" title="Resetting Tags">
        <t>
          The "reset-tags" rpc statement is defined to reset a module's
          tag list to the implementation default, i.e. the tags that are
          present based on module definition and any that are added
          during implementation time. This rpc statement takes module
          identification information as input, and provides the list of
          tags that are present after the reset.
        </t>
      </section>
    </section>
 </section>
    <section anchor="sec-module" title="Tags Module Structure">
      <section anchor="sec-module-tree" title="Tags Module Tree">
      <t>
        The tree associated with the tags module is:
        <figure>
          <artwork><![CDATA[
module: ietf-module-tags
  rpcs:
    +---x reset-tags
       +---w input
       |  +---w name        yang:yang-identifier
       |  +---w revision?   union
       +--ro output
          +--ro tags*   string
]]></artwork>
        </figure>
      </t>
      
      </section>
      <section anchor="sec-module-yang" title="Tags Module">
      <t>
        <figure>
          <artwork><![CDATA[
<CODE BEGINS> file "ietf-module-tags@2017-10-25.yang"
module ietf-module-tags {
  yang-version "1";
  namespace "urn:ietf:params:xml:ns:yang:ietf-module-tags";
  prefix "mtags";

  import ietf-yang-types {
    prefix yang;
  }

  import ietf-yang-library {
    prefix yanglib;
  }

  // meta
  organization "IETF NetMod Working Group (NetMod)";

  contact
    "NetMod Working Group - <netmod@ietf.org>";

  description
    "This module describes a tagging mechanism for yang module.
     Tags may be IANA assigned or privately defined types.";

  revision "2017-10-25" {
    description
      "Initial revision.";
    reference "TBD";
  }

  grouping module-tags {
    description
      "A grouping that may be used to classify a module.";

    leaf-list tags {
      type string;

      description
        "The module associated tags. See the IANA 'YANG Module Tag
        Prefix' registry for reserved prefixes and the IANA 'YANG
        Module IETF Tag' registry for IETF standard tags";
    }
  }

  grouping yanglib-common-leafs {
    description
      "Common parameters for YANG modules and submodules.
       This definition extract from RFC7895 as it is defined as
       a grouping within a grouping.

       TBD is there a legal way to use a grouping defined within
       another grouping without using the parent? If so, should change
       to that.";

    leaf name {
      type yang:yang-identifier;
      mandatory true;
      description
        "The YANG module or submodule name.";
    }
    leaf revision {
      type union {
        type yanglib:revision-identifier;
        type string { length 0; }
      }
      mandatory true;
      description
        "The YANG module or submodule revision date.
         A zero-length string is used if no revision statement
         is present in the YANG module or submodule.";
    }
  }

  list module-tags {
    key "name revision";
    description
      "A list of modules and their tags";
    uses yanglib-common-leafs; // uses yanglib:common-leafs;
    uses module-tags;
  }

  rpc reset-tags {
    description
      "Reset a list of tags for a given module to the list of module
       and implementation time defiend tags. It provides the list of
       tags associated with the module post reset.";

    input {
      uses yanglib-common-leafs; // uses yanglib:common-leafs;
    }

    output {
       uses module-tags;
    }
  }
}
<CODE ENDS>
]]></artwork>
        </figure>
      </t>
    </section>
    </section>

    <section anchor="sec-lib" title="Library Augmentation">
      <t>
        A modules tags can also be read using the yang library <xref
        target="RFC7895"/> if a server supports both YANG library and
        the augmentation defined below. If a server supports
        ietf-module-tags and the YANG library it SHOULD also support the
        ietf-library-tags module.
      </t>
      <t>
        The tree associated with the defined augmentation is:
        <figure>
          <artwork><![CDATA[
module: ietf-library-tags
  augment /yanglib:modules-state/yanglib:module:
    +--ro tags*   string
]]>
          </artwork>
        </figure>
      </t>
    <section anchor="sec-lib-module" title="Library Augmentation Module">
      <t>
        <figure>
          <artwork><![CDATA[
<CODE BEGINS> file "ietf-library-tags@2017-08-12.yang"
module ietf-library-tags {
  // namespace
  namespace "urn:ietf:params:xml:ns:yang:ietf-library-tags";

  prefix ylibtags;

  import ietf-yang-library {
     prefix yanglib;
  }
  import ietf-module-tags {
     prefix mtags;
  }

  // meta
  organization "IETF NetMod Working Group (NetMod)";

  contact
      "NetMod Working Group - <netmod@ietf.org>";

  description
    "This module augments ietf-yang-library with searchable
    classfication tags.  Tags may be IANA or privately defined
    types.";

  revision "2017-08-12" {
    description
      "Initial revision.";
    reference "RFC TBD";
  }

  augment "/yanglib:modules-state/yanglib:module" {
    description
      "The yang library structure is augmented with a module tags
       list. This allows operators to tag modules regardless of
       whether the modules included tag support or not";

    uses mtags:module-tags;

  }
}
<CODE ENDS>
]]></artwork>
        </figure>
      </t>
    </section>
    
    </section>
    <section anchor="sec-other" title="Other Classifications">
      <t>
        It's worth noting that a different yang module classification
        document exists <xref target="RFC8199"/>. That
        document is classifying modules in only a logical manner and
        does not define tagging or any other mechanisms. It divides yang
        modules into 2 categories (service or element) and then into one
        of 3 origins: standard, vendor or user.  It does provide a good
        way to discuss and identify modules in general. This document
        defines standard tags to support <xref target="RFC8199"/> style
        classification.
      </t>
    </section>
    <section anchor="sec-guide" title="Guidelines to Model Writers">
      <t>
        This section updates <xref target="I-D.ietf-netmod-rfc6087bis"/>.
      </t>
      <section anchor="sec-guide-def" title="Define Standard Tags">
        <t>
          A module SHOULD indicate, in the description statement of
          the module, a set of tags that are to be associated with
          it. This description should also include the appropriate
          conformance statement or statements, using <xref
          target="RFC2119"/> language for each tag.
          <figure>
            <artwork><![CDATA[
        module sample-module {
          ...
          description
            "[Text describing the module...]

            RFC<this document> TAGS:
            The following tags MUST be included by an implementation:
                 - ietf:some-required-tag:foo
                 - ...
            The following tags SHOULD be included by an implementation:
                 - ietf:some-recommended-tag:bar
                 - ...
            The following tags MAY be included by an implementation:
                 - ietf:some-optional-tag:baz
                 - ...
              ";
          ...
        }
]]>
            </artwork>
          </figure>
        </t>
        <t>
          One SHOULD only include conformance text if there will be tags
          listed (i.e., there's no need to indicate an empty set).
        </t>
        <t>
            The module writer may use existing standard tags, or use new
            tags defined in the model definition, as appropriate.  New
            tags should be assigned in the IANA registry defined below,
            see <xref target="sec-ietf-prefix"/> below.
        </t>
      </section>
    </section>
    <section anchor="sec-iana" title="IANA Considerations">
      <section anchor="sec-iana-prefix" title="YANG Module Tag Prefix Registry">
        <t>
          This registry allocates tag prefixes. All YANG module tags SHOULD
          begin with one of the prefixes in this registry.
        </t>
        <t>
          The allocation policy for this registry is Specification Required
          <xref target="RFC5226"/>.
        </t>
        <t>
          The initial values for this registry are as follows.
          <figure>
            <artwork>
 prefix    description
 --------  ---------------------------------------------------
 ietf:     IETF Standard Tag allocated in the IANA YANG Module
           IETF Tag Registry.
 vendor:   Non-standardized tags allocated by the module implementer.
 local:    Non-standardized tags allocated by and for the user.
            </artwork>
          </figure>
        </t>
        <t>
          Other SDOs (standard organizations) wishing to standardize their
          own set of tags could allocate a top level prefix from this
          registry.
        </t>
      </section>
      <section anchor="sec-ietf-prefix" title="YANG Module IETF Tag Registry">
        <t>
          This registry allocates prefixes that have the standard prefix
          "ietf:". New values should be well considered and not achievable
          through a combination of already existing standard tags.
        </t>
        <t>
          The allocation policy for this registry is IETF Review
          <xref target="RFC5226"/>.
        </t>
        <t>
          The initial values for this registry are as follows.
        </t>
        <t>
          [Editor's note: many of these tags may move to
          <xref target="I-D.ietf-rtgwg-device-model"/> if/when that
          document is refactored to use tags.]
        </t>
        <texttable anchor="table_ietf_iana" title="IETF Module Tag Registry">
          <ttcol align='center'>Tag</ttcol>
          <ttcol align='center'>Description</ttcol>
          <ttcol align='center'>Reference</ttcol>

         <c>ietf:rfc8199:element</c>
         <c>A module for a network element.</c>
         <c><xref target="RFC8199"/></c>

         <c>ietf:rfc8199:service</c>
         <c>A module for a network service.</c>
         <c><xref target="RFC8199"/></c>

         <c>ietf:rfc8199:standard</c>
         <c>A module defined by a standards organization.</c>
         <c><xref target="RFC8199"/></c>

         <c>ietf:rfc8199:vendor</c>
         <c>A module defined by a vendor.</c>
         <c><xref target="RFC8199"/></c>

         <c>ietf:rfc8199:user</c>
         <c>A module defined by the user.</c>
         <c><xref target="RFC8199"/></c>

         <c>ietf:device:hardware</c>
         <c>A module relating to device hardware (e.g., inventory).</c>
         <c>[This document]</c>

         <c>ietf:device:software</c>
         <c>A module relating to device software (e.g., installed OS).</c>
         <c>[This document]</c>

         <c>ietf:device:qos</c>
         <c>A module for managing quality of service.</c>
         <c>[This document]</c>

         <c>ietf:protocol</c>
         <c>A module representing a protocol.</c>
         <c>[This document]</c>

         <c>ietf:system-management</c>
         <c>A module relating to system management (e.g., a system
         management protocol).</c>
         <c>[This document]</c>

         <c>ietf:network-service</c>
         <c>A module relating to network service (e.g., a network
         service protocol).</c>
         <c>[This document]</c>

         <c>ietf:oam</c>
         <c>A module representing Operations, Administration, and Maintenance.</c>
         <c>[This document]</c>

         <c>ietf:routing</c>
         <c>A module related to routing.</c>
         <c>[This document]</c>

         <c>ietf:routing:rib</c>
         <c>A module related to routing information bases.</c>
         <c>[This document]</c>

         <c>ietf:routing:igp</c>
         <c>An interior gateway protocol module.</c>
         <c>[This document]</c>

         <c>ietf:routing:egp</c>
         <c>An exterior gateway protocol module.</c>
         <c>[This document]</c>

         <c>ietf:signaling</c>
         <c>A module representing control plane signaling.</c>
         <c>[This document]</c>

         <c>ietf:lmp</c>
         <c>A module representing a link management protocol.</c>
         <c>[This document]</c>
        </texttable>
      </section>
    </section>
  </middle>
  <?rfc needLines="20"?>
  <back>
    <references title="Normative References">
      <?rfc include="reference.RFC.2119"?>
      <?rfc include="reference.RFC.5226"?>
      <?rfc include="reference.RFC.7895"?>
      <?rfc include="reference.RFC.8199"?>
      <?rfc include="reference.I-D.ietf-netmod-rfc6087bis.xml"?>
    </references>
    <references title="Informative References">
      <?rfc include="reference.I-D.ietf-rtgwg-device-model.xml"?>
    </references>
  </back>
</rfc>

<!-- Local Variables: -->
<!-- fill-column:72 -->
<!-- End: -->
