blob: 7245b10765816863adf893e51c93ff257a1f19d9 [file] [log] [blame]
Jay Pipes3f981df2012-03-27 18:59:44 -04001# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
3# Copyright 2012 OpenStack, LLC
4# All Rights Reserved.
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
17
Dirk Muellere746fc22013-06-29 16:29:29 +020018from __future__ import print_function
19
Jay Pipes7f757632011-12-02 15:53:32 -050020import os
Attila Fazekas5abb2532012-12-04 11:30:49 +010021import sys
Jay Pipes3f981df2012-03-27 18:59:44 -040022
Dirk Muellere746fc22013-06-29 16:29:29 +020023
Matthew Treinish90aedd12013-02-25 17:56:49 -050024from oslo.config import cfg
25
Attila Fazekas3e1b6742013-01-28 16:30:35 +010026from tempest.common.utils.misc import singleton
Matthew Treinishf4a9b0f2013-07-26 16:58:26 -040027from tempest.openstack.common import log as logging
Jay Pipes7f757632011-12-02 15:53:32 -050028
Daryl Walleck1465d612011-11-02 02:22:15 -050029
Matthew Treinish39e48ef2012-12-21 13:36:15 -050030identity_group = cfg.OptGroup(name='identity',
31 title="Keystone Configuration Options")
Daryl Walleck1465d612011-11-02 02:22:15 -050032
Matthew Treinish39e48ef2012-12-21 13:36:15 -050033IdentityGroup = [
34 cfg.StrOpt('catalog_type',
35 default='identity',
36 help="Catalog type of the Identity service."),
Jay Pipescd8eaec2013-01-16 21:03:48 -050037 cfg.BoolOpt('disable_ssl_certificate_validation',
38 default=False,
39 help="Set to True if using self-signed SSL certificates."),
Jay Pipes7c88eb22013-01-16 21:32:43 -050040 cfg.StrOpt('uri',
41 default=None,
Brant Knudsonc7ca3342013-03-28 21:08:50 -050042 help="Full URI of the OpenStack Identity API (Keystone), v2"),
43 cfg.StrOpt('uri_v3',
44 help='Full URI of the OpenStack Identity API (Keystone), v3'),
Matthew Treinish39e48ef2012-12-21 13:36:15 -050045 cfg.StrOpt('region',
Attila Fazekascadcb1f2013-01-21 23:10:53 +010046 default='RegionOne',
Matthew Treinish39e48ef2012-12-21 13:36:15 -050047 help="The identity region name to use."),
Attila Fazekascadcb1f2013-01-21 23:10:53 +010048 cfg.StrOpt('username',
49 default='demo',
50 help="Username to use for Nova API requests."),
51 cfg.StrOpt('tenant_name',
52 default='demo',
53 help="Tenant name to use for Nova API requests."),
54 cfg.StrOpt('password',
55 default='pass',
56 help="API key to use when authenticating.",
57 secret=True),
58 cfg.StrOpt('alt_username',
59 default=None,
60 help="Username of alternate user to use for Nova API "
61 "requests."),
62 cfg.StrOpt('alt_tenant_name',
63 default=None,
64 help="Alternate user's Tenant name to use for Nova API "
65 "requests."),
66 cfg.StrOpt('alt_password',
67 default=None,
68 help="API key to use when authenticating as alternate user.",
69 secret=True),
70 cfg.StrOpt('admin_username',
71 default='admin',
72 help="Administrative Username to use for"
73 "Keystone API requests."),
74 cfg.StrOpt('admin_tenant_name',
75 default='admin',
76 help="Administrative Tenant name to use for Keystone API "
77 "requests."),
78 cfg.StrOpt('admin_password',
79 default='pass',
80 help="API key to use when authenticating as admin.",
81 secret=True),
Matthew Treinish39e48ef2012-12-21 13:36:15 -050082]
Jay Pipes3f981df2012-03-27 18:59:44 -040083
Daryl Walleck1465d612011-11-02 02:22:15 -050084
Matthew Treinish39e48ef2012-12-21 13:36:15 -050085def register_identity_opts(conf):
86 conf.register_group(identity_group)
87 for opt in IdentityGroup:
88 conf.register_opt(opt, group='identity')
Daryl Walleck1465d612011-11-02 02:22:15 -050089
Jay Pipes3f981df2012-03-27 18:59:44 -040090
Matthew Treinish39e48ef2012-12-21 13:36:15 -050091compute_group = cfg.OptGroup(name='compute',
92 title='Compute Service Options')
Rohit Karajgie1b050d2011-12-02 16:13:18 -080093
Matthew Treinish39e48ef2012-12-21 13:36:15 -050094ComputeGroup = [
95 cfg.BoolOpt('allow_tenant_isolation',
96 default=False,
97 help="Allows test cases to create/destroy tenants and "
98 "users. This option enables isolated test cases and "
99 "better parallel execution, but also requires that "
100 "OpenStack Identity API admin credentials are known."),
101 cfg.BoolOpt('allow_tenant_reuse',
102 default=True,
103 help="If allow_tenant_isolation is True and a tenant that "
104 "would be created for a given test already exists (such "
105 "as from a previously-failed run), re-use that tenant "
106 "instead of failing because of the conflict. Note that "
107 "this would result in the tenant being deleted at the "
108 "end of a subsequent successful run."),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500109 cfg.StrOpt('image_ref',
110 default="{$IMAGE_ID}",
111 help="Valid secondary image reference to be used in tests."),
112 cfg.StrOpt('image_ref_alt',
113 default="{$IMAGE_ID_ALT}",
114 help="Valid secondary image reference to be used in tests."),
115 cfg.IntOpt('flavor_ref',
116 default=1,
117 help="Valid primary flavor to use in tests."),
118 cfg.IntOpt('flavor_ref_alt',
119 default=2,
120 help='Valid secondary flavor to be used in tests.'),
Maru Newbyaf292e82013-05-20 21:32:28 +0000121 cfg.StrOpt('image_ssh_user',
122 default="root",
123 help="User name used to authenticate to an instance."),
Ryan Hsucb2e1252013-09-03 21:44:49 -0700124 cfg.StrOpt('image_ssh_password',
125 default="password",
126 help="Password used to authenticate to an instance."),
Maru Newbyaf292e82013-05-20 21:32:28 +0000127 cfg.StrOpt('image_alt_ssh_user',
128 default="root",
129 help="User name used to authenticate to an instance using "
130 "the alternate image."),
Ryan Hsucb2e1252013-09-03 21:44:49 -0700131 cfg.StrOpt('image_alt_ssh_password',
132 default="password",
133 help="Password used to authenticate to an instance using "
134 "the alternate image."),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500135 cfg.BoolOpt('resize_available',
136 default=False,
137 help="Does the test environment support resizing?"),
138 cfg.BoolOpt('live_migration_available',
139 default=False,
140 help="Does the test environment support live migration "
141 "available?"),
142 cfg.BoolOpt('use_block_migration_for_live_migration',
143 default=False,
144 help="Does the test environment use block devices for live "
145 "migration"),
Bob Ballc078be92013-04-09 14:25:00 +0100146 cfg.BoolOpt('block_migrate_supports_cinder_iscsi',
147 default=False,
148 help="Does the test environment block migration support "
149 "cinder iSCSI volumes"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500150 cfg.BoolOpt('change_password_available',
151 default=False,
152 help="Does the test environment support changing the admin "
153 "password?"),
154 cfg.BoolOpt('create_image_enabled',
155 default=False,
156 help="Does the test environment support snapshots?"),
157 cfg.IntOpt('build_interval',
158 default=10,
159 help="Time in seconds between build status checks."),
160 cfg.IntOpt('build_timeout',
161 default=300,
162 help="Timeout in seconds to wait for an instance to build."),
163 cfg.BoolOpt('run_ssh',
164 default=False,
165 help="Does the test environment support snapshots?"),
166 cfg.StrOpt('ssh_user',
167 default='root',
168 help="User name used to authenticate to an instance."),
Nachi Ueno6d580be2013-07-24 10:58:11 -0700169 cfg.IntOpt('ping_timeout',
170 default=60,
171 help="Timeout in seconds to wait for ping to "
172 "succeed."),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500173 cfg.IntOpt('ssh_timeout',
174 default=300,
Chris Yeoh76916042013-02-27 16:25:25 +1030175 help="Timeout in seconds to wait for authentication to "
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500176 "succeed."),
Chris Yeoh76916042013-02-27 16:25:25 +1030177 cfg.IntOpt('ssh_channel_timeout',
178 default=60,
179 help="Timeout in seconds to wait for output from ssh "
180 "channel."),
Attila Fazekasb0661652013-05-08 13:01:36 +0200181 cfg.StrOpt('fixed_network_name',
182 default='private',
183 help="Visible fixed network name "),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500184 cfg.StrOpt('network_for_ssh',
185 default='public',
186 help="Network used for SSH connections."),
187 cfg.IntOpt('ip_version_for_ssh',
188 default=4,
189 help="IP version used for SSH connections."),
fujioka yuuichia11994e2013-07-09 11:19:51 +0900190 cfg.BoolOpt('use_floatingip_for_ssh',
191 default=True,
192 help="Dose the SSH uses Floating IP?"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500193 cfg.StrOpt('catalog_type',
194 default='compute',
195 help="Catalog type of the Compute service."),
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100196 cfg.StrOpt('path_to_private_key',
197 default=None,
198 help="Path to a private key file for SSH access to remote "
199 "hosts"),
Attila Fazekas86950732013-06-08 09:33:08 +0200200 cfg.BoolOpt('disk_config_enabled',
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100201 default=True,
Attila Fazekas86950732013-06-08 09:33:08 +0200202 help="If false, skip disk config tests"),
203 cfg.BoolOpt('flavor_extra_enabled',
204 default=True,
205 help="If false, skip flavor extra data test"),
Ryan Hsucb2e1252013-09-03 21:44:49 -0700206 cfg.StrOpt('volume_device_name',
207 default='vdb',
208 help="Expected device name when a volume is attached to "
209 "an instance")
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500210]
Rohit Karajgie1b050d2011-12-02 16:13:18 -0800211
Rohit Karajgie1b050d2011-12-02 16:13:18 -0800212
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500213def register_compute_opts(conf):
214 conf.register_group(compute_group)
215 for opt in ComputeGroup:
216 conf.register_opt(opt, group='compute')
kavan-patil4ea2efb2011-12-09 08:58:50 +0000217
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500218compute_admin_group = cfg.OptGroup(name='compute-admin',
219 title="Compute Admin Options")
donald-ngo7fb1efa2011-12-13 17:17:36 -0800220
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500221ComputeAdminGroup = [
222 cfg.StrOpt('username',
223 default='admin',
224 help="Administrative Username to use for Nova API requests."),
225 cfg.StrOpt('tenant_name',
226 default='admin',
227 help="Administrative Tenant name to use for Nova API "
228 "requests."),
229 cfg.StrOpt('password',
230 default='pass',
231 help="API key to use when authenticating as admin.",
232 secret=True),
233]
Daryl Walleck587385b2012-03-03 13:00:26 -0600234
K Jonathan Harkerd6ba4b42012-12-18 13:50:47 -0800235
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500236def register_compute_admin_opts(conf):
237 conf.register_group(compute_admin_group)
238 for opt in ComputeAdminGroup:
239 conf.register_opt(opt, group='compute-admin')
Daryl Walleck587385b2012-03-03 13:00:26 -0600240
Jay Pipesf38eaac2012-06-21 13:37:35 -0400241
Attila Fazekas3ca1fb32013-01-21 23:10:53 +0100242whitebox_group = cfg.OptGroup(name='whitebox',
243 title="Whitebox Options")
244
245WhiteboxGroup = [
246 cfg.BoolOpt('whitebox_enabled',
247 default=False,
248 help="Does the test environment support whitebox tests for "
249 "Compute?"),
250 cfg.StrOpt('db_uri',
251 default=None,
252 help="Connection string to the database of Compute service"),
253 cfg.StrOpt('source_dir',
254 default="/opt/stack/nova",
255 help="Path of nova source directory"),
256 cfg.StrOpt('config_path',
257 default='/etc/nova/nova.conf',
258 help="Path of nova configuration file"),
259 cfg.StrOpt('bin_dir',
260 default="/usr/local/bin/",
261 help="Directory containing nova binaries such as nova-manage"),
262]
263
264
265def register_whitebox_opts(conf):
266 conf.register_group(whitebox_group)
267 for opt in WhiteboxGroup:
268 conf.register_opt(opt, group='whitebox')
269
270
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500271image_group = cfg.OptGroup(name='image',
272 title="Image Service Options")
Jay Pipesf38eaac2012-06-21 13:37:35 -0400273
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500274ImageGroup = [
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500275 cfg.StrOpt('api_version',
276 default='1',
277 help="Version of the API"),
Matthew Treinish72ea4422013-02-07 14:42:49 -0500278 cfg.StrOpt('catalog_type',
279 default='image',
Sean Dague83401992013-05-06 17:46:36 -0400280 help='Catalog type of the Image service.'),
281 cfg.StrOpt('http_image',
282 default='http://download.cirros-cloud.net/0.3.1/'
283 'cirros-0.3.1-x86_64-uec.tar.gz',
284 help='http accessable image')
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500285]
Jay Pipesf38eaac2012-06-21 13:37:35 -0400286
Jay Pipesf38eaac2012-06-21 13:37:35 -0400287
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500288def register_image_opts(conf):
289 conf.register_group(image_group)
290 for opt in ImageGroup:
291 conf.register_opt(opt, group='image')
Jay Pipesf38eaac2012-06-21 13:37:35 -0400292
293
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500294network_group = cfg.OptGroup(name='network',
295 title='Network Service Options')
Daryl Walleck587385b2012-03-03 13:00:26 -0600296
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500297NetworkGroup = [
298 cfg.StrOpt('catalog_type',
299 default='network',
Mark McClainf2982e82013-07-06 17:48:03 -0400300 help='Catalog type of the Neutron service.'),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500301 cfg.StrOpt('tenant_network_cidr',
302 default="10.100.0.0/16",
303 help="The cidr block to allocate tenant networks from"),
304 cfg.IntOpt('tenant_network_mask_bits',
Attila Fazekas8ea181b2013-07-13 16:26:14 +0200305 default=28,
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500306 help="The mask bits for tenant networks"),
307 cfg.BoolOpt('tenant_networks_reachable',
308 default=False,
309 help="Whether tenant network connectivity should be "
310 "evaluated directly"),
311 cfg.StrOpt('public_network_id',
312 default="",
313 help="Id of the public network that provides external "
314 "connectivity"),
315 cfg.StrOpt('public_router_id',
316 default="",
317 help="Id of the public router that provides external "
318 "connectivity"),
319]
Jay Pipes3f981df2012-03-27 18:59:44 -0400320
Jay Pipesf38eaac2012-06-21 13:37:35 -0400321
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500322def register_network_opts(conf):
323 conf.register_group(network_group)
324 for opt in NetworkGroup:
325 conf.register_opt(opt, group='network')
Dan Smithd6ff6b72012-08-23 10:29:41 -0700326
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500327volume_group = cfg.OptGroup(name='volume',
328 title='Block Storage Options')
Daryl Walleck587385b2012-03-03 13:00:26 -0600329
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500330VolumeGroup = [
331 cfg.IntOpt('build_interval',
332 default=10,
333 help='Time in seconds between volume availability checks.'),
334 cfg.IntOpt('build_timeout',
335 default=300,
336 help='Timeout in seconds to wait for a volume to become'
337 'available.'),
338 cfg.StrOpt('catalog_type',
339 default='Volume',
340 help="Catalog type of the Volume Service"),
Jérôme Gallard86551ce2013-03-08 11:41:26 +0100341 cfg.BoolOpt('multi_backend_enabled',
342 default=False,
Giulio Fidentef4fa8942013-05-28 18:48:03 +0200343 help="Runs Cinder multi-backend test (requires 2 backends)"),
Jérôme Gallard86551ce2013-03-08 11:41:26 +0100344 cfg.StrOpt('backend1_name',
Giulio Fidentef4fa8942013-05-28 18:48:03 +0200345 default='BACKEND_1',
Jérôme Gallard86551ce2013-03-08 11:41:26 +0100346 help="Name of the backend1 (must be declared in cinder.conf)"),
347 cfg.StrOpt('backend2_name',
Giulio Fidentef4fa8942013-05-28 18:48:03 +0200348 default='BACKEND_2',
Jérôme Gallard86551ce2013-03-08 11:41:26 +0100349 help="Name of the backend2 (must be declared in cinder.conf)"),
Adam Gandelman827ad332013-06-24 17:04:09 -0700350 cfg.StrOpt('storage_protocol',
351 default='iSCSI',
352 help='Backend protocol to target when creating volume types'),
353 cfg.StrOpt('vendor_name',
354 default='Open Source',
355 help='Backend vendor to target when creating volume types'),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500356]
K Jonathan Harkerd6ba4b42012-12-18 13:50:47 -0800357
Daryl Walleck587385b2012-03-03 13:00:26 -0600358
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500359def register_volume_opts(conf):
360 conf.register_group(volume_group)
361 for opt in VolumeGroup:
362 conf.register_opt(opt, group='volume')
Attila Fazekasa23f5002012-10-23 19:32:45 +0200363
Attila Fazekasa23f5002012-10-23 19:32:45 +0200364
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500365object_storage_group = cfg.OptGroup(name='object-storage',
366 title='Object Storage Service Options')
Attila Fazekasa23f5002012-10-23 19:32:45 +0200367
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500368ObjectStoreConfig = [
369 cfg.StrOpt('catalog_type',
370 default='object-store',
371 help="Catalog type of the Object-Storage service."),
nayna-patelb4989b32013-01-09 06:25:13 +0000372 cfg.StrOpt('container_sync_timeout',
373 default=120,
374 help="Number of seconds to time on waiting for a container"
375 "to container synchronization complete."),
376 cfg.StrOpt('container_sync_interval',
377 default=5,
378 help="Number of seconds to wait while looping to check the"
379 "status of a container to container synchronization"),
Joe H. Rahme2b312572013-07-31 17:53:23 +0200380 cfg.BoolOpt('accounts_quotas_available',
381 default=True,
382 help="Set to True if the Account Quota middleware is enabled"),
Matthew Treinish3fdb80c2013-08-15 11:13:19 -0400383 cfg.StrOpt('operator_role',
384 default='Member',
385 help="Role to add to users created for swift tests to "
386 "enable creating containers"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500387]
Attila Fazekasa23f5002012-10-23 19:32:45 +0200388
Attila Fazekasa23f5002012-10-23 19:32:45 +0200389
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500390def register_object_storage_opts(conf):
391 conf.register_group(object_storage_group)
392 for opt in ObjectStoreConfig:
393 conf.register_opt(opt, group='object-storage')
Attila Fazekasa23f5002012-10-23 19:32:45 +0200394
Steve Bakerc60e4e32013-05-06 15:22:41 +1200395
396orchestration_group = cfg.OptGroup(name='orchestration',
397 title='Orchestration Service Options')
398
399OrchestrationGroup = [
400 cfg.StrOpt('catalog_type',
401 default='orchestration',
402 help="Catalog type of the Orchestration service."),
403 cfg.BoolOpt('allow_tenant_isolation',
404 default=False,
405 help="Allows test cases to create/destroy tenants and "
406 "users. This option enables isolated test cases and "
407 "better parallel execution, but also requires that "
408 "OpenStack Identity API admin credentials are known."),
409 cfg.IntOpt('build_interval',
410 default=1,
411 help="Time in seconds between build status checks."),
412 cfg.IntOpt('build_timeout',
413 default=300,
414 help="Timeout in seconds to wait for a stack to build."),
Steve Bakerc60e4e32013-05-06 15:22:41 +1200415 cfg.StrOpt('instance_type',
Steve Baker9e86b832013-05-22 15:40:28 +1200416 default='m1.micro',
Steve Bakerc60e4e32013-05-06 15:22:41 +1200417 help="Instance type for tests. Needs to be big enough for a "
418 "full OS plus the test workload"),
419 cfg.StrOpt('image_ref',
420 default=None,
421 help="Name of heat-cfntools enabled image to use when "
422 "launching test instances."),
423 cfg.StrOpt('keypair_name',
424 default=None,
425 help="Name of existing keypair to launch servers with."),
426]
427
428
429def register_orchestration_opts(conf):
430 conf.register_group(orchestration_group)
431 for opt in OrchestrationGroup:
432 conf.register_opt(opt, group='orchestration')
433
Julie Pichond1017642013-07-24 16:37:23 +0100434
435dashboard_group = cfg.OptGroup(name="dashboard",
436 title="Dashboard options")
437
438DashboardGroup = [
439 cfg.StrOpt('dashboard_url',
440 default='http://localhost/',
441 help="Where the dashboard can be found"),
442 cfg.StrOpt('login_url',
443 default='http://localhost/auth/login/',
444 help="Login page for the dashboard"),
445]
446
447
448def register_dashboard_opts(conf):
449 conf.register_group(scenario_group)
450 for opt in DashboardGroup:
451 conf.register_opt(opt, group='dashboard')
452
453
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500454boto_group = cfg.OptGroup(name='boto',
455 title='EC2/S3 options')
456BotoConfig = [
457 cfg.StrOpt('ec2_url',
458 default="http://localhost:8773/services/Cloud",
459 help="EC2 URL"),
460 cfg.StrOpt('s3_url',
461 default="http://localhost:8080",
462 help="S3 URL"),
463 cfg.StrOpt('aws_secret',
464 default=None,
465 help="AWS Secret Key",
466 secret=True),
467 cfg.StrOpt('aws_access',
468 default=None,
469 help="AWS Access Key"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500470 cfg.StrOpt('s3_materials_path',
471 default="/opt/stack/devstack/files/images/"
472 "s3-materials/cirros-0.3.0",
473 help="S3 Materials Path"),
474 cfg.StrOpt('ari_manifest',
475 default="cirros-0.3.0-x86_64-initrd.manifest.xml",
476 help="ARI Ramdisk Image manifest"),
477 cfg.StrOpt('ami_manifest',
478 default="cirros-0.3.0-x86_64-blank.img.manifest.xml",
479 help="AMI Machine Image manifest"),
480 cfg.StrOpt('aki_manifest',
481 default="cirros-0.3.0-x86_64-vmlinuz.manifest.xml",
482 help="AKI Kernel Image manifest"),
483 cfg.StrOpt('instance_type',
484 default="m1.tiny",
485 help="Instance type"),
486 cfg.IntOpt('http_socket_timeout',
487 default=3,
488 help="boto Http socket timeout"),
489 cfg.IntOpt('num_retries',
490 default=1,
491 help="boto num_retries on error"),
492 cfg.IntOpt('build_timeout',
493 default=60,
494 help="Status Change Timeout"),
495 cfg.IntOpt('build_interval',
496 default=1,
497 help="Status Change Test Interval"),
498]
Attila Fazekasf7f2d932012-12-13 09:14:38 +0100499
Attila Fazekasa23f5002012-10-23 19:32:45 +0200500
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500501def register_boto_opts(conf):
502 conf.register_group(boto_group)
503 for opt in BotoConfig:
504 conf.register_opt(opt, group='boto')
Attila Fazekasa23f5002012-10-23 19:32:45 +0200505
Matthew Treinish615ea6a2013-02-25 17:26:59 -0500506stress_group = cfg.OptGroup(name='stress', title='Stress Test Options')
507
508StressGroup = [
509 cfg.StrOpt('nova_logdir',
510 default=None,
511 help='Directory containing log files on the compute nodes'),
512 cfg.IntOpt('max_instances',
513 default=16,
514 help='Maximum number of instances to create during test.'),
515 cfg.StrOpt('controller',
516 default=None,
David Kranzb9d97502013-05-01 15:55:04 -0400517 help='Controller host.'),
518 # new stress options
519 cfg.StrOpt('target_controller',
520 default=None,
521 help='Controller host.'),
522 cfg.StrOpt('target_ssh_user',
523 default=None,
524 help='ssh user.'),
525 cfg.StrOpt('target_private_key_path',
526 default=None,
527 help='Path to private key.'),
528 cfg.StrOpt('target_logfiles',
529 default=None,
530 help='regexp for list of log files.'),
531 cfg.StrOpt('log_check_interval',
532 default=60,
Marc Koderer32221b8e2013-08-23 13:57:50 +0200533 help='time (in seconds) between log file error checks.'),
534 cfg.StrOpt('default_thread_number_per_action',
535 default=4,
536 help='The number of threads created while stress test.')
Matthew Treinish615ea6a2013-02-25 17:26:59 -0500537]
538
539
540def register_stress_opts(conf):
541 conf.register_group(stress_group)
542 for opt in StressGroup:
543 conf.register_opt(opt, group='stress')
544
Attila Fazekasa23f5002012-10-23 19:32:45 +0200545
Masayuki Igawa73d9f3a2013-05-24 10:30:01 +0900546scenario_group = cfg.OptGroup(name='scenario', title='Scenario Test Options')
547
548ScenarioGroup = [
549 cfg.StrOpt('img_dir',
550 default='/opt/stack/new/devstack/files/images/'
551 'cirros-0.3.1-x86_64-uec',
552 help='Directory containing image files'),
553 cfg.StrOpt('ami_img_file',
554 default='cirros-0.3.1-x86_64-blank.img',
555 help='AMI image file name'),
556 cfg.StrOpt('ari_img_file',
557 default='cirros-0.3.1-x86_64-initrd',
558 help='ARI image file name'),
559 cfg.StrOpt('aki_img_file',
560 default='cirros-0.3.1-x86_64-vmlinuz',
561 help='AKI image file name'),
562 cfg.StrOpt('ssh_user',
563 default='cirros',
Joe Gordonb5e10cd2013-07-10 15:51:12 +0000564 help='ssh username for the image file'),
565 cfg.IntOpt(
566 'large_ops_number',
567 default=0,
568 help="specifies how many resources to request at once. Used "
569 "for large operations testing.")
Masayuki Igawa73d9f3a2013-05-24 10:30:01 +0900570]
571
572
573def register_scenario_opts(conf):
574 conf.register_group(scenario_group)
575 for opt in ScenarioGroup:
576 conf.register_opt(opt, group='scenario')
577
578
Matthew Treinish4c412922013-07-16 15:27:42 -0400579service_available_group = cfg.OptGroup(name="service_available",
580 title="Available OpenStack Services")
581
582ServiceAvailableGroup = [
583 cfg.BoolOpt('cinder',
584 default=True,
585 help="Whether or not cinder is expected to be available"),
Matthew Treinishfaa340d2013-07-19 16:26:21 -0400586 cfg.BoolOpt('neutron',
587 default=False,
588 help="Whether or not neutron is expected to be available"),
Matthew Treinish853ae442013-07-19 16:36:07 -0400589 cfg.BoolOpt('glance',
590 default=True,
591 help="Whether or not glance is expected to be available"),
Matthew Treinish61e332b2013-07-19 16:42:31 -0400592 cfg.BoolOpt('swift',
593 default=True,
594 help="Whether or not swift is expected to be available"),
Matthew Treinish6b41e242013-07-19 16:49:28 -0400595 cfg.BoolOpt('nova',
596 default=True,
597 help="Whether or not nova is expected to be available"),
Matthew Treinisha9d43882013-07-19 16:54:52 -0400598 cfg.BoolOpt('heat',
599 default=False,
600 help="Whether or not Heat is expected to be available"),
Julie Pichond1017642013-07-24 16:37:23 +0100601 cfg.BoolOpt('horizon',
602 default=True,
603 help="Whether or not Horizon is expected to be available"),
Matthew Treinish4c412922013-07-16 15:27:42 -0400604]
605
606
607def register_service_available_opts(conf):
608 conf.register_group(scenario_group)
609 for opt in ServiceAvailableGroup:
610 conf.register_opt(opt, group='service_available')
611
612
Jay Pipes3f981df2012-03-27 18:59:44 -0400613@singleton
614class TempestConfig:
Daryl Walleck1465d612011-11-02 02:22:15 -0500615 """Provides OpenStack configuration information."""
616
Brian Waldon738cd632011-12-12 18:45:09 -0500617 DEFAULT_CONFIG_DIR = os.path.join(
Zhongyue Luoa1343de2013-01-04 16:21:35 +0800618 os.path.abspath(os.path.dirname(os.path.dirname(__file__))),
Brian Waldon738cd632011-12-12 18:45:09 -0500619 "etc")
Daryl Walleck1465d612011-11-02 02:22:15 -0500620
Brian Waldon738cd632011-12-12 18:45:09 -0500621 DEFAULT_CONFIG_FILE = "tempest.conf"
622
623 def __init__(self):
624 """Initialize a configuration from a conf directory and conf file."""
Sean Dague2416cf32013-04-10 08:29:07 -0400625 config_files = []
Sean Dague2416cf32013-04-10 08:29:07 -0400626 failsafe_path = "/etc/tempest/" + self.DEFAULT_CONFIG_FILE
Brian Waldon738cd632011-12-12 18:45:09 -0500627
628 # Environment variables override defaults...
629 conf_dir = os.environ.get('TEMPEST_CONFIG_DIR',
Zhongyue Luo79d8d362012-09-25 13:49:27 +0800630 self.DEFAULT_CONFIG_DIR)
631 conf_file = os.environ.get('TEMPEST_CONFIG', self.DEFAULT_CONFIG_FILE)
Brian Waldon738cd632011-12-12 18:45:09 -0500632
Jay Pipes7f757632011-12-02 15:53:32 -0500633 path = os.path.join(conf_dir, conf_file)
634
Zhongyue Luoafd43eb2013-02-04 11:32:57 +0800635 if not (os.path.isfile(path) or
636 'TEMPEST_CONFIG_DIR' in os.environ or
637 'TEMPEST_CONFIG' in os.environ):
Sean Dague2416cf32013-04-10 08:29:07 -0400638 path = failsafe_path
Attila Fazekas5abb2532012-12-04 11:30:49 +0100639
Jay Pipes7f757632011-12-02 15:53:32 -0500640 if not os.path.exists(path):
Sean Dague43cd9052013-07-19 12:20:04 -0400641 msg = "Config file %s not found" % path
Dirk Muellere746fc22013-06-29 16:29:29 +0200642 print(RuntimeError(msg), file=sys.stderr)
Sean Dague2416cf32013-04-10 08:29:07 -0400643 else:
644 config_files.append(path)
Jay Pipes7f757632011-12-02 15:53:32 -0500645
Sean Dague2416cf32013-04-10 08:29:07 -0400646 cfg.CONF([], project='tempest', default_config_files=config_files)
Matthew Treinishf4a9b0f2013-07-26 16:58:26 -0400647 logging.setup('tempest')
648 LOG = logging.getLogger('tempest')
649 LOG.info("Using tempest config file %s" % path)
Daryl Walleck1465d612011-11-02 02:22:15 -0500650
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500651 register_compute_opts(cfg.CONF)
652 register_identity_opts(cfg.CONF)
Attila Fazekas3ca1fb32013-01-21 23:10:53 +0100653 register_whitebox_opts(cfg.CONF)
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500654 register_image_opts(cfg.CONF)
655 register_network_opts(cfg.CONF)
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500656 register_volume_opts(cfg.CONF)
657 register_object_storage_opts(cfg.CONF)
Steve Bakerc60e4e32013-05-06 15:22:41 +1200658 register_orchestration_opts(cfg.CONF)
Julie Pichond1017642013-07-24 16:37:23 +0100659 register_dashboard_opts(cfg.CONF)
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500660 register_boto_opts(cfg.CONF)
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100661 register_compute_admin_opts(cfg.CONF)
Matthew Treinish615ea6a2013-02-25 17:26:59 -0500662 register_stress_opts(cfg.CONF)
Masayuki Igawa73d9f3a2013-05-24 10:30:01 +0900663 register_scenario_opts(cfg.CONF)
Matthew Treinish4c412922013-07-16 15:27:42 -0400664 register_service_available_opts(cfg.CONF)
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500665 self.compute = cfg.CONF.compute
Attila Fazekas3ca1fb32013-01-21 23:10:53 +0100666 self.whitebox = cfg.CONF.whitebox
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500667 self.identity = cfg.CONF.identity
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500668 self.images = cfg.CONF.image
669 self.network = cfg.CONF.network
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500670 self.volume = cfg.CONF.volume
671 self.object_storage = cfg.CONF['object-storage']
Steve Bakerc60e4e32013-05-06 15:22:41 +1200672 self.orchestration = cfg.CONF.orchestration
Julie Pichond1017642013-07-24 16:37:23 +0100673 self.dashboard = cfg.CONF.dashboard
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500674 self.boto = cfg.CONF.boto
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100675 self.compute_admin = cfg.CONF['compute-admin']
Matthew Treinish615ea6a2013-02-25 17:26:59 -0500676 self.stress = cfg.CONF.stress
Masayuki Igawa73d9f3a2013-05-24 10:30:01 +0900677 self.scenario = cfg.CONF.scenario
Matthew Treinish4c412922013-07-16 15:27:42 -0400678 self.service_available = cfg.CONF.service_available
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100679 if not self.compute_admin.username:
680 self.compute_admin.username = self.identity.admin_username
681 self.compute_admin.password = self.identity.admin_password
682 self.compute_admin.tenant_name = self.identity.admin_tenant_name