CoRE Working Group                                             M. Koster
Internet-Draft                                               SmartThings
Intended status: Informational                        B. Silverajan, Ed.
Expires: July 16, 2021                                Tampere University
                                                        January 12, 2021


     Dynamic Resource Linking for Constrained RESTful Environments
                       draft-ietf-core-dynlink-12

Abstract

   This specification defines Link Bindings, which provide dynamic
   linking of state updates between resources, either on an endpoint or
   between endpoints, for systems using CoAP (RFC7252).  This
   specification also defines Conditional Notification and Control
   Attributes that work with Link Bindings or with CoAP Observe
   (RFC7641).

Editor note

   The git repository for the draft is found at https://github.com/core-
   wg/dynlink

Status of This Memo

   This Internet-Draft is submitted in full conformance with the
   provisions of BCP 78 and BCP 79.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF).  Note that other groups may also distribute
   working documents as Internet-Drafts.  The list of current Internet-
   Drafts is at https://datatracker.ietf.org/drafts/current/.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   This Internet-Draft will expire on July 16, 2021.

Copyright Notice

   Copyright (c) 2021 IETF Trust and the persons identified as the
   document authors.  All rights reserved.

   This document is subject to BCP 78 and the IETF Trust's Legal
   Provisions Relating to IETF Documents



Koster & Silverajan       Expires July 16, 2021                 [Page 1]


