Skip to content
Snippets Groups Projects
Commit 5683bdb5 authored by Release Webservice's avatar Release Webservice
Browse files

Finished release 0.39.

parents ed781ce6 bc9b8de8
No related branches found
No related tags found
No related merge requests found
...@@ -173,12 +173,17 @@ def provision_folder(token_request, folder_name, dash, ...@@ -173,12 +173,17 @@ def provision_folder(token_request, folder_name, dash,
Function to provision dashboards within a folder. Function to provision dashboards within a folder.
""" """
def _check_valid(interface): # def _check_valid(interface):
return interface['dashboard_info']['name'] != '' # return interface['dashboard_info']['name'] != ''
folder = find_folder(token_request, folder_name) folder = find_folder(token_request, folder_name)
tag = dash['tag'] tag = dash['tag']
interfaces = list(filter(_check_valid, dash['interfaces'])) interfaces = list(
filter(
lambda x: x['dashboards_info'],
dash['interfaces']
)
)
# dashboard should include error panels # dashboard should include error panels
errors = dash.get('errors', False) errors = dash.get('errors', False)
...@@ -286,9 +291,19 @@ def _provision_interfaces(config, org_config, ds_name, token): ...@@ -286,9 +291,19 @@ def _provision_interfaces(config, org_config, ds_name, token):
desc = interface['description'].lower() desc = interface['description'].lower()
lab = 'lab.office' in interface['router'].lower() lab = 'lab.office' in interface['router'].lower()
to_exclude = any(nren.lower() in desc for nren in excluded_nrens) to_exclude = any(nren.lower() in desc for nren in excluded_nrens)
if not (to_exclude or lab):
if 'dashboards_info' not in interface:
to_exclude = True
logger.info(f'No "dashboards_info" for '
f'{interface["router"]}:{interface["name"]}')
return not (to_exclude or lab) return not (to_exclude or lab)
relevant_interfaces = list(filter(excluded, interfaces)) relevant_interfaces = list(filter(excluded, interfaces))
for interface in relevant_interfaces:
interface['dashboards_info'] = filter(
lambda x: x['name'] != '',
interface['dashboards_info']
)
# loop over interfaces and add them to the dashboard_name # loop over interfaces and add them to the dashboard_name
# -> folder mapping structure `dashboards` above, for convenience. # -> folder mapping structure `dashboards` above, for convenience.
......
...@@ -79,49 +79,50 @@ def get_nren_interface_data(interfaces): ...@@ -79,49 +79,50 @@ def get_nren_interface_data(interfaces):
host = interface['router'] host = interface['router']
router = host.replace('.geant.net', '') router = host.replace('.geant.net', '')
location = host.split('.')[1].upper()
panel_title = f"{router} - {{}} - {interface_name} - {description}" panel_title = f"{router} - {{}} - {interface_name} - {description}"
info = interface['dashboard_info'] dashboards_info = interface['dashboards_info']
dashboard_name = info['name']
dashboard = result.get(dashboard_name, { for info in dashboards_info:
'AGGREGATES': [], dashboard_name = info['name']
'SERVICES': [],
'PHYSICAL': []
})
location = host.split('.')[1].upper()
if info['interface_type'] == 'AGGREGATE': dashboard = result.get(dashboard_name, {
dashboard['AGGREGATES'].append({ 'AGGREGATES': [],
'interface': interface_name, 'SERVICES': [],
'hostname': host, 'PHYSICAL': []
'alias': f"{location} - {dashboard_name} ({interface_name})"
}) })
# link aggregates are also shown if info['interface_type'] == 'AGGREGATE':
# under the physical dropdown dashboard['AGGREGATES'].append({
dashboard['PHYSICAL'].append({ 'interface': interface_name,
'title': panel_title, 'hostname': host,
'hostname': host, 'alias':
'interface': interface_name f"{location} - {dashboard_name} ({interface_name})"
}) })
elif info['interface_type'] == 'LOGICAL': # link aggregates are also shown
dashboard['SERVICES'].append({ # under the physical dropdown
'title': panel_title, dashboard['PHYSICAL'].append({
'hostname': host, 'title': panel_title,
'interface': interface_name 'hostname': host,
}) 'interface': interface_name
elif info['interface_type'] == 'PHYSICAL': })
dashboard['PHYSICAL'].append({
'title': panel_title, elif info['interface_type'] == 'LOGICAL':
'hostname': host, dashboard['SERVICES'].append({
'interface': interface_name 'title': panel_title,
}) 'hostname': host,
'interface': interface_name
result[dashboard_name] = dashboard })
elif info['interface_type'] == 'PHYSICAL':
dashboard['PHYSICAL'].append({
'title': panel_title,
'hostname': host,
'interface': interface_name
})
result[dashboard_name] = dashboard
return result return result
...@@ -141,19 +142,20 @@ def get_interface_data(interfaces): ...@@ -141,19 +142,20 @@ def get_interface_data(interfaces):
router = host.replace('.geant.net', '') router = host.replace('.geant.net', '')
panel_title = f"{router} - {{}} - {interface_name} - {description}" panel_title = f"{router} - {{}} - {interface_name} - {description}"
info = interface['dashboard_info'] dashboards_info = interface['dashboards_info']
dashboard_name = info['name'] for info in dashboards_info:
dashboard_name = info['name']
dashboard = result.get(dashboard_name, []) dashboard = result.get(dashboard_name, [])
dashboard.append({ dashboard.append({
'title': panel_title, 'title': panel_title,
'interface': interface_name, 'interface': interface_name,
'hostname': host, 'hostname': host,
'has_v6': len(interface.get('ipv6', [])) > 0 'has_v6': len(interface.get('ipv6', [])) > 0
}) })
result[dashboard_name] = dashboard result[dashboard_name] = dashboard
return result return result
...@@ -187,17 +189,18 @@ def get_aggregate_interface_data(interfaces, agg_type, group_field): ...@@ -187,17 +189,18 @@ def get_aggregate_interface_data(interfaces, agg_type, group_field):
interface_name = interface.get('name') interface_name = interface.get('name')
host = interface.get('router', '') host = interface.get('router', '')
remote = interface['dashboard_info']['name'] for info in interface['dashboards_info']:
remote = info['name']
location = host.split('.')[1].upper() location = host.split('.')[1].upper()
result.append({ result.append({
'type': agg_type, 'type': agg_type,
'interface': interface_name, 'interface': interface_name,
'hostname': host, 'hostname': host,
'remote': remote, 'remote': remote,
'location': location, 'location': location,
'alias': f"{location} - {remote} ({interface_name})", 'alias': f"{location} - {remote} ({interface_name})",
}) })
return reduce(get_reduce_func_for_field(group_field), result, {}) return reduce(get_reduce_func_for_field(group_field), result, {})
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## [0.39] - 2022-06-14
- POL1-524: Add multiple-customer support for l2 circuits
## [0.38] - 2022-04-06 ## [0.38] - 2022-04-06
- Modify staff home dashboard to include errors/discards - Modify staff home dashboard to include errors/discards
......
...@@ -2,7 +2,7 @@ from setuptools import setup, find_packages ...@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup( setup(
name='brian-dashboard-manager', name='brian-dashboard-manager',
version="0.38", version="0.39",
author='GEANT', author='GEANT',
author_email='swd@geant.org', author_email='swd@geant.org',
description='', description='',
......
...@@ -39,6 +39,10 @@ TEST_DASHBOARD = { ...@@ -39,6 +39,10 @@ TEST_DASHBOARD = {
"name": "EXOSCALE", "name": "EXOSCALE",
"interface_type": "LOGICAL" "interface_type": "LOGICAL"
}, },
"dashboards_info": [{
"name": "EXOSCALE",
"interface_type": "LOGICAL"
}],
"ipv4": [ "ipv4": [
"62.40.100.26/31" "62.40.100.26/31"
], ],
...@@ -71,6 +75,10 @@ TEST_DASHBOARD = { ...@@ -71,6 +75,10 @@ TEST_DASHBOARD = {
"name": "EXOSCALE", "name": "EXOSCALE",
"interface_type": "LOGICAL" "interface_type": "LOGICAL"
}, },
"dashboards_info": [{
"name": "EXOSCALE",
"interface_type": "LOGICAL"
}],
"ipv4": [ "ipv4": [
"62.40.100.20/31" "62.40.100.20/31"
], ],
...@@ -103,6 +111,10 @@ TEST_DASHBOARD = { ...@@ -103,6 +111,10 @@ TEST_DASHBOARD = {
"name": "T-SYSTEMS", "name": "T-SYSTEMS",
"interface_type": "LOGICAL" "interface_type": "LOGICAL"
}, },
"dashboards_info": [{
"name": "T-SYSTEMS",
"interface_type": "LOGICAL"
}],
"ipv4": [ "ipv4": [
"94.100.252.88/31" "94.100.252.88/31"
], ],
...@@ -133,6 +145,10 @@ TEST_DASHBOARD = { ...@@ -133,6 +145,10 @@ TEST_DASHBOARD = {
"name": "AWS", "name": "AWS",
"interface_type": "LOGICAL" "interface_type": "LOGICAL"
}, },
"dashboards_info": [{
"name": "AWS",
"interface_type": "LOGICAL"
}],
"ipv4": [ "ipv4": [
"52.95.219.129/31" "52.95.219.129/31"
], ],
...@@ -165,6 +181,10 @@ TEST_DASHBOARD = { ...@@ -165,6 +181,10 @@ TEST_DASHBOARD = {
"name": "CLOUDFERRO", "name": "CLOUDFERRO",
"interface_type": "LOGICAL" "interface_type": "LOGICAL"
}, },
"dashboards_info": [{
"name": "CLOUDFERRO",
"interface_type": "LOGICAL"
}],
"ipv4": [ "ipv4": [
"45.92.241.127/31" "45.92.241.127/31"
], ],
...@@ -195,6 +215,10 @@ TEST_DASHBOARD = { ...@@ -195,6 +215,10 @@ TEST_DASHBOARD = {
"name": "ORACLE", "name": "ORACLE",
"interface_type": "LOGICAL" "interface_type": "LOGICAL"
}, },
"dashboards_info": [{
"name": "ORACLE",
"interface_type": "LOGICAL"
}],
"ipv4": [ "ipv4": [
"130.61.6.73/31" "130.61.6.73/31"
], ],
...@@ -227,6 +251,10 @@ TEST_DASHBOARD = { ...@@ -227,6 +251,10 @@ TEST_DASHBOARD = {
"name": "AWS", "name": "AWS",
"interface_type": "LOGICAL" "interface_type": "LOGICAL"
}, },
"dashboards_info": [{
"name": "AWS",
"interface_type": "LOGICAL"
}],
"ipv4": [ "ipv4": [
"52.95.219.37/31" "52.95.219.37/31"
], ],
...@@ -259,6 +287,10 @@ TEST_DASHBOARD = { ...@@ -259,6 +287,10 @@ TEST_DASHBOARD = {
"name": "ORACLE", "name": "ORACLE",
"interface_type": "LOGICAL" "interface_type": "LOGICAL"
}, },
"dashboards_info": [{
"name": "ORACLE",
"interface_type": "LOGICAL"
}],
"ipv4": [ "ipv4": [
"132.145.7.81/31" "132.145.7.81/31"
], ],
......
...@@ -28,6 +28,10 @@ TEST_INTERFACES = [ ...@@ -28,6 +28,10 @@ TEST_INTERFACES = [
"name": "GEANT", "name": "GEANT",
"interface_type": "PHYSICAL" "interface_type": "PHYSICAL"
}, },
"dashboards_info": [{
"name": "GEANT",
"interface_type": "PHYSICAL"
}],
"ipv4": [], "ipv4": [],
"ipv6": [] "ipv6": []
}, },
...@@ -54,6 +58,10 @@ TEST_INTERFACES = [ ...@@ -54,6 +58,10 @@ TEST_INTERFACES = [
"name": "GEANT", "name": "GEANT",
"interface_type": "LOGICAL" "interface_type": "LOGICAL"
}, },
"dashboards_info": [{
"name": "GEANT",
"interface_type": "LOGICAL"
}],
"ipv4": [ "ipv4": [
"62.40.127.131/31" "62.40.127.131/31"
], ],
...@@ -84,6 +92,10 @@ TEST_INTERFACES = [ ...@@ -84,6 +92,10 @@ TEST_INTERFACES = [
"name": "GEANT", "name": "GEANT",
"interface_type": "LOGICAL" "interface_type": "LOGICAL"
}, },
"dashboards_info": [{
"name": "GEANT",
"interface_type": "LOGICAL"
}],
"ipv4": [ "ipv4": [
"10.101.0.6/30" "10.101.0.6/30"
], ],
...@@ -112,6 +124,10 @@ TEST_INTERFACES = [ ...@@ -112,6 +124,10 @@ TEST_INTERFACES = [
"name": "GEANT", "name": "GEANT",
"interface_type": "LOGICAL" "interface_type": "LOGICAL"
}, },
"dashboards_info": [{
"name": "GEANT",
"interface_type": "LOGICAL"
}],
"ipv4": [ "ipv4": [
"62.40.127.141/31" "62.40.127.141/31"
], ],
...@@ -140,6 +156,10 @@ TEST_INTERFACES = [ ...@@ -140,6 +156,10 @@ TEST_INTERFACES = [
"name": "GEANT", "name": "GEANT",
"interface_type": "LOGICAL" "interface_type": "LOGICAL"
}, },
"dashboards_info": [{
"name": "GEANT",
"interface_type": "LOGICAL"
}],
"ipv4": [ "ipv4": [
"10.1.1.1/30" "10.1.1.1/30"
], ],
...@@ -163,6 +183,10 @@ TEST_INTERFACES = [ ...@@ -163,6 +183,10 @@ TEST_INTERFACES = [
"name": "KIAE", "name": "KIAE",
"interface_type": "PHYSICAL" "interface_type": "PHYSICAL"
}, },
"dashboards_info": [{
"name": "KIAE",
"interface_type": "PHYSICAL"
}],
"ipv4": [], "ipv4": [],
"ipv6": [] "ipv6": []
}, },
...@@ -184,6 +208,10 @@ TEST_INTERFACES = [ ...@@ -184,6 +208,10 @@ TEST_INTERFACES = [
"name": "SWITCH", "name": "SWITCH",
"interface_type": "PHYSICAL" "interface_type": "PHYSICAL"
}, },
"dashboards_info": [{
"name": "SWITCH",
"interface_type": "PHYSICAL"
}],
"ipv4": [], "ipv4": [],
"ipv6": [] "ipv6": []
}, },
...@@ -202,6 +230,10 @@ TEST_INTERFACES = [ ...@@ -202,6 +230,10 @@ TEST_INTERFACES = [
"name": "GEANT", "name": "GEANT",
"interface_type": "LOGICAL" "interface_type": "LOGICAL"
}, },
"dashboards_info": [{
"name": "GEANT",
"interface_type": "LOGICAL"
}],
"ipv4": [], "ipv4": [],
"ipv6": [] "ipv6": []
}, },
...@@ -220,6 +252,10 @@ TEST_INTERFACES = [ ...@@ -220,6 +252,10 @@ TEST_INTERFACES = [
"name": "GEANT", "name": "GEANT",
"interface_type": "LOGICAL" "interface_type": "LOGICAL"
}, },
"dashboards_info": [{
"name": "GEANT",
"interface_type": "LOGICAL"
}],
"ipv4": [], "ipv4": [],
"ipv6": [] "ipv6": []
}, },
...@@ -238,6 +274,10 @@ TEST_INTERFACES = [ ...@@ -238,6 +274,10 @@ TEST_INTERFACES = [
"name": "GEANT", "name": "GEANT",
"interface_type": "LOGICAL" "interface_type": "LOGICAL"
}, },
"dashboards_info": [{
"name": "GEANT",
"interface_type": "LOGICAL"
}],
"ipv4": [], "ipv4": [],
"ipv6": [] "ipv6": []
} }
...@@ -262,6 +302,10 @@ NREN_INTERFACES = [ ...@@ -262,6 +302,10 @@ NREN_INTERFACES = [
"name": "HEANET", "name": "HEANET",
"interface_type": "PHYSICAL" "interface_type": "PHYSICAL"
}, },
"dashboards_info": [{
"name": "HEANET",
"interface_type": "PHYSICAL"
}],
"ipv4": [], "ipv4": [],
"ipv6": [] "ipv6": []
}, },
...@@ -283,6 +327,10 @@ NREN_INTERFACES = [ ...@@ -283,6 +327,10 @@ NREN_INTERFACES = [
"name": "HEANET", "name": "HEANET",
"interface_type": "PHYSICAL" "interface_type": "PHYSICAL"
}, },
"dashboards_info": [{
"name": "HEANET",
"interface_type": "PHYSICAL"
}],
"ipv4": [], "ipv4": [],
"ipv6": [] "ipv6": []
}, },
...@@ -304,6 +352,10 @@ NREN_INTERFACES = [ ...@@ -304,6 +352,10 @@ NREN_INTERFACES = [
"name": "HEANET", "name": "HEANET",
"interface_type": "PHYSICAL" "interface_type": "PHYSICAL"
}, },
"dashboards_info": [{
"name": "HEANET",
"interface_type": "PHYSICAL"
}],
"ipv4": [], "ipv4": [],
"ipv6": [] "ipv6": []
}, },
...@@ -327,6 +379,10 @@ NREN_INTERFACES = [ ...@@ -327,6 +379,10 @@ NREN_INTERFACES = [
"name": "HEANET", "name": "HEANET",
"interface_type": "AGGREGATE" "interface_type": "AGGREGATE"
}, },
"dashboards_info": [{
"name": "HEANET",
"interface_type": "AGGREGATE"
}],
"ipv4": [], "ipv4": [],
"ipv6": [] "ipv6": []
}, },
...@@ -357,6 +413,10 @@ NREN_INTERFACES = [ ...@@ -357,6 +413,10 @@ NREN_INTERFACES = [
"name": "HEANET", "name": "HEANET",
"interface_type": "LOGICAL" "interface_type": "LOGICAL"
}, },
"dashboards_info": [{
"name": "HEANET",
"interface_type": "LOGICAL"
}],
"ipv4": [ "ipv4": [
"62.40.125.13/30" "62.40.125.13/30"
], ],
...@@ -391,6 +451,10 @@ NREN_INTERFACES = [ ...@@ -391,6 +451,10 @@ NREN_INTERFACES = [
"name": "HEANET", "name": "HEANET",
"interface_type": "LOGICAL" "interface_type": "LOGICAL"
}, },
"dashboards_info": [{
"name": "HEANET",
"interface_type": "LOGICAL"
}],
"ipv4": [ "ipv4": [
"62.40.102.36/31" "62.40.102.36/31"
], ],
...@@ -423,6 +487,10 @@ NREN_INTERFACES = [ ...@@ -423,6 +487,10 @@ NREN_INTERFACES = [
"name": "HEANET", "name": "HEANET",
"interface_type": "LOGICAL" "interface_type": "LOGICAL"
}, },
"dashboards_info": [{
"name": "HEANET",
"interface_type": "LOGICAL"
}],
"ipv4": [ "ipv4": [
"83.97.88.77/30" "83.97.88.77/30"
], ],
...@@ -456,6 +524,14 @@ NREN_INTERFACES = [ ...@@ -456,6 +524,14 @@ NREN_INTERFACES = [
"name": "HEANET", "name": "HEANET",
"interface_type": "LOGICAL" "interface_type": "LOGICAL"
}, },
"dashboards_info": [{
"name": "GEANT",
"interface_type": "LOGICAL"
},
{
"name": "HEANET",
"interface_type": "LOGICAL"
}],
"ipv4": [], "ipv4": [],
"ipv6": [] "ipv6": []
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment