mirror of
https://github.com/NeoCloud/NeoNetwork
synced 2024-12-26 13:39:24 +08:00
expose route type
This commit is contained in:
parent
7292a96c81
commit
4fc4de3e91
1 changed files with 4 additions and 6 deletions
|
@ -101,12 +101,9 @@ def route_to_roa(asn_table: dict):
|
||||||
assert fields["name"]
|
assert fields["name"]
|
||||||
assert is_neo_network(fields["prefix"])
|
assert is_neo_network(fields["prefix"])
|
||||||
assert not fields["supernet"] or is_neo_network(fields["supernet"])
|
assert not fields["supernet"] or is_neo_network(fields["supernet"])
|
||||||
yield fields
|
yield pick(fields, ["asn", "name", "type", "prefix", "supernet"])
|
||||||
|
|
||||||
entities = (
|
entities = sorted(make_route(), key=lambda item: item["asn"])
|
||||||
pick(route, ["asn", "name", "prefix", "supernet"]) for route in make_route()
|
|
||||||
)
|
|
||||||
entities = sorted(entities, key=lambda item: item["asn"])
|
|
||||||
prefixes = [item["prefix"] for item in entities]
|
prefixes = [item["prefix"] for item in entities]
|
||||||
for net1, net2 in combinations(
|
for net1, net2 in combinations(
|
||||||
sorted(entities, key=lambda net: net["prefix"].prefixlen), 2
|
sorted(entities, key=lambda net: net["prefix"].prefixlen), 2
|
||||||
|
@ -288,12 +285,13 @@ def make_summary():
|
||||||
(
|
(
|
||||||
"AS{asn}".format_map(entity),
|
"AS{asn}".format_map(entity),
|
||||||
entity["name"],
|
entity["name"],
|
||||||
|
entity["type"],
|
||||||
entity["prefix"] or "",
|
entity["prefix"] or "",
|
||||||
entity["supernet"] or "",
|
entity["supernet"] or "",
|
||||||
)
|
)
|
||||||
for entity in route_to_roa(asn_table)
|
for entity in route_to_roa(asn_table)
|
||||||
),
|
),
|
||||||
headers=["ASN", "Name", "Prefix", "Supernet"],
|
headers=["ASN", "Name", "Type", "Prefix", "Supernet"],
|
||||||
tablefmt="presto",
|
tablefmt="presto",
|
||||||
)
|
)
|
||||||
print(route_table)
|
print(route_table)
|
||||||
|
|
Loading…
Reference in a new issue