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
611df7ce
Commit
611df7ce
authored
3 years ago
by
Robert Latta
Browse files
Options
Downloads
Patches
Plain Diff
changed status of non-monitored services
parent
6af5557d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
inventory_provider/routes/classifier.py
+1
-3
1 addition, 3 deletions
inventory_provider/routes/classifier.py
inventory_provider/tasks/worker.py
+11
-23
11 additions, 23 deletions
inventory_provider/tasks/worker.py
with
12 additions
and
26 deletions
inventory_provider/routes/classifier.py
+
1
−
3
View file @
611df7ce
...
...
@@ -143,15 +143,13 @@ def get_interface_services_and_loc(ims_source_equipment, ims_interface, redis):
for
s
in
json
.
loads
(
raw_services
.
decode
(
'
utf-8
'
)):
related_services
.
update
(
{
r
[
'
id
'
]:
r
for
r
in
s
[
'
related-services
'
]})
if
s
[
'
monitored
'
]
and
s
[
'
circuit_type
'
]
==
'
service
'
:
if
s
[
'
circuit_type
'
]
==
'
service
'
:
contacts
.
update
(
set
(
s
.
pop
(
'
contacts
'
,
set
())))
_format_service
(
s
)
result
[
'
services
'
].
append
(
s
)
result
[
'
related-services
'
]
=
list
(
related_services
.
values
())
result
[
'
contacts
'
]
=
sorted
(
list
(
contacts
))
# non-monitored related services are not added by the worker so don't
# need filtering out here
if
not
result
[
'
services
'
]:
result
.
pop
(
'
services
'
,
None
)
if
result
[
'
related-services
'
]:
...
...
This diff is collapsed.
Click to expand it.
inventory_provider/tasks/worker.py
+
11
−
23
View file @
611df7ce
...
...
@@ -571,8 +571,6 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False):
tls_names
=
list
(
ims_data
.
get_service_types
(
ds1
))
customer_contacts
=
\
{
k
:
v
for
k
,
v
in
ims_data
.
get_customer_service_emails
(
ds1
)}
circuit_ids_not_to_monitor
=
\
list
(
ims_data
.
get_non_monitored_circuit_ids
(
ds1
))
circuit_ids_to_monitor
=
\
list
(
ims_data
.
get_monitored_circuit_ids
(
ds1
))
...
...
@@ -618,7 +616,6 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False):
nonlocal
hierarchy
hierarchy
=
{}
for
d
in
ims_data
.
get_circuit_hierarchy
(
ds1
):
d
[
'
monitored
'
]
=
d
[
'
id
'
]
in
circuit_ids_to_monitor
d
[
'
contacts
'
]
=
customer_contacts
.
get
(
d
[
'
customerid
'
],
[])
hierarchy
[
d
[
'
id
'
]]
=
d
logger
.
debug
(
"
hierarchy complete
"
)
...
...
@@ -667,25 +664,20 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False):
c
=
hierarchy
.
get
(
circuit_id
,
None
)
if
c
:
def
_is_rs
(
candidate
):
if
candidate
[
'
id
'
]
in
circuit_ids_not_to_monitor
:
return
False
if
candidate
[
'
product
'
]
in
tls_names
:
return
True
# if candidate['speed'] == 'BGP':
# return True
return
False
if
_is_rs
(
c
):
if
c
[
'
circuit-type
'
]
==
'
service
'
:
rs
[
c
[
'
id
'
]]
=
{
'
id
'
:
c
[
'
id
'
],
'
name
'
:
c
[
'
name
'
],
'
status
'
:
c
[
'
status
'
],
'
circuit_type
'
:
'
service
'
,
'
circuit_type
'
:
c
[
'
circuit-type
'
],
'
service_type
'
:
c
[
'
product
'
],
'
project
'
:
c
[
'
project
'
],
'
contacts
'
:
sorted
(
list
(
c
[
'
contacts
'
]))
}
if
c
[
'
id
'
]
in
circuit_ids_to_monitor
:
rs
[
c
[
'
id
'
]][
'
status
'
]
=
c
[
'
status
'
]
else
:
rs
[
c
[
'
id
'
]][
'
status
'
]
=
'
non-monitored
'
if
c
[
'
sub-circuits
'
]:
for
sub
in
c
[
'
sub-circuits
'
]:
temp_parents
=
\
...
...
@@ -694,10 +686,10 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False):
return
list
(
rs
.
values
())
def
_format_service
(
s
):
if
s
[
'
id
'
]
in
circuit_ids_not_to_monitor
:
s
[
'
monitored
'
]
=
False
else
:
s
[
'
monitored
'
]
=
True
if
s
[
'
circuit_type
'
]
=
=
'
service
'
\
and
s
[
'
id
'
]
not
in
circuit_ids_to_monitor
:
s
[
'
status
'
]
=
'
non-
monitored
'
pd_a
=
port_id_details
[
s
[
'
port_a_id
'
]][
0
]
location_a
=
locations
.
get
(
pd_a
[
'
equipment_name
'
],
None
)
if
location_a
:
...
...
@@ -758,10 +750,6 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False):
'
name
'
:
hierarchy
[
x
][
'
name
'
],
'
status
'
:
hierarchy
[
x
][
'
status
'
]
}
if
c
[
'
id
'
]
in
circuit_ids_not_to_monitor
:
c
[
'
monitored
'
]
=
False
else
:
c
[
'
monitored
'
]
=
True
circ
[
'
fibre-routes
'
].
append
(
c
)
circ
[
'
related-services
'
]
=
\
...
...
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