Browse Source

Refactoring agent linux&ovsdb config

Refactoring neutron agent linux and ovsdb config opts
to be in neutron/conf/agent so that all the config options
reside in a centralized location. This simplifies the
process of looking up the config opts and provides an easy
way to import.

NeutronLibImpact

Change-Id: Ib1e0e63dec2985c417412d1ecc68e2a74ef87182
Partial-Bug: #1563069
tags/12.0.0.0b1
sindhu devale 2 years ago
parent
commit
51ca683797

+ 4
- 2
neutron/agent/common/ip_lib.py View File

@@ -17,11 +17,13 @@ import os
17 17
 
18 18
 if os.name == 'nt':
19 19
     from neutron.agent.windows import ip_lib
20
+    from neutron.conf.agent import windows
21
+    OPTS = windows.IP_LIB_OPTS_WINDOWS
20 22
 else:
21 23
     from neutron.agent.linux import ip_lib
24
+    from neutron.conf.agent import linux
25
+    OPTS = linux.IP_LIB_OPTS_LINUX
22 26
 
23 27
 
24
-OPTS = ip_lib.OPTS
25
-
26 28
 IPWrapper = ip_lib.IPWrapper
27 29
 IPDevice = ip_lib.IPDevice

+ 1
- 2
neutron/agent/dhcp_agent.py View File

@@ -19,7 +19,6 @@ import sys
19 19
 from oslo_config import cfg
20 20
 from oslo_service import service
21 21
 
22
-from neutron.agent.linux import interface
23 22
 from neutron.common import config as common_config
24 23
 from neutron.common import topics
25 24
 from neutron.conf.agent import common as config
@@ -34,7 +33,7 @@ def register_options(conf):
34 33
     config.register_availability_zone_opts_helper(conf)
35 34
     dhcp_config.register_agent_dhcp_opts(conf)
36 35
     meta_conf.register_meta_conf_opts(meta_conf.SHARED_OPTS, conf)
37
-    conf.register_opts(interface.OPTS)
36
+    config.register_interface_opts(conf)
38 37
 
39 38
 
40 39
 def main():

+ 4
- 8
neutron/agent/l3_agent.py View File

@@ -19,10 +19,6 @@ import sys
19 19
 from oslo_config import cfg
20 20
 from oslo_service import service
21 21
 
22
-from neutron.agent.linux import external_process
23
-from neutron.agent.linux import interface
24
-from neutron.agent.linux import pd
25
-from neutron.agent.linux import ra
26 22
 from neutron.common import config as common_config
27 23
 from neutron.common import topics
28 24
 from neutron.conf.agent import common as config
@@ -38,10 +34,10 @@ def register_opts(conf):
38 34
     meta_conf.register_meta_conf_opts(meta_conf.SHARED_OPTS, conf)
39 35
     config.register_interface_driver_opts_helper(conf)
40 36
     config.register_agent_state_opts_helper(conf)
41
-    conf.register_opts(interface.OPTS)
42
-    conf.register_opts(external_process.OPTS)
43
-    conf.register_opts(pd.OPTS)
44
-    conf.register_opts(ra.OPTS)
37
+    config.register_interface_opts(conf)
38
+    config.register_external_process_opts(conf)
39
+    config.register_pddriver_opts(conf)
40
+    config.register_ra_opts(conf)
45 41
     config.register_availability_zone_opts_helper(conf)
46 42
 
47 43
 

+ 2
- 10
neutron/agent/linux/external_process.py View File

@@ -24,23 +24,15 @@ from oslo_utils import fileutils
24 24
 import psutil
25 25
 import six
26 26
 
27
-from neutron._i18n import _
28 27
 from neutron.agent.linux import ip_lib
29 28
 from neutron.agent.linux import utils
30
-
31 29
 from neutron.conf.agent import common as agent_cfg
32 30
 
33
-LOG = logging.getLogger(__name__)
34
-
35 31
 
36
-OPTS = [
37
-    cfg.StrOpt('external_pids',
38
-               default='$state_path/external/pids',
39
-               help=_('Location to store child pid files')),
40
-]
32
+LOG = logging.getLogger(__name__)
41 33
 
42 34
 
43
-cfg.CONF.register_opts(OPTS)
35
+agent_cfg.register_external_process_opts()
44 36
 agent_cfg.register_process_monitor_opts(cfg.CONF)
45 37
 
46 38
 

+ 0
- 15
neutron/agent/linux/interface.py View File

@@ -18,32 +18,17 @@ import time
18 18
 
19 19
 import netaddr
20 20
 from neutron_lib import constants
21
-from oslo_config import cfg
22 21
 from oslo_log import log as logging
23 22
 import six
24 23
 
25
-from neutron._i18n import _
26 24
 from neutron.agent.common import ovs_lib
27 25
 from neutron.agent.linux import ip_lib
