Re: [netmod] Question about tooling for YANG Instance Data

Kent Watsen <kent@watsen.net> Tue, 07 June 2022 01:13 UTC

Return-Path: <010001813bb91a49-a3cd4f16-6c9c-4679-bbe6-14caa7b4d669-000000@amazonses.watsen.net>
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 A7A16C14792E for <netmod@ietfa.amsl.com>; Mon, 6 Jun 2022 18:13:22 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.809
X-Spam-Level:
X-Spam-Status: No, score=-6.809 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, HTTPS_HTTP_MISMATCH=0.1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001] autolearn=unavailable autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=amazonses.com
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id axXTYKGe7DxJ for <netmod@ietfa.amsl.com>; Mon, 6 Jun 2022 18:13:17 -0700 (PDT)
Received: from a48-94.smtp-out.amazonses.com (a48-94.smtp-out.amazonses.com [54.240.48.94]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id B8996C157901 for <netmod@ietf.org>; Mon, 6 Jun 2022 18:13:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw; d=amazonses.com; t=1654564396; h=From:Message-Id:Content-Type:Mime-Version:Subject:Date:In-Reply-To:Cc:To:References:Feedback-ID; bh=2eNLV3ivFOIpL9OgZuKvBgULaIPZOSgwE+8whx9nhwU=; b=dFI6iVXW7dMQ8BYNwo41Kc8bjlBEWCBWb1uiaAmSYQTvfiGGWAZ7bHWLmeWTOiUo KO4gQ+PVzl0k9cYzIbwPciUW1PsfnDNAKEzHcBSEMEPExxNKFIl6rPPSgp3MOsxwprx eLy5u3KwmkGPYFZej+CrjMQEkveoNwp/jaPxLt2o=
From: Kent Watsen <kent@watsen.net>
Message-ID: <010001813bb91a49-a3cd4f16-6c9c-4679-bbe6-14caa7b4d669-000000@email.amazonses.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_5B8F6A89-B1A3-45B8-8862-CFC4A11ADF59"
Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.60.0.1.1\))
Date: Tue, 7 Jun 2022 01:13:15 +0000
In-Reply-To: <BL0PR1501MB413028FDB547AE215C3BA22F8BA29@BL0PR1501MB4130.namprd15.prod.outlook.com>
Cc: Michal Vasko <mvasko@cesnet.cz>, "netmod@ietf.org" <netmod@ietf.org>
To: Scott Mansfield <scott.mansfield=40ericsson.com@dmarc.ietf.org>
References: <BL0PR1501MB413028FDB547AE215C3BA22F8BA29@BL0PR1501MB4130.namprd15.prod.outlook.com>
X-Mailer: Apple Mail (2.3693.60.0.1.1)
Feedback-ID: 1.us-east-1.DKmIRZFhhsBhtmFMNikgwZUWVrODEw9qVcPhqJEI2DA=:AmazonSES
X-SES-Outgoing: 2022.06.07-54.240.48.94
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/3KVzp_rs7lT7_GGpgRD-lUANaa8>
Subject: Re: [netmod] Question about tooling for YANG Instance Data
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.39
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, 07 Jun 2022 01:13:22 -0000

For structure (and rc:yang-data), my validation scripts hack the YANG module to convert the "structure" to a "container" and then do the validation against the hacked-YANG module.

Kent


> On Jun 6, 2022, at 6:50 AM, Scott Mansfield <scott.mansfield=40ericsson.com@dmarc.ietf.org> wrote:
> 
> Thank you Michal for the information.  I appreciate the work on yanglint and look forward to future updates.
> 
> Then my question is, what tool was used to validate the examples in RFC 9195?  Is there any tooling that can be used to validate the instance data?
> 
> thanks,
> -scott.
> 
> 
> From: Michal Vasko
> Sent: Monday, June 6, 2022 1:59 AM
> To: Scott Mansfield; Kent Watsen
> Cc: netmod@ietf.org <mailto:netmod@ietf.org>
> Subject: Re: [netmod] Question about tooling for YANG Instance Data
> 
> Hi Scott,
> the main developer of libyang commenting. In your example there is a "structure" extension instance, which we do not support currently so you will not be able to validate it no matter what you do. I have already looked at this extension recently and think that we can support it without much trouble but I am currently swamped by lots of other issues so I have no idea when I will get to this.
> Regards,
> Michal
> On 5. 6. 2022 1:35, Scott Mansfield wrote:
>> Excellent ideas.  I will package up a tiny example and post to libyang.
>>  
>> I am using yanglint 2.0.200.
>>  
>> Since I’m starting from an example that is in RFC 9195, it is easy to build a small example and package up an expect script to show the issue.
>>  
>> Regards,
>> -scott.
>>  
>> From: Kent Watsen <kent@watsen.net> <mailto:kent@watsen.net> 
>> Sent: Saturday, June 4, 2022 5:22 PM
>> To: Scott Mansfield <scott.mansfield@ericsson.com> <mailto:scott.mansfield@ericsson.com>
>> Cc: netmod@ietf.org <mailto:netmod@ietf.org>
>> Subject: Re: [netmod] Question about tooling for YANG Instance Data
>>  
>> Hi Scott,
>>  
>> I consider myself a heavy `yanglint` user, as all examples in all my drafts are validated each time I "make" each draft, and I have several other projects that make heavy use of `yanglint` validation.   I have run into a number of validation issues over years and generally first try to validate that my understanding of YANG is correct  and, if unsure, I'll ping the NETMOD list (note: there are many YANG subtleties, such as the recent discovery that a module needs to be "implemented" in order for its features to be defined).   Otherwise, I submit an Issue to the `libyang` GitHub issue tracker, typically containing the smallest possible module (or number of modules) demonstrating the issue, while also pointing out all relevant facts (e.g., foo is implemented, bar is defined, RFC 7950 Section X says this, etc.).  Radek and Michal are pretty good with providing a response in 1-2 business days.   Sometimes my YANG-understanding is challenged, at which point we bring it to the NETMOD list.
>>  
>> FWIW, `yanglint` recently switched from the 1.x to the 2.x code base.   A number of regressions were introduced at this time (resolved now, at least the ones affecting me) but, nicely, the 2.x code catches some issues that the 1.x code never did (it's a better validator).  The CLI changed some, and I'm now very careful to ensure all modules that need to be implemented are, and that all features that need to be defined are.  I now explicitly disable all features for implemented modules when no features from it are needed.   I find that the new 2.x is picky, in a good way and that, after painstakingly working through each issue, all my validation tests are passing now.
>>  
>> Best of luck,
>> Kent
>>  
>> 
>> 
>> On Jun 3, 2022, at 3:35 PM, Scott Mansfield <scott.mansfield=40ericsson.com@dmarc.ietf.org <mailto:scott.mansfield=40ericsson.com@dmarc.ietf.org>> wrote:
>>  
>> I am trying to use two of the examples found in RFC 9195 https://www.rfc-editor.org/rfc/rfc9195.html#name-preloading-default-configur <https://protect2.fireeye.com/v1/url?k=31323334-501d5122-313273af-454445555731-092ccfe7a6702a7c&q=1&e=4e9d6ab0-63b7-4e40-965d-5d89b0208d6e&u=https%3A%2F%2Fwww.rfc-editor.org%2Frfc%2Frfc9195.html%23name-preloading-default-configur> and https://www.rfc-editor.org/rfc/rfc9195.html#name-storing-diagnostics-data <https://protect2.fireeye.com/v1/url?k=31323334-501d5122-313273af-454445555731-4510ebc746564af0&q=1&e=4e9d6ab0-63b7-4e40-965d-5d89b0208d6e&u=https%3A%2F%2Fwww.rfc-editor.org%2Frfc%2Frfc9195.html%23name-storing-diagnostics-data> to test out how to validate that instance data is formatted correctly.
>>  
>> Using yanglint, I load all the yang necessary and then load the data from either the xml file (read-only-acm-rules) or the json file (acme-router-netconf-diagnostics).  I get a similar error for both...
>> data -t data -f xml acme-router-netconf-diagnostics.json
>> libyang[0]: Node "instance-data-set" not found in the "ietf-yang-instance-data" module. (path: Line number 2.)
>> YANGLINT[E]: Failed to parse input data file "acme-router-netconf-diagnostics.json".
>>  
>> What is the best tooling to use to validate the instance data?  What tooling was used to validate the contents used in the examples?  I'm trying to determine if this a yanglint issue, user error, or I'm just using the wrong tool.
>>  
>> Here is a link to a github with my testing:  https://github.com/samans/testing-yang/tree/main/ieee-60802/60802 <https://protect2.fireeye.com/v1/url?k=31323334-501d5122-313273af-454445555731-20ec105f5d2f3377&q=1&e=4e9d6ab0-63b7-4e40-965d-5d89b0208d6e&u=https%3A%2F%2Fgithub.com%2Fsamans%2Ftesting-yang%2Ftree%2Fmain%2Fieee-60802%2F60802>
>> If interested t.in in the expect script for the acme-router-netconf-diagnostics.json example and x.in is the expect script for the read-only-acm-rules.xml example.
>>  
>> regards,
>> -scott.
>> 
>> _______________________________________________
>> netmod mailing list
>> netmod@ietf.org <mailto:netmod@ietf.org>
>> https://www.ietf.org/mailman/listinfo/netmod <https://www.ietf.org/mailman/listinfo/netmod>
>>  
>> 
>> 
>> _______________________________________________
>> netmod mailing list
>> netmod@ietf.org <mailto:netmod@ietf.org>
>> https://www.ietf.org/mailman/listinfo/netmod <https://www.ietf.org/mailman/listinfo/netmod>
> _______________________________________________
> netmod mailing list
> netmod@ietf.org <mailto:netmod@ietf.org>
> https://www.ietf.org/mailman/listinfo/netmod <https://www.ietf.org/mailman/listinfo/netmod>