Re: [core] [netconf] YANG encoding in CBOR

Andy Bierman <andy@yumaworks.com> Fri, 22 March 2019 16:38 UTC

Return-Path: <andy@yumaworks.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 B9049131273 for <core@ietfa.amsl.com>; Fri, 22 Mar 2019 09:38:06 -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=unavailable autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=yumaworks-com.20150623.gappssmtp.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 EnncGzjBvBhv for <core@ietfa.amsl.com>; Fri, 22 Mar 2019 09:38:03 -0700 (PDT)
Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) (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 8676713126F for <core@ietf.org>; Fri, 22 Mar 2019 09:38:02 -0700 (PDT)
Received: by mail-lj1-x22b.google.com with SMTP id q66so2594803ljq.7 for <core@ietf.org>; Fri, 22 Mar 2019 09:38:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yumaworks-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=XbV+v0F4IWhHYrZLR1LxIz8hjL3gK1t4DnGZMzQqnlE=; b=ueOc43Hxjwr37UTVgJNCeWc7guqlZN6yFMaho0H5iVHYiX2ghbGZFYQMzYcuwjElha VsX80ebkxAK6Zgc0Vgd08+77JILTBImMHZL75omvo1gHs+SmivWKOldr+ec5j51Ja4HR jO06Pc7gkSRT/8yAxUIjIuxByoxeGoTg1CaPEDk1xPccqX0MpwPjS8OSpXRUgJWtA9cD Va3JWtXYRHMb0Z0FI6adlsphWderhEHHXC4bc6Zn3bC6znFSJVGUw/TkzLK5VGM71/Sv HSPq5KOZ1MnNr+MNs//+tqJCLbjQYOWpTuCnMQNCYc62qyy4d+mzk6BcTPbQS04vpW+d KLfQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XbV+v0F4IWhHYrZLR1LxIz8hjL3gK1t4DnGZMzQqnlE=; b=hP6j6k3zj5RjgJgG5ZP2G7BZ+TvLzI2hdTNf5QaKAROPvSuUexz2Tf1DRvsbg2Aue0 JJyyPRviNgeYsbnGwnuvb/GFVyZkM7n0Zg9jrT8kH10EXrCBc3VmzAsGh4eN6XVwWJuD trosh1+2C0Se5qmkTXvI7Q+MUMXJ8jk7u7Evk9alizJFblLH7QToh63UNxqX8Py+pDCp UWgtSoY2IfzEkeee23VEcPkCgtT6VD3Nf0eETKzM9l/mQGkfGMx7tdZok6uugNV+l3h5 aNa0xl1m/n3oTolzduWe2dPipFAruCMza8Z4DpfGzIDHzmw+Je2seu/M8Pfofvt8nlJ3 YdYg==
X-Gm-Message-State: APjAAAU32glCZvnLm3X0QT/CxMrdWJwTBFTvCpgvNwgQxA0Dqll3y6MB qrhrPBRQZa1+6FybPGA+4qf84Qg5EDle8SBbYrrYdA==
X-Google-Smtp-Source: APXvYqzCr9/jMoeCv8dXiX02K4OTjQrk8e/Em+9FLIeQ4jD7B8JMRgFq0F2TAwiXcfObI7b39tyMS9ndwaof6W9vry4=
X-Received: by 2002:a2e:551d:: with SMTP id j29mr3704471ljb.180.1553272680645; Fri, 22 Mar 2019 09:38:00 -0700 (PDT)
MIME-Version: 1.0
References: <6235c6683ff14848a661f8b8cec94280@XCH-RCD-007.cisco.com> <BL0PR06MB5042823429DB7CDA0F33408B9A430@BL0PR06MB5042.namprd06.prod.outlook.com> <588401AB-483E-40F5-95BB-20A066E56DAC@tzi.org>
In-Reply-To: <588401AB-483E-40F5-95BB-20A066E56DAC@tzi.org>
From: Andy Bierman <andy@yumaworks.com>
Date: Fri, 22 Mar 2019 09:37:49 -0700
Message-ID: <CABCOCHRWBSdqR8hF8wB225qeAZ_3NSW_UC7Vv4e=6oWVCvS1Pg@mail.gmail.com>
To: Carsten Bormann <cabo@tzi.org>
Cc: Michel Veillette <Michel.Veillette@trilliant.com>, "netconf@ietf.org" <netconf@ietf.org>, "core@ietf.org" <core@ietf.org>
Content-Type: multipart/alternative; boundary="0000000000005ea0a50584b17ad4"
Archived-At: <https://mailarchive.ietf.org/arch/msg/core/Tave36tbZ4SezwidqILN1ZkoH5Y>
Subject: Re: [core] [netconf] YANG encoding in CBOR
X-BeenThere: core@ietf.org
X-Mailman-Version: 2.1.29
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: Fri, 22 Mar 2019 16:38:07 -0000

On Fri, Mar 22, 2019 at 9:08 AM Carsten Bormann <cabo@tzi.org> wrote:

> On Mar 22, 2019, at 16:45, Michel Veillette <
> Michel.Veillette@trilliant.com> wrote:
> >
> > 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.
>
> … and that is not a problem for the XML version, because the string is
> being used instead of the value.  (But then if two enumerations share a
> string, you have the equivalent problem in the XML serialization.)
>
>

The union data type has similar issues with JSON encoding, where the JSON
encoding can
influence the YANG decoding. This is not possible with XML since all values
are strings.


Anyway, I haven’t seen a piece of real-world YANG that actually has this
> problem, so I would be a bit reluctant to make CBOR-based implementations
> more complex (and less efficient) so solve this (non-?)problem.
>
>
I agree, but tools still need to identify the problem if it exists and flag
the object for different processing
or no processing at all (draft says YANG with these conflicts are not
allowed). IMO a string encoding
should be used.

All YANG union types are position-dependent.
The parser goes through the member types in order, and first one that
accepts the value given wins.
(e.g, ip-address, or any union with 2 of the same base type).

We discussed this issue during the NETMOD WG virtual interim this week, and
wanted clarification
on the scope of the problem. It seems to be limited to just multiple
enumerations in a union.
The rest of the corner-cases are just position-dependent, same as before.


Grüße, Carsten
>
>
Andy


> _______________________________________________
> core mailing list
> core@ietf.org
> https://www.ietf.org/mailman/listinfo/core
>