From ff7e44323282ffe8a52bad160ce51f54739f7201 Mon Sep 17 00:00:00 2001 From: Jerry Date: Sun, 26 Sep 2021 22:26:59 +0800 Subject: [PATCH] roa.py: add free cidr range --- scripts/roa.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/roa.py b/scripts/roa.py index d3f2be7..2da29c1 100755 --- a/scripts/roa.py +++ b/scripts/roa.py @@ -392,6 +392,7 @@ def make_summary(): print(route_table) print() print("## Used CIDR Range") + print("
\nClick to expand") print() prefixes = netaddr.cidr_merge( netaddr.IPNetwork(str(entity["prefix"])) @@ -401,6 +402,17 @@ def make_summary(): for prefix in prefixes: print(prefix) print("```") + print("
") + free_netset = netaddr.IPSet([str(n) for n in NEO_NETWORK_POOL]) - netaddr.IPSet(prefixes) + print() + print("## Free CIDR Range") + print("
\nClick to expand") + print() + print("```") + for prefix in free_netset.iter_cidrs(): + print(prefix) + print("```") + print("
") IP_VRSIONS = {4, 6} total_ip_count = { ver: sum(