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

Add GWS direct panel name changes

parent 67f5a8e8
No related branches found
No related tags found
No related merge requests found
......@@ -5,13 +5,27 @@ from brian_dashboard_manager.templating.helpers import get_dashboard_data
def get_panel_data(interfaces):
result = DefaultDict(list)
count = {}
def add_num(iface):
name = iface['nren'] + iface['isp'] + iface['tag']
count[name] = count.get(name, 0) + 1
iface['num'] = count[name]
return iface
# Add a number to multiple interfaces for same nren/isp combination,
# as they share the same tag if the hostnames are different.
interfaces = list(map(add_num, interfaces))
for interface in interfaces:
isp = interface.get('isp')
nren = interface.get('nren')
hostname = interface.get('hostname')
# identifier for interface, as we don't have their names
interface_tag = interface.get('tag')
if_num = interface.get('num')
counters = interface.get('counters')
......@@ -26,14 +40,14 @@ def get_panel_data(interfaces):
continue
gws_measurement = 'gwsd_rates'
panel_title = f'{nren} - {interface_tag} - {{}}'
title = f'{nren} GWS Direct {isp} Interface {if_num} ({hostname})'
result[f'GWS Direct - {isp}'].append({
'isp': isp,
'nren': nren,
'measurement': gws_measurement,
'title': panel_title,
'title': title,
'interface_tag': interface_tag,
'hostname': interface.get('hostname'),
'hostname': hostname,
'has_v6': False
})
return result
......
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