Merge "Define v3 policies_client as library"
diff --git a/requirements.txt b/requirements.txt
index fdcb3d5..058ea00 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -18,7 +18,7 @@
 fixtures>=3.0.0 # Apache-2.0/BSD
 testscenarios>=0.4 # Apache-2.0/BSD
 PyYAML>=3.1.0 # MIT
-stevedore>=1.10.0 # Apache-2.0
+stevedore>=1.16.0 # Apache-2.0
 PrettyTable<0.8,>=0.7 # BSD
 os-testr>=0.7.0 # Apache-2.0
 urllib3>=1.15.1 # MIT
diff --git a/tempest/api/compute/admin/test_aggregates.py b/tempest/api/compute/admin/test_aggregates.py
index 84b00a7..ac1bfee 100644
--- a/tempest/api/compute/admin/test_aggregates.py
+++ b/tempest/api/compute/admin/test_aggregates.py
@@ -181,7 +181,7 @@
                         host=self.host)
 
         aggregates = self.client.list_aggregates()['aggregates']
-        aggs = filter(lambda x: x['id'] == aggregate['id'], aggregates)
+        aggs = [agg for agg in aggregates if agg['id'] == aggregate['id']]
         self.assertEqual(1, len(aggs))
         agg = aggs[0]
         self.assertEqual(aggregate_name, agg['name'])
diff --git a/tempest/api/compute/admin/test_aggregates_negative.py b/tempest/api/compute/admin/test_aggregates_negative.py
index 6b75aee..3c4e313 100644
--- a/tempest/api/compute/admin/test_aggregates_negative.py
+++ b/tempest/api/compute/admin/test_aggregates_negative.py
@@ -36,8 +36,8 @@
         cls.az_name_prefix = 'test_az'
 
         hosts_all = cls.os_adm.hosts_client.list_hosts()['hosts']
-        hosts = map(lambda x: x['host_name'],
-                    filter(lambda y: y['service'] == 'compute', hosts_all))
+        hosts = ([host['host_name']
+                 for host in hosts_all if host['service'] == 'compute'])
         cls.host = hosts[0]
 
     @test.attr(type=['negative'])
diff --git a/tempest/api/compute/admin/test_security_groups.py b/tempest/api/compute/admin/test_security_groups.py
index 1494745..58da8b9 100644
--- a/tempest/api/compute/admin/test_security_groups.py
+++ b/tempest/api/compute/admin/test_security_groups.py
@@ -65,7 +65,7 @@
         # Fetch all security groups based on 'all_tenants' search filter
         fetched_list = self.adm_client.list_security_groups(
             all_tenants='true')['security_groups']
-        sec_group_id_list = map(lambda sg: sg['id'], fetched_list)
+        sec_group_id_list = [sg['id'] for sg in fetched_list]
         # Now check if all created Security Groups are present in fetched list
         for sec_group in security_group_list:
             self.assertIn(sec_group['id'], sec_group_id_list)
diff --git a/tempest/api/compute/admin/test_servers.py b/tempest/api/compute/admin/test_servers.py
index 3eb6d94..09253b0 100644
--- a/tempest/api/compute/admin/test_servers.py
+++ b/tempest/api/compute/admin/test_servers.py
@@ -77,7 +77,7 @@
         params = {'all_tenants': ''}
         body = self.client.list_servers(detail=True, **params)
         servers = body['servers']
-        servers_name = map(lambda x: x['name'], servers)
+        servers_name = [server['name'] for server in servers]
 
         self.assertIn(self.s1_name, servers_name)
         self.assertIn(self.s2_name, servers_name)
diff --git a/tempest/api/identity/admin/v2/test_services.py b/tempest/api/identity/admin/v2/test_services.py
index 6c9b564..94291f8 100644
--- a/tempest/api/identity/admin/v2/test_services.py
+++ b/tempest/api/identity/admin/v2/test_services.py
@@ -93,7 +93,7 @@
                 name=name, type=s_type,
                 description=description)['OS-KSADM:service']
             services.append(service)
-        service_ids = map(lambda x: x['id'], services)
+        service_ids = [svc['id'] for svc in services]
 
         def delete_services():
             for service_id in service_ids:
diff --git a/tempest/api/identity/admin/v2/test_tenants.py b/tempest/api/identity/admin/v2/test_tenants.py
index 583fa8e..4faf184 100644
--- a/tempest/api/identity/admin/v2/test_tenants.py
+++ b/tempest/api/identity/admin/v2/test_tenants.py
@@ -35,7 +35,7 @@
             self.addCleanup(test_utils.call_and_ignore_notfound_exc,
                             self.tenants_client.delete_tenant, tenant['id'])
             tenants.append(tenant)
-        tenant_ids = map(lambda x: x['id'], tenants)
+        tenant_ids = [tn['id'] for tn in tenants]
         body = self.tenants_client.list_tenants()['tenants']
         found = [t for t in body if t['id'] in tenant_ids]
         self.assertEqual(len(found), len(tenants), 'Tenants not created')
diff --git a/tempest/api/image/v1/test_image_members.py b/tempest/api/image/v1/test_image_members.py
index 94edb6c..50f0926 100644
--- a/tempest/api/image/v1/test_image_members.py
+++ b/tempest/api/image/v1/test_image_members.py
@@ -25,7 +25,7 @@
         self.image_member_client.create_image_member(image, self.alt_tenant_id)
         body = self.image_member_client.list_image_members(image)
         members = body['members']
-        members = map(lambda x: x['member_id'], members)
+        members = [member['member_id'] for member in members]
         self.assertIn(self.alt_tenant_id, members)
         # get image as alt user
         self.alt_img_cli.show_image(image)
@@ -40,7 +40,7 @@
         body = self.image_member_client.list_shared_images(
             self.alt_tenant_id)
         images = body['shared_images']
-        images = map(lambda x: x['image_id'], images)
+        images = [img['image_id'] for img in images]
         self.assertIn(share_image, images)
         self.assertIn(image, images)
 
diff --git a/tempest/api/image/v1/test_images.py b/tempest/api/image/v1/test_images.py
index def7750..e4fbbe3 100644
--- a/tempest/api/image/v1/test_images.py
+++ b/tempest/api/image/v1/test_images.py
@@ -212,7 +212,7 @@
     def test_index_no_params(self):
         # Simple test to see all fixture images returned
         images_list = self.client.list_images()['images']
-        image_list = map(lambda x: x['id'], images_list)
+        image_list = [image['id'] for image in images_list]
         for image_id in self.created_images:
             self.assertIn(image_id, image_list)
 
diff --git a/tempest/api/image/v2/test_images.py b/tempest/api/image/v2/test_images.py
index 1fb9c52..42a4352 100644
--- a/tempest/api/image/v2/test_images.py
+++ b/tempest/api/image/v2/test_images.py
@@ -185,7 +185,7 @@
     def test_list_no_params(self):
         # Simple test to see all fixture images returned
         images_list = self.client.list_images()['images']
-        image_list = map(lambda x: x['id'], images_list)
+        image_list = [image['id'] for image in images_list]
 
         for image in self.created_images:
             self.assertIn(image, image_list)
diff --git a/tempest/api/orchestration/stacks/test_non_empty_stack.py b/tempest/api/orchestration/stacks/test_non_empty_stack.py
index 3be5bb6..4ead084 100644
--- a/tempest/api/orchestration/stacks/test_non_empty_stack.py
+++ b/tempest/api/orchestration/stacks/test_non_empty_stack.py
@@ -125,7 +125,7 @@
                                        'resource_status_reason',
                                        'resource_status', 'event_time')
 
-        resource_statuses = map(lambda event: event['resource_status'], events)
+        resource_statuses = [event['resource_status'] for event in events]
         self.assertIn('CREATE_IN_PROGRESS', resource_statuses)
         self.assertIn('CREATE_COMPLETE', resource_statuses)
 
diff --git a/tempest/api/volume/admin/test_volumes_list.py b/tempest/api/volume/admin/test_volumes_list.py
index 64041b8..70c16f3 100644
--- a/tempest/api/volume/admin/test_volumes_list.py
+++ b/tempest/api/volume/admin/test_volumes_list.py
@@ -53,7 +53,7 @@
         self.assertEqual(sorted(expected_list_ids), sorted(fetched_list_ids))
         # Verifying tenant id of volumes fetched list is related to
         # primary tenant
-        fetched_tenant_id = map(operator.itemgetter(
-            'os-vol-tenant-attr:tenant_id'), fetched_list)
+        fetched_tenant_id = [operator.itemgetter(
+            'os-vol-tenant-attr:tenant_id')(item) for item in fetched_list]
         expected_tenant_id = [self.volumes_client.tenant_id] * 3
         self.assertEqual(expected_tenant_id, fetched_tenant_id)
diff --git a/tempest/api/volume/test_volumes_list.py b/tempest/api/volume/test_volumes_list.py
index a93025d..f7176f4 100644
--- a/tempest/api/volume/test_volumes_list.py
+++ b/tempest/api/volume/test_volumes_list.py
@@ -33,8 +33,9 @@
 
     def assertVolumesIn(self, fetched_list, expected_list, fields=None):
         if fields:
-            expected_list = map(operator.itemgetter(*fields), expected_list)
-            fetched_list = map(operator.itemgetter(*fields), fetched_list)
+            fieldsgetter = operator.itemgetter(*fields)
+            expected_list = map(fieldsgetter, expected_list)
+            fetched_list = [fieldsgetter(item) for item in fetched_list]
 
         missing_vols = [v for v in expected_list if v not in fetched_list]
         if len(missing_vols) == 0:
diff --git a/tempest/services/baremetal/v1/json/baremetal_client.py b/tempest/services/baremetal/v1/json/baremetal_client.py
old mode 100644
new mode 100755
index f24ef68..ede0d90
--- a/tempest/services/baremetal/v1/json/baremetal_client.py
+++ b/tempest/services/baremetal/v1/json/baremetal_client.py
@@ -20,7 +20,11 @@
 
     @base.handle_errors
     def list_nodes(self, **kwargs):
-        """List all existing nodes."""
+        """List all existing nodes.
+
+        Available params: see http://developer.openstack.org/api-ref/
+                              baremetal/index.html#list-nodes
+        """
         return self._list_request('nodes', **kwargs)
 
     @base.handle_errors
@@ -35,7 +39,11 @@
 
     @base.handle_errors
     def list_ports(self, **kwargs):
-        """List all existing ports."""
+        """List all existing ports.
+
+        Available params: see http://developer.openstack.org/api-ref/
+                              baremetal/index.html?expanded=#list-ports
+        """
         return self._list_request('ports', **kwargs)
 
     @base.handle_errors
@@ -50,7 +58,11 @@
 
     @base.handle_errors
     def list_ports_detail(self, **kwargs):
-        """Details list all existing ports."""
+        """Details list all existing ports.
+
+        Available params: see http://developer.openstack.org/api-ref/baremetal/
+                              index.html?expanded=#list-detailed-ports
+        """
         return self._list_request('/ports/detail', **kwargs)
 
     @base.handle_errors
diff --git a/tempest/services/volume/base/admin/base_types_client.py b/tempest/services/volume/base/admin/base_types_client.py
old mode 100644
new mode 100755
index e4d9014..afca752
--- a/tempest/services/volume/base/admin/base_types_client.py
+++ b/tempest/services/volume/base/admin/base_types_client.py
@@ -48,7 +48,11 @@
         return 'volume-type/encryption-type'
 
     def list_volume_types(self, **params):
-        """List all the volume_types created."""
+        """List all the volume_types created.
+
+        Available params: see http://developer.openstack.org/
+                              api-ref-blockstorage-v2.html#showVolumeTypes
+        """
         url = 'types'
         if params:
             url += '?%s' % urllib.urlencode(params)
@@ -59,7 +63,11 @@
         return rest_client.ResponseBody(resp, body)
 
     def show_volume_type(self, volume_id):
-        """Returns the details of a single volume_type."""
+        """Returns the details of a single volume_type.
+
+        Available params: see http://developer.openstack.org/
+                              api-ref-blockstorage-v2.html#showVolumeType
+        """
         url = "types/%s" % str(volume_id)
         resp, body = self.get(url)
         body = json.loads(body)
@@ -79,7 +87,11 @@
         return rest_client.ResponseBody(resp, body)
 
     def delete_volume_type(self, volume_id):
-        """Deletes the Specified Volume_type."""
+        """Deletes the Specified Volume_type.
+
+        Available params: see http://developer.openstack.org/
+                              api-ref-blockstorage-v2.html#deleteVolumeType
+        """
         resp, body = self.delete("types/%s" % str(volume_id))
         self.expected_success(202, resp.status)
         return rest_client.ResponseBody(resp, body)
@@ -90,8 +102,6 @@
         TODO: Current api-site doesn't contain this API description.
         After fixing the api-site, we need to fix here also for putting
         the link to api-site.
-
-
         """
         url = 'types/%s/extra_specs' % str(vol_type_id)
         if params:
@@ -139,6 +149,9 @@
         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.
+        Available params: see http://developer.openstack.org/
+                              api-ref-blockstorage-v2.html#
+                              updateVolumeTypeExtraSpecs
         """
         url = "types/%s/extra_specs/%s" % (str(vol_type_id),
                                            str(extra_spec_name))
@@ -207,7 +220,12 @@
         return rest_client.ResponseBody(resp, body)
 
     def list_type_access(self, volume_type_id):
-        """Print access information about the given volume type."""
+        """Print access information about the given volume type.
+
+        Available params: see http://developer.openstack.org/
+                              api-ref-blockstorage-v2.html#
+                              listVolumeTypeAccessExt
+        """
         url = 'types/%s/os-volume-type-access' % (volume_type_id)
         resp, body = self.get(url)
         body = json.loads(body)
diff --git a/tempest/services/volume/base/base_snapshots_client.py b/tempest/services/volume/base/base_snapshots_client.py
old mode 100644
new mode 100755
index 6d3f03b..7a8e12b
--- a/tempest/services/volume/base/base_snapshots_client.py
+++ b/tempest/services/volume/base/base_snapshots_client.py
@@ -23,7 +23,11 @@
     create_resp = 200
 
     def list_snapshots(self, detail=False, **params):
-        """List all the snapshot."""
+        """List all the snapshot.
+
+        Available params: see http://developer.openstack.org/
+                              api-ref-blockstorage-v2.html#listSnapshots
+        """
         url = 'snapshots'
         if detail:
             url += '/detail'
@@ -36,7 +40,11 @@
         return rest_client.ResponseBody(resp, body)
 
     def show_snapshot(self, snapshot_id):
-        """Returns the details of a single snapshot."""
+        """Returns the details of a single snapshot.
+
+        Available params: see http://developer.openstack.org/
+                              api-ref-blockstorage-v2.html#showSnapshot
+        """
         url = "snapshots/%s" % str(snapshot_id)
         resp, body = self.get(url)
         body = json.loads(body)
@@ -68,7 +76,11 @@
         return rest_client.ResponseBody(resp, body)
 
     def delete_snapshot(self, snapshot_id):
-        """Delete Snapshot."""
+        """Delete Snapshot.
+
+        Available params: see http://developer.openstack.org/
+                              api-ref-blockstorage-v2.html#deleteSnapshot
+        """
         resp, body = self.delete("snapshots/%s" % str(snapshot_id))
         self.expected_success(202, resp.status)
         return rest_client.ResponseBody(resp, body)
@@ -115,7 +127,12 @@
         return rest_client.ResponseBody(resp, body)
 
     def show_snapshot_metadata(self, snapshot_id):
-        """Get metadata of the snapshot."""
+        """Get metadata of the snapshot.
+
+        Available params: see http://developer.openstack.org/
+                              api-ref-blockstorage-v2.html#
+                              showSnapshotMetadata
+        """
         url = "snapshots/%s/metadata" % str(snapshot_id)
         resp, body = self.get(url)
         body = json.loads(body)
@@ -126,7 +143,8 @@
         """Update metadata for the snapshot.
 
         Available params: see http://developer.openstack.org/
-                              api-ref-blockstorage-v2.html#updateSnapshotMetadata
+                              api-ref-blockstorage-v2.html#
+                              updateSnapshotMetadata
         """
         put_body = json.dumps(kwargs)
         url = "snapshots/%s/metadata" % str(snapshot_id)