<?xml version="1.0" encoding="UTF-8"?>
  <?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
  <!-- generated by https://github.com/cabo/kramdown-rfc2629 version 1.0.30 -->

<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
]>

<?rfc strict="yes"?>
<?rfc toc="yes"?>
<?rfc tocdepth="4"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>

<rfc ipr="trust200902" docName="draft-veillette-core-cool-library-00" category="std">

  <front>
    <title>Constrained YANG Module Library</title>

    <author initials="M.V." surname="Veillette" fullname="Michel Veillette" role="editor">
      <organization>Trilliant Networks Inc.</organization>
      <address>
        <postal>
          <street>610 Rue du Luxembourg</street>
          <city>Granby</city>
          <region>Quebec</region>
          <code>J2J 2V2</code>
          <country>Canada</country>
        </postal>
        <phone>+14503750556</phone>
        <email>michel.veillette@trilliantinc.com</email>
      </address>
    </author>

    <date year="2016" month="August" day="23"/>

    <area>Applications and Real-Time Area (art)</area>
    <workgroup>Internet Engineering Task Force</workgroup>
    <keyword>YANG</keyword>

    <abstract>


<t>This document describes a library, which provides information about all YANG modules implemented by a CoOL server endpoint.  A simple caching mechanism is provided to minimize retrieval of this information by CoOL clients.</t>



    </abstract>


  </front>

  <middle>


<section anchor="introduction" title="Introduction">

<t>The YANG module defined in this meno is available to CoOL clients to discover the different YANG data models supported by a CoOL server endpoint. The following YANG module information is needed by client applications to fully utilize the YANG data modeling language:</t>

<t><list style="symbols">
  <t>module list: The list of YANG modules implemented by the CoOL server endpoint, each module is identified by its SID and revision.</t>
  <t>submodule list: The list of YANG submodules included by each module, each submodule is identified by its SID and revision.</t>
  <t>feature list: The list of features supported by each YANG module, each feature is identified by its SID.</t>
  <t>deviation list: The list of YANG modules used for deviation statements associated with each YANG module, each module is identified by its SID and revision.</t>
</list></t>

</section>
<section anchor="terminology-and-notation" title="Terminology and Notation">

<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>The following terms are defined in <xref target="I-D.ietf-netmod-rfc6020bis"/>:</t>

<t><list style="symbols">
  <t>module</t>
  <t>submodule</t>
  <t>feature</t>
  <t>deviation</t>
</list></t>

<t>The following terms are defined in <xref target="I-D.somaraju-core-sid"/>:</t>

<t><list style="symbols">
  <t>Structured IDentifier (SID)</t>
</list></t>

<t>The following terms are defined in <xref target="I-D.veillette-core-cool"/>:</t>

<t><list style="symbols">
  <t>CoOL client</t>
  <t>CoOL server</t>
  <t>endpoint</t>
</list></t>

<t>The following terms are used within this document:</t>

<t><list style="symbols">
  <t>library: a collection of YANG modules used by a server endpoint</t>
</list></t>

</section>
<section anchor="overview" title="Overview">

<t>The “ietf-cool-library” module provides information about the YANG library used by a server endpoint.  This module is defined using YANG version 1, but it supports the description of YANG modules written in any revision of YANG.</t>

<section anchor="tree-diagram" title="Tree diagram">

<t>A simplified graphical representation of the YANG module specified in this document (ietf-cool-library) is provided below.  The  meaning of the symbols in this diagram is as follows:</t>

<t><list style="symbols">
  <t>Brackets “[” and “]” enclose list keys.</t>
  <t>Abbreviations before data node names: “rw” means configuration
data (read-write) and “ro” state data (read-only).</t>
  <t>Symbols after data node names: “?” means an optional node, “!”
means a presence container, and “*” denotes a list and leaf-list.</t>
</list></t>

