Refactoring config options for l2 agent ext opts

Refactoring neutron l2 agent extension config agent_ext_manager
and fdb_population opts to be in neutron/conf/agent so that all the
configuration options for l2 agent extensions reside in a centralized
location. This simplifies the process of looking up the l2 agent
extension config opts and provides an easy way to import.

Change-Id: I4ae842c6cfd62edad9a1d435ffad6bec760a2809
Partial-Bug: #1563069
changes/13/348513/11
Anindita Das 6 years ago committed by Kevin Benton
parent cffe2cd1ac
commit d7b40d1729
  1. 15
      neutron/agent/agent_extensions_manager.py
  2. 14
      neutron/agent/l2/extensions/fdb_population.py
  3. 3
      neutron/agent/l2/l2_agent_extensions_manager.py
  4. 3
      neutron/agent/l3/l3_agent_extensions_manager.py
  5. 25
      neutron/conf/agent/agent_extensions_manager.py
  6. 32
      neutron/conf/agent/l2_ext_fdb_population.py
  7. 11
      neutron/opts.py
  8. 3
      neutron/tests/unit/agent/test_agent_extensions_manager.py

@ -10,24 +10,15 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_config import cfg
from oslo_log import log
import stevedore
from neutron._i18n import _, _LI
from neutron._i18n import _LI
from neutron.conf.agent import agent_extensions_manager as agent_ext_mgr_config
LOG = log.getLogger(__name__)
AGENT_EXT_MANAGER_OPTS = [
cfg.ListOpt('extensions',
default=[],
help=_('Extensions list to use')),
]
def register_opts(conf):
conf.register_opts(AGENT_EXT_MANAGER_OPTS, 'agent')
agent_ext_mgr_config.register_agent_ext_manager_opts()
class AgentExtensionsManager(stevedore.named.NamedExtensionManager):

@ -20,24 +20,16 @@ from neutron_lib.utils import helpers
from oslo_config import cfg
from oslo_log import log as logging
from neutron._i18n import _, _LE, _LW
from neutron._i18n import _LE, _LW
from neutron.agent.l2 import l2_agent_extension
from neutron.agent.linux import bridge_lib
from neutron.conf.agent import l2_ext_fdb_population
from neutron.plugins.ml2.drivers.linuxbridge.agent.common import (
constants as linux_bridge_constants)
from neutron.plugins.ml2.drivers.openvswitch.agent.common import (
constants as ovs_constants)
# if shared_physical_device_mappings is not configured KeyError will be thrown
fdb_population_opt = [
cfg.ListOpt('shared_physical_device_mappings', default=[],
help=_("Comma-separated list of "
"<physical_network>:<network_device> tuples mapping "
"physical network names to the agent's node-specific "
"shared physical network device between "
"SR-IOV and OVS or SR-IOV and linux bridge"))
]
cfg.CONF.register_opts(fdb_population_opt, 'FDB')
l2_ext_fdb_population.register_fdb_population_opts()
LOG = logging.getLogger(__name__)

@ -14,6 +14,7 @@ from oslo_log import log
from neutron._i18n import _LE
from neutron.agent import agent_extensions_manager as agent_ext_manager
from neutron.conf.agent import agent_extensions_manager as agent_ext_mgr_config
LOG = log.getLogger(__name__)
@ -22,7 +23,7 @@ L2_AGENT_EXT_MANAGER_NAMESPACE = 'neutron.agent.l2.extensions'
def register_opts(conf):
agent_ext_manager.register_opts(conf)
agent_ext_mgr_config.register_agent_ext_manager_opts(conf)
class L2AgentExtensionsManager(agent_ext_manager.AgentExtensionsManager):

@ -17,6 +17,7 @@ from oslo_log import log
from neutron._i18n import _LE
from neutron.agent import agent_extensions_manager as agent_ext_manager
from neutron.conf.agent import agent_extensions_manager as agent_ext_mgr_config
LOG = log.getLogger(__name__)
@ -25,7 +26,7 @@ L3_AGENT_EXT_MANAGER_NAMESPACE = 'neutron.agent.l3.extensions'
def register_opts(conf):
agent_ext_manager.register_opts(conf)
agent_ext_mgr_config.register_agent_ext_manager_opts(conf)
class L3AgentExtensionsManager(agent_ext_manager.AgentExtensionsManager):

