Re: [core] Comments on draft-ietf-core-yang-cbor-00

Michel Veillette <Michel.Veillette@trilliantinc.com> Tue, 17 May 2016 18:01 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 8ECB912DC81 for <core@ietfa.amsl.com>; Tue, 17 May 2016 11:01:21 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.901
X-Spam-Level:
X-Spam-Status: No, score=-1.901 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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 Elm2pm7XhWcK for <core@ietfa.amsl.com>; Tue, 17 May 2016 11:01:18 -0700 (PDT)
Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1on0779.outbound.protection.outlook.com [IPv6:2a01:111:f400:fc10::779]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 85D3B12DC7C for <core@ietf.org>; Tue, 17 May 2016 11:01:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Trilliant.onmicrosoft.com; s=selector1-trilliantinc-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=955E9SHWYHQlc9k9P5GBr0ugRRVJ0GptecRRypDKqjI=; b=G4hrJCP3KZwgvUnzi5F6xGsFY81JSylifEMmVfiIMrrEwgZW5Hd9XuPrfxcGyGOihOo4NNRqMx9z/pM2+mihLnPQf6C1sHdlPB5MxLoaND2aTP3xm/DHWLtywmeuylkP6WhCZ07z64VNm5KiSmFnU+bIrynHD4fmkMXd0gM/NRY=
Received: from BLUPR06MB1763.namprd06.prod.outlook.com (10.162.224.149) by BLUPR06MB1762.namprd06.prod.outlook.com (10.162.224.148) with Microsoft SMTP Server (TLS) id 15.1.497.12; Tue, 17 May 2016 18:00:58 +0000
Received: from BLUPR06MB1763.namprd06.prod.outlook.com ([10.162.224.149]) by BLUPR06MB1763.namprd06.prod.outlook.com ([10.162.224.149]) with mapi id 15.01.0497.019; Tue, 17 May 2016 18:00:58 +0000
From: Michel Veillette <Michel.Veillette@trilliantinc.com>
To: Andy Bierman <andy@yumaworks.com>, Core <core@ietf.org>
Thread-Topic: [core] Comments on draft-ietf-core-yang-cbor-00
Thread-Index: AQHRr8iPxRSRAjhbgEmS2wWjXvPI7Z+9MAuA
Date: Tue, 17 May 2016 18:00:58 +0000
Message-ID: <BLUPR06MB17631B5C2248C854DFC47906FE480@BLUPR06MB1763.namprd06.prod.outlook.com>
References: <CABCOCHRRACvVXx2S_hZm2TxbvP48aO4Q4REkh0LFjmHkMkZ1Vg@mail.gmail.com>
In-Reply-To: <CABCOCHRRACvVXx2S_hZm2TxbvP48aO4Q4REkh0LFjmHkMkZ1Vg@mail.gmail.com>
Accept-Language: fr-CA, en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
authentication-results: yumaworks.com; dkim=none (message not signed) header.d=none;yumaworks.com; dmarc=none action=none header.from=trilliantinc.com;
x-originating-ip: [207.96.192.122]
x-ms-office365-filtering-correlation-id: 72cc28e0-da3c-4885-aeca-08d37e7d3341
x-microsoft-exchange-diagnostics: 1; BLUPR06MB1762; 5:RN/jHyheuIOorWfomx03zCE5HAOZE8+ylv8AOjvWBoKMBxJEXJdMwioZZyeXBS62iGg2zfNuOQlIqmZuj/fqGL+2rO54OQCAU56SmuCVJpPmPmSUf0k/6huPm+vzRoCy1p55nSnabitrNjM0bjXQXQ==; 24:geb4kv8XT4zlnD5F+u1DO7AzUX/oaAv9rG6CFKsFGYVHjBn6sZtqKC/cQTw83k4jTLIODf1rAviBEDc/kvy+VeRJgINNwczqYJ2XoPgfRcM=; 7:bKkfGBkh0AfXwY8OgPo4XskETxf2NQUeXM8A8UTPtXHDM46A9agrgDE5kI9nnNO+gkaURI1U5TtpfXTQZIgR/g3JXQ6MTYux3LX3CxmJF6WflAdjGouNnG/8q3Bobixl4br0aqVRYchkFHbGNwZv7uSV0xR3es0vseRmFM+4EdbxVC3mQg+Xvwwpk2wzjVkP
x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR06MB1762;
x-microsoft-antispam-prvs: <BLUPR06MB1762F84EBE964AAE491CA939FE480@BLUPR06MB1762.namprd06.prod.outlook.com>
x-exchange-antispam-report-test: UriScan:;
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001); SRVR:BLUPR06MB1762; BCL:0; PCL:0; RULEID:; SRVR:BLUPR06MB1762;
x-forefront-prvs: 0945B0CC72
x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(377454003)(16236675004)(189998001)(107886002)(2906002)(5008740100001)(19300405004)(19617315012)(2950100001)(5003600100002)(2900100001)(54356999)(76176999)(50986999)(5001770100001)(15975445007)(102836003)(790700001)(1220700001)(6116002)(3846002)(586003)(33656002)(19580395003)(230783001)(19625215002)(19580405001)(122556002)(77096005)(5002640100001)(66066001)(8676002)(8936002)(81166006)(87936001)(10400500002)(5004730100002)(9686002)(11100500001)(76576001)(74316001)(106116001)(86362001)(92566002)(579004)(559001); DIR:OUT; SFP:1102; SCL:1; SRVR:BLUPR06MB1762; H:BLUPR06MB1763.namprd06.prod.outlook.com; FPR:; SPF:None; MLV:sfv; LANG:en;
spamdiagnosticoutput: 1:23
spamdiagnosticmetadata: NSPM
Content-Type: multipart/alternative; boundary="_000_BLUPR06MB17631B5C2248C854DFC47906FE480BLUPR06MB1763namp_"
MIME-Version: 1.0
X-OriginatorOrg: trilliantinc.com
X-MS-Exchange-CrossTenant-originalarrivaltime: 17 May 2016 18:00:58.1419 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 4f6fbd13-0dfb-4150-85c3-d43260c04309
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR06MB1762
Archived-At: <http://mailarchive.ietf.org/arch/msg/core/27xMGp1VOni0x_f5hq4qSfrigZM>
Subject: Re: [core] Comments on draft-ietf-core-yang-cbor-00
X-BeenThere: core@ietf.org
X-Mailman-Version: 2.1.17
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: Tue, 17 May 2016 18:01:21 -0000

