Subject: [netmod] semver.org comparison of two YANG modules

From: Benoit Claise <[email-masked]>
Date: Wed, 20 Sep 2017 18:00:08 -0700

Dear all,

In light of draft-claise-semver-01 
<https://datatracker.ietf.org/doc/draft-claise-semver/>, and thinking 
about adding an extra metadata piece of information to a YANG module 
(for example here 
<https://www.yangcatalog.org/yang-search/module_details.php?module=ietf-acl>), 
I'm wondering if any of you investigated how to map semver tags into 
backwards (in)compatible YANG module revisions?

    The fields in such a structured version have the following semantics
    (cf.  semver.org):

    o  MAJOR is incremented when the new version of the specification is
       incompatible with previous versions.

    o  MINOR is incremented when new functionality is added in a manner
       that is backward-compatible with previous versions.

    o  PATCH is incremented when bug fixes are made in a backward-
       compatible manner.

I played with "pyang --check-update-from". As an example, ietf-interfaces

    $ pyang [email-masked]
    [email-masked]:1: warning: unexpected latest
    revision "2017-08-17" in [email-masked], should be
    2017-08-14

Let's not pay attention to this warning above.
If I compare with the RFC version, I get the same output. cx

    $ pyang --path=/home/bclaise/yang/modules
    --check-update-from=/home/bclaise/ietf/YANG-rfc/[email-masked]
    [email-masked]
    [email-masked]:1: warning: unexpected latest
    revision "2017-08-17" in [email-masked], should be
    2017-08-14
    So the tag should be MINOR or PATCH. Not sure if there is a way to
    automate MINOR versus PATCH?

Now, if I manually modify a leaf in [email-masked], 
then I get:

    $ pyang --path=/home/bclaise/yang/modules
    --check-update-from=/home/bclaise/ietf/YANG-rfc/[email-masked]
    [email-masked]
    [email-masked]:1: warning: unexpected latest
    revision "2017-08-17" in [email-masked], should be
    2017-08-14
    [email-masked]:224: error: the base type has
    illegally changed from string to boolean

So I should increment the MAJOR tag.

Is my logic right? Is "pyang --check-update-from" reliable for my use case?

And yeah, I know YANG modules are always supposed to be backwards 
compatible...

Regards, Benoit