From 7ddac97669cf1f337a66c3c718df932af03cfaf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bing=20Preisler=20B=C3=B8nl=C3=B8kke?= <“bpb@au.dk”> Date: Fri, 26 Apr 2024 12:03:00 +0200 Subject: [PATCH] Fix regex and both for import and export route-targets NXOS --- ...unning-config_vrf_{vrf}_|_sec_'^vrf'_20240426102247.rst | 7 +++++++ src/genie/libs/parser/nxos/show_vrf.py | 7 +++++-- 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 changelog/undistributed/changelog_show_running-config_vrf_{vrf}_|_sec_'^vrf'_20240426102247.rst diff --git a/changelog/undistributed/changelog_show_running-config_vrf_{vrf}_|_sec_'^vrf'_20240426102247.rst b/changelog/undistributed/changelog_show_running-config_vrf_{vrf}_|_sec_'^vrf'_20240426102247.rst new file mode 100644 index 0000000000..cc9f2cf27e --- /dev/null +++ b/changelog/undistributed/changelog_show_running-config_vrf_{vrf}_|_sec_'^vrf'_20240426102247.rst @@ -0,0 +1,7 @@ +-------------------------------------------------------------------------------- + Fix +-------------------------------------------------------------------------------- +* NXOS + * Modified ShowRunningConfigVrf: + * Updated regex pattern to include : match for route-target + * Updated so 'both' is used when route-target is imported and exported. (Already done the same way for IOS XE 'show vrf detail') \ No newline at end of file diff --git a/src/genie/libs/parser/nxos/show_vrf.py b/src/genie/libs/parser/nxos/show_vrf.py index 444df1d7e0..2fe003178b 100755 --- a/src/genie/libs/parser/nxos/show_vrf.py +++ b/src/genie/libs/parser/nxos/show_vrf.py @@ -292,7 +292,7 @@ def cli(self, vrf=None): # route-target both auto # route-target both auto mvpn # route-target both auto evpn - p5 = re.compile(r'^\s*route-target +(?P\w+) +(?P\w+)( +(?P\w+))?$') + p5 = re.compile(r'^\s*route-target +(?P\w+) +(?P\w+:\w+)( +(?P\w+))?$') # find all list of vrfs if vrf: @@ -341,7 +341,10 @@ def cli(self, vrf=None): rt = m.groupdict()['rt'] rt_type = m.groupdict()['rt_type'] route_target_dict = af_dict.setdefault('route_target', {}).setdefault(rt, {}) - route_target_dict.update({'rt_type': m.groupdict()['rt_type']}) + if 'rt_type' in route_target_dict: + route_target_dict.update({'rt_type': 'both'}) + else: + route_target_dict.update({'rt_type': rt_type}) if m.groupdict()['rt_evpn_mvpn']: if 'evpn' in m.groupdict()['rt_evpn_mvpn']: