From 3f0c2b552a28b2e9cb8b80dc1691680f65d812db Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Thu, 26 Mar 2015 22:19:58 -0400 Subject: [PATCH] Revert "Fix validation of physical network name for flat nets" This reverts commit dbe37d571474ca759e57e61308cd3926a00b481e. This validation change broke TripleO's os-cloud-config setup-neutron script. Change-Id: I94c419b26ba93c67c9064fc110c8986c1ff68897 Closes-bug: #1437116 --- neutron/plugins/ml2/drivers/type_flat.py | 3 +-- neutron/tests/unit/ml2/test_ml2_plugin.py | 2 -- neutron/tests/unit/ml2/test_type_flat.py | 10 ---------- 3 files changed, 1 insertion(+), 14 deletions(-) diff --git a/neutron/plugins/ml2/drivers/type_flat.py b/neutron/plugins/ml2/drivers/type_flat.py index 657486669..ed055f560 100644 --- a/neutron/plugins/ml2/drivers/type_flat.py +++ b/neutron/plugins/ml2/drivers/type_flat.py @@ -92,8 +92,7 @@ class FlatTypeDriver(helpers.BaseTypeDriver): if not physical_network: msg = _("physical_network required for flat provider network") raise exc.InvalidInput(error_message=msg) - if (self.flat_networks is not None and - physical_network not in self.flat_networks): + if self.flat_networks and physical_network not in self.flat_networks: msg = (_("physical_network '%s' unknown for flat provider network") % physical_network) raise exc.InvalidInput(error_message=msg) diff --git a/neutron/tests/unit/ml2/test_ml2_plugin.py b/neutron/tests/unit/ml2/test_ml2_plugin.py index 1eef9e136..36270a07b 100644 --- a/neutron/tests/unit/ml2/test_ml2_plugin.py +++ b/neutron/tests/unit/ml2/test_ml2_plugin.py @@ -116,8 +116,6 @@ class Ml2PluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase): config.cfg.CONF.set_override('network_vlan_ranges', [self.phys_vrange, self.phys2_vrange], group='ml2_type_vlan') - config.cfg.CONF.set_override('flat_networks', ['noagent'], - group='ml2_type_flat') self.setup_parent() self.driver = ml2_plugin.Ml2Plugin() self.context = context.get_admin_context() diff --git a/neutron/tests/unit/ml2/test_type_flat.py b/neutron/tests/unit/ml2/test_type_flat.py index dac24d344..1e84078d3 100644 --- a/neutron/tests/unit/ml2/test_type_flat.py +++ b/neutron/tests/unit/ml2/test_type_flat.py @@ -86,16 +86,6 @@ class FlatTypeTest(testlib_api.SqlTestCase): self.driver.validate_provider_segment, segment) - def test_validate_provider_segment_with_empty_physical_nets_list(self): - config.cfg.CONF.set_override('flat_networks', [], - group='ml2_type_flat') - driver = type_flat.FlatTypeDriver() - segment = {api.NETWORK_TYPE: p_const.TYPE_FLAT, - api.PHYSICAL_NETWORK: 'flat_net'} - self.assertRaises(exc.InvalidInput, - driver.validate_provider_segment, - segment) - def test_reserve_provider_segment(self): segment = {api.NETWORK_TYPE: p_const.TYPE_FLAT, api.PHYSICAL_NETWORK: 'flat_net1'} -- 2.45.2