Hi Andy and thanks for your comments.
See [MV] bellow for my answers.

I'll wait for your reply before applying any changes to the latest draft.
http://core-wg.github.io/yang-cbor/draft-ietf-core-yang-cbor-latest.html

Regards,
Michel

From: core [mailto:core-bounces@ietf.org] On Behalf Of Andy Bierman
Sent: May-16-16 7:13 PM
To: Core <core@ietf.org>
Subject: [core] Comments on draft-ietf-core-yang-cbor-00

Hi,

Here are my comments on the YANG to CBOR draft


Andy


-------------------------------------------

sec. 3: para 4:

   The end user of this mapping specification
   can mandate the use of a specific key type or a specific subset of
   key types.

C1)  How does the end-user do this?

[MV]
The "end user" in this context is typically a specification.
For example, draft-veillette-core-cool-01 mandate SID as key type.

We should probably use something else than "end user"
Can you propose a new text to clarify the intent of this sentence?

-----------------------------------------

4.2.  The "container" Schema Node

   Collections such as containers, list instances, notifications, RPC
   inputs, RPC outputs, action inputs and action outputs MUST be encoded
   using a CBOR map data item (major type 5).  A map is comprised of
   pairs of data items, with each data item consisting of a key and a
   value.

C2) Add a comment that "key" refers to the child node identifier
and value refers the the value of the child node. It does not
refer to the YANG term "key".

[MV] I proposing to add the following text. Fell free to propose an alternate text.

"Each key within the CBOR map is set to a data node identifier, each
value is set to the value of this data node instance."


----------------------------------------
sec 4.2:

   *SIDs as keys*

   Keys implemented using SIDs MUST be encoded using a CBOR unsigned
   integer (major type 0)

  2nd bullet:
    Delta values may result in a negative number, clients and servers
      MUST support negative deltas.


C3) Doesn't 2nd bullet require CBOR type 1?

Summary: KEY ENCODING (3 variants):
   SID:     Major type 0 or 1
   string:  Major type 3
   hash:    Major type 2

