summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAradhana Singh <aradhana1.singh@intel.com>2016-07-11 06:44:43 +0000
committerBrian Haley <bhaley@redhat.com>2017-09-08 15:34:49 -0400
commitd00a50aad11465d904663dea14b3814017bcff75 (patch)
tree1986d9c219f806831f459ff3c466282e5cb81a11
parent51ca6837974a19369504f7cba7749d4e01d25a1f (diff)
Refactoring config options for ml2 config opts
Refactoring neutron ml2 config opts to be in neutron/conf/plugins/ml2. This would allow centralization of all configuration options and provides an easy way to import. NeutronLibImpact Change-Id: Ibc5a9ab268578c243ef13f7e0041bacd6c0c410b Partial-Bug: #1563069 Needed-By: Id0a97dda7718f06e33b2d30ce01cdcb3e9a46f7d
Notes
Notes (review): Verified+1: Mellanox CI <mlnx-openstack-ci@dev.mellanox.co.il> Code-Review+2: Kevin Benton <kevin@benton.pub> Code-Review+2: Armando Migliaccio <armamig@gmail.com> Workflow+1: Armando Migliaccio <armamig@gmail.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Wed, 13 Sep 2017 09:54:47 +0000 Reviewed-on: https://review.openstack.org/340228 Project: openstack/neutron Branch: refs/heads/master
-rw-r--r--neutron/cmd/sanity_check.py2
-rw-r--r--neutron/conf/plugins/ml2/config.py (renamed from neutron/plugins/ml2/config.py)3
-rw-r--r--neutron/opts.py4
-rw-r--r--neutron/plugins/ml2/managers.py2
-rw-r--r--neutron/plugins/ml2/plugin.py1
-rw-r--r--neutron/tests/unit/extensions/test_dns.py7
-rw-r--r--neutron/tests/unit/extensions/test_l3.py31
-rw-r--r--neutron/tests/unit/extensions/test_segment.py29
-rw-r--r--neutron/tests/unit/plugins/ml2/drivers/base_type_tunnel.py28
-rw-r--r--neutron/tests/unit/plugins/ml2/drivers/test_type_flat.py22
-rw-r--r--neutron/tests/unit/plugins/ml2/drivers/test_type_vlan.py36
-rw-r--r--neutron/tests/unit/plugins/ml2/extensions/test_data_plane_status.py8
-rw-r--r--neutron/tests/unit/plugins/ml2/extensions/test_dns_integration.py149
-rw-r--r--neutron/tests/unit/plugins/ml2/test_ext_portsecurity.py8
-rw-r--r--neutron/tests/unit/plugins/ml2/test_extension_driver_api.py14
-rw-r--r--neutron/tests/unit/plugins/ml2/test_managers.py13
-rw-r--r--neutron/tests/unit/plugins/ml2/test_plugin.py64
-rw-r--r--neutron/tests/unit/plugins/ml2/test_port_binding.py14
-rw-r--r--neutron/tests/unit/plugins/ml2/test_rpc.py2
-rw-r--r--neutron/tests/unit/services/revisions/test_revision_plugin.py8
20 files changed, 221 insertions, 224 deletions
diff --git a/neutron/cmd/sanity_check.py b/neutron/cmd/sanity_check.py
index e7de8c9..8e97a6b 100644
--- a/neutron/cmd/sanity_check.py
+++ b/neutron/cmd/sanity_check.py
@@ -35,7 +35,7 @@ def setup_conf():
35 'agent.common.config') 35 'agent.common.config')
36 cfg.CONF.import_group('VXLAN', 'neutron.plugins.ml2.drivers.linuxbridge.' 36 cfg.CONF.import_group('VXLAN', 'neutron.plugins.ml2.drivers.linuxbridge.'
37 'agent.common.config') 37 'agent.common.config')
38 cfg.CONF.import_group('ml2', 'neutron.plugins.ml2.config') 38 cfg.CONF.import_group('ml2', 'neutron.conf.plugins.ml2.config')
39 cfg.CONF.import_group('SECURITYGROUP', 'neutron.agent.securitygroups_rpc') 39 cfg.CONF.import_group('SECURITYGROUP', 'neutron.agent.securitygroups_rpc')
40 dhcp_agent.register_options(cfg.CONF) 40 dhcp_agent.register_options(cfg.CONF)
41 cfg.CONF.register_opts(l3_hamode_db.L3_HA_OPTS) 41 cfg.CONF.register_opts(l3_hamode_db.L3_HA_OPTS)
diff --git a/neutron/plugins/ml2/config.py b/neutron/conf/plugins/ml2/config.py
index eecafd7..b82083a 100644
--- a/neutron/plugins/ml2/config.py
+++ b/neutron/conf/plugins/ml2/config.py
@@ -69,4 +69,5 @@ ml2_opts = [
69] 69]
70 70
71 71
72cfg.CONF.register_opts(ml2_opts, "ml2") 72def register_ml2_plugin_opts(cfg=cfg.CONF):
73 cfg.register_opts(ml2_opts, "ml2")
diff --git a/neutron/opts.py b/neutron/opts.py
index 6fce03b..5415899 100644
--- a/neutron/opts.py
+++ b/neutron/opts.py
@@ -33,6 +33,7 @@ import neutron.conf.agent.xenapi_conf
33import neutron.conf.cache_utils 33import neutron.conf.cache_utils
34import neutron.conf.common 34import neutron.conf.common
35import neutron.conf.extensions.allowedaddresspairs 35import neutron.conf.extensions.allowedaddresspairs
36import neutron.conf.plugins.ml2.config
36import neutron.conf.plugins.ml2.drivers.agent 37import neutron.conf.plugins.ml2.drivers.agent
37import neutron.conf.plugins.ml2.drivers.driver_type 38import neutron.conf.plugins.ml2.drivers.driver_type
38import neutron.conf.plugins.ml2.drivers.linuxbridge 39import neutron.conf.plugins.ml2.drivers.linuxbridge
@@ -54,7 +55,6 @@ import neutron.db.l3_hamode_db
54import neutron.db.migration.cli 55import neutron.db.migration.cli
55import neutron.extensions.l3 56import neutron.extensions.l3
56import neutron.extensions.securitygroup 57import neutron.extensions.securitygroup
57import neutron.plugins.ml2.config
58import neutron.plugins.ml2.drivers.mech_sriov.agent.common.config 58import neutron.plugins.ml2.drivers.mech_sriov.agent.common.config
59import neutron.wsgi 59import neutron.wsgi
60 60
@@ -235,7 +235,7 @@ def list_metering_agent_opts():
235def list_ml2_conf_opts(): 235def list_ml2_conf_opts():
236 return [ 236 return [
237 ('ml2', 237 ('ml2',
238 neutron.plugins.ml2.config.ml2_opts), 238 neutron.conf.plugins.ml2.config.ml2_opts),
239 ('ml2_type_flat', 239 ('ml2_type_flat',
240 neutron.conf.plugins.ml2.drivers.driver_type.flat_opts), 240 neutron.conf.plugins.ml2.drivers.driver_type.flat_opts),
241 ('ml2_type_vlan', 241 ('ml2_type_vlan',
diff --git a/neutron/plugins/ml2/managers.py b/neutron/plugins/ml2/managers.py
index 0a1ebc6..0a33c8c 100644
--- a/neutron/plugins/ml2/managers.py
+++ b/neutron/plugins/ml2/managers.py
@@ -25,6 +25,7 @@ from oslo_utils import excutils
25import stevedore 25import stevedore
26 26
27from neutron._i18n import _ 27from neutron._i18n import _
28from neutron.conf.plugins.ml2 import config
28from neutron.db import api as db_api 29from neutron.db import api as db_api
29from neutron.db import segments_db 30from neutron.db import segments_db
30from neutron.extensions import external_net 31from neutron.extensions import external_net
@@ -37,6 +38,7 @@ from neutron.plugins.ml2 import models
37LOG = log.getLogger(__name__) 38LOG = log.getLogger(__name__)
38 39
39MAX_BINDING_LEVELS = 10 40MAX_BINDING_LEVELS = 10
41config.register_ml2_plugin_opts()
40 42
41 43
42class TypeManager(stevedore.named.NamedExtensionManager): 44class TypeManager(stevedore.named.NamedExtensionManager):
diff --git a/neutron/plugins/ml2/plugin.py b/neutron/plugins/ml2/plugin.py
index 138a469..412156f 100644
--- a/neutron/plugins/ml2/plugin.py
+++ b/neutron/plugins/ml2/plugin.py
@@ -81,7 +81,6 @@ from neutron.extensions import providernet as provider
81from neutron.extensions import vlantransparent 81from neutron.extensions import vlantransparent
82from neutron.plugins.common import utils as p_utils 82from neutron.plugins.common import utils as p_utils
83from neutron.plugins.ml2.common import exceptions as ml2_exc 83from neutron.plugins.ml2.common import exceptions as ml2_exc
84from neutron.plugins.ml2 import config # noqa
85from neutron.plugins.ml2 import db 84from neutron.plugins.ml2 import db
86from neutron.plugins.ml2 import driver_context 85from neutron.plugins.ml2 import driver_context
87from neutron.plugins.ml2.extensions import qos as qos_ext 86from neutron.plugins.ml2.extensions import qos as qos_ext
diff --git a/neutron/tests/unit/extensions/test_dns.py b/neutron/tests/unit/extensions/test_dns.py
index 6033d29..6c5f567 100644
--- a/neutron/tests/unit/extensions/test_dns.py
+++ b/neutron/tests/unit/extensions/test_dns.py
@@ -23,7 +23,6 @@ from oslo_config import cfg
23from neutron.common import utils 23from neutron.common import utils
24from neutron.db import db_base_plugin_v2 24from neutron.db import db_base_plugin_v2
25from neutron.extensions import dns 25from neutron.extensions import dns
26from neutron.plugins.ml2 import config
27from neutron.tests.unit.db import test_db_base_plugin_v2 26from neutron.tests.unit.db import test_db_base_plugin_v2
28from neutron.tests.unit.plugins.ml2 import test_plugin 27from neutron.tests.unit.plugins.ml2 import test_plugin
29 28
@@ -57,9 +56,9 @@ class DnsExtensionTestCase(test_plugin.Ml2PluginV2TestCase):
57 _extension_drivers = ['dns'] 56 _extension_drivers = ['dns']
58 57
59 def setUp(self): 58 def setUp(self):
60 config.cfg.CONF.set_override('extension_drivers', 59 cfg.CONF.set_override('extension_drivers',
61 self._extension_drivers, 60 self._extension_drivers,
62 group='ml2') 61 group='ml2')
63 super(DnsExtensionTestCase, self).setUp() 62 super(DnsExtensionTestCase, self).setUp()
64 63
65 def _create_network(self, fmt, name, admin_state_up, 64 def _create_network(self, fmt, name, admin_state_up,
diff --git a/neutron/tests/unit/extensions/test_l3.py b/neutron/tests/unit/extensions/test_l3.py
index fd29d7f..3e2dc86 100644
--- a/neutron/tests/unit/extensions/test_l3.py
+++ b/neutron/tests/unit/extensions/test_l3.py
@@ -55,7 +55,6 @@ from neutron.db import models_v2
55from neutron.extensions import dns 55from neutron.extensions import dns
56from neutron.extensions import external_net 56from neutron.extensions import external_net
57from neutron.extensions import l3 57from neutron.extensions import l3
58from neutron.plugins.ml2 import config
59from neutron.services.revisions import revision_plugin 58from neutron.services.revisions import revision_plugin
60from neutron.tests import base 59from neutron.tests import base
61from neutron.tests.common import helpers 60from neutron.tests.common import helpers
@@ -4004,12 +4003,12 @@ class L3NatDBFloatingIpTestCaseWithDNS(L3BaseForSepTests, L3NatTestCaseMixin):
4004 def setUp(self): 4003 def setUp(self):
4005 ext_mgr = L3TestExtensionManagerWithDNS() 4004 ext_mgr = L3TestExtensionManagerWithDNS()
4006 plugin = 'neutron.plugins.ml2.plugin.Ml2Plugin' 4005 plugin = 'neutron.plugins.ml2.plugin.Ml2Plugin'
4007 config.cfg.CONF.set_override('extension_drivers', 4006 cfg.CONF.set_override('extension_drivers',
4008 self._extension_drivers, 4007 self._extension_drivers,
4009 group='ml2') 4008 group='ml2')
4010 super(L3NatDBFloatingIpTestCaseWithDNS, self).setUp(plugin=plugin, 4009 super(L3NatDBFloatingIpTestCaseWithDNS, self).setUp(plugin=plugin,
4011 ext_mgr=ext_mgr) 4010 ext_mgr=ext_mgr)
4012 config.cfg.CONF.set_override('external_dns_driver', 'designate') 4011 cfg.CONF.set_override('external_dns_driver', 'designate')
4013 self.mock_client.reset_mock() 4012 self.mock_client.reset_mock()
4014 self.mock_admin_client.reset_mock() 4013 self.mock_admin_client.reset_mock()
4015 4014
@@ -4096,8 +4095,8 @@ class L3NatDBFloatingIpTestCaseWithDNS(L3BaseForSepTests, L3NatTestCaseMixin):
4096 def _get_bytes_or_nybles_to_skip(self, in_addr_name): 4095 def _get_bytes_or_nybles_to_skip(self, in_addr_name):
4097 if 'in-addr.arpa' in in_addr_name: 4096 if 'in-addr.arpa' in in_addr_name:
4098 return (( 4097 return ((
4099 32 - config.cfg.CONF.designate.ipv4_ptr_zone_prefix_size) / 8) 4098 32 - cfg.CONF.designate.ipv4_ptr_zone_prefix_size) / 8)
4100 return (128 - config.cfg.CONF.designate.ipv6_ptr_zone_prefix_size) / 4 4099 return (128 - cfg.CONF.designate.ipv6_ptr_zone_prefix_size) / 4
4101 4100
4102 def _get_in_addr(self, record): 4101 def _get_in_addr(self, record):
4103 in_addr_name = netaddr.IPAddress(record).reverse_dns 4102 in_addr_name = netaddr.IPAddress(record).reverse_dns
@@ -4133,7 +4132,7 @@ class L3NatDBFloatingIpTestCaseWithDNS(L3BaseForSepTests, L3NatTestCaseMixin):
4133 4132
4134 @mock.patch(MOCK_PATH, **mock_config) 4133 @mock.patch(MOCK_PATH, **mock_config)
4135 def test_floatingip_create_with_net_port_dns(self, mock_args): 4134 def test_floatingip_create_with_net_port_dns(self, mock_args):
4136 config.cfg.CONF.set_override('dns_domain', self.DNS_DOMAIN) 4135 cfg.CONF.set_override('dns_domain', self.DNS_DOMAIN)
4137 with self._create_floatingip_with_dns(net_dns_domain=self.DNS_DOMAIN, 4136 with self._create_floatingip_with_dns(net_dns_domain=self.DNS_DOMAIN,
4138 port_dns_name=self.DNS_NAME, assoc_port=True) as flip: 4137 port_dns_name=self.DNS_NAME, assoc_port=True) as flip:
4139 floatingip = flip 4138 floatingip = flip
@@ -4143,7 +4142,7 @@ class L3NatDBFloatingIpTestCaseWithDNS(L3BaseForSepTests, L3NatTestCaseMixin):
4143 def test_floatingip_create_with_flip_and_net_port_dns(self, mock_args): 4142 def test_floatingip_create_with_flip_and_net_port_dns(self, mock_args):
4144 # If both network+port and the floating ip have dns domain and 4143 # If both network+port and the floating ip have dns domain and
4145 # dns name, floating ip's information should take priority 4144 # dns name, floating ip's information should take priority
4146 config.cfg.CONF.set_override('dns_domain', self.DNS_DOMAIN) 4145 cfg.CONF.set_override('dns_domain', self.DNS_DOMAIN)
4147 with self._create_floatingip_with_dns(net_dns_domain='junkdomain.org.', 4146 with self._create_floatingip_with_dns(net_dns_domain='junkdomain.org.',
4148 port_dns_name='junk', flip_dns_domain=self.DNS_DOMAIN, 4147 port_dns_name='junk', flip_dns_domain=self.DNS_DOMAIN,
4149 flip_dns_name=self.DNS_NAME, assoc_port=True) as flip: 4148 flip_dns_name=self.DNS_NAME, assoc_port=True) as flip:
@@ -4173,7 +4172,7 @@ class L3NatDBFloatingIpTestCaseWithDNS(L3BaseForSepTests, L3NatTestCaseMixin):
4173 4172
4174 @mock.patch(MOCK_PATH, **mock_config) 4173 @mock.patch(MOCK_PATH, **mock_config)
4175 def test_floatingip_associate_port_with_net_port_dns(self, mock_args): 4174 def test_floatingip_associate_port_with_net_port_dns(self, mock_args):
4176 config.cfg.CONF.set_override('dns_domain', self.DNS_DOMAIN) 4175 cfg.CONF.set_override('dns_domain', self.DNS_DOMAIN)
4177 with self._create_floatingip_with_dns_on_update( 4176 with self._create_floatingip_with_dns_on_update(
4178 net_dns_domain=self.DNS_DOMAIN, 4177 net_dns_domain=self.DNS_DOMAIN,
4179 port_dns_name=self.DNS_NAME) as flip: 4178 port_dns_name=self.DNS_NAME) as flip:
@@ -4185,7 +4184,7 @@ class L3NatDBFloatingIpTestCaseWithDNS(L3BaseForSepTests, L3NatTestCaseMixin):
4185 mock_args): 4184 mock_args):
4186 # If both network+port and the floating ip have dns domain and 4185 # If both network+port and the floating ip have dns domain and
4187 # dns name, floating ip's information should take priority 4186 # dns name, floating ip's information should take priority
4188 config.cfg.CONF.set_override('dns_domain', self.DNS_DOMAIN) 4187 cfg.CONF.set_override('dns_domain', self.DNS_DOMAIN)
4189 with self._create_floatingip_with_dns_on_update( 4188 with self._create_floatingip_with_dns_on_update(
4190 net_dns_domain='junkdomain.org.', 4189 net_dns_domain='junkdomain.org.',
4191 port_dns_name='junk', 4190 port_dns_name='junk',
@@ -4198,7 +4197,7 @@ class L3NatDBFloatingIpTestCaseWithDNS(L3BaseForSepTests, L3NatTestCaseMixin):
4198 4197
4199 @mock.patch(MOCK_PATH, **mock_config) 4198 @mock.patch(MOCK_PATH, **mock_config)
4200 def test_floatingip_disassociate_port(self, mock_args): 4199 def test_floatingip_disassociate_port(self, mock_args):
4201 config.cfg.CONF.set_override('dns_domain', self.DNS_DOMAIN) 4200 cfg.CONF.set_override('dns_domain', self.DNS_DOMAIN)
4202 with self._create_floatingip_with_dns(net_dns_domain=self.DNS_DOMAIN, 4201 with self._create_floatingip_with_dns(net_dns_domain=self.DNS_DOMAIN,
4203 port_dns_name=self.DNS_NAME, assoc_port=True) as flip: 4202 port_dns_name=self.DNS_NAME, assoc_port=True) as flip:
4204 fake_recordset = {'id': '', 4203 fake_recordset = {'id': '',
@@ -4224,7 +4223,7 @@ class L3NatDBFloatingIpTestCaseWithDNS(L3BaseForSepTests, L3NatTestCaseMixin):
4224 4223
4225 @mock.patch(MOCK_PATH, **mock_config) 4224 @mock.patch(MOCK_PATH, **mock_config)
4226 def test_floatingip_delete(self, mock_args): 4225 def test_floatingip_delete(self, mock_args):
4227 config.cfg.CONF.set_override('dns_domain', self.DNS_DOMAIN) 4226 cfg.CONF.set_override('dns_domain', self.DNS_DOMAIN)
4228 with self._create_floatingip_with_dns(flip_dns_domain=self.DNS_DOMAIN, 4227 with self._create_floatingip_with_dns(flip_dns_domain=self.DNS_DOMAIN,
4229 flip_dns_name=self.DNS_NAME) as flip: 4228 flip_dns_name=self.DNS_NAME) as flip:
4230 floatingip = flip 4229 floatingip = flip
@@ -4243,13 +4242,13 @@ class L3NatDBFloatingIpTestCaseWithDNS(L3BaseForSepTests, L3NatTestCaseMixin):
4243 4242
4244 @mock.patch(MOCK_PATH, **mock_config) 4243 @mock.patch(MOCK_PATH, **mock_config)
4245 def test_floatingip_no_PTR_record(self, mock_args): 4244 def test_floatingip_no_PTR_record(self, mock_args):
4246 config.cfg.CONF.set_override('dns_domain', self.DNS_DOMAIN) 4245 cfg.CONF.set_override('dns_domain', self.DNS_DOMAIN)
4247 4246
4248 # Disabling this option should stop the admin client from creating 4247 # Disabling this option should stop the admin client from creating
4249 # PTR records. So set this option and make sure the admin client 4248 # PTR records. So set this option and make sure the admin client
4250 # wasn't called to create any records 4249 # wasn't called to create any records
4251 config.cfg.CONF.set_override('allow_reverse_dns_lookup', False, 4250 cfg.CONF.set_override('allow_reverse_dns_lookup', False,
4252 group='designate') 4251 group='designate')
4253 4252
4254 with self._create_floatingip_with_dns(flip_dns_domain=self.DNS_DOMAIN, 4253 with self._create_floatingip_with_dns(flip_dns_domain=self.DNS_DOMAIN,
4255 flip_dns_name=self.DNS_NAME) as flip: 4254 flip_dns_name=self.DNS_NAME) as flip:
diff --git a/neutron/tests/unit/extensions/test_segment.py b/neutron/tests/unit/extensions/test_segment.py
index dd38dd3..91a7d90 100644
--- a/neutron/tests/unit/extensions/test_segment.py
+++ b/neutron/tests/unit/extensions/test_segment.py
@@ -44,7 +44,6 @@ from neutron.extensions import l2_adjacency
44from neutron.extensions import segment as ext_segment 44from neutron.extensions import segment as ext_segment
45from neutron.objects import network 45from neutron.objects import network
46from neutron.plugins.common import constants as p_constants 46from neutron.plugins.common import constants as p_constants
47from neutron.plugins.ml2 import config
48from neutron.services.segments import db 47from neutron.services.segments import db
49from neutron.services.segments import exceptions as segment_exc 48from neutron.services.segments import exceptions as segment_exc
50from neutron.services.segments import placement_client 49from neutron.services.segments import placement_client
@@ -472,9 +471,9 @@ class HostSegmentMappingTestCase(SegmentTestCase):
472 _mechanism_drivers = ['logger'] 471 _mechanism_drivers = ['logger']
473 472
474 def setUp(self, plugin=None): 473 def setUp(self, plugin=None):
475 config.cfg.CONF.set_override('mechanism_drivers', 474 cfg.CONF.set_override('mechanism_drivers',
476 self._mechanism_drivers, 475 self._mechanism_drivers,
477 group='ml2') 476 group='ml2')
478 477
479 # NOTE(dasm): ml2_type_vlan requires to be registered before used. 478 # NOTE(dasm): ml2_type_vlan requires to be registered before used.
480 # This piece was refactored and removed from .config, so it causes 479 # This piece was refactored and removed from .config, so it causes
@@ -482,9 +481,9 @@ class HostSegmentMappingTestCase(SegmentTestCase):
482 # There is no problem when tests are running without debugger. 481 # There is no problem when tests are running without debugger.
483 driver_type.register_ml2_drivers_vlan_opts() 482 driver_type.register_ml2_drivers_vlan_opts()
484 483
485 config.cfg.CONF.set_override('network_vlan_ranges', 484 cfg.CONF.set_override('network_vlan_ranges',
486 ['phys_net1', 'phys_net2'], 485 ['phys_net1', 'phys_net2'],
487 group='ml2_type_vlan') 486 group='ml2_type_vlan')
488 if not plugin: 487 if not plugin:
489 plugin = 'ml2' 488 plugin = 'ml2'
490 super(HostSegmentMappingTestCase, self).setUp(plugin=plugin) 489 super(HostSegmentMappingTestCase, self).setUp(plugin=plugin)
@@ -1434,7 +1433,7 @@ class TestSegmentAwareIpamML2(TestSegmentAwareIpam):
1434 # a problem, when tests are executed with pdb. 1433 # a problem, when tests are executed with pdb.
1435 # There is no problem when tests are running without debugger. 1434 # There is no problem when tests are running without debugger.
1436 driver_type.register_ml2_drivers_vlan_opts() 1435 driver_type.register_ml2_drivers_vlan_opts()
1437 config.cfg.CONF.set_override( 1436 cfg.CONF.set_override(
1438 'network_vlan_ranges', 1437 'network_vlan_ranges',
1439 ['physnet:%s:%s' % (self.VLAN_MIN, self.VLAN_MAX), 1438 ['physnet:%s:%s' % (self.VLAN_MIN, self.VLAN_MAX),
1440 'physnet0:%s:%s' % (self.VLAN_MIN, self.VLAN_MAX), 1439 'physnet0:%s:%s' % (self.VLAN_MIN, self.VLAN_MAX),
@@ -1456,13 +1455,13 @@ class TestNovaSegmentNotifier(SegmentAwareIpamTestCase):
1456 _mechanism_drivers = ['openvswitch', 'logger'] 1455 _mechanism_drivers = ['openvswitch', 'logger']
1457 1456
1458 def setUp(self): 1457 def setUp(self):
1459 config.cfg.CONF.set_override('mechanism_drivers', 1458 cfg.CONF.set_override('mechanism_drivers',
1460 self._mechanism_drivers, 1459 self._mechanism_drivers,
1461 group='ml2') 1460 group='ml2')
1462 config.cfg.CONF.set_override('network_vlan_ranges', 1461 cfg.CONF.set_override('network_vlan_ranges',
1463 ['physnet:200:209', 'physnet0:200:209', 1462 ['physnet:200:209', 'physnet0:200:209',
1464 'physnet1:200:209', 'physnet2:200:209'], 1463 'physnet1:200:209', 'physnet2:200:209'],
1465 group='ml2_type_vlan') 1464 group='ml2_type_vlan')
1466 super(TestNovaSegmentNotifier, self).setUp(plugin='ml2') 1465 super(TestNovaSegmentNotifier, self).setUp(plugin='ml2')
1467 # Need notifier here 1466 # Need notifier here
1468 self.patch_notifier.stop() 1467 self.patch_notifier.stop()
diff --git a/neutron/tests/unit/plugins/ml2/drivers/base_type_tunnel.py b/neutron/tests/unit/plugins/ml2/drivers/base_type_tunnel.py
index 1eed54e..803ef80 100644
--- a/neutron/tests/unit/plugins/ml2/drivers/base_type_tunnel.py
+++ b/neutron/tests/unit/plugins/ml2/drivers/base_type_tunnel.py
@@ -17,12 +17,12 @@ import mock
17from neutron_lib import context 17from neutron_lib import context
18from neutron_lib import exceptions as exc 18from neutron_lib import exceptions as exc
19from neutron_lib.plugins.ml2 import api 19from neutron_lib.plugins.ml2 import api
20from oslo_config import cfg
20from six import moves 21from six import moves
21import testtools 22import testtools
22from testtools import matchers 23from testtools import matchers
23 24
24from neutron.plugins.common import constants as p_const 25from neutron.plugins.common import constants as p_const
25from neutron.plugins.ml2 import config
26from neutron.plugins.ml2.drivers import type_tunnel 26from neutron.plugins.ml2.drivers import type_tunnel
27 27
28TUNNEL_IP_ONE = "10.10.10.10" 28TUNNEL_IP_ONE = "10.10.10.10"
@@ -359,7 +359,7 @@ class TunnelRpcCallbackTestMixin(object):
359 self._test_tunnel_sync(kwargs) 359 self._test_tunnel_sync(kwargs)
360 360
361 def test_tunnel_sync_called_with_host_passed_ipv6(self): 361 def test_tunnel_sync_called_with_host_passed_ipv6(self):
362 config.cfg.CONF.set_override('overlay_ip_version', 6, group='ml2') 362 cfg.CONF.set_override('overlay_ip_version', 6, group='ml2')
363 kwargs = {'tunnel_ip': TUNNEL_IPV6_ONE, 'tunnel_type': self.TYPE, 363 kwargs = {'tunnel_ip': TUNNEL_IPV6_ONE, 'tunnel_type': self.TYPE,
364 'host': HOST_ONE} 364 'host': HOST_ONE}
365 self._test_tunnel_sync(kwargs) 365 self._test_tunnel_sync(kwargs)
@@ -402,13 +402,13 @@ class TunnelRpcCallbackTestMixin(object):
402 self._test_tunnel_sync_raises(kwargs) 402 self._test_tunnel_sync_raises(kwargs)
403 403
404 def test_tunnel_sync_called_with_tunnel_overlay_mismatch(self): 404 def test_tunnel_sync_called_with_tunnel_overlay_mismatch(self):
405 config.cfg.CONF.set_override('overlay_ip_version', 6, group='ml2') 405 cfg.CONF.set_override('overlay_ip_version', 6, group='ml2')
406 kwargs = {'tunnel_ip': TUNNEL_IP_ONE, 'tunnel_type': self.TYPE, 406 kwargs = {'tunnel_ip': TUNNEL_IP_ONE, 'tunnel_type': self.TYPE,
407 'host': HOST_ONE} 407 'host': HOST_ONE}
408 self._test_tunnel_sync_raises(kwargs) 408 self._test_tunnel_sync_raises(kwargs)
409 409
410 def test_tunnel_sync_called_with_tunnel_overlay_mismatch_ipv6(self): 410 def test_tunnel_sync_called_with_tunnel_overlay_mismatch_ipv6(self):
411 config.cfg.CONF.set_override('overlay_ip_version', 4, group='ml2') 411 cfg.CONF.set_override('overlay_ip_version', 4, group='ml2')
412 kwargs = {'tunnel_ip': TUNNEL_IPV6_ONE, 'tunnel_type': self.TYPE, 412 kwargs = {'tunnel_ip': TUNNEL_IPV6_ONE, 'tunnel_type': self.TYPE,
413 'host': HOST_ONE} 413 'host': HOST_ONE}
414 self._test_tunnel_sync_raises(kwargs) 414 self._test_tunnel_sync_raises(kwargs)
@@ -425,30 +425,30 @@ class TunnelTypeMTUTestMixin(object):
425 self.driver = self.DRIVER_CLASS() 425 self.driver = self.DRIVER_CLASS()
426 426
427 def _test_get_mtu(self, ip_version): 427 def _test_get_mtu(self, ip_version):
428 config.cfg.CONF.set_override('overlay_ip_version', ip_version, 428 cfg.CONF.set_override('overlay_ip_version', ip_version,
429 group='ml2') 429 group='ml2')
430 ip_header_length = p_const.IP_HEADER_LENGTH[ip_version] 430 ip_header_length = p_const.IP_HEADER_LENGTH[ip_version]
431 431
432 config.cfg.CONF.set_override('global_physnet_mtu', 1500) 432 cfg.CONF.set_override('global_physnet_mtu', 1500)
433 config.cfg.CONF.set_override('path_mtu', 1475, group='ml2') 433 cfg.CONF.set_override('path_mtu', 1475, group='ml2')
434 self.driver.physnet_mtus = {'physnet1': 1450, 'physnet2': 1400} 434 self.driver.physnet_mtus = {'physnet1': 1450, 'physnet2': 1400}
435 self.assertEqual(1475 - self.ENCAP_OVERHEAD - ip_header_length, 435 self.assertEqual(1475 - self.ENCAP_OVERHEAD - ip_header_length,
436 self.driver.get_mtu('physnet1')) 436 self.driver.get_mtu('physnet1'))
437 437
438 config.cfg.CONF.set_override('global_physnet_mtu', 1450) 438 cfg.CONF.set_override('global_physnet_mtu', 1450)
439 config.cfg.CONF.set_override('path_mtu', 1475, group='ml2') 439 cfg.CONF.set_override('path_mtu', 1475, group='ml2')
440 self.driver.physnet_mtus = {'physnet1': 1400, 'physnet2': 1425} 440 self.driver.physnet_mtus = {'physnet1': 1400, 'physnet2': 1425}
441 self.assertEqual(1450 - self.ENCAP_OVERHEAD - ip_header_length, 441 self.assertEqual(1450 - self.ENCAP_OVERHEAD - ip_header_length,
442 self.driver.get_mtu('physnet1')) 442 self.driver.get_mtu('physnet1'))
443 443
444 config.cfg.CONF.set_override('global_physnet_mtu', 0) 444 cfg.CONF.set_override('global_physnet_mtu', 0)
445 config.cfg.CONF.set_override('path_mtu', 1450, group='ml2') 445 cfg.CONF.set_override('path_mtu', 1450, group='ml2')
446 self.driver.physnet_mtus = {'physnet1': 1425, 'physnet2': 1400} 446 self.driver.physnet_mtus = {'physnet1': 1425, 'physnet2': 1400}
447 self.assertEqual(1450 - self.ENCAP_OVERHEAD - ip_header_length, 447 self.assertEqual(1450 - self.ENCAP_OVERHEAD - ip_header_length,
448 self.driver.get_mtu('physnet1')) 448 self.driver.get_mtu('physnet1'))
449 449
450 config.cfg.CONF.set_override('global_physnet_mtu', 0) 450 cfg.CONF.set_override('global_physnet_mtu', 0)
451 config.cfg.CONF.set_override('path_mtu', 0, group='ml2') 451 cfg.CONF.set_override('path_mtu', 0, group='ml2')
452 self.driver.physnet_mtus = {} 452 self.driver.physnet_mtus = {}
453 self.assertEqual(0, self.driver.get_mtu('physnet1')) 453 self.assertEqual(0, self.driver.get_mtu('physnet1'))
454 454
diff --git a/neutron/tests/unit/plugins/ml2/drivers/test_type_flat.py b/neutron/tests/unit/plugins/ml2/drivers/test_type_flat.py
index 6eb522c..4246422 100644
--- a/neutron/tests/unit/plugins/ml2/drivers/test_type_flat.py
+++ b/neutron/tests/unit/plugins/ml2/drivers/test_type_flat.py
@@ -16,11 +16,11 @@
16from neutron_lib import context 16from neutron_lib import context
17from neutron_lib import exceptions as exc 17from neutron_lib import exceptions as exc
18from neutron_lib.plugins.ml2 import api 18from neutron_lib.plugins.ml2 import api
19from oslo_config import cfg
19 20
20from neutron.common import exceptions as n_exc 21from neutron.common import exceptions as n_exc
21from neutron.objects.plugins.ml2 import flatallocation as flat_obj 22from neutron.objects.plugins.ml2 import flatallocation as flat_obj
22from neutron.plugins.common import constants as p_const 23from neutron.plugins.common import constants as p_const
23from neutron.plugins.ml2 import config
24from neutron.plugins.ml2.drivers import type_flat 24from neutron.plugins.ml2.drivers import type_flat
25from neutron.tests import base 25from neutron.tests import base
26from neutron.tests.unit import testlib_api 26from neutron.tests.unit import testlib_api
@@ -35,7 +35,7 @@ class FlatTypeTest(testlib_api.SqlTestCase):
35 def setUp(self): 35 def setUp(self):
36 super(FlatTypeTest, self).setUp() 36 super(FlatTypeTest, self).setUp()
37 self.setup_coreplugin(CORE_PLUGIN) 37 self.setup_coreplugin(CORE_PLUGIN)
38 config.cfg.CONF.set_override('flat_networks', FLAT_NETWORKS, 38 cfg.CONF.set_override('flat_networks', FLAT_NETWORKS,
39 group='ml2_type_flat') 39 group='ml2_type_flat')
40 self.driver = type_flat.FlatTypeDriver() 40 self.driver = type_flat.FlatTypeDriver()
41 self.context = context.Context() 41 self.context = context.Context()
@@ -127,28 +127,28 @@ class FlatTypeTest(testlib_api.SqlTestCase):
127 self.assertIsNone(observed) 127 self.assertIsNone(observed)
128 128
129 def test_get_mtu(self): 129 def test_get_mtu(self):
130 config.cfg.CONF.set_override('global_physnet_mtu', 1475) 130 cfg.CONF.set_override('global_physnet_mtu', 1475)
131 config.cfg.CONF.set_override('path_mtu', 1400, group='ml2') 131 cfg.CONF.set_override('path_mtu', 1400, group='ml2')
132 self.driver.physnet_mtus = {'physnet1': 1450, 'physnet2': 1400} 132 self.driver.physnet_mtus = {'physnet1': 1450, 'physnet2': 1400}
133 self.assertEqual(1450, self.driver.get_mtu('physnet1')) 133 self.assertEqual(1450, self.driver.get_mtu('physnet1'))
134 134
135 config.cfg.CONF.set_override('global_physnet_mtu', 1375) 135 cfg.CONF.set_override('global_physnet_mtu', 1375)
136 config.cfg.CONF.set_override('path_mtu', 1400, group='ml2') 136 cfg.CONF.set_override('path_mtu', 1400, group='ml2')
137 self.driver.physnet_mtus = {'physnet1': 1450, 'physnet2': 1400} 137 self.driver.physnet_mtus = {'physnet1': 1450, 'physnet2': 1400}
138 self.assertEqual(1375, self.driver.get_mtu('physnet1')) 138 self.assertEqual(1375, self.driver.get_mtu('physnet1'))
139 139
140 config.cfg.CONF.set_override('global_physnet_mtu', 0) 140 cfg.CONF.set_override('global_physnet_mtu', 0)
141 config.cfg.CONF.set_override('path_mtu', 1425, group='ml2') 141 cfg.CONF.set_override('path_mtu', 1425, group='ml2')
142 self.driver.physnet_mtus = {'physnet1': 1450, 'physnet2': 1400} 142 self.driver.physnet_mtus = {'physnet1': 1450, 'physnet2': 1400}
143 self.assertEqual(1400, self.driver.get_mtu('physnet2')) 143 self.assertEqual(1400, self.driver.get_mtu('physnet2'))
144 144
145 config.cfg.CONF.set_override('global_physnet_mtu', 0) 145 cfg.CONF.set_override('global_physnet_mtu', 0)
146 config.cfg.CONF.set_override('path_mtu', 0, group='ml2') 146 cfg.CONF.set_override('path_mtu', 0, group='ml2')
147 self.driver.physnet_mtus = {} 147 self.driver.physnet_mtus = {}
148 self.assertEqual(0, self.driver.get_mtu('physnet1')) 148 self.assertEqual(0, self.driver.get_mtu('physnet1'))
149 149
150 def test_parse_physical_network_mtus(self): 150 def test_parse_physical_network_mtus(self):
151 config.cfg.CONF.set_override( 151 cfg.CONF.set_override(
152 'physical_network_mtus', 152 'physical_network_mtus',
153 ['physnet1:1500', 'physnet2:1500', 'physnet3:9000'], 153 ['physnet1:1500', 'physnet2:1500', 'physnet3:9000'],
154 group='ml2') 154 group='ml2')
diff --git a/neutron/tests/unit/plugins/ml2/drivers/test_type_vlan.py b/neutron/tests/unit/plugins/ml2/drivers/test_type_vlan.py
index 6b39fc5..a8d549d 100644
--- a/neutron/tests/unit/plugins/ml2/drivers/test_type_vlan.py
+++ b/neutron/tests/unit/plugins/ml2/drivers/test_type_vlan.py
@@ -17,13 +17,13 @@ import mock
17from neutron_lib import context 17from neutron_lib import context
18from neutron_lib import exceptions as exc 18from neutron_lib import exceptions as exc
19from neutron_lib.plugins.ml2 import api 19from neutron_lib.plugins.ml2 import api
20from oslo_config import cfg
20from testtools import matchers 21from testtools import matchers
21 22
22from neutron.db import api as db_api 23from neutron.db import api as db_api
23from neutron.objects.plugins.ml2 import vlanallocation as vlan_alloc_obj 24from neutron.objects.plugins.ml2 import vlanallocation as vlan_alloc_obj
24from neutron.plugins.common import constants as p_const 25from neutron.plugins.common import constants as p_const
25from neutron.plugins.common import utils as plugin_utils 26from neutron.plugins.common import utils as plugin_utils
26from neutron.plugins.ml2 import config
27from neutron.plugins.ml2.drivers import type_vlan 27from neutron.plugins.ml2.drivers import type_vlan
28from neutron.tests.unit import testlib_api 28from neutron.tests.unit import testlib_api
29 29
@@ -44,9 +44,9 @@ class VlanTypeTest(testlib_api.SqlTestCase):
44 44
45 def setUp(self): 45 def setUp(self):
46 super(VlanTypeTest, self).setUp() 46 super(VlanTypeTest, self).setUp()
47 config.cfg.CONF.set_override('network_vlan_ranges', 47 cfg.CONF.set_override('network_vlan_ranges',
48 NETWORK_VLAN_RANGES, 48 NETWORK_VLAN_RANGES,
49 group='ml2_type_vlan') 49 group='ml2_type_vlan')
50 self.network_vlan_ranges = plugin_utils.parse_network_vlan_ranges( 50 self.network_vlan_ranges = plugin_utils.parse_network_vlan_ranges(
51 NETWORK_VLAN_RANGES) 51 NETWORK_VLAN_RANGES)
52 self.driver = type_vlan.VlanTypeDriver() 52 self.driver = type_vlan.VlanTypeDriver()
@@ -218,23 +218,23 @@ class VlanTypeTest(testlib_api.SqlTestCase):
218 segment) 218 segment)
219 219
220 def test_get_mtu(self): 220 def test_get_mtu(self):
221 config.cfg.CONF.set_override('global_physnet_mtu', 1475) 221 cfg.CONF.set_override('global_physnet_mtu', 1475)
222 config.cfg.CONF.set_override('path_mtu', 1400, group='ml2') 222 cfg.CONF.set_override('path_mtu', 1400, group='ml2')
223 self.driver.physnet_mtus = {'physnet1': 1450, 'physnet2': 1400} 223 self.driver.physnet_mtus = {'physnet1': 1450, 'physnet2': 1400}
224 self.assertEqual(1450, self.driver.get_mtu('physnet1')) 224 self.assertEqual(1450, self.driver.get_mtu('physnet1'))
225 225
226 config.cfg.CONF.set_override('global_physnet_mtu', 1375) 226 cfg.CONF.set_override('global_physnet_mtu', 1375)
227 config.cfg.CONF.set_override('path_mtu', 1400, group='ml2') 227 cfg.CONF.set_override('path_mtu', 1400, group='ml2')
228 self.driver.physnet_mtus = {'physnet1': 1450, 'physnet2': 1400} 228 self.driver.physnet_mtus = {'physnet1': 1450, 'physnet2': 1400}
229 self.assertEqual(1375, self.driver.get_mtu('physnet1')) 229 self.assertEqual(1375, self.driver.get_mtu('physnet1'))
230 230
231 config.cfg.CONF.set_override('global_physnet_mtu', 0) 231 cfg.CONF.set_override('global_physnet_mtu', 0)
232 config.cfg.CONF.set_override('path_mtu', 1400, group='ml2') 232 cfg.CONF.set_override('path_mtu', 1400, group='ml2')
233 self.driver.physnet_mtus = {'physnet1': 1450, 'physnet2': 1400} 233 self.driver.physnet_mtus = {'physnet1': 1450, 'physnet2': 1400}
234 self.assertEqual(1450, self.driver.get_mtu('physnet1')) 234 self.assertEqual(1450, self.driver.get_mtu('physnet1'))
235 235
236 config.cfg.CONF.set_override('global_physnet_mtu', 0) 236 cfg.CONF.set_override('global_physnet_mtu', 0)
237 config.cfg.CONF.set_override('path_mtu', 0, group='ml2') 237 cfg.CONF.set_override('path_mtu', 0, group='ml2')
238 self.driver.physnet_mtus = {} 238 self.driver.physnet_mtus = {}
239 self.assertEqual(0, self.driver.get_mtu('physnet1')) 239 self.assertEqual(0, self.driver.get_mtu('physnet1'))
240 240
@@ -276,17 +276,17 @@ class VlanTypeAllocationTest(testlib_api.SqlTestCase):
276 276
277 def test_allocate_tenant_segment_in_order_of_config(self): 277 def test_allocate_tenant_segment_in_order_of_config(self):
278 ranges = NETWORK_VLAN_RANGES + ['phys_net3:20:30'] 278 ranges = NETWORK_VLAN_RANGES + ['phys_net3:20:30']
279 config.cfg.CONF.set_override('network_vlan_ranges', 279 cfg.CONF.set_override('network_vlan_ranges',
280 ranges, 280 ranges,
281 group='ml2_type_vlan') 281 group='ml2_type_vlan')
282 driver = type_vlan.VlanTypeDriver() 282 driver = type_vlan.VlanTypeDriver()
283 driver.physnet_mtus = [] 283 driver.physnet_mtus = []
284 driver._sync_vlan_allocations() 284 driver._sync_vlan_allocations()
285 # swap config order from DB order after sync has happened to 285 # swap config order from DB order after sync has happened to
286 # ensure config order is followed and not DB order 286 # ensure config order is followed and not DB order
287 config.cfg.CONF.set_override('network_vlan_ranges', 287 cfg.CONF.set_override('network_vlan_ranges',
288 list(reversed(ranges)), 288 list(reversed(ranges)),
289 group='ml2_type_vlan') 289 group='ml2_type_vlan')
290 driver._parse_network_vlan_ranges() 290 driver._parse_network_vlan_ranges()
291 ctx = context.Context() 291 ctx = context.Context()
292 for vlan in range(11): 292 for vlan in range(11):
diff --git a/neutron/tests/unit/plugins/ml2/extensions/test_data_plane_status.py b/neutron/tests/unit/plugins/ml2/extensions/test_data_plane_status.py
index 25abbd8..6699ef5 100644
--- a/neutron/tests/unit/plugins/ml2/extensions/test_data_plane_status.py
+++ b/neutron/tests/unit/plugins/ml2/extensions/test_data_plane_status.py
@@ -19,8 +19,8 @@ from neutron_lib.api.definitions import port as port_def
19from neutron_lib import constants 19from neutron_lib import constants
20from neutron_lib import context 20from neutron_lib import context
21from neutron_lib.plugins import directory 21from neutron_lib.plugins import directory
22from oslo_config import cfg
22 23
23from neutron.plugins.ml2 import config
24from neutron.plugins.ml2.extensions import data_plane_status 24from neutron.plugins.ml2.extensions import data_plane_status
25from neutron.tests.unit.plugins.ml2 import test_plugin 25from neutron.tests.unit.plugins.ml2 import test_plugin
26 26
@@ -30,9 +30,9 @@ class DataPlaneStatusSML2ExtDriverTestCase(test_plugin.Ml2PluginV2TestCase):
30 _extension_drivers = ['data_plane_status'] 30 _extension_drivers = ['data_plane_status']
31 31
32 def setUp(self): 32 def setUp(self):
33 config.cfg.CONF.set_override('extension_drivers', 33 cfg.CONF.set_override('extension_drivers',
34 self._extension_drivers, 34 self._extension_drivers,
35 group='ml2') 35 group='ml2')
36 super(DataPlaneStatusSML2ExtDriverTestCase, self).setUp() 36 super(DataPlaneStatusSML2ExtDriverTestCase, self).setUp()
37 self.plugin = directory.get_plugin() 37 self.plugin = directory.get_plugin()
38 38
diff --git a/neutron/tests/unit/plugins/ml2/extensions/test_dns_integration.py b/neutron/tests/unit/plugins/ml2/extensions/test_dns_integration.py
index 6837f97..b4625b9 100644
--- a/neutron/tests/unit/plugins/ml2/extensions/test_dns_integration.py
+++ b/neutron/tests/unit/plugins/ml2/extensions/test_dns_integration.py
@@ -21,12 +21,12 @@ from neutron_lib.api.definitions import provider_net as pnet
21from neutron_lib import constants 21from neutron_lib import constants
22from neutron_lib import context 22from neutron_lib import context
23from neutron_lib.plugins import directory 23from neutron_lib.plugins import directory
24from oslo_config import cfg
24from oslo_utils import uuidutils 25from oslo_utils import uuidutils
25import testtools 26import testtools
26 27
27from neutron.extensions import dns 28from neutron.extensions import dns
28from neutron.objects import ports as port_obj 29from neutron.objects import ports as port_obj
29from neutron.plugins.ml2 import config
30from neutron.plugins.ml2.extensions import dns_integration 30from neutron.plugins.ml2.extensions import dns_integration
31from neutron.services.externaldns.drivers.designate import driver 31from neutron.services.externaldns.drivers.designate import driver
32from neutron.tests.unit.plugins.ml2 import test_plugin 32from neutron.tests.unit.plugins.ml2 import test_plugin
@@ -52,17 +52,17 @@ class DNSIntegrationTestCase(test_plugin.Ml2PluginV2TestCase):
52 _domain = DNSDOMAIN 52 _domain = DNSDOMAIN
53 53
54 def setUp(self): 54 def setUp(self):
55 config.cfg.CONF.set_override('extension_drivers', 55 cfg.CONF.set_override('extension_drivers',
56 self._extension_drivers, 56 self._extension_drivers,
57 group='ml2') 57 group='ml2')
58 config.cfg.CONF.set_override('external_dns_driver', 'designate') 58 cfg.CONF.set_override('external_dns_driver', 'designate')
59 mock_client.reset_mock() 59 mock_client.reset_mock()
60 mock_admin_client.reset_mock() 60 mock_admin_client.reset_mock()
61 super(DNSIntegrationTestCase, self).setUp() 61 super(DNSIntegrationTestCase, self).setUp()
62 dns_integration.DNS_DRIVER = None 62 dns_integration.DNS_DRIVER = None
63 dns_integration.subscribe() 63 dns_integration.subscribe()
64 self.plugin = directory.get_plugin() 64 self.plugin = directory.get_plugin()
65 config.cfg.CONF.set_override('dns_domain', self._domain) 65 cfg.CONF.set_override('dns_domain', self._domain)
66 66
67 def _create_port_for_test(self, provider_net=True, dns_domain=True, 67 def _create_port_for_test(self, provider_net=True, dns_domain=True,
68 dns_name=True, ipv4=True, ipv6=True, 68 dns_name=True, ipv4=True, ipv6=True,
@@ -257,9 +257,9 @@ class DNSIntegrationTestCase(test_plugin.Ml2PluginV2TestCase):
257 if 'in-addr.arpa' in in_addr_name: 257 if 'in-addr.arpa' in in_addr_name:
258 return (( 258 return ((
259 constants.IPv4_BITS - 259 constants.IPv4_BITS -
260 config.cfg.CONF.designate.ipv4_ptr_zone_prefix_size) / 8) 260 cfg.CONF.designate.ipv4_ptr_zone_prefix_size) / 8)
261 return (constants.IPv6_BITS - 261 return (constants.IPv6_BITS -
262 config.cfg.CONF.designate.ipv6_ptr_zone_prefix_size) / 4 262 cfg.CONF.designate.ipv6_ptr_zone_prefix_size) / 4
263 263
264 def test_create_port(self, *mocks): 264 def test_create_port(self, *mocks):
265 port, dns_data_db = self._create_port_for_test() 265 port, dns_data_db = self._create_port_for_test()
@@ -278,7 +278,7 @@ class DNSIntegrationTestCase(test_plugin.Ml2PluginV2TestCase):
278 self._verify_port_dns(port, dns_data_db, dns_domain=False) 278 self._verify_port_dns(port, dns_data_db, dns_domain=False)
279 279
280 def test_create_port_no_dns_driver(self, *mocks): 280 def test_create_port_no_dns_driver(self, *mocks):
281 config.cfg.CONF.set_override('external_dns_driver', '') 281 cfg.CONF.set_override('external_dns_driver', '')
282 port, dns_data_db = self._create_port_for_test() 282 port, dns_data_db = self._create_port_for_test()
283 self._verify_port_dns(port, dns_data_db, dns_driver=False) 283 self._verify_port_dns(port, dns_data_db, dns_driver=False)
284 284
@@ -291,12 +291,12 @@ class DNSIntegrationTestCase(test_plugin.Ml2PluginV2TestCase):
291 self._verify_port_dns(port, dns_data_db) 291 self._verify_port_dns(port, dns_data_db)
292 292
293 def test_create_port_no_ptr_zones(self, *mocks): 293 def test_create_port_no_ptr_zones(self, *mocks):
294 config.cfg.CONF.set_override('allow_reverse_dns_lookup', False, 294 cfg.CONF.set_override(
295 group='designate') 295 'allow_reverse_dns_lookup', False, group='designate')
296 port, dns_data_db = self._create_port_for_test() 296 port, dns_data_db = self._create_port_for_test()
297 self._verify_port_dns(port, dns_data_db, ptr_zones=False) 297 self._verify_port_dns(port, dns_data_db, ptr_zones=False)
298 config.cfg.CONF.set_override('allow_reverse_dns_lookup', True, 298 cfg.CONF.set_override('allow_reverse_dns_lookup', True,
299 group='designate') 299 group='designate')
300 300
301 def test_update_port(self, *mocks): 301 def test_update_port(self, *mocks):
302 port, dns_data_db = self._create_port_for_test() 302 port, dns_data_db = self._create_port_for_test()
@@ -772,24 +772,24 @@ class TestDesignateClientKeystoneV2(testtools.TestCase):
772 772
773 def setUp(self): 773 def setUp(self):
774 super(TestDesignateClientKeystoneV2, self).setUp() 774 super(TestDesignateClientKeystoneV2, self).setUp()
775 config.cfg.CONF.set_override('url', 775 cfg.CONF.set_override('url',
776 self.TEST_URL, 776 self.TEST_URL,
777 group='designate') 777 group='designate')
778 config.cfg.CONF.set_override('admin_username', 778 cfg.CONF.set_override('admin_username',
779 self.TEST_ADMIN_USERNAME, 779 self.TEST_ADMIN_USERNAME,
780 group='designate') 780 group='designate')
781 config.cfg.CONF.set_override('admin_password', 781 cfg.CONF.set_override('admin_password',
782 self.TEST_ADMIN_PASSWORD, 782 self.TEST_ADMIN_PASSWORD,
783 group='designate') 783 group='designate')
784 config.cfg.CONF.set_override('admin_auth_url', 784 cfg.CONF.set_override('admin_auth_url',
785 self.TEST_ADMIN_AUTH_URL, 785 self.TEST_ADMIN_AUTH_URL,
786 group='designate') 786 group='designate')
787 config.cfg.CONF.set_override('admin_tenant_id', 787 cfg.CONF.set_override('admin_tenant_id',
788 self.TEST_ADMIN_TENANT_ID, 788 self.TEST_ADMIN_TENANT_ID,
789 group='designate') 789 group='designate')
790 config.cfg.CONF.set_override('admin_tenant_name', 790 cfg.CONF.set_override('admin_tenant_name',
791 self.TEST_ADMIN_TENANT_NAME, 791 self.TEST_ADMIN_TENANT_NAME,
792 group='designate') 792 group='designate')
793 793
794 # enforce session recalculation 794 # enforce session recalculation
795 mock.patch.object(driver, '_SESSION', new=None).start() 795 mock.patch.object(driver, '_SESSION', new=None).start()
@@ -802,21 +802,21 @@ class TestDesignateClientKeystoneV2(testtools.TestCase):
802 mock.patch.object(driver.password, 'Password').start()) 802 mock.patch.object(driver.password, 'Password').start())
803 803
804 def test_insecure_client(self): 804 def test_insecure_client(self):
805 config.cfg.CONF.set_override('insecure', 805 cfg.CONF.set_override('insecure',
806 True, 806 True,
807 group='designate') 807 group='designate')
808 driver.get_clients(self.TEST_CONTEXT) 808 driver.get_clients(self.TEST_CONTEXT)
809 self.driver_session.assert_called_with(cert=None, 809 self.driver_session.assert_called_with(cert=None,
810 timeout=None, 810 timeout=None,
811 verify=False) 811 verify=False)
812 812
813 def test_secure_client(self): 813 def test_secure_client(self):
814 config.cfg.CONF.set_override('insecure', 814 cfg.CONF.set_override('insecure',
815 False, 815 False,
816 group='designate') 816 group='designate')
817 config.cfg.CONF.set_override('cafile', 817 cfg.CONF.set_override('cafile',
818 self.TEST_CA_CERT, 818 self.TEST_CA_CERT,
819 group='designate') 819 group='designate')
820 driver.get_clients(self.TEST_CONTEXT) 820 driver.get_clients(self.TEST_CONTEXT)
821 self.driver_session.assert_called_with(cert=None, 821 self.driver_session.assert_called_with(cert=None,
822 timeout=None, 822 timeout=None,
@@ -853,32 +853,31 @@ class TestDesignateClientKeystoneV3(testtools.TestCase):
853 # Register the Password auth plugin options, 853 # Register the Password auth plugin options,
854 # so we can use CONF.set_override 854 # so we can use CONF.set_override
855 password_option = loading.get_auth_plugin_conf_options('password') 855 password_option = loading.get_auth_plugin_conf_options('password')
856 config.cfg.CONF.register_opts(password_option, group='designate') 856 cfg.CONF.register_opts(password_option, group='designate')
857 self.addCleanup( 857 self.addCleanup(
858 config.cfg.CONF.unregister_opts, 858 cfg.CONF.unregister_opts, password_option, group='designate')
859 password_option, group='designate') 859
860 860 cfg.CONF.set_override('url',
861 config.cfg.CONF.set_override('url', 861 self.TEST_URL,
862 self.TEST_URL, 862 group='designate')
863 group='designate') 863 cfg.CONF.set_override('auth_type',
864 config.cfg.CONF.set_override('auth_type', 864 'password',
865 'password', 865 group='designate')
866 group='designate') 866 cfg.CONF.set_override('username',
867 config.cfg.CONF.set_override('username', 867 self.TEST_ADMIN_USERNAME,
868 self.TEST_ADMIN_USERNAME, 868 group='designate')
869 group='designate') 869 cfg.CONF.set_override('password',
870 config.cfg.CONF.set_override('password', 870 self.TEST_ADMIN_PASSWORD,
871 self.TEST_ADMIN_PASSWORD, 871 group='designate')
872 group='designate') 872 cfg.CONF.set_override('user_domain_id',
873 config.cfg.CONF.set_override('user_domain_id', 873 self.TEST_ADMIN_USER_DOMAIN_ID,
874 self.TEST_ADMIN_USER_DOMAIN_ID, 874 group='designate')
875 group='designate') 875 cfg.CONF.set_override('project_domain_id',
876 config.cfg.CONF.set_override('project_domain_id', 876 self.TEST_ADMIN_PROJECT_DOMAIN_ID,
877 self.TEST_ADMIN_PROJECT_DOMAIN_ID, 877 group='designate')
878 group='designate') 878 cfg.CONF.set_override('auth_url',
879 config.cfg.CONF.set_override('auth_url', 879 self.TEST_ADMIN_AUTH_URL,
880 self.TEST_ADMIN_AUTH_URL, 880 group='designate')
881 group='designate')
882 881
883 # enforce session recalculation 882 # enforce session recalculation
884 mock.patch.object(driver, '_SESSION', new=None).start() 883 mock.patch.object(driver, '_SESSION', new=None).start()
@@ -891,21 +890,21 @@ class TestDesignateClientKeystoneV3(testtools.TestCase):
891 mock.patch.object(driver.password, 'Password').start()) 890 mock.patch.object(driver.password, 'Password').start())
892 891
893 def test_insecure_client(self): 892 def test_insecure_client(self):
894 config.cfg.CONF.set_override('insecure', 893 cfg.CONF.set_override('insecure',
895 True, 894 True,
896 group='designate') 895 group='designate')
897 driver.get_clients(self.TEST_CONTEXT) 896 driver.get_clients(self.TEST_CONTEXT)
898 self.driver_session.assert_called_with(cert=None, 897 self.driver_session.assert_called_with(cert=None,
899 timeout=None, 898 timeout=None,
900 verify=False) 899 verify=False)
901 900
902 def test_secure_client(self): 901 def test_secure_client(self):
903 config.cfg.CONF.set_override('insecure', 902 cfg.CONF.set_override('insecure',
904 False, 903 False,
905 group='designate') 904 group='designate')
906 config.cfg.CONF.set_override('cafile', 905 cfg.CONF.set_override('cafile',
907 self.TEST_CA_CERT, 906 self.TEST_CA_CERT,
908 group='designate') 907 group='designate')
909 driver.get_clients(self.TEST_CONTEXT) 908 driver.get_clients(self.TEST_CONTEXT)
910 self.driver_session.assert_called_with(cert=None, 909 self.driver_session.assert_called_with(cert=None,
911 timeout=None, 910 timeout=None,
@@ -913,5 +912,5 @@ class TestDesignateClientKeystoneV3(testtools.TestCase):
913 912
914 def test_auth_type_password(self): 913 def test_auth_type_password(self):
915 driver.get_clients(self.TEST_CONTEXT) 914 driver.get_clients(self.TEST_CONTEXT)
916 self.load_auth.assert_called_with(config.cfg.CONF, 'designate') 915 self.load_auth.assert_called_with(cfg.CONF, 'designate')
917 self.password.assert_not_called() 916 self.password.assert_not_called()
diff --git a/neutron/tests/unit/plugins/ml2/test_ext_portsecurity.py b/neutron/tests/unit/plugins/ml2/test_ext_portsecurity.py
index a4ad164..be1de37 100644
--- a/neutron/tests/unit/plugins/ml2/test_ext_portsecurity.py
+++ b/neutron/tests/unit/plugins/ml2/test_ext_portsecurity.py
@@ -16,8 +16,8 @@
16from neutron_lib.api.definitions import port_security as psec 16from neutron_lib.api.definitions import port_security as psec
17from neutron_lib import context 17from neutron_lib import context
18from neutron_lib.plugins import directory 18from neutron_lib.plugins import directory
19from oslo_config import cfg
19 20
20from neutron.plugins.ml2 import config
21from neutron.tests.unit.extensions import test_portsecurity as test_psec 21from neutron.tests.unit.extensions import test_portsecurity as test_psec
22from neutron.tests.unit.plugins.ml2 import test_plugin 22from neutron.tests.unit.plugins.ml2 import test_plugin
23 23
@@ -27,9 +27,9 @@ class PSExtDriverTestCase(test_plugin.Ml2PluginV2TestCase,
27 _extension_drivers = ['port_security'] 27 _extension_drivers = ['port_security']
28 28
29 def setUp(self): 29 def setUp(self):
30 config.cfg.CONF.set_override('extension_drivers', 30 cfg.CONF.set_override('extension_drivers',
31 self._extension_drivers, 31 self._extension_drivers,
32 group='ml2') 32 group='ml2')
33 super(PSExtDriverTestCase, self).setUp() 33 super(PSExtDriverTestCase, self).setUp()
34 34
35 def test_create_net_port_security_default(self): 35 def test_create_net_port_security_default(self):
diff --git a/neutron/tests/unit/plugins/ml2/test_extension_driver_api.py b/neutron/tests/unit/plugins/ml2/test_extension_driver_api.py
index b81c2b2..a2feb9c 100644
--- a/neutron/tests/unit/plugins/ml2/test_extension_driver_api.py
+++ b/neutron/tests/unit/plugins/ml2/test_extension_driver_api.py
@@ -13,9 +13,9 @@
13import mock 13import mock
14from neutron_lib import context 14from neutron_lib import context
15from neutron_lib.plugins import directory 15from neutron_lib.plugins import directory
16from oslo_config import cfg
16from oslo_utils import uuidutils 17from oslo_utils import uuidutils
17 18
18from neutron.plugins.ml2 import config
19from neutron.tests.unit.plugins.ml2.drivers import ext_test 19from neutron.tests.unit.plugins.ml2.drivers import ext_test
20from neutron.tests.unit.plugins.ml2 import test_plugin 20from neutron.tests.unit.plugins.ml2 import test_plugin
21 21
@@ -25,9 +25,9 @@ class ExtensionDriverTestCase(test_plugin.Ml2PluginV2TestCase):
25 _extension_drivers = ['test'] 25 _extension_drivers = ['test']
26 26
27 def setUp(self): 27 def setUp(self):
28 config.cfg.CONF.set_override('extension_drivers', 28 cfg.CONF.set_override('extension_drivers',
29 self._extension_drivers, 29 self._extension_drivers,
30 group='ml2') 30 group='ml2')
31 super(ExtensionDriverTestCase, self).setUp() 31 super(ExtensionDriverTestCase, self).setUp()
32 self._plugin = directory.get_plugin() 32 self._plugin = directory.get_plugin()
33 self._ctxt = context.get_admin_context() 33 self._ctxt = context.get_admin_context()
@@ -178,9 +178,9 @@ class DBExtensionDriverTestCase(test_plugin.Ml2PluginV2TestCase):
178 _extension_drivers = ['testdb'] 178 _extension_drivers = ['testdb']
179 179
180 def setUp(self): 180 def setUp(self):
181 config.cfg.CONF.set_override('extension_drivers', 181 cfg.CONF.set_override('extension_drivers',
182 self._extension_drivers, 182 self._extension_drivers,
183 group='ml2') 183 group='ml2')
184 super(DBExtensionDriverTestCase, self).setUp() 184 super(DBExtensionDriverTestCase, self).setUp()
185 self._plugin = directory.get_plugin() 185 self._plugin = directory.get_plugin()
186 self._ctxt = context.get_admin_context() 186 self._ctxt = context.get_admin_context()
diff --git a/neutron/tests/unit/plugins/ml2/test_managers.py b/neutron/tests/unit/plugins/ml2/test_managers.py
index 97b8abb..21c542d 100644
--- a/neutron/tests/unit/plugins/ml2/test_managers.py
+++ b/neutron/tests/unit/plugins/ml2/test_managers.py
@@ -17,10 +17,10 @@
17import mock 17import mock
18 18
19from neutron_lib.plugins.ml2 import api 19from neutron_lib.plugins.ml2 import api
20from oslo_config import cfg
20from oslo_db import exception as db_exc 21from oslo_db import exception as db_exc
21 22
22from neutron.plugins.ml2.common import exceptions as ml2_exc 23from neutron.plugins.ml2.common import exceptions as ml2_exc
23from neutron.plugins.ml2 import config
24from neutron.plugins.ml2 import managers 24from neutron.plugins.ml2 import managers
25from neutron.tests import base 25from neutron.tests import base
26from neutron.tests.unit.plugins.ml2.drivers import mechanism_test 26from neutron.tests.unit.plugins.ml2.drivers import mechanism_test
@@ -45,8 +45,8 @@ class TestManagers(base.BaseTestCase):
45 @mock.patch.object(managers.LOG, 'critical') 45 @mock.patch.object(managers.LOG, 'critical')
46 @mock.patch.object(managers.MechanismManager, '_driver_not_loaded') 46 @mock.patch.object(managers.MechanismManager, '_driver_not_loaded')
47 def test__driver_not_found(self, mock_not_loaded, mock_log): 47 def test__driver_not_found(self, mock_not_loaded, mock_log):
48 config.cfg.CONF.set_override('mechanism_drivers', ['invalidmech'], 48 cfg.CONF.set_override('mechanism_drivers', ['invalidmech'],
49 group='ml2') 49 group='ml2')
50 self.assertRaises(SystemExit, managers.MechanismManager) 50 self.assertRaises(SystemExit, managers.MechanismManager)
51 mock_not_loaded.assert_not_called() 51 mock_not_loaded.assert_not_called()
52 mock_log.assert_called_once_with("The following mechanism drivers " 52 mock_log.assert_called_once_with("The following mechanism drivers "
@@ -56,8 +56,8 @@ class TestManagers(base.BaseTestCase):
56 @mock.patch.object(managers.LOG, 'critical') 56 @mock.patch.object(managers.LOG, 'critical')
57 @mock.patch.object(managers.MechanismManager, '_driver_not_found') 57 @mock.patch.object(managers.MechanismManager, '_driver_not_found')
58 def test__driver_not_loaded(self, mock_not_found, mock_log): 58 def test__driver_not_loaded(self, mock_not_found, mock_log):
59 config.cfg.CONF.set_override('mechanism_drivers', ['faulty_agent'], 59 cfg.CONF.set_override('mechanism_drivers', ['faulty_agent'],
60 group='ml2') 60 group='ml2')
61 self.assertRaises(SystemExit, managers.MechanismManager) 61 self.assertRaises(SystemExit, managers.MechanismManager)
62 mock_log.assert_called_once_with(u"The '%(entrypoint)s' entrypoint " 62 mock_log.assert_called_once_with(u"The '%(entrypoint)s' entrypoint "
63 "could not be loaded for the " 63 "could not be loaded for the "
@@ -68,8 +68,7 @@ class TestManagers(base.BaseTestCase):
68 68
69class TestMechManager(base.BaseTestCase): 69class TestMechManager(base.BaseTestCase):
70 def setUp(self): 70 def setUp(self):
71 config.cfg.CONF.set_override('mechanism_drivers', ['test'], 71 cfg.CONF.set_override('mechanism_drivers', ['test'], group='ml2')
72 group='ml2')
73 super(TestMechManager, self).setUp() 72 super(TestMechManager, self).setUp()
74 self._manager = managers.MechanismManager() 73 self._manager = managers.MechanismManager()
75 74
diff --git a/neutron/tests/unit/plugins/ml2/test_plugin.py b/neutron/tests/unit/plugins/ml2/test_plugin.py
index 28f2e35..0f5d0ea 100644
--- a/neutron/tests/unit/plugins/ml2/test_plugin.py
+++ b/neutron/tests/unit/plugins/ml2/test_plugin.py
@@ -17,6 +17,7 @@ import functools
17 17
18import fixtures 18import fixtures
19import mock 19import mock
20from oslo_config import cfg
20import testtools 21import testtools
21import webob 22import webob
22 23
@@ -49,7 +50,6 @@ from neutron.objects import base as base_obj
49from neutron.objects import router as l3_obj 50from neutron.objects import router as l3_obj
50from neutron.plugins.common import constants as p_const 51from neutron.plugins.common import constants as p_const
51from neutron.plugins.ml2.common import exceptions as ml2_exc 52from neutron.plugins.ml2.common import exceptions as ml2_exc
52from neutron.plugins.ml2 import config
53from neutron.plugins.ml2 import db as ml2_db 53from neutron.plugins.ml2 import db as ml2_db
54from neutron.plugins.ml2 import driver_context 54from neutron.plugins.ml2 import driver_context
55from neutron.plugins.ml2.drivers import type_vlan 55from neutron.plugins.ml2.drivers import type_vlan
@@ -72,9 +72,9 @@ from neutron.tests.unit.plugins.ml2.drivers import mechanism_logger as \
72from neutron.tests.unit.plugins.ml2.drivers import mechanism_test as mech_test 72from neutron.tests.unit.plugins.ml2.drivers import mechanism_test as mech_test
73 73
74 74
75config.cfg.CONF.import_opt('network_vlan_ranges', 75cfg.CONF.import_opt('network_vlan_ranges',
76 'neutron.plugins.ml2.drivers.type_vlan', 76 'neutron.plugins.ml2.drivers.type_vlan',
77 group='ml2_type_vlan') 77 group='ml2_type_vlan')
78 78
79 79
80PLUGIN_NAME = 'ml2' 80PLUGIN_NAME = 'ml2'
@@ -135,18 +135,18 @@ class Ml2PluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase):
135 # Enable the test mechanism driver to ensure that 135 # Enable the test mechanism driver to ensure that
136 # we can successfully call through to all mechanism 136 # we can successfully call through to all mechanism
137 # driver apis. 137 # driver apis.
138 config.cfg.CONF.set_override('mechanism_drivers', 138 cfg.CONF.set_override('mechanism_drivers',
139 self._mechanism_drivers, 139 self._mechanism_drivers,
140 group='ml2') 140 group='ml2')
141 self.physnet = 'physnet1' 141 self.physnet = 'physnet1'
142 self.vlan_range = '1:100' 142 self.vlan_range = '1:100'
143 self.vlan_range2 = '200:300' 143 self.vlan_range2 = '200:300'
144 self.physnet2 = 'physnet2' 144 self.physnet2 = 'physnet2'
145 self.phys_vrange = ':'.join([self.physnet, self.vlan_range]) 145 self.phys_vrange = ':'.join([self.physnet, self.vlan_range])
146 self.phys2_vrange = ':'.join([self.physnet2, self.vlan_range2]) 146 self.phys2_vrange = ':'.join([self.physnet2, self.vlan_range2])
147 config.cfg.CONF.set_override('network_vlan_ranges', 147 cfg.CONF.set_override('network_vlan_ranges',
148 [self.phys_vrange, self.phys2_vrange], 148 [self.phys_vrange, self.phys2_vrange],
149 group='ml2_type_vlan') 149 group='ml2_type_vlan')
150 self.setup_parent() 150 self.setup_parent()
151 self.driver = directory.get_plugin() 151 self.driver = directory.get_plugin()
152 self.context = context.get_admin_context() 152 self.context = context.get_admin_context()
@@ -386,9 +386,9 @@ class TestExternalNetwork(Ml2PluginV2TestCase):
386 return network 386 return network
387 387
388 def test_external_network_type_none(self): 388 def test_external_network_type_none(self):
389 config.cfg.CONF.set_default('external_network_type', 389 cfg.CONF.set_default('external_network_type',
390 None, 390 None,
391 group='ml2') 391 group='ml2')
392 392
393 network = self._create_external_network() 393 network = self._create_external_network()
394 # For external network, expected network type to be 394 # For external network, expected network type to be
@@ -403,9 +403,9 @@ class TestExternalNetwork(Ml2PluginV2TestCase):
403 self.assertNotIn(mpnet.SEGMENTS, network['network']) 403 self.assertNotIn(mpnet.SEGMENTS, network['network'])
404 404
405 def test_external_network_type_vlan(self): 405 def test_external_network_type_vlan(self):
406 config.cfg.CONF.set_default('external_network_type', 406 cfg.CONF.set_default('external_network_type',
407 p_const.TYPE_VLAN, 407 p_const.TYPE_VLAN,
408 group='ml2') 408 group='ml2')
409 409
410 network = self._create_external_network() 410 network = self._create_external_network()
411 # For external network, expected network type to be 'vlan'. 411 # For external network, expected network type to be 'vlan'.
@@ -428,7 +428,7 @@ class TestMl2NetworksWithVlanTransparencyBase(TestMl2NetworksV2):
428 'vlan_transparent': 'True'}} 428 'vlan_transparent': 'True'}}
429 429
430 def setUp(self, plugin=None): 430 def setUp(self, plugin=None):
431 config.cfg.CONF.set_override('vlan_transparent', True) 431 cfg.CONF.set_override('vlan_transparent', True)
432 super(TestMl2NetworksWithVlanTransparencyBase, self).setUp(plugin) 432 super(TestMl2NetworksWithVlanTransparencyBase, self).setUp(plugin)
433 433
434 434
@@ -466,8 +466,8 @@ class TestMl2NetworksWithVlanTransparencyAndMTU(
466 with mock.patch.object(mech_test.TestMechanismDriver, 466 with mock.patch.object(mech_test.TestMechanismDriver,
467 'check_vlan_transparency', 467 'check_vlan_transparency',
468 return_value=True): 468 return_value=True):
469 config.cfg.CONF.set_override('path_mtu', 1000, group='ml2') 469 cfg.CONF.set_override('path_mtu', 1000, group='ml2')
470 config.cfg.CONF.set_override('global_physnet_mtu', 1000) 470 cfg.CONF.set_override('global_physnet_mtu', 1000)
471 network_req = self.new_create_request('networks', self.data) 471 network_req = self.new_create_request('networks', self.data)
472 res = network_req.get_response(self.api) 472 res = network_req.get_response(self.api)
473 self.assertEqual(201, res.status_int) 473 self.assertEqual(201, res.status_int)
@@ -1555,7 +1555,7 @@ class TestMl2PortBinding(Ml2PluginV2TestCase,
1555 1555
1556 def setUp(self, firewall_driver=None): 1556 def setUp(self, firewall_driver=None):
1557 test_sg_rpc.set_firewall_driver(self.FIREWALL_DRIVER) 1557 test_sg_rpc.set_firewall_driver(self.FIREWALL_DRIVER)
1558 config.cfg.CONF.set_override( 1558 cfg.CONF.set_override(
1559 'enable_security_group', self.ENABLE_SG, 1559 'enable_security_group', self.ENABLE_SG,
1560 group='SECURITYGROUP') 1560 group='SECURITYGROUP')
1561 super(TestMl2PortBinding, self).setUp() 1561 super(TestMl2PortBinding, self).setUp()
@@ -2150,9 +2150,9 @@ class TestMl2AllowedAddressPairs(Ml2PluginV2TestCase,
2150 _extension_drivers = ['port_security'] 2150 _extension_drivers = ['port_security']
2151 2151
2152 def setUp(self, plugin=None): 2152 def setUp(self, plugin=None):
2153 config.cfg.CONF.set_override('extension_drivers', 2153 cfg.CONF.set_override('extension_drivers',
2154 self._extension_drivers, 2154 self._extension_drivers,
2155 group='ml2') 2155 group='ml2')
2156 super(test_pair.TestAllowedAddressPairs, self).setUp( 2156 super(test_pair.TestAllowedAddressPairs, self).setUp(
2157 plugin=PLUGIN_NAME) 2157 plugin=PLUGIN_NAME)
2158 2158
@@ -2160,12 +2160,12 @@ class TestMl2AllowedAddressPairs(Ml2PluginV2TestCase,
2160class TestMl2PortSecurity(Ml2PluginV2TestCase): 2160class TestMl2PortSecurity(Ml2PluginV2TestCase):
2161 2161
2162 def setUp(self): 2162 def setUp(self):
2163 config.cfg.CONF.set_override('extension_drivers', 2163 cfg.CONF.set_override('extension_drivers',
2164 ['port_security'], 2164 ['port_security'],
2165 group='ml2') 2165 group='ml2')
2166 config.cfg.CONF.set_override('enable_security_group', 2166 cfg.CONF.set_override('enable_security_group',
2167 False, 2167 False,
2168 group='SECURITYGROUP') 2168 group='SECURITYGROUP')
2169 super(TestMl2PortSecurity, self).setUp() 2169 super(TestMl2PortSecurity, self).setUp()
2170 2170
2171 def test_port_update_without_security_groups(self): 2171 def test_port_update_without_security_groups(self):
@@ -2250,9 +2250,9 @@ class Ml2PluginV2FaultyDriverTestCase(test_plugin.NeutronDbPluginV2TestCase):
2250 # Enable the test mechanism driver to ensure that 2250 # Enable the test mechanism driver to ensure that
2251 # we can successfully call through to all mechanism 2251 # we can successfully call through to all mechanism
2252 # driver apis. 2252 # driver apis.
2253 config.cfg.CONF.set_override('mechanism_drivers', 2253 cfg.CONF.set_override('mechanism_drivers',
2254 ['test', 'logger'], 2254 ['test', 'logger'],
2255 group='ml2') 2255 group='ml2')
2256 super(Ml2PluginV2FaultyDriverTestCase, self).setUp(PLUGIN_NAME) 2256 super(Ml2PluginV2FaultyDriverTestCase, self).setUp(PLUGIN_NAME)
2257 self.port_create_status = 'DOWN' 2257 self.port_create_status = 'DOWN'
2258 2258
diff --git a/neutron/tests/unit/plugins/ml2/test_port_binding.py b/neutron/tests/unit/plugins/ml2/test_port_binding.py
index 8e26f37..a26ed5e 100644
--- a/neutron/tests/unit/plugins/ml2/test_port_binding.py
+++ b/neutron/tests/unit/plugins/ml2/test_port_binding.py
@@ -18,10 +18,10 @@ from neutron_lib.api.definitions import portbindings
18from neutron_lib import constants as const 18from neutron_lib import constants as const
19from neutron_lib import context 19from neutron_lib import context
20from neutron_lib.plugins import directory 20from neutron_lib.plugins import directory
21from oslo_config import cfg
21from oslo_serialization import jsonutils 22from oslo_serialization import jsonutils
22 23
23from neutron.conf.plugins.ml2.drivers import driver_type 24from neutron.conf.plugins.ml2.drivers import driver_type
24from neutron.plugins.ml2 import config
25from neutron.plugins.ml2 import driver_context 25from neutron.plugins.ml2 import driver_context
26from neutron.plugins.ml2 import models as ml2_models 26from neutron.plugins.ml2 import models as ml2_models
27from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin 27from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin
@@ -33,18 +33,18 @@ class PortBindingTestCase(test_plugin.NeutronDbPluginV2TestCase):
33 # Enable the test mechanism driver to ensure that 33 # Enable the test mechanism driver to ensure that
34 # we can successfully call through to all mechanism 34 # we can successfully call through to all mechanism
35 # driver apis. 35 # driver apis.
36 config.cfg.CONF.set_override('mechanism_drivers', 36 cfg.CONF.set_override('mechanism_drivers',
37 ['logger', 'test'], 37 ['logger', 'test'],
38 'ml2') 38 'ml2')
39 39
40 # NOTE(dasm): ml2_type_vlan requires to be registered before used. 40 # NOTE(dasm): ml2_type_vlan requires to be registered before used.
41 # This piece was refactored and removed from .config, so it causes 41 # This piece was refactored and removed from .config, so it causes
42 # a problem, when tests are executed with pdb. 42 # a problem, when tests are executed with pdb.
43 # There is no problem when tests are running without debugger. 43 # There is no problem when tests are running without debugger.
44 driver_type.register_ml2_drivers_vlan_opts() 44 driver_type.register_ml2_drivers_vlan_opts()
45 config.cfg.CONF.set_override('network_vlan_ranges', 45 cfg.CONF.set_override('network_vlan_ranges',
46 ['physnet1:1000:1099'], 46 ['physnet1:1000:1099'],
47 group='ml2_type_vlan') 47 group='ml2_type_vlan')
48 super(PortBindingTestCase, self).setUp('ml2') 48 super(PortBindingTestCase, self).setUp('ml2')
49 self.port_create_status = 'DOWN' 49 self.port_create_status = 'DOWN'
50 self.plugin = directory.get_plugin() 50 self.plugin = directory.get_plugin()
diff --git a/neutron/tests/unit/plugins/ml2/test_rpc.py b/neutron/tests/unit/plugins/ml2/test_rpc.py
index 57740a8..d72ddae 100644
--- a/neutron/tests/unit/plugins/ml2/test_rpc.py
+++ b/neutron/tests/unit/plugins/ml2/test_rpc.py
@@ -38,7 +38,7 @@ from neutron.services.qos import qos_consts
38from neutron.tests import base 38from neutron.tests import base
39 39
40 40
41cfg.CONF.import_group('ml2', 'neutron.plugins.ml2.config') 41cfg.CONF.import_group('ml2', 'neutron.conf.plugins.ml2.config')
42 42
43 43
44class RpcCallbacksTestCase(base.BaseTestCase): 44class RpcCallbacksTestCase(base.BaseTestCase):
diff --git a/neutron/tests/unit/services/revisions/test_revision_plugin.py b/neutron/tests/unit/services/revisions/test_revision_plugin.py
index c1b834b..5849118 100644
--- a/neutron/tests/unit/services/revisions/test_revision_plugin.py
+++ b/neutron/tests/unit/services/revisions/test_revision_plugin.py
@@ -17,6 +17,7 @@ import netaddr
17from neutron_lib import context as nctx 17from neutron_lib import context as nctx
18from neutron_lib.plugins import constants 18from neutron_lib.plugins import constants
19from neutron_lib.plugins import directory 19from neutron_lib.plugins import directory
20from oslo_config import cfg
20from oslo_db import exception as db_exc 21from oslo_db import exception as db_exc
21from oslo_utils import uuidutils 22from oslo_utils import uuidutils
22from sqlalchemy.orm import session as se 23from sqlalchemy.orm import session as se
@@ -25,7 +26,6 @@ from webob import exc
25from neutron.db import api as db_api 26from neutron.db import api as db_api
26from neutron.db import models_v2 27from neutron.db import models_v2
27from neutron.objects import ports as port_obj 28from neutron.objects import ports as port_obj
28from neutron.plugins.ml2 import config
29from neutron.tests.unit.plugins.ml2 import test_plugin 29from neutron.tests.unit.plugins.ml2 import test_plugin
30 30
31 31
@@ -44,9 +44,9 @@ class TestRevisionPlugin(test_plugin.Ml2PluginV2TestCase):
44 return p 44 return p
45 45
46 def setUp(self): 46 def setUp(self):
47 config.cfg.CONF.set_override('extension_drivers', 47 cfg.CONF.set_override('extension_drivers',
48 self._extension_drivers, 48 self._extension_drivers,
49 group='ml2') 49 group='ml2')
50 super(TestRevisionPlugin, self).setUp() 50 super(TestRevisionPlugin, self).setUp()
51 self.cp = directory.get_plugin() 51 self.cp = directory.get_plugin()
52 self.l3p = directory.get_plugin(constants.L3) 52 self.l3p = directory.get_plugin(constants.L3)