<?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.37 -->

<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
]>

<?rfc toc="yes"?>
<?rfc symrefs="yes"?>

<rfc ipr="trust200902" docName="draft-ietf-core-comi-01" category="std">

  <front>
    <title abbrev="CoMI">CoAP Management Interface</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>
        <email>michel.veillette@trilliantinc.com</email>
      </address>
    </author>
    <author initials="P." surname="van der Stok" fullname="Peter van der Stok" role="editor">
      <organization abbrev="consultant">consultant</organization>
      <address>
        <phone>+31-492474673 (Netherlands), +33-966015248 (France)</phone>
        <email>consultancy@vanderstok.org</email>
        <uri>www.vanderstok.org</uri>
      </address>
    </author>
    <author initials="A.P." surname="Pelov" fullname="Alexander Pelov">
      <organization>Acklio</organization>
      <address>
        <postal>
          <street>2bis rue de la Chataigneraie</street>
          <city>Cesson-Sevigne</city>
          <region>Bretagne</region>
          <code>35510</code>
          <country>France</country>
        </postal>
        <email>a@ackl.io</email>
      </address>
    </author>
    <author initials="A." surname="Bierman" fullname="Andy Bierman">
      <organization>YumaWorks</organization>
      <address>
        <postal>
          <street>685 Cochran St.</street> <street>Suite #160</street>
          <city>Simi Valley</city>
          <region>CA</region>
          <code>93065</code>
          <country>USA</country>
        </postal>
        <email>andy@yumaworks.com</email>
      </address>
    </author>

    <date year="2017" month="July" day="17"/>

    <area>Applications</area>
    <workgroup>CoRE</workgroup>
    

    <abstract>


<t>This document describes a network management interface for constrained devices
and networks, called CoAP Management Interface (CoMI). The Constrained Application
Protocol (CoAP) is used to access datastore and data node resources specified
in YANG, or SMIv2 converted to YANG. CoMI uses the YANG to CBOR mapping and converts
YANG identifier strings to numeric identifiers for payload size reduction.
CoMI extends the set of YANG based protocols, NETCONF and RESTCONF, with
the capability to manage constrained devices and networks.</t>



    </abstract>


    <note title="Note">


<t>Discussion and suggestions for improvement are requested,
and should be sent to core@ietf.org.</t>


    </note>


  </front>

  <middle>


<section anchor="introduction" title="Introduction">

<t>The Constrained Application Protocol (CoAP) <xref target="RFC7252"/> is designed for
Machine to Machine (M2M) applications such as smart energy, smart city and building control.
Constrained devices need to be managed in an automatic fashion to handle
the large quantities of devices that are expected in
future installations. Messages between devices need to be as small and
infrequent as possible. The implementation
complexity and runtime resources need to be as small as possible.</t>

<t>This draft describes the CoAP Management Interface which uses CoAP methods
to access structured data defined in YANG <xref target="RFC7950"/>. This draft is
complementary to <xref target="RFC8040"/> which describes a REST-like interface
called RESTCONF, which uses HTTP methods to access structured data
defined in YANG.</t>

<t>The use of standardized data models specified in a standardized language, such
as YANG, promotes interoperability between devices and applications from
different manufacturers.</t>

<t>CoMI and RESTCONF are intended to work in a stateless client-server fashion.
They use a single round-trip to complete a single editing transaction, where
NETCONF needs up to 10 round trips.</t>

<t>To promote small messges, CoMI uses a YANG to CBOR mapping
<xref target="I-D.ietf-core-yang-cbor"/> and numeric identifiers
<xref target="I-D.ietf-core-sid"/> to minimize CBOR payloads and URI length.</t>

<section anchor="terminology" title="Terminology">

<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 the YANG data modelling language <xref target="RFC7950"/>: action, anydata, anyxml, client, configuration data, container, data model, data node, datastore, identity, instance identifier, key, key leaf, leaf, leaf-list, list, module, RPC, schema node, server, state data, submodule.</t>

<t>The following term is defined in <xref target="I-D.ietf-core-yang-cbor"/>: YANG schema item identifier (SID).</t>

<t>The following terms are defined in the CoAP protocol <xref target="RFC7252"/>: Confirmable Message, Content-Format.</t>

<t>The following terms are defined in this document:</t>

<t><list style="hanging">
  <t hangText='data node resource:'>
  a CoAP resource that models a YANG data node.</t>
  <t hangText='datastore resource:'>
  a CoAP resource that models a YANG datastore.</t>
  <t hangText='event stream resource:'>
  a CoAP resource used by clients to observe YANG notifications.</t>
  <t hangText='target resource:'>
  the resource that is associated with a particular CoAP request,
identified by the request URI.</t>
  <t hangText='data node instance:'>
  An instance of a data node specified in a YANG module and stored in the server.</t>
  <t hangText='notification instance:'>
  An instance of a schema node of type notification, specified in a YANG module
implemented by the server. The instance is generated in the server at the occurrence
of the corresponding event and reported by an event stream.</t>
  <t hangText='list instance identifier:'>
  Handle used to identify a YANG data node that is an instance of a YANG “list”
specified with the values of the key leaves of the list.</t>
  <t hangText='single instance identifier:'>
  Handle used to identify a specific data node which can be instantiated only
once. This includes data nodes defined at the root of a YANG module or
data nodes defined within a container. This excludes data nodes defined
within a list or any children of these data nodes.</t>
  <t hangText='instance identifier:'>
  List instance identifier or single instance identifier.</t>
  <t hangText='data node value:'>
  The value assigned to a data node instance. Data node values are serialized into
the payload according to the rules defined in section 4 of <xref target="I-D.ietf-core-yang-cbor"/>.</t>
</list></t>

</section>
</section>
<section anchor="comi-architecture" title="CoMI Architecture">

<t>This section describes the CoMI architecture to use CoAP for reading and
modifying the content of datastore(s) used for the management of the instrumented
node.</t>

<figure title="Abstract CoMI architecture" anchor="archit"><artwork align="left"><![CDATA[
+------------------------------------------------------------+
|                     SMIv2 specification (2)                |
+------------------------------------------------------------+
                               |
                               V
+------------------------------------------------------------+
|                     YANG specification  (1)                |
+------------------------------------------------------------+
         |                                          |
Client   V                               Server     V       
+----------------+                       +-------------------+
| Request        |--> CoAP request(3) -->| Indication        |
| Confirm        |<-- CoAP response(3)<--| Response      (4) |
|                |                       |                   |
|                |<==== Security (7) ===>|+-----------------+|
+----------------+                       || Datastore (5)   ||
                                         |+-----------------+|
                                         |+-----------------+|
                                         || Event stream (6)||
                                         |+-----------------+|
                                         +-------------------+
]]></artwork></figure>

<t><xref target="archit"/> is a high-level representation of the main elements of the CoMI management
architecture. The different numbered components of <xref target="archit"/> are discussed according to component number.</t>

<t><list style="hanging">
  <t hangText='(1) YANG specification:'>
  contains a set of named and versioned modules.</t>
  <t hangText='(2) SMIv2 specification:'>
  A named module specifies a set of variables and “conceptual tables”. There
is an algorithm to translate SMIv2 specifications to YANG specifications.</t>
  <t hangText='(3) CoAP request/response messages:'>
  The CoMI client sends request messages to and receives response messages
from the CoMI server.</t>
  <t hangText='(4) Request, Indication, Response, Confirm:'>
  The processes performed by the CoMI clients and servers.</t>
  <t hangText='(5) Datastore:'>
  A resource used to access configuration data, state data, RPCs and actions. A CoMI server may support multiple datastores to support more complex operations such as configuration rollback, scheduled update.</t>
  <t hangText='(6) Event stream:'>
  An observable resource used to get real time notifications. A CoMI server may support multiple Event streams serving different purposes such as normal monitoring, diagnostic, syslog, security monitoring.</t>
  <t hangText='(7) Security:'>
  The server MUST prevent unauthorized users from reading or writing any CoMI
resources. CoMI relies on security protocols such as DTLS <xref target="RFC6347"/> to secure CoAP communication.</t>
</list></t>

<section anchor="major-differences" title="Major differences between RESTCONF and CoMI">

<t>CoMI is a RESTful protocol for small devices where saving bytes to transport
counts. Contrary to RESTCONF, many design decisions are motivated by the
saving of bytes. Consequently, CoMI is not a RESTCONF over CoAP protocol,
but differs more significantly from RESTCONF. Some major differences are
cited below:</t>

<t><list style="symbols">
  <t>CoMI uses CoAP/UDP as transport protocol and CBOR as payload format
<xref target="I-D.ietf-core-yang-cbor"/>. RESTCONF uses HTTP/TCP as transport
protocol and JSON <xref target="RFC7159"/> or XML <xref target="XML"/> as payload formats.</t>
  <t>CoMI encodes YANG identifier strings as numbers, where RESTCONF does not.</t>
  <t>CoMI uses the methods FETCH and iPATCH, not used by RESTCONF.  RESTCONF uses
the HTTP methods HEAD, and OPTIONS, which are not used by CoMI.</t>
  <t>CoMI does not support “insert” query parameter (first, last, before, after)
and the “point” query parameter which are supported by RESTCONF.</t>
  <t>CoMI does not support the “start-time” and “stop-time” query parameters
to retrieve past notifications.</t>
  <t>CoMI and RESTCONF also differ in the handling of:  <list style="symbols">
      <t>notifications.</t>
      <t>default values.</t>
    </list></t>
</list></t>

</section>
<section anchor="id-compression" title="Compression of YANG identifiers">

<t>In the YANG specification, items are identified with a name string. In order
to significantly reduce the size of identifiers used in CoMI, numeric
 identifiers are used instead of these strings.
YANG Schema Item iDentifier (SID) is defined in <xref target="I-D.ietf-core-yang-cbor"/> section 2.1.</t>

<t>When used in a URI, SIDs are encoded in based64 using the URL and Filename safe
alphabet as defined by <xref target="RFC4648"></xref> section 5. The last 6 bits encoded is always aligned
with the least significant 6 bits of the SID represented using an unsigned integer.
‘A’ characters (value 0) at the start of the resulting string are removed.</t>

<figure><artwork align="left"><![CDATA[
SID in basae64 = URLsafeChar[SID >> 60 & 0x3F] |
                 URLsafeChar[SID >> 54 & 0x3F] | 
                 URLsafeChar[SID >> 48 & 0x3F] | 
                 URLsafeChar[SID >> 42 & 0x3F] |  
                 URLsafeChar[SID >> 36 & 0x3F] | 
                 URLsafeChar[SID >> 30 & 0x3F] | 
                 URLsafeChar[SID >> 24 & 0x3F] |  
                 URLsafeChar[SID >> 18 & 0x3F] | 
                 URLsafeChar[SID >> 12 & 0x3F] | 
                 URLsafeChar[SID >> 6 & 0x3F] | 
                 URLsafeChar[SID & 0x3F]
]]></artwork></figure>

<t>For example, SID 1717 is encoded as follow.</t>

<figure><artwork align="left"><![CDATA[
URLsafeChar[1717 >> 60 & 0x3F] = URLsafeChar[0] = 'A'
URLsafeChar[1717 >> 54 & 0x3F] = URLsafeChar[0] = 'A'
URLsafeChar[1717 >> 48 & 0x3F] = URLsafeChar[0] = 'A'
URLsafeChar[1717 >> 42 & 0x3F] = URLsafeChar[0] = 'A'
URLsafeChar[1717 >> 36 & 0x3F] = URLsafeChar[0] = 'A'
URLsafeChar[1717 >> 30 & 0x3F] = URLsafeChar[0] = 'A'
URLsafeChar[1717 >> 24 & 0x3F] = URLsafeChar[0] = 'A'
URLsafeChar[1717 >> 18 & 0x3F] = URLsafeChar[0] = 'A'
URLsafeChar[1717 >> 12 & 0x3F] = URLsafeChar[0] = 'A'
URLsafeChar[1717 >> 6 & 0x3F]  = URLsafeChar[26] = 'a' 
URLsafeChar[1717 & 0x3F]       = URLsafeChar[53] = '1'
]]></artwork></figure>

<t>The resulting base64 representation of SID 1717 is “a1”</t>

</section>
<section anchor="instance-identifier" title="Instance identifier">

<t>Instance identifiers are used to uniquely identify data node instances within a datastore. This YANG built-in type is defined in <xref target="RFC7950"/> section 9.13. An instance identifier is composed of the data node identifier (i.e. a SID) and for data nodes within list(s) the keys used to index within these list(s).</t>

<t>When part of a payload, instance identifiers are encoded in CBOR based on the rules defined in <xref target="I-D.ietf-core-yang-cbor"/> section 5.13.1. When part of a URI, the SID is appended to the URI of the targeted datastore, the keys are specified using the ‘k’ URI-Query as defined in <xref target="query"/>.</t>

