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
1b4e06e4
Commit
1b4e06e4
authored
3 years ago
by
Bjarke Madsen
Browse files
Options
Downloads
Patches
Plain Diff
Make dashboard_info required, _get_interface_type private
parent
ea4e371c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
inventory_provider/routes/poller.py
+19
-14
19 additions, 14 deletions
inventory_provider/routes/poller.py
with
19 additions
and
14 deletions
inventory_provider/routes/poller.py
+
19
−
14
View file @
1b4e06e4
...
...
@@ -167,7 +167,7 @@ INTERFACE_LIST_SCHEMA = {
'
required
'
:
[
'
router
'
,
'
name
'
,
'
description
'
,
'
snmp-index
'
,
'
bundle
'
,
'
bundle-parents
'
,
'
circuits
'
,
'
dashboards
'
],
'
circuits
'
,
'
dashboards
'
,
'
dashboard_info
'
],
'
additionalProperties
'
:
False
},
},
...
...
@@ -421,26 +421,31 @@ def _get_dashboards(interface):
yield
BRIAN_DASHBOARDS
.
NREN
def
_get_interface_type
(
interface
):
description
=
interface
.
get
(
'
description
'
,
''
).
strip
()
if
re
.
match
(
r
'
^PHY
'
,
description
):
return
INTERFACE_TYPES
.
PHYSICAL
if
re
.
match
(
r
'
^SRV_
'
,
description
):
return
INTERFACE_TYPES
.
LOGICAL
if
re
.
match
(
r
'
^LAG
'
,
description
):
return
INTERFACE_TYPES
.
AGGREGATE
return
INTERFACE_TYPES
.
UNKNOWN
def
_get_dashboard_data
(
ifc
):
def
_get_interface_type
(
description
):
if
re
.
match
(
r
'
^PHY
'
,
description
):
return
INTERFACE_TYPES
.
PHYSICAL
if
re
.
match
(
r
'
^SRV_
'
,
description
):
return
INTERFACE_TYPES
.
LOGICAL
if
re
.
match
(
r
'
^LAG
'
,
description
):
return
INTERFACE_TYPES
.
AGGREGATE
def
_get_dashboard_data
(
ifc
):
interface_type
=
_get_interface_type
(
ifc
)
return
INTERFACE_TYPES
.
UNKNOWN
description
=
ifc
.
get
(
'
description
'
,
''
).
strip
()
dashboards
=
ifc
.
get
(
'
dashboards
'
,
[])
interface_type
=
_get_interface_type
(
description
)
if
len
(
dashboards
)
==
0
:
return
ifc
return
{
**
ifc
,
'
dashboard_info
'
:
{
'
name
'
:
description
,
'
interface_type
'
:
interface_type
.
name
}
}
if
BRIAN_DASHBOARDS
.
INFRASTRUCTURE_BACKBONE
.
name
in
dashboards
:
name
=
description
.
split
(
'
|
'
)
...
...
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