networktocode/ntc-templates

cisco_ios_ping.textfsm cannot parse output when pinging a directed broadcast IP

Closed this issue · 0 comments

ISSUE TYPE
  • Template Issue with error and raw data
TEMPLATE USING
Value Required SENT_QTY (\d+)
Value Required SENT_TYPE (.*)
Value Required DESTINATION (\S+)
Value Required TIMEOUT (\d+)
Value SOURCE (\S+)
Value List RESPONSE_STREAM ([\.\!/U/Q]+)
Value Required SUCCESS_PCT (\d+)
Value Required SUCCESS_QTY (\d+)
Value RTT_MIN (\d+)
Value RTT_AVG (\d+)
Value RTT_MAX (\d+)


Start
  ^Type\s+escape\s+sequence\s+to\s+abort.
  ^Sending\s+${SENT_QTY},\s+${SENT_TYPE}\s+to\s+${DESTINATION},\s+timeout\s+is\s+${TIMEOUT}\s+seconds:
  ^Packet\s+sent\s+with\s+a\s+source\s+address\s+of\s+${SOURCE}
  ^Packet\s+sent\s+with\s+the\s+DF\s+bit\s+set
  ^${RESPONSE_STREAM}
  ^Success\s+rate\s+is\s+${SUCCESS_PCT}\s+percent\s+\(${SUCCESS_QTY}\/\d+\)(?:,\s+round-trip\s+min/avg/max\s+\=\s+)?(?:${RTT_MIN}/${RTT_AVG}/${RTT_MAX})?(?:\sms)?
  ^\s*$$
  # Error out if raw data does not match any above rules.
  ^.* -> Error "Could not parse line:"
SAMPLE COMMAND OUTPUT
Type escape sequence to abort.
Sending 2, 100-byte ICMP Echos to 10.32.20.255, timeout is 2 seconds:

Reply to request 0 from 10.32.20.2, 3 ms
Reply to request 0 from 10.32.20.222, 26 ms
Reply to request 0 from 10.32.20.1, 7 ms
Reply to request 0 from 10.32.20.3, 5 ms
Reply to request 1 from 10.32.20.3, 6 ms
Reply to request 1 from 10.32.20.1, 11 ms
Reply to request 1 from 10.32.20.2, 8 ms
Reply to request 1 from 10.32.20.222, 7 ms
SUMMARY

The current template cannot parse output in this format. It's only seen when pinging the broadcast address of a directly attached network on a cisco IOS device.

STEPS TO REPRODUCE

in production the issue is seen using scraping SSH output from devices but is accurately replicated by inputting the supplied template and CLI into https://textfsm.nornir.tech/

ping 10.32.20.255 repeat 2 timeout 2
EXPECTED RESULTS

I didn't expect it to work, as I could see from the template that it wouldn't cope with the unexpected CLI output

ACTUAL RESULTS

parser error

[
	"Error: \"Could not parse line:\". Rule Line: 23. Input Line: Reply to request 0 from 10.32.20.2, 3 ms."
]