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..08596495b6 --- /dev/null +++ b/changelog/undistributed/changelog_show_bgp_iosxr_20220218145506.rst @@ -0,0 +1,13 @@ +-------------------------------------------------------------------------------- + Fix +-------------------------------------------------------------------------------- +* 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. + diff --git a/src/genie/libs/parser/iosxr/show_bgp.py b/src/genie/libs/parser/iosxr/show_bgp.py index 651db8e6f6..66f05c6dd6 100644 --- a/src/genie/libs/parser/iosxr/show_bgp.py +++ b/src/genie/libs/parser/iosxr/show_bgp.py @@ -3746,11 +3746,11 @@ def cli(self, vrf_type='all', neighbor='', vrf='all', instance='all', address_fa p12 = re.compile(r'^Route +Distinguisher: *(?P\S+) *' r'(\(default +for +vrf +(?P[a-zA-Z0-9]+)\))?$') p13 = re.compile(r'^(?P(i|s|x|S|d|h|\*|\>|\s)+)? *' - r'(?P(?P[\w\.\:\/\[\]]+)\/(?P\d+))?( +' - r'(?P[\w\.\:]+) *(?P[\d\.\s\{\}]+)?' - r'(?: *(?P(i|e|\?)))?)?$') - p13_1 = re.compile(r'(?P[\d\.\s]+)' - r' *(?P(i|e|\?))?$') + '(?P(?P[\w\.\:\/\[\]]+)\/(?P\d+))?( +' + '(?P[\w\.\:]+) *(?P[()\d\.\s\{\}]+)?' + '(?: *(?P(i|e|\?)))?)?$') + p13_1 = re.compile(r'(?P[()\d\.\s]+)' + ' *(?P(i|e|\?))?$') p14 = re.compile(r'^Processed *(?P[0-9]+) *' r'prefixes, *(?P[0-9]+) *paths$') @@ -4117,25 +4117,29 @@ 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} - m1 = re.compile(r'^(?P[0-9]+) +' - r'(?P[0-9]+) +' - r'(?P[0-9]+) ' - r'(?P[0-9\.\{\}\s]+)$').match(group_num) + # 0 120 500 (64630 64601) 39935 + m1 = re.compile(r'^(?P[0-9]+) +' + '(?P[0-9]+) +' + '(?P[0-9]+) ' + '(?P[()0-9\.\{\}\s]+)$').match(group_num) + # metric locprf weight path # 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]+)' - r'(?P\s{2,20})' - r'(?P[0-9]+) ' - r'(?P[0-9\.\{\}\s]+)$').match(group_num) - + '(?P\s{2,20})' + '(?P[0-9]+) ' + '(?P[()0-9\.\{\}\s]+)$').match(group_num) + # 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]+) ' - r'(?P(([\d\.]+\s)|(\{[\d\.]+\}\s))+)$')\ + '(?P(([()\d\.]+\s)|(\{[\d\.]+\}\s))+)$')\ .match(group_num) if m1: @@ -4314,8 +4318,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$') @@ -5262,8 +5266,9 @@ 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[()0-9\.\{\}\s]+) ' r'+(?P(i|e|\?))$') # Network Next Hop Metric LocPrf Weight Path @@ -5280,13 +5285,14 @@ 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[0-9\.\:\[\]]+)\/(?P\d+))?' - r' +(?P\S+) +(?P[\d\.\s\{\}]+)' + r' *(?P(?P[a-z0-9\.\:\[\]]+)\/(?P\d+))?' + 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 @@ -5513,9 +5519,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'] 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 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 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