Re: [netmod] validating instance data against YANG schema including 'must' statements

Ladislav Lhotka <lhotka@nic.cz> Fri, 13 December 2019 07:58 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 111D51200F7 for <netmod@ietfa.amsl.com>; Thu, 12 Dec 2019 23:58:58 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.997
X-Spam-Level:
X-Spam-Status: No, score=-6.997 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, SPF_HELO_NONE=0.001, SPF_NONE=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 Hbl5D-JzgzmH for <netmod@ietfa.amsl.com>; Thu, 12 Dec 2019 23:58:56 -0800 (PST)
Received: from mail.nic.cz (mail.nic.cz [IPv6:2001:1488:800:400::400]) (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 A07A11200EF for <netmod@ietf.org>; Thu, 12 Dec 2019 23:58:54 -0800 (PST)
Received: from birdie (unknown [IPv6:2001:1488:fffe:6:a744:2697:a0ec:a420]) by mail.nic.cz (Postfix) with ESMTPSA id 74A10140D18 for <netmod@ietf.org>; Fri, 13 Dec 2019 08:58:52 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1576223932; bh=eNW8s6RLzBGZyO/izvbqt4/WY+Sqg316nqBT7Beo14I=; h=From:To:Date; b=dGar8CdhaEUkWJXhBjMCzOLoyXUaMt5nlcWyFVw0TJd4lSQuEsHWvnjrhQCW92roe kjzgwT2tnmmw8NFhhgH8PQjFWfJODFvh8gsEAgW9c9m20shqyFCxANR2fjMziVHwAa MA9KnuZO2BzAACL25gemT62DBhcPqG4oy0L3g/YI=
Message-ID: <ca9cdf86c50f0980caa479bf2621ff0f9bfc0941.camel@nic.cz>
From: Ladislav Lhotka <lhotka@nic.cz>
To: netmod@ietf.org
Date: Fri, 13 Dec 2019 08:58:52 +0100
In-Reply-To: <VI1PR07MB3981BBE54D2E235648758C209B550@VI1PR07MB3981.eurprd07.prod.outlook.com>
References: <VI1PR07MB3981BBE54D2E235648758C209B550@VI1PR07MB3981.eurprd07.prod.outlook.com>
Organization: CZ.NIC
Content-Type: text/plain; charset="UTF-8"
User-Agent: Evolution 3.34.2
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: clamav-milter 0.100.3 at mail
X-Virus-Status: Clean
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/hjNEMJfzk2VaFtn7rkMEkJZZgUg>
Subject: Re: [netmod] validating instance data against YANG schema including 'must' statements
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: Fri, 13 Dec 2019 07:58:58 -0000

On Thu, 2019-12-12 at 16:42 +0000, Sterne, Jason (Nokia - CA/Ottawa) wrote:
> Hi all,
>  
> A few years ago there were a few discussions on the list about tools to
> validate instance data (e.g. the data returned by a <get-config>) against a
> YANG model.
>  
> yang2dsdl is one option but I'm pretty sure it doesn't actually check the data
> against 'must' statements.
>  
> Are there some tools that check against 'must' (and 'when') statements?  Do
> those tools also work with YANG 1.1 modules?

Yangson does a complete validation, and supports YANG 1.1, but only JSON
representation of instance data. The GitHub link is below, a PyPI package is
also available:

https://pypi.org/project/yangson/

Lada

>  
> Thx,
> Jason
>  
> ##############################################################################
> ########################
> Re: [netmod] Toolchain upgraded to yangdump-pro 16.10-5 => 16.10-5..1
> Ladislav Lhotka <lhotka@nic.cz> Tue, 07 March 2017 12:42 UTCShow header
> 
> Kent Watsen <kwatsen@juniper.net>; writes:
>  
> > Hi Benoit,
> > 
> > You seem to know the ins and outs of many tools these days, maybe you
> > can point me in the right direction...which tool is able to validate
> > instance documents against YANG 1.1 modules?
>  
> Yangson can validate JSON documents:
>  
> https://github.com/CZ-NIC/yangson
>  
> > 
> > I've always used `yang2dsdl`, but currently it outputs "DSDL plugin
> > supports only YANG version 1".
>  
> I considered updating the DSDL plugin to 1.1 but it turned up to be
> immensely difficult - it would basically require a complete rewrite. And
> even then, the Schematron implementation that is included in pyang
> distribution won't support the new XPath functions.
>  
> Lada
>  
> ##############################################################################
> ########################
>  
> Re: [netmod] DSDL plugin in pyang
> Ladislav Lhotka <lhotka@nic.cz> Tue, 29 November 2016 13:39 UTCShow header
> 
> Hi William,
>  
> apart from yang2dsdl, I have personal experience with these two instance
> validation tools:
>  
> * yanglint - written in C, supports both XML and JSON instance encoding
>  
>   https://github.com/CESNET/libyang
>  
> * yangson - written in Python, supports only JSON
>  
>   https://github.com/CZ-NIC/yangson
>   installation: pip install yangson
>   manual page: http://yangson.readthedocs.io/en/latest/cmdline.html
>  
> Lada
>  
> William Lupton <wlupton@broadband-forum.org>; writes:
>  
> > Are you able to provide a list (either privately or via the NETMOD list) of
> other instance data validators that are available and cover YANG 1.1 features?
> Tx, W.
> > 
> >> On 25 Nov 2016, at 14:33, Ladislav Lhotka <lhotka@nic.cz>; wrote:
> >> 
> >> Hi,
> >> 
> >> for users of $subj: I modified the plugin so that it now immediately
> refuses to process modules of yang-version greater than 1. Supporting some of
> the YANG 1.1 features (new XPath functions, leafref handling) would require
> massive changes and I cannot do them now - I am not even sure it is worth the
> effort given that other instance data validators are available.
> >> 
> >> Lada
>  
> -- 
>  
> ##############################################################################
> ########################
>  
> _______________________________________________
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod
-- 
Ladislav Lhotka
Head, CZ.NIC Labs
PGP Key ID: 0xB8F92B08A9F76C67