<NME> config.py
<BEF> # Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

import os
import tempfile

from oslo_concurrency import lockutils
from oslo_config import cfg
from oslo_config import types
from oslo_log import log as logging

from tempest.lib import exceptions
from tempest.lib.services import clients
from tempest.test_discover import plugins


# TODO(marun) Replace use of oslo_config's global ConfigOpts
# (cfg.CONF) instance with a local instance (cfg.ConfigOpts()) once
# the cli tests move to the clients.  The cli tests rely on oslo
# incubator modules that use the global cfg.CONF.
_CONF = cfg.CONF


def register_opt_group(conf, opt_group, options):
    if opt_group:
        conf.register_group(opt_group)
    for opt in options:
        conf.register_opt(opt, group=getattr(opt_group, 'name', None))


auth_group = cfg.OptGroup(name='auth',
                          title="Options for authentication and credentials")


AuthGroup = [
    cfg.StrOpt('test_accounts_file',
               help="Path to the yaml file that contains the list of "
                    "credentials to use for running tests. If used when "
                    "running in parallel you have to make sure sufficient "
                    "credentials are provided in the accounts file. For "
                    "example if no tests with roles are being run it requires "
                    "at least `2 * CONC` distinct accounts configured in "
                    " the `test_accounts_file`, with CONC == the "
                    "number of concurrent test processes."),
    cfg.BoolOpt('use_dynamic_credentials',
                default=True,
                help="Allows test cases to create/destroy projects and "
                     "users. This option requires that OpenStack Identity "
                     "API admin credentials are known. If false, isolated "
                     "test cases and parallel execution, can still be "
                     "achieved configuring a list of test accounts"),
    cfg.ListOpt('tempest_roles',
                help="Roles to assign to all users created by tempest",
                default=[]),
    cfg.StrOpt('default_credentials_domain_name',
               default='Default',
               help="Default domain used when getting v3 credentials. "
                    "This is the name keystone uses for v2 compatibility."),
    cfg.BoolOpt('create_isolated_networks',
                default=True,
                help="If use_dynamic_credentials is set to True and Neutron "
                     "is enabled Tempest will try to create a usable network, "
                     "subnet, and router when needed for each project it "
                     "creates. However in some neutron configurations, like "
                     "with VLAN provider networks, this doesn't work. So if "
                     "set to False the isolated networks will not be created"),
    cfg.StrOpt('admin_username',
               help="Username for an administrative user. This is needed for "
                    "authenticating requests made by project isolation to "
                    "create users and projects"),
    cfg.StrOpt('admin_project_name',
               help="Project name to use for an administrative user. This is "
                    "needed for authenticating requests made by project "
                    "isolation to create users and projects"),
    cfg.StrOpt('admin_password',
               help="Password to use for an administrative user. This is "
                    "needed for authenticating requests made by project "
                    "isolation to create users and projects",
               secret=True),
    cfg.StrOpt('admin_domain_name',
               default='Default',
               help="Admin domain name for authentication (Keystone V3). "
                    "The same domain applies to user and project if "
                    "admin_user_domain_name and admin_project_domain_name "
                    "are not specified"),
    cfg.StrOpt('admin_user_domain_name',
               help="Domain name that contains the admin user (Keystone V3). "
                    "May be different from admin_project_domain_name and "
                    "admin_domain_name"),
    cfg.StrOpt('admin_project_domain_name',
               help="Domain name that contains the project given by "
                    "admin_project_name (Keystone V3). May be different from "
                    "admin_user_domain_name and admin_domain_name"),
    cfg.StrOpt('admin_system',
               default=None,
               help="The system scope on which an admin user has an admin "
                    "role assignment, if any. Valid values are 'all' or None. "
                    "This must be set to 'all' if using the "
                    "[oslo_policy]/enforce_scope=true option for the "
                    "identity service."),
]

identity_group = cfg.OptGroup(name='identity',
                              title="Keystone Configuration Options")

IdentityGroup = [
    cfg.StrOpt('catalog_type',
               default='identity',
               help="Catalog type of the Identity service."),
    cfg.BoolOpt('disable_ssl_certificate_validation',
                default=False,
                help="Set to True if using self-signed SSL certificates."),
    cfg.StrOpt('ca_certificates_file',
               default=None,
               help='Specify a CA bundle file to use in verifying a '
                    'TLS (https) server certificate.'),
    cfg.StrOpt('uri',
               help="Full URI of the OpenStack Identity API (Keystone), v2"),
    cfg.StrOpt('uri_v3',
               help='Full URI of the OpenStack Identity API (Keystone), v3'),
    cfg.StrOpt('auth_version',
               default='v3',
               help="Identity API version to be used for authentication "
                    "for API tests."),
    cfg.StrOpt('region',
               default='RegionOne',
               help="The identity region name to use. Also used as the other "
                    "services' region name unless they are set explicitly. "
                    "If no such region is found in the service catalog, the "
                    "first found one is used."),
    cfg.StrOpt('v2_admin_endpoint_type',
               default='adminURL',
               choices=['public', 'admin', 'internal',
                        'publicURL', 'adminURL', 'internalURL'],
               help="The admin endpoint type to use for OpenStack Identity "
                    "(Keystone) API v2"),
    cfg.StrOpt('v2_public_endpoint_type',
               default='publicURL',
               choices=['public', 'admin', 'internal',
                        'publicURL', 'adminURL', 'internalURL'],
               help="The public endpoint type to use for OpenStack Identity "
                    "(Keystone) API v2"),
    cfg.StrOpt('v3_endpoint_type',
               default='adminURL',
               choices=['public', 'admin', 'internal',
                        'publicURL', 'adminURL', 'internalURL'],
               help="The endpoint type to use for OpenStack Identity "
                    "(Keystone) API v3. The default value adminURL is "
                    "deprecated and will be modified to publicURL in "
                    "the next release."),
    cfg.StrOpt('admin_role',
               default='admin',
               help="Role required to administrate keystone."),
    cfg.StrOpt('default_domain_id',
               default='default',
               help="ID of the default domain"),
    cfg.BoolOpt('admin_domain_scope',
                default=False,
                help="Whether keystone identity v3 policy required "
                     "a domain scoped token to use admin APIs"),
    # Security Compliance (PCI-DSS)
    cfg.IntOpt('user_lockout_failure_attempts',
               default=2,
               help="The number of unsuccessful login attempts the user is "
                    "allowed before having the account locked. This only "
                    "takes effect when identity-feature-enabled."
                    "security_compliance is set to 'True'. For more details, "
                    "refer to keystone config options keystone.conf:"
                    "security_compliance.lockout_failure_attempts. "
                    "This feature is disabled by default in keystone."),
    cfg.IntOpt('user_lockout_duration',
               default=5,
               help="The number of seconds a user account will remain "
                    "locked. This only takes "
                    "effect when identity-feature-enabled.security_compliance "
                    "is set to 'True'. For more details, refer to "
                    "keystone config options "
                    "keystone.conf:security_compliance.lockout_duration. "
                    "Setting this option will have no effect unless you also "
                    "set identity.user_lockout_failure_attempts."),
    cfg.IntOpt('user_unique_last_password_count',
               default=2,
               help="The number of passwords for a user that must be unique "
                    "before an old password can be reused. This only takes "
                    "effect when identity-feature-enabled.security_compliance "
                    "is set to 'True'. "
                    "This config option corresponds to keystone.conf: "
                    "security_compliance.unique_last_password_count, whose "
                    "default value is 0 meaning disabling this feature. "
                    "NOTE: This config option value must be same as "
                    "keystone.conf: security_compliance.unique_last_password_"
                    "count otherwise test might fail"
               ),
]

service_clients_group = cfg.OptGroup(name='service-clients',
                                     title="Service Clients Options")

ServiceClientsGroup = [
    cfg.IntOpt('http_timeout',
               default=60,
               help='Timeout in seconds to wait for the http request to '
                    'return'),
    cfg.StrOpt('proxy_url',
               help='Specify an http proxy to use.')
]

identity_feature_group = cfg.OptGroup(name='identity-feature-enabled',
                                      title='Enabled Identity Features')

IdentityFeatureGroup = [
    cfg.BoolOpt('trust',
                default=True,
                help='Does the identity service have delegation and '
                     'impersonation enabled'),
    cfg.BoolOpt('api_v2',
                default=False,
                help='Is the v2 identity API enabled',
                deprecated_for_removal=True,
                deprecated_reason='The identity v2.0 API was removed in the '
                                  'Queens release. Tests that exercise the '
                                  'v2.0 API will be removed from tempest in '
                                  'the v22.0.0 release. They are kept only to '
                                  'test stable branches.'),
    cfg.BoolOpt('api_v2_admin',
                default=True,
                help="Is the v2 identity admin API available? This setting "
                     "only applies if api_v2 is set to True."),
    cfg.BoolOpt('api_v3',
                default=True,
                help='Is the v3 identity API enabled'),
    cfg.ListOpt('api_extensions',
                default=['all'],
                help="A list of enabled identity extensions with a special "
                     "entry all which indicates every extension is enabled. "
                     "Empty list indicates all extensions are disabled. "
                     "To get the list of extensions run: "
                     "'openstack extension list --identity'"),
    cfg.BoolOpt('domain_specific_drivers',
                default=False,
                help='Are domain specific drivers enabled? '
                     'This configuration value should be same as '
                     '[identity]->domain_specific_drivers_enabled '
                     'in keystone.conf.'),
    cfg.BoolOpt('security_compliance',
                default=False,
                help='Does the environment have the security compliance '
                     'settings enabled?'),
    cfg.BoolOpt('project_tags',
                default=True,
                help='Is the project tags identity v3 API available?',
                deprecated_for_removal=True,
                deprecated_reason='Project tags API is a default feature '
                                  'since Queens'),
    cfg.BoolOpt('application_credentials',
                default=True,
                help='Does the environment have application credentials '
                     'enabled?',
                deprecated_for_removal=True,
                deprecated_reason='Application credentials is a default '
                                  'feature since Queens'),
    # Access rules for application credentials is a default feature in Train.
    # This config option can removed once Stein is EOL.
    cfg.BoolOpt('access_rules',
                default=False,
                help='Does the environment have access rules enabled?'),
    cfg.BoolOpt('immutable_user_source',
                default=False,
                help='Set to True if the environment has a read-only '
                     'user source. This will skip all tests that attempt to '
                     'create, delete, or modify users. This should not be set '
                     'to True if using dynamic credentials')
]

compute_group = cfg.OptGroup(name='compute',
                             title='Compute Service Options')

ComputeGroup = [
    cfg.StrOpt('image_ref',
               help="Valid primary image reference to be used in tests. "
                    "This is a required option"),
    cfg.StrOpt('image_ref_alt',
               help="Valid secondary image reference to be used in tests. "
                    "This is a required option, but if only one image is "
                    "available duplicate the value of image_ref above"),
    cfg.StrOpt('certified_image_ref',
               help="Valid image reference to be used in image certificate "
                    "validation tests when enabled. This image must also "
                    "have the required img_signature_* properties set. "
                    "Additional details available within the following Nova "
                    "documentation: https://docs.openstack.org/nova/latest/"
                    "user/certificate-validation.html"),
    cfg.ListOpt('certified_image_trusted_certs',
                help="A list of trusted certificates to be used when the "
                     "image certificate validation compute feature is "
                     "enabled."),
    cfg.StrOpt('flavor_ref',
               default="1",
               help="Valid primary flavor to use in tests."),
    cfg.StrOpt('flavor_ref_alt',
               default="2",
               help='Valid secondary flavor to be used in tests.'),
    cfg.IntOpt('build_interval',
               default=1,
               help="Time in seconds between build status checks."),
    cfg.IntOpt('build_timeout',
               default=300,
               help="Timeout in seconds to wait for an instance to build. "
                    "Other services that do not define build_timeout will "
                    "inherit this value."),
    cfg.IntOpt('ready_wait',
               default=0,
               help="Additional wait time for clean state, when there is "
                    "no OS-EXT-STS extension available"),
    cfg.StrOpt('fixed_network_name',
               help="Name of the fixed network that is visible to all test "
                    "projects. If multiple networks are available for a "
                    "project, this is the network which will be used for "
                    "creating servers if tempest does not create a network or "
                    "a network is not specified elsewhere. It may be used for "
                    "ssh validation only if floating IPs are disabled."),
    cfg.StrOpt('catalog_type',
               default='compute',
               help="Catalog type of the Compute service."),
    cfg.StrOpt('region',
               default='',
               help="The compute region name to use. If empty, the value "
                    "of identity.region is used instead. If no such region "
                    "is found in the service catalog, the first found one is "
                    "used."),
    cfg.StrOpt('endpoint_type',
               default='publicURL',
               choices=['public', 'admin', 'internal',
                        'publicURL', 'adminURL', 'internalURL'],
               help="The endpoint type to use for the compute service."),
    cfg.StrOpt('volume_device_name',
               default='vdb',
               help="Expected device name when a volume is attached to "
                    "an instance. Not all hypervisors guarantee that they "
                    "will respect the user defined device name, tests may "
                    "fail if inappropriate device name is set."),
    cfg.IntOpt('shelved_offload_time',
               default=0,
               help='Time in seconds before a shelved instance is eligible '
                    'for removing from a host.  -1 never offload, 0 offload '
                    'when shelved. This configuration value should be same as '
                    'nova.conf: DEFAULT.shelved_offload_time, and '
                    'some tests will run for as long as the time.'),
    cfg.IntOpt('min_compute_nodes',
               default=1,
               help=('The minimum number of compute nodes expected. This will '
                     'be utilized by some multinode specific tests to ensure '
                     'that requests match the expected size of the cluster '
                     'you are testing with.')),
    cfg.StrOpt('hypervisor_type',
               default=None,
               help="Hypervisor type of the test target on heterogeneous "
                    "compute environment. The value can be 'QEMU', 'xen' or "
                    "something."),
    cfg.StrOpt('min_microversion',
               default=None,
               help="Lower version of the test target microversion range. "
                    "The format is 'X.Y', where 'X' and 'Y' are int values. "
                    "Tempest selects tests based on the range between "
                    "min_microversion and max_microversion. "
                    "If both values are not specified, Tempest avoids tests "
                    "which require a microversion. Valid values are string "
                    "with format 'X.Y' or string 'latest'"),
    cfg.StrOpt('max_microversion',
               default=None,
               help="Upper version of the test target microversion range. "
                    "The format is 'X.Y', where 'X' and 'Y' are int values. "
                    "Tempest selects tests based on the range between "
                    "min_microversion and max_microversion. "
                    "If both values are not specified, Tempest avoids tests "
                    "which require a microversion. Valid values are string "
                    "with format 'X.Y' or string 'latest'"),
    cfg.StrOpt('compute_volume_common_az',
               default=None,
               help='AZ to be used for Cinder and Nova. Set this parameter '
                    'when the cloud has nova.conf: cinder.cross_az_attach '
                    'set to false. Which means volumes attached to an '
                    'instance must be in the same availability zone in Cinder '
                    'as the instance availability zone in Nova. Set the '
                    'common availability zone in this config which will be '
                    'used to boot an instance as well as creating a volume. '
                    'NOTE: If that AZ is not in Cinder (or '
                    'allow_availability_zone_fallback=False in cinder.conf), '
                    'the volume create request will fail and the instance '
                    'will fail the build request.'),
]

placement_group = cfg.OptGroup(name='placement',
                               title='Placement Service Options')

PlacementGroup = [
    cfg.StrOpt('endpoint_type',
               default='public',
               choices=['public', 'admin', 'internal'],
               help="The endpoint type to use for the placement service."),
    cfg.StrOpt('catalog_type',
               default='placement',
               help="Catalog type of the Placement service."),
    cfg.StrOpt('region',
               default='',
               help="The placement region name to use. If empty, the value "
                    "of [identity]/region is used instead. If no such region "
                    "is found in the service catalog, the first region found "
                    "is used."),
    cfg.StrOpt('min_microversion',
               default=None,
               help="Lower version of the test target microversion range. "
                    "The format is 'X.Y', where 'X' and 'Y' are int values. "
                    "Valid values are string with format 'X.Y' or string "
                    "'latest'"),
    cfg.StrOpt('max_microversion',
               default=None,
               help="Upper version of the test target microversion range. "
                    "The format is 'X.Y', where 'X' and 'Y' are int values. "
                    "Valid values are string with format 'X.Y' or string "
                    "'latest'"),
]


compute_features_group = cfg.OptGroup(name='compute-feature-enabled',
                                      title="Enabled Compute Service Features")

ComputeFeaturesGroup = [
    cfg.BoolOpt('disk_config',
                default=True,
                help="If false, skip disk config tests"),
    # TODO(pkesav): Make it True by default once wallaby
    # is oldest supported stable for Tempest.
    cfg.BoolOpt('hostname_fqdn_sanitization',
                default=False,
                help="If false, skip fqdn instance sanitization tests. "
                     "Nova started sanitizing the instance name by replacing "
                     "the '.' with '-' to comply with fqdn hostname. Nova "
                     "changed that in Wallaby cycle, if your cloud is older "
                     "than wallaby then you can keep/make it False."),
    cfg.BoolOpt('change_password',
                default=False,
                help="Does the test environment support changing the admin "
                     "password?"),
    cfg.BoolOpt('console_output',
                default=True,
                help="Does the test environment support obtaining instance "
                     "serial console output?"),
    for opt in BotoConfig:
        conf.register_opt(opt, group='boto')

general_group = cfg.OptGroup(name='general', title='General Tempest Options')

GeneralOpts = [
    cfg.BoolOpt('use_xml',
                default=False,
                help="Use xml for the container format"),
]


def register_general_opts(conf):
    conf.register_group(general_group)
    for opt in GeneralOpts:
        conf.register_opt(opt, group='general')


# TODO(jaypipes): Move this to a common utils (not data_utils...)
def singleton(cls):
    cfg.BoolOpt('pause',
                default=True,
                help="Does the test environment support pausing?"),
    cfg.BoolOpt('shelve',
                default=True,
                help="Does the test environment support shelving/unshelving?"),
    cfg.BoolOpt('shelve_migrate',
                default=False,
                help="Does the test environment support "
                     "cold migration of unshelved server?"),
    cfg.BoolOpt('suspend',
                default=True,
                help="Does the test environment support suspend/resume?"),
    cfg.BoolOpt('cold_migration',
                default=True,
                help="Does the test environment support cold migration?"),
    cfg.BoolOpt('live_migration',
                default=True,
                help="Does the test environment support live migration?"),
    cfg.BoolOpt('live_migrate_back_and_forth',
                default=False,
                help="Does the test environment support live migrating "
                     "VM back and forth between different versions of "
                     "nova-compute?"),
    cfg.BoolOpt('metadata_service',
                default=True,
                help="Does the test environment support metadata service? "
                     "Ignored unless validation.run_validation=true."),
    cfg.BoolOpt('block_migration_for_live_migration',
                default=False,
                help="Does the test environment use block devices for live "
                     "migration"),
    cfg.BoolOpt('block_migrate_cinder_iscsi',
                default=False,
                help="Does the test environment support block migration with "
                "Cinder iSCSI volumes. Note: libvirt >= 1.2.17 is required "
                "to support this if using the libvirt compute driver.",
                deprecated_for_removal=True,
                deprecated_reason='This option duplicates the more generic '
                                  '[compute-feature-enabled]/block_migration '
                                  '_for_live_migration now that '
                                  'MIN_LIBVIRT_VERSION is >= 1.2.17 on all '
                                  'branches from stable/rocky and will be '
                                  'removed in a future release.'),
    cfg.BoolOpt('can_migrate_between_any_hosts',
                default=True,
                help="Does the test environment support migrating between "
                     "any hosts? In environments with non-homogeneous compute "
                     "nodes you can set this to False so that it will select "
                     "destination host for migrating automatically"),
    cfg.BoolOpt('vnc_console',
        register_volume_opts(cfg.CONF)
        register_object_storage_opts(cfg.CONF)
        register_boto_opts(cfg.CONF)
        register_general_opts(cfg.CONF)
        self.compute = cfg.CONF.compute
        self.compute_admin = cfg.CONF['compute-admin']
        self.identity = cfg.CONF.identity
                    'in response header.',
               deprecated_for_removal=True,
               deprecated_reason='This option will be ignored because the '
                                 'usage of different response header fields '
        self.volume = cfg.CONF.volume
        self.object_storage = cfg.CONF['object-storage']
        self.boto = cfg.CONF.boto
        self.general = cfg.CONF.general
                default=False,
                help='Enable Spice console. This configuration value should '
                     'be same as nova.conf: spice.enabled',
                deprecated_for_removal=True,
                deprecated_reason="This config option is not being used "
                                  "in Tempest, we can add it back when "
                                  "adding the test cases."),
    cfg.BoolOpt('rdp_console',
                default=False,
                help='Enable RDP console. This configuration value should '
                     'be same as nova.conf: rdp.enabled',
                deprecated_for_removal=True,
                deprecated_reason="This config option is not being used "
                                  "in Tempest, we can add it back when "
                                  "adding the test cases."),
    cfg.BoolOpt('serial_console',
                default=False,
                help='Enable serial console. This configuration value '
                     'should be the same as '
                     'nova.conf: serial_console.enabled'),
    cfg.BoolOpt('rescue',
                default=True,
                help='Does the test environment support instance rescue '
                     'mode?'),
    cfg.BoolOpt('stable_rescue',
                default=False,
                help='Does the test environment support stable device '
                     'instance rescue mode?'),
    cfg.BoolOpt('enable_instance_password',
                default=True,
                help='Enables returning of the instance password by the '
                     'relevant server API calls such as create, rebuild '
                     'or rescue. This configuration value should be same as '
                     'nova.conf: DEFAULT.enable_instance_password'),
    cfg.BoolOpt('interface_attach',
                default=True,
                help='Does the test environment support dynamic network '
                     'interface attachment?'),
    cfg.BoolOpt('snapshot',
                default=True,
                help='Does the test environment support creating snapshot '
                     'images of running instances?'),
    cfg.BoolOpt('nova_cert',
                default=False,
                help='Does the test environment have the nova cert running?',
                deprecated_for_removal=True,
                deprecated_reason="On Nova side, the nova-cert service is "
                                  "deprecated and the service will be removed "
                                  "as early as Ocata."),
    cfg.BoolOpt('personality',
                default=False,
                help='Does the test environment support server personality'),
    cfg.BoolOpt('attach_encrypted_volume',
                default=True,
                help='Does the test environment support attaching an '
                     'encrypted volume to a running server instance? This may '
                     'depend on the combination of compute_driver in nova and '
                     'the volume_driver(s) in cinder.'),
    cfg.BoolOpt('config_drive',
                default=True,
                help='Enable special configuration drive with metadata.'),
    cfg.ListOpt('scheduler_enabled_filters',
                default=["AvailabilityZoneFilter", "ComputeFilter",
                         "ComputeCapabilitiesFilter", "ImagePropertiesFilter",
                         "ServerGroupAntiAffinityFilter",
                         "ServerGroupAffinityFilter"],
                help="A list of enabled filters that Nova will accept as "
                     "hints to the scheduler when creating a server. If the "
                     "default value is overridden in nova.conf by the test "
                     "environment (which means that a different set of "
                     "filters is enabled than what is included in Nova by "
                     "default), then this option must be configured to "
                     "contain the same filters that Nova uses in the test "
                     "environment. A special entry 'all' indicates all "
                     "filters that are included with Nova are enabled. If "
                     "using 'all', be sure to enable all filters in "
                     "nova.conf, as tests can fail in unpredictable ways if "
                     "Nova's and Tempest's enabled filters don't match. "
                     "Empty list indicates all filters are disabled. The "
                     "full list of enabled filters is in nova.conf: "
                     "filter_scheduler.enabled_filters.",
                deprecated_opts=[cfg.DeprecatedOpt(
                    'scheduler_available_filters',
                    group='compute-feature-enabled')]),
    cfg.BoolOpt('swap_volume',
                default=False,
                help='Does the test environment support in-place swapping of '
                     'volumes attached to a server instance?'),
    cfg.BoolOpt('volume_backed_live_migration',
                default=False,
                help='Does the test environment support volume-backed live '
                     'migration?'),
    cfg.BoolOpt('volume_multiattach',
                default=False,
                help='Does the test environment support attaching a volume to '
                     'more than one instance? This depends on hypervisor and '
                     'volume backend/type and compute API version 2.60.'),
    cfg.BoolOpt('xenapi_apis',
                default=False,
                help='Does the test environment support the XenAPI-specific '
                     'APIs: os-agents, writeable server metadata and the '
                     'resetNetwork server action? '
                     'These were removed in Victoria alongside the XenAPI '
                     'virt driver.',
                deprecated_for_removal=True,
                deprecated_reason="On Nova side, XenAPI virt driver and the "
                                  "APIs that only worked with that driver "
                                  "have been removed and there's nothing to "
                                  "test after Ussuri."),
    cfg.BoolOpt('ide_bus',
                default=True,
                help='Does the test environment support attaching devices '
                     'using an IDE bus to the instance?'),
    cfg.BoolOpt('unified_limits',
                default=False,
                help='Does the test environment support unified limits?'),
]


image_group = cfg.OptGroup(name='image',
                           title="Image Service Options")

ImageGroup = [
    cfg.StrOpt('catalog_type',
               default='image',
               help='Catalog type of the Image service.'),
    cfg.StrOpt('region',
               default='',
               help="The image region name to use. If empty, the value "
                    "of identity.region is used instead. If no such region "
                    "is found in the service catalog, the first found one is "
                    "used."),
    cfg.StrOpt('endpoint_type',
               default='publicURL',
               choices=['public', 'admin', 'internal',
                        'publicURL', 'adminURL', 'internalURL'],
               help="The endpoint type to use for the image service."),
    cfg.StrOpt('alternate_image_endpoint',
               default=None,
               help="Alternate endpoint name for cross-worker testing"),
    cfg.StrOpt('alternate_image_endpoint_type',
               default='publicURL',
               choices=['public', 'admin', 'internal',
                        'publicURL', 'adminURL', 'internalURL'],
               help=("The endpoint type to use for the alternate image "
                     "service.")),
    cfg.BoolOpt('image_caching_enabled',
                default=False,
                help=("Flag to enable if caching is enabled by image "
                      "service, operator should set this parameter to True"
                      "if 'image_cache_dir' is set in glance-api.conf")),
    cfg.StrOpt('http_image',
               default='http://download.cirros-cloud.net/0.3.1/'
               'cirros-0.3.1-x86_64-uec.tar.gz',
               help='http accessible image'),
    cfg.IntOpt('build_timeout',
               default=300,
               help="Timeout in seconds to wait for an image to "
                    "become available."),
    cfg.IntOpt('build_interval',
               default=1,
               help="Time in seconds between image operation status "
                    "checks."),
    cfg.ListOpt('container_formats',
                default=['ami', 'ari', 'aki', 'bare', 'ovf', 'ova'],
                help="A list of image's container formats "
                     "users can specify."),
    cfg.ListOpt('disk_formats',
                default=['ami', 'ari', 'aki', 'vhd', 'vmdk', 'raw', 'qcow2',
                         'vdi', 'iso', 'vhdx'],
                help="A list of image's disk formats "
                     "users can specify.")
]

