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
864e0f16
Commit
864e0f16
authored
5 years ago
by
Erik Reid
Browse files
Options
Downloads
Patches
Plain Diff
always return a skeleton structure for any interface name
parent
ac824d4a
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/juniper.py
+2
-0
2 additions, 0 deletions
inventory_provider/juniper.py
inventory_provider/routes/classifier.py
+18
-6
18 additions, 6 deletions
inventory_provider/routes/classifier.py
with
20 additions
and
6 deletions
inventory_provider/juniper.py
+
2
−
0
View file @
864e0f16
...
...
@@ -209,6 +209,8 @@ def list_interfaces(netconf_config):
"""
def
_ifc_info
(
e
):
# warning: this structure should match the default
# returned from routes.classifier.juniper_link_info
name
=
e
.
find
(
'
name
'
)
assert
name
is
not
None
,
"
expected interface
'
name
'
child element
"
ifc
=
{
...
...
This diff is collapsed.
Click to expand it.
inventory_provider/routes/classifier.py
+
18
−
6
View file @
864e0f16
...
...
@@ -107,6 +107,16 @@ def get_juniper_link_info(source_equipment, interface):
'
netconf-interfaces:%s:%s
'
%
(
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
'
:
[]
}
def
_related_services
():
for
related
in
related_interfaces
(
source_equipment
,
interface
):
...
...
@@ -123,12 +133,14 @@ def get_juniper_link_info(source_equipment, interface):
related_services
.
extend
(
top_level_services
)
result
[
'
related-services
'
]
=
related_services
if
not
result
:
return
Response
(
response
=
"
no available info for {} {}
"
.
format
(
source_equipment
,
interface
),
status
=
404
,
mimetype
=
"
text/html
"
)
# no longer possible, now that at least 'interface' is
# returned for unknown interfaces
# if not result:
# return Response(
# response="no available info for {} {}".format(
# source_equipment, interface),
# status=404,
# mimetype="text/html")
result
=
json
.
dumps
(
result
)
# cache this data for the next call
...
...
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