Migrate neutron-dynamic-routing from Ryu to os-ken

This change causes neutron-dynamic-routing to stop consuming Ryu
in favor of os-ken. os-ken becomes the reference implementation
for BGP services and neutron-dynamic-routing no longer has a
dependency on Ryu.

Partially-Implements: blueprint ryu-framework-maintenace-transition
Change-Id: I4a68440809cad5de2d6d191f7211d68b542672e5
This commit is contained in:
Ryan Tidwell 2018-10-05 15:48:16 -05:00
parent 2b9bb078f5
commit 34655a8e6e
No known key found for this signature in database
GPG Key ID: A1C63854C1CDF372
25 changed files with 148 additions and 146 deletions

View File

@ -83,10 +83,10 @@
- ^releasenotes/.*$
- job:
name: neutron-dynamic-routing-dsvm-tempest-with-ryu-master-scenario-ipv4
name: neutron-dynamic-routing-dsvm-tempest-with-os-ken-master-scenario-ipv4
parent: legacy-dsvm-base
run: playbooks/neutron-dynamic-routing-dsvm-tempest-with-ryu-master-scenario-ipv4/run.yaml
post-run: playbooks/neutron-dynamic-routing-dsvm-tempest-with-ryu-master-scenario-ipv4/post.yaml
run: playbooks/neutron-dynamic-routing-dsvm-tempest-with-os-ken-master-scenario-ipv4/run.yaml
post-run: playbooks/neutron-dynamic-routing-dsvm-tempest-with-os-ken-master-scenario-ipv4/post.yaml
timeout: 7800
required-projects:
- openstack-infra/devstack-gate
@ -121,8 +121,8 @@
- neutron-dynamic-routing-dsvm-tempest-api
experimental:
jobs:
- neutron-dynamic-routing-dsvm-tempest-with-ryu-master-scenario-ipv4
- neutron-dynamic-routing-dsvm-tempest-with-os-ken-master-scenario-ipv4
periodic:
jobs:
- neutron-dynamic-routing-dsvm-tempest-with-ryu-master-scenario-ipv4
- neutron-dynamic-routing-dsvm-tempest-with-os-ken-master-scenario-ipv4
- legacy-periodic-neutron-dynamic-routing-dsvm-tempest-with-ryu-master-scenario-ipv4

View File

