Re: [yang-doctors] XPath validation during development

Ladislav Lhotka <lhotka@nic.cz> Tue, 03 March 2020 17:57 UTC

Return-Path: <lhotka@nic.cz>
X-Original-To: yang-doctors@ietfa.amsl.com
Delivered-To: yang-doctors@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 943113A2469 for <yang-doctors@ietfa.amsl.com>; Tue, 3 Mar 2020 09:57:29 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.897
X-Spam-Level:
X-Spam-Status: No, score=-1.897 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=unavailable autolearn_force=no
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 EdUi9UvffO2A for <yang-doctors@ietfa.amsl.com>; Tue, 3 Mar 2020 09:57:25 -0800 (PST)
Received: from trail.lhotka.name (trail.lhotka.name [77.48.224.143]) by ietfa.amsl.com (Postfix) with ESMTP id 067F83A2471 for <yang-doctors@ietf.org>; Tue, 3 Mar 2020 09:57:23 -0800 (PST)
Received: by trail.lhotka.name (Postfix, from userid 109) id 8479F8601D5; Tue, 3 Mar 2020 18:56:33 +0100 (CET)
Received: from localhost (unknown [172.29.2.111]) by trail.lhotka.name (Postfix) with ESMTPSA id 96A4B8601C3; Tue, 3 Mar 2020 18:56:29 +0100 (CET)
From: Ladislav Lhotka <lhotka@nic.cz>
To: Kent Watsen <kent@watsen.net>, Scott Mansfield <scott.mansfield=40ericsson.com@dmarc.ietf.org>
Cc: "yang-doctors@ietf.org" <yang-doctors@ietf.org>
In-Reply-To: <010001709ce294c6-d6393ee5-9c3c-4d0f-80c6-3ffff2523742-000000@email.amazonses.com>
References: <DM5PR15MB1772033DBA980333DF41A5348BE70@DM5PR15MB1772.namprd15.prod.outlook.com> <010001709ce294c6-d6393ee5-9c3c-4d0f-80c6-3ffff2523742-000000@email.amazonses.com>
Date: Tue, 03 Mar 2020 18:57:18 +0100
Message-ID: <87tv35b9tt.fsf@nic.cz>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/yang-doctors/HTbBZvSkLrlaxGX9xrvb5I5gcc4>
Subject: Re: [yang-doctors] XPath validation during development
X-BeenThere: yang-doctors@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Email list of the yang-doctors directorate <yang-doctors.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/yang-doctors>, <mailto:yang-doctors-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/yang-doctors/>
List-Post: <mailto:yang-doctors@ietf.org>
List-Help: <mailto:yang-doctors-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/yang-doctors>, <mailto:yang-doctors-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Mar 2020 17:57:30 -0000

Kent Watsen <kent@watsen.net> writes:

> “Best” is hard to qualify, but perhaps best would be to 1) validate the YANG module(s) and 2) validate as many instance documents as it takes to have near 100% coverage; and doing both is these things with as many validation tools as possible.
>
> I do this myself for all my models, though I only ave access to `yanglint` and `yangson`.  For drafts, my Makefiles do this for each build (pro-tip: the time setting up the automation pays for itself in the long run).
>
> A couple additional comments:
>
> 1) `yangson` has an ability to output test-coverage statistics per https://github.com/CZ-NIC/yangson/issues/13

The test module in Yangson distribution [1] contains a large number of XPath tests in the test_xpath function. It is possible to prepare similar tests for XPath expressions appearing in a specific data model.

Lada

[1] https://github.com/CZ-NIC/yangson/blob/master/tests/test_model.py

>
> 2) testing against multiple implementation has two benefits: a) some implementation catch things others don’t and b) sometimes inconsistencies arise that resolve by either i) one implementation being improved or ii) discovery of a clarification-issue with YANG (RFC 7950).  Example open clarification issues include how NP-containers and implicit-case statements are handled.  My modules are now constructed in such a way to be behaviorally-correct across a greater set of tools (e.g., avoid implicit-case statements, always use a presence-container if a descendent contains a “must” statement, etc.)
>
> Kent
>
>
>> On Mar 2, 2020, at 2:24 PM, Scott Mansfield <scott.mansfield=40ericsson.com@dmarc.ietf.org> wrote:
>> 
>> Hello YANG Doctors!
>>  
>> I searched through the yang-doctors mailing list and didn’t see an answer to my question, so apologies if this has been covered before.
>>  
>> While development a YANG module, how is the best way to ensure that my XPath (must etc) statements are syntactically and semantically correct?  Is the best way to use YUMA123 or confd and build a set of test cases that can be run on an instantiated model?  What do you do to test your XPath during development of YANG?
>>  
>> Many thanks,
>> -scott.
>> _______________________________________________
>> yang-doctors mailing list
>> yang-doctors@ietf.org <mailto:yang-doctors@ietf.org>
>> https://www.ietf.org/mailman/listinfo/yang-doctors <https://www.ietf.org/mailman/listinfo/yang-doctors>
> _______________________________________________
> yang-doctors mailing list
> yang-doctors@ietf.org
> https://www.ietf.org/mailman/listinfo/yang-doctors

-- 
Ladislav Lhotka 
Head, CZ.NIC Labs
PGP Key ID: 0xB8F92B08A9F76C67