From f7c5c77376b9138d239cdccda605713b5d7681e1 Mon Sep 17 00:00:00 2001 From: sarthurdev <965089+sarthurdev@users.noreply.github.com> Date: Thu, 20 Mar 2025 16:49:46 +0100 Subject: kea: T7281: Add support for ping-check in Kea --- python/vyos/kea.py | 5 ++++- python/vyos/template.py | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'python') diff --git a/python/vyos/kea.py b/python/vyos/kea.py index 264142f13..a2a35cf65 100644 --- a/python/vyos/kea.py +++ b/python/vyos/kea.py @@ -145,7 +145,7 @@ def kea_parse_options(config): def kea_parse_subnet(subnet, config): - out = {'subnet': subnet, 'id': int(config['subnet_id'])} + out = {'subnet': subnet, 'id': int(config['subnet_id']), 'user-context': {}} if 'option' in config: out['option-data'] = kea_parse_options(config['option']) @@ -163,6 +163,9 @@ def kea_parse_subnet(subnet, config): out['valid-lifetime'] = int(config['lease']) out['max-valid-lifetime'] = int(config['lease']) + if 'ping_check' in config: + out['user-context']['enable-ping-check'] = True + if 'range' in config: pools = [] for num, range_config in config['range'].items(): diff --git a/python/vyos/template.py b/python/vyos/template.py index f5baf8dbd..7ba85a046 100755 --- a/python/vyos/template.py +++ b/python/vyos/template.py @@ -873,7 +873,8 @@ def kea_shared_network_json(shared_networks): network = { 'name': name, 'authoritative': ('authoritative' in config), - 'subnet4': [] + 'subnet4': [], + 'user-context': {} } if 'option' in config: @@ -885,6 +886,9 @@ def kea_shared_network_json(shared_networks): if 'bootfile_server' in config['option']: network['next-server'] = config['option']['bootfile_server'] + if 'ping_check' in config: + network['user-context']['enable-ping-check'] = True + if 'subnet' in config: for subnet, subnet_config in config['subnet'].items(): if 'disable' in subnet_config: -- cgit v1.2.3