Skip to content

Conversation

@xorrkaz
Copy link

@xorrkaz xorrkaz commented Oct 27, 2025

This is a WIP PR. An early review would be appreciated, but I want to see if others can bang on the code a bit, too.

Add the ietf-yang-semver and ietf-yang-revisions YANG modules along
with their generated header files and test module copies.

- ietf-yang-semver@2025-09-29: Defines version and recommended-min-version extensions
- ietf-yang-revisions@2025-01-28: Defines non-backwards-compatible and recommended-min-date extensions
Add validation plugins for ietf-yang-semver and ietf-yang-revisions
extensions:

yang_semver.c:
- Implements validation for ysv:version extension
  * Validates MAJOR.MINOR.PATCH format with optional modifiers
  * Ensures version uniqueness across module revisions
  * Checks for duplicate versions in same revision
- Implements validation for ysv:recommended-min-version extension
  * Validates strict MAJOR.MINOR.PATCH format (no modifiers)
  * Ensures correct placement in import statements
  * Prevents duplicate declarations

yang_revisions.c:
- Implements validation for rev:non-backwards-compatible extension
  * Validates placement in revision statements
  * Prevents duplicate declarations
- Implements validation for rev:recommended-min-date extension
  * Validates YYYY-MM-DD date format
  * Ensures correct placement in import statements
  * Prevents duplicate declarations
- Add external declarations for plugins_yang_semver and plugins_yang_revisions
- Register both plugin sets during library initialization
- Add source files to build system (CMakeLists.txt)
Split tests into separate modules for ietf-yang-semver and
ietf-yang-revisions extensions:

test_yang_semver.c:
- Tests for ysv:version extension
  * Valid formats (basic, with modifiers, pre-release, metadata)
  * Invalid formats (wrong placement, malformed versions)
  * Version uniqueness across revisions
- Tests for ysv:recommended-min-version extension
  * Valid MAJOR.MINOR.PATCH format
  * Invalid formats (with modifiers, pre-release)
  * Duplicate prevention

test_yang_revisions.c:
- Tests for rev:non-backwards-compatible extension
  * Valid usage in revision statements
  * Invalid placement and duplicates
- Tests for rev:recommended-min-date extension
  * Valid date formats (YYYY-MM-DD)
  * Invalid date formats
  * Duplicate prevention

Update CMakeLists.txt to register both test suites.
Add ietf-yang-semver and ietf-yang-revisions to the internal modules
list so they are automatically available in all contexts.

- Update context.c to include generated headers and module registrations
- Update test_context.c to reflect new module count in test assertions
@michalvasko
Copy link
Member

It seems you have understood the code perfectly and I see no major issues, just some minor ones. Not sure what additional changes you have in mind but I have way too much work at least until the IETF so I am not able to help. It also seems that the CI is broken but that is likely just some minor issue.

This is an attempt to fix some out-of-bounds issues.
@xorrkaz
Copy link
Author

xorrkaz commented Oct 30, 2025

I think I licked the CI problem. Can you re-run the PR? And thanks for the quick look.

@michalvasko
Copy link
Member

Yes, it works now, only some formatting issue left. I can fix that, if you want.

@xorrkaz
Copy link
Author

xorrkaz commented Oct 31, 2025

Should be all fixed. Give it another shot. I do want to give this some time to bake, though. I want more IETFers to look at it, and the YANG modules may rev prior to an RFC number being issued.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants