diff --git a/changelog/undistributed/changelog_show_bgp_nxos_20231209133946.rst b/changelog/undistributed/changelog_show_bgp_nxos_20231209133946.rst new file mode 100644 index 0000000000..00c21dcf30 --- /dev/null +++ b/changelog/undistributed/changelog_show_bgp_nxos_20231209133946.rst @@ -0,0 +1,6 @@ +-------------------------------------------------------------------------------- + Fix +-------------------------------------------------------------------------------- +* NXOS + * Modified ShowBgpVrfAllAllSummary: + * Added support for parsing 3 lines when v6 neighbor and AS wrap to 3 lines \ No newline at end of file diff --git a/src/genie/libs/parser/nxos/show_bgp.py b/src/genie/libs/parser/nxos/show_bgp.py index ad808d5d3b..37467e8ff8 100755 --- a/src/genie/libs/parser/nxos/show_bgp.py +++ b/src/genie/libs/parser/nxos/show_bgp.py @@ -3602,6 +3602,9 @@ def cli(self, vrf='all', address_family='all', output=None): ' +(?P[0-9]+) +(?P[a-zA-Z0-9\:]+)' ' +(?P(?P[a-zA-Z\s\(\)]+)?(?P\d+)?([\w\(\)\s]+)?)$') # Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd + # 4 123456 + p8_2_1 = 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]+)$') # Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd @@ -3852,6 +3855,23 @@ def cli(self, vrf='all', address_family='all', output=None): nbr_af_dict['path']['memory_usage'] = memory_usage continue + # Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd + # 4 4211111111 + m = p8_2_1.match(line) + if m and data_on_nextline: + + # 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..913db2e55f --- /dev/null +++ b/src/genie/libs/parser/nxos/tests/ShowBgpVrfAllAllSummary/cli/equal/golden_output_6_expected.py @@ -0,0 +1,237 @@ +expected_output = { + "vrf": { + "default": { + "neighbor": { + "2001:db8:c006:0:3e57:31ff:feb8:5dc4": { + "address_family": { + "ipv6 unicast": { + "neighbor_table_version": 4, + "as": 65011, + "msg_rcvd": 0, + "msg_sent": 0, + "tbl_ver": 0, + "inq": 0, + "outq": 0, + "up_down": "05:49:52", + "state_pfxrcd": "shut (admin)", + "state": "shut (admin)", + "route_identifier": "172.22.251.3", + "local_as": 65101, + "bgp_table_version": 47, + "config_peers": 6, + "capable_peers": 1, + "attribute_entries": "[4/688]", + "as_path_entries": "[0/0]", + "community_entries": "[0/0]", + "clusterlist_entries": "[0/0]", + "soft_reconfig_recvd_paths": 9, + "soft_reconfig_identical_paths": 9, + "soft_reconfig_combo_paths": 0, + "soft_reconfig_filtered_recvd": 0, + "soft_reconfig_bytes": 0, + "prefixes": { + "total_entries": 9, + "memory_usage": 3744 + }, + "path": { + "total_entries": 21, + "memory_usage": 3744 + } + } + } + }, + "2001:db8:c006:ee::25": { + "address_family": { + "ipv6 unicast": { + "neighbor_table_version": 4, + "as": 65120, + "msg_rcvd": 0, + "msg_sent": 0, + "tbl_ver": 0, + "inq": 0, + "outq": 0, + "up_down": "05:49:52", + "state_pfxrcd": "idle", + "state": "idle", + "route_identifier": "172.22.251.3", + "local_as": 65101, + "bgp_table_version": 47, + "config_peers": 6, + "capable_peers": 1, + "attribute_entries": "[4/688]", + "as_path_entries": "[0/0]", + "community_entries": "[0/0]", + "clusterlist_entries": "[0/0]", + "soft_reconfig_recvd_paths": 9, + "soft_reconfig_identical_paths": 9, + "soft_reconfig_combo_paths": 0, + "soft_reconfig_filtered_recvd": 0, + "soft_reconfig_bytes": 0, + "prefixes": { + "total_entries": 9, + "memory_usage": 3744 + }, + "path": { + "total_entries": 21, + "memory_usage": 3744 + } + } + } + }, + "2001:db8:c006:ff:1::8": { + "address_family": { + "ipv6 unicast": { + "neighbor_table_version": 4, + "as": 65152, + "msg_rcvd": 0, + "msg_sent": 0, + "tbl_ver": 0, + "inq": 0, + "outq": 0, + "up_down": "05:49:52", + "state_pfxrcd": "idle", + "state": "idle", + "route_identifier": "172.22.251.3", + "local_as": 65101, + "bgp_table_version": 47, + "config_peers": 6, + "capable_peers": 1, + "attribute_entries": "[4/688]", + "as_path_entries": "[0/0]", + "community_entries": "[0/0]", + "clusterlist_entries": "[0/0]", + "soft_reconfig_recvd_paths": 9, + "soft_reconfig_identical_paths": 9, + "soft_reconfig_combo_paths": 0, + "soft_reconfig_filtered_recvd": 0, + "soft_reconfig_bytes": 0, + "prefixes": { + "total_entries": 9, + "memory_usage": 3744 + }, + "path": { + "total_entries": 21, + "memory_usage": 3744 + } + } + } + }, + "2001:db8:c006:ff:1::9": { + "address_family": { + "ipv6 unicast": { + "neighbor_table_version": 4, + "as": 65152, + "msg_rcvd": 0, + "msg_sent": 0, + "tbl_ver": 0, + "inq": 0, + "outq": 0, + "up_down": "05:49:52", + "state_pfxrcd": "idle", + "state": "idle", + "route_identifier": "172.22.251.3", + "local_as": 65101, + "bgp_table_version": 47, + "config_peers": 6, + "capable_peers": 1, + "attribute_entries": "[4/688]", + "as_path_entries": "[0/0]", + "community_entries": "[0/0]", + "clusterlist_entries": "[0/0]", + "soft_reconfig_recvd_paths": 9, + "soft_reconfig_identical_paths": 9, + "soft_reconfig_combo_paths": 0, + "soft_reconfig_filtered_recvd": 0, + "soft_reconfig_bytes": 0, + "prefixes": { + "total_entries": 9, + "memory_usage": 3744 + }, + "path": { + "total_entries": 21, + "memory_usage": 3744 + } + } + } + }, + "2001:db8:c006:ff:251::1": { + "address_family": { + "ipv6 unicast": { + "neighbor_table_version": 4, + "as": 406942, + "msg_rcvd": 0, + "msg_sent": 0, + "tbl_ver": 0, + "inq": 0, + "outq": 0, + "up_down": "05:49:52", + "state_pfxrcd": "idle", + "state": "idle", + "route_identifier": "172.22.251.3", + "local_as": 65101, + "bgp_table_version": 47, + "config_peers": 6, + "capable_peers": 1, + "attribute_entries": "[4/688]", + "as_path_entries": "[0/0]", + "community_entries": "[0/0]", + "clusterlist_entries": "[0/0]", + "soft_reconfig_recvd_paths": 9, + "soft_reconfig_identical_paths": 9, + "soft_reconfig_combo_paths": 0, + "soft_reconfig_filtered_recvd": 0, + "soft_reconfig_bytes": 0, + "prefixes": { + "total_entries": 9, + "memory_usage": 3744 + }, + "path": { + "total_entries": 21, + "memory_usage": 3744 + } + } + } + }, + "2001:db8:c006:ff:251::4": { + "address_family": { + "ipv6 unicast": { + "neighbor_table_version": 4, + "as": 65101, + "msg_rcvd": 2104, + "msg_sent": 2101, + "tbl_ver": 47, + "inq": 0, + "outq": 0, + "up_down": "05:49:31", + "state_pfxrcd": "9", + "prefix_received": "9", + "state": "established", + "route_identifier": "172.22.251.3", + "local_as": 65101, + "bgp_table_version": 47, + "config_peers": 6, + "capable_peers": 1, + "attribute_entries": "[4/688]", + "as_path_entries": "[0/0]", + "community_entries": "[0/0]", + "clusterlist_entries": "[0/0]", + "soft_reconfig_recvd_paths": 9, + "soft_reconfig_identical_paths": 9, + "soft_reconfig_combo_paths": 0, + "soft_reconfig_filtered_recvd": 0, + "soft_reconfig_bytes": 0, + "prefixes": { + "total_entries": 9, + "memory_usage": 3744 + }, + "path": { + "total_entries": 21, + "memory_usage": 3744 + } + } + } + } + } + } + } +} \ 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..12d25af8fd --- /dev/null +++ b/src/genie/libs/parser/nxos/tests/ShowBgpVrfAllAllSummary/cli/equal/golden_output_6_output.txt @@ -0,0 +1,24 @@ +show bgp vrf default ipv6 uni summary +BGP summary information for VRF default, address family IPv6 Unicast +BGP router identifier 172.22.251.3, local AS number 65101 +BGP table version is 47, IPv6 Unicast config peers 6, capable peers 1 +9 network entries and 21 paths using 3744 bytes of memory +BGP attribute entries [4/688], BGP AS path entries [0/0] +BGP community entries [0/0], BGP clusterlist entries [0/0] +9 received paths for inbound soft reconfiguration +9 identical, 0 modified, 0 filtered received paths using 0 bytes + +Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd +2001:db8:c006:0:3e57:31ff:feb8:5dc4 + 4 65011 0 0 0 0 0 05:49:52 Shut (Admin) +2001:db8:c006:ee::25 + 4 65120 0 0 0 0 0 05:49:52 Idle +2001:db8:c006:ff:1::8 + 4 65152 0 0 0 0 0 05:49:52 Idle +2001:db8:c006:ff:1::9 + 4 65152 0 0 0 0 0 05:49:52 Idle +2001:db8:c006:ff:251::1 + 4 406942 + 0 0 0 0 0 05:49:52 Idle +2001:db8:c006:ff:251::4 + 4 65101 2104 2101 47 0 0 05:49:31 9 \ No newline at end of file