Merge "Fix baremetal node property keys"
diff --git a/tempest/api/compute/limits/test_absolute_limits.py b/tempest/api/compute/limits/test_absolute_limits.py
index 520dfa9..de6eecb 100644
--- a/tempest/api/compute/limits/test_absolute_limits.py
+++ b/tempest/api/compute/limits/test_absolute_limits.py
@@ -20,8 +20,8 @@
class AbsoluteLimitsTestJSON(base.BaseV2ComputeTest):
@classmethod
- def resource_setup(cls):
- super(AbsoluteLimitsTestJSON, cls).resource_setup()
+ def setup_clients(cls):
+ super(AbsoluteLimitsTestJSON, cls).setup_clients()
cls.client = cls.limits_client
@test.attr(type='gate')
diff --git a/tempest/api/compute/limits/test_absolute_limits_negative.py b/tempest/api/compute/limits/test_absolute_limits_negative.py
index 9776db3..d82a2e5 100644
--- a/tempest/api/compute/limits/test_absolute_limits_negative.py
+++ b/tempest/api/compute/limits/test_absolute_limits_negative.py
@@ -28,8 +28,8 @@
super(AbsoluteLimitsNegativeTestJSON, self).setUp()
@classmethod
- def resource_setup(cls):
- super(AbsoluteLimitsNegativeTestJSON, cls).resource_setup()
+ def setup_clients(cls):
+ super(AbsoluteLimitsNegativeTestJSON, cls).setup_clients()
cls.client = cls.limits_client
cls.server_client = cls.servers_client
diff --git a/tempest/api/compute/volumes/test_attach_volume.py b/tempest/api/compute/volumes/test_attach_volume.py
index 64ea555..5b15a08 100644
--- a/tempest/api/compute/volumes/test_attach_volume.py
+++ b/tempest/api/compute/volumes/test_attach_volume.py
@@ -30,14 +30,22 @@
self.attachment = None
@classmethod
- def resource_setup(cls):
- cls.prepare_instance_network()
- super(AttachVolumeTestJSON, cls).resource_setup()
- cls.device = CONF.compute.volume_device_name
+ def skip_checks(cls):
+ super(AttachVolumeTestJSON, cls).skip_checks()
if not CONF.service_available.cinder:
skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
raise cls.skipException(skip_msg)
+ @classmethod
+ def setup_credentials(cls):
+ cls.prepare_instance_network()
+ super(AttachVolumeTestJSON, cls).setup_credentials()
+
+ @classmethod
+ def resource_setup(cls):
+ super(AttachVolumeTestJSON, cls).resource_setup()
+ cls.device = CONF.compute.volume_device_name
+
def _detach(self, server_id, volume_id):
if self.attachment:
self.servers_client.detach_volume(server_id, volume_id)
diff --git a/tempest/api/compute/volumes/test_volumes_get.py b/tempest/api/compute/volumes/test_volumes_get.py
index 69998d2..aa4fb52 100644
--- a/tempest/api/compute/volumes/test_volumes_get.py
+++ b/tempest/api/compute/volumes/test_volumes_get.py
@@ -27,13 +27,17 @@
class VolumesGetTestJSON(base.BaseV2ComputeTest):
@classmethod
- def resource_setup(cls):
- super(VolumesGetTestJSON, cls).resource_setup()
- cls.client = cls.volumes_extensions_client
+ def skip_checks(cls):
+ super(VolumesGetTestJSON, cls).skip_checks()
if not CONF.service_available.cinder:
skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
raise cls.skipException(skip_msg)
+ @classmethod
+ def setup_clients(cls):
+ super(VolumesGetTestJSON, cls).setup_clients()
+ cls.client = cls.volumes_extensions_client
+
@test.attr(type='smoke')
def test_volume_create_get_delete(self):
# CREATE, GET, DELETE Volume
diff --git a/tempest/api/compute/volumes/test_volumes_list.py b/tempest/api/compute/volumes/test_volumes_list.py
index ba7ee6b..cb74876 100644
--- a/tempest/api/compute/volumes/test_volumes_list.py
+++ b/tempest/api/compute/volumes/test_volumes_list.py
@@ -32,12 +32,20 @@
"""
@classmethod
- def resource_setup(cls):
- super(VolumesTestJSON, cls).resource_setup()
- cls.client = cls.volumes_extensions_client
+ def skip_checks(cls):
+ super(VolumesTestJSON, cls).skip_checks()
if not CONF.service_available.cinder:
skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
raise cls.skipException(skip_msg)
+
+ @classmethod
+ def setup_clients(cls):
+ super(VolumesTestJSON, cls).setup_clients()
+ cls.client = cls.volumes_extensions_client
+
+ @classmethod
+ def resource_setup(cls):
+ super(VolumesTestJSON, cls).resource_setup()
# Create 3 Volumes
cls.volume_list = []
cls.volume_id_list = []
diff --git a/tempest/api/compute/volumes/test_volumes_negative.py b/tempest/api/compute/volumes/test_volumes_negative.py
index ed54aaf..53217c9 100644
--- a/tempest/api/compute/volumes/test_volumes_negative.py
+++ b/tempest/api/compute/volumes/test_volumes_negative.py
@@ -28,13 +28,17 @@
class VolumesNegativeTest(base.BaseV2ComputeTest):
@classmethod
- def resource_setup(cls):
- super(VolumesNegativeTest, cls).resource_setup()
- cls.client = cls.volumes_extensions_client
+ def skip_checks(cls):
+ super(VolumesNegativeTest, cls).skip_checks()
if not CONF.service_available.cinder:
skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
raise cls.skipException(skip_msg)
+ @classmethod
+ def setup_clients(cls):
+ super(VolumesNegativeTest, cls).setup_clients()
+ cls.client = cls.volumes_extensions_client
+
@test.attr(type=['negative', 'gate'])
def test_volume_get_nonexistent_volume_id(self):
# Negative: Should not be able to get details of nonexistent volume
diff --git a/tempest/api/identity/admin/v3/test_default_project_id.py b/tempest/api/identity/admin/v3/test_default_project_id.py
index 72d323a..dab092d 100644
--- a/tempest/api/identity/admin/v3/test_default_project_id.py
+++ b/tempest/api/identity/admin/v3/test_default_project_id.py
@@ -14,8 +14,11 @@
from tempest import auth
from tempest import clients
from tempest.common.utils import data_utils
+from tempest import config
from tempest import test
+CONF = config.CONF
+
class TestDefaultProjectId (base.BaseIdentityV3AdminTest):
@@ -71,7 +74,8 @@
creds = auth.KeystoneV3Credentials(username=user_name,
password=user_name,
domain_name=dom_name)
- auth_provider = auth.KeystoneV3AuthProvider(creds)
+ auth_provider = auth.KeystoneV3AuthProvider(creds,
+ CONF.identity.uri_v3)
creds = auth_provider.fill_credentials()
admin_client = clients.Manager(credentials=creds)
diff --git a/tempest/api/network/admin/test_routers_dvr.py b/tempest/api/network/admin/test_routers_dvr.py
new file mode 100644
index 0000000..c6d8165
--- /dev/null
+++ b/tempest/api/network/admin/test_routers_dvr.py
@@ -0,0 +1,98 @@
+# Copyright 2015 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.
+
+from tempest.api.network import base_routers as base
+from tempest.common.utils import data_utils
+from tempest import test
+
+
+class RoutersTestDVR(base.BaseRouterTest):
+
+ @classmethod
+ def resource_setup(cls):
+ for ext in ['router', 'dvr']:
+ if not test.is_extension_enabled(ext, 'network'):
+ msg = "%s extension not enabled." % ext
+ raise cls.skipException(msg)
+ # The check above will pass if api_extensions=all, which does
+ # not mean DVR extension itself is present.
+ # Instead, we have to check whether DVR is actually present by using
+ # admin credentials to create router with distributed=True attribute
+ # and checking for BadRequest exception and that the resulting router
+ # has a distributed attribute.
+ super(RoutersTestDVR, cls).resource_setup()
+ name = data_utils.rand_name('pretest-check')
+ router = cls.admin_client.create_router(name)
+ if 'distributed' not in router['router']:
+ msg = "'distributed' attribute not found. DVR Possibly not enabled"
+ raise cls.skipException(msg)
+ cls.admin_client.delete_router(router['router']['id'])
+
+ @test.attr(type='smoke')
+ def test_distributed_router_creation(self):
+ """
+ Test uses administrative credentials to creates a
+ DVR (Distributed Virtual Routing) router using the
+ distributed=True.
+
+ Acceptance
+ The router is created and the "distributed" attribute is
+ set to True
+ """
+ name = data_utils.rand_name('router')
+ router = self.admin_client.create_router(name, distributed=True)
+ self.addCleanup(self.admin_client.delete_router,
+ router['router']['id'])
+ self.assertTrue(router['router']['distributed'])
+
+ @test.attr(type='smoke')
+ def test_centralized_router_creation(self):
+ """
+ Test uses administrative credentials to creates a
+ CVR (Centralized Virtual Routing) router using the
+ distributed=False.
+
+ Acceptance
+ The router is created and the "distributed" attribute is
+ set to False, thus making it a "Centralized Virtual Router"
+ as opposed to a "Distributed Virtual Router"
+ """
+ name = data_utils.rand_name('router')
+ router = self.admin_client.create_router(name, distributed=False)
+ self.addCleanup(self.admin_client.delete_router,
+ router['router']['id'])
+ self.assertFalse(router['router']['distributed'])
+
+ @test.attr(type='smoke')
+ def test_centralized_router_update_to_dvr(self):
+ """
+ Test uses administrative credentials to creates a
+ CVR (Centralized Virtual Routing) router using the
+ distributed=False.Then it will "update" the router
+ distributed attribute to True
+
+ Acceptance
+ The router is created and the "distributed" attribute is
+ set to False. Once the router is updated, the distributed
+ attribute will be set to True
+ """
+ name = data_utils.rand_name('router')
+ router = self.admin_client.create_router(name, distributed=False)
+ self.addCleanup(self.admin_client.delete_router,
+ router['router']['id'])
+ self.assertFalse(router['router']['distributed'])
+ router = self.admin_client.update_router(router['router']['id'],
+ distributed=True)
+ self.assertTrue(router['router']['distributed'])
diff --git a/tempest/api/telemetry/base.py b/tempest/api/telemetry/base.py
index 7ec0646..c521b37 100644
--- a/tempest/api/telemetry/base.py
+++ b/tempest/api/telemetry/base.py
@@ -28,18 +28,29 @@
"""Base test case class for all Telemetry API tests."""
@classmethod
- def resource_setup(cls):
+ def skip_checks(cls):
+ super(BaseTelemetryTest, cls).skip_checks()
if not CONF.service_available.ceilometer:
raise cls.skipException("Ceilometer support is required")
- cls.set_network_resources()
- super(BaseTelemetryTest, cls).resource_setup()
- os = cls.get_client_manager()
- cls.telemetry_client = os.telemetry_client
- cls.servers_client = os.servers_client
- cls.flavors_client = os.flavors_client
- cls.image_client = os.image_client
- cls.image_client_v2 = os.image_client_v2
+ @classmethod
+ def setup_credentials(cls):
+ cls.set_network_resources()
+ super(BaseTelemetryTest, cls).setup_credentials()
+ cls.os = cls.get_client_manager()
+
+ @classmethod
+ def setup_clients(cls):
+ super(BaseTelemetryTest, cls).setup_clients()
+ cls.telemetry_client = cls.os.telemetry_client
+ cls.servers_client = cls.os.servers_client
+ cls.flavors_client = cls.os.flavors_client
+ cls.image_client = cls.os.image_client
+ cls.image_client_v2 = cls.os.image_client_v2
+
+ @classmethod
+ def resource_setup(cls):
+ super(BaseTelemetryTest, cls).resource_setup()
cls.nova_notifications = ['memory', 'vcpus', 'disk.root.size',
'disk.ephemeral.size']
diff --git a/tempest/api/telemetry/test_telemetry_notification_api.py b/tempest/api/telemetry/test_telemetry_notification_api.py
index 048e305..a0256af 100644
--- a/tempest/api/telemetry/test_telemetry_notification_api.py
+++ b/tempest/api/telemetry/test_telemetry_notification_api.py
@@ -23,11 +23,11 @@
class TelemetryNotificationAPITestJSON(base.BaseTelemetryTest):
@classmethod
- def resource_setup(cls):
+ def skip_checks(cls):
+ super(TelemetryNotificationAPITestJSON, cls).skip_checks()
if CONF.telemetry.too_slow_to_test:
raise cls.skipException("Ceilometer feature for fast work mysql "
"is disabled")
- super(TelemetryNotificationAPITestJSON, cls).resource_setup()
@test.attr(type="gate")
@testtools.skipIf(not CONF.service_available.nova,
diff --git a/tempest/api/volume/admin/test_multi_backend.py b/tempest/api/volume/admin/test_multi_backend.py
index 245161a..32cdb01 100644
--- a/tempest/api/volume/admin/test_multi_backend.py
+++ b/tempest/api/volume/admin/test_multi_backend.py
@@ -24,11 +24,16 @@
class VolumeMultiBackendV2Test(base.BaseVolumeAdminTest):
@classmethod
- def resource_setup(cls):
- super(VolumeMultiBackendV2Test, cls).resource_setup()
+ def skip_checks(cls):
+ super(VolumeMultiBackendV2Test, cls).skip_checks()
+
if not CONF.volume_feature_enabled.multi_backend:
raise cls.skipException("Cinder multi-backend feature disabled")
+ @classmethod
+ def resource_setup(cls):
+ super(VolumeMultiBackendV2Test, cls).resource_setup()
+
cls.backend1_name = CONF.volume.backend1_name
cls.backend2_name = CONF.volume.backend2_name
diff --git a/tempest/api/volume/admin/test_snapshots_actions.py b/tempest/api/volume/admin/test_snapshots_actions.py
index e7d9d7b..a4b4e3e 100644
--- a/tempest/api/volume/admin/test_snapshots_actions.py
+++ b/tempest/api/volume/admin/test_snapshots_actions.py
@@ -21,9 +21,13 @@
class SnapshotsActionsV2Test(base.BaseVolumeAdminTest):
@classmethod
+ def setup_clients(cls):
+ super(SnapshotsActionsV2Test, cls).setup_clients()
+ cls.client = cls.snapshots_client
+
+ @classmethod
def resource_setup(cls):
super(SnapshotsActionsV2Test, cls).resource_setup()
- cls.client = cls.snapshots_client
# Create a test shared volume for tests
vol_name = data_utils.rand_name(cls.__name__ + '-Volume-')
diff --git a/tempest/api/volume/admin/test_volume_quotas.py b/tempest/api/volume/admin/test_volume_quotas.py
index 2a30b54..f41a97e 100644
--- a/tempest/api/volume/admin/test_volume_quotas.py
+++ b/tempest/api/volume/admin/test_volume_quotas.py
@@ -26,8 +26,8 @@
force_tenant_isolation = True
@classmethod
- def resource_setup(cls):
- super(BaseVolumeQuotasAdminV2TestJSON, cls).resource_setup()
+ def setup_credentials(cls):
+ super(BaseVolumeQuotasAdminV2TestJSON, cls).setup_credentials()
cls.demo_tenant_id = cls.isolated_creds.get_primary_creds().tenant_id
@test.attr(type='gate')
diff --git a/tempest/api/volume/admin/test_volume_quotas_negative.py b/tempest/api/volume/admin/test_volume_quotas_negative.py
index f972457..e37d8f2 100644
--- a/tempest/api/volume/admin/test_volume_quotas_negative.py
+++ b/tempest/api/volume/admin/test_volume_quotas_negative.py
@@ -23,10 +23,14 @@
force_tenant_isolation = True
@classmethod
+ def setup_credentials(cls):
+ super(BaseVolumeQuotasNegativeV2TestJSON, cls).setup_credentials()
+ cls.demo_user = cls.isolated_creds.get_primary_creds()
+ cls.demo_tenant_id = cls.demo_user.tenant_id
+
+ @classmethod
def resource_setup(cls):
super(BaseVolumeQuotasNegativeV2TestJSON, cls).resource_setup()
- demo_user = cls.isolated_creds.get_primary_creds()
- cls.demo_tenant_id = demo_user.tenant_id
cls.shared_quota_set = {'gigabytes': 3, 'volumes': 1, 'snapshots': 1}
# NOTE(gfidente): no need to restore original quota set
diff --git a/tempest/api/volume/admin/test_volumes_actions.py b/tempest/api/volume/admin/test_volumes_actions.py
index 439dd35..fb16872 100644
--- a/tempest/api/volume/admin/test_volumes_actions.py
+++ b/tempest/api/volume/admin/test_volumes_actions.py
@@ -21,9 +21,13 @@
class VolumesActionsV2Test(base.BaseVolumeAdminTest):
@classmethod
+ def setup_clients(cls):
+ super(VolumesActionsV2Test, cls).setup_clients()
+ cls.client = cls.volumes_client
+
+ @classmethod
def resource_setup(cls):
super(VolumesActionsV2Test, cls).resource_setup()
- cls.client = cls.volumes_client
# Create a test shared volume for tests
vol_name = utils.rand_name(cls.__name__ + '-Volume-')
diff --git a/tempest/api/volume/admin/test_volumes_backup.py b/tempest/api/volume/admin/test_volumes_backup.py
index d572893..4db9f7e 100644
--- a/tempest/api/volume/admin/test_volumes_backup.py
+++ b/tempest/api/volume/admin/test_volumes_backup.py
@@ -26,12 +26,15 @@
class VolumesBackupsV2Test(base.BaseVolumeAdminTest):
@classmethod
- def resource_setup(cls):
- super(VolumesBackupsV2Test, cls).resource_setup()
-
+ def skip_checks(cls):
+ super(VolumesBackupsV2Test, cls).skip_checks()
if not CONF.volume_feature_enabled.backup:
raise cls.skipException("Cinder backup feature disabled")
+ @classmethod
+ def resource_setup(cls):
+ super(VolumesBackupsV2Test, cls).resource_setup()
+
cls.volume = cls.create_volume()
@test.attr(type='smoke')
diff --git a/tempest/api/volume/base.py b/tempest/api/volume/base.py
index 2489b79..c672607 100644
--- a/tempest/api/volume/base.py
+++ b/tempest/api/volume/base.py
@@ -33,28 +33,37 @@
_api_version = 2
@classmethod
- def resource_setup(cls):
- cls.set_network_resources()
- super(BaseVolumeTest, cls).resource_setup()
+ def skip_checks(cls):
+ super(BaseVolumeTest, cls).skip_checks()
if not CONF.service_available.cinder:
skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
raise cls.skipException(skip_msg)
-
- cls.os = cls.get_client_manager()
-
- cls.servers_client = cls.os.servers_client
- cls.image_ref = CONF.compute.image_ref
- cls.flavor_ref = CONF.compute.flavor_ref
- cls.build_interval = CONF.volume.build_interval
- cls.build_timeout = CONF.volume.build_timeout
- cls.snapshots = []
- cls.volumes = []
-
if cls._api_version == 1:
if not CONF.volume_feature_enabled.api_v1:
msg = "Volume API v1 is disabled"
raise cls.skipException(msg)
+ elif cls._api_version == 2:
+ if not CONF.volume_feature_enabled.api_v2:
+ msg = "Volume API v2 is disabled"
+ raise cls.skipException(msg)
+ else:
+ msg = ("Invalid Cinder API version (%s)" % cls._api_version)
+ raise exceptions.InvalidConfiguration(message=msg)
+
+ @classmethod
+ def setup_credentials(cls):
+ cls.set_network_resources()
+ super(BaseVolumeTest, cls).setup_credentials()
+ cls.os = cls.get_client_manager()
+
+ @classmethod
+ def setup_clients(cls):
+ super(BaseVolumeTest, cls).setup_clients()
+
+ cls.servers_client = cls.os.servers_client
+
+ if cls._api_version == 1:
cls.snapshots_client = cls.os.snapshots_client
cls.volumes_client = cls.os.volumes_client
cls.backups_client = cls.os.backups_client
@@ -62,27 +71,33 @@
cls.volumes_extension_client = cls.os.volumes_extension_client
cls.availability_zone_client = (
cls.os.volume_availability_zone_client)
- # Special fields and resp code for cinder v1
- cls.special_fields = {'name_field': 'display_name',
- 'descrip_field': 'display_description'}
-
- elif cls._api_version == 2:
- if not CONF.volume_feature_enabled.api_v2:
- msg = "Volume API v2 is disabled"
- raise cls.skipException(msg)
+ else:
cls.snapshots_client = cls.os.snapshots_v2_client
cls.volumes_client = cls.os.volumes_v2_client
cls.volumes_extension_client = cls.os.volumes_v2_extension_client
cls.availability_zone_client = (
cls.os.volume_v2_availability_zone_client)
+
+ @classmethod
+ def resource_setup(cls):
+ super(BaseVolumeTest, cls).resource_setup()
+
+ cls.snapshots = []
+ cls.volumes = []
+ cls.image_ref = CONF.compute.image_ref
+ cls.flavor_ref = CONF.compute.flavor_ref
+ cls.build_interval = CONF.volume.build_interval
+ cls.build_timeout = CONF.volume.build_timeout
+
+ if cls._api_version == 1:
+ # Special fields and resp code for cinder v1
+ cls.special_fields = {'name_field': 'display_name',
+ 'descrip_field': 'display_description'}
+ else:
# Special fields and resp code for cinder v2
cls.special_fields = {'name_field': 'name',
'descrip_field': 'description'}
- else:
- msg = ("Invalid Cinder API version (%s)" % cls._api_version)
- raise exceptions.InvalidConfiguration(message=msg)
-
@classmethod
def resource_cleanup(cls):
cls.clear_snapshots()
@@ -148,10 +163,10 @@
class BaseVolumeAdminTest(BaseVolumeTest):
"""Base test case class for all Volume Admin API tests."""
- @classmethod
- def resource_setup(cls):
- super(BaseVolumeAdminTest, cls).resource_setup()
+ @classmethod
+ def setup_credentials(cls):
+ super(BaseVolumeAdminTest, cls).setup_credentials()
try:
cls.adm_creds = cls.isolated_creds.get_admin_creds()
cls.os_adm = clients.Manager(credentials=cls.adm_creds)
@@ -159,12 +174,11 @@
msg = "Missing Volume Admin API credentials in configuration."
raise cls.skipException(msg)
- cls.qos_specs = []
+ @classmethod
+ def setup_clients(cls):
+ super(BaseVolumeAdminTest, cls).setup_clients()
if cls._api_version == 1:
- if not CONF.volume_feature_enabled.api_v1:
- msg = "Volume API v1 is disabled"
- raise cls.skipException(msg)
cls.volume_qos_client = cls.os_adm.volume_qos_client
cls.admin_volume_services_client = \
cls.os_adm.volume_services_client
@@ -175,9 +189,6 @@
cls.backups_adm_client = cls.os_adm.backups_client
cls.quotas_client = cls.os_adm.volume_quotas_client
elif cls._api_version == 2:
- if not CONF.volume_feature_enabled.api_v2:
- msg = "Volume API v2 is disabled"
- raise cls.skipException(msg)
cls.volume_qos_client = cls.os_adm.volume_qos_v2_client
cls.admin_volume_services_client = \
cls.os_adm.volume_services_v2_client
@@ -189,6 +200,12 @@
cls.quotas_client = cls.os_adm.volume_quotas_v2_client
@classmethod
+ def resource_setup(cls):
+ super(BaseVolumeAdminTest, cls).resource_setup()
+
+ cls.qos_specs = []
+
+ @classmethod
def resource_cleanup(cls):
cls.clear_qos_specs()
super(BaseVolumeAdminTest, cls).resource_cleanup()
diff --git a/tempest/api/volume/test_availability_zone.py b/tempest/api/volume/test_availability_zone.py
index bd3d2a1..b6e226d 100644
--- a/tempest/api/volume/test_availability_zone.py
+++ b/tempest/api/volume/test_availability_zone.py
@@ -24,8 +24,8 @@
"""
@classmethod
- def resource_setup(cls):
- super(AvailabilityZoneV2TestJSON, cls).resource_setup()
+ def setup_clients(cls):
+ super(AvailabilityZoneV2TestJSON, cls).setup_clients()
cls.client = cls.availability_zone_client
@test.attr(type='gate')
diff --git a/tempest/api/volume/test_snapshot_metadata.py b/tempest/api/volume/test_snapshot_metadata.py
index 03474ba..e1fe779 100644
--- a/tempest/api/volume/test_snapshot_metadata.py
+++ b/tempest/api/volume/test_snapshot_metadata.py
@@ -20,9 +20,13 @@
class SnapshotV2MetadataTestJSON(base.BaseVolumeTest):
@classmethod
+ def setup_clients(cls):
+ super(SnapshotV2MetadataTestJSON, cls).setup_clients()
+ cls.client = cls.snapshots_client
+
+ @classmethod
def resource_setup(cls):
super(SnapshotV2MetadataTestJSON, cls).resource_setup()
- cls.client = cls.snapshots_client
# Create a volume
cls.volume = cls.create_volume()
# Create a snapshot
diff --git a/tempest/api/volume/test_volume_transfers.py b/tempest/api/volume/test_volume_transfers.py
index 7451050..6f75403 100644
--- a/tempest/api/volume/test_volume_transfers.py
+++ b/tempest/api/volume/test_volume_transfers.py
@@ -17,6 +17,7 @@
from tempest.api.volume import base
from tempest import clients
+from tempest.common import credentials
from tempest import config
from tempest import test
@@ -26,18 +27,24 @@
class VolumesV2TransfersTest(base.BaseVolumeTest):
@classmethod
- def resource_setup(cls):
- super(VolumesV2TransfersTest, cls).resource_setup()
+ def skip_checks(cls):
+ super(VolumesV2TransfersTest, cls).skip_checks()
+ if not credentials.is_admin_available():
+ msg = "Missing Volume Admin API credentials in configuration."
+ raise cls.skipException(msg)
+ @classmethod
+ def setup_credentials(cls):
+ super(VolumesV2TransfersTest, cls).setup_credentials()
# Add another tenant to test volume-transfer
cls.os_alt = clients.Manager(cls.isolated_creds.get_alt_creds())
# Add admin tenant to cleanup resources
- try:
- creds = cls.isolated_creds.get_admin_creds()
- cls.os_adm = clients.Manager(credentials=creds)
- except NotImplementedError:
- msg = "Missing Volume Admin API credentials in configuration."
- raise cls.skipException(msg)
+ creds = cls.isolated_creds.get_admin_creds()
+ cls.os_adm = clients.Manager(credentials=creds)
+
+ @classmethod
+ def setup_clients(cls):
+ super(VolumesV2TransfersTest, cls).setup_clients()
cls.client = cls.volumes_client
cls.alt_client = cls.os_alt.volumes_client
diff --git a/tempest/api/volume/test_volumes_actions.py b/tempest/api/volume/test_volumes_actions.py
index 333a4f7..e5f7aa4 100644
--- a/tempest/api/volume/test_volumes_actions.py
+++ b/tempest/api/volume/test_volumes_actions.py
@@ -24,11 +24,15 @@
class VolumesV2ActionsTest(base.BaseVolumeTest):
@classmethod
- def resource_setup(cls):
- super(VolumesV2ActionsTest, cls).resource_setup()
+ def setup_clients(cls):
+ super(VolumesV2ActionsTest, cls).setup_clients()
cls.client = cls.volumes_client
cls.image_client = cls.os.image_client
+ @classmethod
+ def resource_setup(cls):
+ super(VolumesV2ActionsTest, cls).resource_setup()
+
# Create a test shared instance
srv_name = data_utils.rand_name(cls.__name__ + '-Instance-')
cls.server = cls.servers_client.create_server(srv_name,
diff --git a/tempest/api/volume/test_volumes_extend.py b/tempest/api/volume/test_volumes_extend.py
index ebe6084..fab25ec 100644
--- a/tempest/api/volume/test_volumes_extend.py
+++ b/tempest/api/volume/test_volumes_extend.py
@@ -23,8 +23,8 @@
class VolumesV2ExtendTest(base.BaseVolumeTest):
@classmethod
- def resource_setup(cls):
- super(VolumesV2ExtendTest, cls).resource_setup()
+ def setup_clients(cls):
+ super(VolumesV2ExtendTest, cls).setup_clients()
cls.client = cls.volumes_client
@test.attr(type='gate')
diff --git a/tempest/api/volume/test_volumes_get.py b/tempest/api/volume/test_volumes_get.py
index 2a49210..3133df4 100644
--- a/tempest/api/volume/test_volumes_get.py
+++ b/tempest/api/volume/test_volumes_get.py
@@ -26,9 +26,13 @@
class VolumesV2GetTest(base.BaseVolumeTest):
@classmethod
+ def setup_clients(cls):
+ super(VolumesV2GetTest, cls).setup_clients()
+ cls.client = cls.volumes_client
+
+ @classmethod
def resource_setup(cls):
super(VolumesV2GetTest, cls).resource_setup()
- cls.client = cls.volumes_client
cls.name_field = cls.special_fields['name_field']
cls.descrip_field = cls.special_fields['descrip_field']
diff --git a/tempest/api/volume/test_volumes_list.py b/tempest/api/volume/test_volumes_list.py
index 91beae9..9a8746a 100644
--- a/tempest/api/volume/test_volumes_list.py
+++ b/tempest/api/volume/test_volumes_list.py
@@ -55,9 +55,13 @@
[str_vol(v) for v in fetched_list]))
@classmethod
+ def setup_clients(cls):
+ super(VolumesV2ListTestJSON, cls).setup_clients()
+ cls.client = cls.volumes_client
+
+ @classmethod
def resource_setup(cls):
super(VolumesV2ListTestJSON, cls).resource_setup()
- cls.client = cls.volumes_client
cls.name = cls.VOLUME_FIELDS[1]
# Create 3 test volumes
diff --git a/tempest/api/volume/test_volumes_negative.py b/tempest/api/volume/test_volumes_negative.py
index 595ddf4..c827f9e 100644
--- a/tempest/api/volume/test_volumes_negative.py
+++ b/tempest/api/volume/test_volumes_negative.py
@@ -25,9 +25,13 @@
class VolumesV2NegativeTest(base.BaseVolumeTest):
@classmethod
+ def setup_clients(cls):
+ super(VolumesV2NegativeTest, cls).setup_clients()
+ cls.client = cls.volumes_client
+
+ @classmethod
def resource_setup(cls):
super(VolumesV2NegativeTest, cls).resource_setup()
- cls.client = cls.volumes_client
cls.name_field = cls.special_fields['name_field']
diff --git a/tempest/api/volume/test_volumes_snapshots.py b/tempest/api/volume/test_volumes_snapshots.py
index 98598c1..c4f8096 100644
--- a/tempest/api/volume/test_volumes_snapshots.py
+++ b/tempest/api/volume/test_volumes_snapshots.py
@@ -23,13 +23,16 @@
class VolumesV2SnapshotTestJSON(base.BaseVolumeTest):
@classmethod
+ def skip_checks(cls):
+ super(VolumesV2SnapshotTestJSON, cls).skip_checks()
+ if not CONF.volume_feature_enabled.snapshot:
+ raise cls.skipException("Cinder volume snapshots are disabled")
+
+ @classmethod
def resource_setup(cls):
super(VolumesV2SnapshotTestJSON, cls).resource_setup()
cls.volume_origin = cls.create_volume()
- if not CONF.volume_feature_enabled.snapshot:
- raise cls.skipException("Cinder volume snapshots are disabled")
-
cls.name_field = cls.special_fields['name_field']
cls.descrip_field = cls.special_fields['descrip_field']
diff --git a/tempest/api/volume/test_volumes_snapshots_negative.py b/tempest/api/volume/test_volumes_snapshots_negative.py
index 8b68ea9..3ad23f7 100644
--- a/tempest/api/volume/test_volumes_snapshots_negative.py
+++ b/tempest/api/volume/test_volumes_snapshots_negative.py
@@ -25,9 +25,8 @@
class VolumesV2SnapshotNegativeTestJSON(base.BaseVolumeTest):
@classmethod
- def resource_setup(cls):
- super(VolumesV2SnapshotNegativeTestJSON, cls).resource_setup()
-
+ def skip_checks(cls):
+ super(VolumesV2SnapshotNegativeTestJSON, cls).skip_checks()
if not CONF.volume_feature_enabled.snapshot:
raise cls.skipException("Cinder volume snapshots are disabled")
diff --git a/tempest/api/volume/v2/test_volumes_list.py b/tempest/api/volume/v2/test_volumes_list.py
index bc14b2c..3a21f41 100644
--- a/tempest/api/volume/v2/test_volumes_list.py
+++ b/tempest/api/volume/v2/test_volumes_list.py
@@ -31,9 +31,13 @@
"""
@classmethod
+ def setup_clients(cls):
+ super(VolumesV2ListTestJSON, cls).setup_clients()
+ cls.client = cls.volumes_client
+
+ @classmethod
def resource_setup(cls):
super(VolumesV2ListTestJSON, cls).resource_setup()
- cls.client = cls.volumes_client
# Create 3 test volumes
cls.volume_list = []
diff --git a/tempest/auth.py b/tempest/auth.py
index f78bb20..7b00f2a 100644
--- a/tempest/auth.py
+++ b/tempest/auth.py
@@ -186,9 +186,9 @@
token_expiry_threshold = datetime.timedelta(seconds=60)
- def __init__(self, credentials):
+ def __init__(self, credentials, auth_url):
super(KeystoneAuthProvider, self).__init__(credentials)
- self.auth_client = self._auth_client()
+ self.auth_client = self._auth_client(auth_url)
def _decorate_request(self, filters, method, url, headers=None, body=None,
auth_data=None):
@@ -236,8 +236,8 @@
EXPIRY_DATE_FORMAT = '%Y-%m-%dT%H:%M:%SZ'
- def _auth_client(self):
- return json_id.TokenClientJSON()
+ def _auth_client(self, auth_url):
+ return json_id.TokenClientJSON(auth_url)
def _auth_params(self):
return dict(
@@ -314,8 +314,8 @@
EXPIRY_DATE_FORMAT = '%Y-%m-%dT%H:%M:%S.%fZ'
- def _auth_client(self):
- return json_v3id.V3TokenClientJSON()
+ def _auth_client(self, auth_url):
+ return json_v3id.V3TokenClientJSON(auth_url)
def _auth_params(self):
return dict(
@@ -430,10 +430,12 @@
return identity_version in IDENTITY_VERSION
-def get_credentials(fill_in=True, identity_version='v2', **kwargs):
+def get_credentials(auth_url, fill_in=True, identity_version='v2', **kwargs):
"""
Builds a credentials object based on the configured auth_version
+ :param auth_url (string): Full URI of the OpenStack Identity API(Keystone)
+ which is used to fetch the token from Identity service.
:param fill_in (boolean): obtain a token and fill in all credential
details provided by the identity service. When fill_in is not
specified, credentials are not validated. Validation can be invoked
@@ -460,7 +462,7 @@
creds = credential_class(**kwargs)
# Fill in the credentials fields that were not specified
if fill_in:
- auth_provider = auth_provider_class(creds)
+ auth_provider = auth_provider_class(creds, auth_url)
creds = auth_provider.fill_credentials()
return creds
diff --git a/tempest/clients.py b/tempest/clients.py
index bb08d87..fa3f65e 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -320,9 +320,9 @@
self.region_client = RegionClientJSON(self.auth_provider, **params)
self.credentials_client = CredentialsClientJSON(self.auth_provider,
**params)
- self.token_client = TokenClientJSON()
+ self.token_client = TokenClientJSON(CONF.identity.uri)
if CONF.identity_feature_enabled.api_v3:
- self.token_v3_client = V3TokenClientJSON()
+ self.token_v3_client = V3TokenClientJSON(CONF.identity.uri_v3)
def _set_volume_clients(self):
params = {
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index 503745c..b11a3c8 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -176,7 +176,7 @@
username=user,
password=pw,
tenant_name=tenant)
- _auth = tempest.auth.KeystoneV2AuthProvider(_creds)
+ _auth = tempest.auth.KeystoneV2AuthProvider(_creds, CONF.identity.uri)
self.identity = identity_client.IdentityClientJSON(
_auth,
CONF.identity.catalog_type,
diff --git a/tempest/common/cred_provider.py b/tempest/common/cred_provider.py
index d899303..033410e 100644
--- a/tempest/common/cred_provider.py
+++ b/tempest/common/cred_provider.py
@@ -76,7 +76,11 @@
if 'domain' in x)
if not domain_fields.intersection(kwargs.keys()):
kwargs['user_domain_name'] = CONF.identity.admin_domain_name
- return auth.get_credentials(fill_in=fill_in,
+ auth_url = CONF.identity.uri_v3
+ else:
+ auth_url = CONF.identity.uri
+ return auth.get_credentials(auth_url,
+ fill_in=fill_in,
identity_version=identity_version,
**kwargs)
diff --git a/tempest/common/isolated_creds.py b/tempest/common/isolated_creds.py
index f81c3ed..3eed689 100644
--- a/tempest/common/isolated_creds.py
+++ b/tempest/common/isolated_creds.py
@@ -333,6 +333,7 @@
if (not self.network_resources or
self.network_resources.get('network')):
self._clear_isolated_network(network['id'], network['name'])
+ self.isolated_net_resources = {}
def clear_isolated_creds(self):
if not self.isolated_creds:
@@ -349,6 +350,7 @@
except lib_exc.NotFound:
LOG.warn("tenant with name: %s not found for delete" %
creds.tenant_name)
+ self.isolated_creds = {}
def is_multi_user(self):
return True
diff --git a/tempest/manager.py b/tempest/manager.py
index 421d2de..50f7e6e 100644
--- a/tempest/manager.py
+++ b/tempest/manager.py
@@ -54,14 +54,14 @@
@classmethod
def get_auth_provider_class(cls, credentials):
if isinstance(credentials, auth.KeystoneV3Credentials):
- return auth.KeystoneV3AuthProvider
+ return auth.KeystoneV3AuthProvider, CONF.identity.uri_v3
else:
- return auth.KeystoneV2AuthProvider
+ return auth.KeystoneV2AuthProvider, CONF.identity.uri
def get_auth_provider(self, credentials):
if credentials is None:
raise exceptions.InvalidCredentials(
'Credentials must be specified')
- auth_provider_class = self.get_auth_provider_class(credentials)
- return auth_provider_class(
- credentials=credentials)
+ auth_provider_class, auth_url = self.get_auth_provider_class(
+ credentials)
+ return auth_provider_class(credentials, auth_url)
diff --git a/tempest/services/compute/json/floating_ips_client.py b/tempest/services/compute/json/floating_ips_client.py
index 8e3a3c9..0354ba4 100644
--- a/tempest/services/compute/json/floating_ips_client.py
+++ b/tempest/services/compute/json/floating_ips_client.py
@@ -40,8 +40,6 @@
url = "os-floating-ips/%s" % str(floating_ip_id)
resp, body = self.get(url)
body = json.loads(body)
- if resp.status == 404:
- raise lib_exc.NotFound(body)
self.validate_response(schema.floating_ip, resp, body)
return service_client.ResponseBody(resp, body['floating_ip'])
diff --git a/tempest/services/identity/json/token_client.py b/tempest/services/identity/json/token_client.py
index 1e8b31e..b28dabb 100644
--- a/tempest/services/identity/json/token_client.py
+++ b/tempest/services/identity/json/token_client.py
@@ -16,17 +16,13 @@
from tempest_lib import exceptions as lib_exc
from tempest.common import service_client
-from tempest import config
from tempest import exceptions
-CONF = config.CONF
-
class TokenClientJSON(service_client.ServiceClient):
- def __init__(self):
+ def __init__(self, auth_url):
super(TokenClientJSON, self).__init__(None, None, None)
- auth_url = CONF.identity.uri
# Normalize URI to ensure /tokens is in it.
if 'tokens' not in auth_url:
diff --git a/tempest/services/identity/v3/json/token_client.py b/tempest/services/identity/v3/json/token_client.py
index 5d75efa..582897a 100644
--- a/tempest/services/identity/v3/json/token_client.py
+++ b/tempest/services/identity/v3/json/token_client.py
@@ -16,17 +16,13 @@
from tempest_lib import exceptions as lib_exc
from tempest.common import service_client
-from tempest import config
from tempest import exceptions
-CONF = config.CONF
-
class V3TokenClientJSON(service_client.ServiceClient):
- def __init__(self):
+ def __init__(self, auth_url):
super(V3TokenClientJSON, self).__init__(None, None, None)
- auth_url = CONF.identity.uri_v3
if not auth_url:
raise exceptions.InvalidConfiguration('you must specify a v3 uri '
'if using the v3 identity '
diff --git a/tempest/services/network/json/network_client.py b/tempest/services/network/json/network_client.py
index 5106225..ba069e8 100644
--- a/tempest/services/network/json/network_client.py
+++ b/tempest/services/network/json/network_client.py
@@ -320,6 +320,8 @@
cur_gw_info.pop('enable_snat', None)
update_body['external_gateway_info'] = kwargs.get(
'external_gateway_info', body['router']['external_gateway_info'])
+ if 'distributed' in kwargs:
+ update_body['distributed'] = kwargs['distributed']
update_body = dict(router=update_body)
update_body = json.dumps(update_body)
resp, body = self.put(uri, update_body)
diff --git a/tempest/tests/common/test_accounts.py b/tempest/tests/common/test_accounts.py
index f45f2cf..a836a20 100644
--- a/tempest/tests/common/test_accounts.py
+++ b/tempest/tests/common/test_accounts.py
@@ -73,7 +73,8 @@
test_account_class = accounts.Accounts('test_name')
hash_list = self._get_hash_list(self.test_accounts)
test_cred_dict = self.test_accounts[3]
- test_creds = auth.get_credentials(**test_cred_dict)
+ test_creds = auth.get_credentials(fake_identity.FAKE_AUTH_URL,
+ **test_cred_dict)
results = test_account_class.get_hash(test_creds)
self.assertEqual(hash_list[3], results)
diff --git a/tempest/tests/fake_identity.py b/tempest/tests/fake_identity.py
index 97098e1..ad78f85 100644
--- a/tempest/tests/fake_identity.py
+++ b/tempest/tests/fake_identity.py
@@ -17,6 +17,7 @@
import httplib2
+FAKE_AUTH_URL = 'http://fake_uri.com/auth'
TOKEN = "fake_token"
ALT_TOKEN = "alt_fake_token"
diff --git a/tempest/tests/test_auth.py b/tempest/tests/test_auth.py
index 0317ad6..c236dbe 100644
--- a/tempest/tests/test_auth.py
+++ b/tempest/tests/test_auth.py
@@ -38,11 +38,11 @@
_auth_provider_class = None
credentials = fake_credentials.FakeCredentials()
- def _auth(self, credentials, **params):
+ def _auth(self, credentials, auth_url, **params):
"""
returns auth method according to keystone
"""
- return self._auth_provider_class(credentials, **params)
+ return self._auth_provider_class(credentials, auth_url, **params)
def setUp(self):
super(BaseAuthTestsSetUp, self).setUp()
@@ -50,7 +50,8 @@
self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
self.fake_http = fake_http.fake_httplib2(return_type=200)
self.stubs.Set(auth, 'get_credentials', fake_get_credentials)
- self.auth_provider = self._auth(self.credentials)
+ self.auth_provider = self._auth(self.credentials,
+ fake_identity.FAKE_AUTH_URL)
class TestBaseAuthProvider(BaseAuthTestsSetUp):
@@ -78,6 +79,12 @@
_auth_provider_class = FakeAuthProviderImpl
+ def _auth(self, credentials, auth_url, **params):
+ """
+ returns auth method according to keystone
+ """
+ return self._auth_provider_class(credentials, **params)
+
def test_check_credentials_bad_type(self):
self.assertFalse(self.auth_provider.check_credentials([]))
diff --git a/tempest/tests/test_credentials.py b/tempest/tests/test_credentials.py
index 7621f6e..54a3360 100644
--- a/tempest/tests/test_credentials.py
+++ b/tempest/tests/test_credentials.py
@@ -84,7 +84,8 @@
self.identity_response)
def _verify_credentials(self, credentials_class, creds_dict, filled=True):
- creds = auth.get_credentials(fill_in=filled,
+ creds = auth.get_credentials(fake_identity.FAKE_AUTH_URL,
+ fill_in=filled,
identity_version=self.identity_version,
**creds_dict)
self._check(creds, credentials_class, filled)