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

From: "Sterne, Jason (Nokia - CA/Ottawa)" <[email-masked]>
Date: Thu, 12 Dec 2019 16:42:09 +0000

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?

Thx,
Jason

######################################################################################################
Re: [netmod] Toolchain upgraded to yangdump-pro 16.10-5 => 16.10-5.1

Ladislav Lhotka <[email-masked]> Tue, 07 March 2017 12:42 UTCShow header<https://mailarchive.ietf.org/arch/msg/netmod/u6-p884fv_R8SLZgLze1YYHBupk>

Kent Watsen <[email-masked]><mailto:[email-masked]&gt>; 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 <[email-masked]> Tue, 29 November 2016 13:39 UTCShow header<https://mailarchive.ietf.org/arch/msg/netmod/o6XNsZ2BA0kBL9bv4oG7LH1yq4k>

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<https://yangson.readthedocs.io/en/latest/cmdline.html>

Lada

William Lupton <[email-masked]><mailto:[email-masked]&gt>; 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 <[email-masked]><mailto:[email-masked]&gt>; 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

--

######################################################################################################

---

From: Ladislav Lhotka <[email-masked]>
Date: Fri, 13 Dec 2019 08:58:52 +0100

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.
>  
> 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

> Re: [netmod] Toolchain upgraded to yangdump-pro 16.10-5 => 16.10-5..1
> Ladislav Lhotka <[email-masked]> Tue, 07 March 2017 12:42 UTCShow header
> 
> Kent Watsen <[email-masked]>; writes:
>  
> > Hi Benoit,
> > 
> Ladislav Lhotka <[email-masked]> Tue, 29 November 2016 13:39 UTCShow header
> 
> Hi William,
>  
>   manual page: http://yangson.readthedocs.io/en/latest/cmdline.html
>  
> Lada
>  
> William Lupton <[email-masked]>; 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 <[email-masked]>; 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
> [email-masked]
> https://www.ietf.org/mailman/listinfo/netmod
-- 
Ladislav Lhotka
Head, CZ.NIC Labs
PGP Key ID: 0xB8F92B08A9F76C67