Skip to content

NMS-19773: Emit an event when config changes between DCB backup intervals#8507

Merged
dino2gnt merged 6 commits into
developfrom
dcy/dcb-config-changed-event
May 8, 2026
Merged

NMS-19773: Emit an event when config changes between DCB backup intervals#8507
dino2gnt merged 6 commits into
developfrom
dcy/dcb-config-changed-event

Conversation

@dino2gnt
Copy link
Copy Markdown
Contributor

@dino2gnt dino2gnt commented May 5, 2026

Check the incoming device config against the previous config and emit a configChanged event if the two are different. As some devices [citation needed] like to insert nonsense like timestamps or other rotating content into commented headers in their configs, also offer the capability to optionally ignore commented content in the device configs when comparing the two versions.

Targeted this to develop, not sure if this should use release-36.x instead, or if we're still merging one into the other, or what the deal is.

External References

Assisted-By: Claude Sonnet 4.6

Copy link
Copy Markdown
Contributor

@christianpape christianpape left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add notes to docs, that when enabling ignore-comments that /**/, // or # might filter out relevant pieces of the configuration while comparing.

// block comments /* ... */ — (?s) makes . match newlines
content = content.replaceAll("(?s)/\\*.*?\\*/", "");
// // line comments
content = content.replaceAll("//[^\r\n]*", "");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be a problem, since URLs like tftp://... or https://... are often used in configurations. Even encrypted passwords may have these characters.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to ignore that, we must at least mention it in the documentation.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good finds.

Copy link
Copy Markdown
Contributor Author

@dino2gnt dino2gnt May 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true, and why it defaults to false. It's pretty liberal in what it will strip out and will even miss some commenting styles used in network device configs that I don't see often, like semicolons or something.

I figured this was better than trying to kludge something that ignores anything that looks like a datestamp before compare. If there's nothing dynamic inserted into the config that changes every cycle, then this option isn't necessary for that case.

If you have a recommendation or suggestion on how else to handle this I'm all ears.

I'll update the docs to make it clearer that ignore-comments can have undesired side effects on comparisons when enabled.

Copy link
Copy Markdown
Contributor

@christianpape christianpape left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@dino2gnt dino2gnt merged commit 4ebffba into develop May 8, 2026
6 checks passed
@dino2gnt dino2gnt deleted the dcy/dcb-config-changed-event branch May 8, 2026 12:57
dino2gnt added a commit that referenced this pull request May 12, 2026
…vals (#8507) (#8519)

* DCB: Emit configChanged event when stored config differs from new backup (backport)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants