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

Change IAS upstream tag to include GWS_UPSTREAMS

parent e09f9f23
No related branches found
No related tags found
No related merge requests found
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
"search": true, "search": true,
"starred": false, "starred": false,
"tags": [ "tags": [
"IAS_UPSTREAM" "UPSTREAM"
], ],
"targets": [ "targets": [
{ {
......
...@@ -20,7 +20,7 @@ from brian_dashboard_manager.templating.nren_access import generate_nrens ...@@ -20,7 +20,7 @@ from brian_dashboard_manager.templating.nren_access import generate_nrens
from brian_dashboard_manager.templating.helpers import is_re_customer, \ from brian_dashboard_manager.templating.helpers import is_re_customer, \
is_cls_peer, is_cls, is_ias_customer, is_ias_private, is_ias_public, \ is_cls_peer, is_cls, is_ias_customer, is_ias_private, is_ias_public, \
is_ias_upstream, is_ias_peer, is_lag_backbone, is_nren, is_phy_upstream, \ is_ias_upstream, is_ias_peer, is_lag_backbone, is_nren, is_phy_upstream, \
is_re_peer, is_gcs, is_geantopen, is_l2circuit, is_lhcone_peer, \ is_re_peer, is_gcs, is_cae1, is_geantopen, is_l2circuit, is_lhcone_peer, \
is_lhcone_customer, is_lhcone, is_mdvpn, get_aggregate_dashboard_data, \ is_lhcone_customer, is_lhcone, is_mdvpn, get_aggregate_dashboard_data, \
get_interface_data, parse_backbone_name, parse_phy_upstream_name, \ get_interface_data, parse_backbone_name, parse_phy_upstream_name, \
get_dashboard_data, get_aggregate_interface_data get_dashboard_data, get_aggregate_interface_data
...@@ -196,11 +196,11 @@ def provision(config): ...@@ -196,11 +196,11 @@ def provision(config):
}, },
'IAS UPSTREAM': { 'IAS UPSTREAM': {
'predicate': is_ias_upstream, 'predicate': is_ias_upstream,
'tag': 'IAS_UPSTREAM' 'tag': ['IAS_UPSTREAM', 'UPSTREAM']
}, },
'GWS PHY Upstream': { 'GWS PHY Upstream': {
'predicate': is_phy_upstream, 'predicate': is_phy_upstream,
'tag': 'GWS_UPSTREAM', 'tag': ['GWS_UPSTREAM', 'UPSTREAM'],
'errors': True, 'errors': True,
'parse_func': parse_phy_upstream_name 'parse_func': parse_phy_upstream_name
} }
...@@ -233,10 +233,10 @@ def provision(config): ...@@ -233,10 +233,10 @@ def provision(config):
'predicate': is_lhcone, 'predicate': is_lhcone,
'tag': 'lhcone', 'tag': 'lhcone',
}, },
# 'CAE1': { 'CAE1': {
# 'predicate': is_cae1, 'predicate': is_cae1,
# 'tag': 'cae', 'tag': 'cae',
# } }
} }
with ProcessPoolExecutor(max_workers=4) as executor: with ProcessPoolExecutor(max_workers=4) as executor:
...@@ -264,7 +264,7 @@ def provision(config): ...@@ -264,7 +264,7 @@ def provision(config):
if dashboard['title'] not in excluded_dashboards: if dashboard['title'] not in excluded_dashboards:
if dashboard['title'].lower() == 'home': if dashboard['title'].lower() == 'home':
dashboard['uid'] = 'home' dashboard['uid'] = 'home'
create_dashboard(token_request, dashboard) create_dashboard(token_request, dashboard)
# Home dashboard is always called "Home" # Home dashboard is always called "Home"
# Make sure it's set for the organization # Make sure it's set for the organization
......
...@@ -113,7 +113,10 @@ def is_lag_backbone(interface): ...@@ -113,7 +113,10 @@ def is_lag_backbone(interface):
def is_cae1(interface): def is_cae1(interface):
return interface.get('router', '').lower() == 'mx1.lon.uk.geant.net' iface_regex = r'^ae12(\.\d+|$)$'
is_router = interface.get('router', '').lower() == 'mx1.lon.uk.geant.net'
is_iface = re.match(iface_regex, interface.get('name'))
return is_router and is_iface
def parse_backbone_name(description, *args, **kwargs): def parse_backbone_name(description, *args, **kwargs):
...@@ -329,14 +332,19 @@ def get_dashboard_data(data, datasource, tag, errors=False): ...@@ -329,14 +332,19 @@ def get_dashboard_data(data, datasource, tag, errors=False):
return result return result
for peer, panels in data.items(): for peer, panels in data.items():
result = {
yield {
'title': peer, 'title': peer,
'datasource': datasource, 'datasource': datasource,
'panels': get_panel_definitions(panels, datasource), 'panels': get_panel_definitions(panels, datasource),
'tag': tag
} }
if isinstance(tag, list):
result['tags'] = tag
else:
result['tag'] = tag
yield result
def create_aggregate_panel(title, gridpos, targets, datasource): def create_aggregate_panel(title, gridpos, targets, datasource):
...@@ -409,9 +417,15 @@ def get_aggregate_dashboard_data(title, targets, datasource, tag): ...@@ -409,9 +417,15 @@ def get_aggregate_dashboard_data(title, targets, datasource, tag):
title + f' - {target}', gridPos, targets[target], datasource) title + f' - {target}', gridPos, targets[target], datasource)
panels.extend([_in, _out]) panels.extend([_in, _out])
return { result = {
'title': title, 'title': title,
'datasource': datasource, 'datasource': datasource,
'panels': panels, 'panels': panels,
'tag': tag
} }
if isinstance(tag, list):
result['tags'] = tag
else:
result['tag'] = tag
return result
...@@ -17,7 +17,15 @@ ...@@ -17,7 +17,15 @@
"graphTooltip": 0, "graphTooltip": 0,
"schemaVersion": 27, "schemaVersion": 27,
"style": "dark", "style": "dark",
{% if not tags %}
"tags": ["{{ tag }}"], "tags": ["{{ tag }}"],
{% else %}
"tags": [
{% for tag in tags %}
"{{ tag }}"{{ "," if not loop.last }}
{% endfor %}
],
{% endif %}
"templating": { "templating": {
"list": [] "list": []
}, },
......
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