Re: [netconf] YANG encoding in CBOR

Michel Veillette <Michel.Veillette@trilliant.com> Fri, 22 March 2019 15:45 UTC

Return-Path: <Michel.Veillette@trilliant.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 07CB31310A8; Fri, 22 Mar 2019 08:45:37 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level:
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=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 WRyd6FD68k0y; Fri, 22 Mar 2019 08:45:34 -0700 (PDT)
Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-eopbgr820118.outbound.protection.outlook.com [40.107.82.118]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 402D01310AE; Fri, 22 Mar 2019 08:45:31 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Trilliant.onmicrosoft.com; s=selector1-Trilliant-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zpDojyMD0CmH4rudlXA9iwXvS2DJbH/e6EwbjArTXSA=; b=xX8mBn0R5+7ThCAX6UV/rsF8x8IyWqNKAPovOdPHfRWa1qqCK3VHQjj0vkNF5hWeovPa8tSm3FFYeZp7XM8jKl4RyV/bqVd/LX/Mg735BIP1rVTp4HGmSgha6XwSQ/fqaZU1DoJ+Izi4mqvCucezf8mH7ZnPHbuwfr7Syf169Is=
Received: from BL0PR06MB5042.namprd06.prod.outlook.com (10.167.240.31) by BL0PR06MB4609.namprd06.prod.outlook.com (20.177.145.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1709.14; Fri, 22 Mar 2019 15:45:27 +0000
Received: from BL0PR06MB5042.namprd06.prod.outlook.com ([fe80::d5:e11c:db10:639d]) by BL0PR06MB5042.namprd06.prod.outlook.com ([fe80::d5:e11c:db10:639d%3]) with mapi id 15.20.1730.017; Fri, 22 Mar 2019 15:45:27 +0000
From: Michel Veillette <Michel.Veillette@trilliant.com>
To: "Rob Wilton (rwilton)" <rwilton@cisco.com>, "core@ietf.org" <core@ietf.org>, "netconf@ietf.org" <netconf@ietf.org>
Thread-Topic: YANG encoding in CBOR
Thread-Index: AdTf3q8hCOPNH5o0Q0SJZRQQHN87VgA3tcGQ
Date: Fri, 22 Mar 2019 15:45:27 +0000
Message-ID: <BL0PR06MB5042823429DB7CDA0F33408B9A430@BL0PR06MB5042.namprd06.prod.outlook.com>
References: <6235c6683ff14848a661f8b8cec94280@XCH-RCD-007.cisco.com>
In-Reply-To: <6235c6683ff14848a661f8b8cec94280@XCH-RCD-007.cisco.com>
Accept-Language: fr-CA, en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
authentication-results: spf=none (sender IP is ) smtp.mailfrom=Michel.Veillette@trilliant.com;
x-originating-ip: [207.96.192.122]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 26a46e2e-c34c-40cb-35fc-08d6aedd6837
x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:BL0PR06MB4609;
x-ms-traffictypediagnostic: BL0PR06MB4609:
x-ms-exchange-purlcount: 3
x-microsoft-antispam-prvs: <BL0PR06MB4609BC6AED4F417A41963B9F9A430@BL0PR06MB4609.namprd06.prod.outlook.com>
x-forefront-prvs: 09840A4839
x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(346002)(396003)(39850400004)(376002)(366004)(199004)(189003)(110136005)(68736007)(9686003)(2906002)(606006)(6246003)(71200400001)(99286004)(53936002)(476003)(26005)(71190400001)(316002)(11346002)(7696005)(5660300002)(3846002)(478600001)(446003)(6116002)(53546011)(97736004)(186003)(76176011)(6506007)(790700001)(102836004)(8936002)(486006)(7736002)(74316002)(25786009)(86362001)(52536014)(33656002)(2201001)(81166006)(6306002)(229853002)(72206003)(966005)(2501003)(55016002)(8676002)(6436002)(106356001)(54896002)(256004)(66066001)(3480700005)(105586002)(236005)(14454004)(81156014); DIR:OUT; SFP:1102; SCL:1; SRVR:BL0PR06MB4609; H:BL0PR06MB5042.namprd06.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1;
received-spf: None (protection.outlook.com: trilliant.com does not designate permitted sender hosts)
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam-message-info: HK6m1mIEdcft0HAw/nxyNQDgKkPCj8ZfYjTSIn7v6X2XsMrrqxFTA2x8DI8eue0XQdwmdSCZfb8ythShE1bJkgxxkJ9kzvWDBoTRX7mlAavn1qCbRCG4m2ISbaU0U/Aune/7jaE2KrHbHCBLSfqfpVIi7FD8LIPLwkBg4/OjMT3w2AxD+Z7e17AY9QkyncOiuYlTaWpGTCbZqAV7t4MOivM26bCabCp4XFa7Y7BJA8fqBOvT1B5OfRaOJ3m0oP/6lGVN+AHNkvRZSK/t+REC5oz63o4ri6wYgmVv9gM3ScP+HcrCoPBaUTaSR4aae3Dlf80lhfsqwcVv/P1+6lOi2tCzdSl0RTfUaMSO5NymSZxeSt+sFgLjpmuCsoeuAfFIzpRp912/0im7Gm5Puq3yVvSHHrdR8W+8TSMzIKxI8oE=
Content-Type: multipart/alternative; boundary="_000_BL0PR06MB5042823429DB7CDA0F33408B9A430BL0PR06MB5042namp_"
MIME-Version: 1.0
X-OriginatorOrg: Trilliant.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 26a46e2e-c34c-40cb-35fc-08d6aedd6837
X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Mar 2019 15:45:27.7216 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 4f6fbd13-0dfb-4150-85c3-d43260c04309
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR06MB4609
Archived-At: <https://mailarchive.ietf.org/arch/msg/netconf/L6wbX6zgRnLPTsadzC8IDRBTh7E>
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 15:45:37 -0000

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> On Behalf Of Rob Wilton (rwilton)
Sent: Friday, March 22, 2019 8:43 AM
To: core@ietf.org; 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