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
092991f4
Commit
092991f4
authored
1 year ago
by
Robert Latta
Browse files
Options
Downloads
Patches
Plain Diff
small refactor
parent
ab9ee0b9
Branches
Branches containing commit
Tags
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
+38
-43
38 additions, 43 deletions
inventory_provider/tasks/worker.py
with
38 additions
and
43 deletions
inventory_provider/tasks/worker.py
+
38
−
43
View file @
092991f4
...
...
@@ -1313,18 +1313,19 @@ def transform_ims_data(data):
circuit_ids_to_monitor
=
data
[
'
circuit_ids_to_monitor
'
]
additional_circuit_customers
=
data
[
'
additional_circuit_customers
'
]
# data in this gets modified
# This is only used within this function and the populate_mic_with_third_party_data
# The following data gets added to this
# contacts
# planned_work_contacts
# sid
# third_party_id - only if it exists for the circuit
hierarchy
=
data
[
'
hierarchy
'
]
hierarchy
=
data
[
'
hierarchy
'
]
# data in this gets modified
# This just gets the flex ILS data added to it
# These two just gets the flex ILS data added to them.
# They are also used for building interface_services
port_id_details
=
data
[
'
port_id_details
'
]
# data in this gets modified
port_id_services
=
data
[
'
port_id_services
'
]
# data in this gets modified
circuit_ids_and_sids
=
data
[
'
circuit_ids_sids
'
]
circuit_ids_and_third_party_ids
=
data
[
'
circuit_ids_third_party_ids
'
]
geant_nodes
=
data
[
'
geant_nodes
'
]
...
...
@@ -1576,46 +1577,40 @@ def transform_ims_data(data):
_build_interface_services
()
def
_build_sid_services
():
for
circuits
in
interface_services
.
values
():
for
circuit
in
circuits
:
if
'
sid
'
in
circuit
:
sid
=
circuit
[
'
sid
'
]
sid_info
=
{
'
circuit_id
'
:
circuit
[
'
id
'
],
'
sid
'
:
sid
,
'
status
'
:
circuit
[
'
original_status
'
],
'
monitored
'
:
circuit
[
'
monitored
'
],
'
name
'
:
circuit
[
'
name
'
],
'
speed
'
:
circuit
[
'
calculated-speed
'
],
'
service_type
'
:
circuit
[
'
service_type
'
],
'
project
'
:
circuit
[
'
project
'
],
'
customer
'
:
circuit
[
'
customer
'
],
'
equipment
'
:
circuit
[
'
equipment
'
],
'
port
'
:
circuit
[
'
port
'
],
'
geant_equipment
'
:
circuit
[
'
equipment
'
]
in
geant_nodes
}
if
sid_info
not
in
sid_services
.
setdefault
(
sid
,
[]):
sid_services
[
sid
].
append
(
sid_info
)
_build_sid_services
()
def
_build_services_by_type
():
for
circuits
in
interface_services
.
values
():
for
circuit
in
circuits
:
type_key
=
ims_sorted_service_type_key
(
circuit
[
'
service_type
'
])
services_by_type
.
setdefault
(
type_key
,
{})[
circuit
[
'
id
'
]]
=
circuit
_build_services_by_type
()
def
_build_node_pair_services
():
for
circuits
in
interface_services
.
values
():
for
circuit
in
circuits
:
if
circuit
[
'
other_end_equipment
'
]:
node_pair_key
=
f
"
{
circuit
[
'
equipment
'
]
}
/
{
circuit
[
'
other_end_equipment
'
]
}
"
node_pair_services
.
setdefault
(
node_pair_key
,
{})[
circuit
[
'
id
'
]]
=
circuit
_build_node_pair_services
()
def
_add_to_sid_services
(
_circuit
):
if
'
sid
'
in
_circuit
:
sid
=
_circuit
[
'
sid
'
]
sid_info
=
{
'
circuit_id
'
:
_circuit
[
'
id
'
],
'
sid
'
:
sid
,
'
status
'
:
_circuit
[
'
original_status
'
],
'
monitored
'
:
_circuit
[
'
monitored
'
],
'
name
'
:
_circuit
[
'
name
'
],
'
speed
'
:
_circuit
[
'
calculated-speed
'
],
'
service_type
'
:
_circuit
[
'
service_type
'
],
'
project
'
:
_circuit
[
'
project
'
],
'
customer
'
:
_circuit
[
'
customer
'
],
'
equipment
'
:
_circuit
[
'
equipment
'
],
'
port
'
:
_circuit
[
'
port
'
],
'
geant_equipment
'
:
_circuit
[
'
equipment
'
]
in
geant_nodes
}
if
sid_info
not
in
sid_services
.
setdefault
(
sid
,
[]):
sid_services
[
sid
].
append
(
sid_info
)
def
_add_to_services_by_type
(
_circuit
):
type_key
=
ims_sorted_service_type_key
(
_circuit
[
'
service_type
'
])
services_by_type
.
setdefault
(
type_key
,
{})[
_circuit
[
'
id
'
]]
=
_circuit
def
_add_to_node_pair_services
(
_circuit
):
if
_circuit
[
'
other_end_equipment
'
]:
node_pair_key
=
f
"
{
_circuit
[
'
equipment
'
]
}
/
{
_circuit
[
'
other_end_equipment
'
]
}
"
node_pair_services
.
setdefault
(
node_pair_key
,
{})[
_circuit
[
'
id
'
]]
=
_circuit
for
circuits
in
interface_services
.
values
():
for
circuit
in
circuits
:
_add_to_sid_services
(
circuit
)
_add_to_services_by_type
(
circuit
)
_add_to_node_pair_services
(
circuit
)
return
{
'
hierarchy
'
:
hierarchy
,
...
...
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