From 3a2451f922513dd1abd73fdb3309a2b293b4b4b0 Mon Sep 17 00:00:00 2001 From: Wender Putters Date: Mon, 11 Mar 2019 12:57:57 +0100 Subject: [PATCH 1/3] updated template to catch speed and mac for bundle-interfaces. --- templates/cisco_xr_show_interfaces.template | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/cisco_xr_show_interfaces.template b/templates/cisco_xr_show_interfaces.template index d010f81722..75512ddbbb 100644 --- a/templates/cisco_xr_show_interfaces.template +++ b/templates/cisco_xr_show_interfaces.template @@ -1,23 +1,23 @@ Value Required INTERFACE (\S+) Value LINK_STATUS (.+?) Value ADMIN_STATE (.+?) -Value HARDWARE_TYPE (\S+?(?:\s+Ethernet|)) +Value HARDWARE_TYPE (\S+?(?:\s+Ethernet|)(?:\s+interface\(s\)|)) Value ADDRESS ((?:\w{4}\.){2}\w{4}) Value BIA ((?:\w{4}\.){2}\w{4}) Value DESCRIPTION (.*?) Value IP_ADDRESS (.*?) Value MTU (\d+) Value DUPLEX (.+?) -Value SPEED (.+?) +Value SPEED (.+?b/s) Value BANDWIDTH (\d+\s+\w+) Value ENCAPSULATION (\w+) Start ^\S+\s+is -> Continue.Record ^${INTERFACE}\sis\s+${LINK_STATUS},\s+line\sprotocol\sis\s+${ADMIN_STATE}\s*$$ - ^\s+Hardware\s+is\s+${HARDWARE_TYPE}(?:,\s+address\s+is\s+${ADDRESS}\s+\(bia\s+${BIA}\)\s*$$|\s.+|\s*$$) + ^\s+Hardware\s+is\s+${HARDWARE_TYPE}(?:,\s+address\s+is\s+${ADDRESS}(?:\s+\(bia\s+${BIA}\)\s*)*$$|\s.+|\s*$$) ^\s+Description:\s+${DESCRIPTION}\s*$$ ^\s+[Ii]nternet\s+[Aa]ddress\s+is\s+${IP_ADDRESS}\s*$$ ^\s+MTU\s+${MTU}.*BW\s+${BANDWIDTH} ^\s+Encapsulation\s+${ENCAPSULATION} - ^\s+(?:[Dd]uplex\s+|)${DUPLEX}(?:-[Dd]uplex|),\s+${SPEED},.+link + ^\s+(?:[Dd]uplex\s+|)${DUPLEX}(?:-[Dd]uplex|),\s+${SPEED} From 041619958e7526fba677e132745f110298c3b557 Mon Sep 17 00:00:00 2001 From: Wender Putters Date: Mon, 11 Mar 2019 14:29:52 +0100 Subject: [PATCH 2/3] Added test --- .../cisco_xr_show_interfaces.parsed | 13 +++++++++ .../cisco_xr_show_interfaces.raw | 28 +++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/tests/cisco_xr/show_interfaces/cisco_xr_show_interfaces.parsed b/tests/cisco_xr/show_interfaces/cisco_xr_show_interfaces.parsed index 62a1bcebec..d7b785946c 100644 --- a/tests/cisco_xr/show_interfaces/cisco_xr_show_interfaces.parsed +++ b/tests/cisco_xr/show_interfaces/cisco_xr_show_interfaces.parsed @@ -104,3 +104,16 @@ parsed_sample: link_status: "administratively down" mtu: "1514" speed: "10000Mb/s" + - address: "aaaa.bbbb.cccc" + admin_state: "up" + bandwidth: "10000000 Kbit" + bia: "" + description: "Bundle_example" + duplex: "Full" + encapsulation: "ARPA" + hardware_type: "Aggregated Ethernet interface(s)" + interface: "Bundle-Ether123456" + ip_address: "Unknown" + link_status: "up" + mtu: "1514" + speed: "10000Mb/s" diff --git a/tests/cisco_xr/show_interfaces/cisco_xr_show_interfaces.raw b/tests/cisco_xr/show_interfaces/cisco_xr_show_interfaces.raw index 52e747aeb9..dddffecec2 100644 --- a/tests/cisco_xr/show_interfaces/cisco_xr_show_interfaces.raw +++ b/tests/cisco_xr/show_interfaces/cisco_xr_show_interfaces.raw @@ -193,3 +193,31 @@ TenGigE0/3/0/4 is administratively down, line protocol is administratively down 0 output errors, 0 underruns, 0 applique, 0 resets 0 output buffer failures, 0 output buffers swapped out 0 carrier transitions + + Bundle-Ether123456 is up, line protocol is up + Interface state transitions: 1 + Hardware is Aggregated Ethernet interface(s), address is aaaa.bbbb.cccc + Description: Bundle_example + Internet address is Unknown + MTU 1514 bytes, BW 10000000 Kbit (Max: 10000000 Kbit) + reliability 255/255, txload 0/255, rxload 0/255 + Encapsulation ARPA, + Full-duplex, 10000Mb/s + loopback not set, + Last link flapped 3w1d + No. of members in this bundle: 1 + TenGigE0/3/0/4 Full-duplex 10000Mb/s Active + Last input 00:00:00, output 00:00:00 + Last clearing of "show interface" counters never + 5 minute input rate 0 bits/sec, 0 packets/sec + 5 minute output rate 0 bits/sec, 0 packets/sec + 0 packets input, 0 bytes, 0 total input drops + 0 drops for unrecognized upper-level protocol + Received 0 broadcast packets, 0 multicast packets + 0 runts, 0 giants, 0 throttles, 0 parity + 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort + 0 packets output, 0 bytes, 0 total output drops + Output 0 broadcast packets, 0 multicast packets + 0 output errors, 0 underruns, 0 applique, 0 resets + 0 output buffer failures, 0 output buffers swapped out + 0 carrier transitions From c14e942044a99c704d23ffd69baf696f2a69a9d1 Mon Sep 17 00:00:00 2001 From: Wender Putters Date: Mon, 11 Mar 2019 15:27:08 +0100 Subject: [PATCH 3/3] removed 'interface(s)' from HARDWARE_TYPE capture. --- templates/cisco_xr_show_interfaces.template | 4 ++-- .../cisco_xr/show_interfaces/cisco_xr_show_interfaces.parsed | 2 +- tests/cisco_xr/show_interfaces/cisco_xr_show_interfaces.raw | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/cisco_xr_show_interfaces.template b/templates/cisco_xr_show_interfaces.template index 75512ddbbb..6b526d6429 100644 --- a/templates/cisco_xr_show_interfaces.template +++ b/templates/cisco_xr_show_interfaces.template @@ -1,7 +1,7 @@ Value Required INTERFACE (\S+) Value LINK_STATUS (.+?) Value ADMIN_STATE (.+?) -Value HARDWARE_TYPE (\S+?(?:\s+Ethernet|)(?:\s+interface\(s\)|)) +Value HARDWARE_TYPE (\S+?(?:\s+Ethernet|)) Value ADDRESS ((?:\w{4}\.){2}\w{4}) Value BIA ((?:\w{4}\.){2}\w{4}) Value DESCRIPTION (.*?) @@ -15,7 +15,7 @@ Value ENCAPSULATION (\w+) Start ^\S+\s+is -> Continue.Record ^${INTERFACE}\sis\s+${LINK_STATUS},\s+line\sprotocol\sis\s+${ADMIN_STATE}\s*$$ - ^\s+Hardware\s+is\s+${HARDWARE_TYPE}(?:,\s+address\s+is\s+${ADDRESS}(?:\s+\(bia\s+${BIA}\)\s*)*$$|\s.+|\s*$$) + ^\s+Hardware\s+is\s+${HARDWARE_TYPE}(?:\s+interface\(s\)|)(?:,\s+address\s+is\s+${ADDRESS}(?:\s+\(bia\s+${BIA}\)\s*)*$$|\s.+|\s*$$) ^\s+Description:\s+${DESCRIPTION}\s*$$ ^\s+[Ii]nternet\s+[Aa]ddress\s+is\s+${IP_ADDRESS}\s*$$ ^\s+MTU\s+${MTU}.*BW\s+${BANDWIDTH} diff --git a/tests/cisco_xr/show_interfaces/cisco_xr_show_interfaces.parsed b/tests/cisco_xr/show_interfaces/cisco_xr_show_interfaces.parsed index d7b785946c..4ba01e435d 100644 --- a/tests/cisco_xr/show_interfaces/cisco_xr_show_interfaces.parsed +++ b/tests/cisco_xr/show_interfaces/cisco_xr_show_interfaces.parsed @@ -111,7 +111,7 @@ parsed_sample: description: "Bundle_example" duplex: "Full" encapsulation: "ARPA" - hardware_type: "Aggregated Ethernet interface(s)" + hardware_type: "Aggregated Ethernet" interface: "Bundle-Ether123456" ip_address: "Unknown" link_status: "up" diff --git a/tests/cisco_xr/show_interfaces/cisco_xr_show_interfaces.raw b/tests/cisco_xr/show_interfaces/cisco_xr_show_interfaces.raw index dddffecec2..9c5d9cc925 100644 --- a/tests/cisco_xr/show_interfaces/cisco_xr_show_interfaces.raw +++ b/tests/cisco_xr/show_interfaces/cisco_xr_show_interfaces.raw @@ -194,7 +194,7 @@ TenGigE0/3/0/4 is administratively down, line protocol is administratively down 0 output buffer failures, 0 output buffers swapped out 0 carrier transitions - Bundle-Ether123456 is up, line protocol is up +Bundle-Ether123456 is up, line protocol is up Interface state transitions: 1 Hardware is Aggregated Ethernet interface(s), address is aaaa.bbbb.cccc Description: Bundle_example