Skip to content
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
@@ -0,0 +1,9 @@
--------------------------------------------------------------------------------
Fix
--------------------------------------------------------------------------------
* <IOSXE>
* Modified ShowObjectGroupName:
* Updated regex pattern p3 to accomodate ipv4 as well as ipv6 addresses.
* Added regex pattern p4 to accomodate ipv4 network addresses.
* Added regex pattern p5 to accomodate ipv4 address ranges.
* Addedd network_address and range to the schema as Optional.
31 changes: 28 additions & 3 deletions src/genie/libs/parser/iosxe/show_acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,9 @@ class ShowObjectGroupNameSchema(MetaParser):
'object_group': {
Any(): {
Optional('host_address'): ListOf(str),
Optional('services'): ListOf(str)
Optional('services'): ListOf(str),
Optional('network_address'): ListOf(str),
Optional('range'): ListOf(str)
}
}
}
Expand All @@ -941,7 +943,7 @@ def cli(self, group_name, output=None):
else:
out = output

ret_dict = {}
ret_dict = {}

# V6-Network object group v6-net1
# V6-Service object group v6-serv1
Expand All @@ -954,7 +956,14 @@ def cli(self, group_name, output=None):
p2 = re.compile(r'^(?P<services>\S+)$')

# host 2040:1::3
p3 = re.compile(r'^host\s+(?P<address>[\w\:]+)$')
# host 10.10.10.10
p3 = re.compile(r'^host\s+(?P<address>[\w\:\.]+)$')

# 10.10.10.10 255.255.255.0
p4 = re.compile(r'^(?P<network>\d{1,3}(?:\.\d{1,3}){3}\s+\d{1,3}(?:\.\d{1,3}){3})$')

# range 10.10.10.10 10.10.10.11
p5 = re.compile(r'^range\s+(?P<range>\d{1,3}(?:\.\d{1,3}){3}\s+\d{1,3}(?:\.\d{1,3}){3})$')

for line in out.splitlines():
line = line.strip()
Expand All @@ -979,11 +988,27 @@ def cli(self, group_name, output=None):
continue

# host 2040:1::3
# host 10.10.10.10
m = p3.match(line)
if m:
group = m.groupdict()
host_dict = group_dict.setdefault('host_address', [])
host_dict.append(group['address'])
continue

# 10.10.10.10 255.255.255.0
m = p4.match(line)
if m:
group = m.groupdict()
host_dict = group_dict.setdefault('network_address', [])
host_dict.append(group['network'])
continue

# range 10.10.10.10 10.10.10.11
m = p5.match(line)
if m:
group = m.groupdict()
host_dict = group_dict.setdefault('range', [])
host_dict.append(group['range'])
continue
return ret_dict