From 887cc893b449c5e836e613f20ab5af8e5c88fba6 Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Wed, 27 Dec 2023 22:30:28 +0100 Subject: [PATCH] maria's test aggregator automagically adds default routes and dumps nexthops --- mq-sketch/myagr.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/mq-sketch/myagr.py b/mq-sketch/myagr.py index dde2dcc2..2c35196a 100755 --- a/mq-sketch/myagr.py +++ b/mq-sketch/myagr.py @@ -140,22 +140,33 @@ t = IPTrie() p = input() data = p.split(" ") +nexthops = set() + try: t.add(AgrPointv6(data[0], data[1])) + nexthops.add(data[1]) try: while p := input(): data = p.split(" ") t.add(AgrPointv6(data[0], data[1])) + nexthops.add(data[1]) except EOFError: - pass + if t.local is None: + t.add(AgrPointv6("::/0", "__auto_unreachable")) + nexthops.add("__auto_unreachable") except ipaddress.AddressValueError: t.add(AgrPointv4(data[0], data[1])) + nexthops.add(data[1]) try: while p := input(): data = p.split(" ") t.add(AgrPointv4(data[0], data[1])) + nexthops.add(data[1]) except EOFError: - pass + if t.local is None: + t.add(AgrPointv4("0.0.0.0/0", "__auto_unreachable")) + nexthops.add("__auto_unreachable") + # Dump print("Dump After Load") @@ -168,3 +179,7 @@ tt = t.aggregate() ttt = tt.prune() print("Dump After Prune") print(ttt.dump()) + +print("Nexthops known") +for n in nexthops: + print(n)