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
0606c443
Commit
0606c443
authored
4 years ago
by
Robert Latta
Browse files
Options
Downloads
Patches
Plain Diff
corrected interface info retrieval
parent
509cbee8
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/routes/ims_classifier.py
+14
-25
14 additions, 25 deletions
inventory_provider/routes/ims_classifier.py
with
14 additions
and
25 deletions
inventory_provider/routes/ims_classifier.py
+
14
−
25
View file @
0606c443
...
...
@@ -13,7 +13,8 @@ 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
from
inventory_provider.routes.classifier
import
_asn_group_info
,
\
_link_interface_info
routes
=
Blueprint
(
"
ims-inventory-data-classifier-support-routes
"
,
__name__
)
...
...
@@ -313,24 +314,13 @@ def get_juniper_link_info(source_equipment: str, interface: str) -> Response:
if
result
:
result
=
result
.
decode
(
'
utf-8
'
)
else
:
result
=
{
'
locations
'
:
[]
}
ifc_info
=
r
.
get
(
f
'
netconf-interfaces:
{
source_equipment
}
:
{
interface
}
'
)
if
ifc_info
:
result
[
'
interface
'
]
=
json
.
loads
(
ifc_info
.
decode
(
'
utf-8
'
))
else
:
# warning: this should match the structure returned by
# juniper:list_interfaces:_ifc_info
result
[
'
interface
'
]
=
{
'
name
'
:
interface
,
'
description
'
:
''
,
'
bundle
'
:
[],
'
ipv4
'
:
[],
'
ipv6
'
:
[]
}
result
[
'
interface
'
]
=
_link_interface_info
(
r
,
source_equipment
,
interface
)
bundle_members
=
r
.
get
(
f
'
netconf-interface-bundles:
{
source_equipment
}
:
{
interface
}
'
)
if
bundle_members
:
...
...
@@ -339,15 +329,6 @@ 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
,
...
...
@@ -531,7 +512,9 @@ def peer_info(address_str: str) -> Response:
def
get_trap_metadata
(
source_equipment
:
str
,
interface
:
str
,
circuit_id
:
str
)
\
->
Response
:
# interface = interface.replace('-T', '-')
ims_source_equipment
=
get_ims_equipment_name
(
source_equipment
)
ims_interface
=
get_ims_interface
(
interface
)
cache_key
=
f
'
ims-classifier-cache:infinera:
{
source_equipment
}
:
{
interface
}
'
r
=
common
.
get_current_redis
()
...
...
@@ -557,6 +540,12 @@ def get_trap_metadata(source_equipment: str, interface: str, circuit_id: str) \
# todo - carry on from here
result
.
update
(
get_interface_services_and_locs
(
ims_source_equipment
,
ims_interface
,
r
))
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