diff options
author | sarthurdev <965089+sarthurdev@users.noreply.github.com> | 2024-03-06 21:53:46 +0100 |
---|---|---|
committer | sarthurdev <965089+sarthurdev@users.noreply.github.com> | 2024-03-06 21:53:46 +0100 |
commit | c55140f8bbd8e8f0e7c112a419027b65d479add6 (patch) | |
tree | febdff7317511b376dea9d7f1a90cf99df8c5f24 /python | |
parent | 38fdc27ee2b3253053b2794e3e7ec5d8e0d5aa02 (diff) | |
download | vyos-1x-c55140f8bbd8e8f0e7c112a419027b65d479add6.tar.gz vyos-1x-c55140f8bbd8e8f0e7c112a419027b65d479add6.zip |
dhcp: T6102: Fix clear DHCP lease op-mode
* Add `clear dhcpv6-server lease`
* Standardize using vyos.opmode
Diffstat (limited to 'python')
-rw-r--r-- | python/vyos/kea.py | 12 |
1 files changed, 12 insertions, 0 deletions
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' |