@ -23,7 +23,7 @@ function configure_dr_agent_bgp_config {
function configure_dr_agent_bgp_driver {
if [ -z "$BGP_SPEAKER_DRIVER" ] ; then
BGP_SPEAKER_DRIVER=$RYU_BGP_SPEAKER_DRIVER
BGP_SPEAKER_DRIVER=$OSKEN_BGP_SPEAKER_DRIVER
fi
iniset $DR_AGENT_BGP_CONF_FILE bgp bgp_speaker_driver $BGP_SPEAKER_DRIVER
}

View File

@ -74,5 +74,5 @@ DR_AGENT_BINARY=${DR_AGENT_BINARY:-"$NEUTRON_BIN_DIR/neutron-bgp-dragent"}
DR_AGENT_BGP_CONF_FILE=${DR_AGENT_BGP_CONF_FILE:-"$NEUTRON_CONF_DIR/bgp_dragent.ini"}
BGP_ROUTER_ID=${BGP_ROUTER_ID:-"127.0.0.1"}
BGP_PLUGIN=${BGP_PLUGIN:-"neutron_dynamic_routing.services.bgp.bgp_plugin.BgpPlugin"}
RYU_BGP_SPEAKER_DRIVER="neutron_dynamic_routing.services.bgp.agent.driver.ryu.driver.RyuBgpDriver"
OSKEN_BGP_SPEAKER_DRIVER="neutron_dynamic_routing.services.bgp.agent.driver.os_ken.driver.OsKenBgpDriver"

View File

@ -33,7 +33,7 @@ realize the required dynamic routing protocol functionality. For details,
please refer to the system design document :doc:`system-design`
.. note::
One DRAgent can support multiple drivers but currently ONLY Ryu is
One DRAgent can support multiple drivers but currently ONLY os-ken is
integrated successfully.

View File

@ -129,12 +129,12 @@ and BGP Speaker object instance is created. For details refer to
BGP Speaker Life Cycle
~~~~~~~~~~~~~~~~~~~~~~
Now we support RyuBgpDriver, BGP Speaker will be processed by Dragent. When
Now we support OsKenBgpDriver, BGP Speaker will be processed by Dragent. When
associating a BGP Speaker with an active Dragent, the plugin will send an RPC
message to the agent for calling driver in order to create a BGP Speaker instance.
In RyuBgpDriver, the created instance ``BGP Speaker`` will setup by router-id
and ASN, then Ryu will setup new context with speaker configuration and listeners
In OsKenBgpDriver, the created instance ``BGP Speaker`` will setup by router-id
and ASN, then os-ken will setup new context with speaker configuration and listeners
which monitor whether the related peers are alive.
Then the following operation could be done.
@ -144,7 +144,7 @@ Then the following operation could be done.
instance, so it will be still the db operation until the speaker is associated with
dragent, and all the peers connection before will be setup by ``BGP Speaker``
creation. If add peers into speaker which is running, Dragent will call driver
to add peer dynamically. For RyuBgpDriver, it will register a new neighbor
to add peer dynamically. For OsKenBgpDriver, it will register a new neighbor
based on your peer configuration and try to establish a session with the peer.
* Delete peers from BGP Speaker

View File

@ -81,7 +81,7 @@ The following figure shows the architecture of this feature::
| +---------------------+ | | +---------------------+ |
| | | | | |
| +---------+-----------+ | | +---------+-----------+ |
| | Ryu | Other | | | | Ryu | Other | |
| | os-ken | Other | | | | os-ken | Other | |
| | Driver | Drivers | | | | Driver | Drivers | |
| +---------+-----------+ | | +---------+-----------+ |
| | | |
@ -126,5 +126,5 @@ It manages and configures different dynamic routing stack through
`Common Driver API <../contributor/dragent-drivers.html>`_.
.. note::
Currently, only integration with `Ryu <http://ryu.readthedocs.io/en/latest/library_bgp_speaker.html>`_
Currently, only integration with `os-ken <https://docs.openstack.org/os-ken/latest/>`_
is supported. Future releases will add the support for Quagga, Bird, etc.

View File

@ -46,14 +46,14 @@ functionality of a dynamic routing protocol::
| | |
| | |
| +------------+------------+ |
| | Ryu | Other | |
| | os-ken | Other | |
| | Driver | Drivers | |
| +------------+------------+ |
| |
+-------------------------------+
.. note::
In the first release, only the integration with Ryu is supported. Later release will
In the first release, only the integration with os-ken is supported. Later release will
have support for Quagga, Bird etc. Besides, BGP is the only protocol supported now
but support for more dynamic routing protocols might come in the future.
@ -66,8 +66,8 @@ BGP Driver
~~~~~~~~~~
There are two configuration parameters related to BGP which are specified in ``bgp_dragent.ini``.
* bgp_speaker_driver, to define BGP speaker driver class. Default is Ryu
(neutron_dynamic_routing.services.bgp.agent.driver.ryu.driver.RyuBgpDriver).
* bgp_speaker_driver, to define BGP speaker driver class. Default is os-ken
(neutron_dynamic_routing.services.bgp.agent.driver.os_ken.driver.OsKenBgpDriver).
* bgp_router_id, to define BGP identity (typically an IPv4 address). Default is
a unique loopback interface IP address.

View File

@ -57,6 +57,7 @@ neutron-lib==1.21.0
openstackdocstheme==1.18.1
openstacksdk==0.11.2
os-client-config==1.28.0
os-ken==0.3.0
os-service-types==1.2.0
os-xenapi==0.3.1
osc-lib==1.8.0
@ -118,7 +119,6 @@ requests==2.14.2
requestsexceptions==1.2.0
rfc3986==0.3.1
Routes==2.3.1
ryu==4.24
simplejson==3.5.1
six==1.10.0
snowballstemmer==1.2.1

View File

@ -13,10 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from os_ken.services.protocols.bgp import bgpspeaker
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 ryu.services.protocols.bgp import bgpspeaker
from ryu.services.protocols.bgp.rtconf.neighbors import CONNECT_MODE_ACTIVE
from neutron_lib import constants as lib_consts
@ -48,14 +48,14 @@ def best_path_change_cb(event):
'is_withdraw': event.is_withdraw})
class RyuBgpDriver(base.BgpDriverBase):
"""BGP speaker implementation via Ryu."""
class OsKenBgpDriver(base.BgpDriverBase):
"""BGP speaker implementation via os-ken."""
def __init__(self, cfg):
LOG.info(_LI('Initializing Ryu driver for BGP Speaker functionality.'))
LOG.info(_LI('Initializing os-ken driver for BGP functionality.'))
self._read_config(cfg)
# Note: Even though Ryu can only support one BGP speaker as of now,
# Note: Even though os-ken can only support one BGP speaker as of now,
# we have tried making the framework generic for the future purposes.
self.cache = utils.BgpMultiSpeakerCache()
@ -66,8 +66,8 @@ class RyuBgpDriver(base.BgpDriverBase):
'functional working.'))
else:
self.routerid = cfg.bgp_router_id
LOG.info(_LI('Initialized Ryu BGP Speaker driver interface with '
'bgp_router_id=%s'), self.routerid)
LOG.info(_LI('Initialized os-ken BGP Speaker driver interface '
'with bgp_router_id=%s'), self.routerid)
def add_bgp_speaker(self, speaker_as):
curr_speaker = self.cache.get_bgp_speaker(speaker_as)
@ -76,7 +76,7 @@ class RyuBgpDriver(base.BgpDriverBase):
current_as=speaker_as,
rtid=self.routerid)
# Ryu can only support One speaker
# os-ken can only support One speaker
if self.cache.get_hosted_bgp_speakers_count() == 1:
raise bgp_driver_exc.BgpSpeakerMaxScheduled(count=1)
@ -84,7 +84,7 @@ class RyuBgpDriver(base.BgpDriverBase):
# speaker_as must be an integer in the allowed range.
utils.validate_as_num('local_as', speaker_as)
# Notify Ryu about BGP Speaker addition.
# Notify os-ken about BGP Speaker addition.
# Please note: Since, only the route-advertisement support is
# implemented we are explicitly setting the bgp_server_port
# attribute to 0 which disables listening on port 179.
@ -104,7 +104,7 @@ class RyuBgpDriver(base.BgpDriverBase):
if not curr_speaker:
raise bgp_driver_exc.BgpSpeakerNotAdded(local_as=speaker_as,
rtid=self.routerid)
# Notify Ryu about BGP Speaker deletion
# Notify os-ken about BGP Speaker deletion
curr_speaker.shutdown()
LOG.info(_LI('Removed BGP Speaker for local_as=%(as)d with '
'router_id=%(rtid)s.'),
@ -125,7 +125,7 @@ class RyuBgpDriver(base.BgpDriverBase):
if password is not None:
password = encodeutils.to_utf8(password)
# Notify Ryu about BGP Peer addition
# Notify os-ken about BGP Peer addition
if ip_version == lib_consts.IP_VERSION_4:
enable_ipv4 = True
enable_ipv6 = False
@ -150,7 +150,7 @@ class RyuBgpDriver(base.BgpDriverBase):
# Validate peer_ip. It must be a string.
utils.validate_ip_addr(peer_ip)
# Notify Ryu about BGP Peer removal
# Notify os-ken about BGP Peer removal
curr_speaker.neighbor_del(address=peer_ip)
LOG.info(_LI('Removed BGP Peer %(peer)s from BGP Speaker '
'running for local_as=%(local_as)d.'),
@ -166,7 +166,7 @@ class RyuBgpDriver(base.BgpDriverBase):
utils.validate_string(cidr)
utils.validate_string(nexthop)
# Notify Ryu about route advertisement
# Notify os-ken about route advertisement
curr_speaker.prefix_add(prefix=cidr, next_hop=nexthop)
LOG.info(_LI('Route cidr=%(prefix)s, nexthop=%(nexthop)s is '
'advertised for BGP Speaker running for '
@ -181,7 +181,7 @@ class RyuBgpDriver(base.BgpDriverBase):
# Validate cidr. It must be a string.
utils.validate_string(cidr)
# Notify Ryu about route withdrawal
# Notify os-ken about route withdrawal
curr_speaker.prefix_del(prefix=cidr)
LOG.info(_LI('Route cidr=%(prefix)s is withdrawn from BGP Speaker '
'running for local_as=%(local_as)d.'),

View File

@ -28,7 +28,7 @@ diagram:
container +---------+ +---------+
docker container environment is provided by test tool of ryu.
docker container environment is provided by test tool of os-ken.
It has the following functions:
- build and remove a container image.
- run, stop and remove a container.

View File

@ -24,7 +24,7 @@ from tempest.common import utils
from tempest import config
from neutron_tempest_plugin.api import base
from ryu.tests.integrated.common import docker_base as ctn_base
from os_ken.tests.integrated.common import docker_base as ctn_base
from neutron_dynamic_routing.tests.tempest import bgp_client

View File

@ -18,7 +18,7 @@ from tempest import config
from neutron_dynamic_routing.tests.tempest.scenario import base
from ryu.tests.integrated.common import docker_base as ctn_base
from os_ken.tests.integrated.common import docker_base as ctn_base
CONF = config.CONF

View File

@ -15,8 +15,8 @@
# under the License.
from neutron_dynamic_routing.tests.tempest.scenario import base
from ryu.tests.integrated.common import docker_base as ctn_base
from ryu.tests.integrated.common import quagga
from os_ken.tests.integrated.common import docker_base as ctn_base
from os_ken.tests.integrated.common import quagga
class BgpSpeakerBasicTestJSONBase(base.BgpSpeakerScenarioTestJSONBase):

View File

@ -17,8 +17,8 @@ from tempest.lib import decorators
from neutron_dynamic_routing.tests.tempest.scenario import base
from neutron_dynamic_routing.tests.tempest.scenario import base_test_proto as test_base # noqa
from ryu.tests.integrated.common import docker_base as ctn_base
from ryu.tests.integrated.common import quagga
from os_ken.tests.integrated.common import docker_base as ctn_base
from os_ken.tests.integrated.common import quagga
CONF = config.CONF

View File

@ -20,7 +20,7 @@ from tempest.lib import decorators
from neutron_dynamic_routing.tests.tempest.scenario import base as s_base
from neutron_dynamic_routing.tests.tempest.scenario.basic import base
from ryu.tests.integrated.common import docker_base as ctn_base
from os_ken.tests.integrated.common import docker_base as ctn_base
CONF = config.CONF

View File

@ -20,8 +20,8 @@ from tempest.lib import decorators
from neutron_dynamic_routing.tests.tempest.scenario import base
from neutron_dynamic_routing.tests.tempest.scenario import base_test_proto as test_base # noqa
from ryu.tests.integrated.common import docker_base as ctn_base
from ryu.tests.integrated.common import quagga
from os_ken.tests.integrated.common import docker_base as ctn_base
from os_ken.tests.integrated.common import quagga
CONF = config.CONF

View File

@ -20,8 +20,8 @@ from tempest.lib import decorators
from neutron_dynamic_routing.tests.tempest.scenario import base
from neutron_dynamic_routing.tests.tempest.scenario import base_test_proto as test_base # noqa
from ryu.tests.integrated.common import docker_base as ctn_base
from ryu.tests.integrated.common import quagga
from os_ken.tests.integrated.common import docker_base as ctn_base
from os_ken.tests.integrated.common import quagga
CONF = config.CONF

View File

@ -16,16 +16,16 @@
import six
import mock
from os_ken.services.protocols.bgp import bgpspeaker
from os_ken.services.protocols.bgp.rtconf.neighbors import CONNECT_MODE_ACTIVE
from oslo_config import cfg
from oslo_utils import encodeutils
from ryu.services.protocols.bgp import bgpspeaker
from ryu.services.protocols.bgp.rtconf.neighbors import CONNECT_MODE_ACTIVE
from neutron.tests import base
from neutron_dynamic_routing.services.bgp.agent import config as bgp_config
from neutron_dynamic_routing.services.bgp.agent.driver import exceptions as bgp_driver_exc # noqa
from neutron_dynamic_routing.services.bgp.agent.driver.ryu import driver as ryu_driver # noqa
from neutron_dynamic_routing.services.bgp.agent.driver.os_ken import driver as os_ken_driver # noqa
# Test variables for BGP Speaker
FAKE_LOCAL_AS1 = 12345
@ -44,45 +44,45 @@ FAKE_ROUTE = '2.2.2.0/24'
FAKE_NEXTHOP = '5.5.5.5'
class TestRyuBgpDriver(base.BaseTestCase):
class TestOsKenBgpDriver(base.BaseTestCase):
def setUp(self):
super(TestRyuBgpDriver, self).setUp()
super(TestOsKenBgpDriver, self).setUp()
cfg.CONF.register_opts(bgp_config.BGP_PROTO_CONFIG_OPTS, 'BGP')
cfg.CONF.set_override('bgp_router_id', FAKE_ROUTER_ID, 'BGP')
self.ryu_bgp_driver = ryu_driver.RyuBgpDriver(cfg.CONF.BGP)
mock_ryu_speaker_p = mock.patch.object(bgpspeaker, 'BGPSpeaker')
self.mock_ryu_speaker = mock_ryu_speaker_p.start()
self.os_ken_bgp_driver = os_ken_driver.OsKenBgpDriver(cfg.CONF.BGP)
mock_os_ken_speaker_p = mock.patch.object(bgpspeaker, 'BGPSpeaker')
self.mock_os_ken_speaker = mock_os_ken_speaker_p.start()
def test_add_new_bgp_speaker(self):
self.ryu_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.os_ken_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.assertEqual(1,
self.ryu_bgp_driver.cache.get_hosted_bgp_speakers_count())
self.mock_ryu_speaker.assert_called_once_with(
self.os_ken_bgp_driver.cache.get_hosted_bgp_speakers_count())
self.mock_os_ken_speaker.assert_called_once_with(
as_number=FAKE_LOCAL_AS1, router_id=FAKE_ROUTER_ID,
bgp_server_port=0,
best_path_change_handler=ryu_driver.best_path_change_cb,
peer_down_handler=ryu_driver.bgp_peer_down_cb,
peer_up_handler=ryu_driver.bgp_peer_up_cb)
best_path_change_handler=os_ken_driver.best_path_change_cb,
peer_down_handler=os_ken_driver.bgp_peer_down_cb,
peer_up_handler=os_ken_driver.bgp_peer_up_cb)
def test_remove_bgp_speaker(self):
self.ryu_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.os_ken_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.assertEqual(1,
self.ryu_bgp_driver.cache.get_hosted_bgp_speakers_count())
speaker = self.ryu_bgp_driver.cache.get_bgp_speaker(FAKE_LOCAL_AS1)
self.ryu_bgp_driver.delete_bgp_speaker(FAKE_LOCAL_AS1)
self.os_ken_bgp_driver.cache.get_hosted_bgp_speakers_count())
speaker = self.os_ken_bgp_driver.cache.get_bgp_speaker(FAKE_LOCAL_AS1)
self.os_ken_bgp_driver.delete_bgp_speaker(FAKE_LOCAL_AS1)
self.assertEqual(0,
self.ryu_bgp_driver.cache.get_hosted_bgp_speakers_count())
self.os_ken_bgp_driver.cache.get_hosted_bgp_speakers_count())
self.assertEqual(1, speaker.shutdown.call_count)
def test_add_bgp_peer_without_password(self):
self.ryu_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.os_ken_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.assertEqual(1,
self.ryu_bgp_driver.cache.get_hosted_bgp_speakers_count())
self.ryu_bgp_driver.add_bgp_peer(FAKE_LOCAL_AS1,
self.os_ken_bgp_driver.cache.get_hosted_bgp_speakers_count())
self.os_ken_bgp_driver.add_bgp_peer(FAKE_LOCAL_AS1,
FAKE_PEER_IP,
FAKE_PEER_AS)
speaker = self.ryu_bgp_driver.cache.get_bgp_speaker(FAKE_LOCAL_AS1)
speaker = self.os_ken_bgp_driver.cache.get_bgp_speaker(FAKE_LOCAL_AS1)
speaker.neighbor_add.assert_called_once_with(
address=FAKE_PEER_IP,
remote_as=FAKE_PEER_AS,
@ -92,15 +92,15 @@ class TestRyuBgpDriver(base.BaseTestCase):
connect_mode=CONNECT_MODE_ACTIVE)
def test_add_bgp_peer_with_password(self):
self.ryu_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.os_ken_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.assertEqual(1,
self.ryu_bgp_driver.cache.get_hosted_bgp_speakers_count())
self.ryu_bgp_driver.add_bgp_peer(FAKE_LOCAL_AS1,
self.os_ken_bgp_driver.cache.get_hosted_bgp_speakers_count())
self.os_ken_bgp_driver.add_bgp_peer(FAKE_LOCAL_AS1,
FAKE_PEER_IP,
FAKE_PEER_AS,
FAKE_AUTH_TYPE,
FAKE_PEER_PASSWORD)
speaker = self.ryu_bgp_driver.cache.get_bgp_speaker(FAKE_LOCAL_AS1)
speaker = self.os_ken_bgp_driver.cache.get_bgp_speaker(FAKE_LOCAL_AS1)
speaker.neighbor_add.assert_called_once_with(
address=FAKE_PEER_IP,
remote_as=FAKE_PEER_AS,
@ -110,17 +110,17 @@ class TestRyuBgpDriver(base.BaseTestCase):
connect_mode=CONNECT_MODE_ACTIVE)
def test_add_bgp_peer_with_unicode_password(self):
self.ryu_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.os_ken_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.assertEqual(1,
self.ryu_bgp_driver.cache.get_hosted_bgp_speakers_count())
self.os_ken_bgp_driver.cache.get_hosted_bgp_speakers_count())
NEW_FAKE_PEER_PASSWORD = six.text_type(FAKE_PEER_PASSWORD)
self.ryu_bgp_driver.add_bgp_peer(
self.os_ken_bgp_driver.add_bgp_peer(
FAKE_LOCAL_AS1,
FAKE_PEER_IP,
FAKE_PEER_AS,
FAKE_AUTH_TYPE,
NEW_FAKE_PEER_PASSWORD)
speaker = self.ryu_bgp_driver.cache.get_bgp_speaker(FAKE_LOCAL_AS1)
speaker = self.os_ken_bgp_driver.cache.get_bgp_speaker(FAKE_LOCAL_AS1)
speaker.neighbor_add.assert_called_once_with(
address=FAKE_PEER_IP,
remote_as=FAKE_PEER_AS,
@ -130,13 +130,13 @@ class TestRyuBgpDriver(base.BaseTestCase):
connect_mode=CONNECT_MODE_ACTIVE)
def test_add_bgp_peer_with_ipv6(self):
self.ryu_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.os_ken_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.assertEqual(1,
self.ryu_bgp_driver.cache.get_hosted_bgp_speakers_count())
self.ryu_bgp_driver.add_bgp_peer(FAKE_LOCAL_AS1,
self.os_ken_bgp_driver.cache.get_hosted_bgp_speakers_count())
self.os_ken_bgp_driver.add_bgp_peer(FAKE_LOCAL_AS1,
FAKE_PEER_IPV6,
FAKE_PEER_AS)
speaker = self.ryu_bgp_driver.cache.get_bgp_speaker(FAKE_LOCAL_AS1)
speaker = self.os_ken_bgp_driver.cache.get_bgp_speaker(FAKE_LOCAL_AS1)
speaker.neighbor_add.assert_called_once_with(
address=FAKE_PEER_IPV6,
remote_as=FAKE_PEER_AS,
@ -146,159 +146,161 @@ class TestRyuBgpDriver(base.BaseTestCase):
connect_mode=CONNECT_MODE_ACTIVE)
def test_remove_bgp_peer(self):
self.ryu_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.os_ken_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.assertEqual(1,
self.ryu_bgp_driver.cache.get_hosted_bgp_speakers_count())
self.ryu_bgp_driver.delete_bgp_peer(FAKE_LOCAL_AS1, FAKE_PEER_IP)
speaker = self.ryu_bgp_driver.cache.get_bgp_speaker(FAKE_LOCAL_AS1)
self.os_ken_bgp_driver.cache.get_hosted_bgp_speakers_count())
self.os_ken_bgp_driver.delete_bgp_peer(FAKE_LOCAL_AS1, FAKE_PEER_IP)
speaker = self.os_ken_bgp_driver.cache.get_bgp_speaker(FAKE_LOCAL_AS1)
speaker.neighbor_del.assert_called_once_with(address=FAKE_PEER_IP)
def test_advertise_route(self):
self.ryu_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.os_ken_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.assertEqual(1,
self.ryu_bgp_driver.cache.get_hosted_bgp_speakers_count())
self.ryu_bgp_driver.advertise_route(FAKE_LOCAL_AS1,
self.os_ken_bgp_driver.cache.get_hosted_bgp_speakers_count())
self.os_ken_bgp_driver.advertise_route(FAKE_LOCAL_AS1,
FAKE_ROUTE,
FAKE_NEXTHOP)
speaker = self.ryu_bgp_driver.cache.get_bgp_speaker(FAKE_LOCAL_AS1)
speaker = self.os_ken_bgp_driver.cache.get_bgp_speaker(FAKE_LOCAL_AS1)
speaker.prefix_add.assert_called_once_with(prefix=FAKE_ROUTE,
next_hop=FAKE_NEXTHOP)
def test_withdraw_route(self):
self.ryu_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.os_ken_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.assertEqual(1,
self.ryu_bgp_driver.cache.get_hosted_bgp_speakers_count())
self.ryu_bgp_driver.withdraw_route(FAKE_LOCAL_AS1, FAKE_ROUTE)
speaker = self.ryu_bgp_driver.cache.get_bgp_speaker(FAKE_LOCAL_AS1)
self.os_ken_bgp_driver.cache.get_hosted_bgp_speakers_count())
self.os_ken_bgp_driver.withdraw_route(FAKE_LOCAL_AS1, FAKE_ROUTE)
speaker = self.os_ken_bgp_driver.cache.get_bgp_speaker(FAKE_LOCAL_AS1)
speaker.prefix_del.assert_called_once_with(prefix=FAKE_ROUTE)
def test_add_same_bgp_speakers_twice(self):
self.ryu_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.os_ken_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.assertRaises(bgp_driver_exc.BgpSpeakerAlreadyScheduled,
self.ryu_bgp_driver.add_bgp_speaker, FAKE_LOCAL_AS1)
self.os_ken_bgp_driver.add_bgp_speaker,
FAKE_LOCAL_AS1)
def test_add_different_bgp_speakers_when_one_already_added(self):
self.ryu_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.os_ken_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.assertRaises(bgp_driver_exc.BgpSpeakerMaxScheduled,
self.ryu_bgp_driver.add_bgp_speaker,
self.os_ken_bgp_driver.add_bgp_speaker,
FAKE_LOCAL_AS2)
def test_add_bgp_speaker_with_invalid_asnum_paramtype(self):
self.assertRaises(bgp_driver_exc.InvalidParamType,
self.ryu_bgp_driver.add_bgp_speaker, '12345')
self.os_ken_bgp_driver.add_bgp_speaker, '12345')
def test_add_bgp_speaker_with_invalid_asnum_range(self):
self.assertRaises(bgp_driver_exc.InvalidParamRange,
self.ryu_bgp_driver.add_bgp_speaker, -1)
self.os_ken_bgp_driver.add_bgp_speaker, -1)
self.assertRaises(bgp_driver_exc.InvalidParamRange,
self.ryu_bgp_driver.add_bgp_speaker, 4294967296)
self.os_ken_bgp_driver.add_bgp_speaker, 4294967296)
# valid when enables 4 byte AS number
self.ryu_bgp_driver.add_bgp_speaker(65536)
self.os_ken_bgp_driver.add_bgp_speaker(65536)
def test_add_bgp_peer_with_invalid_paramtype(self):
# Test with an invalid asnum data-type
self.ryu_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.os_ken_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.assertRaises(bgp_driver_exc.InvalidParamType,
self.ryu_bgp_driver.add_bgp_peer,
self.os_ken_bgp_driver.add_bgp_peer,
FAKE_LOCAL_AS1, FAKE_PEER_IP, '12345')
# Test with an invalid auth-type and an invalid password
self.assertRaises(bgp_driver_exc.InvalidParamType,
self.ryu_bgp_driver.add_bgp_peer,
self.os_ken_bgp_driver.add_bgp_peer,
FAKE_LOCAL_AS1, FAKE_PEER_IP, FAKE_PEER_AS,
'sha-1', 1234)
# Test with an invalid auth-type and a valid password
self.assertRaises(bgp_driver_exc.InvaildAuthType,
self.ryu_bgp_driver.add_bgp_peer,
self.os_ken_bgp_driver.add_bgp_peer,
FAKE_LOCAL_AS1, FAKE_PEER_IP, FAKE_PEER_AS,
'hmac-md5', FAKE_PEER_PASSWORD)
# Test with none auth-type and a valid password
self.assertRaises(bgp_driver_exc.InvaildAuthType,
self.ryu_bgp_driver.add_bgp_peer,
self.os_ken_bgp_driver.add_bgp_peer,
FAKE_LOCAL_AS1, FAKE_PEER_IP, FAKE_PEER_AS,
'none', FAKE_PEER_PASSWORD)
# Test with none auth-type and an invalid password
self.assertRaises(bgp_driver_exc.InvalidParamType,
self.ryu_bgp_driver.add_bgp_peer,
self.os_ken_bgp_driver.add_bgp_peer,
FAKE_LOCAL_AS1, FAKE_PEER_IP, FAKE_PEER_AS,
'none', 1234)
# Test with a valid auth-type and no password
self.assertRaises(bgp_driver_exc.PasswordNotSpecified,
self.ryu_bgp_driver.add_bgp_peer,
self.os_ken_bgp_driver.add_bgp_peer,
FAKE_LOCAL_AS1, FAKE_PEER_IP, FAKE_PEER_AS,
FAKE_AUTH_TYPE, None)
# Test with a invalid ip address
self.assertRaises(bgp_driver_exc.InvalidParamType,
self.ryu_bgp_driver.add_bgp_peer,
self.os_ken_bgp_driver.add_bgp_peer,
FAKE_LOCAL_AS1, '1.2.3.a', FAKE_PEER_AS,
FAKE_AUTH_TYPE, FAKE_PEER_PASSWORD)
def test_add_bgp_peer_with_invalid_asnum_range(self):
self.ryu_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.os_ken_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.assertRaises(bgp_driver_exc.InvalidParamRange,
self.ryu_bgp_driver.add_bgp_peer,
self.os_ken_bgp_driver.add_bgp_peer,
FAKE_LOCAL_AS1, FAKE_PEER_IP, -1)
self.assertRaises(bgp_driver_exc.InvalidParamRange,
self.ryu_bgp_driver.add_bgp_peer,
self.os_ken_bgp_driver.add_bgp_peer,
FAKE_LOCAL_AS1, FAKE_PEER_IP, 4294967296)
# valid when enables 4 byte AS number
self.ryu_bgp_driver.add_bgp_peer(FAKE_LOCAL_AS1, FAKE_PEER_IP, 65536)
self.os_ken_bgp_driver.add_bgp_peer(FAKE_LOCAL_AS1, FAKE_PEER_IP,
65536)
def test_add_bgp_peer_without_adding_speaker(self):
self.assertRaises(bgp_driver_exc.BgpSpeakerNotAdded,
self.ryu_bgp_driver.add_bgp_peer,
self.os_ken_bgp_driver.add_bgp_peer,
FAKE_LOCAL_AS1, FAKE_PEER_IP, FAKE_PEER_AS)
def test_remove_bgp_peer_with_invalid_paramtype(self):
self.ryu_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.os_ken_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.assertRaises(bgp_driver_exc.InvalidParamType,
self.ryu_bgp_driver.delete_bgp_peer,
self.os_ken_bgp_driver.delete_bgp_peer,
FAKE_LOCAL_AS1, 12345)
def test_remove_bgp_peer_without_adding_speaker(self):
self.assertRaises(bgp_driver_exc.BgpSpeakerNotAdded,
self.ryu_bgp_driver.delete_bgp_peer,
self.os_ken_bgp_driver.delete_bgp_peer,
FAKE_LOCAL_AS1, FAKE_PEER_IP)
def test_advertise_route_with_invalid_paramtype(self):
self.ryu_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.os_ken_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.assertRaises(bgp_driver_exc.InvalidParamType,
self.ryu_bgp_driver.advertise_route,
self.os_ken_bgp_driver.advertise_route,
FAKE_LOCAL_AS1, 12345, FAKE_NEXTHOP)
self.assertRaises(bgp_driver_exc.InvalidParamType,
self.ryu_bgp_driver.advertise_route,
self.os_ken_bgp_driver.advertise_route,
FAKE_LOCAL_AS1, FAKE_ROUTE, 12345)
def test_advertise_route_without_adding_speaker(self):
self.assertRaises(bgp_driver_exc.BgpSpeakerNotAdded,
self.ryu_bgp_driver.advertise_route,
self.os_ken_bgp_driver.advertise_route,
FAKE_LOCAL_AS1, FAKE_ROUTE, FAKE_NEXTHOP)
def test_withdraw_route_with_invalid_paramtype(self):
self.ryu_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.os_ken_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.assertRaises(bgp_driver_exc.InvalidParamType,
self.ryu_bgp_driver.withdraw_route,
self.os_ken_bgp_driver.withdraw_route,
FAKE_LOCAL_AS1, 12345)
self.assertRaises(bgp_driver_exc.InvalidParamType,
self.ryu_bgp_driver.withdraw_route,
self.os_ken_bgp_driver.withdraw_route,
FAKE_LOCAL_AS1, 12345)
def test_withdraw_route_without_adding_speaker(self):
self.assertRaises(bgp_driver_exc.BgpSpeakerNotAdded,
self.ryu_bgp_driver.withdraw_route,
self.os_ken_bgp_driver.withdraw_route,
FAKE_LOCAL_AS1, FAKE_ROUTE)
def test_add_multiple_bgp_speakers(self):
self.ryu_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.os_ken_bgp_driver.add_bgp_speaker(FAKE_LOCAL_AS1)
self.assertEqual(1,
self.ryu_bgp_driver.cache.get_hosted_bgp_speakers_count())
self.os_ken_bgp_driver.cache.get_hosted_bgp_speakers_count())
self.assertRaises(bgp_driver_exc.BgpSpeakerMaxScheduled,
self.ryu_bgp_driver.add_bgp_speaker,
self.os_ken_bgp_driver.add_bgp_speaker,
FAKE_LOCAL_AS2)
self.assertRaises(bgp_driver_exc.BgpSpeakerNotAdded,
self.ryu_bgp_driver.delete_bgp_speaker,
self.os_ken_bgp_driver.delete_bgp_speaker,
FAKE_LOCAL_AS2)
self.assertEqual(1,
self.ryu_bgp_driver.cache.get_hosted_bgp_speakers_count())
self.ryu_bgp_driver.delete_bgp_speaker(FAKE_LOCAL_AS1)
self.os_ken_bgp_driver.cache.get_hosted_bgp_speakers_count())
self.os_ken_bgp_driver.delete_bgp_speaker(FAKE_LOCAL_AS1)
self.assertEqual(0,
self.ryu_bgp_driver.cache.get_hosted_bgp_speakers_count())
self.os_ken_bgp_driver.cache.get_hosted_bgp_speakers_count())

