def disable_all_dhcp_clients(api):
"""
Disable all DHCP clients on the router.
:param api: The RouterOS API object.
"""
# Access the DHCP client resource
dhcp_client_resource = api.get_resource('/ip/dhcp-client')
# Get all DHCP clients
dhcp_clients = dhcp_client_resource.get()
# Loop through all DHCP clients and disable each one
for dhcp_client in dhcp_clients:
print(f"Disabling DHCP client {dhcp_client['interface']}")
client_id = dhcp_client['id']
dhcp_client_resource.set(id=client_id, disabled='yes')