draft-ietf-core-senml-etch-05.txt   draft-ietf-core-senml-etch-06.txt 
Network Working Group A. Keranen Network Working Group A. Keranen
Internet-Draft Ericsson Internet-Draft Ericsson
Intended status: Standards Track M. Mohajer Intended status: Standards Track M. Mohajer
Expires: February 18, 2020 u-blox UK Expires: June 29, 2020 u-blox UK
August 17, 2019 December 27, 2019
FETCH & PATCH with Sensor Measurement Lists (SenML) FETCH & PATCH with Sensor Measurement Lists (SenML)
draft-ietf-core-senml-etch-05 draft-ietf-core-senml-etch-06
Abstract Abstract
The Sensor Measurement Lists (SenML) media type and data model can be The Sensor Measurement Lists (SenML) media type and data model can be
used to send collections of resources, such as batches of sensor data used to send collections of resources, such as batches of sensor data
or configuration parameters. The CoAP iPATCH, PATCH, and FETCH or configuration parameters. The CoAP FETCH, PATCH, and iPATCH
methods enable accessing and updating parts of a resource or multiple methods enable accessing and updating parts of a resource or multiple
resources with one request. This document defines new media types resources with one request. This document defines new media types
for the CoAP iPATCH, PATCH, and FETCH methods for resources for the CoAP FETCH, PATCH, and iPATCH methods for resources
represented with the SenML data model. represented with the SenML data model.
Status of This Memo Status of This Memo
This Internet-Draft is submitted in full conformance with the This Internet-Draft is submitted in full conformance with the
provisions of BCP 78 and BCP 79. provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at https://datatracker.ietf.org/drafts/current/. Drafts is at https://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on February 18, 2020. This Internet-Draft will expire on June 29, 2020.
Copyright Notice Copyright Notice
Copyright (c) 2019 IETF Trust and the persons identified as the Copyright (c) 2019 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(https://trustee.ietf.org/license-info) in effect on the date of (https://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
skipping to change at page 2, line 14 skipping to change at page 2, line 14
include Simplified BSD License text as described in Section 4.e of include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License. described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2
2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 3 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 3
3. Using FETCH and (i)PATCH with SenML . . . . . . . . . . . . . 3 3. Using FETCH and (i)PATCH with SenML . . . . . . . . . . . . . 3
3.1. SenML FETCH . . . . . . . . . . . . . . . . . . . . . . . 4 3.1. SenML FETCH . . . . . . . . . . . . . . . . . . . . . . . 4
3.2. SenML (i)PATCH . . . . . . . . . . . . . . . . . . . . . 4 3.2. SenML (i)PATCH . . . . . . . . . . . . . . . . . . . . . 5
4. Fragment Identification . . . . . . . . . . . . . . . . . . . 5 4. Fragment Identification . . . . . . . . . . . . . . . . . . . 6
5. Security Considerations . . . . . . . . . . . . . . . . . . . 6 5. Security Considerations . . . . . . . . . . . . . . . . . . . 6
6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 6 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 7
6.1. CoAP Content-Format Registration . . . . . . . . . . . . 6 6.1. CoAP Content-Format Registration . . . . . . . . . . . . 7
6.2. senml-etch+json Media Type . . . . . . . . . . . . . . . 6 6.2. senml-etch+json Media Type . . . . . . . . . . . . . . . 7
6.3. senml-etch+cbor Media Type . . . . . . . . . . . . . . . 7 6.3. senml-etch+cbor Media Type . . . . . . . . . . . . . . . 8
7. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 9 7. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 9
8. References . . . . . . . . . . . . . . . . . . . . . . . . . 9 8. References . . . . . . . . . . . . . . . . . . . . . . . . . 9
8.1. Normative References . . . . . . . . . . . . . . . . . . 9 8.1. Normative References . . . . . . . . . . . . . . . . . . 10
8.2. Informative References . . . . . . . . . . . . . . . . . 10 8.2. Informative References . . . . . . . . . . . . . . . . . 10
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 10 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 10
1. Introduction 1. Introduction
The Sensor Measurement Lists (SenML) media type [RFC8428] and data The Sensor Measurement Lists (SenML) media type [RFC8428] and data
model can be used to transmit collections of resources, such as model can be used to transmit collections of resources, such as
batches of sensor data or configuration parameters. batches of sensor data or configuration parameters.
An example of a SenML collection is shown below: An example of a SenML collection is shown below:
skipping to change at page 2, line 47 skipping to change at page 2, line 47
{"n":"5851", "v":42}, {"n":"5851", "v":42},
{"n":"5750", "vs":"Ceiling light"} {"n":"5750", "vs":"Ceiling light"}
] ]
Here three resources "3311/0/5850", "3311/0/5851", and "3311/0/5750", Here three resources "3311/0/5850", "3311/0/5851", and "3311/0/5750",
of an IPSO dimmable light smart object [IPSO] are represented using a of an IPSO dimmable light smart object [IPSO] are represented using a
single SenML Pack with three SenML Records. All resources share the single SenML Pack with three SenML Records. All resources share the
same base name "2001:db8::2/3311/0/", hence full names for resources same base name "2001:db8::2/3311/0/", hence full names for resources
are "2001:db8::2/3311/0/5850", etc. are "2001:db8::2/3311/0/5850", etc.
The CoAP [RFC7252] iPATCH, PATCH, and FETCH methods [RFC8132] enable The CoAP [RFC7252] FETCH, PATCH, and iPATCH methods [RFC8132] enable
accessing and updating parts of a resource or multiple resources with accessing and updating parts of a resource or multiple resources with
one request. one request.
This document defines two new media types, one using the JavaScript This document defines two new media types, one using the JavaScript
Object Notation (JSON) [RFC8259] and one using the Concise Binary Object Notation (JSON) [RFC8259] and one using the Concise Binary
Object Representation (CBOR) [RFC7049], that can be used with the Object Representation (CBOR) [RFC7049], which can be used with the
CoAP iPATCH, PATCH, and FETCH methods for resources represented with CoAP FETCH, PATCH, and iPATCH methods for resources represented with
the SenML data model. The semantics of the new media types are the the SenML data model. The rest of the document uses term "(i)PATCH"
same for the CoAP PATCH and iPATCH methods. The rest of the document when referring to both methods as the semantics of the new media
uses term "(i)PATCH" when referring to both methods. types are the same for the CoAP PATCH and iPATCH methods.
2. Terminology 2. Terminology
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
"OPTIONAL" in this document are to be interpreted as described in BCP "OPTIONAL" in this document are to be interpreted as described in BCP
14 [RFC2119] [RFC8174] when, and only when, they appear in all 14 [RFC2119] [RFC8174] when, and only when, they appear in all
capitals, as shown here. capitals, as shown here.
Readers should also be familiar with the terms and concepts discussed Readers should also be familiar with the terms and concepts discussed
in [RFC8132] and [RFC8428]. Also the following terms are used in in [RFC8132] and [RFC8428]. The following additional terms are used
this document: in this document:
Fetch Record: One set of parameters that is used to match SenML Fetch Record: One set of parameters that is used to match SenML
Record(s). Record(s).
Fetch Pack: One or more Fetch Records in an array structure. Fetch Pack: One or more Fetch Records in an array structure.
Patch Record: One set of parameters similar to Fetch Record but also Patch Record: One set of parameters similar to Fetch Record but also
containing instructions on how to change existing SenML Pack(s). containing instructions on how to change existing SenML Pack(s).
Patch Pack: One or more Patch Records in an array structure. Patch Pack: One or more Patch Records in an array structure.
Target Record: A Record in a SenML Pack that is matching the Target Record: A Record in a SenML Pack that matches the selection
selection criteria of a Fetch or Patch Record and hence is a criteria of a Fetch or Patch Record and hence is a target for a
target for a Fetch or Patch operation. Fetch or Patch operation.
Target Pack: A SenML Pack that is a target for a Fetch or Patch
operation.
(i)PATCH: A term that refers to both CoAP "PATCH" and "iPATCH" (i)PATCH: A term that refers to both CoAP "PATCH" and "iPATCH"
methods when there is no difference in this specification in which methods when there is no difference in this specification in which
one is used. one is used.
3. Using FETCH and (i)PATCH with SenML 3. Using FETCH and (i)PATCH with SenML
The FETCH/(i)PATCH media types for SenML are modeled as extensions to The FETCH/(i)PATCH media types for SenML are modeled as extensions to
the SenML media type to enable re-use of existing SenML parsers and the SenML media type to enable re-use of existing SenML parsers and
generators, in particular on constrained devices. Unless mentioned generators, in particular on constrained devices. Unless mentioned
otherwise, FETCH and PATCH Packs are constructed with the same rules otherwise, FETCH and PATCH Packs are constructed with the same rules
and constraints as SenML Packs. and constraints as SenML Packs.
The key difference to the SenML media type is allowing the use of a The key differences to the SenML media type are allowing the use of a
"null" value for removing records with the (i)PATCH method. Also the "null" value for removing records with the (i)PATCH method and lack
Fetch and Patch Records do not have default time or base version when of value fields in Fetch Records. Also the Fetch and Patch Records
the fields are omitted. do not have default time or base version when the fields are omitted.
3.1. SenML FETCH 3.1. SenML FETCH
The FETCH method can be used to select and return a subset of The FETCH method can be used to select and return a subset of
records, in sequence, of one or more SenML Packs. The SenML Records records, in sequence, of one or more SenML Packs. The SenML Records
are selected by giving a set of names that, when resolved, match are selected by giving a set of names that, when resolved, match
resolved names in a SenML Pack. The names for a Fetch Pack are given resolved names in a Target SenML Pack. The names for a Fetch Pack
using the SenML "name" and/or "base name" Fields. The names are are given using the SenML "name" and/or "base name" fields. The
resolved by concatenating the base name with the name field as names are resolved by concatenating the base name with the name field
defined in [RFC8428]. as defined in [RFC8428].
A Fetch Pack MUST contain at least one Fetch Record. A Fetch Record
MUST contain a name and/or a base name field.
For example, to select the IPSO resources "5850" and "5851" from the For example, to select the IPSO resources "5850" and "5851" from the
example in Section 1, the following Fetch Pack can be used: example in Section 1, the following Fetch Pack can be used:
[ [
{"bn":"2001:db8::2/3311/0/", "n":"5850"}, {"bn":"2001:db8::2/3311/0/", "n":"5850"},
{"n":"5851"} {"n":"5851"}
] ]
The result to a FETCH request with the example above would be: The result to a FETCH request with the example above would be:
[ [
{"bn":"2001:db8::2/3311/0/", "n":"5850", "vb":true}, {"bn":"2001:db8::2/3311/0/", "n":"5850", "vb":true},
{"n":"5851", "v":42}, {"n":"5851", "v":42},
] ]
When SenML Records contain also time values, a name may no longer The SenML time and unit fields can be used in a Fetch Record to
uniquely identify a single Record. When no time is given in a Fetch further narrow the selection of matched SenML Records. When no time
Record, all SenML Records with the given name are matched (i.e., or unit is given in a Fetch Record, all SenML Records with the given
unlike with SenML Records, lack of time field in a Fetch Record does name are matched (i.e., unlike with SenML Records, lack of time field
not imply time value zero). When time is given in the Fetch Record, in a Fetch Record does not imply time value zero). When time is
only a SenML Record (if any) with equal resolved time value and name given in the Fetch Record, only the SenML Records (if any) with equal
is matched. resolved time value and name are matched. Similarly, when unit is
given, only the SenML Records with equal resolved unit and name are
matched. If both time and unit are given in the Fetch Record, both
MUST to match for the SenML Record to match.
For example, if the IPSO resource "5850" would have multiple sensor
readings (SenML Records) with different time values, the following
Fetch Pack can be used to retrieve the Record with time
"1.276020091e+09":
[
{"bn":"2001:db8::2/3311/0/", "n":"5850", "t":1.276020091e+09}
]
The resolved form of records (Section 4.6 of [RFC8428]) is used when The resolved form of records (Section 4.6 of [RFC8428]) is used when
comparing the names and times of the Target and Fetch Records to comparing the names, times, and units of the Target and Fetch Records
accommodate for differences in use of the base values. to accommodate for differences in use of the base values. In
resolved form the SenML name in the example above becomes
"2001:db8::2/3311/0/5850". Since there is no base time in the Pack,
the time in resolved form is equal to the time in the example.
If no SenML Records match, empty SenML Pack (i.e., array with no
elements) is returned as a response.
All other Fetch Record fields than name, base name, time, base time,
unit, and base unit MUST be ignored.
3.2. SenML (i)PATCH 3.2. SenML (i)PATCH
The (i)PATCH method can be used to change the values of SenML The (i)PATCH method can be used to change the fields of SenML
Records, to add new Records, and to remove existing Records. The Records, to add new Records, and to remove existing Records. The
names and times of the Patch Records are given and matched in same names, times, and units of the Patch Records are given and matched in
way as for the Fetch Records, except each Patch Record can match at same way as for the Fetch Records, except each Patch Record MUST
most one Target Record. Patch Packs can also include new values and match at most one Target Record. Patch Packs can also include new
other SenML Fields for the Records. Application of Patch Packs is values and other SenML fields for the Records. Application of Patch
idempotent. Packs is idempotent; hence PATCH and iPATCH methods for SenML Packs
are equivalent.
When the name in a Patch Record matches with the name in an existing When the name in a Patch Record matches with the name in an existing
Record, the resolved time values are compared. If the time values Record, the resolved time values and units (if any) are compared. If
either do not exist in both Records or are equal, the Target Record the time values and units either do not exist in both Records or are
is replaced with the contents of the Patch Record. equal, the Target Record is replaced with the contents of the Patch
Record. All Patch Records MUST contain at least a SenML Value or Sum
field. A Patch Pack with invalid Records MUST be rejected.
If a Patch Record contains a name, or combination of a time value and If a Patch Record contains a name, or combination of a time value,
a name, that do not exist in any existing Record in the Pack, the unit, and a name, that do not exist in any existing Record in the
given Record, with all the fields it contains, is added to the Pack. Pack, the given Record, with all the fields it contains, is added to
the Pack.
If a Patch Record has a value ("v") field with value null, the If a Patch Record has a value ("v") field with value null, it MUST
matched Record (if any) is removed from the Pack. NOT be added but the matched Record (if any) is removed from the
Target Pack.
For example, the following document could be given as an (i)PATCH For example, the following document could be given as an (i)PATCH
payload to change/set values of two SenML Records for the example in payload to change/set values of two SenML Records for the example in
Section 1: Section 1:
[ [
{"bn":"2001:db8::2/3311/0/", "n":"5850", "vb":false}, {"bn":"2001:db8::2/3311/0/", "n":"5850", "vb":false},
{"n":"5851", "v":10} {"n":"5851", "v":10}
] ]
skipping to change at page 5, line 47 skipping to change at page 6, line 29
As another example, the following document could be given as an As another example, the following document could be given as an
(i)PATCH payload to remove the two SenML Records: (i)PATCH payload to remove the two SenML Records:
[ [
{"bn":"2001:db8::2/3311/0/", "n":"5850", "v":null}, {"bn":"2001:db8::2/3311/0/", "n":"5850", "v":null},
{"n":"5851", "v":null} {"n":"5851", "v":null}
] ]
4. Fragment Identification 4. Fragment Identification
Fragment identification is supported by analogously applying fragment Fragment identification for Records of Fetch and Patch Packs uses the
identifiers as specified in Section 9 of [RFC8428] to the Fetch/Patch same mechanism as SenML JSON/CBOR fragment identification (see
Records. Section 9 of [RFC8428]), i.e., "rec" scheme followed by a comma-
separated list of Record positions or range(s) of Records. For
example, to select the 3rd and 5th Record of a Fetch or Patch Pack, a
fragment identifier "rec=3,5" can be used in the URI of the Fetch or
Patch Pack resource.
5. Security Considerations 5. Security Considerations
The security and privacy considerations of SenML apply also with the The security and privacy considerations of SenML apply also with the
FETCH and (i)PATCH methods. FETCH and (i)PATCH methods. CoAP's security mechanisms are used to
provide security for the FETCH and (i)PATCH methods.
In FETCH and (i)PATCH requests, the client can pass arbitrary names In FETCH and (i)PATCH requests, the client can pass arbitrary names
to the target resource for manipulation. The resource implementer to the target resource for manipulation. The resource implementer
must take care to only allow access to names that are actually part must take care to only allow access to names that are actually part
of (or accessible through) the target resource. of (or accessible through) the target resource.
If the client is not allowed to do a GET or PUT on the full target If the client is not allowed to do a GET or PUT on the full target
resource (and thus all the names accessible through it), access resource (and thus all the names accessible through it), access
control rules must be evaluated for each record in the pack. control rules must be evaluated for each record in the pack.
skipping to change at page 6, line 50 skipping to change at page 7, line 36
+-----------------------------+----------+---------+ +-----------------------------+----------+---------+
Table 1: CoAP Content-Format IDs Table 1: CoAP Content-Format IDs
6.2. senml-etch+json Media Type 6.2. senml-etch+json Media Type
Type name: application Type name: application
Subtype name: senml-etch+json Subtype name: senml-etch+json
Required parameters: none Required parameters: N/A
Optional parameters: N/A
Optional parameters: none
Encoding considerations: binary Encoding considerations: binary
Security considerations: See Section 5 of RFC-AAAA. Security considerations: See Section 5 of RFC-AAAA.
Interoperability considerations: Applications MUST ignore any key Interoperability considerations: Applications MUST ignore any key
value pairs that they do not understand unless the key ends with the value pairs that they do not understand unless the key ends with the
'_' character in which case an error MUST be generated. This allows '_' character in which case an error MUST be generated. This allows
backwards compatible extensions to this specification. backwards compatible extensions to this specification.
Published specification: RFC-AAAA Published specification: RFC-AAAA
Applications that use this media type: Applications that use the Applications that use this media type: Applications that use the
SenML media type for resource representation. SenML media type for resource representation.
Fragment identifier considerations: Fragment identification for Fragment identifier considerations: Fragment identification for
application/senml-etch+json is supported by using fragment application/senml-etch+json is supported by using fragment
identifiers as specified by RFC AAAA. identifiers as specified by RFC AAAA.
Additional information: Additional information:
Magic number(s): none Deprecated alias names for this type: N/A
Magic number(s): N/A
File extension(s): senml-etchj File extension(s): senml-etchj
Windows Clipboard Name: "SenML FETCH/PATCH format" Windows Clipboard Name: "SenML FETCH/PATCH format"
Macintosh file type code(s): none Macintosh file type code(s): N/A
Macintosh Universal Type Identifier code: org.ietf.senml-etch-json Macintosh Universal Type Identifier code: org.ietf.senml-etch-json
conforms to public.text conforms to public.text
Person & email address to contact for further information: Ari Person & email address to contact for further information: Ari
Keranen ari.keranen@ericsson.com Keranen ari.keranen@ericsson.com
Intended usage: COMMON Intended usage: COMMON
Restrictions on usage: None Restrictions on usage: N/A
Author: Ari Keranen ari.keranen@ericsson.com Author: Ari Keranen ari.keranen@ericsson.com
Change controller: IESG Change controller: IESG
6.3. senml-etch+cbor Media Type 6.3. senml-etch+cbor Media Type
Type name: application Type name: application
Subtype name: senml-etch+cbor Subtype name: senml-etch+cbor
Required parameters: none
Optional parameters: none Required parameters: N/A
Optional parameters: N/A
Encoding considerations: binary Encoding considerations: binary
Security considerations: See Section 5 of RFC-AAAA. Security considerations: See Section 5 of RFC-AAAA.
Interoperability considerations: Applications MUST ignore any key Interoperability considerations: Applications MUST ignore any key
value pairs that they do not understand unless the key ends with the value pairs that they do not understand unless the key ends with the
'_' character in which case an error MUST be generated. This allows '_' character in which case an error MUST be generated. This allows
backwards compatible extensions to this specification. backwards compatible extensions to this specification.
skipping to change at page 8, line 28 skipping to change at page 9, line 16
Applications that use this media type: Applications that use the Applications that use this media type: Applications that use the
SenML media type for resource representation. SenML media type for resource representation.
Fragment identifier considerations: Fragment identification for Fragment identifier considerations: Fragment identification for
application/senml-etch+cbor is supported by using fragment application/senml-etch+cbor is supported by using fragment
identifiers as specified by RFC AAAA. identifiers as specified by RFC AAAA.
Additional information: Additional information:
Magic number(s): none Deprecated alias names for this type: N/A
Magic number(s): N/A
File extension(s): senml-etchc File extension(s): senml-etchc
Macintosh file type code(s): none Macintosh file type code(s): N/A
Macintosh Universal Type Identifier code: org.ietf.senml-etch-cbor Macintosh Universal Type Identifier code: org.ietf.senml-etch-cbor
conforms to public.data conforms to public.data
Person & email address to contact for further information: Ari Person & email address to contact for further information: Ari
Keranen ari.keranen@ericsson.com Keranen ari.keranen@ericsson.com
Intended usage: COMMON Intended usage: COMMON
Restrictions on usage: None Restrictions on usage: N/A
Author: Ari Keranen ari.keranen@ericsson.com Author: Ari Keranen ari.keranen@ericsson.com
Change controller: IESG Change controller: IESG
7. Acknowledgements 7. Acknowledgements
The use of FETCH and (i)PATCH methods with SenML was first introduced The use of FETCH and (i)PATCH methods with SenML was first introduced
by the OMA SpecWorks LwM2M v1.1 specification. This document by the OMA SpecWorks LwM2M v1.1 specification. This document
generalizes the use to any SenML representation. The authors would generalizes the use to any SenML representation. The authors would
 End of changes. 33 change blocks. 
69 lines changed or deleted 112 lines changed or added

This html diff was produced by rfcdiff 1.47. The latest version is available from http://tools.ietf.org/tools/rfcdiff/