From 0cd867b5a777ae76ed420612efd6cc417efd13f8 Mon Sep 17 00:00:00 2001 From: Josh VanDeraa Date: Fri, 29 May 2020 17:07:38 -0500 Subject: [PATCH 1/2] Fixes missing interfaces on down interfaces --- templates/cisco_asa_show_interface.textfsm | 6 +- .../cisco_asa_show_interface1.raw | 142 +++++++++++++++++ .../cisco_asa_show_interface1.yml | 146 ++++++++++++++++++ 3 files changed, 292 insertions(+), 2 deletions(-) create mode 100644 tests/cisco_asa/show_interface/cisco_asa_show_interface1.raw create mode 100644 tests/cisco_asa/show_interface/cisco_asa_show_interface1.yml diff --git a/templates/cisco_asa_show_interface.textfsm b/templates/cisco_asa_show_interface.textfsm index 27a8474275..1d9b837857 100644 --- a/templates/cisco_asa_show_interface.textfsm +++ b/templates/cisco_asa_show_interface.textfsm @@ -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+) @@ -25,12 +25,14 @@ Value FIVEMIN_DROP_RATE (\d+) Start ^Interface.* -> Continue.Record - ^.*Interface ${INTERFACE} "${INTERFACE_ZONE}", is ${LINK_STATUS}.*protocol is ${PROTOCOL_STATUS} + ^.*Interface ${INTERFACE} "${INTERFACE_ZONE}", is ${LINK_STATUS},.*protocol\s+is\s+${PROTOCOL_STATUS} + ^.*Interface ${INTERFACE}.*is\s+${LINK_STATUS},.*protocol\s+is\s+${PROTOCOL_STATUS} ^\s+Hardware is ${HARDWARE_TYPE} -> Continue ^.*BW ${BANDWIDTH}.*DLY ${DELAY} ^.*\(${DUPLEX}.*Auto-Speed\(${SPEED}\) ^.*Description: ${DESCRIPTION} ^.*MAC address ${ADDRESS}.*MTU ${MTU} + ^.*MAC address ${ADDRESS},\s+MTU not set ^.*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 diff --git a/tests/cisco_asa/show_interface/cisco_asa_show_interface1.raw b/tests/cisco_asa/show_interface/cisco_asa_show_interface1.raw new file mode 100644 index 0000000000..275fd6dd8a --- /dev/null +++ b/tests/cisco_asa/show_interface/cisco_asa_show_interface1.raw @@ -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 + 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.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 \ No newline at end of file diff --git a/tests/cisco_asa/show_interface/cisco_asa_show_interface1.yml b/tests/cisco_asa/show_interface/cisco_asa_show_interface1.yml new file mode 100644 index 0000000000..13e621e620 --- /dev/null +++ b/tests/cisco_asa/show_interface/cisco_asa_show_interface1.yml @@ -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" From fd8aec5c4653d9294b6325a920b65744a23c2b3b Mon Sep 17 00:00:00 2001 From: Josh VanDeraa Date: Sat, 30 May 2020 15:01:56 -0500 Subject: [PATCH 2/2] Adds error, and updates old template to new standards --- templates/cisco_asa_show_interface.textfsm | 56 +++++++++++++------ .../cisco_asa_show_interface1.raw | 2 +- 2 files changed, 41 insertions(+), 17 deletions(-) diff --git a/templates/cisco_asa_show_interface.textfsm b/templates/cisco_asa_show_interface.textfsm index 1d9b837857..f7533874f9 100644 --- a/templates/cisco_asa_show_interface.textfsm +++ b/templates/cisco_asa_show_interface.textfsm @@ -24,19 +24,43 @@ Value FIVEMIN_OUT_RATE (\d+) Value FIVEMIN_DROP_RATE (\d+) Start - ^Interface.* -> Continue.Record - ^.*Interface ${INTERFACE} "${INTERFACE_ZONE}", is ${LINK_STATUS},.*protocol\s+is\s+${PROTOCOL_STATUS} - ^.*Interface ${INTERFACE}.*is\s+${LINK_STATUS},.*protocol\s+is\s+${PROTOCOL_STATUS} - ^\s+Hardware is ${HARDWARE_TYPE} -> Continue - ^.*BW ${BANDWIDTH}.*DLY ${DELAY} - ^.*\(${DUPLEX}.*Auto-Speed\(${SPEED}\) - ^.*Description: ${DESCRIPTION} - ^.*MAC address ${ADDRESS}.*MTU ${MTU} - ^.*MAC address ${ADDRESS},\s+MTU not set - ^.*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 \ No newline at end of file diff --git a/tests/cisco_asa/show_interface/cisco_asa_show_interface1.raw b/tests/cisco_asa/show_interface/cisco_asa_show_interface1.raw index 275fd6dd8a..2eed1f08fe 100644 --- a/tests/cisco_asa/show_interface/cisco_asa_show_interface1.raw +++ b/tests/cisco_asa/show_interface/cisco_asa_show_interface1.raw @@ -57,7 +57,7 @@ Interface GigabitEthernet0/1 "inside", is up, line protocol is up 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 - Auto-Duplex(Full-duplex), Auto-Speed(1000 Mbps) + 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