<?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-rtgyangdt-netmod-module-tags-01"
     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 defines two modules that support the association
        of tags with modules. Tags may be included in a module or
        associated with a module through the use of an augmentation to
        YANG library that is defined in this document. The expectation
        is for such tags to be used to help classify and organize
        modules. 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 (see #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 and assigned during module definition;
        assigned by implementations; or dynamically defined and set by
        users.
      </t>
      <t>
        This document defines two modules that support the association
        of tags with modules. The first module defines a grouping which
        contains a list of tags as well as rpc statements for
        changing the contents of the list.  Tags are strings that are
        structured to enable the differentiation of globally assigned
        and non-assigned tags based on a fixed prefix.  This document
        also defines an initial set of globally assigned tags.
      </t>
      <t>
        The second module defined in this document defines an
        augmentation to YANG Library <xref target="RFC7895"/>.  It uses
        (imports) the first module to provide a well known location for
        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>
        Two tag list locations are defined. One location is within the
        module itself, and the other location is in the yang library
        under the modules entry.  When a module includes tags, the same
        tag list may also be presented in yang library.
      </t>
      <t>
        To add tags to a module, the module definition includes a
        tag list using the 'module-tags' grouping defined in this
        document. This list MUST be added by a module author under
        container named "module-tags" at the root of their module.
      </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 2 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.
        </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 as associated at model design time, at
      implementation time, or via user administrative control.  As the
      main consumer of tags are users, users may 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 standard 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 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 specific module's tags leaf
        list is consistent across any location from which the list is
        available. Specifically this includes in the module itself, per
        <xref target="sec-guide-mod" />, or in yang library, per <xref
        target="sec-lib" />.
      </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
          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-08-12.yang"
module ietf-module-tags {
  yang-version "1.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-08-12" {
    description
      "Initial revision.";
    reference "TBD";
  }

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

    leaf-list tags {
      type string;

      config false;

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

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

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

    <section anchor="sec-lib" title="Library Augmentation">
      <t>
        Tags can also be associated with a module using 
        the yang library <xref target="RFC7895"/>. When a server
        supports both yang library and the augmentation defined below,
        a user can add, remove and search for tags for any
        module on the server regardless of whether the specific module
        included tag support in its definition or not. 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="I-D.ietf-netmod-yang-model-classification"/>. 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="I-D.ietf-netmod-yang-model-classification"/> style
        classification.
      </t>
    </section>
    <section anchor="sec-guide" title="Guidelines to Model Writers">
      <t>
        This section updates <xref
        target="I-D.ietf-netmod-rfc6087bis"/>.  This document makes two
        recommendations to model writers,
      </t>
      <section anchor="sec-guide-mod" title="Include Module Tags">
        <t>
            The correct way to use the module-tags grouping is to
            include it in a standard location at the top level
            of your module, specifically contained within a container
            named "module-tags". This standard location allows searching
            module using a well-known xpath wilcard path. For example:
            <figure>
              <artwork><![CDATA[
        module sample-module {
          ...
          import ietf-module-tags {
            prefix mtags;
          }
          ...
          container module-tags {
            description
              "A list of classification tags associated with this
               module. The following predefined tags <MUST|SHOULD|MAY>
               be included by an implementation:
                 - ietf:foo
                 - ietf:bar
                 - ...
              ";
            uses mtags:module-tags;
          }
          ...
        }
]]>
              </artwork>
            </figure>
          </t>
          <t>
            The associated tree will look like:
            <figure>
              <artwork><![CDATA[
        module: sample-module
            +--rw module-tags
            |  +--ro tags*   string
            +--...

]]>
              </artwork>
            </figure>
          </t>
      </section>
      <section anchor="sec-guide-def" title="Define Standard Tags">
        <t>
            A module should indicate, in the description of the
            "module-tags" container, the set of tags that are
            to be populated in the leaf-list for any implementation of
            the module. This description should also include the
            appropriate conformance statement or statements, using <xref
            target="RFC2119"/> language, for each tag.
        </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 must
          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>
        </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: some of these tags are expected to move to
          <xref target="I-D.ietf-rtgwg-device-model"/> if/when this
          document becomes a WG document and 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:area:art</c>
         <c>Applications and Real-Time Area module.</c>
         <c>[This document]</c>

         <c>ietf:area:gen</c>
         <c>General Area module.</c>
         <c>[This document]</c>

         <c>ietf:area:int</c>
         <c>Internet Area module.</c>
         <c>[This document]</c>

         <c>ietf:area:ops</c>
         <c>Operations and Management Area module.</c>
         <c>[This document]</c>

         <c>ietf:area:rtg</c>
         <c>Routing Area module.</c>
         <c>[This document]</c>

         <c>ietf:area:sec</c>
         <c>Security Area module.</c>
         <c>[This document]</c>

         <c>ietf:area:tsv</c>
         <c>Transport Area module.</c>
         <c>[This document]</c>

         <c>ietf:element</c>
         <c>A module for an element (*).</c>
         <c>[This document]</c>

         <c>ietf:service</c>
         <c>A module for a service (*).</c>
         <c>[This document]</c>

         <c>ietf:hardware</c>
         <c>A module for hardware.</c>
         <c>[This document]</c>

         <c>ietf:software</c>
         <c>A module for software.</c>
         <c>[This document]</c>

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

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

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

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

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

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

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

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

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

         <postamble>
         (*) - see <xref target="I-D.ietf-netmod-yang-model-classification"/>
         </postamble>
        </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.I-D.ietf-netmod-rfc6087bis.xml"?>
    </references>
    <references title="Informative References">
      <?rfc
        include="reference.I-D.draft-ietf-netmod-yang-model-classification-04.xml"?>
      <?rfc include="reference.I-D.ietf-rtgwg-device-model.xml"?>
    </references>
  </back>
</rfc>

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