Add aruba aoscx show interface extra fields - #2336
Conversation
matt852
left a comment
There was a problem hiding this comment.
Recommendation: Changes Required
Breaking Change: Yes
ntc_templates/templates/aruba_aoscx_show_interface.textfsmnarrowsValue IP_ADDRESSfrom(\S+)to(\d+\.\d+\.\d+\.\d+), so the existingip_addresskey changes value format from10.1.2.1/24to10.1.2.1.- 10 existing
ip_addressvalues change acrosstests/aruba_aoscx/show_interface/show_interface2.yml,show_interface3.yml,show_interface4.yml(5),show_interface6.yml(2), andshow_interface7.yml.
Thanks @Ardeck — nice to see these fields picked up, and thanks for regenerating all nine fixtures. A few things to address before this can merge:
-
Please flag the breaking change in the PR description. Splitting the prefix out of
ip_addresschanges the value of an existing key for every routed interface, which breaks downstream consumers that feed that value straight into something likeipaddress.ip_interface(). The description explains the mechanism ("netmask -> split from ip_address") but doesn't call it out as breaking — could you add that explicitly? It'll need to go out with a major release alongside the other queued breaking changes. -
NETMASKshould bePREFIX_LENGTH. The captured value is a CIDR prefix length, not a netmask, and every other template doing this sameIPv4 address x.x.x.x/NNsplit usesPREFIX_LENGTH—allied_telesis_awplus_show_interface,cisco_nxos_show_interface,cisco_ios_show_interfaces,ruckus_fastiron_show_interfaces, plusaruba_aoscx_show_ip_route_all-vrfsandaruba_aoscx_show_interface_mgmton this same platform.In
ntc_templates/templates/aruba_aoscx_show_interface.textfsm, the Value declaration:-Value NETMASK (\d+) +Value PREFIX_LENGTH (\d+)
And the matching rule in the
Startstate:- ^\s*IPv4\s+address\s+${IP_ADDRESS}(/${NETMASK})?\s*$$ + ^\s*IPv4\s+address\s+${IP_ADDRESS}(/${PREFIX_LENGTH})?\s*$$
Then in the fixtures:
- netmask: "24" + prefix_length: "24"
Apply the same key rename to every other
netmask:line in all nine fixture files, or just regenerate withgen-yaml-folder/clean-yaml-folder. -
Please expand the
GW_abbreviations. These are the onlyGW_-prefixed values in the library — the project convention is full names.ACTIVE_GATEWAY_*also keeps them distinct from the default-gateway senseIPV4_GATEWAYhas inaruba_aoscx_show_interface_mgmt.The Value declarations:
-Value GW_IP (\S+) -Value GW_IP_MAC (\S+) -Value GW_SOURCE_MAC (\S+) +Value ACTIVE_GATEWAY_IP (\S+) +Value ACTIVE_GATEWAY_MAC_ADDRESS (\S+) +Value ACTIVE_GATEWAY_SOURCE_MAC_ADDRESS (\S+)
And the rules (this also picks up the whitespace point below):
- ^\s*active-gateway L3 source mac ${GW_SOURCE_MAC} - ^\s*active-gateway ip mac ${GW_IP_MAC} - ^\s*active-gateway ip ${GW_IP} + ^\s*active-gateway\s+L3\s+source\s+mac\s+${ACTIVE_GATEWAY_SOURCE_MAC_ADDRESS} + ^\s*active-gateway\s+ip\s+mac\s+${ACTIVE_GATEWAY_MAC_ADDRESS} + ^\s*active-gateway\s+ip\s+${ACTIVE_GATEWAY_IP}
In
tests/aruba_aoscx/show_interface/show_interface7.yml:- gw_ip: "192.0.2.254" - gw_ip_mac: "02:00:00:aa:bb:cc" - gw_source_mac: "bc:d7:a5:aa:bb:cc" + active_gateway_ip: "192.0.2.254" + active_gateway_mac_address: "02:00:00:aa:bb:cc" + active_gateway_source_mac_address: "bc:d7:a5:aa:bb:cc"
Apply the same key rename to every other
gw_ip:/gw_ip_mac:/gw_source_mac:line across all nine fixture files. -
Literal spaces in the new rules — could you switch these to
\s+? Future-proofing against CLI spacing drift, matching the rest of the template. TheSubinterface countline also has a trailing space (harmless, since TextFSM strips rule lines, but worth removing while you're in there).- ^\s*Subinterface count\s*:\s+${SUBINTERFACE_COUNT} + ^\s*Subinterface\s+count\s*:\s+${SUBINTERFACE_COUNT}
- ^\s*MDI mode\s*:\s*${MDI} - ^\s*Leader-follower\s+mode:\s+${LEADER_FOLLOWER_MODE} + ^\s*MDI\s+mode\s*:\s*${MDI} + ^\s*Leader-follower\s+mode\s*:\s+${LEADER_FOLLOWER_MODE}
Two more that would be good to fold in while this is open:
-
MDI→MDI_MODE. The raw label isMDI mode:, the value is a mode, your own sibling field uses the suffix (LEADER_FOLLOWER_MODE), andhp_procurve_show_interfaces_briefalready usesMDI_MODE.-Value MDI (\S+) +Value MDI_MODE (\S+)
- ^\s*MDI\s+mode\s*:\s*${MDI} + ^\s*MDI\s+mode\s*:\s*${MDI_MODE}
Apply the matching
mdi:→mdi_mode:key rename across all nine fixture files. -
secondary_ip_addressstill carries the prefix. After this change the template emitsip_address: "172.23.2.1"+ a separate prefix, butsecondary_ip_address: ["172.25.2.1/30"]— two address formats out of one parse. Sinceip_addressis already breaking here, splitting the secondary in the same release avoids a second breaking change later.-Value List SECONDARY_IP_ADDRESS (\S+) +Value List SECONDARY_IP_ADDRESS (\d+\.\d+\.\d+\.\d+) +Value List SECONDARY_PREFIX_LENGTH (\d+)
- ^\s*IPv4\s+address\s+${SECONDARY_IP_ADDRESS}\s+secondary + ^\s*IPv4\s+address\s+${SECONDARY_IP_ADDRESS}(/${SECONDARY_PREFIX_LENGTH})?\s+secondary
I checked this against the fixtures and the list alignment holds on the multi-secondary interface (
1/1/45→['172.22.19.1', '172.22.22.1']/['30', '30']).
Optional / FYI: the (/${NETMASK})? optional group has no test data for the bare-address case. I think the optional form is the right call — a required / would push an unmasked line into ^. -> Error — but a line in the description noting that AOS-CX always emits the mask would head off the question.
Thanks!
(review generated with Claude)
|
Additionally, with the |
- rename correctly netmask as prefix_length - add prefix_length to secondary_ip_address - rename MDI to MDI_MODE - rename GW prefix to ACTIVE_GATEWAY
Enhance aruba_aoscx_show_interface parser with the capture of additional fields
Summary
Enhance the Aruba AOS-CX
show_interfaceparser by capturing additional fields that are already present in the command output.Breaking change :
Reason : standardization, IP_address is a valid IPv4 address and not a CIDR notation
Added fields:
Also improved IPv4 address matching to tolerate trailing whitespace.
Validation