28 26
 from neutron.agent.linux import utils
29 27
 from neutron.common import constants as n_const
30 28
 from neutron.common import exceptions
31 29
 
32
-
33 30
 LOG = logging.getLogger(__name__)
34 31
 
35
-OPTS = [
36
-    cfg.StrOpt('ovs_integration_bridge',
37
-               default='br-int',
38
-               help=_('Name of Open vSwitch bridge to use')),
39
-    cfg.BoolOpt('ovs_use_veth',
40
-                default=False,
41
-                help=_('Uses veth for an OVS interface or not. '
42
-                       'Support kernels with limited namespace support '
43
-                       '(e.g. RHEL 6.5) so long as ovs_use_veth is set to '
44
-                       'True.')),
45
-]
46
-
47 32
 
48 33
 def _get_veth(name1, name2, namespace2):
49 34
     return (ip_lib.IPDevice(name1),

+ 0
- 5
neutron/agent/linux/ip_lib.py View File

@@ -35,11 +35,6 @@ from neutron.privileged.agent.linux import ip_lib as privileged
35 35
 
36 36
 LOG = logging.getLogger(__name__)
37 37
 
38
-OPTS = [
39
-    cfg.BoolOpt('ip_lib_force_root',
40
-                default=False,
41
-                help=_('Force ip_lib calls to use the root helper')),
42
-]
43 38
 
44 39
 IP_NONLOCAL_BIND = 'net.ipv4.ip_nonlocal_bind'
45 40
 

+ 0
- 8
neutron/agent/linux/pd.py View File

@@ -21,24 +21,16 @@ from neutron_lib.callbacks import events
21 21
 from neutron_lib.callbacks import registry
22 22
 from neutron_lib.callbacks import resources
23 23
 from neutron_lib import constants as n_const
24
-from oslo_config import cfg
25 24
 from oslo_log import log as logging
26 25
 from oslo_utils import netutils
27 26
 import six
28 27
 from stevedore import driver
29 28
 
30
-from neutron._i18n import _
31 29
 from neutron.common import constants as l3_constants
32 30
 from neutron.common import utils
33 31
 
34 32
 LOG = logging.getLogger(__name__)
35 33
 
36
-OPTS = [
37
-    cfg.StrOpt('pd_dhcp_driver',
38
-               default='dibbler',
39
-               help=_('Service to handle DHCPv6 Prefix delegation.')),
40
-]
41
-
42 34
 
43 35
 class PrefixDelegation(object):
44 36
     def __init__(self, context, pmon, intf_driver, notifier, pd_update_cb,

+ 2
- 13
neutron/agent/linux/pd_driver.py View File

@@ -15,22 +15,11 @@
15 15
 
16 16
 import abc
17 17
 
18
-from oslo_config import cfg
19 18
 import six
20 19
 
21
-from neutron._i18n import _
20
+from neutron.conf.agent import common as agent_conf
22 21
 
23
-OPTS = [
24
-    cfg.StrOpt('pd_confs',
25
-               default='$state_path/pd',
26
-               help=_('Location to store IPv6 PD files.')),
27
-    cfg.StrOpt('vendor_pen',
28
-               default='8888',
29
-               help=_("A decimal value as Vendor's Registered Private "
30
-                      "Enterprise Number as required by RFC3315 DUID-EN.")),
31
-]
32
-
33
-cfg.CONF.register_opts(OPTS)
22
+agent_conf.register_pddriver_opts()
34 23
 
35 24
 
36 25
 @six.add_metaclass(abc.ABCMeta)

+ 0
- 14
neutron/agent/linux/ra.py View File

@@ -19,16 +19,13 @@ import jinja2
19 19
 import netaddr
20 20
 from neutron_lib import constants
21 21
 from neutron_lib.utils import file as file_utils
22
-from oslo_config import cfg
23 22
 from oslo_log import log as logging
24 23
 import six
25 24
 
26
-from neutron._i18n import _
27 25
 from neutron.agent.linux import external_process
28 26
 from neutron.agent.linux import utils
29 27
 from neutron.common import constants as n_const
30 28
 
31
-
32 29
 RADVD_SERVICE_NAME = 'radvd'
33 30
 RADVD_SERVICE_CMD = 'radvd'
34 31
 # We can configure max of 3 DNS servers in radvd RDNSS section.
@@ -36,17 +33,6 @@ MAX_RDNSS_ENTRIES = 3
36 33
 
37 34
 LOG = logging.getLogger(__name__)
38 35
 
39
-OPTS = [
40
-    cfg.StrOpt('ra_confs',
41
-               default='$state_path/ra',
42
-               help=_('Location to store IPv6 RA config files')),
43
-    cfg.IntOpt('min_rtr_adv_interval',
44
-               default=30,
45
-               help=_('MinRtrAdvInterval setting for radvd.conf')),
46
-    cfg.IntOpt('max_rtr_adv_interval',
47
-               default=100,
48
-               help=_('MaxRtrAdvInterval setting for radvd.conf')),
49
-]
50 36
 
51 37
 CONFIG_TEMPLATE = jinja2.Template("""interface {{ interface_name }}
52 38
 {

+ 3
- 20
neutron/agent/ovsdb/api.py View File

@@ -21,7 +21,7 @@ from oslo_utils import importutils
21 21
 from ovsdbapp import api
22 22
 from ovsdbapp import exceptions
23 23
 
24
-from neutron._i18n import _
24
+from neutron.conf.agent import ovsdb_api
25 25
 
26 26
 API = moves.moved_class(api.API, 'API', __name__)
27 27
 Command = moves.moved_class(api.Command, 'Command', __name__)
@@ -29,31 +29,14 @@ Transaction = moves.moved_class(api.Transaction, 'Transaction', __name__)
29 29
 TimeoutException = moves.moved_class(exceptions.TimeoutException,
30 30
                                      'TimeoutException', __name__)
31 31
 
32
-interface_map = {
33
-    'vsctl': 'neutron.agent.ovsdb.impl_vsctl',
34
-    'native': 'neutron.agent.ovsdb.impl_idl',
35
-}
36 32
 
37
-OPTS = [
38
-    cfg.StrOpt('ovsdb_interface',
39
-               choices=interface_map.keys(),
40
-               default='native',
41
-               help=_('The interface for interacting with the OVSDB')),
42
-    cfg.StrOpt('ovsdb_connection',
43
-               default='tcp:127.0.0.1:6640',
44
-               help=_('The connection string for the OVSDB backend. '
45
-                      'Will be used by ovsdb-client when monitoring and '
46
-                      'used for the all ovsdb commands when native '
47
-                      'ovsdb_interface is enabled'
48
-                      ))
49
-]
50
-cfg.CONF.register_opts(OPTS, 'OVS')
33
+ovsdb_api.register_ovsdb_api_opts()
51 34
 
52 35
 
53 36
 def from_config(context, iface_name=None):
54 37
     """Return the configured OVSDB API implementation"""
55 38
     iface = importutils.import_module(
56
-        interface_map[iface_name or cfg.CONF.OVS.ovsdb_interface])
39
+        ovsdb_api.interface_map[iface_name or cfg.CONF.OVS.ovsdb_interface])
57 40
     return iface.api_factory(context)
58 41
 
59 42
 

+ 0
- 2
neutron/agent/windows/ip_lib.py View File

@@ -19,8 +19,6 @@ from oslo_log import log as logging
19 19
 
20 20
 LOG = logging.getLogger(__name__)
21 21
 
22
-OPTS = []
23
-
24 22
 
25 23
 class IPWrapper(object):
26 24
 

+ 1
- 3
neutron/cmd/netns_cleanup.py View File

@@ -29,7 +29,6 @@ from neutron.agent.l3 import dvr_snat_ns
29 29
 from neutron.agent.l3 import namespaces
30 30
 from neutron.agent.linux import dhcp
31 31
 from neutron.agent.linux import external_process
32
-from neutron.agent.linux import interface
33 32
 from neutron.agent.linux import ip_lib
34 33
 from neutron.agent.linux import utils
35 34
 from neutron.common import config
@@ -37,7 +36,6 @@ from neutron.conf.agent import cmd
37 36
 from neutron.conf.agent import common as agent_config
38 37
 from neutron.conf.agent import dhcp as dhcp_config
39 38
 
40
-
41 39
 LOG = logging.getLogger(__name__)
42 40
 LB_NS_PREFIX = 'qlbaas-'
43 41
 NS_PREFIXES = {
@@ -73,7 +71,7 @@ def setup_conf():
73 71
     cmd.register_cmd_opts(cmd.netns_opts, conf)
74 72
     agent_config.register_interface_driver_opts_helper(conf)
75 73
     dhcp_config.register_agent_dhcp_opts(conf)
76
-    conf.register_opts(interface.OPTS)
74
+    agent_config.register_interface_opts()
77 75
     return conf
78 76
 
79 77
 

+ 1
- 3
neutron/cmd/ovs_cleanup.py View File

@@ -17,7 +17,6 @@ from oslo_config import cfg
17 17
 from oslo_log import log as logging
18 18
 
19 19
 from neutron.agent.common import ovs_lib
20
-from neutron.agent.linux import interface
21 20
 from neutron.agent.linux import ip_lib
22 21
 from neutron.common import config
23 22
 from neutron.conf.agent import cmd
@@ -25,7 +24,6 @@ from neutron.conf.agent import common as agent_config
25 24
 from neutron.conf.agent.l3 import config as l3_config
26 25
 from neutron.plugins.ml2.drivers.openvswitch.agent.common import constants
27 26
 
28
-
29 27
 LOG = logging.getLogger(__name__)
30 28
 
31 29
 
@@ -39,8 +37,8 @@ def setup_conf():
39 37
     conf = cfg.CONF
40 38
     cmd.register_cmd_opts(cmd.ovs_opts, conf)
41 39
     l3_config.register_l3_agent_config_opts(l3_config.OPTS, conf)
42
-    conf.register_opts(interface.OPTS)
43 40
     agent_config.register_interface_driver_opts_helper(conf)
41
+    agent_config.register_interface_opts()
44 42
     return conf
45 43
 
46 44
 

+ 71
- 0
neutron/conf/agent/common.py View File

@@ -23,6 +23,57 @@ from neutron._i18n import _
23 23
 from neutron.common import config
24 24
 
25 25
 
26
+EXTERNAL_PROCESS_OPTS = [
27
+    cfg.StrOpt('external_pids',
28
+               default='$state_path/external/pids',
29
+               help=_('Location to store child pid files')),
30
+]
31
+
32
+
33
+PD_OPTS = [
34
+    cfg.StrOpt('pd_dhcp_driver',
35
+               default='dibbler',
36
+               help=_('Service to handle DHCPv6 Prefix delegation.')),
37
+]
38
+
39
+
40
+PD_DRIVER_OPTS = [
41
+    cfg.StrOpt('pd_confs',
42
+               default='$state_path/pd',
43
+               help=_('Location to store IPv6 PD files.')),
44
+    cfg.StrOpt('vendor_pen',
45
+               default='8888',
46
+               help=_("A decimal value as Vendor's Registered Private "
47
+                      "Enterprise Number as required by RFC3315 DUID-EN.")),
48
+]
49
+
50
+
51
+INTERFACE_OPTS = [
52
+    cfg.StrOpt('ovs_integration_bridge',
53
+               default='br-int',
54
+               help=_('Name of Open vSwitch bridge to use')),
55
+    cfg.BoolOpt('ovs_use_veth',
56
+                default=False,
57
+                help=_('Uses veth for an OVS interface or not. '
58
+                       'Support kernels with limited namespace support '
59
+                       '(e.g. RHEL 6.5) so long as ovs_use_veth is set to '
60
+                       'True.')),
61
+]
62
+
63
+
64
+RA_OPTS = [
65
+    cfg.StrOpt('ra_confs',
66
+               default='$state_path/ra',
67
+               help=_('Location to store IPv6 RA config files')),
68
+    cfg.IntOpt('min_rtr_adv_interval',
69
+               default=30,
70
+               help=_('MinRtrAdvInterval setting for radvd.conf')),
71
+    cfg.IntOpt('max_rtr_adv_interval',
72
+               default=100,
73
+               help=_('MaxRtrAdvInterval setting for radvd.conf')),
74
+]
75
+
76
+
26 77
 ROOT_HELPER_OPTS = [
27 78
     cfg.StrOpt('root_helper', default='sudo',
28 79
                help=_("Root helper application. "
@@ -131,6 +182,26 @@ def get_log_args(conf, log_file_name, **kwargs):
131 182
     return cmd_args
132 183
 
133 184
 
185
+def register_external_process_opts(cfg=cfg.CONF):
186
+    cfg.register_opts(EXTERNAL_PROCESS_OPTS)
187
+
188
+
189
+def register_pd_opts(cfg=cfg.CONF):
190
+    cfg.register_opts(PD_OPTS)
191
+
192
+
193
+def register_pddriver_opts(cfg=cfg.CONF):
194
+    cfg.register_opts(PD_DRIVER_OPTS)
195
+
196
+
197
+def register_interface_opts(cfg=cfg.CONF):
198
+    cfg.register_opts(INTERFACE_OPTS)
199
+
200
+
201
+def register_ra_opts(cfg=cfg.CONF):
202
+    cfg.register_opts(RA_OPTS)
203
+
204
+
134 205
 def register_root_helper(conf=cfg.CONF):
135 206
     conf.register_opts(ROOT_HELPER_OPTS, 'AGENT')
136 207
 

+ 28
- 0
neutron/conf/agent/linux.py View File

@@ -0,0 +1,28 @@
1
+# Copyright 2017 OpenStack Foundation
2
+# All Rights Reserved.
3
+#
4
+#    Licensed under the Apache License, Version 2.0 (the "License"); you may
5
+#    not use this file except in compliance with the License. You may obtain
6
+#    a copy of the License at
7
+#
8
+#         http://www.apache.org/licenses/LICENSE-2.0
9
+#
10
+#    Unless required by applicable law or agreed to in writing, software
11
+#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+#    License for the specific language governing permissions and limitations
14
+#    under the License.
15
+
16
+from neutron._i18n import _
17
+
18
+from oslo_config import cfg
19
+
20
+IP_LIB_OPTS_LINUX = [
21
+    cfg.BoolOpt('ip_lib_force_root',
22
+                default=False,
23
+                help=_('Force ip_lib calls to use the root helper')),
24
+]
25
+
26
+
27
+def register_iplib_opts(cfg=cfg.CONF):
28
+    cfg.register_opts(IP_LIB_OPTS_LINUX)

+ 42
- 0
neutron/conf/agent/ovsdb_api.py View File

@@ -0,0 +1,42 @@
1
+# Copyright 2017 OpenStack Foundation
2
+# All Rights Reserved.
3
+#
4
+#    Licensed under the Apache License, Version 2.0 (the "License"); you may
5
+#    not use this file except in compliance with the License. You may obtain
6
+#    a copy of the License at
7
+#
8
+#         http://www.apache.org/licenses/LICENSE-2.0
9
+#
10
+#    Unless required by applicable law or agreed to in writing, software
11
+#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+#    License for the specific language governing permissions and limitations
14
+#    under the License.
15
+
16
+from neutron._i18n import _
17
+from oslo_config import cfg
18
+
19
+
20
+interface_map = {
21
+    'vsctl': 'neutron.agent.ovsdb.impl_vsctl',
22
+    'native': 'neutron.agent.ovsdb.impl_idl',
23
+}
24
+
25
+
26
+API_OPTS = [
27
+    cfg.StrOpt('ovsdb_interface',
28
+               choices=interface_map.keys(),
29
+               default='native',
30
+               help=_('The interface for interacting with the OVSDB')),
31
+    cfg.StrOpt('ovsdb_connection',
32
+               default='tcp:127.0.0.1:6640',
33
+               help=_('The connection string for the OVSDB backend. '
34
+                      'Will be used by ovsdb-client when monitoring and '
35
+                      'used for the all ovsdb commands when native '
36
+                      'ovsdb_interface is enabled'
37
+                      ))
38
+]
39
+
40
+
41
+def register_ovsdb_api_opts(cfg=cfg.CONF):
42
+    cfg.register_opts(API_OPTS, 'OVS')

+ 17
- 0
neutron/conf/agent/windows.py View File

@@ -0,0 +1,17 @@
1
+# Copyright 2017 OpenStack Foundation
2
+# All Rights Reserved.
3
+#
4
+#    Licensed under the Apache License, Version 2.0 (the "License"); you may
5
+#    not use this file except in compliance with the License. You may obtain
6
+#    a copy of the License at
7
+#
8
+#         http://www.apache.org/licenses/LICENSE-2.0
9
+#
10
+#    Unless required by applicable law or agreed to in writing, software
11
+#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+#    License for the specific language governing permissions and limitations
14
+#    under the License.
15
+
16
+
17
+IP_LIB_OPTS_WINDOWS = []

+ 1
- 2
neutron/debug/shell.py View File

@@ -20,7 +20,6 @@ from oslo_utils import importutils
20 20
 
21 21
 from neutron._i18n import _
22 22
 from neutron.agent.common import utils
23
-from neutron.agent.linux import interface
24 23
 from neutron.conf.agent import common as config
25 24
 from neutron.debug import debug_agent
26 25
 from neutronclient.common import exceptions as exc
@@ -71,7 +70,7 @@ class NeutronDebugShell(shell.NeutronShell):
71 70
                 _("You must provide a config file for bridge -"
72 71
                   " either --config-file or env[NEUTRON_TEST_CONFIG_FILE]"))
73 72
         client = self.client_manager.neutron
74
-        cfg.CONF.register_opts(interface.OPTS)
73
+        config.register_interface_opts()
75 74
         cfg.CONF.register_opts(config.EXT_NET_BRIDGE_OPTS)
76 75
         config.register_interface_driver_opts_helper(cfg.CONF)
77 76
         cfg.CONF(['--config-file', self.options.config_file])

+ 7
- 9
neutron/opts.py View File

@@ -18,10 +18,6 @@ from keystoneauth1 import loading as ks_loading
18 18
 from oslo_config import cfg
19 19
 
20 20
 import neutron.agent.agent_extensions_manager
21
-import neutron.agent.linux.interface
22
-import neutron.agent.linux.pd
23
-import neutron.agent.linux.ra
24
-import neutron.agent.ovsdb.api
25 21
 import neutron.agent.securitygroups_rpc
26 22
 import neutron.common.cache_utils
27 23
 import neutron.conf.agent.agent_extensions_manager
@@ -29,8 +25,10 @@ import neutron.conf.agent.common
29 25
 import neutron.conf.agent.dhcp
30 26
 import neutron.conf.agent.l3.config
31 27
 import neutron.conf.agent.l3.ha
28
+import neutron.conf.agent.linux
32 29
 import neutron.conf.agent.metadata.config as meta_conf
33 30
 import neutron.conf.agent.ovs_conf
31
+import neutron.conf.agent.ovsdb_api
34 32
 import neutron.conf.agent.xenapi_conf
35 33
 import neutron.conf.cache_utils
36 34
 import neutron.conf.common
@@ -146,12 +144,12 @@ def list_base_agent_opts():
146 144
     return [
147 145
         ('DEFAULT',
148 146
          itertools.chain(
149
-             neutron.agent.linux.interface.OPTS,
147
+             neutron.conf.agent.common.INTERFACE_OPTS,
150 148
              neutron.conf.agent.common.INTERFACE_DRIVER_OPTS,
151 149
              neutron.conf.agent.ovs_conf.OPTS)
152 150
          ),
153 151
         ('agent', neutron.conf.agent.common.AGENT_STATE_OPTS),
154
-        ('ovs', neutron.agent.ovsdb.api.OPTS),
152
+        ('ovs', neutron.conf.agent.ovsdb_api.API_OPTS),
155 153
     ]
156 154
 
157 155
 
@@ -196,8 +194,8 @@ def list_l3_agent_opts():
196 194
              neutron.conf.agent.l3.config.OPTS,
197 195
              neutron.conf.service.service_opts,
198 196
              neutron.conf.agent.l3.ha.OPTS,
199
-             neutron.agent.linux.pd.OPTS,
200
-             neutron.agent.linux.ra.OPTS)
197
+             neutron.conf.agent.common.PD_DRIVER_OPTS,
198
+             neutron.conf.agent.common.RA_OPTS)
201 199
          ),
202 200
         ('agent',
203 201
          neutron.conf.agent.agent_extensions_manager.AGENT_EXT_MANAGER_OPTS),
@@ -258,7 +256,7 @@ def list_ovs_opts():
258 256
         ('ovs',
259 257
          itertools.chain(
260 258
              neutron.conf.plugins.ml2.drivers.ovs_conf.ovs_opts,
261
-             neutron.agent.ovsdb.api.OPTS)
259
+             neutron.conf.agent.ovsdb_api.API_OPTS)
262 260
          ),
263 261
         ('agent',
264 262
          itertools.chain(

+ 1
- 2
neutron/services/metering/drivers/iptables/iptables_driver.py View File

@@ -20,7 +20,6 @@ from oslo_utils import importutils
20 20
 from neutron._i18n import _
21 21
 from neutron.agent.l3 import dvr_snat_ns
22 22
 from neutron.agent.l3 import namespaces
23
-from neutron.agent.linux import interface
24 23
 from neutron.agent.linux import ip_lib
25 24
 from neutron.agent.linux import iptables_manager
26 25
 from neutron.common import constants
@@ -39,7 +38,7 @@ RULE = '-r-'
39 38
 LABEL = '-l-'
40 39
 
41 40
 config.register_interface_driver_opts_helper(cfg.CONF)
42
-cfg.CONF.register_opts(interface.OPTS)
41
+config.register_interface_opts()
43 42
 
44 43
 
45 44
 class IptablesManagerTransaction(object):

+ 1
- 1
neutron/tests/common/net_helpers.py View File

@@ -767,7 +767,7 @@ class OVSPortFixture(PortFixture):
767 767
         # machines as the port should be treated by OVS agent and not by
768 768
         # external party
769 769
         interface_config = cfg.ConfigOpts()
770
-        interface_config.register_opts(interface.OPTS)
770
+        config.register_interface_opts(interface_config)
771 771
         ovs_interface = interface.OVSInterfaceDriver(interface_config)
772 772
         ovs_interface.plug_new(
773 773
             None,

+ 1
- 1
neutron/tests/functional/agent/l2/base.py View File

@@ -70,8 +70,8 @@ class OVSAgentTestFramework(base.BaseOVSLinuxTestCase):
70 70
     def _get_config_opts(self):
71 71
         config = cfg.ConfigOpts()
72 72
         config.register_opts(common_config.core_opts)
73
-        config.register_opts(interface.OPTS)
74 73
         ovs_conf.register_ovs_agent_opts(config)
74
+        agent_config.register_interface_opts(config)
75 75
         agent_config.register_interface_driver_opts_helper(config)
76 76
         agent_config.register_agent_state_opts_helper(config)
77 77
         ext_manager.register_opts(config)

+ 2
- 3
neutron/tests/functional/agent/linux/test_dhcp.py View File

@@ -16,7 +16,6 @@ import mock
16 16
 from oslo_config import cfg
17 17
 
18 18
 from neutron.agent.linux import dhcp
19
-from neutron.agent.linux import interface
20 19
 from neutron.agent.linux import ip_lib
21 20
 from neutron.common import utils as common_utils
22 21
 from neutron.conf.agent import common as config
@@ -31,8 +30,8 @@ class TestDhcp(functional_base.BaseSudoTestCase):
31 30
     def setUp(self):
32 31
         super(TestDhcp, self).setUp()
33 32
         conf = cfg.ConfigOpts()
34
-        conf.register_opts(config.INTERFACE_DRIVER_OPTS)
35
-        conf.register_opts(interface.OPTS)
33
+        config.register_interface_driver_opts_helper(conf)
34
+        config.register_interface_opts(conf)
36 35
         conf.register_opts(common_conf.core_opts)
37 36
         conf.register_opts(dhcp_conf.DHCP_AGENT_OPTS)
38 37
         conf.set_override('interface_driver', 'openvswitch')

+ 3
- 2
neutron/tests/functional/agent/linux/test_interface.py View File

@@ -23,6 +23,7 @@ from neutron.agent.linux import interface
23 23
 from neutron.agent.linux import ip_lib
24 24
 from neutron.common import exceptions
25 25
 from neutron.common import utils
26
+from neutron.conf.agent import common as config
26 27
 from neutron.tests.common import net_helpers
27 28
 from neutron.tests.functional.agent.linux import base as linux_base
28 29
 from neutron.tests.functional import base
@@ -74,7 +75,7 @@ class OVSInterfaceDriverTestCase(linux_base.BaseOVSLinuxTestCase,
74 75
     def setUp(self):
75 76
         super(OVSInterfaceDriverTestCase, self).setUp()
76 77
         conf = cfg.ConfigOpts()
77
-        conf.register_opts(interface.OPTS)
78
+        config.register_interface_opts(conf)
78 79
         self.interface = interface.OVSInterfaceDriver(conf)
79 80
         self.bridge = self.useFixture(net_helpers.OVSBridgeFixture()).bridge
80 81
 
@@ -130,7 +131,7 @@ class BridgeInterfaceDriverTestCase(base.BaseSudoTestCase,
130 131
     def setUp(self):
131 132
         super(BridgeInterfaceDriverTestCase, self).setUp()
132 133
         conf = cfg.ConfigOpts()
133
-        conf.register_opts(interface.OPTS)
134
+        config.register_interface_opts(conf)
134 135
         self.interface = interface.BridgeInterfaceDriver(conf)
135 136
         self.bridge = self.useFixture(net_helpers.LinuxBridgeFixture()).bridge
136 137
 

+ 1
- 2
neutron/tests/functional/agent/linux/test_ip_lib.py View File

@@ -23,7 +23,6 @@ from oslo_log import log as logging
23 23
 from oslo_utils import importutils
24 24
 import testtools
25 25
 
26
-from neutron.agent.linux import interface
27 26
 from neutron.agent.linux import ip_lib
28 27
 from neutron.common import utils
29 28
 from neutron.conf.agent import common as config
@@ -49,7 +48,7 @@ class IpLibTestFramework(functional_base.BaseSudoTestCase):
49 48
         cfg.CONF.set_override(
50 49
             'interface_driver',
51 50
             'neutron.agent.linux.interface.OVSInterfaceDriver')
52
-        cfg.CONF.register_opts(interface.OPTS)
51
+        config.register_interface_opts()
53 52
         self.driver = importutils.import_object(cfg.CONF.interface_driver,
54 53
                                                 cfg.CONF)
55 54
 

+ 1
- 1
neutron/tests/unit/agent/common/test_utils.py View File

@@ -27,7 +27,7 @@ class TestLoadInterfaceDriver(base.BaseTestCase):
27 27
     def setUp(self):
28 28
         super(TestLoadInterfaceDriver, self).setUp()
29 29
         self.conf = config.setup_conf()
30
-        self.conf.register_opts(interface.OPTS)
30
+        config.register_interface_opts(self.conf)
31 31
         config.register_interface_driver_opts_helper(self.conf)
32 32
 
33 33
     def test_load_interface_driver_not_set(self):

+ 1
- 1
neutron/tests/unit/agent/dhcp/test_agent.py View File

@@ -262,7 +262,7 @@ class TestDhcpAgent(base.BaseTestCase):
262 262
                     cfg.CONF.register_opts(dhcp_config.DHCP_AGENT_OPTS)
263 263
                     config.register_interface_driver_opts_helper(cfg.CONF)
264 264
                     config.register_agent_state_opts_helper(cfg.CONF)
265
-                    cfg.CONF.register_opts(interface.OPTS)
265
+                    config.register_interface_opts(cfg.CONF)
266 266
                     common_config.init(sys.argv[1:])
267 267
                     agent_mgr = dhcp_agent.DhcpAgentWithStateReport(
268 268
                         'testhost')

+ 4
- 5
neutron/tests/unit/agent/l3/test_agent.py View File

@@ -41,7 +41,6 @@ from neutron.agent.l3 import namespaces
41 41
 from neutron.agent.l3 import router_info as l3router
42 42
 from neutron.agent.l3 import router_processing_queue
43 43
 from neutron.agent.linux import dibbler
44
-from neutron.agent.linux import external_process
45 44
 from neutron.agent.linux import interface
46 45
 from neutron.agent.linux import iptables_manager
47 46
 from neutron.agent.linux import pd
@@ -77,10 +76,10 @@ class BasicRouterOperationsFramework(base.BaseTestCase):
77 76
         agent_config.register_interface_driver_opts_helper(self.conf)
78 77
         agent_config.register_process_monitor_opts(self.conf)
79 78
         agent_config.register_availability_zone_opts_helper(self.conf)
80
-        self.conf.register_opts(interface.OPTS)
81
-        self.conf.register_opts(external_process.OPTS)
82
-        self.conf.register_opts(pd.OPTS)
83
-        self.conf.register_opts(ra.OPTS)
79
+        agent_config.register_interface_opts(self.conf)
80
+        agent_config.register_external_process_opts(self.conf)
81
+        agent_config.register_pd_opts(self.conf)
82
+        agent_config.register_ra_opts(self.conf)
84 83
         self.conf.set_override('interface_driver',
85 84
                                'neutron.agent.linux.interface.NullDriver')
86 85
         self.conf.set_override('state_path', cfg.CONF.state_path)

+ 2
- 3
neutron/tests/unit/agent/l3/test_dvr_local_router.py View File

@@ -25,7 +25,6 @@ from neutron.agent.l3 import dvr_edge_router as dvr_edge_rtr
25 25
 from neutron.agent.l3 import dvr_local_router as dvr_router
26 26
 from neutron.agent.l3 import link_local_allocator as lla
27 27
 from neutron.agent.l3 import router_info
28
-from neutron.agent.linux import external_process
29 28
 from neutron.agent.linux import interface
30 29
 from neutron.agent.linux import ip_lib
31 30
 from neutron.common import constants as n_const
@@ -55,8 +54,8 @@ class TestDvrRouterOperations(base.BaseTestCase):
55 54
         ha_conf.register_l3_agent_ha_opts(self.conf)
56 55
         agent_config.register_interface_driver_opts_helper(self.conf)
57 56
         agent_config.register_process_monitor_opts(self.conf)
58
-        self.conf.register_opts(interface.OPTS)
59
-        self.conf.register_opts(external_process.OPTS)
57
+        agent_config.register_interface_opts(self.conf)
58
+        agent_config.register_external_process_opts(self.conf)
60 59
         self.conf.set_override('interface_driver',
61 60
                                'neutron.agent.linux.interface.NullDriver')
62 61
         self.conf.set_override('state_path', cfg.CONF.state_path)

+ 1
- 2
neutron/tests/unit/agent/linux/test_dhcp.py View File

@@ -25,7 +25,6 @@ from oslo_utils import fileutils
25 25
 import testtools
26 26
 
27 27
 from neutron.agent.linux import dhcp
28
-from neutron.agent.linux import external_process
29 28
 from neutron.common import constants as n_const
30 29
 from neutron.conf.agent import common as config
31 30
 from neutron.conf.agent import dhcp as dhcp_config
@@ -940,7 +939,7 @@ class TestConfBase(base.BaseTestCase):
940 939
         self.conf.register_opts(base_config.core_opts)
941 940
         self.conf.register_opts(dhcp_config.DHCP_OPTS)
942 941
         self.conf.register_opts(dhcp_config.DNSMASQ_OPTS)
943
-        self.conf.register_opts(external_process.OPTS)
942
+        config.register_external_process_opts(self.conf)
944 943
         config.register_interface_driver_opts_helper(self.conf)
945 944
 
946 945
 

+ 1
- 1
neutron/tests/unit/agent/linux/test_interface.py View File

@@ -58,7 +58,7 @@ class TestBase(base.BaseTestCase):
58 58
     def setUp(self):
59 59
         super(TestBase, self).setUp()
60 60
         self.conf = config.setup_conf()
61
-        self.conf.register_opts(interface.OPTS)
61
+        config.register_interface_opts(self.conf)
62 62
         self.ip_dev_p = mock.patch.object(ip_lib, 'IPDevice')
63 63
         self.ip_dev = self.ip_dev_p.start()
64 64
         self.ip_p = mock.patch.object(ip_lib, 'IPWrapper')

+ 1
- 1
neutron/tests/unit/debug/test_commands.py View File

@@ -35,7 +35,7 @@ class MyApp(object):
35 35
 class TestDebugCommands(base.BaseTestCase):
36 36
     def setUp(self):
37 37
         super(TestDebugCommands, self).setUp()
38
-        cfg.CONF.register_opts(interface.OPTS)
38
+        config.register_interface_opts()
39 39
         cfg.CONF.register_opts(config.EXT_NET_BRIDGE_OPTS)
40 40
         common_config.init([])
41 41
         config.register_interface_driver_opts_helper(cfg.CONF)

Loading…
Cancel
Save