From 82aaa8c22df19ee25481a3394ee430373db1371d Mon Sep 17 00:00:00 2001 From: Erik Reid <erik.reid@geant.org> Date: Mon, 4 Mar 2019 11:24:14 +0100 Subject: [PATCH] filter ix public peer same-router addresses by protocol --- inventory_provider/routes/classifier.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/inventory_provider/routes/classifier.py b/inventory_provider/routes/classifier.py index 4d156f7f..b2e96b65 100644 --- a/inventory_provider/routes/classifier.py +++ b/inventory_provider/routes/classifier.py @@ -104,14 +104,15 @@ def ix_peering_info(peer_info): other = r.get(k.decode('utf-8')).decode('utf-8') other = json.loads(other) + peer_address = ipaddress.ip_address(other['name']) + if protocol != type(peer_address).__name__: + continue + if other['router'] == peer_info['router']: result['router'].append(other['name']) assert other['description'] is not None # sanity: as above... - if not other['description'].startswith(keyword): - continue - peer_address = ipaddress.ip_address(other['name']) - if protocol == type(peer_address).__name__: + if other['description'].startswith(keyword): result['group'].append(other['name']) return result -- GitLab