Re: [netmod] type equivalence

Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de> Mon, 22 February 2021 10:09 UTC

Return-Path: <J.Schoenwaelder@jacobs-university.de>
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 D41EC3A1239 for <netmod@ietfa.amsl.com>; Mon, 22 Feb 2021 02:09:03 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.7
X-Spam-Level:
X-Spam-Status: No, score=-6.7 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_HI=-5, 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=fail (1024-bit key) reason="fail (body has been altered)" header.d=jacobsuniversity.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 uJ2gF81tHzwn for <netmod@ietfa.amsl.com>; Mon, 22 Feb 2021 02:09:01 -0800 (PST)
Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40073.outbound.protection.outlook.com [40.107.4.73]) (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 E2E963A1234 for <netmod@ietf.org>; Mon, 22 Feb 2021 02:09:00 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T5qT1BS835HUiWxcyyPz3T2tgsUrHiE7MCZ883KIoLOu6WTE3aasokIsffHgE7mK45LlFOGnitdxUPcbnRPaf/xo4vj1OiI8PopqPfJ6GrNFsyVyx55YDMFpI7lqeLWtm89jfmN+ARJYyGiKvHK6H/q9VWKurVWk3hxQzEU0dJn4qInGF0JDJkHpwluwCNVgYipzoYI1IJFvRti4A0kLDdNLiqQHex20SY0Yk8DJOhRlzlB1FkoMIdHzklt0TePICMe5VqVvRyvFNVn5LBZKeb99vw/1d5cQBJSNLRy15FP/QSe0yPbs1M5WOpF55Cgagb1WZT6ju8RqFtUt8II6Eg==
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=XJnhcOfjUn73Yog/vO6ZC5P8weoQw5giwGxCZtgCiU4=; b=f0U4NepDX3V0a76rXjtNlntmU/nKwiZvup/HtG7QUVDsYlslv0twSk6b8OCw9Cv/wcXgRcLySIEVrhyRKbhQQhhIwJt+Kg0OMXRd7dCZo7aUrX4YvFb2P+W1UtqWybbZMRz/DHYWvC0aRGQ++iIRtsuqtHt50uDsLw8IvJ2KGx0YuG6Ra6MonSnhtHdjFj3XqVm/ImW7WITEbb/b3LAxZ+/GQMOS5MW7PCYvuHD71sKW6u67djwKtDMd7TCE+8qVEpkpPvrTfwmJMFktxttMSBxCAPji6S3TiR7JAE+Lh8T0Y4E/maG9YucrgahzD/JTtN7JegaoA3k7Zx/2V25vVg==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=jacobs-university.de; dmarc=pass action=none header.from=jacobs-university.de; dkim=pass header.d=jacobs-university.de; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jacobsuniversity.onmicrosoft.com; s=selector2-jacobsuniversity-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XJnhcOfjUn73Yog/vO6ZC5P8weoQw5giwGxCZtgCiU4=; b=kmpj4Kl5NOM+22+rYG4IZcXYSvCeAXoCPIe6oHEYiIgBAlVZbWu7DskiaHitTLFMQ2uVKDywXHrdwomHbvstIZ7uoZOVKIgEN7Bv1i30/ywmYP3MHt9DDnlZlEPWBT1PerYcRFZasxyVZxTK95yxly1tBdjUMVdFCwZxBlcYf9A=
Authentication-Results: 4668.se; dkim=none (message not signed) header.d=none;4668.se; dmarc=none action=none header.from=jacobs-university.de;
Received: from AM0P190MB0641.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:194::23) by AM8P190MB0899.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:1d9::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Mon, 22 Feb 2021 10:08:58 +0000
Received: from AM0P190MB0641.EURP190.PROD.OUTLOOK.COM ([fe80::1ce1:49e3:3e54:804d]) by AM0P190MB0641.EURP190.PROD.OUTLOOK.COM ([fe80::1ce1:49e3:3e54:804d%5]) with mapi id 15.20.3868.033; Mon, 22 Feb 2021 10:08:58 +0000
Date: Mon, 22 Feb 2021 11:08:57 +0100
From: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
To: Martin Björklund <mbj+ietf@4668.se>
Cc: cabo@tzi.org, netmod@ietf.org
Message-ID: <20210222100857.ovetw7udo4ccbezx@anna.jacobs.jacobs-university.de>
Reply-To: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
Mail-Followup-To: Martin Björklund <mbj+ietf@4668.se>, cabo@tzi.org, netmod@ietf.org
References: <20210219181858.arafmdtraq4ydir2@anna.jacobs.jacobs-university.de> <CD64BB41-E2BE-4B25-AA55-3B91D7C0D313@tzi.org> <20210222092455.qupjm2d4lpm4ay4n@anna.jacobs.jacobs-university.de> <20210222.104938.680142326480637892.id@4668.se>
Content-Type: text/plain; charset="iso-8859-1"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20210222.104938.680142326480637892.id@4668.se>
X-Originating-IP: [212.201.44.244]
X-ClientProxiedBy: AM8P189CA0027.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:218::32) To AM0P190MB0641.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:194::23)
MIME-Version: 1.0
X-MS-Exchange-MessageSentRepresentingType: 1
Received: from localhost (212.201.44.244) by AM8P189CA0027.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:218::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 10:08:58 +0000
X-MS-PublicTrafficType: Email
X-MS-Office365-Filtering-Correlation-Id: d6e82fbb-4446-4408-9553-08d8d719dec6
X-MS-TrafficTypeDiagnostic: AM8P190MB0899:
X-MS-Exchange-Transport-Forked: True
X-Microsoft-Antispam-PRVS: <AM8P190MB08994BBCF844A46BDE9DBCC5DE819@AM8P190MB0899.EURP190.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: IVQijoB3kIsoUzT+aWRwgSEuYdAsrurJa2mcfYYhrDv5RjrvQvQuBV9A8vunAZmuzrnnZxVh/mGp5ChD5G8h0tAxjXrkcX/4Dm3GIJEV/W3dBNYjpWMBHCMPSL7e2SejI/FidmE0K2lCchd+qBtZrDO2in/erCCoLXxZswKYZQkDqnleskwUeMn8xvG9kEOPJtP0nmr409zp+/rgogLCvnF9MS2iZ/2btAkNqbAsa9ucQGcpr6TvcBZ+EJMz3xQ+EsvT6M0084aVgVuSAJbOW+IatGiafzDMWiA27ajxakcFFg+8DvJQ74I9p2kohpLJFILTO1LXa2GLrXmLq57SNoGUnLexHBFDjUSeQUsF0eggO1a6XPjuvHIitAj/TOt80WbLOdL/EvnSEaATUfvrOnHEOjiEiFYm6aw75y5RoEstDuNNkzf5pTYR4fuZp/vbb8Fk5GlroeuqLQmwkZUOT7ca3CK0XiNYLPfyWSkxliaHqoOESnKa02UIjsk1+ui8pJjrQJSWzBkQnToH9EJCKhBFrpau4Tm/iQ2IYV8QRQFp9eTUpauZDbcz+lAnyIB4uuCO1B5KjHNl1Z7Dgwe0whTDXx+9J9S1QEAmO5tCjXiOSTX/ZUv6faMUfAXbHfv+003pc1SvSQXpmzBJgl1hug==
X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0P190MB0641.EURP190.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(396003)(346002)(376002)(136003)(366004)(39850400004)(2906002)(52116002)(5660300002)(6496006)(86362001)(1076003)(4326008)(956004)(83080400002)(186003)(16526019)(786003)(66574015)(316002)(3450700001)(478600001)(966005)(8936002)(66946007)(6486002)(66556008)(8676002)(66476007)(26005)(53546011); DIR:OUT; SFP:1101;
X-MS-Exchange-AntiSpam-MessageData: VWPgr/OF9PV6zeEwbw+GZ9PIbKGgf3pSKrzzXfTpXZiK3bV2Wj0ViEV0YLIYV7qleJ+uh15MW+ID3zi7WUnrHGCvwxodQcam2GgiZz0DVZVdii2u8vpvSHaVyLJUZP3Siyi+Z57LoVK8Z6Ouqegh2Eoi7AyrSX3MLVAWPMZr1ySFzLLFHXxhS3UVyRHFD761Fx83pHS2Mi7b5RjhTeDMZ4/pyGAjZLymP73qSvn2xIZpqQ6jV5CG7J6D9tAXj4w6bNPLIA1xMQPclE92PcT677YL66H+kQXulSadKHsYfrrbCjghXkoiLdPnjpIJL/XoVyd/2JZENgDcQnXIBv4+Gq2nPrBZ5In4twFlXi/LTqvHqM+5LYkUEUu3VoiZkomKdD/sgRPUgUW2Taz7ZUCeos0vnoDoi9rVshpWkkBpuy4+oHUh4Qj187lA2mDqoYT1ZaNHHdr8sezPXGltiJNVjAhrmP0AP+mwkLyGkrW/oPZcJNKpwU1srCLM4MXkgYhrVjoN7Sf/lo+sq0AFPE3BvHjahr3wfema9R6kgjx9GhS0Yu1wey1kmLvKJiacQr/ZSaoMDDnar+5CCGG5Kpk0911blaxihqoOQ2NhQIWUbBJgdITgnu+wu5Db2AdnOmwodSsS3XRALni7y5H44Fd5aqfNyRdZUhs/YUjcRxHskbzozbT0fAJ/8qwlrVm04dEwFXiqmf6t6Z7iwDqnVIPZ8S/CzBfd4/JGuX3kGSvwuQ64vEzvkC4PQ9ZCnppLH6VEjnrPEds/U1Mpdqr4sxzNYQHuABCMQkzMPNZtvnNC9xsRKrqnr3arCC86zi+dLsby3P6sup+AxC/5lZ+Wg6MnvZm/5WunUnpJRgPSXYGhFj2JtQt3Sw8hIlUVNQcrAhYbk/ygiux2IbFKTl/VQLAOgKt9MwT7JDjKIQKPut7Q9TV+DLhP2/D0M1PGO3/IsUfJehDvRqmDb0qDUpmB7Fcp8ZX/N+bQywaMQsc54e/hsZqWVfWYA9zOxTLH8aMj2Az1NmoFebSnF6rX8KW9c4k46t+SWODzwjePgr9dTIITkwF4qRW9bH7xnpGxoj/3b/LoW65NsA58UKPvtcb6m/wsaSzUbJCVZC+iUHH5Iqfa0aBSrKsI3X2vSEqnh1jb2ih4R+q0he1bVnbu9YaPwHgxtm+xgX47gvMkNSxD+DSGOzzjoqG+rTyRvPM5F8hcrkD2iLgp65nE7/uo0NQ68stwWKC433O2CrtkjeSWV0MQz/+OIE0S8OWEvQC8ig0aPzU0Waczi5P+4c8elD9lxaLZVRV1aNlEvPffJKEAyQlYgYqN+AmP7hEZQhZ5VGX5dzRw
X-OriginatorOrg: jacobs-university.de
X-MS-Exchange-CrossTenant-Network-Message-Id: d6e82fbb-4446-4408-9553-08d8d719dec6
X-MS-Exchange-CrossTenant-AuthSource: AM0P190MB0641.EURP190.PROD.OUTLOOK.COM
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2021 10:08:58.5462 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: f78e973e-5c0b-4ab8-bbd7-9887c95a8ebd
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: sGDtvgShwhSEFlOaTy98oiN3j+PIPGwKceToy0V0UdFWg4bPO0yHAFO2OJtAlJ4vuNn9zlwmuqdt9k4879EMr5ZbPUa249xjNtbe8RZD9Xc=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8P190MB0899
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/FjNiNa4SOnuzgJqpDExRG4UAOHI>
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: Mon, 22 Feb 2021 10:09:04 -0000

Thanks Martin,

so you are saying that

  int8 { range "1..10"; }

is indeed different from

  uint8 { range "1..10"; }

and

  int32 { range "1..10"; }

The use of the word "syntax" in the text you quote may be a left-over
from SMIv2 times, 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.

/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/>