From eb99106cc6dd2a7fcc9fbf436f0ff4012433fc8d Mon Sep 17 00:00:00 2001 From: vkoulermos Date: Fri, 18 Feb 2022 14:30:29 +0200 Subject: [PATCH 1/9] Adding support for confederations in AS PATH for 'show bgp' IOS-XR parser --- src/genie/libs/parser/iosxr/show_bgp.py | 54 ++++++++++++------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/genie/libs/parser/iosxr/show_bgp.py b/src/genie/libs/parser/iosxr/show_bgp.py index 6f8f48c401..eef4c6025d 100644 --- a/src/genie/libs/parser/iosxr/show_bgp.py +++ b/src/genie/libs/parser/iosxr/show_bgp.py @@ -3624,9 +3624,9 @@ def cli(self, vrf_type='all', neighbor='', vrf='all', instance='all', address_fa '(\(default +for +vrf +(?P[a-zA-Z0-9]+)\))?$') p13 = re.compile(r'^(?P(i|s|x|S|d|h|\*|\>|\s)+)? *' '(?P(?P[\w\.\:\/\[\]]+)\/(?P\d+))?( +' - '(?P[\w\.\:]+) *(?P[\d\.\s\{\}]+)?' + '(?P[\w\.\:]+) *(?P[()\d\.\s\{\}]+)?' '(?: *(?P(i|e|\?)))?)?$') - p13_1 = re.compile(r'(?P[\d\.\s]+)' + p13_1 = re.compile(r'(?P[()\d\.\s]+)' ' *(?P(i|e|\?))?$') p14 = re.compile(r'^Processed *(?P[0-9]+) *' @@ -3997,7 +3997,7 @@ def cli(self, vrf_type='all', neighbor='', vrf='all', instance='all', address_fa m1 = re.compile(r'^(?P[0-9]+) +' '(?P[0-9]+) +' '(?P[0-9]+) ' - '(?P[0-9\.\{\}\s]+)$').match(group_num) + '(?P[()0-9\.\{\}\s]+)$').match(group_num) # metric locprf weight path # 2219 0 200 33299 51178 47751 {27016} @@ -4007,12 +4007,12 @@ def cli(self, vrf_type='all', neighbor='', vrf='all', instance='all', address_fa m2 = re.compile(r'^(?P[0-9]+)' '(?P\s{2,20})' '(?P[0-9]+) ' - '(?P[0-9\.\{\}\s]+)$').match(group_num) + '(?P[()0-9\.\{\}\s]+)$').match(group_num) # weight path # 0 200 33299 51178 47751 {27016} 65000.65000 m3 = re.compile(r'^(?P[0-9]+) ' - '(?P(([\d\.]+\s)|(\{[\d\.]+\}\s))+)$')\ + '(?P(([()\d\.]+\s)|(\{[\d\.]+\}\s))+)$')\ .match(group_num) if m1: @@ -4186,8 +4186,8 @@ def cli(self, vrf_type='all', neighbor='', vrf='all', instance='all', address_fa p4 = re.compile( r'^(?P(?P[\w\.\:]+)/(?P\d+)) *(?P[\w\.\:]+) *(' r'?P[\w\.\:]+) *' - r'(?P[\d\.\{\}\s]+)?(?P[e|i\?])?$') - p5_1 = re.compile(r'(?P[\d\.\{\}\s]+)(?Pe|i)?$') + r'(?P[()\d\.\{\}\s]+)?(?P[e|i\?])?$') + p5_1 = re.compile(r'(?P[()\d\.\{\}\s]+)(?Pe|i)?$') p6 = re.compile( r'^Processed *(?P[0-9]+) *prefixes, *(?P[0-9]+) *paths$') @@ -5080,7 +5080,7 @@ def cli(self, vrf_type='all', address_family='', instance='all', vrf='all', outp # 2219 0 200 33299 51178 47751 {27016} e # 2219 0 200 33299 51178 47751 {27016} 65107.65107 e p16_2 = re.compile(r'^\s*(?P[0-9]+) +(?P[0-9]+)' - r' +(?P[0-9\.\{\}\s]+) ' + r' +(?P[()0-9\.\{\}\s]+) ' r'+(?P(i|e|\?))$') # Network Next Hop Metric LocPrf Weight Path @@ -5099,11 +5099,11 @@ def cli(self, vrf_type='all', address_family='', instance='all', vrf='all', outp # *> 10.7.7.7/32 10.10.10.107 0 0 65107.65107 ? p16 = re.compile(r'^(?P(i|s|x|S|d|h|\*|\>|\s)+)' r' *(?P(?P[0-9\.\:\[\]]+)\/(?P\d+))?' - r' +(?P\S+) +(?P[\d\.\s\{\}]+)' + r' +(?P\S+) +(?P[()\d\.\s\{\}]+)' r'(?: *(?P(i|e|\?)))?$') # 65107.65107 ? - p17 = re.compile(r'(?P[\d\.\s]+)' + p17 = re.compile(r'(?P[()\d\.\s]+)' r' *(?P(i|e|\?))?$') # Processed 40 prefixes, 50 paths @@ -5330,9 +5330,9 @@ def cli(self, vrf_type='all', address_family='', instance='all', vrf='all', outp # Parse and set the numbers group_num = group['number'] - m1 = re.compile(r'^(?P[0-9]+) +(?P[0-9]+) +(?P[0-9]+) (?P[0-9\.\{\}\s]+)$').match(group_num) - m2 = re.compile(r'^(?P[0-9]+)(?P\s{2,20})(?P[0-9]+) (?P[0-9\.\{\}\s]+)$').match(group_num) - m3 = re.compile(r'^(?P[0-9]+) (?P(([\d\.]+\s)|(\{[\d\.]+\}\s))+)$').match(group_num) + m1 = re.compile(r'^(?P[0-9]+) +(?P[0-9]+) +(?P[0-9]+) (?P[()0-9\.\{\}\s]+)$').match(group_num) + m2 = re.compile(r'^(?P[0-9]+)(?P\s{2,20})(?P[0-9]+) (?P[()0-9\.\{\}\s]+)$').match(group_num) + m3 = re.compile(r'^(?P[0-9]+) (?P(([()\d\.]+\s)|(\{[\d\.]+\}\s))+)$').match(group_num) m4 = re.compile(r'^(?P(\d+)) +(?P(\d+))$').match(group_num.strip()) if m1: pfx_dict['metric'] = m1.groupdict()['metric'] @@ -5738,7 +5738,7 @@ def cli(self, output=None): '(i|e|c|l|a|r|I))(?P[\w\.\/]+) ' '+(?P[\w\.\/]+) +' '(?P\d+) +(?P\d+) ' - '+(?P\d+) +(?P[\d ]+) +' + '+(?P\d+) +(?P[()\d ]+) +' '(?P(i|e|\?|\||&))$') p3_1_2 = re.compile(r'^\s*(?P(s|x|S|d|h|\*|\>|\s)+)' ' (?P(i|e|c|l|a|r|I)) ' @@ -5792,7 +5792,7 @@ def cli(self, output=None): p13 = re.compile(r'^\s*BGP *scan *interval *(?P[0-9\s]+) *secs$') p14 = re.compile(r'^(?P(s|x|S|d|h|\*|\>|\s)+)' '(?P(i|e|c|l|a|r|I))? *(?P[\w\.\/\[\]\,]+)$') - p15 = re.compile(r'^(?P[\w\.\:]+) *(?P[\d\s\{\}]+)?' + p15 = re.compile(r'^(?P[\w\.\:]+) *(?P[()\d\s\{\}]+)?' '(?: *(?P(i|e|\?)))$') p16 = re.compile(r'^\s*Processed +(?P[0-9]+) +prefixes, +' '(?P[0-9]+) +paths$') @@ -5994,7 +5994,7 @@ def cli(self, output=None): '(?P[0-9]+)' '(?P\s{5,10})' '(?P[0-9]+)' - '(?: *(?P[0-9\{\}\s]+))?$').match(numbers) + '(?: *(?P[()0-9\{\}\s]+))?$').match(numbers) # 100 --- 0 10 20 30 40 50 60 70 80 90 # --- 100 0 10 20 30 40 50 60 70 80 90 @@ -6003,11 +6003,11 @@ def cli(self, output=None): m2 = re.compile(r'^(?P[0-9]+)' '(?P\s{2,21})' '(?P[0-9]+)' - '(?: *(?P[0-9\{\}\s]+))?$').match(numbers) + '(?: *(?P[()0-9\{\}\s]+))?$').match(numbers) # --- --- 32788 200 33299 51178 47751 {27016} m3 = re.compile(r'^(?P[0-9]+)' - ' +(?P[0-9\{\}\s]+)$').match(numbers) + ' +(?P[()0-9\{\}\s]+)$').match(numbers) if m1: index_dict.update({'metric': int(m1.groupdict()['metric'])}) @@ -6044,7 +6044,7 @@ def cli(self, output=None): '(?P[0-9]+)' '(?P\s{5,10})' '(?P[0-9]+)' - '(?: *(?P[0-9\{\}\s]+))?$').match(numbers) + '(?: *(?P[()0-9\{\}\s]+))?$').match(numbers) # 100 --- 0 10 20 30 40 50 60 70 80 90 # --- 100 0 10 20 30 40 50 60 70 80 90 @@ -6053,11 +6053,11 @@ def cli(self, output=None): m2 = re.compile(r'^(?P[0-9]+)' '(?P\s{2,21})' '(?P[0-9]+)' - '(?: *(?P[0-9\{\}\s]+))?$').match(numbers) + '(?: *(?P[()0-9\{\}\s]+))?$').match(numbers) # --- --- 32788 200 33299 51178 47751 {27016} m3 = re.compile(r'^(?P[0-9]+)' - ' +(?P[0-9\{\}\s]+)$').match(numbers) + ' +(?P[()0-9\{\}\s]+)$').match(numbers) if m1: index_dict.update({'metric': int(m1.groupdict()['metric'])}) @@ -6156,7 +6156,7 @@ def cli(self, output=None): '(?P[0-9]+)' '(?P\s{5,10})' '(?P[0-9]+)' - '(?: *(?P[0-9\{\}\s]+))?$').match(numbers) + '(?: *(?P[()0-9\{\}\s]+))?$').match(numbers) # 100 --- 0 10 20 30 40 50 60 70 80 90 # --- 100 0 10 20 30 40 50 60 70 80 90 @@ -6165,11 +6165,11 @@ def cli(self, output=None): m2 = re.compile(r'^(?P[0-9]+)' '(?P\s{2,21})' '(?P[0-9]+)' - '(?: *(?P[0-9\{\}\s]+))?$').match(numbers) + '(?: *(?P[()0-9\{\}\s]+))?$').match(numbers) # --- --- 32788 200 33299 51178 47751 {27016} m3 = re.compile(r'^(?P[0-9]+)' - ' +(?P[0-9\{\}\s]+)$').match(numbers) + ' +(?P[()0-9\{\}\s]+)$').match(numbers) if m1: index_dict.update({'metric': int(m1.groupdict()['metric'])}) @@ -6330,7 +6330,7 @@ def cli(self, output=None): m1 = re.compile(r'^(?P[0-9]+) +' '(?P[0-9]+) +' '(?P[0-9]+) ' - '(?P[0-9\{\}\s]+)$').match(group_num) + '(?P[()0-9\{\}\s]+)$').match(group_num) # metric locprf weight path # 2219 0 200 33299 51178 47751 {27016} @@ -6340,12 +6340,12 @@ def cli(self, output=None): m2 = re.compile(r'^(?P[0-9]+)' '(?P\s{2,20})' '(?P[0-9]+) ' - '(?P[0-9\{\}\s]+)$').match(group_num) + '(?P[()0-9\{\}\s]+)$').match(group_num) # weight path # 0 200 33299 51178 47751 {27016} m3 = re.compile(r'^(?P[0-9]+) ' - '(?P((\d+\s)|(\{\d+\}\s))+)$')\ + '(?P(([()\d]+\s)|(\{\d+\}\s))+)$')\ .match(group_num) if m1: From e185fe8ff44c5d494d207e80981fddd415d8f953 Mon Sep 17 00:00:00 2001 From: vkoulermos Date: Fri, 18 Feb 2022 17:35:49 +0200 Subject: [PATCH 2/9] add changelog --- .../changelog_show_bgp_iosxr_20220218145506.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 changelog/undistributed/changelog_show_bgp_iosxr_20220218145506.rst diff --git a/changelog/undistributed/changelog_show_bgp_iosxr_20220218145506.rst b/changelog/undistributed/changelog_show_bgp_iosxr_20220218145506.rst new file mode 100644 index 0000000000..8f19d3dc4a --- /dev/null +++ b/changelog/undistributed/changelog_show_bgp_iosxr_20220218145506.rst @@ -0,0 +1,16 @@ +* IOS-XR + * Modified ShowBgpInstanceNeighborsReceivedRoutes: + * Updated regex pattern and to accommodate for BGP confederations in AS_PATH. + * Updated regex pattern , and to accommodate for BGP confederations in AS_PATH. + * Modified ShowBgpInstanceNeighborsAdvertisedRoutes: + * Updated regex pattern and to accommodate for BGP confederations in AS_PATH. + * Modified ShowBgpInstanceAllAll: + * Updated regex pattern , and to accommodate for BGP confederations in AS_PATH. + * Updated regex pattern , and to accommodate for BGP confederations in AS_PATH. + * Modified ShowBgpL2vpnEvpn: + * Updated regex pattern and to accommodate for BGP confederations in AS_PATH. + * Updated regex pattern , and to accommodate for BGP confederations in AS_PATH. + * Updated regex pattern , and to accommodate for BGP confederations in AS_PATH. + * Updated regex pattern , and to accommodate for BGP confederations in AS_PATH. + * Updated regex pattern , and to accommodate for BGP confederations in AS_PATH. + From a224a2a8c7ec490a101e90de0d715de19ee7c7e8 Mon Sep 17 00:00:00 2001 From: vkoulermos Date: Sat, 19 Feb 2022 13:56:05 +0200 Subject: [PATCH 3/9] ShowBgpInstanceAllAll: Added golden output files. And fixed p16 not matching ipv6 --- src/genie/libs/parser/iosxr/show_bgp.py | 2 +- .../cli/equal/golden_output6_expected.py | 105 +++++++++++++++++- .../cli/equal/golden_output6_output.txt | 13 ++- 3 files changed, 113 insertions(+), 7 deletions(-) diff --git a/src/genie/libs/parser/iosxr/show_bgp.py b/src/genie/libs/parser/iosxr/show_bgp.py index eef4c6025d..6df850ffb8 100644 --- a/src/genie/libs/parser/iosxr/show_bgp.py +++ b/src/genie/libs/parser/iosxr/show_bgp.py @@ -5098,7 +5098,7 @@ def cli(self, vrf_type='all', address_family='', instance='all', vrf='all', outp # *>i192.168.111.0/24 10.189.99.98 0 0 i # *> 10.7.7.7/32 10.10.10.107 0 0 65107.65107 ? p16 = re.compile(r'^(?P(i|s|x|S|d|h|\*|\>|\s)+)' - r' *(?P(?P[0-9\.\:\[\]]+)\/(?P\d+))?' + r' *(?P(?P[a-z0-9\.\:\[\]]+)\/(?P\d+))?' r' +(?P\S+) +(?P[()\d\.\s\{\}]+)' r'(?: *(?P(i|e|\?)))?$') diff --git a/src/genie/libs/parser/iosxr/tests/ShowBgpInstanceAllAll/cli/equal/golden_output6_expected.py b/src/genie/libs/parser/iosxr/tests/ShowBgpInstanceAllAll/cli/equal/golden_output6_expected.py index d309dd34e7..ea3af1e741 100644 --- a/src/genie/libs/parser/iosxr/tests/ShowBgpInstanceAllAll/cli/equal/golden_output6_expected.py +++ b/src/genie/libs/parser/iosxr/tests/ShowBgpInstanceAllAll/cli/equal/golden_output6_expected.py @@ -74,10 +74,52 @@ "weight": "0" } } + }, + "80.244.17.144/29": { + "index": { + 1: { + "metric": "120", + "locprf": "100", + "next_hop": "80.244.17.126", + "origin_codes": "?", + "path": "(64622)", + "status_codes": "*>", + "weight": "0" + }, + 2: { + "metric": "100", + "locprf": "100", + "next_hop": "213.140.196.36", + "origin_codes": "?", + "path": "(64630 64615 64622)", + "status_codes": "*", + "weight": "0" + } + } + }, + "80.244.96.160/27": { + "index": { + 1: { + "locprf": "100", + "next_hop": "213.140.196.20", + "origin_codes": "?", + "path": "(64630 64609) 6762 4445 3209 21334", + "status_codes": "*>", + "weight": "0" + }, + 2: { + "locprf": "100", + "next_hop": "213.140.196.20", + "origin_codes": "?", + "path": "(64629 64601 64630 64609) 6762 4445 3209 21334", + "status_codes": "*", + "weight": "0" + } + } } }, - "processed_paths": 6, - "processed_prefix": 4, + "processed_paths": 10, + "processed_prefix": 6, "rd_version": 16, "router_identifier": "10.10.10.108", "scan_interval": 60, @@ -161,10 +203,65 @@ "weight": "32768" } } + }, + "2400:cb00:203::/48": { + "index": { + 1: { + "locprf": "120", + "next_hop": "2a02:540:5::1", + "origin_codes": "i", + "path": "(64605 64628 64630) 13335", + "status_codes": "*", + "weight": "0" + }, + 2: { + "locprf": "120", + "next_hop": "2a02:540:13::1", + "origin_codes": "i", + "path": "(64630) 13335", + "status_codes": "*>", + "weight": "500" + } + } + }, + "2a02:540::/32": { + "index": { + 1: { + "metric": "0", + "locprf": "120", + "next_hop": "2a02:540:13::1", + "origin_codes": "i", + "path": "(64630)", + "status_codes": "*>", + "weight": "500" + } + } + }, + "2a0c:5cc0::/29": { + "index": { + 1: { + "metric": "0", + "locprf": "120", + "next_hop": "2a02:540:5::1", + "origin_codes": "i", + "path": "(64605 64628 64603) 197648", + "status_codes": "*", + "weight": "0" + }, + 2: { + "metric": "0", + "locprf": "120", + "next_hop": "2a02:540:13::1", + "origin_codes": "i", + "path": "(64630 64601 64629 64628 64603) 197648", + "status_codes": "*>", + "weight": "500" + } + } } }, - "processed_paths": 7, - "processed_prefix": 6, + "processed_paths": 12, + "processed_prefix": 9, "rd_version": 15, "router_identifier": "10.10.10.108", "scan_interval": 60, diff --git a/src/genie/libs/parser/iosxr/tests/ShowBgpInstanceAllAll/cli/equal/golden_output6_output.txt b/src/genie/libs/parser/iosxr/tests/ShowBgpInstanceAllAll/cli/equal/golden_output6_output.txt index da45a20961..256c1e7b27 100644 --- a/src/genie/libs/parser/iosxr/tests/ShowBgpInstanceAllAll/cli/equal/golden_output6_output.txt +++ b/src/genie/libs/parser/iosxr/tests/ShowBgpInstanceAllAll/cli/equal/golden_output6_output.txt @@ -24,8 +24,12 @@ Origin codes: i - IGP, e - EGP, ? - incomplete * 10.10.10.107 0 0 65107.65107 ? *> 192.168.52.0/24 0.0.0.0 0 32768 ? * 10.10.10.107 0 0 65107.65107 ? +*> 80.244.17.144/29 80.244.17.126 120 100 0 (64622) ? +* 213.140.196.36 100 100 0 (64630 64615 64622) ? +*> 80.244.96.160/27 213.140.196.20 100 0 (64630 64609) 6762 4445 3209 21334 ? +* 213.140.196.20 100 0 (64629 64601 64630 64609) 6762 4445 3209 21334 ? -Processed 4 prefixes, 6 paths +Processed 6 prefixes, 10 paths Address Family: IPv6 Unicast ---------------------------- @@ -58,5 +62,10 @@ Origin codes: i - IGP, e - EGP, ? - incomplete 0 0 65107.65107 ? *> 2001:2001:2001:2001:2001::7/128 :: 0 32768 ? +* 2400:cb00:203::/48 2a02:540:5::1 120 0 (64605 64628 64630) 13335 i +*> 2a02:540:13::1 120 500 (64630) 13335 i +*> 2a02:540::/32 2a02:540:13::1 0 120 500 (64630) i +* 2a0c:5cc0::/29 2a02:540:5::1 0 120 0 (64605 64628 64603) 197648 i +*> 2a02:540:13::1 0 120 500 (64630 64601 64629 64628 64603) 197648 i -Processed 6 prefixes, 7 paths \ No newline at end of file +Processed 9 prefixes, 12 paths \ No newline at end of file From 2570f4b00ac5026b6f90b00ee66e14e4bbed3721 Mon Sep 17 00:00:00 2001 From: vkoulermos Date: Sat, 19 Feb 2022 14:25:35 +0200 Subject: [PATCH 4/9] Reverted ShowBgpL2vpnEvpn changes. --- ...hangelog_show_bgp_iosxr_20220218145506.rst | 6 ---- src/genie/libs/parser/iosxr/show_bgp.py | 28 +++++++++---------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/changelog/undistributed/changelog_show_bgp_iosxr_20220218145506.rst b/changelog/undistributed/changelog_show_bgp_iosxr_20220218145506.rst index 8f19d3dc4a..f18379adcb 100644 --- a/changelog/undistributed/changelog_show_bgp_iosxr_20220218145506.rst +++ b/changelog/undistributed/changelog_show_bgp_iosxr_20220218145506.rst @@ -7,10 +7,4 @@ * Modified ShowBgpInstanceAllAll: * Updated regex pattern , and to accommodate for BGP confederations in AS_PATH. * Updated regex pattern , and to accommodate for BGP confederations in AS_PATH. - * Modified ShowBgpL2vpnEvpn: - * Updated regex pattern and to accommodate for BGP confederations in AS_PATH. - * Updated regex pattern , and to accommodate for BGP confederations in AS_PATH. - * Updated regex pattern , and to accommodate for BGP confederations in AS_PATH. - * Updated regex pattern , and to accommodate for BGP confederations in AS_PATH. - * Updated regex pattern , and to accommodate for BGP confederations in AS_PATH. diff --git a/src/genie/libs/parser/iosxr/show_bgp.py b/src/genie/libs/parser/iosxr/show_bgp.py index 6df850ffb8..c10b4c0013 100644 --- a/src/genie/libs/parser/iosxr/show_bgp.py +++ b/src/genie/libs/parser/iosxr/show_bgp.py @@ -5738,7 +5738,7 @@ def cli(self, output=None): '(i|e|c|l|a|r|I))(?P[\w\.\/]+) ' '+(?P[\w\.\/]+) +' '(?P\d+) +(?P\d+) ' - '+(?P\d+) +(?P[()\d ]+) +' + '+(?P\d+) +(?P[\d ]+) +' '(?P(i|e|\?|\||&))$') p3_1_2 = re.compile(r'^\s*(?P(s|x|S|d|h|\*|\>|\s)+)' ' (?P(i|e|c|l|a|r|I)) ' @@ -5792,7 +5792,7 @@ def cli(self, output=None): p13 = re.compile(r'^\s*BGP *scan *interval *(?P[0-9\s]+) *secs$') p14 = re.compile(r'^(?P(s|x|S|d|h|\*|\>|\s)+)' '(?P(i|e|c|l|a|r|I))? *(?P[\w\.\/\[\]\,]+)$') - p15 = re.compile(r'^(?P[\w\.\:]+) *(?P[()\d\s\{\}]+)?' + p15 = re.compile(r'^(?P[\w\.\:]+) *(?P[\d\s\{\}]+)?' '(?: *(?P(i|e|\?)))$') p16 = re.compile(r'^\s*Processed +(?P[0-9]+) +prefixes, +' '(?P[0-9]+) +paths$') @@ -5994,7 +5994,7 @@ def cli(self, output=None): '(?P[0-9]+)' '(?P\s{5,10})' '(?P[0-9]+)' - '(?: *(?P[()0-9\{\}\s]+))?$').match(numbers) + '(?: *(?P[0-9\{\}\s]+))?$').match(numbers) # 100 --- 0 10 20 30 40 50 60 70 80 90 # --- 100 0 10 20 30 40 50 60 70 80 90 @@ -6003,11 +6003,11 @@ def cli(self, output=None): m2 = re.compile(r'^(?P[0-9]+)' '(?P\s{2,21})' '(?P[0-9]+)' - '(?: *(?P[()0-9\{\}\s]+))?$').match(numbers) + '(?: *(?P[0-9\{\}\s]+))?$').match(numbers) # --- --- 32788 200 33299 51178 47751 {27016} m3 = re.compile(r'^(?P[0-9]+)' - ' +(?P[()0-9\{\}\s]+)$').match(numbers) + ' +(?P[0-9\{\}\s]+)$').match(numbers) if m1: index_dict.update({'metric': int(m1.groupdict()['metric'])}) @@ -6044,7 +6044,7 @@ def cli(self, output=None): '(?P[0-9]+)' '(?P\s{5,10})' '(?P[0-9]+)' - '(?: *(?P[()0-9\{\}\s]+))?$').match(numbers) + '(?: *(?P[0-9\{\}\s]+))?$').match(numbers) # 100 --- 0 10 20 30 40 50 60 70 80 90 # --- 100 0 10 20 30 40 50 60 70 80 90 @@ -6053,11 +6053,11 @@ def cli(self, output=None): m2 = re.compile(r'^(?P[0-9]+)' '(?P\s{2,21})' '(?P[0-9]+)' - '(?: *(?P[()0-9\{\}\s]+))?$').match(numbers) + '(?: *(?P[0-9\{\}\s]+))?$').match(numbers) # --- --- 32788 200 33299 51178 47751 {27016} m3 = re.compile(r'^(?P[0-9]+)' - ' +(?P[()0-9\{\}\s]+)$').match(numbers) + ' +(?P[0-9\{\}\s]+)$').match(numbers) if m1: index_dict.update({'metric': int(m1.groupdict()['metric'])}) @@ -6156,7 +6156,7 @@ def cli(self, output=None): '(?P[0-9]+)' '(?P\s{5,10})' '(?P[0-9]+)' - '(?: *(?P[()0-9\{\}\s]+))?$').match(numbers) + '(?: *(?P[0-9\{\}\s]+))?$').match(numbers) # 100 --- 0 10 20 30 40 50 60 70 80 90 # --- 100 0 10 20 30 40 50 60 70 80 90 @@ -6165,11 +6165,11 @@ def cli(self, output=None): m2 = re.compile(r'^(?P[0-9]+)' '(?P\s{2,21})' '(?P[0-9]+)' - '(?: *(?P[()0-9\{\}\s]+))?$').match(numbers) + '(?: *(?P[0-9\{\}\s]+))?$').match(numbers) # --- --- 32788 200 33299 51178 47751 {27016} m3 = re.compile(r'^(?P[0-9]+)' - ' +(?P[()0-9\{\}\s]+)$').match(numbers) + ' +(?P[0-9\{\}\s]+)$').match(numbers) if m1: index_dict.update({'metric': int(m1.groupdict()['metric'])}) @@ -6330,7 +6330,7 @@ def cli(self, output=None): m1 = re.compile(r'^(?P[0-9]+) +' '(?P[0-9]+) +' '(?P[0-9]+) ' - '(?P[()0-9\{\}\s]+)$').match(group_num) + '(?P[0-9\{\}\s]+)$').match(group_num) # metric locprf weight path # 2219 0 200 33299 51178 47751 {27016} @@ -6340,12 +6340,12 @@ def cli(self, output=None): m2 = re.compile(r'^(?P[0-9]+)' '(?P\s{2,20})' '(?P[0-9]+) ' - '(?P[()0-9\{\}\s]+)$').match(group_num) + '(?P[0-9\{\}\s]+)$').match(group_num) # weight path # 0 200 33299 51178 47751 {27016} m3 = re.compile(r'^(?P[0-9]+) ' - '(?P(([()\d]+\s)|(\{\d+\}\s))+)$')\ + '(?P(([\d]+\s)|(\{\d+\}\s))+)$')\ .match(group_num) if m1: From d5c8e238ec71ced22c949f877fa285c2cf51d576 Mon Sep 17 00:00:00 2001 From: vkoulermos Date: Sat, 19 Feb 2022 16:14:56 +0200 Subject: [PATCH 5/9] Added ShowBgpInstanceNeighborsRoutes golden outputs --- .../cli/equal/golden_output1_expected.py | 42 ++++++++++++++++++- .../cli/equal/golden_output1_output.txt | 5 ++- 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/src/genie/libs/parser/iosxr/tests/ShowBgpInstanceNeighborsRoutes/cli/equal/golden_output1_expected.py b/src/genie/libs/parser/iosxr/tests/ShowBgpInstanceNeighborsRoutes/cli/equal/golden_output1_expected.py index 86940462e8..551dc95203 100644 --- a/src/genie/libs/parser/iosxr/tests/ShowBgpInstanceNeighborsRoutes/cli/equal/golden_output1_expected.py +++ b/src/genie/libs/parser/iosxr/tests/ShowBgpInstanceNeighborsRoutes/cli/equal/golden_output1_expected.py @@ -11,8 +11,8 @@ "nsr_initial_init_ver_status": "reached", "nsr_initial_initsync_version": "3", "nsr_issu_sync_group_versions": "0/0", - "processed_paths": 3, - "processed_prefixes": 3, + "processed_paths": 6, + "processed_prefixes": 6, "rd_version": 8, "router_identifier": "10.10.10.108", "routes": { @@ -51,6 +51,44 @@ "weight": "0" } } + }, + "195.95.138.0/24": { + "index": { + 1: { + "locprf": "120", + "metric": "0", + "next_hop": "213.140.196.60", + "origin_codes": "i", + "path": "(64630 64601) 39935", + "status_codes": "*>", + "weight": "500" + } + } + }, + "212.31.118.0/23": { + "index": { + 1: { + "locprf": "120", + "next_hop": "213.140.196.60", + "origin_codes": "i", + "path": "(64630 64601) 50233", + "status_codes": "*>", + "weight": "500" + } + } + }, + "212.50.96.0/19": { + "index": { + 1: { + "locprf": "120", + "metric": "0", + "next_hop": "213.140.196.60", + "origin_codes": "i", + "path": "(64630)", + "status_codes": "*>", + "weight": "500" + } + } } }, "routing_table_version": 8, diff --git a/src/genie/libs/parser/iosxr/tests/ShowBgpInstanceNeighborsRoutes/cli/equal/golden_output1_output.txt b/src/genie/libs/parser/iosxr/tests/ShowBgpInstanceNeighborsRoutes/cli/equal/golden_output1_output.txt index 2ab6f27c87..a55c63b8f8 100644 --- a/src/genie/libs/parser/iosxr/tests/ShowBgpInstanceNeighborsRoutes/cli/equal/golden_output1_output.txt +++ b/src/genie/libs/parser/iosxr/tests/ShowBgpInstanceNeighborsRoutes/cli/equal/golden_output1_output.txt @@ -22,5 +22,8 @@ Origin codes: i - IGP, e - EGP, ? - incomplete *> 10.7.7.7/32 10.10.10.107 0 0 65107.65107 ? * 10.10.10.0/24 10.10.10.107 0 0 65107.65107 ? * 192.168.52.0/24 10.10.10.107 0 0 65107.65107 ? +*> 195.95.138.0/24 213.140.196.60 0 120 500 (64630 64601) 39935 i +*> 212.31.118.0/23 213.140.196.60 120 500 (64630 64601) 50233 i +*> 212.50.96.0/19 213.140.196.60 0 120 500 (64630) i -Processed 3 prefixes, 3 paths +Processed 6 prefixes, 6 paths From b116c51fd788141c4e75e270aa5f36aa0678bde5 Mon Sep 17 00:00:00 2001 From: vkoulermos Date: Sat, 19 Feb 2022 16:33:22 +0200 Subject: [PATCH 6/9] Added ShowBgpInstanceNeighborsAdvertisedRoutes golden outputs --- .../cli/equal/golden_output1_expected.py | 24 +++++++++++++++++-- .../cli/equal/golden_output1_output.txt | 4 +++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/genie/libs/parser/iosxr/tests/ShowBgpInstanceNeighborsAdvertisedRoutes/cli/equal/golden_output1_expected.py b/src/genie/libs/parser/iosxr/tests/ShowBgpInstanceNeighborsAdvertisedRoutes/cli/equal/golden_output1_expected.py index 8f013143bd..9160fd2533 100644 --- a/src/genie/libs/parser/iosxr/tests/ShowBgpInstanceNeighborsAdvertisedRoutes/cli/equal/golden_output1_expected.py +++ b/src/genie/libs/parser/iosxr/tests/ShowBgpInstanceNeighborsAdvertisedRoutes/cli/equal/golden_output1_expected.py @@ -35,10 +35,30 @@ "path": "65108.65108" } } + }, + "82.102.71.0/24": { + "index": { + 1: { + "froms": "193.22.30.151", + "next_hop": "213.140.196.25", + "origin_code": "i", + "path": "(64612) 8544" + } + } + }, + "82.102.72.0/24": { + "index": { + 1: { + "froms": "193.22.30.151", + "next_hop": "213.140.196.25", + "origin_code": "i", + "path": "(64612) 8544 30916" + } + } } }, - "processed_paths": "3", - "processed_prefixes": "3" + "processed_paths": "5", + "processed_prefixes": "5" } } } diff --git a/src/genie/libs/parser/iosxr/tests/ShowBgpInstanceNeighborsAdvertisedRoutes/cli/equal/golden_output1_output.txt b/src/genie/libs/parser/iosxr/tests/ShowBgpInstanceNeighborsAdvertisedRoutes/cli/equal/golden_output1_output.txt index 32dc5d27ea..e447929075 100644 --- a/src/genie/libs/parser/iosxr/tests/ShowBgpInstanceNeighborsAdvertisedRoutes/cli/equal/golden_output1_output.txt +++ b/src/genie/libs/parser/iosxr/tests/ShowBgpInstanceNeighborsAdvertisedRoutes/cli/equal/golden_output1_output.txt @@ -8,6 +8,8 @@ Network Next Hop From AS Path 10.8.8.8/32 10.10.10.108 Local 65108.65108? 10.10.10.0/24 10.10.10.108 Local 65108.65108? 192.168.52.0/24 10.10.10.108 Local 65108.65108? +82.102.71.0/24 213.140.196.25 193.22.30.151 (64612) 8544i +82.102.72.0/24 213.140.196.25 193.22.30.151 (64612) 8544 30916i -Processed 3 prefixes, 3 paths +Processed 5 prefixes, 5 paths From 810e572fa3a909d41ae7175be07dcb1cc06f19ad Mon Sep 17 00:00:00 2001 From: vkoulermos Date: Sat, 19 Feb 2022 17:20:57 +0200 Subject: [PATCH 7/9] Missed this during commit 2570f4b00ac5026b6f90b00ee66e14e4bbed3721 --- src/genie/libs/parser/iosxr/show_bgp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/genie/libs/parser/iosxr/show_bgp.py b/src/genie/libs/parser/iosxr/show_bgp.py index c10b4c0013..271fc936b0 100644 --- a/src/genie/libs/parser/iosxr/show_bgp.py +++ b/src/genie/libs/parser/iosxr/show_bgp.py @@ -6345,7 +6345,7 @@ def cli(self, output=None): # weight path # 0 200 33299 51178 47751 {27016} m3 = re.compile(r'^(?P[0-9]+) ' - '(?P(([\d]+\s)|(\{\d+\}\s))+)$')\ + '(?P((\d+\s)|(\{\d+\}\s))+)$')\ .match(group_num) if m1: From 465f9d385f970530347fc440f87ecfd874397111 Mon Sep 17 00:00:00 2001 From: Lukas McClelland Date: Fri, 11 Mar 2022 16:07:00 -0500 Subject: [PATCH 8/9] Update changelog_show_bgp_iosxr_20220218145506.rst --- .../undistributed/changelog_show_bgp_iosxr_20220218145506.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/changelog/undistributed/changelog_show_bgp_iosxr_20220218145506.rst b/changelog/undistributed/changelog_show_bgp_iosxr_20220218145506.rst index f18379adcb..08596495b6 100644 --- a/changelog/undistributed/changelog_show_bgp_iosxr_20220218145506.rst +++ b/changelog/undistributed/changelog_show_bgp_iosxr_20220218145506.rst @@ -1,3 +1,6 @@ +-------------------------------------------------------------------------------- + Fix +-------------------------------------------------------------------------------- * IOS-XR * Modified ShowBgpInstanceNeighborsReceivedRoutes: * Updated regex pattern and to accommodate for BGP confederations in AS_PATH. From 1ebacb67a223d00c6bc9cc864130c31d801d3027 Mon Sep 17 00:00:00 2001 From: vkoulermos Date: Sat, 12 Mar 2022 10:01:10 +0200 Subject: [PATCH 9/9] adding examples of device output --- src/genie/libs/parser/iosxr/show_bgp.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/genie/libs/parser/iosxr/show_bgp.py b/src/genie/libs/parser/iosxr/show_bgp.py index 1bcc3567b1..946c07fbd1 100644 --- a/src/genie/libs/parser/iosxr/show_bgp.py +++ b/src/genie/libs/parser/iosxr/show_bgp.py @@ -3994,6 +3994,8 @@ def cli(self, vrf_type='all', neighbor='', vrf='all', instance='all', address_fa if group_num: # metric locprf weight path # 2219 211 0 200 33299 51178 47751 {27016} + # 0 120 500 (64630 64601) 39935 + m1 = re.compile(r'^(?P[0-9]+) +' '(?P[0-9]+) +' '(?P[0-9]+) ' @@ -4003,6 +4005,7 @@ def cli(self, vrf_type='all', neighbor='', vrf='all', instance='all', address_fa # 2219 0 200 33299 51178 47751 {27016} # locprf weight path # 211 0 200 33299 51178 47751 {27016} 65000.65000 + # 100 0 (64630 64609) 6762 4445 3209 21334 m2 = re.compile(r'^(?P[0-9]+)' '(?P\s{2,20})' @@ -4011,6 +4014,7 @@ def cli(self, vrf_type='all', neighbor='', vrf='all', instance='all', address_fa # weight path # 0 200 33299 51178 47751 {27016} 65000.65000 + # 0 (64629 64601 64630 64609) 6762 4445 3209 21334 m3 = re.compile(r'^(?P[0-9]+) ' '(?P(([()\d\.]+\s)|(\{[\d\.]+\}\s))+)$')\ .match(group_num) @@ -5093,6 +5097,7 @@ def cli(self, vrf_type='all', address_family='', instance='all', vrf='all', outp # 2219 0 200 33299 51178 47751 {27016} e # 2219 0 200 33299 51178 47751 {27016} 65107.65107 e + # 0 500 (64630 64601) 39935 i p16_2 = re.compile(r'^\s*(?P[0-9]+) +(?P[0-9]+)' r' +(?P[()0-9\.\{\}\s]+) ' r'+(?P(i|e|\?))$') @@ -5111,6 +5116,7 @@ def cli(self, vrf_type='all', address_family='', instance='all', vrf='all', outp # *>i10.169.1.0/24 10.64.4.4 2219 100 0 300 33299 51178 47751 {27016} e # *>i192.168.111.0/24 10.189.99.98 0 0 i # *> 10.7.7.7/32 10.10.10.107 0 0 65107.65107 ? + # *> 195.95.138.0/24 213.140.196.60 0 120 500 (64630 64601) 39935 i p16 = re.compile(r'^(?P(i|s|x|S|d|h|\*|\>|\s)+)' r' *(?P(?P[a-z0-9\.\:\[\]]+)\/(?P\d+))?' r' +(?P\S+) +(?P[()\d\.\s\{\}]+)'