Re: [yang-doctors] canonical order question

Martin Björklund <mbj+ietf@4668.se> Wed, 22 November 2023 11:01 UTC

Return-Path: <mbj+ietf@4668.se>
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 08904C14CE4D for <yang-doctors@ietfa.amsl.com>; Wed, 22 Nov 2023 03:01:13 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7.106
X-Spam-Level:
X-Spam-Status: No, score=-7.106 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=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=4668.se header.b="KTQPVhj8"; dkim=pass (2048-bit key) header.d=messagingengine.com header.b="aAqWF+1Y"
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 xL62ZfDdfzcq for <yang-doctors@ietfa.amsl.com>; Wed, 22 Nov 2023 03:01:07 -0800 (PST)
Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 71FA1C14CE2F for <yang-doctors@ietf.org>; Wed, 22 Nov 2023 03:01:07 -0800 (PST)
Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 67B735C01F2; Wed, 22 Nov 2023 06:01:06 -0500 (EST)
Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 22 Nov 2023 06:01:06 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=4668.se; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm3; t= 1700650866; x=1700737266; bh=Nvt0SRMSMzMStsEmDlqhUu9SQkh/fmgmlRe 9NypW0/o=; b=KTQPVhj8P8Qnuq90Bny3dkyLybpgqFrGUJwtCUijJMc+fqVsDZv z38FQQZp7O54eBWD8LSJacPuGZ/dOaw3TOn7+VgJg3oBehQOe7ELjjeGH/83b8Qg M572HtEpi9KD08NBfNGd2wuTBcQrTC55aTRuJgoufZH14Px9sXC2l4WUzMmd3hnp 1z5hDhzbI/Aoeswg5rXWXLjbSzJ6Ko5DfISAUoMSk1NPrhSQWBI5SyWD4KPFyfJ/ cexEaVMhxGtj0B8lyvEc/TvvtnHqiygYKfFsx/h/DAs0PcZD691zH4HfIlL4HgLf KqPO2s1jujH6S3WBP9UHon2mORF5PMiDzSg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1700650866; x=1700737266; bh=Nvt0SRMSMzMStsEmDlqhUu9SQkh/fmgmlRe 9NypW0/o=; b=aAqWF+1Y7pz8EOiHM102wknTgLLrLhPhsWQupAJ5Zkc9obU8eZY 3THEjfZgLdjCxkJwyuXA9/qAEw52UuIsZY+B3O0IXGDxigLCbF2XVm6w3SWtWb0/ /WY4Jt+GjF0h6prx7ulnj+hag0kuTUe32OPSRSI0rEzhnNhwzxVybjI7dCZJ467L qIPgH1VgZauBypZPKbAj7/ZBLCEhVxFDu6SstlkHwkVeuicQjmRvW8oCofgunSS5 9D+NK76Gf5ctqy6fbmmhW9APS0Hsgtd3CAo+05SOjarHGW2oA6ENpl+tHpYWGivN BkZy76X9jCk3/mga7xv/703tq77fqyN9gVQ==
X-ME-Sender: <xms:ct9dZbxRGDTEbuuyxH-5uhGH9Fghm01Ctjk-6e8Pvap1Fva-b6ydaA> <xme:ct9dZTTRD7Ftxu8wuZIqqUBP9d3QOsFwc0k9mfVYgutI72P_QmfZDhOn47vWyRDlX Sg1lMevYZE501MQDPQ>
X-ME-Received: <xmr:ct9dZVUjAYXv4XQqZgJ7ypEzOMaIIsKOd3-cb9jGek6XkvfcBKOcj7OkG70WWj-WrEDJG9C_4mREweBJH9KPfUBQLpjSoC2uuw>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudehuddgvdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffkffvvefuhfgjfhfogggtgfesth hqredtredtudenucfhrhhomhepofgrrhhtihhnuceujhpnrhhklhhunhguuceomhgsjhdo ihgvthhfseegieeikedrshgvqeenucggtffrrghtthgvrhhnpeduueetieeggffgfeelfe eugeelvdefveehjeelieffgeejieehteevffefhffgtdenucffohhmrghinhepvghrihgt shhsohhnrdhnvghtpdgvrhhitghsshhonhdrtghomhdpfhhirhgvvgihvgdrtghomhdpfh grtggvsghoohhkrdgtohhmpdhlihhnkhgvughinhdrtghomhdpthifihhtthgvrhdrtgho mhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmsg hjodhivghtfhesgeeiieekrdhsvg
X-ME-Proxy: <xmx:ct9dZVjVeTS15H9MO-xRfaKFakQs4OEV6aUr66qd6qmOKPtOAN3UbA> <xmx:ct9dZdCq8Aaz8jzB-EqAu4leozUjr-hziGI9BaBLwwv0bfz1piLYWA> <xmx:ct9dZeI2loa5fpSOnyLD67SMBGy_cN__wF51rTfGSkMExoq_3PWY3g> <xmx:ct9dZQp2reiEuh6mhXu_IGQTXSn1F1k6OyQfacRN4SsYkzvd8sk7yQ>
Feedback-ID: icc614784:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 22 Nov 2023 06:01:05 -0500 (EST)
Date: Wed, 22 Nov 2023 12:01:04 +0100
Message-Id: <20231122.120104.1462991385960482989.id@4668.se>
To: scott.mansfield@ericsson.com
Cc: yang-doctors@ietf.org
From: Martin Björklund <mbj+ietf@4668.se>
In-Reply-To: <BL0PR1501MB4130AC63689E98D4173CBBD68BBAA@BL0PR1501MB4130.namprd15.prod.outlook.com>
References: <BL0PR1501MB4130AB9909CDAF5AD4328E728BBAA@BL0PR1501MB4130.namprd15.prod.outlook.com> <20231122.112925.1904227441461262662.id@4668.se> <BL0PR1501MB4130AC63689E98D4173CBBD68BBAA@BL0PR1501MB4130.namprd15.prod.outlook.com>
X-Mailer: Mew version 6.8 on Emacs 27.1
Mime-Version: 1.0
Content-Type: Text/Plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/yang-doctors/vV3trkBa3UdVjgAA_gdKfH1Z-kI>
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 11:01:13 -0000

Scott Mansfield <scott.mansfield@ericsson.com> wrote:
> Thanks for the context, however I'm talking about body-stmts.

I know, please see my reply:

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


[Note that *(A / B) means any number of A or B in any order]


/martin




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