diff --git a/ovn_bgp_agent/drivers/openstack/ovn_evpn_driver.py b/ovn_bgp_agent/drivers/openstack/ovn_evpn_driver.py index 2b8d4adb..67690740 100644 --- a/ovn_bgp_agent/drivers/openstack/ovn_evpn_driver.py +++ b/ovn_bgp_agent/drivers/openstack/ovn_evpn_driver.py @@ -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) diff --git a/ovn_bgp_agent/utils/linux_net.py b/ovn_bgp_agent/utils/linux_net.py index 24c1f464..9b5e1064 100644 --- a/ovn_bgp_agent/utils/linux_net.py +++ b/ovn_bgp_agent/utils/linux_net.py @@ -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)