Re: [netmod] Is this leafref path example valid in YANG 1?

Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de> Fri, 26 August 2016 12:52 UTC

Return-Path: <j.schoenwaelder@jacobs-university.de>
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 A70C512D0AE for <netmod@ietfa.amsl.com>; Fri, 26 Aug 2016 05:52:01 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.748
X-Spam-Level:
X-Spam-Status: No, score=-4.748 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RP_MATCHES_RCVD=-0.548] 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 cbbAiq5zCHlm for <netmod@ietfa.amsl.com>; Fri, 26 Aug 2016 05:51:59 -0700 (PDT)
Received: from atlas3.jacobs-university.de (atlas3.jacobs-university.de [212.201.44.18]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 61D6E12D76E for <netmod@ietf.org>; Fri, 26 Aug 2016 05:50:20 -0700 (PDT)
Received: from localhost (demetrius5.irc-it.jacobs-university.de [10.70.0.222]) by atlas3.jacobs-university.de (Postfix) with ESMTP id 2FC7B35E; Fri, 26 Aug 2016 14:50:19 +0200 (CEST)
X-Virus-Scanned: amavisd-new at jacobs-university.de
Received: from atlas3.jacobs-university.de ([10.70.0.205]) by localhost (demetrius5.jacobs-university.de [10.70.0.222]) (amavisd-new, port 10030) with ESMTP id UOxWx21fs2DY; Fri, 26 Aug 2016 14:49:56 +0200 (CEST)
Received: from hermes.jacobs-university.de (hermes.jacobs-university.de [212.201.44.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "hermes.jacobs-university.de", Issuer "Jacobs University CA - G01" (verified OK)) by atlas3.jacobs-university.de (Postfix) with ESMTPS; Fri, 26 Aug 2016 14:50:18 +0200 (CEST)
Received: from localhost (demetrius4.jacobs-university.de [212.201.44.49]) by hermes.jacobs-university.de (Postfix) with ESMTP id 65B53200A8; Fri, 26 Aug 2016 14:50:18 +0200 (CEST)
X-Virus-Scanned: amavisd-new at jacobs-university.de
Received: from hermes.jacobs-university.de ([212.201.44.23]) by localhost (demetrius4.jacobs-university.de [212.201.44.32]) (amavisd-new, port 10024) with ESMTP id odGU1C0bznNp; Fri, 26 Aug 2016 14:50:17 +0200 (CEST)
Received: from elstar.local (elstar.jacobs.jacobs-university.de [10.50.231.133]) by hermes.jacobs-university.de (Postfix) with ESMTP id 57B80200A3; Fri, 26 Aug 2016 14:50:17 +0200 (CEST)
Received: by elstar.local (Postfix, from userid 501) id 7A5BF3C4EF39; Fri, 26 Aug 2016 14:50:16 +0200 (CEST)
Date: Fri, 26 Aug 2016 14:50:16 +0200
From: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
To: Jernej Tuljak <jernej.tuljak@mg-soft.si>
Message-ID: <20160826125016.GA32908@elstar.local>
Mail-Followup-To: Jernej Tuljak <jernej.tuljak@mg-soft.si>, netmod@ietf.org
References: <062e01d1fd48$82309670$8691c350$@mg-soft.si>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <062e01d1fd48$82309670$8691c350$@mg-soft.si>
User-Agent: Mutt/1.6.0 (2016-04-01)
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/qiGS6tPzuNslzDYYeoQhLLEADDg>
Cc: netmod@ietf.org
Subject: Re: [netmod] Is this leafref path example valid in YANG 1?
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.17
Precedence: list
Reply-To: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
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: Fri, 26 Aug 2016 12:52:01 -0000

On Tue, Aug 23, 2016 at 04:13:23PM +0200, Jernej Tuljak wrote:
> Hi,
> 
> this is a YANG 1, not 1.1 question. 

[...]
 
> Note the "path" expression that is referencing names that do not
> seem to be in b's scope. Is this a valid "path" expression (names
> resolved upon usage) or should all names inside the "grouping" be
> resolved where the "grouping" is defined?

RFC 6020 says in section 7.12:

   The effect of a "uses" reference to a grouping is that the nodes
   defined by the grouping are copied into the current schema tree, and
   then updated according to the "refine" and "augment" statements.

   The identifiers defined in the grouping are not bound to a namespace
   until the contents of the grouping are added to the schema tree via a
   "uses" statement that does not appear inside a "grouping" statement,
   at which point they are bound to the namespace of the current module.

This makes me believe that the uses statement should resolve things
to this:

submodule a {

    belongs-to main {
        prefix "a";
    }
    include b;

    container top {
        leaf top-leaf {
            type string;
        }
        leaf some-leaf {
            type leafref {
                path "/top/top-leaf";
            }
        }
    }
}

Other opinions? The text quoted from RFC 6020 only talks specifically
about identifiers but I would assume that the same late binding applies
to path statement arguments.

/js

-- 
Juergen Schoenwaelder           Jacobs University Bremen gGmbH
Phone: +49 421 200 3587         Campus Ring 1 | 28759 Bremen | Germany
Fax:   +49 421 200 3103         <http://www.jacobs-university.de/>