<figure align="left"><artwork><![CDATA[
module: ietf-cool-library
   +--ro modules-state
      +--ro module-set-id    union
      +--ro module* [sid revision]
         +--ro sid                 sid
         +--ro revision            revision
         +--ro feature*            sid
         +--ro deviation* [sid revision]
         |  +--ro sid         sid
         |  +--ro revision    revision
         +--ro conformance-type    enumeration
         +--ro submodule* [sid revision]
            +--ro sid         sid
            +--ro revision    revision
notifications:
   +---n cool-library-change
      +--ro module-set-id    -> /modules-state/module-set-id
]]></artwork></figure>

</section>
<section anchor="description" title="Description">

<section anchor="modules-state" title="modules-state">

<t>This mandatory container holds the module set identifier and the list of modules supported by the server endpoint.</t>

</section>
<section anchor="modules-statemodule-set-id" title="modules-state/module-set-id">

<t>This mandatory leaf contains an identifier representing the current set of modules and submodules used by a server endpoint. This identifier is endpoint-specific when implemented as unit32 or shared between multiple endpoints on one or multiple servers when implemented as identityref.  The value of this leaf MUST change whenever the set of modules and submodules in the library changes.  There is no requirement that the same set always results in the same module-set-id value.</t>

<t>This leaf allows a client to fetch the module list once, cache it, and only re-fetch it if the value of this leaf has been changed.</t>

<t>If the value of this leaf changes, the server also generates a “cool-library-change” notification, with the new value of “module-set-id”.</t>

</section>
<section anchor="modules-statemodule" title="modules-state/module">

<t>This mandatory list contains one entry for each YANG module supported by the server endpoint.  There MUST be an entry in this list for each revision of each YANG module that is used by the server.</t>

</section>
</section>
</section>
<section anchor="yang-module-ietf-cool-library" title="YANG Module “ietf-cool-library”">

<t>RFC Ed.: update the date below with the date of RFC publication
and remove this note.</t>

