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 |
Assaf Muller | d22ca2e | 2016-01-19 11:47:14 -0500 | [diff] [blame] | 14 | from tempest import config |
| 15 | |
Assaf Muller | 65cc2d2 | 2016-04-07 17:56:03 -0400 | [diff] [blame] | 16 | |
Assaf Muller | d22ca2e | 2016-01-19 11:47:14 -0500 | [diff] [blame] | 17 | CONF = config.CONF |
Maru Newby | b096d9f | 2015-03-09 18:54:54 +0000 | [diff] [blame] | 18 | |
| 19 | |
Assaf Muller | d22ca2e | 2016-01-19 11:47:14 -0500 | [diff] [blame] | 20 | NeutronPluginOptions = [ |
Armando Migliaccio | 7f84c42 | 2017-02-21 18:43:38 -0800 | [diff] [blame] | 21 | cfg.ListOpt('provider_vlans', |
| 22 | default=[], |
| 23 | help='List of provider networks available in the deployment.'), |
Yuuichi Fujioka | 1257b57 | 2015-06-10 17:18:12 +0900 | [diff] [blame] | 24 | cfg.BoolOpt('specify_floating_ip_address_available', |
| 25 | default=True, |
| 26 | help='Allow passing an IP Address of the floating ip when ' |
Hynek Mlnarik | c510676 | 2016-09-01 11:47:31 +0200 | [diff] [blame] | 27 | 'creating the floating ip'), |
| 28 | cfg.ListOpt('available_type_drivers', |
| 29 | default=[], |
| 30 | help='List of network types available to neutron, ' |
| 31 | 'e.g. vxlan,vlan,gre.'), |
Genadi Chereshnya | e91b69c | 2017-07-16 09:51:58 +0300 | [diff] [blame] | 32 | cfg.BoolOpt('image_is_advanced', |
| 33 | default=False, |
| 34 | help='Image that supports features that cirros does not, like' |
| 35 | ' Ubuntu or CentOS supporting advanced features'), |
Chandan Kumar | c125fd1 | 2017-11-15 19:41:01 +0530 | [diff] [blame] | 36 | cfg.StrOpt('agent_availability_zone', |
| 37 | help='The availability zone for all agents in the deployment. ' |
| 38 | 'Configure this only when the single value is used by ' |
| 39 | 'all agents in the deployment.'), |
Yariv Rachmani | fed6f86 | 2017-12-19 11:55:25 +0200 | [diff] [blame] | 40 | cfg.IntOpt('max_networks_per_project', |
| 41 | default=4, |
| 42 | help='Max number of networks per project. ' |
| 43 | 'Configure this only when project is limited with real ' |
| 44 | 'vlans in deployment.'), |
Dongcan Ye | 91017ca | 2018-02-11 10:46:03 +0000 | [diff] [blame] | 45 | cfg.StrOpt('l3_agent_mode', |
| 46 | help='The agent mode for L3 agents in the deployment. ' |
| 47 | 'Configure this only when the single value is used by ' |
| 48 | 'all agents in the deployment.'), |
Yariv Rachmani | 9497088 | 2018-03-04 11:35:17 +0200 | [diff] [blame^] | 49 | cfg.StrOpt('test_mtu_networks', |
| 50 | default='[{"provider:network_type":"vxlan",' |
| 51 | '"mtu":1200, "cidr":"10.100.0.0/16"}' |
| 52 | ',' |
| 53 | '{"provider:network_type":"vxlan",' |
| 54 | '"mtu":1300, "cidr":"10.200.0.0/16"}]', |
| 55 | help='Configuration for test networks. The format is JSON. ' |
| 56 | '"provider:network_type":<TYPE> - string ' |
| 57 | '"mtu":<MTU> - integer ' |
| 58 | '"cidr"<SUBNET/MASK> - string ' |
| 59 | '"provider:segmentation_id":<VLAN_ID> - integer') |
Hynek Mlnarik | c510676 | 2016-09-01 11:47:31 +0200 | [diff] [blame] | 60 | ] |
Maru Newby | b096d9f | 2015-03-09 18:54:54 +0000 | [diff] [blame] | 61 | |
Assaf Muller | d22ca2e | 2016-01-19 11:47:14 -0500 | [diff] [blame] | 62 | # TODO(amuller): Redo configuration options registration as part of the planned |
| 63 | # transition to the Tempest plugin architecture |
| 64 | for opt in NeutronPluginOptions: |
| 65 | CONF.register_opt(opt, 'neutron_plugin_options') |
Assaf Muller | 65cc2d2 | 2016-04-07 17:56:03 -0400 | [diff] [blame] | 66 | |
| 67 | |
| 68 | config_opts_translator = { |
| 69 | 'project_network_cidr': 'tenant_network_cidr', |
| 70 | 'project_network_v6_cidr': 'tenant_network_v6_cidr', |
| 71 | 'project_network_mask_bits': 'tenant_network_mask_bits', |
| 72 | 'project_network_v6_mask_bits': 'tenant_network_v6_mask_bits'} |
| 73 | |
| 74 | |
| 75 | def safe_get_config_value(group, name): |
| 76 | """Safely get Oslo config opts from Tempest, using old and new names.""" |
| 77 | conf_group = getattr(CONF, group) |
| 78 | |
| 79 | try: |
| 80 | return getattr(conf_group, name) |
| 81 | except cfg.NoSuchOptError: |
| 82 | return getattr(conf_group, config_opts_translator[name]) |