-
Notifications
You must be signed in to change notification settings - Fork 393
T5942: Make failover support dhcp-interface #4783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
👍 |
1477a59 to
f5df843
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds DHCP interface support to the failover protocol, allowing routes to use DHCP-obtained gateway addresses instead of only static next-hops. The implementation includes XML configuration refactoring, enhanced route processing logic, and comprehensive test coverage.
- Refactored XML configuration to extract common DHCP interface properties into reusable include files
- Extended failover route configuration to support dhcp-interface alongside existing next-hop options
- Modified DHCP router detection to use
.leasefiles instead of.leasesfor better accuracy
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/helpers/vyos-failover.py | Added DHCP interface processing logic and route management for dynamic gateways |
| src/conf_mode/protocols_failover.py | Updated validation to support both next-hop and dhcp-interface configurations |
| smoketest/scripts/cli/test_protocols_failover.py | Added comprehensive test coverage for DHCP interface functionality |
| python/vyos/template.py | Modified get_dhcp_router to use .lease files and parse new_ip_address field |
| interface-definitions/include/failover/protocol-common-config.xml.i | Refactored to use common failover configuration include |
| interface-definitions/include/failover/common-failover.xml.i | New common configuration include for failover settings |
| interface-definitions/include/dhcp-interface.xml.i | Updated to use common DHCP interface properties |
| interface-definitions/include/dhcp-interface-properties.xml.i | New include file for common DHCP interface properties |
| interface-definitions/include/dhcp-interface-multi.xml.i | Updated to use common DHCP interface properties |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
6927d12 to
cabfb21
Compare
Expected route
It is not clear via which interface it fails
We see the default route: Add
|
cabfb21 to
923b8ab
Compare
(python/vyos/frrender.py) |
|
|
||
| if not os.path.exists(dhclient_base_dir): | ||
| self.need_dhcp_dir_cleanup = True | ||
| run(['sudo', 'mkdir', '-p', dhclient_base_dir]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not see real tests for the DHCP server or client. This test seems fake.
You can use a veth pair to configure a real DHCP server/client for a more realistic test.
Other things work in my case. Therefore, deleting the DHCP default gateway when changing something in the failover router appears to be another bug and is not related to this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, updated test as recommended, with real DHCP server + DHCP client via virtual ethernet.
923b8ab to
52b958a
Compare
* Refactor XML a little: move common dhcp-interface properties to separate include file * Add failover support for dhcp-interface * Add test for DHCP in failover protocol
Change vyos.template.get_dhcp_router to use '*.lease' file instead of '.leases' file - in 'leases' there can be several last leases and current one may not be the first one in file. '*.lease' file contains current lease.
52b958a to
d290b26
Compare
|
CI integration 👍 passed! Details
|
sever-sever
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Manually checked and works fine
dmbaturin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good and I trust @sever-sever's testing.
|
Thanks a lot! Please backport to 1.4 aswell |
Make failover support dhcp-interface
Command sample:
Types of changes
Related Task(s)
Related PR(s)
How to test / Smoketest result
I've added test case:
-->
Checklist: