Agent common config
Refactoring Neutron configuration options for agent common config to be in neutron/conf/agent/common. This will allow centralization of all configuration options and provide an easy way to import. Partial-Bug: #1563069 Change-Id: Iebac0cdd3bcfd0135349128921b7ad7a1a939ab8 Needed-By: Ib676003bbe909b5a9013a3178b12dbe291d936af
This commit is contained in:
@@ -1,43 +0,0 @@
|
||||
# Copyright 2012 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.agent.common import config
|
||||
from neutron.tests import base
|
||||
|
||||
|
||||
def test_setup_conf():
|
||||
conf = config.setup_conf()
|
||||
assert conf.state_path.endswith('/var/lib/neutron')
|
||||
|
||||
|
||||
class TestRootHelper(base.BaseTestCase):
|
||||
|
||||
def test_agent_root_helper(self):
|
||||
conf = config.setup_conf()
|
||||
config.register_root_helper(conf)
|
||||
conf.set_override('root_helper', 'my_root_helper', 'AGENT')
|
||||
self.assertEqual(config.get_root_helper(conf), 'my_root_helper')
|
||||
|
||||
def test_root_default(self):
|
||||
conf = config.setup_conf()
|
||||
config.register_root_helper(conf)
|
||||
self.assertEqual(config.get_root_helper(conf), 'sudo')
|
||||
|
||||
def test_agent_root_helper_daemon(self):
|
||||
conf = config.setup_conf()
|
||||
config.register_root_helper(conf)
|
||||
rhd = 'my_root_helper_daemon'
|
||||
conf.set_override('root_helper_daemon', rhd, 'AGENT')
|
||||
self.assertEqual(rhd, conf.AGENT.root_helper_daemon)
|
||||
@@ -21,9 +21,9 @@ from oslo_utils import uuidutils
|
||||
import tenacity
|
||||
import testtools
|
||||
|
||||
from neutron.agent.common import config
|
||||
from neutron.agent.common import ovs_lib
|
||||
from neutron.agent.common import utils
|
||||
from neutron.conf.agent import common as config
|
||||
from neutron.plugins.common import constants
|
||||
from neutron.plugins.ml2.drivers.openvswitch.agent.common \
|
||||
import constants as p_const
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
|
||||
import mock
|
||||
|
||||
from neutron.agent.common import config
|
||||
from neutron.agent.common import utils
|
||||
from neutron.agent.linux import interface
|
||||
from neutron.conf.agent import common as config
|
||||
from neutron.tests import base
|
||||
from neutron.tests.unit import testlib_api
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ from oslo_config import cfg
|
||||
import oslo_messaging
|
||||
import testtools
|
||||
|
||||
from neutron.agent.common import config
|
||||
from neutron.agent.dhcp import agent as dhcp_agent
|
||||
from neutron.agent import dhcp_agent as entry
|
||||
from neutron.agent.linux import dhcp
|
||||
@@ -35,6 +34,7 @@ from neutron.agent.metadata import driver as metadata_driver
|
||||
from neutron.common import config as common_config
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import utils
|
||||
from neutron.conf.agent import common as config
|
||||
from neutron.conf.agent import dhcp as dhcp_config
|
||||
from neutron.tests import base
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ from oslo_utils import uuidutils
|
||||
import six
|
||||
from testtools import matchers
|
||||
|
||||
from neutron.agent.common import config as agent_config
|
||||
from neutron.agent.l3 import agent as l3_agent
|
||||
from neutron.agent.l3 import dvr_edge_router as dvr_router
|
||||
from neutron.agent.l3 import dvr_snat_ns
|
||||
@@ -49,6 +48,7 @@ from neutron.agent.metadata import driver as metadata_driver
|
||||
from neutron.agent import rpc as agent_rpc
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.conf.agent import common as agent_config
|
||||
from neutron.conf.agent.l3 import config as l3_config
|
||||
from neutron.conf.agent.l3 import ha as ha_conf
|
||||
from neutron.conf import common as base_config
|
||||
|
||||
@@ -19,7 +19,6 @@ from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
from neutron.agent.common import config as agent_config
|
||||
from neutron.agent.l3 import agent as l3_agent
|
||||
from neutron.agent.l3 import dvr_local_router as dvr_router
|
||||
from neutron.agent.l3 import link_local_allocator as lla
|
||||
@@ -29,6 +28,7 @@ from neutron.agent.linux import interface
|
||||
from neutron.agent.linux import ip_lib
|
||||
from neutron.common import constants as n_const
|
||||
from neutron.common import utils as common_utils
|
||||
from neutron.conf.agent import common as agent_config
|
||||
from neutron.conf.agent.l3 import config as l3_config
|
||||
from neutron.conf.agent.l3 import ha as ha_conf
|
||||
from neutron.conf import common as base_config
|
||||
|
||||
@@ -14,10 +14,10 @@ import mock
|
||||
from neutron_lib import constants as lib_constants
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
from neutron.agent.common import config as agent_config
|
||||
from neutron.agent.l3 import router_info
|
||||
from neutron.agent.linux import ip_lib
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.conf.agent import common as config
|
||||
from neutron.tests import base
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ class TestRouterInfo(base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(TestRouterInfo, self).setUp()
|
||||
|
||||
conf = agent_config.setup_conf()
|
||||
conf = config.setup_conf()
|
||||
|
||||
self.ip_cls_p = mock.patch('neutron.agent.linux.ip_lib.IPWrapper')
|
||||
ip_cls = self.ip_cls_p.start()
|
||||
|
||||
@@ -23,10 +23,10 @@ import oslo_messaging
|
||||
from oslo_utils import fileutils
|
||||
import testtools
|
||||
|
||||
from neutron.agent.common import config
|
||||
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
|
||||
from neutron.conf import common as base_config
|
||||
from neutron.extensions import extra_dhcp_opt as edo_ext
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
import mock
|
||||
from neutron_lib import constants
|
||||
|
||||
from neutron.agent.common import config
|
||||
from neutron.agent.common import ovs_lib
|
||||
from neutron.agent.linux import interface
|
||||
from neutron.agent.linux import ip_lib
|
||||
from neutron.agent.linux import utils
|
||||
from neutron.conf.agent import common as config
|
||||
from neutron.tests import base
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ from oslo_config import cfg
|
||||
import six
|
||||
import testtools
|
||||
|
||||
from neutron.agent.common import config as a_cfg
|
||||
from neutron.agent import firewall
|
||||
from neutron.agent.linux import ip_conntrack
|
||||
from neutron.agent.linux import ipset_manager
|
||||
@@ -29,6 +28,7 @@ from neutron.agent.linux import iptables_comments as ic
|
||||
from neutron.agent.linux import iptables_firewall
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.common import utils
|
||||
from neutron.conf.agent import common as agent_config
|
||||
from neutron.conf.agent import securitygroups_rpc as security_config
|
||||
from neutron.tests import base
|
||||
from neutron.tests.unit.api.v2 import test_base
|
||||
@@ -71,8 +71,8 @@ COMMIT
|
||||
class BaseIptablesFirewallTestCase(base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(BaseIptablesFirewallTestCase, self).setUp()
|
||||
cfg.CONF.register_opts(a_cfg.ROOT_HELPER_OPTS, 'AGENT')
|
||||
security_config.register_securitygroups_opts()
|
||||
agent_config.register_root_helper(cfg.CONF)
|
||||
cfg.CONF.set_override('comment_iptables_rules', False, 'AGENT')
|
||||
self.utils_exec_p = mock.patch(
|
||||
'neutron.agent.linux.utils.execute')
|
||||
|
||||
@@ -19,11 +19,11 @@ import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
from neutron.agent.common import config as agent_config
|
||||
from neutron.agent.l3 import agent as l3_agent
|
||||
from neutron.agent.l3 import router_info
|
||||
from neutron.agent.metadata import driver as metadata_driver
|
||||
from neutron.common import constants
|
||||
from neutron.conf.agent import common as agent_config
|
||||
from neutron.conf.agent.l3 import config as l3_config
|
||||
from neutron.conf.agent.l3 import ha as ha_conf
|
||||
from neutron.conf.agent.metadata import config as meta_conf
|
||||
|
||||
Reference in New Issue
Block a user