diff --git a/tempest/services/compute/json/flavors_client.py b/tempest/services/compute/json/flavors_client.py
index 56546de..bd339b2 100644
--- a/tempest/services/compute/json/flavors_client.py
+++ b/tempest/services/compute/json/flavors_client.py
@@ -51,20 +51,23 @@
         body = json.loads(body)
         return resp, body['flavor']
 
-    def create_flavor(self, name, ram, vcpus, disk, ephemeral, flavor_id,
-                      swap, rxtx):
+    def create_flavor(self, name, ram, vcpus, disk, flavor_id, **kwargs):
         """Creates a new flavor or instance type."""
         post_body = {
             'name': name,
             'ram': ram,
             'vcpus': vcpus,
             'disk': disk,
-            'OS-FLV-EXT-DATA:ephemeral': ephemeral,
             'id': flavor_id,
-            'swap': swap,
-            'rxtx_factor': rxtx,
         }
-
+        if kwargs.get('ephemeral'):
+            post_body['OS-FLV-EXT-DATA:ephemeral'] = kwargs.get('ephemeral')
+        if kwargs.get('swap'):
+            post_body['swap'] = kwargs.get('swap')
+        if kwargs.get('rxtx'):
+            post_body['rxtx_factor'] = kwargs.get('rxtx')
+        if kwargs.get('is_public'):
+            post_body['os-flavor-access:is_public'] = kwargs.get('is_public')
         post_body = json.dumps({'flavor': post_body})
         resp, body = self.post('flavors', post_body, self.headers)
 
@@ -74,3 +77,13 @@
     def delete_flavor(self, flavor_id):
         """Deletes the given flavor."""
         return self.delete("flavors/%s" % str(flavor_id))
+
+    def is_resource_deleted(self, id):
+        #Did not use get_flavor_details(id) for verification as it gives
+        #200 ok even for deleted id. LP #981263
+        #we can remove the loop here and use get by ID when bug gets sortedout
+        resp, flavors = self.list_flavors_with_detail()
+        for flavor in flavors:
+            if flavor['id'] == id:
+                return False
+        return True
diff --git a/tempest/services/compute/xml/flavors_client.py b/tempest/services/compute/xml/flavors_client.py
index 2a8ad0d..c011fe4 100644
--- a/tempest/services/compute/xml/flavors_client.py
+++ b/tempest/services/compute/xml/flavors_client.py
@@ -27,7 +27,9 @@
 
 
 XMLNS_OS_FLV_EXT_DATA = \
-        "http://docs.openstack.org/compute/ext/flavor_extra_data/api/v1.1"
+    "http://docs.openstack.org/compute/ext/flavor_extra_data/api/v1.1"
+XMLNS_OS_FLV_ACCESS = \
+    "http://docs.openstack.org/compute/ext/flavor_access/api/v1.1"
 
 
 class FlavorsClientXML(RestClientXML):
@@ -84,8 +86,7 @@
         flavor = self._format_flavor(body)
         return resp, flavor
 
-    def create_flavor(self, name, ram, vcpus, disk, ephemeral, flavor_id,
-                      swap, rxtx):
+    def create_flavor(self, name, ram, vcpus, disk, flavor_id, **kwargs):
         """Creates a new flavor or instance type."""
         flavor = Element("flavor",
                          xmlns=XMLNS_11,
@@ -93,12 +94,19 @@
                          vcpus=vcpus,
                          disk=disk,
                          id=flavor_id,
-                         swap=swap,
-                         rxtx_factor=rxtx,
                          name=name)
+        if kwargs.get('rxtx'):
+            flavor.add_attr('rxtx_factor', kwargs.get('rxtx'))
+        if kwargs.get('swap'):
+            flavor.add_attr('swap', kwargs.get('swap'))
+        if kwargs.get('ephemeral'):
+            flavor.add_attr('OS-FLV-EXT-DATA:ephemeral',
+                            kwargs.get('ephemeral'))
+        if kwargs.get('is_public'):
+            flavor.add_attr('os-flavor-access:is_public',
+                            kwargs.get('is_public'))
         flavor.add_attr('xmlns:OS-FLV-EXT-DATA', XMLNS_OS_FLV_EXT_DATA)
-        flavor.add_attr('OS-FLV-EXT-DATA:ephemeral', ephemeral)
-
+        flavor.add_attr('xmlns:os-flavor-access', XMLNS_OS_FLV_ACCESS)
         resp, body = self.post('flavors', str(Document(flavor)), self.headers)
         body = xml_to_json(etree.fromstring(body))
         flavor = self._format_flavor(body)
@@ -107,3 +115,13 @@
     def delete_flavor(self, flavor_id):
         """Deletes the given flavor."""
         return self.delete("flavors/%s" % str(flavor_id), self.headers)
+
+    def is_resource_deleted(self, id):
+        #Did not use get_flavor_details(id) for verification as it gives
+        #200 ok even for deleted id. LP #981263
+        #we can remove the loop here and use get by ID when bug gets sortedout
+        resp, flavors = self.list_flavors_with_detail()
+        for flavor in flavors:
+            if flavor['id'] == id:
+                return False
+        return True
diff --git a/tempest/tests/compute/admin/test_flavors.py b/tempest/tests/compute/admin/test_flavors.py
index b5ee13a..8172bd4 100644
--- a/tempest/tests/compute/admin/test_flavors.py
+++ b/tempest/tests/compute/admin/test_flavors.py
@@ -29,8 +29,8 @@
     Tests Flavors API Create and Delete that require admin privileges
     """
 
-    @staticmethod
-    def setUpClass(cls):
+    @classmethod
+    def setUpClass(self, cls):
         if not compute.FLAVOR_EXTRA_DATA_ENABLED:
             msg = "FlavorExtraData extension not enabled."
             raise nose.SkipTest(msg)
@@ -43,61 +43,77 @@
         cls.ephemeral = 10
         cls.new_flavor_id = 1234
         cls.swap = 1024
-        cls.rxtx = 1
+        cls.rxtx = 2
 
     @attr(type='positive')
     def test_create_flavor(self):
         # Create a flavor and ensure it is listed
         # This operation requires the user to have 'admin' role
-        #Create the flavor
-        resp, flavor = self.client.create_flavor(self.flavor_name,
-                                                 self.ram, self.vcpus,
-                                                 self.disk,
-                                                 self.ephemeral,
-                                                 self.new_flavor_id,
-                                                 self.swap, self.rxtx)
-        self.assertEqual(200, resp.status)
-        self.assertEqual(flavor['name'], self.flavor_name)
-        self.assertEqual(flavor['vcpus'], self.vcpus)
-        self.assertEqual(flavor['disk'], self.disk)
-        self.assertEqual(flavor['ram'], self.ram)
-        self.assertEqual(int(flavor['id']), self.new_flavor_id)
-        self.assertEqual(flavor['swap'], self.swap)
-        self.assertEqual(flavor['rxtx_factor'], self.rxtx)
-        self.assertEqual(flavor['OS-FLV-EXT-DATA:ephemeral'], self.ephemeral)
+        try:
+            #Create the flavor
+            resp, flavor = self.client.create_flavor(self.flavor_name,
+                                                     self.ram, self.vcpus,
+                                                     self.disk,
+                                                     self.new_flavor_id,
+                                                     ephemeral=self.ephemeral,
+                                                     swap=self.swap,
+                                                     rxtx=self.rxtx)
+            self.assertEqual(200, resp.status)
+            self.assertEqual(flavor['name'], self.flavor_name)
+            self.assertEqual(flavor['vcpus'], self.vcpus)
+            self.assertEqual(flavor['disk'], self.disk)
+            self.assertEqual(flavor['ram'], self.ram)
+            self.assertEqual(int(flavor['id']), self.new_flavor_id)
+            self.assertEqual(flavor['swap'], self.swap)
+            self.assertEqual(flavor['rxtx_factor'], self.rxtx)
+            self.assertEqual(flavor['OS-FLV-EXT-DATA:ephemeral'],
+                             self.ephemeral)
+            if self._interface == "xml":
+                XMLNS_OS_FLV_ACCESS = "http://docs.openstack.org/compute/ext/"\
+                    "flavor_access/api/v2"
+                key = "{" + XMLNS_OS_FLV_ACCESS + "}is_public"
+                self.assertEqual(flavor[key], "True")
+            if self._interface == "json":
+                self.assertEqual(flavor['os-flavor-access:is_public'], True)
 
-        #Verify flavor is retrieved
-        resp, flavor = self.client.get_flavor_details(self.new_flavor_id)
-        self.assertEqual(resp.status, 200)
-        self.assertEqual(flavor['name'], self.flavor_name)
+            #Verify flavor is retrieved
+            resp, flavor = self.client.get_flavor_details(self.new_flavor_id)
+            self.assertEqual(resp.status, 200)
+            self.assertEqual(flavor['name'], self.flavor_name)
 
-        #Delete the flavor
-        resp, body = self.client.delete_flavor(flavor['id'])
-        self.assertEqual(resp.status, 202)
+        finally:
+            #Delete the flavor
+            resp, body = self.client.delete_flavor(self.new_flavor_id)
+            self.assertEqual(resp.status, 202)
+            self.client.wait_for_resource_deletion(self.new_flavor_id)
 
     @attr(type='positive')
     def test_create_flavor_verify_entry_in_list_details(self):
         # Create a flavor and ensure it's details are listed
         # This operation requires the user to have 'admin' role
-        #Create the flavor
-        resp, flavor = self.client.create_flavor(self.flavor_name,
-                                                 self.ram, self.vcpus,
-                                                 self.disk,
-                                                 self.ephemeral,
-                                                 self.new_flavor_id,
-                                                 self.swap, self.rxtx)
-        flag = False
-        #Verify flavor is retrieved
-        resp, flavors = self.client.list_flavors_with_detail()
-        self.assertEqual(resp.status, 200)
-        for flavor in flavors:
-            if flavor['name'] == self.flavor_name:
-                flag = True
-        self.assertTrue(flag)
+        try:
+            #Create the flavor
+            resp, flavor = self.client.create_flavor(self.flavor_name,
+                                                     self.ram, self.vcpus,
+                                                     self.disk,
+                                                     self.new_flavor_id,
+                                                     ephemeral=self.ephemeral,
+                                                     swap=self.swap,
+                                                     rxtx=self.rxtx)
+            flag = False
+            #Verify flavor is retrieved
+            resp, flavors = self.client.list_flavors_with_detail()
+            self.assertEqual(resp.status, 200)
+            for flavor in flavors:
+                if flavor['name'] == self.flavor_name:
+                    flag = True
+            self.assertTrue(flag)
 
-        #Delete the flavor
-        resp, body = self.client.delete_flavor(self.new_flavor_id)
-        self.assertEqual(resp.status, 202)
+        finally:
+            #Delete the flavor
+            resp, body = self.client.delete_flavor(self.new_flavor_id)
+            self.assertEqual(resp.status, 202)
+            self.client.wait_for_resource_deletion(self.new_flavor_id)
 
     @attr(type='negative')
     def test_get_flavor_details_for_deleted_flavor(self):
@@ -106,9 +122,10 @@
         resp, flavor = self.client.create_flavor(self.flavor_name,
                                                  self.ram,
                                                  self.vcpus, self.disk,
-                                                 self.ephemeral,
                                                  self.new_flavor_id,
-                                                 self.swap, self.rxtx)
+                                                 ephemeral=self.ephemeral,
+                                                 swap=self.swap,
+                                                 rxtx=self.rxtx)
         self.assertEquals(200, resp.status)
 
         # Delete the flavor
@@ -129,20 +146,118 @@
                 flag = False
         self.assertTrue(flag)
 
+    def test_create_list_flavor_without_extra_data(self):
+        #Create a flavor and ensure it is listed
+        #This operation requires the user to have 'admin' role
+        try:
+            #Create the flavor
+            resp, flavor = self.client.create_flavor(self.flavor_name,
+                                                     self.ram, self.vcpus,
+                                                     self.disk,
+                                                     self.new_flavor_id)
+            self.assertEqual(200, resp.status)
+            self.assertEqual(flavor['name'], self.flavor_name)
+            self.assertEqual(flavor['ram'], self.ram)
+            self.assertEqual(flavor['vcpus'], self.vcpus)
+            self.assertEqual(flavor['disk'], self.disk)
+            self.assertEqual(int(flavor['id']), self.new_flavor_id)
+            self.assertEqual(flavor['swap'], '')
+            self.assertEqual(int(flavor['rxtx_factor']), 1)
+            self.assertEqual(int(flavor['OS-FLV-EXT-DATA:ephemeral']), 0)
+            if self._interface == "xml":
+                XMLNS_OS_FLV_ACCESS = "http://docs.openstack.org/compute/ext/"\
+                    "flavor_access/api/v2"
+                key = "{" + XMLNS_OS_FLV_ACCESS + "}is_public"
+                self.assertEqual(flavor[key], "True")
+            if self._interface == "json":
+                self.assertEqual(flavor['os-flavor-access:is_public'], True)
+
+            #Verify flavor is retrieved
+            resp, flavor = self.client.get_flavor_details(self.new_flavor_id)
+            self.assertEqual(resp.status, 200)
+            self.assertEqual(flavor['name'], self.flavor_name)
+            #Check if flavor is present in list
+            resp, flavors = self.client.list_flavors_with_detail()
+            self.assertEqual(resp.status, 200)
+            for flavor in flavors:
+                if flavor['name'] == self.flavor_name:
+                    flag = True
+            self.assertTrue(flag)
+
+        finally:
+            #Delete the flavor
+            resp, body = self.client.delete_flavor(self.new_flavor_id)
+            self.assertEqual(resp.status, 202)
+            self.client.wait_for_resource_deletion(self.new_flavor_id)
+
+    @attr(type='positive')
+    def test_flavor_not_public_verify_entry_not_in_list_details(self):
+        #Create a flavor with os-flavor-access:is_public false should not
+        #be present in list_details.
+        #This operation requires the user to have 'admin' role
+        try:
+            #Create the flavor
+            resp, flavor = self.client.create_flavor(self.flavor_name,
+                                                     self.ram, self.vcpus,
+                                                     self.disk,
+                                                     self.new_flavor_id,
+                                                     is_public="False")
+            flag = False
+            #Verify flavor is retrieved
+            resp, flavors = self.client.list_flavors_with_detail()
+            self.assertEqual(resp.status, 200)
+            for flavor in flavors:
+                if flavor['name'] == self.flavor_name:
+                    flag = True
+            self.assertFalse(flag)
+        finally:
+            #Delete the flavor
+            resp, body = self.client.delete_flavor(self.new_flavor_id)
+            self.assertEqual(resp.status, 202)
+
+    def test_list_public_flavor_with_other_user(self):
+        #Create a Flavor with public access.
+        #Try to List/Get flavor with another user
+        try:
+            #Create the flavor
+            resp, flavor = self.client.create_flavor(self.flavor_name,
+                                                     self.ram, self.vcpus,
+                                                     self.disk,
+                                                     self.new_flavor_id,
+                                                     is_public="True")
+            flag = False
+            self.new_client = self.flavors_client
+            #Verify flavor is retrieved with new user
+            resp, flavors = self.new_client.list_flavors_with_detail()
+            self.assertEqual(resp.status, 200)
+            for flavor in flavors:
+                if flavor['name'] == self.flavor_name:
+                    flag = True
+            self.assertTrue(flag)
+        finally:
+            #Delete the flavor
+            resp, body = self.client.delete_flavor(self.new_flavor_id)
+            self.assertEqual(resp.status, 202)
+            self.client.wait_for_resource_deletion(self.new_flavor_id)
+
 
 class FlavorsAdminTestXML(base.BaseComputeAdminTestXML,
+                          base.BaseComputeTestXML,
                           FlavorsAdminTestBase):
 
     @classmethod
     def setUpClass(cls):
         super(FlavorsAdminTestXML, cls).setUpClass()
+        base.BaseComputeTestXML.setUpClass()
         FlavorsAdminTestBase.setUpClass(cls)
 
 
 class FlavorsAdminTestJSON(base.BaseComputeAdminTestJSON,
+                           base.BaseComputeTestJSON,
                            FlavorsAdminTestBase):
 
     @classmethod
     def setUpClass(cls):
         super(FlavorsAdminTestJSON, cls).setUpClass()
+        base.BaseComputeTestJSON.setUpClass()
         FlavorsAdminTestBase.setUpClass(cls)
