Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formally defining backwards compatibility for YANG extensions #151

Open
BalazsLengyel opened this issue May 26, 2022 · 6 comments
Open

Formally defining backwards compatibility for YANG extensions #151

BalazsLengyel opened this issue May 26, 2022 · 6 comments
Labels
schema-comparison Issues related to the YANG schema comparison draft

Comments

@BalazsLengyel
Copy link
Collaborator

When trying to determine whether a module update is compatible or not all YANG statement changes need to be considered. Compatibility aspects of YANG extension statements are not know as each extension is unique and its semantics are described only in a description statement using plain English. While that might be sufficient for an expert human reader, it is not usable in a SW algorithm.

There is a need to define whether changing specific YANG extension statements is backwards compatible or not. This should be defined in a formal, machine readable manner.

@BalazsLengyel
Copy link
Collaborator Author

A possible formal definition of extension backwards compatibility could be the following:

extension extension-backward-compatibility {
description
"Describes if an update to a statement using the YANG extension
defined by the parent statement to this extension is considered
backwards compatible or not.

  The statement MUST only be a substatement of the extension
  statement used to define a new statement within the YANG language.
   
  Zero or One extension-backward-compatibility statement per 
  extension statement is allowed. 
  No substatements are allowed.

  The argument shall follow the following YANG definition:
   
  leaf nbc-changes {
    type bits {
      bit add {
        description 
         "Adding this extension statement is a 
         backwards incompatible change";
      }
      bit remove {
        description 
         "Removing this extension statement is a 
         backwards incompatible change";
      }
      bit change {
        description 
         "Changing this extension statement is a 
         backwards incompatible change";
      }
    default '';
  } 
  
  If the argument is not present all changes to the usage of the 
  parent extension statement are backwards compatible.
  If the argument is present changes listed in the argument 
  are not backwards compatible while changes not listed are 
  backwards compatible.";
  
argument nbc-changes;

}

@BalazsLengyel BalazsLengyel added the schema-comparison Issues related to the YANG schema comparison draft label May 26, 2022
@jsterne
Copy link
Collaborator

jsterne commented May 27, 2022

Minor nit - let's use the "non backwards compatible" terminology like we did in other drafts (instead of 'incompatible).

@jsterne
Copy link
Collaborator

jsterne commented May 27, 2022

One aspect that might not be covered by these 3 bits: what about extensions that depending how they change, it could be BC or NBC ? e.g. imagine the YANG 'range' statement didn't exist and someone invented it as an extension. Increasing the range is BC but shrinking it is NBC.

@rgwilton
Copy link
Collaborator

rgwilton commented Jun 7, 2022

Do we want to be able to annotate as extension as being editorial only?

Perhaps the tooling may categorize into a finer set of categories (e.g. nbc, bc, editorial, potential-nbc) and then those categories are combined into the actual versioning number, depending on the versioning scheme.

Where does the draft pull the definition from editorial from? Probably can just reference the definition in the Semver draft without requiring Semver.

@BalazsLengyel
Copy link
Collaborator Author

IMHO we don't want to go into to details like: one type of change is BC while the other type is NBC. To detailed, to lenghty.

Do we need editorial-change marking too? -IMHO not sure, but if e follow semver maybe it is a good idea.

Do we need a potential-nbc output too? - Looks like a good idea.

@BalazsLengyel
Copy link
Collaborator Author

BalazsLengyel commented Jun 7, 2022

Definition ver-2:

extension extension-backward-compatibility {
description
"Describes if an update to a statement using the YANG extension
defined by the parent statement to this extension is considered
backwards compatible or not or only editorial.

  The statement MUST only be a substatement of the extension
  statement used to define a new statement within the YANG language.

  Zero or One extension-backward-compatibility statement per 
  extension statement is allowed. 
  No substatements are allowed.

  The mandatory argument SHALL contain 3 comma separated strings. 
  Each string defines what kind of change the adding, changing and 
  deleting of the extension represents (in the above order). 
  Each substring SHALL follow the following YANG definition:
  
  typedef change-type {
    type enumeration {
      enum nbc {
        description "Non-backwards compatible change";
      }
      enum potentially-nbc {
        description "A change that maybe either non-backwards  
          or backwards compatible";
      }
      enum bc {
        description "Backwards compatible change";
      }
      enum editorial {
        description "Editorial change";
      }
    }
  }
        
  E.g., the following indicates that adding the extension is 
  bc, changing it is editorial but removing it is potentially 
  non-backwards compatible.
  
  "bc,editorial,potentially-nbc"
  ";

argument change-types;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
schema-comparison Issues related to the YANG schema comparison draft
Projects
None yet
Development

No branches or pull requests

3 participants