Merge "Correct wrong message in configuration doc"
diff --git a/doc/source/configuration.rst b/doc/source/configuration.rst
index f351574..7f1e292 100644
--- a/doc/source/configuration.rst
+++ b/doc/source/configuration.rst
@@ -109,6 +109,9 @@
  #. Provide tempest with the location of your accounts.yaml file with the
     test_accounts_file option in the auth section
 
+    *NOTE: Be sure to use a full path for the file otherwise Tempest will
+    likely not find it.*
+
  #. Set use_dynamic_credentials = False in the auth group
 
 It is worth pointing out that each set of credentials in the accounts.yaml
diff --git a/tempest/api/compute/admin/test_security_groups.py b/tempest/api/compute/admin/test_security_groups.py
index e31129b..1494745 100644
--- a/tempest/api/compute/admin/test_security_groups.py
+++ b/tempest/api/compute/admin/test_security_groups.py
@@ -13,8 +13,6 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-import testtools
-
 from tempest.api.compute import base
 from tempest.common.utils import data_utils
 from tempest import config
@@ -38,9 +36,6 @@
             self.client.delete_security_group(securitygroup_id)
 
     @test.idempotent_id('49667619-5af9-4c63-ab5d-2cfdd1c8f7f1')
-    @testtools.skipIf(CONF.service_available.neutron,
-                      "Skipped because neutron does not support all_tenants "
-                      "search filter.")
     @test.services('network')
     def test_list_security_groups_list_all_tenants_filter(self):
         # Admin can list security groups of all tenants
diff --git a/tempest/api/network/admin/test_agent_management.py b/tempest/api/network/admin/test_agent_management.py
index 64802aa..61f8e15 100644
--- a/tempest/api/network/admin/test_agent_management.py
+++ b/tempest/api/network/admin/test_agent_management.py
@@ -29,13 +29,13 @@
     @classmethod
     def resource_setup(cls):
         super(AgentManagementTestJSON, cls).resource_setup()
-        body = cls.admin_client.list_agents()
+        body = cls.admin_agents_client.list_agents()
         agents = body['agents']
         cls.agent = agents[0]
 
     @test.idempotent_id('9c80f04d-11f3-44a4-8738-ed2f879b0ff4')
     def test_list_agent(self):
-        body = self.admin_client.list_agents()
+        body = self.admin_agents_client.list_agents()
         agents = body['agents']
         # Hearthbeats must be excluded from comparison
         self.agent.pop('heartbeat_timestamp', None)
@@ -47,12 +47,12 @@
 
     @test.idempotent_id('e335be47-b9a1-46fd-be30-0874c0b751e6')
     def test_list_agents_non_admin(self):
-        body = self.client.list_agents()
+        body = self.agents_client.list_agents()
         self.assertEqual(len(body["agents"]), 0)
 
     @test.idempotent_id('869bc8e8-0fda-4a30-9b71-f8a7cf58ca9f')
     def test_show_agent(self):
-        body = self.admin_client.show_agent(self.agent['id'])
+        body = self.admin_agents_client.show_agent(self.agent['id'])
         agent = body['agent']
         self.assertEqual(agent['id'], self.agent['id'])
 
@@ -62,8 +62,8 @@
         # Try to update the 'admin_state_up' to the original
         # one to avoid the negative effect.
         agent_status = {'admin_state_up': origin_status}
-        body = self.admin_client.update_agent(agent_id=self.agent['id'],
-                                              agent=agent_status)
+        body = self.admin_agents_client.update_agent(agent_id=self.agent['id'],
+                                                     agent=agent_status)
         updated_status = body['agent']['admin_state_up']
         self.assertEqual(origin_status, updated_status)
 
@@ -72,8 +72,8 @@
         self.useFixture(fixtures.LockFixture('agent_description'))
         description = 'description for update agent.'
         agent_description = {'description': description}
-        body = self.admin_client.update_agent(agent_id=self.agent['id'],
-                                              agent=agent_description)
+        body = self.admin_agents_client.update_agent(agent_id=self.agent['id'],
+                                                     agent=agent_description)
         self.addCleanup(self._restore_agent)
         updated_description = body['agent']['description']
         self.assertEqual(updated_description, description)
@@ -83,5 +83,5 @@
 
         description = self.agent['description'] or ''
         origin_agent = {'description': description}
-        self.admin_client.update_agent(agent_id=self.agent['id'],
-                                       agent=origin_agent)
+        self.admin_agents_client.update_agent(agent_id=self.agent['id'],
+                                              agent=origin_agent)
diff --git a/tempest/api/network/admin/test_dhcp_agent_scheduler.py b/tempest/api/network/admin/test_dhcp_agent_scheduler.py
index f186b36..5ff465b 100644
--- a/tempest/api/network/admin/test_dhcp_agent_scheduler.py
+++ b/tempest/api/network/admin/test_dhcp_agent_scheduler.py
@@ -51,7 +51,7 @@
 
     def _check_network_in_dhcp_agent(self, network_id, agent):
         network_ids = []
-        body = self.admin_client.list_networks_hosted_by_one_dhcp_agent(
+        body = self.admin_agents_client.list_networks_hosted_by_one_dhcp_agent(
             agent['id'])
         networks = body['networks']
         for network in networks:
@@ -65,7 +65,7 @@
         self.ports.remove(self.port)
         agent = dict()
         agent['agent_type'] = None
-        body = self.admin_client.list_agents()
+        body = self.admin_agents_client.list_agents()
         agents = body['agents']
         for a in agents:
             if a['agent_type'] == 'DHCP agent':
@@ -84,14 +84,14 @@
             self._remove_network_from_dhcp_agent(network_id, agent)
 
     def _remove_network_from_dhcp_agent(self, network_id, agent):
-        self.admin_client.remove_network_from_dhcp_agent(
+        self.admin_agents_client.remove_network_from_dhcp_agent(
             agent_id=agent['id'],
             network_id=network_id)
         self.assertFalse(self._check_network_in_dhcp_agent(
             network_id, agent))
 
     def _add_dhcp_agent_to_network(self, network_id, agent):
-        self.admin_client.add_dhcp_agent_to_network(agent['id'],
-                                                    network_id=network_id)
+        self.admin_agents_client.add_dhcp_agent_to_network(
+            agent['id'], network_id=network_id)
         self.assertTrue(self._check_network_in_dhcp_agent(
             network_id, agent))
diff --git a/tempest/api/network/admin/test_l3_agent_scheduler.py b/tempest/api/network/admin/test_l3_agent_scheduler.py
index 36747a3..2e8fd50 100644
--- a/tempest/api/network/admin/test_l3_agent_scheduler.py
+++ b/tempest/api/network/admin/test_l3_agent_scheduler.py
@@ -51,7 +51,7 @@
     @classmethod
     def resource_setup(cls):
         super(L3AgentSchedulerTestJSON, cls).resource_setup()
-        body = cls.admin_client.list_agents()
+        body = cls.admin_agents_client.list_agents()
         agents = body['agents']
         for agent in agents:
             # TODO(armax): falling back on default _agent_mode can be
@@ -90,12 +90,12 @@
 
     @test.idempotent_id('b7ce6e89-e837-4ded-9b78-9ed3c9c6a45a')
     def test_list_routers_on_l3_agent(self):
-        self.admin_client.list_routers_on_l3_agent(self.agent['id'])
+        self.admin_agents_client.list_routers_on_l3_agent(self.agent['id'])
 
     @test.idempotent_id('9464e5e7-8625-49c3-8fd1-89c52be59d66')
     def test_add_list_remove_router_on_l3_agent(self):
         l3_agent_ids = list()
-        self.admin_client.add_router_to_l3_agent(
+        self.admin_agents_client.add_router_to_l3_agent(
             self.agent['id'],
             router_id=self.router['id'])
         body = (
@@ -105,7 +105,7 @@
             self.assertIn('agent_type', agent)
             self.assertEqual('L3 agent', agent['agent_type'])
         self.assertIn(self.agent['id'], l3_agent_ids)
-        body = self.admin_client.remove_router_from_l3_agent(
+        body = self.admin_agents_client.remove_router_from_l3_agent(
             self.agent['id'],
             self.router['id'])
         # NOTE(afazekas): The deletion not asserted, because neutron
diff --git a/tempest/api/network/base.py b/tempest/api/network/base.py
index e155bd0..2a1776a 100644
--- a/tempest/api/network/base.py
+++ b/tempest/api/network/base.py
@@ -71,7 +71,9 @@
     def setup_clients(cls):
         super(BaseNetworkTest, cls).setup_clients()
         cls.client = cls.os.network_client
+        cls.agents_client = cls.os.network_agents_client
         cls.networks_client = cls.os.networks_client
+        cls.subnetpools_client = cls.os.subnetpools_client
         cls.subnets_client = cls.os.subnets_client
         cls.ports_client = cls.os.ports_client
         cls.quotas_client = cls.os.network_quotas_client
@@ -273,6 +275,7 @@
     def setup_clients(cls):
         super(BaseAdminNetworkTest, cls).setup_clients()
         cls.admin_client = cls.os_adm.network_client
+        cls.admin_agents_client = cls.os_adm.network_agents_client
         cls.admin_networks_client = cls.os_adm.networks_client
         cls.admin_subnets_client = cls.os_adm.subnets_client
         cls.admin_ports_client = cls.os_adm.ports_client
diff --git a/tempest/api/network/test_subnetpools_extensions.py b/tempest/api/network/test_subnetpools_extensions.py
index 8a61ff8..29d1d89 100644
--- a/tempest/api/network/test_subnetpools_extensions.py
+++ b/tempest/api/network/test_subnetpools_extensions.py
@@ -50,27 +50,28 @@
         subnetpool_name = data_utils.rand_name('subnetpools')
         # create subnet pool
         prefix = CONF.network.default_network
-        body = self.client.create_subnetpools(name=subnetpool_name,
-                                              prefixes=prefix)
+        body = self.subnetpools_client.create_subnetpools(name=subnetpool_name,
+                                                          prefixes=prefix)
         subnetpool_id = body["subnetpool"]["id"]
         self.addCleanup(self._cleanup_subnetpools, subnetpool_id)
         self.assertEqual(subnetpool_name, body["subnetpool"]["name"])
         # get detail about subnet pool
-        body = self.client.show_subnetpools(subnetpool_id)
+        body = self.subnetpools_client.show_subnetpools(subnetpool_id)
         self.assertEqual(subnetpool_name, body["subnetpool"]["name"])
         # update the subnet pool
         subnetpool_name = data_utils.rand_name('subnetpools_update')
-        body = self.client.update_subnetpools(subnetpool_id,
-                                              name=subnetpool_name)
+        body = self.subnetpools_client.update_subnetpools(subnetpool_id,
+                                                          name=subnetpool_name)
         self.assertEqual(subnetpool_name, body["subnetpool"]["name"])
         # delete subnet pool
-        body = self.client.delete_subnetpools(subnetpool_id)
-        self.assertRaises(lib_exc.NotFound, self.client.show_subnetpools,
+        body = self.subnetpools_client.delete_subnetpools(subnetpool_id)
+        self.assertRaises(lib_exc.NotFound,
+                          self.subnetpools_client.show_subnetpools,
                           subnetpool_id)
 
     def _cleanup_subnetpools(self, subnetpool_id):
         # this is used to cleanup the resources
         try:
-            self.client.delete_subnetpools(subnetpool_id)
+            self.subnetpools_client.delete_subnetpools(subnetpool_id)
         except lib_exc.NotFound:
             pass
diff --git a/tempest/clients.py b/tempest/clients.py
index bbdab67..54218d6 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -109,6 +109,8 @@
 from tempest.services.image.v2.json.images_client import ImagesClientV2
 from tempest.services.messaging.json.messaging_client import \
     MessagingClient
+from tempest.services.network.json.agents_client import AgentsClient \
+    as NetworkAgentsClient
 from tempest.services.network.json.floating_ips_client import FloatingIPsClient
 from tempest.services.network.json.metering_label_rules_client import \
     MeteringLabelRulesClient
@@ -121,6 +123,7 @@
     as NetworkQuotasClient
 from tempest.services.network.json.security_groups_client import \
     SecurityGroupsClient
+from tempest.services.network.json.subnetpools_client import SubnetpoolsClient
 from tempest.services.network.json.subnets_client import SubnetsClient
 from tempest.services.object_storage.account_client import AccountClient
 from tempest.services.object_storage.container_client import ContainerClient
@@ -204,6 +207,14 @@
             CONF.identity.region,
             endpoint_type=CONF.baremetal.endpoint_type,
             **self.default_params_with_timeout_values)
+        self.network_agents_client = NetworkAgentsClient(
+            self.auth_provider,
+            CONF.network.catalog_type,
+            CONF.network.region or CONF.identity.region,
+            endpoint_type=CONF.network.endpoint_type,
+            build_interval=CONF.network.build_interval,
+            build_timeout=CONF.network.build_timeout,
+            **self.default_params)
         self.network_client = NetworkClient(
             self.auth_provider,
             CONF.network.catalog_type,
@@ -220,6 +231,14 @@
             build_interval=CONF.network.build_interval,
             build_timeout=CONF.network.build_timeout,
             **self.default_params)
+        self.subnetpools_client = SubnetpoolsClient(
+            self.auth_provider,
+            CONF.network.catalog_type,
+            CONF.network.region or CONF.identity.region,
+            endpoint_type=CONF.network.endpoint_type,
+            build_interval=CONF.network.build_interval,
+            build_timeout=CONF.network.build_timeout,
+            **self.default_params)
         self.subnets_client = SubnetsClient(
             self.auth_provider,
             CONF.network.catalog_type,
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 8a00c65..8b34ce9 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -729,7 +729,7 @@
 
     def _list_agents(self, *args, **kwargs):
         """List agents using admin creds """
-        agents_list = self.admin_manager.network_client.list_agents(
+        agents_list = self.admin_manager.network_agents_client.list_agents(
             *args, **kwargs)
         return agents_list['agents']
 
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index 44942b0..b8bec16 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -683,9 +683,9 @@
 
         list_hosts = (self.admin_manager.network_client.
                       list_l3_agents_hosting_router)
-        schedule_router = (self.admin_manager.network_client.
+        schedule_router = (self.admin_manager.network_agents_client.
                            add_router_to_l3_agent)
-        unschedule_router = (self.admin_manager.network_client.
+        unschedule_router = (self.admin_manager.network_agents_client.
                              remove_router_from_l3_agent)
 
         agent_list = set(a["id"] for a in
diff --git a/tempest/services/network/json/agents_client.py b/tempest/services/network/json/agents_client.py
new file mode 100644
index 0000000..07f93b2
--- /dev/null
+++ b/tempest/services/network/json/agents_client.py
@@ -0,0 +1,68 @@
+# Copyright 2015 NEC Corporation.  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.services.network.json import base
+
+
+class AgentsClient(base.BaseNetworkClient):
+
+    def update_agent(self, agent_id, **kwargs):
+        """Update agent."""
+        # TODO(piyush): 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.
+        # LP: https://bugs.launchpad.net/openstack-api-site/+bug/1526673
+        uri = '/agents/%s' % agent_id
+        return self.update_resource(uri, kwargs)
+
+    def show_agent(self, agent_id, **fields):
+        uri = '/agents/%s' % agent_id
+        return self.show_resource(uri, **fields)
+
+    def list_agents(self, **filters):
+        uri = '/agents'
+        return self.list_resources(uri, **filters)
+
+    def list_routers_on_l3_agent(self, agent_id):
+        uri = '/agents/%s/l3-routers' % agent_id
+        return self.list_resources(uri)
+
+    def add_router_to_l3_agent(self, agent_id, **kwargs):
+        # TODO(piyush): 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.
+        # LP: https://bugs.launchpad.net/openstack-api-site/+bug/1526670
+        uri = '/agents/%s/l3-routers' % agent_id
+        return self.create_resource(uri, kwargs)
+
+    def remove_router_from_l3_agent(self, agent_id, router_id):
+        uri = '/agents/%s/l3-routers/%s' % (agent_id, router_id)
+        return self.delete_resource(uri)
+
+    def list_networks_hosted_by_one_dhcp_agent(self, agent_id):
+        uri = '/agents/%s/dhcp-networks' % agent_id
+        return self.list_resources(uri)
+
+    def remove_network_from_dhcp_agent(self, agent_id, network_id):
+        uri = '/agents/%s/dhcp-networks/%s' % (agent_id,
+                                               network_id)
+        return self.delete_resource(uri)
+
+    def add_dhcp_agent_to_network(self, agent_id, **kwargs):
+        # TODO(piyush): 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.
+        # LP: https://bugs.launchpad.net/openstack-api-site/+bug/1526212
+        uri = '/agents/%s/dhcp-networks' % agent_id
+        return self.create_resource(uri, kwargs)
diff --git a/tempest/services/network/json/network_client.py b/tempest/services/network/json/network_client.py
index 24a95e0..e8e21d2 100644
--- a/tempest/services/network/json/network_client.py
+++ b/tempest/services/network/json/network_client.py
@@ -229,60 +229,14 @@
         uri = '/ports?device_id=%s' % uuid
         return self.list_resources(uri)
 
-    def update_agent(self, agent_id, **kwargs):
-        """Update agent
-
-        :param agent_info: Agent update information.
-        E.g {"admin_state_up": True}
-        """
-        # TODO(piyush): 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.
-        # LP: https://bugs.launchpad.net/openstack-api-site/+bug/1526673
-        uri = '/agents/%s' % agent_id
-        return self.update_resource(uri, kwargs)
-
-    def show_agent(self, agent_id, **fields):
-        uri = '/agents/%s' % agent_id
-        return self.show_resource(uri, **fields)
-
-    def list_agents(self, **filters):
-        uri = '/agents'
-        return self.list_resources(uri, **filters)
-
-    def list_routers_on_l3_agent(self, agent_id):
-        uri = '/agents/%s/l3-routers' % agent_id
-        return self.list_resources(uri)
-
     def list_l3_agents_hosting_router(self, router_id):
         uri = '/routers/%s/l3-agents' % router_id
         return self.list_resources(uri)
 
-    def add_router_to_l3_agent(self, agent_id, **kwargs):
-        # TODO(piyush): 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.
-        # LP: https://bugs.launchpad.net/openstack-api-site/+bug/1526670
-        uri = '/agents/%s/l3-routers' % agent_id
-        return self.create_resource(uri, kwargs)
-
-    def remove_router_from_l3_agent(self, agent_id, router_id):
-        uri = '/agents/%s/l3-routers/%s' % (agent_id, router_id)
-        return self.delete_resource(uri)
-
     def list_dhcp_agent_hosting_network(self, network_id):
         uri = '/networks/%s/dhcp-agents' % network_id
         return self.list_resources(uri)
 
-    def list_networks_hosted_by_one_dhcp_agent(self, agent_id):
-        uri = '/agents/%s/dhcp-networks' % agent_id
-        return self.list_resources(uri)
-
-    def remove_network_from_dhcp_agent(self, agent_id, network_id):
-        uri = '/agents/%s/dhcp-networks/%s' % (agent_id,
-                                               network_id)
-        return self.delete_resource(uri)
-
     def update_extra_routes(self, router_id, **kwargs):
         """Update Extra routes.
 
@@ -301,33 +255,3 @@
             }
         }
         return self.update_resource(uri, put_body)
-
-    def add_dhcp_agent_to_network(self, agent_id, **kwargs):
-        # TODO(piyush): 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.
-        # LP: https://bugs.launchpad.net/openstack-api-site/+bug/1526212
-        uri = '/agents/%s/dhcp-networks' % agent_id
-        return self.create_resource(uri, kwargs)
-
-    def list_subnetpools(self, **filters):
-        uri = '/subnetpools'
-        return self.list_resources(uri, **filters)
-
-    def create_subnetpools(self, **kwargs):
-        uri = '/subnetpools'
-        post_data = {'subnetpool': kwargs}
-        return self.create_resource(uri, post_data)
-
-    def show_subnetpools(self, subnetpool_id, **fields):
-        uri = '/subnetpools/%s' % subnetpool_id
-        return self.show_resource(uri, **fields)
-
-    def update_subnetpools(self, subnetpool_id, **kwargs):
-        uri = '/subnetpools/%s' % subnetpool_id
-        post_data = {'subnetpool': kwargs}
-        return self.update_resource(uri, post_data)
-
-    def delete_subnetpools(self, subnetpool_id):
-        uri = '/subnetpools/%s' % subnetpool_id
-        return self.delete_resource(uri)
diff --git a/tempest/services/network/json/subnetpools_client.py b/tempest/services/network/json/subnetpools_client.py
new file mode 100644
index 0000000..b5aec47
--- /dev/null
+++ b/tempest/services/network/json/subnetpools_client.py
@@ -0,0 +1,40 @@
+# Copyright 2015 NEC Corporation.  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.services.network.json import base
+
+
+class SubnetpoolsClient(base.BaseNetworkClient):
+
+    def list_subnetpools(self, **filters):
+        uri = '/subnetpools'
+        return self.list_resources(uri, **filters)
+
+    def create_subnetpools(self, **kwargs):
+        uri = '/subnetpools'
+        post_data = {'subnetpool': kwargs}
+        return self.create_resource(uri, post_data)
+
+    def show_subnetpools(self, subnetpool_id, **fields):
+        uri = '/subnetpools/%s' % subnetpool_id
+        return self.show_resource(uri, **fields)
+
+    def update_subnetpools(self, subnetpool_id, **kwargs):
+        uri = '/subnetpools/%s' % subnetpool_id
+        post_data = {'subnetpool': kwargs}
+        return self.update_resource(uri, post_data)
+
+    def delete_subnetpools(self, subnetpool_id):
+        uri = '/subnetpools/%s' % subnetpool_id
+        return self.delete_resource(uri)