Merge "Values for [ml2]/physical_network_mtus should not be unique" into stable/mitaka
This commit is contained in:
commit
a5a5d72f86
|
@ -19,6 +19,7 @@ from oslo_config import cfg
|
|||
from oslo_db import exception as db_exc
|
||||
from oslo_log import log
|
||||
|
||||
from neutron._i18n import _LE
|
||||
from neutron.common import exceptions as exc
|
||||
from neutron.common import utils
|
||||
from neutron.plugins.common import utils as p_utils
|
||||
|
@ -36,9 +37,10 @@ class BaseTypeDriver(api.TypeDriver):
|
|||
def __init__(self):
|
||||
try:
|
||||
self.physnet_mtus = utils.parse_mappings(
|
||||
cfg.CONF.ml2.physical_network_mtus
|
||||
cfg.CONF.ml2.physical_network_mtus, unique_values=False
|
||||
)
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
LOG.error(_LE("Failed to parse physical_network_mtus: %s"), e)
|
||||
self.physnet_mtus = []
|
||||
|
||||
def get_mtu(self, physical_network=None):
|
||||
|
|
|
@ -142,6 +142,16 @@ class FlatTypeTest(testlib_api.SqlTestCase):
|
|||
self.driver.physnet_mtus = {}
|
||||
self.assertEqual(0, self.driver.get_mtu('physnet1'))
|
||||
|
||||
def test_parse_physical_network_mtus(self):
|
||||
config.cfg.CONF.set_override(
|
||||
'physical_network_mtus',
|
||||
['physnet1:1500', 'physnet2:1500', 'physnet3:9000'],
|
||||
group='ml2')
|
||||
driver = type_flat.FlatTypeDriver()
|
||||
self.assertEqual('1500', driver.physnet_mtus['physnet1'])
|
||||
self.assertEqual('1500', driver.physnet_mtus['physnet2'])
|
||||
self.assertEqual('9000', driver.physnet_mtus['physnet3'])
|
||||
|
||||
|
||||
class FlatTypeDefaultTest(base.BaseTestCase):
|
||||
|
||||
|
|
Loading…
Reference in New Issue