Skip to content
Snippets Groups Projects
Commit 63e78367 authored by Bjarke Madsen's avatar Bjarke Madsen
Browse files

Remove duplicate interfaces in NREN aggregates

parent 9a9b667f
No related branches found
No related tags found
No related merge requests found
...@@ -140,6 +140,7 @@ def get_nren_interface_data(services, interfaces, excluded_dashboards): ...@@ -140,6 +140,7 @@ def get_nren_interface_data(services, interfaces, excluded_dashboards):
result = {} result = {}
customers = defaultdict(list) customers = defaultdict(list)
aggregate_interfaces = dict()
for service in services: for service in services:
_customers = service.get('customers') _customers = service.get('customers')
...@@ -187,6 +188,8 @@ def get_nren_interface_data(services, interfaces, excluded_dashboards): ...@@ -187,6 +188,8 @@ def get_nren_interface_data(services, interfaces, excluded_dashboards):
router = router.replace('.geant.net', '') router = router.replace('.geant.net', '')
location = router.split('.')[1].upper() location = router.split('.')[1].upper()
title = f'{location} - {customer} ({if_name}) | {name}' title = f'{location} - {customer} ({if_name}) | {name}'
aggregate_interfaces[f'{router}:::{if_name}'] = True
dashboard['AGGREGATES'].append({ dashboard['AGGREGATES'].append({
'measurement': measurement, 'measurement': measurement,
'alias': title, 'alias': title,
...@@ -203,6 +206,9 @@ def get_nren_interface_data(services, interfaces, excluded_dashboards): ...@@ -203,6 +206,9 @@ def get_nren_interface_data(services, interfaces, excluded_dashboards):
'scid': scid 'scid': scid
}) })
def _check_in_aggregate(router, interface):
return f'{router}:::{interface}' in aggregate_interfaces
for interface in interfaces: for interface in interfaces:
description = interface['description'].strip() description = interface['description'].strip()
...@@ -225,7 +231,8 @@ def get_nren_interface_data(services, interfaces, excluded_dashboards): ...@@ -225,7 +231,8 @@ def get_nren_interface_data(services, interfaces, excluded_dashboards):
'PHYSICAL': [] 'PHYSICAL': []
}) })
if port_type == 'access': _covered_by_service = _check_in_aggregate(router, interface_name)
if port_type == 'access' and not _covered_by_service:
dashboard['AGGREGATES'].append({ dashboard['AGGREGATES'].append({
'interface': interface_name, 'interface': interface_name,
'hostname': host, 'hostname': host,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment