Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
inventory-provider
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
dashboardv3
inventory-provider
Commits
0a38b913
Commit
0a38b913
authored
3 years ago
by
Bjarke Madsen
Browse files
Options
Downloads
Patches
Plain Diff
Add SRV_GLOBAL and PHY to infrastructure backbone dashboards
parent
fbcb457e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
inventory_provider/routes/poller.py
+23
-8
23 additions, 8 deletions
inventory_provider/routes/poller.py
test/test_general_poller_routes.py
+14
-0
14 additions, 0 deletions
test/test_general_poller_routes.py
with
37 additions
and
8 deletions
inventory_provider/routes/poller.py
+
23
−
8
View file @
0a38b913
...
...
@@ -449,9 +449,7 @@ def _get_dashboards(interface):
yield
BRIAN_DASHBOARDS
.
LHCONE
if
re
.
match
(
'
^SRV_MDVPN CUSTOMER
'
,
description
):
yield
BRIAN_DASHBOARDS
.
MDVPN_CUSTOMERS
if
'
LAG
'
in
description
and
\
re
.
match
(
'
(SRV_GLOBAL|LAG|PHY) INFRASTRUCTURE BACKBONE
'
,
description
):
if
re
.
match
(
'
(SRV_GLOBAL|LAG|PHY) INFRASTRUCTURE BACKBONE
'
,
description
):
yield
BRIAN_DASHBOARDS
.
INFRASTRUCTURE_BACKBONE
if
router
==
'
mx1.lon.uk.geant.net
'
\
and
re
.
match
(
r
'
^ae12(\.\d+|$)$
'
,
ifc_name
):
...
...
@@ -483,17 +481,34 @@ def _get_dashboard_data(ifc):
if
len
(
dashboards
)
==
0
:
return
ifc
if
BRIAN_DASHBOARDS
.
INFRASTRUCTURE_BACKBONE
.
name
in
dashboards
:
def
_get_customer_name
(
description
):
name
=
description
.
split
(
'
'
)
if
len
(
name
)
>=
3
:
return
name
[
2
].
strip
().
upper
()
else
:
# if the description isn't properly formatted
# use it as the name to make it obvious something is wrong
return
description
def
_get_backbone_name
(
description
):
name
=
description
.
split
(
'
|
'
)
name
=
name
[
1
].
strip
()
name
=
name
.
replace
(
'
(
'
,
'
(
'
)
if
len
(
name
)
>=
2
:
name
=
name
[
1
].
strip
()
return
name
.
replace
(
'
(
'
,
'
(
'
)
else
:
# if the description isn't properly formatted
# use it as the name to make it obvious something is wrong
return
description
if
BRIAN_DASHBOARDS
.
INFRASTRUCTURE_BACKBONE
.
name
in
dashboards
:
name
=
_get_backbone_name
(
description
)
elif
BRIAN_DASHBOARDS
.
GWS_PHY_UPSTREAM
.
name
in
dashboards
:
name
=
description
.
split
(
'
'
)[
2
].
strip
().
upper
(
)
name
=
_get_customer_name
(
description
)
host
=
ifc
[
'
router
'
]
location
=
host
.
split
(
'
.
'
)[
1
].
upper
()
name
=
f
'
{
name
}
-
{
location
}
'
else
:
name
=
description
.
split
(
'
'
)[
2
].
upper
(
)
name
=
_get_customer_name
(
description
)
return
{
**
ifc
,
...
...
This diff is collapsed.
Click to expand it.
test/test_general_poller_routes.py
+
14
−
0
View file @
0a38b913
...
...
@@ -231,6 +231,8 @@ def test_fw_counter_bytes_oid_values(customer, interface_name, expected_oid):
[
'
IAS_PEERS
'
,
'
IAS_PUBLIC
'
]),
(
'
LAG INFRASTRUCTURE BACKBONE SRF0000001 | bil-por
'
,
[
'
INFRASTRUCTURE_BACKBONE
'
]),
(
'
SRV_GLOBAL INFRASTRUCTURE BACKBONE SRF0000001 | bil-por
'
,
[
'
INFRASTRUCTURE_BACKBONE
'
]),
(
'
SRV_GCS CUSTOMER FCCN MICROSOFT #FCCN_NoveSBE_ExpressRoute_Vlan1945 | UNIT CONFIGURATION HAS BEEN SYSTEM GENERATED
'
,
# noqa: E501
[
'
GCS
'
]),
(
'
PHY UPSTREAM TELIA SRF9940473 | Telia ID: IC-326863
'
,
...
...
@@ -284,6 +286,10 @@ def test_interface_dashboard_mapping(description, expected_dashboards):
'
description
'
:
'
LAG INFRASTRUCTURE BACKBONE SRF0000001 | bil-por
'
,
'
dashboards
'
:
[
'
INFRASTRUCTURE_BACKBONE
'
]
},
{
'
name
'
:
'
bil-por
'
,
'
interface_type
'
:
'
AGGREGATE
'
}),
({
'
description
'
:
'
SRV_GLOBAL INFRASTRUCTURE BACKBONE SRF0000001 | bil-por
'
,
# noqa: E501
'
dashboards
'
:
[
'
INFRASTRUCTURE_BACKBONE
'
]
},
{
'
name
'
:
'
bil-por
'
,
'
interface_type
'
:
'
LOGICAL
'
}),
({
'
description
'
:
'
SRV_GCS CUSTOMER FCCN MICROSOFT #FCCN_NoveSBE_ExpressRoute_Vlan1945 | UNIT CONFIGURATION HAS BEEN SYSTEM GENERATED
'
,
# noqa: E501
'
dashboards
'
:
[
'
GCS
'
]
...
...
@@ -309,6 +315,14 @@ def test_interface_dashboard_mapping(description, expected_dashboards):
'
description
'
:
'
SRV_L2CIRCUIT CUSTOMER TENET PSNC #lon-lon-GEANTOPEN-PSNC-TENET-18067 |
'
,
# noqa: E501
'
dashboards
'
:
[
'
GEANTOPEN
'
,
'
L2_CIRCUIT
'
]
},
{
'
name
'
:
'
TENET
'
,
'
interface_type
'
:
'
LOGICAL
'
}),
({
'
description
'
:
'
SRV_GLOBAL INFRASTRUCTURE BACKBONE SRF0000001
'
,
'
dashboards
'
:
[
'
INFRASTRUCTURE_BACKBONE
'
]
},
{
'
name
'
:
'
SRV_GLOBAL INFRASTRUCTURE BACKBONE SRF0000001
'
,
'
interface_type
'
:
'
LOGICAL
'
}),
# noqa: E501
({
'
description
'
:
'
SRV_MDVPN CUSTOMER
'
,
'
dashboards
'
:
[
'
MDVPN_CUSTOMERS
'
,
'
NREN
'
]
},
{
'
name
'
:
'
SRV_MDVPN CUSTOMER
'
,
'
interface_type
'
:
'
LOGICAL
'
}),
])
def
test_description_dashboard_parsing
(
interface
,
dashboard_info
):
...
...
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