diff --git a/tempest/services/volume/json/admin/__init__.py b/tempest/services/volume/json/admin/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tempest/services/volume/json/admin/__init__.py
diff --git a/tempest/services/volume/json/admin/volume_types_client.py b/tempest/services/volume/json/admin/volume_types_client.py
new file mode 100644
index 0000000..fc8897f
--- /dev/null
+++ b/tempest/services/volume/json/admin/volume_types_client.py
@@ -0,0 +1,124 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2012 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.
+
+import json
+import urllib
+
+from tempest.common.rest_client import RestClient
+
+
+class VolumeTypesClientJSON(RestClient):
+    """
+    Client class to send CRUD Volume Types API requests to a Cinder endpoint
+    """
+
+    def __init__(self, config, username, password, auth_url, tenant_name=None):
+        super(VolumeTypesClientJSON, self).__init__(config, username, password,
+                                                    auth_url, tenant_name)
+
+        self.service = self.config.volume.catalog_type
+        self.build_interval = self.config.volume.build_interval
+        self.build_timeout = self.config.volume.build_timeout
+
+    def list_volume_types(self, params=None):
+        """List all the volume_types created"""
+        url = 'types'
+        if params is not None:
+            url += '?%s' % urllib.urlencode(params)
+
+        resp, body = self.get(url)
+        body = json.loads(body)
+        return resp, body['volume_types']
+
+    def get_volume_type(self, volume_id):
+        """Returns the details of a single volume_type"""
+        url = "types/%s" % str(volume_id)
+        resp, body = self.get(url)
+        body = json.loads(body)
+        return resp, body['volume_type']
+
+    def create_volume_type(self, name, **kwargs):
+        """
+        Creates a new Volume_type.
+        name(Required): Name of volume_type.
+        Following optional keyword arguments are accepted:
+        extra_specs: A dictionary of values to be used as extra_specs.
+        """
+        post_body = {
+            'name': name,
+            'extra_specs': kwargs.get('extra_specs'),
+        }
+
+        post_body = json.dumps({'volume_type': post_body})
+        resp, body = self.post('types', post_body, self.headers)
+        body = json.loads(body)
+        return resp, body['volume_type']
+
+    def delete_volume_type(self, volume_id):
+        """Deletes the Specified Volume_type"""
+        return self.delete("types/%s" % str(volume_id))
+
+    def list_volume_types_extra_specs(self, vol_type_id, params=None):
+        """List all the volume_types extra specs created"""
+        url = 'types/%s/extra_specs' % str(vol_type_id)
+        if params is not None:
+            url += '?%s' % urllib.urlencode(params)
+
+        resp, body = self.get(url)
+        body = json.loads(body)
+        return resp, body['extra_specs']
+
+    def get_volume_type_extra_specs(self, vol_type_id, extra_spec_name):
+        """Returns the details of a single volume_type extra spec"""
+        url = "types/%s/extra_specs/%s" % (str(vol_type_id),
+                                           str(extra_spec_name))
+        resp, body = self.get(url)
+        body = json.loads(body)
+        return resp, body
+
+    def create_volume_type_extra_specs(self, vol_type_id, extra_spec):
+        """
+        Creates a new Volume_type extra spec.
+        vol_type_id: Id of volume_type.
+        extra_specs: A dictionary of values to be used as extra_specs.
+        """
+        url = "types/%s/extra_specs" % str(vol_type_id)
+        post_body = json.dumps({'extra_specs': extra_spec})
+        resp, body = self.post(url, post_body, self.headers)
+        body = json.loads(body)
+        return resp, body['extra_specs']
+
+    def delete_volume_type_extra_specs(self, vol_id, extra_spec_name):
+        """Deletes the Specified Volume_type extra spec"""
+        return self.delete("types/%s/extra_specs/%s" % ((str(vol_id)),
+                                                        str(extra_spec_name)))
+
+    def update_volume_type_extra_specs(self, vol_type_id, extra_spec_name,
+                                       extra_spec):
+        """
+        Update a volume_type extra spec.
+        vol_type_id: Id of volume_type.
+        extra_spec_name: Name of the extra spec to be updated.
+        extra_spec: A dictionary of with key as extra_spec_name and the
+                     updated value.
+        """
+        url = "types/%s/extra_specs/%s" % (str(vol_type_id),
+                                           str(extra_spec_name))
+        put_body = json.dumps(extra_spec)
+        resp, body = self.put(url, put_body, self.headers)
+        body = json.loads(body)
+        return resp, body
diff --git a/tempest/services/volume/json/volumes_client.py b/tempest/services/volume/json/volumes_client.py
index 2045f3c..962fe72 100644
--- a/tempest/services/volume/json/volumes_client.py
+++ b/tempest/services/volume/json/volumes_client.py
@@ -70,11 +70,13 @@
         Following optional keyword arguments are accepted:
         display_name: Optional Volume Name.
         metadata: A dictionary of values to be used as metadata.
