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.'), |
Lajos Katona | 2f90465 | 2018-08-23 14:04:56 +0200 | [diff] [blame] | 24 | cfg.IntOpt('provider_net_base_segm_id', |
| 25 | default=3000, |
| 26 | help='Base segmentation ID to create provider networks. ' |
| 27 | 'This value will be increased in case of conflict.'), |
Yuuichi Fujioka | 1257b57 | 2015-06-10 17:18:12 +0900 | [diff] [blame] | 28 | cfg.BoolOpt('specify_floating_ip_address_available', |
| 29 | default=True, |
| 30 | help='Allow passing an IP Address of the floating ip when ' |
Hynek Mlnarik | c510676 | 2016-09-01 11:47:31 +0200 | [diff] [blame] | 31 | 'creating the floating ip'), |
| 32 | cfg.ListOpt('available_type_drivers', |
| 33 | default=[], |
| 34 | help='List of network types available to neutron, ' |
| 35 | 'e.g. vxlan,vlan,gre.'), |
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 ' |
Federico Ressi | e9c89bf | 2018-04-19 13:02:33 +0200 | [diff] [blame] | 59 | '"provider:segmentation_id":<VLAN_ID> - integer'), |
pkomarov | 5ce1bc2 | 2019-03-23 22:53:26 +0200 | [diff] [blame] | 60 | cfg.IntOpt('max_mtu', |
| 61 | default=1500, |
| 62 | help='Max mtu value of default deployments".'), |
Huifeng Le | 1c9f40b | 2018-11-07 01:14:21 +0800 | [diff] [blame] | 63 | cfg.StrOpt('q_agent', |
| 64 | default=None, |
| 65 | choices=['None', 'linuxbridge', 'ovs', 'sriov'], |
| 66 | help='Agent used for devstack@q-agt.service'), |
Federico Ressi | e9c89bf | 2018-04-19 13:02:33 +0200 | [diff] [blame] | 67 | |
| 68 | # Option for feature to connect via SSH to VMs using an intermediate SSH |
| 69 | # server |
| 70 | cfg.StrOpt('ssh_proxy_jump_host', |
| 71 | default=None, |
| 72 | help='Proxy jump host used to connect via SSH to VMs..'), |
| 73 | cfg.StrOpt('ssh_proxy_jump_username', |
| 74 | default='root', |
| 75 | help='User name used to connect to "ssh_proxy_jump_host".'), |
| 76 | cfg.StrOpt('ssh_proxy_jump_password', |
| 77 | default=None, |
| 78 | help='Password used to connect to "ssh_proxy_jump_host".'), |
| 79 | cfg.StrOpt('ssh_proxy_jump_keyfile', |
| 80 | default=None, |
| 81 | help='Keyfile used to connect to "ssh_proxy_jump_host".'), |
| 82 | cfg.IntOpt('ssh_proxy_jump_port', |
| 83 | default=22, |
| 84 | help='Port used to connect to "ssh_proxy_jump_host".'), |
Slawek Kaplonski | da17f00 | 2018-10-11 18:35:23 +0200 | [diff] [blame] | 85 | |
| 86 | # Options for special, "advanced" image like e.g. Ubuntu. Such image can be |
| 87 | # used in tests which require some more advanced tool than available in |
| 88 | # Cirros |
Yariv Rachmani | fa1081a | 2018-11-21 12:46:57 +0200 | [diff] [blame] | 89 | cfg.BoolOpt('default_image_is_advanced', |
| 90 | default=False, |
| 91 | help='Default image is an image which supports features ' |
| 92 | 'that Cirros does not, like Ubuntu or CentOS supporting ' |
| 93 | 'advanced features. ' |
| 94 | 'If this is set to True, "advanced_image_ref" option ' |
| 95 | 'is not required to be set.'), |
Slawek Kaplonski | da17f00 | 2018-10-11 18:35:23 +0200 | [diff] [blame] | 96 | cfg.StrOpt('advanced_image_ref', |
| 97 | default=None, |
| 98 | help='Valid advanced image uuid to be used in tests. ' |
| 99 | 'It is an image that supports features that Cirros ' |
| 100 | 'does not, like Ubuntu or CentOS supporting advanced ' |
| 101 | 'features.'), |
| 102 | cfg.StrOpt('advanced_image_flavor_ref', |
| 103 | default=None, |
| 104 | help='Valid flavor to use with advanced image in tests. ' |
| 105 | 'This is required if advanced image has to be used in ' |
| 106 | 'tests.'), |
| 107 | cfg.StrOpt('advanced_image_ssh_user', |
| 108 | default=None, |
| 109 | help='Name of ssh user to use with advanced image in tests. ' |
| 110 | 'This is required if advanced image has to be used in ' |
| 111 | 'tests.'), |
Hynek Mlnarik | c510676 | 2016-09-01 11:47:31 +0200 | [diff] [blame] | 112 | ] |
Maru Newby | b096d9f | 2015-03-09 18:54:54 +0000 | [diff] [blame] | 113 | |
Assaf Muller | d22ca2e | 2016-01-19 11:47:14 -0500 | [diff] [blame] | 114 | # TODO(amuller): Redo configuration options registration as part of the planned |
| 115 | # transition to the Tempest plugin architecture |
| 116 | for opt in NeutronPluginOptions: |
| 117 | CONF.register_opt(opt, 'neutron_plugin_options') |
Assaf Muller | 65cc2d2 | 2016-04-07 17:56:03 -0400 | [diff] [blame] | 118 | |
Slawek Kaplonski | 8dd49aa | 2019-04-16 14:47:07 +0200 | [diff] [blame^] | 119 | BgpvpnGroup = [ |
| 120 | cfg.IntOpt('min_asn', |
| 121 | default=100, |
| 122 | help=("Minimum number for the range of " |
| 123 | "autonomous system number for distinguishers.")), |
| 124 | cfg.IntOpt('min_nn', |
| 125 | default=100, |
| 126 | help=("Minimum number for the range of " |
| 127 | "assigned number for distinguishers.")), |
| 128 | cfg.IntOpt('max_asn', |
| 129 | default=200, |
| 130 | help=("Maximum number for the range of " |
| 131 | "autonomous system number for distinguishers.")), |
| 132 | cfg.IntOpt('max_nn', |
| 133 | default=200, |
| 134 | help=("Maximum number for the range of " |
| 135 | "assigned number for distinguishers.")), |
| 136 | ] |
| 137 | |
| 138 | bgpvpn_group = cfg.OptGroup(name="bgpvpn", title=("Networking-Bgpvpn Service " |
| 139 | "Options")) |
| 140 | CONF.register_group(bgpvpn_group) |
| 141 | CONF.register_opts(BgpvpnGroup, group="bgpvpn") |
Assaf Muller | 65cc2d2 | 2016-04-07 17:56:03 -0400 | [diff] [blame] | 142 | |
| 143 | config_opts_translator = { |
| 144 | 'project_network_cidr': 'tenant_network_cidr', |
| 145 | 'project_network_v6_cidr': 'tenant_network_v6_cidr', |
| 146 | 'project_network_mask_bits': 'tenant_network_mask_bits', |
| 147 | 'project_network_v6_mask_bits': 'tenant_network_v6_mask_bits'} |
| 148 | |
| 149 | |
| 150 | def safe_get_config_value(group, name): |
| 151 | """Safely get Oslo config opts from Tempest, using old and new names.""" |
| 152 | conf_group = getattr(CONF, group) |
| 153 | |
| 154 | try: |
| 155 | return getattr(conf_group, name) |
| 156 | except cfg.NoSuchOptError: |
| 157 | return getattr(conf_group, config_opts_translator[name]) |