[MV] This issue is already fixed in the latest draft, see
http://core-wg.github.io/yang-cbor/draft-ietf-core-yang-cbor-latest.html#rfc.section.4.2

--------------------------------------------

5.3.  The "decimal64" Type

   Leafs of type decimal64 MUST be encoded using either CBOR unsigned
   integer (major type 0) or CBOR signed integer (major type 1),
   depending on the actual value.  The position of the decimal point is
   defined by the fraction-digits YANG statement and is not available in
   the CBOR encoding.

C4) How are decimal64 values that start with zero encoded?

   leaf foo {
     type decimal64 {
       fraction-digits 3;
     }
     default 0.005;
   }

[MV] If I use the default value as example, the value 0.005 is encoded as 0x05 in CBOR.
If a textual representation is required, the logic performing this conversion needs to add the leading zero(s) and the decimal point.

C5) You probably mean to convert the deciaml64 to a signed
or unsigned integer:

   1.005 == 1005

Then it is up to the decoder to know the YANG schema so it
can adjust based on the fraction-digits value.

[MV] Correct.

---------------------------------------------------

5.6.  The "enumeration" Type

   Leafs of type enumeration MUST be encoded using a CBOR unsigned
   integer data item (major type 0).

C6) Need to say that the implicit or explicit value-stmt value
is used, not the enumeration name like in XML or JSON

C7) Enumeration value is allowed to be negative, so major type 1 also
allowed

[MV]
Correct for both comments.
The first sentence need to be fixed and a clarification need to be added about the automatic assignment algorithm. I propose:

"Leafs of type enumeration MUST be encoded using a CBOR unsigned integer (major type 0) or CBOR signed integer (major type 1), depending on the actual value. Enumeration values are either explicitly assigned using the YANG statement "value" or automatically assigned based on the algorithm defined in [RFC6020biss] section 9.6.4.2.

------------------------------------------------------

5.7.  The "bits" Type

   Leafs of type bits MUST be encoded using a CBOR byte string data item
   (major type 2).

C8) Need to say that the implicit or explicit position-stmt value
is used, not the bit name like in XML or JSON

[MV]
Correct, I propose:

"Leafs of type bits MUST be encoded using a CBOR byte string data item (major type 2). The position of each bit is either explicitly assigned using the YANG statement "position" or automatically assigned based on the algorithm defined in [RFC6020biss] section 9.7.4.2."

------------------------------------------------------

5.8.  The "binary" Type

   Leafs of type binary MUST be encoded using a CBOR byte string data
   item (major type 2).

C9) What string format is used? base64? raw UTF-8?

[MV] No special format, just binary, see example.

------------------------------------------------------

5.12.  The "union" Type

   Leafs of type union MUST be encoded using the rules associated with
   one of the types listed.

C10) This does not really work because so many YANG types use
the same CBOR major encoding

   type union {
      type int32;
      type enumeration {
        enum A { value -5; }
        enum B { value 3; }
      }
      type bits {
        bit X { position 1; }
        bit Y { position 3; }
      }
      type decimal64 {
        fraction-digits 2;
      }
   }

How do I know if '3' is for int32, enum B or bit Y?
How do I know 103 is really decimal64 "1.03" and not
an int32 "103"?

[MV] Ouch, very good point.
I'm proposing to use CBOR tags for the following list of datatypes to avoid this kind of ambiguities.


·        bits

·        decimal64

·        enumeration

·        identityref

·        instance-identifier

·        leafref  (Only if if the datatype of the referenced leaf require a CBOR tag)

For the following list of  datatypes, they can be used directly without CBOR tag.


·        binary

·        boolean

·        empty

·        int8

·        int16

·        int32

·        int64

·        string

·        uint8

·        uint16

·        uint32

·        uint64

-------
Propose text:

Leafs of type union MUST be encoded using the rules associated with one of the types listed.
When use in a union, the following list of YANG datatypes are prefixed by CBOR tag to avoid confusion
between different YANG datatypes encoded using the same CBOR major type.

o bits
o decimal64
o enumeration
o identityref
o instance-identifier
o leafref  (Only if the datatype of the leaf referenced using the "path" YANG statement require a CBOR tag)

See section 7.1 for more information about CBOR tags.

