Re: [yang-doctors] Fwd: Re: Issue with ietf-dslite@2017-11-15.yang and yangdump-pro

Mahesh Jethanandani <mjethanandani@gmail.com> Sun, 24 December 2017 21:55 UTC

Return-Path: <mjethanandani@gmail.com>
X-Original-To: yang-doctors@ietfa.amsl.com
Delivered-To: yang-doctors@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id ECCBA124C27 for <yang-doctors@ietfa.amsl.com>; Sun, 24 Dec 2017 13:55:02 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2
X-Spam-Level:
X-Spam-Status: No, score=-2 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.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 dNI9A5YZE3Hl for <yang-doctors@ietfa.amsl.com>; Sun, 24 Dec 2017 13:55:00 -0800 (PST)
Received: from mail-qt0-x22b.google.com (mail-qt0-x22b.google.com [IPv6:2607:f8b0:400d:c0d::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 1AAD812420B for <yang-doctors@ietf.org>; Sun, 24 Dec 2017 13:55:00 -0800 (PST)
Received: by mail-qt0-x22b.google.com with SMTP id i40so41693659qti.8 for <yang-doctors@ietf.org>; Sun, 24 Dec 2017 13:55:00 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:mime-version:in-reply-to:content-transfer-encoding :message-id:cc:from:subject:date:to; bh=o0MPmYzc77iRmgyJ1pVIxak5y7i7OrSE4v+ocuUK3Mw=; b=ST18/Cs/PDUJY9KI/4tFEbmcXVhuDGy+NAH7l35Wj+YViFKmiXTCEzN8Pkr1XtXpms dIyzUdeKc1Q2oscYlhpRLFbyI+LG8SN8ogkvzA9spb1R+DeZl4UVq+JY3aYH6Cta+7C7 C2FnuIsUZZHlnzDbd3HKT3wqLsnb/Sho7JwUhmC7srM7I5xzn3XG5WwMgtjpfVtFaIjU eklmZN0a0jjZgI+dNHusGI9bvRDrl1x3n1EQn1ESOFEjNn0FiPmRMDLKUmi8MTRY52t0 pCTZZkRvlEMtwKeYsTVWvrZusGtpo1MOKR1YXNbEaqJwr3OU21Nol/1ABHVwSOcI7Q1F Z4zw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:mime-version:in-reply-to :content-transfer-encoding:message-id:cc:from:subject:date:to; bh=o0MPmYzc77iRmgyJ1pVIxak5y7i7OrSE4v+ocuUK3Mw=; b=ixFPN7rrW0NqoE/aVFlDowFzF/Nj2550SmtGahniLJaMuLwUY77LNMzKMg6Un/unj5 dpq7+Y1yCE5wzIPhyKpEssZ96TySYET2HDg27X1GdyVhjgIMeKVJi/RMMm9hNKJZ+CZp v6yh/6F+ZgIo8HPNXemV63AbK1ouODuu0YJxtSfugdAKt6osfgZpKieaSf+m7t0lBMSS U35i4+yJpHRecwOw4uRKytwJbsydgi00ZwYMGq1uSe3dKvLYok/eIeF4hLCBbuPopzsU kvcF5sHKhm7zd5g8tpWoGkCYfDB1grAqn3dXrHRg2wp1Dm/y3OE+TnQEstMFiOmAcQBP +8Og==
X-Gm-Message-State: AKGB3mKEgtvK2gK3CjkYV3Zxzh6cRbkN9WP2BvT+urFpSMrcWPgLT6/K zBFtI9fBbnNGHNqj/Ma57jSHSw==
X-Google-Smtp-Source: ACJfBovKJ4nHDbjzhVCpeGXf4l/J2tXg861Fe5W1OEOHl9Y3dWvvWRhwTkl0w3grTdhY71Bc2w/LGQ==
X-Received: by 10.200.23.221 with SMTP id r29mr29776429qtk.27.1514152498686; Sun, 24 Dec 2017 13:54:58 -0800 (PST)
Received: from [10.10.38.9] ([200.68.8.99]) by smtp.gmail.com with ESMTPSA id l30sm17653969qtb.3.2017.12.24.13.54.55 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 24 Dec 2017 13:54:56 -0800 (PST)
References: <CABCOCHQ7GXs9UsiaP=J3TaQqe9ZPP_C-1aLT1Mcep6SyY-X_wQ@mail.gmail.com> <20171223.130153.578331858878241339.mbj@tail-f.com> <1514034829.13134.15.camel@nic.cz> <20171223.144904.1579202476431827301.mbj@tail-f.com>
Mime-Version: 1.0 (1.0)
In-Reply-To: <20171223.144904.1579202476431827301.mbj@tail-f.com>
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Message-Id: <BDD18302-575A-4E21-BF55-223DBBAFE754@gmail.com>
Cc: lhotka@nic.cz, yang-doctors@ietf.org, mvasko@cesnet.cz
X-Mailer: iPad Mail (13G36)
From: Mahesh Jethanandani <mjethanandani@gmail.com>
Date: Sun, 24 Dec 2017 18:54:50 -0300
To: Martin Bjorklund <mbj@tail-f.com>
Archived-At: <https://mailarchive.ietf.org/arch/msg/yang-doctors/BARDrdOdJCDBJP1O2LsNMVj_F-4>
Subject: Re: [yang-doctors] Fwd: Re: Issue with ietf-dslite@2017-11-15.yang and yangdump-pro
X-BeenThere: yang-doctors@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: Email list of the yang-doctors directorate <yang-doctors.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/yang-doctors>, <mailto:yang-doctors-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/yang-doctors/>
List-Post: <mailto:yang-doctors@ietf.org>
List-Help: <mailto:yang-doctors-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/yang-doctors>, <mailto:yang-doctors-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sun, 24 Dec 2017 21:55:03 -0000


> On Dec 23, 2017, at 10:49 AM, Martin Bjorklund <mbj@tail-f.com> wrote:
> 
> Ladislav Lhotka <lhotka@nic.cz> wrote:
>>> On Sat, 2017-12-23 at 13:01 +0100, Martin Bjorklund wrote:
>>> Andy Bierman <andy@yumaworks.com> wrote:
>>>>> On Sat, Dec 23, 2017 at 2:21 AM, Martin Bjorklund <mbj@tail-f.com> wrote:
>>>>> 
>>>>> Hi,
>>>>> 
>>>>> See section 9.10.3 in RFC 7950:
>>>>> 
>>>>>   The string value of a node of type "identityref" in a "must" or
>>>>>   "when" XPath expression is the referred identity's qualified name
>>>>>   with the prefix present.
>>>>> 
>>>>> and re. the prefix:
>>>>> 
>>>>>   If the referred identity is defined in an
>>>>>   imported module, the prefix in the string value is the prefix defined
>>>>>   in the corresponding "import" statement.  Otherwise, the prefix in
>>>>>   the string value is the prefix for the current module.
>>>>> 
>>>>> 
>>>>> I most cases you should consider using derived-from-or-self instead of
>>>>> equality test for identiyrefs.
>>>> 
>>>> So what is "the current module"?
>>>> What is the resolution of 'X'? Is it foo:X or bar:X?
>>> 
>>> foo:X
>> 
>> No, the resolution of 'X' is 'X'
> 
> Yes!  Sorry, I misread the question.  I though the question was what
> prefix should be used.

The question started with a 'when' statement (which I understand should be changed to 'derived-from') using a identity name that is defined in the other (bar) module. Should the 'derived-from' statement reference the identity using the prefix 'b:X' or just 'X', using Andy's example?

> 
> 
> /martin
> 
> 
>> because it is an XPath 1.0 string and XPath
>> knows nothing about YANG identities. Because of the rule of sec. 9.10.3, the
>> equality expression is always false.
>> 
>> That's why we introduced the new XPath functions derived-from() and derived-
>> from-or-self() in YANG 1.1.
>> 
>> Lada 
>> 
>>> 
>>> 
>>> /martin
>>> 
>>> 
>>>> 
>>>> 
>>>> 
>>>>> 
>>>>> /martin
>>>> 
>>>> Andy
>>>> 
>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> Andy Bierman <andy@yumaworks.com> wrote:
>>>>>>> On Fri, Dec 15, 2017 at 4:38 AM, Radek Krejčí <rkrejci@cesnet.cz> wrote:
>>>>>>> 
>>>>>>> Hi,
>>>>>>> I'm adding Michal Vasko to cc, he knows better how these things are
>>>>>>> checked in libyang.
>>>>>>> 
>>>>>>> It seems to me that Andy refers the text which does not apply here.
>>>>>>> The
>>>>>>> identity name was used as part of XPath expresion (when-stmt), so the
>>>>>>> definition of the context nodes for the when-stmt (RFC 7950, sec
>>>>> 
>>>>> 7.21.5)
>>>>>>> and XPath context rules should apply here. Not the rules for the
>>>>>>> identityref's base statement. In this case, the when-stmt is in
>>>>> 
>>>>> augment so
>>>>>>> the context node (which we also understand as the current node in this
>>>>>>> case) is the augment's target node. And according to XPath context
>>>>> 
>>>>> rules
>>>>>>> (RFC 7950, sec 6.4.1):
>>>>>>> 
>>>>>>> o  Names without a namespace prefix belong to the same namespace as
>>>>> 
>>>>> the
>>>>>>> identifier of the current node.
>>>>>> 
>>>>>> 
>>>>>> I cc:ed YANG doctors to get more opinions...
>>>>>> 
>>>>>> The current node is the augment-stmt.
>>>>>> Note that it does not say context node, which is the target of the
>>>>> 
>>>>> augment.
>>>>>> I think prefixes (and default prefix) are resolved in the module
>>>>> 
>>>>> containing
>>>>>> the statement.
>>>>>> 
>>>>>> 
>>>>>> module foo {
>>>>>> 
>>>>>>   import bar { prefix b; }
>>>>>>   identity X;
>>>>>> 
>>>>>>   augment b:/some-node {
>>>>>>      leaf test {
>>>>>>         type string;
>>>>>>         when "/b:some-node/b:other-node = 'X'";
>>>>>>      }
>>>>>>   }
>>>>>> }
>>>>>> 
>>>>>> module bar {
>>>>>> 
>>>>>>   identity W;
>>>>>>   identity X { base W; }
>>>>>>   container some-node {
>>>>>>       leaf other-node {
>>>>>>         type identityref { base W; }
>>>>>>       }
>>>>>>   }
>>>>>> }
>>>>>> 
>>>>>> Q) Does other-node = 'X' resolve to foo:X or bar:X?  IMO: foo:X
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> Andy
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>> In this particular case, the augment node with the when-stmt augments
>>>>> 
>>>>> the
>>>>>>> same module which defines napt44, so they are in the correct namespace
>>>>> 
>>>>> and
>>>>>>> the identity name can be used without the prefix. So it should be
>>>>>>> fine,
>>>>>>> while I believe that using prefix in the cases of identities is always
>>>>>>> better approach. From the first sight (it may be challenging for human
>>>>> 
>>>>> to
>>>>>>> correctly resolve the context/current node in some cases), I would
>>>>>>> also
>>>>>>> expect prefix.
>>>>>>> 
>>>>>>> I propose to keep the change in the draft (added nat prefix), since it
>>>>>>> improves readability of the expression. But I don't think that it is
>>>>>>> an
>>>>>>> error to ommit the prefix.
>>>>>>> 
>>>>>>> Regards,
>>>>>>> Radek
>>>>>>> 
>>>>>>> 
>>>>>>> Dne 19.11.2017 v 20:42 Benoit Claise napsal(a):
>>>>>>>> Hi Radek,
>>>>>>>> 
>>>>>>>> Here is a bug report for you.
>>>>>>>> 
>>>>>>>> Regards, Benoit
>>>>>>>> 
>>>>>>>> 
>>>>>>>> -------- Forwarded Message --------
>>>>>>>> Subject:      Re: Issue with ietf-dslite@2017-11-15.yang and
>>>>>>> 
>>>>>>> yangdump-pro
>>>>>>>> Date:         Sat, 18 Nov 2017 13:22:58 -0800
>>>>>>>> From:         Andy Bierman <andy@yumaworks.com>
>>>>>>>> To:   Benoit Claise <bclaise@cisco.com>
>>>>>>>> CC:   draft-ietf-softwire-dslite-yang@ietf.org <
>>>>>>> 
>>>>>>> draft-ietf-softwire-dslite-yang@ietf.org>, Mahesh Jethanandani <
>>>>>>> mjethanandani@gmail.com>
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> Hi,
>>>>>>>> 
>>>>>>>> yangdump-pro is correct. Every other compiler missed it...
>>>>>>>> 
>>>>>>>> 9.10.2.  The identityref's "base" Statement
>>>>>>>> 
>>>>>>>>   The "base" statement, which is a substatement to the "type"
>>>>>>>>   statement, MUST be present at least once if the type is
>>>>>>>>   "identityref".  The argument is the name of an identity, as
>>>>> 
>>>>> defined
>>>>>>>>   by an "identity" statement.  If a prefix is present on the
>>>>> 
>>>>> identity
>>>>>>>>   name, it refers to an identity defined in the module that was
>>>>>>>>   imported with that prefix.  *Otherwise, an identity with the
>>>>> 
>>>>> matching
>>>>>>> name MUST be defined in the current module or an included submodule.*
>>>>>>>> 
>>>>>>>> Using ietf-dslite@2017-11-15.yang and ietf-nat@2017-11-15.yang
>>>>>>>> 
>>>>>>>> When I change 'natp44' to 'nat:natp44' in both when-stmts:
>>>>>>>> 
>>>>>>>> andy@andy-homedev:~/Desktop/FD1289/IETF$ yangdump-pro
>>>>>>> 
>>>>>>> ietf-dslite@2017-11-15.yang modpath=.
>>>>>>>> 
>>>>>>>> *** /home/andy/Desktop/FD1289/IETF/ietf-dslite@2017-11-15.yang
>>>>>>>> *** 0 Errors, 0 Warnings
>>>>>>>> 
>>>>>>>> andy@andy-homedev:~/Desktop/FD1289/IETF$
>>>>>>>> 
>>>>>>>> 
>>>>>>>> Andy
>>>>>>>> 
>>>>>>>> 
>>>>>>>> On Sat, Nov 18, 2017 at 11:07 AM, Benoit Claise <bclaise@cisco.com
>>>>>>> 
>>>>>>> <mailto:bclaise@cisco.com>> wrote:
>>>>>>>> 
>>>>>>>>    Hi Andy,
>>>>>>>> 
>>>>>>>>    Can you please have a look at ietf-dslite@2017-11-15.yang at
>>>>>>> 
>>>>>>> http://www.claise.be/IETFYANGPageCompilation.html <
>>>>> 
>>>>> http://www.claise.be/
>>>>>>> IETFYANGPageCompilation.html> .
>>>>>>>>    yangdump-pro reports a new error, while the other validators are
>>>>>>> 
>>>>>>> fine.
>>>>>>>> 
>>>>>>>>    Copying Mahesh, as YANG doctor.
>>>>>>>> 
>>>>>>>>    Regards, Benoit
>>> 
>>> _______________________________________________
>>> yang-doctors mailing list
>>> yang-doctors@ietf.org
>>> https://www.ietf.org/mailman/listinfo/yang-doctors
>> -- 
>> Ladislav Lhotka
>> Head, CZ.NIC Labs
>> PGP Key ID: 0xB8F92B08A9F76C67
> _______________________________________________
> yang-doctors mailing list
> yang-doctors@ietf.org
> https://www.ietf.org/mailman/listinfo/yang-doctors