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
01950ae8
Commit
01950ae8
authored
4 years ago
by
Bjarke Madsen
Browse files
Options
Downloads
Patches
Plain Diff
Get some coverage to check for bugs
parent
e977c6d3
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/render.py
+1
-1
1 addition, 1 deletion
brian_dashboard_manager/templating/render.py
test/test_aggregrate.py
+177
-0
177 additions, 0 deletions
test/test_aggregrate.py
with
178 additions
and
1 deletion
brian_dashboard_manager/templating/render.py
+
1
−
1
View file @
01950ae8
...
...
@@ -46,7 +46,7 @@ def create_panel(data):
with
open
(
file
)
as
f
:
template
=
jinja2
.
Template
(
f
.
read
())
yaxes
=
create_yaxes
(
data
.
get
(
'
y_axis_type
'
,
'
bits
'
))
targets
=
[]
targets
=
data
.
get
(
'
targets
'
,
[]
)
for
target
in
data
.
get
(
'
panel_targets
'
,
[]):
targets
.
append
(
create_panel_target
(
target
))
return
template
.
render
({
**
data
,
'
yaxes
'
:
yaxes
,
'
targets
'
:
targets
})
...
...
This diff is collapsed.
Click to expand it.
test/test_aggregrate.py
0 → 100644
+
177
−
0
View file @
01950ae8
from
brian_dashboard_manager.grafana.utils.request
import
TokenRequest
import
responses
from
brian_dashboard_manager.grafana.provision
import
provision_aggregate
,
\
is_cls_peer
DEFAULT_REQUEST_HEADERS
=
{
"
Content-type
"
:
"
application/json
"
,
"
Accept
"
:
[
"
application/json
"
]
}
TEST_INTERFACES
=
[
{
"
router
"
:
"
mx1.ath2.gr.geant.net
"
,
"
name
"
:
"
xe-1/0/1
"
,
"
bundle
"
:
[],
"
bundle-parents
"
:
[],
"
snmp-index
"
:
569
,
"
description
"
:
"
PHY RESERVED | New OTEGLOBE ATH2-VIE 10Gb LS
"
,
"
circuits
"
:
[]
},
{
"
router
"
:
"
mx1.ath2.gr.geant.net
"
,
"
name
"
:
"
ge-1/3/7
"
,
"
bundle
"
:
[],
"
bundle-parents
"
:
[],
"
snmp-index
"
:
543
,
"
description
"
:
"
PHY SPARE
"
,
"
circuits
"
:
[]
},
{
"
router
"
:
"
mx1.ham.de.geant.net
"
,
"
name
"
:
"
xe-2/2/0.13
"
,
"
bundle
"
:
[],
"
bundle-parents
"
:
[],
"
snmp-index
"
:
721
,
"
description
"
:
"
SRV_L2CIRCUIT CUSTOMER WP6T3 WP6T3 #ham_lon2-WP6-GTS_20063 |
"
,
# noqa: E501
"
circuits
"
:
[
{
"
id
"
:
52382
,
"
name
"
:
"
ham_lon2-WP6-GTS_20063_L2c
"
,
"
type
"
:
""
,
"
status
"
:
"
operational
"
}
]
},
{
"
router
"
:
"
mx1.fra.de.geant.net
"
,
"
name
"
:
"
ae27
"
,
"
bundle
"
:
[],
"
bundle-parents
"
:
[
"
xe-10/0/2
"
,
"
xe-10/3/2
"
,
"
xe-10/3/3
"
],
"
snmp-index
"
:
760
,
"
description
"
:
"
LAG CUSTOMER ULAKBIM SRF9940983 |
"
,
"
circuits
"
:
[
{
"
id
"
:
40983
,
"
name
"
:
"
ULAKBIM AP2 LAG
"
,
"
type
"
:
""
,
"
status
"
:
"
operational
"
}
]
},
{
"
router
"
:
"
mx2.zag.hr.geant.net
"
,
"
name
"
:
"
xe-2/1/0
"
,
"
bundle
"
:
[],
"
bundle-parents
"
:
[],
"
snmp-index
"
:
739
,
"
description
"
:
"
PHY SPARE
"
,
"
circuits
"
:
[]
},
{
"
router
"
:
"
rt1.rig.lv.geant.net
"
,
"
name
"
:
"
xe-0/1/5
"
,
"
bundle
"
:
[],
"
bundle-parents
"
:
[],
"
snmp-index
"
:
539
,
"
description
"
:
"
PHY SPARE
"
,
"
circuits
"
:
[]
},
{
"
router
"
:
"
srx1.ch.office.geant.net
"
,
"
name
"
:
"
ge-0/0/0
"
,
"
bundle
"
:
[],
"
bundle-parents
"
:
[],
"
snmp-index
"
:
513
,
"
description
"
:
"
Reserved for GEANT OC to test Virgin Media link
"
,
"
circuits
"
:
[]
},
{
"
router
"
:
"
mx1.par.fr.geant.net
"
,
"
name
"
:
"
xe-4/1/4.1
"
,
"
bundle
"
:
[],
"
bundle-parents
"
:
[],
"
snmp-index
"
:
1516
,
"
description
"
:
"
SRV_L2CIRCUIT INFRASTRUCTURE JRA1 JRA1 | #SDX-L2_PILOT-Br52 OF-P3_par
"
,
# noqa: E501
"
circuits
"
:
[]
},
{
"
router
"
:
"
mx1.lon.uk.geant.net
"
,
"
name
"
:
"
lt-1/3/0.61
"
,
"
bundle
"
:
[],
"
bundle-parents
"
:
[],
"
snmp-index
"
:
1229
,
"
description
"
:
"
SRV_IAS INFRASTRUCTURE ACCESS GLOBAL #LON-IAS-RE-Peering | BGP Peering - IAS Side
"
,
# noqa: E501
"
circuits
"
:
[]
},
{
"
router
"
:
"
mx1.sof.bg.geant.net
"
,
"
name
"
:
"
xe-2/0/5
"
,
"
bundle
"
:
[],
"
bundle-parents
"
:
[],
"
snmp-index
"
:
694
,
"
description
"
:
"
PHY RESERVED | Prime Telecom Sofia-Bucharest 3_4
"
,
"
circuits
"
:
[]
},
{
"
router
"
:
"
mx1.sof.bg.geant.net
"
,
"
name
"
:
"
xe-2/0/5
"
,
"
bundle
"
:
[],
"
bundle-parents
"
:
[],
"
snmp-index
"
:
694
,
"
description
"
:
"
SRV_GLOBAL CUSTOMER HEANET TESTDESCRIPTION |
"
,
"
circuits
"
:
[]
}
]
def
generate_folder
(
data
):
return
{
"
id
"
:
555
,
"
uid
"
:
data
[
'
uid
'
],
"
title
"
:
data
[
'
title
'
],
"
url
"
:
f
"
/dashboards/f/
{
data
[
'
uid
'
]
}
/
{
data
[
'
title
'
].
lower
()
}
"
,
"
hasAcl
"
:
False
,
"
canSave
"
:
True
,
"
canEdit
"
:
True
,
"
canAdmin
"
:
True
,
"
createdBy
"
:
"
Anonymous
"
,
"
created
"
:
"
2021-02-23T15:33:46Z
"
,
"
updatedBy
"
:
"
Anonymous
"
,
"
updated
"
:
"
2021-02-23T15:33:46Z
"
,
"
version
"
:
1
}
@responses.activate
def
test_provision_aggregate
(
data_config
,
mocker
,
client
):
TEST_DATASOURCE
=
[{
"
name
"
:
"
brian-influx-datasource
"
,
"
type
"
:
"
influxdb
"
,
"
access
"
:
"
proxy
"
,
"
url
"
:
"
http://test-brian-datasource.geant.org:8086
"
,
"
database
"
:
"
test-db
"
,
"
basicAuth
"
:
False
,
"
isDefault
"
:
True
,
"
readOnly
"
:
False
}]
_mocked_create_dashboard
=
mocker
.
patch
(
'
brian_dashboard_manager.grafana.provision.create_dashboard
'
)
# we dont care about this, tested separately
_mocked_create_dashboard
.
return_value
=
None
request
=
TokenRequest
(
**
data_config
,
token
=
'
test
'
)
fake_folder
=
generate_folder
({
'
uid
'
:
'
aggtest
'
,
'
title
'
:
'
aggtest
'
})
dash
=
{
'
predicate
'
:
is_cls_peer
,
'
tag
'
:
'
cls_peers
'
,
}
provision_aggregate
(
request
,
'
MY FAKE PEERS
'
,
fake_folder
,
dash
,
TEST_INTERFACES
,
TEST_DATASOURCE
[
0
][
'
name
'
])
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