[netmod] tree diagrams - prefixes

Radek Krejčí <rkrejci@cesnet.cz> Tue, 21 March 2017 13:33 UTC

Return-Path: <rkrejci@cesnet.cz>
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 552C21298BF for <netmod@ietfa.amsl.com>; Tue, 21 Mar 2017 06:33:36 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.301
X-Spam-Level:
X-Spam-Status: No, score=-4.301 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_MED=-2.3, RP_MATCHES_RCVD=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=cesnet.cz
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 WcEtK36Fj89C for <netmod@ietfa.amsl.com>; Tue, 21 Mar 2017 06:33:33 -0700 (PDT)
Received: from office2.cesnet.cz (office2.cesnet.cz [195.113.144.244]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 0E1311298B7 for <netmod@ietf.org>; Tue, 21 Mar 2017 06:33:33 -0700 (PDT)
Received: from [IPv6:2001:67c:1220:80c:921b:eff:fe59:4360] (unknown [IPv6:2001:67c:1220:80c:921b:eff:fe59:4360]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by office2.cesnet.cz (Postfix) with ESMTPSA id E4A5320088 for <netmod@ietf.org>; Tue, 21 Mar 2017 14:33:30 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cesnet.cz; s=office2; t=1490103210; bh=+8hYKaaCJUklR9pRBbF1xoWyNeepTINilpZWLOFHf/Y=; h=From:Subject:To:Date; b=f1KuwkQEJLc+j4ZzfM1fShP+/DhSR2TNW65vyEbkrzR7MGmmzeLPYidznfCpjOx8F IY0VtiPH5jxml+FQ+Ox2wauu49sfsi1JuG7aafp4bE1GnRYZRHbQ4d+H+CUairW0FW +1RJHipWMZ10OuuGnGaxPs6fDELUwtix2VGsOfls=
From: Radek Krejčí <rkrejci@cesnet.cz>
To: "netmod@ietf.org" <netmod@ietf.org>
Message-ID: <abc7a805-440b-9c38-269e-2ea3bcb3ceb6@cesnet.cz>
Date: Tue, 21 Mar 2017 14:32:52 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/D0mnsVNot_b4HpNyUG_WKfZbkHY>
Subject: [netmod] tree diagrams - prefixes
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.22
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: Tue, 21 Mar 2017 13:33:36 -0000

Hi,

I have another note regarding the standardization of tree diagrams - the <prefix> is not clearly defined. pyang --tree-help says:

   <name> is the name of the node
    (<name>) means that the node is a choice node
   :(<name>) means that the node is a case node

   If the node is augmented into the tree from another module, its
   name is printed as <prefix>:<name>.

pyang uses the prefix value from the import statement in the module being printed. This approach can result in confusing output when e.g. module and its submodule import a) same module with different prefixes or b) different modules with a same prefix. However, not even use of the prefix defined in the module itself solve the issue. YANG has no requirement for the module prefixes, so they can repeat in different modules.

The solution I see here, and which is actually already used in JSON encoding of YANG modeled data, is using module names as prefixes. This approach is also implemented in yanglint (there was no standardization of the tree format, so as developers we have decided to slightly modify the format in comparison to what is printed by pyang). The price for the exactness is the width of the output - prefixes used to be shorter than the full module names.

Regards,
Radek