blob: 19170aec92c65f8191b27dccd5832a1883c07edd [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."),
124 cfg.StrOpt('image_alt_ssh_user',
125 default="root",
126 help="User name used to authenticate to an instance using "
127 "the alternate image."),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500128 cfg.BoolOpt('resize_available',
129 default=False,
130 help="Does the test environment support resizing?"),
131 cfg.BoolOpt('live_migration_available',
132 default=False,
133 help="Does the test environment support live migration "
134 "available?"),
135 cfg.BoolOpt('use_block_migration_for_live_migration',
136 default=False,
137 help="Does the test environment use block devices for live "
138 "migration"),
Bob Ballc078be92013-04-09 14:25:00 +0100139 cfg.BoolOpt('block_migrate_supports_cinder_iscsi',
140 default=False,
141 help="Does the test environment block migration support "
142 "cinder iSCSI volumes"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500143 cfg.BoolOpt('change_password_available',
144 default=False,
145 help="Does the test environment support changing the admin "
146 "password?"),
147 cfg.BoolOpt('create_image_enabled',
148 default=False,
149 help="Does the test environment support snapshots?"),
150 cfg.IntOpt('build_interval',
151 default=10,
152 help="Time in seconds between build status checks."),
153 cfg.IntOpt('build_timeout',
154 default=300,
155 help="Timeout in seconds to wait for an instance to build."),
156 cfg.BoolOpt('run_ssh',
157 default=False,
158 help="Does the test environment support snapshots?"),
159 cfg.StrOpt('ssh_user',
160 default='root',
161 help="User name used to authenticate to an instance."),
Nachi Ueno6d580be2013-07-24 10:58:11 -0700162 cfg.IntOpt('ping_timeout',
163 default=60,
164 help="Timeout in seconds to wait for ping to "
165 "succeed."),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500166 cfg.IntOpt('ssh_timeout',
167 default=300,
Chris Yeoh76916042013-02-27 16:25:25 +1030168 help="Timeout in seconds to wait for authentication to "
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500169 "succeed."),
Chris Yeoh76916042013-02-27 16:25:25 +1030170 cfg.IntOpt('ssh_channel_timeout',
171 default=60,
172 help="Timeout in seconds to wait for output from ssh "
173 "channel."),
Attila Fazekasb0661652013-05-08 13:01:36 +0200174 cfg.StrOpt('fixed_network_name',
175 default='private',
176 help="Visible fixed network name "),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500177 cfg.StrOpt('network_for_ssh',
178 default='public',
179 help="Network used for SSH connections."),
180 cfg.IntOpt('ip_version_for_ssh',
181 default=4,
182 help="IP version used for SSH connections."),
fujioka yuuichia11994e2013-07-09 11:19:51 +0900183 cfg.BoolOpt('use_floatingip_for_ssh',
184 default=True,
185 help="Dose the SSH uses Floating IP?"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500186 cfg.StrOpt('catalog_type',
187 default='compute',
188 help="Catalog type of the Compute service."),
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100189 cfg.StrOpt('path_to_private_key',
190 default=None,
191 help="Path to a private key file for SSH access to remote "
192 "hosts"),
Attila Fazekas86950732013-06-08 09:33:08 +0200193 cfg.BoolOpt('disk_config_enabled',
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100194 default=True,
Attila Fazekas86950732013-06-08 09:33:08 +0200195 help="If false, skip disk config tests"),
196 cfg.BoolOpt('flavor_extra_enabled',
197 default=True,
198 help="If false, skip flavor extra data test"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500199]
Rohit Karajgie1b050d2011-12-02 16:13:18 -0800200
Rohit Karajgie1b050d2011-12-02 16:13:18 -0800201
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500202def register_compute_opts(conf):
203 conf.register_group(compute_group)
204 for opt in ComputeGroup:
205 conf.register_opt(opt, group='compute')
kavan-patil4ea2efb2011-12-09 08:58:50 +0000206
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500207compute_admin_group = cfg.OptGroup(name='compute-admin',
208 title="Compute Admin Options")
donald-ngo7fb1efa2011-12-13 17:17:36 -0800209
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500210ComputeAdminGroup = [
211 cfg.StrOpt('username',
212 default='admin',
213 help="Administrative Username to use for Nova API requests."),
214 cfg.StrOpt('tenant_name',
215 default='admin',
216 help="Administrative Tenant name to use for Nova API "
217 "requests."),
218 cfg.StrOpt('password',
219 default='pass',
220 help="API key to use when authenticating as admin.",
221 secret=True),
222]
Daryl Walleck587385b2012-03-03 13:00:26 -0600223
K Jonathan Harkerd6ba4b42012-12-18 13:50:47 -0800224
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500225def register_compute_admin_opts(conf):
226 conf.register_group(compute_admin_group)
227 for opt in ComputeAdminGroup:
228 conf.register_opt(opt, group='compute-admin')
Daryl Walleck587385b2012-03-03 13:00:26 -0600229
Jay Pipesf38eaac2012-06-21 13:37:35 -0400230
Attila Fazekas3ca1fb32013-01-21 23:10:53 +0100231whitebox_group = cfg.OptGroup(name='whitebox',
232 title="Whitebox Options")
233
234WhiteboxGroup = [
235 cfg.BoolOpt('whitebox_enabled',
236 default=False,
237 help="Does the test environment support whitebox tests for "
238 "Compute?"),
239 cfg.StrOpt('db_uri',
240 default=None,
241 help="Connection string to the database of Compute service"),
242 cfg.StrOpt('source_dir',
243 default="/opt/stack/nova",
244 help="Path of nova source directory"),
245 cfg.StrOpt('config_path',
246 default='/etc/nova/nova.conf',
247 help="Path of nova configuration file"),
248 cfg.StrOpt('bin_dir',
249 default="/usr/local/bin/",
250 help="Directory containing nova binaries such as nova-manage"),
251]
252
253
254def register_whitebox_opts(conf):
255 conf.register_group(whitebox_group)
256 for opt in WhiteboxGroup:
257 conf.register_opt(opt, group='whitebox')
258
259
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500260image_group = cfg.OptGroup(name='image',
261 title="Image Service Options")
Jay Pipesf38eaac2012-06-21 13:37:35 -0400262
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500263ImageGroup = [
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500264 cfg.StrOpt('api_version',
265 default='1',
266 help="Version of the API"),
Matthew Treinish72ea4422013-02-07 14:42:49 -0500267 cfg.StrOpt('catalog_type',
268 default='image',
Sean Dague83401992013-05-06 17:46:36 -0400269 help='Catalog type of the Image service.'),
270 cfg.StrOpt('http_image',
271 default='http://download.cirros-cloud.net/0.3.1/'
272 'cirros-0.3.1-x86_64-uec.tar.gz',
273 help='http accessable image')
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500274]
Jay Pipesf38eaac2012-06-21 13:37:35 -0400275
Jay Pipesf38eaac2012-06-21 13:37:35 -0400276
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500277def register_image_opts(conf):
278 conf.register_group(image_group)
279 for opt in ImageGroup:
280 conf.register_opt(opt, group='image')
Jay Pipesf38eaac2012-06-21 13:37:35 -0400281
282
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500283network_group = cfg.OptGroup(name='network',
284 title='Network Service Options')
Daryl Walleck587385b2012-03-03 13:00:26 -0600285
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500286NetworkGroup = [
287 cfg.StrOpt('catalog_type',
288 default='network',
Mark McClainf2982e82013-07-06 17:48:03 -0400289 help='Catalog type of the Neutron service.'),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500290 cfg.StrOpt('tenant_network_cidr',
291 default="10.100.0.0/16",
292 help="The cidr block to allocate tenant networks from"),
293 cfg.IntOpt('tenant_network_mask_bits',
Attila Fazekas8ea181b2013-07-13 16:26:14 +0200294 default=28,
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500295 help="The mask bits for tenant networks"),
296 cfg.BoolOpt('tenant_networks_reachable',
297 default=False,
298 help="Whether tenant network connectivity should be "
299 "evaluated directly"),
300 cfg.StrOpt('public_network_id',
301 default="",
302 help="Id of the public network that provides external "
303 "connectivity"),
304 cfg.StrOpt('public_router_id',
305 default="",
306 help="Id of the public router that provides external "
307 "connectivity"),
308]
Jay Pipes3f981df2012-03-27 18:59:44 -0400309
Jay Pipesf38eaac2012-06-21 13:37:35 -0400310
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500311def register_network_opts(conf):
312 conf.register_group(network_group)
313 for opt in NetworkGroup:
314 conf.register_opt(opt, group='network')
Dan Smithd6ff6b72012-08-23 10:29:41 -0700315
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500316volume_group = cfg.OptGroup(name='volume',
317 title='Block Storage Options')
Daryl Walleck587385b2012-03-03 13:00:26 -0600318
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500319VolumeGroup = [
320 cfg.IntOpt('build_interval',
321 default=10,
322 help='Time in seconds between volume availability checks.'),
323 cfg.IntOpt('build_timeout',
324 default=300,
325 help='Timeout in seconds to wait for a volume to become'
326 'available.'),
327 cfg.StrOpt('catalog_type',
328 default='Volume',
329 help="Catalog type of the Volume Service"),
Jérôme Gallard86551ce2013-03-08 11:41:26 +0100330 cfg.BoolOpt('multi_backend_enabled',
331 default=False,
Giulio Fidentef4fa8942013-05-28 18:48:03 +0200332 help="Runs Cinder multi-backend test (requires 2 backends)"),
Jérôme Gallard86551ce2013-03-08 11:41:26 +0100333 cfg.StrOpt('backend1_name',
Giulio Fidentef4fa8942013-05-28 18:48:03 +0200334 default='BACKEND_1',
Jérôme Gallard86551ce2013-03-08 11:41:26 +0100335 help="Name of the backend1 (must be declared in cinder.conf)"),
336 cfg.StrOpt('backend2_name',
Giulio Fidentef4fa8942013-05-28 18:48:03 +0200337 default='BACKEND_2',
Jérôme Gallard86551ce2013-03-08 11:41:26 +0100338 help="Name of the backend2 (must be declared in cinder.conf)"),
Adam Gandelman827ad332013-06-24 17:04:09 -0700339 cfg.StrOpt('storage_protocol',
340 default='iSCSI',
341 help='Backend protocol to target when creating volume types'),
342 cfg.StrOpt('vendor_name',
343 default='Open Source',
344 help='Backend vendor to target when creating volume types'),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500345]
K Jonathan Harkerd6ba4b42012-12-18 13:50:47 -0800346
Daryl Walleck587385b2012-03-03 13:00:26 -0600347
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500348def register_volume_opts(conf):
349 conf.register_group(volume_group)
350 for opt in VolumeGroup:
351 conf.register_opt(opt, group='volume')
Attila Fazekasa23f5002012-10-23 19:32:45 +0200352
Attila Fazekasa23f5002012-10-23 19:32:45 +0200353
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500354object_storage_group = cfg.OptGroup(name='object-storage',
355 title='Object Storage Service Options')
Attila Fazekasa23f5002012-10-23 19:32:45 +0200356
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500357ObjectStoreConfig = [
358 cfg.StrOpt('catalog_type',
359 default='object-store',
360 help="Catalog type of the Object-Storage service."),
nayna-patelb4989b32013-01-09 06:25:13 +0000361 cfg.StrOpt('container_sync_timeout',
362 default=120,
363 help="Number of seconds to time on waiting for a container"
364 "to container synchronization complete."),
365 cfg.StrOpt('container_sync_interval',
366 default=5,
367 help="Number of seconds to wait while looping to check the"
368 "status of a container to container synchronization"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500369]
Attila Fazekasa23f5002012-10-23 19:32:45 +0200370
Attila Fazekasa23f5002012-10-23 19:32:45 +0200371
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500372def register_object_storage_opts(conf):
373 conf.register_group(object_storage_group)
374 for opt in ObjectStoreConfig:
375 conf.register_opt(opt, group='object-storage')
Attila Fazekasa23f5002012-10-23 19:32:45 +0200376
Steve Bakerc60e4e32013-05-06 15:22:41 +1200377
378orchestration_group = cfg.OptGroup(name='orchestration',
379 title='Orchestration Service Options')
380
381OrchestrationGroup = [
382 cfg.StrOpt('catalog_type',
383 default='orchestration',
384 help="Catalog type of the Orchestration service."),
385 cfg.BoolOpt('allow_tenant_isolation',
386 default=False,
387 help="Allows test cases to create/destroy tenants and "
388 "users. This option enables isolated test cases and "
389 "better parallel execution, but also requires that "
390 "OpenStack Identity API admin credentials are known."),
391 cfg.IntOpt('build_interval',
392 default=1,
393 help="Time in seconds between build status checks."),
394 cfg.IntOpt('build_timeout',
395 default=300,
396 help="Timeout in seconds to wait for a stack to build."),
Steve Bakerc60e4e32013-05-06 15:22:41 +1200397 cfg.StrOpt('instance_type',
Steve Baker9e86b832013-05-22 15:40:28 +1200398 default='m1.micro',
Steve Bakerc60e4e32013-05-06 15:22:41 +1200399 help="Instance type for tests. Needs to be big enough for a "
400 "full OS plus the test workload"),
401 cfg.StrOpt('image_ref',
402 default=None,
403 help="Name of heat-cfntools enabled image to use when "
404 "launching test instances."),
405 cfg.StrOpt('keypair_name',
406 default=None,
407 help="Name of existing keypair to launch servers with."),
408]
409
410
411def register_orchestration_opts(conf):
412 conf.register_group(orchestration_group)
413 for opt in OrchestrationGroup:
414 conf.register_opt(opt, group='orchestration')
415
Julie Pichond1017642013-07-24 16:37:23 +0100416
417dashboard_group = cfg.OptGroup(name="dashboard",
418 title="Dashboard options")
419
420DashboardGroup = [
421 cfg.StrOpt('dashboard_url',
422 default='http://localhost/',
423 help="Where the dashboard can be found"),
424 cfg.StrOpt('login_url',
425 default='http://localhost/auth/login/',
426 help="Login page for the dashboard"),
427]
428
429
430def register_dashboard_opts(conf):
431 conf.register_group(scenario_group)
432 for opt in DashboardGroup:
433 conf.register_opt(opt, group='dashboard')
434
435
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500436boto_group = cfg.OptGroup(name='boto',
437 title='EC2/S3 options')
438BotoConfig = [
439 cfg.StrOpt('ec2_url',
440 default="http://localhost:8773/services/Cloud",
441 help="EC2 URL"),
442 cfg.StrOpt('s3_url',
443 default="http://localhost:8080",
444 help="S3 URL"),
445 cfg.StrOpt('aws_secret',
446 default=None,
447 help="AWS Secret Key",
448 secret=True),
449 cfg.StrOpt('aws_access',
450 default=None,
451 help="AWS Access Key"),
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500452 cfg.StrOpt('s3_materials_path',
453 default="/opt/stack/devstack/files/images/"
454 "s3-materials/cirros-0.3.0",
455 help="S3 Materials Path"),
456 cfg.StrOpt('ari_manifest',
457 default="cirros-0.3.0-x86_64-initrd.manifest.xml",
458 help="ARI Ramdisk Image manifest"),
459 cfg.StrOpt('ami_manifest',
460 default="cirros-0.3.0-x86_64-blank.img.manifest.xml",
461 help="AMI Machine Image manifest"),
462 cfg.StrOpt('aki_manifest',
463 default="cirros-0.3.0-x86_64-vmlinuz.manifest.xml",
464 help="AKI Kernel Image manifest"),
465 cfg.StrOpt('instance_type',
466 default="m1.tiny",
467 help="Instance type"),
468 cfg.IntOpt('http_socket_timeout',
469 default=3,
470 help="boto Http socket timeout"),
471 cfg.IntOpt('num_retries',
472 default=1,
473 help="boto num_retries on error"),
474 cfg.IntOpt('build_timeout',
475 default=60,
476 help="Status Change Timeout"),
477 cfg.IntOpt('build_interval',
478 default=1,
479 help="Status Change Test Interval"),
480]
Attila Fazekasf7f2d932012-12-13 09:14:38 +0100481
Attila Fazekasa23f5002012-10-23 19:32:45 +0200482
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500483def register_boto_opts(conf):
484 conf.register_group(boto_group)
485 for opt in BotoConfig:
486 conf.register_opt(opt, group='boto')
Attila Fazekasa23f5002012-10-23 19:32:45 +0200487
Matthew Treinish615ea6a2013-02-25 17:26:59 -0500488stress_group = cfg.OptGroup(name='stress', title='Stress Test Options')
489
490StressGroup = [
491 cfg.StrOpt('nova_logdir',
492 default=None,
493 help='Directory containing log files on the compute nodes'),
494 cfg.IntOpt('max_instances',
495 default=16,
496 help='Maximum number of instances to create during test.'),
497 cfg.StrOpt('controller',
498 default=None,
David Kranzb9d97502013-05-01 15:55:04 -0400499 help='Controller host.'),
500 # new stress options
501 cfg.StrOpt('target_controller',
502 default=None,
503 help='Controller host.'),
504 cfg.StrOpt('target_ssh_user',
505 default=None,
506 help='ssh user.'),
507 cfg.StrOpt('target_private_key_path',
508 default=None,
509 help='Path to private key.'),
510 cfg.StrOpt('target_logfiles',
511 default=None,
512 help='regexp for list of log files.'),
513 cfg.StrOpt('log_check_interval',
514 default=60,
515 help='time between log file error checks.')
Matthew Treinish615ea6a2013-02-25 17:26:59 -0500516]
517
518
519def register_stress_opts(conf):
520 conf.register_group(stress_group)
521 for opt in StressGroup:
522 conf.register_opt(opt, group='stress')
523
Attila Fazekasa23f5002012-10-23 19:32:45 +0200524
Masayuki Igawa73d9f3a2013-05-24 10:30:01 +0900525scenario_group = cfg.OptGroup(name='scenario', title='Scenario Test Options')
526
527ScenarioGroup = [
528 cfg.StrOpt('img_dir',
529 default='/opt/stack/new/devstack/files/images/'
530 'cirros-0.3.1-x86_64-uec',
531 help='Directory containing image files'),
532 cfg.StrOpt('ami_img_file',
533 default='cirros-0.3.1-x86_64-blank.img',
534 help='AMI image file name'),
535 cfg.StrOpt('ari_img_file',
536 default='cirros-0.3.1-x86_64-initrd',
537 help='ARI image file name'),
538 cfg.StrOpt('aki_img_file',
539 default='cirros-0.3.1-x86_64-vmlinuz',
540 help='AKI image file name'),
541 cfg.StrOpt('ssh_user',
542 default='cirros',
Joe Gordonb5e10cd2013-07-10 15:51:12 +0000543 help='ssh username for the image file'),
544 cfg.IntOpt(
545 'large_ops_number',
546 default=0,
547 help="specifies how many resources to request at once. Used "
548 "for large operations testing.")
Masayuki Igawa73d9f3a2013-05-24 10:30:01 +0900549]
550
551
552def register_scenario_opts(conf):
553 conf.register_group(scenario_group)
554 for opt in ScenarioGroup:
555 conf.register_opt(opt, group='scenario')
556
557
Matthew Treinish4c412922013-07-16 15:27:42 -0400558service_available_group = cfg.OptGroup(name="service_available",
559 title="Available OpenStack Services")
560
561ServiceAvailableGroup = [
562 cfg.BoolOpt('cinder',
563 default=True,
564 help="Whether or not cinder is expected to be available"),
Matthew Treinishfaa340d2013-07-19 16:26:21 -0400565 cfg.BoolOpt('neutron',
566 default=False,
567 help="Whether or not neutron is expected to be available"),
Matthew Treinish853ae442013-07-19 16:36:07 -0400568 cfg.BoolOpt('glance',
569 default=True,
570 help="Whether or not glance is expected to be available"),
Matthew Treinish61e332b2013-07-19 16:42:31 -0400571 cfg.BoolOpt('swift',
572 default=True,
573 help="Whether or not swift is expected to be available"),
Matthew Treinish6b41e242013-07-19 16:49:28 -0400574 cfg.BoolOpt('nova',
575 default=True,
576 help="Whether or not nova is expected to be available"),
Matthew Treinisha9d43882013-07-19 16:54:52 -0400577 cfg.BoolOpt('heat',
578 default=False,
579 help="Whether or not Heat is expected to be available"),
Julie Pichond1017642013-07-24 16:37:23 +0100580 cfg.BoolOpt('horizon',
581 default=True,
582 help="Whether or not Horizon is expected to be available"),
Matthew Treinish4c412922013-07-16 15:27:42 -0400583]
584
585
586def register_service_available_opts(conf):
587 conf.register_group(scenario_group)
588 for opt in ServiceAvailableGroup:
589 conf.register_opt(opt, group='service_available')
590
591
Jay Pipes3f981df2012-03-27 18:59:44 -0400592@singleton
593class TempestConfig:
Daryl Walleck1465d612011-11-02 02:22:15 -0500594 """Provides OpenStack configuration information."""
595
Brian Waldon738cd632011-12-12 18:45:09 -0500596 DEFAULT_CONFIG_DIR = os.path.join(
Zhongyue Luoa1343de2013-01-04 16:21:35 +0800597 os.path.abspath(os.path.dirname(os.path.dirname(__file__))),
Brian Waldon738cd632011-12-12 18:45:09 -0500598 "etc")
Daryl Walleck1465d612011-11-02 02:22:15 -0500599
Brian Waldon738cd632011-12-12 18:45:09 -0500600 DEFAULT_CONFIG_FILE = "tempest.conf"
601
602 def __init__(self):
603 """Initialize a configuration from a conf directory and conf file."""
Sean Dague2416cf32013-04-10 08:29:07 -0400604 config_files = []
Sean Dague2416cf32013-04-10 08:29:07 -0400605 failsafe_path = "/etc/tempest/" + self.DEFAULT_CONFIG_FILE
Brian Waldon738cd632011-12-12 18:45:09 -0500606
607 # Environment variables override defaults...
608 conf_dir = os.environ.get('TEMPEST_CONFIG_DIR',
Zhongyue Luo79d8d362012-09-25 13:49:27 +0800609 self.DEFAULT_CONFIG_DIR)
610 conf_file = os.environ.get('TEMPEST_CONFIG', self.DEFAULT_CONFIG_FILE)
Brian Waldon738cd632011-12-12 18:45:09 -0500611
Jay Pipes7f757632011-12-02 15:53:32 -0500612 path = os.path.join(conf_dir, conf_file)
613
Zhongyue Luoafd43eb2013-02-04 11:32:57 +0800614 if not (os.path.isfile(path) or
615 'TEMPEST_CONFIG_DIR' in os.environ or
616 'TEMPEST_CONFIG' in os.environ):
Sean Dague2416cf32013-04-10 08:29:07 -0400617 path = failsafe_path
Attila Fazekas5abb2532012-12-04 11:30:49 +0100618
Jay Pipes7f757632011-12-02 15:53:32 -0500619 if not os.path.exists(path):
Sean Dague43cd9052013-07-19 12:20:04 -0400620 msg = "Config file %s not found" % path
Dirk Muellere746fc22013-06-29 16:29:29 +0200621 print(RuntimeError(msg), file=sys.stderr)
Sean Dague2416cf32013-04-10 08:29:07 -0400622 else:
623 config_files.append(path)
Jay Pipes7f757632011-12-02 15:53:32 -0500624
Sean Dague2416cf32013-04-10 08:29:07 -0400625 cfg.CONF([], project='tempest', default_config_files=config_files)
Matthew Treinishf4a9b0f2013-07-26 16:58:26 -0400626 logging.setup('tempest')
627 LOG = logging.getLogger('tempest')
628 LOG.info("Using tempest config file %s" % path)
Daryl Walleck1465d612011-11-02 02:22:15 -0500629
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500630 register_compute_opts(cfg.CONF)
631 register_identity_opts(cfg.CONF)
Attila Fazekas3ca1fb32013-01-21 23:10:53 +0100632 register_whitebox_opts(cfg.CONF)
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500633 register_image_opts(cfg.CONF)
634 register_network_opts(cfg.CONF)
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500635 register_volume_opts(cfg.CONF)
636 register_object_storage_opts(cfg.CONF)
Steve Bakerc60e4e32013-05-06 15:22:41 +1200637 register_orchestration_opts(cfg.CONF)
Julie Pichond1017642013-07-24 16:37:23 +0100638 register_dashboard_opts(cfg.CONF)
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500639 register_boto_opts(cfg.CONF)
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100640 register_compute_admin_opts(cfg.CONF)
Matthew Treinish615ea6a2013-02-25 17:26:59 -0500641 register_stress_opts(cfg.CONF)
Masayuki Igawa73d9f3a2013-05-24 10:30:01 +0900642 register_scenario_opts(cfg.CONF)
Matthew Treinish4c412922013-07-16 15:27:42 -0400643 register_service_available_opts(cfg.CONF)
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500644 self.compute = cfg.CONF.compute
Attila Fazekas3ca1fb32013-01-21 23:10:53 +0100645 self.whitebox = cfg.CONF.whitebox
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500646 self.identity = cfg.CONF.identity
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500647 self.images = cfg.CONF.image
648 self.network = cfg.CONF.network
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500649 self.volume = cfg.CONF.volume
650 self.object_storage = cfg.CONF['object-storage']
Steve Bakerc60e4e32013-05-06 15:22:41 +1200651 self.orchestration = cfg.CONF.orchestration
Julie Pichond1017642013-07-24 16:37:23 +0100652 self.dashboard = cfg.CONF.dashboard
Matthew Treinish39e48ef2012-12-21 13:36:15 -0500653 self.boto = cfg.CONF.boto
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100654 self.compute_admin = cfg.CONF['compute-admin']
Matthew Treinish615ea6a2013-02-25 17:26:59 -0500655 self.stress = cfg.CONF.stress
Masayuki Igawa73d9f3a2013-05-24 10:30:01 +0900656 self.scenario = cfg.CONF.scenario
Matthew Treinish4c412922013-07-16 15:27:42 -0400657 self.service_available = cfg.CONF.service_available
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100658 if not self.compute_admin.username:
659 self.compute_admin.username = self.identity.admin_username
660 self.compute_admin.password = self.identity.admin_password
661 self.compute_admin.tenant_name = self.identity.admin_tenant_name