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
530dbd6e
Commit
530dbd6e
authored
4 years ago
by
Robert Latta
Browse files
Options
Downloads
Patches
Plain Diff
added get_node_locations
parent
56b20e7c
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/db/ims_data.py
+36
-27
36 additions, 27 deletions
inventory_provider/db/ims_data.py
with
36 additions
and
27 deletions
inventory_provider/db/ims_data.py
+
36
−
27
View file @
530dbd6e
...
...
@@ -10,37 +10,46 @@ logger = logging.getLogger(__name__)
# Dashboard V3
IMS_OPSDB_STATUS_MAP
=
{
InventoryStatus
.
PLANNED
:
'
Planned
'
,
InventoryStatus
.
READY_FOR_SERVICE
:
'
Installed
'
,
InventoryStatus
.
IN_SERVICE
:
'
Operational
'
,
InventoryStatus
.
MIGRATION
:
'
Planned
'
,
InventoryStatus
.
OUT_OF_SERVICE
:
'
Terminated
'
,
InventoryStatus
.
READY_FOR_CEASURE
:
'
Disposed
'
}
def
lookup_pop_info
(
ds
,
hostname
):
def
get_node_locations
(
ds
):
site_nav_props
=
[
ims
.
SITE_PROPERTIES
[
'
City
'
],
ims
.
SITE_PROPERTIES
[
'
SiteAliases
'
],
ims
.
SITE_PROPERTIES
[
'
Country
'
]
ims
.
SITE_PROPERTIES
[
'
Country
'
],
ims
.
SITE_PROPERTIES
[
'
Nodes
'
]
]
node
=
ds
.
get_entity_by_name
(
'
Node
'
,
hostname
)
if
not
node
:
return
None
site
=
ds
.
get_entity_by_id
(
'
Site
'
,
node
[
'
SiteId
'
],
site_nav_props
,
True
)
city
=
site
[
'
City
'
]
abbreviation
=
''
try
:
abbreviation
=
site
[
'
SiteAliases
'
][
0
][
'
AliasName
'
]
except
IndexError
:
pass
# no alias - ignore silently
eq
=
{
'
equipment-name
'
:
node
[
'
Name
'
],
'
status
'
:
InventoryStatus
(
node
[
'
InventoryStatusId
'
]).
name
,
'
pop
'
:
{
'
name
'
:
site
[
'
Name
'
],
'
city
'
:
city
[
'
Name
'
],
'
country
'
:
city
[
'
Country
'
][
'
Name
'
],
'
abbreviation
'
:
abbreviation
,
'
longitude
'
:
site
[
'
Longitude
'
],
'
latitude
'
:
site
[
'
Latitude
'
],
}
}
return
eq
sites
=
ds
.
get_all_entities
(
'
Site
'
,
site_nav_props
,
step_count
=
500
)
for
site
in
sites
:
city
=
site
[
'
city
'
]
abbreviation
=
''
try
:
abbreviation
=
site
[
'
sitealiases
'
][
0
][
'
aliasname
'
]
except
IndexError
:
pass
# no alias - ignore silently
for
node
in
site
[
'
nodes
'
]:
yield
(
node
[
'
name
'
],
{
'
equipment-name
'
:
node
[
'
name
'
],
'
status
'
:
IMS_OPSDB_STATUS_MAP
.
get
(
InventoryStatus
(
node
[
'
inventorystatusid
'
]),
'
unknown
'
),
'
pop
'
:
{
'
name
'
:
site
[
'
name
'
],
'
city
'
:
city
[
'
name
'
],
'
country
'
:
city
[
'
country
'
][
'
name
'
],
'
abbreviation
'
:
abbreviation
,
'
longitude
'
:
site
[
'
longitude
'
],
'
latitude
'
:
site
[
'
latitude
'
],
}
})
# End of Dashboard V3 stuff
...
...
@@ -114,7 +123,7 @@ def lookup_lg_routers(ds):
'
latitude
'
:
site
[
'
latitude
'
],
}
}
yield
(
eq
)
yield
eq
def
otrs_get_customer_company_rows
(
ds
):
...
...
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