Maru Newby | b096d9f | 2015-03-09 18:54:54 +0000 | [diff] [blame] | 1 | # 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 Hrachyshka | c695f9f | 2015-02-26 23:26:41 +0100 | [diff] [blame] | 13 | from oslo_config import cfg |
Maru Newby | 5690a35 | 2015-03-13 18:46:40 +0000 | [diff] [blame] | 14 | |
Assaf Muller | d22ca2e | 2016-01-19 11:47:14 -0500 | [diff] [blame] | 15 | from tempest import config |
| 16 | |
Assaf Muller | 65cc2d2 | 2016-04-07 17:56:03 -0400 | [diff] [blame] | 17 | |
Assaf Muller | d22ca2e | 2016-01-19 11:47:14 -0500 | [diff] [blame] | 18 | CONF = config.CONF |
Maru Newby | b096d9f | 2015-03-09 18:54:54 +0000 | [diff] [blame] | 19 | |
| 20 | |
Assaf Muller | d22ca2e | 2016-01-19 11:47:14 -0500 | [diff] [blame] | 21 | NeutronPluginOptions = [ |
Armando Migliaccio | 7f84c42 | 2017-02-21 18:43:38 -0800 | [diff] [blame] | 22 | cfg.ListOpt('provider_vlans', |
| 23 | default=[], |
| 24 | help='List of provider networks available in the deployment.'), |
Yuuichi Fujioka | 1257b57 | 2015-06-10 17:18:12 +0900 | [diff] [blame] | 25 | cfg.BoolOpt('specify_floating_ip_address_available', |
| 26 | default=True, |
| 27 | help='Allow passing an IP Address of the floating ip when ' |
Hynek Mlnarik | c510676 | 2016-09-01 11:47:31 +0200 | [diff] [blame] | 28 | '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 Chereshnya | e91b69c | 2017-07-16 09:51:58 +0300 | [diff] [blame] | 33 | 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 Kumar | c125fd1 | 2017-11-15 19:41:01 +0530 | [diff] [blame] | 37 | 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.'), |
Yariv Rachmani | fed6f86 | 2017-12-19 11:55:25 +0200 | [diff] [blame] | 41 | cfg.IntOpt('max_networks_per_project', |
| 42 | default=4, |
| 43 | help='Max number of networks per project. ' |
| 44 | 'Configure this only when project is limited with real ' |
| 45 | 'vlans in deployment.'), |
Dongcan Ye | 91017ca | 2018-02-11 10:46:03 +0000 | [diff] [blame^] | 46 | cfg.StrOpt('l3_agent_mode', |
| 47 | help='The agent mode for L3 agents in the deployment. ' |
| 48 | 'Configure this only when the single value is used by ' |
| 49 | 'all agents in the deployment.'), |
Hynek Mlnarik | c510676 | 2016-09-01 11:47:31 +0200 | [diff] [blame] | 50 | ] |
Maru Newby | b096d9f | 2015-03-09 18:54:54 +0000 | [diff] [blame] | 51 | |
Assaf Muller | d22ca2e | 2016-01-19 11:47:14 -0500 | [diff] [blame] | 52 | # TODO(amuller): Redo configuration options registration as part of the planned |
| 53 | # transition to the Tempest plugin architecture |
| 54 | for opt in NeutronPluginOptions: |
| 55 | CONF.register_opt(opt, 'neutron_plugin_options') |
Assaf Muller | 65cc2d2 | 2016-04-07 17:56:03 -0400 | [diff] [blame] | 56 | |
| 57 | |
| 58 | config_opts_translator = { |
| 59 | 'project_network_cidr': 'tenant_network_cidr', |
| 60 | 'project_network_v6_cidr': 'tenant_network_v6_cidr', |
| 61 | 'project_network_mask_bits': 'tenant_network_mask_bits', |
| 62 | 'project_network_v6_mask_bits': 'tenant_network_v6_mask_bits'} |
| 63 | |
| 64 | |
| 65 | def safe_get_config_value(group, name): |
| 66 | """Safely get Oslo config opts from Tempest, using old and new names.""" |
| 67 | conf_group = getattr(CONF, group) |
| 68 | |
| 69 | try: |
| 70 | return getattr(conf_group, name) |
| 71 | except cfg.NoSuchOptError: |
| 72 | return getattr(conf_group, config_opts_translator[name]) |