+        volume_type: Optional Name of volume_type for the volume
         """
         post_body = {
             'size': size,
             'display_name': kwargs.get('display_name'),
             'metadata': kwargs.get('metadata'),
+            'volume_type': kwargs.get('volume_type')
         }
 
         post_body = json.dumps({'volume': post_body})
diff --git a/tempest/tests/compute/floating_ips/test_floating_ips_actions.py b/tempest/tests/compute/floating_ips/test_floating_ips_actions.py
index 540d9f4..de6eca3 100644
--- a/tempest/tests/compute/floating_ips/test_floating_ips_actions.py
+++ b/tempest/tests/compute/floating_ips/test_floating_ips_actions.py
@@ -129,7 +129,6 @@
         else:
             self.fail('Should not be able to delete a nonexistent floating IP')
 
-    @unittest.skip("Skipped until the Bug #957706 is resolved")
     @attr(type='negative')
     def test_associate_nonexistant_floating_ip(self):
         """
@@ -204,7 +203,6 @@
         #Deletion of server created in this method
         resp, body = self.servers_client.delete_server(self.new_server_id)
 
-    @unittest.skip("Skipped until the Bug #957706 is resolved")
     @attr(type='negative')
     def test_associate_ip_to_server_without_passing_floating_ip(self):
         """
diff --git a/tempest/tests/compute/test_authorization.py b/tempest/tests/compute/test_authorization.py
index beff07f..a31ee49 100644
--- a/tempest/tests/compute/test_authorization.py
+++ b/tempest/tests/compute/test_authorization.py
@@ -325,7 +325,6 @@
                           "happen if the tenant id does not match the"
                           " current user")
 
-    @unittest.skip("Skipped until the Bug #1001118 is resolved")
     @raises(exceptions.NotFound)
     @attr(type='negative')
     def test_delete_security_group_rule_of_alt_account_fails(self):
diff --git a/tempest/tests/volume/admin/__init__.py b/tempest/tests/volume/admin/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tempest/tests/volume/admin/__init__.py
diff --git a/tempest/tests/volume/admin/test_volume_types.py b/tempest/tests/volume/admin/test_volume_types.py
new file mode 100644
index 0000000..a065891
--- /dev/null
+++ b/tempest/tests/volume/admin/test_volume_types.py
@@ -0,0 +1,156 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2012 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.common.utils.data_utils import rand_name
+from tempest.services.volume.json.admin import volume_types_client
+from tempest.tests.volume.base import BaseVolumeTest
+
+
+class VolumeTypesTest(BaseVolumeTest):
+
+    @classmethod
+    def setUpClass(cls):
+        super(VolumeTypesTest, cls).setUpClass()
+        adm_user = cls.config.compute_admin.username
+        adm_pass = cls.config.compute_admin.password
+        adm_tenant = cls.config.compute_admin.tenant_name
+        auth_url = cls.config.identity.auth_url
+
+        cls.client = volume_types_client.VolumeTypesClientJSON(cls.config,
+                                                               adm_user,
+                                                               adm_pass,
+                                                               auth_url,
+                                                               adm_tenant)
+
+    @classmethod
+    def tearDownClass(cls):
+        super(VolumeTypesTest, cls).tearDownClass()
+
+    def test_volume_type_list(self):
+        """List Volume types."""
+        try:
+            resp, body = self.client.list_volume_types()
+            self.assertEqual(200, resp.status)
+            self.assertTrue(type(body), list)
+        except:
+            self.fail("Could not list volume types")
+
+    def test_create_get_delete_volume_with_volume_type_and_extra_specs(self):
+        """ Create/get/delete volume with volume_type and extra spec. """
+        try:
+            volume = {}
+            vol_name = rand_name("volume-")
+            vol_type_name = rand_name("volume-type-")
+            extra_specs = {"Spec1": "Val1", "Spec2": "Val2"}
+            body = {}
+            resp, body = self.client.create_volume_type(vol_type_name,
+                                                        extra_specs=
+                                                        extra_specs)
+            self.assertEqual(200, resp.status)
+            self.assertTrue('id' in body)
+            self.assertTrue('name' in body)
+            resp, volume = self.volumes_client.\
+            create_volume(size=1, display_name=vol_name,
+                          volume_type=vol_type_name)
+            self.assertEqual(200, resp.status)
+            self.assertTrue('id' in volume)
+            self.assertTrue('display_name' in volume)
+            self.assertEqual(volume['display_name'], vol_name,
+                             "The created volume name is not equal "
+                             "to the requested name")
+            self.assertTrue(volume['id'] is not None,
+                            "Field volume id is empty or not found.")
+            self.volumes_client.wait_for_volume_status(volume['id'],
+                                                       'available')
+            resp, fetched_volume = self.volumes_client.\
+            get_volume(volume['id'])
+            self.assertEqual(200, resp.status)
+            self.assertEqual(vol_name, fetched_volume['display_name'],
+                             'The fetched Volume is different '
+                             'from the created Volume')
+            self.assertEqual(volume['id'], fetched_volume['id'],
+                             'The fetched Volume is different '
+                             'from the created Volume')
+            self.assertEqual(vol_type_name, fetched_volume['volume_type'],
+                             'The fetched Volume is different '
+                             'from the created Volume')
+        except:
+            self.fail("Could not create correct volume with volume_type")
+        finally:
+            if volume:
+                # Delete the Volume if it was created
+                resp, _ = self.volumes_client.delete_volume(volume['id'])
+                self.assertEqual(202, resp.status)
+
+            if body:
+                resp, _ = self.client.delete_volume_type(body['id'])
+                self.assertEqual(202, resp.status)
+
+    def test_volume_type_create_delete(self):
+        """ Create/Delete volume type."""
+        try:
+            name = rand_name("volume-type-")
+            extra_specs = {"Spec1": "Val1", "Spec2": "Val2"}
+            resp, body = self.client.\
+            create_volume_type(name, extra_specs=extra_specs)
+            self.assertEqual(200, resp.status)
+            self.assertTrue('id' in body)
+            self.assertTrue('name' in body)
+            self.assertEqual(body['name'], name,
+                             "The created volume_type name is not equal "
+                             "to the requested name")
+            self.assertTrue(body['id'] is not None,
+                            "Field volume_type id is empty or not found.")
+            resp, fetched_volume_type = self.client.\
+            delete_volume_type(body['id'])
+            self.assertEqual(202, resp.status)
+        except:
+            self.fail("Could not create a volume_type")
+
+    def test_volume_type_create_get(self):
+        """ Create/get volume type."""
+        try:
+            body = {}
+            name = rand_name("volume-type-")
+            extra_specs = {"Spec1": "Val1", "Spec2": "Val2"}
+            resp, body = self.client.\
+            create_volume_type(name, extra_specs=extra_specs)
+            self.assertEqual(200, resp.status)
+            self.assertTrue('id' in body)
+            self.assertTrue('name' in body)
+            self.assertEqual(body['name'], name,
+                             "The created volume_type name is not equal "
+                             "to the requested name")
+            self.assertTrue(body['id'] is not None,
+                            "Field volume_type id is empty or not found.")
+            resp, fetched_volume_type = self.client.get_volume_type(body['id'])
+            self.assertEqual(200, resp.status)
+            self.assertEqual(name, fetched_volume_type['name'],
+                             'The fetched Volume_type is different '
+                             'from the created Volume_type')
+            self.assertEqual(str(body['id']), fetched_volume_type['id'],
+                             'The fetched Volume_type is different '
+                             'from the created Volume_type')
+            self.assertEqual(extra_specs, fetched_volume_type['extra_specs'],
+                             'The fetched Volume_type is different '
+                             'from the created Volume_type')
+        except:
+            self.fail("Could not create a volume_type")
+        finally:
+            if body:
+                resp, _ = self.client.delete_volume_type(body['id'])
+                self.assertEqual(202, resp.status)
diff --git a/tempest/tests/volume/admin/test_volume_types_extra_specs.py b/tempest/tests/volume/admin/test_volume_types_extra_specs.py
new file mode 100644
index 0000000..3f06c85
--- /dev/null
+++ b/tempest/tests/volume/admin/test_volume_types_extra_specs.py
@@ -0,0 +1,109 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2012 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.common.utils.data_utils import rand_name
+from tempest.tests.volume.base import BaseVolumeTest
+from tempest.services.volume.json.admin import volume_types_client
+
+
+class VolumeTypesExtraSpecsTest(BaseVolumeTest):
+
+    @classmethod
+    def setUpClass(cls):
+        super(VolumeTypesExtraSpecsTest, cls).setUpClass()
+
+        adm_user = cls.config.compute_admin.username
+        adm_pass = cls.config.compute_admin.password
+        adm_tenant = cls.config.compute_admin.tenant_name
+        auth_url = cls.config.identity.auth_url
+
+        cls.client = volume_types_client.VolumeTypesClientJSON(cls.config,
+                                                               adm_user,
+                                                               adm_pass,
+                                                               auth_url,
+                                                               adm_tenant)
+
+        vol_type_name = rand_name('Volume-type-')
+        cls.extra_spec = {"spec1": "val1"}
+        resp, cls.volume_type = cls.client.create_volume_type(vol_type_name)
+
+    @classmethod
+    def tearDownClass(cls):
+        super(VolumeTypesExtraSpecsTest, cls).tearDownClass()
+        cls.client.delete_volume_type(cls.volume_type['id'])
+
+    def test_volume_type_extra_specs_list(self):
+        """List Volume types extra specs."""
+        try:
+            resp, body = self.client.\
+            list_volume_types_extra_specs(self.volume_type['id'])
+            self.assertEqual(200, resp.status)
+            self.assertTrue(type(body), dict)
+            self.assertTrue('spec1' in body, "Incorrect volume type extra"
+                            " spec returned")
+        except:
+            self.fail("Could not list volume types extra specs")
+
+    def test_volume_type_extra_specs_update(self):
+        """ Update volume type extra specs"""
+        try:
+            extra_spec = {"spec1": "val2"}
+            resp, body = self.client.\
+            update_volume_type_extra_specs(self.volume_type['id'],
+                                           extra_spec.keys()[0],
+                                           extra_spec)
+            self.assertEqual(200, resp.status)
+            self.assertTrue('spec1' in body,
+                            "Volume type extra spec incorrectly updated")
+            self.assertEqual(extra_spec['spec1'], body['spec1'],
+                             "Volume type extra spec incorrectly updated")
+        except:
+            self.fail("Couldnt update volume type extra spec")
+
+    def test_volume_type_extra_spec_create_delete(self):
+        """ Create/Delete volume type extra spec."""
+        try:
+            extra_specs = {"spec2": "val1"}
+            resp, body = self.client.\
+            create_volume_type_extra_specs(self.volume_type['id'], extra_specs)
+            self.assertEqual(200, resp.status)
+            self.assertEqual(extra_specs, body,
+                             "Volume type extra spec incorrectly created")
+            resp, _ = self.client.\
+            delete_volume_type_extra_specs(self.volume_type['id'],
+                                           extra_specs.keys()[0])
+            self.assertEqual(202, resp.status)
+        except:
+            self.fail("Could not create a volume_type extra spec")
+
+    def test_volume_type_extra_spec_create_get(self):
+        """ Create/get volume type extra spec"""
+        try:
+            extra_specs = {"spec1": "val1"}
+            resp, body = self.client.\
+            create_volume_type_extra_specs(self.volume_type['id'], extra_specs)
+            self.assertEqual(200, resp.status)
+            self.assertEqual(extra_specs, body,
+                             "Volume type extra spec incorrectly created")
+            resp, fetched_vol_type_extra_spec = self.client.\
+            get_volume_type_extra_specs(self.volume_type['id'],
+                                        extra_specs.keys()[0])
+            self.assertEqual(200, resp.status)
+            self.assertEqual(extra_specs, body,
+                             "Volume type extra spec incorrectly fetched")
+        except:
+            self.fail("Could not create a volume_type extra spec")
