Add aruba aoscx show system inventory - #2339
Conversation
Next is the default action https://github.com/google/textfsm/wiki/TextFSM#line-actions
* There is leading whitespace before Number, so make it one or more * Modify table separator line regex to simplify
* Remove regex space at beginning of line (not present in data) * Fix two word part types (ex: Power Supply)
|
@Ardeck |
matt852
left a comment
There was a problem hiding this comment.
Recommendation: Changes Suggested
Breaking Change: No
Thanks @Ardeck — this is in great shape: clean fixture pair, index entry, and all tests pass locally. One naming suggestion before merge:
-
Use
PIDinstead ofPRODUCT_NUMBER.docs/dev/data_model.mdstandardizesPIDfor part numbers / SKUs, and all seven existing*_show_inventorytemplates (arista_eos, aruba_os, cisco_asa, cisco_ios, cisco_nxos, cisco_wlc_ssh, cisco_xr_admin) use it —PRODUCT_NUMBERwould be unique to this template.In
ntc_templates/templates/aruba_aoscx_show_system_inventory.textfsm, the Value declaration:-Value PRODUCT_NUMBER (\S+) +Value PID (\S+)
And the matching rule in the
Startstate:- ^${TYPE}\s+${LOCATION}\s+${PRODUCT_NUMBER}\s+${DESCRIPTION}\s+${SERIAL}\s+${HARDWARE_VERSION}\s*$$ -> Record + ^${TYPE}\s+${LOCATION}\s+${PID}\s+${DESCRIPTION}\s+${SERIAL}\s+${HARDWARE_VERSION}\s*$$ -> Record
And in the fixture:
- product_number: "JL635A" + pid: "JL635A"
Apply the same key rename to every other
product_number:line in the fixture —invoke gen-yaml-folderfollowed byinvoke clean-yaml-folderregenerates it for you.
FYI / optional:
-
Value TYPE (\w+\s?\w+)is tighter than the output may allow. It accepts only one or two\wwords, so a hyphenated type (Fan-Tray) raisesLINE NOT FOUNDand a three-word type (Power Supply Shelf) lands in the wrong columns. Since the Type and Location columns are always separated by two or more spaces, a greedy single-space repetition is safe and handles both:-Value TYPE (\w+\s?\w+) +Value TYPE (\S+(?:\s\S+)*)
This leaves the current fixture output unchanged. Given @mjbear's note about testing on more live gear, it may be worth folding in now.
-
Bare
-> Erroris the prevailing convention inaruba_aoscx_*templates (25 bare vs. 2 with a message string):- ^. -> Error "LINE NOT FOUND" + ^. -> Error
-
TYPEandHARDWARE_VERSIONdiffer from the sibling inventory templates'NAMEandVID. Neither pair is standardized indocs/dev/data_model.md, and both of your names match the device's own column labels, so this is a maintainer call rather than a change request.
Thanks!
(review generated with Claude)
There isn't an instance of either of these types ( |
Description
Adds a new TextFSM template to support parsing
show system inventoryfor Aruba AOS-CX devices.Files Added / Modified
ntc_templates/templates/aruba_aoscx_show_system_inventory.textfsmntc_templates/templates/indextests/aruba_aoscx/show_system_inventory/aruba_aoscx_show_system_inventory.rawtests/aruba_aoscx/show_system_inventory/aruba_aoscx_show_system_inventory.ymlExample CLI Output
Parsed Data Structure
[ { "type": "Chassis", "location": "1", "product_number": "JL635A", "description": "Aruba 8325-48Y8C 48p 25G 8p 100G Swch", "serial": "TW52KM007J", "hardware_version": "0" } ]Verification
invoke gen-yaml-folder)poetry run pytest -k aruba_aoscx_show_system_inventory(All tests pass)invoke yamllint black flake8)