From eed9bc6169239555d5cdbd2327b8f0ca8407af33 Mon Sep 17 00:00:00 2001 From: Matthieu Pignolet Date: Mon, 27 Jan 2025 08:08:32 +0400 Subject: read ipv6 routes --- frr-evpn-route-watcher/task.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frr-evpn-route-watcher/task.py b/frr-evpn-route-watcher/task.py index 4b497ea..ce31d92 100755 --- a/frr-evpn-route-watcher/task.py +++ b/frr-evpn-route-watcher/task.py @@ -12,7 +12,7 @@ def get_frr_vrfs(): def get_frr_evpn_info(): """Lists all the routes learned via evpn""" process = subprocess.run( - ["vtysh", "-c", "show ip bgp l2vpn evpn json"], capture_output=True + ["vtysh", "-c", "show bgp l2vpn evpn json"], capture_output=True ) return json.loads(process.stdout) @@ -26,9 +26,11 @@ def remove_route_vrf(ip): subprocess.run(["ip", "route", "del", str(ip)]) def currently_routed(vrfs_names): - process = subprocess.run(["ip", "route"], capture_output=True, text=True) + processfour = subprocess.run(["ip", "route"], capture_output=True, text=True).stdout.splitlines() + processsixe = subprocess.run(["ip", "-6", "route"], capture_output=True, text=True).stdout.splitlines() + processresults = processfour + processsixe routed_ips = [] - for route in process.stdout.splitlines(): + for route in processresults: parts = route.split(" ") if len(parts) == 6: addr, dev, vrf, scope, link = ( @@ -110,4 +112,4 @@ def resolve_routes(): print(f"removing route for {remove}") remove_route_vrf(remove) -resolve_routes() \ No newline at end of file +resolve_routes() -- cgit v1.2.3