Skip to content

Commit

Permalink
New Template for Cisco IOS: traceroute <destination> [options] (#699)
Browse files Browse the repository at this point in the history
* Added support for Cisco IOS traceroute command

This template can parse 'numeric' and 'non-numeric'
versions of the output, including extra details, such
as MPLS Exp bits, ASNs and MPLS labels (if available)

Supports up to 10 probes per hop
Captures RTT, or fault reason per probe/per hop

Excessive probes per hop (11th and above) are ignored

* Re-run tests against raw files

* Update templates/cisco_ios_traceroute.textfsm

Co-authored-by: Mikhail Yohman <mikhail.yohman@gmail.com>

Co-authored-by: Mikhail Yohman <mikhail.yohman@gmail.com>
  • Loading branch information
FragmentedPacket authored May 21, 2020
2 parents 805b498 + f38e5b2 commit 2fe5c2f
Show file tree
Hide file tree
Showing 16 changed files with 1,424 additions and 0 deletions.
45 changes: 45 additions & 0 deletions templates/cisco_ios_traceroute.textfsm
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Value Required,Filldown HOP_NUM (\d+)
Value ADDRESS ((?:\d{1,3}\.){3}\d{1,3})
Value FQDN (\S+)
# Captures RTT (in milliseconds), or faults, like
# - * (probe timed out)
# - !H (destination host unreachable)
# - !N (destination network unreachable)
# - !P (destination protocol unreachable)
# - !A (administratively prohibited, aka ACL deny)
# - !Q (source quench, aka destination too busy)
# - !I (user interrupted test)
# - !T (timeout)
# - ? (unknown packet type)
Value List RTT_RESPONSE (\d+(?=\s+msec)|![A-Z]|\*|\?)
# Some intermediate devices provide additional information, such as
# - ASN
# - MPLS Exp Bits / Labels
# This is captured into details field
Value DETAILS (.*)

Start
^Type\s+escape
^Tracing\s+the\s+route
^VRF\s+info: -> Entries
^\s*$$
^\s*$$
^. -> Error

Entries
^\s+${HOP_NUM}\s+ -> Continue
^.*?${FQDN}\s+\(${ADDRESS}\)\s+(?:\[${DETAILS}\])? -> Continue
^.*?${ADDRESS}\s+(?:\[${DETAILS}\])? -> Continue
^.*?${RTT_RESPONSE} -> Continue
^.*?(?:(?:\d+\s+msec|![A-Z]|\*|\?)\s+){1}${RTT_RESPONSE} -> Continue
^.*?(?:(?:\d+\s+msec|![A-Z]|\*|\?)\s+){2}${RTT_RESPONSE} -> Continue
^.*?(?:(?:\d+\s+msec|![A-Z]|\*|\?)\s+){3}${RTT_RESPONSE} -> Continue
^.*?(?:(?:\d+\s+msec|![A-Z]|\*|\?)\s+){4}${RTT_RESPONSE} -> Continue
^.*?(?:(?:\d+\s+msec|![A-Z]|\*|\?)\s+){5}${RTT_RESPONSE} -> Continue
^.*?(?:(?:\d+\s+msec|![A-Z]|\*|\?)\s+){6}${RTT_RESPONSE} -> Continue
^.*?(?:(?:\d+\s+msec|![A-Z]|\*|\?)\s+){7}${RTT_RESPONSE} -> Continue
^.*?(?:(?:\d+\s+msec|![A-Z]|\*|\?)\s+){8}${RTT_RESPONSE} -> Continue
^.*?(?:(?:\d+\s+msec|![A-Z]|\*|\?)\s+){9}${RTT_RESPONSE} -> Continue
^.* -> Record

EOF
1 change: 1 addition & 0 deletions templates/index
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ cisco_ios_show_ip_bgp.textfsm, .*, cisco_ios, sh[[ow]] i[[p]] bgp
cisco_ios_show_tacacs.textfsm, .*, cisco_ios, sh[[ow]] tacacs
cisco_ios_show_clock.textfsm, .*, cisco_ios, sh[[ow]] clo[[ck]]
cisco_ios_show_dmvpn.textfsm, .*, cisco_ios, sh[[ow]] dm[[vpn]]
cisco_ios_traceroute.textfsm, .*, cisco_ios, tr[[aceroute]]
cisco_ios_show_boot.textfsm, .*, cisco_ios, sh[[ow]] boot
cisco_ios_show_vlan.textfsm, .*, cisco_ios, sh[[ow]] vlan
cisco_ios_show_vrf.textfsm, .*, cisco_ios, sh[[ow]] vrf
Expand Down
8 changes: 8 additions & 0 deletions tests/cisco_ios/traceroute/cisco_ios_traceroute_1.raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Type escape sequence to abort.
Tracing the route to 10.133.2.1
VRF info: (vrf in name/id, vrf out name/id)
1 10.180.133.121 1 msec
10.180.133.125 1 msec
10.180.133.121 0 msec
10.180.133.125 2 msec
2 10.180.133.177 1 msec * 2 msec *
35 changes: 35 additions & 0 deletions tests/cisco_ios/traceroute/cisco_ios_traceroute_1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
parsed_sample:
- hop_num: "1"
address: "10.180.133.121"
fqdn: ""
rtt_response:
- "1"
details: ""
- hop_num: "1"
address: "10.180.133.125"
fqdn: ""
rtt_response:
- "1"
details: ""
- hop_num: "1"
address: "10.180.133.121"
fqdn: ""
rtt_response:
- "0"
details: ""
- hop_num: "1"
address: "10.180.133.125"
fqdn: ""
rtt_response:
- "2"
details: ""
- hop_num: "2"
address: "10.180.133.177"
fqdn: ""
rtt_response:
- "1"
- "*"
- "2"
- "*"
details: ""
24 changes: 24 additions & 0 deletions tests/cisco_ios/traceroute/cisco_ios_traceroute_2.raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Type escape sequence to abort.
Tracing the route to 10.225.2.1
VRF info: (vrf in name/id, vrf out name/id)
1 10.180.140.150 1 msec 1 msec 1 msec
2 172.17.10.225 169 msec 142 msec 135 msec
3 108.170.246.129 13 msec * * * * * * * * *
4 74.125.242.97 14 msec
216.239.63.218 12 msec
172.253.68.212 13 msec
74.125.242.97 13 msec
216.239.56.192 13 msec
74.125.242.97 13 msec
108.170.238.117 13 msec
216.239.58.220 13 msec
74.125.242.97 13 msec 13 msec
5 216.58.204.46 13 msec
74.125.242.115 12 msec
74.125.242.114 15 msec
108.170.238.117 12 msec
108.170.238.119 13 msec
74.125.242.83 12 msec 12 msec 13 msec
74.125.242.82 12 msec
108.170.238.117 14 msec
6 172.17.10.225 !H * !H
146 changes: 146 additions & 0 deletions tests/cisco_ios/traceroute/cisco_ios_traceroute_2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
---
parsed_sample:
- hop_num: "1"
address: "10.180.140.150"
fqdn: ""
rtt_response:
- "1"
- "1"
- "1"
details: ""
- hop_num: "2"
address: "172.17.10.225"
fqdn: ""
rtt_response:
- "169"
- "142"
- "135"
details: ""
- hop_num: "3"
address: "108.170.246.129"
fqdn: ""
rtt_response:
- "13"
- "*"
- "*"
- "*"
- "*"
- "*"
- "*"
- "*"
- "*"
- "*"
details: ""
- hop_num: "4"
address: "74.125.242.97"
fqdn: ""
rtt_response:
- "14"
details: ""
- hop_num: "4"
address: "216.239.63.218"
fqdn: ""
rtt_response:
- "12"
details: ""
- hop_num: "4"
address: "172.253.68.212"
fqdn: ""
rtt_response:
- "13"
details: ""
- hop_num: "4"
address: "74.125.242.97"
fqdn: ""
rtt_response:
- "13"
details: ""
- hop_num: "4"
address: "216.239.56.192"
fqdn: ""
rtt_response:
- "13"
details: ""
- hop_num: "4"
address: "74.125.242.97"
fqdn: ""
rtt_response:
- "13"
details: ""
- hop_num: "4"
address: "108.170.238.117"
fqdn: ""
rtt_response:
- "13"
details: ""
- hop_num: "4"
address: "216.239.58.220"
fqdn: ""
rtt_response:
- "13"
details: ""
- hop_num: "4"
address: "74.125.242.97"
fqdn: ""
rtt_response:
- "13"
- "13"
details: ""
- hop_num: "5"
address: "216.58.204.46"
fqdn: ""
rtt_response:
- "13"
details: ""
- hop_num: "5"
address: "74.125.242.115"
fqdn: ""
rtt_response:
- "12"
details: ""
- hop_num: "5"
address: "74.125.242.114"
fqdn: ""
rtt_response:
- "15"
details: ""
- hop_num: "5"
address: "108.170.238.117"
fqdn: ""
rtt_response:
- "12"
details: ""
- hop_num: "5"
address: "108.170.238.119"
fqdn: ""
rtt_response:
- "13"
details: ""
- hop_num: "5"
address: "74.125.242.83"
fqdn: ""
rtt_response:
- "12"
- "12"
- "13"
details: ""
- hop_num: "5"
address: "74.125.242.82"
fqdn: ""
rtt_response:
- "12"
details: ""
- hop_num: "5"
address: "108.170.238.117"
fqdn: ""
rtt_response:
- "14"
details: ""
- hop_num: "6"
address: "172.17.10.225"
fqdn: ""
rtt_response:
- "!H"
- "*"
- "!H"
details: ""
52 changes: 52 additions & 0 deletions tests/cisco_ios/traceroute/cisco_ios_traceroute_3.raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
Type escape sequence to abort.
Tracing the route to dns.google (8.8.8.8)
VRF info: (vrf in name/id, vrf out name/id)
1 10.255.1.1 2 msec 1 msec 1 msec 2 msec 1 msec 1 msec 1 msec 1 msec 1 msec 1 msec
2 10.255.0.5 1 msec 1 msec 1 msec 0 msec 1 msec 0 msec 1 msec 0 msec 0 msec 1 msec
3 192.168.1.254 1 msec 1 msec 1 msec 1 msec 1 msec 1 msec * 1 msec * 1 msec
4 * * * * * * * * * *
5 * * * * * * * * *
31.55.185.181 12 msec
6 31.55.185.188 16 msec 18 msec 12 msec 13 msec 12 msec 11 msec 12 msec 17 msec 12 msec 12 msec
7 core2-hu0-8-0-1.colindale.ukcore.bt.net (195.99.127.152) 11 msec
core1-hu0-12-0-1.colindale.ukcore.bt.net (195.99.127.214) 11 msec
core2-hu0-16-0-8.colindale.ukcore.bt.net (213.121.192.44) 13 msec 13 msec
core1-hu0-16-0-7.colindale.ukcore.bt.net (213.121.192.18) 11 msec
core2-hu0-16-0-8.colindale.ukcore.bt.net (213.121.192.44) 11 msec
core1-hu0-12-0-1.colindale.ukcore.bt.net (195.99.127.214) 12 msec
core1-hu0-17-0-5.colindale.ukcore.bt.net (195.99.127.150) 12 msec
core2-hu0-6-0-6.colindale.ukcore.bt.net (213.121.192.24) 12 msec
core1-hu0-15-0-9.colindale.ukcore.bt.net (213.121.192.14) 11 msec
8 peer3-et-0-0-1.redbus.ukcore.bt.net (62.172.103.238) 12 msec
peer7-et-4-0-1.telehouse.ukcore.bt.net (194.72.16.122) 14 msec
core2-hu0-7-0-0.colindale.ukcore.bt.net (194.72.16.128) 12 msec
peer8-et-0-1-1.telehouse.ukcore.bt.net (109.159.252.150) 12 msec
194.72.16.230 12 msec
peer2-et-3-0-4.slough.ukcore.bt.net (109.159.252.122) 17 msec
peer3-et-0-0-1.redbus.ukcore.bt.net (62.172.103.238) 17 msec
194.72.16.190 12 msec
peer7-et-0-0-1.telehouse.ukcore.bt.net (62.172.103.158) 12 msec
peer8-et-7-0-1.telehouse.ukcore.bt.net (109.159.252.104) 12 msec
9 109.159.253.189 12 msec
peer5-te0-0-0-32.telehouse.ukcore.bt.net (195.99.126.77) 12 msec
109.159.253.73 12 msec
109.159.253.237 13 msec
peer5-te0-0-0-32.telehouse.ukcore.bt.net (195.99.126.77) 13 msec
109.159.253.3 12 msec
109.159.253.219 11 msec
109.159.253.237 12 msec
109.159.253.187 13 msec
109.159.253.75 12 msec
10 * * * * * * * * * *
11 * * * * * * * * * *
12 * * * * * * * * * *
13 * * * * * * * * * *
14 * * * * * * * * * *
15 * * * * * * * * * *
16 * * * * * * * * * *
17 * * * * * * * * * *
18 * * * * * * * * * *
19 * * * * * * * * * *
20 * * * * * * * * * *
21 * * * * * * * * * *
22 * * * * * * * * * *
Loading

0 comments on commit 2fe5c2f

Please sign in to comment.