Skip to content

Commit

Permalink
Bugfix: ASA - show_interface - Fixes missing interfaces on down inter…
Browse files Browse the repository at this point in the history
  • Loading branch information
jvanderaa authored Jun 1, 2020
1 parent 3e17557 commit 52596cd
Show file tree
Hide file tree
Showing 3 changed files with 329 additions and 15 deletions.
56 changes: 41 additions & 15 deletions templates/cisco_asa_show_interface.textfsm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Value Required INTERFACE (\S+)
Value INTERFACE_ZONE (.+?)
Value LINK_STATUS (\w+)
Value LINK_STATUS (.+?)
Value PROTOCOL_STATUS (.*)
Value HARDWARE_TYPE ([\w ]+)
Value BANDWIDTH (\d+\s+\w+)
Expand All @@ -24,17 +24,43 @@ Value FIVEMIN_OUT_RATE (\d+)
Value FIVEMIN_DROP_RATE (\d+)

Start
^Interface.* -> Continue.Record
^.*Interface ${INTERFACE} "${INTERFACE_ZONE}", is ${LINK_STATUS}.*protocol is ${PROTOCOL_STATUS}
^\s+Hardware is ${HARDWARE_TYPE} -> Continue
^.*BW ${BANDWIDTH}.*DLY ${DELAY}
^.*\(${DUPLEX}.*Auto-Speed\(${SPEED}\)
^.*Description: ${DESCRIPTION}
^.*MAC address ${ADDRESS}.*MTU ${MTU}
^.*IP address ${IP_ADDRESS}, .*subnet mask ${NET_MASK}
^.*1 minute input rate ${ONEMIN_IN_PPS} pkts/sec,\s+${ONEMIN_IN_RATE} bytes/sec
^.*1 minute output rate ${ONEMIN_OUT_PPS} pkts/sec,\s+${ONEMIN_OUT_RATE} bytes/sec
^.*1 minute drop rate, ${ONEMIN_DROP_RATE}
^.*5 minute input rate ${FIVEMIN_IN_PPS} pkts/sec,\s+${FIVEMIN_IN_RATE} bytes/sec
^.*5 minute output rate ${FIVEMIN_OUT_PPS} pkts/sec,\s+${FIVEMIN_OUT_RATE} bytes/sec
^.*5 minute drop rate, ${FIVEMIN_DROP_RATE}
^.*Interface\s+ -> Continue.Record
^.*Interface\s+${INTERFACE}\s+"${INTERFACE_ZONE}",\s+is\s+${LINK_STATUS},.*protocol\s+is\s+${PROTOCOL_STATUS}
^.*Interface\s+${INTERFACE}.*is\s+${LINK_STATUS},.*protocol\s+is\s+${PROTOCOL_STATUS}
^\s+Hardware\s+is\s+${HARDWARE_TYPE} -> Continue
^.*BW\s+${BANDWIDTH},\s+DLY\s+${DELAY}
^.*\(${DUPLEX}\),\s+Auto-Speed\(${SPEED}\)
^.*\(${DUPLEX}\),\s+\d+\s+Mbps\(${SPEED}\)
^.*Description:\s+${DESCRIPTION}
^.*MAC\s+address\s+${ADDRESS},\s+MTU\s+${MTU}
^.*MAC\s+address\s+${ADDRESS},\s+MTU\s+not\s+set
^.*IP\s+address\s+${IP_ADDRESS},\s+subnet\s+mask\s+${NET_MASK}
^.*1\s+minute\s+input\s+rate\s+${ONEMIN_IN_PPS}\s+pkts/sec,\s+${ONEMIN_IN_RATE}\s+bytes/sec
^.*1\s+minute\s+output\s+rate\s+${ONEMIN_OUT_PPS}\s+pkts/sec,\s+${ONEMIN_OUT_RATE}\s+bytes/sec
^.*1\s+minute\s+drop\s+rate,\s+${ONEMIN_DROP_RATE}
^.*5\s+minute\s+input\s+rate\s+${FIVEMIN_IN_PPS}\s+pkts/sec,\s+${FIVEMIN_IN_RATE}\s+bytes/sec
^.*5\s+minute\s+output\s+rate\s+${FIVEMIN_OUT_PPS}\s+pkts/sec,\s+${FIVEMIN_OUT_RATE}\s+bytes/sec
^.*5\s+minute\s+drop\s+rate,\s+${FIVEMIN_DROP_RATE}
^.*Input\s+flow\s+control\s+is\s+unsupported,\s+output\s+flow\s+control\s+is\s+off
^.*\d+\s+packets\s+input,\s+\d+\s+bytes,\s+\d+\s+no\s+buffer
^.*Received\s+\d+\s+broadcasts,\s+\d+\s+runts,\s+\d+\s+giants
^.*\d+\s+input\s+errors,\s+\d+\s+CRC,\s+\d+\s+frame,\s+\d+\s+overrun,\s+\d+\s+ignored,\s+\d+\s+abort
^.*\d+\s+pause\s+input,\s+\d+\s+resume\s+input
^.*\d+\s+L2\s+decode\s+drops
^.*\d+\s+packets\s+output,\s+\d+\s+bytes,\s+\d+\s+underruns
^.*\d+\s+pause\s+output,\s+\d+\s+resume\s+output
^.*\d+\s+output\s+errors,\s+\d+\s+collisions,\s+\d+\s+interface\s+resets
^.*\d+\s+late\s+collisions,\s+\d+\s+deferred
^.*\d+\s+input\s+reset\s+drops,\s+\d+\s+output\s+reset\s+drops
^.*input\s+queue\s+\(blocks\s+free\s+curr\/low\):\s+hardware\s+\(\d+\/\d+\)
^.*output\s+queue\s+\(blocks\s+free\s+curr\/low\):\s+hardware\s+\(\d+\/\d+\)
^.*Traffic\s+Statistics\s+for\s+".+?":
^.*\d+\s+packets\s+input,\s+\d+\s+bytes
^.*\d+\s+packets\s+output,\s+\d+\s+bytes
^.*\d+\s+packets\s+dropped
^.*Management-only\sinterface\.\s+Blocked\s+\d+\s+through-the-device\s+packets
^.*Input\s+flow\s+control\s+is\s+unsupported,\s+output\s+flow\s+control\s+is\s+unsupported
^.*Available\s+but\s+not\s+configured\s+via\s+nameif
^.*IP\s+address\s+unassigned
^\s*$$
^. -> Error
142 changes: 142 additions & 0 deletions tests/cisco_asa/show_interface/cisco_asa_show_interface1.raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
Interface GigabitEthernet0/0 "outside", is up, line protocol is up
Hardware is net_virtio, BW 1000 Mbps, DLY 10 usec
Auto-Duplex(Full-duplex), Auto-Speed(1000 Mbps)
Input flow control is unsupported, output flow control is unsupported
Description: to iosv-1
MAC address 5254.000d.da4c, MTU 1500
IP address 10.99.99.2, subnet mask 255.255.255.0
107 packets input, 35506 bytes, 0 no buffer
Received 0 broadcasts, 0 runts, 0 giants
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
0 pause input, 0 resume input
101 L2 decode drops
6 packets output, 612 bytes, 0 underruns
0 pause output, 0 resume output
0 output errors, 0 collisions, 0 interface resets
0 late collisions, 0 deferred
0 input reset drops, 0 output reset drops
input queue (blocks free curr/low): hardware (0/0)
output queue (blocks free curr/low): hardware (0/0)
Traffic Statistics for "outside":
6 packets input, 492 bytes
6 packets output, 456 bytes
0 packets dropped
1 minute input rate 0 pkts/sec, 0 bytes/sec
1 minute output rate 0 pkts/sec, 0 bytes/sec
1 minute drop rate, 0 pkts/sec
5 minute input rate 0 pkts/sec, 0 bytes/sec
5 minute output rate 0 pkts/sec, 0 bytes/sec
5 minute drop rate, 0 pkts/sec
Interface GigabitEthernet0/1 "inside", is up, line protocol is up
Hardware is net_virtio, BW 1000 Mbps, DLY 10 usec
Auto-Duplex(Full-duplex), Auto-Speed(1000 Mbps)
Input flow control is unsupported, output flow control is unsupported
MAC address 5254.0005.1b55, MTU 1500
IP address 10.90.90.1, subnet mask 255.255.255.0
0 packets input, 0 bytes, 0 no buffer
Received 0 broadcasts, 0 runts, 0 giants
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
0 pause input, 0 resume input
0 L2 decode drops
1 packets output, 54 bytes, 0 underruns
0 pause output, 0 resume output
0 output errors, 0 collisions, 0 interface resets
0 late collisions, 0 deferred
0 input reset drops, 0 output reset drops
input queue (blocks free curr/low): hardware (0/0)
output queue (blocks free curr/low): hardware (0/0)
Traffic Statistics for "inside":
0 packets input, 0 bytes
1 packets output, 28 bytes
0 packets dropped
1 minute input rate 0 pkts/sec, 0 bytes/sec
1 minute output rate 0 pkts/sec, 0 bytes/sec
1 minute drop rate, 0 pkts/sec
5 minute input rate 0 pkts/sec, 0 bytes/sec
5 minute output rate 0 pkts/sec, 0 bytes/sec
5 minute drop rate, 0 pkts/sec
Interface GigabitEthernet0/2 "", is administratively down, line protocol is up
Hardware is net_virtio, BW 1000 Mbps, DLY 10 usec
Full-Duplex(Full-duplex), 1000 Mbps(1000 Mbps)
Input flow control is unsupported, output flow control is unsupported
Available but not configured via nameif
MAC address 5254.0017.e9c0, MTU not set
IP address unassigned
0 packets input, 0 bytes, 0 no buffer
Received 0 broadcasts, 0 runts, 0 giants
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
0 pause input, 0 resume input
0 L2 decode drops
0 packets output, 0 bytes, 0 underruns
0 pause output, 0 resume output
0 output errors, 0 collisions, 0 interface resets
0 late collisions, 0 deferred
0 input reset drops, 0 output reset drops
input queue (blocks free curr/low): hardware (0/0)
output queue (blocks free curr/low): hardware (0/0)
Interface GigabitEthernet0/3 "", is administratively down, line protocol is up
Hardware is net_virtio, BW 1000 Mbps, DLY 10 usec
Auto-Duplex(Full-duplex), Auto-Speed(1000 Mbps)
Input flow control is unsupported, output flow control is unsupported
Available but not configured via nameif
MAC address 5254.001c.5b3a, MTU not set
IP address unassigned
0 packets input, 0 bytes, 0 no buffer
Received 0 broadcasts, 0 runts, 0 giants
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
0 pause input, 0 resume input
0 L2 decode drops
0 packets output, 0 bytes, 0 underruns
0 pause output, 0 resume output
0 output errors, 0 collisions, 0 interface resets
0 late collisions, 0 deferred
0 input reset drops, 0 output reset drops
input queue (blocks free curr/low): hardware (0/0)
output queue (blocks free curr/low): hardware (0/0)
Interface GigabitEthernet0/4 "", is administratively down, line protocol is up
Hardware is net_virtio, BW 1000 Mbps, DLY 10 usec
Auto-Duplex(Full-duplex), Auto-Speed(1000 Mbps)
Input flow control is unsupported, output flow control is unsupported
Available but not configured via nameif
MAC address 5254.0008.9da4, MTU not set
IP address unassigned
0 packets input, 0 bytes, 0 no buffer
Received 0 broadcasts, 0 runts, 0 giants
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
0 pause input, 0 resume input
0 L2 decode drops
0 packets output, 0 bytes, 0 underruns
0 pause output, 0 resume output
0 output errors, 0 collisions, 0 interface resets
0 late collisions, 0 deferred
0 input reset drops, 0 output reset drops
input queue (blocks free curr/low): hardware (0/0)
output queue (blocks free curr/low): hardware (0/0)
Interface Management0/0 "management", is up, line protocol is up
Hardware is net_virtio, BW 1000 Mbps, DLY 10 usec
Auto-Duplex(Full-duplex), Auto-Speed(1000 Mbps)
Input flow control is unsupported, output flow control is unsupported
MAC address 5254.0006.b468, MTU 1500
IP address 10.100.100.2, subnet mask 255.255.255.0
975 packets input, 106522 bytes, 0 no buffer
Received 0 broadcasts, 0 runts, 0 giants
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
0 pause input, 0 resume input
0 L2 decode drops
881 packets output, 108542 bytes, 0 underruns
0 pause output, 0 resume output
0 output errors, 0 collisions, 0 interface resets
0 late collisions, 0 deferred
0 input reset drops, 0 output reset drops
input queue (blocks free curr/low): hardware (0/0)
output queue (blocks free curr/low): hardware (0/0)
Traffic Statistics for "management":
975 packets input, 92872 bytes
883 packets output, 85916 bytes
109 packets dropped
1 minute input rate 1 pkts/sec, 90 bytes/sec
1 minute output rate 1 pkts/sec, 95 bytes/sec
1 minute drop rate, 0 pkts/sec
5 minute input rate 0 pkts/sec, 17 bytes/sec
5 minute output rate 0 pkts/sec, 18 bytes/sec
5 minute drop rate, 0 pkts/sec
146 changes: 146 additions & 0 deletions tests/cisco_asa/show_interface/cisco_asa_show_interface1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
---
parsed_sample:
- address: "5254.000d.da4c"
bandwidth: "1000 Mbps"
delay: "10 usec"
description: "to iosv-1"
duplex: "Full-duplex"
fivemin_drop_rate: "0"
fivemin_in_pps: "0"
fivemin_in_rate: "0"
fivemin_out_pps: "0"
fivemin_out_rate: "0"
hardware_type: "net_virtio"
interface: "GigabitEthernet0/0"
interface_zone: "outside"
ip_address: "10.99.99.2"
link_status: "up"
mtu: "1500"
net_mask: "255.255.255.0"
onemin_drop_rate: "0"
onemin_in_pps: "0"
onemin_in_rate: "0"
onemin_out_pps: "0"
onemin_out_rate: "0"
protocol_status: "up"
speed: "1000 Mbps"
- address: "5254.0005.1b55"
bandwidth: "1000 Mbps"
delay: "10 usec"
description: ""
duplex: "Full-duplex"
fivemin_drop_rate: "0"
fivemin_in_pps: "0"
fivemin_in_rate: "0"
fivemin_out_pps: "0"
fivemin_out_rate: "0"
hardware_type: "net_virtio"
interface: "GigabitEthernet0/1"
interface_zone: "inside"
ip_address: "10.90.90.1"
link_status: "up"
mtu: "1500"
net_mask: "255.255.255.0"
onemin_drop_rate: "0"
onemin_in_pps: "0"
onemin_in_rate: "0"
onemin_out_pps: "0"
onemin_out_rate: "0"
protocol_status: "up"
speed: "1000 Mbps"
- address: "5254.0017.e9c0"
bandwidth: "1000 Mbps"
delay: "10 usec"
description: ""
duplex: "Full-duplex"
fivemin_drop_rate: ""
fivemin_in_pps: ""
fivemin_in_rate: ""
fivemin_out_pps: ""
fivemin_out_rate: ""
hardware_type: "net_virtio"
interface: "GigabitEthernet0/2"
interface_zone: ""
ip_address: ""
link_status: "administratively down"
mtu: ""
net_mask: ""
onemin_drop_rate: ""
onemin_in_pps: ""
onemin_in_rate: ""
onemin_out_pps: ""
onemin_out_rate: ""
protocol_status: "up"
speed: "1000 Mbps"
- address: "5254.001c.5b3a"
bandwidth: "1000 Mbps"
delay: "10 usec"
description: ""
duplex: "Full-duplex"
fivemin_drop_rate: ""
fivemin_in_pps: ""
fivemin_in_rate: ""
fivemin_out_pps: ""
fivemin_out_rate: ""
hardware_type: "net_virtio"
interface: "GigabitEthernet0/3"
interface_zone: ""
ip_address: ""
link_status: "administratively down"
mtu: ""
net_mask: ""
onemin_drop_rate: ""
onemin_in_pps: ""
onemin_in_rate: ""
onemin_out_pps: ""
onemin_out_rate: ""
protocol_status: "up"
speed: "1000 Mbps"
- address: "5254.0008.9da4"
bandwidth: "1000 Mbps"
delay: "10 usec"
description: ""
duplex: "Full-duplex"
fivemin_drop_rate: ""
fivemin_in_pps: ""
fivemin_in_rate: ""
fivemin_out_pps: ""
fivemin_out_rate: ""
hardware_type: "net_virtio"
interface: "GigabitEthernet0/4"
interface_zone: ""
ip_address: ""
link_status: "administratively down"
mtu: ""
net_mask: ""
onemin_drop_rate: ""
onemin_in_pps: ""
onemin_in_rate: ""
onemin_out_pps: ""
onemin_out_rate: ""
protocol_status: "up"
speed: "1000 Mbps"
- address: "5254.0006.b468"
bandwidth: "1000 Mbps"
delay: "10 usec"
description: ""
duplex: "Full-duplex"
fivemin_drop_rate: "0"
fivemin_in_pps: "0"
fivemin_in_rate: "17"
fivemin_out_pps: "0"
fivemin_out_rate: "18"
hardware_type: "net_virtio"
interface: "Management0/0"
interface_zone: "management"
ip_address: "10.100.100.2"
link_status: "up"
mtu: "1500"
net_mask: "255.255.255.0"
onemin_drop_rate: "0"
onemin_in_pps: "1"
onemin_in_rate: "90"
onemin_out_pps: "1"
onemin_out_rate: "95"
protocol_status: "up"
speed: "1000 Mbps"

0 comments on commit 52596cd

Please sign in to comment.