Skip to content

hp_procurve_show_lldp_info_remote-device_detail: tolerate empty values#2310

Open
julmanglano wants to merge 3 commits into
networktocode:masterfrom
julmanglano:pr/hp-procurve-show-lldp-info-remote-device-detail
Open

hp_procurve_show_lldp_info_remote-device_detail: tolerate empty values#2310
julmanglano wants to merge 3 commits into
networktocode:masterfrom
julmanglano:pr/hp-procurve-show-lldp-info-remote-device-detail

Conversation

@julmanglano
Copy link
Copy Markdown
Contributor

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT

hp_procurve, show lldp info remote-device detail

SUMMARY

Six rules in the LLDP state require a literal space after the colon:

^\s+SysName\s+:\s${NEIGHBOR_NAME}\s*$$
^\s+System\sDescr\s:\s${NEIGHBOR_DESCRIPTION}\s*$$
^\s+PortDescr\s+:\s${NEIGHBOR_INTERFACE_DESCRIPTION}\s*$$
^\s+Pvid\s+:\s${VLAN_ID}\s*$$
^\s+System\s+Capabilities\s+Supported\s+:\s${CAPABILITIES_SUPPORTED}\s*$$
^\s+System\s+Capabilities\s+Enabled\s+:\s${CAPABILITIES}\s*$$

ProCurve emits empty-valued lines without that trailing space — e.g. an
LLDP neighbor that has not advertised a system name appears as
SysName :\n. The mandatory-space rule misses, the line is not
matched, and downstream rules in the same neighbor block can fail or
attach to the wrong record.

This PR changes those six occurrences from \s to \s?, making the
post-colon space optional. Capture groups are unchanged; in the
empty-value case they capture the empty string.

The new hp_procurve_show_lldp_info_remote-device_detail2.{raw,yml}
fixture covers a Local Port table with both an unpopulated neighbor
(empty SysName, System Descr, etc.) and a fully populated one.

No schema change. The original fixture continues to pass.

mjbear added 2 commits May 11, 2026 20:12
Instead of \s? we could use \s* to allow for zero or more (repeated)
space capturing (in case the vendor output changes).
@mjbear
Copy link
Copy Markdown
Collaborator

mjbear commented May 12, 2026

@julmanglano
Thank you for the PR!
I made some changes to the white space regexes.

  • Change most \s to \s+ for white space future proofing
  • Change those \s? optional white space regex to be \s*
    • Matches zero or more white space
    • The regex will still not break when SysName (and others) are empty strings
    • The regex will allow matching repeated spaces (in case the vendor output changes)

Please review this - my suggestions can be adjusted as needed. 🙂

@mjbear mjbear self-assigned this May 12, 2026
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.

2 participants