Merge "Convert scenario tests to use global CONF object"
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 32b9d7e..12d81cc 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -35,11 +35,13 @@
from tempest.common import isolated_creds
from tempest.common.utils import data_utils
from tempest.common.utils.linux.remote_client import RemoteClient
+from tempest import config
from tempest import exceptions
import tempest.manager
from tempest.openstack.common import log
import tempest.test
+CONF = config.CONF
LOG = log.getLogger(__name__)
@@ -89,14 +91,14 @@
# each user that operations need to be performed for.
self._validate_credentials(username, password, tenant_name)
- auth_url = self.config.identity.uri
- dscv = self.config.identity.disable_ssl_certificate_validation
- region = self.config.identity.region
+ auth_url = CONF.identity.uri
+ dscv = CONF.identity.disable_ssl_certificate_validation
+ region = CONF.identity.region
client_args = (username, password, tenant_name, auth_url)
# Create our default Nova client to use in testing
- service_type = self.config.compute.catalog_type
+ service_type = CONF.compute.catalog_type
return novaclient.client.Client(self.NOVACLIENT_VERSION,
*client_args,
service_type=service_type,
@@ -107,17 +109,17 @@
def _get_image_client(self):
token = self.identity_client.auth_token
- region = self.config.identity.region
+ region = CONF.identity.region
endpoint = self.identity_client.service_catalog.url_for(
attr='region', filter_value=region,
service_type='image', endpoint_type='publicURL')
- dscv = self.config.identity.disable_ssl_certificate_validation
+ dscv = CONF.identity.disable_ssl_certificate_validation
return glanceclient.Client('1', endpoint=endpoint, token=token,
insecure=dscv)
def _get_volume_client(self, username, password, tenant_name):
- auth_url = self.config.identity.uri
- region = self.config.identity.region
+ auth_url = CONF.identity.uri
+ region = CONF.identity.region
return cinderclient.client.Client(self.CINDERCLIENT_VERSION,
username,
password,
@@ -127,16 +129,16 @@
http_log_debug=True)
def _get_object_storage_client(self, username, password, tenant_name):
- auth_url = self.config.identity.uri
+ auth_url = CONF.identity.uri
# add current tenant to swift operator role group.
keystone_admin = self._get_identity_client(
- self.config.identity.admin_username,
- self.config.identity.admin_password,
- self.config.identity.admin_tenant_name)
+ CONF.identity.admin_username,
+ CONF.identity.admin_password,
+ CONF.identity.admin_tenant_name)
# enable test user to operate swift by adding operator role to him.
roles = keystone_admin.roles.list()
- operator_role = self.config.object_storage.operator_role
+ operator_role = CONF.object_storage.operator_role
member_role = [role for role in roles if role.name == operator_role][0]
# NOTE(maurosr): This is surrounded in the try-except block cause
# neutron tests doesn't have tenant isolation.
@@ -154,16 +156,16 @@
def _get_orchestration_client(self, username=None, password=None,
tenant_name=None):
if not username:
- username = self.config.identity.admin_username
+ username = CONF.identity.admin_username
if not password:
- password = self.config.identity.admin_password
+ password = CONF.identity.admin_password
if not tenant_name:
- tenant_name = self.config.identity.tenant_name
+ tenant_name = CONF.identity.tenant_name
self._validate_credentials(username, password, tenant_name)
keystone = self._get_identity_client(username, password, tenant_name)
- region = self.config.identity.region
+ region = CONF.identity.region
token = keystone.auth_token
try:
endpoint = keystone.service_catalog.url_for(
@@ -185,8 +187,8 @@
# of the identity service, so use admin credentials by default.
self._validate_credentials(username, password, tenant_name)
- auth_url = self.config.identity.uri
- dscv = self.config.identity.disable_ssl_certificate_validation
+ auth_url = CONF.identity.uri
+ dscv = CONF.identity.disable_ssl_certificate_validation
return keystoneclient.v2_0.client.Client(username=username,
password=password,
@@ -201,14 +203,14 @@
# preferable to authenticating as a specific user because
# working with certain resources (public routers and networks)
# often requires admin privileges anyway.
- username = self.config.identity.admin_username
- password = self.config.identity.admin_password
- tenant_name = self.config.identity.admin_tenant_name
+ username = CONF.identity.admin_username
+ password = CONF.identity.admin_password
+ tenant_name = CONF.identity.admin_tenant_name
self._validate_credentials(username, password, tenant_name)
- auth_url = self.config.identity.uri
- dscv = self.config.identity.disable_ssl_certificate_validation
+ auth_url = CONF.identity.uri
+ dscv = CONF.identity.disable_ssl_certificate_validation
return neutronclient.v2_0.client.Client(username=username,
password=password,
@@ -252,12 +254,12 @@
@classmethod
def _get_credentials(cls, get_creds, prefix):
- if cls.config.compute.allow_tenant_isolation:
+ if CONF.compute.allow_tenant_isolation:
username, tenant_name, password = get_creds()
else:
- username = getattr(cls.config.identity, prefix + 'username')
- password = getattr(cls.config.identity, prefix + 'password')
- tenant_name = getattr(cls.config.identity, prefix + 'tenant_name')
+ username = getattr(CONF.identity, prefix + 'username')
+ password = getattr(CONF.identity, prefix + 'password')
+ tenant_name = getattr(CONF.identity, prefix + 'tenant_name')
return username, password, tenant_name
@classmethod
@@ -403,8 +405,8 @@
thing, log_status, new_status)
if not tempest.test.call_until_true(
check_status,
- self.config.compute.build_timeout,
- self.config.compute.build_interval):
+ CONF.compute.build_timeout,
+ CONF.compute.build_interval):
message = ("Timed out waiting for thing %s "
"to become %s") % (thing_id, log_status)
raise exceptions.TimeoutException(message)
@@ -454,9 +456,9 @@
if name is None:
name = data_utils.rand_name('scenario-server-')
if image is None:
- image = self.config.compute.image_ref
+ image = CONF.compute.image_ref
if flavor is None:
- flavor = self.config.compute.flavor_ref
+ flavor = CONF.compute.flavor_ref
LOG.debug("Creating a server (name: %s, image: %s, flavor: %s)",
name, image, flavor)
server = client.servers.create(name, image, flavor, **create_kwargs)
@@ -519,10 +521,10 @@
if isinstance(server_or_ip, basestring):
ip = server_or_ip
else:
- network_name_for_ssh = self.config.compute.network_for_ssh
+ network_name_for_ssh = CONF.compute.network_for_ssh
ip = server_or_ip.networks[network_name_for_ssh][0]
if username is None:
- username = self.config.scenario.ssh_user
+ username = CONF.scenario.ssh_user
if private_key is None:
private_key = self.keypair.private_key
return RemoteClient(ip, username, pkey=private_key)
@@ -542,7 +544,7 @@
@classmethod
def check_preconditions(cls):
- if (cls.config.service_available.neutron):
+ if (CONF.service_available.neutron):
cls.enabled = True
# verify that neutron_available is telling the truth
try:
@@ -558,13 +560,13 @@
@classmethod
def setUpClass(cls):
super(NetworkScenarioTest, cls).setUpClass()
- if cls.config.compute.allow_tenant_isolation:
+ if CONF.compute.allow_tenant_isolation:
cls.tenant_id = cls.isolated_creds.get_primary_tenant().id
else:
cls.tenant_id = cls.manager._get_identity_client(
- cls.config.identity.username,
- cls.config.identity.password,
- cls.config.identity.tenant_name).tenant_id
+ CONF.identity.username,
+ CONF.identity.password,
+ CONF.identity.tenant_name).tenant_id
def _create_network(self, tenant_id, namestart='network-smoke-'):
name = data_utils.rand_name(namestart)
@@ -619,12 +621,12 @@
Create a subnet for the given network within the cidr block
configured for tenant networks.
"""
- cfg = self.config.network
- tenant_cidr = netaddr.IPNetwork(cfg.tenant_network_cidr)
+ tenant_cidr = netaddr.IPNetwork(CONF.network.tenant_network_cidr)
result = None
# Repeatedly attempt subnet creation with sequential cidr
# blocks until an unallocated block is found.
- for subnet_cidr in tenant_cidr.subnet(cfg.tenant_network_mask_bits):
+ for subnet_cidr in tenant_cidr.subnet(
+ CONF.network.tenant_network_mask_bits):
body = dict(
subnet=dict(
ip_version=4,
@@ -708,7 +710,7 @@
return (proc.returncode == 0) == should_succeed
return tempest.test.call_until_true(
- ping, self.config.compute.ping_timeout, 1)
+ ping, CONF.compute.ping_timeout, 1)
def _check_vm_connectivity(self, ip_address,
username=None,
@@ -904,7 +906,7 @@
return rules
def _ssh_to_server(self, server, private_key):
- ssh_login = self.config.compute.image_ssh_user
+ ssh_login = CONF.compute.image_ssh_user
return self.get_remote_client(server,
username=ssh_login,
private_key=private_key)
@@ -930,8 +932,8 @@
network has, a tenant router will be created and returned that
routes traffic to the public network.
"""
- router_id = self.config.network.public_router_id
- network_id = self.config.network.public_network_id
+ router_id = CONF.network.public_router_id
+ network_id = CONF.network.public_network_id
if router_id:
result = self.network_client.show_router(router_id)
return net_common.AttributeDict(**result['router'])
@@ -984,14 +986,14 @@
@classmethod
def setUpClass(cls):
super(OrchestrationScenarioTest, cls).setUpClass()
- if not cls.config.service_available.heat:
+ if not CONF.service_available.heat:
raise cls.skipException("Heat support is required")
@classmethod
def credentials(cls):
- username = cls.config.identity.admin_username
- password = cls.config.identity.admin_password
- tenant_name = cls.config.identity.tenant_name
+ username = CONF.identity.admin_username
+ password = CONF.identity.admin_password
+ tenant_name = CONF.identity.tenant_name
return username, password, tenant_name
def _load_template(self, base_file, file_name):
@@ -1008,5 +1010,5 @@
def _get_default_network(cls):
networks = cls.network_client.list_networks()
for net in networks['networks']:
- if net['name'] == cls.config.compute.fixed_network_name:
+ if net['name'] == CONF.compute.fixed_network_name:
return net
diff --git a/tempest/scenario/orchestration/test_autoscaling.py b/tempest/scenario/orchestration/test_autoscaling.py
index be7f955..cd7a2b2 100644
--- a/tempest/scenario/orchestration/test_autoscaling.py
+++ b/tempest/scenario/orchestration/test_autoscaling.py
@@ -13,25 +13,28 @@
import heatclient.exc as heat_exceptions
import time
+from tempest import config
from tempest.scenario import manager
from tempest.test import attr
from tempest.test import call_until_true
from tempest.test import services
from tempest.test import skip_because
+CONF = config.CONF
+
class AutoScalingTest(manager.OrchestrationScenarioTest):
def setUp(self):
super(AutoScalingTest, self).setUp()
- if not self.config.orchestration.image_ref:
+ if not CONF.orchestration.image_ref:
raise self.skipException("No image available to test")
self.client = self.orchestration_client
def assign_keypair(self):
self.stack_name = self._stack_rand_name()
- if self.config.orchestration.keypair_name:
- self.keypair_name = self.config.orchestration.keypair_name
+ if CONF.orchestration.keypair_name:
+ self.keypair_name = CONF.orchestration.keypair_name
else:
self.keypair = self.create_keypair()
self.keypair_name = self.keypair.id
@@ -40,8 +43,8 @@
net = self._get_default_network()
self.parameters = {
'KeyName': self.keypair_name,
- 'InstanceType': self.config.orchestration.instance_type,
- 'ImageId': self.config.orchestration.image_ref,
+ 'InstanceType': CONF.orchestration.instance_type,
+ 'ImageId': CONF.orchestration.image_ref,
'StackStart': str(time.time()),
'Subnet': net['subnets'][0]
}
@@ -58,7 +61,7 @@
# if a keypair was set, do not delete the stack on exit to allow
# for manual post-mortums
- if not self.config.orchestration.keypair_name:
+ if not CONF.orchestration.keypair_name:
self.set_resource('stack', self.stack)
@skip_because(bug="1257575")
@@ -70,7 +73,7 @@
self.launch_stack()
sid = self.stack_identifier
- timeout = self.config.orchestration.build_timeout
+ timeout = CONF.orchestration.build_timeout
interval = 10
self.assertEqual('CREATE', self.stack.action)
diff --git a/tempest/scenario/test_cross_tenant_connectivity.py b/tempest/scenario/test_cross_tenant_connectivity.py
index 6fd10be..edcf091 100644
--- a/tempest/scenario/test_cross_tenant_connectivity.py
+++ b/tempest/scenario/test_cross_tenant_connectivity.py
@@ -15,6 +15,7 @@
from tempest.common import debug
from tempest.common.utils import data_utils
+from tempest import config
from tempest import exceptions
from tempest.openstack.common import log as logging
from tempest.scenario import manager
@@ -23,6 +24,8 @@
from tempest.test import call_until_true
from tempest.test import services
+CONF = config.CONF
+
LOG = logging.getLogger(__name__)
@@ -131,8 +134,8 @@
msg = 'No alt_tenant defined'
cls.enabled = False
raise cls.skipException(msg)
- cfg = cls.config.network
- if not (cfg.tenant_networks_reachable or cfg.public_network_id):
+ if not (CONF.network.tenant_networks_reachable or
+ CONF.network.public_network_id):
msg = ('Either tenant_networks_reachable must be "true", or '
'public_network_id must be defined.')
cls.enabled = False
@@ -166,7 +169,7 @@
)
for tenant in [cls.demo_tenant, cls.alt_tenant]:
cls.tenants[tenant.tenant_id] = tenant
- if not cls.config.network.public_router_id:
+ if not CONF.network.public_router_id:
cls.floating_ip_access = True
else:
cls.floating_ip_access = False
@@ -277,7 +280,7 @@
self._assign_floating_ips(server)
def _assign_floating_ips(self, server):
- public_network_id = self.config.network.public_network_id
+ public_network_id = CONF.network.public_network_id
floating_ip = self._create_floating_ip(server, public_network_id)
self.floating_ips.setdefault(server, floating_ip)
@@ -353,7 +356,7 @@
return should_succeed
return call_until_true(ping_remote,
- self.config.compute.ping_timeout,
+ CONF.compute.ping_timeout,
1)
def _check_connectivity(self, access_point, ip, should_succeed=True):
diff --git a/tempest/scenario/test_dashboard_basic_ops.py b/tempest/scenario/test_dashboard_basic_ops.py
index 98efcfb..19996e5 100644
--- a/tempest/scenario/test_dashboard_basic_ops.py
+++ b/tempest/scenario/test_dashboard_basic_ops.py
@@ -17,9 +17,12 @@
from lxml import html
+from tempest import config
from tempest.scenario import manager
from tempest.test import services
+CONF = config.CONF
+
class TestDashboardBasicOps(manager.OfficialClientTest):
@@ -35,16 +38,16 @@
cls.set_network_resources()
super(TestDashboardBasicOps, cls).setUpClass()
- if not cls.config.service_available.horizon:
+ if not CONF.service_available.horizon:
raise cls.skipException("Horizon support is required")
def check_login_page(self):
- response = urllib2.urlopen(self.config.dashboard.dashboard_url)
+ response = urllib2.urlopen(CONF.dashboard.dashboard_url)
self.assertIn("<h3>Log In</h3>", response.read())
def user_login(self):
self.opener = urllib2.build_opener(urllib2.HTTPCookieProcessor())
- response = self.opener.open(self.config.dashboard.dashboard_url).read()
+ response = self.opener.open(CONF.dashboard.dashboard_url).read()
# Grab the CSRF token and default region
csrf_token = html.fromstring(response).xpath(
@@ -53,17 +56,17 @@
'//input[@name="region"]/@value')[0]
# Prepare login form request
- req = urllib2.Request(self.config.dashboard.login_url)
+ req = urllib2.Request(CONF.dashboard.login_url)
req.add_header('Content-type', 'application/x-www-form-urlencoded')
- req.add_header('Referer', self.config.dashboard.dashboard_url)
- params = {'username': self.config.identity.username,
- 'password': self.config.identity.password,
+ req.add_header('Referer', CONF.dashboard.dashboard_url)
+ params = {'username': CONF.identity.username,
+ 'password': CONF.identity.password,
'region': region,
'csrfmiddlewaretoken': csrf_token}
self.opener.open(req, urllib.urlencode(params))
def check_home_page(self):
- response = self.opener.open(self.config.dashboard.dashboard_url)
+ response = self.opener.open(CONF.dashboard.dashboard_url)
self.assertIn('Overview', response.read())
@services('dashboard')
diff --git a/tempest/scenario/test_large_ops.py b/tempest/scenario/test_large_ops.py
index 25e2dab..e8030c9 100644
--- a/tempest/scenario/test_large_ops.py
+++ b/tempest/scenario/test_large_ops.py
@@ -14,10 +14,13 @@
# under the License.
from tempest.common.utils import data_utils
+from tempest import config
from tempest.openstack.common import log as logging
from tempest.scenario import manager
from tempest.test import services
+CONF = config.CONF
+
LOG = logging.getLogger(__name__)
@@ -67,12 +70,9 @@
return image.id
def glance_image_create(self):
- aki_img_path = self.config.scenario.img_dir + "/" + \
- self.config.scenario.aki_img_file
- ari_img_path = self.config.scenario.img_dir + "/" + \
- self.config.scenario.ari_img_file
- ami_img_path = self.config.scenario.img_dir + "/" + \
- self.config.scenario.ami_img_file
+ aki_img_path = CONF.scenario.img_dir + "/" + CONF.scenario.aki_img_file
+ ari_img_path = CONF.scenario.img_dir + "/" + CONF.scenario.ari_img_file
+ ami_img_path = CONF.scenario.img_dir + "/" + CONF.scenario.ami_img_file
LOG.debug("paths: ami: %s, ari: %s, aki: %s"
% (ami_img_path, ari_img_path, aki_img_path))
kernel_id = self._image_create('scenario-aki', 'aki', aki_img_path)
@@ -87,12 +87,12 @@
def nova_boot(self):
name = data_utils.rand_name('scenario-server-')
client = self.compute_client
- flavor_id = self.config.compute.flavor_ref
+ flavor_id = CONF.compute.flavor_ref
secgroup = self._create_security_group_nova()
self.servers = client.servers.create(
name=name, image=self.image,
flavor=flavor_id,
- min_count=self.config.scenario.large_ops_number,
+ min_count=CONF.scenario.large_ops_number,
security_groups=[secgroup.name])
# needed because of bug 1199788
self.servers = [x for x in client.servers.list() if name in x.name]
@@ -102,7 +102,7 @@
@services('compute', 'image')
def test_large_ops_scenario(self):
- if self.config.scenario.large_ops_number < 1:
+ if CONF.scenario.large_ops_number < 1:
return
self.glance_image_create()
self.nova_boot()
diff --git a/tempest/scenario/test_minimum_basic.py b/tempest/scenario/test_minimum_basic.py
index 26a4dc0..846e0cc 100644
--- a/tempest/scenario/test_minimum_basic.py
+++ b/tempest/scenario/test_minimum_basic.py
@@ -14,10 +14,12 @@
# under the License.
from tempest.common.utils import data_utils
+from tempest import config
from tempest.openstack.common import log as logging
from tempest.scenario import manager
from tempest.test import services
+CONF = config.CONF
LOG = logging.getLogger(__name__)
@@ -63,12 +65,9 @@
return image.id
def glance_image_create(self):
- aki_img_path = self.config.scenario.img_dir + "/" + \
- self.config.scenario.aki_img_file
- ari_img_path = self.config.scenario.img_dir + "/" + \
- self.config.scenario.ari_img_file
- ami_img_path = self.config.scenario.img_dir + "/" + \
- self.config.scenario.ami_img_file
+ aki_img_path = CONF.scenario.img_dir + "/" + CONF.scenario.aki_img_file
+ ari_img_path = CONF.scenario.img_dir + "/" + CONF.scenario.ari_img_file
+ ami_img_path = CONF.scenario.img_dir + "/" + CONF.scenario.ami_img_file
LOG.debug("paths: ami: %s, ari: %s, aki: %s"
% (ami_img_path, ari_img_path, aki_img_path))
kernel_id = self._image_create('scenario-aki', 'aki', aki_img_path)
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index aea5874..be0e045 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -103,8 +103,8 @@
@classmethod
def check_preconditions(cls):
super(TestNetworkBasicOps, cls).check_preconditions()
- cfg = cls.config.network
- if not (cfg.tenant_networks_reachable or cfg.public_network_id):
+ if not (CONF.network.tenant_networks_reachable
+ or CONF.network.public_network_id):
msg = ('Either tenant_networks_reachable must be "true", or '
'public_network_id must be defined.')
cls.enabled = False
diff --git a/tempest/scenario/test_server_advanced_ops.py b/tempest/scenario/test_server_advanced_ops.py
index 45c24ca..9626157 100644
--- a/tempest/scenario/test_server_advanced_ops.py
+++ b/tempest/scenario/test_server_advanced_ops.py
@@ -13,10 +13,13 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest import config
from tempest.openstack.common import log as logging
from tempest.scenario import manager
from tempest.test import services
+CONF = config.CONF
+
LOG = logging.getLogger(__name__)
@@ -34,13 +37,13 @@
cls.set_network_resources()
super(TestServerAdvancedOps, cls).setUpClass()
- if not cls.config.compute_feature_enabled.resize:
+ if not CONF.compute_feature_enabled.resize:
msg = "Skipping test - resize not available on this host"
raise cls.skipException(msg)
- resize_flavor = cls.config.compute.flavor_ref_alt
+ resize_flavor = CONF.compute.flavor_ref_alt
- if resize_flavor == cls.config.compute.flavor_ref:
+ if resize_flavor == CONF.compute.flavor_ref:
msg = "Skipping test - flavor_ref and flavor_ref_alt are identical"
raise cls.skipException(msg)
@@ -49,7 +52,7 @@
# We create an instance for use in this test
instance = self.create_server()
instance_id = instance.id
- resize_flavor = self.config.compute.flavor_ref_alt
+ resize_flavor = CONF.compute.flavor_ref_alt
LOG.debug("Resizing instance %s from flavor %s to flavor %s",
instance.id, instance.flavor, resize_flavor)
instance.resize(resize_flavor)
diff --git a/tempest/scenario/test_server_basic_ops.py b/tempest/scenario/test_server_basic_ops.py
index 8779518..73ff6b4 100644
--- a/tempest/scenario/test_server_basic_ops.py
+++ b/tempest/scenario/test_server_basic_ops.py
@@ -15,12 +15,15 @@
from tempest.common.utils import data_utils
from tempest.common.utils import test_utils
+from tempest import config
from tempest.openstack.common import log as logging
from tempest.scenario import manager
from tempest.test import services
import testscenarios
+CONF = config.CONF
+
LOG = logging.getLogger(__name__)
# NOTE(andreaf) - nose does not honour the load_tests protocol
@@ -56,9 +59,9 @@
# Setup image and flavor the test instance
# Support both configured and injected values
if not hasattr(self, 'image_ref'):
- self.image_ref = self.config.compute.image_ref
+ self.image_ref = CONF.compute.image_ref
if not hasattr(self, 'flavor_ref'):
- self.flavor_ref = self.config.compute.flavor_ref
+ self.flavor_ref = CONF.compute.flavor_ref
self.image_utils = test_utils.ImageUtils()
if not self.image_utils.is_flavor_enough(self.flavor_ref,
self.image_ref):
@@ -67,7 +70,7 @@
image=self.image_ref, flavor=self.flavor_ref
)
)
- self.run_ssh = self.config.compute.run_ssh and \
+ self.run_ssh = CONF.compute.run_ssh and \
self.image_utils.is_sshable_image(self.image_ref)
self.ssh_user = self.image_utils.ssh_user(self.image_ref)
LOG.debug('Starting test for i:{image}, f:{flavor}. '
diff --git a/tempest/scenario/test_snapshot_pattern.py b/tempest/scenario/test_snapshot_pattern.py
index 5ff8642..2bb3d84 100644
--- a/tempest/scenario/test_snapshot_pattern.py
+++ b/tempest/scenario/test_snapshot_pattern.py
@@ -13,10 +13,12 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest import config
from tempest.openstack.common import log
from tempest.scenario import manager
from tempest.test import services
+CONF = config.CONF
LOG = log.getLogger(__name__)
@@ -74,8 +76,8 @@
self._create_loginable_secgroup_rule_nova()
# boot a instance and create a timestamp file in it
- server = self._boot_image(self.config.compute.image_ref)
- if self.config.compute.use_floatingip_for_ssh:
+ server = self._boot_image(CONF.compute.image_ref)
+ if CONF.compute.use_floatingip_for_ssh:
fip_for_server = self._create_floating_ip()
self._set_floating_ip_to_server(server, fip_for_server)
self._write_timestamp(fip_for_server.ip)
@@ -89,7 +91,7 @@
server_from_snapshot = self._boot_image(snapshot_image.id)
# check the existence of the timestamp file in the second instance
- if self.config.compute.use_floatingip_for_ssh:
+ if CONF.compute.use_floatingip_for_ssh:
fip_for_snapshot = self._create_floating_ip()
self._set_floating_ip_to_server(server_from_snapshot,
fip_for_snapshot)
diff --git a/tempest/scenario/test_stamp_pattern.py b/tempest/scenario/test_stamp_pattern.py
index 84c7096..8d043ae 100644
--- a/tempest/scenario/test_stamp_pattern.py
+++ b/tempest/scenario/test_stamp_pattern.py
@@ -18,11 +18,14 @@
from cinderclient import exceptions as cinder_exceptions
from tempest.common.utils import data_utils
+from tempest import config
from tempest import exceptions
from tempest.openstack.common import log as logging
from tempest.scenario import manager
import tempest.test
+CONF = config.CONF
+
LOG = logging.getLogger(__name__)
@@ -113,7 +116,6 @@
def _wait_for_volume_availible_on_the_system(self, server_or_ip):
ssh = self.get_remote_client(server_or_ip)
- conf = self.config
def _func():
part = ssh.get_partitions()
@@ -121,8 +123,8 @@
return 'vdb' in part
if not tempest.test.call_until_true(_func,
- conf.compute.build_timeout,
- conf.compute.build_interval):
+ CONF.compute.build_timeout,
+ CONF.compute.build_interval):
raise exceptions.TimeoutException
def _create_timestamp(self, server_or_ip):
@@ -148,10 +150,10 @@
# boot an instance and create a timestamp file in it
volume = self._create_volume()
- server = self._boot_image(self.config.compute.image_ref)
+ server = self._boot_image(CONF.compute.image_ref)
# create and add floating IP to server1
- if self.config.compute.use_floatingip_for_ssh:
+ if CONF.compute.use_floatingip_for_ssh:
floating_ip_for_server = self._create_floating_ip()
self._add_floating_ip(server, floating_ip_for_server)
ip_for_server = floating_ip_for_server.ip
@@ -177,7 +179,7 @@
server_from_snapshot = self._boot_image(snapshot_image.id)
# create and add floating IP to server_from_snapshot
- if self.config.compute.use_floatingip_for_ssh:
+ if CONF.compute.use_floatingip_for_ssh:
floating_ip_for_snapshot = self._create_floating_ip()
self._add_floating_ip(server_from_snapshot,
floating_ip_for_snapshot)
diff --git a/tempest/scenario/test_swift_basic_ops.py b/tempest/scenario/test_swift_basic_ops.py
index 5892e1e..b367f7f 100644
--- a/tempest/scenario/test_swift_basic_ops.py
+++ b/tempest/scenario/test_swift_basic_ops.py
@@ -15,10 +15,13 @@
from tempest.common.utils.data_utils import rand_name
+from tempest import config
from tempest.openstack.common import log as logging
from tempest.scenario import manager
from tempest.test import services
+CONF = config.CONF
+
LOG = logging.getLogger(__name__)
@@ -39,7 +42,7 @@
def setUpClass(cls):
cls.set_network_resources()
super(TestSwiftBasicOps, cls).setUpClass()
- if not cls.config.service_available.swift:
+ if not CONF.service_available.swift:
skip_msg = ("%s skipped as swift is not available" %
cls.__name__)
raise cls.skipException(skip_msg)
diff --git a/tempest/scenario/test_volume_boot_pattern.py b/tempest/scenario/test_volume_boot_pattern.py
index c4f8ced..54851b5 100644
--- a/tempest/scenario/test_volume_boot_pattern.py
+++ b/tempest/scenario/test_volume_boot_pattern.py
@@ -11,11 +11,13 @@
# under the License.
from tempest.common.utils import data_utils
+from tempest import config
from tempest.openstack.common import log
from tempest.scenario import manager
import tempest.test
from tempest.test import services
+CONF = config.CONF
LOG = log.getLogger(__name__)
@@ -36,7 +38,7 @@
"""
def _create_volume_from_image(self):
- img_uuid = self.config.compute.image_ref
+ img_uuid = CONF.compute.image_ref
vol_name = data_utils.rand_name('volume-origin')
return self.create_volume(name=vol_name, imageRef=img_uuid)
@@ -89,14 +91,14 @@
'available')
def _ssh_to_server(self, server, keypair):
- if self.config.compute.use_floatingip_for_ssh:
+ if CONF.compute.use_floatingip_for_ssh:
floating_ip = self.compute_client.floating_ips.create()
fip_name = data_utils.rand_name('scenario-fip')
self.set_resource(fip_name, floating_ip)
server.add_floating_ip(floating_ip)
ip = floating_ip.ip
else:
- network_name_for_ssh = self.config.compute.network_for_ssh
+ network_name_for_ssh = CONF.compute.network_for_ssh
ip = server.networks[network_name_for_ssh][0]
try: