Merge "Fixes typos in tempest/api"
diff --git a/requirements.txt b/requirements.txt
index ab48ec5..b15fb92 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -19,3 +19,6 @@
testrepository>=0.0.17
oslo.config>=1.1.0
eventlet>=0.13.0
+six<1.4.0
+iso8601>=0.1.4
+fixtures>=0.3.14
diff --git a/tempest/api/identity/admin/v3/test_credentials.py b/tempest/api/identity/admin/v3/test_credentials.py
new file mode 100644
index 0000000..efd2f83
--- /dev/null
+++ b/tempest/api/identity/admin/v3/test_credentials.py
@@ -0,0 +1,120 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2013 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.identity import base
+from tempest.common.utils.data_utils import rand_name
+from tempest.test import attr
+
+
+class CredentialsTestJSON(base.BaseIdentityAdminTest):
+ _interface = 'json'
+
+ @classmethod
+ def setUpClass(cls):
+ super(CredentialsTestJSON, cls).setUpClass()
+ cls.projects = list()
+ cls.creds_list = [['project_id', 'user_id', 'id'],
+ ['access', 'secret']]
+ u_name = rand_name('user-')
+ u_desc = '%s description' % u_name
+ u_email = '%s@testmail.tm' % u_name
+ u_password = rand_name('pass-')
+ for i in range(2):
+ resp, cls.project = cls.v3_client.create_project(
+ rand_name('project-'), description=rand_name('project-desc-'))
+ assert resp['status'] == '201', "Expected %s" % resp['status']
+ cls.projects.append(cls.project['id'])
+
+ resp, cls.user_body = cls.v3_client.create_user(
+ u_name, description=u_desc, password=u_password,
+ email=u_email, project_id=cls.projects[0])
+ assert resp['status'] == '201', "Expected: %s" % resp['status']
+
+ @classmethod
+ def tearDownClass(cls):
+ resp, _ = cls.v3_client.delete_user(cls.user_body['id'])
+ assert resp['status'] == '204', "Expected: %s" % resp['status']
+ for p in cls.projects:
+ resp, _ = cls.v3_client.delete_project(p)
+ assert resp['status'] == '204', "Expected: %s" % resp['status']
+ super(CredentialsTestJSON, cls).tearDownClass()
+
+ def _delete_credential(self, cred_id):
+ resp, body = self.creds_client.delete_credential(cred_id)
+ self.assertEqual(resp['status'], '204')
+
+ @attr(type='smoke')
+ def test_credentials_create_get_update_delete(self):
+ keys = [rand_name('Access-'), rand_name('Secret-')]
+ resp, cred = self.creds_client.create_credential(
+ keys[0], keys[1], self.user_body['id'],
+ self.projects[0])
+ self.addCleanup(self._delete_credential, cred['id'])
+ self.assertEqual(resp['status'], '201')
+ for value1 in self.creds_list[0]:
+ self.assertIn(value1, cred)
+ for value2 in self.creds_list[1]:
+ self.assertIn(value2, cred['blob'])
+
+ new_keys = [rand_name('NewAccess-'), rand_name('NewSecret-')]
+ resp, update_body = self.creds_client.update_credential(
+ cred['id'], access_key=new_keys[0], secret_key=new_keys[1],
+ project_id=self.projects[1])
+ self.assertEqual(resp['status'], '200')
+ self.assertEqual(cred['id'], update_body['id'])
+ self.assertEqual(self.projects[1], update_body['project_id'])
+ self.assertEqual(self.user_body['id'], update_body['user_id'])
+ self.assertEqual(update_body['blob']['access'], new_keys[0])
+ self.assertEqual(update_body['blob']['secret'], new_keys[1])
+
+ resp, get_body = self.creds_client.get_credential(cred['id'])
+ self.assertEqual(resp['status'], '200')
+ for value1 in self.creds_list[0]:
+ self.assertEqual(update_body[value1],
+ get_body[value1])
+ for value2 in self.creds_list[1]:
+ self.assertEqual(update_body['blob'][value2],
+ get_body['blob'][value2])
+
+ @attr(type='smoke')
+ def test_credentials_list_delete(self):
+ created_cred_ids = list()
+ fetched_cred_ids = list()
+
+ for i in range(2):
+ resp, cred = self.creds_client.create_credential(
+ rand_name('Access-'), rand_name('Secret-'),
+ self.user_body['id'], self.projects[0])
+ self.assertEqual(resp['status'], '201')
+ created_cred_ids.append(cred['id'])
+ self.addCleanup(self._delete_credential, cred['id'])
+
+ resp, creds = self.creds_client.list_credentials()
+ self.assertEqual(resp['status'], '200')
+
+ for i in creds:
+ fetched_cred_ids.append(i['id'])
+ missing_creds = [c for c in created_cred_ids
+ if c not in fetched_cred_ids]
+ self.assertEqual(0, len(missing_creds),
+ "Failed to find cred %s in fetched list" %
+ ', '.join(m_cred for m_cred
+ in missing_creds))
+
+
+class CredentialsTestXML(CredentialsTestJSON):
+ _interface = 'xml'
diff --git a/tempest/api/identity/base.py b/tempest/api/identity/base.py
index bfb5372..2a168de 100644
--- a/tempest/api/identity/base.py
+++ b/tempest/api/identity/base.py
@@ -34,6 +34,7 @@
cls.service_client = os.service_client
cls.policy_client = os.policy_client
cls.v3_token = os.token_v3_client
+ cls.creds_client = os.credentials_client
if not cls.client.has_admin_extensions():
raise cls.skipException("Admin extensions disabled")
diff --git a/tempest/api/network/base.py b/tempest/api/network/base.py
index 19c5f84..3ae718c 100644
--- a/tempest/api/network/base.py
+++ b/tempest/api/network/base.py
@@ -56,9 +56,15 @@
cls.networks = []
cls.subnets = []
cls.ports = []
+ cls.pools = []
+ cls.vips = []
@classmethod
def tearDownClass(cls):
+ for vip in cls.vips:
+ cls.client.delete_vip(vip['id'])
+ for pool in cls.pools:
+ cls.client.delete_pool(pool['id'])
for port in cls.ports:
cls.client.delete_port(port['id'])
for subnet in cls.subnets:
@@ -111,3 +117,21 @@
port = body['port']
cls.ports.append(port)
return port
+
+ @classmethod
+ def create_pool(cls, name, lb_method, protocol, subnet):
+ """Wrapper utility that returns a test pool."""
+ resp, body = cls.client.create_pool(name, lb_method, protocol,
+ subnet['id'])
+ pool = body['pool']
+ cls.pools.append(pool)
+ return pool
+
+ @classmethod
+ def create_vip(cls, name, protocol, protocol_port, subnet, pool):
+ """Wrapper utility that returns a test vip."""
+ resp, body = cls.client.create_vip(name, protocol, protocol_port,
+ subnet['id'], pool['id'])
+ vip = body['vip']
+ cls.vips.append(vip)
+ return vip
diff --git a/tempest/api/network/test_load_balancer.py b/tempest/api/network/test_load_balancer.py
new file mode 100644
index 0000000..1c8c355
--- /dev/null
+++ b/tempest/api/network/test_load_balancer.py
@@ -0,0 +1,102 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2013 OpenStack, LLC
+# 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
+from tempest.common.utils.data_utils import rand_name
+from tempest.test import attr
+
+
+class LoadBalancerJSON(base.BaseNetworkTest):
+ _interface = 'json'
+
+ """
+ Tests the following operations in the Neutron API using the REST client for
+ Neutron:
+
+ create vIP, and Pool
+ show vIP
+ list vIP
+ update vIP
+ delete vIP
+ update pool
+ delete pool
+ """
+
+ @classmethod
+ def setUpClass(cls):
+ super(LoadBalancerJSON, cls).setUpClass()
+ cls.network = cls.create_network()
+ cls.name = cls.network['name']
+ cls.subnet = cls.create_subnet(cls.network)
+ pool_name = rand_name('pool-')
+ vip_name = rand_name('vip-')
+ cls.pool = cls.create_pool(pool_name, "ROUND_ROBIN",
+ "HTTP", cls.subnet)
+ cls.vip = cls.create_vip(vip_name, "HTTP", 80, cls.subnet, cls.pool)
+
+ @attr(type='smoke')
+ def test_list_vips(self):
+ # Verify the vIP exists in the list of all vIPs
+ resp, body = self.client.list_vips()
+ self.assertEqual('200', resp['status'])
+ vips = body['vips']
+ found = None
+ for n in vips:
+ if (n['id'] == self.vip['id']):
+ found = n['id']
+ msg = "vIPs list doesn't contain created vip"
+ self.assertIsNotNone(found, msg)
+
+ def test_create_update_delete_pool_vip(self):
+ # Creates a vip
+ name = rand_name('vip-')
+ resp, body = self.client.create_pool(rand_name("pool-"),
+ "ROUND_ROBIN", "HTTP",
+ self.subnet['id'])
+ pool = body['pool']
+ resp, body = self.client.create_vip(name, "HTTP", 80,
+ self.subnet['id'], pool['id'])
+ self.assertEqual('201', resp['status'])
+ vip = body['vip']
+ vip_id = vip['id']
+ # Verification of vip update
+ new_name = "New_vip"
+ resp, body = self.client.update_vip(vip_id, new_name)
+ self.assertEqual('200', resp['status'])
+ updated_vip = body['vip']
+ self.assertEqual(updated_vip['name'], new_name)
+ # Verification of vip delete
+ resp, body = self.client.delete_vip(vip['id'])
+ self.assertEqual('204', resp['status'])
+ # Verification of pool update
+ new_name = "New_pool"
+ resp, body = self.client.update_pool(pool['id'], new_name)
+ self.assertEqual('200', resp['status'])
+ updated_pool = body['pool']
+ self.assertEqual(updated_pool['name'], new_name)
+ # Verification of pool delete
+ resp, body = self.client.delete_pool(pool['id'])
+ self.assertEqual('204', resp['status'])
+
+ @attr(type='smoke')
+ def test_show_vip(self):
+ # Verifies the details of a vip
+ resp, body = self.client.show_vip(self.vip['id'])
+ self.assertEqual('200', resp['status'])
+ vip = body['vip']
+ self.assertEqual(self.vip['id'], vip['id'])
+ self.assertEqual(self.vip['name'], vip['name'])
diff --git a/tempest/api/network/test_networks.py b/tempest/api/network/test_networks.py
index 66ca05f..7e116b9 100644
--- a/tempest/api/network/test_networks.py
+++ b/tempest/api/network/test_networks.py
@@ -234,6 +234,12 @@
self.assertRaises(exceptions.NotFound, self.client.show_subnet,
non_exist_id)
+ @attr(type=['negative', 'smoke'])
+ def test_show_non_existent_port(self):
+ non_exist_id = rand_name('port')
+ self.assertRaises(exceptions.NotFound, self.client.show_port,
+ non_exist_id)
+
@attr(type='smoke')
def test_bulk_create_delete_network(self):
# Creates 2 networks in one request
diff --git a/tempest/api/volume/test_volumes_get.py b/tempest/api/volume/test_volumes_get.py
index f7f428c..12b03b5 100644
--- a/tempest/api/volume/test_volumes_get.py
+++ b/tempest/api/volume/test_volumes_get.py
@@ -69,6 +69,10 @@
fetched_volume['metadata'],
'The fetched Volume is different '
'from the created Volume')
+ if 'imageRef' in kwargs:
+ self.assertEqual(fetched_volume['bootable'], True)
+ if 'imageRef' not in kwargs:
+ self.assertEqual(fetched_volume['bootable'], False)
@attr(type='gate')
def test_volume_get_metadata_none(self):
diff --git a/tempest/api/volume/test_volumes_list.py b/tempest/api/volume/test_volumes_list.py
index d06a26f..d9c9e48 100644
--- a/tempest/api/volume/test_volumes_list.py
+++ b/tempest/api/volume/test_volumes_list.py
@@ -17,8 +17,11 @@
from tempest.api.volume import base
from tempest.common.utils.data_utils import rand_name
+from tempest.openstack.common import log as logging
from tempest.test import attr
+LOG = logging.getLogger(__name__)
+
class VolumesListTest(base.BaseVolumeTest):
@@ -64,22 +67,17 @@
resp, volume = cls.client.get_volume(volume['id'])
cls.volume_list.append(volume)
cls.volume_id_list.append(volume['id'])
- except Exception:
+ except Exception as exc:
+ LOG.exception(exc)
if cls.volume_list:
# We could not create all the volumes, though we were able
# to create *some* of the volumes. This is typically
# because the backing file size of the volume group is
- # too small. So, here, we clean up whatever we did manage
- # to create and raise a SkipTest
+ # too small.
for volid in cls.volume_id_list:
cls.client.delete_volume(volid)
cls.client.wait_for_resource_deletion(volid)
- msg = ("Failed to create ALL necessary volumes to run "
- "test. This typically means that the backing file "
- "size of the nova-volumes group is too small to "
- "create the 3 volumes needed by this test case")
- raise cls.skipException(msg)
- raise
+ raise exc
@classmethod
def tearDownClass(cls):
diff --git a/tempest/cli/output_parser.py b/tempest/cli/output_parser.py
index f22ec4e..bb3368f 100644
--- a/tempest/cli/output_parser.py
+++ b/tempest/cli/output_parser.py
@@ -158,7 +158,7 @@
def _table_columns(first_table_row):
"""Find column ranges in output line.
- Return list of touples (start,end) for each column
+ Return list of tuples (start,end) for each column
detected by plus (+) characters in delimiter line.
"""
positions = []
diff --git a/tempest/clients.py b/tempest/clients.py
index 48e4939..49b9283 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -71,6 +71,8 @@
VolumesExtensionsClientXML
from tempest.services.identity.json.identity_client import IdentityClientJSON
from tempest.services.identity.json.identity_client import TokenClientJSON
+from tempest.services.identity.v3.json.credentials_client import \
+ CredentialsClientJSON
from tempest.services.identity.v3.json.endpoints_client import \
EndPointClientJSON
from tempest.services.identity.v3.json.identity_client import \
@@ -79,6 +81,8 @@
from tempest.services.identity.v3.json.policy_client import PolicyClientJSON
from tempest.services.identity.v3.json.service_client import \
ServiceClientJSON
+from tempest.services.identity.v3.xml.credentials_client import \
+ CredentialsClientXML
from tempest.services.identity.v3.xml.endpoints_client import EndPointClientXML
from tempest.services.identity.v3.xml.identity_client import \
IdentityV3ClientXML
@@ -252,6 +256,11 @@
"xml": V3TokenClientXML,
}
+CREDENTIALS_CLIENT = {
+ "json": CredentialsClientJSON,
+ "xml": CredentialsClientXML,
+}
+
class Manager(object):
@@ -336,6 +345,8 @@
self.policy_client = POLICY_CLIENT[interface](*client_args)
self.hypervisor_client = HYPERVISOR_CLIENT[interface](*client_args)
self.token_v3_client = V3_TOKEN_CLIENT[interface](*client_args)
+ self.credentials_client = \
+ CREDENTIALS_CLIENT[interface](*client_args)
if client_args_v3_auth:
self.servers_client_v3_auth = SERVERS_CLIENTS[interface](
diff --git a/tempest/common/utils/linux/remote_client.py b/tempest/common/utils/linux/remote_client.py
index 2cbb74d..0d0e794 100644
--- a/tempest/common/utils/linux/remote_client.py
+++ b/tempest/common/utils/linux/remote_client.py
@@ -52,12 +52,12 @@
return self.ssh_client.test_connection_auth()
def hostname_equals_servername(self, expected_hostname):
- # Get hostname using command "hostname"
+ # Get host name using command "hostname"
actual_hostname = self.ssh_client.exec_command("hostname").rstrip()
return expected_hostname == actual_hostname
def get_files(self, path):
- # Return a list of comma seperated files
+ # Return a list of comma separated files
command = "ls -m " + path
return self.ssh_client.exec_command(command).rstrip('\n').split(', ')
diff --git a/tempest/scenario/orchestration/test_autoscaling.py b/tempest/scenario/orchestration/test_autoscaling.py
index 88f2ebd..1a4d802 100644
--- a/tempest/scenario/orchestration/test_autoscaling.py
+++ b/tempest/scenario/orchestration/test_autoscaling.py
@@ -85,7 +85,7 @@
def server_count():
# the number of servers is the number of resources
- # in the nexted stack
+ # in the nested stack
self.server_count = len(
self.client.resources.list(nested_stack_id))
return self.server_count
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index 662e919..9d7086c 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -62,7 +62,7 @@
Tempest host. A public network is assumed to be reachable from
the Tempest host, and it should be possible to associate a public
('floating') IP address with a tenant ('fixed') IP address to
- faciliate external connectivity to a potentially unroutable
+ facilitate external connectivity to a potentially unroutable
tenant IP address.
This test suite can be configured to test network connectivity to
diff --git a/tempest/services/identity/v3/json/credentials_client.py b/tempest/services/identity/v3/json/credentials_client.py
new file mode 100644
index 0000000..c3f788a
--- /dev/null
+++ b/tempest/services/identity/v3/json/credentials_client.py
@@ -0,0 +1,97 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2013 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 json
+from urlparse import urlparse
+
+from tempest.common.rest_client import RestClient
+
+
+class CredentialsClientJSON(RestClient):
+
+ def __init__(self, config, username, password, auth_url, tenant_name=None):
+ super(CredentialsClientJSON, self).__init__(config, username, password,
+ auth_url, tenant_name)
+ self.service = self.config.identity.catalog_type
+ self.endpoint_url = 'adminURL'
+
+ def request(self, method, url, headers=None, body=None, wait=None):
+ """Overriding the existing HTTP request in super class rest_client."""
+ self._set_auth()
+ self.base_url = self.base_url.replace(urlparse(self.base_url).path,
+ "/v3")
+ return super(CredentialsClientJSON, self).request(method, url,
+ headers=headers,
+ body=body)
+
+ def create_credential(self, access_key, secret_key, user_id, project_id):
+ """Creates a credential."""
+ blob = "{\"access\": \"%s\", \"secret\": \"%s\"}" % (
+ access_key, secret_key)
+ post_body = {
+ "blob": blob,
+ "project_id": project_id,
+ "type": "ec2",
+ "user_id": user_id
+ }
+ post_body = json.dumps({'credential': post_body})
+ resp, body = self.post('credentials', post_body,
+ self.headers)
+ body = json.loads(body)
+ body['credential']['blob'] = json.loads(body['credential']['blob'])
+ return resp, body['credential']
+
+ def update_credential(self, credential_id, **kwargs):
+ """Updates a credential."""
+ resp, body = self.get_credential(credential_id)
+ cred_type = kwargs.get('type', body['type'])
+ access_key = kwargs.get('access_key', body['blob']['access'])
+ secret_key = kwargs.get('secret_key', body['blob']['secret'])
+ project_id = kwargs.get('project_id', body['project_id'])
+ user_id = kwargs.get('user_id', body['user_id'])
+ blob = "{\"access\": \"%s\", \"secret\": \"%s\"}" % (
+ access_key, secret_key)
+ post_body = {
+ "blob": blob,
+ "project_id": project_id,
+ "type": cred_type,
+ "user_id": user_id
+ }
+ post_body = json.dumps({'credential': post_body})
+ resp, body = self.patch('credentials/%s' % credential_id, post_body,
+ self.headers)
+ body = json.loads(body)
+ body['credential']['blob'] = json.loads(body['credential']['blob'])
+ return resp, body['credential']
+
+ def get_credential(self, credential_id):
+ """To GET Details of a credential."""
+ resp, body = self.get('credentials/%s' % credential_id)
+ body = json.loads(body)
+ body['credential']['blob'] = json.loads(body['credential']['blob'])
+ return resp, body['credential']
+
+ def list_credentials(self):
+ """Lists out all the available credentials."""
+ resp, body = self.get('credentials')
+ body = json.loads(body)
+ return resp, body['credentials']
+
+ def delete_credential(self, credential_id):
+ """Deletes a credential."""
+ resp, body = self.delete('credentials/%s' % credential_id)
+ return resp, body
diff --git a/tempest/services/identity/v3/xml/credentials_client.py b/tempest/services/identity/v3/xml/credentials_client.py
new file mode 100644
index 0000000..dc0ade1
--- /dev/null
+++ b/tempest/services/identity/v3/xml/credentials_client.py
@@ -0,0 +1,121 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2013 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 json
+from urlparse import urlparse
+
+from lxml import etree
+
+from tempest.common.rest_client import RestClientXML
+from tempest.services.compute.xml.common import Document
+from tempest.services.compute.xml.common import Element
+from tempest.services.compute.xml.common import Text
+from tempest.services.compute.xml.common import xml_to_json
+
+
+XMLNS = "http://docs.openstack.org/identity/api/v3"
+
+
+class CredentialsClientXML(RestClientXML):
+
+ def __init__(self, config, username, password, auth_url, tenant_name=None):
+ super(CredentialsClientXML, self).__init__(config, username, password,
+ auth_url, tenant_name)
+ self.service = self.config.identity.catalog_type
+ self.endpoint_url = 'adminURL'
+
+ def request(self, method, url, headers=None, body=None, wait=None):
+ """Overriding the existing HTTP request in super class rest_client."""
+ self._set_auth()
+ self.base_url = self.base_url.replace(urlparse(self.base_url).path,
+ "/v3")
+ return super(CredentialsClientXML, self).request(method, url,
+ headers=headers,
+ body=body)
+
+ def _parse_body(self, body):
+ data = xml_to_json(body)
+ return data
+
+ def _parse_creds(self, node):
+ array = []
+ for child in node.getchildren():
+ tag_list = child.tag.split('}', 1)
+ if tag_list[1] == "credential":
+ array.append(xml_to_json(child))
+ return array
+
+ def create_credential(self, access_key, secret_key, user_id, project_id):
+ """Creates a credential."""
+ cred_type = 'ec2'
+ access = ""access": "%s"" % access_key
+ secret = ""secret": "%s"" % secret_key
+ blob = Element('blob',
+ xmlns=XMLNS)
+ blob.append(Text("{%s , %s}"
+ % (access, secret)))
+ credential = Element('credential', project_id=project_id,
+ type=cred_type, user_id=user_id)
+ credential.append(blob)
+ resp, body = self.post('credentials', str(Document(credential)),
+ self.headers)
+ body = self._parse_body(etree.fromstring(body))
+ body['blob'] = json.loads(body['blob'])
+ return resp, body
+
+ def update_credential(self, credential_id, **kwargs):
+ """Updates a credential."""
+ resp, body = self.get_credential(credential_id)
+ cred_type = kwargs.get('type', body['type'])
+ access_key = kwargs.get('access_key', body['blob']['access'])
+ secret_key = kwargs.get('secret_key', body['blob']['secret'])
+ project_id = kwargs.get('project_id', body['project_id'])
+ user_id = kwargs.get('user_id', body['user_id'])
+ access = ""access": "%s"" % access_key
+ secret = ""secret": "%s"" % secret_key
+ blob = Element('blob',
+ xmlns=XMLNS)
+ blob.append(Text("{%s , %s}"
+ % (access, secret)))
+ credential = Element('credential', project_id=project_id,
+ type=cred_type, user_id=user_id)
+ credential.append(blob)
+ resp, body = self.patch('credentials/%s' % credential_id,
+ str(Document(credential)),
+ self.headers)
+ body = self._parse_body(etree.fromstring(body))
+ body['blob'] = json.loads(body['blob'])
+ return resp, body
+
+ def get_credential(self, credential_id):
+ """To GET Details of a credential."""
+ resp, body = self.get('credentials/%s' % credential_id, self.headers)
+ body = self._parse_body(etree.fromstring(body))
+ body['blob'] = json.loads(body['blob'])
+ return resp, body
+
+ def list_credentials(self):
+ """Lists out all the available credentials."""
+ resp, body = self.get('credentials', self.headers)
+ body = self._parse_creds(etree.fromstring(body))
+ return resp, body
+
+ def delete_credential(self, credential_id):
+ """Deletes a credential."""
+ resp, body = self.delete('credentials/%s' % credential_id,
+ self.headers)
+ return resp, body
diff --git a/tempest/services/network/json/network_client.py b/tempest/services/network/json/network_client.py
index 10e64f8..bc0a6cf 100644
--- a/tempest/services/network/json/network_client.py
+++ b/tempest/services/network/json/network_client.py
@@ -401,3 +401,80 @@
resp, body = self.post(uri, headers=self.headers, body=body)
body = json.loads(body)
return resp, body
+
+ def list_vips(self):
+ uri = '%s/lb/vips' % (self.uri_prefix)
+ resp, body = self.get(uri, self.headers)
+ body = json.loads(body)
+ return resp, body
+
+ def create_vip(self, name, protocol, protocol_port, subnet_id, pool_id):
+ post_body = {
+ "vip": {
+ "protocol": protocol,
+ "name": name,
+ "subnet_id": subnet_id,
+ "pool_id": pool_id,
+ "protocol_port": protocol_port
+ }
+ }
+ body = json.dumps(post_body)
+ uri = '%s/lb/vips' % (self.uri_prefix)
+ resp, body = self.post(uri, headers=self.headers, body=body)
+ body = json.loads(body)
+ return resp, body
+
+ def create_pool(self, name, lb_method, protocol, subnet_id):
+ post_body = {
+ "pool": {
+ "protocol": protocol,
+ "name": name,
+ "subnet_id": subnet_id,
+ "lb_method": lb_method
+ }
+ }
+ body = json.dumps(post_body)
+ uri = '%s/lb/pools' % (self.uri_prefix)
+ resp, body = self.post(uri, headers=self.headers, body=body)
+ body = json.loads(body)
+ return resp, body
+
+ def show_vip(self, uuid):
+ uri = '%s/lb/vips/%s' % (self.uri_prefix, uuid)
+ resp, body = self.get(uri, self.headers)
+ body = json.loads(body)
+ return resp, body
+
+ def delete_vip(self, uuid):
+ uri = '%s/lb/vips/%s' % (self.uri_prefix, uuid)
+ resp, body = self.delete(uri, self.headers)
+ return resp, body
+
+ def delete_pool(self, uuid):
+ uri = '%s/lb/pools/%s' % (self.uri_prefix, uuid)
+ resp, body = self.delete(uri, self.headers)
+ return resp, body
+
+ def update_vip(self, vip_id, new_name):
+ put_body = {
+ "vip": {
+ "name": new_name,
+ }
+ }
+ body = json.dumps(put_body)
+ uri = '%s/lb/vips/%s' % (self.uri_prefix, vip_id)
+ resp, body = self.put(uri, body=body, headers=self.headers)
+ body = json.loads(body)
+ return resp, body
+
+ def update_pool(self, pool_id, new_name):
+ put_body = {
+ "pool": {
+ "name": new_name,
+ }
+ }
+ body = json.dumps(put_body)
+ uri = '%s/lb/pools/%s' % (self.uri_prefix, pool_id)
+ resp, body = self.put(uri, body=body, headers=self.headers)
+ body = json.loads(body)
+ return resp, body
diff --git a/tempest/services/object_storage/container_client.py b/tempest/services/object_storage/container_client.py
index dd5f3ec..75f7a33 100644
--- a/tempest/services/object_storage/container_client.py
+++ b/tempest/services/object_storage/container_client.py
@@ -35,7 +35,7 @@
metadata_prefix='X-Container-Meta-'):
"""
Creates a container, with optional metadata passed in as a
- dictonary
+ dictionary
"""
url = str(container_name)
headers = {}
@@ -92,9 +92,9 @@
"""
Returns complete list of all objects in the container, even if
item count is beyond 10,000 item listing limit.
- Does not require any paramaters aside from container name.
+ Does not require any parameters aside from container name.
"""
- # TODO(dwalleck): Rewite using json format to avoid newlines at end of
+ # TODO(dwalleck): Rewrite using json format to avoid newlines at end of
# obj names. Set limit to API limit - 1 (max returned items = 9999)
limit = 9999
if params is not None:
diff --git a/tempest/services/object_storage/object_client.py b/tempest/services/object_storage/object_client.py
index 1c97869..c605a45 100644
--- a/tempest/services/object_storage/object_client.py
+++ b/tempest/services/object_storage/object_client.py
@@ -126,7 +126,7 @@
return resp, body
def get_object_using_temp_url(self, container, object_name, expires, key):
- """Retrieve object's data using temp URL."""
+ """Retrieve object's data using temporary URL."""
self._set_auth()
method = 'GET'
diff --git a/tempest/services/volume/xml/snapshots_client.py b/tempest/services/volume/xml/snapshots_client.py
index 51c46da..3596017 100644
--- a/tempest/services/volume/xml/snapshots_client.py
+++ b/tempest/services/volume/xml/snapshots_client.py
@@ -81,7 +81,7 @@
display_name: Optional snapshot Name.
display_description: User friendly snapshot description.
"""
- # NOTE(afazekas): it should use the volume namaspace
+ # NOTE(afazekas): it should use the volume namespace
snapshot = Element("snapshot", xmlns=XMLNS_11, volume_id=volume_id)
for key, value in kwargs.items():
snapshot.add_attr(key, value)
diff --git a/tempest/services/volume/xml/volumes_client.py b/tempest/services/volume/xml/volumes_client.py
index ecbfb19..9fa7a1e 100644
--- a/tempest/services/volume/xml/volumes_client.py
+++ b/tempest/services/volume/xml/volumes_client.py
@@ -60,6 +60,21 @@
"""Return the element 'attachment' from input volumes."""
return volume['attachments']['attachment']
+ def _check_if_bootable(self, volume):
+ """
+ Check if the volume is bootable, also change the value
+ of 'bootable' from string to boolean.
+ """
+ if volume['bootable'] == 'True':
+ volume['bootable'] = True
+ elif volume['bootable'] == 'False':
+ volume['bootable'] = False
+ else:
+ raise ValueError(
+ 'bootable flag is supposed to be either True or False,'
+ 'it is %s' % volume['bootable'])
+ return volume
+
def list_volumes(self, params=None):
"""List all the volumes created."""
url = 'volumes'
@@ -72,6 +87,8 @@
volumes = []
if body is not None:
volumes += [self._parse_volume(vol) for vol in list(body)]
+ for v in volumes:
+ v = self._check_if_bootable(v)
return resp, volumes
def list_volumes_with_detail(self, params=None):
@@ -86,14 +103,17 @@
volumes = []
if body is not None:
volumes += [self._parse_volume(vol) for vol in list(body)]
+ for v in volumes:
+ v = self._check_if_bootable(v)
return resp, volumes
def get_volume(self, volume_id):
"""Returns the details of a single volume."""
url = "volumes/%s" % str(volume_id)
resp, body = self.get(url, self.headers)
- body = etree.fromstring(body)
- return resp, self._parse_volume(body)
+ body = self._parse_volume(etree.fromstring(body))
+ body = self._check_if_bootable(body)
+ return resp, body
def create_volume(self, size, **kwargs):
"""Creates a new Volume.
diff --git a/tempest/stress/stressaction.py b/tempest/stress/stressaction.py
index 28251af..45a628d 100644
--- a/tempest/stress/stressaction.py
+++ b/tempest/stress/stressaction.py
@@ -42,7 +42,7 @@
def setUp(self, **kwargs):
"""This method is called before the run method
- to help the test initiatlize any structures.
+ to help the test initialize any structures.
kwargs contains arguments passed in from the
configuration json file.
@@ -59,7 +59,7 @@
def execute(self, shared_statistic):
"""This is the main execution entry point called
by the driver. We register a signal handler to
- allow us to gracefull tearDown, and then exit.
+ allow us to tearDown gracefully, and then exit.
We also keep track of how many runs we do.
"""
signal.signal(signal.SIGHUP, self._shutdown_handler)