networktocode / ntc-templates

TextFSM templates for parsing show commands of network devices
https://ntc-templates.readthedocs.io/
Other
1.09k stars 713 forks source link

Bug with cisco_ios_show_ap_summary.textfsm #1731

Closed wet17 closed 2 months ago

wet17 commented 2 months ago
ISSUE TYPE
TEMPLATE USING

cisco_ios_show_ap_summary.textfsm

Value AP_NAME (\S+) Value SLOT (\d+) Value AP_MODEL (\S+) Value MAC_ADDRESS ([a-fA-F0-9:.]+) Value RADIO_MAC ([a-fA-F0-9:.]+) Value LOCATION (.+?) Value COUNTRY (\S+) Value IP_ADDRESS ([a-fA-F0-9:.]+) Value STATE (\S+)

Start ^[a-zA-Z]+\s[a-z]+\s[a-zA-z]+:\s\d+$$ ^AP\s+Name\s+Slots\s+AP\s+Model\s+Ethernet\s+MAC\s+Radio\sMAC\s+Location\s+Country\s+IP\s+Address\s+State\s$$ ^-+\s$$ ^${AP_NAME}\s+${SLOT}\s+${AP_MODEL}\s+${MAC_ADDRESS}\s+${RADIO_MAC}\s+${LOCATION}\s+${COUNTRY}\s+${IP_ADDRESS}\s+${STATE}\s$$ -> Record ^\s$$ ^. -> Error

SAMPLE COMMAND OUTPUT

EK-WLC#sh ap summary Number of APs: 44

CC = Country Code RD = Regulatory Domain

AP Name Slots AP Model Ethernet MAC Radio MAC CC RD IP Address State Location

XWL3-2702-ICT02 2 AIR-CAP2702I-E-K9 002c.c82c.aefc 002c.c8f1.8cf0 CH -E 10.198.90.22 Registered Bin7-Reisende

SUMMARY

Cisco added CC = Country Code RD = Regulatory Domain to the show output in the new Cisco 9800 ios WLAN Controller. With the actual TextFSM Template, it ends in a error.

EXPECTED RESULTS

[ { "ap_name": "XWL3-2702-ICT02", "slot": "2", "ap_model": "AIR-CAP2702I-E-K9", "mac": "002c.c82c.aefc", "radio_mac": "002c.c8f1.8cf0", "location": "Bin7-Reisende", "country": "CH", "regulatorydomain": "-E", "ip": "10.198.90.22", "ipv6": "", "state": "Registered", "clients": "", "dse_location": "" } ]

SAMPLE COMMAND OUTPUT

Created a working Template: Value AP_NAME (\S+) Value SLOT (\d+) Value AP_MODEL (\S+) Value MAC ([a-fA-F0-9:.]+) Value RADIO_MAC ([a-fA-F0-9:.]+) Value LOCATION (.+?) Value COUNTRY (\S+) Value REGULATORYDOMAIN (\S+) Value IP ([0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}) Value IPV6 ([0-9a-fA-F]{1,4}\:[a-fA-F0-9\:]+) Value STATE (\S+) Value CLIENTS (\d+) Value DSE_LOCATION ([.+])

Start ^Number. ^${AP_NAME}\s+${SLOT}\s+${AP_MODEL}\s+${MAC}\s+${LOCATION}\s+${COUNTRY}\s+${IP}\s+${CLIENTS}\s+${DSE_LOCATION}\s$$ -> Record ^${AP_NAME}\s+${SLOT}\s+${AP_MODEL}\s+${MAC}\s+${LOCATION}\s+${COUNTRY}\s+${IPV6}\s+${CLIENTS}\s+${DSE_LOCATION}\s$$ -> Record ^${AP_NAME}\s+${SLOT}\s+${AP_MODEL}\s+${MAC}\s+${RADIO_MAC}\s+${COUNTRY}\s+${REGULATORYDOMAIN}\s+${IP}\s+${STATE}\s+${LOCATION}$$ -> Record ^${AP_NAME}\s+${SLOT}\s+${AP_MODEL}\s+${MAC}\s+${RADIO_MAC}\s+${COUNTRY}\s+${REGULATORYDOMAIN}\s+${IPV6}\s+${STATE}\s+${LOCATION}$$ -> Record ^${AP_NAME}\s+${SLOT}\s+${AP_MODEL}\s+${MAC}\s+${RADIO_MAC}\s+${LOCATION}\s+${COUNTRY}\s+${IP}\s+${STATE}\s$$ -> Record ^${AP_NAME}\s+${SLOT}\s+${AP_MODEL}\s+${MAC}\s+${RADIO_MAC}\s+${LOCATION}\s+${COUNTRY}\s+${IPV6}\s+${STATE}\s$$ -> Record ^${AP_NAME}\s+${SLOT}\s+${AP_MODEL}\s+${MAC}\s+${LOCATION}\s+${COUNTRY}\s+${IP}\s+.$$ -> Record ^${AP_NAME}\s+${SLOT}\s+${AP_MODEL}\s+${MAC}\s+${LOCATION}\s+${COUNTRY}\s+${IPV6}\s+.$$ -> Record ^.+.+ ^\s$$ ^AP\s+Name\s. ^AP\ds ^CC\s=\sCountry\sCode. ^RD\s=\sRegulatory\sDomain.* ^-+ ^. -> Error

mjbear commented 2 months ago

Hello @wet17 I'm going to suggest we may make changes in incremental stages because NTC has a policy regarding breaking changes. Breaking changes must wait for a major version release.

Spot on with the regulatory domain addition!

With that aside, a few things:

https://github.com/networktocode/ntc-templates/pull/1739/files#diff-2fd0f359ac70f1a92d624fd450be97aa7ae04eabd07f316691e5bf289e78a09e

Please give my PR #1739 a look if you would. This PR resolves the addition of the Regulatory Domain. Thank you.