Merge "Add set microversion in base compute service client"
diff --git a/doc/source/configuration.rst b/doc/source/configuration.rst
index a16f3b7..7f1e292 100644
--- a/doc/source/configuration.rst
+++ b/doc/source/configuration.rst
@@ -14,11 +14,11 @@
Tempest currently has 2 different ways in configuration to provide credentials
to use when running tempest. One is a traditional set of configuration options
-in the tempest.conf file. These options are in the identity section and let you
-specify a regular user, a global admin user, and an alternate user set of
-credentials. (which consist of a username, password, and project/tenant name)
-These options should be clearly labelled in the sample config file in the
-identity section.
+in the tempest.conf file. These options are in the auth and identity sections
+and let you specify a global admin user, a regular user and an alternate user
+set of credentials. (which consist of a username, password, and project/tenant
+name) These options should be clearly labelled in the sample config file in the
+auth and identity sections.
The other method to provide credentials is using the accounts.yaml file. This
file is used to specify an arbitrary number of users available to run tests
@@ -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
@@ -126,21 +129,21 @@
non-tenant isolated case was converted to internally work similarly to the
accounts.yaml file. This mechanism was then called the legacy test accounts
provider. To use the legacy test accounts provider you can specify the sets of
-credentials in the configuration file like detailed above with following 9
+credentials in the configuration file like detailed above with following 6
options in the identity section:
#. username
#. password
#. tenant_name
- #. admin_username
- #. admin_password
- #. admin_tenant_name
#. alt_username
#. alt_password
#. alt_tenant_name
And in the auth section:
-
+
+ #. admin_username
+ #. admin_password
+ #. admin_tenant_name
#. use_dynamic_credentials = False
#. comment out 'test_accounts_file' or keep it as empty
diff --git a/tempest/api/compute/admin/test_agents.py b/tempest/api/compute/admin/test_agents.py
index d2b3a81..9f7bbae 100644
--- a/tempest/api/compute/admin/test_agents.py
+++ b/tempest/api/compute/admin/test_agents.py
@@ -53,7 +53,7 @@
if rand_key in kwargs:
# NOTE: The rand_name is for avoiding agent conflicts.
# If you try to create an agent with the same hypervisor,
- # os and architecture as an exising agent, Nova will return
+ # os and architecture as an existing agent, Nova will return
# an HTTPConflict or HTTPServerError.
kwargs[rand_key] = data_utils.rand_name(kwargs[rand_key])
return kwargs
diff --git a/tempest/api/compute/admin/test_aggregates.py b/tempest/api/compute/admin/test_aggregates.py
index ddd9aa0..1d83fec 100644
--- a/tempest/api/compute/admin/test_aggregates.py
+++ b/tempest/api/compute/admin/test_aggregates.py
@@ -145,7 +145,7 @@
@test.idempotent_id('c8e85064-e79b-4906-9931-c11c24294d02')
def test_aggregate_add_remove_host(self):
- # Add an host to the given aggregate and remove.
+ # Add a host to the given aggregate and remove.
self.useFixture(fixtures.LockFixture('availability_zone'))
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
aggregate = (self.client.create_aggregate(name=aggregate_name)
@@ -168,7 +168,7 @@
@test.idempotent_id('7f6a1cc5-2446-4cdb-9baa-b6ae0a919b72')
def test_aggregate_add_host_list(self):
- # Add an host to the given aggregate and list.
+ # Add a host to the given aggregate and list.
self.useFixture(fixtures.LockFixture('availability_zone'))
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
aggregate = (self.client.create_aggregate(name=aggregate_name)
@@ -188,7 +188,7 @@
@test.idempotent_id('eeef473c-7c52-494d-9f09-2ed7fc8fc036')
def test_aggregate_add_host_get_details(self):
- # Add an host to the given aggregate and get details.
+ # Add a host to the given aggregate and get details.
self.useFixture(fixtures.LockFixture('availability_zone'))
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
aggregate = (self.client.create_aggregate(name=aggregate_name)
@@ -205,7 +205,7 @@
@test.idempotent_id('96be03c7-570d-409c-90f8-e4db3c646996')
def test_aggregate_add_host_create_server_with_az(self):
- # Add an host to the given aggregate and create a server.
+ # Add a host to the given aggregate and create a server.
self.useFixture(fixtures.LockFixture('availability_zone'))
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
az_name = data_utils.rand_name(self.az_name_prefix)
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/compute/base.py b/tempest/api/compute/base.py
index 165f565..f7b3655 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -285,8 +285,8 @@
# into the delete_volume method as a convenience to the caller.
volumes_client.wait_for_resource_deletion(volume_id)
except lib_exc.NotFound:
- LOG.warn("Unable to delete volume '%s' since it was not found. "
- "Maybe it was already deleted?" % volume_id)
+ LOG.warning("Unable to delete volume '%s' since it was not found. "
+ "Maybe it was already deleted?" % volume_id)
@classmethod
def prepare_instance_network(cls):
diff --git a/tempest/api/identity/admin/v3/test_groups.py b/tempest/api/identity/admin/v3/test_groups.py
index e022023..21fc62a 100644
--- a/tempest/api/identity/admin/v3/test_groups.py
+++ b/tempest/api/identity/admin/v3/test_groups.py
@@ -86,8 +86,7 @@
def test_list_user_groups(self):
# create a user
user = self.client.create_user(
- data_utils.rand_name('User'),
- password=data_utils.rand_name('Pass'))['user']
+ data_utils.rand_name('User'), data_utils.rand_password())['user']
self.addCleanup(self.client.delete_user, user['id'])
# create two groups, and add user into them
groups = []
diff --git a/tempest/api/identity/admin/v3/test_roles.py b/tempest/api/identity/admin/v3/test_roles.py
index 8f48704..ae714aa 100644
--- a/tempest/api/identity/admin/v3/test_roles.py
+++ b/tempest/api/identity/admin/v3/test_roles.py
@@ -75,7 +75,8 @@
self.assertEqual(role['name'], r_name)
new_name = data_utils.rand_name('NewRole')
- updated_role = self.client.update_role(new_name, role['id'])['role']
+ updated_role = self.client.update_role(role['id'],
+ name=new_name)['role']
self.assertIn('name', updated_role)
self.assertIn('id', updated_role)
self.assertIn('links', updated_role)
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 11e1846..772ddfc 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
@@ -225,6 +228,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,
@@ -241,6 +252,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/cmd/account_generator.py b/tempest/cmd/account_generator.py
index b90ee04..5a2713b 100755
--- a/tempest/cmd/account_generator.py
+++ b/tempest/cmd/account_generator.py
@@ -201,7 +201,8 @@
if tenant not in existing:
tenants_admin.create_tenant(tenant)
else:
- LOG.warn("Tenant '%s' already exists in this environment" % tenant)
+ LOG.warning("Tenant '%s' already exists in this environment"
+ % tenant)
LOG.info('Tenants created')
for u in resources['users']:
try:
@@ -220,8 +221,8 @@
enabled=True)
break
else:
- LOG.warn("User '%s' already exists in this environment. "
- "New name generated" % u['name'])
+ LOG.warning("User '%s' already exists in this environment. "
+ "New name generated" % u['name'])
u['name'] = random_user_name(opts.tag, u['prefix'])
LOG.info('Users created')
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index fd35eab..6dfa0a7 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -311,7 +311,8 @@
if tenant not in existing:
admin.tenants.create_tenant(tenant)['tenant']
else:
- LOG.warn("Tenant '%s' already exists in this environment" % tenant)
+ LOG.warning("Tenant '%s' already exists in this environment"
+ % tenant)
def destroy_tenants(tenants):
@@ -376,8 +377,8 @@
try:
identity.get_user_by_username(admin.identity,
tenant['id'], u['name'])
- LOG.warn("User '%s' already exists in this environment"
- % u['name'])
+ LOG.warning("User '%s' already exists in this environment"
+ % u['name'])
except lib_exc.NotFound:
admin.identity.create_user(
u['name'], u['pass'], tenant['id'],
@@ -1074,7 +1075,7 @@
destroy_secgroups(RES['secgroups'])
destroy_users(RES['users'])
destroy_tenants(RES['tenants'])
- LOG.warn("Destroy mode incomplete")
+ LOG.warning("Destroy mode incomplete")
def get_options():
diff --git a/tempest/common/dynamic_creds.py b/tempest/common/dynamic_creds.py
index 5bbc93c..0af07f0 100644
--- a/tempest/common/dynamic_creds.py
+++ b/tempest/common/dynamic_creds.py
@@ -285,24 +285,24 @@
try:
net_client.delete_router(router_id)
except lib_exc.NotFound:
- LOG.warn('router with name: %s not found for delete' %
- router_name)
+ LOG.warning('router with name: %s not found for delete' %
+ router_name)
def _clear_isolated_subnet(self, subnet_id, subnet_name):
client = self.subnets_admin_client
try:
client.delete_subnet(subnet_id)
except lib_exc.NotFound:
- LOG.warn('subnet with name: %s not found for delete' %
- subnet_name)
+ LOG.warning('subnet with name: %s not found for delete' %
+ subnet_name)
def _clear_isolated_network(self, network_id, network_name):
net_client = self.networks_admin_client
try:
net_client.delete_network(network_id)
except lib_exc.NotFound:
- LOG.warn('network with name: %s not found for delete' %
- network_name)
+ LOG.warning('network with name: %s not found for delete' %
+ network_name)
def _cleanup_default_secgroup(self, tenant):
nsg_client = self.security_groups_admin_client
@@ -313,8 +313,8 @@
try:
nsg_client.delete_security_group(secgroup['id'])
except lib_exc.NotFound:
- LOG.warn('Security group %s, id %s not found for clean-up' %
- (secgroup['name'], secgroup['id']))
+ LOG.warning('Security group %s, id %s not found for clean-up' %
+ (secgroup['name'], secgroup['id']))
def _clear_isolated_net_resources(self):
net_client = self.network_admin_client
@@ -333,8 +333,8 @@
net_client.remove_router_interface_with_subnet_id(
creds.router['id'], creds.subnet['id'])
except lib_exc.NotFound:
- LOG.warn('router with name: %s not found for delete' %
- creds.router['name'])
+ LOG.warning('router with name: %s not found for delete' %
+ creds.router['name'])
self._clear_isolated_router(creds.router['id'],
creds.router['name'])
if (not self.network_resources or
@@ -354,15 +354,15 @@
try:
self.creds_client.delete_user(creds.user_id)
except lib_exc.NotFound:
- LOG.warn("user with name: %s not found for delete" %
- creds.username)
+ LOG.warning("user with name: %s not found for delete" %
+ creds.username)
try:
if CONF.service_available.neutron:
self._cleanup_default_secgroup(creds.tenant_id)
self.creds_client.delete_project(creds.tenant_id)
except lib_exc.NotFound:
- LOG.warn("tenant with name: %s not found for delete" %
- creds.tenant_name)
+ LOG.warning("tenant with name: %s not found for delete" %
+ creds.tenant_name)
self._creds = {}
def is_multi_user(self):
diff --git a/tempest/common/fixed_network.py b/tempest/common/fixed_network.py
index 56cd331..3fc1365 100644
--- a/tempest/common/fixed_network.py
+++ b/tempest/common/fixed_network.py
@@ -49,13 +49,13 @@
name, networks))
if caller:
msg = '(%s) %s' % (caller, msg)
- LOG.warn(msg)
+ LOG.warning(msg)
raise exceptions.InvalidTestResource(type='network', name=name)
else:
msg = "Network with name: %s not found" % name
if caller:
msg = '(%s) %s' % (caller, msg)
- LOG.warn(msg)
+ LOG.warning(msg)
raise exceptions.InvalidTestResource(type='network', name=name)
# To be consistent between neutron and nova network always use name even
# if label is used in the api response. If neither is present than then
@@ -65,7 +65,7 @@
msg = "Network found from list doesn't contain a valid name or label"
if caller:
msg = '(%s) %s' % (caller, msg)
- LOG.warn(msg)
+ LOG.warning(msg)
raise exceptions.InvalidTestResource(type='network', name=name)
network['name'] = name
return network
@@ -122,6 +122,6 @@
if 'id' in network.keys():
params.update({"networks": [{'uuid': network['id']}]})
else:
- LOG.warn('The provided network dict: %s was invalid and did not '
- ' contain an id' % network)
+ LOG.warning('The provided network dict: %s was invalid and did '
+ 'not contain an id' % network)
return params
diff --git a/tempest/common/validation_resources.py b/tempest/common/validation_resources.py
index f526299..bb71a51 100644
--- a/tempest/common/validation_resources.py
+++ b/tempest/common/validation_resources.py
@@ -73,8 +73,8 @@
try:
keypair_client.delete_keypair(keypair_name)
except lib_exc.NotFound:
- LOG.warn("Keypair %s is not found when attempting to delete"
- % keypair_name)
+ LOG.warning("Keypair %s is not found when attempting to delete"
+ % keypair_name)
except Exception as exc:
LOG.exception('Exception raised while deleting key %s'
% keypair_name)
@@ -87,8 +87,8 @@
security_group_client.delete_security_group(sec_id)
security_group_client.wait_for_resource_deletion(sec_id)
except lib_exc.NotFound:
- LOG.warn("Security group %s is not found when attempting to "
- " delete" % sec_id)
+ LOG.warning("Security group %s is not found when attempting "
+ "to delete" % sec_id)
except lib_exc.Conflict as exc:
LOG.exception('Conflict while deleting security '
'group %s VM might not be deleted ' % sec_id)
@@ -105,8 +105,8 @@
try:
floating_client.delete_floating_ip(fip_id)
except lib_exc.NotFound:
- LOG.warn('Floating ip %s not found while attempting to delete'
- % fip_id)
+ LOG.warning('Floating ip %s not found while attempting to '
+ 'delete' % fip_id)
except Exception as exc:
LOG.exception('Exception raised while deleting ip %s '
% fip_id)
diff --git a/tempest/config.py b/tempest/config.py
index 8f2ca4b..1fc55d9 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -737,7 +737,7 @@
deprecated_for_removal=True),
cfg.ListOpt('backend_names',
default=['BACKEND_1', 'BACKEND_2'],
- help='A list of backend names seperated by comma .'
+ help='A list of backend names separated by comma. '
'The backend name must be declared in cinder.conf',
deprecated_opts=[cfg.DeprecatedOpt('BACKEND_1',
group='volume'),
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 8a00c65..e5e0d16 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']
@@ -932,8 +932,8 @@
try:
source.ping_host(dest, nic=nic)
except lib_exc.SSHExecCommandFailed:
- LOG.warn('Failed to ping IP: %s via a ssh connection from: %s.'
- % (dest, source.ssh_client.host))
+ LOG.warning('Failed to ping IP: %s via a ssh connection '
+ 'from: %s.' % (dest, source.ssh_client.host))
return not should_succeed
return should_succeed
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/identity/v3/json/identity_client.py b/tempest/services/identity/v3/json/identity_client.py
index 8f2cdf2..ab8ba2a 100644
--- a/tempest/services/identity/v3/json/identity_client.py
+++ b/tempest/services/identity/v3/json/identity_client.py
@@ -206,12 +206,13 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def update_role(self, name, role_id):
- """Create a Role."""
- post_body = {
- 'name': name
- }
- post_body = json.dumps({'role': post_body})
+ def update_role(self, role_id, **kwargs):
+ """Update a Role.
+
+ Available params: see http://developer.openstack.org/
+ api-ref-identity-v3.html#updateRole
+ """
+ post_body = json.dumps({'role': kwargs})
resp, body = self.patch('roles/%s' % str(role_id), post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
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)
diff --git a/tempest/stress/driver.py b/tempest/stress/driver.py
index 4dcaab7..a3e1ea3 100644
--- a/tempest/stress/driver.py
+++ b/tempest/stress/driver.py
@@ -106,7 +106,7 @@
if process['process'].is_alive():
try:
pid = process['process'].pid
- LOG.warn("Process %d hangs. Send SIGKILL." % pid)
+ LOG.warning("Process %d hangs. Send SIGKILL." % pid)
os.kill(pid, signal.SIGKILL)
except Exception:
pass
diff --git a/tempest/test.py b/tempest/test.py
index 339c1a0..aed438c 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -376,8 +376,8 @@
cls.validation_resources = vresources.create_validation_resources(
cls.os, cls.validation_resources)
else:
- LOG.warn("Client manager not found, validation resources not"
- " created")
+ LOG.warning("Client manager not found, validation resources not"
+ " created")
@classmethod
def resource_cleanup(cls):
@@ -392,8 +392,8 @@
cls.validation_resources)
cls.validation_resources = {}
else:
- LOG.warn("Client manager not found, validation resources not"
- " deleted")
+ LOG.warning("Client manager not found, validation resources "
+ "not deleted")
def setUp(self):
super(BaseTestCase, self).setUp()