View File

@ -24,7 +24,7 @@ from neutron_dynamic_routing.services.bgp.common import constants as bgp_consts
FAKE_IP = '2.2.2.5'
FAKE_IPV6 = '2001:db8::'
FAKE_LOCAL_AS = 12345
FAKE_RYU_SPEAKER = {}
FAKE_OS_KEN_SPEAKER = {}
EXC_INV_PARAMTYPE = "Parameter %(param)s must be of %(param_type)s type."
EXC_INV_PARAMRANGE = "%(param)s must be in %(range)s range."
EXC_PASSWORD_NOTSPEC = "Password not specified for authentication " + \
@ -152,25 +152,25 @@ class TestBgpMultiSpeakerCache(base.BaseTestCase):
def setUp(self):
super(TestBgpMultiSpeakerCache, self).setUp()
self.expected_cache = {FAKE_LOCAL_AS: FAKE_RYU_SPEAKER}
self.expected_cache = {FAKE_LOCAL_AS: FAKE_OS_KEN_SPEAKER}
self.bs_cache = bgp_driver_utils.BgpMultiSpeakerCache()
def test_put_bgp_speaker(self):
self.bs_cache.put_bgp_speaker(FAKE_LOCAL_AS, FAKE_RYU_SPEAKER)
self.bs_cache.put_bgp_speaker(FAKE_LOCAL_AS, FAKE_OS_KEN_SPEAKER)
self.assertEqual(self.expected_cache, self.bs_cache.cache)
def test_remove_bgp_speaker(self):
self.bs_cache.put_bgp_speaker(FAKE_LOCAL_AS, FAKE_RYU_SPEAKER)
self.bs_cache.put_bgp_speaker(FAKE_LOCAL_AS, FAKE_OS_KEN_SPEAKER)
self.assertEqual(1, len(self.bs_cache.cache))
self.bs_cache.remove_bgp_speaker(FAKE_LOCAL_AS)
self.assertEqual(0, len(self.bs_cache.cache))
def test_get_bgp_speaker(self):
self.bs_cache.put_bgp_speaker(FAKE_LOCAL_AS, FAKE_RYU_SPEAKER)
self.bs_cache.put_bgp_speaker(FAKE_LOCAL_AS, FAKE_OS_KEN_SPEAKER)
self.assertEqual(
FAKE_RYU_SPEAKER,
FAKE_OS_KEN_SPEAKER,
self.bs_cache.get_bgp_speaker(FAKE_LOCAL_AS))
def test_get_hosted_bgp_speakers_count(self):
self.bs_cache.put_bgp_speaker(FAKE_LOCAL_AS, FAKE_RYU_SPEAKER)
self.bs_cache.put_bgp_speaker(FAKE_LOCAL_AS, FAKE_OS_KEN_SPEAKER)
self.assertEqual(1, self.bs_cache.get_hosted_bgp_speakers_count())

