CoRE Working Group Z. Shelby Internet-Draft ARM Intended status: Informational M. Koster Expires:April 25,September 9, 2019 SmartThings C. Groves J. Zhu Huawei B. Silverajan, Ed. Tampere Universityof Technology October 22, 2018March 08, 2019 Dynamic Resource Linking for Constrained RESTful Environmentsdraft-ietf-core-dynlink-07draft-ietf-core-dynlink-08 AbstractFor CoAP (RFC7252), DynamicThis specification defines Link Bindings, which provide dynamic linking of state updates between resources, either on an endpoint or between endpoints,is defined with the concept of Link Bindings.for systems using CoAP (RFC7252). This specification also definesconditional observation attributesConditional Notification 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 onApril 25,September 9, 2019. Copyright Notice Copyright (c)20182019 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 (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.Link Bindings .Conditional Notification Attributes . . . . . . . . . . . . . 4 3.1. Attribute Definitions . . . . . . . . . .4 3.1. The "bind" attribute and Binding Methods. . . . . . . . 4 3.1.1.Polling . .Minimum Period (pmin) . . . . . . . . . . . . . . . . 5 3.1.2. Maximum Period (pmax) . . . . .5 3.1.2. Observe. . . . . . . . . . . 5 3.1.3. Change Step (st) . . . . . . . . . . . .5 3.1.3. Push. . . . . . 5 3.1.4. Greater Than (gt) . . . . . . . . . . . . . . . . . . 63.2. Link Relation . . .3.1.5. Less Than (lt) . . . . . . . . . . . . . . . . . . . 64. Binding and Resource Observation Attributes .3.1.6. Notification Band (band) . . . . . . . .6 4.1. Minimum Period (pmin). . . . . . 7 3.2. Server processing of Conditional Notification Attributes 8 4. Link Bindings . . . . . . . . . . . .7 4.2. Maximum Period (pmax). . . . . . . . . . . . 8 4.1. The "bind" attribute and Binding Methods . . . . . .7 4.3. Change Step (st). . 9 4.1.1. Polling . . . . . . . . . . . . . . . . . .7 4.4. Greater Than (gt). . . . . 10 4.1.2. Observe . . . . . . . . . . . . . . .8 4.5. Less Than (lt). . . . . . . . 10 4.1.3. Push . . . . . . . . . . . . .8 4.6. Notification Band (band). . . . . . . . . . . 11 4.2. Link Relation . . . . .8 4.7. Attribute Interactions. . . . . . . . . . . . . . . . .911 5. Binding Table . . . . . . . . . . . . . . . . . . . . . . . .1011 6. Implementation Considerations . . . . . . . . . . . . . . . .1112 7. Security Considerations . . . . . . . . . . . . . . . . . . .1213 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . .1213 8.1.Interface Description . . . . .Resource Type value 'core.bnd' . . . . . . . . . . . . .1213 8.2. Link Relation Type . . . . . . . . . . . . . . . . . . . 13 9. Acknowledgements . . . . . . . . . . . . . . . . . . . . . .1314 10. Contributors . . . . . . . . . . . . . . . . . . . . . . . .1314 11. Changelog . . . . . . . . . . . . . . . . . . . . . . . . . .1314 12. References . . . . . . . . . . . . . . . . . . . . . . . . .1516 12.1. Normative References . . . . . . . . . . . . . . . . . .1516 12.2. Informative References . . . . . . . . . . . . . . . . .1617 Appendix A. Examples . . . . . . . . . . . . . . . . . . . . . .1617 A.1. Greater Than (gt) example . . . . . . . . . . . . . . . .1617 A.2. Greater Than (gt) and Period Max (pmax) example . . . . .1718 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . .1819 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 definesa set of conditional ObserveConditional Notification Attributes for use with Link Bindings and with thestandaloneCoRE Observe [RFC7641] method. 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. 3. Conditional Notification Attributes 3.1. Attribute Definitions This specification defines Conditional Notification Attributes, which provide for fine-grained control of notification and state synchronization when using CoRE Observe [RFC7641] or Link BindingsIn a M2M RESTful environment, endpoints may directly exchange the content of their resources to operate(see Section 4). Conditional Notification Attributes define thedistributed system. For example, a light switch may supply on-off control informationconditions thatmay be sent directly totrigger alightnotification. When resourcefor on-off control. 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. Ininterfaces following this specificationsuch 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 withare made available over CoAP, therulesCoAP Observation mechanism [RFC7641] MAY also be used todefineobserve any changes in abinding method which isresource, and receive asynchronous notifications as aspecialized relationship between two resources.result. A resource marked as Observable in its link description SHOULD support these Conditional Notification Attributes. Thepurposeset ofsuchparameters defined here allow abinding isclient tosynchronize the content betweencontrol how often asource resourceclient is interested in receiving notifications and how much adestination resource. The destination resource MAY be a groupresourceif the authority component ofvalue should change for thedestination URI contains a group address (either a multicast address or a name that resolvesnew representation toa multicast address). Since a binding is unidirectional, the binding entry defining a relationship is present only on one endpoint. The binding entry maybelocated either on the sourceinteresting. One orthe destination endpoint depending on the binding method. 3.1. The "bind" attribute and Binding Methods A binding method defines the rules to generate the web-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. In order to use binding methods, this specification defines a special CoRE link attribute "bind". This is the identifier of a binding method which defines the rules to synchronize the destination resource. This attribute is mandatory. +----------------+-----------+------------+more Notification Attributes MAY be included as query parameters in an Observe request. These attributes are defined below: +--------------------+-----------+------------------+ | Attribute | Parameter | Value |+----------------+-----------+------------++--------------------+-----------+------------------+ |Binding methodMinimum Period (s) |bindpmin |xsd:stringxsd:decimal (>0) |+----------------+-----------+------------+ Table 1: The bind attribute The following table gives a summary of the binding methods defined in this specification. +---------+------------+-------------+---------------+|Name|Identifier|Location|Method|+---------+------------+-------------+---------------+Maximum Period (s) |Pollingpmax |pollxsd:decimal (>0) |Destination|GET| | | | Change Step | st | xsd:decimal (>0) |Observe|obs|Destination|GET + Observe| | Greater Than | gt | xsd:decimal | | |Push|push|Source|PUTLess Than |+---------+------------+-------------+---------------+lt | xsd:decimal | | | | | | Notification Band | band | xsd:boolean | +--------------------+-----------+------------------+ Table2: Binding Method Summary The description of1: Conditional Notification Attributes Conditional Notification Attributes SHOULD be evaluated on all potential notifications from abinding method must defineresource, whether resulting from an internal server-driven sampling process or from external update requests to thefollowing aspects: Identifier: This isserver. 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"bind" attribute used to identify the method. Location: This information indicates whetherdescription of thebinding entry is stored on the source or on the destination endpoint. REST Method: This isConditional Notification Attributes and instead use theREST method used inphrase "sampled value" to refer to a member of a sequence of values that may be internally observed from theRequest/Response exchanges. Conditions: A binding method definition mustresource statehowover time. 3.1.1. Minimum Period (pmin) When present, thecondition attributes ofminimum period indicates theabstract binding definition are actually used in this specialized binding. The binding methods are describedminimum time, inmore detail below. 3.1.1. Polling The Polling method consists of sending periodic GET requests from the destination endpoint toseconds, between two consecutive notifications (whether or not thesourceresourceand copyingvalue has changed). In thecontentabsence of this parameter, the minimum period is up to thedestination resource.server. Thebinding entry for this methodminimum period MUST bestored ongreater than zero otherwise thedestination endpoint. The destination endpointreceiver MUSTensurereturn a CoAP error code 4.00 "Bad Request" (or equivalent). A server MAY report the last sampled value that occured during thepolling frequency does not exceedpmin interval, after thelimits defined bypmin interval expires. Note: Due to finite quantization effects, the time between notifications may be greater than pminand pmax attributes ofeven when thebinding entry. The copying process MAY filter out content fromsampled value changes within theGET requests using value- based conditions (e.g based onpmin interval. Pmin may or may not be used to drive theChange Step, Less Than, Greater Than attributes).internal sampling process. 3.1.2.Observe The Observe method creates an observation relationship between the destination endpoint andMaximum Period (pmax) When present, thesource resource. On each notificationmaximum period indicates thecontent frommaximum time, in seconds, between two consecutive notifications (whether or not thesourceresourceis copied to the destination resource. The creation of the observation relationship requiresvalue has changed). In theCoAP Observation mechanism [RFC7641] henceabsence of thismethodparameter, the maximum period isonly permitted whenup to theresources are made available over CoAP.server. Thebinding entry for this methodmaximum period MUST bestored on the destination endpoint. The binding conditions are mapped as query string parameters (see Section 4). 3.1.3. Push When the Push method is assigned to a binding, the source endpoint sends PUT requests to the destination resource whengreater than zero and MUST be greater than thebinding condition attributes are satisfied forminimum period parameter (if present) otherwise thesource resource. The source endpointreceiver MUSTonly sendreturn anotification request if the binding conditions are met. The binding entry for this method MUST be stored onCoAP error code 4.00 "Bad Request" (or equivalent). 3.1.3. Change Step (st) When present, thesource endpoint. 3.2. Link Relation Since Binding involveschange step indicates how much thecreationvalue of alink between two resources, Web Linking and the CoRE Link-Format areresource SHOULD change before triggering anatural waynotification, compared torepresent binding information. This involvesthecreationvalue of the previous notification. Upon reception of anew relation type, named "boundto". In a Web link with this relation type,query including thetarget URI containsst attribute, thelocationmost recently sampled value of thesourceresource is reported, and then set as thecontext URI points to the destination resource. 4. Binding and Resource Observation Attributes In addition to "bind", this specification further defines Web link attributes allowinglast reported value (last_rep_v). When afine-grained controlsubsequent sample or update of thetype of state synchronization along withresource value differs from theconditions that triggerlast reported value by anupdate. When resource interfaces following this specification are made available over CoAP, the CoAP Observation mechanism [RFC7641] MAY also be usedamount, positive or negative, greater than or equal toobserve any changes in a resource, and receive asynchronous notifications as a result. A resource using an interface description defined in this specificationst, andmarked as Observable in its link description SHOULD support these observation parameters. In addition,theset of parameters are defined here allow a client to control how oftentime for pmin has elapsed since the last notification, aclientnotification isinterested in receiving notificationssent andhow much a resource value should change forthenew representationlast reported value is updated to the value sent in the notification. The change step MUST beinteresting, as query parameters. These query parametersgreater than zero otherwise the receiver MUST return a CoAP error code 4.00 "Bad Request" (or equivalent). The Change Step parameter can only betreated assupported on resourcesthat are read using GET and updated using PUT,with a scalar numeric value. Note: Due to sampling andMUST NOT be includedother 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 theObserve request. Multiple parameters MAY be updated atupper 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 thesametimeby includingfpr pmin has elapsed since thevalueslast notification. The sampled value is sent in thequery string of a PUT. Before being updated, these parameters havenotification. If the value continues to rise, nodefault value. These attributesnotifications aredefined below: +--------------------+-----------+------------------+ | Attribute | Parameter | Value | +--------------------+-----------+------------------+ | Minimum Period (s) | pmin | xsd:integer (>0) | | | | | | Maximum Period (s) | pmax | xsd:integer (>0) | | | | | | Change Step | st | xsd:decimal (>0) | | | | | |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| gt | xsd:decimal | | | | | |parameter can only be supported on resources with a scalar numeric value. 3.1.5. Less Than| lt | xsd:decimal | | | | | | Notification Band | band | xsd:boolean | +--------------------+-----------+------------------+ Table 3: Binding Attributes Summary 4.1. Minimum Period (pmin)(lt) When present,the minimum periodLess Than indicates theminimum time to wait (in seconds)lower limit value the resource value SHOULD cross before triggering anew state synchronization (even if it has changed). In the absence of this parameter, the minimum periodnotification. A notification isup tosent when thesynchronization initiator. The minimum period MUST be greater than zero otherwisesamples value crosses thereceiver MUST return a CoAP error code 4.00 "Bad Request" (or equivalent). 4.2. Maximum Period (pmax) When present,specified lower limit value, relative to themaximum period indicateslast reported value, and themaximumtimein seconds between two consecutive state synchronizations (regardless if itfpr pmin haschanged). Inelapsed since theabsencelast notification. The sampled value is sent in the notification. If the value continues to fall no notifications are generated as a result ofthis parameter,lt. If themaximum periodvalue rises above the lower limit value then a new notification isupsent, subject to thesynchronization initiator.pmin time.. Themaximum period MUST be greater than zero and MUSTLess Than parameter can only begreater than thesupported 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 minimumperiod parameter (if present) otherwiseor maximum) value range that may trigger multiple notifications. This enables use cases where different ranges results in differing behaviour. For example: monitoring thereceiver MUST return a CoAP error code 4.00 "Bad Request" (or equivalent). 4.3. Change Step (st) When present,temperature of machinery. Whilst thechange step indicates how muchtemperature is in thevalue ofnormal operating range only periodic observations are needed. However as the temperature moves to more abnormal ranges more frequent synchronization/reporting may be needed. Without aresource SHOULD change before triggeringnotification band, anew state synchronization (comparedtransition across a less than (lt), or greater than (gt) limit only generates one notification. This means that it is not possible tothe value of the previous synchronization). Upon reception ofdescribe aquery includingcase where multiple notifications are sent so long as thestlimit is exceeded. The band attribute works as a modifier to thecurrent value (CurrVal)behaviour ofthe resourcegt and lt. Therefore, if band isset aspresent in a query, gt, lt or both, MUST be included. When band is present with theinitial value (STinit). Oncelt attribute, it defines theresource value differs fromlower bound for the notification band (notification band minimum). Notifications occur when theSTinitresource value(i.e. CurrVal >= STinit + ST or CurrVal <= STint - ST) then a new state synchronization occurs. STinitisthen setequal to or above thestate synchronizationnotification band minimum. If lt is not present there is no minimum valueand new state synchronizations are based on a change step against this value. The change step MUST be greater than zero otherwisefor thereceiver MUST return a CoAP error code 4.00 "Bad Request" (or equivalent). The Change Step parameter can only be supported on resourcesband. When band is present withan atomic numeric value. Note: Due tothestate synchronization based update of STintgt attribute, itmay result in that resource value received in two sequential state synchronizations differs by more than st. 4.4. Greater Than (gt) When present, Greater Than indicatesdefines the upperlimit valuebound for theresource value SHOULD cross before triggering a new state synchronization. State synchronization only occursnotification band (notification band maximum). Notifications occur when the resource valueexceeds the specified upper limit value. The actual resource valueisused for the synchronization rather than the gt value. If the value continuesequal torise, no new state synchronizations are generated as a result of gt. If the value dropsor below theupper limitnotification band maximum. If gt is not present there is no maximum valueand then exceedsfor theupper limit then a new state synchronizationband. If band isgenerated. 4.5. Less Than (lt) When present, Less Than indicates the lower limit valuepresent with both theresource value SHOULD cross before triggering a new state synchronization. State synchronization onlygt and lt attributes, notification occurs when the resource value islessgreater than or equal to gt or when thespecified lower limit value. The actualresource value isused for the synchronization ratherless thanthe lt value.or equal to lt. If a band is specified in which the valuecontinues to fall no new state synchronizations are generated as a resultoflt. Ifgt is less than that of lt, in-band notification occurs. That is, notification occurs whenever the resource valuerises aboveis between thelower limit valuegt andthen drops belowlt values, including equal to gt or lt. If thelower limit then a new state synchronization is generated. 4.6. Notification Band (band) The notificationbandattribute allows a bounded or unbounded (based on a minimum or maximum) value range that may trigger multiple state synchronizations. This enables use cases where different ranges resultsis specified indiffering behaviour. For example: monitoringwhich thetemperaturevalue ofmachinery. Whilst the temperaturegt isin 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), orgreater than(gt) limit only generates one notification. This meansthatit isof lt, out-of-band notification occurs. That is, notification occurs when the resource value notpossible to describe a case where multiple notifications are sent so long asbetween thelimit is exceeded. The band attribute works as a modifiergt and lt values, excluding equal tothe behaviour ofgt and lt.Therefore, if band is present inThe Notification Band parameter can only be supported on resources with aquery,scalar numeric value. 3.2. Server processing of Conditional Notification Attributes Pmin, pmax, st, gt, ltor both, MUST be included. Whenand bandismay be presentwithin thelt attribute, it definessame query. Howver, they are not defined at multiple prioritization levels. The server sends a notification whenever any of thelower boundparameter conditions are met, upon which it updates its last notification value and time to prepare for the next notification. Only one notificationband (notification band minimum). State synchronizationoccurs whenthe 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). State synchronization occurs 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. If band is present with both the gt and lt attributes, two kinds of signaling bands are specified. If a band is specified in which the value of gt is less than that of lt, in-band signaling occurs. State synchronization occurs whenever the resource value is between the notification band minimum and maximum or is equal to the notification band minimum or maximum. On the other hand if the band is specified in which the value of gt is greater than that of lt, out-of-band signaling occurs. State synchronization occurs whenever the resource value is outside the notification band minimum and maximum or is equal to the notification band minimum or maximum. 4.7. Attribute Interactions Pmin, pmax, st, gt and lt may be present in the same query. Parameters are not defined at multiple prioritization levels. Instead, the server state machine generates a notification whenever any of the parameter conditions are met, after which it performs a reset on all the requested conditions. State synchronization also occurs only once even if there are multiple conditions being met atthere are multiple conditions being met at the same time. The reference code below illustrateshow notifications are generated.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 interactionsfor observe notification 5. Binding Table4. 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. 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 | xsd:string | +----------------+-----------+------------+ Table 2: The bind attribute The following table gives a summary of the binding methods defined in this specification. +---------+------------+-------------+---------------+ | Name | Identifier | Location | Method | +---------+------------+-------------+---------------+ | Polling | poll | Destination | GET | | | | | | | Observe | obs | Destination | GET + Observe | | | | | | | Push | push | Source | PUT | +---------+------------+-------------+---------------+ Table 3: 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 TheBinding table is a specialObserve method creates an observation relationship between the destination endpoint and the source resource. On each notification the content from the source resourcethat gives accessis copied to thebindingsdestination resource. The creation of the observation relationship requires the 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 onathe destination endpoint.This section definesThe binding conditions are mapped as query parameters in the Observe request (see Section 3). 4.1.3. Push When the Push method is assigned to aREST interfacebinding, the source endpoint sends PUT requests to the destination resource when the Conditional Notification Attributes are satisfied forBinding table resources.the source resource. TheBinding table resourcesource endpoint SHOULD only send a notification request if any included Conditional Notification Attributes are met. The binding entry for this method MUSTsupportbe stored on the source endpoint. 4.2. Link Relation Since Bindinginterface defined below. The interface supportsinvolves thelink- format type. The if= column definescreation of a link between two resources, Web Linking and theInterface Description (if=) attribute value to beCoRE Link-Format usedinto represent binding information. This involves theCoRE Link Format forcreation of a new relation type, "boundto". In a Web link with this relation type, the target URI contains the location of the source resourceconformingand the context URI points to the destination resource. 5. Binding Table The Binding Table is a special resource thatinterface. When this value appears indescribes theif= attribute ofbindings on an endpoint. An endpoint offering alink,representation of the Binding Table resourceMUST supportSHOULD indicate its presence and enable its discovery by advertising a link at "/.well-known/core" [RFC6690]. If so, thecorresponding REST interface described in this section. TheBinding Table resourceMAY support additional functionality, which is out of scope for this specification. Although this interface description is intended toMUST beused withdiscoverable by using theCoRE Link Format, it is applicable for use in any REST interface definition.Resource Type (rt) 'core.bnd'. The Methods column defines the REST methods supported by theinterface,Binding Table, which are described in more detail below.+-----------+----------+-------------------+-----------------++---------------+----------+----------+----------------+ |InterfaceResource |if=rt= | Methods |Content-FormatsContent-Format |+-----------+----------+-------------------+-----------------++---------------+----------+----------+----------------+ | Binding Table | core.bnd | GET,POST, DELETEPUT | link-format |+-----------+----------+-------------------+-----------------++---------------+----------+----------+----------------+ Table 4: BindingInterfaceTable Description TheBinding interface isREST methods GET and PUT are used to manipulate abinding table.Binding Table. A GET request simply returns the current state of a Binding Table. A request with aPOSTPUT method and a content format of application/link- formatsimply appends newis used to clear the bindings to thetable.table or replaces its entire contents. All links in the payload of a PUT rquest MUST have a relation type "boundto".A GET request simply returns the current state(Editor's Note: Usage ofa binding table whereas a DELETE request emptiesthetable. Individual entries may be deleted from the table by specifying the resource path in a DELETE request.PATCH method for fine-grained addition and removal of individual bindings is under study.) The following example shows requests foradding,discovering, retrieving anddeletingreplacing bindings in a binding table. Req:POSTGET /.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;bind=obs;anchor=/a/fan,;bind="obs", <coap://sensor.example.com/a/switch2/>; rel=boundto;bind=obs;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"Req: DELETE /bnd/a/light Res: 2.04 Changed Req: DELETE /bnd/ Res: 2.04 ChangedFigure 2: BindingInterfaceTable Example 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 for the 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. The initiation of alink bindingLink 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 tolink bindings,Link Bindings, as well as any errors that may arise with establishinglink bindings as well as withLink Bindings in addition to establishedlink bindings.Link Bindings. 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 creatinglink bindingsLink Bindings and handling error conditions can be processed by the state machine. 8. IANA Considerations 8.1.Interface Description TheResource Type value 'core.bnd' This specification registers a new Resource Type Link Target Attribute 'core.bnd' in the"binding" CoRE interface description link target attribute valueResource Type (rt=) registry established as per [RFC6690]. Attribute Value: core.bnd Description:The binding interfaceSee Section 5. This attribute value is used tomanipulatediscover the resource representing a bindingtabletable, 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 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. 10. Contributors Matthieu Vial Schneider-Electric Grenoble France Phone: +33 (0)47657 6522 EMail: matthieu.vial@schneider-electric.com 11. Changelog draft-ietf-core-dynlink-08 o Reorganize the draft to introduce Conditional Notification Attributes at the beginning o Made pmin and pmax type xsd: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 observationsdraft-ietf-core-dynlink-06o 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 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. 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 [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>. Appendix A. Examples This appendix provides some examples of the use of binding attribute / observe attributes. Note: For brevity the only the method or response code is shown in the header field. A.1. Greater Than (gt) 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: 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 3: Client Registers and Receives one Notification of the Current State and One of a New State when it passes through the greather than threshold of 25. A.2. 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 | | 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 4: 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 greather than threshold of 25. Authors' Addresses Zach Shelby ARM Kidekuja 2 Vuokatti 88600 FINLAND Phone: +358407796297 Email: zach.shelby@arm.com Michael Koster SmartThings 665 Clyde Avenue Mountain View 94043 USA Email: michael.koster@smartthings.com Christian Groves Australia Email: cngroves.std@gmail.com Jintao Zhu Huawei No.127 Jinye Road, Huawei Base, High-Tech Development District Xi'an, Shaanxi Province China Email: jintao.zhu@huawei.com Bilhanan Silverajan (editor) Tampere Universityof Technology Korkeakoulunkatu 10Kalevantie 4 TampereFI-33720FI-33100 Finland Email:bilhanan.silverajan@tut.fibilhanan.silverajan@tuni.fi