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
4b6cd012
Commit
4b6cd012
authored
4 years ago
by
Erik Reid
Browse files
Options
Downloads
Patches
Plain Diff
added a service category enum for readability
parent
54d3cc18
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
inventory_provider/tasks/worker.py
+10
-4
10 additions, 4 deletions
inventory_provider/tasks/worker.py
with
10 additions
and
4 deletions
inventory_provider/tasks/worker.py
+
10
−
4
View file @
4b6cd012
import
enum
import
json
import
logging
import
os
...
...
@@ -654,14 +655,19 @@ def refresh_finalizer(self, pending_task_ids_json):
self
.
log_info
(
'
latched current/next dbs
'
)
class
PollerServiceCategory
(
str
,
enum
.
Enum
):
MDVPN
=
'
mdvpn
'
LHCONE
=
'
lhcone
'
@log_task_entry_and_exit
def
_build_service_category_interface_list
(
update_callback
=
lambda
s
:
None
):
def
_classify
(
ifc
):
if
ifc
[
'
description
'
].
startswith
(
'
SRV_MDVPN
'
):
yield
'
mdvpn
'
yield
PollerServiceCategory
.
MDVPN
if
'
LHCONE
'
in
ifc
[
'
description
'
]:
yield
'
lhcone
'
yield
PollerServiceCategory
.
LHCONE
update_callback
(
'
loading all known interfaces
'
)
interfaces
=
data
.
build_service_interface_user_list
(
InventoryTask
.
config
)
...
...
@@ -673,9 +679,9 @@ def _build_service_category_interface_list(update_callback=lambda s: None):
rp
=
r
.
pipeline
()
for
ifc
in
interfaces
:
for
service_
type
in
_classify
(
ifc
):
for
service_
category
in
_classify
(
ifc
):
rp
.
set
(
f
'
interface-services:
{
service_
typ
e
}
'
f
'
interface-services:
{
service_
category
.
valu
e
}
'
f
'
:
{
ifc
[
"
router
"
]
}
:
{
ifc
[
"
interface
"
]
}
'
,
json
.
dumps
(
ifc
))
...
...
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