From bdbbe243c6c0118b862cebfe1bce06bd0a12f40d Mon Sep 17 00:00:00 2001 From: Johann Wagner Date: Fri, 27 Sep 2024 20:57:34 +0200 Subject: [PATCH] fix: work correctly for routers with a single ixp session --- wanda/filter_list_generation.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/wanda/filter_list_generation.py b/wanda/filter_list_generation.py index f3b338b..cd03564 100644 --- a/wanda/filter_list_generation.py +++ b/wanda/filter_list_generation.py @@ -1,5 +1,6 @@ import pathlib import platform +from collections import defaultdict from multiprocessing.pool import Pool from wanda.as_filter.as_filter import ASFilter @@ -88,9 +89,6 @@ def main_customer_filter_lists( router_per_as[router_hostname] = {asn} for ixp in ixp_list: - if ixp['is_route_server']: - continue - fc = list(filter(lambda c: c['id'] == ixp['ixp_connection']['id'], connections)) connection = fc[0] @@ -100,6 +98,11 @@ def main_customer_filter_lists( if hosts and router_hostname not in hosts: continue + if ixp['is_route_server']: + if router_hostname not in router_per_as: + router_per_as[router_hostname] = {} + continue + enabled_asn.add(asn) tag_list = map(lambda x: x['name'], ixp['tags']) @@ -135,7 +138,7 @@ def main_customer_filter_lists( n_worker = max_threads l.warning(f"Running with a limited amount of threads, n_worker={max_threads}") elif system_platform == "Linux": - n_worker = len(prepared_asns) + n_worker = max(len(prepared_asns), 1) else: l.warning("Running with a limited amount of threads due to OS limitations...") n_worker = 8