Re: [netmod] definition of "fully expanded YANG"

Robert Varga <nite@hq.sk> Wed, 17 July 2019 14:32 UTC

Return-Path: <nite@hq.sk>
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 DC22F120409 for <netmod@ietfa.amsl.com>; Wed, 17 Jul 2019 07:32:27 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.998
X-Spam-Level:
X-Spam-Status: No, score=-1.998 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=hq.sk
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 XM5jEckHS5Rj for <netmod@ietfa.amsl.com>; Wed, 17 Jul 2019 07:32:25 -0700 (PDT)
Received: from mail.hq.sk (hq.sk [81.89.59.181]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 60B241205D7 for <netmod@ietf.org>; Wed, 17 Jul 2019 07:32:25 -0700 (PDT)
Received: from nitebug.nitenet.local (46.229.239.158.host.vnet.sk [46.229.239.158]) by mail.hq.sk (Postfix) with ESMTPSA id 3C299243F98; Wed, 17 Jul 2019 16:32:22 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=hq.sk; s=mail; t=1563373942; bh=F3rkqQNaM9kyD9Fo7Yi6cfPvzoe9NhTdznhROgt8sTw=; h=Subject:To:References:From:Date:In-Reply-To; b=WIyBd0nqnIK48KupxnYUhwyAOh2mqF8j0eMYrhXRRRGSO3f4VCtuBxi6hiN5wU3/A lklalv3cMw3dpdru0rKKNIR0tlA216kI1v28eBxpGS/JrE1FDC1T72EKWJ99qhzhfn WH6v08YfweGl1IctpWf1+8DvBfAPJ+kUTiSP09os=
To: Michael Rehder <Michael.Rehder@Amdocs.com>, "netmod@ietf.org" <netmod@ietf.org>
References: <AM0PR06MB40833B02760A889E273D8278E7C90@AM0PR06MB4083.eurprd06.prod.outlook.com> <20190717131035.5rseucu3foys6veb@anna.jacobs.jacobs-university.de> <AM0PR06MB408317206939E4BE8219C4A8E7C90@AM0PR06MB4083.eurprd06.prod.outlook.com> <20190717135414.qqvobxqcnta6lghy@anna.jacobs.jacobs-university.de>
From: Robert Varga <nite@hq.sk>
Openpgp: preference=signencrypt
Message-ID: <1ef4785d-5cab-ff62-b8fb-ed64c876e437@hq.sk>
Date: Wed, 17 Jul 2019 16:32:14 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2
MIME-Version: 1.0
In-Reply-To: <20190717135414.qqvobxqcnta6lghy@anna.jacobs.jacobs-university.de>
Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="QqenCvsxKvy7dXcXKFETMJQhYUSH3N476"
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/RQA_3Shv9lSLX-ED9HpwrBs2VKI>
Subject: Re: [netmod] definition of "fully expanded YANG"
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, 17 Jul 2019 14:32:28 -0000

On 17/07/2019 15:54, Juergen Schoenwaelder wrote:
> On Wed, Jul 17, 2019 at 01:18:57PM +0000, Michael Rehder wrote:
>> Yes, inlining of everything, including augments. What you'd see in the tree representation.
>> For example augments makes it particularly impossible for a consumer of the YANG schema to process the schema since the final result.
>>
>> Some use cases:
>> - translating to another schema language
>> - translating to a UI dialog for data entry
>> - an accurate diff on versions
>>
>> Model-driven-design means using the "computable specification" for all sorts of things, increasing the ROI of the schema definition.
> 
> It sounds to me like you are interested in what compiler people call
> the abstract syntax tree, which is quite a different thing than the
> YANG module you start with. The easiest and most robust way to do
> translations is likely to simply expand pyang (or any other compiler
> of choice).

Depends on how you define the AST (and how many different ASTs are in
your compiler), as .yang file has an AST itself, which you then
cross-reference between modules/submodules, and you arrive at some IR,
from which you derive the effective model with whatever indices/details
your use case requires.

This is certainly possible with OpenDaylight tooling, i.e. arrive at
https://github.com/opendaylight/yangtools/blob/master/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/EffectiveModelContext.java,
which gives you a per-module tree of statements with all RFC7950
semantic processing applied. It also contains some generally-useful
indices (like schema tree/data tree traversal) as well as references to
original statement declaration (i.e. as it appeared in .yang file, if
applicable).

Regards,
Robert