diff --git a/brian_dashboard_manager/dashboards/services_10ggbs.json b/brian_dashboard_manager/dashboards/services_10ggbs.json new file mode 100755 index 0000000000000000000000000000000000000000..ca17acbce090150a5f33e163603499389522d147 --- /dev/null +++ b/brian_dashboard_manager/dashboards/services_10ggbs.json @@ -0,0 +1,119 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "gnetId": null, + "graphTooltip": 0, + "id": 454, + "links": [], + "panels": [ + { + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "folderId": null, + "gridPos": { + "h": 25, + "w": 24, + "x": 0, + "y": 0 + }, + "headings": false, + "id": 2, + "limit": 100, + "pluginVersion": "7.1.4", + "query": "", + "recent": false, + "search": true, + "starred": false, + "tags": [ + "GBS_10G" + ], + "targets": [ + { + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [] + } + ], + "timeFrom": null, + "timeShift": null, + "title": "", + "type": "dashlist" + } + ], + "schemaVersion": 26, + "style": "dark", + "tags": [ + "services" + ], + "templating": { + "list": [] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": { + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ] + }, + "timezone": "", + "title": "GÉANT 10G Guaranteed Bandwidth Service", + "version": 1 +} diff --git a/brian_dashboard_manager/grafana/provision.py b/brian_dashboard_manager/grafana/provision.py index 23caf74d728afafb59c9a756f642addedaf8265f..3284f913bcdd98b9725f5638a97054b4aacb9220 100644 --- a/brian_dashboard_manager/grafana/provision.py +++ b/brian_dashboard_manager/grafana/provision.py @@ -123,6 +123,11 @@ DASHBOARDS = { 'errors': True, 'folder_name': 'GWS PHY Upstream', 'interfaces': [] + }, + 'GBS_10G': { + 'tag': 'GBS_10G', + 'folder_name': '10G Guaranteed Bandwidth Service', + 'interfaces': [] } } @@ -155,6 +160,7 @@ AGG_DASHBOARDS = { 'COPERNICUS': { 'tag': 'copernicus', 'dashboard_name': 'COPERNICUS', + 'group_by': 'location', 'interfaces': [] } } @@ -213,7 +219,8 @@ def provision_aggregate(token_request, folder, name = dash['dashboard_name'] tag = dash['tag'] interfaces = dash['interfaces'] - data = get_aggregate_interface_data(interfaces, name) + group_field = dash.get('group_by', 'remote') + data = get_aggregate_interface_data(interfaces, name, group_field) dashboard = get_aggregate_dashboard_data( f'Aggregate - {name}', data, ds_name, tag) diff --git a/brian_dashboard_manager/templating/helpers.py b/brian_dashboard_manager/templating/helpers.py index fbd95d2f62b85b007639cd7859f3357071a4564e..a6331f41555bdb8258340cdb173644db3456718a 100644 --- a/brian_dashboard_manager/templating/helpers.py +++ b/brian_dashboard_manager/templating/helpers.py @@ -157,28 +157,30 @@ def get_interface_data(interfaces): return result -def get_aggregate_interface_data(interfaces, agg_type): +def get_aggregate_interface_data(interfaces, agg_type, group_field): """ - Helper for grouping interfaces into groups of remotes + Helper for grouping interfaces into groups by fields, eg. remotes (ISP/NREN/...) used for aggregate dashboards Extracts information from interfaces to be used in panels. - Aggregate dashboards have aggregates at the top for all remotes - as well as aggregate panels for specific remotes. - This builds a dict with interfaces for each remote + Aggregate dashboards have aggregates at the top for all groups + as well as aggregate panels for specific groups. + This builds a dict with interfaces for each group and one with all interfaces. """ result = [] - def reduce_func(prev, curr): - remotes = prev.get(curr['remote'], []) - remotes.append(curr) - all_agg = prev.get('EVERYSINGLETARGET', []) - all_agg.append(curr) - prev[curr['remote']] = remotes - prev['EVERYSINGLETARGET'] = all_agg - return prev + def get_reduce_func_for_field(field): + def reduce_func(prev, curr): + groups = prev.get(curr[field], []) + groups.append(curr) + all_agg = prev.get('EVERYSINGLETARGET', []) + all_agg.append(curr) + prev[curr[field]] = groups + prev['EVERYSINGLETARGET'] = all_agg + return prev + return reduce_func for interface in interfaces: @@ -193,9 +195,10 @@ def get_aggregate_interface_data(interfaces, agg_type): 'interface': interface_name, 'hostname': host, 'remote': remote, + 'location': location, 'alias': f"{location} - {remote} ({interface_name})", }) - return reduce(reduce_func, result, {}) + return reduce(get_reduce_func_for_field(group_field), result, {}) def get_aggregate_targets(targets): diff --git a/changelog.md b/changelog.md index ace1965254074d374de03254a309cb7aec64fe11..602f5feac3aab1fd2c1a7381bf763bf10b0b4219 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,10 @@ All notable changes to this project will be documented in this file. +## [0.35] - 2022-02-24 +- POL1-487: Adjust aggregate dashboard for COPERNICUS to group interfaces by location +- POL1-560: Add service category for 10G Guaranteed Bandwidth Service + ## [0.34] - 2022-02-16 - POL1-487: Add aggregate dashboard for COPERNICUS diff --git a/setup.py b/setup.py index fb28e7e05742fd4f4164ff2ca7193c0c7369cd06..bf617039cd652a4bca7f9d9221c18ef79343a4e7 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup( name='brian-dashboard-manager', - version="0.34", + version="0.35", author='GEANT', author_email='swd@geant.org', description='', diff --git a/test/test_aggregrate.py b/test/test_aggregrate.py index a992dc52600b5486f2ea42c60d01e4976ab7836e..d0484a24ba83bd98ff660b062e258e3a73687ffe 100644 --- a/test/test_aggregrate.py +++ b/test/test_aggregrate.py @@ -11,6 +11,7 @@ DEFAULT_REQUEST_HEADERS = { TEST_DASHBOARD = { "tag": "TEST_AGGREGATE", "dashboard_name": "TEST CLS Peers", + "group_by": "remote", "interfaces": [ { "router": "mx1.gen.ch.geant.net",