From 25b7a65cc22def633a0021b861baba0e2e00586b Mon Sep 17 00:00:00 2001 From: Neo_Chen Date: Thu, 4 May 2023 14:04:08 +0800 Subject: [PATCH] ROA Generator: removed nodes / peer support --- scripts/roa.py | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) diff --git a/scripts/roa.py b/scripts/roa.py index eab5c91..3d8bc01 100755 --- a/scripts/roa.py +++ b/scripts/roa.py @@ -95,24 +95,6 @@ def load_asn(entities: dict): assert entity["source"] in ["NeoNetwork", "DN42", "Internet"] yield asn, entity - -def node_to_asn(orignal_asn_set: set): - node_table = dict() - for _, entities in iter_toml_file("node"): - mapping = {name: entity["asn"] for (name, entity) in entities.items()} - asn_set = set(mapping.values()) - assert orignal_asn_set & asn_set == asn_set - node_table.update(mapping) - return node_table - - -def assert_peer(nodes: set): - for item, entities in iter_toml_file("peer"): - peers = set(entities["to-peer"]) - assert item.stem in nodes - assert nodes & peers == peers - - def route_to_roa(asn_table: dict): def make_route(): for item, entity in iter_toml_file("route"): @@ -319,7 +301,6 @@ def make_roa_records(roa4, roa6): def make_summary(): entities = dict(load_entities()) asn_table = dict(load_asn(entities)) - node_table = node_to_asn(set(asn_table.keys())) stream = StringIO() with redirect_stdout(stream): print("# NeoNetwork Summary") @@ -352,32 +333,6 @@ def make_summary(): ) print(as_table) print() - print("## Node table") - print() - node_table = tabulate( - ( - ("AS{}".format(asn), name) - for name, asn in sorted(node_table.items(), key=lambda item: item[1]) - ), - headers=["ASN", "Name"], - tablefmt="github", - ) - print(node_table) - print() - print("## Peer table") - print() - peer_table = tabulate( - ( - (item.stem, downstream) - for item, entity in iter_toml_file("peer") - for downstream in entity["to-peer"] - ), - headers=["Upstream", "Downstream"], - tablefmt="github", - colalign=("right",), - ) - print(peer_table) - print() print("## Route table") print() route_table = tabulate( @@ -472,8 +427,6 @@ def make_summary(): def main(args): entities = dict(load_entities()) asn_table = dict(load_asn(entities)) - node_table = node_to_asn(set(asn_table.keys())) - assert_peer(set(node_table.keys())) roa4, roa6 = prehandle_roa(asn_table, args) if args.export: return make_export(roa4, roa6)