From fc2dae7c93eb8606bcf0c77b6691595f69502c20 Mon Sep 17 00:00:00 2001 From: Ryan Tidwell Date: Fri, 5 Oct 2018 10:45:38 -0500 Subject: [PATCH] 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 --- .../services/bgp/agent/driver/os_ken/driver.py | 15 +++------------ .../services/bgp/driver/os_ken/test_driver.py | 8 ++++---- .../notes/mp-bgp-support-d408e8569e94d07f.yaml | 7 +++++++ 3 files changed, 14 insertions(+), 16 deletions(-) create mode 100644 releasenotes/notes/mp-bgp-support-d408e8569e94d07f.yaml diff --git a/neutron_dynamic_routing/services/bgp/agent/driver/os_ken/driver.py b/neutron_dynamic_routing/services/bgp/agent/driver/os_ken/driver.py index f5ba7a44..11ea1da7 100644 --- a/neutron_dynamic_routing/services/bgp/agent/driver/os_ken/driver.py +++ b/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 ' diff --git a/neutron_dynamic_routing/tests/unit/services/bgp/driver/os_ken/test_driver.py b/neutron_dynamic_routing/tests/unit/services/bgp/driver/os_ken/test_driver.py index 4541a04e..3f281a95 100644 --- a/neutron_dynamic_routing/tests/unit/services/bgp/driver/os_ken/test_driver.py +++ b/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) diff --git a/releasenotes/notes/mp-bgp-support-d408e8569e94d07f.yaml b/releasenotes/notes/mp-bgp-support-d408e8569e94d07f.yaml new file mode 100644 index 00000000..635d7dda --- /dev/null +++ b/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.