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

From: [email-masked]
Date: Fri, 30 Mar 2018 16:42:43 +0200

Hi all,
grepyang has got a new feature: it could grep for a node through a module:

# ./grepyang cancel-commit [email-masked]
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 [email-masked]
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

----- Forwarded message from [email-masked] -----
     Date: Mon, 26 Mar 2018 11:37:01 +0200
     From: [email-masked]
Reply-To: [email-masked]
  Subject: Re: [Netconf] How to grep through a YANG? With grepyang
       To: "Bert Wijnen (IETF)" <[email-masked]>, [email-masked]

Thanks, Bert;
If, by playing around with the tool, you come across a behaviour you
did not like, or a feature you would like to be in, please, open an
issue (https://github.com/ariel-anieli/grepyang): I will improve on it.

Regards,
Ariel

Quoting "Bert Wijnen (IETF)" <[email-masked]>:

> Looks like an interesting too.
>
> Bert
>
> On 25/03/2018 00:55, [email-masked] wrote:
>> Hello members,
>>
>> I have put on Github 'grepyang'    
>> (https://github.com/ariel-anieli/grepyang.git), a script that greps  
>>   through a YANG, and extracts snippets matching a key, it seems    
>> 'pyang' does not have that feature; for example:
>>
>> # ./grepyang cancel-commit [email-masked]
>> 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:  }
>>
>> If you have any feedback, please, do so: I will improve the tool from it.
>>
>> Regards,
>> Ariel
>>
>> -------------------------------------------------------------------------------
>> This message was sent using EURECOM Webmail: http://webmail.eurecom.fr
>>
>> _______________________________________________
>> Netconf mailing list
>> [email-masked]
>> https://www.ietf.org/mailman/listinfo/netconf
>>

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

----- End forwarded message -----

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