Skip to content

Commit 14fd501

Browse files
authored
Merge pull request #745 from netenglabs/path-rr-bugfix
Path: Always update nexthop IPs for recursive routes, not just for EVPN
2 parents b6db6ef + 8e23524 commit 14fd501

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

suzieq/engines/pandas/path.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -449,11 +449,15 @@ def _handle_recursive_route(self, df: pd.DataFrame,
449449
for row in df.itertuples():
450450
oifs = []
451451
nhops = []
452-
for nhop in row.nexthopIps:
452+
for i, nhop in enumerate(row.nexthopIps):
453+
if row.oifs and '_nexthopVrf:' in row.oifs[i]:
454+
vrf = row.oifs[i].split('_nexthopVrf:')[1]
455+
else:
456+
vrf = row.vrf
453457
rrdf = self._get_table_sqobj('routes') \
454458
.lpm(namespace=[row.namespace],
455459
hostname=[row.hostname], address=[nhop],
456-
vrf=[row.vrf])
460+
vrf=[vrf])
457461

458462
if not rrdf.empty:
459463
if not rrdf.oifs.size:
@@ -462,10 +466,13 @@ def _handle_recursive_route(self, df: pd.DataFrame,
462466
max_recurse-1)
463467
oif = rrdf.oifs.tolist()[0]
464468
oifs.extend(oif)
465-
if isinstance(oif, np.ndarray):
466-
oif = oif.tolist()[0]
467-
if oif.startswith('_nexthopVrf:'):
468-
# We need to change the nhop too
469+
# Not all NOS fill in usable values for nexthop for a
470+
# connected route. So don't copy nexthop IP if the result
471+
# of this lookup was a connected route. It also doesn't
472+
# matter if we've a connected route because recursive
473+
# resolution is over when we hit a connected route.
474+
if ~rrdf.protocol.isin(['direct', 'local', 'connected',
475+
'kernel']).all():
469476
nhops.extend(rrdf.nexthopIps.tolist()[0])
470477

471478
df.at[row.Index, 'oifs'] = np.array(oifs)

0 commit comments

Comments
 (0)