Skip to content

fix(cisco_nxos): record LLDP detail blocks that carry no Port id line - #2355

Open
jacqueswindt-gif wants to merge 1 commit into
networktocode:masterfrom
jacqueswindt-gif:fix-nxos-lldp-detail-missing-port-id
Open

fix(cisco_nxos): record LLDP detail blocks that carry no Port id line#2355
jacqueswindt-gif wants to merge 1 commit into
networktocode:masterfrom
jacqueswindt-gif:fix-nxos-lldp-detail-missing-port-id

Conversation

@jacqueswindt-gif

Copy link
Copy Markdown

Problem

On NX-OS releases that do not emit a Port id: line, show lldp neighbors detail parses to zero rows. Not a partial result — the whole command comes back empty, and nothing raises.

NEIGHBOR_INTERFACE is Required and is sourced from:

  ^[Pp]ort\s[idID]{2}\:\s${NEIGHBOR_INTERFACE}$$

That rule is anchored at the start of the line, so Local Port id: correctly does not match it (it is caught by the rule below). On a release that emits Local Port id: and Port Description: but no bare Port id: line, NEIGHBOR_INTERFACE is therefore never filled — and because it is Required, every block is discarded.

Where this was seen

Two Cisco Nexus 3064s, same estate:

release show lldp neighbors detail parsed
6.0(2)U2(9Z) 250 lines, 18 neighbours 0 rows
7.0(3)I4(9) 208 lines, 14 neighbours 14 rows

On the 6.x switch all 18 blocks carry Local Port id: and Port Description:, and none carries Port id:.

The silence is the awkward part: an empty parse from a switch with 18 LLDP neighbours is indistinguishable from a switch that genuinely has none, so a consumer reports "no LLDP adjacency" and is believed.

Fix

Drop Required from NEIGHBOR_INTERFACE. A block then records with the fields the device did send, instead of the command yielding nothing.

NEIGHBOR_NAME and LOCAL_INTERFACE stay Required, so they still guard against recording junk.

Verification

  • Added cisco_nxos_show_lldp_neighbors_detail_no_port_id.{raw,yml} — the block shape that release emits. It parses to 0 rows before this change and 2 rows after.
  • Both existing show_lldp_neighbors_detail fixtures parse byte-identically before and after; releases that already worked are unaffected.
  • Full suite green: 1896 passed for the parsed-reference tests and 2929 passed for index/testcase/capture-group.

Not included, deliberately

Port Description: is present in this output and currently discarded, and on this release it happens to hold the remote interface name. Mapping it to NEIGHBOR_INTERFACE would be wrong in general — in the existing ..._detail2.raw fixture, Port id: Ethernet1/52 sits beside Port Description: SW-NEXUS-UPLINK, where the description is a description. Adding a separate PORT_DESCRIPTION value would be a reasonable follow-up but changes the parsed schema for every consumer, so it is left out of a bug fix.

🤖 Generated with Claude Code

`show lldp neighbors detail` parsed to zero rows on NX-OS releases that do
not emit a `Port id:` line. Not a partial result -- the whole command came
back empty, and nothing raised.

`NEIGHBOR_INTERFACE` is Required and comes from a rule anchored at the start
of the line, so `Local Port id:` correctly does not match it. On a release
emitting `Local Port id:` and `Port Description:` and no bare `Port id:`, the
value is never filled, and being Required it discards every block.

Measured on two Nexus 3064s in one estate: 6.0(2)U2(9Z) returns 250 lines
describing 18 neighbours and parses to 0 rows, while 7.0(3)I4(9) returns 208
lines and parses to 14. All 18 blocks on the 6.x switch carry `Local Port id:`
and `Port Description:` and none carries `Port id:`.

An empty parse from a switch with 18 neighbours is indistinguishable from a
switch that has none, so a consumer reports no LLDP adjacency and is believed.

Dropping Required lets a block record with the fields the device did send.
`NEIGHBOR_NAME` and `LOCAL_INTERFACE` stay Required and still guard against
recording junk. Both existing fixtures parse byte-identically before and
after, so releases that already worked are unaffected.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant