networktocode / ntc-templates

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

cisco_ios_show_alert_counters fails to parse empty space in front of Global Errors' #1295

Closed mjuenema closed 3 months ago

mjuenema commented 1 year ago
ISSUE TYPE
TEMPLATE USING
Value Filldown interface (.+) 
Value errorcode (.+)
Value timestamp (.+)
Value description (.+)
Value recommendation (.+)

Start
  ^Interface:\s+${interface} -> Clear
  ^Error Code:\s+${errorcode}
  ^Timestamp:\s+${timestamp}
  ^Description:\s+${description}
  ^Recommendation:\s+${recommendation} -> Record
  ^Global\s+Errors
  ^\s*$$
  ^. -> Error

EOF
SAMPLE COMMAND OUTPUT
 Global Errors :
SUMMARY

The template fails to parse the space before Global Errors

STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS
textfsm.parser.TextFSMError: State Error raised. Rule Line: 15. Input Line:  Global Errors:

The solution is to change line 13 of the template to below. I am going to submit a Pull Request later.

 ^\s*Global\s+Errors
jvanderaa commented 1 year ago

Do we have some full output? Is this closed out with a different PR already?

mjuenema commented 1 year ago

This is still outstanding. I just have to find the time to submit a PR.

mjbear commented 3 months ago

@mjuenema This goes back to early last year. :wave: If you're busy I'm good with submitting a PR so this issue can be closed out.

:one: But we're going to need the full raw CLI output from cisco_ios show alert counters not only to test against, but also add test cases to this project.

:question: Would you be able to provide complete raw CLI output in a code block within this thread?

For all my effort I can't find this command on any new or old router images nor in Cisco's command references. I know the command had to exist or you all wouldn't have created PR #881 back in '21. :question: What Cisco hardware model does this apply to?

mjuenema commented 3 months ago

The command seems to be specific to the Cisco IE-3000 model. The command does not seem to be documented at all, I only found it by chance. The Cisco IE-3000 model will go end-of-life in June 2025. Rather than fixing the bug it may better to remove support for the command altogether as very few people other than me may actually use it.

mjbear commented 3 months ago

The command seems to be specific to the Cisco IE-3000 model. The command does not seem to be documented at all, I only found it by chance. The Cisco IE-3000 model will go end-of-life in June 2025. Rather than fixing the bug it may better to remove support for the command altogether as very few people other than me may actually use it.

I see. That would explain why I couldn't find a device with the command in its help output.

I wonder if any other Cisco "industrial" switches (or successors to IE-3000) might support show alert counters...

June 2025 is a year away if you're up for seeing this fixed. :grinning: I'll carry the torch. :fire: Whether that's you or me, we need to submit additional test data.

mjuenema commented 3 months ago

The newer Industrial Ethernet switches, e.g. IE-3300, do not support this command.

Leave it to me. I can submit test data.