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
f65145f2
Commit
f65145f2
authored
9 months ago
by
Sam Roberts
Browse files
Options
Downloads
Patches
Plain Diff
unit test for new functionality (make sure only categorised nrens go into category)
parent
6d42fff7
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!13
Feature/pol1 430 EAP NRENs
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_update.py
+126
-37
126 additions, 37 deletions
test/test_update.py
with
126 additions
and
37 deletions
test/test_update.py
+
126
−
37
View file @
f65145f2
...
...
@@ -10,7 +10,8 @@ TEST_INTERFACES = [
"
name
"
:
"
ge-0/0/8
"
,
"
bundle
"
:
[],
"
bundle-parents
"
:
[],
"
description
"
:
"
PHY CUSTOMER GEANT CORPORATE SRF000001 | GEANT Corporate to MX1.LON - Via Vodafone
"
,
# noqa: E501
"
description
"
:
"
PHY CUSTOMER GEANT CORPORATE SRF000001 | GEANT Corporate to MX1.LON - Via Vodafone
"
,
# noqa: E501
"
circuits
"
:
[
{
"
id
"
:
679232
,
...
...
@@ -280,6 +281,41 @@ TEST_INTERFACES = [
}],
"
ipv4
"
:
[],
"
ipv6
"
:
[]
},
{
"
router
"
:
"
rt1.fra.de.geant.net
"
,
"
name
"
:
"
xe-11/2/5.300
"
,
"
bundle
"
:
[],
"
bundle-parents
"
:
[],
"
description
"
:
"
SRV_GLOBAL CUSTOMER AZSCIENCENET #AZSCIENCENET-AP1 $GS-00433 | ASN202993 |
"
,
"
circuits
"
:
[
{
"
id
"
:
723799
,
"
name
"
:
"
AZSCIENCENET-AP1
"
,
"
type
"
:
"
GEANT IP
"
,
"
status
"
:
"
operational
"
}
],
"
snmp-index
"
:
1033
,
"
dashboards
"
:
[
"
EAP
"
,
"
NREN
"
,
"
RE_CUST
"
],
"
dashboard_info
"
:
{
"
name
"
:
"
AZSCIENCENET
"
,
"
interface_type
"
:
"
LOGICAL
"
},
"
dashboards_info
"
:
[
{
"
name
"
:
"
AZSCIENCENET
"
,
"
interface_type
"
:
"
LOGICAL
"
}
],
"
port_type
"
:
"
SERVICE
"
,
"
ipv4
"
:
[],
"
ipv6
"
:
[]
}
]
...
...
@@ -288,7 +324,7 @@ NREN_INTERFACES = [
"
router
"
:
"
mx1.dub2.ie.geant.net
"
,
"
name
"
:
"
xe-0/0/0
"
,
"
bundle
"
:
[
"
ae10
"
"
ae10
"
],
"
bundle-parents
"
:
[],
"
description
"
:
"
PHY CUSTOMER HEANET P_AE10 SRF9948758 | HEANET-AP2-LL3
"
,
# noqa: E501
...
...
@@ -313,7 +349,7 @@ NREN_INTERFACES = [
"
router
"
:
"
mx1.dub2.ie.geant.net
"
,
"
name
"
:
"
xe-1/0/1
"
,
"
bundle
"
:
[
"
ae10
"
"
ae10
"
],
"
bundle-parents
"
:
[],
"
description
"
:
"
PHY CUSTOMER HEANET P_AE10 SRF0000001 | HEANET-AP2-LL2
"
,
# noqa: E501
...
...
@@ -338,7 +374,7 @@ NREN_INTERFACES = [
"
router
"
:
"
mx1.dub2.ie.geant.net
"
,
"
name
"
:
"
xe-1/1/0
"
,
"
bundle
"
:
[
"
ae10
"
"
ae10
"
],
"
bundle-parents
"
:
[],
"
description
"
:
"
PHY CUSTOMER HEANET P_AE10 SRF9925903 | HEANET-AP2-LL1
"
,
# noqa: E501
...
...
@@ -364,9 +400,9 @@ NREN_INTERFACES = [
"
name
"
:
"
ae10
"
,
"
bundle
"
:
[],
"
bundle-parents
"
:
[
"
xe-0/0/0
"
,
"
xe-1/0/1
"
,
"
xe-1/1/0
"
"
xe-0/0/0
"
,
"
xe-1/0/1
"
,
"
xe-1/1/0
"
],
"
description
"
:
"
LAG CUSTOMER HEANET SRF9925909 | HEANET-AP2-LAG
"
,
"
circuits
"
:
[],
...
...
@@ -391,9 +427,9 @@ NREN_INTERFACES = [
"
name
"
:
"
ae10.12
"
,
"
bundle
"
:
[],
"
bundle-parents
"
:
[
"
xe-0/0/0
"
,
"
xe-1/0/1
"
,
"
xe-1/1/0
"
"
xe-0/0/0
"
,
"
xe-1/0/1
"
,
"
xe-1/1/0
"
],
"
description
"
:
"
SRV_GLOBAL CUSTOMER HEANET #HEANET-AP2 | ASN1213 |
"
,
"
circuits
"
:
[
...
...
@@ -429,9 +465,9 @@ NREN_INTERFACES = [
"
name
"
:
"
ae10.30
"
,
"
bundle
"
:
[],
"
bundle-parents
"
:
[
"
xe-0/0/0
"
,
"
xe-1/0/1
"
,
"
xe-1/1/0
"
"
xe-0/0/0
"
,
"
xe-1/0/1
"
,
"
xe-1/1/0
"
],
"
description
"
:
"
SRV_MDVPN CUSTOMER HEANET AP2 #HEANET-BGP-LU-CoC-1 |
"
,
# noqa: E501
"
circuits
"
:
[
...
...
@@ -465,9 +501,9 @@ NREN_INTERFACES = [
"
name
"
:
"
ae10.333
"
,
"
bundle
"
:
[],
"
bundle-parents
"
:
[
"
xe-0/0/0
"
,
"
xe-1/0/1
"
,
"
xe-1/1/0
"
"
xe-0/0/0
"
,
"
xe-1/0/1
"
,
"
xe-1/1/0
"
],
"
description
"
:
"
SRV_IAS CUSTOMER HEANET #HEANET-AP2-IAS IASPS | ASN1213
"
,
# noqa: E501
"
circuits
"
:
[
...
...
@@ -503,9 +539,9 @@ NREN_INTERFACES = [
"
name
"
:
"
ae10.1214
"
,
"
bundle
"
:
[],
"
bundle-parents
"
:
[
"
xe-0/0/0
"
,
"
xe-1/0/1
"
,
"
xe-1/1/0
"
"
xe-0/0/0
"
,
"
xe-1/0/1
"
,
"
xe-1/1/0
"
],
"
description
"
:
"
SRV_L2CIRCUIT CUSTOMER HEANET GEANT #ams-dub2-HEANET-RARE-21061 |
"
,
# noqa: E501
"
circuits
"
:
[
...
...
@@ -529,9 +565,9 @@ NREN_INTERFACES = [
"
interface_type
"
:
"
LOGICAL
"
},
{
"
name
"
:
"
HEANET
"
,
"
interface_type
"
:
"
LOGICAL
"
}],
"
name
"
:
"
HEANET
"
,
"
interface_type
"
:
"
LOGICAL
"
}],
"
ipv4
"
:
[],
"
ipv6
"
:
[]
}
...
...
@@ -634,26 +670,26 @@ def populate_inventory(data_config):
(
"
NREN Access
"
,
[],
[
'
ASNET-AM
'
,
'
CESNET
'
,
'
GEANT
'
,
'
KIAE
'
,
'
LITNET
'
,
'
SWITCH
'
]),
(
"
NREN Access
"
,
[
"
GEANT
"
,
"
KIAE
"
],
[
'
ASNET-AM
'
,
'
CESNET
'
,
'
LITNET
'
,
'
SWITCH
'
]),
(
"
NREN Access
"
,
[],
[
"
ASNET-AM
"
,
"
LITNET
"
,
"
CESNET
"
,
"
GEANT
"
,
"
KIAE
"
,
"
SWITCH
"
],
"
NREN Access
"
,
[],
[
"
ASNET-AM
"
,
"
LITNET
"
,
"
CESNET
"
,
"
GEANT
"
,
"
KIAE
"
,
"
SWITCH
"
],
),
(
"
NREN Access
"
,
[
"
ASNET-AM
"
,
"
GEANT
"
],
[
"
LITNET
"
,
"
CESNET
"
,
"
KIAE
"
,
"
SWITCH
"
],
"
NREN Access
"
,
[
"
ASNET-AM
"
,
"
GEANT
"
],
[
"
LITNET
"
,
"
CESNET
"
,
"
KIAE
"
,
"
SWITCH
"
],
),
(
"
testfolder
"
,
[
"
GEANT
"
],
[
"
KIAE
"
,
"
SWITCH
"
]),
],
)
def
test_provision_nren_folder
(
folder_name
,
excluded_nrens
,
expected_nrens
,
data_config
,
mock_grafana
,
reporting_provider
,
populate_inventory
,
folder_name
,
excluded_nrens
,
expected_nrens
,
data_config
,
mock_grafana
,
reporting_provider
,
populate_inventory
,
):
dashboards
=
{
"
NREN
"
:
{
...
...
@@ -700,7 +736,7 @@ def test_provision_nren_folder(
@responses.activate
def
test_provision
(
data_config
,
mocker
,
mock_grafana
,
reporting_provider
,
populate_inventory
data_config
,
mocker
,
mock_grafana
,
reporting_provider
,
populate_inventory
):
mock_grafana
.
create_datasource
(
{
...
...
@@ -739,7 +775,7 @@ def test_provision(
@responses.activate
def
test_provision_re_peer_dashboard
(
mocker
,
data_config
,
mock_grafana
,
reporting_provider
,
populate_inventory
mocker
,
data_config
,
mock_grafana
,
reporting_provider
,
populate_inventory
):
interfaces
=
[
{
...
...
@@ -785,3 +821,56 @@ def test_provision_re_peer_dashboard(
assert
"
traffic
"
in
panels
[
4
][
"
title
"
]
assert
"
IPv6
"
in
panels
[
5
][
"
title
"
]
assert
"
Interfaces
"
in
panels
[
6
][
"
title
"
]
@responses.activate
@pytest.mark.parametrize
(
"
folder_name, dashboard_id, expected_dashboard_count
"
,
[
(
'
NREN Access
'
,
'
NREN
'
,
6
),
# uncategorized interfaces
(
'
EAP Access
'
,
'
EAP
'
,
1
)
# EAP categorized interfaces
]
)
def
test_provision_nren_category
(
folder_name
,
dashboard_id
,
expected_dashboard_count
,
data_config
,
mock_grafana
,
reporting_provider
,
populate_inventory
,
):
nren_interfaces
=
[
iface
for
iface
in
TEST_INTERFACES
if
"
NREN
"
in
iface
[
"
dashboards
"
]
]
dashboards
=
{
"
NREN
"
:
{
"
tag
"
:
[
"
customers
"
],
"
folder_name
"
:
"
NREN Access
"
,
"
interfaces
"
:
nren_interfaces
,
},
"
EAP
"
:
{
"
tag
"
:
[
"
eap
"
],
"
folder_name
"
:
"
EAP Access
"
,
"
interfaces
"
:
nren_interfaces
,
},
}
populate_inventory
(
{
"
/poller/interfaces
"
:
NREN_INTERFACES
,
"
/data/interfaces
"
:
NREN_INTERFACES
,
"
/poller/eumetsat-multicast
"
:
EUMETSAT_MULTICAST
,
}
)
services
=
fetch_services
(
data_config
[
'
reporting_provider
'
])
result
=
provision_folder
(
mock_grafana
.
request
,
folder_name
,
dashboards
[
dashboard_id
],
services
,
"
testdatasource
"
,
[],
)
assert
len
(
result
)
==
expected_dashboard_count
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