Re: [netmod] YANG 'when' with absolute path
Michal Vaško <mvasko@cesnet.cz> Tue, 18 January 2022 07:07 UTC
Return-Path: <mvasko@cesnet.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 692153A0A97 for <netmod@ietfa.amsl.com>; Mon, 17 Jan 2022 23:07:32 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.098
X-Spam-Level:
X-Spam-Status: No, score=-2.098 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, RCVD_IN_DNSWL_BLOCKED=0.001, 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=cesnet.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 lWMe8kuB3x5z for <netmod@ietfa.amsl.com>; Mon, 17 Jan 2022 23:07:27 -0800 (PST)
Received: from kalendar.cesnet.cz (kalendar.cesnet.cz [IPv6:2001:718:1:1f:50:56ff:feee:34]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 594EE3A0A93 for <netmod@ietf.org>; Mon, 17 Jan 2022 23:07:26 -0800 (PST)
Received: by kalendar.cesnet.cz (Postfix, from userid 110) id 202DE60068; Tue, 18 Jan 2022 08:07:21 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cesnet.cz; s=kalendar; t=1642489641; bh=MYJbgmH2sawWQi3PnC0/dTVhYGL5gAMg4UQOP4sVn/c=; h=From:In-Reply-To:Date:Cc:To:Subject; b=UTPb5e94tN2F3OUmDL7w/lgyH04ucuSWkyB0Zt34RUzO5CPhWhxhY41h+Ugy/CRW0 NqpvPAdMvYoTnXMzm58IWpT1QF3c3KPaxMSOgYPJENtvxRG5ozNAQ2grCVh9s6W039 TYkQGu59l/zrUNc94XqKTaaTb6636ByPfLUPVltI=
From: Michal Vaško <mvasko@cesnet.cz>
In-Reply-To: <010ba32d4f934498be4a032b864a65bc@huawei.com>
Content-Type: text/plain; charset="utf-8"
X-Forward: 2001:67c:1220:80c:b5:55d3:81d5:8636
Date: Tue, 18 Jan 2022 08:07:21 +0100
Cc: Ladislav Lhotka <ladislav.lhotka@nic.cz>, Martin Björklund <mbj+ietf@4668.se>, "netmod@ietf.org" <netmod@ietf.org>
To: Italo Busi <Italo.Busi=40huawei.com@dmarc.ietf.org>
MIME-Version: 1.0
Message-ID: <49b-61e66700-61-555dec00@38936218>
User-Agent: SOGoMail 5.4.0
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/gpQHv7luBY5733YDYZmNYibUBiE>
Subject: Re: [netmod] YANG 'when' with absolute path
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.29
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: Tue, 18 Jan 2022 07:07:33 -0000
Hi, yanglint uses its own XPath implementation, which unfortunately does not support axes, hence the error. Regards, Michal On Monday, January 17, 2022 16:59 CET, Italo Busi <Italo.Busi=40huawei.com@dmarc.ietf.org> wrote: > Lada, Martin, > > Thanks for your suggestion and thanks Tom for having raised this issue to Netmod WG > > We have tried to follow your suggestion and replaced the relative paths with: > when "ancestor::nw:network/nw:network-types/tet:te-topology" > > You can find the updated YANG module on github: > > https://github.com/ietf-ccamp-wg/draft-ietf-ccamp-flexigrid-yang/tree/wg-lc-resolution > > However, we have found some issues when compiling the new code with yanglint. This is the error that we have got from the on-line YANG validator: > > libyang err : Invalid character 'a'[1] of expression 'ancestor::nw:network/nw:network-types/tet:te-topology/flexgt:flexi-grid-topology'. (/ietf-flexi-grid-topology:{augment='/nw:networks/nw:network/nt:link/tet:te/tet:te-link-attributes/tet:underlay/tet:primary-path/tet:path-element/tet:type/tet:label/tet:label-hop/tet:te-label/tet:technology'}) > YANGLINT[E]: Processing schema module from /var/yang/tmp/yangvalidator/yangvalidator-v2-workdir-tNQJZOjI/ietf-flexi-grid-topology.yang failed. > > Is this an issue with yanglint or with the updated code? > > Pyang compilation does not return any error/warning > > Thanks in advance > > Aihua, Sergio and Italo > > > -----Original Message----- > > From: Ladislav Lhotka [mailto:ladislav.lhotka@nic.cz] > > Sent: domenica 2 gennaio 2022 10:58 > > To: Martin Björklund <mbj+ietf@4668.se> > > Cc: cabo@tzi.org; netmod@ietf.org > > Subject: Re: [netmod] YANG 'when' with absolute path > > > > > > > > On 02. 01. 22 10:43, Martin Björklund wrote: > > > Hi, > > > > > > Ladislav Lhotka <ladislav.lhotka@nic.cz<mailto:ladislav.lhotka@nic.cz>> wrote: > > >> Carsten Bormann <cabo@tzi.org<mailto:cabo@tzi.org>> writes: > > >> > > >>> On 2021-12-30, at 13:29, tom petch <ietfc@btconnect.com<mailto:ietfc@btconnect.com>> wrote: > > >>>> > > >>>> when "../../../../../../nw:network-types/tet:te-topology/“ > > >>> > > >>> I’m probably showing my ignorance about YANG again, but what is the > > >>> reason this is not phrased as > > >>> > > >>> when "./ancestor::nw:network-types/tet:te-topology/“ > > >> > > >> Yes, this would work, with a minor correction: > > >> > > >> when "./ancestor::node()/nw:network-types/tet:te-topology" > > >> > > >> because 'nw:network-types' isn't an ancestor of the context node. > > >> Also, the initial './' isn't actually needed, hence > > >> > > >> when "ancestor::node()/nw:network-types/tet:te-topology" > > > > > > Or the more direct: > > > > > > when "ancestor::nw:network/nw:network-types/tet:te-topology" > > > > Right, this is the best option. > > > > > > > > This style works if we can guarantee that there will be exactly one > > > node "nw:network" among our ancestors. > > > > > > It is perhaps easier to get this style right w/o a YANG compiler > > > (which would detect if the number of ".." in the relative path is > > > wrong), but the relative path might be easier to understand for a > > > casual reader. > > > > +1 > > > > Lada > > > > > > > > > > > > > > /martin > > > > > > > > > > > >> > > >> Lada > > >> > > >>> > > >>> ? > > >>> > > >>> Grüße, Carsten > > >>> > > >>> _______________________________________________ > > >>> netmod mailing list > > >>> netmod@ietf.org<mailto:netmod@ietf.org> > > >>> https://www.ietf.org/mailman/listinfo/netmod > > >> > > >> -- > > >> Ladislav Lhotka > > >> Head, CZ.NIC Labs > > >> PGP Key ID: 0xB8F92B08A9F76C67 > > >> > > >> _______________________________________________ > > >> netmod mailing list > > >> netmod@ietf.org<mailto:netmod@ietf.org> > > >> https://www.ietf.org/mailman/listinfo/netmod > > > > -- > > Ladislav Lhotka > > Head, CZ.NIC Labs > > PGP Key ID: 0xB8F92B08A9F76C67 > > > >
- [netmod] YANG 'when' with absolute path tom petch
- Re: [netmod] YANG 'when' with absolute path Martin Björklund
- Re: [netmod] YANG 'when' with absolute path tom petch
- Re: [netmod] YANG 'when' with absolute path Carsten Bormann
- Re: [netmod] YANG 'when' with absolute path Ladislav Lhotka
- Re: [netmod] YANG 'when' with absolute path Andy Bierman
- Re: [netmod] YANG 'when' with absolute path Ladislav Lhotka
- Re: [netmod] YANG 'when' with absolute path Carsten Bormann
- Re: [netmod] YANG 'when' with absolute path Andy Bierman
- Re: [netmod] YANG 'when' with absolute path Martin Björklund
- Re: [netmod] YANG 'when' with absolute path Ladislav Lhotka
- Re: [netmod] YANG 'when' with absolute path Italo Busi
- Re: [netmod] YANG 'when' with absolute path Michal Vaško
- Re: [netmod] YANG 'when' with absolute path Italo Busi
- Re: [netmod] YANG 'when' with absolute path Robert Varga
- Re: [netmod] [yang-doctors] YANG 'when' with abso… Ladislav Lhotka
- Re: [netmod] [yang-doctors] YANG 'when' with abso… Jan Lindblad
- Re: [netmod] [yang-doctors] YANG 'when' with abso… Ladislav Lhotka
- Re: [netmod] [yang-doctors] YANG 'when' with abso… Jan Lindblad
- Re: [netmod] [yang-doctors] YANG 'when' with abso… Ladislav Lhotka
- Re: [netmod] [yang-doctors] YANG 'when' with abso… Andy Bierman
- Re: [netmod] [yang-doctors] YANG 'when' with abso… tom petch