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
509cbee8
Commit
509cbee8
authored
4 years ago
by
Robert Latta
Browse files
Options
Downloads
Patches
Plain Diff
added snmp and as data
parent
65438596
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
inventory_provider/db/ims_data.py
+8
-7
8 additions, 7 deletions
inventory_provider/db/ims_data.py
inventory_provider/routes/ims_classifier.py
+30
-0
30 additions, 0 deletions
inventory_provider/routes/ims_classifier.py
with
38 additions
and
7 deletions
inventory_provider/db/ims_data.py
+
8
−
7
View file @
509cbee8
...
...
@@ -14,12 +14,12 @@ logger = logging.getLogger(__name__)
# Dashboard V3
IMS_OPSDB_STATUS_MAP
=
{
InventoryStatus
.
PLANNED
:
'
P
lanned
'
,
InventoryStatus
.
READY_FOR_SERVICE
:
'
I
nstalled
'
,
InventoryStatus
.
IN_SERVICE
:
'
O
perational
'
,
InventoryStatus
.
MIGRATION
:
'
P
lanned
'
,
InventoryStatus
.
OUT_OF_SERVICE
:
'
T
erminated
'
,
InventoryStatus
.
READY_FOR_CEASURE
:
'
D
isposed
'
InventoryStatus
.
PLANNED
:
'
p
lanned
'
,
InventoryStatus
.
READY_FOR_SERVICE
:
'
i
nstalled
'
,
InventoryStatus
.
IN_SERVICE
:
'
o
perational
'
,
InventoryStatus
.
MIGRATION
:
'
p
lanned
'
,
InventoryStatus
.
OUT_OF_SERVICE
:
'
t
erminated
'
,
InventoryStatus
.
READY_FOR_CEASURE
:
'
d
isposed
'
}
...
...
@@ -87,6 +87,7 @@ def get_port_id_services(ds: IMS):
# 'BGP',
}
circuit_nav_props
=
[
ims
.
CIRCUIT_PROPERTIES
[
'
Customer
'
],
ims
.
CIRCUIT_PROPERTIES
[
'
Speed
'
],
ims
.
CIRCUIT_PROPERTIES
[
'
Product
'
],
ims
.
CIRCUIT_PROPERTIES
[
'
Ports
'
],
...
...
@@ -142,7 +143,7 @@ def get_port_id_services(ds: IMS):
InventoryStatus
(
circuit
[
'
inventorystatusid
'
]),
'
unknown
'
),
'
circuit_type
'
:
circuit
[
'
circuit_type
'
],
'
service_type
'
:
circuit
[
'
product
'
][
'
name
'
],
'
project
'
:
circuit
[
'
product
'
][
'
name
'
]
'
project
'
:
circuit
[
'
customer
'
][
'
name
'
]
}
ports
=
[]
if
circuit
[
'
internalports
'
]:
...
...
This diff is collapsed.
Click to expand it.
inventory_provider/routes/ims_classifier.py
+
30
−
0
View file @
509cbee8
...
...
@@ -13,6 +13,7 @@ from redis import Redis
from
inventory_provider.db.ims
import
IMS_SERVICE_NAMES
from
inventory_provider.routes
import
common
from
inventory_provider.routes.classifier
import
_asn_group_info
routes
=
Blueprint
(
"
ims-inventory-data-classifier-support-routes
"
,
__name__
)
...
...
@@ -274,6 +275,8 @@ def get_interface_services_and_locs(ims_source_equipment, ims_interface, r):
result
[
'
locations
'
].
append
(
loc
)
result
[
'
services
'
]
=
list
(
services_dict
.
values
())
result
[
'
related-services
'
]
=
list
(
rs_dict
.
values
())
for
r
in
result
[
'
related-services
'
]:
r
.
pop
(
'
id
'
,
None
)
if
not
result
.
get
(
'
locations
'
):
result
[
'
locations
'
]
=
[
...
...
@@ -336,6 +339,15 @@ def get_juniper_link_info(source_equipment: str, interface: str) -> Response:
else
:
result
[
'
interface
'
][
'
bundle_members
'
]
=
[]
snmp_info
=
r
.
get
(
f
'
snmp-interfaces-single:
{
source_equipment
}
:
{
interface
}
'
)
if
snmp_info
:
snmp_info
=
json
.
loads
(
snmp_info
.
decode
(
'
utf-8
'
))
ifc_info
[
'
snmp
'
]
=
{
'
community
'
:
snmp_info
[
'
community
'
],
'
index
'
:
snmp_info
[
'
index
'
]
}
result
.
update
(
get_interface_services_and_locs
(
ims_source_equipment
,
ims_interface
,
...
...
@@ -465,6 +477,10 @@ def peer_info(address_str: str) -> Response:
_location_from_equipment
(
get_ims_equipment_name
(
info
[
'
router
'
]),
r
)))
asn_group_info
=
_asn_group_info
(
r
,
address_str
)
if
asn_group_info
:
result
[
'
asn
'
]
=
asn_group_info
try
:
address
=
ipaddress
.
ip_address
(
address_str
)
except
ValueError
:
...
...
@@ -489,6 +505,17 @@ def peer_info(address_str: str) -> Response:
)
result
[
'
locations
'
].
extend
(
services_and_locs
[
'
locations
'
])
snmp_info
=
r
.
get
(
f
'
snmp-peerings:remote:
{
address
}
'
)
if
snmp_info
:
snmp_info
=
json
.
loads
(
snmp_info
.
decode
(
'
utf-8
'
))
result
[
'
snmp
'
]
=
[
{
'
hostname
'
:
h
[
'
hostname
'
],
'
community
'
:
h
[
'
community
'
],
'
oid
'
:
h
[
'
oid
'
]
}
for
h
in
snmp_info
]
result
[
'
locations
'
]
=
_remove_duplicates_from_list
(
result
[
'
locations
'
])
result
=
json
.
dumps
(
result
)
# cache this data for the next call
...
...
@@ -527,6 +554,9 @@ def get_trap_metadata(source_equipment: str, interface: str, circuit_id: str) \
}
top_level_services
=
[]
# todo - carry on from here
services
=
r
.
get
(
f
'
ims:interface_services:
{
source_equipment
}
:
{
interface
}
'
)
if
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