From c55140f8bbd8e8f0e7c112a419027b65d479add6 Mon Sep 17 00:00:00 2001 From: sarthurdev <965089+sarthurdev@users.noreply.github.com> Date: Wed, 6 Mar 2024 21:53:46 +0100 Subject: dhcp: T6102: Fix clear DHCP lease op-mode * Add `clear dhcpv6-server lease` * Standardize using vyos.opmode --- python/vyos/kea.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'python') diff --git a/python/vyos/kea.py b/python/vyos/kea.py index 2328d0b00..5aa91e652 100644 --- a/python/vyos/kea.py +++ b/python/vyos/kea.py @@ -328,6 +328,18 @@ def kea_get_leases(inet): return leases['arguments']['leases'] +def kea_delete_lease(inet, ip_address): + ctrl_socket = f'/run/kea/dhcp{inet}-ctrl-socket' + + args = {'ip-address': ip_address} + + result = _ctrl_socket_command(ctrl_socket, f'lease{inet}-del', args) + + if result and 'result' in result: + return result['result'] == 0 + + return False + def kea_get_active_config(inet): ctrl_socket = f'/run/kea/dhcp{inet}-ctrl-socket' -- cgit v1.2.3