diff --git a/changelog/undistributed/changelog_show_object-group_name_iosxe_20240922151843.rst b/changelog/undistributed/changelog_show_object-group_name_iosxe_20240922151843.rst new file mode 100644 index 0000000000..e0e05ce373 --- /dev/null +++ b/changelog/undistributed/changelog_show_object-group_name_iosxe_20240922151843.rst @@ -0,0 +1,9 @@ +-------------------------------------------------------------------------------- + Fix +-------------------------------------------------------------------------------- +* + * 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. \ No newline at end of file diff --git a/src/genie/libs/parser/iosxe/show_acl.py b/src/genie/libs/parser/iosxe/show_acl.py index 49bbf5f615..269230f092 100755 --- a/src/genie/libs/parser/iosxe/show_acl.py +++ b/src/genie/libs/parser/iosxe/show_acl.py @@ -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) } } } @@ -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 @@ -954,7 +956,14 @@ def cli(self, group_name, output=None): p2 = re.compile(r'^(?P\S+)$') # host 2040:1::3 - p3 = re.compile(r'^host\s+(?P
[\w\:]+)$') + # host 10.10.10.10 + p3 = re.compile(r'^host\s+(?P
[\w\:\.]+)$') + + # 10.10.10.10 255.255.255.0 + p4 = re.compile(r'^(?P\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\d{1,3}(?:\.\d{1,3}){3}\s+\d{1,3}(?:\.\d{1,3}){3})$') for line in out.splitlines(): line = line.strip() @@ -979,6 +988,7 @@ 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() @@ -986,4 +996,19 @@ def cli(self, group_name, output=None): 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 \ No newline at end of file