diff --git a/brian_dashboard_manager/templating/helpers.py b/brian_dashboard_manager/templating/helpers.py index dd71709b4c400d5d667b09843feb545c39131a45..6f98043061fdf490c393ba9da5d1663e45bfe08f 100644 --- a/brian_dashboard_manager/templating/helpers.py +++ b/brian_dashboard_manager/templating/helpers.py @@ -140,6 +140,7 @@ def get_nren_interface_data(services, interfaces, excluded_dashboards): result = {} customers = defaultdict(list) + aggregate_interfaces = dict() for service in services: _customers = service.get('customers') @@ -187,6 +188,8 @@ def get_nren_interface_data(services, interfaces, excluded_dashboards): router = router.replace('.geant.net', '') location = router.split('.')[1].upper() title = f'{location} - {customer} ({if_name}) | {name}' + + aggregate_interfaces[f'{router}:::{if_name}'] = True dashboard['AGGREGATES'].append({ 'measurement': measurement, 'alias': title, @@ -203,6 +206,9 @@ def get_nren_interface_data(services, interfaces, excluded_dashboards): 'scid': scid }) + def _check_in_aggregate(router, interface): + return f'{router}:::{interface}' in aggregate_interfaces + for interface in interfaces: description = interface['description'].strip() @@ -225,7 +231,8 @@ def get_nren_interface_data(services, interfaces, excluded_dashboards): '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({ 'interface': interface_name, 'hostname': host, diff --git a/changelog.md b/changelog.md index f9571d90f7ed601977bd63294712578bc10d51ed..a86109fdec8030487cc4dfdf42a6403fecdbcdab 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,9 @@ All notable changes to this project will be documented in this file. +## [0.46] - 2022-12-7 +- POL1-645: Changed NREN aggregate code to not add duplicate interfaces + ## [0.45] - 2022-12-7 - POL1-642: Added new service-based NREN dashboard as a separate beta for staff - POL1-645: Changed how interfaces/services are addeed to Aggregate panels diff --git a/setup.py b/setup.py index 6f13dbb6d6dad43c4fd39301fbe66baab8e92190..7b9fafb0dec5baef3d21158dc374504fe77ecc5b 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup( name='brian-dashboard-manager', - version="0.45", + version="0.46", author='GEANT', author_email='swd@geant.org', description='',