Add hp_procurve_show_lldp_info_local-device#2313
Conversation
matt852
left a comment
There was a problem hiding this comment.
Recommendation: Changes Suggested
Thanks @julmanglano — clean PR with thoughtful test data covering both chassis-ID formats. One cross-vendor alignment suggestion before merge:
Rename CAPABILITIES_ENABLED → CAPABILITIES. The dominant LLDP/CDP convention across Cisco, Arista, Aruba AOS-CX, Brocade, Huawei, and the existing hp_procurve_show_lldp_info_remote-device_detail.textfsm is CAPABILITIES_SUPPORTED paired with plain CAPABILITIES for the enabled set. Matching the sibling HP procurve template specifically keeps the field name consistent within the same vendor.
In ntc_templates/templates/hp_procurve_show_lldp_info_local-device.textfsm, the Value declaration:
-Value CAPABILITIES_ENABLED (\S.*\S)
+Value CAPABILITIES (\S.*\S)And the matching rule in the Start state:
- ^\s*System\s+Capabilities\s+Enabled\s*:\s+${CAPABILITIES_ENABLED}\s*$$
+ ^\s*System\s+Capabilities\s+Enabled\s*:\s+${CAPABILITIES}\s*$$And the fixture key. In tests/hp_procurve/show_lldp_info_local-device/show_lldp_info_local-device.yml:
- capabilities_enabled: "bridge"
+ capabilities: "bridge"Apply the same single-line key rename to tests/hp_procurve/show_lldp_info_local-device/show_lldp_info_local-device2.yml.
Thanks!
|
Thanks @matt852 — agreed on the alignment with the sibling |
matt852
left a comment
There was a problem hiding this comment.
A few additional suggestions as I continue refining the AI agent reviewer:
Recommendation: Changes Suggested
Breaking Change: No
Two regex-coverage suggestions before merge, plus a couple of optional thoughts.
Unused ProCurve alternation branch in the System Description rule. Neither fixture emits a description starting with ProCurve (both are Aruba and HP), so the branch is not exercised.
Recommended fix: Tighten the regex to the two branches the fixtures cover. In ntc_templates/templates/hp_procurve_show_lldp_info_local-device.textfsm:
- ^\s*System\s+Description\s*:\s+(?:ProCurve|HP|Aruba)\s+${MODEL}\s+${SYSTEM_DESCRIPTION}\s*$$
+ ^\s*System\s+Description\s*:\s+(?:HP|Aruba)\s+${MODEL}\s+${SYSTEM_DESCRIPTION}\s*$$Or — if you'd rather keep the three-way alternation for defensive reasons — add a third .raw/.yml fixture pair from a real device that emits System Description : ProCurve <model> … so the branch is exercised.
Why
The project standard for permissive regex constructs (alternation branches, optional groups, fallback rules) is that test data must exercise every branch — otherwise tighten the regex. The fixtures cover `HP` and `Aruba` but not `ProCurve`.Unused vendor-less System Description fallback rule. The fallback at line 17 catches descriptions that don't start with ProCurve|HP|Aruba, but neither fixture takes that path — both match the vendor-prefixed rule on line 16.
Recommended fix: Either drop the fallback:
- ^\s*System\s+Description\s*:\s+${SYSTEM_DESCRIPTION}\s*$$Or keep it as a defensive parse and add a .raw/.yml fixture pair whose System Description does not start with a recognized vendor token (e.g., a different firmware variant), so the rule is exercised.
Why
Same rule as above — every catch-all rule needs a test that hits it, or it should be removed. Prose justification in the PR body doesn't substitute for fixture coverage; the goal is that any future maintainer can confirm the rule's behavior by reading the fixtures.Optional — MODEL could align with the data-model dictionary. The captured values (JL255A, J9774A) are HP part numbers/SKUs, which docs/dev/data_model.md lists under PID ("Part IDs (PIDs), Stock Keeping Units (SKUs), and in some cases Models or Model Numbers"). For cross-vendor consumers, PID is more portable than MODEL.
Recommended fix (optional): Rename MODEL → PID in the template Value + the Start-state rule, and regenerate both fixture YAMLs.
-Value MODEL (\S+)
+Value PID (\S+)- ^\s*System\s+Description\s*:\s+(?:ProCurve|HP|Aruba)\s+${MODEL}\s+${SYSTEM_DESCRIPTION}\s*$$
+ ^\s*System\s+Description\s*:\s+(?:ProCurve|HP|Aruba)\s+${PID}\s+${SYSTEM_DESCRIPTION}\s*$$Apply the same model: → pid: key rename in both fixture YAMLs.
Why
`PID` is the canonical name in the data-model dictionary for SKU/part-number captures, and `MODEL` is not in the dictionary at all. Cross-vendor name normalization is the project's top standard.Optional — LLDP Port Information rows. The PR description notes this section is intentionally not captured because it would duplicate show lldp info remote-device. Worth flagging that the local-device port table is structurally distinct (it's the local device's own port advertisements, not neighbors). If you'd like to keep it out of scope here, a one-line comment in the PortSection state noting the intent would help future readers; otherwise, decomposing it into LOCAL_INTERFACE / PORT_TYPE / LOCAL_PORT_ID / LOCAL_PORT_DESCRIPTION captures would be a clean follow-up.
Why
The data-model-coverage rule asks contributors to expose every meaningful field a downstream consumer might want — adding a capture later can be a breaking change.Thanks!
|
Thanks @matt852 — Probed 124 hp_procurve devices across the estate: 0 hits on the Picked up the Worth flagging: the parsed-output key rename has a downstream consumer in the On the Parser tests + meta tests all green locally. Pushed. |
…IS_ID and capture PID Builds on PR networktocode#2284. Two additive changes: - Broaden CHASSIS_ID regex from \S+ to \S.*\S to match the existing CHASSIS_TYPE / DESCRIPTION style. Without this, lines like 'Chassis Id : 54 80 28 ed 33 80' (HP 2530-8G family) fail to match the rule, the parse aborts on '^. -> Error', and device_type discovery breaks downstream. - Add Value Filldown PID (\S+) extracted from the System Description via a Continue rule. Keeps DESCRIPTION semantics unchanged (whole string) while exposing the SKU (JL254A, J9774A, ...) as a separately-queryable field. Useful for device_type mappers that consume the SKU directly. New fixture (hp_procurve_show_lldp_info_local-device3) covers the space-separated CHASSIS_ID format on HP 2530-8G. Existing yml fixtures updated with the new pid key.
bc6f4ac to
d23f8c5
Compare
|
Thanks @matt852 — rebased on top of #2284 to combine both improvements. Two additive changes layered onto #2284's :
Per-port captures ( |
ISSUE TYPE
COMPONENT
hp_procurve,
show lldp info local-deviceSUMMARY
Adds a new template for the HP/Aruba ProCurve
show lldp info local-devicecommand. Captures the device's own LLDP advertisement —chassis info, system name/description, capabilities, and management
address.
Capture groups (cross-vendor aligned with other LLDP templates):
CHASSIS_TYPE, CHASSIS_ID, SYSTEM_NAME, SYSTEM_DESCRIPTION, MODEL,
CAPABILITIES_SUPPORTED, CAPABILITIES_ENABLED, MGMT_ADDRESS_TYPE,
MGMT_ADDRESS.
SYSTEM_DESCRIPTIONhas two fallback rules: when the descriptionstarts with the vendor token (
ProCurve|HP|Aruba), the part-numberis captured separately into
MODEL; otherwise the whole string iscaptured into
SYSTEM_DESCRIPTION.CHASSIS_IDis anchored on\S.*\Srather than\S+becauseProCurve emits the chassis MAC in two different formats depending on
firmware:
548028-aabbcf(stack/newer firmware)54 80 28 aa bb cd(standalone/older firmware)The two fixtures cover both formats.
The
LLDP Port Informationsection is acknowledged but not parsedinto capture groups (it would duplicate
show lldp info remote-deviceoutput — out of scope here).
Index entry inserted at the correct length-sorted position within the
hp_procurveblock (length 47, between length-48 and length-45 rows).