image_feature_group = cfg.OptGroup(name='image-feature-enabled',
                                   title='Enabled image service features')

ImageFeaturesGroup = [
    cfg.BoolOpt('api_v2',
                default=True,
                help="Is the v2 image API enabled",
                deprecated_for_removal=True,
                deprecated_reason='Glance v1 APIs are deprecated and v2 APIs '
                                  'are current one. In future, Tempest will '
                                  'test v2 APIs only so this config option '
                                  'will be removed.'),
    cfg.BoolOpt('api_v1',
                default=False,
                help="Is the v1 image API enabled",
                deprecated_for_removal=True,
                deprecated_reason='Glance v1 APIs are deprecated and v2 APIs '
                                  'are current one. In future, Tempest will '
                                  'test v2 APIs only so this config option '
                                  'will be removed.'),
    # Image import feature is setup in devstack victoria onwards.
    # Once all stable branches setup the same via glance standalone
    # mode or with uwsgi, we can remove this config option.
    cfg.BoolOpt('import_image',
                default=False,
                help="Is image import feature enabled"),
    # NOTE(danms): Starting mid-Wallaby glance began enforcing the
    # previously-informal requirement that os_glance_* properties are
    # reserved for internal use. Thus, we can only run these checks
    # if we know we are on a new enough glance.
    cfg.BoolOpt('os_glance_reserved',
                default=False,
                help="Should we check that os_glance namespace is reserved"),
    cfg.BoolOpt('manage_locations',
                default=False,
                help=('Is show_multiple_locations enabled in glance. '
                      'Note that at least one http store must be enabled as '
                      'well, because we use that location scheme to test.')),
]

network_group = cfg.OptGroup(name='network',
                             title='Network Service Options')

ProfileType = types.Dict(types.List(types.String(), bounds=True))
NetworkGroup = [
    cfg.StrOpt('catalog_type',
               default='network',
               help='Catalog type of the Neutron service.'),
    cfg.StrOpt('region',
               default='',
               help="The network region name to use. If empty, the value "
                    "of identity.region is used instead. If no such region "
                    "is found in the service catalog, the first found one is "
                    "used."),
    cfg.StrOpt('endpoint_type',
               default='publicURL',
               choices=['public', 'admin', 'internal',
                        'publicURL', 'adminURL', 'internalURL'],
               help="The endpoint type to use for the network service."),
    cfg.StrOpt('project_network_cidr',
               default="10.100.0.0/16",
               help="The cidr block to allocate project ipv4 subnets from"),
    cfg.IntOpt('project_network_mask_bits',
               default=28,
               help="The mask bits for project ipv4 subnets"),
    cfg.StrOpt('project_network_v6_cidr',
               default="2001:db8::/48",
               help="The cidr block to allocate project ipv6 subnets from"),
    cfg.IntOpt('project_network_v6_mask_bits',
               default=64,
               help="The mask bits for project ipv6 subnets"),
    cfg.BoolOpt('project_networks_reachable',
                default=False,
                help="Whether project networks can be reached directly from "
                     "the test client. This must be set to True when the "
                     "'fixed' connect_method is selected."),
    cfg.StrOpt('public_network_id',
               default="",
               help="Id of the public network that provides external "
                    "connectivity"),
    cfg.StrOpt('floating_network_name',
               help="Default floating network name. Used to allocate floating "
                    "IPs when neutron is enabled."),
    cfg.StrOpt('subnet_id',
               default="",
               help="Subnet id of subnet which is used for allocation of "
                    "floating IPs. Specify when two or more subnets are "
                    "present in network."),
    cfg.StrOpt('public_router_id',
               default="",
               help="Id of the public router that provides external "
                    "connectivity. This should only be used when Neutron's "
                    "'allow_overlapping_ips' is set to 'False' in "
                    "neutron.conf. usually not needed past 'Grizzly' release"),
    cfg.IntOpt('build_timeout',
               default=300,
               help="Timeout in seconds to wait for network operation to "
                    "complete."),
    cfg.IntOpt('build_interval',
               default=1,
               help="Time in seconds between network operation status "
                    "checks."),
    cfg.ListOpt('dns_servers',
                default=["8.8.8.8", "8.8.4.4"],
                help="List of dns servers which should be used"
                     " for subnet creation",
                deprecated_for_removal=True,
                deprecated_reason="This config option is no longer "
                                  "used anywhere, so it can be removed."),
    cfg.StrOpt('port_vnic_type',
               choices=[None, 'normal', 'direct', 'macvtap', 'direct-physical',
                        'baremetal', 'virtio-forwarder'],
               help="vnic_type to use when launching instances"
                    " with pre-configured ports."
                    " Supported ports are:"
                    " ['normal', 'direct', 'macvtap', 'direct-physical', "
                    "'baremetal', 'virtio-forwarder']"),
    cfg.Opt('port_profile',
            type=ProfileType,
            default={},
            help="port profile to use when launching instances"
                 " with pre-configured ports."),
    cfg.ListOpt('default_network',
                default=["1.0.0.0/16", "2.0.0.0/16"],
                help="List of ip pools"
                     " for subnetpools creation"),
    cfg.BoolOpt('shared_physical_network',
                default=False,
                help="The environment does not support network separation "
                     "between tenants."),
]

network_feature_group = cfg.OptGroup(name='network-feature-enabled',
                                     title='Enabled network service features')

NetworkFeaturesGroup = [
    cfg.BoolOpt('ipv6',
                default=True,
                help="Allow the execution of IPv6 tests."),
    cfg.ListOpt('api_extensions',
                default=['all'],
                help="A list of enabled network extensions with a special "
                     "entry all which indicates every extension is enabled. "
                     "Empty list indicates all extensions are disabled. "
                     "To get the list of extensions run: "
                     "'openstack extension list --network'"),
    cfg.ListOpt('available_features',
                default=['all'],
                help="A list of available network features with a special "
                     "entry all that indicates every feature is available. "
                     "Empty list indicates all features are disabled. "
                     "This list can contain features that are not "
                     "discoverable through the API."),
    cfg.BoolOpt('ipv6_subnet_attributes',
                default=False,
                help="Allow the execution of IPv6 subnet tests that use "
                     "the extended IPv6 attributes ipv6_ra_mode "
                     "and ipv6_address_mode."
                ),
    cfg.BoolOpt('port_admin_state_change',
                default=True,
                help="Does the test environment support changing "
                     "port admin state?"),
    cfg.BoolOpt('port_security',
                default=False,
                help="Does the test environment support port security?"),
    cfg.BoolOpt('floating_ips',
                default=True,
                help='Does the test environment support floating_ips?'),
    cfg.StrOpt('qos_placement_physnet', default=None,
               help='Name of the physnet for placement based minimum '
                    'bandwidth allocation.'),
    cfg.StrOpt('provider_net_base_segmentation_id', default='3000',
               help='Base segmentation ID to create provider networks. '
                    'This value will be increased in case of conflict.'),
    cfg.BoolOpt('qos_min_bw_and_pps', default=False,
                help='Does the test environment have minimum bandwidth and '
                     'packet rate inventories configured?'),
]

dashboard_group = cfg.OptGroup(name="dashboard",
                               title="Dashboard options")

DashboardGroup = [
    cfg.StrOpt('dashboard_url',
               default='http://localhost/',
               help="Where the dashboard can be found"),
    cfg.BoolOpt('disable_ssl_certificate_validation',
                default=False,
                help="Set to True if using self-signed SSL certificates."),
]

validation_group = cfg.OptGroup(name='validation',
                                title='SSH Validation options')

ValidationGroup = [
    cfg.BoolOpt('run_validation',
                default=True,
                help='Enable ssh on created servers and creation of additional'
                     ' validation resources to enable remote access.'
                     ' In case the guest does not support ssh set it'
                     ' to false'),
    cfg.BoolOpt('security_group',
                default=True,
                help='Enable/disable security groups.'),
    cfg.BoolOpt('security_group_rules',
                default=True,
                help='Enable/disable security group rules.'),
    cfg.StrOpt('connect_method',
               default='floating',
               choices=['fixed', 'floating'],
               help='Default IP type used for validation: '
                    '-fixed: uses the first IP belonging to the fixed network '
                    '-floating: creates and uses a floating IP'),
    cfg.StrOpt('auth_method',
               default='keypair',
               choices=['keypair'],
               help='Default authentication method to the instance. '
                    'Only ssh via keypair is supported for now. '
                    'Additional methods will be handled in a separate spec.'),
    cfg.IntOpt('ip_version_for_ssh',
               default=4,
               help='Default IP version for ssh connections.'),
    cfg.IntOpt('ping_timeout',
               default=120,
               help='Timeout in seconds to wait for ping to succeed.'),
    cfg.IntOpt('connect_timeout',
               default=60,
               help='Timeout in seconds to wait for the TCP connection to be '
                    'successful.'),
    cfg.IntOpt('ssh_timeout',
               default=300,
               help='Timeout in seconds to wait for the ssh banner.'),
    cfg.StrOpt('image_ssh_user',
               default="root",
               help="User name used to authenticate to an instance."),
    cfg.StrOpt('image_alt_ssh_user',
               default="root",
               help="User name used to authenticate to an alt instance."),
    cfg.StrOpt('image_ssh_password',
               default="password",
               help="Password used to authenticate to an instance.",
               secret=True),
    cfg.StrOpt('image_alt_ssh_password',
               default="password",
               help="Password used to authenticate to an alt instance.",
               secret=True),
    cfg.StrOpt('ssh_shell_prologue',
               default="set -eu -o pipefail; PATH=$$PATH:/sbin:/usr/sbin;",
               help="Shell fragments to use before executing a command "
                    "when sshing to a guest."),
    cfg.IntOpt('ping_size',
               default=56,
               help="The packet size for ping packets originating "
                    "from remote linux hosts"),
    cfg.IntOpt('ping_count',
               default=1,
               help="The number of ping packets originating from remote "
                    "linux hosts"),
    cfg.StrOpt('floating_ip_range',
               default='10.0.0.0/29',
               help='Unallocated floating IP range, which will be used to '
                    'test the floating IP bulk feature for CRUD operation. '
                    'This block must not overlap an existing floating IP '
                    'pool.'),
    cfg.StrOpt('network_for_ssh',
               default='public',
               help="Network used for SSH connections. Ignored if "
                    "connect_method=floating."),
    cfg.StrOpt('ssh_key_type',
               default='ecdsa',
               help='Type of key to use for ssh connections. '
                    'Valid types are rsa, ecdsa'),
    cfg.IntOpt('allowed_network_downtime',
               default=5.0,
               help="Allowed VM network connection downtime during live "
                    "migration, in seconds. "
                    "When the measured downtime exceeds this value, an "
                    "exception is raised."),
]

volume_group = cfg.OptGroup(name='volume',
                            title='Block Storage Options')

VolumeGroup = [
    cfg.IntOpt('build_interval',
               default=1,
               help='Time in seconds between volume availability checks.'),
    cfg.IntOpt('build_timeout',
               default=300,
               help='Timeout in seconds to wait for a volume to become '
                    'available.'),
    cfg.StrOpt('catalog_type',
               default='volumev3',
               help="Catalog type of the Volume Service"),
    cfg.StrOpt('region',
               default='',
               help="The volume region name to use. If empty, the value "
                    "of identity.region is used instead. If no such region "
                    "is found in the service catalog, the first found one is "
                    "used."),
    cfg.StrOpt('endpoint_type',
               default='publicURL',
               choices=['public', 'admin', 'internal',
                        'publicURL', 'adminURL', 'internalURL'],
               help="The endpoint type to use for the volume service."),
    cfg.ListOpt('backend_names',
                default=['BACKEND_1', 'BACKEND_2'],
                help='A list of backend names separated by comma. '
                     'The backend name must be declared in cinder.conf'),
    cfg.StrOpt('volume_type',
               default='',
               help='Volume type to be used while creating volume.'),
    cfg.StrOpt('storage_protocol',
               default='iSCSI',
               help='Backend protocol to target when creating volume types'),
    cfg.StrOpt('vendor_name',
               default='Open Source',
               help='Backend vendor to target when creating volume types'),
    cfg.StrOpt('disk_format',
               default='raw',
               help='Disk format to use when copying a volume to image'),
    cfg.IntOpt('volume_size',
               default=1,
               help='Default size in GB for volumes created by volumes tests'),
    cfg.IntOpt('volume_size_extend',
               default=1,
               help="Size in GB a volume is extended by - if a test "
                    "extends a volume, the size of the new volume will be "
                    "volume_size + volume_size_extend."),
    cfg.ListOpt('manage_volume_ref',
                default=['source-name', 'volume-%s'],
                help="A reference to existing volume for volume manage. "
                     "It contains two elements, the first is ref type "
                     "(like 'source-name', 'source-id', etc), the second is "
                     "volume name template used in storage backend"),
    cfg.ListOpt('manage_snapshot_ref',
                default=['source-name', '_snapshot-%s'],
                help="A reference to existing snapshot for snapshot manage. "
                     "It contains two elements, the first is ref type "
                     "(like 'source-name', 'source-id', etc), the second is "
                     "snapshot name template used in storage backend"),
    cfg.StrOpt('min_microversion',
               default=None,
               help="Lower version of the test target microversion range. "
                    "The format is 'X.Y', where 'X' and 'Y' are int values. "
                    "Tempest selects tests based on the range between "
                    "min_microversion and max_microversion. "
                    "If both values are not specified, Tempest avoids tests "
                    "which require a microversion. Valid values are string "
                    "with format 'X.Y' or string 'latest'",),
    cfg.StrOpt('max_microversion',
               default=None,
               help="Upper version of the test target microversion range. "
                    "The format is 'X.Y', where 'X' and 'Y' are int values. "
                    "Tempest selects tests based on the range between "
                    "min_microversion and max_microversion. "
                    "If both values are not specified, Tempest avoids tests "
                    "which require a microversion. Valid values are string "
                    "with format 'X.Y' or string 'latest'",),
]

volume_feature_group = cfg.OptGroup(name='volume-feature-enabled',
                                    title='Enabled Cinder Features')

VolumeFeaturesGroup = [
    cfg.BoolOpt('multi_backend',
                default=False,
                help="Runs Cinder multi-backend test (requires 2 backends)"),
    cfg.BoolOpt('backup',
                default=True,
                help='Runs Cinder volumes backup test'),
    cfg.BoolOpt('snapshot',
                default=True,
                help='Runs Cinder volume snapshot test'),
    cfg.BoolOpt('clone',
                default=True,
                help='Runs Cinder volume clone test'),
    cfg.BoolOpt('manage_snapshot',
                default=False,
                help='Runs Cinder manage snapshot tests'),
    cfg.BoolOpt('manage_volume',
                default=False,
                help='Runs Cinder manage volume tests'),
    cfg.ListOpt('api_extensions',
                default=['all'],
                help='A list of enabled volume extensions with a special '
                     'entry all which indicates every extension is enabled. '
                     'Empty list indicates all extensions are disabled'),
    cfg.BoolOpt('extend_attached_volume',
                default=False,
                help='Does the cloud support extending the size of a volume '
                     'which is currently attached to a server instance? This '
                     'depends on the 3.42 volume API microversion and the '
                     '2.51 compute API microversion. Also, not all volume or '
                     'compute backends support this operation.'),
    cfg.BoolOpt('extend_attached_encrypted_volume',
                default=False,
                help='Does the cloud support extending the size of an '
                     'encrypted volume  which is currently attached to a '
                     'server instance? This depends on the 3.42 volume API '
                     'microversion and the 2.51 compute API microversion. '
                     'Also, not all volume or compute backends support this '
                     'operation.')
]


object_storage_group = cfg.OptGroup(name='object-storage',
                                    title='Object Storage Service Options')

ObjectStoreGroup = [
    cfg.StrOpt('catalog_type',
               default='object-store',
               help="Catalog type of the Object-Storage service."),
    cfg.StrOpt('region',
               default='',
               help="The object-storage region name to use. If empty, the "
                    "value of identity.region is used instead. If no such "
                    "region is found in the service catalog, the first found "
                    "one is used."),
    cfg.StrOpt('endpoint_type',
               default='publicURL',
               choices=['public', 'admin', 'internal',
                        'publicURL', 'adminURL', 'internalURL'],
               help="The endpoint type to use for the object-store service."),
    cfg.IntOpt('container_sync_timeout',
               default=600,
               help="Number of seconds to time on waiting for a container "
                    "to container synchronization complete."),
    cfg.IntOpt('container_sync_interval',
               default=5,
               help="Number of seconds to wait while looping to check the "
                    "status of a container to container synchronization"),
    cfg.StrOpt('operator_role',
               default='member',
               help="Role to add to users created for swift tests to "
                    "enable creating containers"),
    cfg.StrOpt('reseller_admin_role',
               default='ResellerAdmin',
               help="User role that has reseller admin"),
    cfg.StrOpt('realm_name',
               default='realm1',
               help="Name of sync realm. A sync realm is a set of clusters "
                    "that have agreed to allow container syncing with each "
                    "other. Set the same realm name as Swift's "
                    "container-sync-realms.conf"),
    cfg.StrOpt('cluster_name',
               default='name1',
               help="One name of cluster which is set in the realm whose name "
                    "is set in 'realm_name' item in this file. Set the "
                    "same cluster name as Swift's container-sync-realms.conf"),
    cfg.IntOpt('build_timeout',
               default=10,
               help="Timeout in seconds to wait for objects to create."),
]

object_storage_feature_group = cfg.OptGroup(
    name='object-storage-feature-enabled',
    title='Enabled object-storage features')

ObjectStoreFeaturesGroup = [
    cfg.ListOpt('discoverable_apis',
                default=['all'],
                help="A list of the enabled optional discoverable apis. "
                     "A single entry, all, indicates that all of these "
                     "features are expected to be enabled"),
    cfg.BoolOpt('container_sync',
                default=True,
                help="Execute (old style) container-sync tests"),
    cfg.BoolOpt('object_versioning',
                default=True,
                help="Execute object-versioning tests"),
    cfg.BoolOpt('discoverability',
                default=True,
                help="Execute discoverability tests"),
    cfg.StrOpt('tempurl_digest_hashlib',
               default='sha256',
               help="Hashing algorithm to use for the temp_url tests. "
                    "Needs to be supported both by Swift and the "
                    "hashlib module, for example sha1 or sha256"),
]


scenario_group = cfg.OptGroup(name='scenario', title='Scenario Test Options')

ScenarioGroup = [
    cfg.StrOpt('img_file', deprecated_name='qcow2_img_file',
               default='/opt/stack/new/devstack/files/images'
               '/cirros-0.3.1-x86_64-disk.img',
               help='Image full path.'),
    cfg.StrOpt('img_disk_format',
               default='qcow2',
               help='Image disk format'),
    cfg.StrOpt('img_container_format',
               default='bare',
               help='Image container format'),
    cfg.DictOpt('img_properties', help='Glance image properties. '
                'Use for custom images which require them'),
    # TODO(yfried): add support for dhcpcd
    cfg.StrOpt('dhcp_client',
               default='udhcpc',
               choices=["udhcpc", "dhclient", ""],
               help='DHCP client used by images to renew DCHP lease. '
                    'If left empty, update operation will be skipped. '
                    'Supported clients: "udhcpc", "dhclient"'),
    cfg.StrOpt('protocol',
               default='icmp',
               choices=('icmp', 'tcp', 'udp'),
               help='The protocol used in security groups tests to check '
                    'connectivity.'),
]


service_available_group = cfg.OptGroup(name="service_available",
                                       title="Available OpenStack Services")

ServiceAvailableGroup = [
    cfg.BoolOpt('cinder',
                default=True,
                help="Whether or not cinder is expected to be available"),
    cfg.BoolOpt('neutron',
                default=False,
                help="Whether or not neutron is expected to be available"),
    cfg.BoolOpt('glance',
                default=True,
                help="Whether or not glance is expected to be available"),
    cfg.BoolOpt('swift',
                default=True,
                help="Whether or not swift is expected to be available"),
    cfg.BoolOpt('nova',
                default=True,
                help="Whether or not nova is expected to be available"),
    cfg.BoolOpt('horizon',
                default=True,
                help="Whether or not horizon is expected to be available"),
]

enforce_scope_group = cfg.OptGroup(name="enforce_scope",
                                   title="OpenStack Services with "
                                         "enforce scope")


EnforceScopeGroup = [
    cfg.BoolOpt('nova',
                default=False,
                help='Does the compute service API policies enforce scope? '
                     'This configuration value should be same as '
                     'nova.conf: [oslo_policy].enforce_scope option.'),
    cfg.BoolOpt('neutron',
                default=False,
                help='Does the network service API policies enforce scope? '
                     'This configuration value should be same as '
                     'neutron.conf: [oslo_policy].enforce_scope option.'),
    cfg.BoolOpt('glance',
                default=False,
                help='Does the Image service API policies enforce scope? '
                     'This configuration value should be same as '
                     'glance.conf: [oslo_policy].enforce_scope option.'),
    cfg.BoolOpt('cinder',
                default=False,
                help='Does the Volume service API policies enforce scope? '
                     'This configuration value should be same as '
                     'cinder.conf: [oslo_policy].enforce_scope option.'),
    cfg.BoolOpt('keystone',
                default=False,
                help='Does the Identity service API policies enforce scope? '
                     'This configuration value should be same as '
                     'keystone.conf: [oslo_policy].enforce_scope option.'),
]

debug_group = cfg.OptGroup(name="debug",
                           title="Debug System")

DebugGroup = [
    cfg.StrOpt('trace_requests',
               default='',
               help="""A regex to determine which requests should be traced.

This is a regex to match the caller for rest client requests to be able to
selectively trace calls out of specific classes and methods. It largely
exists for test development, and is not expected to be used in a real deploy
of tempest. This will be matched against the discovered ClassName:method
in the test environment.

Expected values for this field are:

 * ClassName:test_method_name - traces one test_method
 * ClassName:setUp(Class) - traces specific setup functions
 * ClassName:tearDown(Class) - traces specific teardown functions
 * ClassName:_run_cleanups - traces the cleanup functions

If nothing is specified, this feature is not enabled. To trace everything
specify .* as the regex.
""")
]


profiler_group = cfg.OptGroup(name="profiler",
                              title="OpenStack Profiler")

ProfilerGroup = [
    cfg.StrOpt('key',
               help="The secret key to enable OpenStack Profiler. The value "
                    "should match the one configured in OpenStack services "
                    "under `[profiler]/hmac_keys` property. The default empty "
                    "value keeps profiling disabled"),
]

DefaultGroup = [
    cfg.BoolOpt('pause_teardown',
                default=False,
                help="""Whether to pause a test in global teardown.

The best use case is investigating used resources of one test.
A test can be run as follows:
 $ stestr run --pdb TEST_ID
or
 $ python -m testtools.run TEST_ID"""),
]

_opts = [
    (auth_group, AuthGroup),
    (compute_group, ComputeGroup),
    (compute_features_group, ComputeFeaturesGroup),
    (identity_group, IdentityGroup),
    (service_clients_group, ServiceClientsGroup),
    (identity_feature_group, IdentityFeatureGroup),
    (image_group, ImageGroup),
    (image_feature_group, ImageFeaturesGroup),
    (network_group, NetworkGroup),
    (network_feature_group, NetworkFeaturesGroup),
    (dashboard_group, DashboardGroup),
    (validation_group, ValidationGroup),
    (volume_group, VolumeGroup),
    (volume_feature_group, VolumeFeaturesGroup),
    (object_storage_group, ObjectStoreGroup),
    (object_storage_feature_group, ObjectStoreFeaturesGroup),
    (scenario_group, ScenarioGroup),
    (service_available_group, ServiceAvailableGroup),
    (enforce_scope_group, EnforceScopeGroup),
    (debug_group, DebugGroup),
    (placement_group, PlacementGroup),
    (profiler_group, ProfilerGroup),
    (None, DefaultGroup)
]


def register_opts():
    ext_plugins = plugins.TempestTestPluginManager()
    # Register in-tree tempest config options
    for g, o in _opts:
        register_opt_group(_CONF, g, o)
    # Call external plugin config option registration
    ext_plugins.register_plugin_opts(_CONF)


def list_opts():
    """Return a list of oslo.config options available.

    The purpose of this is to allow tools like the Oslo sample config file
    generator to discover the options exposed to users.
    """
    ext_plugins = plugins.TempestTestPluginManager()
    # Make a shallow copy of the options list that can be
    # extended by plugins. Send back the group object
    # to allow group help text to be generated.
    opt_list = [(g, o) for g, o in _opts]
    opt_list.extend(ext_plugins.get_plugin_options_list())
    return opt_list


