Re: [netmod] [yang-doctors] Clarification needed for YANG 1.1 XPATH context

Ladislav Lhotka <lhotka@nic.cz> Fri, 13 April 2018 15:00 UTC

Return-Path: <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 8F3CB126CC7; Fri, 13 Apr 2018 08:00:52 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7
X-Spam-Level:
X-Spam-Status: No, score=-7 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] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=nic.cz
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 yy3KinkGOBax; Fri, 13 Apr 2018 08:00:49 -0700 (PDT)
Received: from mail.nic.cz (mail.nic.cz [217.31.204.67]) (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 6FFC1124BE8; Fri, 13 Apr 2018 08:00:49 -0700 (PDT)
Received: from birdie (unknown [IPv6:2001:1488:fffe:6:2ca5:7aff:fe82:b795]) by mail.nic.cz (Postfix) with ESMTPSA id 8EF486239C; Fri, 13 Apr 2018 17:00:47 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1523631647; bh=gCcI1ln/CrekLu8r96tV8Bqkiu942srz2pEKoRYDTjU=; h=From:To:Date; b=ViFQRTWeybwamlVX3/gaAG3Y3BGKdLAXkZgXe8eqaVegepP85J29jfQXP+Ex4J4wW f5DRVj1uu46uhrK+91ibJ/Qoh/Wdl5h8A9e1yvx7KblfwGKSPN1p7FtD5DacL7bgsY bAAb76iuVq9v3SVtpYnL5fHylRspCQ0oV8ADQ30k=
Message-ID: <8ebc8e37878820424f70043045fe32c460fa39da.camel@nic.cz>
From: Ladislav Lhotka <lhotka@nic.cz>
To: Radek =?UTF-8?Q?Krej=C4=8D=C3=AD?= <rkrejci@cesnet.cz>, Martin Bjorklund <mbj@tail-f.com>
Cc: FRANK RIMPLER <FRANK.RIMPLER@adtran.com>, YANG Doctors <yang-doctors@ietf.org>, netmod@ietf.org
Date: Fri, 13 Apr 2018 17:00:47 +0200
In-Reply-To: <abdcaa53-c5ce-4815-cf2b-904e6670e89e@cesnet.cz>
References: <f790c7e329684d78bec27a1bfe150d6c@EMEAWP-EXMB12.corp.brocade.com> <20160225.161659.2204602310947308417.mbj@tail-f.com> <cac18b6591244715b79376188fa4c3fe@EMEAWP-EXMB12.corp.brocade.com> <20160225.163105.511576225570588684.mbj@tail-f.com> <abdcaa53-c5ce-4815-cf2b-904e6670e89e@cesnet.cz>
Organization: CZ.NIC
Content-Type: text/plain; charset="UTF-8"
X-Mailer: Evolution 3.28.1
Mime-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Virus-Scanned: clamav-milter 0.99.2 at mail
X-Virus-Status: Clean
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/80R2Ij9RjzZJRYKlQcsJi7QqEkY>
Subject: Re: [netmod] [yang-doctors] Clarification needed for YANG 1.1 XPATH context
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: Fri, 13 Apr 2018 15:00:53 -0000

On Fri, 2018-04-13 at 13:51 +0200, Radek Krejčí wrote:
> Hi,
> I'm refreshing an old thread to clarify specific use case, see below...
> 
> Dne 25.2.2016 v 16:31 Martin Bjorklund napsal(a):
> > William Ivory <wivory@Brocade.com>; wrote:
> > > 
> > > -----Original Message-----
> > > From: Martin Bjorklund [mailto:mbj@tail-f.com] 
> > > Sent: 25 February 2016 15:17
> > > To: William Ivory <wivory@Brocade.com>;
> > > Cc: netmod@ietf.org
> > > Subject: Re: [netmod] Clarification needed for YANG 1.1 XPATH context
> > > 
> > > William Ivory <wivory@Brocade.com>; wrote:
> > > > Hi,
> > > > 
> > > > I'm looking for clarification on the meaning of the following 
> > > > paragraph in section 6.4.1 (XPATH context) in RFC6020bis:
> > > > 
> > > >    'If a node that exists in the accessible tree has a non-presence
> > > >    container as a child, then the non-presence container also exists in
> > > >    the tree.'
> > > > 
> > > > It's unclear to me what this is trying to say, and why - for example, 
> > > > does this mean that I need to validate any 'must' and 'when'
> > > > statements on the child container even when nothing within that child 
> > > > container is configured?
> > > 
> > > must expressions are always evaluated if the node where the must
> > > expression is defined exists, regardless of the number of children
> > > this node has.
> > > 
> > > [wivory] So in my example where the child container (non-presence) has
> > > NO children, then it doesn't exist, and any must statement on it
> > > should not be run.  Only when a non-presence container has a non-zero
> > > number of children should any 'must' statements on that container be
> > > run.
> > > 
> > > [wivory] If that's the case, then would it be correct to say that the
> > > intention of this paragraph is as a reminder that one must evaluate
> > > 'must' statements on nodes that have no inherent meaning and exist
> > > only because they contain child nodes?
> > 
> > No; section 7.5.3 says:
> > 
> >    When a datastore is validated, all "must" constraints are
> >    conceptually evaluated once for each node in the accessible tree (see
> >    Section 6.4.1).
> > 
> > And the quoted paragraph of 6.4.1 says that the NP-container
> > (conceptually) exists if its parent exists - regardless of number of
> > children.
> > 
> > So if the parent exists, any must expressions in the NP-container are
> > evaluated.
> > 
> 
> what about top-level NP-container with must constraint? Is a root node
> something which is always present in accessible tree (even in an empty tree)?
> Intuitively, I believe that it is, so even constraints on top-level NP-
> containers are supposed to be evaluated, but I cannot find something about it
> in RFC.

Yes, this follows already from XPath 1.0 spec, section 5.

Lada

> 
> Regards,
> Radek
> 
> 
> _______________________________________________
> 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