Re: [netconf] YANG encoding in CBOR

"Rob Wilton (rwilton)" <rwilton@cisco.com> Fri, 22 March 2019 17:32 UTC

Return-Path: <rwilton@cisco.com>
X-Original-To: netconf@ietfa.amsl.com
Delivered-To: netconf@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 002E113124D; Fri, 22 Mar 2019 10:32:45 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -14.5
X-Spam-Level:
X-Spam-Status: No, score=-14.5 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, USER_IN_DEF_DKIM_WL=-7.5] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=cisco.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 kESfwdQ52kJy; Fri, 22 Mar 2019 10:32:42 -0700 (PDT)
Received: from alln-iport-3.cisco.com (alln-iport-3.cisco.com [173.37.142.90]) (using TLSv1.2 with cipher DHE-RSA-SEED-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id F1AC3131362; Fri, 22 Mar 2019 10:32:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=16959; q=dns/txt; s=iport; t=1553275962; x=1554485562; h=from:to:subject:date:message-id:references:in-reply-to: mime-version; bh=cAZv961zRktHDt5LV5+eOjxytb5d77os58Lam1lZSr8=; b=RjbQzFNepV1HAo4KrNprMgo9z6YF/jfwH4jHMZvXHoJfd36ifZdZZ0iT 2lr1bPlEZ6Iv6Lz87U7o2zhxKvktij+EWXDXc/qsODXG6exO0kdERp5wN 0yl97/x2ba+pNlJFaZW5HBfefbQ1TvEs8gKBhNlMWlPGuYQNp8KkXYrlI U=;
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0AEAAC4G5Vc/4kNJK1jGgEBAQEBAgE?= =?us-ascii?q?BAQEHAgEBAQGBUQUBAQEBCwGBDoECaIEDJwqMIIsggg2SQYV3FIFnDQEBI4R?= =?us-ascii?q?JAoR8IjQJDQEBAwEBCQEDAm0cDIVKAQEBBCcGXAIBCBEEAQEoBzIUCQgBAQQ?= =?us-ascii?q?BEgiDG4ERZA+qPjOKKQWBLwGLMReBQD+BEYMSPoJhAQECAYErARIBLSiFKwO?= =?us-ascii?q?KFSCGUx6TB2AJAodhi00hk3yLGIYCjSICERWBLh84KD1xcBU7gmyCFheIX4U?= =?us-ascii?q?/QTEBAQGMQYEfgR8BAQ?=
X-IronPort-AV: E=Sophos;i="5.60,256,1549929600"; d="scan'208,217";a="251126838"
Received: from alln-core-4.cisco.com ([173.36.13.137]) by alln-iport-3.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA; 22 Mar 2019 17:32:37 +0000
Received: from XCH-RCD-008.cisco.com (xch-rcd-008.cisco.com [173.37.102.18]) by alln-core-4.cisco.com (8.15.2/8.15.2) with ESMTPS id x2MHWbbi001478 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=FAIL); Fri, 22 Mar 2019 17:32:37 GMT
Received: from xch-rcd-007.cisco.com (173.37.102.17) by XCH-RCD-008.cisco.com (173.37.102.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 22 Mar 2019 12:32:36 -0500
Received: from xch-rcd-007.cisco.com ([173.37.102.17]) by XCH-RCD-007.cisco.com ([173.37.102.17]) with mapi id 15.00.1473.003; Fri, 22 Mar 2019 12:32:36 -0500
From: "Rob Wilton (rwilton)" <rwilton@cisco.com>
To: Michel Veillette <Michel.Veillette@trilliant.com>, "core@ietf.org" <core@ietf.org>, "netconf@ietf.org" <netconf@ietf.org>
Thread-Topic: YANG encoding in CBOR
Thread-Index: AdTf3q8hCOPNH5o0Q0SJZRQQHN87VgA3tcGQAAXew9A=
Date: Fri, 22 Mar 2019 17:32:36 +0000
Message-ID: <edbd00c68ad2440684d61160be263e9c@XCH-RCD-007.cisco.com>
References: <6235c6683ff14848a661f8b8cec94280@XCH-RCD-007.cisco.com> <BL0PR06MB5042823429DB7CDA0F33408B9A430@BL0PR06MB5042.namprd06.prod.outlook.com>
In-Reply-To: <BL0PR06MB5042823429DB7CDA0F33408B9A430@BL0PR06MB5042.namprd06.prod.outlook.com>
Accept-Language: en-GB, en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-ms-exchange-transport-fromentityheader: Hosted
x-originating-ip: [10.61.76.6]
Content-Type: multipart/alternative; boundary="_000_edbd00c68ad2440684d61160be263e9cXCHRCD007ciscocom_"
MIME-Version: 1.0
X-Outbound-SMTP-Client: 173.37.102.18, xch-rcd-008.cisco.com
X-Outbound-Node: alln-core-4.cisco.com
Archived-At: <https://mailarchive.ietf.org/arch/msg/netconf/CEONQVdJuBIJxlsJ-SpJ97UBxig>
Subject: Re: [netconf] YANG encoding in CBOR
X-BeenThere: netconf@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: NETCONF WG list <netconf.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netconf>, <mailto:netconf-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netconf/>
List-Post: <mailto:netconf@ietf.org>
List-Help: <mailto:netconf-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netconf>, <mailto:netconf-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 22 Mar 2019 17:32:45 -0000

Hi Michael,

Indeed, it was the encoding of unions containing more than one enum that was the concern raised in the meeting.

Thanks,
Rob


From: Michel Veillette <Michel.Veillette@trilliant.com>;
Sent: 22 March 2019 15:45
To: Rob Wilton (rwilton) <rwilton@cisco.com>;; core@ietf.org; netconf@ietf.org
Subject: RE: YANG encoding in CBOR

Hi Rob

==================================================================
About "I was wondering whether it would be better to encode enum values ..."

YANG assigns either explicitly or implicitly to each enumeration, a unique integer value, see https://tools.ietf.org/html/rfc7950#section-9.6.4.2.
In CBOR, these values are used, see https://tools.ietf.org/html/draft-ietf-core-yang-cbor-07#section-6.6
When used outside of a union, I don't see any issues with those values.
Andy, do you have a specific example for which, the current encoding is ambiguous?

==================================================================
The encoding of union is defined in:
https://tools.ietf.org/html/draft-ietf-core-yang-cbor-07#section-6.12

Currently, each YANG datatype in a union is encoded differently to avoid any ambiguities between  them.
For example, integer 4 is encoded as:

04 # unsigned(4)

enumerator value 4 is encoded as (assuming the allocated tag is 99):

D8 63 # tag(99)
   04 # unsigned(4)

The list of these encoding is shown below:
- unsigned integer --> CBOR unsigned integer
- integer --> CBOR unsigned integer, CBOR negative integer
- enumeration --> CBOR tag <TBD>
- identityref as SID --> CBOR tag <TBD>
- string --> CBOR text string
- identityref as name --> CBOR tag <TBD>
- bits --> CBOR tag <TBD>
- binary --> CBOR byte string
- decimal64 --> CBOR tag 4
- boolean --> CBOR simple value

The only potential problem I aware is when multiple enumerations are part of the same union.
Value 4 from enumeration A will be encoded the same way as Value 4 from enumeration B.

Is it a real problem is proactive?
If so, how this can be resolved?

I won't be present at the Prague meeting, but I'm certainly available to discuss this topic by email.
I will be present at the Montreal meeting for any remaining discussions on this draft.

Note: I'm currently updating the draft to remove any dependencies with RFC 7951, to resolve a comment sent by Andy.

Regards
Michel


From: core <core-bounces@ietf.org<mailto:core-bounces@ietf.org>> On Behalf Of Rob Wilton (rwilton)
Sent: Friday, March 22, 2019 8:43 AM
To: core@ietf.org<mailto:core@ietf.org>; netconf@ietf.org<mailto:netconf@ietf.org>
Subject: [core] YANG encoding in CBOR

Hi,

As part of YANG evolution discussion, that was some talk about using a binary encoding of YANG in NETCONF or RESTCONF.

CBOR looks like a good fit for this, and obviously CORE WG are working on draft-ietf-core-yang-cbor-07, but one comment came up from Andy that the CBOR encoding of YANG cannot handle all YANG data models.  In particular, because of the way that the encoding works there are limitations on how unions of enums work.  Is that still the case?

Hence I was wondering whether it would be better to encode enum values in CBOR using module-qualified names, or also assign them SIDs and use the SIDs.  Has this approach been considered at all?

Or, is there an alternative approach to how we could/should consider using CBOR as a binary encoding for YANG data in NETCONF or RESTCONF?

Do you think it would be possible to get interested parties together to discuss this at some point in Prague?

Thanks,
Rob