Re: [netmod] question about unprefixed path in leafref

Ladislav Lhotka <ladislav.lhotka@nic.cz> Thu, 10 February 2022 15:58 UTC

Return-Path: <ladislav.lhotka@nic.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 686393A0C73 for <netmod@ietfa.amsl.com>; Thu, 10 Feb 2022 07:58:14 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.899
X-Spam-Level:
X-Spam-Status: No, score=-1.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=unavailable autolearn_force=no
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 ONBAxTVC4EQo for <netmod@ietfa.amsl.com>; Thu, 10 Feb 2022 07:58:10 -0800 (PST)
Received: from mail.nic.cz (mail.nic.cz [IPv6:2001:1488:800:400::400]) (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 E458D3A0C69 for <netmod@ietf.org>; Thu, 10 Feb 2022 07:58:09 -0800 (PST)
Received: from localhost (unknown [IPv6:2a01:5e0:29:ffff::82e]) by mail.nic.cz (Postfix) with ESMTPSA id 183D3140628; Thu, 10 Feb 2022 16:58:05 +0100 (CET)
From: Ladislav Lhotka <ladislav.lhotka@nic.cz>
To: "Sterne, Jason (Nokia - CA/Ottawa)" <jason.sterne@nokia.com>, Jernej Tuljak <jernej.tuljak@mg-soft.si>, "Fengchong (frank)" <frank.fengchong=40huawei.com@dmarc.ietf.org>, "netmod@ietf.org" <netmod@ietf.org>
In-Reply-To: <DM6PR08MB5084A75FA033B6C10B91B52F9B2F9@DM6PR08MB5084.namprd08.prod.outlook.com>
References: <70d5c82cf41042e28aa71cfd39a147ab@huawei.com> <fd4bdca6-ba49-493a-4d2a-fe70dd3941f6@mg-soft.si> <DM6PR08MB5084A75FA033B6C10B91B52F9B2F9@DM6PR08MB5084.namprd08.prod.outlook.com>
Mail-Followup-To: "Sterne, Jason (Nokia - CA/Ottawa)" <jason.sterne@nokia.com>, Jernej Tuljak <jernej.tuljak@mg-soft.si>, "Fengchong (frank)" <frank.fengchong=40huawei.com@dmarc.ietf.org>, "netmod@ietf.org" <netmod@ietf.org>
Date: Thu, 10 Feb 2022 16:58:03 +0100
Message-ID: <87v8xmd88k.fsf@nic.cz>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-Virus-Scanned: clamav-milter 0.102.4 at mail
X-Virus-Status: Clean
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/Z7uR-lX3eM0_d1WtqghG1g-e5GI>
Subject: Re: [netmod] question about unprefixed path in leafref
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: Thu, 10 Feb 2022 15:58:15 -0000

"Sterne, Jason (Nokia - CA/Ottawa)" <jason.sterne@nokia.com> writes:

> Hi all,
>
> This immediately made me worried about all such xxx-ref constructs in YANG that I've seen in a few modules.
>
> But looking at IETF interfaces https://datatracker.ietf.org/doc/html/rfc8343 I see that this error is avoided because interface-ref is fully qualified right ?
>

RFC 8407, sec 4.2:

   o  The local module prefix SHOULD be used instead of no prefix in all
      path expressions.

This is particularly important for typedefs that are intended to be used in other modules.

Lada

>      typedef interface-ref {
>        type leafref {
>          path "/if:interfaces/if:interface/if:name";
>        }
>        description
>          "This type is used by data models that need to reference
>           interfaces.";
>      }
>
> Jason
>
> From: netmod <netmod-bounces@ietf.org> On Behalf Of Jernej Tuljak
> Sent: Wednesday, February 9, 2022 3:47 AM
> To: Fengchong (frank) <frank.fengchong=40huawei.com@dmarc.ietf.org>; netmod@ietf.org
> Subject: Re: [netmod] question about unprefixed path in leafref
>
>
> On 08/02/2022 03:40, Fengchong (frank) wrote:
> Hi all,
>
> In RFC7950 sec6.4.1 says:
>
>
> o  Names without a namespace prefix belong to the same namespace as
>
>       the identifier of the current node.  Inside a grouping, that
>
>       namespace is affected by where the grouping is used (see
>
>       Section 7.13<https://datatracker.ietf.org/doc/html/rfc7950#section-7.13>).  Inside a typedef, that namespace is affected by
>
>       where the typedef is referenced.  If a typedef is defined and
>
>       referenced within a grouping, the namespace is affected by where
>
>       the grouping is used (see Section 7.13<https://datatracker.ietf.org/doc/html/rfc7950#section-7.13>).
>
> But in module openconfig-aft-network-instance:
>
>   augment "/oc-ni:network-instances/oc-ni:network-instance/" +
>           "oc-ni:afts/oc-ni:next-hops/oc-ni:next-hop/oc-ni:state" {
>
>     description
>       "Add leaves that require referencing of a network instance to the
>       operational state parameters of a next-hop within the AFT for IPv4
>       unicast.";
>
>     uses aft-nexthop-ni-state;
>   }
>
>   grouping aft-nexthop-ni-state {
>     description
>       "Operational state parameters relating to a next-hop which reference a
>       network instance.";
>
>     leaf network-instance {
>       type oc-ni:network-instance-ref;
>       description
>         "The network-instance within which the next-hop should be resolved.
>          When this leaf is unspecified, the next-hop is resolved within
>          the local instance.";
>     }
>   }
>
> The typedef network-instance-ref is defined in module openconfig-network-instance:
>
>   typedef network-instance-ref {
>     type leafref {
>       path "/network-instances/network-instance/config/name";
>     }
>     description
>       "A re-usable type that can be referenced within other
>        modules that references a network instance.";
>   }
>
> The leafref’s path is a unprefixed path.
>
> So, according RFC7950, the typedef network-instance-ref is referenced in leaf network-instance, and the leaf is inside grouping aft-nexthop-ni-state, and this grouping is used in augment "/oc-ni:network-instances/oc-ni:network-instance/" +
>           "oc-ni:afts/oc-ni:next-hops/oc-ni:next-hop/oc-ni:state"
> So the path "/network-instances/network-instance/config/name" ‘s namespace is module openconfig-aft-network-instance’s namespace. But in fact, there is no node called network-instances with namespace: http://openconfig.net/yang/aft/ni.
>
> Is it incorrect?
>
> I try to use pyang to compile it, and no error is reported.
>
> These modules are written in YANG 1.0, therefore RFC6020 applies, not RFC7950. This was one of the cases where RFC6020 was unclear, hence new text you quote from RFC7950. If you change openconfig-network-instance to YANG 1.1, pyang should report an error for that "path" when the "typedef" gets used in openconfig-aft-network-instance.
>
> Jernej
>
>
>
> 本邮件及其附件含有华为公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件!
> This e-mail and its attachments contain confidential information from HUAWEI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!
>
>
>
>
> _______________________________________________
>
> netmod mailing list
>
> netmod@ietf.org<mailto:netmod@ietf.org>
>
> https://www.ietf.org/mailman/listinfo/netmod
>
> _______________________________________________
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod

-- 
Ladislav Lhotka
Head, CZ.NIC Labs
PGP Key ID: 0xB8F92B08A9F76C67