Internet-Draft      Dynamic Resource Linking for CoRE       January 2021


   (https://trustee.ietf.org/license-info) in effect on the date of
   publication of this document.  Please review these documents
   carefully, as they describe your rights and restrictions with respect
   to this document.  Code Components extracted from this document must
   include Simplified BSD License text as described in Section 4.e of
   the Trust Legal Provisions and are provided without warranty as
   described in the Simplified BSD License.

Table of Contents

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   3
   2.  Terminology . . . . . . . . . . . . . . . . . . . . . . . . .   3
   3.  Conditional Notification and Control Attributes . . . . . . .   4
     3.1.  Attribute Definitions . . . . . . . . . . . . . . . . . .   4
       3.1.1.  Minimum Period (pmin) . . . . . . . . . . . . . . . .   5
       3.1.2.  Maximum Period (pmax) . . . . . . . . . . . . . . . .   6
       3.1.3.  Change Step (st)  . . . . . . . . . . . . . . . . . .   6
       3.1.4.  Greater Than (gt) . . . . . . . . . . . . . . . . . .   6
       3.1.5.  Less Than (lt)  . . . . . . . . . . . . . . . . . . .   7
       3.1.6.  Notification Band (band)  . . . . . . . . . . . . . .   7
       3.1.7.  Minimum Evaluation Period (epmin) . . . . . . . . . .   8
       3.1.8.  Maximum Evaluation Period (epmax) . . . . . . . . . .   8
     3.2.  Server processing of Conditional Notification Attributes    9
   4.  Link Bindings . . . . . . . . . . . . . . . . . . . . . . . .   9
     4.1.  The "bind" attribute and Binding Methods  . . . . . . . .  10
       4.1.1.  Polling . . . . . . . . . . . . . . . . . . . . . . .  11
       4.1.2.  Observe . . . . . . . . . . . . . . . . . . . . . . .  11
       4.1.3.  Push  . . . . . . . . . . . . . . . . . . . . . . . .  12
       4.1.4.  Execute . . . . . . . . . . . . . . . . . . . . . . .  12
     4.2.  Link Relation . . . . . . . . . . . . . . . . . . . . . .  12
   5.  Binding Table . . . . . . . . . . . . . . . . . . . . . . . .  13
   6.  Implementation Considerations . . . . . . . . . . . . . . . .  14
   7.  Security Considerations . . . . . . . . . . . . . . . . . . .  15
   8.  IANA Considerations . . . . . . . . . . . . . . . . . . . . .  15
     8.1.  Resource Type value 'core.bnd'  . . . . . . . . . . . . .  15
     8.2.  Link Relation Type  . . . . . . . . . . . . . . . . . . .  15
   9.  Acknowledgements  . . . . . . . . . . . . . . . . . . . . . .  16
   10. Contributors  . . . . . . . . . . . . . . . . . . . . . . . .  16
   11. Changelog . . . . . . . . . . . . . . . . . . . . . . . . . .  17
   12. References  . . . . . . . . . . . . . . . . . . . . . . . . .  20
     12.1.  Normative References . . . . . . . . . . . . . . . . . .  20
     12.2.  Informative References . . . . . . . . . . . . . . . . .  20
   Appendix A.  Examples . . . . . . . . . . . . . . . . . . . . . .  20
     A.1.  Minimum Period (pmin) example . . . . . . . . . . . . . .  21
     A.2.  Maximum Period (pmax) example . . . . . . . . . . . . . .  21
     A.3.  Greater Than (gt) example . . . . . . . . . . . . . . . .  22
     A.4.  Greater Than (gt) and Period Max (pmax) example . . . . .  23
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . .  24



Koster & Silverajan       Expires July 16, 2021                 [Page 2]


Internet-Draft      Dynamic Resource Linking for CoRE       January 2021


1.  Introduction

   IETF Standards for machine to machine communication in constrained
   environments describe a REST protocol [RFC7252] and a set of related
   information standards that may be used to represent machine data and
   machine metadata in REST interfaces.  CoRE Link-format [RFC6690] is a
   standard for doing Web Linking [RFC8288] in constrained environments.

   This specification introduces the concept of a Link Binding, which
   defines a new link relation type to create a dynamic link between
   resources over which state updates are conveyed.  Specifically, a
   Link Binding is a unidirectional link for binding the states of
   source and destination resources together such that updates to one
   are sent over the link to the other.  CoRE Link Format
   representations are used to configure, inspect, and maintain Link
   Bindings.  This specification additionally defines Conditional
   Notification and Control Attributes for use with Link Bindings and
   with CoRE Observe [RFC7641].

2.  Terminology

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
   "OPTIONAL" in this document are to be interpreted as described in
   BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all
   capitals, as shown here.

   This specification requires readers to be familiar with all the terms
   and concepts that are discussed in [RFC8288] and [RFC6690].  This
   specification makes use of the following additional terminology:

   Link Binding:  A unidirectional logical link between a source
      resource and a destination resource, over which state information
      is synchronized.

   State Synchronization:  Depending on the binding method (Polling,
      Observe, Push) different REST methods may be used to synchronize
      the resource values between a source and a destination.  The
      process of using a REST method to achieve this is defined as
      "State Synchronization".  The endpoint triggering the state
      synchronization is the synchronization initiator.

   Notification Band:  A resource value range that results in state
      sychronization.  The value range may be bounded by a minimum and
      maximum value or may be unbounded having either a minimum or
      maximum value.





Koster & Silverajan       Expires July 16, 2021                 [Page 3]


Internet-Draft      Dynamic Resource Linking for CoRE       January 2021


3.  Conditional Notification and Control Attributes

3.1.  Attribute Definitions

   This specification defines Conditional Notification and Control
   Attributes, which provide for fine-grained control of notification
   and state synchronization when using CoRE Observe [RFC7641] or Link
   Bindings (see Section 4).  Conditional Notification Attributes define
   the conditions that trigger a notification.  Conditional Control
   Attributes define the cadence of the measurement of the conditions
   that trigger a notification.

   When resource interfaces following this specification are made
   available over CoAP, the CoAP Observation mechanism [RFC7641] MAY
   also be used to observe any changes in a resource, and receive
   asynchronous notifications as a result.  A resource marked as
   Observable in its link description SHOULD support these Conditional
   Notification and Control Attributes.

   The set of Notification Attributes defined here allow a client to
   control how often a client is interested in receiving notifications
   and how much a resource value should change for the new
   representation to be interesting.  The set of Control Attributes
   defined here allow a client to control how often the server performs
   a measurement of the conditions.

   One or more Notification Attributes MAY be included as query
   parameters in an Observe request.

   Conditional Notification Attributes are defined below:

            +-------------------+-----------+-----------------+
            | Attribute         | Parameter | Value           |
            +-------------------+-----------+-----------------+
            | Greater Than      | gt        | xs:decimal      |
            |                   |           |                 |
            | Less Than         | lt        | xs:decimal      |
            |                   |           |                 |
            | Change Step       | st        | xs:decimal (>0) |
            |                   |           |                 |
            | Notification Band | band      | xs:boolean      |
            +-------------------+-----------+-----------------+

               Table 1: Conditional Notification Attributes

   One or more Control Attributes MAY be included as query parameters in
   an Observe request.




Koster & Silverajan       Expires July 16, 2021                 [Page 4]


Internet-Draft      Dynamic Resource Linking for CoRE       January 2021


   Conditional Control Attributes are defined below:

      +-------------------------------+-----------+-----------------+
      | Attribute                     | Parameter | Value           |
      +-------------------------------+-----------+-----------------+
      | Minimum Period (s)            | pmin      | xs:decimal (>0) |
      |                               |           |                 |
      | Maximum Period (s)            | pmax      | xs:decimal (>0) |
      |                               |           |                 |
      | Minimum Evaluation Period (s) | epmin     | xs:decimal (>0) |
      |                               |           |                 |
      | Maximum Evaluation Period (s) | epmax     | xs:decimal (>0) |
      +-------------------------------+-----------+-----------------+

                  Table 2: Conditional Control Attributes

   Conditional Notification Attributes SHOULD be evaluated on all
   potential notifications from a resource, whether resulting from an
   internal server-driven sampling process or from external update
   requests to the server.  Conditional Control Attributes are used to
   configure the internal server-driven sampling process for performing
   measurements of the conditions of a resource.

   Note: In this draft, we assume that there are finite quantization
   effects in the internal or external updates to the value of a
   resource; specifically, that a resource may be updated at any time
   with any valid value.  We therefore avoid any continuous-time
   assumptions in the description of the Conditional Notification
   Attributes and instead use the phrase "sampled value" to refer to a
   member of a sequence of values that may be internally observed from
   the resource state over time.

3.1.1.  Minimum Period (pmin)

   When present, the minimum period indicates the minimum time, in
   seconds, between two consecutive notifications (whether or not the
   resource value has changed).  In the absence of this parameter, the
   minimum period is up to the server.  The minimum period MUST be
   greater than zero otherwise the receiver MUST return a CoAP error
   code 4.00 "Bad Request" (or equivalent).

   A server MAY report the last sampled value that occured during the
   pmin interval, after the pmin interval expires.

   Note: Due to finite quantization effects, the time between
   notifications may be greater than pmin even when the sampled value
   changes within the pmin interval.  Pmin may or may not be used to
   drive the internal sampling process.



Koster & Silverajan       Expires July 16, 2021                 [Page 5]


Internet-Draft      Dynamic Resource Linking for CoRE       January 2021


3.1.2.  Maximum Period (pmax)

   When present, the maximum period indicates the maximum time, in
   seconds, between two consecutive notifications (whether or not the
   resource value has changed).  In the absence of this parameter, the
   maximum period is up to the server.  The maximum period MUST be
   greater than zero and MUST be greater than, or equal to, the minimum
   period parameter (if present) otherwise the receiver MUST return a
   CoAP error code 4.00 "Bad Request" (or equivalent).

3.1.3.  Change Step (st)

   When present, the change step indicates how much the value of a
   resource SHOULD change before triggering a notification, compared to
   the value of the previous notification.  Upon reception of a query
   including the st attribute, the most recently sampled value of the
   resource is reported, and then set as the last reported value
   (last_rep_v).  When a subsequent sample or update of the resource
   value differs from the last reported value by an amount, positive or
   negative, greater than or equal to st, and the time for pmin has
   elapsed since the last notification, a notification is sent and the
   last reported value is updated to the value sent in the notification.
   The change step MUST be greater than zero otherwise the receiver MUST
   return a CoAP error code 4.00 "Bad Request" (or equivalent).

   The Change Step parameter can only be supported on resources with a
   scalar numeric value.

   Note: Due to sampling and other constraints, e.g. pmin, the resource
   value received in two sequential notifications may differ by more
   than st.

3.1.4.  Greater Than (gt)

   When present, Greater Than indicates the upper limit value the
   sampled value SHOULD cross before triggering a notification.  A
   notification is sent whenever the sampled value crosses the specified
   upper limit value, relative to the last reported value, and the time
   fpr pmin has elapsed since the last notification.  The sampled value
   is sent in the notification.  If the value continues to rise, no
   notifications are generated as a result of gt.  If the value drops
   below the upper limit value then a notification is sent, subject
   again to the pmin time.

   The Greater Than parameter can only be supported on resources with a
   scalar numeric value.





Koster & Silverajan       Expires July 16, 2021                 [Page 6]


Internet-Draft      Dynamic Resource Linking for CoRE       January 2021


3.1.5.  Less Than (lt)

   When present, Less Than indicates the lower limit value the resource
   value SHOULD cross before triggering a notification.  A notification
   is sent when the samples value crosses the specified lower limit
   value, relative to the last reported value, and the time fpr pmin has
   elapsed since the last notification.  The sampled value is sent in
   the notification.  If the value continues to fall no notifications
   are generated as a result of lt.  If the value rises above the lower
   limit value then a new notification is sent, subject to the pmin
   time..

   The Less Than parameter can only be supported on resources with a
   scalar numeric value.

3.1.6.  Notification Band (band)

   The notification band attribute allows a bounded or unbounded (based
   on a minimum or maximum) value range that may trigger multiple
   notifications.  This enables use cases where different ranges results
   in differing behaviour.  For example: monitoring the temperature of
   machinery.  Whilst the temperature is in the normal operating range
   only periodic observations are needed.  However as the temperature
   moves to more abnormal ranges more frequent synchronization/reporting
   may be needed.

   Without a notification band, a transition across a less than (lt), or
   greater than (gt) limit only generates one notification.  This means
   that it is not possible to describe a case where multiple
   notifications are sent so long as the limit is exceeded.

   The band attribute works as a modifier to the behaviour of gt and lt.
   Therefore, if band is present in a query, gt, lt or both, MUST be
   included.

   When band is present with the lt attribute, it defines the lower
   bound for the notification band (notification band minimum).
   Notifications occur when the resource value is equal to or above the
   notification band minimum.  If lt is not present there is no minimum
   value for the band.

   When band is present with the gt attribute, it defines the upper
   bound for the notification band (notification band maximum).
   Notifications occur when the resource value is equal to or below the
   notification band maximum.  If gt is not present there is no maximum
   value for the band.





Koster & Silverajan       Expires July 16, 2021                 [Page 7]


Internet-Draft      Dynamic Resource Linking for CoRE       January 2021


   If band is present with both the gt and lt attributes, notification
   occurs when the resource value is greater than or equal to gt or when
   the resource value is less than or equal to lt.

   If a band is specified in which the value of gt is less than that of
   lt, in-band notification occurs.  That is, notification occurs
   whenever the resource value is between the gt and lt values,
   including equal to gt or lt.

   If the band is specified in which the value of gt is greater than
   that of lt, out-of-band notification occurs.  That is, notification
   occurs when the resource value not between the gt and lt values,
   excluding equal to gt and lt.

   The Notification Band parameter can only be supported on resources
   with a scalar numeric value.

3.1.7.  Minimum Evaluation Period (epmin)

   When present, the minimum evaluation period indicates the minimum
   time, in seconds, the client recommends to the server to wait between
   two consecutive measurements of the conditions of a resource since
   the client has no interest in the server doing more frequent
   measurements.  When the minimum evaluation period expires after the
   previous measurement, the server MAY immediately perform a new
   measurement.  In the absence of this parameter, the minimum
   evaluation period is not defined and thus not used by the server.
   The server MAY use pmin, if defined, as a guidance on the desired
   measurement cadence.  The minimum evaluation period MUST be greater
   than zero otherwise the receiver MUST return a CoAP error code 4.00
   "Bad Request" (or equivalent).

3.1.8.  Maximum Evaluation Period (epmax)

   When present, the maximum evaluation period indicates the maximum
   time, in seconds, the server MAY wait between two consecutive
   measurements of the conditions of a resource.  When the maximum
   evaluation period expires after the previous measurement, the server
   MUST immediately perform a new measurement.  In the absence of this
   parameter, the maximum evaluation period is not defined and thus not
   used by the server.  The maximum evaluation period MUST be greater
   than zero and MUST be greater than the minimum evaluation period
   parameter (if present) otherwise the receiver MUST return a CoAP
   error code 4.00 "Bad Request" (or equivalent).







Koster & Silverajan       Expires July 16, 2021                 [Page 8]


Internet-Draft      Dynamic Resource Linking for CoRE       January 2021


3.2.  Server processing of Conditional Notification Attributes

   Pmin, pmax, epmin, epmax, st, gt, lt and band may be present in the
   same query.  However, they are not defined at multiple prioritization
   levels.  The server sends a notification whenever any of the
   parameter conditions are met, upon which it updates its last
   notification value and time to prepare for the next notification.
   Only one notification occurs when there are multiple conditions being
   met at the same time.  The reference code below illustrates the logic
   to determine when a notification is to be sent.

bool notifiable( Resource * r ) {

#define BAND r->band
#define SCALAR_TYPE ( num_type == r->type )
#define STRING_TYPE ( str_type == r->type )
#define BOOLEAN_TYPE ( bool_type == r->type )
#define PMIN_EX ( r->last_sample_time - r->last_rep_time >= r->pmin )
#define PMAX_EX ( r->last_sample_time - r->last_rep_time > r->pmax )
#define LT_EX ( r->v < r->lt ^ r->last_rep_v < r->lt )
#define GT_EX ( r->v > r->gt ^ r->last_rep_v > r->gt )
#define ST_EX ( abs( r->v - r->last_rep_v ) >= r->st )
#define IN_BAND ( ( r->gt <= r->v && r->v <= r->lt ) || ( r->lt <= r->gt && r->gt <= r->v ) || ( r->v <= r->lt && r->lt <= r->gt ) )
#define VB_CHANGE ( r->vb != r->last_rep_vb )
#define VS_CHANGE ( r->vs != r->last_rep_vs )

  return (
    PMIN_EX &&
    ( SCALAR_TYPE ?
      ( ( !BAND && ( GT_EX || LT_EX || ST_EX || PMAX_EX ) ) ||
        ( BAND && IN_BAND && ( ST_EX || PMAX_EX) ) )
    : STRING_TYPE ?
      ( VS_CHANGE || PMAX_EX )
    : BOOLEAN_TYPE ?
      ( VB_CHANGE || PMAX_EX )
    : false )
  );
}

        Figure 1: Code logic for conditional notification attribute
                               interactions

4.  Link Bindings

   In a M2M RESTful environment, endpoints may directly exchange the
   content of their resources to operate the distributed system.  For
   example, a light switch may supply on-off control information that
   may be sent directly to a light resource for on-off control.



Koster & Silverajan       Expires July 16, 2021                 [Page 9]


Internet-Draft      Dynamic Resource Linking for CoRE       January 2021


   Beforehand, a configuration phase is necessary to determine how the
   resources of the different endpoints are related to each other.  This
   can be done either automatically using discovery mechanisms or by
   means of human intervention and a so-called commissioning tool.

   In this specification such an abstract relationship between two
   resources is defined, called a Link Binding.  The configuration phase
   necessitates the exchange of binding information, so a format
   recognized by all CoRE endpoints is essential.  This specification
   defines a format based on the CoRE Link-Format to represent binding
   information along with the rules to define a binding method which is
   a specialized relationship between two resources.

   The purpose of such a binding is to synchronize content updates
   between a source resource and a destination resource.  The
   destination resource MAY be a group resource if the authority
   component of the destination URI contains a group address (either a
   multicast address or a name that resolves to a multicast address).
   Since a binding is unidirectional, the binding entry defining a
   relationship is present only on one endpoint.  The binding entry may
   be located either on the source or the destination endpoint depending
   on the binding method.

   Conditional Notification Attributes defined in Section 3 can be used
   with Link Bindings in order to customize the notification behavior
   and timing.

4.1.  The "bind" attribute and Binding Methods

   A binding method defines the rules to generate the network-transfer
   exchanges that synchronize state between source and destination
   resources.  By using REST methods content is sent from the source
   resource to the destination resource.

   This specification defines a new CoRE link attribute "bind".  This is
   the identifier for a binding method which defines the rules to
   synchronize the destination resource.  This attribute is mandatory.

                +----------------+-----------+-----------+
                | Attribute      | Parameter | Value     |
                +----------------+-----------+-----------+
                | Binding method | bind      | xs:string |
                +----------------+-----------+-----------+

                        Table 3: The bind attribute

   The following table gives a summary of the binding methods defined in
   this specification.



Koster & Silverajan       Expires July 16, 2021                [Page 10]


Internet-Draft      Dynamic Resource Linking for CoRE       January 2021


          +---------+------------+-------------+---------------+
          | Name    | Identifier | Location    | Method        |
          +---------+------------+-------------+---------------+
          | Polling | poll       | Destination | GET           |
          |         |            |             |               |
          | Observe | obs        | Destination | GET + Observe |
          |         |            |             |               |
          | Push    | push       | Source      | PUT           |
          |         |            |             |               |
          | Execute | exec       | Source      | POST          |
          +---------+------------+-------------+---------------+

                      Table 4: Binding Method Summary

   The description of a binding method defines the following aspects:

   Identifier:  This is the value of the "bind" attribute used to
      identify the method.

   Location:  This information indicates whether the binding entry is
      stored on the source or on the destination endpoint.

   REST Method:  This is the REST method used in the Request/Response
      exchanges.

   Conditional Notification:  How Conditional Notification Attributes
      are used in the binding.

   The binding methods are described in more detail below.

4.1.1.  Polling

   The Polling method consists of sending periodic GET requests from the
   destination endpoint to the source resource and copying the content
   to the destination resource.  The binding entry for this method MUST
   be stored on the destination endpoint.  The destination endpoint MUST
   ensure that the polling frequency does not exceed the limits defined
   by the pmin and pmax attributes of the binding entry.  The copying
   process MAY filter out content from the GET requests using value-
   based conditions (e.g based on the Change Step, Less Than, Greater
   Than attributes).

4.1.2.  Observe

   The Observe method creates an observation relationship between the
   destination endpoint and the source resource.  On each notification
   the content from the source resource is copied to the destination
   resource.  The creation of the observation relationship requires the



Koster & Silverajan       Expires July 16, 2021                [Page 11]


Internet-Draft      Dynamic Resource Linking for CoRE       January 2021


   CoAP Observation mechanism [RFC7641] hence this method is only
   permitted when the resources are made available over CoAP.  The
   binding entry for this method MUST be stored on the destination
   endpoint.  The binding conditions are mapped as query parameters in
   the Observe request (see Section 3).

4.1.3.  Push

   The Push method can be used to allow a source endpoint to replace an
   outdated resource state at the destination with a newer
   representation.  When the Push method is assigned to a binding, the
   source endpoint sends PUT requests to the destination resource when
   the Conditional Notification Attributes are satisfied for the source
   resource.  The source endpoint SHOULD only send a notification
   request if any included Conditional Notification Attributes are met.
   The binding entry for this method MUST be stored on the source
   endpoint.

4.1.4.  Execute

   An alternative means for a source endpoint to deliver change-of-state
   notifications to a destination resource is to use the Execute Method.
   While the Push method simply updates the state of the destination
   resource with the representation of the source resource, Execute can
   be used when the destination endpoint wishes to receive all state
   changes from a source.  This allows, for example, the existence of a
   resource collection consisting of all the state changes at the
   destination endpoint.  When the Execute method is assigned to a
   binding, the source endpoint sends POST requests to the destination
   resource when the Conditional Notification Attributes are satisfied
   for the source resource.  The source endpoint SHOULD only send a
   notification request if any included Conditional Notification
   Attributes are met.  The binding entry for this method MUST be stored
   on the source endpoint.

   Note: Both the Push and the Execute methods are examples of Server
   Push mechanisms that are being researched in the Thing-to-Thing
   Research Group (T2TRG) [I-D.irtf-t2trg-rest-iot].

4.2.  Link Relation

   Since Binding involves the creation of a link between two resources,
   Web Linking and the CoRE Link-Format used to represent binding
   information.  This involves the creation of a new relation type,
   "boundto".  In a Web link with this relation type, the target URI
   contains the location of the source resource and the context URI
   points to the destination resource.




Koster & Silverajan       Expires July 16, 2021                [Page 12]


Internet-Draft      Dynamic Resource Linking for CoRE       January 2021


5.  Binding Table

   The Binding Table is a special resource that describes the bindings
   on an endpoint.  An endpoint offering a representation of the Binding
   Table resource SHOULD indicate its presence and enable its discovery
   by advertising a link at "/.well-known/core" [RFC6690].  If so, the
   Binding Table resource MUST be discoverable by using the Resource
   Type (rt) 'core.bnd'.

   The Methods column defines the REST methods supported by the Binding
   Table, which are described in more detail below.

         +---------------+----------+----------+----------------+
         | Resource      | rt=      | Methods  | Content-Format |
         +---------------+----------+----------+----------------+
         | Binding Table | core.bnd | GET, PUT | link-format    |
         +---------------+----------+----------+----------------+

                    Table 5: Binding Table Description

   The REST methods GET and PUT are used to manipulate a Binding Table.
   A GET request simply returns the current state of a Binding Table.  A
   request with a PUT method and a content format of application/link-
   format is used to clear the bindings to the table or replaces its
   entire contents.  All links in the payload of a PUT rquest MUST have
   a relation type "boundto".

   The following example shows requests for discovering, retrieving and
   replacing bindings in a binding table.






















Koster & Silverajan       Expires July 16, 2021                [Page 13]


Internet-Draft      Dynamic Resource Linking for CoRE       January 2021


   Req: GET /.well-known/core?rt=core.bnd (application/link-format)
   Res: 2.05 Content (application/link-format)
   </bnd/>;rt=core.bnd;ct=40

   Req: GET /bnd/
   Res: 2.05 Content (application/link-format)
   <coap://sensor.example.com/a/switch1/>;
           rel=boundto;anchor=/a/fan,;bind="obs",
   <coap://sensor.example.com/a/switch2/>;
           rel=boundto;anchor=/a/light;bind="obs"

   Req: PUT /bnd/ (Content-Format: application/link-format)
   <coap://sensor.example.com/s/light>;
     rel="boundto";anchor="/a/light";bind="obs";pmin=10;pmax=60
   Res: 2.04 Changed

   Req: GET /bnd/
   Res: 2.05 Content (application/link-format)
   <coap://sensor.example.com/s/light>;
     rel="boundto";anchor="/a/light";bind="obs";pmin=10;pmax=60

                      Figure 2: Binding Table Example

   Additional operations on the Binding Table can be specified in future
   documents.  Such operations can include, for example, the usage of
   the iPATCH or PATCH methods [RFC8132] for fine-grained addition and
   removal of individual bindings or binding subsets.

6.  Implementation Considerations

   When using multiple resource bindings (e.g. multiple Observations of
   resource) with different bands, consideration should be given to the
   resolution of the resource value when setting sequential bands.  For
   example: Given BandA (Abmn=10, Bbmx=20) and BandB (Bbmn=21, Bbmx=30).
   If the resource value returns an integer then notifications for
   values between and inclusive of 10 and 30 will be triggered.  Whereas
   if the resolution is to one decimal point (0.1) then notifications
   for values 20.1 to 20.9 will not be triggered.

   The use of the notification band minimum and maximum allow for a
   synchronization whenever a change in the resource value occurs.
   Theoretically this could occur in-line with the server internal
   sample period or the configuration of epmin and epmax values for
   determining the resource value.  Implementors SHOULD consider the
   resolution needed before updating the resource, e.g. updating the
   resource when a temperature sensor value changes by 0.001 degree
   versus 1 degree.




Koster & Silverajan       Expires July 16, 2021                [Page 14]


Internet-Draft      Dynamic Resource Linking for CoRE       January 2021


   The initiation of a Link Binding can be delegated from a client to a
   link state machine implementation, which can be an embedded client or
   a configuration tool.  Implementation considerations have to be given
   to how to monitor transactions made by the configuration tool with
   regards to Link Bindings, as well as any errors that may arise with
   establishing Link Bindings in addition to established Link Bindings.

   When a server has multiple observations with different measurement
   cadences as defined by the epmin and epmax values, the server MAY
   evaluate all observations when performing the measurement of any one
   observation.

7.  Security Considerations

   Consideration has to be given to what kinds of security credentials
   the state machine of a configuration tool or an embedded client needs
   to be configured with, and what kinds of access control lists client
   implementations should possess, so that transactions on creating Link
   Bindings and handling error conditions can be processed by the state
   machine.

8.  IANA Considerations

8.1.  Resource Type value 'core.bnd'

   This specification registers a new Resource Type Link Target
   Attribute 'core.bnd' in the Resource Type (rt=) registry established
   as per [RFC6690].

   Attribute Value:  core.bnd

   Description: See Section 5.  This attribute value is used to discover
   the resource representing a binding table, which describes the link
   bindings between source and destination resources for the purposes of
   synchronizing their content.

   Reference: This specification.  Note to RFC editor: please insert the
   RFC of this specification.

   Notes: None

8.2.  Link Relation Type

   This specification registers the new "boundto" link relation type as
   per [RFC8288].

   Relation Name:  boundto




Koster & Silverajan       Expires July 16, 2021                [Page 15]


Internet-Draft      Dynamic Resource Linking for CoRE       January 2021


   Description:  The purpose of a boundto relation type is to indicate
      that there is a binding between a source resource and a
      destination resource for the purposes of synchronizing their
      content.

   Reference:  This specification.  Note to RFC editor: please insert
      the RFC of this specification.

   Notes:  None

   Application Data:  None

9.  Acknowledgements

   Acknowledgement is given to colleagues from the SENSEI project who
   were critical in the initial development of the well-known REST
   interface concept, to members of the IPSO Alliance where further
   requirements for interface types have been discussed, and to Szymon
   Sasin, Cedric Chauvenet, Daniel Gavelle and Carsten Bormann who have
   provided useful discussion and input to the concepts in this
   specification.  Christian Amsuss supplied a comprehensive review of
   draft -06.  Hannes Tschofenig and Mert Ocak highlighted syntactical
   corrections in the usage of pmax and pmin in a query.  Discussions
   with Ari Keraenen led to the addition of an extra binding method
   supporting POST operations.  Alan Soloway contributed text leading to
   the inclusion of epmin and epmax.  David Navarro proposed allowing
   for pmax to be equal to pmin.

10.  Contributors






















Koster & Silverajan       Expires July 16, 2021                [Page 16]


Internet-Draft      Dynamic Resource Linking for CoRE       January 2021


   Christian Groves
   Australia
   email: cngroves.std@gmail.com

   Zach Shelby
   ARM
   Vuokatti
   FINLAND
   phone: +358 40 7796297
   email: zach.shelby@arm.com

   Matthieu Vial
   Schneider-Electric
   Grenoble
   France
   phone: +33 (0)47657 6522
   eMail: matthieu.vial@schneider-electric.com

   Jintao Zhu
   Huawei
   Xi'an, Shaanxi Province
   China
   email: jintao.zhu@huawei.com

11.  Changelog

   draft-ietf-core-dynlink-12

   o  Attributes epmin and epmax included

   o  pmax now can be equal to pmin

   draft-ietf-core-dynlink-11

   o  Updates to author list

   draft-ietf-core-dynlink-10

   o  Binding methods now support both POST and PUT operations for
      server push.

   draft-ietf-core-dynlink-09

   o  Corrections in Table 1, Table 2, Figure 2.

   o  Clarifications for additional operations to binding table added in
      section 5




Koster & Silverajan       Expires July 16, 2021                [Page 17]


Internet-Draft      Dynamic Resource Linking for CoRE       January 2021


   o  Additional examples in Appendix A

   draft-ietf-core-dynlink-08

   o  Reorganize the draft to introduce Conditional Notification
      Attributes at the beginning

   o  Made pmin and pmax type xs:decimal to accommodate fractional
      second timing

   o  updated the attribute descriptions. lt and gt notify on all
      crossings, both directions

   o  updated Binding Table description, removed interface description
      but introduced core.bnd rt attribute value

   draft-ietf-core-dynlink-07

   o  Added reference code to illustrate attribute interactions for
      observations

   draft-ietf-core-dynlink-06

   o  Document restructure and refactoring into three main sections

   o  Clarifications on band usage

   o  Implementation considerations introduced

   o  Additional text on security considerations

   draft-ietf-core-dynlink-05

   o  Addition of a band modifier for gt and lt, adapted from draft-
      groves-core-obsattr

   o  Removed statement prescribing gt MUST be greater than lt

   draft-ietf-core-dynlink-03

   o  General: Reverted to using "gt" and "lt" from "gth" and "lth" for
      this draft owing to concerns raised that the attributes are
      already used in LwM2M with the original names "gt" and "lt".

   o  New author and editor added.

   draft-ietf-core-dynlink-02




Koster & Silverajan       Expires July 16, 2021                [Page 18]


Internet-Draft      Dynamic Resource Linking for CoRE       January 2021


   o  General: Changed the name of the greater than attribute "gt" to
      "gth" and the name of the less than attribute "lt" to "lth" due to
      conlict with the core resource directory draft lifetime "lt"
      attribute.

   o  Clause 6.1: Addressed the editor's note by changing the link
      target attribute to "core.binding".

   o  Added Appendix A for examples.

   draft-ietf-core-dynlink-01

   o  General: The term state synchronization has been introduced to
      describe the process of synchronization between destination and
      source resources.

   o  General: The document has been restructured the make the
      information flow better.

   o  Clause 3.1: The descriptions of the binding attributes have been
      updated to clarify their usage.

   o  Clause 3.1: A new clause has been added to discuss the
      interactions between the resources.

   o  Clause 3.4: Has been simplified to refer to the descriptions in
      3.1.  As the text was largely duplicated.

   o  Clause 4.1: Added a clarification that individual resources may be
      removed from the binding table.

   o  Clause 6: Formailised the IANA considerations.

   draft-ietf-core-dynlink Initial Version 00:

   o  This is a copy of draft-groves-core-dynlink-00

   draft-groves-core-dynlink Draft Initial Version 00:

   o  This initial version is based on the text regarding the dynamic
      linking functionality in I.D.ietf-core-interfaces-05.

   o  The WADL description has been dropped in favour of a thorough
      textual description of the REST API.







Koster & Silverajan       Expires July 16, 2021                [Page 19]


Internet-Draft      Dynamic Resource Linking for CoRE       January 2021


12.  References

12.1.  Normative References

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119,
              DOI 10.17487/RFC2119, March 1997,
              <https://www.rfc-editor.org/info/rfc2119>.

   [RFC6690]  Shelby, Z., "Constrained RESTful Environments (CoRE) Link
              Format", RFC 6690, DOI 10.17487/RFC6690, August 2012,
              <https://www.rfc-editor.org/info/rfc6690>.

   [RFC8174]  Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC
              2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,
              May 2017, <https://www.rfc-editor.org/info/rfc8174>.

   [RFC8288]  Nottingham, M., "Web Linking", RFC 8288,
              DOI 10.17487/RFC8288, October 2017,
              <https://www.rfc-editor.org/info/rfc8288>.

12.2.  Informative References

   [I-D.irtf-t2trg-rest-iot]
              Keranen, A., Kovatsch, M., and K. Hartke, "RESTful Design
              for Internet of Things Systems", draft-irtf-t2trg-rest-
              iot-06 (work in progress), May 2020.

   [RFC7252]  Shelby, Z., Hartke, K., and C. Bormann, "The Constrained
              Application Protocol (CoAP)", RFC 7252,
              DOI 10.17487/RFC7252, June 2014,
              <https://www.rfc-editor.org/info/rfc7252>.

   [RFC7641]  Hartke, K., "Observing Resources in the Constrained
              Application Protocol (CoAP)", RFC 7641,
              DOI 10.17487/RFC7641, September 2015,
              <https://www.rfc-editor.org/info/rfc7641>.

   [RFC8132]  van der Stok, P., Bormann, C., and A. Sehgal, "PATCH and
              FETCH Methods for the Constrained Application Protocol
              (CoAP)", RFC 8132, DOI 10.17487/RFC8132, April 2017,
              <https://www.rfc-editor.org/info/rfc8132>.

Appendix A.  Examples

   This appendix provides some examples of the use of binding attribute
   / observe attributes.




Koster & Silverajan       Expires July 16, 2021                [Page 20]


Internet-Draft      Dynamic Resource Linking for CoRE       January 2021


   Note: For brevity the only the method or response code is shown in
   the header field.

A.1.  Minimum Period (pmin) example

           Observed   CLIENT  SERVER     Actual
       t   State         |      |         State
           ____________  |      |  ____________
       1                 |      |
       2    unknown      |      |     18.5 Cel
       3                 +----->|                  Header: GET
       4                 | GET  |                   Token: 0x4a
       5                 |      |                Uri-Path: temperature
       6                 |      |               Uri-Query: pmin="10"
       7                 |      |                 Observe: 0 (register)
       8                 |      |
       9   ____________  |<-----+                  Header: 2.05
      10                 | 2.05 |                   Token: 0x4a
      11    18.5 Cel     |      |                 Observe: 9
      12                 |      |                 Payload: "18.5 Cel"
      13                 |      |  ____________
      14                 |      |
      15                 |      |     23 Cel
      16                 |      |
      17                 |      |
      18                 |      |
      19                 |      |  ____________
      20   ____________  |<-----+                  Header: 2.05
      21                 | 2.05 |     26 Cel        Token: 0x4a
      22    26 Cel       |      |                 Observe: 20
      23                 |      |                 Payload: "26 Cel"
      24                 |      |
      25                 |      |

      Figure 3: Client registers and receives one notification of the
    current state and one of a new state state when pmin time expires.

A.2.  Maximum Period (pmax) example

           Observed   CLIENT  SERVER     Actual
       t   State         |      |         State
           ____________  |      |  ____________
       1                 |      |
       2    unknown      |      |     18.5 Cel
       3                 +----->|                  Header: GET
       4                 | GET  |                   Token: 0x4a
       5                 |      |                Uri-Path: temperature
       6                 |      |               Uri-Query: pmax="20"



Koster & Silverajan       Expires July 16, 2021                [Page 21]


Internet-Draft      Dynamic Resource Linking for CoRE       January 2021


       7                 |      |                 Observe: 0 (register)
       8                 |      |
       9   ____________  |<-----+                  Header: 2.05
      10                 | 2.05 |                   Token: 0x4a
      11    18.5 Cel     |      |                 Observe: 9
      12                 |      |                 Payload: "18.5 Cel"
      13                 |      |
      14                 |      |
      15                 |      |  ____________
      16   ____________  |<-----+                  Header: 2.05
      17                 | 2.05 |     23 Cel        Token: 0x4a
      18    23 Cel       |      |                 Observe: 16
      19                 |      |                 Payload: "23 Cel"
      20                 |      |
      21                 |      |
      22                 |      |
      23                 |      |
      24                 |      |
      25                 |      |
      26                 |      |
      27                 |      |
      28                 |      |
      29                 |      |
      30                 |      |
      31                 |      |
      32                 |      |
      33                 |      |
      34                 |      |
      35                 |      |
      36                 |      |  ____________
      37   ____________  |<-----+                  Header: 2.05
      38                 | 2.05 |     23 Cel        Token: 0x4a
      39    23 Cel       |      |                 Observe: 37
      40                 |      |                 Payload: "23 Cel"
      41                 |      |
      42                 |      |

      Figure 4: Client registers and receives one notification of the
   current state, one of a new state and one of an unchanged state when
                            pmax time expires.

A.3.  Greater Than (gt) example









Koster & Silverajan       Expires July 16, 2021                [Page 22]


Internet-Draft      Dynamic Resource Linking for CoRE       January 2021


        Observed   CLIENT  SERVER     Actual
    t   State         |      |         State
        ____________  |      |  ____________
    1                 |      |
    2    unknown      |      |     18.5 Cel
    3                 +----->|                  Header: GET
    4                 | GET  |                   Token: 0x4a
    5                 |      |                Uri-Path: temperature
    6                 |      |               Uri-Query: gt=25
    7                 |      |                 Observe: 0 (register)
    8                 |      |
    9   ____________  |<-----+                  Header: 2.05
   10                 | 2.05 |                   Token: 0x4a
   11    18.5 Cel     |      |                 Observe: 9
   12                 |      |                 Payload: "18.5 Cel"
   13                 |      |
   14                 |      |
   15                 |      |  ____________
   16   ____________  |<-----+                  Header: 2.05
   17                 | 2.05 |     26 Cel        Token: 0x4a
   18    26 Cel       |      |                 Observe: 16
   29                 |      |                 Payload: "26 Cel"
   20                 |      |
   21                 |      |

      Figure 5: Client registers and receives one notification of the
      current state and one of a new state when it passes through the
                       greater than threshold of 25.

A.4.  Greater Than (gt) and Period Max (pmax) example

        Observed   CLIENT  SERVER     Actual
    t   State         |      |         State
        ____________  |      |  ____________
    1                 |      |
    2    unknown      |      |     18.5 Cel
    3                 +----->|                  Header: GET
    4                 | GET  |                   Token: 0x4a
    5                 |      |                Uri-Path: temperature
    6                 |      |         Uri-Query: pmax=20;gt=25
    7                 |      |                 Observe: 0 (register)
    8                 |      |
    9   ____________  |<-----+                  Header: 2.05
   10                 | 2.05 |                   Token: 0x4a
   11    18.5 Cel     |      |                 Observe: 9
   12                 |      |                 Payload: "18.5 Cel"
   13                 |      |
   14                 |      |



Koster & Silverajan       Expires July 16, 2021                [Page 23]


Internet-Draft      Dynamic Resource Linking for CoRE       January 2021


   15                 |      |
   16                 |      |
   17                 |      |
   18                 |      |
   19                 |      |
   20                 |      |
   21                 |      |
   22                 |      |
   23                 |      |
   24                 |      |
   25                 |      |
   26                 |      |
   27                 |      |
   28                 |      |
   29                 |      |  ____________
   30   ____________  |<-----+                  Header: 2.05
   31                 | 2.05 |     23 Cel        Token: 0x4a
   32    23 Cel       |      |                 Observe: 30
   33                 |      |                 Payload: "23 Cel"
   34                 |      |
   35                 |      |
   36                 |      |  ____________
   37   ____________  |<-----+                  Header: 2.05
   38                 | 2.05 |     26 Cel        Token: 0x4a
   39    26 Cel       |      |                 Observe: 37
   40                 |      |                 Payload: "26 Cel"
   41                 |      |
   42                 |      |

      Figure 6: Client registers and receives one notification of the
   current state, one when pmax time expires and one of a new state when
            it passes through the greater than threshold of 25.

Authors' Addresses

   Michael Koster
   SmartThings
   665 Clyde Avenue
   Mountain View  94043
   USA

   Email: michael.koster@smartthings.com









Koster & Silverajan       Expires July 16, 2021                [Page 24]


Internet-Draft      Dynamic Resource Linking for CoRE       January 2021


   Bilhanan Silverajan (editor)
   Tampere University
   Kalevantie 4
   Tampere  FI-33100
   Finland

   Email: bilhanan.silverajan@tuni.fi












































Koster & Silverajan       Expires July 16, 2021                [Page 25]