Skip to content
Snippets Groups Projects
Commit ec41598a authored by Sam Roberts's avatar Sam Roberts
Browse files

rework region dashboards change into _get_dashboard_data

parent 3651fa80
No related branches found
No related tags found
1 merge request!41Feature/pol1 430 eap nrens
This commit is part of merge request !41. Comments created here will be created in the context of that merge request.
......@@ -523,7 +523,10 @@ def _get_dashboards(interface):
yield BRIAN_DASHBOARDS.ANA
def _get_dashboard_data(ifc, customers):
def _get_dashboard_data(ifc, customers, regions=None):
if regions is None:
regions = []
def _get_interface_type(description):
if re.match(r'^PHY', description):
return INTERFACE_TYPES.PHYSICAL
......@@ -580,6 +583,15 @@ def _get_dashboard_data(ifc, customers):
if not names:
return ifc
# add region-based dashboard names
region_names = []
for name in names:
if name in regions:
region = regions[name]
if region == 'EAP':
region_names.append(BRIAN_DASHBOARDS.EAP.name)
names.extend(region_names)
# to maintain compatability with current brian dashboard manager we will
# continue to return dashboard_info with the first customer name. We will
# also return dashboards_info (note the plural of dashboards) with up to
......@@ -597,20 +609,6 @@ def _get_dashboard_data(ifc, customers):
}
def _add_region_data(ifc, regions):
if 'dashboards_info' in ifc:
for item in ifc['dashboards_info']:
name = item['name']
if name in regions:
region = regions[name]
if region == 'EAP':
dashboards = ifc['dashboards']
dashboards.append(BRIAN_DASHBOARDS.EAP.name)
ifc['dashboards'] = sorted(dashboards)
return ifc
return ifc
def _load_interface_bundles(config, hostname=None, use_next_redis=False):
result = dict()
......@@ -883,8 +881,7 @@ def load_interfaces_to_poll(config, hostname=None, no_lab=False, use_next_redis=
ifc['dashboards'] = sorted([d.name for d in dashboards])
ifc = _get_dashboard_data(
ifc, ifc_services_and_customers.get('customers', []))
ifc = _add_region_data(ifc, nren_regions)
ifc, ifc_services_and_customers.get('customers', []), nren_regions)
port_type = _get_port_type(ifc['description'])
ifc['port_type'] = port_type
yield ifc
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment