blob: 804fece5357fc7c1c5816d9269f44935b82214e1 [file] [log] [blame]
Maru Newbyb096d9f2015-03-09 18:54:54 +00001# Licensed under the Apache License, Version 2.0 (the "License"); you may
2# not use this file except in compliance with the License. You may obtain
3# a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10# License for the specific language governing permissions and limitations
11# under the License.
12
Ihar Hrachyshkac695f9f2015-02-26 23:26:41 +010013from oslo_config import cfg
Maru Newby5690a352015-03-13 18:46:40 +000014
Assaf Mullerd22ca2e2016-01-19 11:47:14 -050015from tempest import config
16
Assaf Muller65cc2d22016-04-07 17:56:03 -040017
Assaf Mullerd22ca2e2016-01-19 11:47:14 -050018CONF = config.CONF
Maru Newbyb096d9f2015-03-09 18:54:54 +000019
20
Assaf Mullerd22ca2e2016-01-19 11:47:14 -050021NeutronPluginOptions = [
Armando Migliaccio7f84c422017-02-21 18:43:38 -080022 cfg.ListOpt('provider_vlans',
23 default=[],
24 help='List of provider networks available in the deployment.'),
Yuuichi Fujioka1257b572015-06-10 17:18:12 +090025 cfg.BoolOpt('specify_floating_ip_address_available',
26 default=True,
27 help='Allow passing an IP Address of the floating ip when '
Hynek Mlnarikc5106762016-09-01 11:47:31 +020028 'creating the floating ip'),
29 cfg.ListOpt('available_type_drivers',
30 default=[],
31 help='List of network types available to neutron, '
32 'e.g. vxlan,vlan,gre.'),
Genadi Chereshnyae91b69c2017-07-16 09:51:58 +030033 cfg.BoolOpt('image_is_advanced',
34 default=False,
35 help='Image that supports features that cirros does not, like'
36 ' Ubuntu or CentOS supporting advanced features'),
Chandan Kumarc125fd12017-11-15 19:41:01 +053037 cfg.StrOpt('agent_availability_zone',
38 help='The availability zone for all agents in the deployment. '
39 'Configure this only when the single value is used by '
40 'all agents in the deployment.'),
Hynek Mlnarikc5106762016-09-01 11:47:31 +020041]
Maru Newbyb096d9f2015-03-09 18:54:54 +000042
Assaf Mullerd22ca2e2016-01-19 11:47:14 -050043# TODO(amuller): Redo configuration options registration as part of the planned
44# transition to the Tempest plugin architecture
45for opt in NeutronPluginOptions:
46 CONF.register_opt(opt, 'neutron_plugin_options')
Assaf Muller65cc2d22016-04-07 17:56:03 -040047
48
49config_opts_translator = {
50 'project_network_cidr': 'tenant_network_cidr',
51 'project_network_v6_cidr': 'tenant_network_v6_cidr',
52 'project_network_mask_bits': 'tenant_network_mask_bits',
53 'project_network_v6_mask_bits': 'tenant_network_v6_mask_bits'}
54
55
56def safe_get_config_value(group, name):
57 """Safely get Oslo config opts from Tempest, using old and new names."""
58 conf_group = getattr(CONF, group)
59
60 try:
61 return getattr(conf_group, name)
62 except cfg.NoSuchOptError:
63 return getattr(conf_group, config_opts_translator[name])