Re: [core] content-formats for cbor YANG

Michel Veillette <Michel.Veillette@trilliantinc.com> Thu, 20 April 2017 16:21 UTC

Return-Path: <Michel.Veillette@trilliantinc.com>
X-Original-To: core@ietfa.amsl.com
Delivered-To: core@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id D1E4A128D3E for <core@ietfa.amsl.com>; Thu, 20 Apr 2017 09:21:44 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.922
X-Spam-Level:
X-Spam-Status: No, score=-1.922 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=trilliant.onmicrosoft.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 jPM0XVBFx7k5 for <core@ietfa.amsl.com>; Thu, 20 Apr 2017 09:21:42 -0700 (PDT)
Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0133.outbound.protection.outlook.com [104.47.33.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 39BEF1287A3 for <core@ietf.org>; Thu, 20 Apr 2017 09:21:42 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Trilliant.onmicrosoft.com; s=selector1-trilliantinc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=C2PVnZrmsIo2iBZsuA+6DD8x5md0prcTxt+IGmVeafc=; b=QGcTsUpUc7tOmcCPB5qC6Et4cA5C0KN0u3L+DBW5mwQQTrdYDl7eED1ADFCGWyO5AAQ9mBOh/VtrfMr8u0/ZTkBpqDG2FSQm9kEi5aqVJOCzCmC/dqjW+f3N8xbC4v9UQzZT0jTNgPFRVvdp1cfUEbzILz5ouSOhsCvwinJsXtg=
Received: from BN6PR06MB2308.namprd06.prod.outlook.com (10.173.19.139) by BN6PR06MB2308.namprd06.prod.outlook.com (10.173.19.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.10; Thu, 20 Apr 2017 16:21:40 +0000
Received: from BN6PR06MB2308.namprd06.prod.outlook.com ([10.173.19.139]) by BN6PR06MB2308.namprd06.prod.outlook.com ([10.173.19.139]) with mapi id 15.01.1034.018; Thu, 20 Apr 2017 16:21:40 +0000
From: Michel Veillette <Michel.Veillette@trilliantinc.com>
To: "consultancy@vanderstok.org" <consultancy@vanderstok.org>
CC: Carsten Bormann <cabo@tzi.org>, Core <core@ietf.org>
Thread-Topic: [core] content-formats for cbor YANG
Thread-Index: AQHSubKXN7UA6+6dAE+n0rfEL3aqF6HN9EUAgABIYfCAABcJAIAAGQHg
Date: Thu, 20 Apr 2017 16:21:40 +0000
Message-ID: <BN6PR06MB2308B088FCC1DE8AD1370C4FFE1B0@BN6PR06MB2308.namprd06.prod.outlook.com>
References: <c2b6fb6e92c6a5680e544963e88d5fa7@xs4all.nl> <09BD739F-89A1-4DA7-9006-E30AEAEE581E@tzi.org> <BN6PR06MB230807D8EF9B69A473254077FE1B0@BN6PR06MB2308.namprd06.prod.outlook.com> <063c4a22d221667a92b180e5dce7ea1f@xs4all.nl>
In-Reply-To: <063c4a22d221667a92b180e5dce7ea1f@xs4all.nl>
Accept-Language: fr-CA, en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
authentication-results: vanderstok.org; dkim=none (message not signed) header.d=none;vanderstok.org; dmarc=none action=none header.from=trilliantinc.com;
x-originating-ip: [207.96.192.122]
x-ms-publictraffictype: Email
x-microsoft-exchange-diagnostics: 1; BN6PR06MB2308; 7:lz2vvNJoqs6hjauXG++Mhgb9hQVfYRgMVPkZz22e4qCJ031T1/6q/UMeFoO/EbW3KkXaNXSmcJHfQwHPeEDJHdx9L5VYHJ6R5wwJ5pJSrDVbgiJ2l+f6fXJu4aT5Cm0BIR3GrNiuSJdS2sC9NY/21ay2g4R574ap5ZLqzHp2YUVgxBy08aHkIGF7fRvhYN6SamnSC4JQ6kntkxem8ePrLa3oG5RFRcRZlf4P2tAQEP6aFPEPV64aopCA+hKY1HAP8ysTtKHAJ7KsLsfDND6fCbcGmzTAU2JN5H/fWqitPRyunyXkrTrVTfjSJz0spzpIdSkRY2zpmWLMi55tw/iStQ==
x-ms-office365-filtering-correlation-id: 3fb08d73-a9fc-46ba-704e-08d488095390
x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254075)(201703131423075)(201703031133081); SRVR:BN6PR06MB2308;
x-microsoft-antispam-prvs: <BN6PR06MB2308E0EBC88B5FB73A21B5F5FE1B0@BN6PR06MB2308.namprd06.prod.outlook.com>
x-exchange-antispam-report-test: UriScan:;
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(6041248)(20161123560025)(20161123562025)(20161123555025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(6072148); SRVR:BN6PR06MB2308; BCL:0; PCL:0; RULEID:; SRVR:BN6PR06MB2308;
x-forefront-prvs: 02830F0362
x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(39450400003)(39840400002)(39850400002)(39400400002)(39410400002)(377454003)(377424004)(13464003)(24454002)(189998001)(8936002)(77096006)(6506006)(110136004)(81166006)(7736002)(8676002)(305945005)(1730700003)(38730400002)(25786009)(53546009)(6916009)(2950100002)(4326008)(54356999)(2351001)(2906002)(3846002)(102836003)(93886004)(53936002)(6116002)(6246003)(3280700002)(86362001)(6306002)(2900100001)(7696004)(2501003)(122556002)(99286003)(5640700003)(66066001)(3660700001)(50986999)(9686003)(229853002)(74316002)(33656002)(55016002)(54906002)(5660300001)(76176999); DIR:OUT; SFP:1102; SCL:1; SRVR:BN6PR06MB2308; H:BN6PR06MB2308.namprd06.prod.outlook.com; FPR:; SPF:None; MLV:sfv; LANG:en;
spamdiagnosticoutput: 1:99
spamdiagnosticmetadata: NSPM
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
MIME-Version: 1.0
X-OriginatorOrg: trilliantinc.com
X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Apr 2017 16:21:40.3239 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 4f6fbd13-0dfb-4150-85c3-d43260c04309
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR06MB2308
Archived-At: <https://mailarchive.ietf.org/arch/msg/core/mFTLasTNsPwp4aTK8JbqAdRDzp0>
Subject: Re: [core] content-formats for cbor YANG
X-BeenThere: core@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: "Constrained RESTful Environments \(CoRE\) Working Group list" <core.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/core>, <mailto:core-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/core/>
List-Post: <mailto:core@ietf.org>
List-Help: <mailto:core-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/core>, <mailto:core-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 20 Apr 2017 16:21:45 -0000

Hi Peter

It still unclear to me what is the role of the CoAP method vs. the role of the Content-Format.
The PUT, POST and iPATCH methods all share the same payload (i.e. CBOR array (instance-identifier, value)).

- In the case of the PUT, the existing datastore is deleted and replaced by the provided payload.
- In the case of the POST, a new datastore is created with the provided payload.
- In the case of the iPATCH, the existing datastore is updated based on the provided payload.

For these three use cases, the method defines what to do with the payload, not the Content-Format.
My question is why iPATCH required a different Content-Format when PUT and POST use the same?

Regards,
Michel

-----Original Message-----
From: peter van der Stok [mailto:stokcons@xs4all.nl] 
Sent: Thursday, April 20, 2017 10:37 AM
To: Michel Veillette <Michel.Veillette@trilliantinc.com>
Cc: Carsten Bormann <cabo@tzi.org>; peter van der Stok <consultancy@vanderstok.org>; Core <core@ietf.org>
Subject: Re: [core] content-formats for cbor YANG

Hi Michel,

The semantics of the PUT and GET specify that the payload replaces
(represents) the whole payload.
Applying PUT semantics to a PATCH payload has as consequence that you loose unintentionally large parts of the resource.
A different content-format signals this semantics difference.
The FETCH payload may contain only an array of YANG-CBOR identifiers and each identifier represents GET semantics

Not all CBOR documents represent YANG to CBOR mappings, that's why the content format application/yang-data+cbor is proposed equivalent to application/yang-data+json.

Does that help?

Peter

Michel Veillette schreef op 2017-04-20 15:40:
> Hi Peter, Hi Carsten
> 
> The following table summarizes the different payload uses by CoMI.
> 'value' is defined in
> https://tools.ietf.org/html/draft-ietf-core-yang-cbor-04#section-4
> 'instance-identifier' is defined in
> https://tools.ietf.org/html/draft-ietf-core-yang-cbor-04#section-5.13.
> 1
> 
> Use Case	                  | Request payload                         |
> Response payload
> ----------------------------------+-----------------------------------------+----------------------------------------
> GET /c/instance-identifier        | na
>      | value
> PUT /c/instance-identifier        | value                               
>     | na
> POST /c/instance-identifier       | value                               
>     | na
> DELETE /c/instance-identifier     | na                                  
>     | na
> GET /c                            | na
>      | CBOR array (instance-identifier, value)
> PUT /c	                          | CBOR array (instance-identifier, 
> value) | na
> POST /c	                          | CBOR array (instance-identifier, 
> value) | na
> FETCH /c                          | CBOR array (instance-identifier)
>      | CBOR array (value)
> iPATCH/c                          | CBOR array (instance-identifier, 
> value) | na
> POST /c/instance-identifier (RPC) | value
>      | value
> GET /s (Notification)             | value or CBOR array (value)         
>     | na
> 
> As you can see, the payload of a iPATCH /c request have the same 
> format a PUT /c request, POST /c request and GET /c response.
> What will be the rational to use a different Content-Format for the 
> iPATCH?
> Can we simply use (Content-Format: application/cbor) in all cases?
> 
> Quick note, draft-ietf-core-yang-cbor don't propose any 
> Content-Format, this is left to  draft-ietf-core-comi.
> 
> Regards,
> Michel
> 
> -----Original Message-----
> From: core [mailto:core-bounces@ietf.org] On Behalf Of Carsten Bormann
> Sent: Thursday, April 20, 2017 4:55 AM
> To: peter van der Stok <consultancy@vanderstok.org>
> Cc: Core <core@ietf.org>
> Subject: Re: [core] content-formats for cbor YANG
> 
> 
>> On Apr 20, 2017, at 10:46, peter van der Stok <stokcons@xs4all.nl>
>> wrote:
>> 
>> Hi Core,
>> 
>> Following the discussion on CoMI content-formats during ietf98, I 
>> want to propose the following;
>> 
>> Draft-ietf-core-yang-cbor deines the content-format 
>> application/yang+cbor which defines CBOR documents which contain the 
>> results of the mapping of a YANG document to CBOR as specified in the 
>> draft.
>> 
>> Draft-ietf-core-comi defines two additional content-formats:
>> 1) application/yang-fetch+cbor that specifies the contents and 
>> semantics of a FETCH CoMI request payload
>> 2) application/yang-patch+cbor that specifies the contents and 
>> semantics of a PATCH CoMI request payload
>> 
>> Looking forward to alternative proposals or noises of approval.
> 
> Sounds very good to me.
> 
> Grüße, Carsten
> 
> _______________________________________________
> core mailing list
> core@ietf.org
> https://www.ietf.org/mailman/listinfo/core