Skip to content

Commit 1e8f3f7

Browse files
committed
Fixes related to "show bgp vrf all all summary"
- Handle cases BGP neighbor information is spread over 3 lines
1 parent ed40758 commit 1e8f3f7

File tree

3 files changed

+695
-0
lines changed

3 files changed

+695
-0
lines changed

src/genie/libs/parser/nxos/show_bgp_vrf.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1959,6 +1959,12 @@ def cli(self, vrf='all', address_family='all', output=None):
19591959
r' +(?P<tbl_ver>[0-9]+) +(?P<inq>[0-9]+)'
19601960
r' +(?P<outq>[0-9]+) +(?P<up_down>[a-zA-Z0-9\:]+)'
19611961
r' +(?P<state_pfxrcd>(?P<state>[a-zA-Z\s\(\)]+)?(?P<prx_rcd>\d+)?([\w\(\)\s]+)?)$')
1962+
#Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
1963+
# 1670:92:e000:24:2000::3
1964+
# 4 4110507001
1965+
# 0 0 0 0 0 2w1d Active
1966+
p8_2a = re.compile(r'^\s*(?P<v>[0-9]+) +(?P<as>[0-9]+)$')
1967+
19621968
# Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
19631969
# 10.10.10.10 4 4211111111
19641970
p8_3 = re.compile(r'^\s*(?P<neighbor>[a-zA-Z0-9\.\:]+) +(?P<v>[0-9]+) +(?P<as>[0-9]+)$')
@@ -2210,6 +2216,27 @@ def cli(self, vrf='all', address_family='all', output=None):
22102216
nbr_af_dict['path']['memory_usage'] = memory_usage
22112217
continue
22122218

2219+
# Neighbor information is spread over three lines:
2220+
#Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
2221+
# 1670:92:e000:24:2000::3
2222+
# 4 4110507001
2223+
# 0 0 0 0 0 2w1d Active
2224+
m = p8_2a.match(line)
2225+
if m and data_on_nextline:
2226+
# Note that we are not clearing data_on_nextline, the 3rd
2227+
# line will be matched by the existing p8_4 logic and cleared there
2228+
# Add address family to this neighbor
2229+
if 'address_family' not in nbr_dict:
2230+
nbr_dict['address_family'] = {}
2231+
if address_family not in nbr_dict['address_family']:
2232+
nbr_dict['address_family'][address_family] = {}
2233+
nbr_af_dict = nbr_dict['address_family'][address_family]
2234+
2235+
# Add keys for this address_family
2236+
nbr_af_dict['neighbor_table_version'] = int(m.groupdict()['v'])
2237+
nbr_af_dict['as'] = int(m.groupdict()['as'])
2238+
continue
2239+
22132240
# Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
22142241
# 10.10.10.10 4 4211111111
22152242
m = p8_3.match(line)

0 commit comments

Comments
 (0)