def disable_all_non_dynamic_firewall_rules(api):
"""
Disable all non-dynamic firewall rules on the router.
:param api: The RouterOS API object.
"""
# Access the firewall resource
firewall_resource = api.get_resource('/ip/firewall/filter')
# Get all firewall rules
firewall_rules = firewall_resource.get()
print(f"Disabling all non-dynamic firewall rules")
# Loop through all firewall rules and disable each one
for firewall_rule in firewall_rules:
if firewall_rule['dynamic'] == 'false':
print(f"Disabling firewall rule {firewall_rule['comment']}")
rule_id = firewall_rule['id']
firewall_resource.set(id=rule_id, disabled='yes')