-------
7.  IANA Considerations

7.1.  Tags Registry

This specification require the assignment of CBOR tags for the following YANG datatypes.
These tags are added to the Tags Registry as defined in section 7.2 of RFC 7049.

| Data Item | Semantics | Reference
| bits | YANG bits datatype | RFC6020biss, draft-ietf-core-yang-cbor
| decimal64 | YANG decimal64 datatype | RFC6020biss, draft-ietf-core-yang-cbor
| enumeration | YANG enumeration datatype | RFC6020biss, draft-ietf-core-yang-cbor
|  identityref | YANG identityref datatype | RFC6020biss, draft-ietf-core-yang-cbor
| instance-identifier | YANG instance-identifier datatype | RFC6020biss, draft-ietf-core-yang-cbor
|  leafref  | YANG leafref  datatype | RFC6020biss, draft-ietf-core-yang-cbor


C11)  Need to specify that types are evaluated in YANG
statement order (e.g., check int32, then enumeration, then bits)

[MV] I don’t understand this comment or proposed solution.

--------------------------------------------------------

sec. 5.13, para 5

   When SIDs identify a YANG list, the presence of the key(s) for this
   list is optional.  When the key(s) are present, the targeted instance
   within this list is selected.  When the key(s) are absent, the entire
   YANG list is selected.

C12) A YANG instance-identifier MUST identify exactly 1 instance.
It cannot specify all instances of a YANG list.

[MV] The definition of a list in RFC 6020 seem effectively to back-up this conclusion.

"list: An interior data node that may exist in multiple instances
in the data tree. A list has no value, but rather a set of child nodes."

Are you aware of any other places where this limitation is described?

If this is the case, the following sentences need to be removed and re-introduced as extension within
draft-veillette-core-cool when instance-identifiers are used in the context of the FETCH or iPATCH methods.


"When SIDs identify a YANG list, the presence of the key(s) for this list is optional.

When the key(s) are present, the targeted instance within this list is selected.

When the key(s) are absent, the entire YANG list is selected."

Note:
draft-veillette-core-cool already add two extensions to instance-identifier in the context of a FETCH or iPATCH,
we will need to add a third one. I still believe that using instance-identifier as the base construct
for FETCH and iPATCH make sense in order to minimize implementation footprint even if extensions are needed.

C13) If instance-identifier used in a union, no way to tell that
SID, name, or hash encoding is really an instance-identifier
and not a string or a number.

[MV] Addressed by my previous answer.

C14) How are the keys specified?  The CoMI draft specifies a URI encoding
but nothing in CBOR. Seems like they would have to be a separate string
(keys=A,14,fred).  Examples (e.g. for SID) using an array are not clear.

[MV] When key(s) are needed to qualify the instance-identifier, a CBOR array is used instead of a simple CBOR unsigned integer.
The first entry within the CBOR array is the SID, the next entries are the key(s) encoded using the rules defined for their datatypes.
There is no text conversion require to minimise the implementation footprint.

The following example:
"/ietf-system:system/authentication/user[name='bob']/authorized-key[name='admin']/key-data"

Is encoded as follow in CBOR:
[1721, "bob", "admin"]

Can you propose extra text which will clarify this item?

-----------------------------------------------------------

Attributes:

C15) XML and YANG/JSON allow meta-data to be sent with
the YANG data.  (e.g. NETCONF "operation" or "default" attributes)
How would meta-data be encoded in CBOR?

[MV] Can you provide me some reference to this topic.
I didn't find any references to "operation" and "default" in "draft-ietf-netmod-yang-json"

-----------------------------------------------------------

YANG List Keys:

C16) XML and YANG/JSON require YANG list keys to be encoded first
even if they are not defined first in the list.  This allows server
code to dispatch or do entry lookup without requiring buffering.
Should CBOR encoding of YANG lists require the same?

[MV] This is not possible for both JSON and CBOR.
The ordering of items within JSON objects or CBOR maps are arbitrary.

This is addressed in "draft-ietf-netmod-yang-json" section 5.4

"Unlike the XML encoding, where list keys are required to precede any
other siblings within a list entry, and appear in the order specified
by the data model, the order of members in a JSON-encoded list entry
is arbitrary because JSON objects are fundamentally unordered
collections of members. "