Skip to content

Commit

Permalink
Update cisco_asa_ping.textfsm (#1565)
Browse files Browse the repository at this point in the history
* Update cisco_asa_ping.textfsm

Added U and Q response to RESPONSE STREAM

Cisco has for valid outputs for ping: .(fail) ! (success) U (unreachable) Q (quench)
  • Loading branch information
jorlandobr authored Dec 26, 2023
1 parent 8e47090 commit 4b1e288
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 6 deletions.
13 changes: 7 additions & 6 deletions ntc_templates/templates/cisco_asa_ping.textfsm
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@ Value Required SENT_QTY (\d+)
Value Required SENT_TYPE (.*)
Value Required DESTINATION (\S+)
Value Required TIMEOUT (\d+)
Value Required RESPONSE_STREAM ([\.\!]+)
Value Required RESPONSE_STREAM ([\.\!/Q/U]+)
Value Required SUCCESS_PCT (\d+)
Value Required SUCCESS_QTY (\d+)
Value Required RTT_MIN (\d+)
Value Required RTT_AVG (\d+)
Value Required RTT_MAX (\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:
^${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}\s+ms
^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
# Error out if raw data does not match any above rules.
^.* -> Error "Could not parse line:"
4 changes: 4 additions & 0 deletions tests/cisco_asa/ping/cisco_asa_ping_mix.raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.245.179.14, timeout is 2 seconds:
Q..U!
Success rate is 20 percent (1/5), round-trip min/avg/max = 9/9/9 ms
12 changes: 12 additions & 0 deletions tests/cisco_asa/ping/cisco_asa_ping_mix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
parsed_sample:
- sent_qty: "5"
sent_type: "100-byte ICMP Echos"
destination: "10.245.179.14"
timeout: "2"
response_stream: "Q..U!"
success_pct: "20"
success_qty: "1"
rtt_min: "9"
rtt_avg: "9"
rtt_max: "9"
4 changes: 4 additions & 0 deletions tests/cisco_asa/ping/cisco_asa_ping_quench.raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.245.179.14, timeout is 2 seconds:
Q..Q.
Success rate is 0 percent (0/5)
12 changes: 12 additions & 0 deletions tests/cisco_asa/ping/cisco_asa_ping_quench.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
parsed_sample:
- sent_qty: "5"
sent_type: "100-byte ICMP Echos"
destination: "10.245.179.14"
timeout: "2"
response_stream: "Q..Q."
success_pct: "0"
success_qty: "0"
rtt_min: ""
rtt_avg: ""
rtt_max: ""
4 changes: 4 additions & 0 deletions tests/cisco_asa/ping/cisco_asa_ping_unreachable.raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.245.179.14, timeout is 2 seconds:
U..U.
Success rate is 0 percent (0/5)
12 changes: 12 additions & 0 deletions tests/cisco_asa/ping/cisco_asa_ping_unreachable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
parsed_sample:
- sent_qty: "5"
sent_type: "100-byte ICMP Echos"
destination: "10.245.179.14"
timeout: "2"
response_stream: "U..U."
success_pct: "0"
success_qty: "0"
rtt_min: ""
rtt_avg: ""
rtt_max: ""

0 comments on commit 4b1e288

Please sign in to comment.