config-sync: T7784: Add command to diff configuration with secondary node#5081
Open
alexandr-san4ez wants to merge 1 commit intovyos:currentfrom
Open
config-sync: T7784: Add command to diff configuration with secondary node#5081alexandr-san4ez wants to merge 1 commit intovyos:currentfrom
alexandr-san4ez wants to merge 1 commit intovyos:currentfrom
Conversation
|
👍 |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an operational command to diff local configuration (running/candidate/saved) against a config-sync secondary node via the HTTPS API, to let operators preview differences before syncing/applying changes.
Changes:
- Introduces
show config-sync diff [commands] [running|candidate|saved] [section]op-mode command backed by a newsrc/op_mode/config_sync.pyscript. - Adds a small reusable HTTPS API client (
python/vyos/http_api_client.py) and aConfigMgmt.remote_compare()helper. - Adds op-mode XML definitions (including section include files) and a smoketest validating diff output.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/op_mode/config_sync.py | Implements the op-mode handler that fetches remote config via REST API and renders a diff vs local config. |
| python/vyos/http_api_client.py | Adds a small requests-based client with consistent exceptions for VyOS REST API calls. |
| python/vyos/config_mgmt.py | Adds remote_compare() to diff a local tree (by source) against a provided remote ConfigTree. |
| op-mode-definitions/show-config-sync.xml.in | Wires the new show config-sync diff command into the CLI tree (including commands format). |
| op-mode-definitions/include/show-config-sync-section.xml.i | Defines selectable diff “sections” matching config-sync’s supported sections. |
| op-mode-definitions/include/show-config-sync-section-commands.xml.i | Same as above, but for diff commands output. |
| smoketest/scripts/cli/test_service_config-sync.py | Adds smoketest coverage for empty diff, candidate diff (commands format), and saved vs running diff. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1 task
9dbb111 to
02cf2cc
Compare
sever-sever
requested changes
Mar 25, 2026
Member
|
main node config
|
sever-sever
reviewed
Mar 25, 2026
sever-sever
requested changes
Mar 25, 2026
02cf2cc to
7a638da
Compare
sever-sever
reviewed
Mar 27, 2026
sever-sever
reviewed
Mar 27, 2026
sever-sever
reviewed
Mar 27, 2026
7a638da to
c2f15ca
Compare
sever-sever
requested changes
Mar 30, 2026
…node Add a new operational command to compare configuration between nodes participating in config synchronization. New command: - `show configuration secondary sync [commands] [running|candidate|saved] [config-node-path]`. This allows operators to view configuration differences across secondary peer before applying or syncing changes. Supports: - displaying using raw diff and 'commands' format; - optional section filtering (subtree comparison); - selectable config source (running, candidate, saved).
c2f15ca to
54fc0e1
Compare
|
CI integration 👍 passed! Details
|
sever-sever
approved these changes
Apr 3, 2026
Member
sever-sever
left a comment
There was a problem hiding this comment.
Works as expected:
set nat source rule 100 description 'rule100'
set nat source rule 100 outbound-interface name 'eth0'
set nat source rule 100 source address '100.64.0.0/24'
set nat source rule 100 translation address 'masquerade'
set policy route-map RMAP-IN description 'inbound'
set policy route-map RMAP-IN rule 10 action 'permit'
set policy route-map RMAP-IN rule 10 description 'test'
set service config-sync mode 'load'
set service config-sync secondary address '192.168.122.16'
set service config-sync secondary key 'foo'
set service config-sync section nat
set service config-sync section policy
Check:
vyos@r14:~$ show configuration secondary sync commands candidate nat
set nat source rule 100 description 'rule100'
set nat source rule 100 outbound-interface name 'eth0'
set nat source rule 100 source address '100.64.0.0/24'
set nat source rule 100 translation address 'masquerade'
vyos@r14:~$
vyos@r14:~$
vyos@r14:~$ show configuration secondary sync commands candidate policy
delete policy route-map FOO
set policy route-map RMAP-IN description 'inbound'
set policy route-map RMAP-IN rule 10 action 'permit'
set policy route-map RMAP-IN rule 10 description 'test'
vyos@r14:~$
vyos@r14:~$
vyos@r14:~$ show configuration secondary sync commands
set nat source rule 100 description 'rule100'
set nat source rule 100 outbound-interface name 'eth0'
set nat source rule 100 source address '100.64.0.0/24'
set nat source rule 100 translation address 'masquerade'
delete policy route-map FOO
set policy route-map RMAP-IN description 'inbound'
set policy route-map RMAP-IN rule 10 action 'permit'
set policy route-map RMAP-IN rule 10 description 'test'
vyos@r14:~$
vyos@r14:~$
vyos@r14:~$ show configuration secondary sync
[nat]
+ source {
+ rule 100 {
+ description "rule100"
+ outbound-interface {
+ name "eth0"
+ }
+ source {
+ address "100.64.0.0/24"
+ }
+ translation {
+ address "masquerade"
+ }
+ }
+ }
[policy]
- route-map FOO {
- }
+ route-map RMAP-IN {
+ description "inbound"
+ rule 10 {
+ action "permit"
+ description "test"
+ }
+ }
vyos@r14:~$
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change summary
Add a new operational command to compare configuration between nodes participating in config synchronization.
New command:
show configuration secondary sync [commands] [running|candidate|saved] [<config-node-path>].This allows operators to view configuration differences across secondary peer
before applying or syncing changes.
Supports:
Types of changes
Related Task(s)
Related PR(s)
How to test / Smoketest result
Manual test
Smoketest
Checklist: