summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Pignolet <matthieu@matthieu-dev.xyz>2025-01-27 08:08:32 +0400
committerGitHub <noreply@github.com>2025-01-27 08:08:32 +0400
commiteed9bc6169239555d5cdbd2327b8f0ca8407af33 (patch)
tree589a9494962e4de0deccd1adacfd56b87acf3eb3
parent4bcee1cde2e98d0c61dca7e376a62c9831cb10e7 (diff)
read ipv6 routes
-rwxr-xr-xfrr-evpn-route-watcher/task.py10
1 files 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()