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
f0d65e75
Commit
f0d65e75
authored
7 months ago
by
Sam Roberts
Browse files
Options
Downloads
Patches
Plain Diff
make it so that EAP is given in dashboards too
parent
5795c1dd
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!43
Regions included in dashboard generation
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
inventory_provider/routes/poller.py
+12
-4
12 additions, 4 deletions
inventory_provider/routes/poller.py
with
12 additions
and
4 deletions
inventory_provider/routes/poller.py
+
12
−
4
View file @
f0d65e75
...
...
@@ -469,7 +469,7 @@ def after_request(resp):
return
common
.
after_request
(
resp
)
def
_get_dashboards
(
interface
):
def
_get_dashboards
(
interface
,
region
=
None
):
"""
Yield enums from BRIAN_DASHBOARDS to indicate which dashboards
this interface should be included in.
...
...
@@ -482,12 +482,14 @@ def _get_dashboards(interface):
inventory_provider.routes.poller._DASHBOARD_IDS
:param interface: a dict with keys like router, name, description
:param region: a key from the regions dict
:return: generator that yields enums from BRIAN_DASHBOARDS
"""
router
=
interface
.
get
(
'
router
'
,
''
).
lower
()
ifc_name
=
interface
.
get
(
'
name
'
,
''
)
description
=
interface
.
get
(
'
description
'
,
''
).
strip
()
if
'
SRV_L3VPN
'
in
description
and
'
COPERNICUS
'
in
description
:
yield
BRIAN_DASHBOARDS
.
COPERNICUS
if
re
.
match
(
r
'
SRV_CLS\s
'
,
description
):
...
...
@@ -539,11 +541,12 @@ def _get_dashboards(interface):
if
re
.
match
(
r
'
PHY UPSTREAM\s
'
,
description
):
yield
BRIAN_DASHBOARDS
.
GWS_PHY_UPSTREAM
regex
=
r
'
(PHY|LAG|(SRV_(GLOBAL|LHCONE|MDVPN|IAS|CLS|L3VPN))) CUSTOMER\s
'
if
re
.
match
(
regex
,
description
):
if
re
.
match
(
regex
,
description
)
and
region
is
None
:
yield
BRIAN_DASHBOARDS
.
NREN
if
"
GA-
"
in
description
and
"
ANA-
"
in
description
:
yield
BRIAN_DASHBOARDS
.
ANA
if
region
==
'
EAP
'
:
yield
BRIAN_DASHBOARDS
.
EAP
def
_get_dashboard_data
(
ifc
,
customers
,
regions
=
None
):
if
regions
is
None
:
...
...
@@ -873,6 +876,9 @@ def load_interfaces_to_poll(config, hostname=None, no_lab=False, use_next_redis=
_get_services_and_customers
(
config
,
hostname
,
use_next_redis
)
snmp_indexes
=
common
.
load_snmp_indexes
(
config
,
hostname
,
use_next_redis
)
nren_regions
=
_load_nren_regions
(
config
,
use_next_redis
)
unique_regions
=
set
([
value
for
value
in
nren_regions
.
values
()])
region_index
=
{
region_key
:
[
nren
for
nren
,
reg
in
nren_regions
.
items
()
if
reg
==
region_key
]
for
region_key
in
unique_regions
}
def
_get_populated_interfaces
(
all_interfaces
):
if
use_next_redis
:
...
...
@@ -900,7 +906,9 @@ def load_interfaces_to_poll(config, hostname=None, no_lab=False, use_next_redis=
and
ifc_services_and_customers
[
'
services
'
]:
ifc
[
'
circuits
'
]
=
ifc_services_and_customers
[
'
services
'
]
dashboards
=
_get_dashboards
(
ifc
)
_customers
=
ifc_services_and_customers
.
get
(
'
customers
'
,
[])
region
=
'
EAP
'
if
any
(
customer
in
region_index
.
get
(
'
EAP
'
,
[])
for
customer
in
_customers
)
else
None
dashboards
=
_get_dashboards
(
ifc
,
region
)
ifc
[
'
dashboards
'
]
=
sorted
([
d
.
name
for
d
in
dashboards
])
ifc
=
_get_dashboard_data
(
...
...
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