Re: [yang-doctors] canonical order question

Scott Mansfield <scott.mansfield@ericsson.com> Wed, 22 November 2023 10:53 UTC

Return-Path: <scott.mansfield@ericsson.com>
X-Original-To: yang-doctors@ietfa.amsl.com
Delivered-To: yang-doctors@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 3974CC14CE2F for <yang-doctors@ietfa.amsl.com>; Wed, 22 Nov 2023 02:53:16 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.11
X-Spam-Level:
X-Spam-Status: No, score=-2.11 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=ericsson.com
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zErw3zbrJHym for <yang-doctors@ietfa.amsl.com>; Wed, 22 Nov 2023 02:53:11 -0800 (PST)
Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2077.outbound.protection.outlook.com [40.107.94.77]) (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 B7FFDC14CE2B for <yang-doctors@ietf.org>; Wed, 22 Nov 2023 02:53:11 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FK0Fi7k2QL+3+IZSbaXL31DBPzHX8MJ7sDR/z4jTQU5iGY6Lqshi+zoYvHRJ7zg/GEiVnvCqbzGPmH/kzLzXmsT0jAfpLdzQpqqQQX6f4Qn2rI3DaVpUSX8CAeZCoTgsVBzt3KRvSeja1S971AVHriOX0PQ+i8FatvFQN7emLur/UkYryTthRbfiEmKhWkTsYXLpy1EI7mzUEn1G/rpZoMT+aRrbUEOVTDFMu8iryc27ityQqzwlsn/ugn6iZj6bJYmR55DRjIs39G657UTnfblgBH6R0YWrKe6j1YUkLVOSQIyxz7uzPe53GlHhWUeGGaoAM0IBbrkhpn805DCE5w==
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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/o6JP3WJC0NT0G7kAsI6MIpVECGHl7tq7MQ1BVQUoUs=; b=m1PC6JNYrvRUoeAmdNfls7kqXf5E+TyfToaCklZgXz3Wrircr5gmRBDxYB9HbA/FWVp00MOyaMl3gCWcl0wfUB0PQqSOUQ0QUZ43LcaWu58FInvrosJQ5OE1Rj3jlUQhTH6cXkiaVpLcp9vEh0J8NJ755Q1MT+gyHIyodngQg/EngYt0+oBwOxj0h+HIa4t9yRMhIGhCuiViU0/JlGOnEMQ41hBo+aGIR6g09cR1io5yJ7B/BCtkDL2pOL6Q52as4Ri2vk4XuwbrYXF2JpVrxjwQeR6KW5VlPNxxgT204/KK5IodTaibIQG3tdTobZ3qfQqDp0LQnhrLDiVaCxSx9Q==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ericsson.com; dmarc=pass action=none header.from=ericsson.com; dkim=pass header.d=ericsson.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/o6JP3WJC0NT0G7kAsI6MIpVECGHl7tq7MQ1BVQUoUs=; b=uAjziBUXWkbFtAxk1rdF9+aMsUgnerkZKoq0b5aOgYOU0FuRWyzvbaxpEmRHl+6oNnP+Yx43cTNkhCI6+OC0J/jqBNFuOG3KNGeEGW1zAKXicdANwdLOGPs9TuV4enQg4qCU68r+Vwil7/4sAFaVqpo4GiinxG0IRh3BXiiFUHZ5F8xsdwoanmj0ReebmeCsgM9RobC9EWYw2oiIeyKr/ytk/EKDJlG1BUw7ahknW4QAgqUSF+IBgOfn3h6JMkk/WgWnwSHFvMjgRPXwcfwaFbu9phBB6XXT21lMnotwFVKWdp0oWhomAa5L+Hqoc2bb62oLH3OeGMt6S9h3+Pcp3Q==
Received: from BL0PR1501MB4130.namprd15.prod.outlook.com (2603:10b6:208:86::17) by SJ0PR15MB5823.namprd15.prod.outlook.com (2603:10b6:a03:4e6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.19; Wed, 22 Nov 2023 10:53:08 +0000
Received: from BL0PR1501MB4130.namprd15.prod.outlook.com ([fe80::6dbe:9b9:1ae4:c7f9]) by BL0PR1501MB4130.namprd15.prod.outlook.com ([fe80::6dbe:9b9:1ae4:c7f9%3]) with mapi id 15.20.7025.019; Wed, 22 Nov 2023 10:53:08 +0000
From: Scott Mansfield <scott.mansfield@ericsson.com>
To: Martin Björklund <mbj+ietf@4668.se>
CC: "yang-doctors@ietf.org" <yang-doctors@ietf.org>
Thread-Topic: [yang-doctors] canonical order question
Thread-Index: AdodIqHV2/hEGmG5QFSYXuE8ziBATQADCHiAAAA2M3A=
Date: Wed, 22 Nov 2023 10:53:07 +0000
Message-ID: <BL0PR1501MB4130AC63689E98D4173CBBD68BBAA@BL0PR1501MB4130.namprd15.prod.outlook.com>
References: <BL0PR1501MB4130AB9909CDAF5AD4328E728BBAA@BL0PR1501MB4130.namprd15.prod.outlook.com> <20231122.112925.1904227441461262662.id@4668.se>
In-Reply-To: <20231122.112925.1904227441461262662.id@4668.se>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=ericsson.com;
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: BL0PR1501MB4130:EE_|SJ0PR15MB5823:EE_
x-ms-office365-filtering-correlation-id: 42b61784-9590-4f83-b003-08dbeb493630
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: WdbvSqm8tDqvA1YEI00RNnstkIb5ZWVLkdpVpXv062jltkfHnHP5iJoJ+GK44R//wZrX9Luwh20vgiZbzHfdjSTAoq5azjoxuv/vtyKo2CZqC63OEaB8G17RdOQgKPphe/LFaF0Q2RfjOKTmK/aG8Mi5d7NkSliSWg/FzTq2ne+48FEv4I1yxpH+hdy6cGF+Xq320xxBRwnGUOiRAfo0n15dX8i3yltBQPTGwsKL+3cfc+XsDn+/dw/9FFgBpEd85laXlo7r2hYac16pHDu6vX3faHpxrXCU5k8CPMIZSNgEJT8aO8s75hCbvi1xxnxnwpGC5OSGIfI7oA9hOIoAmtPlTVuBDRCJnG836dKDkHgClGa134ZgfxTvjOGgo7lyCVLb/gZUSm8XgHLZTRyJVz3MQGH8F5Y3gi9l/npD1OaLkeW1lwK0+d+ZgjSiV1EG4PSgjj9rlBYPkqq5XLZSRJP7Dg4auVMSti5iIJVxP2eQWimhNy2othoO+xNjtEp7pLEbPVnrkJPwXbqWHqMgEGtLjzOnWNNbdHtWwW9ooLji4OkVUXL7ArFuAcCoTyiqVE9e9DTXTQjkHSCKYKhPo3LpOnSxtp9VTIBWl0NjeFHiFZ3AUjV7qROTBMX4np1QrPVq+10HZbw827PT5VNatZw2z+TLfP/5Cvw6WAB8JU1I1lv5JHLPwCctJ9LWCaG/
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BL0PR1501MB4130.namprd15.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(136003)(346002)(366004)(39860400002)(376002)(230373577357003)(230922051799003)(230473577357003)(186009)(64100799003)(451199024)(1800799012)(55016003)(2906002)(41300700001)(5660300002)(44832011)(66899024)(71200400001)(9686003)(53546011)(26005)(7696005)(6506007)(82960400001)(4326008)(52536014)(38070700009)(8936002)(8676002)(66574015)(15974865002)(83380400001)(33656002)(45080400002)(478600001)(86362001)(76116006)(66556008)(316002)(66946007)(66476007)(64756008)(66446008)(38100700002)(122000001); DIR:OUT; SFP:1101;
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0: iWTkAOv5Xh8alBIsTXBKURHMv5JK8VBfDjp71vsutvBCEgkI8+ek7cc1qOBu1zO3NuMfATcjuGq/lXgKEt99eBDqJjTIrpk6LaVuLx9Ht2cvZkHajBRcelanRSfF5dwzJunFGzAlygVEoUS8nGQLCwi9EaubdefiPQWYT30h6yu67UJd5mVlGNX5NzFJUBI3YtyX/8I5K5EYaFWG7p/J6sv0RNg5hKybeDOZA0ECWNi3yesAij0btkyWpZgw9c1l0lum604tQ47I+NLsbqUjr7VFiy80td2MdFezF5JH4JW4VCLyQ/OI7Dpyf0U4iqnHznecFOyACLh+V1KJynHS/SOyAcXHgrMl7Yi7tG3pkb1DJ8gcW61sOKXFi0/vo8DKuytjBPY8jR4RI2LcfNqdmA0JidkhsCYge9uNGQOpS/QbYQuVhi8wy86JaXHryGROlUDONEzSjZlcG4jv26CDGgrfrsMFSH+AJtolhz5E/FYwmg5U6lmAtvo9fFTrcH9gcp1Evjk29WHh5f7dVQhcbUmDd5hKtGDtpxNhEKEpBreTnmvSx05ulhQ01UgNVHPngjYMauJAkIC8JNq14BKTSP/DpRu7RR/YwhOXqh1VOZxtGlT6QZBlKCkdyDWgh1ZLEr9gc9gPvh+L/aba1LyTsVQL47MMVhz/PLuDO5CkFUClMJGw5TvyxJh3n3xqKS6kg/aQ36Ys5OczyC6bdRrS5uG0tibxGPf1aX1jtYl0u9dDksm+Z8ocURvx5WDJ+4X4ZGEgOVqNcq7xLplXfsRbZwqs8pUfrpMp3oBAoJYWz0ghNmsVprFIlyuutBFlm3pECkRF8lzZPgf0lTYBdF4QWVoNhXfkRw0ywymYML7r/GFvVNna19HD60FgHyRfytiV12XRUt4xxBSGpI0fShagSsMRpMmncY9aWu1xWrn3DHGTOEhREKquErHIiO2K3yzJjwErCGeRy5P7JCVkt8MKc+Hlos3h2AoiiSy5j531YbiN47SB0vyiam9n7UhwYUCx5FPk2C1oLxrl4hxBtV+PpFKvxf46S+xwnjHtUsqkEQez2QLo86/DM0hqr/xdr7SNpKEdoJU7xcM4QM5ax18+pA3rncQkovehKMYa4uJ6FSPNOwlz6TdrYug0BjJwhdGN7atTJm3uHBv1cUPJgqYw6+A721d9cEj29oYdraIJb0l2MeYhPiDxQtTclKf4roKe+ZVH0Z6/nVlXMiy3XHQlyOrSxs8NFsvprmxkmfJRanJspKm6gKAeBlJVCLBB8WmSD6kGOvDV4QxYDpX+FpN9Rwt/z/UsD4UHz4jhCg1XvwaH2JOOnPAD75CPvOp9m7mWjHd5jjCbH3e5kiNoS2ime4CgV9/JRbQNn6WprmY8kPd/xBuxdxMjcRzMfQ2gFrdBjXcf2CXQIwUt84Vx663qC3o85pxMSGDhklhd8/bHuD4jrh9nsMNXguzMi2ysZKKM/aSyzxRawPOZT4dfvpTjr0VL4oRQQl0d2QZbiQ5MiBnV1DUu5unu1iSezkdCMA7/d8HEHlhO2NdK7Pl0s97GouMMEUyO+NOGTQ5iFWxHibo7q4dfxhrhmyA5L7wk0P4mO3dG6jJI6T2T5Yjyzm42hw==
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: ericsson.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: BL0PR1501MB4130.namprd15.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 42b61784-9590-4f83-b003-08dbeb493630
X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Nov 2023 10:53:07.7273 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 92e84ceb-fbfd-47ab-be52-080c6b87953f
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: FYaYPURNVMQ7M3Ho6Z16ZQWREod1r8k0IxlfBkPAVzwAiH3q6azlMm+kr5NfVKcyV/3jYo3JsdWCqyX6N8PFrhWixeB3GATG8oi/NWnGPao=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR15MB5823
Archived-At: <https://mailarchive.ietf.org/arch/msg/yang-doctors/NqK7bKGkbgbSqNmOoIb4_VpbH0o>
Subject: Re: [yang-doctors] canonical order question
X-BeenThere: yang-doctors@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: Email list of the yang-doctors directorate <yang-doctors.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/yang-doctors>, <mailto:yang-doctors-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/yang-doctors/>
List-Post: <mailto:yang-doctors@ietf.org>
List-Help: <mailto:yang-doctors-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/yang-doctors>, <mailto:yang-doctors-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 22 Nov 2023 10:53:16 -0000

Thanks for the context, however I'm talking about body-stmts.

Can body-stmts can be in any order? I don't see anywhere where the ABNF says body-stmts can be in any order.  I see what you mean for import-stmts and linkage-stmts, but those aren't the statements I'm concerned about in my example.

I had the following..
module {
...
   import {
   }
   feature {
   }
   augment {
   }
   notification {
   }
}

That was changed by the --yang-canonical flag to: (notifications were moved above the augment)
module {
...
   import {
   }
   feature {
   }
   notification {
   }
   augment {
   }
}

augment-stmt and notification-stmt are body-stmts.  So I assumed the order in the ABNF in the body-stmts list was the canonical order.  But that is not what pyang --yang-canonical does.

Regards,
-scott.
   

-----Original Message-----
From: Martin Björklund <mbj+ietf@4668.se> 
Sent: Wednesday, November 22, 2023 5:29 AM
To: Scott Mansfield <scott.mansfield@ericsson.com>
Cc: yang-doctors@ietf.org
Subject: Re: [yang-doctors] canonical order question

Hi,

Scott Mansfield <scott.mansfield=40ericsson.com@dmarc.ietf.org> wrote:
> I looked through the mail archive and the pyang issues list on git, so 
> apologies if I missed this...
> 
> However,
> 
> Clause 14 of RFC 7950 says this...
>    body-stmts          = *(extension-stmt /
>                            feature-stmt /
>                            identity-stmt /
>                            typedef-stmt /
>                            grouping-stmt /
>                            data-def-stmt /
>                            augment-stmt /
>                            rpc-stmt /
>                            notification-stmt /
>                            deviation-stmt)
> 
> 
> But when I use pyang and the -yang-canonical switch, the output I get 
> has the notification statements before the augment statements.  Is 
> this ok?  Am I reading the ABNF incorrectly?

RFC 7950 says:

   The ABNF grammar
   [RFC5234] [RFC7405] defines the canonical order.

And then the grammar has for example:

   linkage-stmts       = ;; these stmts can appear in any order
                         *import-stmt
                         *include-stmt

So, the ABNF says that "import" comes before "include" which means that this is the canonical order.

But for body-stmts, the ABNF allows any order of the child statements.  Hence the canonical order also allows any order.


/martin




> 
> I have attached the before and after for information.
> ieee802-dot1q-rstp.yang is the original which has notifications after 
> the augment statement.  I then ran it though pyang with -f yang 
> -yang-canonical and put the result in ieee802-dot1q-rstp-canon.yang, 
> but now the notification statements were moved before the augment.
> Just trying to understand what the canonical order is.
> 
> Many thanks for the help and experience!
> Regards,
> -scott.
> 
> 
> 
> [http://mediabank.ericsson.net/internet-media/Email_logo_Ericsson.png]
> <http://www.ericsson.com/>
> 
> Scott Mansfield
> Principal Researcher Standardization
> 
> BNEW TS ST STA NAM
> Phone: +14692662097
> Mobile: +17249319316
> scott.mansfield@ericsson.com<mailto:scott.mansfield@ericsson.com>
> 
> Ericsson
> ericsson.com<http://www.ericsson.com/>
> 
> [http://mediabank.ericsson.net/internet-media/Email_Message.gif]<http:
> //www.ericsson.com/current_campaign>
> 
> Our commitment to Technology for
> Good<http://www.ericsson.com/thecompany/sustainability-corporaterespon
> sibility>
> and Diversity and
> Inclusion<http://www.ericsson.com/thecompany/diversity-inclusion>
> contributes to positive change.
> Follow us on: 
> Facebook<https://protect2.fireeye.com/v1/url?k=31323334-501d5122-31327
> 3af-454445555731-a4edbadbd57cb477&q=1&e=fcd2c336-306c-4500-97f4-b1c172
> 77193e&u=https%3A%2F%2Fwww.facebook.com%2Fericsson>
> LinkedIn<https://protect2.fireeye.com/v1/url?k=31323334-501d5122-31327
> 3af-454445555731-25461567501c53b8&q=1&e=fcd2c336-306c-4500-97f4-b1c172
> 77193e&u=https%3A%2F%2Fwww.linkedin.com%2Fcompany%2Fericsson>
> Twitter<https://twitter.com/Ericsson>
> 
> Legal entity:ERICSSON INC., registration number2047104, registered 
> office in A Delaware corporation.
> This communication is confidential. Our email terms:
> www.ericsson.com/en/legal/privacy/email-disclaimer<https://www.ericsso
> n.com/en/legal/privacy/email-disclaimer>
>