Re: [netmod] false() vs 'false' in 'when' statements
"Sterne, Jason (Nokia - CA/Ottawa)" <jason.sterne@nokia.com> Wed, 08 August 2018 13:45 UTC
Return-Path: <jason.sterne@nokia.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 028CA12F1A2 for <netmod@ietfa.amsl.com>; Wed, 8 Aug 2018 06:45:48 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.911
X-Spam-Level:
X-Spam-Status: No, score=-1.911 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, T_DKIMWL_WL_HIGH=-0.01] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=nokia.onmicrosoft.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 i6u38MHDScYO for <netmod@ietfa.amsl.com>; Wed, 8 Aug 2018 06:45:46 -0700 (PDT)
Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-db5eur03on0721.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0a::721]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id D4B3A1252B7 for <netmod@ietf.org>; Wed, 8 Aug 2018 06:45:45 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.onmicrosoft.com; s=selector1-nokia-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R+t/1Xb00uUT/ZQc/C5muxyqPi4knS5/Y4DSSxIIkpQ=; b=okh0DkfaY+5qCpkUnk36EXPe94UiBzN+NzZAvW0K24ovEMpfVV+bqtdzDumh7jqE5VMN/aKVOKHbRbVvqhtFMoGB7uFwvJ5tQSKOOn+SzSYpuX85K/I0oy541gYNrS6JsZMDJLAzTQQnTg6vPk5skI0SWLwqs8nSW2ogPQaZiXg=
Received: from VI1PR07MB3981.eurprd07.prod.outlook.com (52.134.28.141) by VI1PR07MB1248.eurprd07.prod.outlook.com (10.164.92.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.15; Wed, 8 Aug 2018 13:45:42 +0000
Received: from VI1PR07MB3981.eurprd07.prod.outlook.com ([fe80::dd01:b567:f507:8f07]) by VI1PR07MB3981.eurprd07.prod.outlook.com ([fe80::dd01:b567:f507:8f07%4]) with mapi id 15.20.1038.013; Wed, 8 Aug 2018 13:45:42 +0000
From: "Sterne, Jason (Nokia - CA/Ottawa)" <jason.sterne@nokia.com>
To: "Ivory, William" <william.ivory@intl.att.com>, "netmod@ietf.org" <netmod@ietf.org>
Thread-Topic: [netmod] false() vs 'false' in 'when' statements
Thread-Index: AdQudRPPuaY7IZR/R5mIg6eZugDJwAApuzeAAAB4NKA=
Date: Wed, 08 Aug 2018 13:45:42 +0000
Message-ID: <VI1PR07MB3981F1D3F78AAC3D953CC0069B260@VI1PR07MB3981.eurprd07.prod.outlook.com>
References: <VI1PR07MB3981A0DC1F7069AFC5BE72AD9B270@VI1PR07MB3981.eurprd07.prod.outlook.com> <E3378E0605547F4E854DEE0CB1116AB03A8BA8@gbcdcmbx03.intl.att.com> <VI1PR07MB39813DB16C1AF2314EBD14EE9B260@VI1PR07MB3981.eurprd07.prod.outlook.com>
In-Reply-To: <VI1PR07MB39813DB16C1AF2314EBD14EE9B260@VI1PR07MB3981.eurprd07.prod.outlook.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
authentication-results: spf=none (sender IP is ) smtp.mailfrom=jason.sterne@nokia.com;
x-originating-ip: [135.245.20.4]
x-ms-publictraffictype: Email
x-microsoft-exchange-diagnostics: 1; VI1PR07MB1248; 6:2aepx3dM2BSmuAgYl9qu9lBfpLqmyKu47XXC0CPBx26Dd2QXrmdVPl36mZv/ggTPNYjFF1Ntgo4Q1ZDtI2GzJZZRrVWAaq3FFxQ1ZX/B6kOz5xPX1mCVpviDm0u3/FY1Qdlr6e9SwfZll/nVXk6iqVt39fZ/uPeWhpTGstZNBX4i1vjQC+Dubos9EiL9akv7FjtLArltrrM/p3w5nLCAWx711ws6fdLDOi5hdlAr4D395IeOPd4qYApTwPVfXeMYEfFJRqDVw1REPDUoYftAInrCYpQq0KP299Qwx/Q16LqfNWi3GUtI/VVKJ4UfodsW7hhmx/FujJ91/C9Qi/9OA6iGBqZTVCFFL4cUKDJNvkmWWm5X1RY8zR03XDafMUQx00tTGwNSDWHHBmHqK2ge88xvB5QLm2MB5BKgGYEpEXpNG0/vjCS6ODpp8/j1dNnjp3byNUolV1/VpfPw5NvzyA==; 5:kZlkW30K2KTwsCAeiuKS40wjsuiXURZv9t9JQmTHj4G34Z0VUJ5a/mynIjMbDsM/gl6Tggfcs6DWl9K1x6i4ouk8FdINjuLF/xOjRNO0RDptB8vrUf8ou3UoUd3Fr5AKhebypphg759rMv3+ma+gDLUzz0mQVW1+/BLZHwblJaM=; 7:GjvjbPwevU78qNBjKwNLHYnvNk9gZ+tjbgTjk3nNdlRWFDnlD1CwipVKwFk4BeyYC1Ns2EvKFvuWkhM9Xb/np7ToWy2NHNV1qhaNP1z6TAyCtfLPAtT53XJAlk+0lNAD5fgCq7EbGqK8O0n8stg7MNCQGBULtWoeiJlG6E5Zpz7nZ7p4e4wqmBQijSGorsAhxGtwKLVw60tgygDsyBVq7HkKtpM3t4Qay+OGiLs3kwD+qBK+RFLDovKo/yoEYKP1
x-ms-exchange-antispam-srfa-diagnostics: SOS;
x-ms-office365-filtering-correlation-id: ac534c40-cdbe-4693-1e02-08d5fd353c36
x-ms-office365-filtering-ht: Tenant
x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7193020); SRVR:VI1PR07MB1248;
x-ms-traffictypediagnostic: VI1PR07MB1248:
x-microsoft-antispam-prvs: <VI1PR07MB12482035A9BED811DEAD1E9E9B260@VI1PR07MB1248.eurprd07.prod.outlook.com>
x-exchange-antispam-report-test: UriScan:(82608151540597)(97927398514766)(195916259791689)(788757137089)(109105607167333);
x-ms-exchange-senderadcheck: 1
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(3231311)(11241501184)(806099)(944501410)(52105095)(10201501046)(6055026)(149027)(150027)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:VI1PR07MB1248; BCL:0; PCL:0; RULEID:; SRVR:VI1PR07MB1248;
x-forefront-prvs: 07584EDBCD
x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(346002)(366004)(39860400002)(396003)(136003)(53754006)(13464003)(199004)(189003)(99286004)(97736004)(74316002)(256004)(5250100002)(33656002)(229853002)(2501003)(8936002)(2906002)(25786009)(86362001)(3846002)(5660300001)(6116002)(305945005)(6246003)(55016002)(81156014)(9686003)(2940100002)(76176011)(966005)(81166006)(105586002)(476003)(486006)(446003)(186003)(6306002)(68736007)(106356001)(14454004)(11346002)(53936002)(7736002)(6436002)(26005)(316002)(53546011)(66066001)(110136005)(6506007)(102836004)(7696005)(2900100001)(478600001)(8676002); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR07MB1248; H:VI1PR07MB3981.eurprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1;
received-spf: None (protection.outlook.com: nokia.com does not designate permitted sender hosts)
x-microsoft-antispam-message-info: CCmNtrtpvhvze8Bn+8GJRz3z/LPmo/oM+IVJLzPdCvgficO4pgR22zXHqS53FYCm5yNNLUnS7TcZh4IOiWhYtZRvc63UGF+Cbrt8UGs4fM7qm/8Z7htHxsuDWPWpETIn5IfGuJjtvjM/taYH3AV75aHzRJGDr8qjh7QzU7qwDH/YeDUbhET9gUrqf/C/0W6lZox75stj0fFQjSCLO/OHoxsxMtJvXkl5rcCRc6+CnA42jjfd8ZQXvsjCtbpeFBiH1sUGiywxs69LoOmYkEwPccGEki27WSPTI4PM5UhTSBOW/MAXe/ghrEes9PDmNia/5mLMdmFd+Tv+FVAPwtRnVX8kF5VkLdI+x45G+q6TW5ob+VtSnyicZKbkQZW54uAW5Cfvb0rOcCHgCo2rhF++kw==
spamdiagnosticoutput: 1:99
spamdiagnosticmetadata: NSPM
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: nokia.com
X-MS-Exchange-CrossTenant-Network-Message-Id: ac534c40-cdbe-4693-1e02-08d5fd353c36
X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Aug 2018 13:45:42.7426 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 5d471751-9675-428d-917b-70f44f9630b0
X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR07MB1248
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/vLYWz_WanAcxRnnn5kt-J6Dwph0>
Subject: Re: [netmod] false() vs 'false' in 'when' statements
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.27
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: Wed, 08 Aug 2018 13:45:48 -0000
What I'm also a little worried about is whether when "../a = true()" is actually checking the *existence* of leaf a. In other words, could that expression be evaluated as enabling the when whether leaf a is set to 'true' or if it is set to 'false' ? In either case it has a value and exists. Jason > -----Original Message----- > From: Sterne, Jason (Nokia - CA/Ottawa) > Sent: Wednesday, August 8, 2018 9:37 AM > To: 'Ivory, William' <william.ivory@intl.att.com>; netmod@ietf.org > Subject: RE: [netmod] false() vs 'false' in 'when' statements > > Thanks William. > Please see below. > Regards, > Jason > > > -----Original Message----- > > From: Ivory, William <william.ivory@intl.att.com> > > Sent: Wednesday, August 8, 2018 3:27 AM > > To: Sterne, Jason (Nokia - CA/Ottawa) <jason.sterne@nokia.com>; > > netmod@ietf.org > > Subject: Re: [netmod] false() vs 'false' in 'when' statements > > > > On 07/08/18 18:37, Sterne, Jason (Nokia - CA/Ottawa) wrote: > > Hi all, > > > > When comparing the value of a boolean leaf in a 'when' statement (or a 'must' > > statement), is an equality comparison to 'true' or 'false' the same as a check > > against true() or false() ? > > > > For example: > > > > leaf a { > > type boolean; > > } > > leaf b { > > type uint32; > > when ".../a = 'true'"; > > } > > leaf c { > > type uint32; > > when ".../a = 'false'"; > > } > > (note that neither b nor c can be configured if leaf a isn't explicitly configured > > with a value since there is no default) > > > > If I replace the two 'when' statements above with the following instead, is the > > behavior the same ? > > ... > > when ".../a = true()"; > > ... > > when ".../a = false()"; > > ... > > > > Or does "../a = true()" behave as an existence check on leaf a and would be > > enabled whether a is configured as true or false ? > > > > Regards, > > Jason > > > > > > > > See https://www.w3.org/TR/1999/REC-xpath-19991116/#booleans > > > > (a) "../a = 'true'" > > > > Compares 'string-value' (same as value of node if a leaf, rather more > > interesting if a list / container!) of each node in nodeset generated by '../a' > and > > if any node in the nodeset matches 'true', expression is true. > > [>>JTS: ] In my specific example, leaf a is a single Boolean leaf. In that case, are > these equivalent ? > when ".../a = 'true'"; > when ".../a = true()"; > and are these also equivalent ? > when ".../a = 'false'"; > when ".../a = false()"; > (sorry if I'm being dense here, but I'm not 100% positive if I'm interpreting your > explanations correctly and getting the right conclusion. I've never seen must or > when statements that use = false() or = true()). > > [>>JTS: ] Are the strings 'true' and 'false' the "string-value" (that you mention > above) for a Boolean leaf ? > 'a' is a single Boolean leaf so the nodeset is that single leaf and the value is > 'true' or 'false'. > > > > > (b) "../a = true()" > > > > Similar to above but after getting the string-value, this is converted to a > > boolean before comparing with the boolean true. > > [>>JTS: ] I'm a bit confused here. Are you saying that the string-value of leaf a is > converted to a Boolean ? > Do the string-values of a convert to something that is equal to true() or false() ? > > > > > (c) '../a' > > > > True if the nodeset generated by this expression is not empty. > > > > --- > > > > Caveats alluded to above are that if '../a' matches multiple nodes, then only > > one of these nodes needs to pass the test for the test to be true. Separately, > if > > any of the nodes are not leaves, the 'string-value' is a concatenated string of > > the values of the node's child / grandchild leaves. > > > > Hope that helps. You wouldn't believe the number of unit tests I have to > make > > sure we get this logic right! Using '!=' when comparing a nodeset with >1 > node > > with other values is very likely not to give the answer you expect (-: > > > > Regards, > > > > William > >
- [netmod] false() vs 'false' in 'when' statements Sterne, Jason (Nokia - CA/Ottawa)
- Re: [netmod] false() vs 'false' in 'when' stateme… Ivory, William
- Re: [netmod] false() vs 'false' in 'when' stateme… Sterne, Jason (Nokia - CA/Ottawa)
- Re: [netmod] false() vs 'false' in 'when' stateme… Sterne, Jason (Nokia - CA/Ottawa)
- Re: [netmod] false() vs 'false' in 'when' stateme… Martin Bjorklund
- Re: [netmod] false() vs 'false' in 'when' stateme… Andy Bierman
- Re: [netmod] false() vs 'false' in 'when' stateme… Martin Bjorklund
- Re: [netmod] false() vs 'false' in 'when' stateme… Andy Bierman
- Re: [netmod] false() vs 'false' in 'when' stateme… Martin Bjorklund