pyang
pyang copied to clipboard
Query, revision update plugin
Hi Guys, I was wondering if you were aware of any pyang plugins that support updating the revision for one or more yang files? Any info much appreciated.
No I'm not, but I also don't understand what the expected input and output to such a tool would be.
Hi @mbj4668 what I'm looking for is a way to simplify the addition of new revision statements for a set of YANG files.
I am working with a group who are publishing a set of YANG, at the end of a development cycle, the group would like to automate the process of inserting new revision statements for any YANG that has changed [change set] and update the imports for any modules that use these changed YANG.
I recognise that the identification of the changed YANG is outside of the scope of the plugin.
Given this context I think the plugin should behave as follows;
Input would include; date string, description string, reference string, change set
Output would result in modified YANG (YANG with new revision statements, YANG with updated imports)
Any feedback you have on this would be much appreciated.
If this is something you view as valuable I'm happy to contribute to the project as a plugin, with your guidance on how it should be implemented.
Thanks, Damian.
I'm not sure about the value. What we do is that we carefully track the changes done in modules and submodules, and then update the revision only for modules/submodules that actually have changed. We also never use import-by-revision, but always use include-by-revision.
We also run the check-update plugin to detect changes, and ensure that the revision has been updated when necessary.
This said, a plugin that could list all changes and maybe even output a skeleton for text to put in the revision statement might be useful.
See #437
Also see #435, which adds support for --transform plugins and has been merged.
#437 is an example "edit" transform that hasn't yet been merged. We use this when preparing Broadband Forum YANG for publication. It includes logic for updating 'revision' statements (it can add new ones and it can remove statements added since a specified date). Here's an example of how it could be used.
pyang --transform=edit --format=yang --edit-previous-revision-date=2018-07-13 --edit-revision-date=2018-12-03 FILE.yang >FILE.yang.edited