diff --git a/neutron/agent/common/ip_lib.py b/neutron/agent/common/ip_lib.py index ee129f40a0b..abe9c405f3b 100644 --- a/neutron/agent/common/ip_lib.py +++ b/neutron/agent/common/ip_lib.py @@ -17,11 +17,13 @@ import os if os.name == 'nt': from neutron.agent.windows import ip_lib + from neutron.conf.agent import windows + OPTS = windows.IP_LIB_OPTS_WINDOWS else: from neutron.agent.linux import ip_lib + from neutron.conf.agent import linux + OPTS = linux.IP_LIB_OPTS_LINUX -OPTS = ip_lib.OPTS - IPWrapper = ip_lib.IPWrapper IPDevice = ip_lib.IPDevice diff --git a/neutron/agent/dhcp_agent.py b/neutron/agent/dhcp_agent.py index 6096a137ba0..cfb1576655a 100644 --- a/neutron/agent/dhcp_agent.py +++ b/neutron/agent/dhcp_agent.py @@ -19,7 +19,6 @@ import sys from oslo_config import cfg from oslo_service import service -from neutron.agent.linux import interface from neutron.common import config as common_config from neutron.common import topics from neutron.conf.agent import common as config @@ -34,7 +33,7 @@ def register_options(conf): config.register_availability_zone_opts_helper(conf) dhcp_config.register_agent_dhcp_opts(conf) meta_conf.register_meta_conf_opts(meta_conf.SHARED_OPTS, conf) - conf.register_opts(interface.OPTS) + config.register_interface_opts(conf) def main(): diff --git a/neutron/agent/l3_agent.py b/neutron/agent/l3_agent.py index 0c8c052087a..c88195f15d5 100644 --- a/neutron/agent/l3_agent.py +++ b/neutron/agent/l3_agent.py @@ -19,10 +19,6 @@ import sys from oslo_config import cfg from oslo_service import service -from neutron.agent.linux import external_process -from neutron.agent.linux import interface -from neutron.agent.linux import pd -from neutron.agent.linux import ra from neutron.common import config as common_config from neutron.common import topics from neutron.conf.agent import common as config @@ -38,10 +34,10 @@ def register_opts(conf): meta_conf.register_meta_conf_opts(meta_conf.SHARED_OPTS, conf) config.register_interface_driver_opts_helper(conf) config.register_agent_state_opts_helper(conf) - conf.register_opts(interface.OPTS) - conf.register_opts(external_process.OPTS) - conf.register_opts(pd.OPTS) - conf.register_opts(ra.OPTS) + config.register_interface_opts(conf) + config.register_external_process_opts(conf) + config.register_pddriver_opts(conf) + config.register_ra_opts(conf) config.register_availability_zone_opts_helper(conf) diff --git a/neutron/agent/linux/external_process.py b/neutron/agent/linux/external_process.py index bd32fcafb0d..b1d9c3cbc7e 100644 --- a/neutron/agent/linux/external_process.py +++ b/neutron/agent/linux/external_process.py @@ -24,23 +24,15 @@ from oslo_utils import fileutils import psutil import six -from neutron._i18n import _ from neutron.agent.linux import ip_lib from neutron.agent.linux import utils - from neutron.conf.agent import common as agent_cfg + LOG = logging.getLogger(__name__) -OPTS = [ - cfg.StrOpt('external_pids', - default='$state_path/external/pids', - help=_('Location to store child pid files')), -] - - -cfg.CONF.register_opts(OPTS) +agent_cfg.register_external_process_opts() agent_cfg.register_process_monitor_opts(cfg.CONF) diff --git a/neutron/agent/linux/interface.py b/neutron/agent/linux/interface.py index 88d6e67f318..f4515753e8a 100644 --- a/neutron/agent/linux/interface.py +++ b/neutron/agent/linux/interface.py @@ -18,32 +18,17 @@ import time import netaddr from neutron_lib import constants -from oslo_config import cfg from oslo_log import log as logging import six -from neutron._i18n import _ from neutron.agent.common import ovs_lib from neutron.agent.linux import ip_lib from neutron.agent.linux import utils from neutron.common import constants as n_const from neutron.common import exceptions - LOG = logging.getLogger(__name__) -OPTS = [ - cfg.StrOpt('ovs_integration_bridge', - default='br-int', - help=_('Name of Open vSwitch bridge to use')), - cfg.BoolOpt('ovs_use_veth', - default=False, - help=_('Uses veth for an OVS interface or not. ' - 'Support kernels with limited namespace support ' - '(e.g. RHEL 6.5) so long as ovs_use_veth is set to ' - 'True.')), -] - def _get_veth(name1, name2, namespace2): return (ip_lib.IPDevice(name1), diff --git a/neutron/agent/linux/ip_lib.py b/neutron/agent/linux/ip_lib.py index 18bb6a1899d..8f501d9f887 100644 --- a/neutron/agent/linux/ip_lib.py +++ b/neutron/agent/linux/ip_lib.py @@ -35,11 +35,6 @@ from neutron.privileged.agent.linux import ip_lib as privileged LOG = logging.getLogger(__name__) -OPTS = [ - cfg.BoolOpt('ip_lib_force_root', - default=False, - help=_('Force ip_lib calls to use the root helper')), -] IP_NONLOCAL_BIND = 'net.ipv4.ip_nonlocal_bind' diff --git a/neutron/agent/linux/pd.py b/neutron/agent/linux/pd.py index 02ef2e85171..ef66587bf25 100644 --- a/neutron/agent/linux/pd.py +++ b/neutron/agent/linux/pd.py @@ -21,24 +21,16 @@ from neutron_lib.callbacks import events from neutron_lib.callbacks import registry from neutron_lib.callbacks import resources from neutron_lib import constants as n_const -from oslo_config import cfg from oslo_log import log as logging from oslo_utils import netutils import six from stevedore import driver -from neutron._i18n import _ from neutron.common import constants as l3_constants from neutron.common import utils LOG = logging.getLogger(__name__) -OPTS = [ - cfg.StrOpt('pd_dhcp_driver', - default='dibbler', - help=_('Service to handle DHCPv6 Prefix delegation.')), -] - class PrefixDelegation(object): def __init__(self, context, pmon, intf_driver, notifier, pd_update_cb, diff --git a/neutron/agent/linux/pd_driver.py b/neutron/agent/linux/pd_driver.py index 2aabacdf361..6f7d28f82e8 100644 --- a/neutron/agent/linux/pd_driver.py +++ b/neutron/agent/linux/pd_driver.py @@ -15,22 +15,11 @@ import abc -from oslo_config import cfg import six -from neutron._i18n import _ +from neutron.conf.agent import common as agent_conf -OPTS = [ - cfg.StrOpt('pd_confs', - default='$state_path/pd', - help=_('Location to store IPv6 PD files.')), - cfg.StrOpt('vendor_pen', - default='8888', - help=_("A decimal value as Vendor's Registered Private " - "Enterprise Number as required by RFC3315 DUID-EN.")), -] - -cfg.CONF.register_opts(OPTS) +agent_conf.register_pddriver_opts() @six.add_metaclass(abc.ABCMeta) diff --git a/neutron/agent/linux/ra.py b/neutron/agent/linux/ra.py index 89e9a244791..00b09909be4 100644 --- a/neutron/agent/linux/ra.py +++ b/neutron/agent/linux/ra.py @@ -19,16 +19,13 @@ import jinja2 import netaddr from neutron_lib import constants from neutron_lib.utils import file as file_utils -from oslo_config import cfg from oslo_log import log as logging import six -from neutron._i18n import _ from neutron.agent.linux import external_process from neutron.agent.linux import utils from neutron.common import constants as n_const - RADVD_SERVICE_NAME = 'radvd' RADVD_SERVICE_CMD = 'radvd' # We can configure max of 3 DNS servers in radvd RDNSS section. @@ -36,17 +33,6 @@ MAX_RDNSS_ENTRIES = 3 LOG = logging.getLogger(__name__) -OPTS = [ - cfg.StrOpt('ra_confs', - default='$state_path/ra', - help=_('Location to store IPv6 RA config files')), - cfg.IntOpt('min_rtr_adv_interval', - default=30, - help=_('MinRtrAdvInterval setting for radvd.conf')), - cfg.IntOpt('max_rtr_adv_interval', - default=100, - help=_('MaxRtrAdvInterval setting for radvd.conf')), -] CONFIG_TEMPLATE = jinja2.Template("""interface {{ interface_name }} { diff --git a/neutron/agent/ovsdb/api.py b/neutron/agent/ovsdb/api.py index 81fc59cbc4f..36205b609fd 100644 --- a/neutron/agent/ovsdb/api.py +++ b/neutron/agent/ovsdb/api.py @@ -21,7 +21,7 @@ from oslo_utils import importutils from ovsdbapp import api from ovsdbapp import exceptions -from neutron._i18n import _ +from neutron.conf.agent import ovsdb_api API = moves.moved_class(api.API, 'API', __name__) Command = moves.moved_class(api.Command, 'Command', __name__) @@ -29,31 +29,14 @@ Transaction = moves.moved_class(api.Transaction, 'Transaction', __name__) TimeoutException = moves.moved_class(exceptions.TimeoutException, 'TimeoutException', __name__) -interface_map = { - 'vsctl': 'neutron.agent.ovsdb.impl_vsctl', - 'native': 'neutron.agent.ovsdb.impl_idl', -} -OPTS = [ - cfg.StrOpt('ovsdb_interface', - choices=interface_map.keys(), - default='native', - help=_('The interface for interacting with the OVSDB')), - cfg.StrOpt('ovsdb_connection', - default='tcp:127.0.0.1:6640', - help=_('The connection string for the OVSDB backend. ' - 'Will be used by ovsdb-client when monitoring and ' - 'used for the all ovsdb commands when native ' - 'ovsdb_interface is enabled' - )) -] -cfg.CONF.register_opts(OPTS, 'OVS') +ovsdb_api.register_ovsdb_api_opts() def from_config(context, iface_name=None): """Return the configured OVSDB API implementation""" iface = importutils.import_module( - interface_map[iface_name or cfg.CONF.OVS.ovsdb_interface]) + ovsdb_api.interface_map[iface_name or cfg.CONF.OVS.ovsdb_interface]) return iface.api_factory(context) diff --git a/neutron/agent/windows/ip_lib.py b/neutron/agent/windows/ip_lib.py index bae94e4fe98..030f2a04cc1 100644 --- a/neutron/agent/windows/ip_lib.py +++ b/neutron/agent/windows/ip_lib.py @@ -19,8 +19,6 @@ from oslo_log import log as logging LOG = logging.getLogger(__name__) -OPTS = [] - class IPWrapper(object): diff --git a/neutron/cmd/netns_cleanup.py b/neutron/cmd/netns_cleanup.py index 247f6e53c0d..729fa58ca8d 100644 --- a/neutron/cmd/netns_cleanup.py +++ b/neutron/cmd/netns_cleanup.py @@ -29,7 +29,6 @@ from neutron.agent.l3 import dvr_snat_ns from neutron.agent.l3 import namespaces from neutron.agent.linux import dhcp from neutron.agent.linux import external_process -from neutron.agent.linux import interface from neutron.agent.linux import ip_lib from neutron.agent.linux import utils from neutron.common import config @@ -37,7 +36,6 @@ from neutron.conf.agent import cmd from neutron.conf.agent import common as agent_config from neutron.conf.agent import dhcp as dhcp_config - LOG = logging.getLogger(__name__) LB_NS_PREFIX = 'qlbaas-' NS_PREFIXES = { @@ -73,7 +71,7 @@ def setup_conf(): cmd.register_cmd_opts(cmd.netns_opts, conf) agent_config.register_interface_driver_opts_helper(conf) dhcp_config.register_agent_dhcp_opts(conf) - conf.register_opts(interface.OPTS) + agent_config.register_interface_opts() return conf diff --git a/neutron/cmd/ovs_cleanup.py b/neutron/cmd/ovs_cleanup.py index dc53a6ca3e8..8757a375ad3 100644 --- a/neutron/cmd/ovs_cleanup.py +++ b/neutron/cmd/ovs_cleanup.py @@ -17,7 +17,6 @@ from oslo_config import cfg from oslo_log import log as logging from neutron.agent.common import ovs_lib -from neutron.agent.linux import interface from neutron.agent.linux import ip_lib from neutron.common import config from neutron.conf.agent import cmd @@ -25,7 +24,6 @@ from neutron.conf.agent import common as agent_config from neutron.conf.agent.l3 import config as l3_config from neutron.plugins.ml2.drivers.openvswitch.agent.common import constants - LOG = logging.getLogger(__name__) @@ -39,8 +37,8 @@ def setup_conf(): conf = cfg.CONF cmd.register_cmd_opts(cmd.ovs_opts, conf) l3_config.register_l3_agent_config_opts(l3_config.OPTS, conf) - conf.register_opts(interface.OPTS) agent_config.register_interface_driver_opts_helper(conf) + agent_config.register_interface_opts() return conf diff --git a/neutron/conf/agent/common.py b/neutron/conf/agent/common.py index 33dedcceded..6f0fd91dc87 100644 --- a/neutron/conf/agent/common.py +++ b/neutron/conf/agent/common.py @@ -23,6 +23,57 @@ from neutron._i18n import _ from neutron.common import config +EXTERNAL_PROCESS_OPTS = [ + cfg.StrOpt('external_pids', + default='$state_path/external/pids', + help=_('Location to store child pid files')), +] + + +PD_OPTS = [ + cfg.StrOpt('pd_dhcp_driver', + default='dibbler', + help=_('Service to handle DHCPv6 Prefix delegation.')), +] + + +PD_DRIVER_OPTS = [ + cfg.StrOpt('pd_confs', + default='$state_path/pd', + help=_('Location to store IPv6 PD files.')), + cfg.StrOpt('vendor_pen', + default='8888', + help=_("A decimal value as Vendor's Registered Private " + "Enterprise Number as required by RFC3315 DUID-EN.")), +] + + +INTERFACE_OPTS = [ + cfg.StrOpt('ovs_integration_bridge', + default='br-int', + help=_('Name of Open vSwitch bridge to use')), + cfg.BoolOpt('ovs_use_veth', + default=False, + help=_('Uses veth for an OVS interface or not. ' + 'Support kernels with limited namespace support ' + '(e.g. RHEL 6.5) so long as ovs_use_veth is set to ' + 'True.')), +] + + +RA_OPTS = [ + cfg.StrOpt('ra_confs', + default='$state_path/ra', + help=_('Location to store IPv6 RA config files')), + cfg.IntOpt('min_rtr_adv_interval', + default=30, + help=_('MinRtrAdvInterval setting for radvd.conf')), + cfg.IntOpt('max_rtr_adv_interval', + default=100, + help=_('MaxRtrAdvInterval setting for radvd.conf')), +] + + ROOT_HELPER_OPTS = [ cfg.StrOpt('root_helper', default='sudo', help=_("Root helper application. " @@ -131,6 +182,26 @@ def get_log_args(conf, log_file_name, **kwargs): return cmd_args +def register_external_process_opts(cfg=cfg.CONF): + cfg.register_opts(EXTERNAL_PROCESS_OPTS) + + +def register_pd_opts(cfg=cfg.CONF): + cfg.register_opts(PD_OPTS) + + +def register_pddriver_opts(cfg=cfg.CONF): + cfg.register_opts(PD_DRIVER_OPTS) + + +def register_interface_opts(cfg=cfg.CONF): + cfg.register_opts(INTERFACE_OPTS) + + +def register_ra_opts(cfg=cfg.CONF): + cfg.register_opts(RA_OPTS) + + def register_root_helper(conf=cfg.CONF): conf.register_opts(ROOT_HELPER_OPTS, 'AGENT') diff --git a/neutron/conf/agent/linux.py b/neutron/conf/agent/linux.py new file mode 100644 index 00000000000..aaacfcd0b58 --- /dev/null +++ b/neutron/conf/agent/linux.py @@ -0,0 +1,28 @@ +# Copyright 2017 OpenStack Foundation +# All Rights Reserved. +# +# 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._i18n import _ + +from oslo_config import cfg + +IP_LIB_OPTS_LINUX = [ + cfg.BoolOpt('ip_lib_force_root', + default=False, + help=_('Force ip_lib calls to use the root helper')), +] + + +def register_iplib_opts(cfg=cfg.CONF): + cfg.register_opts(IP_LIB_OPTS_LINUX) diff --git a/neutron/conf/agent/ovsdb_api.py b/neutron/conf/agent/ovsdb_api.py new file mode 100644 index 00000000000..b218d0c3651 --- /dev/null +++ b/neutron/conf/agent/ovsdb_api.py @@ -0,0 +1,42 @@ +# Copyright 2017 OpenStack Foundation +# All Rights Reserved. +# +# 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._i18n import _ +from oslo_config import cfg + + +interface_map = { + 'vsctl': 'neutron.agent.ovsdb.impl_vsctl', + 'native': 'neutron.agent.ovsdb.impl_idl', +} + + +API_OPTS = [ + cfg.StrOpt('ovsdb_interface', + choices=interface_map.keys(), + default='native', + help=_('The interface for interacting with the OVSDB')), + cfg.StrOpt('ovsdb_connection', + default='tcp:127.0.0.1:6640', + help=_('The connection string for the OVSDB backend. ' + 'Will be used by ovsdb-client when monitoring and ' + 'used for the all ovsdb commands when native ' + 'ovsdb_interface is enabled' + )) +] + + +def register_ovsdb_api_opts(cfg=cfg.CONF): + cfg.register_opts(API_OPTS, 'OVS') diff --git a/neutron/conf/agent/windows.py b/neutron/conf/agent/windows.py new file mode 100644 index 00000000000..30be1cf5a20 --- /dev/null +++ b/neutron/conf/agent/windows.py @@ -0,0 +1,17 @@ +# Copyright 2017 OpenStack Foundation +# All Rights Reserved. +# +# 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. + + +IP_LIB_OPTS_WINDOWS = [] diff --git a/neutron/debug/shell.py b/neutron/debug/shell.py index fafa93e0dd8..adc43ceb577 100644 --- a/neutron/debug/shell.py +++ b/neutron/debug/shell.py @@ -20,7 +20,6 @@ from oslo_utils import importutils from neutron._i18n import _ from neutron.agent.common import utils -from neutron.agent.linux import interface from neutron.conf.agent import common as config from neutron.debug import debug_agent from neutronclient.common import exceptions as exc @@ -71,7 +70,7 @@ class NeutronDebugShell(shell.NeutronShell): _("You must provide a config file for bridge -" " either --config-file or env[NEUTRON_TEST_CONFIG_FILE]")) client = self.client_manager.neutron - cfg.CONF.register_opts(interface.OPTS) + config.register_interface_opts() cfg.CONF.register_opts(config.EXT_NET_BRIDGE_OPTS) config.register_interface_driver_opts_helper(cfg.CONF) cfg.CONF(['--config-file', self.options.config_file]) diff --git a/neutron/opts.py b/neutron/opts.py index 1d54f2f579a..6fce03bd6bd 100644 --- a/neutron/opts.py +++ b/neutron/opts.py @@ -18,10 +18,6 @@ from keystoneauth1 import loading as ks_loading from oslo_config import cfg import neutron.agent.agent_extensions_manager -import neutron.agent.linux.interface -import neutron.agent.linux.pd -import neutron.agent.linux.ra -import neutron.agent.ovsdb.api import neutron.agent.securitygroups_rpc import neutron.common.cache_utils import neutron.conf.agent.agent_extensions_manager @@ -29,8 +25,10 @@ import neutron.conf.agent.common import neutron.conf.agent.dhcp import neutron.conf.agent.l3.config import neutron.conf.agent.l3.ha +import neutron.conf.agent.linux import neutron.conf.agent.metadata.config as meta_conf import neutron.conf.agent.ovs_conf +import neutron.conf.agent.ovsdb_api import neutron.conf.agent.xenapi_conf import neutron.conf.cache_utils import neutron.conf.common @@ -146,12 +144,12 @@ def list_base_agent_opts(): return [ ('DEFAULT', itertools.chain( - neutron.agent.linux.interface.OPTS, + neutron.conf.agent.common.INTERFACE_OPTS, neutron.conf.agent.common.INTERFACE_DRIVER_OPTS, neutron.conf.agent.ovs_conf.OPTS) ), ('agent', neutron.conf.agent.common.AGENT_STATE_OPTS), - ('ovs', neutron.agent.ovsdb.api.OPTS), + ('ovs', neutron.conf.agent.ovsdb_api.API_OPTS), ] @@ -196,8 +194,8 @@ def list_l3_agent_opts(): neutron.conf.agent.l3.config.OPTS, neutron.conf.service.service_opts, neutron.conf.agent.l3.ha.OPTS, - neutron.agent.linux.pd.OPTS, - neutron.agent.linux.ra.OPTS) + neutron.conf.agent.common.PD_DRIVER_OPTS, + neutron.conf.agent.common.RA_OPTS) ), ('agent', neutron.conf.agent.agent_extensions_manager.AGENT_EXT_MANAGER_OPTS), @@ -258,7 +256,7 @@ def list_ovs_opts(): ('ovs', itertools.chain( neutron.conf.plugins.ml2.drivers.ovs_conf.ovs_opts, - neutron.agent.ovsdb.api.OPTS) + neutron.conf.agent.ovsdb_api.API_OPTS) ), ('agent', itertools.chain( diff --git a/neutron/services/metering/drivers/iptables/iptables_driver.py b/neutron/services/metering/drivers/iptables/iptables_driver.py index 7f99c3403bc..e07f5845d53 100644 --- a/neutron/services/metering/drivers/iptables/iptables_driver.py +++ b/neutron/services/metering/drivers/iptables/iptables_driver.py @@ -20,7 +20,6 @@ from oslo_utils import importutils from neutron._i18n import _ from neutron.agent.l3 import dvr_snat_ns from neutron.agent.l3 import namespaces -from neutron.agent.linux import interface from neutron.agent.linux import ip_lib from neutron.agent.linux import iptables_manager from neutron.common import constants @@ -39,7 +38,7 @@ RULE = '-r-' LABEL = '-l-' config.register_interface_driver_opts_helper(cfg.CONF) -cfg.CONF.register_opts(interface.OPTS) +config.register_interface_opts() class IptablesManagerTransaction(object): diff --git a/neutron/tests/common/net_helpers.py b/neutron/tests/common/net_helpers.py index eef23c7c3dd..9b5e8b00928 100644 --- a/neutron/tests/common/net_helpers.py +++ b/neutron/tests/common/net_helpers.py @@ -767,7 +767,7 @@ class OVSPortFixture(PortFixture): # machines as the port should be treated by OVS agent and not by # external party interface_config = cfg.ConfigOpts() - interface_config.register_opts(interface.OPTS) + config.register_interface_opts(interface_config) ovs_interface = interface.OVSInterfaceDriver(interface_config) ovs_interface.plug_new( None, diff --git a/neutron/tests/functional/agent/l2/base.py b/neutron/tests/functional/agent/l2/base.py index 26efc129f93..36c954ec984 100644 --- a/neutron/tests/functional/agent/l2/base.py +++ b/neutron/tests/functional/agent/l2/base.py @@ -70,8 +70,8 @@ class OVSAgentTestFramework(base.BaseOVSLinuxTestCase): def _get_config_opts(self): config = cfg.ConfigOpts() config.register_opts(common_config.core_opts) - config.register_opts(interface.OPTS) ovs_conf.register_ovs_agent_opts(config) + agent_config.register_interface_opts(config) agent_config.register_interface_driver_opts_helper(config) agent_config.register_agent_state_opts_helper(config) ext_manager.register_opts(config) diff --git a/neutron/tests/functional/agent/linux/test_dhcp.py b/neutron/tests/functional/agent/linux/test_dhcp.py index 94237d8db3d..0fa1fdb871e 100644 --- a/neutron/tests/functional/agent/linux/test_dhcp.py +++ b/neutron/tests/functional/agent/linux/test_dhcp.py @@ -16,7 +16,6 @@ import mock from oslo_config import cfg from neutron.agent.linux import dhcp -from neutron.agent.linux import interface from neutron.agent.linux import ip_lib from neutron.common import utils as common_utils from neutron.conf.agent import common as config @@ -31,8 +30,8 @@ class TestDhcp(functional_base.BaseSudoTestCase): def setUp(self): super(TestDhcp, self).setUp() conf = cfg.ConfigOpts() - conf.register_opts(config.INTERFACE_DRIVER_OPTS) - conf.register_opts(interface.OPTS) + config.register_interface_driver_opts_helper(conf) + config.register_interface_opts(conf) conf.register_opts(common_conf.core_opts) conf.register_opts(dhcp_conf.DHCP_AGENT_OPTS) conf.set_override('interface_driver', 'openvswitch') diff --git a/neutron/tests/functional/agent/linux/test_interface.py b/neutron/tests/functional/agent/linux/test_interface.py index c72defd48ce..9a512893e17 100644 --- a/neutron/tests/functional/agent/linux/test_interface.py +++ b/neutron/tests/functional/agent/linux/test_interface.py @@ -23,6 +23,7 @@ from neutron.agent.linux import interface from neutron.agent.linux import ip_lib from neutron.common import exceptions from neutron.common import utils +from neutron.conf.agent import common as config from neutron.tests.common import net_helpers from neutron.tests.functional.agent.linux import base as linux_base from neutron.tests.functional import base @@ -74,7 +75,7 @@ class OVSInterfaceDriverTestCase(linux_base.BaseOVSLinuxTestCase, def setUp(self): super(OVSInterfaceDriverTestCase, self).setUp() conf = cfg.ConfigOpts() - conf.register_opts(interface.OPTS) + config.register_interface_opts(conf) self.interface = interface.OVSInterfaceDriver(conf) self.bridge = self.useFixture(net_helpers.OVSBridgeFixture()).bridge @@ -130,7 +131,7 @@ class BridgeInterfaceDriverTestCase(base.BaseSudoTestCase, def setUp(self): super(BridgeInterfaceDriverTestCase, self).setUp() conf = cfg.ConfigOpts() - conf.register_opts(interface.OPTS) + config.register_interface_opts(conf) self.interface = interface.BridgeInterfaceDriver(conf) self.bridge = self.useFixture(net_helpers.LinuxBridgeFixture()).bridge diff --git a/neutron/tests/functional/agent/linux/test_ip_lib.py b/neutron/tests/functional/agent/linux/test_ip_lib.py index 7b6c23dc456..79bc10c079a 100644 --- a/neutron/tests/functional/agent/linux/test_ip_lib.py +++ b/neutron/tests/functional/agent/linux/test_ip_lib.py @@ -23,7 +23,6 @@ from oslo_log import log as logging from oslo_utils import importutils import testtools -from neutron.agent.linux import interface from neutron.agent.linux import ip_lib from neutron.common import utils from neutron.conf.agent import common as config @@ -49,7 +48,7 @@ class IpLibTestFramework(functional_base.BaseSudoTestCase): cfg.CONF.set_override( 'interface_driver', 'neutron.agent.linux.interface.OVSInterfaceDriver') - cfg.CONF.register_opts(interface.OPTS) + config.register_interface_opts() self.driver = importutils.import_object(cfg.CONF.interface_driver, cfg.CONF) diff --git a/neutron/tests/unit/agent/common/test_utils.py b/neutron/tests/unit/agent/common/test_utils.py index 64dc6be22e4..f372e7a68a7 100644 --- a/neutron/tests/unit/agent/common/test_utils.py +++ b/neutron/tests/unit/agent/common/test_utils.py @@ -27,7 +27,7 @@ class TestLoadInterfaceDriver(base.BaseTestCase): def setUp(self): super(TestLoadInterfaceDriver, self).setUp() self.conf = config.setup_conf() - self.conf.register_opts(interface.OPTS) + config.register_interface_opts(self.conf) config.register_interface_driver_opts_helper(self.conf) def test_load_interface_driver_not_set(self): diff --git a/neutron/tests/unit/agent/dhcp/test_agent.py b/neutron/tests/unit/agent/dhcp/test_agent.py index 21dfaa44637..150f0c6bf84 100644 --- a/neutron/tests/unit/agent/dhcp/test_agent.py +++ b/neutron/tests/unit/agent/dhcp/test_agent.py @@ -262,7 +262,7 @@ class TestDhcpAgent(base.BaseTestCase): cfg.CONF.register_opts(dhcp_config.DHCP_AGENT_OPTS) config.register_interface_driver_opts_helper(cfg.CONF) config.register_agent_state_opts_helper(cfg.CONF) - cfg.CONF.register_opts(interface.OPTS) + config.register_interface_opts(cfg.CONF) common_config.init(sys.argv[1:]) agent_mgr = dhcp_agent.DhcpAgentWithStateReport( 'testhost') diff --git a/neutron/tests/unit/agent/l3/test_agent.py b/neutron/tests/unit/agent/l3/test_agent.py index 03042de4de6..44bc880f5b6 100644 --- a/neutron/tests/unit/agent/l3/test_agent.py +++ b/neutron/tests/unit/agent/l3/test_agent.py @@ -41,7 +41,6 @@ from neutron.agent.l3 import namespaces from neutron.agent.l3 import router_info as l3router from neutron.agent.l3 import router_processing_queue from neutron.agent.linux import dibbler -from neutron.agent.linux import external_process from neutron.agent.linux import interface from neutron.agent.linux import iptables_manager from neutron.agent.linux import pd @@ -77,10 +76,10 @@ class BasicRouterOperationsFramework(base.BaseTestCase): agent_config.register_interface_driver_opts_helper(self.conf) agent_config.register_process_monitor_opts(self.conf) agent_config.register_availability_zone_opts_helper(self.conf) - self.conf.register_opts(interface.OPTS) - self.conf.register_opts(external_process.OPTS) - self.conf.register_opts(pd.OPTS) - self.conf.register_opts(ra.OPTS) + agent_config.register_interface_opts(self.conf) + agent_config.register_external_process_opts(self.conf) + agent_config.register_pd_opts(self.conf) + agent_config.register_ra_opts(self.conf) self.conf.set_override('interface_driver', 'neutron.agent.linux.interface.NullDriver') self.conf.set_override('state_path', cfg.CONF.state_path) diff --git a/neutron/tests/unit/agent/l3/test_dvr_local_router.py b/neutron/tests/unit/agent/l3/test_dvr_local_router.py index 02605d56906..4cb56804ce1 100644 --- a/neutron/tests/unit/agent/l3/test_dvr_local_router.py +++ b/neutron/tests/unit/agent/l3/test_dvr_local_router.py @@ -25,7 +25,6 @@ from neutron.agent.l3 import dvr_edge_router as dvr_edge_rtr from neutron.agent.l3 import dvr_local_router as dvr_router from neutron.agent.l3 import link_local_allocator as lla from neutron.agent.l3 import router_info -from neutron.agent.linux import external_process from neutron.agent.linux import interface from neutron.agent.linux import ip_lib from neutron.common import constants as n_const @@ -55,8 +54,8 @@ class TestDvrRouterOperations(base.BaseTestCase): ha_conf.register_l3_agent_ha_opts(self.conf) agent_config.register_interface_driver_opts_helper(self.conf) agent_config.register_process_monitor_opts(self.conf) - self.conf.register_opts(interface.OPTS) - self.conf.register_opts(external_process.OPTS) + agent_config.register_interface_opts(self.conf) + agent_config.register_external_process_opts(self.conf) self.conf.set_override('interface_driver', 'neutron.agent.linux.interface.NullDriver') self.conf.set_override('state_path', cfg.CONF.state_path) diff --git a/neutron/tests/unit/agent/linux/test_dhcp.py b/neutron/tests/unit/agent/linux/test_dhcp.py index c9cb450f404..72059dc997a 100644 --- a/neutron/tests/unit/agent/linux/test_dhcp.py +++ b/neutron/tests/unit/agent/linux/test_dhcp.py @@ -25,7 +25,6 @@ from oslo_utils import fileutils import testtools from neutron.agent.linux import dhcp -from neutron.agent.linux import external_process from neutron.common import constants as n_const from neutron.conf.agent import common as config from neutron.conf.agent import dhcp as dhcp_config @@ -940,7 +939,7 @@ class TestConfBase(base.BaseTestCase): self.conf.register_opts(base_config.core_opts) self.conf.register_opts(dhcp_config.DHCP_OPTS) self.conf.register_opts(dhcp_config.DNSMASQ_OPTS) - self.conf.register_opts(external_process.OPTS) + config.register_external_process_opts(self.conf) config.register_interface_driver_opts_helper(self.conf) diff --git a/neutron/tests/unit/agent/linux/test_interface.py b/neutron/tests/unit/agent/linux/test_interface.py index 057151f097b..2c0598bf668 100644 --- a/neutron/tests/unit/agent/linux/test_interface.py +++ b/neutron/tests/unit/agent/linux/test_interface.py @@ -58,7 +58,7 @@ class TestBase(base.BaseTestCase): def setUp(self): super(TestBase, self).setUp() self.conf = config.setup_conf() - self.conf.register_opts(interface.OPTS) + config.register_interface_opts(self.conf) self.ip_dev_p = mock.patch.object(ip_lib, 'IPDevice') self.ip_dev = self.ip_dev_p.start() self.ip_p = mock.patch.object(ip_lib, 'IPWrapper') diff --git a/neutron/tests/unit/debug/test_commands.py b/neutron/tests/unit/debug/test_commands.py index fa0260aa263..ec806747c3f 100644 --- a/neutron/tests/unit/debug/test_commands.py +++ b/neutron/tests/unit/debug/test_commands.py @@ -35,7 +35,7 @@ class MyApp(object): class TestDebugCommands(base.BaseTestCase): def setUp(self): super(TestDebugCommands, self).setUp() - cfg.CONF.register_opts(interface.OPTS) + config.register_interface_opts() cfg.CONF.register_opts(config.EXT_NET_BRIDGE_OPTS) common_config.init([]) config.register_interface_driver_opts_helper(cfg.CONF)