# This should never be called outside of this module
class TempestConfigPrivate(object):
    """Provides OpenStack configuration information."""

    DEFAULT_CONFIG_DIR = os.path.join(os.getcwd(), "etc")

    DEFAULT_CONFIG_FILE = "tempest.conf"

    def __getattr__(self, attr):
        # Handles config options from the default group
        return getattr(_CONF, attr)

    def _set_attrs(self):
        # This methods ensures that config options in Tempest as well as
        # in Tempest plugins can be accessed via:
        #     CONF.<normalised_group_name>.<key_name>
        # where:
        #     normalised_group_name = group_name.replace('-', '_')
        # Attributes are set at __init__ time *only* for known option groups
        self.auth = _CONF.auth
        self.compute = _CONF.compute
        self.compute_feature_enabled = _CONF['compute-feature-enabled']
        self.identity = _CONF.identity
        self.service_clients = _CONF['service-clients']
        self.identity_feature_enabled = _CONF['identity-feature-enabled']
        self.image = _CONF.image
        self.image_feature_enabled = _CONF['image-feature-enabled']
        self.network = _CONF.network
        self.network_feature_enabled = _CONF['network-feature-enabled']
        self.dashboard = _CONF.dashboard
        self.validation = _CONF.validation
        self.volume = _CONF.volume
        self.volume_feature_enabled = _CONF['volume-feature-enabled']
        self.object_storage = _CONF['object-storage']
        self.object_storage_feature_enabled = _CONF[
            'object-storage-feature-enabled']
        self.scenario = _CONF.scenario
        self.service_available = _CONF.service_available
        self.enforce_scope = _CONF.enforce_scope
        self.debug = _CONF.debug
        logging.tempest_set_log_file('tempest.log')
        # Setting attributes for plugins
        # NOTE(andreaf) Plugins have no access to the TempestConfigPrivate
        # instance at discovery time, so they have no way of setting these
        # aliases themselves.
        ext_plugins = plugins.TempestTestPluginManager()
        for group, _ in ext_plugins.get_plugin_options_list():
            if isinstance(group, cfg.OptGroup):
                # If we have an OptGroup
                group_name = group.name
                group_dest = group.dest
            else:
                # If we have a group name as a string
                group_name = group
                group_dest = group.replace('-', '_')
            # NOTE(andreaf) We can set the attribute safely here since in
            # case of name conflict we would not have reached this point.
            setattr(self, group_dest, _CONF[group_name])

    def __init__(self, parse_conf=True, config_path=None):
        """Initialize a configuration from a conf directory and conf file."""
        super(TempestConfigPrivate, self).__init__()
        config_files = []
        failsafe_path = "/etc/tempest/" + self.DEFAULT_CONFIG_FILE

        if config_path:
            path = config_path
        else:
            # Environment variables override defaults...
            conf_dir = os.environ.get('TEMPEST_CONFIG_DIR',
                                      self.DEFAULT_CONFIG_DIR)
            conf_file = os.environ.get('TEMPEST_CONFIG',
                                       self.DEFAULT_CONFIG_FILE)

            path = os.path.join(conf_dir, conf_file)

        if not os.path.isfile(path):
            path = failsafe_path

        # only parse the config file if we expect one to exist. This is needed
        # to remove an issue with the config file up to date checker.
        if parse_conf:
            config_files.append(path)
        logging.register_options(_CONF)
        if os.path.isfile(path):
            _CONF([], project='tempest', default_config_files=config_files)
        else:
            _CONF([], project='tempest')

        logging_cfg_path = "%s/logging.conf" % os.path.dirname(path)
        if ((not hasattr(_CONF, 'log_config_append') or
             _CONF.log_config_append is None) and
            os.path.isfile(logging_cfg_path)):
            # if logging conf is in place we need to set log_config_append
            _CONF.log_config_append = logging_cfg_path

        logging.setup(_CONF, 'tempest')
        LOG = logging.getLogger('tempest')
        LOG.info("Using tempest config file %s", path)
        register_opts()
        self._set_attrs()
        if parse_conf:
            _CONF.log_opt_values(LOG, logging.DEBUG)


class TempestConfigProxy(object):
    _config = None
    _path = None

    _extra_log_defaults = [
        ('paramiko.transport', logging.INFO),
        ('requests.packages.urllib3.connectionpool', logging.WARN),
    ]

    def _fix_log_levels(self):
        """Tweak the oslo log defaults."""
        for name, level in self._extra_log_defaults:
            logging.getLogger(name).logger.setLevel(level)

    def __getattr__(self, attr):
        if not self._config:
            self._fix_log_levels()
            lock_dir = os.path.join(tempfile.gettempdir(), 'tempest-lock')
            lockutils.set_defaults(lock_dir)
            self._config = TempestConfigPrivate(config_path=self._path)

            # Pushing tempest internal service client configuration to the
            # service clients register. Doing this in the config module ensures
            # that the configuration is available by the time we register the
            # service clients.
            # NOTE(andreaf) This has to be done at the time the first
            # attribute is accessed, to ensure all plugins have been already
            # loaded, options registered, and _config is set.
            _register_tempest_service_clients()

            # Registering service clients and pushing their configuration to
            # the service clients register. Doing this in the config module
            # ensures that the configuration is available by the time we
            # discover tests from plugins.
            plugins.TempestTestPluginManager()._register_service_clients()

        return getattr(self._config, attr)

    def set_config_path(self, path):
        self._path = path
        # FIXME(masayukig): bug#1783751 To pass the config file path to child
        # processes, we need to set the environment variables here as a
        # workaround.
        os.environ['TEMPEST_CONFIG_DIR'] = os.path.dirname(path)
        os.environ['TEMPEST_CONFIG'] = os.path.basename(path)


CONF = TempestConfigProxy()


def service_client_config(service_client_name=None):
    """Return a dict with the parameters to init service clients

    Extracts from CONF the settings specific to the service_client_name and
    api_version, and formats them as dict ready to be passed to the service
    clients __init__:

        * `region` (default to identity)
        * `catalog_type`
        * `endpoint_type`
        * `build_timeout` (object-storage and identity default to compute)
        * `build_interval` (object-storage and identity default to compute)

    The following common settings are always returned, even if
    `service_client_name` is None:

        * `disable_ssl_certificate_validation`
        * `ca_certs`
        * `trace_requests`
        * `http_timeout`
        * `proxy_url`

    The dict returned by this does not fit a few service clients:

        * The endpoint type is not returned for identity client, since it takes
          three different values for v2 admin, v2 public and v3
        * The `ServersClient` from compute accepts an optional
          `enable_instance_password` parameter, which is not returned.
        * The `VolumesClient` for both v1 and v2 volume accept an optional
          `default_volume_size` parameter, which is not returned.
        * The `TokenClient` and `V3TokenClient` have a very different
          interface, only auth_url is needed for them.

    :param service_client_name: str Name of the service. Supported values are
        'compute', 'identity', 'image', 'network', 'object-storage', 'volume'
    :return: dictionary of __init__ parameters for the service clients
    :rtype: dict
    """
    _parameters = {
        'disable_ssl_certificate_validation':
            CONF.identity.disable_ssl_certificate_validation,
        'ca_certs': CONF.identity.ca_certificates_file,
        'trace_requests': CONF.debug.trace_requests,
        'http_timeout': CONF.service_clients.http_timeout,
        'proxy_url': CONF.service_clients.proxy_url,
    }

    if service_client_name is None:
        return _parameters

    # Get the group of options first, by normalising the service_group_name
    # Services with a '-' in the name have an '_' in the option group name
    config_group = service_client_name.replace('-', '_')
    # NOTE(andreaf) Check if the config group exists. This allows for this
    # helper to be used for settings from registered plugins as well
    try:
        options = getattr(CONF, config_group)
    except cfg.NoSuchOptError:
        # Option group not defined
        raise exceptions.UnknownServiceClient(services=service_client_name)
    # Set endpoint_type
    # Identity uses different settings depending on API version, so do not
    # return the endpoint at all.
    if service_client_name != 'identity':
        _parameters['endpoint_type'] = getattr(options, 'endpoint_type')
    # Set build_*
    # Object storage and identity groups do not have conf settings for
    # build_* parameters, and we default to compute in any case
    for setting in ['build_timeout', 'build_interval']:
        if not hasattr(options, setting) or not getattr(options, setting):
            _parameters[setting] = getattr(CONF.compute, setting)
        else:
            _parameters[setting] = getattr(options, setting)
    # Set region
    # If a service client does not define region or region is not set
    # default to the identity region
    if not hasattr(options, 'region') or not getattr(options, 'region'):
        _parameters['region'] = CONF.identity.region
    else:
        _parameters['region'] = getattr(options, 'region')
    # Set service
    _parameters['service'] = getattr(options, 'catalog_type')
    return _parameters


def _register_tempest_service_clients():
    # Register tempest own service clients using the same mechanism used
    # for external plugins.
    # The configuration data is pushed to the registry so that automatic
    # configuration of tempest own service clients is possible both for
    # tempest as well as for the plugins.
    service_clients = clients.tempest_modules()
    registry = clients.ClientsRegistry()
    all_clients = []
    for service_client in service_clients:
        module = service_clients[service_client]
        configs = service_client.split('.')[0]
        service_client_data = dict(
            name=service_client.replace('.', '_').replace('-', '_'),
            service_version=service_client,
            module_path=module.__name__,
            client_names=module.__all__,
            **service_client_config(configs)
        )
        all_clients.append(service_client_data)
    # NOTE(andreaf) Internal service clients do not actually belong
    # to a plugin, so using '__tempest__' to indicate a virtual plugin
    # which holds internal service clients.
    registry.register_service_client('__tempest__', all_clients)

<MSG> Revert "Split up XML and JSON testing."

This reverts commit 58dec9d45360a69192fc6ba43dddf5a597063972

This ended gating of the XML API without any real public deliberation.  It should be reverted, and a plan agreed upon with PTLs and the CI team.

Also, if we do decide to implement this, we should make the CI change _first_ so that we don't abruptly stop gating on something we should be testing.
<DFF> @@ -461,20 +461,6 @@ def register_boto_opts(conf):
     for opt in BotoConfig:
         conf.register_opt(opt, group='boto')
 
-general_group = cfg.OptGroup(name='general', title='General Tempest Options')
-
-GeneralOpts = [
-    cfg.BoolOpt('use_xml',
-                default=False,
-                help="Use xml for the container format"),
-]
-
-
-def register_general_opts(conf):
-    conf.register_group(general_group)
-    for opt in GeneralOpts:
-        conf.register_opt(opt, group='general')
-
 
 # TODO(jaypipes): Move this to a common utils (not data_utils...)
 def singleton(cls):
@@ -532,7 +518,6 @@ class TempestConfig:
         register_volume_opts(cfg.CONF)
         register_object_storage_opts(cfg.CONF)
         register_boto_opts(cfg.CONF)
-        register_general_opts(cfg.CONF)
         self.compute = cfg.CONF.compute
         self.compute_admin = cfg.CONF['compute-admin']
         self.identity = cfg.CONF.identity
@@ -543,4 +528,3 @@ class TempestConfig:
         self.volume = cfg.CONF.volume
         self.object_storage = cfg.CONF['object-storage']
         self.boto = cfg.CONF.boto
-        self.general = cfg.CONF.general

