[netmod] question about unprefixed path in leafref

"Fengchong (frank)" <frank.fengchong@huawei.com> Tue, 08 February 2022 02:40 UTC

Return-Path: <frank.fengchong@huawei.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 0C6B63A119D for <netmod@ietfa.amsl.com>; Mon, 7 Feb 2022 18:40:56 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.895
X-Spam-Level:
X-Spam-Status: No, score=-1.895 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_BLOCKED=0.001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham 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 IWPvkM4XRnPp for <netmod@ietfa.amsl.com>; Mon, 7 Feb 2022 18:40:52 -0800 (PST)
Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id B13023A1194 for <netmod@ietf.org>; Mon, 7 Feb 2022 18:40:51 -0800 (PST)
Received: from fraeml743-chm.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Jt6ZG0wZZz67MP9 for <netmod@ietf.org>; Tue, 8 Feb 2022 10:35:50 +0800 (CST)
Received: from dggpemm500002.china.huawei.com (7.185.36.229) by fraeml743-chm.china.huawei.com (10.206.15.224) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Tue, 8 Feb 2022 03:40:48 +0100
Received: from dggpemm500003.china.huawei.com (7.185.36.56) by dggpemm500002.china.huawei.com (7.185.36.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Tue, 8 Feb 2022 10:40:46 +0800
Received: from dggpemm500003.china.huawei.com ([7.185.36.56]) by dggpemm500003.china.huawei.com ([7.185.36.56]) with mapi id 15.01.2308.021; Tue, 8 Feb 2022 10:40:46 +0800
From: "Fengchong (frank)" <frank.fengchong@huawei.com>
To: "netmod@ietf.org" <netmod@ietf.org>
Thread-Topic: question about unprefixed path in leafref
Thread-Index: Adgck9MwG/qknU6FTZy7nQGK6GtDkg==
Date: Tue, 08 Feb 2022 02:40:46 +0000
Message-ID: <70d5c82cf41042e28aa71cfd39a147ab@huawei.com>
Accept-Language: zh-CN, en-US
Content-Language: zh-CN
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [10.136.113.80]
Content-Type: multipart/alternative; boundary="_000_70d5c82cf41042e28aa71cfd39a147abhuaweicom_"
MIME-Version: 1.0
X-CFilter-Loop: Reflected
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/JSCSlCDoOJGrbHaNtlrmhD1u52c>
Subject: [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: Tue, 08 Feb 2022 02:40:56 -0000

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.

本邮件及其附件含有华为公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件!
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!