Skip to content
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

Standardize VRF Regex for IOSXE show_vrf.py #804

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
--------------------------------------------------------------------------------
Fix
--------------------------------------------------------------------------------
* IOSXE
* Modified ShowVrf:
* Standardized VRF Matching to include special characters beyond dash and dot
8 changes: 4 additions & 4 deletions src/genie/libs/parser/iosxe/show_vrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def cli(self, vrf='', output=None):
# test 10.116.83.34:100 ipv4,ipv6 Lo100
# ce1 <being deleted> ipv4,ipv6 Et1/0
# * ce1 2:2 ipv4,ipv6
p1 = re.compile(r'^(((?P<being_deleted>\*))\s+)?(?P<vrf>[\w\d\-\.]+)\s+(?P<rd>\<not +set\>|<being deleted>|[\.\d\:]+)(?:\s+(?P<protocols>[(?:ipv\d)\,]+))?(?:\s+(?P<intf>[\S\s]+))?$')
p1 = re.compile(r'^(((?P<being_deleted>\*))\s+)?(?P<vrf>[\S]+)\s+(?P<rd>\<not +set\>|<being deleted>|[\.\d\:]+)(?:\s+(?P<protocols>[(?:ipv\d)\,]+))?(?:\s+(?P<intf>[\S\s]+))?$')

# Lo300
# Gi2.390
Expand Down Expand Up @@ -282,7 +282,7 @@ def cli(self, output=None):
r'current +count +(?P<count>\d+)$')

# VRF label distribution protocol: not configured
p10 = re.compile(r'^VRF +label +distribution +protocol: +(?P<vrf_label>[\w\s\-]+)$')
p10 = re.compile(r'^VRF +label +distribution +protocol: +(?P<vrf_label>[\S]+)$')

# VRF label allocation mode: per-prefix
p11 = re.compile(r'^VRF +label +allocation +mode: +(?P<mode>[\w\s\-]+)'
Expand Down Expand Up @@ -591,7 +591,7 @@ def cli(self, vrf='',output=None):
output = self.device.execute(self.cli_command.format(vrf=vrf))

res_dict = {}
p1 = re.compile(r'^(?P<vrf>[\w\d]+)+\s+(?P<default_rd>[\d\:\d]+)+\s+(?P<protocols>[\w\,\w]+)\s+\s\s(?P<interface>[\w\d]+)*$')
p1 = re.compile(r'^(?P<vrf>[\S]+)+\s+(?P<default_rd>[\d\:\d]+)+\s+(?P<protocols>[\w\,\w]+)\s+\s\s(?P<interface>[\w\d]+)*$')
for line in output.splitlines():
line = line.strip()
# vrf21 21:1 ipv4,ipv6 Vl21'''
Expand Down Expand Up @@ -648,7 +648,7 @@ def cli(self, protocol, ip, option, mask, output=None):
output = self.device.execute(self.cli_command.format(protocol=protocol, option=option, ip=ip,mask=mask))

# VRF Default
p1 = re.compile(r'^VRF\s+(?P<vrf_name>[\w\s\-]+)$')
p1 = re.compile(r'^VRF\s+(?P<vrf_name>[\S]+)$')

# ------------------ show ip route vrf Default 11.1.6.1 255.255.255.0 ------------------
# ------------------ show ip cef vrf vrf1000 11.1.6.1 255.255.255.0 internal ------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
expected_output = {
"vrf": {
"t!#$%()*+@^:t/<>,.~`'\";t": {
"protocols": ["ipv4", "ipv6"],
"route_distinguisher": "1:1"
},
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Name Default RD Protocols Interfaces
t!#$%()*+@^:t/<>,.~`'";t 1:1 ipv4,ipv6