<figure align="left"><artwork><![CDATA[
<CODE BEGINS> file "ietf-cool-library@2016-06-01.yang"
module ietf-cool-library {
  namespace "urn:ietf:params:xml:ns:yang:ietf-cool-library";
  prefix "coollib";

  organization
    "IETF CORE (Constrained RESTful Environments) Working Group";

  contact
    "WG Web:   <http://datatracker.ietf.org/wg/core/>
    
     WG List:  <mailto:core@ietf.org>

     WG Chair: Carsten Bormann 
               <mailto:cabo@tzi.org>

     WG Chair: Jaime Jimenez 
               <mailto:jaime.jimenez@ericsson.com>

     Editor:   Michel Veillette
               <mailto:michel.veillette@trilliantinc.com>";

  description
    "This module contains the list of YANG modules and submodules
    implemented by a CoOL server endpoint.

     Copyright (c) 2016 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
     (http://trustee.ietf.org/license-info).

     This version of this YANG module is part of RFC XXXX; see
     the RFC itself for full legal notices.";

  // RFC Ed.: replace XXXX with actual RFC number and remove
  // this note.

  // RFC Ed.: update the date below with the date of the RFC
  // publication and remove this note.

  // RFC Ed.: update [I-D.somaraju-core-sid] with actual RFC
  // number and remove this note.
  
  revision 2016-06-01 {
    description
      "Initial revision.";
    reference
      "RFC XXXX: Contrained YANG Module Library.";
  }

  /*
   * Typedefs
   */

  typedef revision {
    type binary {
      length "4";
    }
    description
      "Revision date encoded as a binary string as follow:
      - First byte = Century
      - Second byte = Year (0 to 99)
      - Third byte = Month (1 = January to 12 = december)
      - Forth byte = Day (1 to 31)";
  }

  typedef sid {
    type uint32;
    description
      "Unique identifier assigned to different YANG items
      such as data nodes, RPCs and actions, notifications,
      modules, sub-modules, features and deviations. The SID
      registration process is defined in
      [I-D.somaraju-core-sid].";
  }
  
  /*
   * Groupings
   */

  grouping identification-info {
    description
      "YANG modules and submodules identification information.";

    leaf sid {
      type sid;
      mandatory true;
      description
        "SID assigned to this module or submodule.";
    }
    
    leaf revision {
      type revision;
      description
        "Revision date assigned to this module or submodule.
        A zero-length binary string is used if no revision statement
        is present in the YANG module or submodule.";
    }
  }
  
  identity module-set {
      description
        "Base identity from which shared module-set identifiers
        are derived.";
    }
  
  /*
   * Operational state data nodes
   */

  container modules-state {
    config false;
    description
      "Contain information about the different data models
      implement by a CoOL endpoint.";
    
    leaf module-set-id {
      type union {
        type uint32;
        type identityref {
          base "coollib:module-set";
        }
      }
      mandatory true;
      description
        "Identifier representing the current set of modules
        and submodules listed in the 'module' list. This
        identifier is endpoint-specific when implemented as
        unit32 or shared between multiple endpoints on one
        or multiple servers when implemented as identityref.
        The server MUST change the value of this leaf each
        time the information represented by the 'module'
        list instance changes.";
    }

    list module {
      key "sid revision";
      description
        "Each entry represents one revision of one module
         currently supported by the server endpoint.";

      uses identification-info;
      
      leaf-list feature {
        type sid;
        description
          "List of YANG features from this module that are
          supported by the server endpoint, regardless whether
          they are defined in the module or any included
          submodule.";
      }
      
      list deviation {
        key "sid revision";
        description
          "List of YANG deviation modules used by this server
          endpoint to modify the conformance of the module
          associated with this entry.  Note that the same module
          can be used for deviations for multiple modules, so the
          same entry MAY appear within multiple 'module' entries.

          The deviation module MUST be present in the 'module'
          list, with the same sid and revision values.
          The 'conformance-type' value will be 'implement' for
          the deviation module.";
          
        uses identification-info;
      }
      
      leaf conformance-type {
        type enumeration {
          enum implement {
            value 0;
            description
              "Indicates that the server endpoint implements one or
              more protocol-accessible objects defined in the YANG
              module identified in this entry.  This includes
              deviation statements defined in the module.

              For YANG version 1.1 modules, there is at most one
              module entry with conformance type 'implement' for a
              particular module, since YANG 1.1 requires that
              at most one revision of a module is implemented.

              For YANG version 1 modules, there SHOULD NOT be more
              than one module entry for a particular module.";
          }
          enum import {
            value 1;
            description
              "Indicates that the server endpoint imports reusable
              definitions from the specified revision of the module,
              but does not implement any protocol accessible objects
              from this revision.

              Multiple module entries for the same module MAY
              exist. This can occur if multiple modules import the
              same module, but specify different revision-dates in
              the import statements.";
          }
        }
        mandatory true;
        description
          "Indicates the type of conformance the server endpoint is
          claiming for the YANG module identified by this entry.";
      }
      
      list submodule {
        key "sid revision";
        description
          "Each entry represents one submodule within the
           parent module.";
        uses identification-info;
      }
    }
  }

  /*
   * Notifications
   */

  notification cool-library-change {
    description
      "Generated when the set of modules and submodules supported
      by the server endpoint has changed.";
      
    leaf module-set-id {
      type leafref {
        path "/coollib:modules-state/coollib:module-set-id";
      }
      mandatory true;
      description
        "Contains the module-set-id value representing the
        set of modules and submodules supported at the server
        endpoint at the time the notification is generated.";
    }
  }
}
<CODE ENDS>
]]></artwork></figure>

</section>
<section anchor="iana-considerations" title="IANA Considerations">

<section anchor="yang-module-registry" title="YANG Module Registry">

<t>This document registers one YANG module in the YANG Module Names registry <xref target="I-D.ietf-netmod-rfc6020bis"/>.</t>

<t>name:         ietf-cool-library</t>

<t>namespace:    urn:ietf:params:xml:ns:yang:ietf-cool-library</t>

<t>prefix:       coollib</t>

<t>reference:    RFC XXXX</t>

<t>// RFC Ed.: replace XXXX with RFC number and remove this note</t>

</section>
</section>
<section anchor="security-considerations" title="Security Considerations">

<t>This YANG module is designed to be accessed via the CoOL protocol <xref target="I-D.veillette-core-cool"/>.  Some of the readable data nodes in this YANG module may be considered sensitive or vulnerable in some network environments.  It is thus important to control read access to these data nodes.</t>

<t>Specifically, the ‘module’ list may help an attacker identify the server capabilities and server implementations with known bugs. Server vulnerabilities may be specific to particular modules, module revisions, module features, or even module deviations.  This information is included in each module entry.  For example, if a particular operation on a particular data node is known to cause a server to crash or significantly degrade device performance, then the module list information will help an attacker identify server implementations with such a defect, in order to launch a denial of service attack on the device.</t>

</section>
<section anchor="acknowledgments" title="Acknowledgments">

<t>The YANG module defined by this memo have been derived from an already existing YANG module targeting the RESTconf protocol <xref target="I-D.ietf-netconf-restconf"/>. We will like to thank the authors of this prior work <xref target="I-D.ietf-netconf-yang-library"/> which have been essential for the development of “ietf-cool-library” targeting the Constrained Objects Language <xref target="I-D.veillette-core-cool"/> protocol. The authors would also like to thank Andy Bierman for his recommendations and his review of the resulting YANG module.</t>

</section>


  </middle>

  <back>

    <references title='Normative References'>





<reference  anchor='RFC2119' target='http://www.rfc-editor.org/info/rfc2119'>
<front>
<title>Key words for use in RFCs to Indicate Requirement Levels</title>
<author initials='S.' surname='Bradner' fullname='S. Bradner'><organization /></author>
<date year='1997' month='March' />
<abstract><t>In many standards track documents several words are used to signify the requirements in the specification.  These words are often capitalized. This document defines these words as they should be interpreted in IETF documents.  This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t></abstract>
</front>
<seriesInfo name='BCP' value='14'/>
<seriesInfo name='RFC' value='2119'/>
<seriesInfo name='DOI' value='10.17487/RFC2119'/>
</reference>



<reference anchor='I-D.ietf-netmod-rfc6020bis'>
<front>
<title>The YANG 1.1 Data Modeling Language</title>

<author initials='M' surname='Bjorklund' fullname='Martin Bjorklund'>
    <organization />
</author>

<date month='June' day='17' year='2016' />

<abstract><t>YANG is a data modeling language used to model configuration data, state data, remote procedure calls, and notifications for network management protocols.  This document describes the syntax and semantics of version 1.1 of the YANG language.  YANG version 1.1 is a maintenance release of the YANG language, addressing ambiguities and defects in the original specification.  There are a small number of backward incompatibilities from YANG version 1.  This document also specifies the YANG mappings to the Network Configuration Protocol (NETCONF).</t></abstract>

</front>

<seriesInfo name='Internet-Draft' value='draft-ietf-netmod-rfc6020bis-14' />
<format type='TXT'
        target='http://www.ietf.org/internet-drafts/draft-ietf-netmod-rfc6020bis-14.txt' />
</reference>



<reference anchor='I-D.somaraju-core-sid'>
<front>
<title>Structure Identifier (SID)</title>

<author initials='A' surname='Somaraju' fullname='Abhinav Somaraju'>
    <organization />
</author>

<author initials='M' surname='Veillette' fullname='Michel Veillette'>
    <organization />
</author>

<author initials='A' surname='Pelov' fullname='Alexander Pelov'>
    <organization />
</author>

<author initials='R' surname='Turner' fullname='Randy Turner'>
    <organization />
</author>

<author initials='A' surname='Minaburo' fullname='Ana Minaburo'>
    <organization />
</author>

<date month='July' day='8' year='2016' />

<abstract><t>Structured IDentifiers (SID) are used to identify different YANG items when encoded in CBOR.  This document defines the registration and assignment processes of SIDs.  To enable the implementation of these processes, this document also defines a file format used to persist and publish assigned SIDs.</t></abstract>

</front>

<seriesInfo name='Internet-Draft' value='draft-somaraju-core-sid-01' />
<format type='TXT'
        target='http://www.ietf.org/internet-drafts/draft-somaraju-core-sid-01.txt' />
</reference>




    </references>

    <references title='Informative References'>





<reference anchor='I-D.veillette-core-cool'>
<front>
<title>Constrained Objects Language</title>

<author initials='M' surname='Veillette' fullname='Michel Veillette'>
    <organization />
</author>

<author initials='A' surname='Pelov' fullname='Alexander Pelov'>
    <organization />
</author>

<author initials='A' surname='Somaraju' fullname='Abhinav Somaraju'>
    <organization />
</author>

<author initials='R' surname='Turner' fullname='Randy Turner'>
    <organization />
</author>

<author initials='A' surname='Minaburo' fullname='Ana Minaburo'>
    <organization />
</author>

<date month='July' day='18' year='2016' />

<abstract><t>This document describes a management function set adapted to constrained devices and constrained networks (e.g., low-power, lossy).  CoOL objects (datastores, RPCs, actions and notifications) are defined using the YANG modelling language [I-D.ietf-netmod-rfc6020bis].  Interactions with these objects are performed using the CoAP web transfer protocol [RFC7252].  Payloads are encoded using the CBOR data format [RFC7049].  The mapping between YANG data models and the CBOR data format is defined in [I-D.ietf-core-yang-cbor].</t></abstract>

</front>

<seriesInfo name='Internet-Draft' value='draft-veillette-core-cool-02' />
<format type='TXT'
        target='http://www.ietf.org/internet-drafts/draft-veillette-core-cool-02.txt' />
</reference>



<reference anchor='I-D.ietf-netconf-restconf'>
<front>
<title>RESTCONF Protocol</title>

<author initials='A' surname='Bierman' fullname='Andy Bierman'>
    <organization />
</author>

<author initials='M' surname='Bjorklund' fullname='Martin Bjorklund'>
    <organization />
</author>

<author initials='K' surname='Watsen' fullname='Kent Watsen'>
    <organization />
</author>

<date month='August' day='15' year='2016' />

<abstract><t>This document describes an HTTP-based protocol that provides a programmatic interface for accessing data defined in YANG, using the datastore concepts defined in NETCONF.</t></abstract>

</front>

<seriesInfo name='Internet-Draft' value='draft-ietf-netconf-restconf-16' />
<format type='TXT'
        target='http://www.ietf.org/internet-drafts/draft-ietf-netconf-restconf-16.txt' />
</reference>



<reference anchor='I-D.ietf-netconf-yang-library'>
<front>
<title>YANG Module Library</title>

<author initials='A' surname='Bierman' fullname='Andy Bierman'>
    <organization />
</author>

<author initials='M' surname='Bjorklund' fullname='Martin Bjorklund'>
    <organization />
</author>

<author initials='K' surname='Watsen' fullname='Kent Watsen'>
    <organization />
</author>

<date month='April' day='27' year='2016' />

<abstract><t>This document describes a YANG library, which provides information about all the YANG modules used by a network management server (e.g., a Network Configuration Protocol (NETCONF) server).  Simple caching mechanisms are provided to allow clients to minimize retrieval of this information.</t></abstract>

</front>

<seriesInfo name='Internet-Draft' value='draft-ietf-netconf-yang-library-06' />
<format type='TXT'
        target='http://www.ietf.org/internet-drafts/draft-ietf-netconf-yang-library-06.txt' />
</reference>




    </references>




  </back>
</rfc>

