blob: 1bc9617733e5cd61ddbe6b3129b318dd8969d9f7 [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
Assaf Mullerd22ca2e2016-01-19 11:47:14 -050014from tempest import config
15
Assaf Muller65cc2d22016-04-07 17:56:03 -040016
Assaf Mullerd22ca2e2016-01-19 11:47:14 -050017CONF = config.CONF
Maru Newbyb096d9f2015-03-09 18:54:54 +000018
19
Assaf Mullerd22ca2e2016-01-19 11:47:14 -050020NeutronPluginOptions = [
Armando Migliaccio7f84c422017-02-21 18:43:38 -080021 cfg.ListOpt('provider_vlans',
22 default=[],
23 help='List of provider networks available in the deployment.'),
Yuuichi Fujioka1257b572015-06-10 17:18:12 +090024 cfg.BoolOpt('specify_floating_ip_address_available',
25 default=True,
26 help='Allow passing an IP Address of the floating ip when '
Hynek Mlnarikc5106762016-09-01 11:47:31 +020027 '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.'),
Chandan Kumarc125fd12017-11-15 19:41:01 +053032 cfg.StrOpt('agent_availability_zone',
33 help='The availability zone for all agents in the deployment. '
34 'Configure this only when the single value is used by '
35 'all agents in the deployment.'),
Yariv Rachmanifed6f862017-12-19 11:55:25 +020036 cfg.IntOpt('max_networks_per_project',
37 default=4,
38 help='Max number of networks per project. '
39 'Configure this only when project is limited with real '
40 'vlans in deployment.'),
Dongcan Ye91017ca2018-02-11 10:46:03 +000041 cfg.StrOpt('l3_agent_mode',
42 help='The agent mode for L3 agents in the deployment. '
43 'Configure this only when the single value is used by '
44 'all agents in the deployment.'),
Yariv Rachmani94970882018-03-04 11:35:17 +020045 cfg.StrOpt('test_mtu_networks',
46 default='[{"provider:network_type":"vxlan",'
47 '"mtu":1200, "cidr":"10.100.0.0/16"}'
48 ','
49 '{"provider:network_type":"vxlan",'
50 '"mtu":1300, "cidr":"10.200.0.0/16"}]',
51 help='Configuration for test networks. The format is JSON. '
52 '"provider:network_type":<TYPE> - string '
53 '"mtu":<MTU> - integer '
54 '"cidr"<SUBNET/MASK> - string '
Federico Ressie9c89bf2018-04-19 13:02:33 +020055 '"provider:segmentation_id":<VLAN_ID> - integer'),
Huifeng Le1c9f40b2018-11-07 01:14:21 +080056 cfg.StrOpt('q_agent',
57 default=None,
58 choices=['None', 'linuxbridge', 'ovs', 'sriov'],
59 help='Agent used for devstack@q-agt.service'),
Federico Ressie9c89bf2018-04-19 13:02:33 +020060
61 # Option for feature to connect via SSH to VMs using an intermediate SSH
62 # server
63 cfg.StrOpt('ssh_proxy_jump_host',
64 default=None,
65 help='Proxy jump host used to connect via SSH to VMs..'),
66 cfg.StrOpt('ssh_proxy_jump_username',
67 default='root',
68 help='User name used to connect to "ssh_proxy_jump_host".'),
69 cfg.StrOpt('ssh_proxy_jump_password',
70 default=None,
71 help='Password used to connect to "ssh_proxy_jump_host".'),
72 cfg.StrOpt('ssh_proxy_jump_keyfile',
73 default=None,
74 help='Keyfile used to connect to "ssh_proxy_jump_host".'),
75 cfg.IntOpt('ssh_proxy_jump_port',
76 default=22,
77 help='Port used to connect to "ssh_proxy_jump_host".'),
Slawek Kaplonskida17f002018-10-11 18:35:23 +020078
79 # Options for special, "advanced" image like e.g. Ubuntu. Such image can be
80 # used in tests which require some more advanced tool than available in
81 # Cirros
82 cfg.StrOpt('advanced_image_ref',
83 default=None,
84 help='Valid advanced image uuid to be used in tests. '
85 'It is an image that supports features that Cirros '
86 'does not, like Ubuntu or CentOS supporting advanced '
87 'features.'),
88 cfg.StrOpt('advanced_image_flavor_ref',
89 default=None,
90 help='Valid flavor to use with advanced image in tests. '
91 'This is required if advanced image has to be used in '
92 'tests.'),
93 cfg.StrOpt('advanced_image_ssh_user',
94 default=None,
95 help='Name of ssh user to use with advanced image in tests. '
96 'This is required if advanced image has to be used in '
97 'tests.'),
Hynek Mlnarikc5106762016-09-01 11:47:31 +020098]
Maru Newbyb096d9f2015-03-09 18:54:54 +000099
Assaf Mullerd22ca2e2016-01-19 11:47:14 -0500100# TODO(amuller): Redo configuration options registration as part of the planned
101# transition to the Tempest plugin architecture
102for opt in NeutronPluginOptions:
103 CONF.register_opt(opt, 'neutron_plugin_options')
Assaf Muller65cc2d22016-04-07 17:56:03 -0400104
105
106config_opts_translator = {
107 'project_network_cidr': 'tenant_network_cidr',
108 'project_network_v6_cidr': 'tenant_network_v6_cidr',
109 'project_network_mask_bits': 'tenant_network_mask_bits',
110 'project_network_v6_mask_bits': 'tenant_network_v6_mask_bits'}
111
112
113def safe_get_config_value(group, name):
114 """Safely get Oslo config opts from Tempest, using old and new names."""
115 conf_group = getattr(CONF, group)
116
117 try:
118 return getattr(conf_group, name)
119 except cfg.NoSuchOptError:
120 return getattr(conf_group, config_opts_translator[name])