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
62d46c16
Commit
62d46c16
authored
4 years ago
by
Robert Latta
Browse files
Options
Downloads
Patches
Plain Diff
grouped interface name generation in single place
parent
90f4d7c4
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/db/ims_data.py
+9
-14
9 additions, 14 deletions
inventory_provider/db/ims_data.py
with
9 additions
and
14 deletions
inventory_provider/db/ims_data.py
+
9
−
14
View file @
62d46c16
...
...
@@ -21,10 +21,6 @@ IMS_OPSDB_STATUS_MAP = {
InventoryStatus
.
READY_FOR_CEASURE
:
'
Disposed
'
}
interface_generators
=
{
'
infinera
'
:
lambda
x
:
f
"
{
x
[
'
shelf
'
][
'
sequencenumber
'
]
}
-
{
x
[
'
name
'
]
}
"
}
def
get_fibre_info
(
ds
:
IMS
):
# get all the wdm ots circuits where each node is in a different location
...
...
@@ -76,10 +72,9 @@ def get_fibre_info(ds: IMS):
def
get_port_id_services
(
ds
:
IMS
):
# get subset of circuits -
# start with just the ams fra lag, then expand to
# include the relevant carrier circuits
# service types come from the 'product' information
# this is the only place that speeds are used,
# products are used else where to define services, so a relevant list of
# products has been moved to the ims module as IMS_SERVICE_NAMES
speeds
=
{
'
L3VPN
'
,
'
LAG
'
,
...
...
@@ -174,12 +169,12 @@ def get_port_details(ds: IMS):
ds
.
get_all_entities
(
'
internalport
'
,
internal_port_nav_props
,
step_count
=
2000
)
):
vendor
=
p
[
'
node
'
][
'
equipmentdefinition
'
][
'
name
'
]
interface_name
=
\
interface_generators
.
get
(
vendor
.
lower
(),
lambda
x
:
x
[
'
name
'
]
)(
p
)
vendor
=
p
[
'
node
'
][
'
equipmentdefinition
'
][
'
name
'
]
.
lower
()
# if there become more exceptions we will need to abstract this
if
vendor
==
'
infinera
'
:
interface_name
=
f
"
{
p
[
'
shelf
'
][
'
sequencenumber
'
]
}
-
{
p
[
'
name
'
]
}
"
else
:
interface_name
=
p
[
'
name
'
]
data
=
{
'
port_id
'
:
p
[
'
id
'
],
'
equipment_name
'
:
p
[
'
node
'
][
'
name
'
],
...
...
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