Re: [yang-doctors] YANG must statement constraints
Ladislav Lhotka <ladislav.lhotka@nic.cz> Fri, 19 March 2021 15:39 UTC
Return-Path: <ladislav.lhotka@nic.cz>
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 612F63A18B9
for <yang-doctors@ietfa.amsl.com>; Fri, 19 Mar 2021 08:39:38 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7.1
X-Spam-Level:
X-Spam-Status: No, score=-7.1 tagged_above=-999 required=5
tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.001,
RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
URIBL_BLOCKED=0.001] 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 NyYwMU8lE9X5 for <yang-doctors@ietfa.amsl.com>;
Fri, 19 Mar 2021 08:39:36 -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 257F23A18BA
for <yang-doctors@ietf.org>; Fri, 19 Mar 2021 08:39:35 -0700 (PDT)
Received: from [IPv6:2001:1488:fffe:6:a88f:7eff:fed2:45f8] (unknown
[IPv6:2001:1488:fffe:6:a88f:7eff:fed2:45f8])
by mail.nic.cz (Postfix) with ESMTPSA id 7B5E2140A87;
Fri, 19 Mar 2021 16:39:30 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default;
t=1616168370; bh=Aj+C0/efzMeF8CgQT1eJT5kwIXT7/cj5nORgJY2+h/s=;
h=To:From:Date;
b=iNj1XMFn1CYALqJhnqN4ek66XefNf9+lFUwilvU4j83091LHPhN2453+vzv/j9XyG
jtu3pp/ea7yhx9Gj5g8sUw3u+6dyiujms2z4UG0Wnst6ZHulp0VHmdaYrqdtjtdNci
0SxhowFot0Ht9oRsaE4yE/j5SmTlKttBt5qzHDvk=
To: "Acee Lindem (acee)" <acee@cisco.com>, YANG Doctors <yang-doctors@ietf.org>
References: <27FBDC6F-0D23-4D18-9764-42E4F1826952@cisco.com>
<4c68b8ea-dad7-5097-7b31-09045463da5d@nic.cz>
<0CAB260B-C636-440C-913C-234EECC3DA7D@cisco.com>
From: Ladislav Lhotka <ladislav.lhotka@nic.cz>
Organization: CZ.NIC
Message-ID: <104c7fed-ff01-2e66-6da3-b56bbfc87176@nic.cz>
Date: Fri, 19 Mar 2021 16:39:30 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.8.1
MIME-Version: 1.0
In-Reply-To: <0CAB260B-C636-440C-913C-234EECC3DA7D@cisco.com>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-Virus-Scanned: clamav-milter 0.102.2 at mail
X-Virus-Status: Clean
Archived-At: <https://mailarchive.ietf.org/arch/msg/yang-doctors/SAm3HaR9mGJIFjt1ou-tXufgOj4>
Subject: Re: [yang-doctors] YANG must statement constraints
X-BeenThere: yang-doctors@ietf.org
X-Mailman-Version: 2.1.29
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: Fri, 19 Mar 2021 15:39:38 -0000
On 19. 03. 21 16:17, Acee Lindem (acee) wrote:
> Hi Lada,
>
> I guess the corollary would be that:
>
> must "list/non-key-leaf != 42";
>
> Is satisfied if there is at least one list entry with a non-key-leaf other than 42.
Yes.
>
> And,
>
> must not("list/non-key-leaf = 42)";
>
> Requires all leaf entries to have non-key-leaf not equal to 42.
Yes.
>
> What if non-key-leaf is optional and not specified? Would this be equivalent to "!= 42" in the constraint evaluation?
This is another tricky point of XPath. Either of the conditions "= 42"
and "!= 42" is satisfied only if an instance exists and satisfies the
condition. In other words, if no instance exists, then neither of the
two conditions is true.
Lada
>
> Thanks much,
> Acee
>
> On 3/19/21, 11:08 AM, "Ladislav Lhotka" <ladislav.lhotka@nic.cz> wrote:
>
> Hi Acee,
>
> On 19. 03. 21 15:25, Acee Lindem (acee) wrote:
> > When the constraint references a non-key leaf in a list, do all members
> > of the list have to satisfy the constraint or only one of the list entries?
>
> It depends on how the constraint is written.
>
> If you have e.g.
>
> must "list/non-key-leaf = 42";
>
> then it is sufficient that at least one instance on non-key-leaf exist
> with that value. In contrast,
>
> must "not(list/non-key-leaf != 42)";
>
> requires all instances to have that value.
>
> Lada
>
> >
> >
> >
> > Thanks,
> > Acee
> >
> >
> > _______________________________________________
> > 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
>
--
Ladislav Lhotka
Head, CZ.NIC Labs
PGP Key ID: 0xB8F92B08A9F76C67
- [yang-doctors] YANG must statement constraints Acee Lindem (acee)
- Re: [yang-doctors] YANG must statement constraints Ladislav Lhotka
- Re: [yang-doctors] YANG must statement constraints Acee Lindem (acee)
- Re: [yang-doctors] YANG must statement constraints Ladislav Lhotka
- Re: [yang-doctors] YANG must statement constraints Acee Lindem (acee)
- Re: [yang-doctors] YANG must statement constraints Ladislav Lhotka