Skip to content
Snippets Groups Projects

Implement get_router_dashboard_data and _provision_vlan_dashboards

Merged Maryam Mokhtarifar requested to merge feature/POL1-877-add-vlans-dashboard into develop
1 file
+ 0
1
Compare changes
  • Side-by-side
  • Inline
@@ -543,9 +543,33 @@ def get_router_dashboard_data(interfaces):
:return: dictionary of routers (dashboards) and their interface data.
"""
# TODO: implement
result = {}
filtered_interfaces = [interface for interface in interfaces if interface.get('vlan_type') in {'TRUNK', 'VLAN'}]
sorted_interfaces = sorted(filtered_interfaces, key=lambda x: x['name'])
for interface in sorted_interfaces:
description = interface['description'].strip()
interface_name = interface['name']
host = interface['router']
return {}
router = host.replace('.geant.net', '')
panel_title = f'{router} - {{}} - {interface_name} - {description}'
dashboard_name = interface['router']
dashboard = result.setdefault(dashboard_name, {})
base_interface = interface_name.split('.')[0]
dropdown = dashboard.setdefault(base_interface, [])
dropdown.append({
'title': panel_title,
'interface': interface_name,
'hostname': host
})
return result
def get_interface_data(interfaces):
@@ -1130,7 +1154,6 @@ def get_dashboard_data_dropdown(
def get_nren_dashboard_data(data, datasource, tag):
func = partial(
get_dashboard_with_agg_data_single,
datasource=datasource,
Loading