Skip to content

Handle breaking changes to YANG models #178

Closed

Description

@wkz

In an AFK discussion, the following question was brought up:

Sooner or later, we will have to make breaking changes to YANG models that will cause confd to reject old configs. How should we handle that?

Some ideas:

  • confd should only care about the current YANG models belonging to any given version of Infix.
  • We can create special text transformers that translate a valid infix-x.y.z config to a valid infix-x+1.y.z config, these can be simple scripts that run a few jq(1) pipelines.
  • The transformers can be stacked as infix evolves to support going from any config version to the present.
  • The original config should always be preserved, so that a user can audit the diff.
  • The config files need a version field, so that we know the starting point in the transformer stack.

Config File Versioning

To keep the version information somewhat out-of-band from the actual configuration data, we should look at the possibility of adding it as a metadata annotation.

Sketch:

module infix-system {
  import ietf-yang-metadata {
    prefix "md";
  }
  md:annotation compatible {
    type string;
    description
      "Specifies the operating system which this configuration
       is compatible with. When a generated by the system
       itself, it is set to the concatenation of ID and
       VERSION_ID, as specified in /etc/os-release, joined by
       a hyphen.";
  }
}

Example:

{
    "ietf-system:system": {
        "@": {
            "infix-system:compatible": "infix-v24.06.0"
        }
    }
}

Having the OS name in addition to the version could potentially enable one OS to extract general settings from another, while ignoring OS-specific configuration.

Backup/Restore

  • Add restore-config RPC that will parse out the metadata and run the required transforms before feeding it to sysrepo.
  • If we ever start to version config's on the device, provide a backup-config RPC that can fetch older versions.

Activity

  1. troglobit commented on Feb 29, 2024

    @troglobit
    Contributor

    PR #324 shows an alternative/complementary route to take for breaking changes:

    1. Mark old setting as deprecated or obsolete (needs planning ahead)
    2. Introduce new setting replacement, used only if old setting does not exist
  2. added
    enhancement
    on Jun 16, 2024
  3. self-assigned this
    on Jun 16, 2024
  4. moved this to In progress in Infix & C:oon Jun 16, 2024
  5. troglobit commented on Jun 16, 2024

    @troglobit
    Contributor

    @wkz unfortunately it appears that sysrepo does not support annotations: sysrepo/sysrepo#2462 The bug report has a few years to it, but this seems to be still the case. so I'll go ahead and add a plain config augment with a discouraging description instead.

  6. added a commit that references this issue on Jun 16, 2024
    5f80e44
  7. troglobit commented on Jun 17, 2024

    @troglobit
    Contributor

    Break out into own model, infix-version.yang

  8. added 4 commits that reference this issue on Jun 18, 2024
    ae29e50
    80d86ca
    cc1889d
    058b3fb
  9. added this to the Infix v24.06 milestone on Jun 20, 2024
  10. linked a pull request that will close this issueSimplify defaults #480on Jun 20, 2024
  11. added a commit that references this issue on Jun 25, 2024
    99117fc
  12. moved this from In progress to Done in Infix & C:oon Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions