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
5dabe1ef
Commit
5dabe1ef
authored
8 months ago
by
Robert Latta
Browse files
Options
Downloads
Patches
Plain Diff
excluded pxc ports and related lags. RE DBOARD3-997
parent
8802988a
No related branches found
Branches containing commit
Tags
0.130
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
+22
-0
22 additions, 0 deletions
inventory_provider/nokia.py
with
22 additions
and
0 deletions
inventory_provider/nokia.py
+
22
−
0
View file @
5dabe1ef
import
ipaddress
import
logging
import
re
from
functools
import
lru_cache
from
lxml
import
etree
from
ncclient
import
manager
,
xml_
...
...
@@ -173,6 +174,19 @@ def get_interfaces_state(state_doc):
yield
details
@lru_cache
def
get_pxc_ports
(
netconf_config
):
# these ports will be ignored for the purposes of the update
pxc_ports
=
set
()
for
port
in
netconf_config
.
findall
(
'
./configure/port-xc/pxc
'
):
pxc_ports
.
add
(
port
.
find
(
'
port-id
'
).
text
)
for
port
in
netconf_config
.
findall
(
'
./configure/port
'
):
port_id
=
port
.
find
(
'
port-id
'
).
text
if
port_id
.
startswith
(
'
pxc
'
):
pxc_ports
.
add
(
port_id
)
return
pxc_ports
def
get_ports_config
(
netconf_config
):
def
_port_info
(
e
):
pi
=
{
...
...
@@ -193,10 +207,14 @@ def get_ports_config(netconf_config):
breakout_match
.
group
(
'
unit
'
),
'
Unknown
'
)
return
pi
pxc_ports
=
get_pxc_ports
(
netconf_config
)
# making the assumption that the breakout ports are listed directly before their
current_parent_port
=
None
# child ports
for
port
in
netconf_config
.
findall
(
'
./configure/port
'
):
port_id
=
port
.
find
(
'
port-id
'
).
text
if
port_id
in
pxc_ports
:
continue
port_info
=
_port_info
(
port
)
if
'
breakout
'
in
port_info
:
current_parent_port
=
port_info
...
...
@@ -212,6 +230,7 @@ def get_lags_config(netconf_config):
enabled_ports
=
{
p
[
'
port-id
'
]
for
p
in
get_ports_config
(
netconf_config
)
if
p
[
'
admin-state
'
]
==
'
enable
'
}
pxc_ports
=
get_pxc_ports
(
netconf_config
)
def
_lag_info
(
e
):
_name
=
e
.
find
(
'
./lag-name
'
).
text
...
...
@@ -228,6 +247,9 @@ def get_lags_config(netconf_config):
return
ifc
for
lag
in
netconf_config
.
findall
(
'
./configure/lag
'
):
ports
=
{
p
.
find
(
'
./port-id
'
).
text
for
p
in
lag
.
findall
(
'
./port
'
)}
if
pxc_ports
>
ports
:
continue
yield
_lag_info
(
lag
)
...
...
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