-
Notifications
You must be signed in to change notification settings - Fork 373
kea: T6211: add VRF support for KEA dhcp server #4508
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
base: current
Are you sure you want to change the base?
Conversation
👍 |
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
Adds VRF support to the KEA DHCP server by extending control-socket calls, CLI commands, templates, systemd units, and configuration mode scripts to accept and propagate a --vrf
parameter.
- Extended
dhcp.py
and underlying Kea API (vyos/kea.py
) to acceptvrf
/vrf_name
- Updated service definitions, systemd overrides, op-mode XML, interface definitions, and Jinja templates for VRF support
- Adapted smoke tests and configuration mode scripts to inject VRF context via
argv
Reviewed Changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
src/op_mode/dhcp.py | Updated commands to accept --vrf , modified function signatures and service names, but introduced mis-wired pool sizing |
python/vyos/kea.py | Extended Kea API calls (_ctrl_socket_command , lease/config getters) to include vrf_name |
src/conf_mode/service_dhcp-server.py & service_dhcpv6-… | Detect VRF context via argv and set config/control-socket paths accordingly |
src/etc/systemd/system/kea-dhcp*[email protected]/… | Added ip vrf exec overrides for DHCP4, DHCP6, and DDNS units |
op-mode-definitions/.xml.in & interface-definitions/ | Added <tagNode name="vrf"> blocks for new CLI commands and VRF under interface definitions |
data/templates/dhcp-server/kea-dhcp*.j2 | Conditionally generate control-socket paths based on vrf_context |
Comments suppressed due to low confidence (5)
src/op_mode/dhcp.py:177
config
is not defined inside_get_pool_size
. You need to pass the active configuration object into_get_pool_size
or capture it from the outer scope.
subnets = config.list_nodes(f'{base} subnet')
src/op_mode/dhcp.py:196
- The call to
_get_pool_size
does not pass thevrf
argument, so pool sizes will always be computed for the global context rather than the selected VRF. Change to_get_pool_size(pool=p, family=family, vrf=vrf)
.
size = _get_pool_size(family=family, pool=p)
src/op_mode/dhcp.py:85
- [nitpick] The parameter name
sorted
shadows the built-in Pythonsorted
function. Consider renaming it tosort_key
orsort_by
for clarity.
def _get_raw_server_leases(config, family='inet', vrf='', pool=None, sorted=None, state=[], origin=None)
smoketest/scripts/cli/test_service_dhcp-server.py:100
- [nitpick] There are no smoke tests for the new VRF-aware
show_server_leases
commands. Add tests forshow dhcp-server leases vrf <name>
to validate CLI and config output.
def verify_service_running(self):
src/system/on-dhcp-event.sh:33
- [nitpick] Indentation around this line is inconsistent with surrounding lines, which could affect readability or heredoc parsing. Align it with the other commands in this block.
config = kea_get_active_config('4', '')
Please combine ten commits into a single commit, e.g. with |
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.
CI tests failing:
DEBUG - Running Testcase: /usr/libexec/vyos/tests/smoke/cli/test_service_dhcp-server.py
DEBUG - test_dhcp_dynamic_dns_update (__main__.TestServiceDHCPServer.test_dhcp_dynamic_dns_update) ... ERROR
DEBUG - test_dhcp_exclude_in_range (__main__.TestServiceDHCPServer.test_dhcp_exclude_in_range) ... ERROR
DEBUG - test_dhcp_exclude_not_in_range (__main__.TestServiceDHCPServer.test_dhcp_exclude_not_in_range) ... ERROR
DEBUG - test_dhcp_high_availability (__main__.TestServiceDHCPServer.test_dhcp_high_availability) ... ERROR
DEBUG - test_dhcp_high_availability_standby (__main__.TestServiceDHCPServer.test_dhcp_high_availability_standby) ... ERROR
DEBUG - test_dhcp_hostsd_lease_sync (__main__.TestServiceDHCPServer.test_dhcp_hostsd_lease_sync) ... ERROR
DEBUG - test_dhcp_multiple_pools (__main__.TestServiceDHCPServer.test_dhcp_multiple_pools) ... ERROR
DEBUG - test_dhcp_on_interface_with_vrf (__main__.TestServiceDHCPServer.test_dhcp_on_interface_with_vrf) ... ERROR
DEBUG - test_dhcp_relay_server (__main__.TestServiceDHCPServer.test_dhcp_relay_server) ... ERROR
DEBUG - test_dhcp_single_pool_options (__main__.TestServiceDHCPServer.test_dhcp_single_pool_options) ... ERROR
DEBUG - test_dhcp_single_pool_options_scoped (__main__.TestServiceDHCPServer.test_dhcp_single_pool_options_scoped) ... ERROR
DEBUG - test_dhcp_single_pool_range (__main__.TestServiceDHCPServer.test_dhcp_single_pool_range) ... ERROR
DEBUG - test_dhcp_single_pool_static_mapping (__main__.TestServiceDHCPServer.test_dhcp_single_pool_static_mapping) ... ERROR
DEBUG -
DEBUG - ======================================================================
DEBUG - ERROR: test_dhcp_dynamic_dns_update (__main__.TestServiceDHCPServer.test_dhcp_dynamic_dns_update)
DEBUG - ----------------------------------------------------------------------
DEBUG - Traceback (most recent call last):
DEBUG - File "/usr/libexec/vyos/tests/smoke/cli/test_service_dhcp-server.py", line 1262, in test_dhcp_dynamic_dns_update
DEBUG - config = read_file(KEA4_CONF)
DEBUG - ^^^^^^^^^^^^^^^^^^^^
DEBUG - File "/usr/lib/python3/dist-packages/vyos/utils/file.py", line 44, in read_file
DEBUG - raise e
DEBUG - File "/usr/lib/python3/dist-packages/vyos/utils/file.py", line 38, in read_file
DEBUG - with open(fname, 'r') as f:
DEBUG - ^^^^^^^^^^^^^^^^
512455c
to
3fd44d7
Compare
CI integration ❌ failed! Details
|
Current failing tests seem to be in conntrack-sync witht the firewall
|
Changes have been implemented, and i'm currently using a image with this merge for testing The failing smoketest is for conntrack, and does't seem related to this merge |
Change summary
The change adds support for VRF in the KEA DHCP-server
Change implemtes desired config from T6211
Unsure if tests should be placed in the VRF segment or in the DHCP segment - therefor no tests are added for the VRF part - yet
Types of changes
Related Task(s)
https://vyos.dev/T6211
Related PR(s)
vyos/vyos-documentation#1637
How to test / Smoketest result
ran tests locally and the pass - a new test was added for vrf to ensure it is checked
Checklist: