Network Working Group A. Keranen
Internet-Draft Ericsson
Intended status: Standards Track M. Mohajer
Expires: January 4, 2019 u-blox UK
July 3, 2018
FETCH & PATCH with Sensor Measurement Lists (SenML)
draft-keranen-core-senml-fetch-01
Abstract
The Sensor Measurement Lists (SenML) media type and data model can be
used to send collections of resources, such as batches of sensor data
or configuration parameters. The CoAP iPATCH, PATCH, and FETCH
methods enable accessing and updating parts of a resource or multiple
resources with one request. This document defines semantics for the
CoAP iPATCH, and FETCH methods for resources represented with the
SenML data model.
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 http://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 January 4, 2019.
Copyright Notice
Copyright (c) 2018 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
(http://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
Keranen & Mohajer Expires January 4, 2019 [Page 1]
Internet-Draft FETCH & PATCH with SenML July 2018
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 . . . . . . . . . . . . . . . . . . . . . . . . 2
2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 3
3. Using FETCH and iPATCH with SenML . . . . . . . . . . . . . . 3
3.1. SenML FETCH . . . . . . . . . . . . . . . . . . . . . . . 3
3.2. SenML iPATCH . . . . . . . . . . . . . . . . . . . . . . 4
4. Security Considerations . . . . . . . . . . . . . . . . . . . 5
5. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 5
6. References . . . . . . . . . . . . . . . . . . . . . . . . . 5
6.1. Normative References . . . . . . . . . . . . . . . . . . 5
6.2. Informative References . . . . . . . . . . . . . . . . . 6
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 6
1. Introduction
The Sensor Measurement Lists (SenML) media type [I-D.ietf-core-senml]
and data model can be used to transmit collections of resources, such
as batches of sensor data or configuration parameters.
Example of a SenML collection is shown below:
[
{"bn":"2001:db8::2/3306/0/", "n":"5850", "vb":true},
{"n":"5851", "v":42},
{"n":"5750", "vs":"Ceiling light"}
]
Here three resources "3306/0/5850", "3306/0/5851", and "3306/0/5750",
of an IPSO dimmable light smart object [IPSO] are represented using a
single SenML Pack with three SenML Records. All resources share the
same base name "2001:db8::2/3306/0/", hence full names for resources
are "2001:db8::2/3306/0/5850", etc.
The CoAP [RFC7252] iPATCH and FETCH methods [RFC8132] enable
accessing and updating parts of a resource or multiple resources with
one request.
This document defines semantics for the CoAP iPATCH and FETCH methods
for resources represented with the SenML data model. Same semantics
apply also for the CoAP PATCH method.
Keranen & Mohajer Expires January 4, 2019 [Page 2]
Internet-Draft FETCH & PATCH with SenML July 2018
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.
Readers should also be familiar with the terms and concepts discussed
in [RFC8132] and [I-D.ietf-core-senml]. Also the following terms are
used in this document:
FETCH Record: One set of parameters that is used to match SenML
Record(s).
FETCH Pack: One or more FETCH Records in an array structure.
Presented using the SenML media type.
PATCH Record: One set of parameters similar to FETCH Record but
contains also instructions on how to change existing SenML
Pack(s).
PATCH Pack: One or more PATCH Records in an array structure.
3. Using FETCH and iPATCH with SenML
The FETCH and iPATCH methods use the same SenML media type to enable
re-use of existing SenML parsers and generators, in particular on
constrained devices.
3.1. SenML FETCH
The FETCH method can be used to select and return parts of one or
more SenML Packs. The SenML Records are selected by giving the
name(s) of the resources using the SenML "name" and/or "base name"
Fields.
For example, to select resources "5850" and "5851" from the example
in Section 1, the following FETCH Pack can be used:
[
{"bn":"2001:db8::2/3306/0/", "n":"5850"},
{"n":"5851"}
]
The result to a FETCH request with the example above would be:
Keranen & Mohajer Expires January 4, 2019 [Page 3]
Internet-Draft FETCH & PATCH with SenML July 2018
[
{"bn":"2001:db8::2/3306/0/", "n":"5850", "vb":true},
{"n":"5851", "v":42},
]
When SenML Records contain also time values, a name may no longer
uniquely identify a single Record. When no time is given in a FETCH
Record, all SenML Records with the given name are be matched. When
time is given in the FETCH Record, only a SenML Record (if any) with
equal time value and name is matched.
3.2. SenML iPATCH
The iPATCH method can be used to change the values of SenML Records,
to add new Records, and to remove existing Records. The names and
times of the PATCH Records are given and matched in same way as for
the FETCH method but PATCH Packs can include also new values and
other SenML Fields for the Records.
When the name, or time and name, in a PATCH Record matches with an
existing Record, the Record is replaced with the contents of the
PATCH Record.
If a PATCH Record contains a combination of a time value and a name
that do not exist in any existing Record in the Pack, the given
Record, with all the fields it contains, is added to the Pack.
If a PATCH Record has a value field with value null, the matched
Records (if any) are removed from the Pack.
For example, the following document could be given as iPATCH payload
to change/set values of two SenML Records for the example in
Section 1:
[
{"bn":"2001:db8::2/3306/0/", "n":"5850", "vb":false},
{"n":"5851", "v":10}
]
If the request is successful, the resulting representation of the
example SenML Pack would be as follows:
[
{"bn":"2001:db8::2/3306/0/", "n":"5850", "vb":false},
{"n":"5851", "v":10},
{"n":"5750", "vs":"Ceiling light"}
]
Keranen & Mohajer Expires January 4, 2019 [Page 4]
Internet-Draft FETCH & PATCH with SenML July 2018
4. Security Considerations
The security and privacy considerations of SenML apply also with the
FETCH and iPATCH methods.
Since the the FETCH and iPATCH methods potentially allow retrieving
or changing many resources at once, particular care must be taken to
ensure that access control rules for different resources are
respected.
5. Acknowledgements
The use of FETCH and iPATCH methods with SenML was first introduced
by the OMA SpecWorks LwM2M v1.1 specification. This document
generalizes the use to any SenML representation. The authors would
like to thank Jaime Jimenez, Klaus Hartke, and also everyone in the
IETF CoRE and OMA SpecWorks DMSE working groups for their
contributions and reviews.
6. References
6.1. Normative References
[I-D.ietf-core-senml]
Jennings, C., Shelby, Z., Arkko, J., Keranen, A., and C.
Bormann, "Sensor Measurement Lists (SenML)", draft-ietf-
core-senml-16 (work in progress), May 2018.
[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>.
[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>.
[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>.
[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>.
Keranen & Mohajer Expires January 4, 2019 [Page 5]
Internet-Draft FETCH & PATCH with SenML July 2018
6.2. Informative References
[IPSO] IPSO, "IP for Smart Objects - IPSO Objects", 2018,
<https://github.com/IPSO-Alliance/pub>.
Authors' Addresses
Ari Keranen
Ericsson
Email: ari.keranen@ericsson.com
Mojan Mohajer
u-blox UK
Email: Mojan.Mohajer@u-blox.com
Keranen & Mohajer Expires January 4, 2019 [Page 6]