Merge "Add linux bridge trunk server side driver"
This commit is contained in:
commit
2c01c1a48b
|
@ -13,6 +13,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron.services.trunk.drivers.linuxbridge import driver as lxb_driver
|
||||
from neutron.services.trunk.drivers.openvswitch import driver as ovs_driver
|
||||
|
||||
|
||||
|
@ -24,4 +25,5 @@ def register():
|
|||
# be at least one compatible driver enabled in the deployment for trunk
|
||||
# setup to be successful. The plugin fails to initialize if no compatible
|
||||
# driver is found in the deployment.
|
||||
lxb_driver.register()
|
||||
ovs_driver.register()
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
from neutron_lib import constants
|
||||
|
||||
from neutron.extensions import portbindings
|
||||
from neutron.services.trunk import constants as trunk_consts
|
||||
from neutron.services.trunk.drivers import base
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
NAME = 'linuxbridge'
|
||||
SUPPORTED_INTERFACES = (
|
||||
portbindings.VIF_TYPE_BRIDGE,
|
||||
)
|
||||
SUPPORTED_SEGMENTATION_TYPES = (
|
||||
trunk_consts.VLAN,
|
||||
)
|
||||
|
||||
|
||||
class LinuxBridgeDriver(base.DriverBase):
|
||||
"""Server-side Trunk driver for the ML2 Linux Bridge driver."""
|
||||
|
||||
@property
|
||||
def is_loaded(self):
|
||||
return NAME in cfg.CONF.ml2.mechanism_drivers
|
||||
|
||||
@classmethod
|
||||
def create(cls):
|
||||
return cls(NAME, SUPPORTED_INTERFACES, SUPPORTED_SEGMENTATION_TYPES,
|
||||
constants.AGENT_TYPE_LINUXBRIDGE, can_trunk_bound_port=True)
|
||||
|
||||
|
||||
def register():
|
||||
# NOTE(kevinbenton): the thing that is keeping this from being
|
||||
# immediately garbage collected is that it registers callbacks
|
||||
LinuxBridgeDriver.create()
|
||||
LOG.debug("Linux bridge trunk driver initialized.")
|
|
@ -0,0 +1,38 @@
|
|||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants
|
||||
from oslo_config import cfg
|
||||
|
||||
from neutron.services.trunk.drivers.linuxbridge import driver
|
||||
from neutron.tests import base
|
||||
|
||||
|
||||
class LinuxBridgeDriverTestCase(base.BaseTestCase):
|
||||
|
||||
def test_driver_is_loaded(self):
|
||||
inst = driver.LinuxBridgeDriver.create()
|
||||
cfg.CONF.set_override('mechanism_drivers',
|
||||
['a', 'b', 'linuxbridge'], group='ml2')
|
||||
self.assertTrue(inst.is_loaded)
|
||||
cfg.CONF.set_override('mechanism_drivers',
|
||||
['a', 'b'], group='ml2')
|
||||
self.assertFalse(inst.is_loaded)
|
||||
|
||||
def test_driver_properties(self):
|
||||
inst = driver.LinuxBridgeDriver.create()
|
||||
self.assertEqual(driver.NAME, inst.name)
|
||||
self.assertEqual(driver.SUPPORTED_INTERFACES, inst.interfaces)
|
||||
self.assertEqual(driver.SUPPORTED_SEGMENTATION_TYPES,
|
||||
inst.segmentation_types)
|
||||
self.assertEqual(constants.AGENT_TYPE_LINUXBRIDGE, inst.agent_type)
|
||||
self.assertTrue(inst.can_trunk_bound_port)
|
Loading…
Reference in New Issue