diff --git a/changelog/undistributed/changelog_show_bgp_vrf_all_all_summary_20251118.rst b/changelog/undistributed/changelog_show_bgp_vrf_all_all_summary_20251118.rst new file mode 100644 index 0000000000..4491409126 --- /dev/null +++ b/changelog/undistributed/changelog_show_bgp_vrf_all_all_summary_20251118.rst @@ -0,0 +1,6 @@ +-------------------------------------------------------------------------------- + Fix +-------------------------------------------------------------------------------- +* NXOS + * Modified ShowBgpVrfAllAllSummary: + * Handle cases where BGP neighbor information is spread over 3 lines diff --git a/src/genie/libs/parser/nxos/show_bgp_vrf.py b/src/genie/libs/parser/nxos/show_bgp_vrf.py index e640809799..c8f3400964 100644 --- a/src/genie/libs/parser/nxos/show_bgp_vrf.py +++ b/src/genie/libs/parser/nxos/show_bgp_vrf.py @@ -1959,6 +1959,12 @@ def cli(self, vrf='all', address_family='all', output=None): r' +(?P[0-9]+) +(?P[0-9]+)' r' +(?P[0-9]+) +(?P[a-zA-Z0-9\:]+)' r' +(?P(?P[a-zA-Z\s\(\)]+)?(?P\d+)?([\w\(\)\s]+)?)$') + #Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd + # 1670:92:e000:24:2000::3 + # 4 4110507001 + # 0 0 0 0 0 2w1d Active + p8_2a = re.compile(r'^\s*(?P[0-9]+) +(?P[0-9]+)$') + # Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd # 10.10.10.10 4 4211111111 p8_3 = re.compile(r'^\s*(?P[a-zA-Z0-9\.\:]+) +(?P[0-9]+) +(?P[0-9]+)$') @@ -2210,6 +2216,27 @@ def cli(self, vrf='all', address_family='all', output=None): nbr_af_dict['path']['memory_usage'] = memory_usage continue + # Neighbor information is spread over three lines: + #Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd + # 1670:92:e000:24:2000::3 + # 4 4110507001 + # 0 0 0 0 0 2w1d Active + m = p8_2a.match(line) + if m and data_on_nextline: + # Note that we are not clearing data_on_nextline, the 3rd + # line will be matched by the existing p8_4 logic and cleared there + # Add address family to this neighbor + if 'address_family' not in nbr_dict: + nbr_dict['address_family'] = {} + if address_family not in nbr_dict['address_family']: + nbr_dict['address_family'][address_family] = {} + nbr_af_dict = nbr_dict['address_family'][address_family] + + # Add keys for this address_family + nbr_af_dict['neighbor_table_version'] = int(m.groupdict()['v']) + nbr_af_dict['as'] = int(m.groupdict()['as']) + continue + # Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd # 10.10.10.10 4 4211111111 m = p8_3.match(line) diff --git a/src/genie/libs/parser/nxos/tests/ShowBgpVrfAllAllSummary/cli/equal/golden_output_6_expected.py b/src/genie/libs/parser/nxos/tests/ShowBgpVrfAllAllSummary/cli/equal/golden_output_6_expected.py new file mode 100644 index 0000000000..4af23c2c86 --- /dev/null +++ b/src/genie/libs/parser/nxos/tests/ShowBgpVrfAllAllSummary/cli/equal/golden_output_6_expected.py @@ -0,0 +1,618 @@ +expected_output = { + "vrf": { + "hgtref": { + "neighbor": { + "10.167.68.50": { + "address_family": { + "ipv4 unicast": { + "neighbor_table_version": 4, + "as": 65100, + "msg_rcvd": 52705, + "msg_sent": 44731, + "tbl_ver": 96073, + "inq": 0, + "outq": 0, + "up_down": "6d13h", + "state_pfxrcd": "4951", + "prefix_received": "4951", + "state": "established", + "route_identifier": "10.167.68.54", + "local_as": 65100, + "bgp_table_version": 96073, + "config_peers": 9, + "capable_peers": 9, + "attribute_entries": "[463/77784]", + "as_path_entries": "[283/8242]", + "community_entries": "[437/24892]", + "clusterlist_entries": "[0/0]", + "prefixes": { + "total_entries": 5312, + "memory_usage": 3839280 + }, + "path": { + "total_entries": 26682, + "memory_usage": 3839280 + } + } + } + }, + "10.167.68.51": { + "address_family": { + "ipv4 unicast": { + "neighbor_table_version": 4, + "as": 65100, + "msg_rcvd": 52681, + "msg_sent": 44731, + "tbl_ver": 96073, + "inq": 0, + "outq": 0, + "up_down": "6d12h", + "state_pfxrcd": "4951", + "prefix_received": "4951", + "state": "established", + "route_identifier": "10.167.68.54", + "local_as": 65100, + "bgp_table_version": 96073, + "config_peers": 9, + "capable_peers": 9, + "attribute_entries": "[463/77784]", + "as_path_entries": "[283/8242]", + "community_entries": "[437/24892]", + "clusterlist_entries": "[0/0]", + "prefixes": { + "total_entries": 5312, + "memory_usage": 3839280 + }, + "path": { + "total_entries": 26682, + "memory_usage": 3839280 + } + } + } + }, + "10.167.68.52": { + "address_family": { + "ipv4 unicast": { + "neighbor_table_version": 4, + "as": 65100, + "msg_rcvd": 54474, + "msg_sent": 44727, + "tbl_ver": 96073, + "inq": 0, + "outq": 0, + "up_down": "1w2d", + "state_pfxrcd": "4157", + "prefix_received": "4157", + "state": "established", + "route_identifier": "10.167.68.54", + "local_as": 65100, + "bgp_table_version": 96073, + "config_peers": 9, + "capable_peers": 9, + "attribute_entries": "[463/77784]", + "as_path_entries": "[283/8242]", + "community_entries": "[437/24892]", + "clusterlist_entries": "[0/0]", + "prefixes": { + "total_entries": 5312, + "memory_usage": 3839280 + }, + "path": { + "total_entries": 26682, + "memory_usage": 3839280 + } + } + } + }, + "10.167.68.53": { + "address_family": { + "ipv4 unicast": { + "neighbor_table_version": 4, + "as": 65100, + "msg_rcvd": 54518, + "msg_sent": 44726, + "tbl_ver": 96073, + "inq": 0, + "outq": 0, + "up_down": "1w2d", + "state_pfxrcd": "4157", + "prefix_received": "4157", + "state": "established", + "route_identifier": "10.167.68.54", + "local_as": 65100, + "bgp_table_version": 96073, + "config_peers": 9, + "capable_peers": 9, + "attribute_entries": "[463/77784]", + "as_path_entries": "[283/8242]", + "community_entries": "[437/24892]", + "clusterlist_entries": "[0/0]", + "prefixes": { + "total_entries": 5312, + "memory_usage": 3839280 + }, + "path": { + "total_entries": 26682, + "memory_usage": 3839280 + } + } + } + }, + "10.167.68.55": { + "address_family": { + "ipv4 unicast": { + "neighbor_table_version": 4, + "as": 65100, + "msg_rcvd": 44729, + "msg_sent": 44727, + "tbl_ver": 96073, + "inq": 0, + "outq": 0, + "up_down": "2w1d", + "state_pfxrcd": "2", + "prefix_received": "2", + "state": "established", + "route_identifier": "10.167.68.54", + "local_as": 65100, + "bgp_table_version": 96073, + "config_peers": 9, + "capable_peers": 9, + "attribute_entries": "[463/77784]", + "as_path_entries": "[283/8242]", + "community_entries": "[437/24892]", + "clusterlist_entries": "[0/0]", + "prefixes": { + "total_entries": 5312, + "memory_usage": 3839280 + }, + "path": { + "total_entries": 26682, + "memory_usage": 3839280 + } + } + } + }, + "10.167.68.56": { + "address_family": { + "ipv4 unicast": { + "neighbor_table_version": 4, + "as": 65100, + "msg_rcvd": 53129, + "msg_sent": 44731, + "tbl_ver": 96073, + "inq": 0, + "outq": 0, + "up_down": "1w1d", + "state_pfxrcd": "4230", + "prefix_received": "4230", + "state": "established", + "route_identifier": "10.167.68.54", + "local_as": 65100, + "bgp_table_version": 96073, + "config_peers": 9, + "capable_peers": 9, + "attribute_entries": "[463/77784]", + "as_path_entries": "[283/8242]", + "community_entries": "[437/24892]", + "clusterlist_entries": "[0/0]", + "prefixes": { + "total_entries": 5312, + "memory_usage": 3839280 + }, + "path": { + "total_entries": 26682, + "memory_usage": 3839280 + } + } + } + }, + "10.167.68.57": { + "address_family": { + "ipv4 unicast": { + "neighbor_table_version": 4, + "as": 65100, + "msg_rcvd": 53197, + "msg_sent": 44731, + "tbl_ver": 96073, + "inq": 0, + "outq": 0, + "up_down": "1w1d", + "state_pfxrcd": "4230", + "prefix_received": "4230", + "state": "established", + "route_identifier": "10.167.68.54", + "local_as": 65100, + "bgp_table_version": 96073, + "config_peers": 9, + "capable_peers": 9, + "attribute_entries": "[463/77784]", + "as_path_entries": "[283/8242]", + "community_entries": "[437/24892]", + "clusterlist_entries": "[0/0]", + "prefixes": { + "total_entries": 5312, + "memory_usage": 3839280 + }, + "path": { + "total_entries": 26682, + "memory_usage": 3839280 + } + } + } + }, + "10.167.70.123": { + "address_family": { + "ipv4 unicast": { + "neighbor_table_version": 4, + "as": 4230103023, + "msg_rcvd": 44738, + "msg_sent": 47436, + "tbl_ver": 96073, + "inq": 0, + "outq": 0, + "up_down": "2w1d", + "state_pfxrcd": "2", + "prefix_received": "2", + "state": "established", + "route_identifier": "10.167.68.54", + "local_as": 65100, + "bgp_table_version": 96073, + "config_peers": 9, + "capable_peers": 9, + "attribute_entries": "[463/77784]", + "as_path_entries": "[283/8242]", + "community_entries": "[437/24892]", + "clusterlist_entries": "[0/0]", + "prefixes": { + "total_entries": 5312, + "memory_usage": 3839280 + }, + "path": { + "total_entries": 26682, + "memory_usage": 3839280 + } + } + } + }, + "10.167.70.137": { + "address_family": { + "ipv4 unicast": { + "neighbor_table_version": 4, + "as": 4230103023, + "msg_rcvd": 44738, + "msg_sent": 47437, + "tbl_ver": 96073, + "inq": 0, + "outq": 0, + "up_down": "2w1d", + "state_pfxrcd": "2", + "prefix_received": "2", + "state": "established", + "route_identifier": "10.167.68.54", + "local_as": 65100, + "bgp_table_version": 96073, + "config_peers": 9, + "capable_peers": 9, + "attribute_entries": "[463/77784]", + "as_path_entries": "[283/8242]", + "community_entries": "[437/24892]", + "clusterlist_entries": "[0/0]", + "prefixes": { + "total_entries": 5312, + "memory_usage": 3839280 + }, + "path": { + "total_entries": 26682, + "memory_usage": 3839280 + } + } + } + }, + "1227:81:e000:50::": { + "address_family": { + "ipv6 unicast": { + "neighbor_table_version": 4, + "as": 65100, + "msg_rcvd": 44728, + "msg_sent": 44731, + "tbl_ver": 13, + "inq": 0, + "outq": 0, + "up_down": "6d13h", + "state_pfxrcd": "0", + "prefix_received": "0", + "state": "established", + "route_identifier": "10.167.68.54", + "local_as": 65100, + "bgp_table_version": 13, + "config_peers": 9, + "capable_peers": 7, + "attribute_entries": "[0/0]", + "as_path_entries": "[0/0]", + "community_entries": "[437/24892]", + "clusterlist_entries": "[0/0]", + "prefixes": { + "total_entries": 0, + "memory_usage": 0 + }, + "path": { + "total_entries": 0, + "memory_usage": 0 + } + } + } + }, + "1227:81:e000:50::1": { + "address_family": { + "ipv6 unicast": { + "neighbor_table_version": 4, + "as": 65100, + "msg_rcvd": 44728, + "msg_sent": 44731, + "tbl_ver": 13, + "inq": 0, + "outq": 0, + "up_down": "6d12h", + "state_pfxrcd": "0", + "prefix_received": "0", + "state": "established", + "route_identifier": "10.167.68.54", + "local_as": 65100, + "bgp_table_version": 13, + "config_peers": 9, + "capable_peers": 7, + "attribute_entries": "[0/0]", + "as_path_entries": "[0/0]", + "community_entries": "[437/24892]", + "clusterlist_entries": "[0/0]", + "prefixes": { + "total_entries": 0, + "memory_usage": 0 + }, + "path": { + "total_entries": 0, + "memory_usage": 0 + } + } + } + }, + "1227:81:e000:50::2": { + "address_family": { + "ipv6 unicast": { + "neighbor_table_version": 4, + "as": 65100, + "msg_rcvd": 44725, + "msg_sent": 44727, + "tbl_ver": 13, + "inq": 0, + "outq": 0, + "up_down": "1w2d", + "state_pfxrcd": "0", + "prefix_received": "0", + "state": "established", + "route_identifier": "10.167.68.54", + "local_as": 65100, + "bgp_table_version": 13, + "config_peers": 9, + "capable_peers": 7, + "attribute_entries": "[0/0]", + "as_path_entries": "[0/0]", + "community_entries": "[437/24892]", + "clusterlist_entries": "[0/0]", + "prefixes": { + "total_entries": 0, + "memory_usage": 0 + }, + "path": { + "total_entries": 0, + "memory_usage": 0 + } + } + } + }, + "1227:81:e000:50::3": { + "address_family": { + "ipv6 unicast": { + "neighbor_table_version": 4, + "as": 65100, + "msg_rcvd": 44726, + "msg_sent": 44726, + "tbl_ver": 13, + "inq": 0, + "outq": 0, + "up_down": "1w2d", + "state_pfxrcd": "0", + "prefix_received": "0", + "state": "established", + "route_identifier": "10.167.68.54", + "local_as": 65100, + "bgp_table_version": 13, + "config_peers": 9, + "capable_peers": 7, + "attribute_entries": "[0/0]", + "as_path_entries": "[0/0]", + "community_entries": "[437/24892]", + "clusterlist_entries": "[0/0]", + "prefixes": { + "total_entries": 0, + "memory_usage": 0 + }, + "path": { + "total_entries": 0, + "memory_usage": 0 + } + } + } + }, + "1227:81:e000:50::5": { + "address_family": { + "ipv6 unicast": { + "neighbor_table_version": 4, + "as": 65100, + "msg_rcvd": 44725, + "msg_sent": 44727, + "tbl_ver": 13, + "inq": 0, + "outq": 0, + "up_down": "2w1d", + "state_pfxrcd": "0", + "prefix_received": "0", + "state": "established", + "route_identifier": "10.167.68.54", + "local_as": 65100, + "bgp_table_version": 13, + "config_peers": 9, + "capable_peers": 7, + "attribute_entries": "[0/0]", + "as_path_entries": "[0/0]", + "community_entries": "[437/24892]", + "clusterlist_entries": "[0/0]", + "prefixes": { + "total_entries": 0, + "memory_usage": 0 + }, + "path": { + "total_entries": 0, + "memory_usage": 0 + } + } + } + }, + "1227:81:e000:50::6": { + "address_family": { + "ipv6 unicast": { + "neighbor_table_version": 4, + "as": 65100, + "msg_rcvd": 44727, + "msg_sent": 44731, + "tbl_ver": 13, + "inq": 0, + "outq": 0, + "up_down": "1w1d", + "state_pfxrcd": "0", + "prefix_received": "0", + "state": "established", + "route_identifier": "10.167.68.54", + "local_as": 65100, + "bgp_table_version": 13, + "config_peers": 9, + "capable_peers": 7, + "attribute_entries": "[0/0]", + "as_path_entries": "[0/0]", + "community_entries": "[437/24892]", + "clusterlist_entries": "[0/0]", + "prefixes": { + "total_entries": 0, + "memory_usage": 0 + }, + "path": { + "total_entries": 0, + "memory_usage": 0 + } + } + } + }, + "1227:81:e000:50::7": { + "address_family": { + "ipv6 unicast": { + "neighbor_table_version": 4, + "as": 65100, + "msg_rcvd": 44729, + "msg_sent": 44730, + "tbl_ver": 13, + "inq": 0, + "outq": 0, + "up_down": "1w1d", + "state_pfxrcd": "0", + "prefix_received": "0", + "state": "established", + "route_identifier": "10.167.68.54", + "local_as": 65100, + "bgp_table_version": 13, + "config_peers": 9, + "capable_peers": 7, + "attribute_entries": "[0/0]", + "as_path_entries": "[0/0]", + "community_entries": "[437/24892]", + "clusterlist_entries": "[0/0]", + "prefixes": { + "total_entries": 0, + "memory_usage": 0 + }, + "path": { + "total_entries": 0, + "memory_usage": 0 + } + } + } + }, + "1227:81:e000:54:2000::1": { + "address_family": { + "ipv6 unicast": { + "neighbor_table_version": 4, + "as": 4130103024, + "msg_rcvd": 0, + "msg_sent": 0, + "tbl_ver": 0, + "inq": 0, + "outq": 0, + "up_down": "2w1d", + "state_pfxrcd": "active", + "state": "active", + "route_identifier": "10.167.68.54", + "local_as": 65100, + "bgp_table_version": 13, + "config_peers": 9, + "capable_peers": 7, + "attribute_entries": "[0/0]", + "as_path_entries": "[0/0]", + "community_entries": "[437/24892]", + "clusterlist_entries": "[0/0]", + "prefixes": { + "total_entries": 0, + "memory_usage": 0 + }, + "path": { + "total_entries": 0, + "memory_usage": 0 + } + } + } + }, + "1227:81:e000:54:2000::3": { + "address_family": { + "ipv6 unicast": { + "neighbor_table_version": 4, + "as": 4130103024, + "msg_rcvd": 0, + "msg_sent": 0, + "tbl_ver": 0, + "inq": 0, + "outq": 0, + "up_down": "2w1d", + "state_pfxrcd": "idle", + "state": "idle", + "route_identifier": "10.167.68.54", + "local_as": 65100, + "bgp_table_version": 13, + "config_peers": 9, + "capable_peers": 7, + "attribute_entries": "[0/0]", + "as_path_entries": "[0/0]", + "community_entries": "[437/24892]", + "clusterlist_entries": "[0/0]", + "prefixes": { + "total_entries": 0, + "memory_usage": 0 + }, + "path": { + "total_entries": 0, + "memory_usage": 0 + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/genie/libs/parser/nxos/tests/ShowBgpVrfAllAllSummary/cli/equal/golden_output_6_output.txt b/src/genie/libs/parser/nxos/tests/ShowBgpVrfAllAllSummary/cli/equal/golden_output_6_output.txt new file mode 100644 index 0000000000..36f68ef8c4 --- /dev/null +++ b/src/genie/libs/parser/nxos/tests/ShowBgpVrfAllAllSummary/cli/equal/golden_output_6_output.txt @@ -0,0 +1,50 @@ +show bgp vrf all all summary + +BGP summary information for VRF hgtref, address family IPv4 Unicast +BGP router identifier 10.167.68.54, local AS number 65100 +BGP table version is 96073, IPv4 Unicast config peers 9, capable peers 9 +5312 network entries and 26682 paths using 3839280 bytes of memory +BGP attribute entries [463/77784], BGP AS path entries [283/8242] +BGP community entries [437/24892], BGP clusterlist entries [0/0] + +Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd +10.167.68.50 4 65100 52705 44731 96073 0 0 6d13h 4951 +10.167.68.51 4 65100 52681 44731 96073 0 0 6d12h 4951 +10.167.68.52 4 65100 54474 44727 96073 0 0 1w2d 4157 +10.167.68.53 4 65100 54518 44726 96073 0 0 1w2d 4157 +10.167.68.55 4 65100 44729 44727 96073 0 0 2w1d 2 +10.167.68.56 4 65100 53129 44731 96073 0 0 1w1d 4230 +10.167.68.57 4 65100 53197 44731 96073 0 0 1w1d 4230 +10.167.70.123 4 4230103023 + 44738 47436 96073 0 0 2w1d 2 +10.167.70.137 4 4230103023 + 44738 47437 96073 0 0 2w1d 2 + +BGP summary information for VRF hgtref, address family IPv6 Unicast +BGP router identifier 10.167.68.54, local AS number 65100 +BGP table version is 13, IPv6 Unicast config peers 9, capable peers 7 +0 network entries and 0 paths using 0 bytes of memory +BGP attribute entries [0/0], BGP AS path entries [0/0] +BGP community entries [437/24892], BGP clusterlist entries [0/0] + +Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd +1227:81:e000:50:: + 4 65100 44728 44731 13 0 0 6d13h 0 +1227:81:e000:50::1 + 4 65100 44728 44731 13 0 0 6d12h 0 +1227:81:e000:50::2 + 4 65100 44725 44727 13 0 0 1w2d 0 +1227:81:e000:50::3 + 4 65100 44726 44726 13 0 0 1w2d 0 +1227:81:e000:50::5 + 4 65100 44725 44727 13 0 0 2w1d 0 +1227:81:e000:50::6 + 4 65100 44727 44731 13 0 0 1w1d 0 +1227:81:e000:50::7 + 4 65100 44729 44730 13 0 0 1w1d 0 +1227:81:e000:54:2000::1 + 4 4130103024 + 0 0 0 0 0 2w1d Active +1227:81:e000:54:2000::3 + 4 4130103024 + 0 0 0 0 0 2w1d Idle