Skip to content

Fix XR7 parse error where ARP EVPN line exists #2092

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Start
^\s+Outgoing\s+access\s+list\s+is\s+${OUT_ACL}
^\s+Inbound\s+(?:common)?\s+access\s+list\s+is\s+${IN_ACL}
^\s+Proxy.*$$
^\s+ARP EVPN.*$$
^\s+ICMP redirects.*$$
^\s+ICMP unreachables.*$$
^\s+ICMP mask.*$$
Comment on lines +38 to 41
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we please replace literal whitespaces with regex?

(We can leave the other regexes alone on this PR and I can follow up with another PR for other things as mentioned in earlier discussion.)

Suggested change
^\s+ARP EVPN.*$$
^\s+ICMP redirects.*$$
^\s+ICMP unreachables.*$$
^\s+ICMP mask.*$$
^\s+ARP\s+EVPN.*$$
^\s+ICMP\s+redirects.*$$
^\s+ICMP\s+unreachables.*$$
^\s+ICMP\s+mask.*$$

Copy link
Contributor Author

@garymccann garymccann Apr 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines are not equivalent. \s+ matches one or more whitespace characters, where the literal whitespace is just one.
I checked performance of literal, \s and \s+ - all 3 take 14 processing steps (regex101.com) so there is no processing gain to be had from any change in implementation.

My personal preference is to keep the literal whitespace, since it reads most similar to the CLI output, however, given there is no performance penalties, i am agnostic.

Please let me know your thoughts, main thing here is to get this merged into a pypy release for my use in production uses.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm looking at this through a future-proofing lens -- balancing the flexibility of the template and its regexes to hopefully reduce the maintenance burden in the long term.

I certainly hope that Cisco doesn't add extra accidental whitespace, but we've seen other vendors make somewhat haphazard changes (ex: spacing, capitalization, spelling).

Note

Since I already have it on my mind to tackle putting the structured data alphabetic ordering in a different PR, this literal whitespace could be something that happens there.

My gut feeling is for me to hold off with the whitespace regex, etc until a later PR (as in not for this PR).
I welcome feedback from the other maintainers if they have thoughts on it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@itdependsnetworks @jmcgill298 @jvanderaa
👋
Thoughts on moving forward with merging this as it is?

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Mon Mar 31 18:49:52.390 UTC
Bundle-Ether123 is Down, ipv4 protocol is Down
Vrf is default (vrfid 0x60000000)
Internet protocol processing disabled
MgmtEth0/RP0/CPU0/0 is Up, ipv4 protocol is Up
Vrf is MGMT (vrfid 0x60000001)
Internet address is 192.168.254.130/24
MTU is 1514 (1500 is available to IP)
Helper address is not set
Directed broadcast forwarding is disabled
Outgoing access list is not set
Inbound common access list is not set, access list is not set
Proxy ARP is disabled
ARP EVPN Proxy is disabled
ICMP redirects are never sent
ICMP unreachables are always sent
ICMP mask replies are never sent
Table Id is 0xe0000001
GigabitEthernet0/0/0/0 is Shutdown, ipv4 protocol is Down
Vrf is default (vrfid 0x60000000)
Internet protocol processing disabled
GigabitEthernet0/0/0/1 is Shutdown, ipv4 protocol is Down
Vrf is default (vrfid 0x60000000)
Internet protocol processing disabled
GigabitEthernet0/0/0/1.100 is Shutdown, ipv4 protocol is Down
Vrf is default (vrfid 0x60000000)
Internet protocol processing disabled
GigabitEthernet0/0/0/2 is Shutdown, ipv4 protocol is Down
Vrf is default (vrfid 0x60000000)
Internet protocol processing disabled
GigabitEthernet0/0/0/3 is Up, ipv4 protocol is Up
Vrf is MGMT (vrfid 0x60000001)
Internet protocol processing disabled
114 changes: 114 additions & 0 deletions tests/cisco_xr/show_ipv4_interface/cisco_xr_show_ipv4_interface6.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
---
parsed_sample:
- interface: "Bundle-Ether123"
in_acl: ""
ip_address: ""
ip_mtu: ""
link_status: "Down"
mtu: ""
multicast_groups: []
out_acl: ""
prefix_length: ""
protocol: "ipv4"
protocol_status: "Down"
rpf_check: ""
sec_ip_address: []
sec_prefix_length: []
vrf: "default"
vrf_id: "0x60000000"
- interface: "MgmtEth0/RP0/CPU0/0"
in_acl: "not set, access list is not set"
ip_address: "192.168.254.130"
ip_mtu: "1500"
link_status: "Up"
mtu: "1514"
multicast_groups: []
out_acl: "not set"
prefix_length: "24"
protocol: "ipv4"
protocol_status: "Up"
rpf_check: ""
sec_ip_address: []
sec_prefix_length: []
vrf: "MGMT"
vrf_id: "0x60000001"
- interface: "GigabitEthernet0/0/0/0"
in_acl: ""
ip_address: ""
ip_mtu: ""
link_status: "Shutdown"
mtu: ""
multicast_groups: []
out_acl: ""
prefix_length: ""
protocol: "ipv4"
protocol_status: "Down"
rpf_check: ""
sec_ip_address: []
sec_prefix_length: []
vrf: "default"
vrf_id: "0x60000000"
- interface: "GigabitEthernet0/0/0/1"
in_acl: ""
ip_address: ""
ip_mtu: ""
link_status: "Shutdown"
mtu: ""
multicast_groups: []
out_acl: ""
prefix_length: ""
protocol: "ipv4"
protocol_status: "Down"
rpf_check: ""
sec_ip_address: []
sec_prefix_length: []
vrf: "default"
vrf_id: "0x60000000"
- interface: "GigabitEthernet0/0/0/1.100"
in_acl: ""
ip_address: ""
ip_mtu: ""
link_status: "Shutdown"
mtu: ""
multicast_groups: []
out_acl: ""
prefix_length: ""
protocol: "ipv4"
protocol_status: "Down"
rpf_check: ""
sec_ip_address: []
sec_prefix_length: []
vrf: "default"
vrf_id: "0x60000000"
- interface: "GigabitEthernet0/0/0/2"
in_acl: ""
ip_address: ""
ip_mtu: ""
link_status: "Shutdown"
mtu: ""
multicast_groups: []
out_acl: ""
prefix_length: ""
protocol: "ipv4"
protocol_status: "Down"
rpf_check: ""
sec_ip_address: []
sec_prefix_length: []
vrf: "default"
vrf_id: "0x60000000"
- interface: "GigabitEthernet0/0/0/3"
in_acl: ""
ip_address: ""
ip_mtu: ""
link_status: "Up"
mtu: ""
multicast_groups: []
out_acl: ""
prefix_length: ""
protocol: "ipv4"
protocol_status: "Up"
rpf_check: ""
sec_ip_address: []
sec_prefix_length: []
vrf: "MGMT"
vrf_id: "0x60000001"
Loading