Merge "Remove Nova v3 API config"
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index f0805c0..78215db 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -248,7 +248,9 @@
# Time in seconds between build status checks. (integer value)
#build_interval = 1
-# Timeout in seconds to wait for an instance to build. (integer value)
+# Timeout in seconds to wait for an instance to build. Other services
+# that do not define build_timeout will inherit this value, for
+# example the image service. (integer value)
#build_timeout = 300
# Catalog type of the Compute service. (string value)
@@ -736,7 +738,7 @@
# Catalog type of the Neutron service. (string value)
#catalog_type = network
-# List of dns servers whichs hould be used for subnet creation (list
+# List of dns servers which should be used for subnet creation (list
# value)
#dns_servers = 8.8.8.8,8.8.4.4
diff --git a/tempest/api/compute/servers/test_create_server.py b/tempest/api/compute/servers/test_create_server.py
index b561b4e..1c4dc59 100644
--- a/tempest/api/compute/servers/test_create_server.py
+++ b/tempest/api/compute/servers/test_create_server.py
@@ -130,23 +130,23 @@
# Verify that the networks order given at the server creation is
# preserved within the server.
name_net1 = data_utils.rand_name(self.__class__.__name__)
- _, net1 = self.network_client.create_network(name=name_net1)
+ net1 = self.network_client.create_network(name=name_net1)
self.addCleanup(self.network_client.delete_network,
net1['network']['id'])
name_net2 = data_utils.rand_name(self.__class__.__name__)
- _, net2 = self.network_client.create_network(name=name_net2)
+ net2 = self.network_client.create_network(name=name_net2)
self.addCleanup(self.network_client.delete_network,
net2['network']['id'])
- _, subnet1 = self.network_client.create_subnet(
+ subnet1 = self.network_client.create_subnet(
network_id=net1['network']['id'],
cidr='19.80.0.0/24',
ip_version=4)
self.addCleanup(self.network_client.delete_subnet,
subnet1['subnet']['id'])
- _, subnet2 = self.network_client.create_subnet(
+ subnet2 = self.network_client.create_subnet(
network_id=net2['network']['id'],
cidr='19.86.0.0/24',
ip_version=4)
diff --git a/tempest/api/compute/servers/test_server_personality.py b/tempest/api/compute/servers/test_server_personality.py
index de5b6c1..c6d48bc 100644
--- a/tempest/api/compute/servers/test_server_personality.py
+++ b/tempest/api/compute/servers/test_server_personality.py
@@ -36,6 +36,8 @@
personality = []
max_file_limit = \
self.user_client.get_specific_absolute_limit("maxPersonality")
+ if max_file_limit == -1:
+ raise self.skipException("No limit for personality files")
for i in range(0, int(max_file_limit) + 1):
path = 'etc/test' + str(i) + '.txt'
personality.append({'path': path,
@@ -52,6 +54,8 @@
file_contents = 'This is a test file.'
max_file_limit = \
self.user_client.get_specific_absolute_limit("maxPersonality")
+ if max_file_limit == -1:
+ raise self.skipException("No limit for personality files")
person = []
for i in range(0, int(max_file_limit)):
path = 'etc/test' + str(i) + '.txt'
diff --git a/tempest/api/network/admin/test_agent_management.py b/tempest/api/network/admin/test_agent_management.py
index 53b9ddd..e7fd016 100644
--- a/tempest/api/network/admin/test_agent_management.py
+++ b/tempest/api/network/admin/test_agent_management.py
@@ -26,13 +26,13 @@
if not test.is_extension_enabled('agent', 'network'):
msg = "agent extension not enabled."
raise cls.skipException(msg)
- resp, body = cls.admin_client.list_agents()
+ body = cls.admin_client.list_agents()
agents = body['agents']
cls.agent = agents[0]
@test.attr(type='smoke')
def test_list_agent(self):
- _, body = self.admin_client.list_agents()
+ body = self.admin_client.list_agents()
agents = body['agents']
# Hearthbeats must be excluded from comparison
self.agent.pop('heartbeat_timestamp', None)
@@ -44,12 +44,12 @@
@test.attr(type=['smoke'])
def test_list_agents_non_admin(self):
- _, body = self.client.list_agents()
+ body = self.client.list_agents()
self.assertEqual(len(body["agents"]), 0)
@test.attr(type='smoke')
def test_show_agent(self):
- _, body = self.admin_client.show_agent(self.agent['id'])
+ body = self.admin_client.show_agent(self.agent['id'])
agent = body['agent']
self.assertEqual(agent['id'], self.agent['id'])
@@ -59,8 +59,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_info=agent_status)
+ body = self.admin_client.update_agent(agent_id=self.agent['id'],
+ agent_info=agent_status)
updated_status = body['agent']['admin_state_up']
self.assertEqual(origin_status, updated_status)
@@ -69,8 +69,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_info=agent_description)
+ body = self.admin_client.update_agent(agent_id=self.agent['id'],
+ agent_info=agent_description)
self.addCleanup(self._restore_agent)
updated_description = body['agent']['description']
self.assertEqual(updated_description, description)
diff --git a/tempest/api/network/admin/test_dhcp_agent_scheduler.py b/tempest/api/network/admin/test_dhcp_agent_scheduler.py
index a938fa6..a89f25c 100644
--- a/tempest/api/network/admin/test_dhcp_agent_scheduler.py
+++ b/tempest/api/network/admin/test_dhcp_agent_scheduler.py
@@ -34,12 +34,12 @@
@test.attr(type='smoke')
def test_list_dhcp_agent_hosting_network(self):
- _, body = self.admin_client.list_dhcp_agent_hosting_network(
+ self.admin_client.list_dhcp_agent_hosting_network(
self.network['id'])
@test.attr(type='smoke')
def test_list_networks_hosted_by_one_dhcp(self):
- resp, body = self.admin_client.list_dhcp_agent_hosting_network(
+ body = self.admin_client.list_dhcp_agent_hosting_network(
self.network['id'])
agents = body['agents']
self.assertIsNotNone(agents)
@@ -49,7 +49,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_client.list_networks_hosted_by_one_dhcp_agent(
agent['id'])
networks = body['networks']
for network in networks:
@@ -63,7 +63,7 @@
self.ports.remove(self.port)
agent = dict()
agent['agent_type'] = None
- resp, body = self.admin_client.list_agents()
+ body = self.admin_client.list_agents()
agents = body['agents']
for a in agents:
if a['agent_type'] == 'DHCP agent':
@@ -82,14 +82,14 @@
self._remove_network_from_dhcp_agent(network_id, agent)
def _remove_network_from_dhcp_agent(self, network_id, agent):
- _, body = self.admin_client.remove_network_from_dhcp_agent(
+ self.admin_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):
- _, body = self.admin_client.add_dhcp_agent_to_network(agent['id'],
- network_id)
+ self.admin_client.add_dhcp_agent_to_network(agent['id'],
+ network_id)
self.assertTrue(self._check_network_in_dhcp_agent(
network_id, agent))
diff --git a/tempest/api/network/admin/test_external_network_extension.py b/tempest/api/network/admin/test_external_network_extension.py
index 75ee217..06cce48 100644
--- a/tempest/api/network/admin/test_external_network_extension.py
+++ b/tempest/api/network/admin/test_external_network_extension.py
@@ -26,7 +26,7 @@
post_body = {'name': data_utils.rand_name('network-')}
if external:
post_body['router:external'] = external
- _, body = self.admin_client.create_network(**post_body)
+ body = self.admin_client.create_network(**post_body)
network = body['network']
self.addCleanup(self.admin_client.delete_network, network['id'])
return network
@@ -45,8 +45,8 @@
network = self._create_network(external=False)
self.assertFalse(network.get('router:external', False))
update_body = {'router:external': True}
- _, body = self.admin_client.update_network(network['id'],
- **update_body)
+ body = self.admin_client.update_network(network['id'],
+ **update_body)
updated_network = body['network']
# Verify that router:external parameter was updated
self.assertTrue(updated_network['router:external'])
@@ -57,7 +57,7 @@
# List networks as a normal user and confirm the external
# network extension attribute is returned for those networks
# that were created as external
- _, body = self.client.list_networks()
+ body = self.client.list_networks()
networks_list = [net['id'] for net in body['networks']]
self.assertIn(external_network['id'], networks_list)
self.assertIn(self.network['id'], networks_list)
@@ -72,12 +72,12 @@
external_network = self._create_network()
# Show an external network as a normal user and confirm the
# external network extension attribute is returned.
- _, body = self.client.show_network(external_network['id'])
+ body = self.client.show_network(external_network['id'])
show_ext_net = body['network']
self.assertEqual(external_network['name'], show_ext_net['name'])
self.assertEqual(external_network['id'], show_ext_net['id'])
self.assertTrue(show_ext_net['router:external'])
- _, body = self.client.show_network(self.network['id'])
+ body = self.client.show_network(self.network['id'])
show_net = body['network']
# Verify with show that router:external is False for network
self.assertEqual(self.network['name'], show_net['name'])
@@ -91,29 +91,29 @@
"""
# Set cls.client to admin to use base.create_subnet()
client = self.admin_client
- _, body = client.create_network(**{'router:external': True})
+ body = client.create_network(**{'router:external': True})
external_network = body['network']
self.addCleanup(self._try_delete_resource,
client.delete_network,
external_network['id'])
subnet = self.create_subnet(external_network, client=client)
- _, body = client.create_floatingip(
+ body = client.create_floatingip(
floating_network_id=external_network['id'])
created_floating_ip = body['floatingip']
self.addCleanup(self._try_delete_resource,
client.delete_floatingip,
created_floating_ip['id'])
- _, floatingip_list = client.list_floatingips(
+ floatingip_list = client.list_floatingips(
network=external_network['id'])
self.assertIn(created_floating_ip['id'],
(f['id'] for f in floatingip_list['floatingips']))
client.delete_network(external_network['id'])
# Verifies floating ip is deleted
- _, floatingip_list = client.list_floatingips()
+ floatingip_list = client.list_floatingips()
self.assertNotIn(created_floating_ip['id'],
(f['id'] for f in floatingip_list['floatingips']))
# Verifies subnet is deleted
- _, subnet_list = client.list_subnets()
+ subnet_list = client.list_subnets()
self.assertNotIn(subnet['id'],
(s['id'] for s in subnet_list))
# Removes subnet from the cleanup list
diff --git a/tempest/api/network/admin/test_floating_ips_admin_actions.py b/tempest/api/network/admin/test_floating_ips_admin_actions.py
index 2fe7bf8..62ba1b3 100644
--- a/tempest/api/network/admin/test_floating_ips_admin_actions.py
+++ b/tempest/api/network/admin/test_floating_ips_admin_actions.py
@@ -36,18 +36,18 @@
@test.attr(type='smoke')
def test_list_floating_ips_from_admin_and_nonadmin(self):
# Create floating ip from admin user
- _, floating_ip_admin = self.admin_client.create_floatingip(
+ floating_ip_admin = self.admin_client.create_floatingip(
floating_network_id=self.ext_net_id)
self.addCleanup(self.admin_client.delete_floatingip,
floating_ip_admin['floatingip']['id'])
# Create floating ip from alt user
- _, body = self.alt_client.create_floatingip(
+ body = self.alt_client.create_floatingip(
floating_network_id=self.ext_net_id)
floating_ip_alt = body['floatingip']
self.addCleanup(self.alt_client.delete_floatingip,
floating_ip_alt['id'])
# List floating ips from admin
- _, body = self.admin_client.list_floatingips()
+ body = self.admin_client.list_floatingips()
floating_ip_ids_admin = [f['id'] for f in body['floatingips']]
# Check that admin sees all floating ips
self.assertIn(self.floating_ip['id'], floating_ip_ids_admin)
@@ -55,7 +55,7 @@
floating_ip_ids_admin)
self.assertIn(floating_ip_alt['id'], floating_ip_ids_admin)
# List floating ips from nonadmin
- resp, body = self.client.list_floatingips()
+ body = self.client.list_floatingips()
floating_ip_ids = [f['id'] for f in body['floatingips']]
# Check that nonadmin user doesn't see floating ip created from admin
# and floating ip that is created in another tenant (alt user)
diff --git a/tempest/api/network/admin/test_l3_agent_scheduler.py b/tempest/api/network/admin/test_l3_agent_scheduler.py
index 8fccb1f..a6de581 100644
--- a/tempest/api/network/admin/test_l3_agent_scheduler.py
+++ b/tempest/api/network/admin/test_l3_agent_scheduler.py
@@ -40,7 +40,7 @@
msg = "L3 Agent Scheduler Extension not enabled."
raise cls.skipException(msg)
# Trying to get agent details for L3 Agent
- resp, body = cls.admin_client.list_agents()
+ body = cls.admin_client.list_agents()
agents = body['agents']
for agent in agents:
if agent['agent_type'] == 'L3 agent':
@@ -52,18 +52,18 @@
@test.attr(type='smoke')
def test_list_routers_on_l3_agent(self):
- _, body = self.admin_client.list_routers_on_l3_agent(self.agent['id'])
+ self.admin_client.list_routers_on_l3_agent(self.agent['id'])
@test.attr(type='smoke')
def test_add_list_remove_router_on_l3_agent(self):
l3_agent_ids = list()
name = data_utils.rand_name('router1-')
- resp, router = self.client.create_router(name)
+ router = self.client.create_router(name)
self.addCleanup(self.client.delete_router, router['router']['id'])
- _, body = self.admin_client.add_router_to_l3_agent(
+ self.admin_client.add_router_to_l3_agent(
self.agent['id'],
router['router']['id'])
- _, body = self.admin_client.list_l3_agents_hosting_router(
+ body = self.admin_client.list_l3_agents_hosting_router(
router['router']['id'])
for agent in body['agents']:
l3_agent_ids.append(agent['id'])
@@ -71,7 +71,7 @@
self.assertEqual('L3 agent', agent['agent_type'])
self.assertIn(self.agent['id'], l3_agent_ids)
del l3_agent_ids[:]
- _, body = self.admin_client.remove_router_from_l3_agent(
+ body = self.admin_client.remove_router_from_l3_agent(
self.agent['id'],
router['router']['id'])
# NOTE(afazekas): The deletion not asserted, because neutron
diff --git a/tempest/api/network/admin/test_lbaas_agent_scheduler.py b/tempest/api/network/admin/test_lbaas_agent_scheduler.py
index 03296a4..da1af36 100644
--- a/tempest/api/network/admin/test_lbaas_agent_scheduler.py
+++ b/tempest/api/network/admin/test_lbaas_agent_scheduler.py
@@ -49,13 +49,13 @@
@test.attr(type='smoke')
def test_list_pools_on_lbaas_agent(self):
found = False
- _, body = self.admin_client.list_agents(
+ body = self.admin_client.list_agents(
agent_type="Loadbalancer agent")
agents = body['agents']
for a in agents:
msg = 'Load Balancer agent expected'
self.assertEqual(a['agent_type'], 'Loadbalancer agent', msg)
- _, body = (
+ body = (
self.admin_client.list_pools_hosted_by_one_lbaas_agent(
a['id']))
pools = body['pools']
@@ -66,6 +66,6 @@
@test.attr(type='smoke')
def test_show_lbaas_agent_hosting_pool(self):
- _, body = self.admin_client.show_lbaas_agent_hosting_pool(
+ body = self.admin_client.show_lbaas_agent_hosting_pool(
self.pool['id'])
self.assertEqual('Loadbalancer agent', body['agent']['agent_type'])
diff --git a/tempest/api/network/admin/test_load_balancer_admin_actions.py b/tempest/api/network/admin/test_load_balancer_admin_actions.py
index 15d06e3..e81616b 100644
--- a/tempest/api/network/admin/test_load_balancer_admin_actions.py
+++ b/tempest/api/network/admin/test_load_balancer_admin_actions.py
@@ -46,7 +46,7 @@
@test.attr(type='smoke')
def test_create_vip_as_admin_for_another_tenant(self):
name = data_utils.rand_name('vip-')
- _, body = self.admin_client.create_pool(
+ body = self.admin_client.create_pool(
name=data_utils.rand_name('pool-'),
lb_method="ROUND_ROBIN",
protocol="HTTP",
@@ -54,24 +54,24 @@
tenant_id=self.tenant_id)
pool = body['pool']
self.addCleanup(self.admin_client.delete_pool, pool['id'])
- _, body = self.admin_client.create_vip(name=name,
- protocol="HTTP",
- protocol_port=80,
- subnet_id=self.subnet['id'],
- pool_id=pool['id'],
- tenant_id=self.tenant_id)
+ body = self.admin_client.create_vip(name=name,
+ protocol="HTTP",
+ protocol_port=80,
+ subnet_id=self.subnet['id'],
+ pool_id=pool['id'],
+ tenant_id=self.tenant_id)
vip = body['vip']
self.addCleanup(self.admin_client.delete_vip, vip['id'])
self.assertIsNotNone(vip['id'])
self.assertEqual(self.tenant_id, vip['tenant_id'])
- _, body = self.client.show_vip(vip['id'])
+ body = self.client.show_vip(vip['id'])
show_vip = body['vip']
self.assertEqual(vip['id'], show_vip['id'])
self.assertEqual(vip['name'], show_vip['name'])
@test.attr(type='smoke')
def test_create_health_monitor_as_admin_for_another_tenant(self):
- _, body = (
+ body = (
self.admin_client.create_health_monitor(delay=4,
max_retries=3,
type="TCP",
@@ -82,13 +82,13 @@
health_monitor['id'])
self.assertIsNotNone(health_monitor['id'])
self.assertEqual(self.tenant_id, health_monitor['tenant_id'])
- _, body = self.client.show_health_monitor(health_monitor['id'])
+ body = self.client.show_health_monitor(health_monitor['id'])
show_health_monitor = body['health_monitor']
self.assertEqual(health_monitor['id'], show_health_monitor['id'])
@test.attr(type='smoke')
def test_create_pool_from_admin_user_other_tenant(self):
- _, body = self.admin_client.create_pool(
+ body = self.admin_client.create_pool(
name=data_utils.rand_name('pool-'),
lb_method="ROUND_ROBIN",
protocol="HTTP",
@@ -101,10 +101,10 @@
@test.attr(type='smoke')
def test_create_member_from_admin_user_other_tenant(self):
- _, body = self.admin_client.create_member(address="10.0.9.47",
- protocol_port=80,
- pool_id=self.pool['id'],
- tenant_id=self.tenant_id)
+ body = self.admin_client.create_member(address="10.0.9.47",
+ protocol_port=80,
+ pool_id=self.pool['id'],
+ tenant_id=self.tenant_id)
member = body['member']
self.addCleanup(self.admin_client.delete_member, member['id'])
self.assertIsNotNone(member['id'])
diff --git a/tempest/api/network/admin/test_quotas.py b/tempest/api/network/admin/test_quotas.py
index 72aef36..54aa54c 100644
--- a/tempest/api/network/admin/test_quotas.py
+++ b/tempest/api/network/admin/test_quotas.py
@@ -57,14 +57,14 @@
self.addCleanup(self.identity_admin_client.delete_tenant, tenant_id)
# Change quotas for tenant
- _, quota_set = self.admin_client.update_quotas(tenant_id,
- **new_quotas)
+ quota_set = self.admin_client.update_quotas(tenant_id,
+ **new_quotas)
self.addCleanup(self.admin_client.reset_quotas, tenant_id)
for key, value in new_quotas.iteritems():
self.assertEqual(value, quota_set[key])
# Confirm our tenant is listed among tenants with non default quotas
- _, non_default_quotas = self.admin_client.list_quotas()
+ non_default_quotas = self.admin_client.list_quotas()
found = False
for qs in non_default_quotas['quotas']:
if qs['tenant_id'] == tenant_id:
@@ -72,14 +72,14 @@
self.assertTrue(found)
# Confirm from API quotas were changed as requested for tenant
- _, quota_set = self.admin_client.show_quotas(tenant_id)
+ quota_set = self.admin_client.show_quotas(tenant_id)
quota_set = quota_set['quota']
for key, value in new_quotas.iteritems():
self.assertEqual(value, quota_set[key])
# Reset quotas to default and confirm
- _, body = self.admin_client.reset_quotas(tenant_id)
- _, non_default_quotas = self.admin_client.list_quotas()
+ self.admin_client.reset_quotas(tenant_id)
+ non_default_quotas = self.admin_client.list_quotas()
for q in non_default_quotas['quotas']:
self.assertNotEqual(tenant_id, q['tenant_id'])
diff --git a/tempest/api/network/base.py b/tempest/api/network/base.py
index b13dd22..12b2d13 100644
--- a/tempest/api/network/base.py
+++ b/tempest/api/network/base.py
@@ -185,7 +185,7 @@
"""Wrapper utility that returns a test network."""
network_name = network_name or data_utils.rand_name('test-network-')
- resp, body = cls.client.create_network(name=network_name)
+ body = cls.client.create_network(name=network_name)
network = body['network']
cls.networks.append(network)
return network
@@ -216,7 +216,7 @@
else:
gateway_ip = gateway
try:
- resp, body = client.create_subnet(
+ body = client.create_subnet(
network_id=network['id'],
cidr=str(subnet_cidr),
ip_version=ip_version,
@@ -237,8 +237,8 @@
@classmethod
def create_port(cls, network, **kwargs):
"""Wrapper utility that returns a test port."""
- resp, body = cls.client.create_port(network_id=network['id'],
- **kwargs)
+ body = cls.client.create_port(network_id=network['id'],
+ **kwargs)
port = body['port']
cls.ports.append(port)
return port
@@ -246,8 +246,8 @@
@classmethod
def update_port(cls, port, **kwargs):
"""Wrapper utility that updates a test port."""
- resp, body = cls.client.update_port(port['id'],
- **kwargs)
+ body = cls.client.update_port(port['id'],
+ **kwargs)
return body['port']
@classmethod
@@ -258,7 +258,7 @@
ext_gw_info['network_id'] = external_network_id
if enable_snat:
ext_gw_info['enable_snat'] = enable_snat
- resp, body = cls.client.create_router(
+ body = cls.client.create_router(
router_name, external_gateway_info=ext_gw_info,
admin_state_up=admin_state_up)
router = body['router']
@@ -268,7 +268,7 @@
@classmethod
def create_floatingip(cls, external_network_id):
"""Wrapper utility that returns a test floating IP."""
- resp, body = cls.client.create_floatingip(
+ body = cls.client.create_floatingip(
floating_network_id=external_network_id)
fip = body['floatingip']
cls.floating_ips.append(fip)
@@ -277,7 +277,7 @@
@classmethod
def create_pool(cls, name, lb_method, protocol, subnet):
"""Wrapper utility that returns a test pool."""
- resp, body = cls.client.create_pool(
+ body = cls.client.create_pool(
name=name,
lb_method=lb_method,
protocol=protocol,
@@ -289,25 +289,25 @@
@classmethod
def update_pool(cls, name):
"""Wrapper utility that returns a test pool."""
- resp, body = cls.client.update_pool(name=name)
+ body = cls.client.update_pool(name=name)
pool = body['pool']
return pool
@classmethod
def create_vip(cls, name, protocol, protocol_port, subnet, pool):
"""Wrapper utility that returns a test vip."""
- resp, body = cls.client.create_vip(name=name,
- protocol=protocol,
- protocol_port=protocol_port,
- subnet_id=subnet['id'],
- pool_id=pool['id'])
+ body = cls.client.create_vip(name=name,
+ protocol=protocol,
+ protocol_port=protocol_port,
+ subnet_id=subnet['id'],
+ pool_id=pool['id'])
vip = body['vip']
cls.vips.append(vip)
return vip
@classmethod
def update_vip(cls, name):
- resp, body = cls.client.update_vip(name=name)
+ body = cls.client.update_vip(name=name)
vip = body['vip']
return vip
@@ -316,47 +316,47 @@
"""Wrapper utility that returns a test member."""
ip_version = ip_version if ip_version is not None else cls._ip_version
member_address = "fd00::abcd" if ip_version == 6 else "10.0.9.46"
- resp, body = cls.client.create_member(address=member_address,
- protocol_port=protocol_port,
- pool_id=pool['id'])
+ body = cls.client.create_member(address=member_address,
+ protocol_port=protocol_port,
+ pool_id=pool['id'])
member = body['member']
cls.members.append(member)
return member
@classmethod
def update_member(cls, admin_state_up):
- resp, body = cls.client.update_member(admin_state_up=admin_state_up)
+ body = cls.client.update_member(admin_state_up=admin_state_up)
member = body['member']
return member
@classmethod
def create_health_monitor(cls, delay, max_retries, Type, timeout):
"""Wrapper utility that returns a test health monitor."""
- resp, body = cls.client.create_health_monitor(delay=delay,
- max_retries=max_retries,
- type=Type,
- timeout=timeout)
+ body = cls.client.create_health_monitor(delay=delay,
+ max_retries=max_retries,
+ type=Type,
+ timeout=timeout)
health_monitor = body['health_monitor']
cls.health_monitors.append(health_monitor)
return health_monitor
@classmethod
def update_health_monitor(cls, admin_state_up):
- resp, body = cls.client.update_vip(admin_state_up=admin_state_up)
+ body = cls.client.update_vip(admin_state_up=admin_state_up)
health_monitor = body['health_monitor']
return health_monitor
@classmethod
def create_router_interface(cls, router_id, subnet_id):
"""Wrapper utility that returns a router interface."""
- resp, interface = cls.client.add_router_interface_with_subnet_id(
+ interface = cls.client.add_router_interface_with_subnet_id(
router_id, subnet_id)
return interface
@classmethod
def create_vpnservice(cls, subnet_id, router_id):
"""Wrapper utility that returns a test vpn service."""
- resp, body = cls.client.create_vpnservice(
+ body = cls.client.create_vpnservice(
subnet_id=subnet_id, router_id=router_id, admin_state_up=True,
name=data_utils.rand_name("vpnservice-"))
vpnservice = body['vpnservice']
@@ -366,7 +366,7 @@
@classmethod
def create_ikepolicy(cls, name):
"""Wrapper utility that returns a test ike policy."""
- resp, body = cls.client.create_ikepolicy(name=name)
+ body = cls.client.create_ikepolicy(name=name)
ikepolicy = body['ikepolicy']
cls.ikepolicies.append(ikepolicy)
return ikepolicy
@@ -374,7 +374,7 @@
@classmethod
def create_firewall_rule(cls, action, protocol):
"""Wrapper utility that returns a test firewall rule."""
- resp, body = cls.client.create_firewall_rule(
+ body = cls.client.create_firewall_rule(
name=data_utils.rand_name("fw-rule"),
action=action,
protocol=protocol)
@@ -385,7 +385,7 @@
@classmethod
def create_firewall_policy(cls):
"""Wrapper utility that returns a test firewall policy."""
- resp, body = cls.client.create_firewall_policy(
+ body = cls.client.create_firewall_policy(
name=data_utils.rand_name("fw-policy"))
fw_policy = body['firewall_policy']
cls.fw_policies.append(fw_policy)
@@ -393,7 +393,7 @@
@classmethod
def delete_router(cls, router):
- resp, body = cls.client.list_router_interfaces(router['id'])
+ body = cls.client.list_router_interfaces(router['id'])
interfaces = body['ports']
for i in interfaces:
cls.client.remove_router_interface_with_subnet_id(
@@ -403,7 +403,7 @@
@classmethod
def create_ipsecpolicy(cls, name):
"""Wrapper utility that returns a test ipsec policy."""
- _, body = cls.client.create_ipsecpolicy(name=name)
+ body = cls.client.create_ipsecpolicy(name=name)
ipsecpolicy = body['ipsecpolicy']
cls.ipsecpolicies.append(ipsecpolicy)
return ipsecpolicy
@@ -428,7 +428,7 @@
@classmethod
def create_metering_label(cls, name, description):
"""Wrapper utility that returns a test metering label."""
- resp, body = cls.admin_client.create_metering_label(
+ body = cls.admin_client.create_metering_label(
description=description,
name=data_utils.rand_name("metering-label"))
metering_label = body['metering_label']
@@ -439,7 +439,7 @@
def create_metering_label_rule(cls, remote_ip_prefix, direction,
metering_label_id):
"""Wrapper utility that returns a test metering label rule."""
- resp, body = cls.admin_client.create_metering_label_rule(
+ body = cls.admin_client.create_metering_label_rule(
remote_ip_prefix=remote_ip_prefix, direction=direction,
metering_label_id=metering_label_id)
metering_label_rule = body['metering_label_rule']
diff --git a/tempest/api/network/base_routers.py b/tempest/api/network/base_routers.py
index 38985a0..1b580b0 100644
--- a/tempest/api/network/base_routers.py
+++ b/tempest/api/network/base_routers.py
@@ -29,14 +29,14 @@
self.client.delete_router(router_id)
# Asserting that the router is not found in the list
# after deletion
- _, list_body = self.client.list_routers()
+ list_body = self.client.list_routers()
routers_list = list()
for router in list_body['routers']:
routers_list.append(router['id'])
self.assertNotIn(router_id, routers_list)
def _add_router_interface_with_subnet_id(self, router_id, subnet_id):
- _, interface = self.client.add_router_interface_with_subnet_id(
+ interface = self.client.add_router_interface_with_subnet_id(
router_id, subnet_id)
self.addCleanup(self._remove_router_interface_with_subnet_id,
router_id, subnet_id)
@@ -44,11 +44,11 @@
return interface
def _remove_router_interface_with_subnet_id(self, router_id, subnet_id):
- _, body = self.client.remove_router_interface_with_subnet_id(
+ body = self.client.remove_router_interface_with_subnet_id(
router_id, subnet_id)
self.assertEqual(subnet_id, body['subnet_id'])
def _remove_router_interface_with_port_id(self, router_id, port_id):
- _, body = self.client.remove_router_interface_with_port_id(router_id,
- port_id)
+ body = self.client.remove_router_interface_with_port_id(router_id,
+ port_id)
self.assertEqual(port_id, body['port_id'])
diff --git a/tempest/api/network/base_security_groups.py b/tempest/api/network/base_security_groups.py
index 622ed01..623e2d0 100644
--- a/tempest/api/network/base_security_groups.py
+++ b/tempest/api/network/base_security_groups.py
@@ -26,7 +26,7 @@
def _create_security_group(self):
# Create a security group
name = data_utils.rand_name('secgroup-')
- _, group_create_body = self.client.create_security_group(name=name)
+ group_create_body = self.client.create_security_group(name=name)
self.addCleanup(self._delete_security_group,
group_create_body['security_group']['id'])
self.assertEqual(group_create_body['security_group']['name'], name)
@@ -36,7 +36,7 @@
self.client.delete_security_group(secgroup_id)
# Asserting that the security group is not found in the list
# after deletion
- _, list_body = self.client.list_security_groups()
+ list_body = self.client.list_security_groups()
secgroup_list = list()
for secgroup in list_body['security_groups']:
secgroup_list.append(secgroup['id'])
@@ -46,7 +46,7 @@
self.client.delete_security_group_rule(rule_id)
# Asserting that the security group is not found in the list
# after deletion
- _, list_body = self.client.list_security_group_rules()
+ list_body = self.client.list_security_group_rules()
rules_list = list()
for rule in list_body['security_group_rules']:
rules_list.append(rule['id'])
diff --git a/tempest/api/network/test_allowed_address_pair.py b/tempest/api/network/test_allowed_address_pair.py
index 7b7a5db..57887ac 100644
--- a/tempest/api/network/test_allowed_address_pair.py
+++ b/tempest/api/network/test_allowed_address_pair.py
@@ -58,14 +58,14 @@
# Create port with allowed address pair attribute
allowed_address_pairs = [{'ip_address': self.ip_address,
'mac_address': self.mac_address}]
- _, body = self.client.create_port(
+ body = self.client.create_port(
network_id=self.network['id'],
allowed_address_pairs=allowed_address_pairs)
port_id = body['port']['id']
self.addCleanup(self.client.delete_port, port_id)
# Confirm port was created with allowed address pair attribute
- _, body = self.client.list_ports()
+ body = self.client.list_ports()
ports = body['ports']
port = [p for p in ports if p['id'] == port_id]
msg = 'Created port not found in list of ports returned by Neutron'
@@ -75,7 +75,7 @@
@test.attr(type='smoke')
def _update_port_with_address(self, address, mac_address=None, **kwargs):
# Create a port without allowed address pair
- _, body = self.client.create_port(network_id=self.network['id'])
+ body = self.client.create_port(network_id=self.network['id'])
port_id = body['port']['id']
self.addCleanup(self.client.delete_port, port_id)
if mac_address is None:
@@ -86,7 +86,7 @@
'mac_address': mac_address}]
if kwargs:
allowed_address_pairs.append(kwargs['allowed_address_pairs'])
- _, body = self.client.update_port(
+ body = self.client.update_port(
port_id, allowed_address_pairs=allowed_address_pairs)
allowed_address_pair = body['port']['allowed_address_pairs']
self.assertEqual(allowed_address_pair, allowed_address_pairs)
@@ -105,7 +105,7 @@
@test.attr(type='smoke')
def test_update_port_with_multiple_ip_mac_address_pair(self):
# Create an ip _address and mac_address through port create
- _, resp = self.client.create_port(network_id=self.network['id'])
+ resp = self.client.create_port(network_id=self.network['id'])
newportid = resp['port']['id']
self.addCleanup(self.client.delete_port, newportid)
ipaddress = resp['port']['fixed_ips'][0]['ip_address']
diff --git a/tempest/api/network/test_dhcp_ipv6.py b/tempest/api/network/test_dhcp_ipv6.py
index 5bc63d0..6ce1216 100644
--- a/tempest/api/network/test_dhcp_ipv6.py
+++ b/tempest/api/network/test_dhcp_ipv6.py
@@ -25,7 +25,6 @@
class NetworksTestDHCPv6(base.BaseNetworkTest):
- _interface = 'json'
_ip_version = 6
""" Test DHCPv6 specific features using SLAAC, stateless and
@@ -39,7 +38,7 @@
"""
@classmethod
- def resource_setup(cls):
+ def skip_checks(cls):
msg = None
if not CONF.network_feature_enabled.ipv6:
msg = "IPv6 is not enabled"
@@ -47,6 +46,9 @@
msg = "DHCPv6 attributes are not enabled."
if msg:
raise cls.skipException(msg)
+
+ @classmethod
+ def resource_setup(cls):
super(NetworksTestDHCPv6, cls).resource_setup()
cls.network = cls.create_network()
@@ -57,10 +59,10 @@
del things_list[index]
def _clean_network(self):
- resp, body = self.client.list_ports()
+ body = self.client.list_ports()
ports = body['ports']
for port in ports:
- if (port['device_owner'] == 'network:router_interface'
+ if (port['device_owner'].startswith('network:router_interface')
and port['device_id'] in [r['id'] for r in self.routers]):
self.client.remove_router_interface_with_port_id(
port['device_id'], port['id']
@@ -69,13 +71,13 @@
if port['id'] in [p['id'] for p in self.ports]:
self.client.delete_port(port['id'])
self._remove_from_list_by_index(self.ports, port)
- resp, body = self.client.list_subnets()
+ body = self.client.list_subnets()
subnets = body['subnets']
for subnet in subnets:
if subnet['id'] in [s['id'] for s in self.subnets]:
self.client.delete_subnet(subnet['id'])
self._remove_from_list_by_index(self.subnets, subnet)
- resp, body = self.client.list_routers()
+ body = self.client.list_routers()
routers = body['routers']
for router in routers:
if router['id'] in [r['id'] for r in self.routers]:
@@ -197,7 +199,7 @@
subnet_slaac]
self.client.delete_port(port['id'])
self.ports.pop()
- _, body = self.client.list_ports()
+ body = self.client.list_ports()
ports_id_list = [i['id'] for i in body['ports']]
self.assertNotIn(port['id'], ports_id_list)
self._clean_network()
@@ -361,7 +363,7 @@
admin_state_up=True)
port = self.create_router_interface(router['id'],
subnet['id'])
- _, body = self.client.show_port(port['port_id'])
+ body = self.client.show_port(port['port_id'])
return subnet, body['port']
def test_dhcp_stateful_router(self):
@@ -371,7 +373,6 @@
for ra_mode, add_mode in (
('dhcpv6-stateful', 'dhcpv6-stateful'),
('dhcpv6-stateful', None),
- (None, 'dhcpv6-stateful'),
):
kwargs = {'ipv6_ra_mode': ra_mode,
'ipv6_address_mode': add_mode}
diff --git a/tempest/api/network/test_extensions.py b/tempest/api/network/test_extensions.py
index 1c7feb3..54c3cb9 100644
--- a/tempest/api/network/test_extensions.py
+++ b/tempest/api/network/test_extensions.py
@@ -47,14 +47,14 @@
expected_alias = [ext for ext in expected_alias if
test.is_extension_enabled(ext, 'network')]
actual_alias = list()
- _, extensions = self.client.list_extensions()
+ extensions = self.client.list_extensions()
list_extensions = extensions['extensions']
# Show and verify the details of the available extensions
for ext in list_extensions:
ext_name = ext['name']
ext_alias = ext['alias']
actual_alias.append(ext['alias'])
- _, ext_details = self.client.show_extension(ext_alias)
+ ext_details = self.client.show_extension(ext_alias)
ext_details = ext_details['extension']
self.assertIsNotNone(ext_details)
diff --git a/tempest/api/network/test_extra_dhcp_options.py b/tempest/api/network/test_extra_dhcp_options.py
index 6d083b3..bd70323 100644
--- a/tempest/api/network/test_extra_dhcp_options.py
+++ b/tempest/api/network/test_extra_dhcp_options.py
@@ -57,14 +57,14 @@
@test.attr(type='smoke')
def test_create_list_port_with_extra_dhcp_options(self):
# Create a port with Extra DHCP Options
- _, body = self.client.create_port(
+ body = self.client.create_port(
network_id=self.network['id'],
extra_dhcp_opts=self.extra_dhcp_opts)
port_id = body['port']['id']
self.addCleanup(self.client.delete_port, port_id)
# Confirm port created has Extra DHCP Options
- _, body = self.client.list_ports()
+ body = self.client.list_ports()
ports = body['ports']
port = [p for p in ports if p['id'] == port_id]
self.assertTrue(port)
@@ -74,12 +74,12 @@
def test_update_show_port_with_extra_dhcp_options(self):
# Update port with extra dhcp options
name = data_utils.rand_name('new-port-name')
- _, body = self.client.update_port(
+ body = self.client.update_port(
self.port['id'],
name=name,
extra_dhcp_opts=self.extra_dhcp_opts)
# Confirm extra dhcp options were added to the port
- _, body = self.client.show_port(self.port['id'])
+ body = self.client.show_port(self.port['id'])
self._confirm_extra_dhcp_options(body['port'], self.extra_dhcp_opts)
def _confirm_extra_dhcp_options(self, port, extra_dhcp_opts):
diff --git a/tempest/api/network/test_floating_ips.py b/tempest/api/network/test_floating_ips.py
index 9beae0a..1151c5d 100644
--- a/tempest/api/network/test_floating_ips.py
+++ b/tempest/api/network/test_floating_ips.py
@@ -67,7 +67,7 @@
@test.attr(type='smoke')
def test_create_list_show_update_delete_floating_ip(self):
# Creates a floating IP
- _, body = self.client.create_floatingip(
+ body = self.client.create_floatingip(
floating_network_id=self.ext_net_id,
port_id=self.ports[0]['id'])
created_floating_ip = body['floatingip']
@@ -82,7 +82,7 @@
self.assertIn(created_floating_ip['fixed_ip_address'],
[ip['ip_address'] for ip in self.ports[0]['fixed_ips']])
# Verifies the details of a floating_ip
- _, floating_ip = self.client.show_floatingip(created_floating_ip['id'])
+ floating_ip = self.client.show_floatingip(created_floating_ip['id'])
shown_floating_ip = floating_ip['floatingip']
self.assertEqual(shown_floating_ip['id'], created_floating_ip['id'])
self.assertEqual(shown_floating_ip['floating_network_id'],
@@ -94,13 +94,13 @@
self.assertEqual(shown_floating_ip['port_id'], self.ports[0]['id'])
# Verify the floating ip exists in the list of all floating_ips
- _, floating_ips = self.client.list_floatingips()
+ floating_ips = self.client.list_floatingips()
floatingip_id_list = list()
for f in floating_ips['floatingips']:
floatingip_id_list.append(f['id'])
self.assertIn(created_floating_ip['id'], floatingip_id_list)
# Associate floating IP to the other port
- _, floating_ip = self.client.update_floatingip(
+ floating_ip = self.client.update_floatingip(
created_floating_ip['id'],
port_id=self.ports[1]['id'])
updated_floating_ip = floating_ip['floatingip']
@@ -110,7 +110,7 @@
self.assertEqual(updated_floating_ip['router_id'], self.router['id'])
# Disassociate floating IP from the port
- _, floating_ip = self.client.update_floatingip(
+ floating_ip = self.client.update_floatingip(
created_floating_ip['id'],
port_id=None)
updated_floating_ip = floating_ip['floatingip']
@@ -121,21 +121,21 @@
@test.attr(type='smoke')
def test_floating_ip_delete_port(self):
# Create a floating IP
- _, body = self.client.create_floatingip(
+ body = self.client.create_floatingip(
floating_network_id=self.ext_net_id)
created_floating_ip = body['floatingip']
self.addCleanup(self.client.delete_floatingip,
created_floating_ip['id'])
# Create a port
- resp, port = self.client.create_port(network_id=self.network['id'])
+ port = self.client.create_port(network_id=self.network['id'])
created_port = port['port']
- _, floating_ip = self.client.update_floatingip(
+ floating_ip = self.client.update_floatingip(
created_floating_ip['id'],
port_id=created_port['id'])
# Delete port
self.client.delete_port(created_port['id'])
# Verifies the details of the floating_ip
- _, floating_ip = self.client.show_floatingip(created_floating_ip['id'])
+ floating_ip = self.client.show_floatingip(created_floating_ip['id'])
shown_floating_ip = floating_ip['floatingip']
# Confirm the fields are back to None
self.assertEqual(shown_floating_ip['id'], created_floating_ip['id'])
@@ -146,7 +146,7 @@
@test.attr(type='smoke')
def test_floating_ip_update_different_router(self):
# Associate a floating IP to a port on a router
- _, body = self.client.create_floatingip(
+ body = self.client.create_floatingip(
floating_network_id=self.ext_net_id,
port_id=self.ports[1]['id'])
created_floating_ip = body['floatingip']
@@ -160,7 +160,7 @@
self.create_router_interface(router2['id'], subnet2['id'])
port_other_router = self.create_port(network2)
# Associate floating IP to the other port on another router
- _, floating_ip = self.client.update_floatingip(
+ floating_ip = self.client.update_floatingip(
created_floating_ip['id'],
port_id=port_other_router['id'])
updated_floating_ip = floating_ip['floatingip']
@@ -171,7 +171,7 @@
@test.attr(type='smoke')
def test_create_floating_ip_specifying_a_fixed_ip_address(self):
- _, body = self.client.create_floatingip(
+ body = self.client.create_floatingip(
floating_network_id=self.ext_net_id,
port_id=self.ports[1]['id'],
fixed_ip_address=self.ports[1]['fixed_ips'][0]['ip_address'])
@@ -181,7 +181,7 @@
self.assertIsNotNone(created_floating_ip['id'])
self.assertEqual(created_floating_ip['fixed_ip_address'],
self.ports[1]['fixed_ips'][0]['ip_address'])
- _, floating_ip = self.client.update_floatingip(
+ floating_ip = self.client.update_floatingip(
created_floating_ip['id'],
port_id=None)
self.assertIsNone(floating_ip['floatingip']['port_id'])
@@ -193,12 +193,12 @@
list_ips = [str(ip) for ip in ips[-3:-1]]
fixed_ips = [{'ip_address': list_ips[0]}, {'ip_address': list_ips[1]}]
# Create port
- _, body = self.client.create_port(network_id=self.network['id'],
- fixed_ips=fixed_ips)
+ body = self.client.create_port(network_id=self.network['id'],
+ fixed_ips=fixed_ips)
port = body['port']
self.addCleanup(self.client.delete_port, port['id'])
# Create floating ip
- _, body = self.client.create_floatingip(
+ body = self.client.create_floatingip(
floating_network_id=self.ext_net_id,
port_id=port['id'],
fixed_ip_address=list_ips[0])
@@ -207,9 +207,9 @@
self.assertIsNotNone(floating_ip['id'])
self.assertEqual(floating_ip['fixed_ip_address'], list_ips[0])
# Update floating ip
- _, body = self.client.update_floatingip(floating_ip['id'],
- port_id=port['id'],
- fixed_ip_address=list_ips[1])
+ body = self.client.update_floatingip(floating_ip['id'],
+ port_id=port['id'],
+ fixed_ip_address=list_ips[1])
update_floating_ip = body['floatingip']
self.assertEqual(update_floating_ip['fixed_ip_address'],
list_ips[1])
diff --git a/tempest/api/network/test_fwaas_extensions.py b/tempest/api/network/test_fwaas_extensions.py
index 0c36820..8104567 100644
--- a/tempest/api/network/test_fwaas_extensions.py
+++ b/tempest/api/network/test_fwaas_extensions.py
@@ -88,7 +88,7 @@
target_states = ('ACTIVE', 'CREATED')
def _wait():
- _, firewall = self.client.show_firewall(fw_id)
+ firewall = self.client.show_firewall(fw_id)
firewall = firewall['firewall']
return firewall['status'] in target_states
@@ -100,7 +100,7 @@
def test_list_firewall_rules(self):
# List firewall rules
- _, fw_rules = self.client.list_firewall_rules()
+ fw_rules = self.client.list_firewall_rules()
fw_rules = fw_rules['firewall_rules']
self.assertIn((self.fw_rule['id'],
self.fw_rule['name'],
@@ -117,32 +117,32 @@
def test_create_update_delete_firewall_rule(self):
# Create firewall rule
- _, body = self.client.create_firewall_rule(
+ body = self.client.create_firewall_rule(
name=data_utils.rand_name("fw-rule"),
action="allow",
protocol="tcp")
fw_rule_id = body['firewall_rule']['id']
# Update firewall rule
- _, body = self.client.update_firewall_rule(fw_rule_id,
- shared=True)
+ body = self.client.update_firewall_rule(fw_rule_id,
+ shared=True)
self.assertTrue(body["firewall_rule"]['shared'])
# Delete firewall rule
self.client.delete_firewall_rule(fw_rule_id)
# Confirm deletion
- resp, fw_rules = self.client.list_firewall_rules()
+ fw_rules = self.client.list_firewall_rules()
self.assertNotIn(fw_rule_id,
[m['id'] for m in fw_rules['firewall_rules']])
def test_show_firewall_rule(self):
# show a created firewall rule
- _, fw_rule = self.client.show_firewall_rule(self.fw_rule['id'])
+ fw_rule = self.client.show_firewall_rule(self.fw_rule['id'])
for key, value in fw_rule['firewall_rule'].iteritems():
self.assertEqual(self.fw_rule[key], value)
def test_list_firewall_policies(self):
- _, fw_policies = self.client.list_firewall_policies()
+ fw_policies = self.client.list_firewall_policies()
fw_policies = fw_policies['firewall_policies']
self.assertIn((self.fw_policy['id'],
self.fw_policy['name'],
@@ -153,15 +153,15 @@
def test_create_update_delete_firewall_policy(self):
# Create firewall policy
- _, body = self.client.create_firewall_policy(
+ body = self.client.create_firewall_policy(
name=data_utils.rand_name("fw-policy"))
fw_policy_id = body['firewall_policy']['id']
self.addCleanup(self._try_delete_policy, fw_policy_id)
# Update firewall policy
- _, body = self.client.update_firewall_policy(fw_policy_id,
- shared=True,
- name="updated_policy")
+ body = self.client.update_firewall_policy(fw_policy_id,
+ shared=True,
+ name="updated_policy")
updated_fw_policy = body["firewall_policy"]
self.assertTrue(updated_fw_policy['shared'])
self.assertEqual("updated_policy", updated_fw_policy['name'])
@@ -169,13 +169,13 @@
# Delete firewall policy
self.client.delete_firewall_policy(fw_policy_id)
# Confirm deletion
- resp, fw_policies = self.client.list_firewall_policies()
+ fw_policies = self.client.list_firewall_policies()
fw_policies = fw_policies['firewall_policies']
self.assertNotIn(fw_policy_id, [m['id'] for m in fw_policies])
def test_show_firewall_policy(self):
# show a created firewall policy
- _, fw_policy = self.client.show_firewall_policy(self.fw_policy['id'])
+ fw_policy = self.client.show_firewall_policy(self.fw_policy['id'])
fw_policy = fw_policy['firewall_policy']
for key, value in fw_policy.iteritems():
self.assertEqual(self.fw_policy[key], value)
@@ -191,7 +191,7 @@
router['id'], subnet['id'])
# Create firewall
- _, body = self.client.create_firewall(
+ body = self.client.create_firewall(
name=data_utils.rand_name("firewall"),
firewall_policy_id=self.fw_policy['id'])
created_firewall = body['firewall']
@@ -202,7 +202,7 @@
self._wait_until_ready(firewall_id)
# show a created firewall
- _, firewall = self.client.show_firewall(firewall_id)
+ firewall = self.client.show_firewall(firewall_id)
firewall = firewall['firewall']
for key, value in firewall.iteritems():
@@ -211,7 +211,7 @@
self.assertEqual(created_firewall[key], value)
# list firewall
- _, firewalls = self.client.list_firewalls()
+ firewalls = self.client.list_firewalls()
firewalls = firewalls['firewalls']
self.assertIn((created_firewall['id'],
created_firewall['name'],
@@ -226,14 +226,14 @@
@test.attr(type='smoke')
def test_firewall_rule_insertion_position_removal_rule_from_policy(self):
# Create firewall rule
- resp, body = self.client.create_firewall_rule(
+ body = self.client.create_firewall_rule(
name=data_utils.rand_name("fw-rule"),
action="allow",
protocol="tcp")
fw_rule_id1 = body['firewall_rule']['id']
self.addCleanup(self._try_delete_rule, fw_rule_id1)
# Create firewall policy
- _, body = self.client.create_firewall_policy(
+ body = self.client.create_firewall_policy(
name=data_utils.rand_name("fw-policy"))
fw_policy_id = body['firewall_policy']['id']
self.addCleanup(self._try_delete_policy, fw_policy_id)
@@ -245,7 +245,7 @@
# Verify insertion of rule in policy
self.assertIn(fw_rule_id1, self._get_list_fw_rule_ids(fw_policy_id))
# Create another firewall rule
- _, body = self.client.create_firewall_rule(
+ body = self.client.create_firewall_rule(
name=data_utils.rand_name("fw-rule"),
action="allow",
protocol="icmp")
@@ -257,7 +257,7 @@
fw_policy_id, fw_rule_id2, fw_rule_id1, '')
# Verify the posiition of rule after insertion
- _, fw_rule = self.client.show_firewall_rule(
+ fw_rule = self.client.show_firewall_rule(
fw_rule_id2)
self.assertEqual(int(fw_rule['firewall_rule']['position']), 2)
@@ -268,7 +268,7 @@
self.client.insert_firewall_rule_in_policy(
fw_policy_id, fw_rule_id2, '', fw_rule_id1)
# Verify the posiition of rule after insertion
- _, fw_rule = self.client.show_firewall_rule(
+ fw_rule = self.client.show_firewall_rule(
fw_rule_id2)
self.assertEqual(int(fw_rule['firewall_rule']['position']), 1)
# Remove rule from the firewall policy
@@ -285,21 +285,21 @@
self.assertNotIn(fw_rule_id1, self._get_list_fw_rule_ids(fw_policy_id))
def _get_list_fw_rule_ids(self, fw_policy_id):
- _, fw_policy = self.client.show_firewall_policy(
+ fw_policy = self.client.show_firewall_policy(
fw_policy_id)
return [ruleid for ruleid in fw_policy['firewall_policy']
['firewall_rules']]
def test_update_firewall_policy_audited_attribute(self):
# Create firewall rule
- _, body = self.client.create_firewall_rule(
+ body = self.client.create_firewall_rule(
name=data_utils.rand_name("fw-rule"),
action="allow",
protocol="icmp")
fw_rule_id = body['firewall_rule']['id']
self.addCleanup(self._try_delete_rule, fw_rule_id)
# Create firewall policy
- _, body = self.client.create_firewall_policy(
+ body = self.client.create_firewall_policy(
name=data_utils.rand_name('fw-policy'))
fw_policy_id = body['firewall_policy']['id']
self.addCleanup(self._try_delete_policy, fw_policy_id)
@@ -310,6 +310,6 @@
# Insert Firewall rule to firewall policy
self.client.insert_firewall_rule_in_policy(
fw_policy_id, fw_rule_id, '', '')
- _, body = self.client.show_firewall_policy(
+ body = self.client.show_firewall_policy(
fw_policy_id)
self.assertFalse(body['firewall_policy']['audited'])
diff --git a/tempest/api/network/test_load_balancer.py b/tempest/api/network/test_load_balancer.py
index 41294f6..289da7e 100644
--- a/tempest/api/network/test_load_balancer.py
+++ b/tempest/api/network/test_load_balancer.py
@@ -68,31 +68,31 @@
delete_obj = getattr(self.client, 'delete_' + obj_name)
list_objs = getattr(self.client, 'list_' + obj_name + 's')
- _, body = create_obj(**kwargs)
+ body = create_obj(**kwargs)
obj = body[obj_name]
self.addCleanup(delete_obj, obj['id'])
for key, value in obj.iteritems():
# It is not relevant to filter by all arguments. That is why
# there is a list of attr to except
if key not in attr_exceptions:
- _, body = list_objs(**{key: value})
+ body = list_objs(**{key: value})
objs = [v[key] for v in body[obj_name + 's']]
self.assertIn(value, objs)
@test.attr(type='smoke')
def test_list_vips(self):
# Verify the vIP exists in the list of all vIPs
- _, body = self.client.list_vips()
+ body = self.client.list_vips()
vips = body['vips']
self.assertIn(self.vip['id'], [v['id'] for v in vips])
@test.attr(type='smoke')
def test_list_vips_with_filter(self):
name = data_utils.rand_name('vip-')
- _, body = self.client.create_pool(name=data_utils.rand_name("pool-"),
- lb_method="ROUND_ROBIN",
- protocol="HTTPS",
- subnet_id=self.subnet['id'])
+ body = self.client.create_pool(name=data_utils.rand_name("pool-"),
+ lb_method="ROUND_ROBIN",
+ protocol="HTTPS",
+ subnet_id=self.subnet['id'])
pool = body['pool']
self.addCleanup(self.client.delete_pool, pool['id'])
attr_exceptions = ['status', 'session_persistence',
@@ -108,22 +108,22 @@
# Creates a vip
name = data_utils.rand_name('vip-')
address = self.subnet['allocation_pools'][0]['end']
- resp, body = self.client.create_pool(
+ body = self.client.create_pool(
name=data_utils.rand_name("pool-"),
lb_method='ROUND_ROBIN',
protocol='HTTP',
subnet_id=self.subnet['id'])
pool = body['pool']
- _, body = self.client.create_vip(name=name,
- protocol="HTTP",
- protocol_port=80,
- subnet_id=self.subnet['id'],
- pool_id=pool['id'],
- address=address)
+ body = self.client.create_vip(name=name,
+ protocol="HTTP",
+ protocol_port=80,
+ subnet_id=self.subnet['id'],
+ pool_id=pool['id'],
+ address=address)
vip = body['vip']
vip_id = vip['id']
# Confirm VIP's address correctness with a show
- _, body = self.client.show_vip(vip_id)
+ body = self.client.show_vip(vip_id)
vip = body['vip']
self.assertEqual(address, vip['address'])
# Verification of vip update
@@ -132,12 +132,12 @@
persistence_type = "HTTP_COOKIE"
update_data = {"session_persistence": {
"type": persistence_type}}
- _, body = self.client.update_vip(vip_id,
- name=new_name,
- description=new_description,
- connection_limit=10,
- admin_state_up=False,
- **update_data)
+ body = self.client.update_vip(vip_id,
+ name=new_name,
+ description=new_description,
+ connection_limit=10,
+ admin_state_up=False,
+ **update_data)
updated_vip = body['vip']
self.assertEqual(new_name, updated_vip['name'])
self.assertEqual(new_description, updated_vip['description'])
@@ -149,10 +149,10 @@
self.client.wait_for_resource_deletion('vip', vip['id'])
# Verification of pool update
new_name = "New_pool"
- _, body = self.client.update_pool(pool['id'],
- name=new_name,
- description="new_description",
- lb_method='LEAST_CONNECTIONS')
+ body = self.client.update_pool(pool['id'],
+ name=new_name,
+ description="new_description",
+ lb_method='LEAST_CONNECTIONS')
updated_pool = body['pool']
self.assertEqual(new_name, updated_pool['name'])
self.assertEqual('new_description', updated_pool['description'])
@@ -162,7 +162,7 @@
@test.attr(type='smoke')
def test_show_vip(self):
# Verifies the details of a vip
- _, body = self.client.show_vip(self.vip['id'])
+ body = self.client.show_vip(self.vip['id'])
vip = body['vip']
for key, value in vip.iteritems():
# 'status' should not be confirmed in api tests
@@ -172,14 +172,14 @@
@test.attr(type='smoke')
def test_show_pool(self):
# Here we need to new pool without any dependence with vips
- _, body = self.client.create_pool(name=data_utils.rand_name("pool-"),
- lb_method='ROUND_ROBIN',
- protocol='HTTP',
- subnet_id=self.subnet['id'])
+ body = self.client.create_pool(name=data_utils.rand_name("pool-"),
+ lb_method='ROUND_ROBIN',
+ protocol='HTTP',
+ subnet_id=self.subnet['id'])
pool = body['pool']
self.addCleanup(self.client.delete_pool, pool['id'])
# Verifies the details of a pool
- _, body = self.client.show_pool(pool['id'])
+ body = self.client.show_pool(pool['id'])
shown_pool = body['pool']
for key, value in pool.iteritems():
# 'status' should not be confirmed in api tests
@@ -189,7 +189,7 @@
@test.attr(type='smoke')
def test_list_pools(self):
# Verify the pool exists in the list of all pools
- _, body = self.client.list_pools()
+ body = self.client.list_pools()
pools = body['pools']
self.assertIn(self.pool['id'], [p['id'] for p in pools])
@@ -207,7 +207,7 @@
@test.attr(type='smoke')
def test_list_members(self):
# Verify the member exists in the list of all members
- _, body = self.client.list_members()
+ body = self.client.list_members()
members = body['members']
self.assertIn(self.member['id'], [m['id'] for m in members])
@@ -222,13 +222,13 @@
@test.attr(type='smoke')
def test_create_update_delete_member(self):
# Creates a member
- _, body = self.client.create_member(address=self.member_address,
- protocol_port=80,
- pool_id=self.pool['id'])
+ body = self.client.create_member(address=self.member_address,
+ protocol_port=80,
+ pool_id=self.pool['id'])
member = body['member']
# Verification of member update
- _, body = self.client.update_member(member['id'],
- admin_state_up=False)
+ body = self.client.update_member(member['id'],
+ admin_state_up=False)
updated_member = body['member']
self.assertFalse(updated_member['admin_state_up'])
# Verification of member delete
@@ -237,7 +237,7 @@
@test.attr(type='smoke')
def test_show_member(self):
# Verifies the details of a member
- _, body = self.client.show_member(self.member['id'])
+ body = self.client.show_member(self.member['id'])
member = body['member']
for key, value in member.iteritems():
# 'status' should not be confirmed in api tests
@@ -247,7 +247,7 @@
@test.attr(type='smoke')
def test_list_health_monitors(self):
# Verify the health monitor exists in the list of all health monitors
- _, body = self.client.list_health_monitors()
+ body = self.client.list_health_monitors()
health_monitors = body['health_monitors']
self.assertIn(self.health_monitor['id'],
[h['id'] for h in health_monitors])
@@ -262,27 +262,27 @@
@test.attr(type='smoke')
def test_create_update_delete_health_monitor(self):
# Creates a health_monitor
- _, body = self.client.create_health_monitor(delay=4,
- max_retries=3,
- type="TCP",
- timeout=1)
+ body = self.client.create_health_monitor(delay=4,
+ max_retries=3,
+ type="TCP",
+ timeout=1)
health_monitor = body['health_monitor']
# Verification of health_monitor update
- _, body = (self.client.update_health_monitor
- (health_monitor['id'],
- admin_state_up=False))
+ body = (self.client.update_health_monitor
+ (health_monitor['id'],
+ admin_state_up=False))
updated_health_monitor = body['health_monitor']
self.assertFalse(updated_health_monitor['admin_state_up'])
# Verification of health_monitor delete
- _, body = self.client.delete_health_monitor(health_monitor['id'])
+ body = self.client.delete_health_monitor(health_monitor['id'])
@test.attr(type='smoke')
def test_create_health_monitor_http_type(self):
hm_type = "HTTP"
- _, body = self.client.create_health_monitor(delay=4,
- max_retries=3,
- type=hm_type,
- timeout=1)
+ body = self.client.create_health_monitor(delay=4,
+ max_retries=3,
+ type=hm_type,
+ timeout=1)
health_monitor = body['health_monitor']
self.addCleanup(self.client.delete_health_monitor,
health_monitor['id'])
@@ -290,18 +290,18 @@
@test.attr(type='smoke')
def test_update_health_monitor_http_method(self):
- _, body = self.client.create_health_monitor(delay=4,
- max_retries=3,
- type="HTTP",
- timeout=1)
+ body = self.client.create_health_monitor(delay=4,
+ max_retries=3,
+ type="HTTP",
+ timeout=1)
health_monitor = body['health_monitor']
self.addCleanup(self.client.delete_health_monitor,
health_monitor['id'])
- _, body = (self.client.update_health_monitor
- (health_monitor['id'],
- http_method="POST",
- url_path="/home/user",
- expected_codes="290"))
+ body = (self.client.update_health_monitor
+ (health_monitor['id'],
+ http_method="POST",
+ url_path="/home/user",
+ expected_codes="290"))
updated_health_monitor = body['health_monitor']
self.assertEqual("POST", updated_health_monitor['http_method'])
self.assertEqual("/home/user", updated_health_monitor['url_path'])
@@ -310,7 +310,7 @@
@test.attr(type='smoke')
def test_show_health_monitor(self):
# Verifies the details of a health_monitor
- _, body = self.client.show_health_monitor(self.health_monitor['id'])
+ body = self.client.show_health_monitor(self.health_monitor['id'])
health_monitor = body['health_monitor']
for key, value in health_monitor.iteritems():
# 'status' should not be confirmed in api tests
@@ -320,12 +320,12 @@
@test.attr(type='smoke')
def test_associate_disassociate_health_monitor_with_pool(self):
# Verify that a health monitor can be associated with a pool
- _, body = (self.client.associate_health_monitor_with_pool
- (self.health_monitor['id'], self.pool['id']))
- resp, body = self.client.show_health_monitor(
+ self.client.associate_health_monitor_with_pool(
+ self.health_monitor['id'], self.pool['id'])
+ body = self.client.show_health_monitor(
self.health_monitor['id'])
health_monitor = body['health_monitor']
- resp, body = self.client.show_pool(self.pool['id'])
+ body = self.client.show_pool(self.pool['id'])
pool = body['pool']
self.assertIn(pool['id'],
[p['pool_id'] for p in health_monitor['pools']])
@@ -333,9 +333,9 @@
# Verify that a health monitor can be disassociated from a pool
(self.client.disassociate_health_monitor_with_pool
(self.health_monitor['id'], self.pool['id']))
- _, body = self.client.show_pool(self.pool['id'])
+ body = self.client.show_pool(self.pool['id'])
pool = body['pool']
- resp, body = self.client.show_health_monitor(
+ body = self.client.show_health_monitor(
self.health_monitor['id'])
health_monitor = body['health_monitor']
self.assertNotIn(health_monitor['id'], pool['health_monitors'])
@@ -345,7 +345,7 @@
@test.attr(type='smoke')
def test_get_lb_pool_stats(self):
# Verify the details of pool stats
- _, body = self.client.list_lb_pool_stats(self.pool['id'])
+ body = self.client.list_lb_pool_stats(self.pool['id'])
stats = body['stats']
self.assertIn("bytes_in", stats)
self.assertIn("total_connections", stats)
@@ -358,10 +358,10 @@
(self.health_monitor['id'], self.pool['id']))
self.client.update_health_monitor(
self.health_monitor['id'], admin_state_up=False)
- _, body = self.client.show_pool(self.pool['id'])
+ body = self.client.show_pool(self.pool['id'])
health_monitors = body['pool']['health_monitors']
for health_monitor_id in health_monitors:
- _, body = self.client.show_health_monitor(health_monitor_id)
+ body = self.client.show_health_monitor(health_monitor_id)
self.assertFalse(body['health_monitor']['admin_state_up'])
(self.client.disassociate_health_monitor_with_pool
(self.health_monitor['id'], self.pool['id']))
@@ -370,25 +370,25 @@
def test_update_admin_state_up_of_pool(self):
self.client.update_pool(self.pool['id'],
admin_state_up=False)
- _, body = self.client.show_pool(self.pool['id'])
+ body = self.client.show_pool(self.pool['id'])
pool = body['pool']
self.assertFalse(pool['admin_state_up'])
@test.attr(type='smoke')
def test_show_vip_associated_with_pool(self):
- _, body = self.client.show_pool(self.pool['id'])
+ body = self.client.show_pool(self.pool['id'])
pool = body['pool']
- _, body = self.client.show_vip(pool['vip_id'])
+ body = self.client.show_vip(pool['vip_id'])
vip = body['vip']
self.assertEqual(self.vip['name'], vip['name'])
self.assertEqual(self.vip['id'], vip['id'])
@test.attr(type='smoke')
def test_show_members_associated_with_pool(self):
- _, body = self.client.show_pool(self.pool['id'])
+ body = self.client.show_pool(self.pool['id'])
members = body['pool']['members']
for member_id in members:
- _, body = self.client.show_member(member_id)
+ body = self.client.show_member(member_id)
self.assertIsNotNone(body['member']['status'])
self.assertEqual(member_id, body['member']['id'])
self.assertIsNotNone(body['member']['admin_state_up'])
@@ -396,28 +396,28 @@
@test.attr(type='smoke')
def test_update_pool_related_to_member(self):
# Create new pool
- _, body = self.client.create_pool(name=data_utils.rand_name("pool-"),
- lb_method='ROUND_ROBIN',
- protocol='HTTP',
- subnet_id=self.subnet['id'])
+ body = self.client.create_pool(name=data_utils.rand_name("pool-"),
+ lb_method='ROUND_ROBIN',
+ protocol='HTTP',
+ subnet_id=self.subnet['id'])
new_pool = body['pool']
self.addCleanup(self.client.delete_pool, new_pool['id'])
# Update member with new pool's id
- _, body = self.client.update_member(self.member['id'],
- pool_id=new_pool['id'])
+ body = self.client.update_member(self.member['id'],
+ pool_id=new_pool['id'])
# Confirm with show that pool_id change
- resp, body = self.client.show_member(self.member['id'])
+ body = self.client.show_member(self.member['id'])
member = body['member']
self.assertEqual(member['pool_id'], new_pool['id'])
# Update member with old pool id, this is needed for clean up
- _, body = self.client.update_member(self.member['id'],
- pool_id=self.pool['id'])
+ body = self.client.update_member(self.member['id'],
+ pool_id=self.pool['id'])
@test.attr(type='smoke')
def test_update_member_weight(self):
self.client.update_member(self.member['id'],
weight=2)
- _, body = self.client.show_member(self.member['id'])
+ body = self.client.show_member(self.member['id'])
member = body['member']
self.assertEqual(2, member['weight'])
diff --git a/tempest/api/network/test_metering_extensions.py b/tempest/api/network/test_metering_extensions.py
index daf9948..6ba1ea4 100644
--- a/tempest/api/network/test_metering_extensions.py
+++ b/tempest/api/network/test_metering_extensions.py
@@ -23,7 +23,7 @@
LOG = logging.getLogger(__name__)
-class MeteringJSON(base.BaseAdminNetworkTest):
+class MeteringTestJSON(base.BaseAdminNetworkTest):
_interface = 'json'
"""
@@ -36,7 +36,7 @@
@classmethod
def resource_setup(cls):
- super(MeteringJSON, cls).resource_setup()
+ super(MeteringTestJSON, cls).resource_setup()
if not test.is_extension_enabled('metering', 'network'):
msg = "metering extension not enabled."
raise cls.skipException(msg)
@@ -52,25 +52,24 @@
def _delete_metering_label(self, metering_label_id):
# Deletes a label and verifies if it is deleted or not
- _, body = self.admin_client.delete_metering_label(metering_label_id)
+ self.admin_client.delete_metering_label(metering_label_id)
# Asserting that the label is not found in list after deletion
- resp, labels = (self.admin_client.list_metering_labels(
- id=metering_label_id))
+ labels = self.admin_client.list_metering_labels(id=metering_label_id)
self.assertEqual(len(labels['metering_labels']), 0)
def _delete_metering_label_rule(self, metering_label_rule_id):
# Deletes a rule and verifies if it is deleted or not
- _, body = (self.admin_client.delete_metering_label_rule(
- metering_label_rule_id))
+ self.admin_client.delete_metering_label_rule(
+ metering_label_rule_id)
# Asserting that the rule is not found in list after deletion
- resp, rules = (self.admin_client.list_metering_label_rules(
- id=metering_label_rule_id))
+ rules = (self.admin_client.list_metering_label_rules(
+ id=metering_label_rule_id))
self.assertEqual(len(rules['metering_label_rules']), 0)
@test.attr(type='smoke')
def test_list_metering_labels(self):
# Verify label filtering
- _, body = self.admin_client.list_metering_labels(id=33)
+ body = self.admin_client.list_metering_labels(id=33)
metering_labels = body['metering_labels']
self.assertEqual(0, len(metering_labels))
@@ -79,22 +78,21 @@
# Creates a label
name = data_utils.rand_name('metering-label-')
description = "label created by tempest"
- _, body = (self.admin_client.create_metering_label(name=name,
- description=description))
+ body = self.admin_client.create_metering_label(name=name,
+ description=description)
metering_label = body['metering_label']
self.addCleanup(self._delete_metering_label,
metering_label['id'])
# Assert whether created labels are found in labels list or fail
# if created labels are not found in labels list
- resp, labels = (self.admin_client.list_metering_labels(
- id=metering_label['id']))
+ labels = (self.admin_client.list_metering_labels(
+ id=metering_label['id']))
self.assertEqual(len(labels['metering_labels']), 1)
@test.attr(type='smoke')
def test_show_metering_label(self):
# Verifies the details of a label
- _, body = (self.admin_client.show_metering_label(
- self.metering_label['id']))
+ body = self.admin_client.show_metering_label(self.metering_label['id'])
metering_label = body['metering_label']
self.assertEqual(self.metering_label['id'], metering_label['id'])
self.assertEqual(self.metering_label['tenant_id'],
@@ -106,7 +104,7 @@
@test.attr(type='smoke')
def test_list_metering_label_rules(self):
# Verify rule filtering
- _, body = self.admin_client.list_metering_label_rules(id=33)
+ body = self.admin_client.list_metering_label_rules(id=33)
metering_label_rules = body['metering_label_rules']
self.assertEqual(0, len(metering_label_rules))
@@ -115,24 +113,24 @@
# Creates a rule
remote_ip_prefix = ("10.0.1.0/24" if self._ip_version == 4
else "fd03::/64")
- _, body = (self.admin_client.create_metering_label_rule(
- remote_ip_prefix=remote_ip_prefix,
- direction="ingress",
- metering_label_id=self.metering_label['id']))
+ body = (self.admin_client.create_metering_label_rule(
+ remote_ip_prefix=remote_ip_prefix,
+ direction="ingress",
+ metering_label_id=self.metering_label['id']))
metering_label_rule = body['metering_label_rule']
self.addCleanup(self._delete_metering_label_rule,
metering_label_rule['id'])
# Assert whether created rules are found in rules list or fail
# if created rules are not found in rules list
- resp, rules = (self.admin_client.list_metering_label_rules(
- id=metering_label_rule['id']))
+ rules = (self.admin_client.list_metering_label_rules(
+ id=metering_label_rule['id']))
self.assertEqual(len(rules['metering_label_rules']), 1)
@test.attr(type='smoke')
def test_show_metering_label_rule(self):
# Verifies the details of a rule
- _, body = (self.admin_client.show_metering_label_rule(
- self.metering_label_rule['id']))
+ body = (self.admin_client.show_metering_label_rule(
+ self.metering_label_rule['id']))
metering_label_rule = body['metering_label_rule']
self.assertEqual(self.metering_label_rule['id'],
metering_label_rule['id'])
@@ -145,5 +143,5 @@
self.assertFalse(metering_label_rule['excluded'])
-class MeteringIpV6JSON(MeteringJSON):
+class MeteringIpV6TestJSON(MeteringTestJSON):
_ip_version = 6
diff --git a/tempest/api/network/test_networks.py b/tempest/api/network/test_networks.py
index ccc489e..1f827da 100644
--- a/tempest/api/network/test_networks.py
+++ b/tempest/api/network/test_networks.py
@@ -160,7 +160,7 @@
self.assertEqual('ACTIVE', network['status'])
# Verify network update
new_name = "New_network"
- _, body = self.client.update_network(net_id, name=new_name)
+ body = self.client.update_network(net_id, name=new_name)
updated_net = body['network']
self.assertEqual(updated_net['name'], new_name)
# Find a cidr that is not in use yet and create a subnet with it
@@ -168,14 +168,14 @@
subnet_id = subnet['id']
# Verify subnet update
new_name = "New_subnet"
- _, body = self.client.update_subnet(subnet_id, name=new_name)
+ body = self.client.update_subnet(subnet_id, name=new_name)
updated_subnet = body['subnet']
self.assertEqual(updated_subnet['name'], new_name)
@test.attr(type='smoke')
def test_show_network(self):
# Verify the details of a network
- _, body = self.client.show_network(self.network['id'])
+ body = self.client.show_network(self.network['id'])
network = body['network']
for key in ['id', 'name']:
self.assertEqual(network[key], self.network[key])
@@ -184,8 +184,8 @@
def test_show_network_fields(self):
# Verify specific fields of a network
fields = ['id', 'name']
- _, body = self.client.show_network(self.network['id'],
- fields=fields)
+ body = self.client.show_network(self.network['id'],
+ fields=fields)
network = body['network']
self.assertEqual(sorted(network.keys()), sorted(fields))
for field_name in fields:
@@ -194,7 +194,7 @@
@test.attr(type='smoke')
def test_list_networks(self):
# Verify the network exists in the list of all networks
- _, body = self.client.list_networks()
+ body = self.client.list_networks()
networks = [network['id'] for network in body['networks']
if network['id'] == self.network['id']]
self.assertNotEmpty(networks, "Created network not found in the list")
@@ -203,7 +203,7 @@
def test_list_networks_fields(self):
# Verify specific fields of the networks
fields = ['id', 'name']
- _, body = self.client.list_networks(fields=fields)
+ body = self.client.list_networks(fields=fields)
networks = body['networks']
self.assertNotEmpty(networks, "Network list returned is empty")
for network in networks:
@@ -212,7 +212,7 @@
@test.attr(type='smoke')
def test_show_subnet(self):
# Verify the details of a subnet
- _, body = self.client.show_subnet(self.subnet['id'])
+ body = self.client.show_subnet(self.subnet['id'])
subnet = body['subnet']
self.assertNotEmpty(subnet, "Subnet returned has no fields")
for key in ['id', 'cidr']:
@@ -223,8 +223,8 @@
def test_show_subnet_fields(self):
# Verify specific fields of a subnet
fields = ['id', 'network_id']
- _, body = self.client.show_subnet(self.subnet['id'],
- fields=fields)
+ body = self.client.show_subnet(self.subnet['id'],
+ fields=fields)
subnet = body['subnet']
self.assertEqual(sorted(subnet.keys()), sorted(fields))
for field_name in fields:
@@ -233,7 +233,7 @@
@test.attr(type='smoke')
def test_list_subnets(self):
# Verify the subnet exists in the list of all subnets
- _, body = self.client.list_subnets()
+ body = self.client.list_subnets()
subnets = [subnet['id'] for subnet in body['subnets']
if subnet['id'] == self.subnet['id']]
self.assertNotEmpty(subnets, "Created subnet not found in the list")
@@ -242,7 +242,7 @@
def test_list_subnets_fields(self):
# Verify specific fields of subnets
fields = ['id', 'network_id']
- _, body = self.client.list_subnets(fields=fields)
+ body = self.client.list_subnets(fields=fields)
subnets = body['subnets']
self.assertNotEmpty(subnets, "Subnet list returned is empty")
for subnet in subnets:
@@ -260,7 +260,7 @@
def test_delete_network_with_subnet(self):
# Creates a network
name = data_utils.rand_name('network-')
- _, body = self.client.create_network(name=name)
+ body = self.client.create_network(name=name)
network = body['network']
net_id = network['id']
self.addCleanup(self._try_delete_network, net_id)
@@ -270,7 +270,7 @@
subnet_id = subnet['id']
# Delete network while the subnet still exists
- _, body = self.client.delete_network(net_id)
+ body = self.client.delete_network(net_id)
# Verify that the subnet got automatically deleted.
self.assertRaises(exceptions.NotFound, self.client.show_subnet,
@@ -331,8 +331,8 @@
'gateway_ip': new_gateway, 'enable_dhcp': True}
new_name = "New_subnet"
- _, body = self.client.update_subnet(subnet_id, name=new_name,
- **kwargs)
+ body = self.client.update_subnet(subnet_id, name=new_name,
+ **kwargs)
updated_subnet = body['subnet']
kwargs['name'] = new_name
self.assertEqual(sorted(updated_subnet['dns_nameservers']),
@@ -350,7 +350,7 @@
@test.attr(type='smoke')
def test_external_network_visibility(self):
"""Verifies user can see external networks but not subnets."""
- _, body = self.client.list_networks(**{'router:external': True})
+ body = self.client.list_networks(**{'router:external': True})
networks = [network['id'] for network in body['networks']]
self.assertNotEmpty(networks, "No external networks found")
@@ -364,7 +364,7 @@
# subnets_iter is a list (iterator) of lists. This flattens it to a
# list of UUIDs
public_subnets_iter = itertools.chain(*subnets_iter)
- _, body = self.client.list_subnets()
+ body = self.client.list_subnets()
subnets = [sub['id'] for sub in body['subnets']
if sub['id'] in public_subnets_iter]
self.assertEmpty(subnets, "Public subnets visible")
@@ -396,7 +396,7 @@
for n in created_networks:
self.client.delete_network(n['id'])
# Asserting that the networks are not found in the list after deletion
- resp, body = self.client.list_networks()
+ body = self.client.list_networks()
networks_list = [network['id'] for network in body['networks']]
for n in created_networks:
self.assertNotIn(n['id'], networks_list)
@@ -405,7 +405,7 @@
for n in created_subnets:
self.client.delete_subnet(n['id'])
# Asserting that the subnets are not found in the list after deletion
- resp, body = self.client.list_subnets()
+ body = self.client.list_subnets()
subnets_list = [subnet['id'] for subnet in body['subnets']]
for n in created_subnets:
self.assertNotIn(n['id'], subnets_list)
@@ -414,7 +414,7 @@
for n in created_ports:
self.client.delete_port(n['id'])
# Asserting that the ports are not found in the list after deletion
- resp, body = self.client.list_ports()
+ body = self.client.list_ports()
ports_list = [port['id'] for port in body['ports']]
for n in created_ports:
self.assertNotIn(n['id'], ports_list)
@@ -424,11 +424,11 @@
# Creates 2 networks in one request
network_names = [data_utils.rand_name('network-'),
data_utils.rand_name('network-')]
- _, body = self.client.create_bulk_network(network_names)
+ body = self.client.create_bulk_network(network_names)
created_networks = body['networks']
self.addCleanup(self._delete_networks, created_networks)
# Asserting that the networks are found in the list after creation
- resp, body = self.client.list_networks()
+ body = self.client.list_networks()
networks_list = [network['id'] for network in body['networks']]
for n in created_networks:
self.assertIsNotNone(n['id'])
@@ -455,11 +455,11 @@
}
subnets_list.append(p1)
del subnets_list[1]['name']
- _, body = self.client.create_bulk_subnet(subnets_list)
+ body = self.client.create_bulk_subnet(subnets_list)
created_subnets = body['subnets']
self.addCleanup(self._delete_subnets, created_subnets)
# Asserting that the subnets are found in the list after creation
- resp, body = self.client.list_subnets()
+ body = self.client.list_subnets()
subnets_list = [subnet['id'] for subnet in body['subnets']]
for n in created_subnets:
self.assertIsNotNone(n['id'])
@@ -480,11 +480,11 @@
}
port_list.append(p1)
del port_list[1]['name']
- _, body = self.client.create_bulk_port(port_list)
+ body = self.client.create_bulk_port(port_list)
created_ports = body['ports']
self.addCleanup(self._delete_ports, created_ports)
# Asserting that the ports are found in the list after creation
- resp, body = self.client.list_ports()
+ body = self.client.list_ports()
ports_list = [port['id'] for port in body['ports']]
for n in created_ports:
self.assertIsNotNone(n['id'])
@@ -534,7 +534,7 @@
# Verifies Subnet GW is None in IPv4
self.assertEqual(subnet2['gateway_ip'], None)
# Verifies all 2 subnets in the same network
- _, body = self.client.list_subnets()
+ body = self.client.list_subnets()
subnets = [sub['id'] for sub in body['subnets']
if sub['network_id'] == network['id']]
test_subnet_ids = [sub['id'] for sub in (subnet1, subnet2)]
diff --git a/tempest/api/network/test_ports.py b/tempest/api/network/test_ports.py
index d919f2e..80097db 100644
--- a/tempest/api/network/test_ports.py
+++ b/tempest/api/network/test_ports.py
@@ -45,23 +45,23 @@
def _delete_port(self, port_id):
self.client.delete_port(port_id)
- _, body = self.client.list_ports()
+ body = self.client.list_ports()
ports_list = body['ports']
self.assertFalse(port_id in [n['id'] for n in ports_list])
@test.attr(type='smoke')
def test_create_update_delete_port(self):
# Verify port creation
- _, body = self.client.create_port(network_id=self.network['id'])
+ body = self.client.create_port(network_id=self.network['id'])
port = body['port']
# Schedule port deletion with verification upon test completion
self.addCleanup(self._delete_port, port['id'])
self.assertTrue(port['admin_state_up'])
# Verify port update
new_name = "New_Port"
- _, body = self.client.update_port(port['id'],
- name=new_name,
- admin_state_up=False)
+ body = self.client.update_port(port['id'],
+ name=new_name,
+ admin_state_up=False)
updated_port = body['port']
self.assertEqual(updated_port['name'], new_name)
self.assertFalse(updated_port['admin_state_up'])
@@ -72,7 +72,7 @@
network2 = self.create_network(network_name=name)
network_list = [network1['id'], network2['id']]
port_list = [{'network_id': net_id} for net_id in network_list]
- _, body = self.client.create_bulk_port(port_list)
+ body = self.client.create_bulk_port(port_list)
created_ports = body['ports']
port1 = created_ports[0]
port2 = created_ports[1]
@@ -86,7 +86,7 @@
@test.attr(type='smoke')
def test_show_port(self):
# Verify the details of port
- _, body = self.client.show_port(self.port['id'])
+ body = self.client.show_port(self.port['id'])
port = body['port']
self.assertIn('id', port)
# TODO(Santosh)- This is a temporary workaround to compare create_port
@@ -100,8 +100,8 @@
def test_show_port_fields(self):
# Verify specific fields of a port
fields = ['id', 'mac_address']
- _, body = self.client.show_port(self.port['id'],
- fields=fields)
+ body = self.client.show_port(self.port['id'],
+ fields=fields)
port = body['port']
self.assertEqual(sorted(port.keys()), sorted(fields))
for field_name in fields:
@@ -110,7 +110,7 @@
@test.attr(type='smoke')
def test_list_ports(self):
# Verify the port exists in the list of all ports
- _, body = self.client.list_ports()
+ body = self.client.list_ports()
ports = [port['id'] for port in body['ports']
if port['id'] == self.port['id']]
self.assertNotEmpty(ports, "Created port not found in the list")
@@ -121,14 +121,14 @@
network = self.create_network()
self.create_subnet(network)
router = self.create_router(data_utils.rand_name('router-'))
- resp, port = self.client.create_port(network_id=network['id'])
+ port = self.client.create_port(network_id=network['id'])
# Add router interface to port created above
- resp, interface = self.client.add_router_interface_with_port_id(
+ self.client.add_router_interface_with_port_id(
router['id'], port['port']['id'])
self.addCleanup(self.client.remove_router_interface_with_port_id,
router['id'], port['port']['id'])
# List ports filtered by router_id
- _, port_list = self.client.list_ports(device_id=router['id'])
+ port_list = self.client.list_ports(device_id=router['id'])
ports = port_list['ports']
self.assertEqual(len(ports), 1)
self.assertEqual(ports[0]['id'], port['port']['id'])
@@ -138,7 +138,7 @@
def test_list_ports_fields(self):
# Verify specific fields of ports
fields = ['id', 'mac_address']
- _, body = self.client.list_ports(fields=fields)
+ body = self.client.list_ports(fields=fields)
ports = body['ports']
self.assertNotEmpty(ports, "Port list returned is empty")
# Asserting the fields returned are correct
@@ -173,20 +173,19 @@
self.create_subnet(self.network)
security_groups_list = list()
for name in security_groups_names:
- _, group_create_body = self.client.create_security_group(
+ group_create_body = self.client.create_security_group(
name=name)
self.addCleanup(self.client.delete_security_group,
group_create_body['security_group']['id'])
security_groups_list.append(group_create_body['security_group']
['id'])
# Create a port
- _, body = self.client.create_port(**post_body)
+ body = self.client.create_port(**post_body)
self.addCleanup(self.client.delete_port, body['port']['id'])
port = body['port']
# Update the port with security groups
update_body = {"security_groups": security_groups_list}
- _, body = self.client.update_port(
- port['id'], **update_body)
+ body = self.client.update_port(port['id'], **update_body)
# Verify the security groups updated to port
port_show = body['port']
for security_group in security_groups_list:
@@ -206,16 +205,16 @@
@test.attr(type='smoke')
def test_create_show_delete_port_user_defined_mac(self):
# Create a port for a legal mac
- _, body = self.client.create_port(network_id=self.network['id'])
+ body = self.client.create_port(network_id=self.network['id'])
old_port = body['port']
free_mac_address = old_port['mac_address']
self.client.delete_port(old_port['id'])
# Create a new port with user defined mac
- _, body = self.client.create_port(network_id=self.network['id'],
- mac_address=free_mac_address)
+ body = self.client.create_port(network_id=self.network['id'],
+ mac_address=free_mac_address)
self.addCleanup(self.client.delete_port, body['port']['id'])
port = body['port']
- _, body = self.client.show_port(port['id'])
+ body = self.client.show_port(port['id'])
show_port = body['port']
self.assertEqual(free_mac_address,
show_port['mac_address'])
@@ -253,7 +252,7 @@
def test_create_port_binding_ext_attr(self):
post_body = {"network_id": self.network['id'],
"binding:host_id": self.host_id}
- _, body = self.admin_client.create_port(**post_body)
+ body = self.admin_client.create_port(**post_body)
port = body['port']
self.addCleanup(self.admin_client.delete_port, port['id'])
host_id = port['binding:host_id']
@@ -263,11 +262,11 @@
@test.attr(type='smoke')
def test_update_port_binding_ext_attr(self):
post_body = {"network_id": self.network['id']}
- _, body = self.admin_client.create_port(**post_body)
+ body = self.admin_client.create_port(**post_body)
port = body['port']
self.addCleanup(self.admin_client.delete_port, port['id'])
update_body = {"binding:host_id": self.host_id}
- _, body = self.admin_client.update_port(port['id'], **update_body)
+ body = self.admin_client.update_port(port['id'], **update_body)
updated_port = body['port']
host_id = updated_port['binding:host_id']
self.assertIsNotNone(host_id)
@@ -277,7 +276,7 @@
def test_list_ports_binding_ext_attr(self):
# Create a new port
post_body = {"network_id": self.network['id']}
- _, body = self.admin_client.create_port(**post_body)
+ body = self.admin_client.create_port(**post_body)
port = body['port']
self.addCleanup(self.admin_client.delete_port, port['id'])
@@ -288,7 +287,7 @@
# List all ports, ensure new port is part of list and its binding
# attributes are set and accurate
- _, body = self.admin_client.list_ports()
+ body = self.admin_client.list_ports()
ports_list = body['ports']
pids_list = [p['id'] for p in ports_list]
self.assertIn(port['id'], pids_list)
@@ -300,10 +299,10 @@
@test.attr(type='smoke')
def test_show_port_binding_ext_attr(self):
- _, body = self.admin_client.create_port(network_id=self.network['id'])
+ body = self.admin_client.create_port(network_id=self.network['id'])
port = body['port']
self.addCleanup(self.admin_client.delete_port, port['id'])
- _, body = self.admin_client.show_port(port['id'])
+ body = self.admin_client.show_port(port['id'])
show_port = body['port']
self.assertEqual(port['binding:host_id'],
show_port['binding:host_id'])
diff --git a/tempest/api/network/test_routers.py b/tempest/api/network/test_routers.py
index 34650c5..5e8a851 100644
--- a/tempest/api/network/test_routers.py
+++ b/tempest/api/network/test_routers.py
@@ -57,7 +57,7 @@
# NOTE(salv-orlando): Do not invoke self.create_router
# as we need to check the response code
name = data_utils.rand_name('router-')
- _, create_body = self.client.create_router(
+ create_body = self.client.create_router(
name, external_gateway_info={
"network_id": CONF.network.public_network_id},
admin_state_up=False)
@@ -68,24 +68,24 @@
CONF.network.public_network_id)
self.assertEqual(create_body['router']['admin_state_up'], False)
# Show details of the created router
- _, show_body = self.client.show_router(create_body['router']['id'])
+ show_body = self.client.show_router(create_body['router']['id'])
self.assertEqual(show_body['router']['name'], name)
self.assertEqual(
show_body['router']['external_gateway_info']['network_id'],
CONF.network.public_network_id)
self.assertEqual(show_body['router']['admin_state_up'], False)
# List routers and verify if created router is there in response
- _, list_body = self.client.list_routers()
+ list_body = self.client.list_routers()
routers_list = list()
for router in list_body['routers']:
routers_list.append(router['id'])
self.assertIn(create_body['router']['id'], routers_list)
# Update the name of router and verify if it is updated
updated_name = 'updated ' + name
- _, update_body = self.client.update_router(create_body['router']['id'],
- name=updated_name)
+ update_body = self.client.update_router(create_body['router']['id'],
+ name=updated_name)
self.assertEqual(update_body['router']['name'], updated_name)
- resp, show_body = self.client.show_router(
+ show_body = self.client.show_router(
create_body['router']['id'])
self.assertEqual(show_body['router']['name'], updated_name)
@@ -100,8 +100,8 @@
self.addCleanup(self.identity_admin_client.delete_tenant, tenant_id)
name = data_utils.rand_name('router-')
- _, create_body = self.admin_client.create_router(name,
- tenant_id=tenant_id)
+ create_body = self.admin_client.create_router(name,
+ tenant_id=tenant_id)
self.addCleanup(self.admin_client.delete_router,
create_body['router']['id'])
self.assertEqual(tenant_id, create_body['router']['tenant_id'])
@@ -127,7 +127,7 @@
external_gateway_info = {
'network_id': CONF.network.public_network_id,
'enable_snat': enable_snat}
- _, create_body = self.admin_client.create_router(
+ create_body = self.admin_client.create_router(
name, external_gateway_info=external_gateway_info)
self.addCleanup(self.admin_client.delete_router,
create_body['router']['id'])
@@ -141,14 +141,14 @@
subnet = self.create_subnet(network)
router = self._create_router(data_utils.rand_name('router-'))
# Add router interface with subnet id
- _, interface = self.client.add_router_interface_with_subnet_id(
+ interface = self.client.add_router_interface_with_subnet_id(
router['id'], subnet['id'])
self.addCleanup(self._remove_router_interface_with_subnet_id,
router['id'], subnet['id'])
self.assertIn('subnet_id', interface.keys())
self.assertIn('port_id', interface.keys())
# Verify router id is equal to device id in port details
- resp, show_port_body = self.client.show_port(
+ show_port_body = self.client.show_port(
interface['port_id'])
self.assertEqual(show_port_body['port']['device_id'],
router['id'])
@@ -158,23 +158,23 @@
network = self.create_network()
self.create_subnet(network)
router = self._create_router(data_utils.rand_name('router-'))
- resp, port_body = self.client.create_port(
+ port_body = self.client.create_port(
network_id=network['id'])
# add router interface to port created above
- _, interface = self.client.add_router_interface_with_port_id(
+ interface = self.client.add_router_interface_with_port_id(
router['id'], port_body['port']['id'])
self.addCleanup(self._remove_router_interface_with_port_id,
router['id'], port_body['port']['id'])
self.assertIn('subnet_id', interface.keys())
self.assertIn('port_id', interface.keys())
# Verify router id is equal to device id in port details
- resp, show_port_body = self.client.show_port(
+ show_port_body = self.client.show_port(
interface['port_id'])
self.assertEqual(show_port_body['port']['device_id'],
router['id'])
def _verify_router_gateway(self, router_id, exp_ext_gw_info=None):
- _, show_body = self.admin_client.show_router(router_id)
+ show_body = self.admin_client.show_router(router_id)
actual_ext_gw_info = show_body['router']['external_gateway_info']
if exp_ext_gw_info is None:
self.assertIsNone(actual_ext_gw_info)
@@ -184,14 +184,14 @@
self.assertEqual(v, actual_ext_gw_info[k])
def _verify_gateway_port(self, router_id):
- resp, list_body = self.admin_client.list_ports(
+ list_body = self.admin_client.list_ports(
network_id=CONF.network.public_network_id,
device_id=router_id)
self.assertEqual(len(list_body['ports']), 1)
gw_port = list_body['ports'][0]
fixed_ips = gw_port['fixed_ips']
self.assertGreaterEqual(len(fixed_ips), 1)
- resp, public_net_body = self.admin_client.show_network(
+ public_net_body = self.admin_client.show_network(
CONF.network.public_network_id)
public_subnet_id = public_net_body['network']['subnets'][0]
self.assertIn(public_subnet_id,
@@ -205,7 +205,6 @@
external_gateway_info={
'network_id': CONF.network.public_network_id})
# Verify operation - router
- _, show_body = self.client.show_router(router['id'])
self._verify_router_gateway(
router['id'],
{'network_id': CONF.network.public_network_id})
@@ -249,7 +248,7 @@
self.client.update_router(router['id'], external_gateway_info={})
self._verify_router_gateway(router['id'])
# No gateway port expected
- resp, list_body = self.admin_client.list_ports(
+ list_body = self.admin_client.list_ports(
network_id=CONF.network.public_network_id,
device_id=router['id'])
self.assertFalse(list_body['ports'])
@@ -289,31 +288,31 @@
cidr = netaddr.IPNetwork(self.subnet['cidr'])
next_hop = str(cidr[2])
destination = str(self.subnet['cidr'])
- _, extra_route = self.client.update_extra_routes(self.router['id'],
- next_hop, destination)
+ extra_route = self.client.update_extra_routes(self.router['id'],
+ next_hop, destination)
self.assertEqual(1, len(extra_route['router']['routes']))
self.assertEqual(destination,
extra_route['router']['routes'][0]['destination'])
self.assertEqual(next_hop,
extra_route['router']['routes'][0]['nexthop'])
- _, show_body = self.client.show_router(self.router['id'])
+ show_body = self.client.show_router(self.router['id'])
self.assertEqual(destination,
show_body['router']['routes'][0]['destination'])
self.assertEqual(next_hop,
show_body['router']['routes'][0]['nexthop'])
def _delete_extra_routes(self, router_id):
- resp, _ = self.client.delete_extra_routes(router_id)
+ self.client.delete_extra_routes(router_id)
@test.attr(type='smoke')
def test_update_router_admin_state(self):
self.router = self._create_router(data_utils.rand_name('router-'))
self.assertFalse(self.router['admin_state_up'])
# Update router admin state
- _, update_body = self.client.update_router(self.router['id'],
- admin_state_up=True)
+ update_body = self.client.update_router(self.router['id'],
+ admin_state_up=True)
self.assertTrue(update_body['router']['admin_state_up'])
- _, show_body = self.client.show_router(self.router['id'])
+ show_body = self.client.show_router(self.router['id'])
self.assertTrue(show_body['router']['admin_state_up'])
@test.attr(type='smoke')
@@ -336,7 +335,7 @@
interface02['port_id'])
def _verify_router_interface(self, router_id, subnet_id, port_id):
- _, show_port_body = self.client.show_port(port_id)
+ show_port_body = self.client.show_port(port_id)
interface_port = show_port_body['port']
self.assertEqual(router_id, interface_port['device_id'])
self.assertEqual(subnet_id,
diff --git a/tempest/api/network/test_security_groups.py b/tempest/api/network/test_security_groups.py
index b995b1d..415dedd 100644
--- a/tempest/api/network/test_security_groups.py
+++ b/tempest/api/network/test_security_groups.py
@@ -42,7 +42,7 @@
remote_ip_prefix=None):
# Create Security Group rule with the input params and validate
# that SG rule is created with the same parameters.
- resp, rule_create_body = self.client.create_security_group_rule(
+ rule_create_body = self.client.create_security_group_rule(
security_group_id=sg_id,
direction=direction,
ethertype=ethertype,
@@ -71,7 +71,7 @@
@test.attr(type='smoke')
def test_list_security_groups(self):
# Verify the that security group belonging to tenant exist in list
- _, body = self.client.list_security_groups()
+ body = self.client.list_security_groups()
security_groups = body['security_groups']
found = None
for n in security_groups:
@@ -85,7 +85,7 @@
group_create_body, name = self._create_security_group()
# List security groups and verify if created group is there in response
- _, list_body = self.client.list_security_groups()
+ list_body = self.client.list_security_groups()
secgroup_list = list()
for secgroup in list_body['security_groups']:
secgroup_list.append(secgroup['id'])
@@ -93,7 +93,7 @@
# Update the security group
new_name = data_utils.rand_name('security-')
new_description = data_utils.rand_name('security-description')
- _, update_body = self.client.update_security_group(
+ update_body = self.client.update_security_group(
group_create_body['security_group']['id'],
name=new_name,
description=new_description)
@@ -102,7 +102,7 @@
self.assertEqual(update_body['security_group']['description'],
new_description)
# Show details of the updated security group
- resp, show_body = self.client.show_security_group(
+ show_body = self.client.show_security_group(
group_create_body['security_group']['id'])
self.assertEqual(show_body['security_group']['name'], new_name)
self.assertEqual(show_body['security_group']['description'],
@@ -115,7 +115,7 @@
# Create rules for each protocol
protocols = ['tcp', 'udp', 'icmp']
for protocol in protocols:
- _, rule_create_body = self.client.create_security_group_rule(
+ rule_create_body = self.client.create_security_group_rule(
security_group_id=group_create_body['security_group']['id'],
protocol=protocol,
direction='ingress',
@@ -123,7 +123,7 @@
)
# Show details of the created security rule
- _, show_rule_body = self.client.show_security_group_rule(
+ show_rule_body = self.client.show_security_group_rule(
rule_create_body['security_group_rule']['id']
)
create_dict = rule_create_body['security_group_rule']
@@ -133,7 +133,7 @@
"%s does not match." % key)
# List rules and verify created rule is in response
- _, rule_list_body = self.client.list_security_group_rules()
+ rule_list_body = self.client.list_security_group_rules()
rule_list = [rule['id']
for rule in rule_list_body['security_group_rules']]
self.assertIn(rule_create_body['security_group_rule']['id'],
@@ -221,7 +221,7 @@
direction = 'ingress'
protocol = 17
security_group_id = group_create_body['security_group']['id']
- _, rule_create_body = self.client.create_security_group_rule(
+ rule_create_body = self.client.create_security_group_rule(
security_group_id=security_group_id,
direction=direction,
protocol=protocol
diff --git a/tempest/api/network/test_security_groups_negative.py b/tempest/api/network/test_security_groups_negative.py
index b9e8666..fb51e30 100644
--- a/tempest/api/network/test_security_groups_negative.py
+++ b/tempest/api/network/test_security_groups_negative.py
@@ -164,7 +164,7 @@
min_port = 66
max_port = 67
# Create a rule with valid params
- resp, _ = self.client.create_security_group_rule(
+ self.client.create_security_group_rule(
security_group_id=body['security_group']['id'],
direction='ingress',
ethertype=self.ethertype,
@@ -193,3 +193,22 @@
class NegativeSecGroupIPv6Test(NegativeSecGroupTest):
_ip_version = 6
_tenant_network_cidr = CONF.network.tenant_network_v6_cidr
+
+ @test.attr(type=['negative', 'gate'])
+ def test_create_security_group_rule_wrong_ip_prefix_version(self):
+ group_create_body, _ = self._create_security_group()
+
+ # Create rule with bad remote_ip_prefix
+ pairs = ({'ethertype': 'IPv6',
+ 'ip_prefix': CONF.network.tenant_network_cidr},
+ {'ethertype': 'IPv4',
+ 'ip_prefix': CONF.network.tenant_network_v6_cidr})
+ for pair in pairs:
+ self.assertRaisesRegexp(
+ exceptions.BadRequest,
+ "Conflicting value ethertype",
+ self.client.create_security_group_rule,
+ security_group_id=group_create_body['security_group']['id'],
+ protocol='tcp', direction='ingress',
+ ethertype=pair['ethertype'],
+ remote_ip_prefix=pair['ip_prefix'])
diff --git a/tempest/api/network/test_service_type_management.py b/tempest/api/network/test_service_type_management.py
index 7f8b479..447c3f3 100644
--- a/tempest/api/network/test_service_type_management.py
+++ b/tempest/api/network/test_service_type_management.py
@@ -27,5 +27,5 @@
@test.skip_because(bug="1400370")
@test.attr(type='smoke')
def test_service_provider_list(self):
- _, body = self.client.list_service_providers()
+ body = self.client.list_service_providers()
self.assertIsInstance(body['service_providers'], list)
diff --git a/tempest/api/network/test_vpnaas_extensions.py b/tempest/api/network/test_vpnaas_extensions.py
index 46f10c4..56e1a05 100644
--- a/tempest/api/network/test_vpnaas_extensions.py
+++ b/tempest/api/network/test_vpnaas_extensions.py
@@ -57,13 +57,13 @@
def _delete_ike_policy(self, ike_policy_id):
# Deletes a ike policy and verifies if it is deleted or not
ike_list = list()
- resp, all_ike = self.client.list_ikepolicies()
+ all_ike = self.client.list_ikepolicies()
for ike in all_ike['ikepolicies']:
ike_list.append(ike['id'])
if ike_policy_id in ike_list:
self.client.delete_ikepolicy(ike_policy_id)
# Asserting that the policy is not found in list after deletion
- resp, ikepolicies = self.client.list_ikepolicies()
+ ikepolicies = self.client.list_ikepolicies()
ike_id_list = list()
for i in ikepolicies['ikepolicies']:
ike_id_list.append(i['id'])
@@ -86,7 +86,7 @@
def _delete_vpn_service(self, vpn_service_id):
self.client.delete_vpnservice(vpn_service_id)
# Asserting if vpn service is found in the list after deletion
- _, body = self.client.list_vpnservices()
+ body = self.client.list_vpnservices()
vpn_services = [vs['id'] for vs in body['vpnservices']]
self.assertNotIn(vpn_service_id, vpn_services)
@@ -97,7 +97,7 @@
# TODO(jroovers) This is a temporary workaround to get the tenant_id
# of the the current client. Replace this once tenant_isolation for
# neutron is fixed.
- _, body = self.client.show_network(self.network['id'])
+ body = self.client.show_network(self.network['id'])
return body['network']['tenant_id']
@test.attr(type='smoke')
@@ -105,15 +105,15 @@
tenant_id = self._get_tenant_id()
# Create IPSec policy for the newly created tenant
name = data_utils.rand_name('ipsec-policy')
- _, body = (self.admin_client.
- create_ipsecpolicy(name=name, tenant_id=tenant_id))
+ body = (self.admin_client.
+ create_ipsecpolicy(name=name, tenant_id=tenant_id))
ipsecpolicy = body['ipsecpolicy']
self.assertIsNotNone(ipsecpolicy['id'])
self.addCleanup(self.admin_client.delete_ipsecpolicy,
ipsecpolicy['id'])
# Assert that created ipsec policy is found in API list call
- _, body = self.client.list_ipsecpolicies()
+ body = self.client.list_ipsecpolicies()
ipsecpolicies = [policy['id'] for policy in body['ipsecpolicies']]
self.assertIn(ipsecpolicy['id'], ipsecpolicies)
@@ -128,7 +128,7 @@
external_network_id=self.ext_net_id)
self.create_router_interface(router2['id'], subnet2['id'])
name = data_utils.rand_name('vpn-service')
- _, body = self.admin_client.create_vpnservice(
+ body = self.admin_client.create_vpnservice(
subnet_id=subnet2['id'],
router_id=router2['id'],
name=name,
@@ -138,7 +138,7 @@
self.assertIsNotNone(vpnservice['id'])
self.addCleanup(self.admin_client.delete_vpnservice, vpnservice['id'])
# Assert that created vpnservice is found in API list call
- _, body = self.client.list_vpnservices()
+ body = self.client.list_vpnservices()
vpn_services = [vs['id'] for vs in body['vpnservices']]
self.assertIn(vpnservice['id'], vpn_services)
@@ -148,24 +148,24 @@
# Create IKE policy for the newly created tenant
name = data_utils.rand_name('ike-policy')
- _, body = (self.admin_client.
- create_ikepolicy(name=name, ike_version="v1",
- encryption_algorithm="aes-128",
- auth_algorithm="sha1",
- tenant_id=tenant_id))
+ body = (self.admin_client.
+ create_ikepolicy(name=name, ike_version="v1",
+ encryption_algorithm="aes-128",
+ auth_algorithm="sha1",
+ tenant_id=tenant_id))
ikepolicy = body['ikepolicy']
self.assertIsNotNone(ikepolicy['id'])
self.addCleanup(self.admin_client.delete_ikepolicy, ikepolicy['id'])
# Assert that created ike policy is found in API list call
- _, body = self.client.list_ikepolicies()
+ body = self.client.list_ikepolicies()
ikepolicies = [ikp['id'] for ikp in body['ikepolicies']]
self.assertIn(ikepolicy['id'], ikepolicies)
@test.attr(type='smoke')
def test_list_vpn_services(self):
# Verify the VPN service exists in the list of all VPN services
- _, body = self.client.list_vpnservices()
+ body = self.client.list_vpnservices()
vpnservices = body['vpnservices']
self.assertIn(self.vpnservice['id'], [v['id'] for v in vpnservices])
@@ -178,14 +178,14 @@
external_network_id=self.ext_net_id)
self.create_router_interface(router1['id'], subnet1['id'])
name = data_utils.rand_name('vpn-service1')
- _, body = self.client.create_vpnservice(subnet_id=subnet1['id'],
- router_id=router1['id'],
- name=name,
- admin_state_up=True)
+ body = self.client.create_vpnservice(subnet_id=subnet1['id'],
+ router_id=router1['id'],
+ name=name,
+ admin_state_up=True)
vpnservice = body['vpnservice']
self.addCleanup(self._delete_vpn_service, vpnservice['id'])
# Assert if created vpnservices are not found in vpnservices list
- resp, body = self.client.list_vpnservices()
+ body = self.client.list_vpnservices()
vpn_services = [vs['id'] for vs in body['vpnservices']]
self.assertIsNotNone(vpnservice['id'])
self.assertIn(vpnservice['id'], vpn_services)
@@ -198,7 +198,7 @@
@test.attr(type='smoke')
def test_show_vpn_service(self):
# Verifies the details of a vpn service
- _, body = self.client.show_vpnservice(self.vpnservice['id'])
+ body = self.client.show_vpnservice(self.vpnservice['id'])
vpnservice = body['vpnservice']
self.assertEqual(self.vpnservice['id'], vpnservice['id'])
self.assertEqual(self.vpnservice['name'], vpnservice['name'])
@@ -214,7 +214,7 @@
@test.attr(type='smoke')
def test_list_ike_policies(self):
# Verify the ike policy exists in the list of all IKE policies
- _, body = self.client.list_ikepolicies()
+ body = self.client.list_ikepolicies()
ikepolicies = body['ikepolicies']
self.assertIn(self.ikepolicy['id'], [i['id'] for i in ikepolicies])
@@ -222,11 +222,11 @@
def test_create_update_delete_ike_policy(self):
# Creates a IKE policy
name = data_utils.rand_name('ike-policy')
- _, body = (self.client.create_ikepolicy(
- name=name,
- ike_version="v1",
- encryption_algorithm="aes-128",
- auth_algorithm="sha1"))
+ body = (self.client.create_ikepolicy(
+ name=name,
+ ike_version="v1",
+ encryption_algorithm="aes-128",
+ auth_algorithm="sha1"))
ikepolicy = body['ikepolicy']
self.assertIsNotNone(ikepolicy['id'])
self.addCleanup(self._delete_ike_policy, ikepolicy['id'])
@@ -240,7 +240,7 @@
'lifetime': {'units': "seconds", 'value': 2000}}
self.client.update_ikepolicy(ikepolicy['id'], **new_ike)
# Confirm that update was successful by verifying using 'show'
- _, body = self.client.show_ikepolicy(ikepolicy['id'])
+ body = self.client.show_ikepolicy(ikepolicy['id'])
ike_policy = body['ikepolicy']
for key, value in new_ike.iteritems():
self.assertIn(key, ike_policy)
@@ -248,14 +248,14 @@
# Verification of ike policy delete
self.client.delete_ikepolicy(ikepolicy['id'])
- _, body = self.client.list_ikepolicies()
+ body = self.client.list_ikepolicies()
ikepolicies = [ikp['id'] for ikp in body['ikepolicies']]
self.assertNotIn(ike_policy['id'], ikepolicies)
@test.attr(type='smoke')
def test_show_ike_policy(self):
# Verifies the details of a ike policy
- _, body = self.client.show_ikepolicy(self.ikepolicy['id'])
+ body = self.client.show_ikepolicy(self.ikepolicy['id'])
ikepolicy = body['ikepolicy']
self.assertEqual(self.ikepolicy['id'], ikepolicy['id'])
self.assertEqual(self.ikepolicy['name'], ikepolicy['name'])
@@ -277,7 +277,7 @@
@test.attr(type='smoke')
def test_list_ipsec_policies(self):
# Verify the ipsec policy exists in the list of all ipsec policies
- _, body = self.client.list_ipsecpolicies()
+ body = self.client.list_ipsecpolicies()
ipsecpolicies = body['ipsecpolicies']
self.assertIn(self.ipsecpolicy['id'], [i['id'] for i in ipsecpolicies])
@@ -288,7 +288,7 @@
'pfs': 'group5',
'encryption_algorithm': "aes-128",
'auth_algorithm': 'sha1'}
- _, resp_body = self.client.create_ipsecpolicy(**ipsec_policy_body)
+ resp_body = self.client.create_ipsecpolicy(**ipsec_policy_body)
ipsecpolicy = resp_body['ipsecpolicy']
self.addCleanup(self._delete_ipsec_policy, ipsecpolicy['id'])
self._assertExpected(ipsec_policy_body, ipsecpolicy)
@@ -298,8 +298,8 @@
'name': data_utils.rand_name("New-IPSec"),
'encryption_algorithm': "aes-256",
'lifetime': {'units': "seconds", 'value': '2000'}}
- _, body = self.client.update_ipsecpolicy(ipsecpolicy['id'],
- **new_ipsec)
+ body = self.client.update_ipsecpolicy(ipsecpolicy['id'],
+ **new_ipsec)
updated_ipsec_policy = body['ipsecpolicy']
self._assertExpected(new_ipsec, updated_ipsec_policy)
# Verification of ipsec policy delete
@@ -310,6 +310,6 @@
@test.attr(type='smoke')
def test_show_ipsec_policy(self):
# Verifies the details of an ipsec policy
- _, body = self.client.show_ipsecpolicy(self.ipsecpolicy['id'])
+ body = self.client.show_ipsecpolicy(self.ipsecpolicy['id'])
ipsecpolicy = body['ipsecpolicy']
self._assertExpected(self.ipsecpolicy, ipsecpolicy)
diff --git a/tempest/api/orchestration/base.py b/tempest/api/orchestration/base.py
index 5a586fc..6896362 100644
--- a/tempest/api/orchestration/base.py
+++ b/tempest/api/orchestration/base.py
@@ -51,7 +51,7 @@
@classmethod
def _get_default_network(cls):
- _, networks = cls.network_client.list_networks()
+ networks = cls.network_client.list_networks()
for net in networks['networks']:
if net['name'] == CONF.compute.fixed_network_name:
return net
diff --git a/tempest/api/orchestration/stacks/test_neutron_resources.py b/tempest/api/orchestration/stacks/test_neutron_resources.py
index f1a4f85..8352719 100644
--- a/tempest/api/orchestration/stacks/test_neutron_resources.py
+++ b/tempest/api/orchestration/stacks/test_neutron_resources.py
@@ -107,7 +107,7 @@
def test_created_network(self):
"""Verifies created network."""
network_id = self.test_resources.get('Network')['physical_resource_id']
- _, body = self.network_client.show_network(network_id)
+ body = self.network_client.show_network(network_id)
network = body['network']
self.assertIsInstance(network, dict)
self.assertEqual(network_id, network['id'])
@@ -119,7 +119,7 @@
def test_created_subnet(self):
"""Verifies created subnet."""
subnet_id = self.test_resources.get('Subnet')['physical_resource_id']
- _, body = self.network_client.show_subnet(subnet_id)
+ body = self.network_client.show_subnet(subnet_id)
subnet = body['subnet']
network_id = self.test_resources.get('Network')['physical_resource_id']
self.assertEqual(subnet_id, subnet['id'])
@@ -137,7 +137,7 @@
def test_created_router(self):
"""Verifies created router."""
router_id = self.test_resources.get('Router')['physical_resource_id']
- _, body = self.network_client.show_router(router_id)
+ body = self.network_client.show_router(router_id)
router = body['router']
self.assertEqual(self.neutron_basic_template['resources'][
'Router']['properties']['name'], router['name'])
@@ -152,7 +152,7 @@
router_id = self.test_resources.get('Router')['physical_resource_id']
network_id = self.test_resources.get('Network')['physical_resource_id']
subnet_id = self.test_resources.get('Subnet')['physical_resource_id']
- _, body = self.network_client.list_ports()
+ body = self.network_client.list_ports()
ports = body['ports']
router_ports = filter(lambda port: port['device_id'] ==
router_id, ports)
diff --git a/tempest/api/volume/test_volumes_snapshots.py b/tempest/api/volume/test_volumes_snapshots.py
index 21d0a86..b7e9422 100644
--- a/tempest/api/volume/test_volumes_snapshots.py
+++ b/tempest/api/volume/test_volumes_snapshots.py
@@ -70,11 +70,14 @@
self.addCleanup(self.servers_client.delete_server, server['id'])
self.servers_client.wait_for_server_status(server['id'], 'ACTIVE')
mountpoint = '/dev/%s' % CONF.compute.volume_device_name
- _, body = self.volumes_client.attach_volume(
- self.volume_origin['id'], server['id'], mountpoint)
+ _, body = self.servers_client.attach_volume(
+ server['id'], self.volume_origin['id'], mountpoint)
self.volumes_client.wait_for_volume_status(self.volume_origin['id'],
'in-use')
- self.addCleanup(self._detach, self.volume_origin['id'])
+ self.addCleanup(self.volumes_client.wait_for_volume_status,
+ self.volume_origin['id'], 'available')
+ self.addCleanup(self.servers_client.detach_volume, server['id'],
+ self.volume_origin['id'])
# Snapshot a volume even if it's attached to an instance
snapshot = self.create_snapshot(self.volume_origin['id'],
force=True)
diff --git a/tempest/auth.py b/tempest/auth.py
index 022a450..2550cfb 100644
--- a/tempest/auth.py
+++ b/tempest/auth.py
@@ -561,7 +561,10 @@
raise exceptions.InvalidCredentials()
creds = cls._get_default(credentials_type)
if not creds.is_valid():
- raise exceptions.InvalidConfiguration()
+ msg = ("The %s credentials are incorrectly set in the config file."
+ " Double check that all required values are assigned" %
+ credentials_type)
+ raise exceptions.InvalidConfiguration(msg)
return creds
@classmethod
diff --git a/tempest/cmd/cleanup.py b/tempest/cmd/cleanup.py
index f36ef56..28f0aa8 100755
--- a/tempest/cmd/cleanup.py
+++ b/tempest/cmd/cleanup.py
@@ -19,18 +19,18 @@
Runtime Arguments
-----------------
---init-saved-state: Before you can execute cleanup you must initialize
-the saved state by running it with the --init-saved-state flag
+**--init-saved-state**: Before you can execute cleanup you must initialize
+the saved state by running it with the **--init-saved-state** flag
(creating ./saved_state.json), which protects your deployment from
cleanup deleting objects you want to keep. Typically you would run
-cleanup with --init-saved-state prior to a tempest run. If this is not
+cleanup with **--init-saved-state** prior to a tempest run. If this is not
the case saved_state.json must be edited, removing objects you want
cleanup to delete.
---dry-run: Creates a report (dry_run.json) of the tenants that will be
+**--dry-run**: Creates a report (dry_run.json) of the tenants that will be
cleaned up (in the "_tenants_to_clean" array), and the global objects
that will be removed (tenants, users, flavors and images). Once
-cleanup is executed in normal mode, running it again with --dry-run
+cleanup is executed in normal mode, running it again with **--dry-run**
should yield an empty report.
**NOTE**: The _tenants_to_clean array in dry-run.json lists the
@@ -38,17 +38,17 @@
delete the tenant itself. This may differ from the tenants array as you
can clean the tempest and alternate tempest tenants but by default,
cleanup deletes the objects in the tempest and alternate tempest tenants
-but does not delete those tenants unless the --delete-tempest-conf-objects
+but does not delete those tenants unless the **--delete-tempest-conf-objects**
flag is used to force their deletion.
**Normal mode**: running with no arguments, will query your deployment and
build a list of objects to delete after filtering out the objects found in
-saved_state.json and based on the --delete-tempest-conf-objects flag.
+saved_state.json and based on the **--delete-tempest-conf-objects** flag.
By default the tempest and alternate tempest users and tenants are not
deleted and the admin user specified in tempest.conf is never deleted.
-Please run with --help to see full list of options.
+Please run with **--help** to see full list of options.
"""
import argparse
import json
diff --git a/tempest/cmd/cleanup_service.py b/tempest/cmd/cleanup_service.py
index 67843e6..db862c7 100644
--- a/tempest/cmd/cleanup_service.py
+++ b/tempest/cmd/cleanup_service.py
@@ -85,7 +85,7 @@
net_cl = am.network_client
id_cl = am.identity_client
- _, networks = net_cl.list_networks()
+ networks = net_cl.list_networks()
tenant = id_cl.get_tenant_by_name(tenant_name)
t_id = tenant['id']
n_id = None
@@ -357,7 +357,7 @@
def list(self):
client = self.client
- _, networks = client.list_networks()
+ networks = client.list_networks()
networks = self._filter_by_tenant_id(networks['networks'])
# filter out networks declared in tempest.conf
if self.is_preserve:
@@ -385,7 +385,7 @@
def list(self):
client = self.client
- _, ipsecpols = client.list_ipsecpolicies()
+ ipsecpols = client.list_ipsecpolicies()
ipsecpols = ipsecpols['ipsecpolicies']
ipsecpols = self._filter_by_tenant_id(ipsecpols)
LOG.debug("List count, %s IP Security Policies" % len(ipsecpols))
@@ -410,7 +410,7 @@
def list(self):
client = self.client
- _, fwpols = client.list_firewall_policies()
+ fwpols = client.list_firewall_policies()
fwpols = fwpols['firewall_policies']
fwpols = self._filter_by_tenant_id(fwpols)
LOG.debug("List count, %s Firewall Policies" % len(fwpols))
@@ -435,7 +435,7 @@
def list(self):
client = self.client
- _, fwrules = client.list_firewall_rules()
+ fwrules = client.list_firewall_rules()
fwrules = fwrules['firewall_rules']
fwrules = self._filter_by_tenant_id(fwrules)
LOG.debug("List count, %s Firewall Rules" % len(fwrules))
@@ -460,7 +460,7 @@
def list(self):
client = self.client
- _, ikepols = client.list_ikepolicies()
+ ikepols = client.list_ikepolicies()
ikepols = ikepols['ikepolicies']
ikepols = self._filter_by_tenant_id(ikepols)
LOG.debug("List count, %s IKE Policies" % len(ikepols))
@@ -485,7 +485,7 @@
def list(self):
client = self.client
- _, vpnsrvs = client.list_vpnservices()
+ vpnsrvs = client.list_vpnservices()
vpnsrvs = vpnsrvs['vpnservices']
vpnsrvs = self._filter_by_tenant_id(vpnsrvs)
LOG.debug("List count, %s VPN Services" % len(vpnsrvs))
@@ -510,7 +510,7 @@
def list(self):
client = self.client
- _, flips = client.list_floatingips()
+ flips = client.list_floatingips()
flips = flips['floatingips']
flips = self._filter_by_tenant_id(flips)
LOG.debug("List count, %s Network Floating IPs" % len(flips))
@@ -535,7 +535,7 @@
def list(self):
client = self.client
- _, routers = client.list_routers()
+ routers = client.list_routers()
routers = routers['routers']
routers = self._filter_by_tenant_id(routers)
if self.is_preserve:
@@ -551,7 +551,7 @@
for router in routers:
try:
rid = router['id']
- _, ports = client.list_router_interfaces(rid)
+ ports = client.list_router_interfaces(rid)
ports = ports['ports']
for port in ports:
subid = port['fixed_ips'][0]['subnet_id']
@@ -570,7 +570,7 @@
def list(self):
client = self.client
- _, hms = client.list_health_monitors()
+ hms = client.list_health_monitors()
hms = hms['health_monitors']
hms = self._filter_by_tenant_id(hms)
LOG.debug("List count, %s Health Monitors" % len(hms))
@@ -595,7 +595,7 @@
def list(self):
client = self.client
- _, members = client.list_members()
+ members = client.list_members()
members = members['members']
members = self._filter_by_tenant_id(members)
LOG.debug("List count, %s Members" % len(members))
@@ -620,7 +620,7 @@
def list(self):
client = self.client
- _, vips = client.list_vips()
+ vips = client.list_vips()
vips = vips['vips']
vips = self._filter_by_tenant_id(vips)
LOG.debug("List count, %s VIPs" % len(vips))
@@ -645,7 +645,7 @@
def list(self):
client = self.client
- _, pools = client.list_pools()
+ pools = client.list_pools()
pools = pools['pools']
pools = self._filter_by_tenant_id(pools)
LOG.debug("List count, %s Pools" % len(pools))
@@ -670,7 +670,7 @@
def list(self):
client = self.client
- _, rules = client.list_metering_label_rules()
+ rules = client.list_metering_label_rules()
rules = rules['metering_label_rules']
rules = self._filter_by_tenant_id(rules)
LOG.debug("List count, %s Metering Label Rules" % len(rules))
@@ -695,7 +695,7 @@
def list(self):
client = self.client
- _, labels = client.list_metering_labels()
+ labels = client.list_metering_labels()
labels = labels['metering_labels']
labels = self._filter_by_tenant_id(labels)
LOG.debug("List count, %s Metering Labels" % len(labels))
@@ -720,7 +720,7 @@
def list(self):
client = self.client
- _, ports = client.list_ports()
+ ports = client.list_ports()
ports = ports['ports']
ports = self._filter_by_tenant_id(ports)
if self.is_preserve:
@@ -747,7 +747,7 @@
def list(self):
client = self.client
- _, subnets = client.list_subnets()
+ subnets = client.list_subnets()
subnets = subnets['subnets']
subnets = self._filter_by_tenant_id(subnets)
if self.is_preserve:
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index 6879db9..97aa62b 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -509,15 +509,10 @@
def _get_router_namespace(client, network):
network_id = _get_resource_by_name(client.networks,
'networks', network)['id']
- resp, n_body = client.networks.list_routers()
- if not resp_ok(resp):
- raise ValueError("unable to routers list: [%s] %s" % (resp, n_body))
+ n_body = client.networks.list_routers()
for router in n_body['routers']:
router_id = router['id']
- resp, r_body = client.networks.list_router_interfaces(router_id)
- if not resp_ok(resp):
- raise ValueError("unable to router interfaces list: [%s] %s" %
- (resp, r_body))
+ r_body = client.networks.list_router_interfaces(router_id)
for port in r_body['ports']:
if port['network_id'] == network_id:
return "qrouter-%s" % router_id
@@ -527,9 +522,12 @@
get_resources = getattr(client, 'list_%s' % resource)
if get_resources is None:
raise AttributeError("client doesn't have method list_%s" % resource)
- r, body = get_resources()
- if not resp_ok(r):
- raise ValueError("unable to list %s: [%s] %s" % (resource, r, body))
+ # Until all tempest client methods are changed to return only one value,
+ # we cannot assume they all have the same signature so we need to discard
+ # the unused response first value it two values are being returned.
+ body = get_resources()
+ if type(body) == tuple:
+ body = body[1]
if isinstance(body, dict):
body = body[resource]
for res in body:
@@ -544,7 +542,7 @@
client = client_for_user(network['owner'])
# only create a network if the name isn't here
- r, body = client.networks.list_networks()
+ body = client.networks.list_networks()
if any(item['name'] == network['name'] for item in body['networks']):
LOG.warning("Dupplicated network name: %s" % network['name'])
continue
@@ -596,7 +594,7 @@
client = client_for_user(router['owner'])
# only create a router if the name isn't here
- r, body = client.networks.list_routers()
+ body = client.networks.list_routers()
if any(item['name'] == router['name'] for item in body['routers']):
LOG.warning("Dupplicated router name: %s" % router['name'])
continue
diff --git a/tempest/cmd/verify_tempest_config.py b/tempest/cmd/verify_tempest_config.py
index 21c9894..974ee2e 100755
--- a/tempest/cmd/verify_tempest_config.py
+++ b/tempest/cmd/verify_tempest_config.py
@@ -154,7 +154,10 @@
def verify_extensions(os, service, results):
extensions_client = get_extension_client(os, service)
- __, resp = extensions_client.list_extensions()
+ if service == 'neutron':
+ resp = extensions_client.list_extensions()
+ else:
+ __, resp = extensions_client.list_extensions()
# For Nova, Cinder and Neutron we use the alias name rather than the
# 'name' field because the alias is considered to be the canonical
# name.
diff --git a/tempest/common/custom_matchers.py b/tempest/common/custom_matchers.py
index 39e3a67..298a94e 100644
--- a/tempest/common/custom_matchers.py
+++ b/tempest/common/custom_matchers.py
@@ -122,33 +122,21 @@
def match(self, actual):
for key, value in actual.iteritems():
- if key == 'content-length' and not value.isdigit():
+ if key in ('content-length', 'x-account-bytes-used',
+ 'x-account-container-count', 'x-account-object-count',
+ 'x-container-bytes-used', 'x-container-object-count')\
+ and not value.isdigit():
+ return InvalidFormat(key, value)
+ elif key in ('content-type', 'date', 'last-modified',
+ 'x-copied-from-last-modified') and not value:
return InvalidFormat(key, value)
elif key == 'x-timestamp' and not re.match("^\d+\.?\d*\Z", value):
return InvalidFormat(key, value)
- elif key == 'x-account-bytes-used' and not value.isdigit():
- return InvalidFormat(key, value)
- elif key == 'x-account-container-count' and not value.isdigit():
- return InvalidFormat(key, value)
- elif key == 'x-account-object-count' and not value.isdigit():
- return InvalidFormat(key, value)
- elif key == 'x-container-bytes-used' and not value.isdigit():
- return InvalidFormat(key, value)
- elif key == 'x-container-object-count' and not value.isdigit():
- return InvalidFormat(key, value)
- elif key == 'content-type' and not value:
- return InvalidFormat(key, value)
elif key == 'x-copied-from' and not re.match("\S+/\S+", value):
return InvalidFormat(key, value)
- elif key == 'x-copied-from-last-modified' and not value:
- return InvalidFormat(key, value)
elif key == 'x-trans-id' and \
not re.match("^tx[0-9a-f]{21}-[0-9a-f]{10}.*", value):
return InvalidFormat(key, value)
- elif key == 'date' and not value:
- return InvalidFormat(key, value)
- elif key == 'last-modified' and not value:
- return InvalidFormat(key, value)
elif key == 'accept-ranges' and not value == 'bytes':
return InvalidFormat(key, value)
elif key == 'etag' and not value.isalnum():
diff --git a/tempest/common/isolated_creds.py b/tempest/common/isolated_creds.py
index 1ce1e39..9a9ef82 100644
--- a/tempest/common/isolated_creds.py
+++ b/tempest/common/isolated_creds.py
@@ -174,7 +174,7 @@
return network, subnet, router
def _create_network(self, name, tenant_id):
- _, resp_body = self.network_admin_client.create_network(
+ resp_body = self.network_admin_client.create_network(
name=name, tenant_id=tenant_id)
return resp_body['network']
@@ -184,7 +184,7 @@
for subnet_cidr in base_cidr.subnet(mask_bits):
try:
if self.network_resources:
- _, resp_body = self.network_admin_client.\
+ resp_body = self.network_admin_client.\
create_subnet(
network_id=network_id, cidr=str(subnet_cidr),
name=subnet_name,
@@ -192,7 +192,7 @@
enable_dhcp=self.network_resources['dhcp'],
ip_version=4)
else:
- _, resp_body = self.network_admin_client.\
+ resp_body = self.network_admin_client.\
create_subnet(network_id=network_id,
cidr=str(subnet_cidr),
name=subnet_name,
@@ -210,7 +210,7 @@
def _create_router(self, router_name, tenant_id):
external_net_id = dict(
network_id=CONF.network.public_network_id)
- _, resp_body = self.network_admin_client.create_router(
+ resp_body = self.network_admin_client.create_router(
router_name,
external_gateway_info=external_net_id,
tenant_id=tenant_id)
@@ -302,8 +302,8 @@
def _cleanup_default_secgroup(self, tenant):
net_client = self.network_admin_client
- _, resp_body = net_client.list_security_groups(tenant_id=tenant,
- name="default")
+ resp_body = net_client.list_security_groups(tenant_id=tenant,
+ name="default")
secgroups_to_delete = resp_body['security_groups']
for secgroup in secgroups_to_delete:
try:
diff --git a/tempest/config.py b/tempest/config.py
index 0d4e08a..4f5eae0 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -185,7 +185,9 @@
help="Time in seconds between build status checks."),
cfg.IntOpt('build_timeout',
default=300,
- help="Timeout in seconds to wait for an instance to build."),
+ help="Timeout in seconds to wait for an instance to build. "
+ "Other services that do not define build_timeout will "
+ "inherit this value, for example the image service."),
cfg.BoolOpt('run_ssh',
default=False,
help="Should the tests ssh to instances?"),
@@ -455,7 +457,7 @@
"checks."),
cfg.ListOpt('dns_servers',
default=["8.8.8.8", "8.8.4.4"],
- help="List of dns servers whichs hould be used"
+ help="List of dns servers which should be used"
" for subnet creation")
]
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 410d90a..9cb24b9 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -14,7 +14,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import logging
import os
import subprocess
@@ -36,13 +35,6 @@
LOG = log.getLogger(__name__)
-# NOTE(afazekas): Workaround for the stdout logging
-LOG_nova_client = logging.getLogger('novaclient.client')
-LOG_nova_client.addHandler(log.NullHandler())
-
-LOG_cinder_client = logging.getLogger('cinderclient.client')
-LOG_cinder_client.addHandler(log.NullHandler())
-
class ScenarioTest(tempest.test.BaseTestCase):
"""Base class for scenario tests. Uses tempest own clients. """
@@ -556,9 +548,9 @@
if not client:
client = self.network_client
if not tenant_id:
- tenant_id = client.rest_client.tenant_id
+ tenant_id = client.tenant_id
name = data_utils.rand_name(namestart)
- _, result = client.create_network(name=name, tenant_id=tenant_id)
+ result = client.create_network(name=name, tenant_id=tenant_id)
network = net_resources.DeletableNetwork(client=client,
**result['network'])
self.assertEqual(network.name, name)
@@ -585,7 +577,7 @@
def temp(*args, **kwargs):
temp_method = self.admin_manager.network_client.__getattr__(
'list_%s' % resource_type)
- _, resource_list = temp_method(*args, **kwargs)
+ resource_list = temp_method(*args, **kwargs)
return resource_list[resource_type]
return temp
@@ -634,7 +626,7 @@
**kwargs
)
try:
- _, result = client.create_subnet(**subnet)
+ result = client.create_subnet(**subnet)
break
except exceptions.Conflict as e:
is_overlapping_cidr = 'overlaps with another subnet' in str(e)
@@ -651,7 +643,7 @@
if not client:
client = self.network_client
name = data_utils.rand_name(namestart)
- _, result = client.create_port(
+ result = client.create_port(
name=name,
network_id=network.id,
tenant_id=network.tenant_id)
@@ -690,7 +682,7 @@
port_id, ip4 = self._get_server_port_id_and_ip4(thing)
else:
ip4 = None
- _, result = client.create_floatingip(
+ result = client.create_floatingip(
floating_network_id=external_network_id,
port_id=port_id,
tenant_id=thing['tenant_id'],
@@ -751,9 +743,9 @@
# The target login is assumed to have been configured for
# key-based authentication by cloud-init.
try:
- for net_name, ip_addresses in server['networks'].iteritems():
+ for net_name, ip_addresses in server['addresses'].iteritems():
for ip_address in ip_addresses:
- self.check_vm_connectivity(ip_address,
+ self.check_vm_connectivity(ip_address['addr'],
username,
private_key,
should_connect=should_connect)
@@ -791,7 +783,7 @@
if client is None:
client = self.network_client
if tenant_id is None:
- tenant_id = client.rest_client.tenant_id
+ tenant_id = client.tenant_id
secgroup = self._create_empty_security_group(namestart=namestart,
client=client,
tenant_id=tenant_id)
@@ -817,13 +809,13 @@
if client is None:
client = self.network_client
if not tenant_id:
- tenant_id = client.rest_client.tenant_id
+ tenant_id = client.tenant_id
sg_name = data_utils.rand_name(namestart)
sg_desc = sg_name + " description"
sg_dict = dict(name=sg_name,
description=sg_desc)
sg_dict['tenant_id'] = tenant_id
- _, result = client.create_security_group(**sg_dict)
+ result = client.create_security_group(**sg_dict)
secgroup = net_resources.DeletableSecurityGroup(
client=client,
**result['security_group']
@@ -842,7 +834,7 @@
if client is None:
client = self.network_client
if not tenant_id:
- tenant_id = client.rest_client.tenant_id
+ tenant_id = client.tenant_id
sgs = [
sg for sg in client.list_security_groups().values()[0]
if sg['tenant_id'] == tenant_id and sg['name'] == 'default'
@@ -874,7 +866,7 @@
if client is None:
client = self.network_client
if not tenant_id:
- tenant_id = client.rest_client.tenant_id
+ tenant_id = client.tenant_id
if secgroup is None:
secgroup = self._default_security_group(client=client,
tenant_id=tenant_id)
@@ -883,7 +875,7 @@
tenant_id=secgroup.tenant_id)
ruleset.update(kwargs)
- _, sg_rule = client.create_security_group_rule(**ruleset)
+ sg_rule = client.create_security_group_rule(**ruleset)
sg_rule = net_resources.DeletableSecurityGroupRule(
client=client,
**sg_rule['security_group_rule']
@@ -937,9 +929,9 @@
"""Wrapper utility that returns a test pool."""
client = self.network_client
name = data_utils.rand_name('pool')
- _, resp_pool = client.create_pool(protocol=protocol, name=name,
- subnet_id=subnet_id,
- lb_method=lb_method)
+ resp_pool = client.create_pool(protocol=protocol, name=name,
+ subnet_id=subnet_id,
+ lb_method=lb_method)
pool = net_resources.DeletablePool(client=client, **resp_pool['pool'])
self.assertEqual(pool['name'], name)
self.addCleanup(self.delete_wrapper, pool.delete)
@@ -948,9 +940,9 @@
def _create_member(self, address, protocol_port, pool_id):
"""Wrapper utility that returns a test member."""
client = self.network_client
- _, resp_member = client.create_member(protocol_port=protocol_port,
- pool_id=pool_id,
- address=address)
+ resp_member = client.create_member(protocol_port=protocol_port,
+ pool_id=pool_id,
+ address=address)
member = net_resources.DeletableMember(client=client,
**resp_member['member'])
self.addCleanup(self.delete_wrapper, member.delete)
@@ -960,9 +952,9 @@
"""Wrapper utility that returns a test vip."""
client = self.network_client
name = data_utils.rand_name('vip')
- _, resp_vip = client.create_vip(protocol=protocol, name=name,
- subnet_id=subnet_id, pool_id=pool_id,
- protocol_port=protocol_port)
+ resp_vip = client.create_vip(protocol=protocol, name=name,
+ subnet_id=subnet_id, pool_id=pool_id,
+ protocol_port=protocol_port)
vip = net_resources.DeletableVip(client=client, **resp_vip['vip'])
self.assertEqual(vip['name'], name)
self.addCleanup(self.delete_wrapper, vip.delete)
@@ -986,7 +978,7 @@
if not client:
client = self.network_client
if not tenant_id:
- tenant_id = client.rest_client.tenant_id
+ tenant_id = client.tenant_id
router_id = CONF.network.public_router_id
network_id = CONF.network.public_network_id
if router_id:
@@ -1005,11 +997,11 @@
if not client:
client = self.network_client
if not tenant_id:
- tenant_id = client.rest_client.tenant_id
+ tenant_id = client.tenant_id
name = data_utils.rand_name(namestart)
- _, result = client.create_router(name=name,
- admin_state_up=True,
- tenant_id=tenant_id)
+ result = client.create_router(name=name,
+ admin_state_up=True,
+ tenant_id=tenant_id)
router = net_resources.DeletableRouter(client=client,
**result['router'])
self.assertEqual(router.name, name)
@@ -1274,7 +1266,7 @@
@classmethod
def _get_default_network(cls):
- _, networks = cls.networks_client.list_networks()
+ networks = cls.networks_client.list_networks()
for net in networks:
if net['label'] == CONF.compute.fixed_network_name:
return net
diff --git a/tempest/scenario/test_baremetal_basic_ops.py b/tempest/scenario/test_baremetal_basic_ops.py
index ea10140..d59e31e 100644
--- a/tempest/scenario/test_baremetal_basic_ops.py
+++ b/tempest/scenario/test_baremetal_basic_ops.py
@@ -112,7 +112,7 @@
def validate_ports(self):
for port in self.get_ports(self.node['uuid']):
n_port_id = port['extra']['vif_port_id']
- _, body = self.network_client.show_port(n_port_id)
+ body = self.network_client.show_port(n_port_id)
n_port = body['port']
self.assertEqual(n_port['device_id'], self.instance['id'])
self.assertEqual(n_port['mac_address'], port['address'])
diff --git a/tempest/scenario/test_network_v6.py b/tempest/scenario/test_network_v6.py
index a75fa02..1a82e78 100644
--- a/tempest/scenario/test_network_v6.py
+++ b/tempest/scenario/test_network_v6.py
@@ -68,15 +68,15 @@
one IPv4 subnet
Creates router with ports on both subnets
"""
- net = self._create_network(tenant_id=self.tenant_id)
- sub4 = self._create_subnet(network=net,
+ self.network = self._create_network(tenant_id=self.tenant_id)
+ sub4 = self._create_subnet(network=self.network,
namestart='sub4',
ip_version=4,)
# since https://bugs.launchpad.net/neutron/+bug/1394112 we need
# to specify gateway_ip manually
net_range = netaddr.IPNetwork(CONF.network.tenant_network_v6_cidr)
gateway_ip = (netaddr.IPAddress(net_range) + 1).format()
- sub6 = self._create_subnet(network=net,
+ sub6 = self._create_subnet(network=self.network,
namestart='sub6',
ip_version=6,
gateway_ip=gateway_ip,
@@ -101,7 +101,10 @@
def prepare_server(self):
username = CONF.compute.image_ssh_user
- srv = self.create_server(create_kwargs=self.srv_kwargs)
+ create_kwargs = self.srv_kwargs
+ create_kwargs['networks'] = [{'uuid': self.network.id}]
+
+ srv = self.create_server(create_kwargs=create_kwargs)
fip = self.create_floating_ip(thing=srv)
self.define_server_ips(srv=srv)
ssh = self.get_remote_client(
diff --git a/tempest/services/compute/json/agents_client.py b/tempest/services/compute/json/agents_client.py
index 5b76a56..eacd367 100644
--- a/tempest/services/compute/json/agents_client.py
+++ b/tempest/services/compute/json/agents_client.py
@@ -17,21 +17,14 @@
from tempest.api_schema.response.compute import agents as common_schema
from tempest.api_schema.response.compute.v2 import agents as schema
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.compute.json import base
-class AgentsClientJSON(rest_client.RestClient):
+class AgentsClientJSON(base.ComputeClient):
"""
Tests Agents API
"""
- def __init__(self, auth_provider):
- super(AgentsClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_type
-
def list_agents(self, params=None):
"""List all agent builds."""
url = 'os-agents'
diff --git a/tempest/services/compute/json/aggregates_client.py b/tempest/services/compute/json/aggregates_client.py
index 09927d3..1539259 100644
--- a/tempest/services/compute/json/aggregates_client.py
+++ b/tempest/services/compute/json/aggregates_client.py
@@ -17,18 +17,11 @@
from tempest.api_schema.response.compute import aggregates as schema
from tempest.api_schema.response.compute.v2 import aggregates as v2_schema
-from tempest.common import rest_client
-from tempest import config
from tempest import exceptions
-
-CONF = config.CONF
+from tempest.services.compute.json import base
-class AggregatesClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(AggregatesClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_type
+class AggregatesClientJSON(base.ComputeClient):
def list_aggregates(self):
"""Get aggregate list."""
diff --git a/tempest/services/compute/json/availability_zone_client.py b/tempest/services/compute/json/availability_zone_client.py
index 00f8330..b8bda68 100644
--- a/tempest/services/compute/json/availability_zone_client.py
+++ b/tempest/services/compute/json/availability_zone_client.py
@@ -16,18 +16,10 @@
import json
from tempest.api_schema.response.compute.v2 import availability_zone as schema
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.compute.json import base
-class AvailabilityZoneClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(AvailabilityZoneClientJSON, self).__init__(
- auth_provider)
- self.service = CONF.compute.catalog_type
+class AvailabilityZoneClientJSON(base.ComputeClient):
def get_availability_zone_list(self):
resp, body = self.get('os-availability-zone')
diff --git a/tempest/services/compute/json/base.py b/tempest/services/compute/json/base.py
new file mode 100644
index 0000000..b712452
--- /dev/null
+++ b/tempest/services/compute/json/base.py
@@ -0,0 +1,36 @@
+# Copyright 2014 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.common import rest_client
+from tempest import config
+
+CONF = config.CONF
+
+
+class ComputeClient(rest_client.RestClient):
+ """
+ Base compute client class
+ """
+
+ def __init__(self, auth_provider,
+ build_interval=None, build_timeout=None):
+ if build_interval is None:
+ build_interval = CONF.compute.build_interval
+ if build_timeout is None:
+ build_timeout = CONF.compute.build_timeout
+
+ super(ComputeClient, self).__init__(auth_provider)
+ self.service = CONF.compute.catalog_type
+ self.build_interval = build_interval
+ self.build_timeout = build_timeout
diff --git a/tempest/services/compute/json/certificates_client.py b/tempest/services/compute/json/certificates_client.py
index 356ded2..123f0b9 100644
--- a/tempest/services/compute/json/certificates_client.py
+++ b/tempest/services/compute/json/certificates_client.py
@@ -17,17 +17,10 @@
from tempest.api_schema.response.compute import certificates as schema
from tempest.api_schema.response.compute.v2 import certificates as v2schema
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.compute.json import base
-class CertificatesClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(CertificatesClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_type
+class CertificatesClientJSON(base.ComputeClient):
def get_certificate(self, id):
url = "os-certificates/%s" % (id)
diff --git a/tempest/services/compute/json/extensions_client.py b/tempest/services/compute/json/extensions_client.py
index 41d1c4e..69ad7c0 100644
--- a/tempest/services/compute/json/extensions_client.py
+++ b/tempest/services/compute/json/extensions_client.py
@@ -16,17 +16,10 @@
import json
from tempest.api_schema.response.compute.v2 import extensions as schema
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.compute.json import base
-class ExtensionsClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(ExtensionsClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_type
+class ExtensionsClientJSON(base.ComputeClient):
def list_extensions(self):
url = 'extensions'
diff --git a/tempest/services/compute/json/fixed_ips_client.py b/tempest/services/compute/json/fixed_ips_client.py
index 5903334..8fd24b6 100644
--- a/tempest/services/compute/json/fixed_ips_client.py
+++ b/tempest/services/compute/json/fixed_ips_client.py
@@ -16,17 +16,10 @@
import json
from tempest.api_schema.response.compute.v2 import fixed_ips as schema
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.compute.json import base
-class FixedIPsClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(FixedIPsClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_type
+class FixedIPsClientJSON(base.ComputeClient):
def get_fixed_ip_details(self, fixed_ip):
url = "os-fixed-ips/%s" % (fixed_ip)
diff --git a/tempest/services/compute/json/flavors_client.py b/tempest/services/compute/json/flavors_client.py
index 8faf8a7..6276d3c 100644
--- a/tempest/services/compute/json/flavors_client.py
+++ b/tempest/services/compute/json/flavors_client.py
@@ -21,17 +21,10 @@
from tempest.api_schema.response.compute import flavors_extra_specs \
as schema_extra_specs
from tempest.api_schema.response.compute.v2 import flavors as v2schema
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.compute.json import base
-class FlavorsClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(FlavorsClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_type
+class FlavorsClientJSON(base.ComputeClient):
def list_flavors(self, params=None):
url = 'flavors'
diff --git a/tempest/services/compute/json/floating_ips_client.py b/tempest/services/compute/json/floating_ips_client.py
index 0ed1720..788b4d2 100644
--- a/tempest/services/compute/json/floating_ips_client.py
+++ b/tempest/services/compute/json/floating_ips_client.py
@@ -17,17 +17,11 @@
import urllib
from tempest.api_schema.response.compute.v2 import floating_ips as schema
-from tempest.common import rest_client
-from tempest import config
from tempest import exceptions
-
-CONF = config.CONF
+from tempest.services.compute.json import base
-class FloatingIPsClientJSON(rest_client.RestClient):
- def __init__(self, auth_provider):
- super(FloatingIPsClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_type
+class FloatingIPsClientJSON(base.ComputeClient):
def list_floating_ips(self, params=None):
"""Returns a list of all floating IPs filtered by any parameters."""
diff --git a/tempest/services/compute/json/hosts_client.py b/tempest/services/compute/json/hosts_client.py
index 8644173..5d306f9 100644
--- a/tempest/services/compute/json/hosts_client.py
+++ b/tempest/services/compute/json/hosts_client.py
@@ -17,17 +17,10 @@
from tempest.api_schema.response.compute import hosts as schema
from tempest.api_schema.response.compute.v2 import hosts as v2_schema
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.compute.json import base
-class HostsClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(HostsClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_type
+class HostsClientJSON(base.ComputeClient):
def list_hosts(self, params=None):
"""Lists all hosts."""
diff --git a/tempest/services/compute/json/hypervisor_client.py b/tempest/services/compute/json/hypervisor_client.py
index 8eacf61..52b50c8 100644
--- a/tempest/services/compute/json/hypervisor_client.py
+++ b/tempest/services/compute/json/hypervisor_client.py
@@ -17,17 +17,10 @@
from tempest.api_schema.response.compute import hypervisors as common_schema
from tempest.api_schema.response.compute.v2 import hypervisors as v2schema
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.compute.json import base
-class HypervisorClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(HypervisorClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_type
+class HypervisorClientJSON(base.ComputeClient):
def get_hypervisor_list(self):
"""List hypervisors information."""
diff --git a/tempest/services/compute/json/images_client.py b/tempest/services/compute/json/images_client.py
index 079a91e..a4cfe57 100644
--- a/tempest/services/compute/json/images_client.py
+++ b/tempest/services/compute/json/images_client.py
@@ -17,21 +17,12 @@
import urllib
from tempest.api_schema.response.compute.v2 import images as schema
-from tempest.common import rest_client
from tempest.common import waiters
-from tempest import config
from tempest import exceptions
-
-CONF = config.CONF
+from tempest.services.compute.json import base
-class ImagesClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(ImagesClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_type
- self.build_interval = CONF.compute.build_interval
- self.build_timeout = CONF.compute.build_timeout
+class ImagesClientJSON(base.ComputeClient):
def create_image(self, server_id, name, meta=None):
"""Creates an image of the original server."""
diff --git a/tempest/services/compute/json/instance_usage_audit_log_client.py b/tempest/services/compute/json/instance_usage_audit_log_client.py
index 4b0362b..f79c3de 100644
--- a/tempest/services/compute/json/instance_usage_audit_log_client.py
+++ b/tempest/services/compute/json/instance_usage_audit_log_client.py
@@ -17,18 +17,10 @@
from tempest.api_schema.response.compute.v2 import instance_usage_audit_logs \
as schema
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.compute.json import base
-class InstanceUsagesAuditLogClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(InstanceUsagesAuditLogClientJSON, self).__init__(
- auth_provider)
- self.service = CONF.compute.catalog_type
+class InstanceUsagesAuditLogClientJSON(base.ComputeClient):
def list_instance_usage_audit_logs(self):
url = 'os-instance_usage_audit_log'
diff --git a/tempest/services/compute/json/interfaces_client.py b/tempest/services/compute/json/interfaces_client.py
index 620ed68..f1e2660 100644
--- a/tempest/services/compute/json/interfaces_client.py
+++ b/tempest/services/compute/json/interfaces_client.py
@@ -19,18 +19,11 @@
from tempest.api_schema.response.compute import interfaces as common_schema
from tempest.api_schema.response.compute import servers as servers_schema
from tempest.api_schema.response.compute.v2 import interfaces as schema
-from tempest.common import rest_client
-from tempest import config
from tempest import exceptions
-
-CONF = config.CONF
+from tempest.services.compute.json import base
-class InterfacesClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(InterfacesClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_type
+class InterfacesClientJSON(base.ComputeClient):
def list_interfaces(self, server):
resp, body = self.get('servers/%s/os-interface' % server)
diff --git a/tempest/services/compute/json/keypairs_client.py b/tempest/services/compute/json/keypairs_client.py
index 31c42a5..c4406f5 100644
--- a/tempest/services/compute/json/keypairs_client.py
+++ b/tempest/services/compute/json/keypairs_client.py
@@ -17,17 +17,10 @@
from tempest.api_schema.response.compute import keypairs as common_schema
from tempest.api_schema.response.compute.v2 import keypairs as schema
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.compute.json import base
-class KeyPairsClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(KeyPairsClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_type
+class KeyPairsClientJSON(base.ComputeClient):
def list_keypairs(self):
resp, body = self.get("os-keypairs")
diff --git a/tempest/services/compute/json/limits_client.py b/tempest/services/compute/json/limits_client.py
index 81c602b..66a0649 100644
--- a/tempest/services/compute/json/limits_client.py
+++ b/tempest/services/compute/json/limits_client.py
@@ -16,17 +16,10 @@
import json
from tempest.api_schema.response.compute.v2 import limits as schema
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.compute.json import base
-class LimitsClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(LimitsClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_type
+class LimitsClientJSON(base.ComputeClient):
def get_absolute_limits(self):
resp, body = self.get("limits")
diff --git a/tempest/services/compute/json/migrations_client.py b/tempest/services/compute/json/migrations_client.py
index f4abbb2..de183f1 100644
--- a/tempest/services/compute/json/migrations_client.py
+++ b/tempest/services/compute/json/migrations_client.py
@@ -16,17 +16,10 @@
import urllib
from tempest.api_schema.response.compute import migrations as schema
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.compute.json import base
-class MigrationsClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(MigrationsClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_type
+class MigrationsClientJSON(base.ComputeClient):
def list_migrations(self, params=None):
"""Lists all migrations."""
diff --git a/tempest/services/compute/json/networks_client.py b/tempest/services/compute/json/networks_client.py
index 40eb1a6..5a2744d 100644
--- a/tempest/services/compute/json/networks_client.py
+++ b/tempest/services/compute/json/networks_client.py
@@ -15,17 +15,10 @@
import json
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.compute.json import base
-class NetworksClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(NetworksClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_type
+class NetworksClientJSON(base.ComputeClient):
def list_networks(self):
resp, body = self.get("os-networks")
diff --git a/tempest/services/compute/json/quotas_client.py b/tempest/services/compute/json/quotas_client.py
index b691529..0fee57a 100644
--- a/tempest/services/compute/json/quotas_client.py
+++ b/tempest/services/compute/json/quotas_client.py
@@ -18,17 +18,10 @@
from tempest.api_schema.response.compute.v2\
import quota_classes as classes_schema
from tempest.api_schema.response.compute.v2 import quotas as schema
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.compute.json import base
-class QuotasClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(QuotasClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_type
+class QuotasClientJSON(base.ComputeClient):
def get_quota_set(self, tenant_id, user_id=None):
"""List the quota set for a tenant."""
@@ -122,11 +115,7 @@
return resp, body
-class QuotaClassesClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(QuotaClassesClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_type
+class QuotaClassesClientJSON(base.ComputeClient):
def get_quota_class_set(self, quota_class_id):
"""List the quota class set for a quota class."""
diff --git a/tempest/services/compute/json/security_group_default_rules_client.py b/tempest/services/compute/json/security_group_default_rules_client.py
index 7743f9c..efaf329 100644
--- a/tempest/services/compute/json/security_group_default_rules_client.py
+++ b/tempest/services/compute/json/security_group_default_rules_client.py
@@ -17,18 +17,10 @@
from tempest.api_schema.response.compute.v2 import \
security_group_default_rule as schema
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.compute.json import base
-class SecurityGroupDefaultRulesClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(SecurityGroupDefaultRulesClientJSON,
- self).__init__(auth_provider)
- self.service = CONF.compute.catalog_type
+class SecurityGroupDefaultRulesClientJSON(base.ComputeClient):
def create_security_default_group_rule(self, ip_protocol, from_port,
to_port, **kwargs):
diff --git a/tempest/services/compute/json/security_groups_client.py b/tempest/services/compute/json/security_groups_client.py
index 733a50b..a301a0f 100644
--- a/tempest/services/compute/json/security_groups_client.py
+++ b/tempest/services/compute/json/security_groups_client.py
@@ -17,18 +17,11 @@
import urllib
from tempest.api_schema.response.compute.v2 import security_groups as schema
-from tempest.common import rest_client
-from tempest import config
from tempest import exceptions
-
-CONF = config.CONF
+from tempest.services.compute.json import base
-class SecurityGroupsClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(SecurityGroupsClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_type
+class SecurityGroupsClientJSON(base.ComputeClient):
def list_security_groups(self, params=None):
"""List all security groups for a user."""
diff --git a/tempest/services/compute/json/servers_client.py b/tempest/services/compute/json/servers_client.py
index 4268b1a..400f9a7 100644
--- a/tempest/services/compute/json/servers_client.py
+++ b/tempest/services/compute/json/servers_client.py
@@ -20,20 +20,15 @@
from tempest.api_schema.response.compute import servers as common_schema
from tempest.api_schema.response.compute.v2 import servers as schema
-from tempest.common import rest_client
from tempest.common import waiters
from tempest import config
from tempest import exceptions
+from tempest.services.compute.json import base
CONF = config.CONF
-class ServersClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(ServersClientJSON, self).__init__(auth_provider)
-
- self.service = CONF.compute.catalog_type
+class ServersClientJSON(base.ComputeClient):
def create_server(self, name, image_ref, flavor_ref, **kwargs):
"""
diff --git a/tempest/services/compute/json/services_client.py b/tempest/services/compute/json/services_client.py
index e56263c..8d73c37 100644
--- a/tempest/services/compute/json/services_client.py
+++ b/tempest/services/compute/json/services_client.py
@@ -18,17 +18,10 @@
import urllib
from tempest.api_schema.response.compute import services as schema
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.compute.json import base
-class ServicesClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(ServicesClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_type
+class ServicesClientJSON(base.ComputeClient):
def list_services(self, params=None):
url = 'os-services'
diff --git a/tempest/services/compute/json/tenant_usages_client.py b/tempest/services/compute/json/tenant_usages_client.py
index a0b9b4a..eac23bb 100644
--- a/tempest/services/compute/json/tenant_usages_client.py
+++ b/tempest/services/compute/json/tenant_usages_client.py
@@ -17,17 +17,10 @@
import urllib
from tempest.api_schema.response.compute.v2 import tenant_usages as schema
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.compute.json import base
-class TenantUsagesClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(TenantUsagesClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_type
+class TenantUsagesClientJSON(base.ComputeClient):
def list_tenant_usages(self, params=None):
url = 'os-simple-tenant-usage'
diff --git a/tempest/services/compute/json/volumes_extensions_client.py b/tempest/services/compute/json/volumes_extensions_client.py
index afa6937..69b9bea 100644
--- a/tempest/services/compute/json/volumes_extensions_client.py
+++ b/tempest/services/compute/json/volumes_extensions_client.py
@@ -18,21 +18,20 @@
import urllib
from tempest.api_schema.response.compute.v2 import volumes as schema
-from tempest.common import rest_client
from tempest import config
from tempest import exceptions
+from tempest.services.compute.json import base
CONF = config.CONF
-class VolumesExtensionsClientJSON(rest_client.RestClient):
+class VolumesExtensionsClientJSON(base.ComputeClient):
def __init__(self, auth_provider):
super(VolumesExtensionsClientJSON, self).__init__(
- auth_provider)
- self.service = CONF.compute.catalog_type
- self.build_interval = CONF.volume.build_interval
- self.build_timeout = CONF.volume.build_timeout
+ auth_provider,
+ build_interval=CONF.volume.build_interval,
+ build_timeout=CONF.volume.build_timeout)
def list_volumes(self, params=None):
"""List all the volumes created."""
diff --git a/tempest/services/identity/v3/json/base.py b/tempest/services/identity/v3/json/base.py
new file mode 100644
index 0000000..3df0dab
--- /dev/null
+++ b/tempest/services/identity/v3/json/base.py
@@ -0,0 +1,30 @@
+# Copyright 2014 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.common import rest_client
+from tempest import config
+
+CONF = config.CONF
+
+
+class IdentityV3Client(rest_client.RestClient):
+ """
+ Base identity v3 client class
+ """
+
+ def __init__(self, auth_provider):
+ super(IdentityV3Client, self).__init__(auth_provider)
+ self.service = CONF.identity.catalog_type
+ self.endpoint_url = 'adminURL'
+ self.api_version = "v3"
diff --git a/tempest/services/identity/v3/json/credentials_client.py b/tempest/services/identity/v3/json/credentials_client.py
index d424f4c..42acd2a 100644
--- a/tempest/services/identity/v3/json/credentials_client.py
+++ b/tempest/services/identity/v3/json/credentials_client.py
@@ -15,19 +15,10 @@
import json
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.identity.v3.json import base
-class CredentialsClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(CredentialsClientJSON, self).__init__(auth_provider)
- self.service = CONF.identity.catalog_type
- self.endpoint_url = 'adminURL'
- self.api_version = "v3"
+class CredentialsClientJSON(base.IdentityV3Client):
def create_credential(self, access_key, secret_key, user_id, project_id):
"""Creates a credential."""
diff --git a/tempest/services/identity/v3/json/endpoints_client.py b/tempest/services/identity/v3/json/endpoints_client.py
index c3fedb2..9316a4b 100644
--- a/tempest/services/identity/v3/json/endpoints_client.py
+++ b/tempest/services/identity/v3/json/endpoints_client.py
@@ -15,19 +15,10 @@
import json
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.identity.v3.json import base
-class EndPointClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(EndPointClientJSON, self).__init__(auth_provider)
- self.service = CONF.identity.catalog_type
- self.endpoint_url = 'adminURL'
- self.api_version = "v3"
+class EndPointClientJSON(base.IdentityV3Client):
def list_endpoints(self):
"""GET endpoints."""
diff --git a/tempest/services/identity/v3/json/identity_client.py b/tempest/services/identity/v3/json/identity_client.py
index 6ac4901..4c8d8df 100644
--- a/tempest/services/identity/v3/json/identity_client.py
+++ b/tempest/services/identity/v3/json/identity_client.py
@@ -19,17 +19,12 @@
from tempest.common import rest_client
from tempest import config
from tempest import exceptions
+from tempest.services.identity.v3.json import base
CONF = config.CONF
-class IdentityV3ClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(IdentityV3ClientJSON, self).__init__(auth_provider)
- self.service = CONF.identity.catalog_type
- self.endpoint_url = 'adminURL'
- self.api_version = "v3"
+class IdentityV3ClientJSON(base.IdentityV3Client):
def create_user(self, user_name, password=None, project_id=None,
email=None, domain_id='default', **kwargs):
diff --git a/tempest/services/identity/v3/json/policy_client.py b/tempest/services/identity/v3/json/policy_client.py
index 579243c..04374a2 100644
--- a/tempest/services/identity/v3/json/policy_client.py
+++ b/tempest/services/identity/v3/json/policy_client.py
@@ -16,18 +16,10 @@
import json
from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.identity.v3.json import base
-class PolicyClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(PolicyClientJSON, self).__init__(auth_provider)
- self.service = CONF.identity.catalog_type
- self.endpoint_url = 'adminURL'
- self.api_version = "v3"
+class PolicyClientJSON(base.IdentityV3Client):
def create_policy(self, blob, type):
"""Creates a Policy."""
diff --git a/tempest/services/identity/v3/json/region_client.py b/tempest/services/identity/v3/json/region_client.py
index becea6b..8545778 100644
--- a/tempest/services/identity/v3/json/region_client.py
+++ b/tempest/services/identity/v3/json/region_client.py
@@ -16,19 +16,10 @@
import json
import urllib
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.identity.v3.json import base
-class RegionClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(RegionClientJSON, self).__init__(auth_provider)
- self.service = CONF.identity.catalog_type
- self.endpoint_url = 'adminURL'
- self.api_version = "v3"
+class RegionClientJSON(base.IdentityV3Client):
def create_region(self, description, **kwargs):
"""Create region."""
diff --git a/tempest/services/identity/v3/json/service_client.py b/tempest/services/identity/v3/json/service_client.py
index 8e89957..b8b2556 100644
--- a/tempest/services/identity/v3/json/service_client.py
+++ b/tempest/services/identity/v3/json/service_client.py
@@ -15,19 +15,10 @@
import json
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.identity.v3.json import base
-class ServiceClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(ServiceClientJSON, self).__init__(auth_provider)
- self.service = CONF.identity.catalog_type
- self.endpoint_url = 'adminURL'
- self.api_version = "v3"
+class ServiceClientJSON(base.IdentityV3Client):
def update_service(self, service_id, **kwargs):
"""Updates a service."""
diff --git a/tempest/services/network/json/network_client.py b/tempest/services/network/json/network_client.py
index 809c98b..c622ee4 100644
--- a/tempest/services/network/json/network_client.py
+++ b/tempest/services/network/json/network_client.py
@@ -11,12 +11,18 @@
# under the License.
import json
+import time
+import urllib
from tempest.common import rest_client
-from tempest.services.network import network_client_base
+from tempest.common.utils import misc
+from tempest import config
+from tempest import exceptions
+
+CONF = config.CONF
-class NetworkClientJSON(network_client_base.NetworkClientBase):
+class NetworkClientJSON(rest_client.RestClient):
"""
Tempest REST client for Neutron. Uses v2 of the Neutron API, since the
@@ -31,8 +37,228 @@
quotas
"""
- def get_rest_client(self, auth_provider):
- return rest_client.RestClient(auth_provider)
+ def __init__(self, auth_provider):
+ super(NetworkClientJSON, self).__init__(auth_provider)
+ self.service = CONF.network.catalog_type
+ self.build_timeout = CONF.network.build_timeout
+ self.build_interval = CONF.network.build_interval
+ self.version = '2.0'
+ self.uri_prefix = "v%s" % (self.version)
+
+ def get_uri(self, plural_name):
+ # get service prefix from resource name
+
+ # The following list represents resource names that do not require
+ # changing underscore to a hyphen
+ hyphen_exceptions = ["health_monitors", "firewall_rules",
+ "firewall_policies"]
+ # the following map is used to construct proper URI
+ # for the given neutron resource
+ service_resource_prefix_map = {
+ 'networks': '',
+ 'subnets': '',
+ 'ports': '',
+ 'pools': 'lb',
+ 'vips': 'lb',
+ 'health_monitors': 'lb',
+ 'members': 'lb',
+ 'ipsecpolicies': 'vpn',
+ 'vpnservices': 'vpn',
+ 'ikepolicies': 'vpn',
+ 'ipsecpolicies': 'vpn',
+ 'metering_labels': 'metering',
+ 'metering_label_rules': 'metering',
+ 'firewall_rules': 'fw',
+ 'firewall_policies': 'fw',
+ 'firewalls': 'fw'
+ }
+ service_prefix = service_resource_prefix_map.get(
+ plural_name)
+ if plural_name not in hyphen_exceptions:
+ plural_name = plural_name.replace("_", "-")
+ if service_prefix:
+ uri = '%s/%s/%s' % (self.uri_prefix, service_prefix,
+ plural_name)
+ else:
+ uri = '%s/%s' % (self.uri_prefix, plural_name)
+ return uri
+
+ def pluralize(self, resource_name):
+ # get plural from map or just add 's'
+
+ # map from resource name to a plural name
+ # needed only for those which can't be constructed as name + 's'
+ resource_plural_map = {
+ 'security_groups': 'security_groups',
+ 'security_group_rules': 'security_group_rules',
+ 'ipsecpolicy': 'ipsecpolicies',
+ 'ikepolicy': 'ikepolicies',
+ 'ipsecpolicy': 'ipsecpolicies',
+ 'quotas': 'quotas',
+ 'firewall_policy': 'firewall_policies'
+ }
+ return resource_plural_map.get(resource_name, resource_name + 's')
+
+ def _lister(self, plural_name):
+ def _list(**filters):
+ uri = self.get_uri(plural_name)
+ if filters:
+ uri += '?' + urllib.urlencode(filters, doseq=1)
+ resp, body = self.get(uri)
+ result = {plural_name: self.deserialize_list(body)}
+ self.expected_success(200, resp.status)
+ return rest_client.ResponseBody(resp, result)
+
+ return _list
+
+ def _deleter(self, resource_name):
+ def _delete(resource_id):
+ plural = self.pluralize(resource_name)
+ uri = '%s/%s' % (self.get_uri(plural), resource_id)
+ resp, body = self.delete(uri)
+ self.expected_success(204, resp.status)
+ return rest_client.ResponseBody(resp, body)
+
+ return _delete
+
+ def _shower(self, resource_name):
+ def _show(resource_id, **fields):
+ # fields is a dict which key is 'fields' and value is a
+ # list of field's name. An example:
+ # {'fields': ['id', 'name']}
+ plural = self.pluralize(resource_name)
+ uri = '%s/%s' % (self.get_uri(plural), resource_id)
+ if fields:
+ uri += '?' + urllib.urlencode(fields, doseq=1)
+ resp, body = self.get(uri)
+ body = self.deserialize_single(body)
+ self.expected_success(200, resp.status)
+ return rest_client.ResponseBody(resp, body)
+
+ return _show
+
+ def _creater(self, resource_name):
+ def _create(**kwargs):
+ plural = self.pluralize(resource_name)
+ uri = self.get_uri(plural)
+ post_data = self.serialize({resource_name: kwargs})
+ resp, body = self.post(uri, post_data)
+ body = self.deserialize_single(body)
+ self.expected_success(201, resp.status)
+ return rest_client.ResponseBody(resp, body)
+
+ return _create
+
+ def _updater(self, resource_name):
+ def _update(res_id, **kwargs):
+ plural = self.pluralize(resource_name)
+ uri = '%s/%s' % (self.get_uri(plural), res_id)
+ post_data = self.serialize({resource_name: kwargs})
+ resp, body = self.put(uri, post_data)
+ body = self.deserialize_single(body)
+ self.expected_success(200, resp.status)
+ return rest_client.ResponseBody(resp, body)
+
+ return _update
+
+ def __getattr__(self, name):
+ method_prefixes = ["list_", "delete_", "show_", "create_", "update_"]
+ method_functors = [self._lister,
+ self._deleter,
+ self._shower,
+ self._creater,
+ self._updater]
+ for index, prefix in enumerate(method_prefixes):
+ prefix_len = len(prefix)
+ if name[:prefix_len] == prefix:
+ return method_functors[index](name[prefix_len:])
+ raise AttributeError(name)
+
+ # Common methods that are hard to automate
+ def create_bulk_network(self, names):
+ network_list = [{'name': name} for name in names]
+ post_data = {'networks': network_list}
+ body = self.serialize_list(post_data, "networks", "network")
+ uri = self.get_uri("networks")
+ resp, body = self.post(uri, body)
+ body = {'networks': self.deserialize_list(body)}
+ self.expected_success(201, resp.status)
+ return rest_client.ResponseBody(resp, body)
+
+ def create_bulk_subnet(self, subnet_list):
+ post_data = {'subnets': subnet_list}
+ body = self.serialize_list(post_data, 'subnets', 'subnet')
+ uri = self.get_uri('subnets')
+ resp, body = self.post(uri, body)
+ body = {'subnets': self.deserialize_list(body)}
+ self.expected_success(201, resp.status)
+ return rest_client.ResponseBody(resp, body)
+
+ def create_bulk_port(self, port_list):
+ post_data = {'ports': port_list}
+ body = self.serialize_list(post_data, 'ports', 'port')
+ uri = self.get_uri('ports')
+ resp, body = self.post(uri, body)
+ body = {'ports': self.deserialize_list(body)}
+ self.expected_success(201, resp.status)
+ return rest_client.ResponseBody(resp, body)
+
+ def wait_for_resource_deletion(self, resource_type, id):
+ """Waits for a resource to be deleted."""
+ start_time = int(time.time())
+ while True:
+ if self.is_resource_deleted(resource_type, id):
+ return
+ if int(time.time()) - start_time >= self.build_timeout:
+ raise exceptions.TimeoutException
+ time.sleep(self.build_interval)
+
+ def is_resource_deleted(self, resource_type, id):
+ method = 'show_' + resource_type
+ try:
+ getattr(self, method)(id)
+ except AttributeError:
+ raise Exception("Unknown resource type %s " % resource_type)
+ except exceptions.NotFound:
+ return True
+ return False
+
+ def wait_for_resource_status(self, fetch, status, interval=None,
+ timeout=None):
+ """
+ @summary: Waits for a network resource to reach a status
+ @param fetch: the callable to be used to query the resource status
+ @type fecth: callable that takes no parameters and returns the resource
+ @param status: the status that the resource has to reach
+ @type status: String
+ @param interval: the number of seconds to wait between each status
+ query
+ @type interval: Integer
+ @param timeout: the maximum number of seconds to wait for the resource
+ to reach the desired status
+ @type timeout: Integer
+ """
+ if not interval:
+ interval = self.build_interval
+ if not timeout:
+ timeout = self.build_timeout
+ start_time = time.time()
+
+ while time.time() - start_time <= timeout:
+ resource = fetch()
+ if resource['status'] == status:
+ return
+ time.sleep(interval)
+
+ # At this point, the wait has timed out
+ message = 'Resource %s' % (str(resource))
+ message += ' failed to reach status %s' % status
+ message += ' (current: %s)' % resource['status']
+ message += ' within the required time %s' % timeout
+ caller = misc.find_test_caller()
+ if caller:
+ message = '(%s) %s' % (caller, message)
+ raise exceptions.TimeoutException(message)
def deserialize_single(self, body):
return json.loads(body)
@@ -59,15 +285,15 @@
body = json.dumps(put_body)
uri = '%s/quotas/%s' % (self.uri_prefix, tenant_id)
resp, body = self.put(uri, body)
- self.rest_client.expected_success(200, resp.status)
+ self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['quota']
+ return rest_client.ResponseBody(resp, body['quota'])
def reset_quotas(self, tenant_id):
uri = '%s/quotas/%s' % (self.uri_prefix, tenant_id)
resp, body = self.delete(uri)
- self.rest_client.expected_success(204, resp.status)
- return resp, body
+ self.expected_success(204, resp.status)
+ return rest_client.ResponseBody(resp, body)
def create_router(self, name, admin_state_up=True, **kwargs):
post_body = {'router': kwargs}
@@ -76,14 +302,14 @@
body = json.dumps(post_body)
uri = '%s/routers' % (self.uri_prefix)
resp, body = self.post(uri, body)
- self.rest_client.expected_success(201, resp.status)
+ self.expected_success(201, resp.status)
body = json.loads(body)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def _update_router(self, router_id, set_enable_snat, **kwargs):
uri = '%s/routers/%s' % (self.uri_prefix, router_id)
resp, body = self.get(uri)
- self.rest_client.expected_success(200, resp.status)
+ self.expected_success(200, resp.status)
body = json.loads(body)
update_body = {}
update_body['name'] = kwargs.get('name', body['router']['name'])
@@ -103,9 +329,9 @@
update_body = dict(router=update_body)
update_body = json.dumps(update_body)
resp, body = self.put(uri, update_body)
- self.rest_client.expected_success(200, resp.status)
+ self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def update_router(self, router_id, **kwargs):
"""Update a router leaving enable_snat to its default value."""
@@ -130,9 +356,9 @@
update_body = {"subnet_id": subnet_id}
update_body = json.dumps(update_body)
resp, body = self.put(uri, update_body)
- self.rest_client.expected_success(200, resp.status)
+ self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def add_router_interface_with_port_id(self, router_id, port_id):
uri = '%s/routers/%s/add_router_interface' % (self.uri_prefix,
@@ -140,9 +366,9 @@
update_body = {"port_id": port_id}
update_body = json.dumps(update_body)
resp, body = self.put(uri, update_body)
- self.rest_client.expected_success(200, resp.status)
+ self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def remove_router_interface_with_subnet_id(self, router_id, subnet_id):
uri = '%s/routers/%s/remove_router_interface' % (self.uri_prefix,
@@ -150,9 +376,9 @@
update_body = {"subnet_id": subnet_id}
update_body = json.dumps(update_body)
resp, body = self.put(uri, update_body)
- self.rest_client.expected_success(200, resp.status)
+ self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def remove_router_interface_with_port_id(self, router_id, port_id):
uri = '%s/routers/%s/remove_router_interface' % (self.uri_prefix,
@@ -160,9 +386,9 @@
update_body = {"port_id": port_id}
update_body = json.dumps(update_body)
resp, body = self.put(uri, update_body)
- self.rest_client.expected_success(200, resp.status)
+ self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def associate_health_monitor_with_pool(self, health_monitor_id,
pool_id):
@@ -175,24 +401,24 @@
uri = '%s/lb/pools/%s/health_monitors' % (self.uri_prefix,
pool_id)
resp, body = self.post(uri, body)
- self.rest_client.expected_success(201, resp.status)
+ self.expected_success(201, resp.status)
body = json.loads(body)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def disassociate_health_monitor_with_pool(self, health_monitor_id,
pool_id):
uri = '%s/lb/pools/%s/health_monitors/%s' % (self.uri_prefix, pool_id,
health_monitor_id)
resp, body = self.delete(uri)
- self.rest_client.expected_success(204, resp.status)
- return resp, body
+ self.expected_success(204, resp.status)
+ return rest_client.ResponseBody(resp, body)
def list_router_interfaces(self, uuid):
uri = '%s/ports?device_id=%s' % (self.uri_prefix, uuid)
resp, body = self.get(uri)
- self.rest_client.expected_success(200, resp.status)
+ self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def update_agent(self, agent_id, agent_info):
"""
@@ -203,75 +429,75 @@
agent = {"agent": agent_info}
body = json.dumps(agent)
resp, body = self.put(uri, body)
- self.rest_client.expected_success(200, resp.status)
+ self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def list_pools_hosted_by_one_lbaas_agent(self, agent_id):
uri = '%s/agents/%s/loadbalancer-pools' % (self.uri_prefix, agent_id)
resp, body = self.get(uri)
- self.rest_client.expected_success(200, resp.status)
+ self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def show_lbaas_agent_hosting_pool(self, pool_id):
uri = ('%s/lb/pools/%s/loadbalancer-agent' %
(self.uri_prefix, pool_id))
resp, body = self.get(uri)
- self.rest_client.expected_success(200, resp.status)
+ self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def list_routers_on_l3_agent(self, agent_id):
uri = '%s/agents/%s/l3-routers' % (self.uri_prefix, agent_id)
resp, body = self.get(uri)
- self.rest_client.expected_success(200, resp.status)
+ self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def list_l3_agents_hosting_router(self, router_id):
uri = '%s/routers/%s/l3-agents' % (self.uri_prefix, router_id)
resp, body = self.get(uri)
- self.rest_client.expected_success(200, resp.status)
+ self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def add_router_to_l3_agent(self, agent_id, router_id):
uri = '%s/agents/%s/l3-routers' % (self.uri_prefix, agent_id)
post_body = {"router_id": router_id}
body = json.dumps(post_body)
resp, body = self.post(uri, body)
- self.rest_client.expected_success(201, resp.status)
+ self.expected_success(201, resp.status)
body = json.loads(body)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def remove_router_from_l3_agent(self, agent_id, router_id):
uri = '%s/agents/%s/l3-routers/%s' % (
self.uri_prefix, agent_id, router_id)
resp, body = self.delete(uri)
- self.rest_client.expected_success(204, resp.status)
- return resp, body
+ self.expected_success(204, resp.status)
+ return rest_client.ResponseBody(resp, body)
def list_dhcp_agent_hosting_network(self, network_id):
uri = '%s/networks/%s/dhcp-agents' % (self.uri_prefix, network_id)
resp, body = self.get(uri)
- self.rest_client.expected_success(200, resp.status)
+ self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def list_networks_hosted_by_one_dhcp_agent(self, agent_id):
uri = '%s/agents/%s/dhcp-networks' % (self.uri_prefix, agent_id)
resp, body = self.get(uri)
- self.rest_client.expected_success(200, resp.status)
+ self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def remove_network_from_dhcp_agent(self, agent_id, network_id):
uri = '%s/agents/%s/dhcp-networks/%s' % (self.uri_prefix, agent_id,
network_id)
resp, body = self.delete(uri)
- self.rest_client.expected_success(204, resp.status)
- return resp, body
+ self.expected_success(204, resp.status)
+ return rest_client.ResponseBody(resp, body)
def create_ikepolicy(self, name, **kwargs):
post_body = {
@@ -284,9 +510,9 @@
body = json.dumps(post_body)
uri = '%s/vpn/ikepolicies' % (self.uri_prefix)
resp, body = self.post(uri, body)
- self.rest_client.expected_success(201, resp.status)
+ self.expected_success(201, resp.status)
body = json.loads(body)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def update_extra_routes(self, router_id, nexthop, destination):
uri = '%s/routers/%s' % (self.uri_prefix, router_id)
@@ -298,9 +524,9 @@
}
body = json.dumps(put_body)
resp, body = self.put(uri, body)
- self.rest_client.expected_success(200, resp.status)
+ self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def delete_extra_routes(self, router_id):
uri = '%s/routers/%s' % (self.uri_prefix, router_id)
@@ -312,25 +538,25 @@
}
body = json.dumps(put_body)
resp, body = self.put(uri, body)
- self.rest_client.expected_success(200, resp.status)
+ self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def list_lb_pool_stats(self, pool_id):
uri = '%s/lb/pools/%s/stats' % (self.uri_prefix, pool_id)
resp, body = self.get(uri)
- self.rest_client.expected_success(200, resp.status)
+ self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def add_dhcp_agent_to_network(self, agent_id, network_id):
post_body = {'network_id': network_id}
body = json.dumps(post_body)
uri = '%s/agents/%s/dhcp-networks' % (self.uri_prefix, agent_id)
resp, body = self.post(uri, body)
- self.rest_client.expected_success(201, resp.status)
+ self.expected_success(201, resp.status)
body = json.loads(body)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def insert_firewall_rule_in_policy(self, firewall_policy_id,
firewall_rule_id, insert_after="",
@@ -344,9 +570,9 @@
}
body = json.dumps(body)
resp, body = self.put(uri, body)
- self.rest_client.expected_success(200, resp.status)
+ self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def remove_firewall_rule_from_policy(self, firewall_policy_id,
firewall_rule_id):
@@ -355,6 +581,6 @@
update_body = {"firewall_rule_id": firewall_rule_id}
update_body = json.dumps(update_body)
resp, body = self.put(uri, update_body)
- self.rest_client.expected_success(200, resp.status)
+ self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
diff --git a/tempest/services/network/network_client_base.py b/tempest/services/network/network_client_base.py
deleted file mode 100644
index 2c767d9..0000000
--- a/tempest/services/network/network_client_base.py
+++ /dev/null
@@ -1,267 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import time
-import urllib
-
-from tempest.common.utils import misc
-from tempest import config
-from tempest import exceptions
-
-CONF = config.CONF
-
-# the following map is used to construct proper URI
-# for the given neutron resource
-service_resource_prefix_map = {
- 'networks': '',
- 'subnets': '',
- 'ports': '',
- 'pools': 'lb',
- 'vips': 'lb',
- 'health_monitors': 'lb',
- 'members': 'lb',
- 'ipsecpolicies': 'vpn',
- 'vpnservices': 'vpn',
- 'ikepolicies': 'vpn',
- 'ipsecpolicies': 'vpn',
- 'metering_labels': 'metering',
- 'metering_label_rules': 'metering',
- 'firewall_rules': 'fw',
- 'firewall_policies': 'fw',
- 'firewalls': 'fw'
-}
-
-# The following list represents resource names that do not require
-# changing underscore to a hyphen
-hyphen_exceptions = ["health_monitors", "firewall_rules", "firewall_policies"]
-
-# map from resource name to a plural name
-# needed only for those which can't be constructed as name + 's'
-resource_plural_map = {
- 'security_groups': 'security_groups',
- 'security_group_rules': 'security_group_rules',
- 'ipsecpolicy': 'ipsecpolicies',
- 'ikepolicy': 'ikepolicies',
- 'ipsecpolicy': 'ipsecpolicies',
- 'quotas': 'quotas',
- 'firewall_policy': 'firewall_policies'
-}
-
-
-class NetworkClientBase(object):
- def __init__(self, auth_provider):
- self.rest_client = self.get_rest_client(
- auth_provider)
- self.rest_client.service = CONF.network.catalog_type
- self.version = '2.0'
- self.uri_prefix = "v%s" % (self.version)
- self.build_timeout = CONF.network.build_timeout
- self.build_interval = CONF.network.build_interval
-
- def get_rest_client(self, auth_provider):
- raise NotImplementedError
-
- def post(self, uri, body, headers=None):
- return self.rest_client.post(uri, body, headers)
-
- def put(self, uri, body, headers=None):
- return self.rest_client.put(uri, body, headers)
-
- def get(self, uri, headers=None):
- return self.rest_client.get(uri, headers)
-
- def delete(self, uri, headers=None):
- return self.rest_client.delete(uri, headers)
-
- def deserialize_list(self, body):
- raise NotImplementedError
-
- def deserialize_single(self, body):
- raise NotImplementedError
-
- def get_uri(self, plural_name):
- # get service prefix from resource name
- service_prefix = service_resource_prefix_map.get(
- plural_name)
- if plural_name not in hyphen_exceptions:
- plural_name = plural_name.replace("_", "-")
- if service_prefix:
- uri = '%s/%s/%s' % (self.uri_prefix, service_prefix,
- plural_name)
- else:
- uri = '%s/%s' % (self.uri_prefix, plural_name)
- return uri
-
- def pluralize(self, resource_name):
- # get plural from map or just add 's'
- return resource_plural_map.get(resource_name, resource_name + 's')
-
- def _lister(self, plural_name):
- def _list(**filters):
- uri = self.get_uri(plural_name)
- if filters:
- uri += '?' + urllib.urlencode(filters, doseq=1)
- resp, body = self.get(uri)
- result = {plural_name: self.deserialize_list(body)}
- self.rest_client.expected_success(200, resp.status)
- return resp, result
-
- return _list
-
- def _deleter(self, resource_name):
- def _delete(resource_id):
- plural = self.pluralize(resource_name)
- uri = '%s/%s' % (self.get_uri(plural), resource_id)
- resp, body = self.delete(uri)
- self.rest_client.expected_success(204, resp.status)
- return resp, body
-
- return _delete
-
- def _shower(self, resource_name):
- def _show(resource_id, **fields):
- # fields is a dict which key is 'fields' and value is a
- # list of field's name. An example:
- # {'fields': ['id', 'name']}
- plural = self.pluralize(resource_name)
- uri = '%s/%s' % (self.get_uri(plural), resource_id)
- if fields:
- uri += '?' + urllib.urlencode(fields, doseq=1)
- resp, body = self.get(uri)
- body = self.deserialize_single(body)
- self.rest_client.expected_success(200, resp.status)
- return resp, body
-
- return _show
-
- def _creater(self, resource_name):
- def _create(**kwargs):
- plural = self.pluralize(resource_name)
- uri = self.get_uri(plural)
- post_data = self.serialize({resource_name: kwargs})
- resp, body = self.post(uri, post_data)
- body = self.deserialize_single(body)
- self.rest_client.expected_success(201, resp.status)
- return resp, body
-
- return _create
-
- def _updater(self, resource_name):
- def _update(res_id, **kwargs):
- plural = self.pluralize(resource_name)
- uri = '%s/%s' % (self.get_uri(plural), res_id)
- post_data = self.serialize({resource_name: kwargs})
- resp, body = self.put(uri, post_data)
- body = self.deserialize_single(body)
- self.rest_client.expected_success(200, resp.status)
- return resp, body
-
- return _update
-
- def __getattr__(self, name):
- method_prefixes = ["list_", "delete_", "show_", "create_", "update_"]
- method_functors = [self._lister,
- self._deleter,
- self._shower,
- self._creater,
- self._updater]
- for index, prefix in enumerate(method_prefixes):
- prefix_len = len(prefix)
- if name[:prefix_len] == prefix:
- return method_functors[index](name[prefix_len:])
- raise AttributeError(name)
-
- # Common methods that are hard to automate
- def create_bulk_network(self, names):
- network_list = [{'name': name} for name in names]
- post_data = {'networks': network_list}
- body = self.serialize_list(post_data, "networks", "network")
- uri = self.get_uri("networks")
- resp, body = self.post(uri, body)
- body = {'networks': self.deserialize_list(body)}
- self.rest_client.expected_success(201, resp.status)
- return resp, body
-
- def create_bulk_subnet(self, subnet_list):
- post_data = {'subnets': subnet_list}
- body = self.serialize_list(post_data, 'subnets', 'subnet')
- uri = self.get_uri('subnets')
- resp, body = self.post(uri, body)
- body = {'subnets': self.deserialize_list(body)}
- self.rest_client.expected_success(201, resp.status)
- return resp, body
-
- def create_bulk_port(self, port_list):
- post_data = {'ports': port_list}
- body = self.serialize_list(post_data, 'ports', 'port')
- uri = self.get_uri('ports')
- resp, body = self.post(uri, body)
- body = {'ports': self.deserialize_list(body)}
- self.rest_client.expected_success(201, resp.status)
- return resp, body
-
- def wait_for_resource_deletion(self, resource_type, id):
- """Waits for a resource to be deleted."""
- start_time = int(time.time())
- while True:
- if self.is_resource_deleted(resource_type, id):
- return
- if int(time.time()) - start_time >= self.build_timeout:
- raise exceptions.TimeoutException
- time.sleep(self.build_interval)
-
- def is_resource_deleted(self, resource_type, id):
- method = 'show_' + resource_type
- try:
- getattr(self, method)(id)
- except AttributeError:
- raise Exception("Unknown resource type %s " % resource_type)
- except exceptions.NotFound:
- return True
- return False
-
- def wait_for_resource_status(self, fetch, status, interval=None,
- timeout=None):
- """
- @summary: Waits for a network resource to reach a status
- @param fetch: the callable to be used to query the resource status
- @type fecth: callable that takes no parameters and returns the resource
- @param status: the status that the resource has to reach
- @type status: String
- @param interval: the number of seconds to wait between each status
- query
- @type interval: Integer
- @param timeout: the maximum number of seconds to wait for the resource
- to reach the desired status
- @type timeout: Integer
- """
- if not interval:
- interval = self.build_interval
- if not timeout:
- timeout = self.build_timeout
- start_time = time.time()
-
- while time.time() - start_time <= timeout:
- resource = fetch()
- if resource['status'] == status:
- return
- time.sleep(interval)
-
- # At this point, the wait has timed out
- message = 'Resource %s' % (str(resource))
- message += ' failed to reach status %s' % status
- message += ' (current: %s)' % resource['status']
- message += ' within the required time %s' % timeout
- caller = misc.find_test_caller()
- if caller:
- message = '(%s) %s' % (caller, message)
- raise exceptions.TimeoutException(message)
diff --git a/tempest/services/network/resources.py b/tempest/services/network/resources.py
index a84b4d5..513d2cf 100644
--- a/tempest/services/network/resources.py
+++ b/tempest/services/network/resources.py
@@ -82,7 +82,7 @@
self._router_ids = set()
def update(self, *args, **kwargs):
- _, result = self.client.update_subnet(subnet=self.id, *args, **kwargs)
+ result = self.client.update_subnet(subnet=self.id, *args, **kwargs)
super(DeletableSubnet, self).update(**result['subnet'])
def add_to_router(self, router_id):
@@ -108,9 +108,9 @@
return self.update(external_gateway_info=dict())
def update(self, *args, **kwargs):
- _, result = self.client.update_router(self.id,
- *args,
- **kwargs)
+ result = self.client.update_router(self.id,
+ *args,
+ **kwargs)
return super(DeletableRouter, self).update(**result['router'])
def delete(self):
@@ -121,15 +121,15 @@
class DeletableFloatingIp(DeletableResource):
def refresh(self, *args, **kwargs):
- _, result = self.client.show_floatingip(self.id,
- *args,
- **kwargs)
+ result = self.client.show_floatingip(self.id,
+ *args,
+ **kwargs)
super(DeletableFloatingIp, self).update(**result['floatingip'])
def update(self, *args, **kwargs):
- _, result = self.client.update_floatingip(self.id,
- *args,
- **kwargs)
+ result = self.client.update_floatingip(self.id,
+ *args,
+ **kwargs)
super(DeletableFloatingIp, self).update(**result['floatingip'])
def __repr__(self):
@@ -183,5 +183,5 @@
self.client.delete_vip(self.id)
def refresh(self):
- _, result = self.client.show_vip(self.id)
- super(DeletableVip, self).update(**result['vip'])
\ No newline at end of file
+ result = self.client.show_vip(self.id)
+ super(DeletableVip, self).update(**result['vip'])
diff --git a/tempest/services/object_storage/account_client.py b/tempest/services/object_storage/account_client.py
index a2044ef..23984cd 100644
--- a/tempest/services/object_storage/account_client.py
+++ b/tempest/services/object_storage/account_client.py
@@ -18,17 +18,14 @@
from xml.etree import ElementTree as etree
from tempest.common import http
-from tempest.common import rest_client
from tempest import config
from tempest import exceptions
+from tempest.services.object_storage import base
CONF = config.CONF
-class AccountClient(rest_client.RestClient):
- def __init__(self, auth_provider):
- super(AccountClient, self).__init__(auth_provider)
- self.service = CONF.object_storage.catalog_type
+class AccountClient(base.ObjectStorageClient):
def create_account(self, data=None,
params=None,
@@ -167,17 +164,10 @@
return resp, body
-class AccountClientCustomizedHeader(rest_client.RestClient):
+class AccountClientCustomizedHeader(base.ObjectStorageClient):
# TODO(andreaf) This class is now redundant, to be removed in next patch
- def __init__(self, auth_provider):
- super(AccountClientCustomizedHeader, self).__init__(
- auth_provider)
- # Overwrites json-specific header encoding in rest_client.RestClient
- self.service = CONF.object_storage.catalog_type
- self.format = 'json'
-
def request(self, method, url, extra_headers=False, headers=None,
body=None):
"""A simple HTTP request interface."""
diff --git a/tempest/services/object_storage/base.py b/tempest/services/object_storage/base.py
new file mode 100644
index 0000000..c903ca5
--- /dev/null
+++ b/tempest/services/object_storage/base.py
@@ -0,0 +1,29 @@
+# Copyright 2014 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.common import rest_client
+from tempest import config
+
+CONF = config.CONF
+
+
+class ObjectStorageClient(rest_client.RestClient):
+ """
+ Base object storage client class
+ """
+
+ def __init__(self, auth_provider):
+ super(ObjectStorageClient, self).__init__(auth_provider)
+ self.service = CONF.object_storage.catalog_type
+ self.format = 'json'
diff --git a/tempest/services/object_storage/container_client.py b/tempest/services/object_storage/container_client.py
index 182c4d0..c55826b 100644
--- a/tempest/services/object_storage/container_client.py
+++ b/tempest/services/object_storage/container_client.py
@@ -17,20 +17,10 @@
import urllib
from xml.etree import ElementTree as etree
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.object_storage import base
-class ContainerClient(rest_client.RestClient):
- def __init__(self, auth_provider):
- super(ContainerClient, self).__init__(auth_provider)
-
- # Overwrites json-specific header encoding in rest_client.RestClient
- self.headers = {}
- self.service = CONF.object_storage.catalog_type
- self.format = 'json'
+class ContainerClient(base.ObjectStorageClient):
def create_container(
self, container_name,
diff --git a/tempest/services/object_storage/object_client.py b/tempest/services/object_storage/object_client.py
index 7a69fa8..a93a9df 100644
--- a/tempest/services/object_storage/object_client.py
+++ b/tempest/services/object_storage/object_client.py
@@ -18,18 +18,14 @@
import urlparse
from tempest.common import http
-from tempest.common import rest_client
from tempest import config
from tempest import exceptions
+from tempest.services.object_storage import base
CONF = config.CONF
-class ObjectClient(rest_client.RestClient):
- def __init__(self, auth_provider):
- super(ObjectClient, self).__init__(auth_provider)
-
- self.service = CONF.object_storage.catalog_type
+class ObjectClient(base.ObjectStorageClient):
def create_object(self, container, object_name, data,
params=None, metadata=None):
@@ -182,17 +178,10 @@
return resp.status, resp.reason, resp_headers
-class ObjectClientCustomizedHeader(rest_client.RestClient):
+class ObjectClientCustomizedHeader(base.ObjectStorageClient):
# TODO(andreaf) This class is now redundant, to be removed in next patch
- def __init__(self, auth_provider):
- super(ObjectClientCustomizedHeader, self).__init__(
- auth_provider)
- # Overwrites json-specific header encoding in rest_client.RestClient
- self.service = CONF.object_storage.catalog_type
- self.format = 'json'
-
def request(self, method, url, extra_headers=False, headers=None,
body=None):
"""A simple HTTP request interface."""
diff --git a/tempest/services/telemetry/json/telemetry_client.py b/tempest/services/telemetry/json/telemetry_client.py
index 996aceb..d2dd375 100644
--- a/tempest/services/telemetry/json/telemetry_client.py
+++ b/tempest/services/telemetry/json/telemetry_client.py
@@ -13,15 +13,22 @@
# License for the specific language governing permissions and limitations
# under the License.
+import urllib
+
from tempest.common import rest_client
+from tempest import config
from tempest.openstack.common import jsonutils as json
-import tempest.services.telemetry.telemetry_client_base as client
+
+CONF = config.CONF
-class TelemetryClientJSON(client.TelemetryClientBase):
+class TelemetryClientJSON(rest_client.RestClient):
- def get_rest_client(self, auth_provider):
- return rest_client.RestClient(auth_provider)
+ def __init__(self, auth_provider):
+ super(TelemetryClientJSON, self).__init__(auth_provider)
+ self.service = CONF.telemetry.catalog_type
+ self.version = '2'
+ self.uri_prefix = "v%s" % self.version
def deserialize(self, body):
return json.loads(body.replace("\n", ""))
@@ -42,4 +49,87 @@
def create_sample(self, meter_name, sample_list):
uri = "%s/meters/%s" % (self.uri_prefix, meter_name)
- return self.post(uri, str(sample_list))
+ body = self.serialize(sample_list)
+ resp, body = self.post(uri, body)
+ body = self.deserialize(body)
+ return resp, body
+
+ def helper_list(self, uri, query=None, period=None):
+ uri_dict = {}
+ if query:
+ uri_dict = {'q.field': query[0],
+ 'q.op': query[1],
+ 'q.value': query[2]}
+ if period:
+ uri_dict['period'] = period
+ if uri_dict:
+ uri += "?%s" % urllib.urlencode(uri_dict)
+ resp, body = self.get(uri)
+ body = self.deserialize(body)
+ return resp, body
+
+ def list_resources(self, query=None):
+ uri = '%s/resources' % self.uri_prefix
+ return self.helper_list(uri, query)
+
+ def list_meters(self, query=None):
+ uri = '%s/meters' % self.uri_prefix
+ return self.helper_list(uri, query)
+
+ def list_alarms(self, query=None):
+ uri = '%s/alarms' % self.uri_prefix
+ return self.helper_list(uri, query)
+
+ def list_statistics(self, meter, period=None, query=None):
+ uri = "%s/meters/%s/statistics" % (self.uri_prefix, meter)
+ return self.helper_list(uri, query, period)
+
+ def list_samples(self, meter_id, query=None):
+ uri = '%s/meters/%s' % (self.uri_prefix, meter_id)
+ return self.helper_list(uri, query)
+
+ def get_resource(self, resource_id):
+ uri = '%s/resources/%s' % (self.uri_prefix, resource_id)
+ resp, body = self.get(uri)
+ body = self.deserialize(body)
+ return resp, body
+
+ def get_alarm(self, alarm_id):
+ uri = '%s/alarms/%s' % (self.uri_prefix, alarm_id)
+ resp, body = self.get(uri)
+ body = self.deserialize(body)
+ return resp, body
+
+ def delete_alarm(self, alarm_id):
+ uri = "%s/alarms/%s" % (self.uri_prefix, alarm_id)
+ resp, body = self.delete(uri)
+ if body:
+ body = self.deserialize(body)
+ return resp, body
+
+ def create_alarm(self, **kwargs):
+ uri = "%s/alarms" % self.uri_prefix
+ body = self.serialize(kwargs)
+ resp, body = self.post(uri, body)
+ body = self.deserialize(body)
+ return resp, body
+
+ def update_alarm(self, alarm_id, **kwargs):
+ uri = "%s/alarms/%s" % (self.uri_prefix, alarm_id)
+ body = self.serialize(kwargs)
+ resp, body = self.put(uri, body)
+ body = self.deserialize(body)
+ return resp, body
+
+ def alarm_get_state(self, alarm_id):
+ uri = "%s/alarms/%s/state" % (self.uri_prefix, alarm_id)
+ resp, body = self.get(uri)
+ body = self.deserialize(body)
+ return resp, body
+
+ def alarm_set_state(self, alarm_id, state):
+ uri = "%s/alarms/%s/state" % (self.uri_prefix, alarm_id)
+ body = self.serialize(state)
+ resp, body = self.put(uri, body)
+ body = self.deserialize(body)
+ return resp, body
diff --git a/tempest/services/telemetry/telemetry_client_base.py b/tempest/services/telemetry/telemetry_client_base.py
deleted file mode 100644
index a184a77..0000000
--- a/tempest/services/telemetry/telemetry_client_base.py
+++ /dev/null
@@ -1,151 +0,0 @@
-# Copyright 2013 OpenStack Foundation
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import abc
-import urllib
-
-import six
-
-from tempest import config
-
-CONF = config.CONF
-
-
-@six.add_metaclass(abc.ABCMeta)
-class TelemetryClientBase(object):
-
- """
- Tempest REST client for Ceilometer V2 API.
- Implements the following basic Ceilometer abstractions:
- resources
- meters
- alarms
- queries
- statistics
- """
-
- def __init__(self, auth_provider):
- self.rest_client = self.get_rest_client(auth_provider)
- self.rest_client.service = CONF.telemetry.catalog_type
- self.version = '2'
- self.uri_prefix = "v%s" % self.version
-
- @abc.abstractmethod
- def get_rest_client(self, auth_provider):
- """
- :param config:
- :param username:
- :param password:
- :param auth_url:
- :param tenant_name:
- :return: RestClient
- """
-
- @abc.abstractmethod
- def deserialize(self, body):
- """
- :param body:
- :return: Deserialize body
- """
-
- @abc.abstractmethod
- def serialize(self, body):
- """
- :param body:
- :return: Serialize body
- """
-
- def post(self, uri, body):
- body = self.serialize(body)
- resp, body = self.rest_client.post(uri, body)
- body = self.deserialize(body)
- return resp, body
-
- def put(self, uri, body):
- body = self.serialize(body)
- resp, body = self.rest_client.put(uri, body)
- body = self.deserialize(body)
- return resp, body
-
- def get(self, uri):
- resp, body = self.rest_client.get(uri)
- body = self.deserialize(body)
- return resp, body
-
- def delete(self, uri):
- resp, body = self.rest_client.delete(uri)
- if body:
- body = self.deserialize(body)
- return resp, body
-
- def helper_list(self, uri, query=None, period=None):
- uri_dict = {}
- if query:
- uri_dict = {'q.field': query[0],
- 'q.op': query[1],
- 'q.value': query[2]}
- if period:
- uri_dict['period'] = period
- if uri_dict:
- uri += "?%s" % urllib.urlencode(uri_dict)
- return self.get(uri)
-
- def list_resources(self, query=None):
- uri = '%s/resources' % self.uri_prefix
- return self.helper_list(uri, query)
-
- def list_meters(self, query=None):
- uri = '%s/meters' % self.uri_prefix
- return self.helper_list(uri, query)
-
- def list_alarms(self, query=None):
- uri = '%s/alarms' % self.uri_prefix
- return self.helper_list(uri, query)
-
- def list_statistics(self, meter, period=None, query=None):
- uri = "%s/meters/%s/statistics" % (self.uri_prefix, meter)
- return self.helper_list(uri, query, period)
-
- def list_samples(self, meter_id, query=None):
- uri = '%s/meters/%s' % (self.uri_prefix, meter_id)
- return self.helper_list(uri, query)
-
- def get_resource(self, resource_id):
- uri = '%s/resources/%s' % (self.uri_prefix, resource_id)
- return self.get(uri)
-
- def get_alarm(self, alarm_id):
- uri = '%s/alarms/%s' % (self.uri_prefix, alarm_id)
- return self.get(uri)
-
- def delete_alarm(self, alarm_id):
- uri = "%s/alarms/%s" % (self.uri_prefix, alarm_id)
- return self.delete(uri)
-
- def create_alarm(self, **kwargs):
- uri = "%s/alarms" % self.uri_prefix
- return self.post(uri, kwargs)
-
- def update_alarm(self, alarm_id, **kwargs):
- uri = "%s/alarms/%s" % (self.uri_prefix, alarm_id)
- return self.put(uri, kwargs)
-
- def alarm_get_state(self, alarm_id):
- uri = "%s/alarms/%s/state" % (self.uri_prefix, alarm_id)
- return self.get(uri)
-
- def alarm_set_state(self, alarm_id, state):
- uri = "%s/alarms/%s/state" % (self.uri_prefix, alarm_id)
- return self.put(uri, state)
diff --git a/tempest/services/volume/json/admin/volume_hosts_client.py b/tempest/services/volume/json/admin/volume_hosts_client.py
index 10cb0be..e7add30 100644
--- a/tempest/services/volume/json/admin/volume_hosts_client.py
+++ b/tempest/services/volume/json/admin/volume_hosts_client.py
@@ -16,24 +16,14 @@
import json
import urllib
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.volume.json import base
-class BaseVolumeHostsClientJSON(rest_client.RestClient):
+class BaseVolumeHostsClientJSON(base.VolumeClient):
"""
Client class to send CRUD Volume Hosts API requests to a Cinder endpoint
"""
- def __init__(self, auth_provider):
- super(BaseVolumeHostsClientJSON, self).__init__(auth_provider)
-
- self.service = CONF.volume.catalog_type
- self.build_interval = CONF.volume.build_interval
- self.build_timeout = CONF.volume.build_timeout
-
def list_hosts(self, params=None):
"""Lists all hosts."""
diff --git a/tempest/services/volume/json/admin/volume_quotas_client.py b/tempest/services/volume/json/admin/volume_quotas_client.py
index 5b49040..f08cb64 100644
--- a/tempest/services/volume/json/admin/volume_quotas_client.py
+++ b/tempest/services/volume/json/admin/volume_quotas_client.py
@@ -16,27 +16,17 @@
import urllib
-from tempest.common import rest_client
-from tempest import config
from tempest.openstack.common import jsonutils
-
-CONF = config.CONF
+from tempest.services.volume.json import base
-class BaseVolumeQuotasClientJSON(rest_client.RestClient):
+class BaseVolumeQuotasClientJSON(base.VolumeClient):
"""
Client class to send CRUD Volume Quotas API requests to a Cinder endpoint
"""
TYPE = "json"
- def __init__(self, auth_provider):
- super(BaseVolumeQuotasClientJSON, self).__init__(auth_provider)
-
- self.service = CONF.volume.catalog_type
- self.build_interval = CONF.volume.build_interval
- self.build_timeout = CONF.volume.build_timeout
-
def get_default_quota_set(self, tenant_id):
"""List the default volume quota set for a tenant."""
diff --git a/tempest/services/volume/json/admin/volume_services_client.py b/tempest/services/volume/json/admin/volume_services_client.py
index 88c6db0..5d4f9db 100644
--- a/tempest/services/volume/json/admin/volume_services_client.py
+++ b/tempest/services/volume/json/admin/volume_services_client.py
@@ -16,17 +16,10 @@
import json
import urllib
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.volume.json import base
-class BaseVolumesServicesClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(BaseVolumesServicesClientJSON, self).__init__(auth_provider)
- self.service = CONF.volume.catalog_type
+class BaseVolumesServicesClientJSON(base.VolumeClient):
def list_services(self, params=None):
url = 'os-services'
diff --git a/tempest/services/volume/json/admin/volume_types_client.py b/tempest/services/volume/json/admin/volume_types_client.py
index eedf880..171ad35 100644
--- a/tempest/services/volume/json/admin/volume_types_client.py
+++ b/tempest/services/volume/json/admin/volume_types_client.py
@@ -16,25 +16,15 @@
import json
import urllib
-from tempest.common import rest_client
-from tempest import config
from tempest import exceptions
-
-CONF = config.CONF
+from tempest.services.volume.json import base
-class BaseVolumeTypesClientJSON(rest_client.RestClient):
+class BaseVolumeTypesClientJSON(base.VolumeClient):
"""
Client class to send CRUD Volume Types API requests to a Cinder endpoint
"""
- def __init__(self, auth_provider):
- super(BaseVolumeTypesClientJSON, self).__init__(auth_provider)
-
- self.service = CONF.volume.catalog_type
- self.build_interval = CONF.volume.build_interval
- self.build_timeout = CONF.volume.build_timeout
-
def is_resource_deleted(self, resource):
# to use this method self.resource must be defined to respective value
# Resource is a dictionary containing resource id and type
diff --git a/tempest/services/volume/json/availability_zone_client.py b/tempest/services/volume/json/availability_zone_client.py
index 5ad2287..9f2c570 100644
--- a/tempest/services/volume/json/availability_zone_client.py
+++ b/tempest/services/volume/json/availability_zone_client.py
@@ -15,18 +15,10 @@
import json
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.volume.json import base
-class BaseVolumeAvailabilityZoneClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(BaseVolumeAvailabilityZoneClientJSON, self).__init__(
- auth_provider)
- self.service = CONF.volume.catalog_type
+class BaseVolumeAvailabilityZoneClientJSON(base.VolumeClient):
def get_availability_zone_list(self):
resp, body = self.get('os-availability-zone')
diff --git a/tempest/services/volume/json/backups_client.py b/tempest/services/volume/json/backups_client.py
index 51a017e..e2ba822 100644
--- a/tempest/services/volume/json/backups_client.py
+++ b/tempest/services/volume/json/backups_client.py
@@ -16,24 +16,15 @@
import json
import time
-from tempest.common import rest_client
-from tempest import config
from tempest import exceptions
-
-CONF = config.CONF
+from tempest.services.volume.json import base
-class BaseBackupsClientJSON(rest_client.RestClient):
+class BaseBackupsClientJSON(base.VolumeClient):
"""
Client class to send CRUD Volume backup API requests to a Cinder endpoint
"""
- def __init__(self, auth_provider):
- super(BaseBackupsClientJSON, self).__init__(auth_provider)
- self.service = CONF.volume.catalog_type
- self.build_interval = CONF.volume.build_interval
- self.build_timeout = CONF.volume.build_timeout
-
def create_backup(self, volume_id, container=None, name=None,
description=None):
"""Creates a backup of volume."""
diff --git a/tempest/services/volume/json/base.py b/tempest/services/volume/json/base.py
new file mode 100644
index 0000000..8bc2f93
--- /dev/null
+++ b/tempest/services/volume/json/base.py
@@ -0,0 +1,30 @@
+# Copyright 2014 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.common import rest_client
+from tempest import config
+
+CONF = config.CONF
+
+
+class VolumeClient(rest_client.RestClient):
+ """
+ Base volume client class
+ """
+
+ def __init__(self, auth_provider):
+ super(VolumeClient, self).__init__(auth_provider)
+ self.service = CONF.volume.catalog_type
+ self.build_interval = CONF.volume.build_interval
+ self.build_timeout = CONF.volume.build_timeout
diff --git a/tempest/services/volume/json/extensions_client.py b/tempest/services/volume/json/extensions_client.py
index c84b186..13b91c3 100644
--- a/tempest/services/volume/json/extensions_client.py
+++ b/tempest/services/volume/json/extensions_client.py
@@ -15,17 +15,10 @@
import json
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.volume.json import base
-class BaseExtensionsClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(BaseExtensionsClientJSON, self).__init__(auth_provider)
- self.service = CONF.volume.catalog_type
+class BaseExtensionsClientJSON(base.VolumeClient):
def list_extensions(self):
url = 'extensions'
diff --git a/tempest/services/volume/json/qos_client.py b/tempest/services/volume/json/qos_client.py
index b647bc7..9c13cac 100644
--- a/tempest/services/volume/json/qos_client.py
+++ b/tempest/services/volume/json/qos_client.py
@@ -15,22 +15,13 @@
import json
import time
-from tempest.common import rest_client
-from tempest import config
from tempest import exceptions
-
-CONF = config.CONF
+from tempest.services.volume.json import base
-class BaseQosSpecsClientJSON(rest_client.RestClient):
+class BaseQosSpecsClientJSON(base.VolumeClient):
"""Client class to send CRUD QoS API requests"""
- def __init__(self, auth_provider):
- super(BaseQosSpecsClientJSON, self).__init__(auth_provider)
- self.service = CONF.volume.catalog_type
- self.build_interval = CONF.volume.build_interval
- self.build_timeout = CONF.volume.build_timeout
-
def is_resource_deleted(self, qos_id):
try:
self.get_qos(qos_id)
diff --git a/tempest/services/volume/json/snapshots_client.py b/tempest/services/volume/json/snapshots_client.py
index e9d5b83..349d1b0 100644
--- a/tempest/services/volume/json/snapshots_client.py
+++ b/tempest/services/volume/json/snapshots_client.py
@@ -14,26 +14,18 @@
import time
import urllib
-from tempest.common import rest_client
-from tempest import config
from tempest import exceptions
from tempest.openstack.common import log as logging
+from tempest.services.volume.json import base
-CONF = config.CONF
LOG = logging.getLogger(__name__)
-class BaseSnapshotsClientJSON(rest_client.RestClient):
+class BaseSnapshotsClientJSON(base.VolumeClient):
"""Base Client class to send CRUD Volume API requests."""
- def __init__(self, auth_provider):
- super(BaseSnapshotsClientJSON, self).__init__(auth_provider)
-
- self.service = CONF.volume.catalog_type
- self.build_interval = CONF.volume.build_interval
- self.build_timeout = CONF.volume.build_timeout
- self.create_resp = 200
+ create_resp = 200
def list_snapshots(self, params=None):
"""List all the snapshot."""
diff --git a/tempest/services/volume/json/volumes_client.py b/tempest/services/volume/json/volumes_client.py
index 1e49e5a..f19718e 100644
--- a/tempest/services/volume/json/volumes_client.py
+++ b/tempest/services/volume/json/volumes_client.py
@@ -17,25 +17,19 @@
import time
import urllib
-from tempest.common import rest_client
from tempest import config
from tempest import exceptions
+from tempest.services.volume.json import base
CONF = config.CONF
-class BaseVolumesClientJSON(rest_client.RestClient):
+class BaseVolumesClientJSON(base.VolumeClient):
"""
Base client class to send CRUD Volume API requests to a Cinder endpoint
"""
- def __init__(self, auth_provider):
- super(BaseVolumesClientJSON, self).__init__(auth_provider)
-
- self.service = CONF.volume.catalog_type
- self.build_interval = CONF.volume.build_interval
- self.build_timeout = CONF.volume.build_timeout
- self.create_resp = 200
+ create_resp = 200
def get_attachment_from_volume(self, volume):
"""Return the element 'attachment' from input volumes."""
diff --git a/tempest/test.py b/tempest/test.py
index d614127..cc8370c 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -273,8 +273,8 @@
cls.resource_setup()
except Exception:
etype, value, trace = sys.exc_info()
- LOG.info("%s in %s.setUpClass. Invoking tearDownClass." % (
- cls.__name__, etype))
+ LOG.info("%s raised in %s.setUpClass. Invoking tearDownClass." % (
+ etype, cls.__name__))
cls.tearDownClass()
try:
raise etype, value, trace
@@ -320,20 +320,6 @@
del trace # to avoid circular refs
@classmethod
- def resource_setup(cls):
- """Class level resource setup for test cases.
- """
- pass
-
- @classmethod
- def resource_cleanup(cls):
- """Class level resource cleanup for test cases.
- Resource cleanup must be able to handle the case of partially setup
- resources, in case a failure during `resource_setup` should happen.
- """
- pass
-
- @classmethod
def skip_checks(cls):
"""Class level skip checks. Subclasses verify in here all
conditions that might prevent the execution of the entire test class.
@@ -361,6 +347,20 @@
# specify which client is `client` and nothing else.
pass
+ @classmethod
+ def resource_setup(cls):
+ """Class level resource setup for test cases.
+ """
+ pass
+
+ @classmethod
+ def resource_cleanup(cls):
+ """Class level resource cleanup for test cases.
+ Resource cleanup must be able to handle the case of partially setup
+ resources, in case a failure during `resource_setup` should happen.
+ """
+ pass
+
def setUp(self):
super(BaseTestCase, self).setUp()
if not self.setUpClassCalled:
diff --git a/tempest/tests/cmd/test_verify_tempest_config.py b/tempest/tests/cmd/test_verify_tempest_config.py
index 9ff7481..65106cc 100644
--- a/tempest/tests/cmd/test_verify_tempest_config.py
+++ b/tempest/tests/cmd/test_verify_tempest_config.py
@@ -204,9 +204,9 @@
def test_verify_extensions_neutron(self):
def fake_list_extensions():
- return (None, {'extensions': [{'alias': 'fake1'},
- {'alias': 'fake2'},
- {'alias': 'not_fake'}]})
+ return {'extensions': [{'alias': 'fake1'},
+ {'alias': 'fake2'},
+ {'alias': 'not_fake'}]}
fake_os = mock.MagicMock()
fake_os.network_client.list_extensions = fake_list_extensions
self.useFixture(mockpatch.PatchObject(
@@ -226,9 +226,9 @@
def test_verify_extensions_neutron_all(self):
def fake_list_extensions():
- return (None, {'extensions': [{'alias': 'fake1'},
- {'alias': 'fake2'},
- {'alias': 'not_fake'}]})
+ return {'extensions': [{'alias': 'fake1'},
+ {'alias': 'fake2'},
+ {'alias': 'not_fake'}]}
fake_os = mock.MagicMock()
fake_os.network_client.list_extensions = fake_list_extensions
self.useFixture(mockpatch.PatchObject(
diff --git a/tempest/tests/test_tenant_isolation.py b/tempest/tests/test_tenant_isolation.py
index df9719b..053dae1 100644
--- a/tempest/tests/test_tenant_isolation.py
+++ b/tempest/tests/test_tenant_isolation.py
@@ -92,24 +92,21 @@
net_fix = self.useFixture(mockpatch.PatchObject(
iso_creds.network_admin_client,
'create_network',
- return_value=({'status': 200},
- {'network': {'id': id, 'name': name}})))
+ return_value={'network': {'id': id, 'name': name}}))
return net_fix
def _mock_subnet_create(self, iso_creds, id, name):
subnet_fix = self.useFixture(mockpatch.PatchObject(
iso_creds.network_admin_client,
'create_subnet',
- return_value=({'status': 200},
- {'subnet': {'id': id, 'name': name}})))
+ return_value={'subnet': {'id': id, 'name': name}}))
return subnet_fix
def _mock_router_create(self, id, name):
router_fix = self.useFixture(mockpatch.PatchObject(
json_network_client.NetworkClientJSON,
'create_router',
- return_value=({'status': 200},
- {'router': {'id': id, 'name': name}})))
+ return_value={'router': {'id': id, 'name': name}}))
return router_fix
@mock.patch('tempest.common.rest_client.RestClient')
@@ -242,12 +239,11 @@
@mock.patch('tempest.common.rest_client.RestClient')
def test_network_cleanup(self, MockRestClient):
def side_effect(**args):
- return ({'status': 200},
- {"security_groups": [{"tenant_id": args['tenant_id'],
- "name": args['name'],
- "description": args['name'],
- "security_group_rules": [],
- "id": "sg-%s" % args['tenant_id']}]})
+ return {"security_groups": [{"tenant_id": args['tenant_id'],
+ "name": args['name'],
+ "description": args['name'],
+ "security_group_rules": [],
+ "id": "sg-%s" % args['tenant_id']}]}
iso_creds = isolated_creds.IsolatedCreds('test class',
password='fake_password')
# Create primary tenant and network
@@ -324,8 +320,8 @@
return_values = (fake_http.fake_httplib({}, status=204), {})
remove_secgroup_mock = self.patch(
- 'tempest.services.network.network_client_base.'
- 'NetworkClientBase.delete', return_value=return_values)
+ 'tempest.services.network.json.network_client.'
+ 'NetworkClientJSON.delete', return_value=return_values)
iso_creds.clear_isolated_creds()
# Verify default security group delete
calls = remove_secgroup_mock.mock_calls
diff --git a/tempest/thirdparty/boto/test_ec2_instance_run.py b/tempest/thirdparty/boto/test_ec2_instance_run.py
index 00b17d9..707590e 100644
--- a/tempest/thirdparty/boto/test_ec2_instance_run.py
+++ b/tempest/thirdparty/boto/test_ec2_instance_run.py
@@ -157,19 +157,24 @@
instance.add_tag('key1', value='value1')
tags = self.ec2_client.get_all_tags()
- self.assertEqual(tags[0].name, 'key1')
- self.assertEqual(tags[0].value, 'value1')
+ td = {item.name: item.value for item in tags}
+
+ self.assertIn('key1', td)
+ self.assertEqual('value1', td['key1'])
tags = self.ec2_client.get_all_tags(filters={'key': 'key1'})
- self.assertEqual(tags[0].name, 'key1')
- self.assertEqual(tags[0].value, 'value1')
+ td = {item.name: item.value for item in tags}
+ self.assertIn('key1', td)
+ self.assertEqual('value1', td['key1'])
tags = self.ec2_client.get_all_tags(filters={'value': 'value1'})
- self.assertEqual(tags[0].name, 'key1')
- self.assertEqual(tags[0].value, 'value1')
+ td = {item.name: item.value for item in tags}
+ self.assertIn('key1', td)
+ self.assertEqual('value1', td['key1'])
tags = self.ec2_client.get_all_tags(filters={'key': 'value2'})
- self.assertEqual(len(tags), 0, str(tags))
+ td = {item.name: item.value for item in tags}
+ self.assertNotIn('key1', td)
for instance in reservation.instances:
instance.remove_tag('key1', value='value1')
diff --git a/tools/pretty_tox.sh b/tools/pretty_tox.sh
index ff554c5..fb4e6d5 100755
--- a/tools/pretty_tox.sh
+++ b/tools/pretty_tox.sh
@@ -3,4 +3,10 @@
set -o pipefail
TESTRARGS=$1
-python setup.py testr --slowest --testr-args="--subunit $TESTRARGS" | subunit-trace --no-failure-debug -f
+python setup.py testr --testr-args="--subunit $TESTRARGS" | subunit-trace --no-failure-debug -f
+retval=$?
+# NOTE(mtreinish) The pipe above would eat the slowest display from pbr's testr
+# wrapper so just manually print the slowest tests.
+echo -e "\nSlowest Tests:\n"
+testr slowest
+exit $retval
diff --git a/tox.ini b/tox.ini
index edfee15..fe2f79e 100644
--- a/tox.ini
+++ b/tox.ini
@@ -7,7 +7,8 @@
sitepackages = True
setenv = VIRTUAL_ENV={envdir}
OS_TEST_PATH=./tempest/test_discover
-deps = -r{toxinidir}/requirements.txt
+deps = setuptools
+ -r{toxinidir}/requirements.txt
[testenv]
setenv = VIRTUAL_ENV={envdir}