[EVPN-Driver] Cannot remove routes

Bug #2038819 reported by Justin Lamp
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ovn-bgp-agent
Fix Released
Medium
Unassigned

Bug Description

When executing remove_extra_routes() in the main sync loop, the removal will fail as the returned routes will not contain the 'dst', 'oif' and 'gateway' attributes. They are only found in the attrs as RTA_X.

```
Python 3.10.12 (main, Jul 4 2023, 05:58:45) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyroute2
>>> ipr = pyroute2.IPRoute()
>>> r = ipr.get_routes(table=200)
>>> r[1]
{'family': 2, 'dst_len': 32, 'src_len': 0, 'tos': 0, 'table': 200, 'proto': 3, 'scope': 253, 'type': 1, 'flags': 0, 'attrs': [('RTA_TABLE', 200), ('RTA_DST', '92.148.12.2'), ('RTA_OIF', 11)], 'header': {'length': 52, 'type': 24, 'flags': 2, 'sequence_number': 255, 'pid': 1264284, 'error': None, 'target': 'localhost', 'stats': Stats(qsize=0, delta=0, delay=0)}, 'event': 'RTM_NEWROUTE'}
>>> r[1]['dst']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.10/site-packages/pyroute2/netlink/__init__.py", line 1351, in __getitem__
    return dict.__getitem__(self, key)
KeyError: 'dst'
>>> r[1].get('dst')
'92.148.12.2'
>>>
```

```
2023-10-09 11:41:53.366 7 INFO ovn_bgp_agent.drivers.openstack.utils.frr [-] FRR reconfiguration (action = add-vrf) for evpn: {'vni': 1020, 'bgp_as': 65296}
2023-10-09 11:41:54.113 7 ERROR ovn_bgp_agent.agent [-] Unexpected exception while running the sync: 'dst': KeyError: 'dst'
2023-10-09 11:41:54.113 7 ERROR ovn_bgp_agent.agent Traceback (most recent call last):
2023-10-09 11:41:54.113 7 ERROR ovn_bgp_agent.agent File "/usr/local/lib/python3.10/site-packages/ovn_bgp_agent/agent.py", line 53, in sync
2023-10-09 11:41:54.113 7 ERROR ovn_bgp_agent.agent self.agent_driver.sync()
2023-10-09 11:41:54.113 7 ERROR ovn_bgp_agent.agent File "/usr/local/lib/python3.10/site-packages/oslo_concurrency/lockutils.py", line 414, in inner
2023-10-09 11:41:54.113 7 ERROR ovn_bgp_agent.agent return f(*args, **kwargs)
2023-10-09 11:41:54.113 7 ERROR ovn_bgp_agent.agent File "/usr/local/lib/python3.10/site-packages/ovn_bgp_agent/drivers/openstack/ovn_evpn_driver.py", line 147, in sync
2023-10-09 11:41:54.113 7 ERROR ovn_bgp_agent.agent self._remove_extra_routes()
2023-10-09 11:41:54.113 7 ERROR ovn_bgp_agent.agent File "/usr/local/lib/python3.10/site-packages/ovn_bgp_agent/drivers/openstack/ovn_evpn_driver.py", line 774, in _remove_extra_routes
2023-10-09 11:41:54.113 7 ERROR ovn_bgp_agent.agent possible_matchings = [
2023-10-09 11:41:54.113 7 ERROR ovn_bgp_agent.agent File "/usr/local/lib/python3.10/site-packages/ovn_bgp_agent/drivers/openstack/ovn_evpn_driver.py", line 776, in <listcomp>
2023-10-09 11:41:54.113 7 ERROR ovn_bgp_agent.agent if (r['dst'] == route_info['route']['dst'] and
2023-10-09 11:41:54.113 7 ERROR ovn_bgp_agent.agent File "/usr/local/lib/python3.10/site-packages/pyroute2/netlink/__init__.py", line 1351, in __getitem__
2023-10-09 11:41:54.113 7 ERROR ovn_bgp_agent.agent return dict.__getitem__(self, key)
2023-10-09 11:41:54.113 7 ERROR ovn_bgp_agent.agent KeyError: 'dst'
2023-10-09 11:41:54.113 7 ERROR ovn_bgp_agent.agent
```

Changed in ovn-bgp-agent:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ovn-bgp-agent (master)
Changed in ovn-bgp-agent:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ovn-bgp-agent (master)

Reviewed: https://review.opendev.org/c/openstack/ovn-bgp-agent/+/898824
Committed: https://opendev.org/openstack/ovn-bgp-agent/commit/5bb65f5dd006a47900a2a656874ebd54f78e4589
Submitter: "Zuul (22348)"
Branch: master

commit 5bb65f5dd006a47900a2a656874ebd54f78e4589
Author: Justin Lamp <email address hidden>
Date: Thu Oct 19 16:11:26 2023 +0200

    Fix [EVPN-Driver] Cannot remove routes

    pyroute2 update breaks getting some route information.

    Closes-Bug: #2038819
    Change-Id: I17f6882b54314a65bdb05760609dbda1dcc82e6b
    Signed-off-by: Justin Lamp <email address hidden>

Changed in ovn-bgp-agent:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ovn-bgp-agent (stable/2023.2)

Fix proposed to branch: stable/2023.2
Review: https://review.opendev.org/c/openstack/ovn-bgp-agent/+/901065

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ovn-bgp-agent (stable/2023.2)

Reviewed: https://review.opendev.org/c/openstack/ovn-bgp-agent/+/901065
Committed: https://opendev.org/openstack/ovn-bgp-agent/commit/d989789ac26f610827379332da8ecc495ea8f3a9
Submitter: "Zuul (22348)"
Branch: stable/2023.2

commit d989789ac26f610827379332da8ecc495ea8f3a9
Author: Justin Lamp <email address hidden>
Date: Thu Oct 19 16:11:26 2023 +0200

    Fix [EVPN-Driver] Cannot remove routes

    pyroute2 update breaks getting some route information.

    Closes-Bug: #2038819
    Change-Id: I17f6882b54314a65bdb05760609dbda1dcc82e6b
    Signed-off-by: Justin Lamp <email address hidden>
    (cherry picked from commit 5bb65f5dd006a47900a2a656874ebd54f78e4589)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/ovn-bgp-agent 2.0.0.0rc1

This issue was fixed in the openstack/ovn-bgp-agent 2.0.0.0rc1 release candidate.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.