NMS-19773: Emit an event when config changes between DCB backup intervals#8507
Conversation
christianpape
left a comment
There was a problem hiding this comment.
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]*", ""); |
There was a problem hiding this comment.
This might be a problem, since URLs like tftp://... or https://... are often used in configurations. Even encrypted passwords may have these characters.
There was a problem hiding this comment.
If we want to ignore that, we must at least mention it in the documentation.
There was a problem hiding this comment.
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.
Check the incoming device config against the previous config and emit a
configChangedevent 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 userelease-36.xinstead, or if we're still merging one into the other, or what the deal is.External References
Assisted-By: Claude Sonnet 4.6