Re: [netmod] Fwd: Re: How to grep through a YANG? With grepyang

otilibil@eurecom.fr Tue, 03 April 2018 14:56 UTC

Return-Path: <otilibil@eurecom.fr>
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 D053812E86D for <netmod@ietfa.amsl.com>; Tue, 3 Apr 2018 07:56:09 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.91
X-Spam-Level:
X-Spam-Status: No, score=-1.91 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, URIBL_BLOCKED=0.001] autolearn=ham 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 zUBKFJ3MRr5m for <netmod@ietfa.amsl.com>; Tue, 3 Apr 2018 07:56:07 -0700 (PDT)
Received: from smtp2.eurecom.fr (smtp2.eurecom.fr [193.55.113.211]) by ietfa.amsl.com (Postfix) with ESMTP id C87A3127AD4 for <netmod@ietf.org>; Tue, 3 Apr 2018 07:56:06 -0700 (PDT)
X-IronPort-AV: E=Sophos;i="5.48,401,1517871600"; d="scan'208";a="7876667"
Received: from thorgal.eurecom.fr ([10.3.2.220]) by drago2i.eurecom.fr with ESMTP; 03 Apr 2018 16:56:05 +0200
Received: (from apache@localhost) by thorgal.eurecom.fr (8.14.4+Sun/8.14.4/Submit) id w33Eu5xj009001; Tue, 3 Apr 2018 16:56:05 +0200 (CEST)
X-Authentication-Warning: thorgal.eurecom.fr: apache set sender to otilibil@eurecom.fr using -f
Received: from reverse.completel.net (reverse.completel.net [92.103.89.82]) by webmail.eurecom.fr (Horde MIME library) with HTTP; Tue, 03 Apr 2018 16:56:05 +0200
Message-ID: <20180403165605.2c9o1mru8ssg0w4c@webmail.eurecom.fr>
Date: Tue, 03 Apr 2018 16:56:05 +0200
From: otilibil@eurecom.fr
To: Robert Wilton <rwilton@cisco.com>
Cc: netmod@ietf.org
References: <20180330164544.pazut2dfxc08840w@webmail.eurecom.fr> <40e7e93c-c112-78a1-647c-1f30b95cd689@cisco.com>
In-Reply-To: <40e7e93c-c112-78a1-647c-1f30b95cd689@cisco.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"; DelSp="Yes"; format="flowed"
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
User-Agent: Internet Messaging Program (IMP) H3 (4.1.4)
X-Originating-IP: 92.103.89.82
X-Remote-Browser: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.89 Safari/537.36
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/a7dvjSZA7JwRRqbdSQq-ZHmjLXw>
Subject: Re: [netmod] Fwd: Re: How to grep through a YANG? With grepyang
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.22
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, 03 Apr 2018 14:56:10 -0000

Hi Rob,

My answers inline.

Regards,
Ariel

Quoting Robert Wilton <rwilton@cisco.com>:

> Hi Ariel,
>
> This looks like an interesting/useful tool.
>
> Have you considered hooking into pyang as a pyang extension?
Till today, no; grpeyang is still a rush, needing improvements and  
cleanups. You suggested a nice idea, indeed.
> pyang is one of the defacto standard tools that folks interacting with
> yang often use.  If your aim to get widespread usage of your tool
> making it a pyang extension may be one way to achieve that. E.g. this
> would then allow your tool to generate tree output for selected yang
> subtree(s) nodes that you find, or other nice things.
Thanks for your feedback, Rob. Then, I will read through the code of  
pyang, and check the dependencies, if they are any. Who manages the  
Github repository?
>
> Thanks,
> Rob
>
>
> On 30/03/2018 15:45, otilibil@eurecom.fr wrote:
>> Hi all,
>> grepyang has got a new feature: it could grep for a node through a module:
>>
>> # ./grepyang cancel-commit ietf-netconf@2011-06-01.yang
>> 853:  rpc cancel-commit {
>> 854:    if-feature confirmed-commit;
>> 855:    description
>> 856:      "This operation is used to cancel an ongoing confirmed commit.
>> 857:       If the confirmed commit is persistent, the parameter
>> 858:       'persist-id' must be given, and it must match the value of the
>> 859:       'persist' parameter.";
>> 860:    reference "RFC 6241, Section 8.4.4.1";
>> 861:
>> 862:    input {
>> 863:      leaf persist-id {
>> 864:        type string;
>> 865:        description
>> 866:          "This parameter is given in order to cancel a persistent
>> 867:           confirmed commit.  The value must be equal to the value
>> 868:           given in the 'persist' parameter to the <commit> operation.
>> 869:           If it does not match, the operation fails with an
>> 870:          'invalid-value' error.";
>> 871:      }
>> 872:    }
>> 873:  }
>>
>> Now it can grep for a node with a greped node:
>>
>> # ./grepyang input cancel-commit ietf-netconf@2011-06-01.yang
>> 853:  rpc cancel-commit {
>> 862:    input {
>> 863:      leaf persist-id {
>> 864:        type string;
>> 865:        description
>> 866:          "This parameter is given in order to cancel a persistent
>> 867:           confirmed commit.  The value must be equal to the value
>> 868:           given in the 'persist' parameter to the <commit> operation.
>> 869:           If it does not match, the operation fails with an
>> 870:          'invalid-value' error.";
>> 871:      }
>> 872:    }
>> 873:  }
>>
>> pyang lacks such features; that's why I have been working on grepyang.
>>
>> It is out on Github (https://github.com/ariel-anieli/grepyang);   
>> feel free to play around with it.
>>
>> If you find it of any interest, have some remarks, or see it needs   
>> enhancements; please,  do so: I will work on the issues.
>>
>> Regards,
>> Ariel
>>
>> ------------------------------------------------------------------------------- This message was sent using EURECOM Webmail:   
>> http://webmail.eurecom.fr
>>
>> _______________________________________________
>> netmod mailing list
>> netmod@ietf.org
>> https://www.ietf.org/mailman/listinfo/netmod
>> .
>>



-------------------------------------------------------------------------------
This message was sent using EURECOM Webmail: http://webmail.eurecom.fr