@ -0,0 +1,25 @@
# 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 oslo_config import cfg
from neutron._i18n import _
AGENT_EXT_MANAGER_OPTS = [
cfg.ListOpt('extensions',
default=[],
help=_('Extensions list to use')),
]
def register_agent_ext_manager_opts(cfg=cfg.CONF):
cfg.register_opts(AGENT_EXT_MANAGER_OPTS, 'agent')

@ -0,0 +1,32 @@
# Copyright (c) 2016 Mellanox Technologies, Ltd
# 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 oslo_config import cfg
from neutron._i18n import _
# if shared_physical_device_mappings is not configured KeyError will be thrown
fdb_population_opt = [
cfg.ListOpt('shared_physical_device_mappings', default=[],
help=_("Comma-separated list of "
"<physical_network>:<network_device> tuples mapping "
"physical network names to the agent's node-specific "
"shared physical network device between "
"SR-IOV and OVS or SR-IOV and linux bridge"))
]
def register_fdb_population_opts(cfg=cfg.CONF):
cfg.register_opts(fdb_population_opt, 'FDB')

@ -17,7 +17,6 @@ import operator
from keystoneauth1 import loading as ks_loading
from oslo_config import cfg
import neutron.agent.agent_extensions_manager
import neutron.agent.common.config
import neutron.agent.linux.interface
import neutron.agent.linux.pd
@ -25,6 +24,8 @@ import neutron.agent.linux.ra
import neutron.agent.metadata.config
import neutron.agent.ovsdb.api
import neutron.agent.securitygroups_rpc
import neutron.common.cache_utils
import neutron.conf.agent.agent_extensions_manager
import neutron.conf.agent.dhcp
import neutron.conf.agent.l3.config
import neutron.conf.agent.l3.ha
@ -183,7 +184,8 @@ def list_linux_bridge_opts():
('agent',
itertools.chain(
neutron.conf.plugins.ml2.drivers.agent.agent_opts,
neutron.agent.agent_extensions_manager.AGENT_EXT_MANAGER_OPTS)
neutron.conf.agent.agent_extensions_manager.
AGENT_EXT_MANAGER_OPTS)
),
('securitygroup',
neutron.conf.agent.securitygroups_rpc.security_group_opts)
@ -268,7 +270,8 @@ def list_ovs_opts():
itertools.chain(
neutron.plugins.ml2.drivers.openvswitch.agent.common.config.
agent_opts,
neutron.agent.agent_extensions_manager.AGENT_EXT_MANAGER_OPTS)
neutron.conf.agent.agent_extensions_manager.
AGENT_EXT_MANAGER_OPTS)
),
('securitygroup',
neutron.conf.agent.securitygroups_rpc.security_group_opts)
@ -281,7 +284,7 @@ def list_sriov_agent_opts():
neutron.plugins.ml2.drivers.mech_sriov.agent.common.config.
sriov_nic_opts),
('agent',
neutron.agent.agent_extensions_manager.AGENT_EXT_MANAGER_OPTS)
neutron.conf.agent.agent_extensions_manager.AGENT_EXT_MANAGER_OPTS)
]

@ -14,6 +14,7 @@ import mock
from oslo_config import cfg
from neutron.agent import agent_extensions_manager as ext_manager
from neutron.conf.agent import agent_extensions_manager as ext_manager_config
from neutron.tests import base
@ -24,7 +25,7 @@ class TestAgentExtensionsManager(base.BaseTestCase):
mock.patch('neutron.agent.l2.extensions.qos.QosAgentExtension',
autospec=True).start()
conf = cfg.CONF
ext_manager.register_opts(conf)
ext_manager_config.register_agent_ext_manager_opts()
cfg.CONF.set_override('extensions', ['qos'], 'agent')
namespace = 'neutron.agent.l2.extensions'
self.manager = ext_manager.AgentExtensionsManager(conf, namespace)

Loading…
Cancel
Save