[T2TRG] OCF Observe on special interfaces, design question, RFC requirements?

Michael Koster <michael.koster@smartthings.com> Tue, 09 July 2019 20:38 UTC

Return-Path: <michael.koster@smartthings.com>
X-Original-To: t2trg@ietfa.amsl.com
Delivered-To: t2trg@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 9673012004F for <t2trg@ietfa.amsl.com>; Tue, 9 Jul 2019 13:38:47 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.705
X-Spam-Level:
X-Spam-Status: No, score=-0.705 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, PDS_NO_HELO_DNS=1.295, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=no autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=smartthings.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RGZcJhfCvPHR for <t2trg@ietfa.amsl.com>; Tue, 9 Jul 2019 13:38:46 -0700 (PDT)
Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id F3521120024 for <t2trg@irtf.org>; Tue, 9 Jul 2019 13:38:45 -0700 (PDT)
Received: by mail-pg1-x530.google.com with SMTP id t132so20308pgb.9 for <t2trg@irtf.org>; Tue, 09 Jul 2019 13:38:45 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smartthings.com; s=google; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=LYYOdrOf2eP3BkgPfAJhvZsFUcOZbxfE2dxlId+qEgI=; b=Op1+wl+NFH/mA7CSthdBaH/MiSlK7avlWZzb0TUC2V9us3e18eN3suQnBmTJPO7AEq j9kwB5vCBf282nLYxW2TzyEYCCH+iiXlBKHuVhHgkmB97b6dotj9Ek2zjjBYK4/dwzqE bH/8XeglO3Ea2PZfSTSRkUqv8fKHrvQXNhXqFRLm0eXNRgeQh66yrwybPYy8l6ekCvd2 Ywgg92DwIpPnk3J6qP+COcK8S83fMhaNaToNZ0jhq45Yu30gwQ870Cp9pnoH2lx95PiN oF02uyh5/BP9/p2Xda7HY+Nmya314uUoRoZ5kkAObbo2zism1e2zFvyTQyZFzOjbqY8X up9w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:message-id:date:to; bh=LYYOdrOf2eP3BkgPfAJhvZsFUcOZbxfE2dxlId+qEgI=; b=G+h/tBxvLHXCHvDiYJXlJ63gSeReIigk1H8RTlkJmnK1sDgs8oiQXiZ3RsRyOhZocN ygofdpJhY+s7PvuD1yUUTtonYwAHUOjAWgcMnN5R6uLwjOGLjR3XlATE4t5KF5WKgf0R h0MP5o0NJLiz2NJzbzz4kmYEwiOjHl97n5R2ulnPvl15gHDncX7TmVj6yb+kOyskDiyM /CwBcNEeVXPkr0Q4Vh9jVVqg44QGs2zVdO7VuADjN0CbwpSoiGgL+S/1B0wbu8wfzePV wBpyRjxtJBUbSUM87WYYGFPxHUFf/ARCrXgEz9hfeN5JKO0Ii7S54bHkEq75w0cohsU/ 98OA==
X-Gm-Message-State: APjAAAVf3wZC7UcHhtEHtQBr113bamqhDtZ9eEzdTnPITOhd1Va7JpBi QB/4itzC0cubbjRBlMb4jTuYPxX5yvXT5Q==
X-Google-Smtp-Source: APXvYqwEr00IlFKk5xB74+uy9Tcr4fHQR3azeIrg20pHk+bCSExHMosseiQI/WCdcwnlpG/s9zosvw==
X-Received: by 2002:a63:ca4d:: with SMTP id o13mr4611096pgi.210.1562704725365; Tue, 09 Jul 2019 13:38:45 -0700 (PDT)
Received: from [172.16.0.7] (c-71-202-145-92.hsd1.ca.comcast.net. [71.202.145.92]) by smtp.gmail.com with ESMTPSA id f3sm38315970pfg.165.2019.07.09.13.38.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jul 2019 13:38:44 -0700 (PDT)
From: Michael Koster <michael.koster@smartthings.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\))
Message-Id: <166B0435-8C96-4B83-98CB-A1D6F0838335@smartthings.com>
Date: Tue, 09 Jul 2019 13:38:43 -0700
To: core <core@ietf.org>, "t2trg@irtf.org" <t2trg@irtf.org>
X-Mailer: Apple Mail (2.3273)
Archived-At: <https://mailarchive.ietf.org/arch/msg/t2trg/5Ov5TSdBFXaYb-VhNepGARJ41hM>
Subject: [T2TRG] OCF Observe on special interfaces, design question, RFC requirements?
X-BeenThere: t2trg@irtf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: IRTF Thing-to-Thing Research Group <t2trg.irtf.org>
List-Unsubscribe: <https://www.irtf.org/mailman/options/t2trg>, <mailto:t2trg-request@irtf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/t2trg/>
List-Post: <mailto:t2trg@irtf.org>
List-Help: <mailto:t2trg-request@irtf.org?subject=help>
List-Subscribe: <https://www.irtf.org/mailman/listinfo/t2trg>, <mailto:t2trg-request@irtf.org?subject=subscribe>
X-List-Received-Date: Tue, 09 Jul 2019 20:38:48 -0000

Background:
OCF uses special URLs, selected by query parameters, to specialize views and functions on resources. Client applications use the CoRE defined "if" target attribute and use IANA registered values as OCF Core  Interface Types in the query to select these views.

We provide interfaces that report partial state representations, e.g. links list for just the links of a collection, batch for just the data items in a collection, etc., and one interface (called baseline) that does report the full state of the resource.

For example:
GET /machine/state/3?if=oic.if.s
selects the "sensor" interface which returns sensor values but maybe not things like units and range that may also be present in the resource.

The need:
In OCF we are in the process of adding more special URLs, as interface types, for creation and deletion of resources, and interface types for modifying link arrays.

We would like to use CoAP Observe on these new interface URLs to report only the updates to the resource, and not the entire state of the resource in each notification. You might say partial state from a temporal view; incremental state updates. 

The Problem:
When a client first Observes or tries to poll, for example using the create interface, there are no items to reply with (this issue is similar to the Pub/Sub empty topic issue). Later, when a resource is eventually created, then a notification is sent to all observers containing the representation that was used to create the resource.

Proposed Solution:
With OCF we have a default content format and can return an empty CBOR map or an empty CBOR array, as appropriate, for the initial GET + Observe response, and return an item in the payload on subsequent notifications whenever a new resource is created.

We would use 2.05 Content for the response code in all non-error notifications.

Question:
Does this violate any of the current requirements in RFC7252 or RFC7641, or other specifications? There is some text that suggests a full representation be transmitted on every response, but it seems to address the general case i.e. not special URLs, and also would not allow for over-the-wire protocol optimization.

Example:
client-1 ==> GET /some/collection?if=oic.if.create obs=0 // client-1 wants to be notified when items are created in the collection
server response ==> 2.05 Content obs {} 

(later)

client-2 ==> POST /some/collection?if=oic.if.create { item: foo } //item being created by client-2 in the collection
server response ==> 2.01 Created { item:foo, id:1234 }

(to client-1)
observe response ==> 2.05 Content { item:foo, id:1234 } // client-1 is notified of the new item