netenglabs / suzieq

Using network observability to operate and design healthier networks
https://www.stardustsystems.net/
Apache License 2.0
775 stars 105 forks source link

fix(suzieq/poller/worker/services/interfaces.py): change xcvr unsupported adminState for NX-OS #931

Closed beufanet closed 3 months ago

beufanet commented 3 months ago

Related Issue

Fixes #930

Description

XCVR not inserted should be managed as admin down interface.

Type of change

New Behavior

When dealing with Cisco NX-OS, output for shutdown interface when SFP is not inserted is the following :

cisco# show interface brief
<...>
--------------------------------------------------------------------------------
Ethernet      VLAN    Type Mode   Status  Reason                   Speed     Port
Interface                                                                    Ch #
--------------------------------------------------------------------------------
Eth1/1        --      eth  routed down    XCVR not inserted          auto(D) --
Eth1/2        --      eth  routed down    XCVR not inserted          auto(D) --
Eth1/3        --      eth  routed down    XCVR not inserted          auto(D) --
Eth1/4        --      eth  routed down    XCVR not inserted          auto(D) --
Eth1/5        --      eth  routed down    XCVR not inserted          auto(D) --
Eth1/6        --      eth  routed down    XCVR not inserted          auto(D) --
Eth1/7        --      eth  routed down    XCVR not inserted          auto(D) --
Eth1/8        --      eth  routed down    XCVR not inserted          auto(D) --
Eth1/9        1       eth  trunk  up      none                        25G(D) 9
Eth1/10       --      eth  routed up      none                        25G(D) --
Eth1/11       1       eth  trunk  up      none                        25G(D) --
Eth1/12       --      eth  routed up      none                        25G(D) --

Even if the interface is in shutdown adminState.

...

Contrast to Current Behavior

In the following line, this is considered as if the link is not connected, even if the interface is set to shutdown state.

                if entry['reason'] in ["link not connected",
                                       "xcvr not inserted"]:
                    entry['state'] = 'notConnected'

Creating a specific case for the entry reason "xcvr not inserted" to change adminState to down:

               if entry['reason'] == "xcvr not inserted":
                    entry['state'] = 'notConnected'
                    entry['adminState'] = 'down'

Discussion: Benefits and Drawbacks

It will help to show interfaces really down, as an interface with no XCVR is by default shutdown.

Changes to the Documentation

None

Proposed Release Note Entry

Consider NX-OS interface with Reason 'XCVR not inserted' as adminState=down ...

Comments

None

Double Check

ddutt commented 3 months ago

Thank you @beufanet we'll get this incorporated into the next release.