Fix [EVPN-Driver] Cannot remove routes

pyroute2 update breaks getting some route information.

Closes-Bug: #2038819
Change-Id: I17f6882b54314a65bdb05760609dbda1dcc82e6b
Signed-off-by: Justin Lamp <justin.lamp@netways.de>
This commit is contained in:
Justin Lamp 2023-10-19 16:11:26 +02:00
parent 629c6dff34
commit 5bb65f5dd0
No known key found for this signature in database
GPG Key ID: 06D118614B977305
2 changed files with 8 additions and 7 deletions

View File

@ -766,16 +766,17 @@ class OVNEVPNDriver(driver_api.AgentDriverBase):
if 'gateway' in route_info['route'].keys(): # subnet route
possible_matchings = [
r for r in vrf_routes
if (r['dst'] == route_info['route']['dst'] and
if (r.get('dst') == route_info['route']['dst'] and
r['dst_len'] == route_info['route']['dst_len'] and
r['gateway'] == route_info['route']['gateway'] and
r.get('gateway') == (
route_info['route']['gateway']) and
r['table'] == route_info['route']['table'])]
else: # cr-lrp
possible_matchings = [
r for r in vrf_routes
if (r['dst'] == route_info['route']['dst'] and
if (r.get('dst') == route_info['route']['dst'] and
r['dst_len'] == route_info['route']['dst_len'] and
r['oif'] == oif and
r.get('oif') == oif and
r['table'] == route_info['route']['table'])]
for r in possible_matchings:
vrf_routes.remove(r)

View File

@ -528,11 +528,11 @@ def get_routes_on_tables(table_ids):
def delete_ip_routes(routes):
for route in routes:
r_info = {'dst': route['dst'],
r_info = {'dst': route.get('dst'),
'dst_len': route['dst_len'],
'family': route['family'],
'oif': route['oif'],
'gateway': route['gateway'],
'oif': route.get('oif'),
'gateway': route.get('gateway'),
'table': route['table']}
ovn_bgp_agent.privileged.linux_net.route_delete(r_info)