{'commit': 'diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample\nindex 2c1b07ce8..8429cd0b9 100644\n--- a/etc/tempest.conf.sample\n+++ b/etc/tempest.conf.sample\n@@ -310,10 +310,3 @@ build_timeout = 120\n \n # Status change wait interval\n build_interval = 1\n-\n-[general]\n-#This section contains configuration options that are used for all of tempest\n-#that are not specific to a single project or API\n-\n-#Use xml containe for tests that support both JSON and XML?\n-use_xml = False\ndiff --git a/tempest/clients.py b/tempest/clients.py\nindex 146acd4dc..ac163b615 100644\n--- a/tempest/clients.py\n+++ b/tempest/clients.py\n@@ -141,7 +141,8 @@ class Manager(object):\n     Top level manager for OpenStack Compute clients\n     """\n \n-    def __init__(self, username=None, password=None, tenant_name=None):\n+    def __init__(self, username=None, password=None, tenant_name=None,\n+                 interface=\'json\'):\n         """\n         We allow overriding of the credentials used within the various\n         client classes managed by the Manager object. Left as None, the\n@@ -158,10 +159,6 @@ class Manager(object):\n         self.username = username or self.config.compute.username\n         self.password = password or self.config.compute.password\n         self.tenant_name = tenant_name or self.config.compute.tenant_name\n-        if self.config.general.use_xml:\n-            interface = \'xml\'\n-        else:\n-            interface = \'json\'\n \n         if None in (self.username, self.password, self.tenant_name):\n             msg = ("Missing required credentials. "\n@@ -232,11 +229,12 @@ class AdminManager(Manager):\n     managed client objects\n     """\n \n-    def __init__(self):\n+    def __init__(self, interface=\'json\'):\n         conf = config.TempestConfig()\n         super(AdminManager, self).__init__(conf.compute_admin.username,\n                                            conf.compute_admin.password,\n-                                           conf.compute_admin.tenant_name)\n+                                           conf.compute_admin.tenant_name,\n+                                           interface=interface)\n \n \n class ServiceManager(object):\n@@ -259,11 +257,12 @@ class IdentityManager(Manager):\n     managed client objects\n     """\n \n-    def __init__(self):\n+    def __init__(self, interface=\'json\'):\n         conf = config.TempestConfig()\n         super(IdentityManager, self).__init__(conf.identity_admin.username,\n                                               conf.identity_admin.password,\n-                                              conf.identity_admin.tenant_name)\n+                                              conf.identity_admin.tenant_name,\n+                                              interface)\n \n \n class IdentityNaManager(Manager):\n@@ -273,8 +272,9 @@ class IdentityNaManager(Manager):\n     managed client objects\n     """\n \n-    def __init__(self):\n+    def __init__(self, interface=\'json\'):\n         conf = config.TempestConfig()\n         super(IdentityNaManager, self).__init__(conf.compute.username,\n                                                 conf.compute.password,\n-                                                conf.compute.tenant_name)\n+                                                conf.compute.tenant_name,\n+                                                interface)\ndiff --git a/tempest/config.py b/tempest/config.py\nindex 66e0d5d12..70b1c79fd 100644\n--- a/tempest/config.py\n+++ b/tempest/config.py\n@@ -461,20 +461,6 @@ def register_boto_opts(conf):\n     for opt in BotoConfig:\n         conf.register_opt(opt, group=\'boto\')\n \n-general_group = cfg.OptGroup(name=\'general\', title=\'General Tempest Options\')\n-\n-GeneralOpts = [\n-    cfg.BoolOpt(\'use_xml\',\n-                default=False,\n-                help="Use xml for the container format"),\n-]\n-\n-\n-def register_general_opts(conf):\n-    conf.register_group(general_group)\n-    for opt in GeneralOpts:\n-        conf.register_opt(opt, group=\'general\')\n-\n \n # TODO(jaypipes): Move this to a common utils (not data_utils...)\n def singleton(cls):\n@@ -532,7 +518,6 @@ class TempestConfig:\n         register_volume_opts(cfg.CONF)\n         register_object_storage_opts(cfg.CONF)\n         register_boto_opts(cfg.CONF)\n-        register_general_opts(cfg.CONF)\n         self.compute = cfg.CONF.compute\n         self.compute_admin = cfg.CONF[\'compute-admin\']\n         self.identity = cfg.CONF.identity\n@@ -543,4 +528,3 @@ class TempestConfig:\n         self.volume = cfg.CONF.volume\n         self.object_storage = cfg.CONF[\'object-storage\']\n         self.boto = cfg.CONF.boto\n-        self.general = cfg.CONF.general\ndiff --git a/tempest/tests/compute/admin/test_flavors.py b/tempest/tests/compute/admin/test_flavors.py\nindex eb873bdce..8172bd41e 100644\n--- a/tempest/tests/compute/admin/test_flavors.py\n+++ b/tempest/tests/compute/admin/test_flavors.py\n@@ -19,12 +19,9 @@ import nose\n from nose.plugins.attrib import attr\n import unittest2 as unittest\n \n-from tempest import config\n from tempest.tests import compute\n from tempest.tests.compute import base\n \n-CONF = config.TempestConfig()\n-\n \n class FlavorsAdminTestBase(object):\n \n@@ -71,12 +68,12 @@ class FlavorsAdminTestBase(object):\n             self.assertEqual(flavor[\'rxtx_factor\'], self.rxtx)\n             self.assertEqual(flavor[\'OS-FLV-EXT-DATA:ephemeral\'],\n                              self.ephemeral)\n-            if CONF.general.use_xml:\n+            if self._interface == "xml":\n                 XMLNS_OS_FLV_ACCESS = "http://docs.openstack.org/compute/ext/"\\\n                     "flavor_access/api/v2"\n                 key = "{" + XMLNS_OS_FLV_ACCESS + "}is_public"\n                 self.assertEqual(flavor[key], "True")\n-            else:\n+            if self._interface == "json":\n                 self.assertEqual(flavor[\'os-flavor-access:is_public\'], True)\n \n             #Verify flavor is retrieved\n@@ -167,12 +164,12 @@ class FlavorsAdminTestBase(object):\n             self.assertEqual(flavor[\'swap\'], \'\')\n             self.assertEqual(int(flavor[\'rxtx_factor\']), 1)\n             self.assertEqual(int(flavor[\'OS-FLV-EXT-DATA:ephemeral\']), 0)\n-            if CONF.general.use_xml:\n+            if self._interface == "xml":\n                 XMLNS_OS_FLV_ACCESS = "http://docs.openstack.org/compute/ext/"\\\n                     "flavor_access/api/v2"\n                 key = "{" + XMLNS_OS_FLV_ACCESS + "}is_public"\n                 self.assertEqual(flavor[key], "True")\n-            else:\n+            if self._interface == "json":\n                 self.assertEqual(flavor[\'os-flavor-access:is_public\'], True)\n \n             #Verify flavor is retrieved\n@@ -244,11 +241,23 @@ class FlavorsAdminTestBase(object):\n             self.client.wait_for_resource_deletion(self.new_flavor_id)\n \n \n-class FlavorsAdminTest(base.BaseComputeAdminTest, base.BaseCompTest,\n-                       FlavorsAdminTestBase):\n+class FlavorsAdminTestXML(base.BaseComputeAdminTestXML,\n+                          base.BaseComputeTestXML,\n+                          FlavorsAdminTestBase):\n+\n+    @classmethod\n+    def setUpClass(cls):\n+        super(FlavorsAdminTestXML, cls).setUpClass()\n+        base.BaseComputeTestXML.setUpClass()\n+        FlavorsAdminTestBase.setUpClass(cls)\n+\n+\n+class FlavorsAdminTestJSON(base.BaseComputeAdminTestJSON,\n+                           base.BaseComputeTestJSON,\n+                           FlavorsAdminTestBase):\n \n     @classmethod\n     def setUpClass(cls):\n-        super(FlavorsAdminTest, cls).setUpClass()\n-        base.BaseCompTest.setUpClass()\n+        super(FlavorsAdminTestJSON, cls).setUpClass()\n+        base.BaseComputeTestJSON.setUpClass()\n         FlavorsAdminTestBase.setUpClass(cls)\ndiff --git a/tempest/tests/compute/admin/test_quotas.py b/tempest/tests/compute/admin/test_quotas.py\nindex ca58c6a60..eaf245a50 100644\n--- a/tempest/tests/compute/admin/test_quotas.py\n+++ b/tempest/tests/compute/admin/test_quotas.py\n@@ -19,10 +19,10 @@ from nose.plugins.attrib import attr\n \n from tempest import exceptions\n from tempest.services.compute.admin.json import quotas_client as adm_quotas\n-from tempest.tests.compute.base import BaseCompTest\n+from tempest.tests.compute.base import BaseComputeTest\n \n \n-class QuotasTest(BaseCompTest):\n+class QuotasTest(BaseComputeTest):\n \n     @classmethod\n     def setUpClass(cls):\ndiff --git a/tempest/tests/compute/base.py b/tempest/tests/compute/base.py\nindex d1cf52269..c44a2f1d4 100644\n--- a/tempest/tests/compute/base.py\n+++ b/tempest/tests/compute/base.py\n@@ -26,7 +26,8 @@ from tempest.common.utils.data_utils import rand_name\n from tempest import config\n from tempest import exceptions\n \n-__all__ = [\'BaseCompTest\', \'BaseComputeAdminTest\']\n+__all__ = [\'BaseComputeTest\', \'BaseComputeTestJSON\', \'BaseComputeTestXML\',\n+           \'BaseComputeAdminTestJSON\', \'BaseComputeAdminTestXML\']\n \n LOG = logging.getLogger(__name__)\n \n@@ -45,9 +46,10 @@ class BaseCompTest(unittest.TestCase):\n             username, tenant_name, password = creds\n             os = clients.Manager(username=username,\n                                  password=password,\n-                                 tenant_name=tenant_name)\n+                                 tenant_name=tenant_name,\n+                                 interface=cls._interface)\n         else:\n-            os = clients.Manager()\n+            os = clients.Manager(interface=cls._interface)\n \n         cls.os = os\n         cls.servers_client = os.servers_client\n@@ -76,7 +78,7 @@ class BaseCompTest(unittest.TestCase):\n         """\n         Returns an instance of the Identity Admin API client\n         """\n-        os = clients.IdentityManager()\n+        os = clients.IdentityManager(interface=cls._interface)\n         admin_client = os.admin_client\n         return admin_client\n \n@@ -225,6 +227,23 @@ class BaseCompTest(unittest.TestCase):\n             time.sleep(self.build_interval)\n \n \n+class BaseComputeTestJSON(BaseCompTest):\n+    @classmethod\n+    def setUpClass(cls):\n+        cls._interface = "json"\n+        super(BaseComputeTestJSON, cls).setUpClass()\n+\n+# NOTE(danms): For transition, keep the old name active as JSON\n+BaseComputeTest = BaseComputeTestJSON\n+\n+\n+class BaseComputeTestXML(BaseCompTest):\n+    @classmethod\n+    def setUpClass(cls):\n+        cls._interface = "xml"\n+        super(BaseComputeTestXML, cls).setUpClass()\n+\n+\n class BaseComputeAdminTest(unittest.TestCase):\n \n     """Base test case class for all Compute Admin API tests."""\n@@ -241,4 +260,18 @@ class BaseComputeAdminTest(unittest.TestCase):\n                    "in configuration.")\n             raise nose.SkipTest(msg)\n \n-        cls.os = clients.AdminManager()\n+        cls.os = clients.AdminManager(interface=cls._interface)\n+\n+\n+class BaseComputeAdminTestJSON(BaseComputeAdminTest):\n+    @classmethod\n+    def setUpClass(cls):\n+        cls._interface = "json"\n+        super(BaseComputeAdminTestJSON, cls).setUpClass()\n+\n+\n+class BaseComputeAdminTestXML(BaseComputeAdminTest):\n+    @classmethod\n+    def setUpClass(cls):\n+        cls._interface = "xml"\n+        super(BaseComputeAdminTestXML, cls).setUpClass()\ndiff --git a/tempest/tests/compute/flavors/test_flavors.py b/tempest/tests/compute/flavors/test_flavors.py\nindex bf5646484..53cad6547 100644\n--- a/tempest/tests/compute/flavors/test_flavors.py\n+++ b/tempest/tests/compute/flavors/test_flavors.py\n@@ -137,9 +137,19 @@ class FlavorsTestBase(object):\n                           9999)\n \n \n-class FlavorsTest(base.BaseCompTest, FlavorsTestBase):\n+class FlavorsTestXML(base.BaseComputeTestXML,\n+                     FlavorsTestBase):\n \n     @classmethod\n     def setUpClass(cls):\n-        super(FlavorsTest, cls).setUpClass()\n+        super(FlavorsTestXML, cls).setUpClass()\n+        cls.client = cls.flavors_client\n+\n+\n+class FlavorsTestJSON(base.BaseComputeTestJSON,\n+                      FlavorsTestBase):\n+\n+    @classmethod\n+    def setUpClass(cls):\n+        super(FlavorsTestJSON, cls).setUpClass()\n         cls.client = cls.flavors_client\ndiff --git a/tempest/tests/compute/floating_ips/test_floating_ips_actions.py b/tempest/tests/compute/floating_ips/test_floating_ips_actions.py\nindex e81022c45..9a9914a26 100644\n--- a/tempest/tests/compute/floating_ips/test_floating_ips_actions.py\n+++ b/tempest/tests/compute/floating_ips/test_floating_ips_actions.py\n@@ -205,13 +205,25 @@ class FloatingIPsTestBase(object):\n                       \' with out passing floating IP  should raise BadRequest\')\n \n \n-class FloatingIPsTest(base.BaseCompTest, FloatingIPsTestBase):\n+class FloatingIPsTestJSON(base.BaseComputeTestJSON, FloatingIPsTestBase):\n     @classmethod\n     def setUpClass(cls):\n-        super(FloatingIPsTest, cls).setUpClass()\n+        super(FloatingIPsTestJSON, cls).setUpClass()\n         FloatingIPsTestBase.setUpClass(cls)\n \n     @classmethod\n     def tearDownClass(cls):\n         FloatingIPsTestBase.tearDownClass(cls)\n-        super(FloatingIPsTest, cls).tearDownClass()\n+        super(FloatingIPsTestJSON, cls).tearDownClass()\n+\n+\n+class FloatingIPsTestXML(base.BaseComputeTestXML, FloatingIPsTestBase):\n+    @classmethod\n+    def setUpClass(cls):\n+        super(FloatingIPsTestXML, cls).setUpClass()\n+        FloatingIPsTestBase.setUpClass(cls)\n+\n+    @classmethod\n+    def tearDownClass(cls):\n+        FloatingIPsTestBase.tearDownClass(cls)\n+        super(FloatingIPsTestXML, cls).tearDownClass()\ndiff --git a/tempest/tests/compute/floating_ips/test_list_floating_ips.py b/tempest/tests/compute/floating_ips/test_list_floating_ips.py\nindex 4fbe4eb90..9eec27ca9 100644\n--- a/tempest/tests/compute/floating_ips/test_list_floating_ips.py\n+++ b/tempest/tests/compute/floating_ips/test_list_floating_ips.py\n@@ -99,13 +99,27 @@ class FloatingIPDetailsTestBase(object):\n                       \'nonexistant floating IP\')\n \n \n-class FloatingIPDetailsTest(base.BaseCompTest, FloatingIPDetailsTestBase):\n+class FloatingIPDetailsTestJSON(base.BaseComputeTestJSON,\n+                                FloatingIPDetailsTestBase):\n     @classmethod\n     def setUpClass(cls):\n-        super(FloatingIPDetailsTest, cls).setUpClass()\n+        super(FloatingIPDetailsTestJSON, cls).setUpClass()\n         FloatingIPDetailsTestBase.setUpClass(cls)\n \n     @classmethod\n     def tearDownClass(cls):\n         FloatingIPDetailsTestBase.tearDownClass(cls)\n-        super(FloatingIPDetailsTest, cls).tearDownClass()\n+        super(FloatingIPDetailsTestJSON, cls).tearDownClass()\n+\n+\n+class FloatingIPDetailsTestXML(base.BaseComputeTestXML,\n+                               FloatingIPDetailsTestBase):\n+    @classmethod\n+    def setUpClass(cls):\n+        super(FloatingIPDetailsTestXML, cls).setUpClass()\n+        FloatingIPDetailsTestBase.setUpClass(cls)\n+\n+    @classmethod\n+    def tearDownClass(cls):\n+        FloatingIPDetailsTestBase.tearDownClass(cls)\n+        super(FloatingIPDetailsTestXML, cls).tearDownClass()\ndiff --git a/tempest/tests/compute/images/test_image_metadata.py b/tempest/tests/compute/images/test_image_metadata.py\nindex 66c051ee4..cdf4249cf 100644\n--- a/tempest/tests/compute/images/test_image_metadata.py\n+++ b/tempest/tests/compute/images/test_image_metadata.py\n@@ -19,10 +19,10 @@ from nose.plugins.attrib import attr\n \n from tempest.common.utils.data_utils import rand_name\n from tempest import exceptions\n-from tempest.tests.compute.base import BaseCompTest\n+from tempest.tests.compute.base import BaseComputeTest\n \n \n-class ImagesMetadataTest(BaseCompTest):\n+class ImagesMetadataTest(BaseComputeTest):\n \n     @classmethod\n     def setUpClass(cls):\ndiff --git a/tempest/tests/compute/images/test_images.py b/tempest/tests/compute/images/test_images.py\nindex 8bea2574e..2557f1647 100644\n--- a/tempest/tests/compute/images/test_images.py\n+++ b/tempest/tests/compute/images/test_images.py\n@@ -213,13 +213,40 @@ class ImagesTestBase(object):\n                       "exceeds 35 character ID length limit")\n \n \n-class ImagesTest(base.BaseCompTest, ImagesTestBase):\n+class ImagesTestJSON(base.BaseComputeTestJSON,\n+                     ImagesTestBase):\n     def tearDown(self):\n         ImagesTestBase.tearDown(self)\n \n     @classmethod\n     def setUpClass(cls):\n-        super(ImagesTest, cls).setUpClass()\n+        super(ImagesTestJSON, cls).setUpClass()\n+        cls.client = cls.images_client\n+        cls.servers_client = cls.servers_client\n+\n+        cls.image_ids = []\n+\n+        if compute.MULTI_USER:\n+            if cls.config.compute.allow_tenant_isolation:\n+                creds = cls._get_isolated_creds()\n+                username, tenant_name, password = creds\n+                cls.alt_manager = clients.Manager(username=username,\n+                                                  password=password,\n+                                                  tenant_name=tenant_name)\n+            else:\n+                # Use the alt_XXX credentials in the config file\n+                cls.alt_manager = clients.AltManager()\n+            cls.alt_client = cls.alt_manager.images_client\n+\n+\n+class ImagesTestXML(base.BaseComputeTestXML,\n+                    ImagesTestBase):\n+    def tearDown(self):\n+        ImagesTestBase.tearDown(self)\n+\n+    @classmethod\n+    def setUpClass(cls):\n+        super(ImagesTestXML, cls).setUpClass()\n         cls.client = cls.images_client\n         cls.servers_client = cls.servers_client\n \ndiff --git a/tempest/tests/compute/images/test_images_oneserver.py b/tempest/tests/compute/images/test_images_oneserver.py\nindex 27c73f410..f8b560b1e 100644\n--- a/tempest/tests/compute/images/test_images_oneserver.py\n+++ b/tempest/tests/compute/images/test_images_oneserver.py\n@@ -187,14 +187,43 @@ class ImagesOneServerTestBase(object):\n         self.assertRaises(exceptions.NotFound, self.client.get_image, image_id)\n \n \n-class ImagesOneServerTest(base.BaseCompTest, ImagesOneServerTestBase):\n+class ImagesOneServerTestJSON(base.BaseComputeTestJSON,\n+                              ImagesOneServerTestBase):\n \n     def tearDown(self):\n         ImagesOneServerTestBase.tearDown(self)\n \n     @classmethod\n     def setUpClass(cls):\n-        super(ImagesOneServerTest, cls).setUpClass()\n+        super(ImagesOneServerTestJSON, cls).setUpClass()\n+        cls.client = cls.images_client\n+        cls.servers_client = cls.servers_client\n+        cls.server = cls.create_server()\n+\n+        cls.image_ids = []\n+\n+        if compute.MULTI_USER:\n+            if cls.config.compute.allow_tenant_isolation:\n+                creds = cls._get_isolated_creds()\n+                username, tenant_name, password = creds\n+                cls.alt_manager = clients.Manager(username=username,\n+                                                  password=password,\n+                                                  tenant_name=tenant_name)\n+            else:\n+                # Use the alt_XXX credentials in the config file\n+                cls.alt_manager = clients.AltManager()\n+            cls.alt_client = cls.alt_manager.images_client\n+\n+\n+class ImagesOneServerTestXML(base.BaseComputeTestXML,\n+                             ImagesOneServerTestBase):\n+\n+    def tearDown(self):\n+        ImagesOneServerTestBase.tearDown(self)\n+\n+    @classmethod\n+    def setUpClass(cls):\n+        super(ImagesOneServerTestXML, cls).setUpClass()\n         cls.client = cls.images_client\n         cls.servers_client = cls.servers_client\n         cls.server = cls.create_server()\ndiff --git a/tempest/tests/compute/images/test_images_whitebox.py b/tempest/tests/compute/images/test_images_whitebox.py\nindex a61576157..2987534f0 100644\n--- a/tempest/tests/compute/images/test_images_whitebox.py\n+++ b/tempest/tests/compute/images/test_images_whitebox.py\n@@ -24,7 +24,7 @@ from tempest import whitebox\n \n \n @attr(type=\'whitebox\')\n-class ImagesWhiteboxTest(whitebox.ComputeWhiteboxTest, base.BaseCompTest):\n+class ImagesWhiteboxTest(whitebox.ComputeWhiteboxTest, base.BaseComputeTest):\n \n     @classmethod\n     def setUpClass(cls):\ndiff --git a/tempest/tests/compute/images/test_list_image_filters.py b/tempest/tests/compute/images/test_list_image_filters.py\nindex 1b1baff11..26119e3d3 100644\n--- a/tempest/tests/compute/images/test_list_image_filters.py\n+++ b/tempest/tests/compute/images/test_list_image_filters.py\n@@ -20,10 +20,10 @@ from nose.plugins.attrib import attr\n from tempest.common.utils.data_utils import parse_image_id\n from tempest.common.utils.data_utils import rand_name\n from tempest import exceptions\n-from tempest.tests.compute.base import BaseCompTest\n+from tempest.tests.compute.base import BaseComputeTest\n \n \n-class ListImageFiltersTest(BaseCompTest):\n+class ListImageFiltersTest(BaseComputeTest):\n \n     @classmethod\n     def setUpClass(cls):\ndiff --git a/tempest/tests/compute/images/test_list_images.py b/tempest/tests/compute/images/test_list_images.py\nindex 6b5ca10ee..da92ca847 100644\n--- a/tempest/tests/compute/images/test_list_images.py\n+++ b/tempest/tests/compute/images/test_list_images.py\n@@ -20,10 +20,10 @@ from nose.plugins.attrib import attr\n from tempest.common.utils.data_utils import parse_image_id\n from tempest.common.utils.data_utils import rand_name\n from tempest import exceptions\n-from tempest.tests.compute.base import BaseCompTest\n+from tempest.tests.compute.base import BaseComputeTest\n \n \n-class ListImagesTest(BaseCompTest):\n+class ListImagesTest(BaseComputeTest):\n \n     @classmethod\n     def setUpClass(cls):\ndiff --git a/tempest/tests/compute/keypairs/test_keypairs.py b/tempest/tests/compute/keypairs/test_keypairs.py\nindex e3a97cf68..7d95a9b8f 100644\n--- a/tempest/tests/compute/keypairs/test_keypairs.py\n+++ b/tempest/tests/compute/keypairs/test_keypairs.py\n@@ -20,7 +20,8 @@ import unittest2 as unittest\n \n from tempest.common.utils.data_utils import rand_name\n from tempest import exceptions\n-from tempest.tests.compute.base import BaseCompTest\n+from tempest.tests.compute.base import BaseComputeTestJSON\n+from tempest.tests.compute.base import BaseComputeTestXML\n \n \n class KeyPairsTestBase(object):\n@@ -221,8 +222,15 @@ class KeyPairsTestBase(object):\n             self.fail(\'invalid name\')\n \n \n-class KeyPairsTest(BaseCompTest, KeyPairsTestBase):\n+class KeyPairsTestXML(BaseComputeTestXML, KeyPairsTestBase):\n     @classmethod\n     def setUpClass(cls):\n-        super(KeyPairsTest, cls).setUpClass()\n+        super(KeyPairsTestXML, cls).setUpClass()\n+        cls.client = cls.keypairs_client\n+\n+\n+class KeyPairsTestJSON(BaseComputeTestJSON, KeyPairsTestBase):\n+    @classmethod\n+    def setUpClass(cls):\n+        super(KeyPairsTestJSON, cls).setUpClass()\n         cls.client = cls.keypairs_client\ndiff --git a/tempest/tests/compute/limits/test_absolute_limits.py b/tempest/tests/compute/limits/test_absolute_limits.py\nindex 2e201fe88..89c5b25b1 100644\n--- a/tempest/tests/compute/limits/test_absolute_limits.py\n+++ b/tempest/tests/compute/limits/test_absolute_limits.py\n@@ -20,7 +20,7 @@ import unittest2 as unittest\n from tempest.tests.compute import base\n \n \n-class AbsoluteLimitsTestBase(object):\n+class AbsoluteLimitsTest(object):\n \n     @staticmethod\n     def setUpClass(cls):\n@@ -50,8 +50,17 @@ class AbsoluteLimitsTestBase(object):\n                          % \', \'.join(ele for ele in missing_elements))\n \n \n-class AbsoluteLimitsTest(base.BaseCompTest, AbsoluteLimitsTestBase):\n+class AbsoluteLimitsTestJSON(base.BaseComputeTestJSON,\n+                             AbsoluteLimitsTest):\n     @classmethod\n     def setUpClass(cls):\n-        super(AbsoluteLimitsTest, cls).setUpClass()\n-        AbsoluteLimitsTestBase.setUpClass(cls)\n+        super(AbsoluteLimitsTestJSON, cls).setUpClass()\n+        AbsoluteLimitsTest.setUpClass(cls)\n+\n+\n+class AbsoluteLimitsTestXML(base.BaseComputeTestXML,\n+                            AbsoluteLimitsTest):\n+    @classmethod\n+    def setUpClass(cls):\n+        super(AbsoluteLimitsTestXML, cls).setUpClass()\n+        AbsoluteLimitsTest.setUpClass(cls)\ndiff --git a/tempest/tests/compute/security_groups/test_security_group_rules.py b/tempest/tests/compute/security_groups/test_security_group_rules.py\nindex 19e10a4a6..805adf43a 100644\n--- a/tempest/tests/compute/security_groups/test_security_group_rules.py\n+++ b/tempest/tests/compute/security_groups/test_security_group_rules.py\n@@ -22,7 +22,7 @@ from tempest import exceptions\n from tempest.tests.compute import base\n \n \n-class SecurityGroupRulesTestBase(object):\n+class SecurityGroupRulesTest(object):\n \n     @staticmethod\n     def setUpClass(cls):\n@@ -244,8 +244,17 @@ class SecurityGroupRulesTestBase(object):\n                       \'with nonexistant rule id\')\n \n \n-class SecurityGroupRulesTest(base.BaseCompTest, SecurityGroupRulesTestBase):\n+class SecurityGroupRulesTestJSON(base.BaseComputeTestJSON,\n+                                 SecurityGroupRulesTest):\n     @classmethod\n     def setUpClass(cls):\n-        super(SecurityGroupRulesTest, cls).setUpClass()\n-        SecurityGroupRulesTestBase.setUpClass(cls)\n+        super(SecurityGroupRulesTestJSON, cls).setUpClass()\n+        SecurityGroupRulesTest.setUpClass(cls)\n+\n+\n+class SecurityGroupRulesTestXML(base.BaseComputeTestXML,\n+                                SecurityGroupRulesTest):\n+    @classmethod\n+    def setUpClass(cls):\n+        super(SecurityGroupRulesTestXML, cls).setUpClass()\n+        SecurityGroupRulesTest.setUpClass(cls)\ndiff --git a/tempest/tests/compute/security_groups/test_security_groups.py b/tempest/tests/compute/security_groups/test_security_groups.py\nindex 51bea0d35..5c0bd825b 100644\n--- a/tempest/tests/compute/security_groups/test_security_groups.py\n+++ b/tempest/tests/compute/security_groups/test_security_groups.py\n@@ -22,7 +22,7 @@ from tempest import exceptions\n from tempest.tests.compute import base\n \n \n-class SecurityGroupsTestBase(object):\n+class SecurityGroupsTest(object):\n \n     @staticmethod\n     def setUpClass(cls):\n@@ -298,8 +298,17 @@ class SecurityGroupsTestBase(object):\n         self.assertEqual(202, resp.status)\n \n \n-class SecurityGroupsTest(base.BaseCompTest, SecurityGroupsTestBase):\n+class SecurityGroupsTestJSON(base.BaseComputeTestJSON,\n+                             SecurityGroupsTest):\n     @classmethod\n     def setUpClass(cls):\n-        super(SecurityGroupsTest, cls).setUpClass()\n-        SecurityGroupsTestBase.setUpClass(cls)\n+        super(SecurityGroupsTestJSON, cls).setUpClass()\n+        SecurityGroupsTest.setUpClass(cls)\n+\n+\n+class SecurityGroupsTestXML(base.BaseComputeTestXML,\n+                            SecurityGroupsTest):\n+    @classmethod\n+    def setUpClass(cls):\n+        super(SecurityGroupsTestXML, cls).setUpClass()\n+        SecurityGroupsTest.setUpClass(cls)\ndiff --git a/tempest/tests/compute/servers/test_console_output.py b/tempest/tests/compute/servers/test_console_output.py\nindex 34ff614a6..3ad29a15e 100644\n--- a/tempest/tests/compute/servers/test_console_output.py\n+++ b/tempest/tests/compute/servers/test_console_output.py\n@@ -23,7 +23,7 @@ from tempest import exceptions\n from tempest.tests.compute import base\n \n \n-class ConsoleOutputTestBase(object):\n+class ConsoleOutputTest(object):\n \n     @classmethod\n     def setUpClass(self, cls):\n@@ -87,13 +87,28 @@ class ConsoleOutputTestBase(object):\n \n \n @attr(type=\'smoke\')\n-class ConsoleOutputTest(base.BaseCompTest, ConsoleOutputTestBase):\n+class ConsoleOutputTestJSON(base.BaseComputeTestJSON,\n+                            ConsoleOutputTest):\n     @classmethod\n     def setUpClass(cls):\n-        super(ConsoleOutputTest, cls).setUpClass()\n-        ConsoleOutputTestBase.setUpClass(cls)\n+        super(ConsoleOutputTestJSON, cls).setUpClass()\n+        ConsoleOutputTest.setUpClass(cls)\n \n     @classmethod\n     def tearDownClass(cls):\n-        ConsoleOutputTestBase.tearDownClass(cls)\n-        super(ConsoleOutputTest, cls).tearDownClass()\n+        ConsoleOutputTest.tearDownClass(cls)\n+        super(ConsoleOutputTestJSON, cls).tearDownClass()\n+\n+\n+@attr(type=\'smoke\')\n+class ConsoleOutputTestXML(base.BaseComputeTestXML,\n+                           ConsoleOutputTest):\n+    @classmethod\n+    def setUpClass(cls):\n+        super(ConsoleOutputTestXML, cls).setUpClass()\n+        ConsoleOutputTest.setUpClass(cls)\n+\n+    @classmethod\n+    def tearDownClass(cls):\n+        ConsoleOutputTest.tearDownClass(cls)\n+        super(ConsoleOutputTestXML, cls).tearDownClass()\ndiff --git a/tempest/tests/compute/servers/test_create_server.py b/tempest/tests/compute/servers/test_create_server.py\nindex c655d1804..c5a54dcad 100644\n--- a/tempest/tests/compute/servers/test_create_server.py\n+++ b/tempest/tests/compute/servers/test_create_server.py\n@@ -29,7 +29,7 @@ from tempest.tests import compute\n from tempest.tests.compute import base\n \n \n-class ServersTestBase(object):\n+class ServersTest(object):\n \n     run_ssh = tempest.config.TempestConfig().compute.run_ssh\n \n@@ -122,7 +122,8 @@ class ServersTestBase(object):\n \n \n @attr(type=\'positive\')\n-class ServersTestAutoDisk(base.BaseCompTest, ServersTestBase):\n+class ServersTestAutoDisk(base.BaseComputeTestJSON,\n+                          ServersTest):\n     @classmethod\n     def setUpClass(cls):\n         if not compute.DISK_CONFIG_ENABLED:\n@@ -130,16 +131,17 @@ class ServersTestAutoDisk(base.BaseCompTest, ServersTestBase):\n             raise nose.SkipTest(msg)\n         super(ServersTestAutoDisk, cls).setUpClass()\n         cls.disk_config = \'AUTO\'\n-        ServersTestBase.setUpClass(cls)\n+        ServersTest.setUpClass(cls)\n \n     @classmethod\n     def tearDownClass(cls):\n-        ServersTestBase.tearDownClass(cls)\n+        ServersTest.tearDownClass(cls)\n         super(ServersTestAutoDisk, cls).tearDownClass()\n \n \n @attr(type=\'positive\')\n-class ServersTestManualDisk(base.BaseCompTest, ServersTestBase):\n+class ServersTestManualDisk(base.BaseComputeTestJSON,\n+                            ServersTest):\n     @classmethod\n     def setUpClass(cls):\n         if not compute.DISK_CONFIG_ENABLED:\n@@ -147,23 +149,39 @@ class ServersTestManualDisk(base.BaseCompTest, ServersTestBase):\n             raise nose.SkipTest(msg)\n         super(ServersTestManualDisk, cls).setUpClass()\n         cls.disk_config = \'MANUAL\'\n-        ServersTestBase.setUpClass(cls)\n+        ServersTest.setUpClass(cls)\n \n     @classmethod\n     def tearDownClass(cls):\n-        ServersTestBase.tearDownClass(cls)\n+        ServersTest.tearDownClass(cls)\n         super(ServersTestManualDisk, cls).tearDownClass()\n \n \n @attr(type=\'smoke\')\n-class ServersTest(base.BaseCompTest, ServersTestBase):\n+class ServersTestJSON(base.BaseComputeTestJSON,\n+                      ServersTest):\n     @classmethod\n     def setUpClass(cls):\n-        super(ServersTest, cls).setUpClass()\n+        super(ServersTestJSON, cls).setUpClass()\n         cls.disk_config = None\n-        ServersTestBase.setUpClass(cls)\n+        ServersTest.setUpClass(cls)\n \n     @classmethod\n     def tearDownClass(cls):\n-        ServersTestBase.tearDownClass(cls)\n-        super(ServersTest, cls).tearDownClass()\n+        ServersTest.tearDownClass(cls)\n+        super(ServersTestJSON, cls).tearDownClass()\n+\n+\n+@attr(type=\'smoke\')\n+class ServersTestXML(base.BaseComputeTestXML,\n+                     ServersTest):\n+    @classmethod\n+    def setUpClass(cls):\n+        super(ServersTestXML, cls).setUpClass()\n+        cls.disk_config = None\n+        ServersTest.setUpClass(cls)\n+\n+    @classmethod\n+    def tearDownClass(cls):\n+        ServersTest.tearDownClass(cls)\n+        super(ServersTestXML, cls).tearDownClass()\ndiff --git a/tempest/tests/compute/servers/test_disk_config.py b/tempest/tests/compute/servers/test_disk_config.py\nindex ff04bbccb..490156bbe 100644\n--- a/tempest/tests/compute/servers/test_disk_config.py\n+++ b/tempest/tests/compute/servers/test_disk_config.py\n@@ -22,10 +22,10 @@ import unittest2 as unittest\n from tempest.common.utils.data_utils import rand_name\n from tempest import exceptions\n from tempest.tests import compute\n-from tempest.tests.compute.base import BaseCompTest\n+from tempest.tests.compute.base import BaseComputeTest\n \n \n-class TestServerDiskConfig(BaseCompTest):\n+class TestServerDiskConfig(BaseComputeTest):\n \n     @classmethod\n     def setUpClass(cls):\ndiff --git a/tempest/tests/compute/servers/test_list_server_filters.py b/tempest/tests/compute/servers/test_list_server_filters.py\nindex 1f3e48b59..d943e5d1d 100644\n--- a/tempest/tests/compute/servers/test_list_server_filters.py\n+++ b/tempest/tests/compute/servers/test_list_server_filters.py\n@@ -27,7 +27,7 @@ from tempest.tests.compute import base\n from tempest.tests import utils\n \n \n-class ListServerFiltersTestBase(object):\n+class ListServerFiltersTest(object):\n \n     @staticmethod\n     def setUpClass(cls):\n@@ -204,13 +204,27 @@ class ListServerFiltersTestBase(object):\n         return min_detail\n \n \n-class ListServerFiltersTest(base.BaseCompTest, ListServerFiltersTestBase):\n+class ListServerFiltersTestJSON(base.BaseComputeTestJSON,\n+                                ListServerFiltersTest):\n     @classmethod\n     def setUpClass(cls):\n-        super(ListServerFiltersTest, cls).setUpClass()\n-        ListServerFiltersTestBase.setUpClass(cls)\n+        super(ListServerFiltersTestJSON, cls).setUpClass()\n+        ListServerFiltersTest.setUpClass(cls)\n \n     @classmethod\n     def tearDownClass(cls):\n-        super(ListServerFiltersTest, cls).tearDownClass()\n-        ListServerFiltersTestBase.tearDownClass(cls)\n+        super(ListServerFiltersTestJSON, cls).tearDownClass()\n+        ListServerFiltersTest.tearDownClass(cls)\n+\n+\n+class ListServerFiltersTestXML(base.BaseComputeTestXML,\n+                               ListServerFiltersTest):\n+    @classmethod\n+    def setUpClass(cls):\n+        super(ListServerFiltersTestXML, cls).setUpClass()\n+        ListServerFiltersTest.setUpClass(cls)\n+\n+    @classmethod\n+    def tearDownClass(cls):\n+        super(ListServerFiltersTestXML, cls).tearDownClass()\n+        ListServerFiltersTest.tearDownClass(cls)\ndiff --git a/tempest/tests/compute/servers/test_list_servers_negative.py b/tempest/tests/compute/servers/test_list_servers_negative.py\nindex 66441c475..035ffe876 100644\n--- a/tempest/tests/compute/servers/test_list_servers_negative.py\n+++ b/tempest/tests/compute/servers/test_list_servers_negative.py\n@@ -25,10 +25,10 @@ from tempest import clients\n from tempest.common.utils.data_utils import rand_name\n from tempest import exceptions\n from tempest.tests import compute\n-from tempest.tests.compute.base import BaseCompTest\n+from tempest.tests.compute.base import BaseComputeTest\n \n \n-class ListServersNegativeTest(BaseCompTest):\n+class ListServersNegativeTest(BaseComputeTest):\n \n     @classmethod\n     def setUpClass(cls):\ndiff --git a/tempest/tests/compute/servers/test_server_actions.py b/tempest/tests/compute/servers/test_server_actions.py\nindex a2c5d5c1c..2fe84644b 100644\n--- a/tempest/tests/compute/servers/test_server_actions.py\n+++ b/tempest/tests/compute/servers/test_server_actions.py\n@@ -193,9 +193,10 @@ class ServerActionsTestBase(object):\n                       \' be allowed\')\n \n \n-class ServerActionsTest(base.BaseCompTest, ServerActionsTestBase):\n+class ServerActionsTestXML(base.BaseComputeTestXML,\n+                           ServerActionsTestBase):\n     def setUp(self):\n-        super(ServerActionsTest, self).setUp()\n+        super(ServerActionsTestXML, self).setUp()\n         # Check if the server is in a clean state after test\n         try:\n             self.client.wait_for_server_status(self.server_id, \'ACTIVE\')\n@@ -211,7 +212,7 @@ class ServerActionsTest(base.BaseCompTest, ServerActionsTestBase):\n \n     @classmethod\n     def setUpClass(cls):\n-        super(ServerActionsTest, cls).setUpClass()\n+        super(ServerActionsTestXML, cls).setUpClass()\n         cls.client = cls.servers_client\n         cls.name = rand_name(\'server\')\n         resp, server = cls.create_server_with_extras(cls.name,\n@@ -224,4 +225,39 @@ class ServerActionsTest(base.BaseCompTest, ServerActionsTestBase):\n     @classmethod\n     def tearDownClass(cls):\n         cls.clear_servers()\n-        super(ServerActionsTest, cls).tearDownClass()\n+        super(ServerActionsTestXML, cls).tearDownClass()\n+\n+\n+class ServerActionsTestJSON(base.BaseComputeTestJSON,\n+                            ServerActionsTestBase):\n+    def setUp(self):\n+        super(ServerActionsTestJSON, self).setUp()\n+        # Check if the server is in a clean state after test\n+        try:\n+            self.client.wait_for_server_status(self.server_id, \'ACTIVE\')\n+        except exceptions:\n+            # Rebuild server if something happened to it during a test\n+            self.clear_servers()\n+            resp, server = self.create_server_with_extras(self.name,\n+                                                          self.image_ref,\n+                                                          self.flavor_ref)\n+            self.server_id = server[\'id\']\n+            self.password = server[\'adminPass\']\n+            self.client.wait_for_server_status(self.server_id, \'ACTIVE\')\n+\n+    @classmethod\n+    def setUpClass(cls):\n+        super(ServerActionsTestJSON, cls).setUpClass()\n+        cls.client = cls.servers_client\n+        cls.name = rand_name(\'server\')\n+        resp, server = cls.create_server_with_extras(cls.name,\n+                                                     cls.image_ref,\n+                                                     cls.flavor_ref)\n+        cls.server_id = server[\'id\']\n+        cls.password = server[\'adminPass\']\n+        cls.client.wait_for_server_status(cls.server_id, \'ACTIVE\')\n+\n+    @classmethod\n+    def tearDownClass(cls):\n+        cls.clear_servers()\n+        super(ServerActionsTestJSON, cls).tearDownClass()\ndiff --git a/tempest/tests/compute/servers/test_server_addresses.py b/tempest/tests/compute/servers/test_server_addresses.py\nindex ee0dbb01d..6e819a2d0 100644\n--- a/tempest/tests/compute/servers/test_server_addresses.py\n+++ b/tempest/tests/compute/servers/test_server_addresses.py\n@@ -19,10 +19,10 @@ from nose.plugins.attrib import attr\n \n from tempest.common.utils.data_utils import rand_name\n from tempest import exceptions\n-from tempest.tests.compute.base import BaseCompTest\n+from tempest.tests.compute.base import BaseComputeTest\n \n \n-class ServerAddressesTest(BaseCompTest):\n+class ServerAddressesTest(BaseComputeTest):\n \n     @classmethod\n     def setUpClass(cls):\ndiff --git a/tempest/tests/compute/servers/test_server_metadata.py b/tempest/tests/compute/servers/test_server_metadata.py\nindex b1e82bece..6c44c3cce 100644\n--- a/tempest/tests/compute/servers/test_server_metadata.py\n+++ b/tempest/tests/compute/servers/test_server_metadata.py\n@@ -19,10 +19,10 @@ from nose.plugins.attrib import attr\n \n from tempest.common.utils.data_utils import rand_name\n from tempest import exceptions\n-from tempest.tests.compute.base import BaseCompTest\n+from tempest.tests.compute.base import BaseComputeTest\n \n \n-class ServerMetadataTest(BaseCompTest):\n+class ServerMetadataTest(BaseComputeTest):\n \n     @classmethod\n     def setUpClass(cls):\ndiff --git a/tempest/tests/compute/servers/test_server_personality.py b/tempest/tests/compute/servers/test_server_personality.py\nindex 23222b513..6ea09598c 100644\n--- a/tempest/tests/compute/servers/test_server_personality.py\n+++ b/tempest/tests/compute/servers/test_server_personality.py\n@@ -78,9 +78,21 @@ class ServerPersonalityTestBase(object):\n             self.client.delete_server(server[\'id\'])\n \n \n-class ServerPersonalityTest(base.BaseCompTest, ServerPersonalityTestBase):\n+class ServerPersonalityTestXML(base.BaseComputeTestXML,\n+                               ServerPersonalityTestBase):\n     @classmethod\n     def setUpClass(cls):\n-        super(ServerPersonalityTest, cls).setUpClass()\n+        cls._interface = "xml"\n+        super(ServerPersonalityTestXML, cls).setUpClass()\n+        cls.client = cls.servers_client\n+        cls.user_client = cls.limits_client\n+\n+\n+class ServerPersonalityTestJSON(base.BaseComputeTestJSON,\n+                                ServerPersonalityTestBase):\n+    @classmethod\n+    def setUpClass(cls):\n+        cls._interface = "json"\n+        super(ServerPersonalityTestJSON, cls).setUpClass()\n         cls.client = cls.servers_client\n         cls.user_client = cls.limits_client\ndiff --git a/tempest/tests/compute/servers/test_servers.py b/tempest/tests/compute/servers/test_servers.py\nindex 5829835e2..3566ef4a7 100644\n--- a/tempest/tests/compute/servers/test_servers.py\n+++ b/tempest/tests/compute/servers/test_servers.py\n@@ -156,10 +156,10 @@ class ServersTestBase(object):\n         self.assertEqual(\'204\', resp[\'status\'])\n \n \n-class ServersTest(base.BaseCompTest, ServersTestBase):\n+class ServersTestJSON(base.BaseComputeTestJSON, ServersTestBase):\n     @classmethod\n     def setUpClass(cls):\n-        super(ServersTest, cls).setUpClass()\n+        super(ServersTestJSON, cls).setUpClass()\n         cls.client = cls.servers_client\n \n     def tearDown(self):\n@@ -169,4 +169,20 @@ class ServersTest(base.BaseCompTest, ServersTestBase):\n         # memory\n         self.clear_servers()\n \n-        super(ServersTest, self).tearDown()\n+        super(ServersTestJSON, self).tearDown()\n+\n+\n+class ServersTestXML(base.BaseComputeTestXML, ServersTestBase):\n+    @classmethod\n+    def setUpClass(cls):\n+        super(ServersTestXML, cls).setUpClass()\n+        cls.client = cls.servers_client\n+\n+    def tearDown(self):\n+        # clean up any remaining servers and wait for them to fully\n+        # delete. This is done because delete calls are async, and if\n+        # deletes are running slow we could very well overrun system\n+        # memory\n+        self.clear_servers()\n+\n+        super(ServersTestXML, self).tearDown()\ndiff --git a/tempest/tests/compute/servers/test_servers_negative.py b/tempest/tests/compute/servers/test_servers_negative.py\nindex 4ff7f1284..dfe594433 100644\n--- a/tempest/tests/compute/servers/test_servers_negative.py\n+++ b/tempest/tests/compute/servers/test_servers_negative.py\n@@ -24,10 +24,10 @@ import unittest2 as unittest\n from tempest import clients\n from tempest.common.utils.data_utils import rand_name\n from tempest import exceptions\n-from tempest.tests.compute.base import BaseCompTest\n+from tempest.tests.compute.base import BaseComputeTest\n \n \n-class ServersNegativeTest(BaseCompTest):\n+class ServersNegativeTest(BaseComputeTest):\n \n     @classmethod\n     def setUpClass(cls):\ndiff --git a/tempest/tests/compute/test_authorization.py b/tempest/tests/compute/test_authorization.py\nindex ff38eee95..78661d1bf 100644\n--- a/tempest/tests/compute/test_authorization.py\n+++ b/tempest/tests/compute/test_authorization.py\n@@ -25,10 +25,10 @@ from tempest.common.utils.data_utils import parse_image_id\n from tempest.common.utils.data_utils import rand_name\n from tempest import exceptions\n from tempest.tests import compute\n-from tempest.tests.compute.base import BaseCompTest\n+from tempest.tests.compute.base import BaseComputeTest\n \n \n-class AuthorizationTest(BaseCompTest):\n+class AuthorizationTest(BaseComputeTest):\n \n     @classmethod\n     def setUpClass(cls):\ndiff --git a/tempest/tests/compute/test_extensions.py b/tempest/tests/compute/test_extensions.py\nindex dc141381b..829e2956b 100644\n--- a/tempest/tests/compute/test_extensions.py\n+++ b/tempest/tests/compute/test_extensions.py\n@@ -30,9 +30,17 @@ class ExtensionsTestBase(object):\n         self.assertEqual(200, resp.status)\n \n \n-class ExtensionsTest(base.BaseCompTest):\n+class ExtensionsTestJSON(base.BaseComputeTest, ExtensionsTestBase):\n \n     @classmethod\n     def setUpClass(cls):\n-        super(ExtensionsTest, cls).setUpClass()\n+        super(ExtensionsTestJSON, cls).setUpClass()\n+        cls.client = cls.extensions_client\n+\n+\n+class ExtensionsTestXML(base.BaseComputeTestXML, ExtensionsTestBase):\n+\n+    @classmethod\n+    def setUpClass(cls):\n+        super(ExtensionsTestXML, cls).setUpClass()\n         cls.client = cls.extensions_client\ndiff --git a/tempest/tests/compute/test_live_block_migration.py b/tempest/tests/compute/test_live_block_migration.py\nindex 53f3ac054..915868c11 100644\n--- a/tempest/tests/compute/test_live_block_migration.py\n+++ b/tempest/tests/compute/test_live_block_migration.py\n@@ -31,7 +31,7 @@ from tempest.tests.compute import base\n \n \n @attr(category=\'live-migration\')\n-class LiveBlockMigrationTest(base.BaseCompTest):\n+class LiveBlockMigrationTest(base.BaseComputeTest):\n \n     live_migration_available = (\n         config.TempestConfig().compute.live_migration_available)\ndiff --git a/tempest/tests/compute/test_quotas.py b/tempest/tests/compute/test_quotas.py\nindex 5d062734c..3dc251576 100644\n--- a/tempest/tests/compute/test_quotas.py\n+++ b/tempest/tests/compute/test_quotas.py\n@@ -17,10 +17,10 @@\n \n from nose.plugins.attrib import attr\n \n-from tempest.tests.compute.base import BaseCompTest\n+from tempest.tests.compute.base import BaseComputeTest\n \n \n-class QuotasTest(BaseCompTest):\n+class QuotasTest(BaseComputeTest):\n \n     @classmethod\n     def setUpClass(cls):\ndiff --git a/tempest/tests/compute/volumes/test_attach_volume.py b/tempest/tests/compute/volumes/test_attach_volume.py\nindex 792bedff6..958102600 100644\n--- a/tempest/tests/compute/volumes/test_attach_volume.py\n+++ b/tempest/tests/compute/volumes/test_attach_volume.py\n@@ -107,8 +107,17 @@ class AttachVolumeTest(object):\n             self._delete(server[\'id\'], volume[\'id\'])\n \n \n-class TestAttachVolume(base.BaseCompTest, AttachVolumeTest):\n+class TestAttachVolumeJSON(base.BaseComputeTestJSON,\n+                           AttachVolumeTest):\n     @classmethod\n     def setUpClass(cls):\n-        super(TestAttachVolume, cls).setUpClass()\n+        super(TestAttachVolumeJSON, cls).setUpClass()\n+        AttachVolumeTest.setUpClass(cls)\n+\n+\n+class TestAttachVolumeXML(base.BaseComputeTestXML,\n+                          AttachVolumeTest):\n+    @classmethod\n+    def setUpClass(cls):\n+        super(TestAttachVolumeXML, cls).setUpClass()\n         AttachVolumeTest.setUpClass(cls)\ndiff --git a/tempest/tests/compute/volumes/test_volumes_get.py b/tempest/tests/compute/volumes/test_volumes_get.py\nindex 45f8053a7..afb00cd1e 100644\n--- a/tempest/tests/compute/volumes/test_volumes_get.py\n+++ b/tempest/tests/compute/volumes/test_volumes_get.py\n@@ -28,7 +28,7 @@ class VolumesGetTestBase(object):\n         # CREATE, GET, DELETE Volume\n         volume = None\n         try:\n-            v_name = rand_name(\'Volume-\')\n+            v_name = rand_name(\'Volume-%s-\') % self._interface\n             metadata = {\'Type\': \'work\'}\n             #Create volume\n             resp, volume = self.client.create_volume(size=1,\n@@ -95,8 +95,17 @@ class VolumesGetTestBase(object):\n             self.client.wait_for_resource_deletion(volume[\'id\'])\n \n \n-class VolumesGetTest(base.BaseCompTest, VolumesGetTestBase):\n+class VolumesGetTestXML(base.BaseComputeTestXML, VolumesGetTestBase):\n+    @classmethod\n+    def setUpClass(cls):\n+        cls._interface = "xml"\n+        super(VolumesGetTestXML, cls).setUpClass()\n+        cls.client = cls.volumes_extensions_client\n+\n+\n+class VolumesGetTestJSON(base.BaseComputeTestJSON, VolumesGetTestBase):\n     @classmethod\n     def setUpClass(cls):\n-        super(VolumesGetTest, cls).setUpClass()\n+        cls._interface = "json"\n+        super(VolumesGetTestJSON, cls).setUpClass()\n         cls.client = cls.volumes_extensions_client\ndiff --git a/tempest/tests/compute/volumes/test_volumes_list.py b/tempest/tests/compute/volumes/test_volumes_list.py\nindex 6ec03ae56..fef9c8d29 100644\n--- a/tempest/tests/compute/volumes/test_volumes_list.py\n+++ b/tempest/tests/compute/volumes/test_volumes_list.py\n@@ -62,10 +62,57 @@ class VolumesTestBase(object):\n                                    for m_vol in missing_volumes))\n \n \n-class VolumesTest(base.BaseCompTest, VolumesTestBase):\n+class VolumesTestXML(base.BaseComputeTestXML, VolumesTestBase):\n     @classmethod\n     def setUpClass(cls):\n-        super(VolumesTest, cls).setUpClass()\n+        cls._interface = \'xml\'\n+        super(VolumesTestXML, cls).setUpClass()\n+        cls.client = cls.volumes_extensions_client\n+        # Create 3 Volumes\n+        cls.volume_list = list()\n+        cls.volume_id_list = list()\n+        for i in range(3):\n+            v_name = rand_name(\'volume\')\n+            metadata = {\'Type\': \'work\'}\n+            v_name += cls._interface\n+            try:\n+                resp, volume = cls.client.create_volume(size=1,\n+                                                        display_name=v_name,\n+                                                        metadata=metadata)\n+                cls.client.wait_for_volume_status(volume[\'id\'], \'available\')\n+                resp, volume = cls.client.get_volume(volume[\'id\'])\n+                cls.volume_list.append(volume)\n+                cls.volume_id_list.append(volume[\'id\'])\n+            except Exception:\n+                if cls.volume_list:\n+                    # We could not create all the volumes, though we were able\n+                    # to create *some* of the volumes. This is typically\n+                    # because the backing file size of the volume group is\n+                    # too small. So, here, we clean up whatever we did manage\n+                    # to create and raise a SkipTest\n+                    for volume in cls.volume_list:\n+                        cls.client.delete_volume(volume)\n+                    msg = ("Failed to create ALL necessary volumes to run "\n+                           "test. This typically means that the backing file "\n+                           "size of the nova-volumes group is too small to "\n+                           "create the 3 volumes needed by this test case")\n+                    raise nose.SkipTest(msg)\n+                raise\n+\n+    @classmethod\n+    def tearDownClass(cls):\n+        # Delete the created Volumes\n+        for volume in cls.volume_list:\n+            resp, _ = cls.client.delete_volume(volume[\'id\'])\n+            cls.client.wait_for_resource_deletion(volume[\'id\'])\n+        super(VolumesTestXML, cls).tearDownClass()\n+\n+\n+class VolumesTestJSON(base.BaseComputeTestJSON, VolumesTestBase):\n+    @classmethod\n+    def setUpClass(cls):\n+        cls._interface = \'json\'\n+        super(VolumesTestJSON, cls).setUpClass()\n         cls.client = cls.volumes_extensions_client\n         # Create 3 Volumes\n         cls.volume_list = []\n@@ -73,6 +120,7 @@ class VolumesTest(base.BaseCompTest, VolumesTestBase):\n         for i in range(3):\n             v_name = rand_name(\'volume-%s\')\n             metadata = {\'Type\': \'work\'}\n+            v_name += cls._interface\n             try:\n                 resp, volume = cls.client.create_volume(size=1,\n                                                         display_name=v_name,\n@@ -103,4 +151,4 @@ class VolumesTest(base.BaseCompTest, VolumesTestBase):\n         for volume in cls.volume_list:\n             resp, _ = cls.client.delete_volume(volume[\'id\'])\n             cls.client.wait_for_resource_deletion(volume[\'id\'])\n-        super(VolumesTest, cls).tearDownClass()\n+        super(VolumesTestJSON, cls).tearDownClass()\ndiff --git a/tempest/tests/compute/volumes/test_volumes_negative.py b/tempest/tests/compute/volumes/test_volumes_negative.py\nindex bdd6b2f9b..d2ad30e29 100644\n--- a/tempest/tests/compute/volumes/test_volumes_negative.py\n+++ b/tempest/tests/compute/volumes/test_volumes_negative.py\n@@ -124,8 +124,19 @@ class VolumesNegativeTestBase(object):\n         resp, volume = self.client.delete_volume(\'\')\n \n \n-class VolumesNegativeTest(base.BaseCompTest, VolumesNegativeTestBase):\n+class VolumesNegativeTestXML(base.BaseComputeTestXML,\n+                             VolumesNegativeTestBase):\n     @classmethod\n     def setUpClass(cls):\n-        super(VolumesNegativeTest, cls).setUpClass()\n+        cls._interface = "xml"\n+        super(VolumesNegativeTestXML, cls).setUpClass()\n+        cls.client = cls.volumes_extensions_client\n+\n+\n+class VolumesNegativeTestJSON(base.BaseComputeTestJSON,\n+                              VolumesNegativeTestBase):\n+    @classmethod\n+    def setUpClass(cls):\n+        cls._interface = "json"\n+        super(VolumesNegativeTestJSON, cls).setUpClass()\n         cls.client = cls.volumes_extensions_client\ndiff --git a/tempest/tests/identity/admin/test_roles.py b/tempest/tests/identity/admin/test_roles.py\nindex 5ebf2ae5e..f0dd8d9b4 100644\n--- a/tempest/tests/identity/admin/test_roles.py\n+++ b/tempest/tests/identity/admin/test_roles.py\n@@ -100,10 +100,21 @@ class RolesTestBase(object):\n         self.client.delete_role(role1_id)\n \n \n-class RolesTest(base.BaseIdentityAdminTest, RolesTestBase):\n+class RolesTestJSON(base.BaseIdentityAdminTestJSON,\n+                    RolesTestBase):\n+\n+    @classmethod\n+    def setUpClass(cls):\n+        super(RolesTestJSON, cls).setUpClass()\n+        RolesTestBase.setUpClass(cls)\n+\n+\n+class RolesTestXML(base.BaseIdentityAdminTestXML,\n+                   RolesTestBase):\n+\n     @classmethod\n     def setUpClass(cls):\n-        super(RolesTest, cls).setUpClass()\n+        super(RolesTestXML, cls).setUpClass()\n         RolesTestBase.setUpClass(cls)\n \n \n@@ -253,8 +264,17 @@ class UserRolesTestBase(RolesTestBase):\n                           tenant[\'id\'], \'junk-role-aabbcc11\')\n \n \n-class UserRolesTest(RolesTest, UserRolesTestBase):\n+class UserRolesTestJSON(RolesTestJSON,\n+                        UserRolesTestBase):\n+\n+    @classmethod\n+    def setUpClass(cls):\n+        super(UserRolesTestJSON, cls).setUpClass()\n+\n+\n+class UserRolesTestXML(RolesTestXML,\n+                       UserRolesTestBase):\n \n     @classmethod\n     def setUpClass(cls):\n-        super(UserRolesTest, cls).setUpClass()\n+        super(UserRolesTestXML, cls).setUpClass()\ndiff --git a/tempest/tests/identity/admin/test_services.py b/tempest/tests/identity/admin/test_services.py\nindex 7d6cd2ac6..30dfeb051 100644\n--- a/tempest/tests/identity/admin/test_services.py\n+++ b/tempest/tests/identity/admin/test_services.py\n@@ -18,12 +18,9 @@\n import nose\n \n from tempest.common.utils.data_utils import rand_name\n-from tempest import config\n from tempest import exceptions\n from tempest.tests.identity import base\n \n-CONF = config.TempestConfig()\n-\n \n class ServicesTestBase(object):\n \n@@ -68,9 +65,15 @@ class ServicesTestBase(object):\n                               service_data[\'id\'])\n \n \n-class ServicesTest(base.BaseIdentityAdminTest, ServicesTestBase):\n+class ServicesTestJSON(base.BaseIdentityAdminTestJSON, ServicesTestBase):\n+    @classmethod\n+    def setUpClass(cls):\n+        super(ServicesTestJSON, cls).setUpClass()\n+\n+\n+class ServicesTestXML(base.BaseIdentityAdminTestXML,\n+                      ServicesTestBase):\n     @classmethod\n     def setUpClass(cls):\n-        super(ServicesTest, cls).setUpClass()\n-        if CONF.general.use_xml:\n-            raise nose.SkipTest("Skipping until Bug #1061738 resolved")\n+        super(ServicesTestXML, cls).setUpClass()\n+        raise nose.SkipTest("Skipping until Bug #1061738 resolved")\ndiff --git a/tempest/tests/identity/admin/test_tenants.py b/tempest/tests/identity/admin/test_tenants.py\nindex b6678b829..578af4a54 100644\n--- a/tempest/tests/identity/admin/test_tenants.py\n+++ b/tempest/tests/identity/admin/test_tenants.py\n@@ -274,8 +274,16 @@ class TenantsTestBase(object):\n         self.data.tenants.remove(tenant)\n \n \n-class TenantsTest(base.BaseIdentityAdminTest, TenantsTestBase):\n+class TenantsTestJSON(base.BaseIdentityAdminTestJSON,\n+                      TenantsTestBase):\n \n     @classmethod\n     def setUpClass(cls):\n-        super(TenantsTest, cls).setUpClass()\n+        super(TenantsTestJSON, cls).setUpClass()\n+\n+\n+class TenantsTestXML(base.BaseIdentityAdminTestXML, TenantsTestBase):\n+\n+    @classmethod\n+    def setUpClass(cls):\n+        super(TenantsTestXML, cls).setUpClass()\ndiff --git a/tempest/tests/identity/admin/test_users.py b/tempest/tests/identity/admin/test_users.py\nindex 064f9f8ba..7ad932b56 100644\n--- a/tempest/tests/identity/admin/test_users.py\n+++ b/tempest/tests/identity/admin/test_users.py\n@@ -329,7 +329,14 @@ class UsersTestBase(object):\n                       \'tenant ids %s\' % fail)\n \n \n-class UsersTest(base.BaseIdentityAdminTest, UsersTestBase):\n+class UsersTestJSON(base.BaseIdentityAdminTestJSON,\n+                    UsersTestBase):\n     @classmethod\n     def setUpClass(cls):\n-        super(UsersTest, cls).setUpClass()\n+        super(UsersTestJSON, cls).setUpClass()\n+\n+\n+class UsersTestXML(base.BaseIdentityAdminTestXML, UsersTestBase):\n+    @classmethod\n+    def setUpClass(cls):\n+        super(UsersTestXML, cls).setUpClass()\ndiff --git a/tempest/tests/identity/base.py b/tempest/tests/identity/base.py\nindex a75d83061..8fee7ef2e 100644\n--- a/tempest/tests/identity/base.py\n+++ b/tempest/tests/identity/base.py\n@@ -26,7 +26,7 @@ class BaseIdAdminTest(unittest.TestCase):\n \n     @classmethod\n     def setUpClass(cls):\n-        os = clients.IdentityManager()\n+        os = clients.IdentityManager(interface=cls._interface)\n         cls.client = os.admin_client\n         cls.token_client = os.token_client\n \n@@ -35,7 +35,7 @@ class BaseIdAdminTest(unittest.TestCase):\n \n         cls.data = DataGenerator(cls.client)\n \n-        os = clients.IdentityNaManager()\n+        os = clients.IdentityNaManager(interface=cls._interface)\n         cls.non_admin_client = os.admin_client\n \n     @classmethod\n@@ -69,10 +69,20 @@ class BaseIdAdminTest(unittest.TestCase):\n             return role[0]\n \n \n-class BaseIdentityAdminTest(BaseIdAdminTest):\n+class BaseIdentityAdminTestJSON(BaseIdAdminTest):\n     @classmethod\n     def setUpClass(cls):\n-        super(BaseIdentityAdminTest, cls).setUpClass()\n+        cls._interface = "json"\n+        super(BaseIdentityAdminTestJSON, cls).setUpClass()\n+\n+BaseIdentityAdminTest = BaseIdentityAdminTestJSON\n+\n+\n+class BaseIdentityAdminTestXML(BaseIdAdminTest):\n+    @classmethod\n+    def setUpClass(cls):\n+        cls._interface = "xml"\n+        super(BaseIdentityAdminTestXML, cls).setUpClass()\n \n \n class DataGenerator(object):\ndiff --git a/tempest/tests/volume/admin/base.py b/tempest/tests/volume/admin/base.py\nindex 38b1e5b70..d35efbc10 100644\n--- a/tempest/tests/volume/admin/base.py\n+++ b/tempest/tests/volume/admin/base.py\n@@ -42,15 +42,26 @@ class BaseVolumeAdminTest(BaseVolumeTest):\n                    "in configuration.")\n             raise nose.SkipTest(msg)\n \n-        if cls.config.general.use_xml:\n-            cls.client = volumes_types_xml_client.\\\n-            VolumeTypesClient(cls.config, cls.adm_user, cls.adm_pass,\n-                              cls.auth_url, cls.adm_tenant)\n-        else:\n-            cls.client = volume_types_json_client.\\\n-            VolumeTypesClientJSON(cls.config, cls.adm_user, cls.adm_pass,\n-                                  cls.auth_url, cls.adm_tenant)\n-\n     @classmethod\n     def tearDownClass(cls):\n         super(BaseVolumeAdminTest, cls).tearDownClass()\n+\n+\n+class BaseVolumeAdminTestJSON(BaseVolumeAdminTest):\n+    @classmethod\n+    def setUpClass(cls):\n+        cls._interface = "json"\n+        super(BaseVolumeAdminTestJSON, cls).setUpClass()\n+        cls.client = volume_types_json_client.\\\n+        VolumeTypesClientJSON(cls.config, cls.adm_user, cls.adm_pass,\n+                              cls.auth_url, cls.adm_tenant)\n+\n+\n+class BaseVolumeAdminTestXML(BaseVolumeAdminTest):\n+    @classmethod\n+    def setUpClass(cls):\n+        cls._interface = "xml"\n+        super(BaseVolumeAdminTestXML, cls).setUpClass()\n+        cls.client = volume_types_xml_client.\\\n+        VolumeTypesClientXML(cls.config, cls.adm_user, cls.adm_pass,\n+                             cls.auth_url, cls.adm_tenant)\ndiff --git a/tempest/tests/volume/admin/test_volume_types_extra_specs_negative.py b/tempest/tests/volume/admin/test_volume_types_extra_specs_negative.py\nindex a59f9d3e1..d139425b1 100644\n--- a/tempest/tests/volume/admin/test_volume_types_extra_specs_negative.py\n+++ b/tempest/tests/volume/admin/test_volume_types_extra_specs_negative.py\n@@ -23,7 +23,8 @@ from nose.tools import raises\n \n from tempest.common.utils.data_utils import rand_name\n from tempest import exceptions\n-from tempest.tests.volume.admin.base import BaseVolumeAdminTest\n+from tempest.tests.volume.admin.base import BaseVolumeAdminTestJSON\n+from tempest.tests.volume.admin.base import BaseVolumeAdminTestXML\n \n \n class ExtraSpecsNegativeTestBase():\n@@ -135,14 +136,29 @@ class ExtraSpecsNegativeTestBase():\n                                                 str(uuid.uuid4()))\n \n \n-class ExtraSpecsNegativeTest(BaseVolumeAdminTest, ExtraSpecsNegativeTestBase):\n+class ExtraSpecsNegativeTestXML(BaseVolumeAdminTestXML,\n+                                ExtraSpecsNegativeTestBase):\n \n     @classmethod\n     def setUpClass(cls):\n-        super(ExtraSpecsNegativeTest, cls).setUpClass()\n+        super(ExtraSpecsNegativeTestXML, cls).setUpClass()\n         ExtraSpecsNegativeTestBase.setUpClass(cls)\n \n     @classmethod\n     def tearDownClass(cls):\n-        super(ExtraSpecsNegativeTest, cls).tearDownClass()\n+        super(ExtraSpecsNegativeTestXML, cls).tearDownClass()\n+        ExtraSpecsNegativeTestBase.tearDownClass(cls)\n+\n+\n+class ExtraSpecsNegativeTestJSON(BaseVolumeAdminTestJSON,\n+                                 ExtraSpecsNegativeTestBase):\n+\n+    @classmethod\n+    def setUpClass(cls):\n+        super(ExtraSpecsNegativeTestJSON, cls).setUpClass()\n+        ExtraSpecsNegativeTestBase.setUpClass(cls)\n+\n+    @classmethod\n+    def tearDownClass(cls):\n+        super(ExtraSpecsNegativeTestJSON, cls).tearDownClass()\n         ExtraSpecsNegativeTestBase.tearDownClass(cls)\ndiff --git a/tempest/tests/volume/admin/test_volume_types_negative.py b/tempest/tests/volume/admin/test_volume_types_negative.py\nindex a7be74528..c2daef9c6 100644\n--- a/tempest/tests/volume/admin/test_volume_types_negative.py\n+++ b/tempest/tests/volume/admin/test_volume_types_negative.py\n@@ -22,7 +22,8 @@ from nose.plugins.attrib import attr\n from nose.tools import raises\n \n from tempest import exceptions\n-from tempest.tests.volume.admin.base import BaseVolumeAdminTest\n+from tempest.tests.volume.admin.base import BaseVolumeAdminTestJSON\n+from tempest.tests.volume.admin.base import BaseVolumeAdminTestXML\n \n \n class VolumeTypesNegativeTestBase():\n@@ -59,9 +60,17 @@ class VolumeTypesNegativeTestBase():\n         self.client.delete_volume_type(str(uuid.uuid4()))\n \n \n-class VolumesTypesNegativeTest(BaseVolumeAdminTest,\n-                               VolumeTypesNegativeTestBase):\n+class VolumesTypesNegativeTestXML(BaseVolumeAdminTestXML,\n+                                  VolumeTypesNegativeTestBase):\n     @classmethod\n     def setUpClass(cls):\n-        super(VolumesTypesNegativeTest, cls).setUpClass()\n+        super(VolumesTypesNegativeTestXML, cls).setUpClass()\n+        VolumeTypesNegativeTestBase.setUpClass(cls)\n+\n+\n+class VolumesTypesNegativeTestJSON(BaseVolumeAdminTestJSON,\n+                                   VolumeTypesNegativeTestBase):\n+    @classmethod\n+    def setUpClass(cls):\n+        super(VolumesTypesNegativeTestJSON, cls).setUpClass()\n         VolumeTypesNegativeTestBase.setUpClass(cls)\ndiff --git a/tempest/tests/volume/base.py b/tempest/tests/volume/base.py\nindex 9420d4388..8657db818 100644\n--- a/tempest/tests/volume/base.py\n+++ b/tempest/tests/volume/base.py\n@@ -146,3 +146,17 @@ class BaseVolumeTest(unittest.TestCase):\n                 condition()\n                 return\n             time.sleep(self.build_interval)\n+\n+\n+class BaseVolumeTestJSON(BaseVolumeTest):\n+    @classmethod\n+    def setUpClass(cls):\n+        cls._interface = "json"\n+        super(BaseVolumeTestJSON, cls).setUpClass()\n+\n+\n+class BaseVolumeTestXML(BaseVolumeTest):\n+    @classmethod\n+    def setUpClass(cls):\n+        cls._interface = "xml"\n+        super(BaseVolumeTestXML, cls).setUpClass()\ndiff --git a/tempest/tests/volume/test_volumes_get.py b/tempest/tests/volume/test_volumes_get.py\nindex 054f0a997..bc64ff482 100644\n--- a/tempest/tests/volume/test_volumes_get.py\n+++ b/tempest/tests/volume/test_volumes_get.py\n@@ -95,8 +95,17 @@ class VolumesGetTestBase(object):\n                 self.client.wait_for_resource_deletion(volume[\'id\'])\n \n \n-class VolumesGetTest(base.BaseVolumeTest, VolumesGetTestBase):\n+class VolumesGetTestXML(base.BaseVolumeTestXML, VolumesGetTestBase):\n     @classmethod\n     def setUpClass(cls):\n-        super(VolumesGetTest, cls).setUpClass()\n+        cls._interface = "xml"\n+        super(VolumesGetTestXML, cls).setUpClass()\n+        cls.client = cls.volumes_client\n+\n+\n+class VolumesGetTestJSON(base.BaseVolumeTestJSON, VolumesGetTestBase):\n+    @classmethod\n+    def setUpClass(cls):\n+        cls._interface = "json"\n+        super(VolumesGetTestJSON, cls).setUpClass()\n         cls.client = cls.volumes_client\ndiff --git a/tempest/tests/volume/test_volumes_list.py b/tempest/tests/volume/test_volumes_list.py\nindex 3f0bcee5a..2fc1353b9 100644\n--- a/tempest/tests/volume/test_volumes_list.py\n+++ b/tempest/tests/volume/test_volumes_list.py\n@@ -59,10 +59,11 @@ class VolumesListTestBase(object):\n                                    for m_vol in missing_vols))\n \n \n-class VolumeListTest(base.BaseVolumeTest, VolumesListTestBase):\n+class VolumeListTestXML(base.BaseVolumeTestXML, VolumesListTestBase):\n     @classmethod\n     def setUpClass(cls):\n-        super(VolumeListTest, cls).setUpClass()\n+        cls._interface = \'xml\'\n+        super(VolumeListTestXML, cls).setUpClass()\n         cls.client = cls.volumes_client\n \n         # Create 3 test volumes\n@@ -102,4 +103,51 @@ class VolumeListTest(base.BaseVolumeTest, VolumesListTestBase):\n         for volid in cls.volume_id_list:\n             resp, _ = cls.client.delete_volume(volid)\n             cls.client.wait_for_resource_deletion(volid)\n-        super(VolumeListTest, cls).tearDownClass()\n+        super(VolumeListTestXML, cls).tearDownClass()\n+\n+\n+class VolumeListTestJSON(base.BaseVolumeTestJSON, VolumesListTestBase):\n+    @classmethod\n+    def setUpClass(cls):\n+        cls._interface = \'json\'\n+        super(VolumeListTestJSON, cls).setUpClass()\n+        cls.client = cls.volumes_client\n+\n+        # Create 3 test volumes\n+        cls.volume_list = []\n+        cls.volume_id_list = []\n+        for i in range(3):\n+            v_name = rand_name(\'volume\')\n+            metadata = {\'Type\': \'work\'}\n+            try:\n+                resp, volume = cls.client.create_volume(size=1,\n+                                                        display_name=v_name,\n+                                                        metadata=metadata)\n+                cls.client.wait_for_volume_status(volume[\'id\'], \'available\')\n+                resp, volume = cls.client.get_volume(volume[\'id\'])\n+                cls.volume_list.append(volume)\n+                cls.volume_id_list.append(volume[\'id\'])\n+            except Exception:\n+                if cls.volume_list:\n+                    # We could not create all the volumes, though we were able\n+                    # to create *some* of the volumes. This is typically\n+                    # because the backing file size of the volume group is\n+                    # too small. So, here, we clean up whatever we did manage\n+                    # to create and raise a SkipTest\n+                    for volid in cls.volume_id_list:\n+                        cls.client.delete_volume(volid)\n+                        cls.client.wait_for_resource_deletion(volid)\n+                    msg = ("Failed to create ALL necessary volumes to run "\n+                           "test. This typically means that the backing file "\n+                           "size of the nova-volumes group is too small to "\n+                           "create the 3 volumes needed by this test case")\n+                    raise nose.SkipTest(msg)\n+                raise\n+\n+    @classmethod\n+    def tearDownClass(cls):\n+        # Delete the created volumes\n+        for volid in cls.volume_id_list:\n+            resp, _ = cls.client.delete_volume(volid)\n+            cls.client.wait_for_resource_deletion(volid)\n+        super(VolumeListTestJSON, cls).tearDownClass()\ndiff --git a/tempest/tests/volume/test_volumes_negative.py b/tempest/tests/volume/test_volumes_negative.py\nindex 0474eacb6..6bd700284 100644\n--- a/tempest/tests/volume/test_volumes_negative.py\n+++ b/tempest/tests/volume/test_volumes_negative.py\n@@ -114,8 +114,16 @@ class VolumesNegativeTestBase(object):\n         resp, volume = self.client.delete_volume(\'\')\n \n \n-class VolumesNegativeTest(base.BaseVolumeTest, VolumesNegativeTestBase):\n+class VolumesNegativeTestXML(base.BaseVolumeTestXML, VolumesNegativeTestBase):\n     @classmethod\n     def setUpClass(cls):\n-        super(VolumesNegativeTest, cls).setUpClass()\n+        super(VolumesNegativeTestXML, cls).setUpClass()\n+        cls.client = cls.volumes_client\n+\n+\n+class VolumesNegativeTestJSON(base.BaseVolumeTestJSON,\n+                              VolumesNegativeTestBase):\n+    @classmethod\n+    def setUpClass(cls):\n+        super(VolumesNegativeTestJSON, cls).setUpClass()\n         cls.client = cls.volumes_client\n', 'commit_subject': 'Revert "Split up XML and JSON testing."', 'repo_name': 'openstack/tempest', 'committer': {'name': 'Gerrit Code Review', 'email': '61e62b213a1a56f7695845df4fc372a10cb0a73e@openstack.org', 'time_sec': '1358544825', 'tz_offset': '0', 'date': {'seconds': '1358544825'}}, 'commit_tree': '6c1bfb00477f25de035e050bf94b7cba546231c2', 'commit_message': 'Revert "Split up XML and JSON testing."\n\nThis reverts commit 58dec9d45360a69192fc6ba43dddf5a597063972\n\nThis ended gating of the XML API without any real public deliberation.  It should be reverted, and a plan agreed upon with PTLs and the CI team.\n\nAlso, if we do decide to implement this, we should make the CI change _first_ so that we don\'t abruptly stop gating on something we should be testing.', 'language_name': 'Shell', 'license': 'apache-2.0', 'hunks': '@@ -461,20 +461,6 @@ def register_boto_opts(conf):\n     for opt in BotoConfig:\n         conf.register_opt(opt, group=\'boto\')\n \n-general_group = cfg.OptGroup(name=\'general\', title=\'General Tempest Options\')\n-\n-GeneralOpts = [\n-    cfg.BoolOpt(\'use_xml\',\n-                default=False,\n-                help="Use xml for the container format"),\n-]\n-\n-\n-def register_general_opts(conf):\n-    conf.register_group(general_group)\n-    for opt in GeneralOpts:\n-        conf.register_opt(opt, group=\'general\')\n-\n \n # TODO(jaypipes): Move this to a common utils (not data_utils...)\n def singleton(cls):\n@@ -532,7 +518,6 @@ class TempestConfig:\n         register_volume_opts(cfg.CONF)\n         register_object_storage_opts(cfg.CONF)\n         register_boto_opts(cfg.CONF)\n-        register_general_opts(cfg.CONF)\n         self.compute = cfg.CONF.compute\n         self.compute_admin = cfg.CONF[\'compute-admin\']\n         self.identity = cfg.CONF.identity\n@@ -543,4 +528,3 @@ class TempestConfig:\n         self.volume = cfg.CONF.volume\n         self.object_storage = cfg.CONF[\'object-storage\']\n         self.boto = cfg.CONF.boto\n-        self.general = cfg.CONF.general\n', 'addition_count': 0, 'deletion_count': 16, 'src_file': 'a/tempest/config.py', 'tgt_file': 'b/tempest/config.py', 'file_extension': '.py', 'before_file': '# Copyright 2012 OpenStack Foundation\n# All Rights Reserved.\n#\n#    Licensed under the Apache License, Version 2.0 (the "License"); you may\n#    not use this file except in compliance with the License. You may obtain\n#    a copy of the License at\n#\n#         http://www.apache.org/licenses/LICENSE-2.0\n#\n#    Unless required by applicable law or agreed to in writing, software\n#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n#    License for the specific language governing permissions and limitations\n#    under the License.\n\nimport os\nimport tempfile\n\nfrom oslo_concurrency import lockutils\nfrom oslo_config import cfg\nfrom oslo_config import types\nfrom oslo_log import log as logging\n\nfrom tempest.lib import exceptions\nfrom tempest.lib.services import clients\nfrom tempest.test_discover import plugins\n\n\n# TODO(marun) Replace use of oslo_config\'s global ConfigOpts\n# (cfg.CONF) instance with a local instance (cfg.ConfigOpts()) once\n# the cli tests move to the clients.  The cli tests rely on oslo\n# incubator modules that use the global cfg.CONF.\n_CONF = cfg.CONF\n\n\ndef register_opt_group(conf, opt_group, options):\n    if opt_group:\n        conf.register_group(opt_group)\n    for opt in options:\n        conf.register_opt(opt, group=getattr(opt_group, \'name\', None))\n\n\nauth_group = cfg.OptGroup(name=\'auth\',\n                          title="Options for authentication and credentials")\n\n\nAuthGroup = [\n    cfg.StrOpt(\'test_accounts_file\',\n               help="Path to the yaml file that contains the list of "\n                    "credentials to use for running tests. If used when "\n                    "running in parallel you have to make sure sufficient "\n                    "credentials are provided in the accounts file. For "\n                    "example if no tests with roles are being run it requires "\n                    "at least `2 * CONC` distinct accounts configured in "\n                    " the `test_accounts_file`, with CONC == the "\n                    "number of concurrent test processes."),\n    cfg.BoolOpt(\'use_dynamic_credentials\',\n                default=True,\n                help="Allows test cases to create/destroy projects and "\n                     "users. This option requires that OpenStack Identity "\n                     "API admin credentials are known. If false, isolated "\n                     "test cases and parallel execution, can still be "\n                     "achieved configuring a list of test accounts"),\n    cfg.ListOpt(\'tempest_roles\',\n                help="Roles to assign to all users created by tempest",\n                default=[]),\n    cfg.StrOpt(\'default_credentials_domain_name\',\n               default=\'Default\',\n               help="Default domain used when getting v3 credentials. "\n                    "This is the name keystone uses for v2 compatibility."),\n    cfg.BoolOpt(\'create_isolated_networks\',\n                default=True,\n                help="If use_dynamic_credentials is set to True and Neutron "\n                     "is enabled Tempest will try to create a usable network, "\n                     "subnet, and router when needed for each project it "\n                     "creates. However in some neutron configurations, like "\n                     "with VLAN provider networks, this doesn\'t work. So if "\n                     "set to False the isolated networks will not be created"),\n    cfg.StrOpt(\'admin_username\',\n               help="Username for an administrative user. This is needed for "\n                    "authenticating requests made by project isolation to "\n                    "create users and projects"),\n    cfg.StrOpt(\'admin_project_name\',\n               help="Project name to use for an administrative user. This is "\n                    "needed for authenticating requests made by project "\n                    "isolation to create users and projects"),\n    cfg.StrOpt(\'admin_password\',\n               help="Password to use for an administrative user. This is "\n                    "needed for authenticating requests made by project "\n                    "isolation to create users and projects",\n               secret=True),\n    cfg.StrOpt(\'admin_domain_name\',\n               default=\'Default\',\n               help="Admin domain name for authentication (Keystone V3). "\n                    "The same domain applies to user and project if "\n                    "admin_user_domain_name and admin_project_domain_name "\n                    "are not specified"),\n    cfg.StrOpt(\'admin_user_domain_name\',\n               help="Domain name that contains the admin user (Keystone V3). "\n                    "May be different from admin_project_domain_name and "\n                    "admin_domain_name"),\n    cfg.StrOpt(\'admin_project_domain_name\',\n               help="Domain name that contains the project given by "\n                    "admin_project_name (Keystone V3). May be different from "\n                    "admin_user_domain_name and admin_domain_name"),\n    cfg.StrOpt(\'admin_system\',\n               default=None,\n               help="The system scope on which an admin user has an admin "\n                    "role assignment, if any. Valid values are \'all\' or None. "\n                    "This must be set to \'all\' if using the "\n                    "[oslo_policy]/enforce_scope=true option for the "\n                    "identity service."),\n]\n\nidentity_group = cfg.OptGroup(name=\'identity\',\n                              title="Keystone Configuration Options")\n\nIdentityGroup = [\n    cfg.StrOpt(\'catalog_type\',\n               default=\'identity\',\n               help="Catalog type of the Identity service."),\n    cfg.BoolOpt(\'disable_ssl_certificate_validation\',\n                default=False,\n                help="Set to True if using self-signed SSL certificates."),\n    cfg.StrOpt(\'ca_certificates_file\',\n               default=None,\n               help=\'Specify a CA bundle file to use in verifying a \'\n                    \'TLS (https) server certificate.\'),\n    cfg.StrOpt(\'uri\',\n               help="Full URI of the OpenStack Identity API (Keystone), v2"),\n    cfg.StrOpt(\'uri_v3\',\n               help=\'Full URI of the OpenStack Identity API (Keystone), v3\'),\n    cfg.StrOpt(\'auth_version\',\n               default=\'v3\',\n               help="Identity API version to be used for authentication "\n                    "for API tests."),\n    cfg.StrOpt(\'region\',\n               default=\'RegionOne\',\n               help="The identity region name to use. Also used as the other "\n                    "services\' region name unless they are set explicitly. "\n                    "If no such region is found in the service catalog, the "\n                    "first found one is used."),\n    cfg.StrOpt(\'v2_admin_endpoint_type\',\n               default=\'adminURL\',\n               choices=[\'public\', \'admin\', \'internal\',\n                        \'publicURL\', \'adminURL\', \'internalURL\'],\n               help="The admin endpoint type to use for OpenStack Identity "\n                    "(Keystone) API v2"),\n    cfg.StrOpt(\'v2_public_endpoint_type\',\n               default=\'publicURL\',\n               choices=[\'public\', \'admin\', \'internal\',\n                        \'publicURL\', \'adminURL\', \'internalURL\'],\n               help="The public endpoint type to use for OpenStack Identity "\n                    "(Keystone) API v2"),\n    cfg.StrOpt(\'v3_endpoint_type\',\n               default=\'adminURL\',\n               choices=[\'public\', \'admin\', \'internal\',\n                        \'publicURL\', \'adminURL\', \'internalURL\'],\n               help="The endpoint type to use for OpenStack Identity "\n                    "(Keystone) API v3. The default value adminURL is "\n                    "deprecated and will be modified to publicURL in "\n                    "the next release."),\n    cfg.StrOpt(\'admin_role\',\n               default=\'admin\',\n               help="Role required to administrate keystone."),\n    cfg.StrOpt(\'default_domain_id\',\n               default=\'default\',\n               help="ID of the default domain"),\n    cfg.BoolOpt(\'admin_domain_scope\',\n                default=False,\n                help="Whether keystone identity v3 policy required "\n                     "a domain scoped token to use admin APIs"),\n    # Security Compliance (PCI-DSS)\n    cfg.IntOpt(\'user_lockout_failure_attempts\',\n               default=2,\n               help="The number of unsuccessful login attempts the user is "\n                    "allowed before having the account locked. This only "\n                    "takes effect when identity-feature-enabled."\n                    "security_compliance is set to \'True\'. For more details, "\n                    "refer to keystone config options keystone.conf:"\n                    "security_compliance.lockout_failure_attempts. "\n                    "This feature is disabled by default in keystone."),\n    cfg.IntOpt(\'user_lockout_duration\',\n               default=5,\n               help="The number of seconds a user account will remain "\n                    "locked. This only takes "\n                    "effect when identity-feature-enabled.security_compliance "\n                    "is set to \'True\'. For more details, refer to "\n                    "keystone config options "\n                    "keystone.conf:security_compliance.lockout_duration. "\n                    "Setting this option will have no effect unless you also "\n                    "set identity.user_lockout_failure_attempts."),\n    cfg.IntOpt(\'user_unique_last_password_count\',\n               default=2,\n               help="The number of passwords for a user that must be unique "\n                    "before an old password can be reused. This only takes "\n                    "effect when identity-feature-enabled.security_compliance "\n                    "is set to \'True\'. "\n                    "This config option corresponds to keystone.conf: "\n                    "security_compliance.unique_last_password_count, whose "\n                    "default value is 0 meaning disabling this feature. "\n                    "NOTE: This config option value must be same as "\n                    "keystone.conf: security_compliance.unique_last_password_"\n                    "count otherwise test might fail"\n               ),\n]\n\nservice_clients_group = cfg.OptGroup(name=\'service-clients\',\n                                     title="Service Clients Options")\n\nServiceClientsGroup = [\n    cfg.IntOpt(\'http_timeout\',\n               default=60,\n               help=\'Timeout in seconds to wait for the http request to \'\n                    \'return\'),\n    cfg.StrOpt(\'proxy_url\',\n               help=\'Specify an http proxy to use.\')\n]\n\nidentity_feature_group = cfg.OptGroup(name=\'identity-feature-enabled\',\n                                      title=\'Enabled Identity Features\')\n\nIdentityFeatureGroup = [\n    cfg.BoolOpt(\'trust\',\n                default=True,\n                help=\'Does the identity service have delegation and \'\n                     \'impersonation enabled\'),\n    cfg.BoolOpt(\'api_v2\',\n                default=False,\n                help=\'Is the v2 identity API enabled\',\n                deprecated_for_removal=True,\n                deprecated_reason=\'The identity v2.0 API was removed in the \'\n                                  \'Queens release. Tests that exercise the \'\n                                  \'v2.0 API will be removed from tempest in \'\n                                  \'the v22.0.0 release. They are kept only to \'\n                                  \'test stable branches.\'),\n    cfg.BoolOpt(\'api_v2_admin\',\n                default=True,\n                help="Is the v2 identity admin API available? This setting "\n                     "only applies if api_v2 is set to True."),\n    cfg.BoolOpt(\'api_v3\',\n                default=True,\n                help=\'Is the v3 identity API enabled\'),\n    cfg.ListOpt(\'api_extensions\',\n                default=[\'all\'],\n                help="A list of enabled identity extensions with a special "\n                     "entry all which indicates every extension is enabled. "\n                     "Empty list indicates all extensions are disabled. "\n                     "To get the list of extensions run: "\n                     "\'openstack extension list --identity\'"),\n    cfg.BoolOpt(\'domain_specific_drivers\',\n                default=False,\n                help=\'Are domain specific drivers enabled? \'\n                     \'This configuration value should be same as \'\n                     \'[identity]->domain_specific_drivers_enabled \'\n                     \'in keystone.conf.\'),\n    cfg.BoolOpt(\'security_compliance\',\n                default=False,\n                help=\'Does the environment have the security compliance \'\n                     \'settings enabled?\'),\n    cfg.BoolOpt(\'project_tags\',\n                default=True,\n                help=\'Is the project tags identity v3 API available?\',\n                deprecated_for_removal=True,\n                deprecated_reason=\'Project tags API is a default feature \'\n                                  \'since Queens\'),\n    cfg.BoolOpt(\'application_credentials\',\n                default=True,\n                help=\'Does the environment have application credentials \'\n                     \'enabled?\',\n                deprecated_for_removal=True,\n                deprecated_reason=\'Application credentials is a default \'\n                                  \'feature since Queens\'),\n    # Access rules for application credentials is a default feature in Train.\n    # This config option can removed once Stein is EOL.\n    cfg.BoolOpt(\'access_rules\',\n                default=False,\n                help=\'Does the environment have access rules enabled?\'),\n    cfg.BoolOpt(\'immutable_user_source\',\n                default=False,\n                help=\'Set to True if the environment has a read-only \'\n                     \'user source. This will skip all tests that attempt to \'\n                     \'create, delete, or modify users. This should not be set \'\n                     \'to True if using dynamic credentials\')\n]\n\ncompute_group = cfg.OptGroup(name=\'compute\',\n                             title=\'Compute Service Options\')\n\nComputeGroup = [\n    cfg.StrOpt(\'image_ref\',\n               help="Valid primary image reference to be used in tests. "\n                    "This is a required option"),\n    cfg.StrOpt(\'image_ref_alt\',\n               help="Valid secondary image reference to be used in tests. "\n                    "This is a required option, but if only one image is "\n                    "available duplicate the value of image_ref above"),\n    cfg.StrOpt(\'certified_image_ref\',\n               help="Valid image reference to be used in image certificate "\n                    "validation tests when enabled. This image must also "\n                    "have the required img_signature_* properties set. "\n                    "Additional details available within the following Nova "\n                    "documentation: https://docs.openstack.org/nova/latest/"\n                    "user/certificate-validation.html"),\n    cfg.ListOpt(\'certified_image_trusted_certs\',\n                help="A list of trusted certificates to be used when the "\n                     "image certificate validation compute feature is "\n                     "enabled."),\n    cfg.StrOpt(\'flavor_ref\',\n               default="1",\n               help="Valid primary flavor to use in tests."),\n    cfg.StrOpt(\'flavor_ref_alt\',\n               default="2",\n               help=\'Valid secondary flavor to be used in tests.\'),\n    cfg.IntOpt(\'build_interval\',\n               default=1,\n               help="Time in seconds between build status checks."),\n    cfg.IntOpt(\'build_timeout\',\n               default=300,\n               help="Timeout in seconds to wait for an instance to build. "\n                    "Other services that do not define build_timeout will "\n                    "inherit this value."),\n    cfg.IntOpt(\'ready_wait\',\n               default=0,\n               help="Additional wait time for clean state, when there is "\n                    "no OS-EXT-STS extension available"),\n    cfg.StrOpt(\'fixed_network_name\',\n               help="Name of the fixed network that is visible to all test "\n                    "projects. If multiple networks are available for a "\n                    "project, this is the network which will be used for "\n                    "creating servers if tempest does not create a network or "\n                    "a network is not specified elsewhere. It may be used for "\n                    "ssh validation only if floating IPs are disabled."),\n    cfg.StrOpt(\'catalog_type\',\n               default=\'compute\',\n               help="Catalog type of the Compute service."),\n    cfg.StrOpt(\'region\',\n               default=\'\',\n               help="The compute region name to use. If empty, the value "\n                    "of identity.region is used instead. If no such region "\n                    "is found in the service catalog, the first found one is "\n                    "used."),\n    cfg.StrOpt(\'endpoint_type\',\n               default=\'publicURL\',\n               choices=[\'public\', \'admin\', \'internal\',\n                        \'publicURL\', \'adminURL\', \'internalURL\'],\n               help="The endpoint type to use for the compute service."),\n    cfg.StrOpt(\'volume_device_name\',\n               default=\'vdb\',\n               help="Expected device name when a volume is attached to "\n                    "an instance. Not all hypervisors guarantee that they "\n                    "will respect the user defined device name, tests may "\n                    "fail if inappropriate device name is set."),\n    cfg.IntOpt(\'shelved_offload_time\',\n               default=0,\n               help=\'Time in seconds before a shelved instance is eligible \'\n                    \'for removing from a host.  -1 never offload, 0 offload \'\n                    \'when shelved. This configuration value should be same as \'\n                    \'nova.conf: DEFAULT.shelved_offload_time, and \'\n                    \'some tests will run for as long as the time.\'),\n    cfg.IntOpt(\'min_compute_nodes\',\n               default=1,\n               help=(\'The minimum number of compute nodes expected. This will \'\n                     \'be utilized by some multinode specific tests to ensure \'\n                     \'that requests match the expected size of the cluster \'\n                     \'you are testing with.\')),\n    cfg.StrOpt(\'hypervisor_type\',\n               default=None,\n               help="Hypervisor type of the test target on heterogeneous "\n                    "compute environment. The value can be \'QEMU\', \'xen\' or "\n                    "something."),\n    cfg.StrOpt(\'min_microversion\',\n               default=None,\n               help="Lower version of the test target microversion range. "\n                    "The format is \'X.Y\', where \'X\' and \'Y\' are int values. "\n                    "Tempest selects tests based on the range between "\n                    "min_microversion and max_microversion. "\n                    "If both values are not specified, Tempest avoids tests "\n                    "which require a microversion. Valid values are string "\n                    "with format \'X.Y\' or string \'latest\'"),\n    cfg.StrOpt(\'max_microversion\',\n               default=None,\n               help="Upper version of the test target microversion range. "\n                    "The format is \'X.Y\', where \'X\' and \'Y\' are int values. "\n                    "Tempest selects tests based on the range between "\n                    "min_microversion and max_microversion. "\n                    "If both values are not specified, Tempest avoids tests "\n                    "which require a microversion. Valid values are string "\n                    "with format \'X.Y\' or string \'latest\'"),\n    cfg.StrOpt(\'compute_volume_common_az\',\n               default=None,\n               help=\'AZ to be used for Cinder and Nova. Set this parameter \'\n                    \'when the cloud has nova.conf: cinder.cross_az_attach \'\n                    \'set to false. Which means volumes attached to an \'\n                    \'instance must be in the same availability zone in Cinder \'\n                    \'as the instance availability zone in Nova. Set the \'\n                    \'common availability zone in this config which will be \'\n                    \'used to boot an instance as well as creating a volume. \'\n                    \'NOTE: If that AZ is not in Cinder (or \'\n                    \'allow_availability_zone_fallback=False in cinder.conf), \'\n                    \'the volume create request will fail and the instance \'\n                    \'will fail the build request.\'),\n]\n\nplacement_group = cfg.OptGroup(name=\'placement\',\n                               title=\'Placement Service Options\')\n\nPlacementGroup = [\n    cfg.StrOpt(\'endpoint_type\',\n               default=\'public\',\n               choices=[\'public\', \'admin\', \'internal\'],\n               help="The endpoint type to use for the placement service."),\n    cfg.StrOpt(\'catalog_type\',\n               default=\'placement\',\n               help="Catalog type of the Placement service."),\n    cfg.StrOpt(\'region\',\n               default=\'\',\n               help="The placement region name to use. If empty, the value "\n                    "of [identity]/region is used instead. If no such region "\n                    "is found in the service catalog, the first region found "\n                    "is used."),\n    cfg.StrOpt(\'min_microversion\',\n               default=None,\n               help="Lower version of the test target microversion range. "\n                    "The format is \'X.Y\', where \'X\' and \'Y\' are int values. "\n                    "Valid values are string with format \'X.Y\' or string "\n                    "\'latest\'"),\n    cfg.StrOpt(\'max_microversion\',\n               default=None,\n               help="Upper version of the test target microversion range. "\n                    "The format is \'X.Y\', where \'X\' and \'Y\' are int values. "\n                    "Valid values are string with format \'X.Y\' or string "\n                    "\'latest\'"),\n]\n\n\ncompute_features_group = cfg.OptGroup(name=\'compute-feature-enabled\',\n                                      title="Enabled Compute Service Features")\n\nComputeFeaturesGroup = [\n    cfg.BoolOpt(\'disk_config\',\n                default=True,\n                help="If false, skip disk config tests"),\n    # TODO(pkesav): Make it True by default once wallaby\n    # is oldest supported stable for Tempest.\n    cfg.BoolOpt(\'hostname_fqdn_sanitization\',\n                default=False,\n                help="If false, skip fqdn instance sanitization tests. "\n                     "Nova started sanitizing the instance name by replacing "\n                     "the \'.\' with \'-\' to comply with fqdn hostname. Nova "\n                     "changed that in Wallaby cycle, if your cloud is older "\n                     "than wallaby then you can keep/make it False."),\n    cfg.BoolOpt(\'change_password\',\n                default=False,\n                help="Does the test environment support changing the admin "\n                     "password?"),\n    cfg.BoolOpt(\'console_output\',\n                default=True,\n                help="Does the test environment support obtaining instance "\n                     "serial console output?"),\n    for opt in BotoConfig:\n        conf.register_opt(opt, group=\'boto\')\n\ngeneral_group = cfg.OptGroup(name=\'general\', title=\'General Tempest Options\')\n\nGeneralOpts = [\n    cfg.BoolOpt(\'use_xml\',\n                default=False,\n                help="Use xml for the container format"),\n]\n\n\ndef register_general_opts(conf):\n    conf.register_group(general_group)\n    for opt in GeneralOpts:\n        conf.register_opt(opt, group=\'general\')\n\n\n# TODO(jaypipes): Move this to a common utils (not data_utils...)\ndef singleton(cls):\n    cfg.BoolOpt(\'pause\',\n                default=True,\n                help="Does the test environment support pausing?"),\n    cfg.BoolOpt(\'shelve\',\n                default=True,\n                help="Does the test environment support shelving/unshelving?"),\n    cfg.BoolOpt(\'shelve_migrate\',\n                default=False,\n                help="Does the test environment support "\n                     "cold migration of unshelved server?"),\n    cfg.BoolOpt(\'suspend\',\n                default=True,\n                help="Does the test environment support suspend/resume?"),\n    cfg.BoolOpt(\'cold_migration\',\n                default=True,\n                help="Does the test environment support cold migration?"),\n    cfg.BoolOpt(\'live_migration\',\n                default=True,\n                help="Does the test environment support live migration?"),\n    cfg.BoolOpt(\'live_migrate_back_and_forth\',\n                default=False,\n                help="Does the test environment support live migrating "\n                     "VM back and forth between different versions of "\n                     "nova-compute?"),\n    cfg.BoolOpt(\'metadata_service\',\n                default=True,\n                help="Does the test environment support metadata service? "\n                     "Ignored unless validation.run_validation=true."),\n    cfg.BoolOpt(\'block_migration_for_live_migration\',\n                default=False,\n                help="Does the test environment use block devices for live "\n                     "migration"),\n    cfg.BoolOpt(\'block_migrate_cinder_iscsi\',\n                default=False,\n                help="Does the test environment support block migration with "\n                "Cinder iSCSI volumes. Note: libvirt >= 1.2.17 is required "\n                "to support this if using the libvirt compute driver.",\n                deprecated_for_removal=True,\n                deprecated_reason=\'This option duplicates the more generic \'\n                                  \'[compute-feature-enabled]/block_migration \'\n                                  \'_for_live_migration now that \'\n                                  \'MIN_LIBVIRT_VERSION is >= 1.2.17 on all \'\n                                  \'branches from stable/rocky and will be \'\n                                  \'removed in a future release.\'),\n    cfg.BoolOpt(\'can_migrate_between_any_hosts\',\n                default=True,\n                help="Does the test environment support migrating between "\n                     "any hosts? In environments with non-homogeneous compute "\n                     "nodes you can set this to False so that it will select "\n                     "destination host for migrating automatically"),\n    cfg.BoolOpt(\'vnc_console\',\n        register_volume_opts(cfg.CONF)\n        register_object_storage_opts(cfg.CONF)\n        register_boto_opts(cfg.CONF)\n        register_general_opts(cfg.CONF)\n        self.compute = cfg.CONF.compute\n        self.compute_admin = cfg.CONF[\'compute-admin\']\n        self.identity = cfg.CONF.identity\n                    \'in response header.\',\n               deprecated_for_removal=True,\n               deprecated_reason=\'This option will be ignored because the \'\n                                 \'usage of different response header fields \'\n        self.volume = cfg.CONF.volume\n        self.object_storage = cfg.CONF[\'object-storage\']\n        self.boto = cfg.CONF.boto\n        self.general = cfg.CONF.general\n                default=False,\n                help=\'Enable Spice console. This configuration value should \'\n                     \'be same as nova.conf: spice.enabled\',\n                deprecated_for_removal=True,\n                deprecated_reason="This config option is not being used "\n                                  "in Tempest, we can add it back when "\n                                  "adding the test cases."),\n    cfg.BoolOpt(\'rdp_console\',\n                default=False,\n                help=\'Enable RDP console. This configuration value should \'\n                     \'be same as nova.conf: rdp.enabled\',\n                deprecated_for_removal=True,\n                deprecated_reason="This config option is not being used "\n                                  "in Tempest, we can add it back when "\n                                  "adding the test cases."),\n    cfg.BoolOpt(\'serial_console\',\n                default=False,\n                help=\'Enable serial console. This configuration value \'\n                     \'should be the same as \'\n                     \'nova.conf: serial_console.enabled\'),\n    cfg.BoolOpt(\'rescue\',\n                default=True,\n                help=\'Does the test environment support instance rescue \'\n                     \'mode?\'),\n    cfg.BoolOpt(\'stable_rescue\',\n                default=False,\n                help=\'Does the test environment support stable device \'\n                     \'instance rescue mode?\'),\n    cfg.BoolOpt(\'enable_instance_password\',\n                default=True,\n                help=\'Enables returning of the instance password by the \'\n                     \'relevant server API calls such as create, rebuild \'\n                     \'or rescue. This configuration value should be same as \'\n                     \'nova.conf: DEFAULT.enable_instance_password\'),\n    cfg.BoolOpt(\'interface_attach\',\n                default=True,\n                help=\'Does the test environment support dynamic network \'\n                     \'interface attachment?\'),\n    cfg.BoolOpt(\'snapshot\',\n                default=True,\n                help=\'Does the test environment support creating snapshot \'\n                     \'images of running instances?\'),\n    cfg.BoolOpt(\'nova_cert\',\n                default=False,\n                help=\'Does the test environment have the nova cert running?\',\n                deprecated_for_removal=True,\n                deprecated_reason="On Nova side, the nova-cert service is "\n                                  "deprecated and the service will be removed "\n                                  "as early as Ocata."),\n    cfg.BoolOpt(\'personality\',\n                default=False,\n                help=\'Does the test environment support server personality\'),\n    cfg.BoolOpt(\'attach_encrypted_volume\',\n                default=True,\n                help=\'Does the test environment support attaching an \'\n                     \'encrypted volume to a running server instance? This may \'\n                     \'depend on the combination of compute_driver in nova and \'\n                     \'the volume_driver(s) in cinder.\'),\n    cfg.BoolOpt(\'config_drive\',\n                default=True,\n                help=\'Enable special configuration drive with metadata.\'),\n    cfg.ListOpt(\'scheduler_enabled_filters\',\n                default=["AvailabilityZoneFilter", "ComputeFilter",\n                         "ComputeCapabilitiesFilter", "ImagePropertiesFilter",\n                         "ServerGroupAntiAffinityFilter",\n                         "ServerGroupAffinityFilter"],\n                help="A list of enabled filters that Nova will accept as "\n                     "hints to the scheduler when creating a server. If the "\n                     "default value is overridden in nova.conf by the test "\n                     "environment (which means that a different set of "\n                     "filters is enabled than what is included in Nova by "\n                     "default), then this option must be configured to "\n                     "contain the same filters that Nova uses in the test "\n                     "environment. A special entry \'all\' indicates all "\n                     "filters that are included with Nova are enabled. If "\n                     "using \'all\', be sure to enable all filters in "\n                     "nova.conf, as tests can fail in unpredictable ways if "\n                     "Nova\'s and Tempest\'s enabled filters don\'t match. "\n                     "Empty list indicates all filters are disabled. The "\n                     "full list of enabled filters is in nova.conf: "\n                     "filter_scheduler.enabled_filters.",\n                deprecated_opts=[cfg.DeprecatedOpt(\n                    \'scheduler_available_filters\',\n                    group=\'compute-feature-enabled\')]),\n    cfg.BoolOpt(\'swap_volume\',\n                default=False,\n                help=\'Does the test environment support in-place swapping of \'\n                     \'volumes attached to a server instance?\'),\n    cfg.BoolOpt(\'volume_backed_live_migration\',\n                default=False,\n                help=\'Does the test environment support volume-backed live \'\n                     \'migration?\'),\n    cfg.BoolOpt(\'volume_multiattach\',\n                default=False,\n                help=\'Does the test environment support attaching a volume to \'\n                     \'more than one instance? This depends on hypervisor and \'\n                     \'volume backend/type and compute API version 2.60.\'),\n    cfg.BoolOpt(\'xenapi_apis\',\n                default=False,\n                help=\'Does the test environment support the XenAPI-specific \'\n                     \'APIs: os-agents, writeable server metadata and the \'\n                     \'resetNetwork server action? \'\n                     \'These were removed in Victoria alongside the XenAPI \'\n                     \'virt driver.\',\n                deprecated_for_removal=True,\n                deprecated_reason="On Nova side, XenAPI virt driver and the "\n                                  "APIs that only worked with that driver "\n                                  "have been removed and there\'s nothing to "\n                                  "test after Ussuri."),\n    cfg.BoolOpt(\'ide_bus\',\n                default=True,\n                help=\'Does the test environment support attaching devices \'\n                     \'using an IDE bus to the instance?\'),\n    cfg.BoolOpt(\'unified_limits\',\n                default=False,\n                help=\'Does the test environment support unified limits?\'),\n]\n\n\nimage_group = cfg.OptGroup(name=\'image\',\n                           title="Image Service Options")\n\nImageGroup = [\n    cfg.StrOpt(\'catalog_type\',\n               default=\'image\',\n               help=\'Catalog type of the Image service.\'),\n    cfg.StrOpt(\'region\',\n               default=\'\',\n               help="The image region name to use. If empty, the value "\n                    "of identity.region is used instead. If no such region "\n                    "is found in the service catalog, the first found one is "\n                    "used."),\n    cfg.StrOpt(\'endpoint_type\',\n               default=\'publicURL\',\n               choices=[\'public\', \'admin\', \'internal\',\n                        \'publicURL\', \'adminURL\', \'internalURL\'],\n               help="The endpoint type to use for the image service."),\n    cfg.StrOpt(\'alternate_image_endpoint\',\n               default=None,\n               help="Alternate endpoint name for cross-worker testing"),\n    cfg.StrOpt(\'alternate_image_endpoint_type\',\n               default=\'publicURL\',\n               choices=[\'public\', \'admin\', \'internal\',\n                        \'publicURL\', \'adminURL\', \'internalURL\'],\n               help=("The endpoint type to use for the alternate image "\n                     "service.")),\n    cfg.BoolOpt(\'image_caching_enabled\',\n                default=False,\n                help=("Flag to enable if caching is enabled by image "\n                      "service, operator should set this parameter to True"\n                      "if \'image_cache_dir\' is set in glance-api.conf")),\n    cfg.StrOpt(\'http_image\',\n               default=\'http://download.cirros-cloud.net/0.3.1/\'\n               \'cirros-0.3.1-x86_64-uec.tar.gz\',\n               help=\'http accessible image\'),\n    cfg.IntOpt(\'build_timeout\',\n               default=300,\n               help="Timeout in seconds to wait for an image to "\n                    "become available."),\n    cfg.IntOpt(\'build_interval\',\n               default=1,\n               help="Time in seconds between image operation status "\n                    "checks."),\n    cfg.ListOpt(\'container_formats\',\n                default=[\'ami\', \'ari\', \'aki\', \'bare\', \'ovf\', \'ova\'],\n                help="A list of image\'s container formats "\n                     "users can specify."),\n    cfg.ListOpt(\'disk_formats\',\n                default=[\'ami\', \'ari\', \'aki\', \'vhd\', \'vmdk\', \'raw\', \'qcow2\',\n                         \'vdi\', \'iso\', \'vhdx\'],\n                help="A list of image\'s disk formats "\n                     "users can specify.")\n]\n\nimage_feature_group = cfg.OptGroup(name=\'image-feature-enabled\',\n                                   title=\'Enabled image service features\')\n\nImageFeaturesGroup = [\n    cfg.BoolOpt(\'api_v2\',\n                default=True,\n                help="Is the v2 image API enabled",\n                deprecated_for_removal=True,\n                deprecated_reason=\'Glance v1 APIs are deprecated and v2 APIs \'\n                                  \'are current one. In future, Tempest will \'\n                                  \'test v2 APIs only so this config option \'\n                                  \'will be removed.\'),\n    cfg.BoolOpt(\'api_v1\',\n                default=False,\n                help="Is the v1 image API enabled",\n                deprecated_for_removal=True,\n                deprecated_reason=\'Glance v1 APIs are deprecated and v2 APIs \'\n                                  \'are current one. In future, Tempest will \'\n                                  \'test v2 APIs only so this config option \'\n                                  \'will be removed.\'),\n    # Image import feature is setup in devstack victoria onwards.\n    # Once all stable branches setup the same via glance standalone\n    # mode or with uwsgi, we can remove this config option.\n    cfg.BoolOpt(\'import_image\',\n                default=False,\n                help="Is image import feature enabled"),\n    # NOTE(danms): Starting mid-Wallaby glance began enforcing the\n    # previously-informal requirement that os_glance_* properties are\n    # reserved for internal use. Thus, we can only run these checks\n    # if we know we are on a new enough glance.\n    cfg.BoolOpt(\'os_glance_reserved\',\n                default=False,\n                help="Should we check that os_glance namespace is reserved"),\n    cfg.BoolOpt(\'manage_locations\',\n                default=False,\n                help=(\'Is show_multiple_locations enabled in glance. \'\n                      \'Note that at least one http store must be enabled as \'\n                      \'well, because we use that location scheme to test.\')),\n]\n\nnetwork_group = cfg.OptGroup(name=\'network\',\n                             title=\'Network Service Options\')\n\nProfileType = types.Dict(types.List(types.String(), bounds=True))\nNetworkGroup = [\n    cfg.StrOpt(\'catalog_type\',\n               default=\'network\',\n               help=\'Catalog type of the Neutron service.\'),\n    cfg.StrOpt(\'region\',\n               default=\'\',\n               help="The network region name to use. If empty, the value "\n                    "of identity.region is used instead. If no such region "\n                    "is found in the service catalog, the first found one is "\n                    "used."),\n    cfg.StrOpt(\'endpoint_type\',\n               default=\'publicURL\',\n               choices=[\'public\', \'admin\', \'internal\',\n                        \'publicURL\', \'adminURL\', \'internalURL\'],\n               help="The endpoint type to use for the network service."),\n    cfg.StrOpt(\'project_network_cidr\',\n               default="10.100.0.0/16",\n               help="The cidr block to allocate project ipv4 subnets from"),\n    cfg.IntOpt(\'project_network_mask_bits\',\n               default=28,\n               help="The mask bits for project ipv4 subnets"),\n    cfg.StrOpt(\'project_network_v6_cidr\',\n               default="2001:db8::/48",\n               help="The cidr block to allocate project ipv6 subnets from"),\n    cfg.IntOpt(\'project_network_v6_mask_bits\',\n               default=64,\n               help="The mask bits for project ipv6 subnets"),\n    cfg.BoolOpt(\'project_networks_reachable\',\n                default=False,\n                help="Whether project networks can be reached directly from "\n                     "the test client. This must be set to True when the "\n                     "\'fixed\' connect_method is selected."),\n    cfg.StrOpt(\'public_network_id\',\n               default="",\n               help="Id of the public network that provides external "\n                    "connectivity"),\n    cfg.StrOpt(\'floating_network_name\',\n               help="Default floating network name. Used to allocate floating "\n                    "IPs when neutron is enabled."),\n    cfg.StrOpt(\'subnet_id\',\n               default="",\n               help="Subnet id of subnet which is used for allocation of "\n                    "floating IPs. Specify when two or more subnets are "\n                    "present in network."),\n    cfg.StrOpt(\'public_router_id\',\n               default="",\n               help="Id of the public router that provides external "\n                    "connectivity. This should only be used when Neutron\'s "\n                    "\'allow_overlapping_ips\' is set to \'False\' in "\n                    "neutron.conf. usually not needed past \'Grizzly\' release"),\n    cfg.IntOpt(\'build_timeout\',\n               default=300,\n               help="Timeout in seconds to wait for network operation to "\n                    "complete."),\n    cfg.IntOpt(\'build_interval\',\n               default=1,\n               help="Time in seconds between network operation status "\n                    "checks."),\n    cfg.ListOpt(\'dns_servers\',\n                default=["8.8.8.8", "8.8.4.4"],\n                help="List of dns servers which should be used"\n                     " for subnet creation",\n                deprecated_for_removal=True,\n                deprecated_reason="This config option is no longer "\n                                  "used anywhere, so it can be removed."),\n    cfg.StrOpt(\'port_vnic_type\',\n               choices=[None, \'normal\', \'direct\', \'macvtap\', \'direct-physical\',\n                        \'baremetal\', \'virtio-forwarder\'],\n               help="vnic_type to use when launching instances"\n                    " with pre-configured ports."\n                    " Supported ports are:"\n                    " [\'normal\', \'direct\', \'macvtap\', \'direct-physical\', "\n                    "\'baremetal\', \'virtio-forwarder\']"),\n    cfg.Opt(\'port_profile\',\n            type=ProfileType,\n            default={},\n            help="port profile to use when launching instances"\n                 " with pre-configured ports."),\n    cfg.ListOpt(\'default_network\',\n                default=["1.0.0.0/16", "2.0.0.0/16"],\n                help="List of ip pools"\n                     " for subnetpools creation"),\n    cfg.BoolOpt(\'shared_physical_network\',\n                default=False,\n                help="The environment does not support network separation "\n                     "between tenants."),\n]\n\nnetwork_feature_group = cfg.OptGroup(name=\'network-feature-enabled\',\n                                     title=\'Enabled network service features\')\n\nNetworkFeaturesGroup = [\n    cfg.BoolOpt(\'ipv6\',\n                default=True,\n                help="Allow the execution of IPv6 tests."),\n    cfg.ListOpt(\'api_extensions\',\n                default=[\'all\'],\n                help="A list of enabled network extensions with a special "\n                     "entry all which indicates every extension is enabled. "\n                     "Empty list indicates all extensions are disabled. "\n                     "To get the list of extensions run: "\n                     "\'openstack extension list --network\'"),\n    cfg.ListOpt(\'available_features\',\n                default=[\'all\'],\n                help="A list of available network features with a special "\n                     "entry all that indicates every feature is available. "\n                     "Empty list indicates all features are disabled. "\n                     "This list can contain features that are not "\n                     "discoverable through the API."),\n    cfg.BoolOpt(\'ipv6_subnet_attributes\',\n                default=False,\n                help="Allow the execution of IPv6 subnet tests that use "\n                     "the extended IPv6 attributes ipv6_ra_mode "\n                     "and ipv6_address_mode."\n                ),\n    cfg.BoolOpt(\'port_admin_state_change\',\n                default=True,\n                help="Does the test environment support changing "\n                     "port admin state?"),\n    cfg.BoolOpt(\'port_security\',\n                default=False,\n                help="Does the test environment support port security?"),\n    cfg.BoolOpt(\'floating_ips\',\n                default=True,\n                help=\'Does the test environment support floating_ips?\'),\n    cfg.StrOpt(\'qos_placement_physnet\', default=None,\n               help=\'Name of the physnet for placement based minimum \'\n                    \'bandwidth allocation.\'),\n    cfg.StrOpt(\'provider_net_base_segmentation_id\', default=\'3000\',\n               help=\'Base segmentation ID to create provider networks. \'\n                    \'This value will be increased in case of conflict.\'),\n    cfg.BoolOpt(\'qos_min_bw_and_pps\', default=False,\n                help=\'Does the test environment have minimum bandwidth and \'\n                     \'packet rate inventories configured?\'),\n]\n\ndashboard_group = cfg.OptGroup(name="dashboard",\n                               title="Dashboard options")\n\nDashboardGroup = [\n    cfg.StrOpt(\'dashboard_url\',\n               default=\'http://localhost/\',\n               help="Where the dashboard can be found"),\n    cfg.BoolOpt(\'disable_ssl_certificate_validation\',\n                default=False,\n                help="Set to True if using self-signed SSL certificates."),\n]\n\nvalidation_group = cfg.OptGroup(name=\'validation\',\n                                title=\'SSH Validation options\')\n\nValidationGroup = [\n    cfg.BoolOpt(\'run_validation\',\n                default=True,\n                help=\'Enable ssh on created servers and creation of additional\'\n                     \' validation resources to enable remote access.\'\n                     \' In case the guest does not support ssh set it\'\n                     \' to false\'),\n    cfg.BoolOpt(\'security_group\',\n                default=True,\n                help=\'Enable/disable security groups.\'),\n    cfg.BoolOpt(\'security_group_rules\',\n                default=True,\n                help=\'Enable/disable security group rules.\'),\n    cfg.StrOpt(\'connect_method\',\n               default=\'floating\',\n               choices=[\'fixed\', \'floating\'],\n               help=\'Default IP type used for validation: \'\n                    \'-fixed: uses the first IP belonging to the fixed network \'\n                    \'-floating: creates and uses a floating IP\'),\n    cfg.StrOpt(\'auth_method\',\n               default=\'keypair\',\n               choices=[\'keypair\'],\n               help=\'Default authentication method to the instance. \'\n                    \'Only ssh via keypair is supported for now. \'\n                    \'Additional methods will be handled in a separate spec.\'),\n    cfg.IntOpt(\'ip_version_for_ssh\',\n               default=4,\n               help=\'Default IP version for ssh connections.\'),\n    cfg.IntOpt(\'ping_timeout\',\n               default=120,\n               help=\'Timeout in seconds to wait for ping to succeed.\'),\n    cfg.IntOpt(\'connect_timeout\',\n               default=60,\n               help=\'Timeout in seconds to wait for the TCP connection to be \'\n                    \'successful.\'),\n    cfg.IntOpt(\'ssh_timeout\',\n               default=300,\n               help=\'Timeout in seconds to wait for the ssh banner.\'),\n    cfg.StrOpt(\'image_ssh_user\',\n               default="root",\n               help="User name used to authenticate to an instance."),\n    cfg.StrOpt(\'image_alt_ssh_user\',\n               default="root",\n               help="User name used to authenticate to an alt instance."),\n    cfg.StrOpt(\'image_ssh_password\',\n               default="password",\n               help="Password used to authenticate to an instance.",\n               secret=True),\n    cfg.StrOpt(\'image_alt_ssh_password\',\n               default="password",\n               help="Password used to authenticate to an alt instance.",\n               secret=True),\n    cfg.StrOpt(\'ssh_shell_prologue\',\n               default="set -eu -o pipefail; PATH=$$PATH:/sbin:/usr/sbin;",\n               help="Shell fragments to use before executing a command "\n                    "when sshing to a guest."),\n    cfg.IntOpt(\'ping_size\',\n               default=56,\n               help="The packet size for ping packets originating "\n                    "from remote linux hosts"),\n    cfg.IntOpt(\'ping_count\',\n               default=1,\n               help="The number of ping packets originating from remote "\n                    "linux hosts"),\n    cfg.StrOpt(\'floating_ip_range\',\n               default=\'10.0.0.0/29\',\n               help=\'Unallocated floating IP range, which will be used to \'\n                    \'test the floating IP bulk feature for CRUD operation. \'\n                    \'This block must not overlap an existing floating IP \'\n                    \'pool.\'),\n    cfg.StrOpt(\'network_for_ssh\',\n               default=\'public\',\n               help="Network used for SSH connections. Ignored if "\n                    "connect_method=floating."),\n    cfg.StrOpt(\'ssh_key_type\',\n               default=\'ecdsa\',\n               help=\'Type of key to use for ssh connections. \'\n                    \'Valid types are rsa, ecdsa\'),\n    cfg.IntOpt(\'allowed_network_downtime\',\n               default=5.0,\n               help="Allowed VM network connection downtime during live "\n                    "migration, in seconds. "\n                    "When the measured downtime exceeds this value, an "\n                    "exception is raised."),\n]\n\nvolume_group = cfg.OptGroup(name=\'volume\',\n                            title=\'Block Storage Options\')\n\nVolumeGroup = [\n    cfg.IntOpt(\'build_interval\',\n               default=1,\n               help=\'Time in seconds between volume availability checks.\'),\n    cfg.IntOpt(\'build_timeout\',\n               default=300,\n               help=\'Timeout in seconds to wait for a volume to become \'\n                    \'available.\'),\n    cfg.StrOpt(\'catalog_type\',\n               default=\'volumev3\',\n               help="Catalog type of the Volume Service"),\n    cfg.StrOpt(\'region\',\n               default=\'\',\n               help="The volume region name to use. If empty, the value "\n                    "of identity.region is used instead. If no such region "\n                    "is found in the service catalog, the first found one is "\n                    "used."),\n    cfg.StrOpt(\'endpoint_type\',\n               default=\'publicURL\',\n               choices=[\'public\', \'admin\', \'internal\',\n                        \'publicURL\', \'adminURL\', \'internalURL\'],\n               help="The endpoint type to use for the volume service."),\n    cfg.ListOpt(\'backend_names\',\n                default=[\'BACKEND_1\', \'BACKEND_2\'],\n                help=\'A list of backend names separated by comma. \'\n                     \'The backend name must be declared in cinder.conf\'),\n    cfg.StrOpt(\'volume_type\',\n               default=\'\',\n               help=\'Volume type to be used while creating volume.\'),\n    cfg.StrOpt(\'storage_protocol\',\n               default=\'iSCSI\',\n               help=\'Backend protocol to target when creating volume types\'),\n    cfg.StrOpt(\'vendor_name\',\n               default=\'Open Source\',\n               help=\'Backend vendor to target when creating volume types\'),\n    cfg.StrOpt(\'disk_format\',\n               default=\'raw\',\n               help=\'Disk format to use when copying a volume to image\'),\n    cfg.IntOpt(\'volume_size\',\n               default=1,\n               help=\'Default size in GB for volumes created by volumes tests\'),\n    cfg.IntOpt(\'volume_size_extend\',\n               default=1,\n               help="Size in GB a volume is extended by - if a test "\n                    "extends a volume, the size of the new volume will be "\n                    "volume_size + volume_size_extend."),\n    cfg.ListOpt(\'manage_volume_ref\',\n                default=[\'source-name\', \'volume-%s\'],\n                help="A reference to existing volume for volume manage. "\n                     "It contains two elements, the first is ref type "\n                     "(like \'source-name\', \'source-id\', etc), the second is "\n                     "volume name template used in storage backend"),\n    cfg.ListOpt(\'manage_snapshot_ref\',\n                default=[\'source-name\', \'_snapshot-%s\'],\n                help="A reference to existing snapshot for snapshot manage. "\n                     "It contains two elements, the first is ref type "\n                     "(like \'source-name\', \'source-id\', etc), the second is "\n                     "snapshot name template used in storage backend"),\n    cfg.StrOpt(\'min_microversion\',\n               default=None,\n               help="Lower version of the test target microversion range. "\n                    "The format is \'X.Y\', where \'X\' and \'Y\' are int values. "\n                    "Tempest selects tests based on the range between "\n                    "min_microversion and max_microversion. "\n                    "If both values are not specified, Tempest avoids tests "\n                    "which require a microversion. Valid values are string "\n                    "with format \'X.Y\' or string \'latest\'",),\n    cfg.StrOpt(\'max_microversion\',\n               default=None,\n               help="Upper version of the test target microversion range. "\n                    "The format is \'X.Y\', where \'X\' and \'Y\' are int values. "\n                    "Tempest selects tests based on the range between "\n                    "min_microversion and max_microversion. "\n                    "If both values are not specified, Tempest avoids tests "\n                    "which require a microversion. Valid values are string "\n                    "with format \'X.Y\' or string \'latest\'",),\n]\n\nvolume_feature_group = cfg.OptGroup(name=\'volume-feature-enabled\',\n                                    title=\'Enabled Cinder Features\')\n\nVolumeFeaturesGroup = [\n    cfg.BoolOpt(\'multi_backend\',\n                default=False,\n                help="Runs Cinder multi-backend test (requires 2 backends)"),\n    cfg.BoolOpt(\'backup\',\n                default=True,\n                help=\'Runs Cinder volumes backup test\'),\n    cfg.BoolOpt(\'snapshot\',\n                default=True,\n                help=\'Runs Cinder volume snapshot test\'),\n    cfg.BoolOpt(\'clone\',\n                default=True,\n                help=\'Runs Cinder volume clone test\'),\n    cfg.BoolOpt(\'manage_snapshot\',\n                default=False,\n                help=\'Runs Cinder manage snapshot tests\'),\n    cfg.BoolOpt(\'manage_volume\',\n                default=False,\n                help=\'Runs Cinder manage volume tests\'),\n    cfg.ListOpt(\'api_extensions\',\n                default=[\'all\'],\n                help=\'A list of enabled volume extensions with a special \'\n                     \'entry all which indicates every extension is enabled. \'\n                     \'Empty list indicates all extensions are disabled\'),\n    cfg.BoolOpt(\'extend_attached_volume\',\n                default=False,\n                help=\'Does the cloud support extending the size of a volume \'\n                     \'which is currently attached to a server instance? This \'\n                     \'depends on the 3.42 volume API microversion and the \'\n                     \'2.51 compute API microversion. Also, not all volume or \'\n                     \'compute backends support this operation.\'),\n    cfg.BoolOpt(\'extend_attached_encrypted_volume\',\n                default=False,\n                help=\'Does the cloud support extending the size of an \'\n                     \'encrypted volume  which is currently attached to a \'\n                     \'server instance? This depends on the 3.42 volume API \'\n                     \'microversion and the 2.51 compute API microversion. \'\n                     \'Also, not all volume or compute backends support this \'\n                     \'operation.\')\n]\n\n\nobject_storage_group = cfg.OptGroup(name=\'object-storage\',\n                                    title=\'Object Storage Service Options\')\n\nObjectStoreGroup = [\n    cfg.StrOpt(\'catalog_type\',\n               default=\'object-store\',\n               help="Catalog type of the Object-Storage service."),\n    cfg.StrOpt(\'region\',\n               default=\'\',\n               help="The object-storage region name to use. If empty, the "\n                    "value of identity.region is used instead. If no such "\n                    "region is found in the service catalog, the first found "\n                    "one is used."),\n    cfg.StrOpt(\'endpoint_type\',\n               default=\'publicURL\',\n               choices=[\'public\', \'admin\', \'internal\',\n                        \'publicURL\', \'adminURL\', \'internalURL\'],\n               help="The endpoint type to use for the object-store service."),\n    cfg.IntOpt(\'container_sync_timeout\',\n               default=600,\n               help="Number of seconds to time on waiting for a container "\n                    "to container synchronization complete."),\n    cfg.IntOpt(\'container_sync_interval\',\n               default=5,\n               help="Number of seconds to wait while looping to check the "\n                    "status of a container to container synchronization"),\n    cfg.StrOpt(\'operator_role\',\n               default=\'member\',\n               help="Role to add to users created for swift tests to "\n                    "enable creating containers"),\n    cfg.StrOpt(\'reseller_admin_role\',\n               default=\'ResellerAdmin\',\n               help="User role that has reseller admin"),\n    cfg.StrOpt(\'realm_name\',\n               default=\'realm1\',\n               help="Name of sync realm. A sync realm is a set of clusters "\n                    "that have agreed to allow container syncing with each "\n                    "other. Set the same realm name as Swift\'s "\n                    "container-sync-realms.conf"),\n    cfg.StrOpt(\'cluster_name\',\n               default=\'name1\',\n               help="One name of cluster which is set in the realm whose name "\n                    "is set in \'realm_name\' item in this file. Set the "\n                    "same cluster name as Swift\'s container-sync-realms.conf"),\n    cfg.IntOpt(\'build_timeout\',\n               default=10,\n               help="Timeout in seconds to wait for objects to create."),\n]\n\nobject_storage_feature_group = cfg.OptGroup(\n    name=\'object-storage-feature-enabled\',\n    title=\'Enabled object-storage features\')\n\nObjectStoreFeaturesGroup = [\n    cfg.ListOpt(\'discoverable_apis\',\n                default=[\'all\'],\n                help="A list of the enabled optional discoverable apis. "\n                     "A single entry, all, indicates that all of these "\n                     "features are expected to be enabled"),\n    cfg.BoolOpt(\'container_sync\',\n                default=True,\n                help="Execute (old style) container-sync tests"),\n    cfg.BoolOpt(\'object_versioning\',\n                default=True,\n                help="Execute object-versioning tests"),\n    cfg.BoolOpt(\'discoverability\',\n                default=True,\n                help="Execute discoverability tests"),\n    cfg.StrOpt(\'tempurl_digest_hashlib\',\n               default=\'sha256\',\n               help="Hashing algorithm to use for the temp_url tests. "\n                    "Needs to be supported both by Swift and the "\n                    "hashlib module, for example sha1 or sha256"),\n]\n\n\nscenario_group = cfg.OptGroup(name=\'scenario\', title=\'Scenario Test Options\')\n\nScenarioGroup = [\n    cfg.StrOpt(\'img_file\', deprecated_name=\'qcow2_img_file\',\n               default=\'/opt/stack/new/devstack/files/images\'\n               \'/cirros-0.3.1-x86_64-disk.img\',\n               help=\'Image full path.\'),\n    cfg.StrOpt(\'img_disk_format\',\n               default=\'qcow2\',\n               help=\'Image disk format\'),\n    cfg.StrOpt(\'img_container_format\',\n               default=\'bare\',\n               help=\'Image container format\'),\n    cfg.DictOpt(\'img_properties\', help=\'Glance image properties. \'\n                \'Use for custom images which require them\'),\n    # TODO(yfried): add support for dhcpcd\n    cfg.StrOpt(\'dhcp_client\',\n               default=\'udhcpc\',\n               choices=["udhcpc", "dhclient", ""],\n               help=\'DHCP client used by images to renew DCHP lease. \'\n                    \'If left empty, update operation will be skipped. \'\n                    \'Supported clients: "udhcpc", "dhclient"\'),\n    cfg.StrOpt(\'protocol\',\n               default=\'icmp\',\n               choices=(\'icmp\', \'tcp\', \'udp\'),\n               help=\'The protocol used in security groups tests to check \'\n                    \'connectivity.\'),\n]\n\n\nservice_available_group = cfg.OptGroup(name="service_available",\n                                       title="Available OpenStack Services")\n\nServiceAvailableGroup = [\n    cfg.BoolOpt(\'cinder\',\n                default=True,\n                help="Whether or not cinder is expected to be available"),\n    cfg.BoolOpt(\'neutron\',\n                default=False,\n                help="Whether or not neutron is expected to be available"),\n    cfg.BoolOpt(\'glance\',\n                default=True,\n                help="Whether or not glance is expected to be available"),\n    cfg.BoolOpt(\'swift\',\n                default=True,\n                help="Whether or not swift is expected to be available"),\n    cfg.BoolOpt(\'nova\',\n                default=True,\n                help="Whether or not nova is expected to be available"),\n    cfg.BoolOpt(\'horizon\',\n                default=True,\n                help="Whether or not horizon is expected to be available"),\n]\n\nenforce_scope_group = cfg.OptGroup(name="enforce_scope",\n                                   title="OpenStack Services with "\n                                         "enforce scope")\n\n\nEnforceScopeGroup = [\n    cfg.BoolOpt(\'nova\',\n                default=False,\n                help=\'Does the compute service API policies enforce scope? \'\n                     \'This configuration value should be same as \'\n                     \'nova.conf: [oslo_policy].enforce_scope option.\'),\n    cfg.BoolOpt(\'neutron\',\n                default=False,\n                help=\'Does the network service API policies enforce scope? \'\n                     \'This configuration value should be same as \'\n                     \'neutron.conf: [oslo_policy].enforce_scope option.\'),\n    cfg.BoolOpt(\'glance\',\n                default=False,\n                help=\'Does the Image service API policies enforce scope? \'\n                     \'This configuration value should be same as \'\n                     \'glance.conf: [oslo_policy].enforce_scope option.\'),\n    cfg.BoolOpt(\'cinder\',\n                default=False,\n                help=\'Does the Volume service API policies enforce scope? \'\n                     \'This configuration value should be same as \'\n                     \'cinder.conf: [oslo_policy].enforce_scope option.\'),\n    cfg.BoolOpt(\'keystone\',\n                default=False,\n                help=\'Does the Identity service API policies enforce scope? \'\n                     \'This configuration value should be same as \'\n                     \'keystone.conf: [oslo_policy].enforce_scope option.\'),\n]\n\ndebug_group = cfg.OptGroup(name="debug",\n                           title="Debug System")\n\nDebugGroup = [\n    cfg.StrOpt(\'trace_requests\',\n               default=\'\',\n               help="""A regex to determine which requests should be traced.\n\nThis is a regex to match the caller for rest client requests to be able to\nselectively trace calls out of specific classes and methods. It largely\nexists for test development, and is not expected to be used in a real deploy\nof tempest. This will be matched against the discovered ClassName:method\nin the test environment.\n\nExpected values for this field are:\n\n * ClassName:test_method_name - traces one test_method\n * ClassName:setUp(Class) - traces specific setup functions\n * ClassName:tearDown(Class) - traces specific teardown functions\n * ClassName:_run_cleanups - traces the cleanup functions\n\nIf nothing is specified, this feature is not enabled. To trace everything\nspecify .* as the regex.\n""")\n]\n\n\nprofiler_group = cfg.OptGroup(name="profiler",\n                              title="OpenStack Profiler")\n\nProfilerGroup = [\n    cfg.StrOpt(\'key\',\n               help="The secret key to enable OpenStack Profiler. The value "\n                    "should match the one configured in OpenStack services "\n                    "under `[profiler]/hmac_keys` property. The default empty "\n                    "value keeps profiling disabled"),\n]\n\nDefaultGroup = [\n    cfg.BoolOpt(\'pause_teardown\',\n                default=False,\n                help="""Whether to pause a test in global teardown.\n\nThe best use case is investigating used resources of one test.\nA test can be run as follows:\n $ stestr run --pdb TEST_ID\nor\n $ python -m testtools.run TEST_ID"""),\n]\n\n_opts = [\n    (auth_group, AuthGroup),\n    (compute_group, ComputeGroup),\n    (compute_features_group, ComputeFeaturesGroup),\n    (identity_group, IdentityGroup),\n    (service_clients_group, ServiceClientsGroup),\n    (identity_feature_group, IdentityFeatureGroup),\n    (image_group, ImageGroup),\n    (image_feature_group, ImageFeaturesGroup),\n    (network_group, NetworkGroup),\n    (network_feature_group, NetworkFeaturesGroup),\n    (dashboard_group, DashboardGroup),\n    (validation_group, ValidationGroup),\n    (volume_group, VolumeGroup),\n    (volume_feature_group, VolumeFeaturesGroup),\n    (object_storage_group, ObjectStoreGroup),\n    (object_storage_feature_group, ObjectStoreFeaturesGroup),\n    (scenario_group, ScenarioGroup),\n    (service_available_group, ServiceAvailableGroup),\n    (enforce_scope_group, EnforceScopeGroup),\n    (debug_group, DebugGroup),\n    (placement_group, PlacementGroup),\n    (profiler_group, ProfilerGroup),\n    (None, DefaultGroup)\n]\n\n\ndef register_opts():\n    ext_plugins = plugins.TempestTestPluginManager()\n    # Register in-tree tempest config options\n    for g, o in _opts:\n        register_opt_group(_CONF, g, o)\n    # Call external plugin config option registration\n    ext_plugins.register_plugin_opts(_CONF)\n\n\ndef list_opts():\n    """Return a list of oslo.config options available.\n\n    The purpose of this is to allow tools like the Oslo sample config file\n    generator to discover the options exposed to users.\n    """\n    ext_plugins = plugins.TempestTestPluginManager()\n    # Make a shallow copy of the options list that can be\n    # extended by plugins. Send back the group object\n    # to allow group help text to be generated.\n    opt_list = [(g, o) for g, o in _opts]\n    opt_list.extend(ext_plugins.get_plugin_options_list())\n    return opt_list\n\n\n# This should never be called outside of this module\nclass TempestConfigPrivate(object):\n    """Provides OpenStack configuration information."""\n\n    DEFAULT_CONFIG_DIR = os.path.join(os.getcwd(), "etc")\n\n    DEFAULT_CONFIG_FILE = "tempest.conf"\n\n    def __getattr__(self, attr):\n        # Handles config options from the default group\n        return getattr(_CONF, attr)\n\n    def _set_attrs(self):\n        # This methods ensures that config options in Tempest as well as\n        # in Tempest plugins can be accessed via:\n        #     CONF.<normalised_group_name>.<key_name>\n        # where:\n        #     normalised_group_name = group_name.replace(\'-\', \'_\')\n        # Attributes are set at __init__ time *only* for known option groups\n        self.auth = _CONF.auth\n        self.compute = _CONF.compute\n        self.compute_feature_enabled = _CONF[\'compute-feature-enabled\']\n        self.identity = _CONF.identity\n        self.service_clients = _CONF[\'service-clients\']\n        self.identity_feature_enabled = _CONF[\'identity-feature-enabled\']\n        self.image = _CONF.image\n        self.image_feature_enabled = _CONF[\'image-feature-enabled\']\n        self.network = _CONF.network\n        self.network_feature_enabled = _CONF[\'network-feature-enabled\']\n        self.dashboard = _CONF.dashboard\n        self.validation = _CONF.validation\n        self.volume = _CONF.volume\n        self.volume_feature_enabled = _CONF[\'volume-feature-enabled\']\n        self.object_storage = _CONF[\'object-storage\']\n        self.object_storage_feature_enabled = _CONF[\n            \'object-storage-feature-enabled\']\n        self.scenario = _CONF.scenario\n        self.service_available = _CONF.service_available\n        self.enforce_scope = _CONF.enforce_scope\n        self.debug = _CONF.debug\n        logging.tempest_set_log_file(\'tempest.log\')\n        # Setting attributes for plugins\n        # NOTE(andreaf) Plugins have no access to the TempestConfigPrivate\n        # instance at discovery time, so they have no way of setting these\n        # aliases themselves.\n        ext_plugins = plugins.TempestTestPluginManager()\n        for group, _ in ext_plugins.get_plugin_options_list():\n            if isinstance(group, cfg.OptGroup):\n                # If we have an OptGroup\n                group_name = group.name\n                group_dest = group.dest\n            else:\n                # If we have a group name as a string\n                group_name = group\n                group_dest = group.replace(\'-\', \'_\')\n            # NOTE(andreaf) We can set the attribute safely here since in\n            # case of name conflict we would not have reached this point.\n            setattr(self, group_dest, _CONF[group_name])\n\n    def __init__(self, parse_conf=True, config_path=None):\n        """Initialize a configuration from a conf directory and conf file."""\n        super(TempestConfigPrivate, self).__init__()\n        config_files = []\n        failsafe_path = "/etc/tempest/" + self.DEFAULT_CONFIG_FILE\n\n        if config_path:\n            path = config_path\n        else:\n            # Environment variables override defaults...\n            conf_dir = os.environ.get(\'TEMPEST_CONFIG_DIR\',\n                                      self.DEFAULT_CONFIG_DIR)\n            conf_file = os.environ.get(\'TEMPEST_CONFIG\',\n                                       self.DEFAULT_CONFIG_FILE)\n\n            path = os.path.join(conf_dir, conf_file)\n\n        if not os.path.isfile(path):\n            path = failsafe_path\n\n        # only parse the config file if we expect one to exist. This is needed\n        # to remove an issue with the config file up to date checker.\n        if parse_conf:\n            config_files.append(path)\n        logging.register_options(_CONF)\n        if os.path.isfile(path):\n            _CONF([], project=\'tempest\', default_config_files=config_files)\n        else:\n            _CONF([], project=\'tempest\')\n\n        logging_cfg_path = "%s/logging.conf" % os.path.dirname(path)\n        if ((not hasattr(_CONF, \'log_config_append\') or\n             _CONF.log_config_append is None) and\n            os.path.isfile(logging_cfg_path)):\n            # if logging conf is in place we need to set log_config_append\n            _CONF.log_config_append = logging_cfg_path\n\n        logging.setup(_CONF, \'tempest\')\n        LOG = logging.getLogger(\'tempest\')\n        LOG.info("Using tempest config file %s", path)\n        register_opts()\n        self._set_attrs()\n        if parse_conf:\n            _CONF.log_opt_values(LOG, logging.DEBUG)\n\n\nclass TempestConfigProxy(object):\n    _config = None\n    _path = None\n\n    _extra_log_defaults = [\n        (\'paramiko.transport\', logging.INFO),\n        (\'requests.packages.urllib3.connectionpool\', logging.WARN),\n    ]\n\n    def _fix_log_levels(self):\n        """Tweak the oslo log defaults."""\n        for name, level in self._extra_log_defaults:\n            logging.getLogger(name).logger.setLevel(level)\n\n    def __getattr__(self, attr):\n        if not self._config:\n            self._fix_log_levels()\n            lock_dir = os.path.join(tempfile.gettempdir(), \'tempest-lock\')\n            lockutils.set_defaults(lock_dir)\n            self._config = TempestConfigPrivate(config_path=self._path)\n\n            # Pushing tempest internal service client configuration to the\n            # service clients register. Doing this in the config module ensures\n            # that the configuration is available by the time we register the\n            # service clients.\n            # NOTE(andreaf) This has to be done at the time the first\n            # attribute is accessed, to ensure all plugins have been already\n            # loaded, options registered, and _config is set.\n            _register_tempest_service_clients()\n\n            # Registering service clients and pushing their configuration to\n            # the service clients register. Doing this in the config module\n            # ensures that the configuration is available by the time we\n            # discover tests from plugins.\n            plugins.TempestTestPluginManager()._register_service_clients()\n\n        return getattr(self._config, attr)\n\n    def set_config_path(self, path):\n        self._path = path\n        # FIXME(masayukig): bug#1783751 To pass the config file path to child\n        # processes, we need to set the environment variables here as a\n        # workaround.\n        os.environ[\'TEMPEST_CONFIG_DIR\'] = os.path.dirname(path)\n        os.environ[\'TEMPEST_CONFIG\'] = os.path.basename(path)\n\n\nCONF = TempestConfigProxy()\n\n\ndef service_client_config(service_client_name=None):\n    """Return a dict with the parameters to init service clients\n\n    Extracts from CONF the settings specific to the service_client_name and\n    api_version, and formats them as dict ready to be passed to the service\n    clients __init__:\n\n        * `region` (default to identity)\n        * `catalog_type`\n        * `endpoint_type`\n        * `build_timeout` (object-storage and identity default to compute)\n        * `build_interval` (object-storage and identity default to compute)\n\n    The following common settings are always returned, even if\n    `service_client_name` is None:\n\n        * `disable_ssl_certificate_validation`\n        * `ca_certs`\n        * `trace_requests`\n        * `http_timeout`\n        * `proxy_url`\n\n    The dict returned by this does not fit a few service clients:\n\n        * The endpoint type is not returned for identity client, since it takes\n          three different values for v2 admin, v2 public and v3\n        * The `ServersClient` from compute accepts an optional\n          `enable_instance_password` parameter, which is not returned.\n        * The `VolumesClient` for both v1 and v2 volume accept an optional\n          `default_volume_size` parameter, which is not returned.\n        * The `TokenClient` and `V3TokenClient` have a very different\n          interface, only auth_url is needed for them.\n\n    :param service_client_name: str Name of the service. Supported values are\n        \'compute\', \'identity\', \'image\', \'network\', \'object-storage\', \'volume\'\n    :return: dictionary of __init__ parameters for the service clients\n    :rtype: dict\n    """\n    _parameters = {\n        \'disable_ssl_certificate_validation\':\n            CONF.identity.disable_ssl_certificate_validation,\n        \'ca_certs\': CONF.identity.ca_certificates_file,\n        \'trace_requests\': CONF.debug.trace_requests,\n        \'http_timeout\': CONF.service_clients.http_timeout,\n        \'proxy_url\': CONF.service_clients.proxy_url,\n    }\n\n    if service_client_name is None:\n        return _parameters\n\n    # Get the group of options first, by normalising the service_group_name\n    # Services with a \'-\' in the name have an \'_\' in the option group name\n    config_group = service_client_name.replace(\'-\', \'_\')\n    # NOTE(andreaf) Check if the config group exists. This allows for this\n    # helper to be used for settings from registered plugins as well\n    try:\n        options = getattr(CONF, config_group)\n    except cfg.NoSuchOptError:\n        # Option group not defined\n        raise exceptions.UnknownServiceClient(services=service_client_name)\n    # Set endpoint_type\n    # Identity uses different settings depending on API version, so do not\n    # return the endpoint at all.\n    if service_client_name != \'identity\':\n        _parameters[\'endpoint_type\'] = getattr(options, \'endpoint_type\')\n    # Set build_*\n    # Object storage and identity groups do not have conf settings for\n    # build_* parameters, and we default to compute in any case\n    for setting in [\'build_timeout\', \'build_interval\']:\n        if not hasattr(options, setting) or not getattr(options, setting):\n            _parameters[setting] = getattr(CONF.compute, setting)\n        else:\n            _parameters[setting] = getattr(options, setting)\n    # Set region\n    # If a service client does not define region or region is not set\n    # default to the identity region\n    if not hasattr(options, \'region\') or not getattr(options, \'region\'):\n        _parameters[\'region\'] = CONF.identity.region\n    else:\n        _parameters[\'region\'] = getattr(options, \'region\')\n    # Set service\n    _parameters[\'service\'] = getattr(options, \'catalog_type\')\n    return _parameters\n\n\ndef _register_tempest_service_clients():\n    # Register tempest own service clients using the same mechanism used\n    # for external plugins.\n    # The configuration data is pushed to the registry so that automatic\n    # configuration of tempest own service clients is possible both for\n    # tempest as well as for the plugins.\n    service_clients = clients.tempest_modules()\n    registry = clients.ClientsRegistry()\n    all_clients = []\n    for service_client in service_clients:\n        module = service_clients[service_client]\n        configs = service_client.split(\'.\')[0]\n        service_client_data = dict(\n            name=service_client.replace(\'.\', \'_\').replace(\'-\', \'_\'),\n            service_version=service_client,\n            module_path=module.__name__,\n            client_names=module.__all__,\n            **service_client_config(configs)\n        )\n        all_clients.append(service_client_data)\n    # NOTE(andreaf) Internal service clients do not actually belong\n    # to a plugin, so using \'__tempest__\' to indicate a virtual plugin\n    # which holds internal service clients.\n    registry.register_service_client(\'__tempest__\', all_clients)\n', 'message': 'Revert "Split up XML and JSON testing."\n\nThis reverts commit 58dec9d45360a69192fc6ba43dddf5a597063972\n\nThis ended gating of the XML API without any real public deliberation.  It should be reverted, and a plan agreed upon with PTLs and the CI team.\n\nAlso, if we do decide to implement this, we should make the CI change _first_ so that we don\'t abruptly stop gating on something we should be testing.', 'author_name': 'Gerrit Code Review', 'lang': 'py'}