Re: [netmod] type equivalence

tom petch <ietfc@btconnect.com> Wed, 24 February 2021 11:52 UTC

Return-Path: <ietfc@btconnect.com>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 4DD203A147B for <netmod@ietfa.amsl.com>; Wed, 24 Feb 2021 03:52:46 -0800 (PST)
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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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=btconnect.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 ZM_bbVIRD87F for <netmod@ietfa.amsl.com>; Wed, 24 Feb 2021 03:52:43 -0800 (PST)
Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80095.outbound.protection.outlook.com [40.107.8.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 28BDF3A147D for <netmod@ietf.org>; Wed, 24 Feb 2021 03:52:42 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DomTioX3P9cBJpcosfGDB92KPqtTnN4YaWBs0OeMxCdHB31gChmpDNGf+aUVu4YPqiI4ZNsmWPxvdert2ICMAwicL5L0vJF6VJfurUcXdNqt68s9JO43o+cjSj5eSk7ZeKgha2p/3fAxnnfJ84gwvdyxtU62Lrsjo6oD6QevDq6qz7ltrA59XzNKkna9V1q3qGjplfjVZU13zRdlKlfZ2kxZ++B4Tk+j2DVBTP2EpTETgHJzEEd/GN/kFPFxY1FyJweUtDK0IWlTNF3EqTyUdsTfOfDtuI+uDFRx0D9gj8cXi3pY689PQG4CLnSrMxbbAstryHjGS8UxD5eMb2rqiA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VCdu48ehoJP6WOGInVYHQTXJfDDEfGMW5nq4EzgBfog=; b=FsWGW3XhrAY4AX1OIHpVTvWiAx5z6CSAfQ0yxH4oka+wmvi9/GNfp3NBTL7vL4+zT1PlUynP/rKru275E9kktyBrpbg3CbqlodM6LPV3kPBIEP2Ws+MDYeG5KOeqLkMjKIBw8asJ+ktIA6ds4aJj9xRS+aTPLUA3TZUBTrj+jcvkWGxywLmVPNK3hi0EdHXdCohnj71h/82ydAaN0guHjI8PL4FS5FZPY/RbjaEEhqK8bmNeT1MS6Fwdw1fupxvOKD8PgOLQEWjzGnnFdkjEO3O6XBc9EWNjRVmPuVtH7T++CHW64hXJqHBDhIX3cyfuIjSQB0tbsTvjPqR3xBOGkw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=btconnect.com; dmarc=pass action=none header.from=btconnect.com; dkim=pass header.d=btconnect.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=btconnect.onmicrosoft.com; s=selector2-btconnect-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VCdu48ehoJP6WOGInVYHQTXJfDDEfGMW5nq4EzgBfog=; b=CChoPUGvDhQXEAyu9m70FSGUzcgH7BjKeykgdEyj26SwGI8OBrYsGritmGl9sIanXYNZy6rPKKg77/cgVGT4OxolbR6xn6br+y3TfjndJ6TdNkhvLrynRDJTUAcQetWmrXB5Yn24F1A2/PARo93WvKasC3v7swKreSADxA9/FTg=
Received: from AM7PR07MB6248.eurprd07.prod.outlook.com (2603:10a6:20b:134::11) by AS8PR07MB7400.eurprd07.prod.outlook.com (2603:10a6:20b:2a4::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.10; Wed, 24 Feb 2021 11:52:40 +0000
Received: from AM7PR07MB6248.eurprd07.prod.outlook.com ([fe80::8115:3afd:18f6:c6d1]) by AM7PR07MB6248.eurprd07.prod.outlook.com ([fe80::8115:3afd:18f6:c6d1%8]) with mapi id 15.20.3890.018; Wed, 24 Feb 2021 11:52:40 +0000
From: tom petch <ietfc@btconnect.com>
To: Martin Björklund <mbj+ietf@4668.se>, "j.schoenwaelder@jacobs-university.de" <j.schoenwaelder@jacobs-university.de>
CC: "netmod@ietf.org" <netmod@ietf.org>
Thread-Topic: [netmod] type equivalence
Thread-Index: AQHXBuAkvMxLMh6nSE6cLkddsVGR2apfukcAgAAPWQCAADYYAIAD67GAgAAG5wCAAAVmgIAAAVWAgAM+kwI=
Date: Wed, 24 Feb 2021 11:52:40 +0000
Message-ID: <AM7PR07MB6248167AAE82201DC1F64CAAA09F9@AM7PR07MB6248.eurprd07.prod.outlook.com>
References: <20210222092455.qupjm2d4lpm4ay4n@anna.jacobs.jacobs-university.de> <20210222.104938.680142326480637892.id@4668.se> <20210222100857.ovetw7udo4ccbezx@anna.jacobs.jacobs-university.de>, <20210222.111343.254950973345362316.id@4668.se>
In-Reply-To: <20210222.111343.254950973345362316.id@4668.se>
Accept-Language: en-GB, en-US
Content-Language: en-GB
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
authentication-results: 4668.se; dkim=none (message not signed) header.d=none;4668.se; dmarc=none action=none header.from=btconnect.com;
x-originating-ip: [86.146.121.140]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 5e194e5b-b37f-42c4-6fcc-08d8d8bab049
x-ms-traffictypediagnostic: AS8PR07MB7400:
x-microsoft-antispam-prvs: <AS8PR07MB740058B3B75B041838042829A09F9@AS8PR07MB7400.eurprd07.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:9508;
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: HESHxdE+1IFnN+HMOce+M0aDegE+lIEN2RjpuQee2DVtcC6z/KNcAF1/XiTV/vDqc0nQFQfWHVBXIY4adT0Rte28Vso9xnB7UNrBpzsK41b+a87xbgNkXHyNrFCiJYtxjdiwTMpt7Sk6l/xUYj65jZltpcOC1tXEyWTCEJcqNmX7qNvL7cnSe3vJ79+WQy0f2/QbB4OPSF13mrjpYNhdJfcQPcidPz9i0Acs7j0/F6S2nZks34O8UeTuDwKv23pniubFbwCYiJ0BOD6YjplYUy2t48t23y4MJdSLAqnc5vsiFPuels4v3OGt0TVuBK89j9HsA/xTq99ATb/0mC/2KU78MVy4udt9w6f1u3QGKUA4YCAOk5CqJy2iJ1ZYu1k8Rr5zcunPwWdLNCvOjGJgXK7/HXRQukscip81HXXwqu9p/iEBBC9tTxNuyyFJv/2Z/AiMrC+ywcBJegBGSLJNQDvPiV1SyuloGjC2OCKL3qN3noOzfhQ64XMo1nzjZzTwhUguYi1nUfnoMet+Tu5ovb+pejTAS/xtn2afeC+gtyPio4Q2R9AGcMQdHCS8NyxE+TVZp7mTAQ+ZSgNtoUpdAchm86LaJK9dwaRjnEvImLw/DhChyM0AM6leqsOfGAnef/AUE8wjEjjL1ZvGb/sgWw==
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR07MB6248.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(39860400002)(366004)(396003)(376002)(346002)(4326008)(66574015)(53546011)(478600001)(7696005)(6506007)(26005)(186003)(55016002)(86362001)(966005)(110136005)(8936002)(8676002)(2906002)(33656002)(316002)(83080400002)(66556008)(71200400001)(5660300002)(64756008)(66946007)(52536014)(91956017)(9686003)(66476007)(66446008)(76116006); DIR:OUT; SFP:1102;
x-ms-exchange-antispam-messagedata: HgN6xLJiAIghDy7TLMc+HjRCHCHkzCDeX6X3SbNAm6Y6t9HrHBgVlTG620QUXplKfGx8HU+1uNwhviyMY8JBMSFsCbd+fAyDcnog/zMgwT7Nt8O9qOirVf8rhpp2Z+BYcApFQtK7pvHXDj11Dh/roJCUEgThV/pPsITqWuKVoS/CQZzew3wOVhhZo86NPN0jdVC9x3mjvq8OymqsytYEJjoEpDC01ekupKriZSXNfQIB3oJj8hn6688yKNUcdRhU3iDSU9uCHgARpoCVfFMGvXTR6WsgX5Us/04kLQaUq628IA0VTCDt4U7wj8ERb2zW1UeMvKO11zRqndnemwbN2jGjhniETVhiMgll1EFbB8+hHhCLjNNrRpfqQ5KRS4f1gyYbTNbVnDuSM/Lz/CE7gurjLIFu4YRyFRceDfZHQCdz1wrEkN9TfkAggN9KK3rqC20zYoxsrHj1a5ZpcwViblE74xvuMtcqJrwMCpOtS6rDd+I5UybpHvOa5dUiu7GpT2366r9w7b11Vc1sz1vdGc3IH0TKyhsCcDD7awdWifg1J14FQzRc49JXZWAl0L8QB3bPmWvePUttLohIsl621t0O1d+y0K2tos5r5xb8FvuJ52YzH6K8eyhzNeZ2TWA19Q4i8W3ZIfNyUEYJHYz+et0GcaBqGRKPZnL5xLefh62iSvx1M5LwINckoQRbKCmbKuBcdM8hgLPFh+03iXOBitxAK+gSj64igocGsA2ABY0Sp+EZyc9Fx7C73fX+bxZ+HG+8toomJNuwTlSyH4oXFukQ6LJitRJ7/Ma/teM91aXbQz8Re1Cv2xQEvjjYBZgRxYE+CNIbq0MaSpqJogfEeWp3xZZCyUU0/DeM+NQ9BmRaCtPgioYLtez9zprzxEuxx7du0c8/Kk514Og+P6t4ac1UW8TBO/+jXwpPtjdWNF5FDiDiXkNDOT/Q1BXAJ9RCWKpHkb3VWFZOJvKiYQ5SI1m61T2wZvndJnu8TMcbZ4K8ENfaPx5sb2Pl8+bWEn4J+4V9CNpQaLG/JFJzoLHTNYJV7owFS9f2DhZMXApL+FyDb03WEyxOgf7ktiL5WpXEZk1pJv/QIAu8iGYoBlYtq5/2EFttrDDYbdHQdAS29awJTyLDeyxpj31iD7GAnMBVC3lGYHJxg/KnrOVqiOYwvygJRAm+1EyKfI+DwW8YEiqxD9R2ZUQ66HalvATWFFiijUjIQSLWRaLANkds6Vzc4DUlcHfdKGUIjGifLW0RCPBBPKNeeCygI4XKXP2Hui0c6SE5Q03iqSg6lAD+hPGio9iGGkXTNuXaykihhDVYhvshBm5KJIPFYj8aF5EUPDpL
x-ms-exchange-transport-forked: True
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: btconnect.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: AM7PR07MB6248.eurprd07.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 5e194e5b-b37f-42c4-6fcc-08d8d8bab049
X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Feb 2021 11:52:40.4561 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: cf8853ed-96e5-465b-9185-806bfe185e30
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: enaszm7TgWGphNfVdC5xem3Ch8JTMapIijdb2awofXJSs3YbWBZA5VToP/CCBmdLeoI7eQ99LQf6UQ6zw5Lf6w==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB7400
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/qV4TSjLoIGF56I-H5tZHSyJDYss>
Subject: Re: [netmod] type equivalence
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: NETMOD WG list <netmod.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netmod>, <mailto:netmod-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netmod/>
List-Post: <mailto:netmod@ietf.org>
List-Help: <mailto:netmod-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netmod>, <mailto:netmod-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 24 Feb 2021 11:52:46 -0000

From: netmod <netmod-bounces@ietf.org> on behalf of Martin Björklund <mbj+ietf@4668.se>
Sent: 22 February 2021 10:13

Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de> wrote:
> Thanks Martin,
>
> so you are saying that
>
>   int8 { range "1..10"; }
>
> is indeed different from
>
>   uint8 { range "1..10"; }
>
> and
>
>   int32 { range "1..10"; }

Yes.

> The use of the word "syntax" in the text you quote may be a left-over
> from SMIv2 times

[That's what I thought as well, but I couldn't find it in the SMIv2
RFCs.  Perhaps it was from some sming text?]

<tp>
When asked about SNMP/SMI, I always say to start with RFC1155/1156/1157.  Either of the first two gives, for me, a clear exposition of the meaning of 'syntax' which I have always taken as read in YANG.

Going back, well, ASN.1, ISO etc etc

Tom Petch

> , it does not really seem to be aligned with how the
> term 'syntax' is used elsewhere in RFC 7950. Anyway, if the agreement
> back then was that you can't change base types (regardless of type
> restrictions), it would have been nice if the text would say this more
> clearly.

Agreed.


/martin



>
> /js
>
> On Mon, Feb 22, 2021 at 10:49:38AM +0100, Martin Björklund wrote:
> > Hi,
> >
> > Section 11 of RFC 7950 says:
> >
> >    o  A "type" statement may be replaced with another "type" statement
> >       that does not change the syntax or semantics of the type.  For
> >       example, an inline type definition may be replaced with a typedef,
> >       but an int8 type cannot be replaced by an int16, since the syntax
> >       would change.
> >
> > If we're just considering XML, then the syntax or encoding wouldn't
> > change if we went from
> >
> >   type int64 { range "2..4"; }
> >
> > to
> >
> >   type string { pattern "2|3|4"; }
> >
> > or
> >
> >   type enumeration {
> >     enum 2;
> >     enum 3;
> >     enum 4;
> >   }
> >
> > or
> >
> >   type union {
> >     type uint8 { range "2"; }
> >     type string { pattern "3"; }
> >     type enumeration { enum 4; }
> >   }
> >
> >
> > But I don't think this is reasonable, and not the intention.  I think
> > that changing the base built-in type always should be considered
> > non-backwards compatible (which the quoted text above seems to imply).
> >
> >
> > /martin
> >
> >
> >
> >
> > Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de> wrote:
> > > On Fri, Feb 19, 2021 at 10:32:34PM +0100, Carsten Bormann wrote:
> > > >
> > > >
> > > > > On 2021-02-19, at 19:18, Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de> wrote:
> > > > >
> > > > > I think the CBOR encoding picks different tags depending on the
> > > > > signedness of the base type and this is why things are not that simple
> > > > > anymore.
> > > >
> > > > (This is not the CBOR encoding, but the COMI encoding of keys in URIs.)
> > >
> > > OK. The CBOR document indeed says:
> > >
> > > 6.1.  The unsigned integer Types
> > >
> > >    Leafs of type uint8, uint16, uint32 and uint64 MUST be encoded using
> > >    a CBOR unsigned integer data item (major type 0).
> > >
> > > 6.2.  The integer Types
> > >
> > >    Leafs of type int8, int16, int32 and int64 MUST be encoded using
> > >    either CBOR unsigned integer (major type 0) or CBOR negative integer
> > >    (major type 1), depending on the actual value.
> > >
> > > This means the type 'int8 { range 0..10; }' leads to the same
> > > encodings as the type 'uint8 { range 0..10; }'.
> > >
> > > > > For the XML and JSON encodings, all definitions lead to the
> > > > > same on-the-wire representation, hence the difference is more an
> > > > > implementation detail. I have no clue what the gnmi people do. The
> > > > > more diverse encodings we add, the more complex things get.
> > > >
> > > > Well, if the equivalence expectation that I was trying to describe actually is ingrained, then whoever designs an encoding (COMI for its URI encoding included) needs to respect it.  That would be important to know.
> > > >
> > >
> > > Exactly. I think we never defined this. And of course, this can get
> > > even more fun if you consider string based encodings. The type
> > >
> > >    type string { pattern "1|2|3|4"; }
> > >
> > > yields the same _XML encoded_ value space as
> > >
> > >    type int32 { range "1..4"; }
> > >
> > > but as far as I recall the JSON/CBOR encodings will treat these two
> > > differently. So yes, ideally the YANG language would have clear rules
> > > what YANG's type equivalences are.
> > >
> > > /js
> > >
> > > --
> > > Juergen Schoenwaelder           Jacobs University Bremen gGmbH
> > > Phone: +49 421 200 3587         Campus Ring 1 | 28759 Bremen | Germany
> > > Fax:   +49 421 200 3103         <https://www.jacobs-university.de/>
> > >
> > > _______________________________________________
> > > netmod mailing list
> > > netmod@ietf.org
> > > https://www.ietf.org/mailman/listinfo/netmod
>
> --
> Juergen Schoenwaelder           Jacobs University Bremen gGmbH
> Phone: +49 421 200 3587         Campus Ring 1 | 28759 Bremen | Germany
> Fax:   +49 421 200 3103         <https://www.jacobs-university.de/>

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