</section>
<section anchor="ordered-map" title="CBOR ordered map schematic">

<t>An ordered map is used as a root container of the application/yang-tree+cbor Content-Format. This datatype share the same functionalities as a CBOR map without the following limitations:</t>

<t><list style="symbols">
  <t>The ordering of the pairs of data items is preserved from serialization to deserialization.</t>
  <t>Duplicate keys are allowed</t>
</list></t>

<t>This schematic is constructed using a CBOR array comprising pairs of data items, each pair consisting of a key that is immediately followed by a value. Unlike a CBOR map for which the length denotes the number of pairs, the length of the ordered map denotes the number of items (i.e. number of keys plus number of values).</t>

<t>The use of this schematic can be inferred from its context or by the presence of a preceding tag. The tag assigned to the Ordered map is defined in <xref target="tags-registry"/>.</t>

<t>In the case of CoMI, the use of the ordered map as the root container of the application/yang-tree+cbor Content-Format is inferred, the Ordered map tag is not used.</t>

</section>
<section anchor="content-format" title="Content-Formats">

<t>ComI uses Content-Formats based on the YANG to CBOR mapping specified
in <xref target="I-D.ietf-core-yang-cbor"/>. All Content-Formats defined hereafter are
constructed using one or both of these constructs:</t>

<t><list style="symbols">
  <t>YANG data node value, encoded based on the rules defined in <xref target="I-D.ietf-core-yang-cbor"/> section 4.</t>
  <t>YANG instance identifier, encoded based on the rules defined in <xref target="I-D.ietf-core-yang-cbor"/> section 5.13.1.</t>
</list></t>

<t>The following Content-formats are defined:</t>

<t><list style="hanging">
  <t hangText='application/yang-value+cbor:'>
  represents a CBOR YANG document containing one YANG data node value.
The YANG data node instance can be a leaf, a container, a list, a list instance,
a RPC input, a RPC output, an action input, an action output, a leaf-list, an anydata
or an anyxml. The CBOR encoding for each of these YANG data node instances are defined in
<xref target="I-D.ietf-core-yang-cbor"/> section 4.</t>
  <t>FORMAT: data-node-value</t>
  <t>DELTA ENCODING: SIDs included in a YANG container, a list instance, a RPC input, a RPC output,
an action input, an actions output and an anydata are encoded using a delta value equal to the
SID of the current schema node minus the SID of the parent. The parent SID of root data
nodes is defined by the URI carried in the associated request (i.e. GET, PUT, POST).</t>
  <t hangText='application/yang-values+cbor:'>
  represents a YANG document containing a list of data node values.</t>
  <t>FORMAT: CBOR array of data-node-value</t>
  <t>DELTA ENCODING: SIDs included in a YANG container, a list instance and an anydata are encoded
using a delta value equal to the SID of the current schema node minus the SID of the parent.
The parent SID of root data nodes is defined by the corresponding instance-identifier carried
in the FETCH request.</t>
  <t hangText='application/yang-tree+cbor:'>
  represents a CBOR YANG document containing a YANG data tree.</t>
  <t>FORMAT: ordered map of single-instance-identifier, data-node-value</t>
  <t>DELTA ENCODING: The SID part of the first instance-identifier within the ordered map is
encoded using its absolute value. Subsequent instance-identifiers are
encoded using a delta value equal to the SID of the current instance-identifiers
minus the SID of the previous instance-identifier.</t>
  <t hangText='application/yang-selectors+cbor:'>
  represents a CBOR YANG document containing a list of data node selectors (i.e. instance identifier).</t>
  <t>FORMAT: CBOR array of instance-identifier</t>
  <t>DELTA ENCODING: The SID part of the first instance-identifier within the CBOR array is
encoded using its absolute value. Subsequent instance-identifiers are
encoded using a delta value equal to the SID of the current instance-identifiers
minus the SID of the previous instance-identifier.</t>
  <t hangText='application/yang-patch+cbor:'>
  represents a CBOR YANG document containing a list of data nodes to be replaced, created, or deleted.</t>
  <t>For each data node instance, D, for which the
instance identifier is the same as for a data node instance, I, in the targeted
resource: the data node value of D replaces the data node value of I. When
the data node value of D is null, the data node instance I is removed. When
the targeted resource does not contain a data node instance with the same
instance identifier as D, a new data node instance is created in the targeted
resource with the same instance identifier and data node value as D.</t>
  <t>FORMAT: CBOR array of instance-identifier, data-node-value</t>
  <t>DELTA ENCODING: Same as Content-Format application/yang-tree+cbor</t>
</list></t>

<t>The different Content-formats usage is  summarized in the table below:</t>

<texttable align="left">
      <ttcol align='left'>Method</ttcol>
      <ttcol align='left'>Resource</ttcol>
      <ttcol align='left'>Content-Format</ttcol>
      <c>GET response</c>
      <c>data node</c>
      <c>/application/yang-value+cbor</c>
      <c>PUT request</c>
      <c>data node</c>
      <c>/application/yang-value+cbor</c>
      <c>POST request</c>
      <c>data node</c>
      <c>/application/yang-value+cbor</c>
      <c>DELETE</c>
      <c>data node</c>
      <c>n/a</c>
      <c>GET response</c>
      <c>datastore</c>
      <c>/application/yang-tree+cbor</c>
      <c>PUT request</c>
      <c>datastore</c>
      <c>/application/yang-tree+cbor</c>
      <c>POST request</c>
      <c>datastore</c>
      <c>/application/yang-tree+cbor</c>
      <c>FETCH request</c>
      <c>datastore</c>
      <c>/application/yang-selectors+cbor</c>
      <c>FETCH response</c>
      <c>datastore</c>
      <c>/application/yang-values+cbor</c>
      <c>iPATCH request</c>
      <c>datastore</c>
      <c>/application/yang-patch+cbor</c>
      <c>GET response</c>
      <c>event stream</c>
      <c>/application/yang-tree+cbor</c>
      <c>POST request</c>
      <c>rpc, action</c>
      <c>/application/yang-value+cbor</c>
      <c>POST response</c>
      <c>rpc, action</c>
      <c>/application/yang-value+cbor</c>
</texttable>

</section>
</section>
<section anchor="example-syntax" title="Example syntax">

<t>This section presents the notation used for the examples. The YANG modules
that are used throughout this document are shown in <xref target="example-specifications"/>.
The example modules are copied from existing modules and annotated with
SIDs. The values of the SIDs are taken over from <xref target="yang-cbor"/>.</t>

<t>CBOR is used to encode CoMI request and response payloads. The CBOR syntax
of the YANG payloads is specified in <xref target="RFC7049"/>. The payload examples are
notated in Diagnostic notation (defined in section 6 of <xref target="RFC7049"/>) that
can be automatically converted to CBOR.</t>

<t>SIDs in URIs are represented as a base64 number, SIDs in the payload are
represented as decimal numbers.</t>

</section>
<section anchor="coap-interface" title="CoAP Interface">

<t>The format of the links is specified in <xref target="I-D.ietf-core-interfaces"/>.
This note specifies a Management Collection Interface. CoMI end-points that
implement the CoMI management protocol, support
at least one discoverable management resource of resource type (rt): core.c.datastore,
with example path: /c, where c is short-hand for CoMI. The path /c is recommended
but not compulsory (see <xref target="discovery"/>).</t>

<t>Three CoMI resources are accessible with the following three example paths:</t>

<t><list style="hanging">
  <t hangText='/c:'>
  Datastore resource with path “/c” and using CBOR content encoding format.
Sub-resouces of format /c/instance-identifier may be available to access
directly each data node resource for this datastore.</t>
  <t hangText='/mod.uri:'>
  URI identifying the location of the YANG module library used by this server,
with path “/mod.uri” and Content-Format “text/plain; charset=utf-8”. An ETag
MUST be maintained for this resource by the server, which MUST be changed to
a new value when the set of YANG modules in use by the server changes.</t>
  <t hangText='/s:'>
  Event stream resource to which YANG notification instances are reported.
Notification support is optional, so this resource will not exist if the
server does not support any notifications.</t>
</list></t>

<t>The mapping of YANG data node instances to CoMI resources is as follows.
Every data node of the YANG modules loaded in the CoMI server represents
a sub-resource of the datastore resource (e.g. /c/instance-identifier).</t>

<t>When multiple instances of a list exist, instance selection is possible
as described in <xref target="query"/>, <xref target="fetch"/>, and <xref target="get-example"/>.</t>

<t>The description of the management collection interface, with if=core.c, is
shown in the table below, following the guidelines of <xref target="I-D.ietf-core-interfaces"/>:</t>

<texttable align="left">
      <ttcol align='left'>Function</ttcol>
      <ttcol align='left'>Recommended path</ttcol>
      <ttcol align='left'>rt</ttcol>
      <c>Datastore</c>
      <c>/c</c>
      <c>core.c.datastore</c>
      <c>Data node</c>
      <c>/c/instance-identifier</c>
      <c>core.c.datanode</c>
      <c>YANG module library</c>
      <c>/mod.uri</c>
      <c>core.c.moduri</c>
      <c>Event steam</c>
      <c>/s</c>
      <c>core.c.eventstream</c>
</texttable>

<t>The path values are example values. On discovery, the server makes the actual
path values known for these four resources.</t>

</section>
<section anchor="collection-interface" title="CoMI Collection Interface">

<t>The CoMI Collection Interface provides a CoAP interface to manage YANG servers.</t>

<t>The methods used by CoMI are:</t>

<texttable align="left">
      <ttcol align='left'>Operation</ttcol>
      <ttcol align='left'>Description</ttcol>
      <c>GET</c>
      <c>Retrieve the datastore resource or a data node resource</c>
      <c>FETCH</c>
      <c>Retrieve specific data nodes within a datastore resource</c>
      <c>POST</c>
      <c>Create a datastore resource or a data node resource, invoke an RPC or action</c>
      <c>PUT</c>
      <c>Create or replace a datastore resource or a data node resource</c>
      <c>iPATCH</c>
      <c>Idem-potently create, replace, and delete data node resource(s) within a datastore resource</c>
      <c>DELETE</c>
      <c>Delete a datastore resource or a data node resource</c>
</texttable>

<t>There is one Uri-Query option for the GET, PUT, POST, and DELETE methods.</t>

<texttable align="left">
      <ttcol align='left'>Uri-Query option</ttcol>
      <ttcol align='left'>Description</ttcol>
      <c>k</c>
      <c>Select an instance within YANG list(s)</c>
</texttable>

<t>This parameter is not used for FETCH and iPATCH, because their request payloads
support list instance selection.</t>

<section anchor="query" title="Using the ‘k’ Uri-Query option">

<t>The “k” (key) parameter specifies a specific instance of a data node.
The SID in the URI is followed by the (?k=key1, key2,..). Where SID identifies
a data node, and key1, key2 are the values of the key leaves that specify
an instance. Lists can have multiple keys, and lists can be part
of lists. The order of key value generation is given recursively by:</t>

<t><list style="symbols">
  <t>For a given list, if a parent data node is a list, generate the keys for the parent list first.</t>
  <t>For a given list, generate key values in the order specified in the YANG module.</t>
</list></t>

<t>Key values are encoded using the rules defined in the following table.</t>

<texttable align="left">
      <ttcol align='left'>YANG datatype</ttcol>
      <ttcol align='left'>Uri-Query text content</ttcol>
      <c>uint8,uint16,unit32, uint64</c>
      <c>int2str(key)</c>
      <c>int8, int16,int32, int64</c>
      <c>urlSafeBase64(CBORencode(key))</c>
      <c>decimal64</c>
      <c>urlSafeBase64(CBOR key)</c>
      <c>string</c>
      <c>key</c>
      <c>boolean</c>
      <c>“0” or “1”</c>
      <c>enumeration</c>
      <c>int2str(key)</c>
      <c>bits</c>
      <c>urlSafeBase64(CBORencode(key))</c>
      <c>binary</c>
      <c>urlSafeBase64(key)</c>
      <c>identityref</c>
      <c>int2str(key)</c>
      <c>union</c>
      <c>urlSafeBase64(CBORencode(key))</c>
      <c>instance-identifier</c>
      <c>urlSafeBase64(CBORencode(key))</c>
</texttable>

<t>In this table:</t>

<t><list style="symbols">
  <t>The method int2str() is used to convert an integer value to a string. For example, int2str(0x0123) return  the string “291”.</t>
  <t>The method urlSafeBase64() is used to convert a binary string to base64 using the URL and Filename safe alphabet as defined by <xref target="RFC4648"></xref> section 5. For example, urlSafeBase64(\xF9\x56\xA1\x3C) return the string “-VahPA”.</t>
  <t>The method CBORencode() is used to convert a YANG value to CBOR as specified in <xref target="I-D.ietf-core-yang-cbor"/> section 5, item 8.</t>
</list></t>

<t>The resulting key string is encoded in a Uri-Query as specified in <xref target="RFC7252"/> section 6.5.</t>

</section>
<section anchor="data-retrieval" title="Data Retrieval">

<t>One or more data nodes can be retrieved by the client.
The operation is mapped to the GET method defined in
section 5.8.1 of <xref target="RFC7252"/> and to the FETCH method defined in section 2 of <xref target="RFC8132"/>.</t>

<t>It is possible that the size of the payload is too large to fit in a single
message. In the case that management data is bigger than the maximum supported payload
size, the Block mechanism from <xref target="RFC7959"/> may be used, as explained in more detail in <xref target="block"/>.</t>

<t>There are two additional Uri-Query options for the GET and FETCH methods.</t>

<texttable align="left">
      <ttcol align='left'>Uri-Query option</ttcol>
      <ttcol align='left'>Description</ttcol>
      <c>c</c>
      <c>Control selection of configuration and non-configuration data nodes (GET and FETCH)</c>
      <c>d</c>
      <c>Control retrieval of default values.</c>
</texttable>

<section anchor="content" title="Using the ‘c’ Uri-Query option">

<t>The ‘c’ (content) parameter controls how descendant nodes of the
requested data nodes will be processed in the reply.</t>

<t>The allowed values are:</t>

<texttable align="left">
      <ttcol align='left'>Value</ttcol>
      <ttcol align='left'>Description</ttcol>
      <c>c</c>
      <c>Return only configuration descendant data nodes</c>
      <c>n</c>
      <c>Return only non-configuration descendant data nodes</c>
      <c>a</c>
      <c>Return all descendant data nodes</c>
</texttable>

<t>This parameter is only allowed for GET and FETCH methods on datastore and
data node resources.  A 4.02 (Bad Option) error is returned if used for other
methods or resource types.</t>

<t>If this Uri-Query option is not present, the default value is “a”.</t>

</section>
<section anchor="dquery" title="Using the ‘d’ Uri-Query option">

<t>The “d” (with-defaults) parameter controls how the default values of the
descendant nodes of the requested data nodes will be processed.</t>

<t>The allowed values are:</t>

<texttable align="left">
      <ttcol align='left'>Value</ttcol>
      <ttcol align='left'>Description</ttcol>
      <c>a</c>
      <c>All data nodes are reported. Defined as ‘report-all’ in section 3.1 of <xref target="RFC6243"/>.</c>
      <c>t</c>
      <c>Data nodes set to the YANG default are not reported. Defined as ‘trim’ in section 3.2 of <xref target="RFC6243"/>.</c>
</texttable>

<t>If the target of a GET or FETCH method is a data node that represents a leaf
that has a default value, and the leaf has not been given a value by any
client yet, the server MUST return the default value of the leaf.</t>

<t>If the target of a GET method is a data node that represents a
container or list that has child resources with default values,
and these have not been given value yet,</t>

<t><list style='empty'>
  <t>The server MUST not return the child resource if d= ‘t’</t>
</list></t>

<t><list style='empty'>
  <t>The server MUST return the child resource if d= ‘a’.</t>
</list></t>

<t>If this Uri-Query option is not present, the default value is ‘t’.</t>

</section>
<section anchor="get-operation" title="GET">

<t>A request to read the values of a data node instance is sent with a confirmable
CoAP GET message. An instance identifier is specified in the URI path
prefixed with the example path /c.</t>

<figure><artwork align="left"><![CDATA[
FORMAT:
  GET /c/instance-identifier

  2.05 Content (Content-Format: application/yang-value+cbor)
  data-node-value
]]></artwork></figure>

<t>The returned payload contains the CBOR encoding of the specified data node instance value.</t>

<section anchor="get-example" title="GET Examples">

<t>Using for example the current-datetime leaf from <xref target="ietf-system"/>, a request is sent to
retrieve the value of system-state/clock/current-datetime specified in container system-state.
The SID of system-state/clock/current-datetime is 1719, encoded in octal 3267,
yields two 6 bit decimal numbers 26 and 55, encoded in base64, (according to table 2 of <xref target="RFC4648"/>)
yields a3. The response to the request returns the CBOR encoding of this leaf of type ‘string’
as defined in <xref target="I-D.ietf-core-yang-cbor"/> section 5.4.</t>

<figure><artwork align="left"><![CDATA[
REQ: GET example.com/c/a3

RES: 2.05 Content (Content-Format: application/yang-value+cbor)
"2014-10-26T12:16:31Z"
]]></artwork></figure>

<t>The next example represents the retrieval of a YANG container. In this
case, the CoMI client performs a GET request on the clock container
(SID = 1717; base64: a1). The container returned is encoded using a
CBOR map as specified by <xref target="I-D.ietf-core-yang-cbor"/> section 4.2.</t>

<figure><artwork align="left"><![CDATA[
REQ: GET example.com/c/a1

RES: 2.05 Content (Content-Format: application/yang-value+cbor)
{
  +2 : "2014-10-26T12:16:51Z",   / SID 1719 /
  +1 : "2014-10-21T03:00:00Z"    / SID 1718 /
}
]]></artwork></figure>

<t>This example shows the retrieval of the /interfaces/interface YANG list
accessed using SID 1533 (base64: X9). The return payload is encoded using
a CBOR array as specified by <xref target="I-D.ietf-core-yang-cbor"/> section 4.4.1
containing 2 instances.</t>

<figure><artwork align="left"><![CDATA[
REQ: GET example.com/c/X9

RES: 2.05 Content (Content-Format: application/yang-value+cbor)
[
  {
    +4 : "eth0",                / name  (SID 1537) /
    +1 : "Ethernet adaptor",    / description (SID 1534) /
    +5 : 1179,                  / type, (SID 1538) identity /
                                / ethernetCsmacd (SID 1179) /
    +2 : true                   / enabled ( SID 1535) /
  },
  {
    +4 : "eth1",                / name (SID 1537) /
    +1 : "Ethernet adaptor",    / description (SID 1534) /
    +5 : 1179,                  / type, (SID 1538) identity /
                                / ethernetCsmacd (SID 1179) /
    +2 : false                  / enabled /
  }
]
]]></artwork></figure>

<t>It is equally possible to select a leaf of a specific instance of a list.
The example below requests the description leaf (SID=1534, base64: X-) 
within the interface list corresponding to the list key “eth0”.
The returned value is encoded in CBOR based on the rules
specified by <xref target="I-D.ietf-core-yang-cbor"/> section 5.4.</t>

<figure><artwork align="left"><![CDATA[
REQ: GET example.com/c/X-?k="eth0"

RES: 2.05 Content (Content-Format: application/yang-value+cbor)
"Ethernet adaptor"
]]></artwork></figure>

</section>
</section>
<section anchor="fetch" title="FETCH">

<t>The FETCH is used to retrieve multiple data node values. The FETCH request
payload contains a list of instance-identifier encoded based on the rules
defined by Content-Format application/yang-selectors+cbor in <xref target="content-format"/>.
The return response payload contains a list of values encoded based on the rules
defined by Content-Format application/yang-values+cbor in <xref target="content-format"/>.
A value MUST be returned for each instance-identifier specified in the request.
A CBOR null is returned for each data node requested by the client, not supported
by the server or not currently instantiated.</t>

<figure><artwork align="left"><![CDATA[
FORMAT:
  FETCH /c (Content-Format :application/yang-selectors+cbor)
  CBOR array of instance-identifier

  2.05 Content (Content-Format: application/yang-values+cbor)
  CBOR array of data-node-value
]]></artwork></figure>

<section anchor="fetch-example" title="FETCH examples">

