OpenStack Testing (Tempest) of an existing cloud
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

config.py 68KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467
  1. # Copyright 2012 OpenStack Foundation
  2. # All Rights Reserved.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License"); you may
  5. # not use this file except in compliance with the License. You may obtain
  6. # a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. # License for the specific language governing permissions and limitations
  14. # under the License.
  15. from __future__ import print_function
  16. import os
  17. import tempfile
  18. from oslo_concurrency import lockutils
  19. from oslo_config import cfg
  20. from oslo_config import types
  21. from oslo_log import log as logging
  22. from tempest.lib import exceptions
  23. from tempest.lib.services import clients
  24. from tempest.test_discover import plugins
  25. # TODO(marun) Replace use of oslo_config's global ConfigOpts
  26. # (cfg.CONF) instance with a local instance (cfg.ConfigOpts()) once
  27. # the cli tests move to the clients. The cli tests rely on oslo
  28. # incubator modules that use the global cfg.CONF.
  29. _CONF = cfg.CONF
  30. def register_opt_group(conf, opt_group, options):
  31. if opt_group:
  32. conf.register_group(opt_group)
  33. for opt in options:
  34. conf.register_opt(opt, group=getattr(opt_group, 'name', None))
  35. auth_group = cfg.OptGroup(name='auth',
  36. title="Options for authentication and credentials")
  37. AuthGroup = [
  38. cfg.StrOpt('test_accounts_file',
  39. help="Path to the yaml file that contains the list of "
  40. "credentials to use for running tests. If used when "
  41. "running in parallel you have to make sure sufficient "
  42. "credentials are provided in the accounts file. For "
  43. "example if no tests with roles are being run it requires "
  44. "at least `2 * CONC` distinct accounts configured in "
  45. " the `test_accounts_file`, with CONC == the "
  46. "number of concurrent test processes."),
  47. cfg.BoolOpt('use_dynamic_credentials',
  48. default=True,
  49. help="Allows test cases to create/destroy projects and "
  50. "users. This option requires that OpenStack Identity "
  51. "API admin credentials are known. If false, isolated "
  52. "test cases and parallel execution, can still be "
  53. "achieved configuring a list of test accounts"),
  54. cfg.ListOpt('tempest_roles',
  55. help="Roles to assign to all users created by tempest",
  56. default=[]),
  57. cfg.StrOpt('default_credentials_domain_name',
  58. default='Default',
  59. help="Default domain used when getting v3 credentials. "
  60. "This is the name keystone uses for v2 compatibility."),
  61. cfg.BoolOpt('create_isolated_networks',
  62. default=True,
  63. help="If use_dynamic_credentials is set to True and Neutron "
  64. "is enabled Tempest will try to create a usable network, "
  65. "subnet, and router when needed for each project it "
  66. "creates. However in some neutron configurations, like "
  67. "with VLAN provider networks, this doesn't work. So if "
  68. "set to False the isolated networks will not be created"),
  69. cfg.StrOpt('admin_username',
  70. help="Username for an administrative user. This is needed for "
  71. "authenticating requests made by project isolation to "
  72. "create users and projects"),
  73. cfg.StrOpt('admin_project_name',
  74. help="Project name to use for an administrative user. This is "
  75. "needed for authenticating requests made by project "
  76. "isolation to create users and projects"),
  77. cfg.StrOpt('admin_password',
  78. help="Password to use for an administrative user. This is "
  79. "needed for authenticating requests made by project "
  80. "isolation to create users and projects",
  81. secret=True),
  82. cfg.StrOpt('admin_domain_name',
  83. default='Default',
  84. help="Admin domain name for authentication (Keystone V3). "
  85. "The same domain applies to user and project"),
  86. ]
  87. identity_group = cfg.OptGroup(name='identity',
  88. title="Keystone Configuration Options")
  89. IdentityGroup = [
  90. cfg.StrOpt('catalog_type',
  91. default='identity',
  92. help="Catalog type of the Identity service."),
  93. cfg.BoolOpt('disable_ssl_certificate_validation',
  94. default=False,
  95. help="Set to True if using self-signed SSL certificates."),
  96. cfg.StrOpt('ca_certificates_file',
  97. default=None,
  98. help='Specify a CA bundle file to use in verifying a '
  99. 'TLS (https) server certificate.'),
  100. cfg.StrOpt('uri',
  101. help="Full URI of the OpenStack Identity API (Keystone), v2"),
  102. cfg.StrOpt('uri_v3',
  103. help='Full URI of the OpenStack Identity API (Keystone), v3'),
  104. cfg.StrOpt('auth_version',
  105. default='v3',
  106. help="Identity API version to be used for authentication "
  107. "for API tests."),
  108. cfg.StrOpt('region',
  109. default='RegionOne',
  110. help="The identity region name to use. Also used as the other "
  111. "services' region name unless they are set explicitly. "
  112. "If no such region is found in the service catalog, the "
  113. "first found one is used."),
  114. cfg.StrOpt('v2_admin_endpoint_type',
  115. default='adminURL',
  116. choices=['public', 'admin', 'internal',
  117. 'publicURL', 'adminURL', 'internalURL'],
  118. help="The admin endpoint type to use for OpenStack Identity "
  119. "(Keystone) API v2"),
  120. cfg.StrOpt('v2_public_endpoint_type',
  121. default='publicURL',
  122. choices=['public', 'admin', 'internal',
  123. 'publicURL', 'adminURL', 'internalURL'],
  124. help="The public endpoint type to use for OpenStack Identity "
  125. "(Keystone) API v2"),
  126. cfg.StrOpt('v3_endpoint_type',
  127. default='adminURL',
  128. choices=['public', 'admin', 'internal',
  129. 'publicURL', 'adminURL', 'internalURL'],
  130. help="The endpoint type to use for OpenStack Identity "
  131. "(Keystone) API v3. The default value adminURL is "
  132. "deprecated and will be modified to publicURL in "
  133. "the next release."),
  134. cfg.StrOpt('admin_role',
  135. default='admin',
  136. help="Role required to administrate keystone."),
  137. cfg.StrOpt('default_domain_id',
  138. default='default',
  139. help="ID of the default domain"),
  140. cfg.BoolOpt('admin_domain_scope',
  141. default=False,
  142. help="Whether keystone identity v3 policy required "
  143. "a domain scoped token to use admin APIs"),
  144. # Security Compliance (PCI-DSS)
  145. cfg.IntOpt('user_lockout_failure_attempts',
  146. default=2,
  147. help="The number of unsuccessful login attempts the user is "
  148. "allowed before having the account locked. This only "
  149. "takes effect when identity-feature-enabled."
  150. "security_compliance is set to 'True'. For more details, "
  151. "refer to keystone config options keystone.conf:"
  152. "security_compliance.lockout_failure_attempts. "
  153. "This feature is disabled by default in keystone."),
  154. cfg.IntOpt('user_lockout_duration',
  155. default=5,
  156. help="The number of seconds a user account will remain "
  157. "locked. This only takes "
  158. "effect when identity-feature-enabled.security_compliance "
  159. "is set to 'True'. For more details, refer to "
  160. "keystone config options "
  161. "keystone.conf:security_compliance.lockout_duration. "
  162. "Setting this option will have no effect unless you also "
  163. "set identity.user_lockout_failure_attempts."),
  164. cfg.IntOpt('user_unique_last_password_count',
  165. default=2,
  166. help="The number of passwords for a user that must be unique "
  167. "before an old password can be reused. This only takes "
  168. "effect when identity-feature-enabled.security_compliance "
  169. "is set to 'True'. "
  170. "This config option corresponds to keystone.conf: "
  171. "security_compliance.unique_last_password_count, whose "
  172. "default value is 0 meaning disabling this feature. "
  173. "NOTE: This config option value must be same as "
  174. "keystone.conf: security_compliance.unique_last_password_"
  175. "count otherwise test might fail"
  176. ),
  177. ]
  178. service_clients_group = cfg.OptGroup(name='service-clients',
  179. title="Service Clients Options")
  180. ServiceClientsGroup = [
  181. cfg.IntOpt('http_timeout',
  182. default=60,
  183. help='Timeout in seconds to wait for the http request to '
  184. 'return'),
  185. cfg.StrOpt('proxy_url',
  186. help='Specify an http proxy to use.')
  187. ]
  188. identity_feature_group = cfg.OptGroup(name='identity-feature-enabled',
  189. title='Enabled Identity Features')
  190. IdentityFeatureGroup = [
  191. cfg.BoolOpt('trust',
  192. default=True,
  193. help='Does the identity service have delegation and '
  194. 'impersonation enabled'),
  195. cfg.BoolOpt('api_v2',
  196. default=False,
  197. help='Is the v2 identity API enabled',
  198. deprecated_for_removal=True,
  199. deprecated_reason='The identity v2.0 API was removed in the '
  200. 'Queens release. Tests that exercise the '
  201. 'v2.0 API will be removed from tempest in '
  202. 'the v22.0.0 release. They are kept only to '
  203. 'test stable branches.'),
  204. cfg.BoolOpt('api_v2_admin',
  205. default=True,
  206. help="Is the v2 identity admin API available? This setting "
  207. "only applies if api_v2 is set to True."),
  208. cfg.BoolOpt('api_v3',
  209. default=True,
  210. help='Is the v3 identity API enabled'),
  211. cfg.ListOpt('api_extensions',
  212. default=['all'],
  213. help="A list of enabled identity extensions with a special "
  214. "entry all which indicates every extension is enabled. "
  215. "Empty list indicates all extensions are disabled. "
  216. "To get the list of extensions run: "
  217. "'openstack extension list --identity'"),
  218. cfg.BoolOpt('domain_specific_drivers',
  219. default=False,
  220. help='Are domain specific drivers enabled? '
  221. 'This configuration value should be same as '
  222. '[identity]->domain_specific_drivers_enabled '
  223. 'in keystone.conf.'),
  224. cfg.BoolOpt('security_compliance',
  225. default=False,
  226. help='Does the environment have the security compliance '
  227. 'settings enabled?'),
  228. cfg.BoolOpt('project_tags',
  229. default=False,
  230. help='Is the project tags identity v3 API available?'),
  231. # Application credentials is a default feature in Queens. This config
  232. # option can removed once Pike is EOL.
  233. cfg.BoolOpt('application_credentials',
  234. default=False,
  235. help='Does the environment have application credentials '
  236. 'enabled?'),
  237. cfg.BoolOpt('immutable_user_source',
  238. default=False,
  239. help='Set to True if the environment has a read-only '
  240. 'user source. This will skip all tests that attempt to '
  241. 'create, delete, or modify users. This should not be set '
  242. 'to True if using dynamic credentials')
  243. ]
  244. compute_group = cfg.OptGroup(name='compute',
  245. title='Compute Service Options')
  246. ComputeGroup = [
  247. cfg.StrOpt('image_ref',
  248. help="Valid primary image reference to be used in tests. "
  249. "This is a required option"),
  250. cfg.StrOpt('image_ref_alt',
  251. help="Valid secondary image reference to be used in tests. "
  252. "This is a required option, but if only one image is "
  253. "available duplicate the value of image_ref above"),
  254. cfg.StrOpt('certified_image_ref',
  255. help="Valid image reference to be used in image certificate "
  256. "validation tests when enabled. This image must also "
  257. "have the required img_signature_* properties set. "
  258. "Additional details available within the following Nova "
  259. "documentation: https://docs.openstack.org/nova/latest/"
  260. "user/certificate-validation.html"),
  261. cfg.ListOpt('certified_image_trusted_certs',
  262. help="A list of trusted certificates to be used when the "
  263. "image certificate validation compute feature is "
  264. "enabled."),
  265. cfg.StrOpt('flavor_ref',
  266. default="1",
  267. help="Valid primary flavor to use in tests."),
  268. cfg.StrOpt('flavor_ref_alt',
  269. default="2",
  270. help='Valid secondary flavor to be used in tests.'),
  271. cfg.IntOpt('build_interval',
  272. default=1,
  273. help="Time in seconds between build status checks."),
  274. cfg.IntOpt('build_timeout',
  275. default=300,
  276. help="Timeout in seconds to wait for an instance to build. "
  277. "Other services that do not define build_timeout will "
  278. "inherit this value."),
  279. cfg.IntOpt('ready_wait',
  280. default=0,
  281. help="Additional wait time for clean state, when there is "
  282. "no OS-EXT-STS extension available"),
  283. cfg.StrOpt('fixed_network_name',
  284. help="Name of the fixed network that is visible to all test "
  285. "projects. If multiple networks are available for a "
  286. "project, this is the network which will be used for "
  287. "creating servers if tempest does not create a network or "
  288. "a network is not specified elsewhere. It may be used for "
  289. "ssh validation only if floating IPs are disabled."),
  290. cfg.StrOpt('catalog_type',
  291. default='compute',
  292. help="Catalog type of the Compute service."),
  293. cfg.StrOpt('region',
  294. default='',
  295. help="The compute region name to use. If empty, the value "
  296. "of identity.region is used instead. If no such region "
  297. "is found in the service catalog, the first found one is "
  298. "used."),
  299. cfg.StrOpt('endpoint_type',
  300. default='publicURL',
  301. choices=['public', 'admin', 'internal',
  302. 'publicURL', 'adminURL', 'internalURL'],
  303. help="The endpoint type to use for the compute service."),
  304. cfg.StrOpt('volume_device_name',
  305. default='vdb',
  306. help="Expected device name when a volume is attached to "
  307. "an instance. Not all hypervisors guarantee that they "
  308. "will respect the user defined device name, tests may "
  309. "fail if inappropriate device name is set."),
  310. cfg.IntOpt('shelved_offload_time',
  311. default=0,
  312. help='Time in seconds before a shelved instance is eligible '
  313. 'for removing from a host. -1 never offload, 0 offload '
  314. 'when shelved. This configuration value should be same as '
  315. 'nova.conf: DEFAULT.shelved_offload_time, and '
  316. 'some tests will run for as long as the time.'),
  317. cfg.IntOpt('min_compute_nodes',
  318. default=1,
  319. help=('The minimum number of compute nodes expected. This will '
  320. 'be utilized by some multinode specific tests to ensure '
  321. 'that requests match the expected size of the cluster '
  322. 'you are testing with.')),
  323. cfg.StrOpt('hypervisor_type',
  324. default=None,
  325. help="Hypervisor type of the test target on heterogeneous "
  326. "compute environment. The value can be 'QEMU', 'xen' or "
  327. "something."),
  328. cfg.StrOpt('min_microversion',
  329. default=None,
  330. help="Lower version of the test target microversion range. "
  331. "The format is 'X.Y', where 'X' and 'Y' are int values. "
  332. "Tempest selects tests based on the range between "
  333. "min_microversion and max_microversion. "
  334. "If both values are not specified, Tempest avoids tests "
  335. "which require a microversion. Valid values are string "
  336. "with format 'X.Y' or string 'latest'"),
  337. cfg.StrOpt('max_microversion',
  338. default=None,
  339. help="Upper version of the test target microversion range. "
  340. "The format is 'X.Y', where 'X' and 'Y' are int values. "
  341. "Tempest selects tests based on the range between "
  342. "min_microversion and max_microversion. "
  343. "If both values are not specified, Tempest avoids tests "
  344. "which require a microversion. Valid values are string "
  345. "with format 'X.Y' or string 'latest'"),
  346. cfg.StrOpt('compute_volume_common_az',
  347. default=None,
  348. help='AZ to be used for Cinder and Nova. Set this parameter '
  349. 'when the cloud has nova.conf: cinder.cross_az_attach '
  350. 'set to false. Which means volumes attached to an '
  351. 'instance must be in the same availability zone in Cinder '
  352. 'as the instance availability zone in Nova. Set the '
  353. 'common availability zone in this config which will be '
  354. 'used to boot an instance as well as creating a volume. '
  355. 'NOTE: If that AZ is not in Cinder (or '
  356. 'allow_availability_zone_fallback=False in cinder.conf), '
  357. 'the volume create request will fail and the instance '
  358. 'will fail the build request.'),
  359. ]
  360. placement_group = cfg.OptGroup(name='placement',
  361. title='Placement Service Options')
  362. PlacementGroup = [
  363. cfg.StrOpt('endpoint_type',
  364. default='public',
  365. choices=['public', 'admin', 'internal'],
  366. help="The endpoint type to use for the placement service."),
  367. cfg.StrOpt('catalog_type',
  368. default='placement',
  369. help="Catalog type of the Placement service."),
  370. cfg.StrOpt('region',
  371. default='RegionOne',
  372. help="The placement region name to use. If empty, the value "
  373. "of [identity]/region is used instead. If no such region "
  374. "is found in the service catalog, the first region found "
  375. "is used."),
  376. cfg.StrOpt('min_microversion',
  377. default=None,
  378. help="Lower version of the test target microversion range. "
  379. "The format is 'X.Y', where 'X' and 'Y' are int values. "
  380. "Valid values are string with format 'X.Y' or string "
  381. "'latest'"),
  382. cfg.StrOpt('max_microversion',
  383. default=None,
  384. help="Upper version of the test target microversion range. "
  385. "The format is 'X.Y', where 'X' and 'Y' are int values. "
  386. "Valid values are string with format 'X.Y' or string "
  387. "'latest'"),
  388. ]
  389. compute_features_group = cfg.OptGroup(name='compute-feature-enabled',
  390. title="Enabled Compute Service Features")
  391. ComputeFeaturesGroup = [
  392. cfg.BoolOpt('disk_config',
  393. default=True,
  394. help="If false, skip disk config tests"),
  395. cfg.ListOpt('api_extensions',
  396. default=['all'],
  397. help='A list of enabled compute extensions with a special '
  398. 'entry all which indicates every extension is enabled. '
  399. 'Each extension should be specified with alias name. '
  400. 'Empty list indicates all extensions are disabled',
  401. deprecated_for_removal=True,
  402. deprecated_reason='The Nova extensions API and mechanism '
  403. 'is deprecated. This option will be '
  404. 'removed when all releases supported '
  405. 'by tempest no longer contain the Nova '
  406. 'extensions API and mechanism.'),
  407. cfg.BoolOpt('change_password',
  408. default=False,
  409. help="Does the test environment support changing the admin "
  410. "password?"),
  411. cfg.BoolOpt('console_output',
  412. default=True,
  413. help="Does the test environment support obtaining instance "
  414. "serial console output?"),
  415. cfg.BoolOpt('resize',
  416. default=False,
  417. help="Does the test environment support resizing? When you "
  418. "enable this feature, 'flavor_ref_alt' should be set and "
  419. "it should refer to a larger flavor than 'flavor_ref' "
  420. "one."),
  421. cfg.BoolOpt('pause',
  422. default=True,
  423. help="Does the test environment support pausing?"),
  424. cfg.BoolOpt('shelve',
  425. default=True,
  426. help="Does the test environment support shelving/unshelving?"),
  427. cfg.BoolOpt('suspend',
  428. default=True,
  429. help="Does the test environment support suspend/resume?"),
  430. cfg.BoolOpt('cold_migration',
  431. default=True,
  432. help="Does the test environment support cold migration?"),
  433. cfg.BoolOpt('live_migration',
  434. default=True,
  435. help="Does the test environment support live migration?"),
  436. cfg.BoolOpt('live_migrate_back_and_forth',
  437. default=False,
  438. help="Does the test environment support live migrating "
  439. "VM back and forth between different versions of "
  440. "nova-compute?"),
  441. cfg.BoolOpt('metadata_service',
  442. default=True,
  443. help="Does the test environment support metadata service? "
  444. "Ignored unless validation.run_validation=true."),
  445. cfg.BoolOpt('block_migration_for_live_migration',
  446. default=False,
  447. help="Does the test environment use block devices for live "
  448. "migration"),
  449. cfg.BoolOpt('block_migrate_cinder_iscsi',
  450. default=False,
  451. help="Does the test environment support block migration with "
  452. "Cinder iSCSI volumes. Note: libvirt >= 1.2.17 is required "
  453. "to support this if using the libvirt compute driver."),
  454. cfg.BoolOpt('vnc_console',
  455. default=False,
  456. help='Enable VNC console. This configuration value should '
  457. 'be same as nova.conf: vnc.enabled'),
  458. cfg.StrOpt('vnc_server_header',
  459. default='WebSockify',
  460. help='Expected VNC server name (WebSockify, nginx, etc) '
  461. 'in response header.',
  462. deprecated_for_removal=True,
  463. deprecated_reason='This option will be ignored because the '
  464. 'usage of different response header fields '
  465. 'to accomplish the same goal (in accordance '
  466. 'with RFC7231 S6.2.2) makes it obsolete.'),
  467. cfg.BoolOpt('spice_console',
  468. default=False,
  469. help='Enable Spice console. This configuration value should '
  470. 'be same as nova.conf: spice.enabled'),
  471. cfg.BoolOpt('rdp_console',
  472. default=False,
  473. help='Enable RDP console. This configuration value should '
  474. 'be same as nova.conf: rdp.enabled'),
  475. cfg.BoolOpt('serial_console',
  476. default=False,
  477. help='Enable serial console. This configuration value '
  478. 'should be the same as '
  479. 'nova.conf: serial_console.enabled'),
  480. cfg.BoolOpt('rescue',
  481. default=True,
  482. help='Does the test environment support instance rescue '
  483. 'mode?'),
  484. cfg.BoolOpt('enable_instance_password',
  485. default=True,
  486. help='Enables returning of the instance password by the '
  487. 'relevant server API calls such as create, rebuild '
  488. 'or rescue. This configuration value should be same as '
  489. 'nova.conf: DEFAULT.enable_instance_password'),
  490. cfg.BoolOpt('interface_attach',
  491. default=True,
  492. help='Does the test environment support dynamic network '
  493. 'interface attachment?'),
  494. cfg.BoolOpt('snapshot',
  495. default=True,
  496. help='Does the test environment support creating snapshot '
  497. 'images of running instances?'),
  498. cfg.BoolOpt('nova_cert',
  499. default=False,
  500. help='Does the test environment have the nova cert running?',
  501. deprecated_for_removal=True,
  502. deprecated_reason="On Nova side, the nova-cert service is "
  503. "deprecated and the service will be removed "
  504. "as early as Ocata."),
  505. cfg.BoolOpt('personality',
  506. default=False,
  507. help='Does the test environment support server personality'),
  508. cfg.BoolOpt('attach_encrypted_volume',
  509. default=True,
  510. help='Does the test environment support attaching an '
  511. 'encrypted volume to a running server instance? This may '
  512. 'depend on the combination of compute_driver in nova and '
  513. 'the volume_driver(s) in cinder.'),
  514. cfg.BoolOpt('config_drive',
  515. default=True,
  516. help='Enable special configuration drive with metadata.'),
  517. cfg.ListOpt('scheduler_enabled_filters',
  518. default=["AvailabilityZoneFilter", "ComputeFilter",
  519. "ComputeCapabilitiesFilter", "ImagePropertiesFilter",
  520. "ServerGroupAntiAffinityFilter",
  521. "ServerGroupAffinityFilter"],
  522. help="A list of enabled filters that Nova will accept as "
  523. "hints to the scheduler when creating a server. If the "
  524. "default value is overridden in nova.conf by the test "
  525. "environment (which means that a different set of "
  526. "filters is enabled than what is included in Nova by "
  527. "default), then this option must be configured to "
  528. "contain the same filters that Nova uses in the test "
  529. "environment. A special entry 'all' indicates all "
  530. "filters that are included with Nova are enabled. If "
  531. "using 'all', be sure to enable all filters in "
  532. "nova.conf, as tests can fail in unpredictable ways if "
  533. "Nova's and Tempest's enabled filters don't match. "
  534. "Empty list indicates all filters are disabled. The "
  535. "full list of enabled filters is in nova.conf: "
  536. "filter_scheduler.enabled_filters.",
  537. deprecated_opts=[cfg.DeprecatedOpt(
  538. 'scheduler_available_filters',
  539. group='compute-feature-enabled')]),
  540. cfg.BoolOpt('swap_volume',
  541. default=False,
  542. help='Does the test environment support in-place swapping of '
  543. 'volumes attached to a server instance?'),
  544. cfg.BoolOpt('volume_backed_live_migration',
  545. default=False,
  546. help='Does the test environment support volume-backed live '
  547. 'migration?'),
  548. cfg.BoolOpt('volume_multiattach',
  549. default=False,
  550. help='Does the test environment support attaching a volume to '
  551. 'more than one instance? This depends on hypervisor and '
  552. 'volume backend/type and compute API version 2.60.'),
  553. ]
  554. image_group = cfg.OptGroup(name='image',
  555. title="Image Service Options")
  556. ImageGroup = [
  557. cfg.StrOpt('catalog_type',
  558. default='image',
  559. help='Catalog type of the Image service.'),
  560. cfg.StrOpt('region',
  561. default='',
  562. help="The image region name to use. If empty, the value "
  563. "of identity.region is used instead. If no such region "
  564. "is found in the service catalog, the first found one is "
  565. "used."),
  566. cfg.StrOpt('endpoint_type',
  567. default='publicURL',
  568. choices=['public', 'admin', 'internal',
  569. 'publicURL', 'adminURL', 'internalURL'],
  570. help="The endpoint type to use for the image service."),
  571. cfg.StrOpt('http_image',
  572. default='http://download.cirros-cloud.net/0.3.1/'
  573. 'cirros-0.3.1-x86_64-uec.tar.gz',
  574. help='http accessible image'),
  575. cfg.IntOpt('build_timeout',
  576. default=300,
  577. help="Timeout in seconds to wait for an image to "
  578. "become available."),
  579. cfg.IntOpt('build_interval',
  580. default=1,
  581. help="Time in seconds between image operation status "
  582. "checks."),
  583. cfg.ListOpt('container_formats',
  584. default=['ami', 'ari', 'aki', 'bare', 'ovf', 'ova'],
  585. help="A list of image's container formats "
  586. "users can specify."),
  587. cfg.ListOpt('disk_formats',
  588. default=['ami', 'ari', 'aki', 'vhd', 'vmdk', 'raw', 'qcow2',
  589. 'vdi', 'iso', 'vhdx'],
  590. help="A list of image's disk formats "
  591. "users can specify.")
  592. ]
  593. image_feature_group = cfg.OptGroup(name='image-feature-enabled',
  594. title='Enabled image service features')
  595. ImageFeaturesGroup = [
  596. cfg.BoolOpt('api_v2',
  597. default=True,
  598. help="Is the v2 image API enabled",
  599. deprecated_for_removal=True,
  600. deprecated_reason='Glance v1 APIs are deprecated and v2 APIs '
  601. 'are current one. In future, Tempest will '
  602. 'test v2 APIs only so this config option '
  603. 'will be removed.'),
  604. cfg.BoolOpt('api_v1',
  605. default=False,
  606. help="Is the v1 image API enabled",
  607. deprecated_for_removal=True,
  608. deprecated_reason='Glance v1 APIs are deprecated and v2 APIs '
  609. 'are current one. In future, Tempest will '
  610. 'test v2 APIs only so this config option '
  611. 'will be removed.'),
  612. ]
  613. network_group = cfg.OptGroup(name='network',
  614. title='Network Service Options')
  615. ProfileType = types.Dict(types.List(types.String(), bounds=True))
  616. NetworkGroup = [
  617. cfg.StrOpt('catalog_type',
  618. default='network',
  619. help='Catalog type of the Neutron service.'),
  620. cfg.StrOpt('region',
  621. default='',
  622. help="The network region name to use. If empty, the value "
  623. "of identity.region is used instead. If no such region "
  624. "is found in the service catalog, the first found one is "
  625. "used."),
  626. cfg.StrOpt('endpoint_type',
  627. default='publicURL',
  628. choices=['public', 'admin', 'internal',
  629. 'publicURL', 'adminURL', 'internalURL'],
  630. help="The endpoint type to use for the network service."),
  631. cfg.StrOpt('project_network_cidr',
  632. default="10.100.0.0/16",
  633. help="The cidr block to allocate project ipv4 subnets from"),
  634. cfg.IntOpt('project_network_mask_bits',
  635. default=28,
  636. help="The mask bits for project ipv4 subnets"),
  637. cfg.StrOpt('project_network_v6_cidr',
  638. default="2003::/48",
  639. help="The cidr block to allocate project ipv6 subnets from"),
  640. cfg.IntOpt('project_network_v6_mask_bits',
  641. default=64,
  642. help="The mask bits for project ipv6 subnets"),
  643. cfg.BoolOpt('project_networks_reachable',
  644. default=False,
  645. help="Whether project networks can be reached directly from "
  646. "the test client. This must be set to True when the "
  647. "'fixed' connect_method is selected."),
  648. cfg.StrOpt('public_network_id',
  649. default="",
  650. help="Id of the public network that provides external "
  651. "connectivity"),
  652. cfg.StrOpt('floating_network_name',
  653. help="Default floating network name. Used to allocate floating "
  654. "IPs when neutron is enabled."),
  655. cfg.StrOpt('public_router_id',
  656. default="",
  657. help="Id of the public router that provides external "
  658. "connectivity. This should only be used when Neutron's "
  659. "'allow_overlapping_ips' is set to 'False' in "
  660. "neutron.conf. usually not needed past 'Grizzly' release"),
  661. cfg.IntOpt('build_timeout',
  662. default=300,
  663. help="Timeout in seconds to wait for network operation to "
  664. "complete."),
  665. cfg.IntOpt('build_interval',
  666. default=1,
  667. help="Time in seconds between network operation status "
  668. "checks."),
  669. cfg.ListOpt('dns_servers',
  670. default=["8.8.8.8", "8.8.4.4"],
  671. help="List of dns servers which should be used"
  672. " for subnet creation",
  673. deprecated_for_removal=True,
  674. deprecated_reason="This config option is no longer "
  675. "used anywhere, so it can be removed."),
  676. cfg.StrOpt('port_vnic_type',
  677. choices=[None, 'normal', 'direct', 'macvtap'],
  678. help="vnic_type to use when launching instances"
  679. " with pre-configured ports."
  680. " Supported ports are:"
  681. " ['normal','direct','macvtap']"),
  682. cfg.Opt('port_profile',
  683. type=ProfileType,
  684. default={},
  685. help="port profile to use when launching instances"
  686. " with pre-configured ports."),
  687. cfg.ListOpt('default_network',
  688. default=["1.0.0.0/16", "2.0.0.0/16"],
  689. help="List of ip pools"
  690. " for subnetpools creation"),
  691. cfg.BoolOpt('shared_physical_network',
  692. default=False,
  693. help="The environment does not support network separation "
  694. "between tenants."),
  695. ]
  696. network_feature_group = cfg.OptGroup(name='network-feature-enabled',
  697. title='Enabled network service features')
  698. NetworkFeaturesGroup = [
  699. cfg.BoolOpt('ipv6',
  700. default=True,
  701. help="Allow the execution of IPv6 tests"),
  702. cfg.ListOpt('api_extensions',
  703. default=['all'],
  704. help="A list of enabled network extensions with a special "
  705. "entry all which indicates every extension is enabled. "
  706. "Empty list indicates all extensions are disabled. "
  707. "To get the list of extensions run: 'neutron ext-list'"),
  708. cfg.BoolOpt('ipv6_subnet_attributes',
  709. default=False,
  710. help="Allow the execution of IPv6 subnet tests that use "
  711. "the extended IPv6 attributes ipv6_ra_mode "
  712. "and ipv6_address_mode"
  713. ),
  714. cfg.BoolOpt('port_admin_state_change',
  715. default=True,
  716. help="Does the test environment support changing"
  717. " port admin state"),
  718. cfg.BoolOpt('port_security',
  719. default=False,
  720. help="Does the test environment support port security?"),
  721. cfg.BoolOpt('floating_ips',
  722. default=True,
  723. help='Does the test environment support floating_ips'),
  724. cfg.StrOpt('qos_placement_physnet', default=None,
  725. help='Name of the physnet for placement based minimum '
  726. 'bandwidth allocation.'),
  727. cfg.StrOpt('provider_net_base_segmentation_id', default=3000,
  728. help='Base segmentation ID to create provider networks. '
  729. 'This value will be increased in case of conflict.')
  730. ]
  731. validation_group = cfg.OptGroup(name='validation',
  732. title='SSH Validation options')
  733. ValidationGroup = [
  734. cfg.BoolOpt('run_validation',
  735. default=True,
  736. help='Enable ssh on created servers and creation of additional'
  737. ' validation resources to enable remote access.'
  738. ' In case the guest does not support ssh set it'
  739. ' to false'),
  740. cfg.BoolOpt('security_group',
  741. default=True,
  742. help='Enable/disable security groups.'),
  743. cfg.BoolOpt('security_group_rules',
  744. default=True,
  745. help='Enable/disable security group rules.'),
  746. cfg.StrOpt('connect_method',
  747. default='floating',
  748. choices=['fixed', 'floating'],
  749. help='Default IP type used for validation: '
  750. '-fixed: uses the first IP belonging to the fixed network '
  751. '-floating: creates and uses a floating IP'),
  752. cfg.StrOpt('auth_method',
  753. default='keypair',
  754. choices=['keypair'],
  755. help='Default authentication method to the instance. '
  756. 'Only ssh via keypair is supported for now. '
  757. 'Additional methods will be handled in a separate spec.'),
  758. cfg.IntOpt('ip_version_for_ssh',
  759. default=4,
  760. help='Default IP version for ssh connections.'),
  761. cfg.IntOpt('ping_timeout',
  762. default=120,
  763. help='Timeout in seconds to wait for ping to succeed.'),
  764. cfg.IntOpt('connect_timeout',
  765. default=60,
  766. help='Timeout in seconds to wait for the TCP connection to be '
  767. 'successful.'),
  768. cfg.IntOpt('ssh_timeout',
  769. default=300,
  770. help='Timeout in seconds to wait for the ssh banner.'),
  771. cfg.StrOpt('image_ssh_user',
  772. default="root",
  773. help="User name used to authenticate to an instance."),
  774. cfg.StrOpt('image_ssh_password',
  775. default="password",
  776. help="Password used to authenticate to an instance."),
  777. cfg.StrOpt('ssh_shell_prologue',
  778. default="set -eu -o pipefail; PATH=$$PATH:/sbin:/usr/sbin;",
  779. help="Shell fragments to use before executing a command "
  780. "when sshing to a guest."),
  781. cfg.IntOpt('ping_size',
  782. default=56,
  783. help="The packet size for ping packets originating "
  784. "from remote linux hosts"),
  785. cfg.IntOpt('ping_count',
  786. default=1,
  787. help="The number of ping packets originating from remote "
  788. "linux hosts"),
  789. cfg.StrOpt('floating_ip_range',
  790. default='10.0.0.0/29',
  791. help='Unallocated floating IP range, which will be used to '
  792. 'test the floating IP bulk feature for CRUD operation. '
  793. 'This block must not overlap an existing floating IP '
  794. 'pool.'),
  795. cfg.StrOpt('network_for_ssh',
  796. default='public',
  797. help="Network used for SSH connections. Ignored if "
  798. "connect_method=floating."),
  799. ]
  800. volume_group = cfg.OptGroup(name='volume',
  801. title='Block Storage Options')
  802. VolumeGroup = [
  803. cfg.IntOpt('build_interval',
  804. default=1,
  805. help='Time in seconds between volume availability checks.'),
  806. cfg.IntOpt('build_timeout',
  807. default=300,
  808. help='Timeout in seconds to wait for a volume to become '
  809. 'available.'),
  810. cfg.StrOpt('catalog_type',
  811. default='volumev3',
  812. help="Catalog type of the Volume Service"),
  813. cfg.StrOpt('region',
  814. default='',
  815. help="The volume region name to use. If empty, the value "
  816. "of identity.region is used instead. If no such region "
  817. "is found in the service catalog, the first found one is "
  818. "used."),
  819. cfg.StrOpt('endpoint_type',
  820. default='publicURL',
  821. choices=['public', 'admin', 'internal',
  822. 'publicURL', 'adminURL', 'internalURL'],
  823. help="The endpoint type to use for the volume service."),
  824. cfg.ListOpt('backend_names',
  825. default=['BACKEND_1', 'BACKEND_2'],
  826. help='A list of backend names separated by comma. '
  827. 'The backend name must be declared in cinder.conf'),
  828. cfg.StrOpt('storage_protocol',
  829. default='iSCSI',
  830. help='Backend protocol to target when creating volume types'),
  831. cfg.StrOpt('vendor_name',
  832. default='Open Source',
  833. help='Backend vendor to target when creating volume types'),
  834. cfg.StrOpt('disk_format',
  835. default='raw',
  836. help='Disk format to use when copying a volume to image'),
  837. cfg.IntOpt('volume_size',
  838. default=1,
  839. help='Default size in GB for volumes created by volumes tests'),
  840. cfg.ListOpt('manage_volume_ref',
  841. default=['source-name', 'volume-%s'],
  842. help="A reference to existing volume for volume manage. "
  843. "It contains two elements, the first is ref type "
  844. "(like 'source-name', 'source-id', etc), the second is "
  845. "volume name template used in storage backend"),
  846. cfg.ListOpt('manage_snapshot_ref',
  847. default=['source-name', '_snapshot-%s'],
  848. help="A reference to existing snapshot for snapshot manage. "
  849. "It contains two elements, the first is ref type "
  850. "(like 'source-name', 'source-id', etc), the second is "
  851. "snapshot name template used in storage backend"),
  852. cfg.StrOpt('min_microversion',
  853. default=None,
  854. help="Lower version of the test target microversion range. "
  855. "The format is 'X.Y', where 'X' and 'Y' are int values. "
  856. "Tempest selects tests based on the range between "
  857. "min_microversion and max_microversion. "
  858. "If both values are not specified, Tempest avoids tests "
  859. "which require a microversion. Valid values are string "
  860. "with format 'X.Y' or string 'latest'",),
  861. cfg.StrOpt('max_microversion',
  862. default=None,
  863. help="Upper version of the test target microversion range. "
  864. "The format is 'X.Y', where 'X' and 'Y' are int values. "
  865. "Tempest selects tests based on the range between "
  866. "min_microversion and max_microversion. "
  867. "If both values are not specified, Tempest avoids tests "
  868. "which require a microversion. Valid values are string "
  869. "with format 'X.Y' or string 'latest'",),
  870. ]
  871. volume_feature_group = cfg.OptGroup(name='volume-feature-enabled',
  872. title='Enabled Cinder Features')
  873. VolumeFeaturesGroup = [
  874. cfg.BoolOpt('multi_backend',
  875. default=False,
  876. help="Runs Cinder multi-backend test (requires 2 backends)"),
  877. cfg.BoolOpt('backup',
  878. default=True,
  879. help='Runs Cinder volumes backup test'),
  880. cfg.BoolOpt('snapshot',
  881. default=True,
  882. help='Runs Cinder volume snapshot test'),
  883. cfg.BoolOpt('clone',
  884. default=True,
  885. help='Runs Cinder volume clone test'),
  886. cfg.BoolOpt('manage_snapshot',
  887. default=False,
  888. help='Runs Cinder manage snapshot tests'),
  889. cfg.BoolOpt('manage_volume',
  890. default=False,
  891. help='Runs Cinder manage volume tests'),
  892. cfg.ListOpt('api_extensions',
  893. default=['all'],
  894. help='A list of enabled volume extensions with a special '
  895. 'entry all which indicates every extension is enabled. '
  896. 'Empty list indicates all extensions are disabled'),
  897. cfg.BoolOpt('api_v2',
  898. default=True,
  899. help="Is the v2 volume API enabled",
  900. deprecated_for_removal=True,
  901. deprecated_reason="The v2 volume API has been deprecated "
  902. "since Pike release. Now Tempest run all "
  903. "the volume tests against v2 or v3 API "
  904. "based on CONF.volume.catalog_type which "
  905. "makes this config option unusable. If "
  906. "catalog_type is volumev2, then all the "
  907. "volume tests will run against v2 API. "
  908. "Use ``CONF.volume.catalog_type`` to run "
  909. "the Tempest against volume v2 or v3 API"),
  910. cfg.BoolOpt('api_v3',
  911. default=True,
  912. help="Is the v3 volume API enabled",
  913. deprecated_for_removal=True,
  914. deprecated_reason="Tempest run all the volume tests against "
  915. "v2 or v3 API based on "
  916. "CONF.volume.catalog_type which makes this "
  917. "config option unusable. If catalog_type is "
  918. "volumev3 which is default, then all the "
  919. "volume tests will run against v3 API. "
  920. "Use ``CONF.volume.catalog_type`` to run "
  921. "the Tempest against volume v2 or v3 API"),
  922. cfg.BoolOpt('extend_attached_volume',
  923. default=False,
  924. help='Does the cloud support extending the size of a volume '
  925. 'which is currently attached to a server instance? This '
  926. 'depends on the 3.42 volume API microversion and the '
  927. '2.51 compute API microversion. Also, not all volume or '
  928. 'compute backends support this operation.')
  929. ]
  930. object_storage_group = cfg.OptGroup(name='object-storage',
  931. title='Object Storage Service Options')
  932. ObjectStoreGroup = [
  933. cfg.StrOpt('catalog_type',
  934. default='object-store',
  935. help="Catalog type of the Object-Storage service."),
  936. cfg.StrOpt('region',
  937. default='',
  938. help="The object-storage region name to use. If empty, the "
  939. "value of identity.region is used instead. If no such "
  940. "region is found in the service catalog, the first found "
  941. "one is used."),
  942. cfg.StrOpt('endpoint_type',
  943. default='publicURL',
  944. choices=['public', 'admin', 'internal',
  945. 'publicURL', 'adminURL', 'internalURL'],
  946. help="The endpoint type to use for the object-store service."),
  947. cfg.IntOpt('container_sync_timeout',
  948. default=600,
  949. help="Number of seconds to time on waiting for a container "
  950. "to container synchronization complete."),
  951. cfg.IntOpt('container_sync_interval',
  952. default=5,
  953. help="Number of seconds to wait while looping to check the "
  954. "status of a container to container synchronization"),
  955. cfg.StrOpt('operator_role',
  956. default='Member',
  957. help="Role to add to users created for swift tests to "
  958. "enable creating containers"),
  959. cfg.StrOpt('reseller_admin_role',
  960. default='ResellerAdmin',
  961. help="User role that has reseller admin"),
  962. cfg.StrOpt('realm_name',
  963. default='realm1',
  964. help="Name of sync realm. A sync realm is a set of clusters "
  965. "that have agreed to allow container syncing with each "
  966. "other. Set the same realm name as Swift's "
  967. "container-sync-realms.conf"),
  968. cfg.StrOpt('cluster_name',
  969. default='name1',
  970. help="One name of cluster which is set in the realm whose name "
  971. "is set in 'realm_name' item in this file. Set the "
  972. "same cluster name as Swift's container-sync-realms.conf"),
  973. ]
  974. object_storage_feature_group = cfg.OptGroup(
  975. name='object-storage-feature-enabled',
  976. title='Enabled object-storage features')
  977. ObjectStoreFeaturesGroup = [
  978. cfg.ListOpt('discoverable_apis',
  979. default=['all'],
  980. help="A list of the enabled optional discoverable apis. "
  981. "A single entry, all, indicates that all of these "
  982. "features are expected to be enabled"),
  983. cfg.BoolOpt('container_sync',
  984. default=True,
  985. help="Execute (old style) container-sync tests"),
  986. cfg.BoolOpt('object_versioning',
  987. default=True,
  988. help="Execute object-versioning tests"),
  989. cfg.BoolOpt('discoverability',
  990. default=True,
  991. help="Execute discoverability tests"),
  992. ]
  993. scenario_group = cfg.OptGroup(name='scenario', title='Scenario Test Options')
  994. ScenarioGroup = [
  995. cfg.StrOpt('img_dir',
  996. default='/opt/stack/new/devstack/files/images/'
  997. 'cirros-0.3.1-x86_64-uec',
  998. help='Directory containing image files',
  999. deprecated_for_removal=True),
  1000. cfg.StrOpt('img_file', deprecated_name='qcow2_img_file',
  1001. default='cirros-0.3.1-x86_64-disk.img',
  1002. help='Image file name'),
  1003. cfg.StrOpt('img_disk_format',
  1004. default='qcow2',
  1005. help='Image disk format'),
  1006. cfg.StrOpt('img_container_format',
  1007. default='bare',
  1008. help='Image container format'),
  1009. cfg.DictOpt('img_properties', help='Glance image properties. '
  1010. 'Use for custom images which require them'),
  1011. cfg.StrOpt('ami_img_file',
  1012. default='cirros-0.3.1-x86_64-blank.img',
  1013. help='AMI image file name',
  1014. deprecated_for_removal=True),
  1015. cfg.StrOpt('ari_img_file',
  1016. default='cirros-0.3.1-x86_64-initrd',
  1017. help='ARI image file name',
  1018. deprecated_for_removal=True),
  1019. cfg.StrOpt('aki_img_file',
  1020. default='cirros-0.3.1-x86_64-vmlinuz',
  1021. help='AKI image file name',
  1022. deprecated_for_removal=True),
  1023. # TODO(yfried): add support for dhcpcd
  1024. cfg.StrOpt('dhcp_client',
  1025. default='udhcpc',
  1026. choices=["udhcpc", "dhclient", ""],
  1027. help='DHCP client used by images to renew DCHP lease. '
  1028. 'If left empty, update operation will be skipped. '
  1029. 'Supported clients: "udhcpc", "dhclient"'),
  1030. cfg.StrOpt('protocol',
  1031. default='icmp',
  1032. choices=('icmp', 'tcp', 'udp'),
  1033. help='The protocol used in security groups tests to check '
  1034. 'connectivity.'),
  1035. ]
  1036. service_available_group = cfg.OptGroup(name="service_available",
  1037. title="Available OpenStack Services")
  1038. ServiceAvailableGroup = [
  1039. cfg.BoolOpt('cinder',
  1040. default=True,
  1041. help="Whether or not cinder is expected to be available"),
  1042. cfg.BoolOpt('neutron',
  1043. default=False,
  1044. help="Whether or not neutron is expected to be available"),
  1045. cfg.BoolOpt('glance',
  1046. default=True,
  1047. help="Whether or not glance is expected to be available"),
  1048. cfg.BoolOpt('swift',
  1049. default=True,
  1050. help="Whether or not swift is expected to be available"),
  1051. cfg.BoolOpt('nova',
  1052. default=True,
  1053. help="Whether or not nova is expected to be available"),
  1054. ]
  1055. debug_group = cfg.OptGroup(name="debug",
  1056. title="Debug System")
  1057. DebugGroup = [
  1058. cfg.StrOpt('trace_requests',
  1059. default='',
  1060. help="""A regex to determine which requests should be traced.
  1061. This is a regex to match the caller for rest client requests to be able to
  1062. selectively trace calls out of specific classes and methods. It largely
  1063. exists for test development, and is not expected to be used in a real deploy
  1064. of tempest. This will be matched against the discovered ClassName:method
  1065. in the test environment.
  1066. Expected values for this field are:
  1067. * ClassName:test_method_name - traces one test_method
  1068. * ClassName:setUp(Class) - traces specific setup functions
  1069. * ClassName:tearDown(Class) - traces specific teardown functions
  1070. * ClassName:_run_cleanups - traces the cleanup functions
  1071. If nothing is specified, this feature is not enabled. To trace everything
  1072. specify .* as the regex.
  1073. """)
  1074. ]
  1075. profiler_group = cfg.OptGroup(name="profiler",
  1076. title="OpenStack Profiler")
  1077. ProfilerGroup = [
  1078. cfg.StrOpt('key',
  1079. help="The secret key to enable OpenStack Profiler. The value "
  1080. "should match the one configured in OpenStack services "
  1081. "under `[profiler]/hmac_keys` property. The default empty "
  1082. "value keeps profiling disabled"),
  1083. ]
  1084. DefaultGroup = [
  1085. cfg.BoolOpt('pause_teardown',
  1086. default=False,
  1087. help="""Whether to pause a test in global teardown.
  1088. The best use case is investigating used resources of one test.
  1089. A test can be run as follows:
  1090. $ ostestr --pdb TEST_ID
  1091. or
  1092. $ python -m testtools.run TEST_ID"""),
  1093. ]
  1094. _opts = [
  1095. (auth_group, AuthGroup),
  1096. (compute_group, ComputeGroup),
  1097. (compute_features_group, ComputeFeaturesGroup),
  1098. (identity_group, IdentityGroup),
  1099. (service_clients_group, ServiceClientsGroup),
  1100. (identity_feature_group, IdentityFeatureGroup),
  1101. (image_group, ImageGroup),
  1102. (image_feature_group, ImageFeaturesGroup),
  1103. (network_group, NetworkGroup),
  1104. (network_feature_group, NetworkFeaturesGroup),
  1105. (validation_group, ValidationGroup),
  1106. (volume_group, VolumeGroup),
  1107. (volume_feature_group, VolumeFeaturesGroup),
  1108. (object_storage_group, ObjectStoreGroup),
  1109. (object_storage_feature_group, ObjectStoreFeaturesGroup),
  1110. (scenario_group, ScenarioGroup),
  1111. (service_available_group, ServiceAvailableGroup),
  1112. (debug_group, DebugGroup),
  1113. (placement_group, PlacementGroup),
  1114. (profiler_group, ProfilerGroup),
  1115. (None, DefaultGroup)
  1116. ]
  1117. def register_opts():
  1118. ext_plugins = plugins.TempestTestPluginManager()
  1119. # Register in-tree tempest config options
  1120. for g, o in _opts:
  1121. register_opt_group(_CONF, g, o)
  1122. # Call external plugin config option registration
  1123. ext_plugins.register_plugin_opts(_CONF)
  1124. def list_opts():
  1125. """Return a list of oslo.config options available.
  1126. The purpose of this is to allow tools like the Oslo sample config file
  1127. generator to discover the options exposed to users.
  1128. """
  1129. ext_plugins = plugins.TempestTestPluginManager()
  1130. # Make a shallow copy of the options list that can be
  1131. # extended by plugins. Send back the group object
  1132. # to allow group help text to be generated.
  1133. opt_list = [(g, o) for g, o in _opts]
  1134. opt_list.extend(ext_plugins.get_plugin_options_list())
  1135. return opt_list
  1136. # This should never be called outside of this module
  1137. class TempestConfigPrivate(object):
  1138. """Provides OpenStack configuration information."""
  1139. DEFAULT_CONFIG_DIR = os.path.join(os.getcwd(), "etc")
  1140. DEFAULT_CONFIG_FILE = "tempest.conf"
  1141. def __getattr__(self, attr):
  1142. # Handles config options from the default group
  1143. return getattr(_CONF, attr)
  1144. def _set_attrs(self):
  1145. # This methods ensures that config options in Tempest as well as
  1146. # in Tempest plugins can be accessed via:
  1147. # CONF.<normalised_group_name>.<key_name>
  1148. # where:
  1149. # normalised_group_name = group_name.replace('-', '_')
  1150. # Attributes are set at __init__ time *only* for known option groups
  1151. self.auth = _CONF.auth
  1152. self.compute = _CONF.compute
  1153. self.compute_feature_enabled = _CONF['compute-feature-enabled']
  1154. self.identity = _CONF.identity
  1155. self.service_clients = _CONF['service-clients']
  1156. self.identity_feature_enabled = _CONF['identity-feature-enabled']
  1157. self.image = _CONF.image
  1158. self.image_feature_enabled = _CONF['image-feature-enabled']
  1159. self.network = _CONF.network
  1160. self.network_feature_enabled = _CONF['network-feature-enabled']
  1161. self.validation = _CONF.validation
  1162. self.volume = _CONF.volume
  1163. self.volume_feature_enabled = _CONF['volume-feature-enabled']
  1164. self.object_storage = _CONF['object-storage']
  1165. self.object_storage_feature_enabled = _CONF[
  1166. 'object-storage-feature-enabled']
  1167. self.scenario = _CONF.scenario
  1168. self.service_available = _CONF.service_available
  1169. self.debug = _CONF.debug
  1170. logging.tempest_set_log_file('tempest.log')
  1171. # Setting attributes for plugins
  1172. # NOTE(andreaf) Plugins have no access to the TempestConfigPrivate
  1173. # instance at discovery time, so they have no way of setting these
  1174. # aliases themselves.
  1175. ext_plugins = plugins.TempestTestPluginManager()
  1176. for group, _ in ext_plugins.get_plugin_options_list():
  1177. if isinstance(group, cfg.OptGroup):
  1178. # If we have an OptGroup
  1179. group_name = group.name
  1180. group_dest = group.dest
  1181. else:
  1182. # If we have a group name as a string
  1183. group_name = group
  1184. group_dest = group.replace('-', '_')
  1185. # NOTE(andreaf) We can set the attribute safely here since in
  1186. # case of name conflict we would not have reached this point.
  1187. setattr(self, group_dest, _CONF[group_name])
  1188. def __init__(self, parse_conf=True, config_path=None):
  1189. """Initialize a configuration from a conf directory and conf file."""
  1190. super(TempestConfigPrivate, self).__init__()
  1191. config_files = []
  1192. failsafe_path = "/etc/tempest/" + self.DEFAULT_CONFIG_FILE
  1193. if config_path:
  1194. path = config_path
  1195. else:
  1196. # Environment variables override defaults...
  1197. conf_dir = os.environ.get('TEMPEST_CONFIG_DIR',
  1198. self.DEFAULT_CONFIG_DIR)
  1199. conf_file = os.environ.get('TEMPEST_CONFIG',
  1200. self.DEFAULT_CONFIG_FILE)
  1201. path = os.path.join(conf_dir, conf_file)
  1202. if not os.path.isfile(path):
  1203. path = failsafe_path
  1204. # only parse the config file if we expect one to exist. This is needed
  1205. # to remove an issue with the config file up to date checker.
  1206. if parse_conf:
  1207. config_files.append(path)
  1208. logging.register_options(_CONF)
  1209. if os.path.isfile(path):
  1210. _CONF([], project='tempest', default_config_files=config_files)
  1211. else:
  1212. _CONF([], project='tempest')
  1213. logging_cfg_path = "%s/logging.conf" % os.path.dirname(path)
  1214. if ((not hasattr(_CONF, 'log_config_append') or
  1215. _CONF.log_config_append is None) and
  1216. os.path.isfile(logging_cfg_path)):
  1217. # if logging conf is in place we need to set log_config_append
  1218. _CONF.log_config_append = logging_cfg_path
  1219. logging.setup(_CONF, 'tempest')
  1220. LOG = logging.getLogger('tempest')
  1221. LOG.info("Using tempest config file %s", path)
  1222. register_opts()
  1223. self._set_attrs()
  1224. if parse_conf:
  1225. _CONF.log_opt_values(LOG, logging.DEBUG)
  1226. class TempestConfigProxy(object):
  1227. _config = None
  1228. _path = None
  1229. _extra_log_defaults = [
  1230. ('paramiko.transport', logging.INFO),
  1231. ('requests.packages.urllib3.connectionpool', logging.WARN),
  1232. ]
  1233. def _fix_log_levels(self):
  1234. """Tweak the oslo log defaults."""
  1235. for name, level in self._extra_log_defaults:
  1236. logging.getLogger(name).logger.setLevel(level)
  1237. def __getattr__(self, attr):
  1238. if not self._config:
  1239. self._fix_log_levels()
  1240. lock_dir = os.path.join(tempfile.gettempdir(), 'tempest-lock')
  1241. lockutils.set_defaults(lock_dir)
  1242. self._config = TempestConfigPrivate(config_path=self._path)
  1243. # Pushing tempest internal service client configuration to the
  1244. # service clients register. Doing this in the config module ensures
  1245. # that the configuration is available by the time we register the
  1246. # service clients.
  1247. # NOTE(andreaf) This has to be done at the time the first
  1248. # attribute is accessed, to ensure all plugins have been already
  1249. # loaded, options registered, and _config is set.
  1250. _register_tempest_service_clients()
  1251. # Registering service clients and pushing their configuration to
  1252. # the service clients register. Doing this in the config module
  1253. # ensures that the configuration is available by the time we
  1254. # discover tests from plugins.
  1255. plugins.TempestTestPluginManager()._register_service_clients()
  1256. return getattr(self._config, attr)
  1257. def set_config_path(self, path):
  1258. self._path = path
  1259. # FIXME(masayukig): bug#1783751 To pass the config file path to child
  1260. # processes, we need to set the environment variables here as a
  1261. # workaround.
  1262. os.environ['TEMPEST_CONFIG_DIR'] = os.path.dirname(path)
  1263. os.environ['TEMPEST_CONFIG'] = os.path.basename(path)
  1264. CONF = TempestConfigProxy()
  1265. def service_client_config(service_client_name=None):
  1266. """Return a dict with the parameters to init service clients
  1267. Extracts from CONF the settings specific to the service_client_name and
  1268. api_version, and formats them as dict ready to be passed to the service
  1269. clients __init__:
  1270. * `region` (default to identity)
  1271. * `catalog_type`
  1272. * `endpoint_type`
  1273. * `build_timeout` (object-storage and identity default to compute)
  1274. * `build_interval` (object-storage and identity default to compute)
  1275. The following common settings are always returned, even if
  1276. `service_client_name` is None:
  1277. * `disable_ssl_certificate_validation`
  1278. * `ca_certs`
  1279. * `trace_requests`
  1280. * `http_timeout`
  1281. * `proxy_url`
  1282. The dict returned by this does not fit a few service clients:
  1283. * The endpoint type is not returned for identity client, since it takes
  1284. three different values for v2 admin, v2 public and v3
  1285. * The `ServersClient` from compute accepts an optional
  1286. `enable_instance_password` parameter, which is not returned.
  1287. * The `VolumesClient` for both v1 and v2 volume accept an optional
  1288. `default_volume_size` parameter, which is not returned.
  1289. * The `TokenClient` and `V3TokenClient` have a very different
  1290. interface, only auth_url is needed for them.
  1291. :param service_client_name: str Name of the service. Supported values are
  1292. 'compute', 'identity', 'image', 'network', 'object-storage', 'volume'
  1293. :return: dictionary of __init__ parameters for the service clients
  1294. :rtype: dict
  1295. """
  1296. _parameters = {
  1297. 'disable_ssl_certificate_validation':
  1298. CONF.identity.disable_ssl_certificate_validation,
  1299. 'ca_certs': CONF.identity.ca_certificates_file,
  1300. 'trace_requests': CONF.debug.trace_requests,
  1301. 'http_timeout': CONF.service_clients.http_timeout,
  1302. 'proxy_url': CONF.service_clients.proxy_url,
  1303. }
  1304. if service_client_name is None:
  1305. return _parameters
  1306. # Get the group of options first, by normalising the service_group_name
  1307. # Services with a '-' in the name have an '_' in the option group name
  1308. config_group = service_client_name.replace('-', '_')
  1309. # NOTE(andreaf) Check if the config group exists. This allows for this
  1310. # helper to be used for settings from registered plugins as well
  1311. try:
  1312. options = getattr(CONF, config_group)
  1313. except cfg.NoSuchOptError:
  1314. # Option group not defined
  1315. raise exceptions.UnknownServiceClient(services=service_client_name)
  1316. # Set endpoint_type
  1317. # Identity uses different settings depending on API version, so do not
  1318. # return the endpoint at all.
  1319. if service_client_name != 'identity':
  1320. _parameters['endpoint_type'] = getattr(options, 'endpoint_type')
  1321. # Set build_*
  1322. # Object storage and identity groups do not have conf settings for
  1323. # build_* parameters, and we default to compute in any case
  1324. for setting in ['build_timeout', 'build_interval']:
  1325. if not hasattr(options, setting) or not getattr(options, setting):
  1326. _parameters[setting] = getattr(CONF.compute, setting)
  1327. else:
  1328. _parameters[setting] = getattr(options, setting)
  1329. # Set region
  1330. # If a service client does not define region or region is not set
  1331. # default to the identity region
  1332. if not hasattr(options, 'region') or not getattr(options, 'region'):
  1333. _parameters['region'] = CONF.identity.region
  1334. else:
  1335. _parameters['region'] = getattr(options, 'region')
  1336. # Set service
  1337. _parameters['service'] = getattr(options, 'catalog_type')
  1338. return _parameters
  1339. def _register_tempest_service_clients():
  1340. # Register tempest own service clients using the same mechanism used
  1341. # for external plugins.
  1342. # The configuration data is pushed to the registry so that automatic
  1343. # configuration of tempest own service clients is possible both for
  1344. # tempest as well as for the plugins.
  1345. service_clients = clients.tempest_modules()
  1346. registry = clients.ClientsRegistry()
  1347. all_clients = []
  1348. for service_client in service_clients:
  1349. module = service_clients[service_client]
  1350. configs = service_client.split('.')[0]
  1351. service_client_data = dict(
  1352. name=service_client.replace('.', '_').replace('-', '_'),
  1353. service_version=service_client,
  1354. module_path=module.__name__,
  1355. client_names=module.__all__,
  1356. **service_client_config(configs)
  1357. )
  1358. all_clients.append(service_client_data)
  1359. # NOTE(andreaf) Internal service clients do not actually belong
  1360. # to a plugin, so using '__tempest__' to indicate a virtual plugin
  1361. # which holds internal service clients.
  1362. registry.register_service_client('__tempest__', all_clients)