Skip to content

Commit

Permalink
add rates and error counters to cisco_xr_show_interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
mjbear committed Jul 28, 2024
1 parent c770fcc commit 98e01e8
Show file tree
Hide file tree
Showing 2 changed files with 201 additions and 12 deletions.
33 changes: 31 additions & 2 deletions ntc_templates/templates/cisco_xr_show_interfaces.textfsm
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,27 @@ Value DESCRIPTION (.*?)
Value IP_ADDRESS (.*?)
Value MTU (\d+)
Value DUPLEX (.+?)
Value HARDWARE_MEDIA (.*?)
Value SPEED (.+?b/s)
Value BANDWIDTH (\d+\s+\w+)
Value ENCAPSULATION ([\w\.\s]+)
Value VLAN_ID (\d+)
Value HARDWARE_MEDIA (.*?)
Value LAST_INPUT (.+?)
Value LAST_OUTPUT (.+?)
Value INPUT_RATE (\d+)
Value OUTPUT_RATE (\d+)
Value INPUT_PPS (\d+)
Value OUTPUT_PPS (\d+)
Value INPUT_PACKETS (\d+)
Value OUTPUT_PACKETS (\d+)
Value RUNTS (\d+)
Value GIANTS (\d+)
Value INPUT_ERRORS (\d+)
Value CRC (\d+)
Value FRAME (\d+)
Value OVERRUN (\d+)
Value ABORT (\d+)
Value OUTPUT_ERRORS (\d+)

Start
^\S+\s+is -> Continue.Record
Expand All @@ -24,4 +40,17 @@ Start
^\s+Encapsulation\s+${ENCAPSULATION},\s+(Vlan|VLAN)\s+I(D|d)\s+${VLAN_ID}.+$$
^\s+Encapsulation\s+${ENCAPSULATION},.*$$
^\s+(?:[Dd]uplex\s+|)${DUPLEX}(?:-[Dd]uplex|),\s+${SPEED}(?:,\s+${HARDWARE_MEDIA},)?

