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
f30caae2
Commit
f30caae2
authored
10 months ago
by
Erik Reid
Browse files
Options
Downloads
Patches
Plain Diff
DBOARD3-965 workaround
parent
a9881ec6
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/nokia.py
+11
-8
11 additions, 8 deletions
inventory_provider/nokia.py
with
11 additions
and
8 deletions
inventory_provider/nokia.py
+
11
−
8
View file @
f30caae2
...
...
@@ -3,6 +3,7 @@ import re
from
ncclient
import
manager
,
xml_
from
lxml
import
etree
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -236,15 +237,16 @@ def get_lags_config(netconf_config):
def
get_interfaces_config
(
netconf_config
):
def
_get_address_node_info
(
_e
):
# HACKHACK: quick workaround for DBOARD3-965
# TODO: fix this properly
yield
from
_e
.
xpath
(
'
n:address
'
,
namespaces
=
NS
)
yield
from
_e
.
xpath
(
'
n:primary
'
,
namespaces
=
NS
)
def
_get_ip_address
(
e
):
for
details_parent
in
e
:
# example element
# <primary> # details_parent - not always primary
# <address>62.40.119.9</address>
# <prefix-length>32</prefix-length>
# </primary>
address
=
details_parent
[
0
].
text
prefix_length
=
details_parent
[
1
].
text
for
_address_elem
in
_get_address_node_info
(
e
):
address
=
_address_elem
[
0
].
text
prefix_length
=
_address_elem
[
1
].
text
ip_string
=
f
'
{
address
}
/
{
prefix_length
}
'
yield
ip_string
...
...
@@ -263,6 +265,7 @@ def get_interfaces_config(netconf_config):
if
admin_state
is
not
None
:
details
[
"
admin-state
"
]
=
admin_state
.
text
for
element
in
interface
.
xpath
(
'
n:ipv4
'
,
namespaces
=
NS
):
details
[
"
ipv4
"
].
extend
(
_get_ip_address
(
element
))
...
...
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