Browse Source

Enable MP-BGP capabilities in Ryu BGP driver

This change enables all capabilties regardless of peer address
family, thereby enabling announcement of IPv6 prefixes over IPv4
sessions and vice-versa. Peers can opt in/out with capabilities
configured on the remote end of the session.

Change-Id: I7b241cdfddcecbdd8cdde2e88de35b9be6982451
Closes-Bug: #1784590
changes/02/608302/3
Ryan Tidwell 3 years ago
parent
commit
fc2dae7c93
No known key found for this signature in database GPG Key ID: A1C63854C1CDF372
  1. 15
      neutron_dynamic_routing/services/bgp/agent/driver/os_ken/driver.py
  2. 8
      neutron_dynamic_routing/tests/unit/services/bgp/driver/os_ken/test_driver.py
  3. 7
      releasenotes/notes/mp-bgp-support-d408e8569e94d07f.yaml

15
neutron_dynamic_routing/services/bgp/agent/driver/os_ken/driver.py

@ -18,8 +18,6 @@ from os_ken.services.protocols.bgp.rtconf.neighbors import CONNECT_MODE_ACTIVE
from oslo_log import log as logging
from oslo_utils import encodeutils
from neutron_lib import constants as lib_consts
from neutron_dynamic_routing._i18n import _LE, _LI
from neutron_dynamic_routing.services.bgp.agent.driver import base
from neutron_dynamic_routing.services.bgp.agent.driver import exceptions as bgp_driver_exc # noqa
@ -120,22 +118,15 @@ class OsKenBgpDriver(base.BgpDriverBase):
# Validate peer_ip and peer_as.
utils.validate_as_num('remote_as', peer_as)
ip_version = utils.validate_ip_addr(peer_ip)
utils.validate_ip_addr(peer_ip)
utils.validate_auth(auth_type, password)
if password is not None:
password = encodeutils.to_utf8(password)
# Notify os-ken about BGP Peer addition
if ip_version == lib_consts.IP_VERSION_4:
enable_ipv4 = True
enable_ipv6 = False
else:
enable_ipv4 = False
enable_ipv6 = True
curr_speaker.neighbor_add(address=peer_ip,
remote_as=peer_as,
enable_ipv4=enable_ipv4,
enable_ipv6=enable_ipv6,
enable_ipv4=True,
enable_ipv6=True,
password=password,
connect_mode=CONNECT_MODE_ACTIVE)
LOG.info(_LI('Added BGP Peer %(peer)s for remote_as=%(as)d to '

8
neutron_dynamic_routing/tests/unit/services/bgp/driver/os_ken/test_driver.py

@ -87,7 +87,7 @@ class TestOsKenBgpDriver(base.BaseTestCase):
address=FAKE_PEER_IP,
remote_as=FAKE_PEER_AS,
enable_ipv4=True,
enable_ipv6=False,
enable_ipv6=True,
password=None,
connect_mode=CONNECT_MODE_ACTIVE)
@ -105,7 +105,7 @@ class TestOsKenBgpDriver(base.BaseTestCase):
address=FAKE_PEER_IP,
remote_as=FAKE_PEER_AS,
enable_ipv4=True,
enable_ipv6=False,
enable_ipv6=True,
password=encodeutils.to_utf8(FAKE_PEER_PASSWORD),
connect_mode=CONNECT_MODE_ACTIVE)
@ -125,7 +125,7 @@ class TestOsKenBgpDriver(base.BaseTestCase):
address=FAKE_PEER_IP,
remote_as=FAKE_PEER_AS,
enable_ipv4=True,
enable_ipv6=False,
enable_ipv6=True,
password=encodeutils.to_utf8(NEW_FAKE_PEER_PASSWORD),
connect_mode=CONNECT_MODE_ACTIVE)
@ -140,7 +140,7 @@ class TestOsKenBgpDriver(base.BaseTestCase):
speaker.neighbor_add.assert_called_once_with(
address=FAKE_PEER_IPV6,
remote_as=FAKE_PEER_AS,
enable_ipv4=False,
enable_ipv4=True,
enable_ipv6=True,
password=None,
connect_mode=CONNECT_MODE_ACTIVE)

7
releasenotes/notes/mp-bgp-support-d408e8569e94d07f.yaml

@ -0,0 +1,7 @@
---
features:
- |
The os-ken driver now supports announcement of IPv6 prefixes
over IPv4 sessions and vice-versa. Peers can opt in/out with
MP-BGP capabilities configured on the peer end of BGP sessions
established with the os-ken driver.
Loading…
Cancel
Save