<t>The example uses the current-datetime leaf and the interface list from <xref target="ietf-system"/>.
In the following example the value of current-datetime (SID 1719 and the interface
list (SID 1533) instance identified with name=”eth0” are queried.</t>

<figure><artwork align="left"><![CDATA[
REQ:  FETCH /c (Content-Format :application/yang-selectors+cbor)
[
  1719,            / SID 1719 /
  [-186, "eth0"]   / SID 1533 with name = "eth0" /
]

RES:  2.05 Content (Content-Format :application/yang-value+cbor)
[
  "2014-10-26T12:16:31Z",
  {
    +4 : "eth0",                / name (SID 1537) /
    +1 : "Ethernet adaptor",    / description (SID 1534) /
    +5 : 1179,                  / type (SID 1538), identity /
                                / ethernetCsmacd (SID 1179) /
    +2 : true                   / enabled (SID 1535) /
  }
]
]]></artwork></figure>

</section>
</section>
</section>
<section anchor="data-editing" title="Data Editing">

<t>CoMI allows datastore contents to be created, modified and deleted using
CoAP methods.</t>

<section anchor="DataOrdering" title="Data Ordering">

<t>A CoMI server SHOULD preserve the relative order of all user-ordered list
and leaf-list entries that are received in a single edit request.  These YANG
data node types are encoded as CBOR arrays so messages will preserve their
order.</t>

</section>
<section anchor="post-operation" title="POST">

<t>The CoAP POST operation is used in CoMI for creation of data node resources and the
invocation of “ACTION” and “RPC” resources.
Refer to <xref target="rpc"/> for details on “ACTION” and “RPC” resources.</t>

<t>A request to create a data node resource is sent with a confirmable CoAP POST message.
The URI specifies the data node to be instantiated at the exception of list intances.
In this case, for compactness, the URI specifies the list for which an instance is created.</t>

<figure><artwork align="left"><![CDATA[
FORMAT:
  POST /c/<instance identifier>
  (Content-Format :application/yang-value+cbor)
  data-node-value

  2.01 Created
]]></artwork></figure>

<t>If the data node resource already exists, then the POST request MUST fail and
a “4.09 Conflict” response code MUST be returned</t>

<section anchor="post-example" title="Post example">

<t>The example uses the interface list from <xref target="ietf-system"/>.
Example is creating a new list instance within the interface list (SID = 1533):</t>

<figure><artwork align="left"><![CDATA[
REQ: POST /c/X9 (Content-Format :application/yang-value+cbor)
{
  +4 : "eth5",              / name (SID 1537) /
  +1 : "Ethernet adaptor",  / description (SID 1534) /
  +5 : 1179,                / type (SID 1538), identity /
                            / ethernetCsmacd (SID 1179) /
  +2 : true                 / enabled (SID 1535) /
}


RES: 2.01 Created
]]></artwork></figure>

</section>
</section>
<section anchor="put-operation" title="PUT">

<t>A data node resource instance is created or replaced with the PUT method.
A request to set the value of a data node instance is sent with a confirmable
CoAP PUT message.</t>

<figure><artwork align="left"><![CDATA[
FORMAT:
  PUT /c/<instanceidentifier>
           (Content-Format :application/yang-value+cbor)
  data-node-value

  2.01 Created
]]></artwork></figure>

<section anchor="put-example" title="PUT example">

<t>The example uses the interface list from <xref target="ietf-system"/>.
Example is renewing an instance of the list interface (SID = 1533) with key
name=”eth0”:</t>

<figure><artwork align="left"><![CDATA[
REQ: PUT /c/X9?k="eth0"
(Content-Format :application/yang-value+cbor)
{
  +4 : "eth0",             / name (SID 1537) /
  +1 : "Ethernet adaptor", / description (SID 1534) /
  +5 : 1179,               / type (SID 1538), identity /
                           / ethernetCsmacd ( SID 1179) /
  +2 : true                / enabled (SID 1535) /
}

RES:  2.04 Changed
]]></artwork></figure>

</section>
</section>
<section anchor="ipatch-operation" title="iPATCH">

<t>One or multiple data node instances are replaced with the idempotent
iPATCH method <xref target="RFC8132"/>. A request is sent with a confirmable CoAP iPATCH message.</t>

<t>There are no Uri-Query options for the iPATCH method.</t>

<t>The processing of the iPATCH command is specified by Content-Format application/yang-patch+cbor.
In summary, if the CBOR patch payload contains a data node instance that is not present
in the target, this instance is added. If the target contains the specified instance,
the content of this instance is replaced with the value of the payload.
A null value indicates the removal of an existing data node instance.</t>

<figure><artwork align="left"><![CDATA[
FORMAT:
  iPATCH /c (Content-Format :application/yang-patch+cbor)
  ordered map of instance-identifier, data-node-value

  2.04 Changed
]]></artwork></figure>

<section anchor="ipatch-example" title="iPATCH example">

<t>In this example, a CoMI client requests the following operations:</t>

<t><list style="symbols">
  <t>Set “/system/ntp/enabled” (SID 1751) to true.</t>
  <t>Remove the server “tac.nrc.ca” from the”/system/ntp/server” (SID 1752) list.</t>
  <t>Add the server “NTP Pool server 2” to the list “/system/ntp/server” (SID 1752).</t>
</list></t>

<figure><artwork align="left"><![CDATA[
REQ: iPATCH /c (Content-Format :application/yang-patch+cbor)
[
  1751 , true,                          / enabled (1751) /
  [+1, "tac.nrc.ca"], null,             / server (SID 1752) /
  +0,                                   / server (SID 1752) /
    {
      +3 : "tic.nrc.ca",                / name (SID 1755) /
      +4 : true,                        / prefer (SID 1756) /
      +5 : {                            / udp (SID 1757) /
        +1 : "132.246.11.231"           / address (SID 1758) /
      }
    }
]

RES: 2.04 Changed
]]></artwork></figure>

</section>
</section>
<section anchor="delete-operation" title="DELETE">

<t>A data node resource is deleted with the DELETE method.</t>

<figure><artwork align="left"><![CDATA[
FORMAT:
  Delete /c/<instance identifier>

  2.02 Deleted
]]></artwork></figure>

<section anchor="delete-example" title="DELETE example">

<t>The example uses the interface list from <xref target="interfaces"/>.
Example is deleting an instance of the interface list (SID = 1533):</t>

<figure><artwork align="left"><![CDATA[
REQ:   DELETE /c/X9?k="eth0"

RES:   2.02 Deleted
]]></artwork></figure>

</section>
</section>
</section>
<section anchor="datastore-access" title="Full datastore access">

<t>The methods GET, PUT, POST, and DELETE can be used to request, replace, create,
and delete a whole datastore respectively.</t>

<figure><artwork align="left"><![CDATA[
FORMAT:
  GET /c
   
  2.05 Content (Content-Format: application/yang-tree+cbor)
  ordered map of single-instance-identifier, data-node-value
]]></artwork></figure>

<figure><artwork align="left"><![CDATA[
FORMAT:
  PUT /c (Content-Format: application/yang-tree+cbor)
  ordered map of single-instance-identifier, data-node-value
   
  2.04 Changed
]]></artwork></figure>

<figure><artwork align="left"><![CDATA[
FORMAT:
  POST /c (Content-Format: application/yang-tree+cbor)
  ordered map of single-instance-identifier, data-node-value
    
  2.01 Created
]]></artwork></figure>

<figure><artwork align="left"><![CDATA[
FORMAT:
   DELETE /c
   
  2.02 Deleted
]]></artwork></figure>

<t>The content of the ordered map represents the complete datastore of the server
at the GET indication of after a successful processing of a PUT or POST request.
When an Ordered map is used to carry a whole datastore, all data nodes MUST
be identified using single instance identifiers (i.e. a SID), list instance
identifiers are not allowed.</t>

<section anchor="datastore-example" title="Full datastore examples">

<t>The example uses the interface list and the clock container from <xref target="interfaces"/>.
Assume that the datastore contains two modules ietf-system (SID 1700) and
ietf-interfaces (SID 1500); they contain the list interface (SID 1533) with
one instance and the container Clock (SID 1717). After invocation of GET, a
map with these two modules is returned:</t>

<figure><artwork align="left"><![CDATA[
REQ:  GET /c

RES: 2.05 Content (Content-Format :application/yang-tree+cbor)
[
  1717,                           / Clock (SID 1717) /
    {
      +2: "2016-10-26T12:16:31Z", / current-datetime (SID 1719) /
      +1: "2014-10-05T09:00:00Z"  / boot-datetime (SID 1718) /
    },
  -186,                            / clock (SID 1533) /
    {
      +4 : "eth0",                / name (SID 1537) /
      +1 : "Ethernet adaptor",    / description (SID 1534) /
      +5 : 1179,                  / type (SID 1538), identity: /
                                  / ethernetCsmacd (SID 1179) /
      +2 : true                   / enabled (SID 1535) /
    }
]
]]></artwork></figure>

</section>
</section>
<section anchor="event-stream" title="Event stream">

<t>Event notification is an essential function for the management of servers.
CoMI allows notifications specified in YANG <xref target="RFC5277"/> to be reported to a list
of clients. The recommended path of the default event stream is /s.
The server MAY support additional event stream resources to address different 
notification needs.</t>

<t>Reception of notification instances is enabled with the CoAP Observe
<xref target="RFC7641"/> function. Clients subscribe to the notifications by sending a
GET request with an “Observe” option, specifying the /s resource when the
default stream is selected.</t>

<t>Each response payload carries one or multiple notifications. The number of
notification reported and the conditions used to remove notifications
from the reported list is left to the implementers.
When multiple notifications are reported, they MUST be ordered starting from
the newest notification at index zero.</t>

<t>An example implementation is:</t>

<t><list style='empty'>
  <t>Every time an event is generated, the generated notification instance is
appended to the chosen stream(s). After appending the instance, the content
of the instance is sent to all clients observing the modified stream.</t>
</list></t>

<t><list style='empty'>
  <t>Dependending on the storage space allocated to the notification stream, the
oldest notifications that do not fit inside the notification stream storage
space are removed.</t>
</list></t>

<figure><artwork align="left"><![CDATA[
FORMAT:
  Get /<stream-resource> Observe(0)

  2.05 Content (Content-Format :application/yang-tree+cbor)
  ordered map of instance-identifier, data-node-value
]]></artwork></figure>

<t>The array of data node instances may contain identical entries which have
been generated at different times.</t>

<section anchor="event-stream-example" title="Notify Examples">

<t>Suppose the server generates the event specified in <xref target="notify-ex"/>.
By executing a GET on the /s resource the client receives the following response:</t>

<figure><artwork align="left"><![CDATA[
REQ:  GET /s Observe(0) Token(0x93)

RES:  2.05 Content (Content-Format :application/yang-tree+cbor)
                        Observe(12) Token(0x93)
[
  60010,                  / example-port-fault (SID 60010) /
    {
      +1 : "0/4/21",      / port-name (SID 60011) /
      +2 : "Open pin 2"   / port-fault (SID 60012) /
    },
  +0,                     / example-port-fault (SID 60010) /
    {
      +1 : "1/4/21",      / port-name (SID 60011) /
      +2 : "Open pin 5"   / port-fault (SID 60012) /
    }
]

]]></artwork></figure>

<t>In the example, the request returns a success response with the contents
of the last two generated events. Consecutively the server will regularly
notify the client when a new event is generated.</t>

<t>To check that the client is still alive, the server MUST send confirmable
notifications periodically. When the client does not confirm the notification
from the server, the server will remove the client from the list of observers
<xref target="RFC7641"/>.</t>

</section>
</section>
<section anchor="rpc" title="RPC statements">

<t>The YANG “action” and “RPC” statements specify the execution of a Remote
procedure Call (RPC) in the server.  It is invoked using a POST method to
an “Action” or “RPC” resource instance. The request payload contains the
values assigned to the input container when specified. The response payload
contains the values of the output container when specified. Both the
input and output containers are encoded in CBOR using the rules defined in
<xref target="I-D.ietf-core-yang-cbor"/> section 4.2.1. Root data nodes are encoded using the delta
between the current SID and the SID of the invoked instance identifier
a specified by the URI.</t>

<t>The returned success response code is 2.05 Content.</t>

<figure><artwork align="left"><![CDATA[
FORMAT:
  POST /c/<instance identifier>
           (Content-Format :application/yang-value+cbor)
  data-node-value

  2.05 Content (Content-Format :application/yang-value+cbor)
  data-node-value

]]></artwork></figure>

<section anchor="rpc-example" title="RPC Example">

<t>The example is based on the YANG action specification of <xref target="server"/>.
A server list is specified and the action “reset” (SID 60002, base64: Opq),
that is part of a “server instance” with key value “myserver”, is invoked.</t>

<figure><artwork align="left"><![CDATA[
REQ:  POST /c/Opq?k="myserver"
              (Content-Format :application/yang-value+cbor)
{
  +1 : "2016-02-08T14:10:08Z09:00" / reset-at (SID 60003) /
}

RES:  2.05 Content (Content-Format :application/yang-value+cbor)
{
  +2 : "2016-02-08T14:10:08Z09:18" / reset-finished-at (SID 60004)/
}
]]></artwork></figure>

</section>
</section>
</section>
<section anchor="mib" title="Access to MIB Data">

<t><xref target="smi"/> shows a YANG module mapped from the SMI specification “IP-MIB” <xref target="RFC4293"/>.
The following example shows the “ipNetToPhysicalEntry” list with 2 instances,
using diagnostic notation without delta encoding.</t>

<figure><artwork align="left"><![CDATA[
{
   60021 :                     / list ipNetToPhysicalEntry /
   [
     {
       60022 : 1,              / ipNetToPhysicalIfIndex /
       60023 : 1,              / ipNetToPhysicalNetAddressType /
       60024 : h'0A000033',    / ipNetToPhysicalNetAddress /
       60025 : h'00000A01172D',/ ipNetToPhysicalPhysAddress /
       60026 : 2333943,        / ipNetToPhysicalLastUpdated /
       60027 : 4,              / ipNetToPhysicalType /
       60028 : 1,              / ipNetToPhysicalState /
       60029 : 1               / ipNetToPhysicalRowStatus /
     },
     {
       60022 : 1,              / ipNetToPhysicalIfIndex /
       60023 : 1,              / ipNetToPhysicalNetAddressType /
       60024 : h'09020304',    / ipNetToPhysicalNetAddress  /
       60025 : h'00000A36200A',/ ipNetToPhysicalPhysAddress /
       60026 : 2329836,        / ipNetToPhysicalLastUpdated /
       60027 : 3,              / ipNetToPhysicalType /
       60028 : 6,              / ipNetToPhysicalState /
       60029 : 1               / ipNetToPhysicalRowStatus /
     }
   ]
}
]]></artwork></figure>

<t>In this example one instance of /ip/ipNetToPhysicalEntry (SID 60021, base64: Oz1)
that matches the keys ipNetToPhysicalIfIndex = 1, ipNetToPhysicalNetAddressType = ipv4
and ipNetToPhysicalNetAddress = 9.2.3.4 (h’09020304’, base64: CQIDBA) is requested.</t>

<figure><artwork align="left"><![CDATA[
REQ: GET example.com/c/Oz1?k="1,1,CQIDBA"

RES: 2.05 Content (Content-Format: application/yang-value+cbor)
{
  +1 : 1,                  / ( SID 60022 ) /
  +2 : 1,                  / ( SID 60023 ) /
  +3 : h'09020304',        / ( SID 60024 ) /
  +4 : h'00000A36200A',    / ( SID 60025 ) /
  +5 : 2329836,            / ( SID 60026 ) /
  +6 : 3,                  / ( SID 60027 ) /
  +7 : 6,                  / ( SID 60028 ) /
  +8 : 1                   / ( SID 60029 ) /
}
]]></artwork></figure>

</section>
<section anchor="block" title="Use of Block">

<t>The CoAP protocol provides reliability by acknowledging the UDP datagrams.
However, when large pieces of data need to be transported, datagrams get
fragmented, thus creating constraints on the resources in the client, server
and intermediate routers. The block option <xref target="RFC7959"/> allows the transport
of the total payload in individual blocks of which the
size can be adapted to the underlying transport sizes such as: (UDP datagram
size ~64KiB, IPv6 MTU of 1280, IEEE 802.15.4 payload of 60-80 bytes). Each
block is individually acknowledged to guarantee reliability.</t>

<t>Notice that the Block mechanism splits the data at fixed positions,
such that individual data fields may become fragmented. Therefore, assembly
of multiple blocks may be required to process the complete data field.</t>

<t>Beware of race conditions. Blocks are filled one at a time and care should
be taken that the whole data representation is sent in multiple blocks sequentially
without interruption. On the server, values are changed, lists are re-ordered,
extended or reduced. When these actions happen during the serialization of
the contents of the resource, the transported results do not correspond with
a state having occurred in the server; or worse the returned values are inconsistent.
For example: array length does not correspond with the actual number of items.
It may be advisable to use CBOR maps or CBOR arrays of undefined length, which
are foreseen for data streaming purposes.</t>

</section>
<section anchor="discovery" title="Resource Discovery">

<t>The presence and location of (path to) the management data are discovered
by sending a GET request to “/.well-known/core” including a resource type
(RT) parameter with the value “core.c.datastore” <xref target="RFC6690"/>.
Upon success, the return payload will contain the root resource of the
management data. It is up to the implementation to choose its root resource,
the value “/c” is used as an example. The example below shows the discovery
of the presence and location of management data.</t>

<figure><artwork align="left"><![CDATA[
REQ: GET /.well-known/core?rt=core.c.datastore

RES: 2.05 Content
</c>; rt="core.c.datastore"
]]></artwork></figure>

<t>Implemented data nodes MAY be discovered using the standard CoAP resource discovery.
The implementation can add the data node identifiers (SID) supported to
/.well-known/core with rt=”core.c.datanode”. The available SIDs can be discovered
by sending a GET request to “/.well-known/core” including a resource type (rt)
parameter with the value “core.c.datanode”. Upon success, the return payload will
contain the registered SIDs and their location.</t>

<t>The example below shows the discovery of the presence and location of data nodes.</t>

<figure><artwork align="left"><![CDATA[
REQ: GET /.well-known/core?rt=core.c.datanode

RES: 2.05 Content
</c/BaAiN>; rt="core.c.datanode",
</c/CF_fA>; rt="core.c.datanode"

]]></artwork></figure>

<t>The list of data nodes may become prohibitively long. Therefore, it is recommended
to discover the details about the YANG modules implemented by reading
a YANG module library (e.g. “ietf-comi-yang-library” ad defined by <xref target="I-D.veillette-core-yang-library"/>).</t>

<t>The resource “/mod.uri” is used to retrieve the location of the YANG module library.
This library can be stored locally on each server, or remotely on a different
server. The latter is advised when the deployment of many servers are identical.</t>

<t>The following example shows the URI of a local instance of container modules-state
(SID=1802) as defined in <xref target="I-D.veillette-core-yang-library"/>.</t>

<figure><artwork align="left"><![CDATA[
REQ: GET example.com/mod.uri

RES: 2.05 Content (Content-Format: text/plain; charset=utf-8)
example.com/c/cK
]]></artwork></figure>

<t>The following example shows the URI of a remote instance of same container.</t>

<figure><artwork align="left"><![CDATA[
REQ: GET example.com/mod.uri

RES: 2.05 Content (Content-Format: text/plain; charset=utf-8)
example-remote-server.com/group17/cK
]]></artwork></figure>

<t>Within the YANG module library all information about the module is stored
such as: module identifier, identifier hierarchy, grouping, features and
revision numbers.</t>

</section>
<section anchor="error-handling" title="Error Handling">

<t>In case a request is received which cannot be processed properly, the CoMI server MUST return an error message. This error message MUST contain a CoAP 4.xx or 5.xx response code.</t>

<t>Errors returned by a CoMI server can be broken into two categories, those associated to the CoAP protocol itself and those generated during the validation of the YANG data model constrains as described in <xref target="RFC7950"></xref> section 8.</t>

<t>The following list of common CoAP errors should be implemented by CoMI servers. This list is not exhaustive, other errors defined by CoAP and associated RFCs may be applicable.</t>

<t><list style="symbols">
  <t>Error 4.01 (Unauthorized) is returned by the CoMI server when the CoMI client is not authorized to perform the requested action on the targeted resource (i.e. data node, datastore, rpc, action or event stream).</t>
  <t>Error 4.02 (Bad Option) is returned by the CoMI server when one or more CoAP options are unknown or malformed.</t>
  <t>Error 4.04 (Not Found) is returned by the CoMI server when the CoMI client is requesting a non-instantiated resource (i.e. data node, datastore, rpc, action or event stream).</t>
  <t>Error 4.05 (Method Not Allowed) is returned by the CoMI server when the CoMI client is requesting a method not supported on the targeted resource. (e.g. GET on an rpc, PUT or POST on a data node with “config” set to false).</t>
  <t>Error 4.08 (Request Entity Incomplete) is returned by the CoMI server if one or multiple blocks of a block transfer request is missing, see <xref target="RFC7959"></xref> for more details.</t>
  <t>Error 4.13 (Request Entity Too Large) may be returned by the CoMI server during a block transfer request, see <xref target="RFC7959"></xref> for more details.</t>
  <t>Error 4.15 (Unsupported Content-Format) is returned by the CoMI server when the Content-Format used in the request don’t match those specified in section 2.3.</t>
</list></t>

<t>CoMI server MUST also enforce the different constraints associated to the YANG data models implemented. These constraints are described in <xref target="RFC7950"></xref> section 8. These errors are reported using the CoAP error code 4.00 (Bad Request) and may have the following error container as payload. The YANG definition and associated .sid file are available in <xref target="ietf-comi-yang"/> and <xref target="ietf-comi-sid"/>. The error container is encoded using delta value equal to the SID of the current schema node minus the SID of the parent container (i.e 1024).</t>

<figure><artwork align="left"><![CDATA[
+--rw error!
   +--rw error-tag             identityref
   +--rw error-app-tag?        identityref
   +--rw data-node-in-error?   instance-identifier
   +--rw error-message?        string
]]></artwork></figure>

<t>The following error-tag and error-app-tag are defined by the ietf-comi YANG module, these tags are implemented as YANG identity and can be extended as needed.</t>

<t><list style="symbols">
  <t>error-tag operation-failed is returned by the CoMI server when the operation request cannot be processed successfully.  <list style="symbols">
      <t>error-app-tag malformed-message is returned by the CoMI server when the payload received from the CoMI client don’t contain a well-formed CBOR content as defined in <xref target="RFC7049"></xref> section 3.3 or don’t comply with the CBOR structure defined within this document.</t>
      <t>error-app-tag data-not-unique is returned by the CoMI server when the validation of the ‘unique’ constraint of a list or leaf-list fails.</t>
      <t>error-app-tag too-many-elements is returned by the CoMI server when the validation of the ‘max-elements’ constraint of a list or leaf-list fails.</t>
      <t>error-app-tag too-few-elements is returned by the CoMI server when the validation of the ‘min-elements’ constraint of a list or leaf-list fails.</t>
      <t>error-app-tag must-violation is returned by the CoMI server when the restrictions imposed by a ‘must’ statement are violated.</t>
      <t>error-app-tag duplicate is returned by the CoMI server when a client tries to create a duplicate list or leaf-list entry.</t>
    </list></t>
  <t>error-tag invalid-value is returned by the CoMI server when the CoMI client tries to update or create a leaf with a value encoded using an invalid CBOR datatype or if the ‘range’, ‘length’, ‘pattern’ or ‘require-instance’ constrain is not fulfilled.  <list style="symbols">
      <t>error-app-tag invalid-datatype is returned by the CoMI server when CBOR encoding don’t follow the rules set by or when the value is incompatible with the YANG Built-In type. (e.g. a value greater than 127 for an int8, undefined enumeration)</t>
      <t>error-app-tag not-in-range is returned by the CoMI server when the validation of the ‘range’ property fails.</t>
      <t>error-app-tag invalid-length is returned by the CoMI server when the validation of the ‘length’ property fails.</t>
      <t>error-app-tag pattern-test-failed is returned by the CoMI server when the validation of the ‘pattern’ property fails.</t>
    </list></t>
  <t>error-tag missing-element is returned by the CoMI server when the operation requested by a CoMI client fail to comply with the ‘mandatory’ constraint defined. The ‘mandatory’ constraint is enforced for leafs and choices, unless the node or any of its ancestors have a ‘when’ condition or ‘if-feature’ expression that evaluates to ‘false’.  <list style="symbols">
      <t>error-app-tag missing-key is returned by the CoMI server to further qualify an missing-element error. This error is returned when the CoMI client  tries to create or list instance, without all the ‘key’ specified or when the CoMI client  tries to delete a leaf listed as a ‘key’.</t>
      <t>error-app-tag missing-input-parameter is returned by the CoMI server when the input parameters of an RPC or action are incomplete.</t>
    </list></t>
  <t>error-tag unknown-element is returned by the CoMI server when the CoMI client  tries to access a data node of a YANG module not supported, of a data node associated to an ‘if-feature’ expression evaluated to ‘false’ or to a ‘when’ condition evaluated to ‘false’.</t>
  <t>error-tag bad-element is returned by the CoMI server when the CoMI client  tries to create data nodes for more than one case in a choice.</t>
  <t>error-tag data-missing is returned by the CoMI server when a data node required to accept the request is not present.  <list style="symbols">
      <t>error-app-tag instance-required is returned by the CoMI server when a leaf of type ‘instance-identifier’ or ‘leafref’ marked with require-instance set to ‘true’ refers to an instance that does not exist.</t>
      <t>error-app-tag missing-choice is returned by the CoMI server when no nodes exist in a mandatory choice.</t>
    </list></t>
  <t>error-tag error is returned by the CoMI server when an unspecified error has occurred.</t>
</list></t>

<t>For example, the CoMI server might return the following error.</t>

<figure><artwork align="left"><![CDATA[
RES:  4.00 Bad Request (Content-Format :application/yang-value+cbor)
{
 +4 : 1020,        / error-tag = invalid-value /
 +2 : 1012,        / error-app-tag = not-in-range /
 +1 : 1736,        / data-node-in-error = timezone-utc-offset /
 +3 : "maximum value exceeded" / error-message /
}
]]></artwork></figure>

</section>
<section anchor="security-considerations" title="Security Considerations">

<t>For secure network management, it is important to restrict access to configuration variables
only to authorized parties. CoMI re-uses the security mechanisms already available to CoAP,
this includes DTLS <xref target="RFC6347"/> for protected access to resources, as well suitable
authentication and authorization mechanisms.</t>

<t>Among the security decisions that need to be made are selecting security modes and encryption
mechanisms (see <xref target="RFC7252"/>). This requires a trade-off, as the NoKey mode gives no protection at all,
but is easy to implement, whereas the X.509 mode is quite secure, but may be too complex for constrained devices.</t>

<t>In addition, mechanisms for authentication and authorization may need to be selected.</t>

<t>CoMI avoids defining new security mechanisms as much as possible.
However, some adaptations may still be required, to cater for CoMI’s specific requirements.</t>

</section>
<section anchor="iana-considerations" title="IANA Considerations">

<section anchor="resource-type-rt-link-target-attribute-values-registry" title="Resource Type (rt=) Link Target Attribute Values Registry">

<t>This document adds the following resource type to the “Resource Type (rt=) Link Target Attribute Values”, within the “Constrained RESTful Environments (CoRE) Parameters” registry.</t>

<texttable align="left">
      <ttcol align='left'>Value</ttcol>
      <ttcol align='left'>Description</ttcol>
      <ttcol align='left'>Reference</ttcol>
      <c>core.c.datastore</c>
      <c>YANG datastore</c>
      <c>RFC XXXX</c>
      <c>core.c.datanode</c>
      <c>YANG data node</c>
      <c>RFC XXXX</c>
      <c>core.c.liburi</c>
      <c>YANG module library</c>
      <c>RFC XXXX</c>
      <c>core.c.eventstream</c>
      <c>YANG event stream</c>
      <c>RFC XXXX</c>
</texttable>

<t>// RFC Ed.: replace RFC XXXX with this RFC number and remove this note.</t>

</section>
<section anchor="coap-content-formats-registry" title="CoAP Content-Formats Registry">

<t>This document adds the following Content-Format to the “CoAP Content-Formats”, within the “Constrained RESTful Environments (CoRE) Parameters” registry.</t>

<texttable align="left">
      <ttcol align='left'>Media Type</ttcol>
      <ttcol align='left'>Excoding ID</ttcol>
      <ttcol align='left'>Reference</ttcol>
      <c>application/yang-value+cbor</c>
      <c>XXX</c>
      <c>RFC XXXX</c>
      <c>application/yang-values+cbor</c>
      <c>XXX</c>
      <c>RFC XXXX</c>
      <c>application/yang-selectors+cbor</c>
      <c>XXX</c>
      <c>RFC XXXX</c>
      <c>application/yang-tree+cbor</c>
      <c>XXX</c>
      <c>RFC XXXX</c>
      <c>application/yang-ipatch+cbor</c>
      <c>XXX</c>
      <c>RFC XXXX</c>
</texttable>

<t>// RFC Ed.: replace XXX with assigned IDs and remove this note.
// RFC Ed.: replace RFC XXXX with this RFC number and remove this note.</t>

</section>
<section anchor="media-types-registry" title="Media Types Registry">

<t>This document adds the following media types to the “Media Types” registry.</t>

<texttable align="left">
      <ttcol align='left'>Name</ttcol>
      <ttcol align='left'>Template</ttcol>
      <ttcol align='left'>Reference</ttcol>
      <c>yang-value+cbor</c>
      <c>application/yang-value+cbor</c>
      <c>RFC XXXX</c>
      <c>yang-values+cbor</c>
      <c>application/yang-values+cbor</c>
      <c>RFC XXXX</c>
      <c>yang-selectors+cbor</c>
      <c>application/yang-selectors+cbor</c>
      <c>RFC XXXX</c>
      <c>yang-tree+cbor</c>
      <c>application/yang-tree+cbor</c>
      <c>RFC XXXX</c>
      <c>yang-ipatch+cbor</c>
      <c>application/yang-ipatch+cbor</c>
      <c>RFC XXXX</c>
</texttable>

<t>Each of these media types share the following information:</t>

<t><list style="symbols">
  <t>Subtype name: &lt;as listed in table&gt;</t>
  <t>Required parameters: N/A</t>
  <t>Optional parameters: N/A</t>
  <t>Encoding considerations: binary</t>
  <t>Security considerations: See the Security Considerations section of RFC XXXX</t>
  <t>Interoperability considerations: N/A</t>
  <t>Published specification: RFC XXXX</t>
  <t>Applications that use this media type: CoMI</t>
  <t>Fragment identifier considerations: N/A</t>
  <t>Additional information:</t>
</list></t>

<figure><artwork><![CDATA[
*  Deprecated alias names for this type: N/A

*  Magic number(s): N/A

*  File extension(s): N/A

*  Macintosh file type code(s): N/A
]]></artwork></figure>

<t><list style="symbols">
  <t>Person &amp; email address to contact for further information: iesg&amp;ietf.org</t>
  <t>Intended usage: COMMON</t>
  <t>Restrictions on usage: N/A</t>
  <t>Author: Michel Veillette, ietf&amp;augustcellars.com</t>
  <t>Change Controller: IESG</t>
  <t>Provisional registration?  No</t>
</list></t>

<t>// RFC Ed.: replace RFC XXXX with this RFC number and remove this note.</t>

</section>
<section anchor="tags-registry" title="Concise Binary Object Representation (CBOR) Tags Registry">

<t>This document adds the following tags to the “Concise Binary Object Representation (CBOR) Tags”  registry.</t>

<texttable align="left">
      <ttcol align='left'>Tag</ttcol>
      <ttcol align='left'>Data Item</ttcol>
      <ttcol align='left'>Semantics</ttcol>
      <ttcol align='left'>Reference</ttcol>
      <c>xxx</c>
      <c>array</c>
      <c>Oedered map</c>
      <c>RFC XXXX</c>
</texttable>

<t>// RFC Ed.: replace xxx by the assigned Tag and remove this note.
// RFC Ed.: replace RFC XXXX with this RFC number and remove this note.</t>

</section>
</section>
<section anchor="acknowledgements" title="Acknowledgements">

<t>We are very grateful to Bert Greevenbosch who was one of the original authors
of the CoMI specification and specified CBOR encoding and use of hashes.</t>

<t>Mehmet Ersue and Bert Wijnen explained the encoding aspects of PDUs transported
under SNMP. Carsten Bormann has given feedback on the use of CBOR.</t>

<t>Timothy Carey has provided the text for <xref target="lwm2m"/>.</t>

<t>The draft has benefited from comments (alphabetical order) by Rodney Cummings,
Dee Denteneer, Esko Dijk, Michael van Hartskamp, Tanguy Ropitault, Juergen
Schoenwaelder, Anuj Sehgal, Zach Shelby, Hannes Tschofenig, Michael Verschoor,
and Thomas Watteyne.</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='RFC4648' target='http://www.rfc-editor.org/info/rfc4648'>
<front>
<title>The Base16, Base32, and Base64 Data Encodings</title>
<author initials='S.' surname='Josefsson' fullname='S. Josefsson'><organization /></author>
<date year='2006' month='October' />
<abstract><t>This document describes the commonly used base 64, base 32, and base 16 encoding schemes.  It also discusses the use of line-feeds in encoded data, use of padding in encoded data, use of non-alphabet characters in encoded data, use of different encoding alphabets, and canonical encodings.  [STANDARDS-TRACK]</t></abstract>
</front>
<seriesInfo name='RFC' value='4648'/>
<seriesInfo name='DOI' value='10.17487/RFC4648'/>
</reference>



<reference  anchor='RFC5277' target='http://www.rfc-editor.org/info/rfc5277'>
<front>
<title>NETCONF Event Notifications</title>
<author initials='S.' surname='Chisholm' fullname='S. Chisholm'><organization /></author>
<author initials='H.' surname='Trevino' fullname='H. Trevino'><organization /></author>
<date year='2008' month='July' />
<abstract><t>This document defines mechanisms that provide an asynchronous message notification delivery service for the Network Configuration protocol (NETCONF).  This is an optional capability built on top of the base NETCONF definition.  This document defines the capabilities and operations necessary to support this service.  [STANDARDS-TRACK]</t></abstract>
</front>
<seriesInfo name='RFC' value='5277'/>
<seriesInfo name='DOI' value='10.17487/RFC5277'/>
</reference>



<reference  anchor='RFC6243' target='http://www.rfc-editor.org/info/rfc6243'>
<front>
<title>With-defaults Capability for NETCONF</title>
<author initials='A.' surname='Bierman' fullname='A. Bierman'><organization /></author>
<author initials='B.' surname='Lengyel' fullname='B. Lengyel'><organization /></author>
<date year='2011' month='June' />
<abstract><t>The Network Configuration Protocol (NETCONF) defines ways to read and edit configuration data from a NETCONF server.  In some cases, part of this data may not be set by the NETCONF client, but rather a default value known to the server is used instead.  In many situations the NETCONF client has a priori knowledge about default data, so the NETCONF server does not need to save it in a NETCONF configuration datastore or send it to the client in a retrieval operation reply.  In other situations the NETCONF client will need this data from the server.  Not all server implementations treat this default data the same way.  This document defines a capability-based extension to the NETCONF protocol that allows the NETCONF client to identify how defaults are processed by the server, and also defines new mechanisms for client control of server processing of default data.  [STANDARDS-TRACK]</t></abstract>
</front>
<seriesInfo name='RFC' value='6243'/>
<seriesInfo name='DOI' value='10.17487/RFC6243'/>
</reference>



<reference  anchor='RFC7049' target='http://www.rfc-editor.org/info/rfc7049'>
<front>
<title>Concise Binary Object Representation (CBOR)</title>
<author initials='C.' surname='Bormann' fullname='C. Bormann'><organization /></author>
<author initials='P.' surname='Hoffman' fullname='P. Hoffman'><organization /></author>
<date year='2013' month='October' />
<abstract><t>The Concise Binary Object Representation (CBOR) is a data format whose design goals include the possibility of extremely small code size, fairly small message size, and extensibility without the need for version negotiation.  These design goals make it different from earlier binary serializations such as ASN.1 and MessagePack.</t></abstract>
</front>
<seriesInfo name='RFC' value='7049'/>
<seriesInfo name='DOI' value='10.17487/RFC7049'/>
</reference>



<reference  anchor='RFC7252' target='http://www.rfc-editor.org/info/rfc7252'>
<front>
<title>The Constrained Application Protocol (CoAP)</title>
<author initials='Z.' surname='Shelby' fullname='Z. Shelby'><organization /></author>
<author initials='K.' surname='Hartke' fullname='K. Hartke'><organization /></author>
<author initials='C.' surname='Bormann' fullname='C. Bormann'><organization /></author>
<date year='2014' month='June' />
<abstract><t>The Constrained Application Protocol (CoAP) is a specialized web transfer protocol for use with constrained nodes and constrained (e.g., low-power, lossy) networks.  The nodes often have 8-bit microcontrollers with small amounts of ROM and RAM, while constrained networks such as IPv6 over Low-Power Wireless Personal Area Networks (6LoWPANs) often have high packet error rates and a typical throughput of 10s of kbit/s.  The protocol is designed for machine- to-machine (M2M) applications such as smart energy and building automation.</t><t>CoAP provides a request/response interaction model between application endpoints, supports built-in discovery of services and resources, and includes key concepts of the Web such as URIs and Internet media types.  CoAP is designed to easily interface with HTTP for integration with the Web while meeting specialized requirements such as multicast support, very low overhead, and simplicity for constrained environments.</t></abstract>
</front>
<seriesInfo name='RFC' value='7252'/>
<seriesInfo name='DOI' value='10.17487/RFC7252'/>
</reference>



<reference  anchor='RFC7950' target='http://www.rfc-editor.org/info/rfc7950'>
<front>
<title>The YANG 1.1 Data Modeling Language</title>
<author initials='M.' surname='Bjorklund' fullname='M. Bjorklund' role='editor'><organization /></author>
<date year='2016' month='August' />
<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='RFC' value='7950'/>
<seriesInfo name='DOI' value='10.17487/RFC7950'/>
</reference>



<reference  anchor='RFC7959' target='http://www.rfc-editor.org/info/rfc7959'>
<front>
<title>Block-Wise Transfers in the Constrained Application Protocol (CoAP)</title>
<author initials='C.' surname='Bormann' fullname='C. Bormann'><organization /></author>
<author initials='Z.' surname='Shelby' fullname='Z. Shelby' role='editor'><organization /></author>
<date year='2016' month='August' />
<abstract><t>The Constrained Application Protocol (CoAP) is a RESTful transfer protocol for constrained nodes and networks.  Basic CoAP messages work well for small payloads from sensors and actuators; however, applications will need to transfer larger payloads occasionally -- for instance, for firmware updates.  In contrast to HTTP, where TCP does the grunt work of segmenting and resequencing, CoAP is based on datagram transports such as UDP or Datagram Transport Layer Security (DTLS).  These transports only offer fragmentation, which is even more problematic in constrained nodes and networks, limiting the maximum size of resource representations that can practically be transferred.</t><t>Instead of relying on IP fragmentation, this specification extends basic CoAP with a pair of &quot;Block&quot; options for transferring multiple blocks of information from a resource representation in multiple request-response pairs.  In many important cases, the Block options enable a server to be truly stateless: the server can handle each block transfer separately, with no need for a connection setup or other server-side memory of previous block transfers.  Essentially, the Block options provide a minimal way to transfer larger representations in a block-wise fashion.</t><t>A CoAP implementation that does not support these options generally is limited in the size of the representations that can be exchanged, so there is an expectation that the Block options will be widely used in CoAP implementations.  Therefore, this specification updates RFC 7252.</t></abstract>
</front>
<seriesInfo name='RFC' value='7959'/>
<seriesInfo name='DOI' value='10.17487/RFC7959'/>
</reference>



<reference  anchor='RFC7641' target='http://www.rfc-editor.org/info/rfc7641'>
<front>
<title>Observing Resources in the Constrained Application Protocol (CoAP)</title>
<author initials='K.' surname='Hartke' fullname='K. Hartke'><organization /></author>
<date year='2015' month='September' />
<abstract><t>The Constrained Application Protocol (CoAP) is a RESTful application protocol for constrained nodes and networks.  The state of a resource on a CoAP server can change over time.  This document specifies a simple protocol extension for CoAP that enables CoAP clients to &quot;observe&quot; resources, i.e., to retrieve a representation of a resource and keep this representation updated by the server over a period of time.  The protocol follows a best-effort approach for sending new representations to clients and provides eventual consistency between the state observed by each client and the actual resource state at the server.</t></abstract>
</front>
<seriesInfo name='RFC' value='7641'/>
<seriesInfo name='DOI' value='10.17487/RFC7641'/>
</reference>



<reference  anchor='RFC8132' target='http://www.rfc-editor.org/info/rfc8132'>
<front>
<title>PATCH and FETCH Methods for the Constrained Application Protocol (CoAP)</title>
<author initials='P.' surname='van der Stok' fullname='P. van der Stok'><organization /></author>
<author initials='C.' surname='Bormann' fullname='C. Bormann'><organization /></author>
<author initials='A.' surname='Sehgal' fullname='A. Sehgal'><organization /></author>
<date year='2017' month='April' />
<abstract><t>The methods defined in RFC 7252 for the Constrained Application Protocol (CoAP) only allow access to a complete resource, not to parts of a resource.  In case of resources with larger or complex data, or in situations where resource continuity is required, replacing or requesting the whole resource is undesirable.  Several applications using CoAP need to access parts of the resources.</t><t>This specification defines the new CoAP methods, FETCH, PATCH, and iPATCH, which are used to access and update parts of a resource.</t></abstract>
</front>
<seriesInfo name='RFC' value='8132'/>
<seriesInfo name='DOI' value='10.17487/RFC8132'/>
</reference>



<reference  anchor='RFC8040' target='http://www.rfc-editor.org/info/rfc8040'>
<front>
<title>RESTCONF Protocol</title>
<author initials='A.' surname='Bierman' fullname='A. Bierman'><organization /></author>
<author initials='M.' surname='Bjorklund' fullname='M. Bjorklund'><organization /></author>
<author initials='K.' surname='Watsen' fullname='K. Watsen'><organization /></author>
<date year='2017' month='January' />
<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 the Network Configuration Protocol (NETCONF).</t></abstract>
</front>
<seriesInfo name='RFC' value='8040'/>
<seriesInfo name='DOI' value='10.17487/RFC8040'/>
</reference>



<reference anchor='I-D.ietf-core-yang-cbor'>
<front>
<title>CBOR Encoding of Data Modeled with YANG</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='February' day='7' year='2017' />

<abstract><t>This document defines encoding rules for serializing configuration data, state data, RPC input and RPC output, Action input, Action output and notifications defined within YANG modules using the Concise Binary Object Representation (CBOR) [RFC7049].</t></abstract>

</front>

<seriesInfo name='Internet-Draft' value='draft-ietf-core-yang-cbor-04' />
<format type='TXT'
        target='http://www.ietf.org/internet-drafts/draft-ietf-core-yang-cbor-04.txt' />
</reference>



<reference anchor='I-D.ietf-core-sid'>
<front>
<title>YANG Schema Item iDentifier (SID)</title>

<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>

<author initials='A' surname='Somaraju' fullname='Abhinav Somaraju'>
    <organization />
</author>

<date month='May' day='2' year='2017' />

<abstract><t>YANG Schema Item iDentifiers (SID) are globally unique 64-bit numeric identifiers used to identify all items used in YANG.  This document defines the semantics, 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-ietf-core-sid-01' />
<format type='TXT'
        target='http://www.ietf.org/internet-drafts/draft-ietf-core-sid-01.txt' />
</reference>



<reference anchor='I-D.veillette-core-yang-library'>
<front>
<title>Constrained YANG Module Library</title>

<author initials='M' surname='Veillette' fullname='Michel Veillette'>
    <organization />
</author>

<date month='January' day='31' year='2017' />

<abstract><t>This document describes a YANG library that provides information about all the YANG modules used by a constrained network management server (e.g., a CoAP Management Interface (CoMI) server).  Simple caching mechanisms are provided to allow clients to minimize retrieval of this information.</t></abstract>

</front>

<seriesInfo name='Internet-Draft' value='draft-veillette-core-yang-library-00' />
<format type='TXT'
        target='http://www.ietf.org/internet-drafts/draft-veillette-core-yang-library-00.txt' />
</reference>




    </references>

    <references title='Informative References'>





<reference  anchor='RFC4293' target='http://www.rfc-editor.org/info/rfc4293'>
<front>
<title>Management Information Base for the Internet Protocol (IP)</title>
<author initials='S.' surname='Routhier' fullname='S. Routhier' role='editor'><organization /></author>
<date year='2006' month='April' />
<abstract><t>This memo defines a portion of the Management Information Base (MIB) for use with network management protocols in the Internet community.  In particular, it describes managed objects used for implementations of the Internet Protocol (IP) in an IP version independent manner.  This memo obsoletes RFCs 2011, 2465, and 2466.  [STANDARDS-TRACK]</t></abstract>
</front>
<seriesInfo name='RFC' value='4293'/>
<seriesInfo name='DOI' value='10.17487/RFC4293'/>
</reference>



<reference  anchor='RFC6347' target='http://www.rfc-editor.org/info/rfc6347'>
<front>
<title>Datagram Transport Layer Security Version 1.2</title>
<author initials='E.' surname='Rescorla' fullname='E. Rescorla'><organization /></author>
<author initials='N.' surname='Modadugu' fullname='N. Modadugu'><organization /></author>
<date year='2012' month='January' />
<abstract><t>This document specifies version 1.2 of the Datagram Transport Layer Security (DTLS) protocol.  The DTLS protocol provides communications privacy for datagram protocols.  The protocol allows client/server applications to communicate in a way that is designed to prevent eavesdropping, tampering, or message forgery.  The DTLS protocol is based on the Transport Layer Security (TLS) protocol and provides equivalent security guarantees.  Datagram semantics of the underlying transport are preserved by the DTLS protocol.  This document updates DTLS 1.0 to work with TLS version 1.2.  [STANDARDS-TRACK]</t></abstract>
</front>
<seriesInfo name='RFC' value='6347'/>
<seriesInfo name='DOI' value='10.17487/RFC6347'/>
</reference>



<reference  anchor='RFC6690' target='http://www.rfc-editor.org/info/rfc6690'>
<front>
<title>Constrained RESTful Environments (CoRE) Link Format</title>
<author initials='Z.' surname='Shelby' fullname='Z. Shelby'><organization /></author>
<date year='2012' month='August' />
<abstract><t>This specification defines Web Linking using a link format for use by constrained web servers to describe hosted resources, their attributes, and other relationships between links.  Based on the HTTP Link Header field defined in RFC 5988, the Constrained RESTful Environments (CoRE) Link Format is carried as a payload and is assigned an Internet media type.  &quot;RESTful&quot; refers to the Representational State Transfer (REST) architecture.  A well-known URI is defined as a default entry point for requesting the links hosted by a server.  [STANDARDS-TRACK]</t></abstract>
</front>
<seriesInfo name='RFC' value='6690'/>
<seriesInfo name='DOI' value='10.17487/RFC6690'/>
</reference>



<reference  anchor='RFC7159' target='http://www.rfc-editor.org/info/rfc7159'>
<front>
<title>The JavaScript Object Notation (JSON) Data Interchange Format</title>
<author initials='T.' surname='Bray' fullname='T. Bray' role='editor'><organization /></author>
<date year='2014' month='March' />
<abstract><t>JavaScript Object Notation (JSON) is a lightweight, text-based, language-independent data interchange format.  It was derived from the ECMAScript Programming Language Standard.  JSON defines a small set of formatting rules for the portable representation of structured data.</t><t>This document removes inconsistencies with other specifications of JSON, repairs specification errors, and offers experience-based interoperability guidance.</t></abstract>
</front>
<seriesInfo name='RFC' value='7159'/>
<seriesInfo name='DOI' value='10.17487/RFC7159'/>
</reference>



<reference  anchor='RFC7223' target='http://www.rfc-editor.org/info/rfc7223'>
<front>
<title>A YANG Data Model for Interface Management</title>
<author initials='M.' surname='Bjorklund' fullname='M. Bjorklund'><organization /></author>
<date year='2014' month='May' />
<abstract><t>This document defines a YANG data model for the management of network interfaces.  It is expected that interface-type-specific data models augment the generic interfaces data model defined in this document. The data model includes configuration data and state data (status information and counters for the collection of statistics).</t></abstract>
</front>
<seriesInfo name='RFC' value='7223'/>
<seriesInfo name='DOI' value='10.17487/RFC7223'/>
</reference>



<reference  anchor='RFC7317' target='http://www.rfc-editor.org/info/rfc7317'>
<front>
<title>A YANG Data Model for System Management</title>
<author initials='A.' surname='Bierman' fullname='A. Bierman'><organization /></author>
<author initials='M.' surname='Bjorklund' fullname='M. Bjorklund'><organization /></author>
<date year='2014' month='August' />
<abstract><t>This document defines a YANG data model for the configuration and identification of some common system properties within a device containing a Network Configuration Protocol (NETCONF) server.  This document also includes data node definitions for system identification, time-of-day management, user management, DNS resolver configuration, and some protocol operations for system management.</t></abstract>
</front>
<seriesInfo name='RFC' value='7317'/>
<seriesInfo name='DOI' value='10.17487/RFC7317'/>
</reference>



<reference anchor='I-D.ietf-core-interfaces'>
<front>
<title>Reusable Interface Definitions for Constrained RESTful Environments</title>

<author initials='Z' surname='Shelby' fullname='Zach Shelby'>
    <organization />
</author>

<author initials='M' surname='Vial' fullname='Matthieu Vial'>
    <organization />
</author>

<author initials='M' surname='Koster' fullname='Michael Koster'>
    <organization />
</author>

<author initials='C' surname='Groves' fullname='Christian Groves'>
    <organization />
</author>

<date month='March' day='13' year='2017' />

<abstract><t>This document defines a set of Constrained RESTful Environments (CoRE) Link Format Interface Descriptions [RFC6690] applicable for use in constrained environments.  These include the: Actuator, Paramter, Read-only parameter, Sensor, Batch, Linked Batch and Link List interfaces.  The Batch, Linked Batch and Link List interfaces make use of resource collections.  This document further describes how collections relate to interfaces.  Many applications require a set of interface descriptions in order provide the required functionality.  This document defines the concept of function sets to specify this set of interfaces and resources.  _Editor's note: The git repository for the draft is found at https://github.com/core-wg/interfaces_  _Editor's note: Two open issues are proposals for: Removing the binding interface in favour of the link list interface.  Changing "rel" type from one attribute to two to indicate src and destination._</t></abstract>

</front>

<seriesInfo name='Internet-Draft' value='draft-ietf-core-interfaces-09' />
<format type='TXT'
        target='http://www.ietf.org/internet-drafts/draft-ietf-core-interfaces-09.txt' />
</reference>


<reference anchor="XML" >
  <front>
    <title>Extensible Markup Language (XML)</title>
    <author >
      <organization>W3C</organization>
    </author>
    <date />
  </front>
  <seriesInfo name="Web" value="http://www.w3.org/xml"/>
</reference>
<reference anchor="netconfcentral" >
  <front>
    <title>NETCONF Central: library of YANG modules</title>
    <author >
      <organization>YUMAworks</organization>
    </author>
    <date />
  </front>
  <seriesInfo name="Web" value="http://www.netconfcentral.org/modulelist"/>
</reference>
<reference anchor="yang-cbor" >
  <front>
    <title>yang-cbor Registry</title>
    <author initials="M." surname="Veillette" fullname="Michel Veillette">
      <organization></organization>
    </author>
    <date />
  </front>
  <seriesInfo name="Web" value="https://github.com/core-wg/yang-cbor/tree/master/registry/"/>
</reference>


    </references>


<section anchor="ietf-comi-yang" title="ietf-comi YANG module">

<figure><artwork align="left"><![CDATA[
<CODE BEGINS> file "ietf-comi@2017-07-01.yang"
module ietf-comi {
  yang-version 1.1;
  
  namespace "urn:ietf:params:xml:ns:yang:ietf-comi";
  prefix comi;

  organization
    "IETF Core Working Group";

  contact
    "Michel Veillette
     <mailto:michel.veillette@trilliantinc.com>

     Alexander Pelov
     <mailto:alexander@ackl.io>

     Peter van der Stok
     <mailto:consultancy@vanderstok.org>
     
     Andy Bierman
     <mailto:andy@yumaworks.com>";

  description
    "This module contains the different definitions required
     by the CoMI protocol.";

  revision 2017-07-01 {
     description
      "Initial revision.";
    reference
      "draft-ietf-core-comi";
  }

  identity error-tag {
    description
      "Base identity for error-tag.";
  }

  identity operation-failed {
    base error-tag;
    description
      "Returned by the CoMI server when the operation request
       can't be processed successfully.";
  }

  identity invalid-value {
    base error-tag;
    description
      "Returned by the CoMI server when the CoMI client tries to
       update or create a leaf with a value encoded using an
       invalid CBOR datatype or if the 'range', 'length',
       'pattern' or 'require-instance' constrain is not
       fulfilled.";
  }
  
  identity missing-element {
    base error-tag;
    description
      "Returned by the CoMI server when the operation requested
       by a CoMI client fails to comply with the 'mandatory'
       constraint defined. The 'mandatory' constraint is
       enforced for leafs and choices, unless the node or any of
       its ancestors have a 'when' condition or 'if-feature'
       expression that evaluates to 'false'.";
  }
  
  identity unknown-element {
    base error-tag;
    description
      "Returned by the CoMI server when the CoMI client tries to
       access a data node of a YANG module not supported, of a
       data node associated with an 'if-feature' expression
       evaluated to 'false' or to a 'when' condition evaluated
       to 'false'.";
  }
  
  identity bad-element {
    base error-tag;
    description
      "Returned by the CoMI server when the CoMI client tries to
       create data nodes for more than one case in a choice.";
  }

  identity data-missing {
    base error-tag;
    description
      "Returned by the CoMI server when a data node required to
       accept the request is not present.";
  }
  
  identity error {
    base error-tag;
    description
      "Returned by the CoMI server when an unspecified error has
      occurred.";
  }
  
  identity error-app-tag {
    description
      "Base identity for error-app-tag.";
  }


  identity malformed-message {
    base error-app-tag;
    description
      "Returned by the CoMI server when the payload received
       from the CoMI client don't contain a well-formed CBOR
       content as defined in [RFC7049] section 3.3 or don't
       comply with the CBOR structure defined within this
       document.";
  }

  identity data-not-unique {
    base error-app-tag;
    description
      "Returned by the CoMI server when the validation of the
       'unique' constraint of a list or leaf-list fails.";
  }

  identity too-many-elements {
    base error-app-tag;
    description
      "Returned by the CoMI server when the validation of the
       'max-elements' constraint of a list or leaf-list fails.";
  }

  identity too-few-elements {
    base error-app-tag;
    description
      "Returned by the CoMI server when the validation of the
       'min-elements' constraint of a list or leaf-list fails.";
  }

  identity must-violation {
    base error-app-tag;
    description
      "Returned by the CoMI server when the restrictions
       imposed by a 'must' statement are violated.";
  }

  identity duplicate {
    base error-app-tag;
    description
      "Returned by the CoMI server when a client tries to create
       a duplicate list or leaf-list entry.";
  }

  identity invalid-datatype {
    base error-app-tag;
    description
      "Returned by the CoMI server when CBOR encoding is
       incorect or when the value encoded is incompatible with
       the YANG Built-In type. (e.g. value greater than 127
       for an int8, undefined enumeration).";
  }

  identity not-in-range {
    base error-app-tag;
    description
      "Returned by the CoMI server when the validation of the
       'range' property fails.";
  }

  identity invalid-length {
    base error-app-tag;
    description
      "Returned by the CoMI server when the validation of the
       'length' property fails.";
  }

  identity pattern-test-failed {
    base error-app-tag;
    description
      "Returned by the CoMI server when the validation of the
       'pattern' property fails.";
  }

  identity missing-key {
    base error-app-tag;
    description
      "Returned by the CoMI server to further qualify a
       missing-element error. This error is returned when the
       CoMI client tries to create or list instance, without all
       the 'key' specified or when the CoMI client tries to
       delete a leaf listed as a 'key'.";
  }

  identity missing-input-parameter {
    base error-app-tag;
    description
      "Returned by the CoMI server when the input parameters
       of a RPC or action are incomplete.";
  }

  identity instance-required {
    base error-app-tag;
    description
      "Returned by the CoMI server when a leaf of type
       'instance-identifier' or 'leafref' marked with
       require-instance set to 'true' refers to an instance
       that does not exist.";
  }

  identity missing-choice {
    base error-app-tag;
    description
      "Returned by the CoMI server when no nodes exist in a
       mandatory choice.";
  }
        
  container error {
    presence "Error paylaod";
    
    description
      "Optional payload of a 4.00 Bad Request CoAP error.";

    leaf error-tag {
      type identityref {
        base error-tag;
      }
      mandatory true;
      description
        "The enumerated error-tag.";
    }

    leaf error-app-tag {
      type identityref {
        base error-app-tag;
      }
      description
        "The application-specific error-tag.";
    }   

    leaf data-node-in-error {
      type instance-identifier;
      description
        "When the error reported is caused by a specific data node,
         this leaf identifies the data node in error.";
    }

    leaf error-message {
      type string;
      description
        "A message describing the error.";
    }
  }
}
<CODE ENDS>
]]></artwork></figure>

</section>
<section anchor="ietf-comi-sid" title="ietf-comi .sid file">

<figure><artwork align="left"><![CDATA[
{
  "assignment-ranges": [
    {
      "entry-point": 1000,
      "size": 100
    }
  ],
  "module-name": "ietf-comi",
  "module-revision": "2017-07-01",
  "items": [
    {
      "type": "Module",
      "label": "ietf-comi",
      "sid": 1000
    },
    {
      "type": "identity",
      "label": "/error-app-tag",
      "sid": 1001
    },
    {
      "type": "identity",
      "label": "/error-app-tag/data-not-unique",
      "sid": 1002
    },
    {
      "type": "identity",
      "label": "/error-app-tag/duplicate",
      "sid": 1003
    },
    {
      "type": "identity",
      "label": "/error-app-tag/instance-required",
      "sid": 1004
    },
    {
      "type": "identity",
      "label": "/error-app-tag/invalid-datatype",
      "sid": 1005
    },
    {
      "type": "identity",
      "label": "/error-app-tag/invalid-length",
      "sid": 1006
    },
    {
      "type": "identity",
      "label": "/error-app-tag/malformed-message",
      "sid": 1007
    },
    {
      "type": "identity",
      "label": "/error-app-tag/missing-choice",
      "sid": 1008
    },
    {
      "type": "identity",
      "label": "/error-app-tag/missing-input-parameter",
      "sid": 1009
    },
    {
      "type": "identity",
      "label": "/error-app-tag/missing-key",
      "sid": 1010
    },
    {
      "type": "identity",
      "label": "/error-app-tag/must-violation",
      "sid": 1011
    },
    {
      "type": "identity",
      "label": "/error-app-tag/not-in-range",
      "sid": 1012
    },
    {
      "type": "identity",
      "label": "/error-app-tag/pattern-test-failed",
      "sid": 1013
    },
    {
      "type": "identity",
      "label": "/error-app-tag/too-few-elements",
      "sid": 1014
    },
    {
      "type": "identity",
      "label": "/error-app-tag/too-many-elements",
      "sid": 1015
    },
    {
      "type": "identity",
      "label": "/error-tag",
      "sid": 1016
    },
    {
      "type": "identity",
      "label": "/error-tag/bad-element",
      "sid": 1017
    },
    {
      "type": "identity",
      "label": "/error-tag/data-missing",
      "sid": 1018
    },
    {
      "type": "identity",
      "label": "/error-tag/error",
      "sid": 1019
    },
    {
      "type": "identity",
      "label": "/error-tag/invalid-value",
      "sid": 1020
    },
    {
      "type": "identity",
      "label": "/error-tag/missing-element",
      "sid": 1021
    },
    {
      "type": "identity",
      "label": "/error-tag/operation-failed",
      "sid": 1022
    },
    {
      "type": "identity",
      "label": "/error-tag/unknown-element",
      "sid": 1023
    },
    {
      "type": "node",
      "label": "/error",
      "sid": 1024
    },
    {
      "type": "node",
      "label": "/error/data-node-in-error",
      "sid": 1025
    },
    {
      "type": "node",
      "label": "/error/error-app-tag",
      "sid": 1026
    },
    {
      "type": "node",
      "label": "/error/error-message",
      "sid": 1027
    },
    {
      "type": "node",
      "label": "/error/error-tag",
      "sid": 1028
    }
  ]
}
]]></artwork></figure>

</section>
<section anchor="example-specifications" title="YANG example specifications">

<t>This appendix shows five YANG example specifications taken over from as many
existing YANG modules. The YANG modules are available from <xref target="netconfcentral"/>.
Each YANG item identifier is accompanied by its SID shown after the “//”
comment sign.</t>

<section anchor="ietf-system" title="ietf-system">

<t>Excerpt of the YANG module ietf-system <xref target="RFC7317"/>.</t>

<figure><artwork align="left"><![CDATA[
module ietf-system {                   // SID 1700
  container system {                   // SID 1715
    container clock {                  // SID 1734
      choice timezone {
        case timezone-name {
          leaf timezone-name {         // SID 1735
            type timezone-name;
          }
        }
        case timezone-utc-offset {
          leaf timezone-utc-offset {   // SID 1736
            type int16 {
            }
          }
        }
      }
    }
    container ntp {                    // SID 1750
      leaf enabled {                   // SID 1751
        type boolean;
        default true;
      }
      list server {                    // SID 1752
        key name;
        leaf name {                    // SID 1755
          type string;
        }
        choice transport {
          case udp {
            container udp {            // SID 1757
              leaf address {           // SID 1758
                type inet:host;
              }
              leaf port {              // SID 1759
                type inet:port-number;
              }
            }
          }
        }
        leaf association-type {        // SID 1753
          type enumeration {
            enum server {
            }
            enum peer {
            }
            enum pool {
            }
          }
        }
        leaf iburst {                  // SID 1754
          type boolean;
        }
        leaf prefer {                  // SID 1756
          type boolean;
          default false;
        }
      }
    }
  container system-state {             // SID 1716
    container clock {                  // SID 1717
      leaf current-datetime {          // SID 1719
        type yang:date-and-time;
      }
      leaf boot-datetime {             // SID 1718
        type yang:date-and-time;
      }
    }
  }
}

]]></artwork></figure>

</section>
<section anchor="server" title="server list">

<t>Taken over from <xref target="RFC7950"/> section 7.15.3.</t>

<figure><artwork align="left"><![CDATA[
module example-server-farm {
  yang-version 1.1;
  namespace "urn:example:server-farm";
  prefix "sfarm";

  import ietf-yang-types {
    prefix "yang";
  }

  list server {                        // SID 60000
    key name;
    leaf name {                        // SID 60001
      type string;
    }
    action reset {                     // SID 60002
      input {
        leaf reset-at {                // SID 60003
          type yang:date-and-time;
          mandatory true;
         }
       }
       output {
         leaf reset-finished-at {      // SID 60004
           type yang:date-and-time;
           mandatory true;
         }
       }
     }
   }
}

]]></artwork></figure>

</section>
<section anchor="interfaces" title="interfaces">

<t>Excerpt of the YANG module ietf-interfaces <xref target="RFC7223"/>.</t>

<figure><artwork align="left"><![CDATA[
module ietf-interfaces {               // SID 1500
  container interfaces {               // SID 1505
    list interface {                   // SID 1533
      key "name";
      leaf name {                      // SID 1537
        type string;
      }
      leaf description {               // SID 1534
        type string;
      }
      leaf type {                      // SID 1538
        type identityref {
          base interface-type;
        }
        mandatory true;
      }

      leaf enabled {                   // SID 1535
        type boolean;
        default "true";
      }

      leaf link-up-down-trap-enable {  // SID 1536
        if-feature if-mib;
        type enumeration {
          enum enabled {
            value 1;
          }
          enum disabled {
            value 2;
          }
        }
      }
    }
  }
}

]]></artwork></figure>

</section>
<section anchor="notify-ex" title="Example-port">

<t>Notification example defined within this document.</t>

<figure><artwork align="left"><![CDATA[
module example-port {
        ...
        notification example-port-fault {   // SID 60010
          description
            "Event generated if a hardware fault on a
             line card port is detected";
          leaf port-name {                  // SID 60011
            type string;
            description "Port name";
          }
          leaf port-fault {                 // SID 60012
            type string;
            description "Error condition detected";
          }
        }
      }
]]></artwork></figure>

</section>
<section anchor="smi" title="IP-MIB">

<t>The YANG translation of the SMI specifying the IP-MIB <xref target="RFC4293"/>, extended with example SID numbers, yields:</t>

<figure><artwork align="left"><![CDATA[
module IP-MIB {
  import IF-MIB {
    prefix if-mib;
  }
  import INET-ADDRESS-MIB {
    prefix inet-address;
  }
  import SNMPv2-TC {
    prefix smiv2;
  }
  import ietf-inet-types {
    prefix inet;
  }
  import yang-smi {
    prefix smi;
  }
  import ietf-yang-types {
    prefix yang;
  }

  container ip {                            // SID 60020
    list ipNetToPhysicalEntry {             // SID 60021
      key "ipNetToPhysicalIfIndex
           ipNetToPhysicalNetAddressType
           ipNetToPhysicalNetAddress";
      leaf ipNetToPhysicalIfIndex {         // SID 60022
        type if-mib:InterfaceIndex;
      }
      leaf ipNetToPhysicalNetAddressType {  // SID 60023
        type inet-address:InetAddressType;
      }
      leaf ipNetToPhysicalNetAddress {      // SID 60024
        type inet-address:InetAddress;
      }
      leaf ipNetToPhysicalPhysAddress {     // SID 60025
        type yang:phys-address {
          length "0..65535";
        }
      }
      leaf ipNetToPhysicalLastUpdated {     // SID 60026
        type yang:timestamp;
      }
      leaf ipNetToPhysicalType {            // SID 60027
        type enumeration {
          enum "other" {
            value 1;
          }
          enum "invalid" {
            value 2;
          }
          enum "dynamic" {
            value 3;
          }
          enum "static" {
            value 4;
          }
          enum "local" {
            value 5;
          }
        }
      }
      leaf ipNetToPhysicalState {           // SID 60028
        type enumeration {
          enum "reachable" {
            value 1;
          }
          enum "stale" {
            value 2;
          }
          enum "delay" {
            value 3;
          }
          enum "probe" {
            value 4;
          }
          enum "invalid" {
            value 5;
          }
          enum "unknown" {
            value 6;
          }
          enum "incomplete" {
            value 7;
          }
        }
      }
      leaf ipNetToPhysicalRowStatus {       // SID 60029
        type smiv2:RowStatus;
    }  // list ipNetToPhysicalEntry
  }  // container ip
}  // module IP-MIB

]]></artwork></figure>

</section>
</section>
<section anchor="lwm2m" title="Comparison with LWM2M">

<t>TO DO Need updated text based on the current version of CoMI.
Multiple assumptions used in the original text are no more valid.</t>

</section>


  </back>
</rfc>