^\s+Last\s+input\s+${LAST_INPUT},\s+output\s+${LAST_OUTPUT}\s*$$
^.*input\s+rate\s+${INPUT_RATE}\s+\w+/sec,\s+${INPUT_PPS}\s+packets.+$$
^.*output\s+rate\s+${OUTPUT_RATE}\s+\w+/sec,\s+${OUTPUT_PPS}\s+packets.+$$
^\s+${INPUT_PACKETS}\s+packets\s+input,\s+\d+\s+bytes,\s+\d+(\s+\S+){3}\s*$$
^\s+\d+\s+drops\s+for\s+unrecognized(\s+\S+)+$$
^\s+Received\s+\d+
^\s+${RUNTS}\s+runts,\s+${GIANTS}\s+giants,\s+\d+\s+throttles,\s+\d+\s+parity\s*$$
^\s+${INPUT_ERRORS}\s+input\s+errors,\s+${CRC}\s+CRC,\s+${FRAME}\s+frame,\s+${OVERRUN}\s+overrun,\s+\d+\s+ignored\s*$$
^\s+${INPUT_ERRORS}\s+input\s+errors,\s+${CRC}\s+CRC,\s+${FRAME}\s+frame,\s+${OVERRUN}\s+overrun,\s+\d+\s+ignored,\s+${ABORT}\s+abort\s*$$
^\s+${OUTPUT_PACKETS}\s+packets\s+output,\s+\d+\s+bytes,\s+\d+(\s+\S+){3}\s*$$
^\s+Output\s+\d+
^\s+${OUTPUT_ERRORS}\s+output\s+errors,(\s+\d+\s+\S+,?)+\s*$$
^\s+\d+output\s+buffer
^\s+\d+carrier\s+transitions
180 changes: 170 additions & 10 deletions tests/cisco_xr/show_interfaces/cisco_xr_show_interfaces.yml
Original file line number Diff line number Diff line change
@@ -1,152 +1,312 @@
---
parsed_sample:
- admin_state: "up"
- abort: ""
admin_state: "up"
bandwidth: "0 Kbit"
bia: ""
crc: ""
description: "$DCI ~Loopback for OSPF/LDP/BGP/TE"
duplex: ""
encapsulation: "Loopback"
frame: ""
giants: ""
hardware_media: ""
hardware_type: "Loopback"
input_errors: ""
input_packets: ""
input_pps: ""
input_rate: ""
interface: "Loopback5"
ip_address: "192.168.169.21/32"
last_input: "Unknown"
last_output: "Unknown"
link_status: "up"
mac_address: ""
mtu: "1500"
output_errors: ""
output_packets: ""
output_pps: ""
output_rate: ""
overrun: ""
runts: ""
speed: ""
vlan_id: ""
- admin_state: "up"
- abort: ""
admin_state: "up"
bandwidth: "0 Kbit"
bia: ""
crc: ""
description: ""
duplex: ""
encapsulation: "Null"
frame: ""
giants: ""
hardware_media: ""
hardware_type: "Null"
input_errors: ""
input_packets: "0"
input_pps: "0"
input_rate: "0"
interface: "Null0"
ip_address: "Unknown"
last_input: "never"
last_output: "never"
link_status: "up"
mac_address: ""
mtu: "1500"
output_errors: ""
output_packets: "0"
output_pps: "0"
output_rate: "0"
overrun: ""
runts: ""
speed: ""
vlan_id: ""
- admin_state: "up"
- abort: ""
admin_state: "up"
bandwidth: "0 Kbit"
bia: ""
crc: ""
description: "$DCI TE Tunnel For REPLICATION to P-YB19-C95"
duplex: ""
encapsulation: "TUNNEL"
frame: ""
giants: ""
hardware_media: ""
hardware_type: "Tunnel-TE"
input_errors: ""
input_packets: "0"
input_pps: "0"
input_rate: "0"
interface: "tunnel-te300"
ip_address: "192.168.169.21/32"
last_input: "never"
last_output: "00:00:00"
link_status: "up"
mac_address: ""
mtu: "1500"
output_errors: ""
output_packets: "1960425"
output_pps: "1"
output_rate: "2000"
overrun: ""
runts: ""
speed: ""
vlan_id: ""
- admin_state: "administratively down"
- abort: "0"
admin_state: "administratively down"
bandwidth: "0 Kbit"
bia: "5087.8966.5329"
crc: "0"
description: "$DCI"
duplex: "unknown"
encapsulation: "ARPA"
frame: "0"
giants: "0"
hardware_media: "THD"
hardware_type: "Management Ethernet"
input_errors: "0"
input_packets: "0"
input_pps: "0"
input_rate: "0"
interface: "MgmtEth0/RSP0/CPU0/1"
ip_address: "Unknown"
last_input: "never"
last_output: "never"
link_status: "administratively down"
mac_address: "5087.8966.5329"
mtu: "1514"
output_errors: "0"
output_packets: "0"
output_pps: "0"
output_rate: "0"
overrun: "0"
runts: "0"
speed: "0Kb/s"
vlan_id: ""
- admin_state: "up"
- abort: "0"
admin_state: "up"
bandwidth: "1000000 Kbit"
bia: "f09e.6340.1420"
crc: "0"
description: "Management Interface"
duplex: "Full"
encapsulation: "ARPA"
frame: "0"
giants: "0"
hardware_media: "THD"
hardware_type: "Management Ethernet"
input_errors: "0"
input_packets: "43738403"
input_pps: "10"
input_rate: "22000"
interface: "MgmtEth0/RSP1/CPU0/0"
ip_address: "10.253.3.18/25"
last_input: "00:00:11"
last_output: "00:00:41"
link_status: "up"
mac_address: "f09e.6340.1420"
mtu: "1514"
output_errors: "0"
output_packets: "121976"
output_pps: "0"
output_rate: "0"
overrun: "0"
runts: "0"
speed: "1000Mb/s"
vlan_id: ""
- admin_state: "up"
- abort: "0"
admin_state: "up"
bandwidth: "40000000 Kbit"
bia: "5087.895f.81a0"
crc: "0"
description: "$DCI ~QTS Richmond DCI @CRDC %P-CRDC-C98 +Fort0/0/0/0 !CRIT"
duplex: "Full"
encapsulation: "ARPA"
frame: "0"
giants: "0"
hardware_media: ""
hardware_type: "FortyGigE"
input_errors: "0"
input_packets: "478575583"
input_pps: "128"
input_rate: "62000"
interface: "FortyGigE0/0/0/0"
ip_address: "192.168.166.9/30"
last_input: "00:00:00"
last_output: "00:00:00"
link_status: "up"
mac_address: "5087.895f.81a0"
mtu: "9216"
output_errors: "0"
output_packets: "478514791"
output_pps: "128"
output_rate: "62000"
overrun: "0"
runts: "0"
speed: "40000Mb/s"
vlan_id: ""
- admin_state: "up"
- abort: "0"
admin_state: "up"
bandwidth: "10000000 Kbit"
bia: "5087.8964.53b0"
crc: "0"
description: "$DCI ~QTS Richmond Prod @CRDC %Z-CRDC-Dcc001 +Te5/1 !CRIT"
duplex: "Full"
encapsulation: "ARPA"
frame: "0"
giants: "0"
hardware_media: ""
hardware_type: "TenGigE"
input_errors: "0"
input_packets: "74732197285"
input_pps: "26671"
input_rate: "134379000"
interface: "TenGigE0/3/0/0"
ip_address: "192.168.166.65/30"
last_input: "00:00:00"
last_output: "00:00:00"
link_status: "up"
mac_address: "5087.8964.53b0"
mtu: "9216"
output_errors: "0"
output_packets: "2222908838"
output_pps: "257"
output_rate: "285000"
overrun: "0"
runts: "0"
speed: "10000Mb/s"
vlan_id: ""
- admin_state: "administratively down"
- abort: "0"
admin_state: "administratively down"
bandwidth: "10000000 Kbit"
bia: "5087.8964.53b4"
crc: "0"
description: ""
duplex: "Full"
encapsulation: "ARPA"
frame: "0"
giants: "0"
hardware_media: ""
hardware_type: "TenGigE"
input_errors: "0"
input_packets: "0"
input_pps: "0"
input_rate: "0"
interface: "TenGigE0/3/0/4"
ip_address: "Unknown"
last_input: "never"
last_output: "never"
link_status: "administratively down"
mac_address: "5087.8964.53b4"
mtu: "1514"
output_errors: "0"
output_packets: "0"
output_pps: "0"
output_rate: "0"
overrun: "0"
runts: "0"
speed: "10000Mb/s"
vlan_id: ""
- admin_state: "up"
- abort: "0"
admin_state: "up"
bandwidth: "10000000 Kbit"
bia: ""
crc: "0"
description: "Bundle_example"
duplex: "Full"
encapsulation: "ARPA"
frame: "0"
giants: "0"
hardware_media: ""
hardware_type: "Aggregated Ethernet"
input_errors: "0"
input_packets: "0"
input_pps: "0"
input_rate: "0"
interface: "Bundle-Ether123456"
ip_address: "Unknown"
last_input: "00:00:00"
last_output: "00:00:00"
link_status: "up"
mac_address: "aaaa.bbbb.cccc"
mtu: "1514"
output_errors: "0"
output_packets: "0"
output_pps: "0"
output_rate: "0"
overrun: "0"
runts: "0"
speed: "10000Mb/s"
vlan_id: ""
- admin_state: "administratively down"
- abort: ""
admin_state: "administratively down"
bandwidth: "1000000 Kbit"
bia: ""
crc: ""
description: "qsqsd svsdvxcvsdv"
duplex: ""
encapsulation: "802.1Q Virtual LAN"
frame: ""
giants: ""
hardware_media: ""
hardware_type: "VLAN"
input_errors: ""
input_packets: "0"
input_pps: "0"
input_rate: "0"
interface: "GigabitEthernet0/0/0/12.456"
ip_address: "192.168.5.1/24"
last_input: "never"
last_output: "never"
link_status: "administratively down"
mac_address: "5000.0002.000d"
mtu: "1518"
output_errors: ""
output_packets: "0"
output_pps: "0"
output_rate: "0"
overrun: ""
runts: ""
speed: ""
vlan_id: "456"

0 comments on commit 98e01e8

Please sign in to comment.