Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
brian-dashboard-manager
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
geant-swd
brian
brian-dashboard-manager
Commits
12c44eec
Commit
12c44eec
authored
3 years ago
by
Bjarke Madsen
Browse files
Options
Downloads
Patches
Plain Diff
Add interfaces to aggregate target aliases
parent
5c1de75c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
brian_dashboard_manager/templating/helpers.py
+13
-19
13 additions, 19 deletions
brian_dashboard_manager/templating/helpers.py
brian_dashboard_manager/templating/nren_access.py
+2
-3
2 additions, 3 deletions
brian_dashboard_manager/templating/nren_access.py
with
15 additions
and
22 deletions
brian_dashboard_manager/templating/helpers.py
+
13
−
19
View file @
12c44eec
...
...
@@ -224,13 +224,17 @@ def get_interface_data(interfaces, name_parse_func=None):
def
get_aggregate_interface_data
(
interfaces
,
agg_type
):
result
=
[]
# 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
# and one with all interfaces.
def
reduce_func
(
prev
,
curr
):
remotes
=
prev
.
get
(
curr
[
'
remote
'
],
[])
remotes
.
append
(
curr
)
all_agg
=
prev
.
get
(
'
EVERYSINGLE
PANEL
'
,
[])
all_agg
=
prev
.
get
(
'
EVERYSINGLE
TARGET
'
,
[])
all_agg
.
append
(
curr
)
prev
[
curr
[
'
remote
'
]]
=
remotes
prev
[
'
EVERYSINGLE
PANEL
'
]
=
all_agg
prev
[
'
EVERYSINGLE
TARGET
'
]
=
all_agg
return
prev
for
interface
in
interfaces
:
...
...
@@ -241,12 +245,13 @@ def get_aggregate_interface_data(interfaces, agg_type):
remote
=
description
.
split
(
'
'
)[
2
].
upper
()
location
=
host
.
split
(
'
.
'
)[
1
].
upper
()
result
.
append
({
'
type
'
:
agg_type
,
'
interface
'
:
interface_name
,
'
hostname
'
:
host
,
'
remote
'
:
remote
,
'
alias
'
:
f
"
{
host
.
split
(
'
.
'
)[
1
].
upper
()
}
-
{
remote
}
"
,
'
alias
'
:
f
"
{
location
}
-
{
remote
}
(
{
interface_name
}
)
"
,
})
return
reduce
(
reduce_func
,
result
,
{})
...
...
@@ -303,19 +308,10 @@ def get_panel_fields(panel, panel_type, datasource):
egress
=
[
'
Egress Traffic
'
,
'
Egress 95th Percentile
'
]
is_v6
=
panel_type
==
'
IPv6
'
is_multicast
=
panel_type
==
'
multicast
'
is_error
=
panel_type
==
'
errors
'
in_field
=
'
ingressv6
'
if
is_v6
else
\
'
ingressMulticast
'
if
is_multicast
else
'
ingress
'
in_field
=
'
ingressv6
'
if
is_v6
else
'
ingress
'
out_field
=
'
egressv6
'
if
is_v6
else
\
'
egressMulticast
'
if
is_multicast
else
'
egress
'
if
is_multicast
:
def
add_multicast
(
label
):
return
'
Multicast
'
+
label
ingress
=
list
(
map
(
add_multicast
,
ingress
))
egress
=
list
(
map
(
add_multicast
,
egress
))
out_field
=
'
egressv6
'
if
is_v6
else
'
egress
'
fields
=
[
*
product
(
ingress
,
[
in_field
]),
*
product
(
egress
,
[
out_field
])]
...
...
@@ -343,8 +339,6 @@ def get_dashboard_data(data, datasource, tag, errors=False):
if
panel
.
get
(
'
has_v6
'
,
False
):
result
.
append
(
get_panel_fields
(
{
**
panel
,
**
next
(
gridPos
)},
'
IPv6
'
,
datasource
))
# result.append(get_panel_fields(
# {**panel, **next(gridPos)}, 'multicast', datasource))
if
errors
:
result
.
append
(
get_panel_fields
(
{
**
panel
,
**
next
(
gridPos
)},
'
errors
'
,
datasource
))
...
...
@@ -417,7 +411,7 @@ def get_aggregate_dashboard_data(title, targets, datasource, tag):
gridPos
=
gridPos_generator
(
id_gen
,
agg
=
True
)
panels
=
[]
all_targets
=
targets
.
get
(
'
EVERYSINGLE
PANEL
'
,
[])
all_targets
=
targets
.
get
(
'
EVERYSINGLE
TARGET
'
,
[])
ingress
,
egress
=
create_aggregate_panel
(
title
,
gridPos
,
all_targets
,
datasource
)
...
...
@@ -428,8 +422,8 @@ def get_aggregate_dashboard_data(title, targets, datasource, tag):
totals_title
,
gridPos
,
all_targets
,
datasource
)
panels
.
extend
([
t_in
,
t_eg
])
if
'
EVERYSINGLE
PANEL
'
in
targets
:
del
targets
[
'
EVERYSINGLE
PANEL
'
]
if
'
EVERYSINGLE
TARGET
'
in
targets
:
del
targets
[
'
EVERYSINGLE
TARGET
'
]
for
target
in
targets
:
_in
,
_out
=
create_aggregate_panel
(
...
...
This diff is collapsed.
Click to expand it.
brian_dashboard_manager/templating/nren_access.py
+
2
−
3
View file @
12c44eec
...
...
@@ -25,11 +25,12 @@ def get_nrens(interfaces):
router
=
host
.
replace
(
'
.geant.net
'
,
''
)
panel_title
=
f
"
{
router
}
- {{}} -
{
interface_name
}
-
{
description
}
"
location
=
host
.
split
(
'
.
'
)[
1
].
upper
()
if
is_aggregate_interface
(
interface
):
nren
[
'
AGGREGATES
'
].
append
({
'
interface
'
:
interface_name
,
'
hostname
'
:
host
,
'
alias
'
:
f
"
{
host
.
split
(
'
.
'
)[
1
].
upper
()
}
-
{
nren_name
}
"
'
alias
'
:
f
"
{
location
}
-
{
nren_name
}
(
{
interface_name
}
)
"
})
# link aggregates are also shown
...
...
@@ -73,8 +74,6 @@ def get_panel_definitions(panels, datasource, errors=False):
if
panel
.
get
(
'
has_v6
'
,
False
):
result
.
append
(
get_panel_fields
(
{
**
panel
,
**
next
(
gridPos
)},
'
IPv6
'
,
datasource
))
# result.append(get_panel_fields(
# {**panel, **next(gridPos)}, 'multicast', datasource))
if
errors
:
result
.
append
(
get_panel_fields
(
{
**
panel
,
**
next
(
gridPos
)},
'
errors
'
,
datasource
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment