Re: [netmod] tree diagrams - prefixes

Robert Wilton <rwilton@cisco.com> Tue, 21 March 2017 13:52 UTC

Return-Path: <rwilton@cisco.com>
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 55179126DED for <netmod@ietfa.amsl.com>; Tue, 21 Mar 2017 06:52:51 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -14.522
X-Spam-Level:
X-Spam-Status: No, score=-14.522 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_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, USER_IN_DEF_DKIM_WL=-7.5] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=cisco.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 PYSF_o0wtRT9 for <netmod@ietfa.amsl.com>; Tue, 21 Mar 2017 06:52:49 -0700 (PDT)
Received: from aer-iport-2.cisco.com (aer-iport-2.cisco.com [173.38.203.52]) (using TLSv1.2 with cipher DHE-RSA-SEED-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 307DD126DEE for <netmod@ietf.org>; Tue, 21 Mar 2017 06:52:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1999; q=dns/txt; s=iport; t=1490104369; x=1491313969; h=subject:to:references:from:message-id:date:mime-version: in-reply-to:content-transfer-encoding; bh=cZGKb2ilKtQLrpPYWXFgvVhR/OhJiEsF/fPbzn8bEcM=; b=VVPAI4ijS+Mku4nTgIb8Fc9Vd8Z209eyJQOZwDtxfVzp0ZKacKF5H6yX 4IQLF/9v3CQH8ypoyGnwbMnnu0r8HzhDeFegazgptd82OhjgWGm/bfjI+ 5nUWN0pVH2X/2FTIhUh6ffGFurRX263HJgbG6zK2rHbt8RO+n6q2SaiNO 4=;
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A0DoAwDkLtFY/xbLJq1eGQEBAQEBAQEBAQEBBwEBAQEBhDIqYINiihBzkGyVRIIOHwuFLkoCg1EYAQIBAQEBAQEBayiFFgEBAQMBASEECwEFNhsJAhgCAiYCAicwBgEMBgIBAReJaQ6NBZ1bgWw6ilMBAQEBAQEBAQEBAQEBAQEBAQEBAQEYBYELhUOCBYJqh1qCXwEEj12Mc5JGileGVotNiBIfOIEEIxYIFxVBhldANYlBAQEB
X-IronPort-AV: E=Sophos;i="5.36,198,1486425600"; d="scan'208";a="650577660"
Received: from aer-iport-nat.cisco.com (HELO aer-core-2.cisco.com) ([173.38.203.22]) by aer-iport-2.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Mar 2017 13:52:47 +0000
Received: from [10.63.23.130] (dhcp-ensft1-uk-vla370-10-63-23-130.cisco.com [10.63.23.130]) by aer-core-2.cisco.com (8.14.5/8.14.5) with ESMTP id v2LDqkFp009093; Tue, 21 Mar 2017 13:52:47 GMT
To: Radek Krejčí <rkrejci@cesnet.cz>, "netmod@ietf.org" <netmod@ietf.org>
References: <abc7a805-440b-9c38-269e-2ea3bcb3ceb6@cesnet.cz>
From: Robert Wilton <rwilton@cisco.com>
Message-ID: <61bd410a-e600-2b83-57c4-058d999a9447@cisco.com>
Date: Tue, 21 Mar 2017 13:52:46 +0000
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1
MIME-Version: 1.0
In-Reply-To: <abc7a805-440b-9c38-269e-2ea3bcb3ceb6@cesnet.cz>
Content-Type: text/plain; charset="UTF-8"; format="flowed"
Content-Transfer-Encoding: 8bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/7Q1n9sNbWBbDwy7K4utBSHwSr-k>
Subject: Re: [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:52:51 -0000

Hi Radek,

I think that using the full module name might make the lines too long.

Perhaps the tree output could separately list the prefix to module 
mapping, and ensure that the prefix names are unique in the diagram 
(e.g. adding a number to the prefix name if it clashes).

Prefix to module map:
if -> ietf-interfaces
ip -> ietf-ip
ip2 -> ietf-ip @ 2017-03-21
...

where, if no revision number is specified then the import is for any 
revision.

Thanks,
Rob


On 21/03/2017 13:32, Radek Krejčí wrote:
> 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
>
> _______________________________________________
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod
> .
>