View File

@ -1,6 +1,6 @@
- hosts: all
name: Autoconverted job legacy-neutron-dynamic-routing-dsvm-tempest-with-ryu-master-scenario-ipv4
from old job gate-neutron-dynamic-routing-dsvm-tempest-with-ryu-master-scenario-ipv4-nv
name: Autoconverted job legacy-neutron-dynamic-routing-dsvm-tempest-with-os-ken-master-scenario-ipv4
from old job gate-neutron-dynamic-routing-dsvm-tempest-with-os-ken-master-scenario-ipv4-nv
tasks:
- name: Ensure legacy workspace directory
@ -48,11 +48,11 @@
export DEVSTACK_LOCAL_CONFIG
function gate_hook {
local ryu_path=$BASE/new/ryu_master
if [[ ! -d $ryu_path ]]; then
git clone https://github.com/osrg/ryu $ryu_path
local os_ken_path=$BASE/new/os_ken_master
if [[ ! -d $os_ken_path ]]; then
git clone git://git.openstack.org/openstack/os-ken $os_ken_path
fi
sudo pip install -e $ryu_path
sudo pip install -e $os_ken_path
bash -xe $BASE/new/neutron-dynamic-routing/neutron_dynamic_routing/tests/contrib/gate_hook.sh dsvm-scenario
}
export -f gate_hook

View File

@ -10,6 +10,7 @@ SQLAlchemy>=1.2.0 # MIT
alembic>=0.8.10 # MIT
six>=1.10.0 # MIT
neutron-lib>=1.21.0 # Apache-2.0
os-ken>=0.3.0 # Apache-2.0
oslo.config>=5.2.0 # Apache-2.0
oslo.db>=4.27.0 # Apache-2.0
oslo.log>=3.36.0 # Apache-2.0

View File

@ -20,4 +20,3 @@ WebTest>=2.0.27 # MIT
oslotest>=3.2.0 # Apache-2.0
reno>=2.5.0 # Apache-2.0
tempest>=17.1.0 # Apache-2.0
ryu>=4.24 # Apache-2.0