#!/usr/bin/env python3 import subprocess # This script removes a route and adds it again to address a timing issue # for L2GRE tunnels # The script is only meant to be run via the AOS R8 ams cron-app # See https://dokuwiki.alu4u.com/doku.php?id=aos-r8-omniswitch-crontab-cron-cronjob-reboot for details # # Adapt the following to your needs # -Benny # Destination destination = "1.1.1.1" # Mask e.g. /32 mask = "32" # Gateway gateway = "192.168.2.1" # # Do not modify below this line # subprocess.run(['no', 'ip', 'static-route', f'{destination}/{mask}', 'gateway', f'{gateway}'], capture_output=False) subprocess.run(['ip', 'static-route', f'{destination}/{mask}', 'gateway', f'{gateway}'], capture_output=False)