Merge "Add compute personality feature config"
diff --git a/tempest/api/compute/servers/test_create_server.py b/tempest/api/compute/servers/test_create_server.py
index 2f7ae25..902b72c 100644
--- a/tempest/api/compute/servers/test_create_server.py
+++ b/tempest/api/compute/servers/test_create_server.py
@@ -40,6 +40,7 @@
cls.client = cls.servers_client
cls.network_client = cls.os.network_client
cls.networks_client = cls.os.networks_client
+ cls.subnets_client = cls.os.subnets_client
@classmethod
def resource_setup(cls):
@@ -68,11 +69,11 @@
self.addCleanup(self.networks_client.delete_network,
net['network']['id'])
- subnet = self.network_client.create_subnet(
+ subnet = self.subnets_client.create_subnet(
network_id=net['network']['id'],
cidr=cidr,
ip_version=4)
- self.addCleanup(self.network_client.delete_subnet,
+ self.addCleanup(self.subnets_client.delete_subnet,
subnet['subnet']['id'])
return net
diff --git a/tempest/api/compute/test_authorization.py b/tempest/api/compute/test_authorization.py
index 484c156..f8d0cca 100644
--- a/tempest/api/compute/test_authorization.py
+++ b/tempest/api/compute/test_authorization.py
@@ -186,6 +186,14 @@
@test.idempotent_id('acf8724b-142b-4044-82c3-78d31a533f24')
def test_create_server_fails_when_tenant_incorrect(self):
+ # BUG(sdague): this test should fail because of bad auth url,
+ # which means that when we run with a service catalog without
+ # project_id in the urls, it should fail to fail, and thus
+ # fail the test. It does not.
+ #
+ # The 400 BadRequest is clearly ambiguous, and something else
+ # is wrong about this request. This should be fixed.
+ #
# A create server request should fail if the tenant id does not match
# the current user
# Change the base URL to impersonate another user
@@ -199,9 +207,22 @@
@test.idempotent_id('f03d1ded-7fd4-4d29-bc13-e2391f29c625')
def test_create_keypair_in_analt_user_tenant(self):
- # A create keypair request should fail if the tenant id does not match
- # the current user
- # POST keypair with other user tenant
+ """create keypair should not function for alternate tenant
+
+ POST {alt_service_url}/os-keypairs
+
+ Attempt to create a keypair against an alternate tenant by
+ changing using a different tenant's service url. This should
+ return a BadRequest. This tests basic tenant isolation protections.
+
+ NOTE(sdague): if the environment does not use project_id in
+ the service urls, this test is not valid. Skip under these
+ conditions.
+
+ """
+ if self.alt_keypairs_client.base_url == self.keypairs_client.base_url:
+ raise self.skipException("Service urls don't include project_id")
+
k_name = data_utils.rand_name('keypair')
try:
# Change the base URL to impersonate another user
@@ -250,9 +271,23 @@
@test.idempotent_id('752c917e-83be-499d-a422-3559127f7d3c')
def test_create_security_group_in_analt_user_tenant(self):
- # A create security group request should fail if the tenant id does not
- # match the current user
- # POST security group with other user tenant
+ """create security group should not function for alternate tenant
+
+ POST {alt_service_url}/os-security-groups
+
+ Attempt to create a security group against an alternate tenant
+ by changing using a different tenant's service url. This
+ should return a BadRequest. This tests basic tenant isolation
+ protections.
+
+ NOTE(sdague): if the environment does not use project_id in
+ the service urls, this test is not valid. Skip under these
+ conditions.
+
+ """
+ if self.alt_security_client.base_url == self.security_client.base_url:
+ raise self.skipException("Service urls don't include project_id")
+
s_name = data_utils.rand_name('security')
s_description = data_utils.rand_name('security')
try:
@@ -289,9 +324,23 @@
@test.idempotent_id('b2b76de0-210a-4089-b921-591c9ec552f6')
def test_create_security_group_rule_in_analt_user_tenant(self):
- # A create security group rule request should fail if the tenant id
- # does not match the current user
- # POST security group rule with other user tenant
+ """create security group rule should not function for alternate tenant
+
+ POST {alt_service_url}/os-security-group-rules
+
+ Attempt to create a security group rule against an alternate
+ tenant by changing using a different tenant's service
+ url. This should return a BadRequest. This tests basic tenant
+ isolation protections.
+
+ NOTE(sdague): if the environment does not use project_id in
+ the service urls, this test is not valid. Skip under these
+ conditions.
+
+ """
+ if self.alt_security_client.base_url == self.security_client.base_url:
+ raise self.skipException("Service urls don't include project_id")
+
parent_group_id = self.security_group['id']
ip_protocol = 'icmp'
from_port = -1
diff --git a/tempest/api/image/v2/test_images.py b/tempest/api/image/v2/test_images.py
index a336507..bacf211 100644
--- a/tempest/api/image/v2/test_images.py
+++ b/tempest/api/image/v2/test_images.py
@@ -18,10 +18,15 @@
from six import moves
+from oslo_log import log as logging
from tempest.api.image import base
from tempest.common.utils import data_utils
+from tempest import config
from tempest import test
+CONF = config.CONF
+LOG = logging.getLogger(__name__)
+
class BasicOperationsImagesTest(base.BaseV2ImageTest):
"""
@@ -39,9 +44,11 @@
uuid = '00000000-1111-2222-3333-444455556666'
image_name = data_utils.rand_name('image')
+ container_format = CONF.image.container_formats[0]
+ disk_format = CONF.image.disk_formats[0]
body = self.create_image(name=image_name,
- container_format='bare',
- disk_format='raw',
+ container_format=container_format,
+ disk_format=disk_format,
visibility='private',
ramdisk_id=uuid)
self.assertIn('id', body)
@@ -77,9 +84,11 @@
# Create image
image_name = data_utils.rand_name('image')
+ container_format = CONF.image.container_formats[0]
+ disk_format = CONF.image.disk_formats[0]
body = self.client.create_image(name=image_name,
- container_format='bare',
- disk_format='raw',
+ container_format=container_format,
+ disk_format=disk_format,
visibility='private')
image_id = body['id']
@@ -99,9 +108,11 @@
# Create image
image_name = data_utils.rand_name('image')
+ container_format = CONF.image.container_formats[0]
+ disk_format = CONF.image.disk_formats[0]
body = self.client.create_image(name=image_name,
- container_format='bare',
- disk_format='iso',
+ container_format=container_format,
+ disk_format=disk_format,
visibility='private')
self.addCleanup(self.client.delete_image, body['id'])
self.assertEqual('queued', body['status'])
@@ -133,13 +144,17 @@
super(ListImagesTest, cls).resource_setup()
# We add a few images here to test the listing functionality of
# the images API
- cls._create_standard_image('bare', 'raw')
- cls._create_standard_image('bare', 'raw')
- cls._create_standard_image('ami', 'raw')
- # Add some more for listing
- cls._create_standard_image('ami', 'ami')
- cls._create_standard_image('ari', 'ari')
- cls._create_standard_image('aki', 'aki')
+ container_fmts = CONF.image.container_formats
+ disk_fmts = CONF.image.disk_formats
+ all_pairs = [(container_fmt, disk_fmt)
+ for container_fmt in container_fmts
+ for disk_fmt in disk_fmts]
+
+ for (container_fmt, disk_fmt) in all_pairs[:6]:
+ LOG.debug("Creating a image"
+ "(Container format: %s, Disk format: %s).",
+ container_fmt, disk_fmt)
+ cls._create_standard_image(container_fmt, disk_fmt)
@classmethod
def _create_standard_image(cls, container_format, disk_format):
@@ -201,7 +216,7 @@
@test.idempotent_id('cf1b9a48-8340-480e-af7b-fe7e17690876')
def test_list_images_param_size(self):
# Test to get all images by size
- image_id = self.created_images[1]
+ image_id = self.created_images[0]
# Get image metadata
image = self.client.show_image(image_id)
@@ -211,7 +226,7 @@
@test.idempotent_id('4ad8c157-971a-4ba8-aa84-ed61154b1e7f')
def test_list_images_param_min_max_size(self):
# Test to get all images with size between 2000 to 3000
- image_id = self.created_images[1]
+ image_id = self.created_images[0]
# Get image metadata
image = self.client.show_image(image_id)
@@ -234,7 +249,7 @@
@test.idempotent_id('e914a891-3cc8-4b40-ad32-e0a39ffbddbb')
def test_list_images_param_limit(self):
# Test to get images by limit
- params = {"limit": 2}
+ params = {"limit": 1}
images_list = self.client.list_images(params=params)['images']
self.assertEqual(len(images_list), params['limit'],
diff --git a/tempest/api/network/admin/test_external_network_extension.py b/tempest/api/network/admin/test_external_network_extension.py
index 62aa18e..ac53587 100644
--- a/tempest/api/network/admin/test_external_network_extension.py
+++ b/tempest/api/network/admin/test_external_network_extension.py
@@ -103,8 +103,9 @@
self.addCleanup(self._try_delete_resource,
self.admin_networks_client.delete_network,
external_network['id'])
- subnet = self.create_subnet(external_network, client=client,
- enable_dhcp=False)
+ subnet = self.create_subnet(
+ external_network, client=self.admin_subnets_client,
+ enable_dhcp=False)
body = client.create_floatingip(
floating_network_id=external_network['id'])
created_floating_ip = body['floatingip']
@@ -121,7 +122,7 @@
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 = self.admin_subnets_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/base.py b/tempest/api/network/base.py
index 39bdcff..26cf180 100644
--- a/tempest/api/network/base.py
+++ b/tempest/api/network/base.py
@@ -74,6 +74,7 @@
super(BaseNetworkTest, cls).setup_clients()
cls.client = cls.os.network_client
cls.networks_client = cls.os.networks_client
+ cls.subnets_client = cls.os.subnets_client
@classmethod
def resource_setup(cls):
@@ -115,7 +116,7 @@
router)
# Clean up subnets
for subnet in cls.subnets:
- cls._try_delete_resource(cls.client.delete_subnet,
+ cls._try_delete_resource(cls.subnets_client.delete_subnet,
subnet['id'])
# Clean up networks
for network in cls.networks:
@@ -160,7 +161,7 @@
# allow tests to use admin client
if not client:
- client = cls.client
+ client = cls.subnets_client
# The cidr and mask_bits depend on the ip version.
ip_version = ip_version if ip_version is not None else cls._ip_version
@@ -267,6 +268,7 @@
super(BaseAdminNetworkTest, cls).setup_clients()
cls.admin_client = cls.os_adm.network_client
cls.admin_networks_client = cls.os_adm.networks_client
+ cls.admin_subnets_client = cls.os_adm.subnets_client
@classmethod
def create_metering_label(cls, name, description):
diff --git a/tempest/api/network/test_dhcp_ipv6.py b/tempest/api/network/test_dhcp_ipv6.py
index f362f85..631a38b 100644
--- a/tempest/api/network/test_dhcp_ipv6.py
+++ b/tempest/api/network/test_dhcp_ipv6.py
@@ -75,11 +75,11 @@
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)
- body = self.client.list_subnets()
+ body = self.subnets_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.subnets_client.delete_subnet(subnet['id'])
self._remove_from_list_by_index(self.subnets, subnet)
body = self.client.list_routers()
routers = body['routers']
diff --git a/tempest/api/network/test_networks.py b/tempest/api/network/test_networks.py
index a4ab43a..c5b2080 100644
--- a/tempest/api/network/test_networks.py
+++ b/tempest/api/network/test_networks.py
@@ -194,7 +194,7 @@
subnet_id = subnet['id']
# Verify subnet update
new_name = "New_subnet"
- body = self.client.update_subnet(subnet_id, name=new_name)
+ body = self.subnets_client.update_subnet(subnet_id, name=new_name)
updated_subnet = body['subnet']
self.assertEqual(updated_subnet['name'], new_name)
@@ -241,7 +241,7 @@
@test.idempotent_id('bd635d81-6030-4dd1-b3b9-31ba0cfdf6cc')
def test_show_subnet(self):
# Verify the details of a subnet
- body = self.client.show_subnet(self.subnet['id'])
+ body = self.subnets_client.show_subnet(self.subnet['id'])
subnet = body['subnet']
self.assertNotEmpty(subnet, "Subnet returned has no fields")
for key in ['id', 'cidr']:
@@ -252,8 +252,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.subnets_client.show_subnet(self.subnet['id'],
+ fields=fields)
subnet = body['subnet']
self.assertEqual(sorted(subnet.keys()), sorted(fields))
for field_name in fields:
@@ -263,7 +263,7 @@
@test.idempotent_id('db68ba48-f4ea-49e9-81d1-e367f6d0b20a')
def test_list_subnets(self):
# Verify the subnet exists in the list of all subnets
- body = self.client.list_subnets()
+ body = self.subnets_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")
@@ -272,7 +272,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.subnets_client.list_subnets(fields=fields)
subnets = body['subnets']
self.assertNotEmpty(subnets, "Subnet list returned is empty")
for subnet in subnets:
@@ -303,7 +303,7 @@
body = self.networks_client.delete_network(net_id)
# Verify that the subnet got automatically deleted.
- self.assertRaises(lib_exc.NotFound, self.client.show_subnet,
+ self.assertRaises(lib_exc.NotFound, self.subnets_client.show_subnet,
subnet_id)
# Since create_subnet adds the subnet to the delete list, and it is
@@ -362,8 +362,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.subnets_client.update_subnet(subnet_id, name=new_name,
+ **kwargs)
updated_subnet = body['subnet']
kwargs['name'] = new_name
self.assertEqual(sorted(updated_subnet['dns_nameservers']),
@@ -398,7 +398,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.subnets_client.list_subnets()
subnets = [sub['id'] for sub in body['subnets']
if sub['id'] in public_subnets_iter]
self.assertEmpty(subnets, "Public subnets visible")
@@ -435,9 +435,9 @@
def _delete_subnets(self, created_subnets):
for n in created_subnets:
- self.client.delete_subnet(n['id'])
+ self.subnets_client.delete_subnet(n['id'])
# Asserting that the subnets are not found in the list after deletion
- body = self.client.list_subnets()
+ body = self.subnets_client.list_subnets()
subnets_list = [subnet['id'] for subnet in body['subnets']]
for n in created_subnets:
self.assertNotIn(n['id'], subnets_list)
@@ -496,7 +496,7 @@
created_subnets = body['subnets']
self.addCleanup(self._delete_subnets, created_subnets)
# Asserting that the subnets are found in the list after creation
- body = self.client.list_subnets()
+ body = self.subnets_client.list_subnets()
subnets_list = [subnet['id'] for subnet in body['subnets']]
for n in created_subnets:
self.assertIsNotNone(n['id'])
@@ -576,7 +576,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.subnets_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)]
@@ -621,9 +621,9 @@
'ipv6_address_mode': mode})
port = self.create_port(slaac_network)
self.assertIsNotNone(port['fixed_ips'][0]['ip_address'])
- self.client.delete_subnet(subnet_slaac['id'])
+ self.subnets_client.delete_subnet(subnet_slaac['id'])
self.subnets.pop()
- subnets = self.client.list_subnets()
+ subnets = self.subnets_client.list_subnets()
subnet_ids = [subnet['id'] for subnet in subnets['subnets']]
self.assertNotIn(subnet_slaac['id'], subnet_ids,
"Subnet wasn't deleted")
diff --git a/tempest/api/network/test_networks_negative.py b/tempest/api/network/test_networks_negative.py
index 4d1971f..4fe31cf 100644
--- a/tempest/api/network/test_networks_negative.py
+++ b/tempest/api/network/test_networks_negative.py
@@ -34,7 +34,7 @@
@test.idempotent_id('d746b40c-5e09-4043-99f7-cba1be8b70df')
def test_show_non_existent_subnet(self):
non_exist_id = data_utils.rand_uuid()
- self.assertRaises(lib_exc.NotFound, self.client.show_subnet,
+ self.assertRaises(lib_exc.NotFound, self.subnets_client.show_subnet,
non_exist_id)
@test.attr(type=['negative'])
@@ -64,7 +64,7 @@
@test.idempotent_id('1cc47884-ac52-4415-a31c-e7ce5474a868')
def test_update_non_existent_subnet(self):
non_exist_id = data_utils.rand_uuid()
- self.assertRaises(lib_exc.NotFound, self.client.update_subnet,
+ self.assertRaises(lib_exc.NotFound, self.subnets_client.update_subnet,
non_exist_id, name='new_name')
@test.attr(type=['negative'])
@@ -72,7 +72,7 @@
def test_delete_non_existent_subnet(self):
non_exist_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound,
- self.client.delete_subnet, non_exist_id)
+ self.subnets_client.delete_subnet, non_exist_id)
@test.attr(type=['negative'])
@test.idempotent_id('13d3b106-47e6-4b9b-8d53-dae947f092fe')
diff --git a/tempest/api/network/test_ports.py b/tempest/api/network/test_ports.py
index 321473c..6f58075 100644
--- a/tempest/api/network/test_ports.py
+++ b/tempest/api/network/test_ports.py
@@ -106,7 +106,7 @@
allocation_pools = {'allocation_pools': [{'start': str(address + 4),
'end': str(address + 6)}]}
subnet = self.create_subnet(network, **allocation_pools)
- self.addCleanup(self.client.delete_subnet, subnet['id'])
+ self.addCleanup(self.subnets_client.delete_subnet, subnet['id'])
body = self.client.create_port(network_id=net_id)
self.addCleanup(self.client.delete_port, body['port']['id'])
port = body['port']
@@ -155,7 +155,7 @@
# Create network and subnet
network = self.create_network()
subnet = self.create_subnet(network)
- self.addCleanup(self.client.delete_subnet, subnet['id'])
+ self.addCleanup(self.subnets_client.delete_subnet, subnet['id'])
# Create two ports
port_1 = self.client.create_port(network_id=network['id'])
self.addCleanup(self.client.delete_port, port_1['port']['id'])
@@ -187,7 +187,7 @@
network = self.create_network()
self.addCleanup(self.networks_client.delete_network, network['id'])
subnet = self.create_subnet(network)
- self.addCleanup(self.client.delete_subnet, subnet['id'])
+ self.addCleanup(self.subnets_client.delete_subnet, subnet['id'])
router = self.create_router(data_utils.rand_name('router-'))
self.addCleanup(self.client.delete_router, router['id'])
port = self.client.create_port(network_id=network['id'])
@@ -220,9 +220,9 @@
network = self.create_network()
self.addCleanup(self.networks_client.delete_network, network['id'])
subnet_1 = self.create_subnet(network)
- self.addCleanup(self.client.delete_subnet, subnet_1['id'])
+ self.addCleanup(self.subnets_client.delete_subnet, subnet_1['id'])
subnet_2 = self.create_subnet(network)
- self.addCleanup(self.client.delete_subnet, subnet_2['id'])
+ self.addCleanup(self.subnets_client.delete_subnet, subnet_2['id'])
fixed_ip_1 = [{'subnet_id': subnet_1['id']}]
fixed_ip_2 = [{'subnet_id': subnet_2['id']}]
@@ -247,7 +247,7 @@
def _update_port_with_security_groups(self, security_groups_names):
subnet_1 = self.create_subnet(self.network)
- self.addCleanup(self.client.delete_subnet, subnet_1['id'])
+ self.addCleanup(self.subnets_client.delete_subnet, subnet_1['id'])
fixed_ip_1 = [{'subnet_id': subnet_1['id']}]
security_groups_list = list()
@@ -328,7 +328,7 @@
network = self.create_network()
self.addCleanup(self.networks_client.delete_network, network['id'])
subnet = self.create_subnet(network)
- self.addCleanup(self.client.delete_subnet, subnet['id'])
+ self.addCleanup(self.subnets_client.delete_subnet, subnet['id'])
port = self.create_port(network, security_groups=[])
self.addCleanup(self.client.delete_port, port['id'])
self.assertIsNotNone(port['security_groups'])
diff --git a/tempest/api/orchestration/stacks/test_neutron_resources.py b/tempest/api/orchestration/stacks/test_neutron_resources.py
index 99c2a97..070150d 100644
--- a/tempest/api/orchestration/stacks/test_neutron_resources.py
+++ b/tempest/api/orchestration/stacks/test_neutron_resources.py
@@ -44,6 +44,7 @@
def setup_clients(cls):
super(NeutronResourcesTestJSON, cls).setup_clients()
cls.network_client = cls.os.network_client
+ cls.subnets_client = cls.os.subnets_client
@classmethod
def resource_setup(cls):
@@ -130,7 +131,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.subnets_client.show_subnet(subnet_id)
subnet = body['subnet']
network_id = self.test_resources.get('Network')['physical_resource_id']
self.assertEqual(subnet_id, subnet['id'])
diff --git a/tempest/api_schema/response/compute/v2_1/aggregates.py b/tempest/api_schema/response/compute/v2_1/aggregates.py
deleted file mode 100644
index 1a9fe41..0000000
--- a/tempest/api_schema/response/compute/v2_1/aggregates.py
+++ /dev/null
@@ -1,92 +0,0 @@
-# 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.
-
-import copy
-
-# create-aggregate api doesn't have 'hosts' and 'metadata' attributes.
-aggregate_for_create = {
- 'type': 'object',
- 'properties': {
- 'availability_zone': {'type': ['string', 'null']},
- 'created_at': {'type': 'string'},
- 'deleted': {'type': 'boolean'},
- 'deleted_at': {'type': ['string', 'null']},
- 'id': {'type': 'integer'},
- 'name': {'type': 'string'},
- 'updated_at': {'type': ['string', 'null']}
- },
- 'additionalProperties': False,
- 'required': ['availability_zone', 'created_at', 'deleted',
- 'deleted_at', 'id', 'name', 'updated_at'],
-}
-
-common_aggregate_info = copy.deepcopy(aggregate_for_create)
-common_aggregate_info['properties'].update({
- 'hosts': {'type': 'array'},
- 'metadata': {'type': 'object'}
-})
-common_aggregate_info['required'].extend(['hosts', 'metadata'])
-
-list_aggregates = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'aggregates': {
- 'type': 'array',
- 'items': common_aggregate_info
- }
- },
- 'additionalProperties': False,
- 'required': ['aggregates'],
- }
-}
-
-get_aggregate = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'aggregate': common_aggregate_info
- },
- 'additionalProperties': False,
- 'required': ['aggregate'],
- }
-}
-
-aggregate_set_metadata = get_aggregate
-# The 'updated_at' attribute of 'update_aggregate' can't be null.
-update_aggregate = copy.deepcopy(get_aggregate)
-update_aggregate['response_body']['properties']['aggregate']['properties'][
- 'updated_at'] = {
- 'type': 'string'
- }
-
-delete_aggregate = {
- 'status_code': [200]
-}
-
-create_aggregate = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'aggregate': aggregate_for_create
- },
- 'additionalProperties': False,
- 'required': ['aggregate'],
- }
-}
-
-aggregate_add_remove_host = get_aggregate
diff --git a/tempest/api_schema/response/compute/v2_1/availability_zone.py b/tempest/api_schema/response/compute/v2_1/availability_zone.py
deleted file mode 100644
index d9aebce..0000000
--- a/tempest/api_schema/response/compute/v2_1/availability_zone.py
+++ /dev/null
@@ -1,78 +0,0 @@
-# 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.
-
-import copy
-
-
-base = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'availabilityZoneInfo': {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'zoneName': {'type': 'string'},
- 'zoneState': {
- 'type': 'object',
- 'properties': {
- 'available': {'type': 'boolean'}
- },
- 'additionalProperties': False,
- 'required': ['available']
- },
- # NOTE: Here is the difference between detail and
- # non-detail.
- 'hosts': {'type': 'null'}
- },
- 'additionalProperties': False,
- 'required': ['zoneName', 'zoneState', 'hosts']
- }
- }
- },
- 'additionalProperties': False,
- 'required': ['availabilityZoneInfo']
- }
-}
-
-detail = {
- 'type': 'object',
- 'patternProperties': {
- # NOTE: Here is for a hostname
- '^[a-zA-Z0-9-_.]+$': {
- 'type': 'object',
- 'patternProperties': {
- # NOTE: Here is for a service name
- '^.*$': {
- 'type': 'object',
- 'properties': {
- 'available': {'type': 'boolean'},
- 'active': {'type': 'boolean'},
- 'updated_at': {'type': ['string', 'null']}
- },
- 'additionalProperties': False,
- 'required': ['available', 'active', 'updated_at']
- }
- }
- }
- }
-}
-
-list_availability_zone_list = copy.deepcopy(base)
-
-list_availability_zone_list_detail = copy.deepcopy(base)
-list_availability_zone_list_detail['response_body']['properties'][
- 'availabilityZoneInfo']['items']['properties']['hosts'] = detail
diff --git a/tempest/api_schema/response/compute/v2_1/baremetal_nodes.py b/tempest/api_schema/response/compute/v2_1/baremetal_nodes.py
deleted file mode 100644
index d1ee877..0000000
--- a/tempest/api_schema/response/compute/v2_1/baremetal_nodes.py
+++ /dev/null
@@ -1,63 +0,0 @@
-# Copyright 2015 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import copy
-
-node = {
- 'type': 'object',
- 'properties': {
- 'id': {'type': 'string'},
- 'interfaces': {'type': 'array'},
- 'host': {'type': 'string'},
- 'task_state': {'type': ['string', 'null']},
- 'cpus': {'type': ['integer', 'string']},
- 'memory_mb': {'type': ['integer', 'string']},
- 'disk_gb': {'type': ['integer', 'string']},
- },
- 'additionalProperties': False,
- 'required': ['id', 'interfaces', 'host', 'task_state', 'cpus', 'memory_mb',
- 'disk_gb']
-}
-
-list_baremetal_nodes = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'nodes': {
- 'type': 'array',
- 'items': node
- }
- },
- 'additionalProperties': False,
- 'required': ['nodes']
- }
-}
-
-baremetal_node = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'node': node
- },
- 'additionalProperties': False,
- 'required': ['node']
- }
-}
-get_baremetal_node = copy.deepcopy(baremetal_node)
-get_baremetal_node['response_body']['properties']['node'][
- 'properties'].update({'instance_uuid': {'type': ['string', 'null']}})
-get_baremetal_node['response_body']['properties']['node'][
- 'required'].append('instance_uuid')
diff --git a/tempest/api_schema/response/compute/v2_1/certificates.py b/tempest/api_schema/response/compute/v2_1/certificates.py
deleted file mode 100644
index 4e7cbe4..0000000
--- a/tempest/api_schema/response/compute/v2_1/certificates.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# 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.
-
-import copy
-
-_common_schema = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'certificate': {
- 'type': 'object',
- 'properties': {
- 'data': {'type': 'string'},
- 'private_key': {'type': 'string'},
- },
- 'additionalProperties': False,
- 'required': ['data', 'private_key']
- }
- },
- 'additionalProperties': False,
- 'required': ['certificate']
- }
-}
-
-get_certificate = copy.deepcopy(_common_schema)
-get_certificate['response_body']['properties']['certificate'][
- 'properties']['private_key'].update({'type': 'null'})
-
-create_certificate = copy.deepcopy(_common_schema)
diff --git a/tempest/api_schema/response/compute/v2_1/extensions.py b/tempest/api_schema/response/compute/v2_1/extensions.py
deleted file mode 100644
index a6a455c..0000000
--- a/tempest/api_schema/response/compute/v2_1/extensions.py
+++ /dev/null
@@ -1,47 +0,0 @@
-# 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.
-
-list_extensions = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'extensions': {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'updated': {
- 'type': 'string',
- 'format': 'data-time'
- },
- 'name': {'type': 'string'},
- 'links': {'type': 'array'},
- 'namespace': {
- 'type': 'string',
- 'format': 'uri'
- },
- 'alias': {'type': 'string'},
- 'description': {'type': 'string'}
- },
- 'additionalProperties': False,
- 'required': ['updated', 'name', 'links', 'namespace',
- 'alias', 'description']
- }
- }
- },
- 'additionalProperties': False,
- 'required': ['extensions']
- }
-}
diff --git a/tempest/clients.py b/tempest/clients.py
index cffdc3f..19d3000 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -17,6 +17,15 @@
from oslo_log import log as logging
from tempest_lib.services.compute.agents_client import AgentsClient
+from tempest_lib.services.compute.aggregates_client import AggregatesClient
+from tempest_lib.services.compute.availability_zone_client import \
+ AvailabilityZoneClient
+from tempest_lib.services.compute.baremetal_nodes_client import \
+ BaremetalNodesClient
+from tempest_lib.services.compute.certificates_client import \
+ CertificatesClient
+from tempest_lib.services.compute.extensions_client import \
+ ExtensionsClient
from tempest_lib.services.identity.v2.token_client import TokenClient
from tempest_lib.services.identity.v3.token_client import V3TokenClient
@@ -28,16 +37,6 @@
from tempest.services.baremetal.v1.json.baremetal_client import \
BaremetalClient
from tempest.services import botoclients
-from tempest.services.compute.json.aggregates_client import \
- AggregatesClient
-from tempest.services.compute.json.availability_zone_client import \
- AvailabilityZoneClient
-from tempest.services.compute.json.baremetal_nodes_client import \
- BaremetalNodesClient
-from tempest.services.compute.json.certificates_client import \
- CertificatesClient
-from tempest.services.compute.json.extensions_client import \
- ExtensionsClient
from tempest.services.compute.json.fixed_ips_client import FixedIPsClient
from tempest.services.compute.json.flavors_client import FlavorsClient
from tempest.services.compute.json.floating_ip_pools_client import \
@@ -108,6 +107,7 @@
MessagingClient
from tempest.services.network.json.network_client import NetworkClient
from tempest.services.network.json.networks_client import NetworksClient
+from tempest.services.network.json.subnets_client import SubnetsClient
from tempest.services.object_storage.account_client import AccountClient
from tempest.services.object_storage.container_client import ContainerClient
from tempest.services.object_storage.object_client import ObjectClient
@@ -205,6 +205,14 @@
build_interval=CONF.network.build_interval,
build_timeout=CONF.network.build_timeout,
**self.default_params)
+ self.subnets_client = SubnetsClient(
+ self.auth_provider,
+ CONF.network.catalog_type,
+ CONF.network.region or CONF.identity.region,
+ endpoint_type=CONF.network.endpoint_type,
+ build_interval=CONF.network.build_interval,
+ build_timeout=CONF.network.build_timeout,
+ **self.default_params)
self.messaging_client = MessagingClient(
self.auth_provider,
CONF.messaging.catalog_type,
diff --git a/tempest/cmd/account_generator.py b/tempest/cmd/account_generator.py
index 02c6e7f..a90b0ce 100755
--- a/tempest/cmd/account_generator.py
+++ b/tempest/cmd/account_generator.py
@@ -94,6 +94,7 @@
from tempest.services.identity.v2.json import identity_client
from tempest.services.network.json import network_client
from tempest.services.network.json import networks_client
+from tempest.services.network.json import subnets_client
import tempest_lib.auth
from tempest_lib.common.utils import data_utils
import tempest_lib.exceptions
@@ -138,6 +139,7 @@
)
network_admin = None
networks_admin = None
+ subnets_admin = None
neutron_iso_networks = False
if (CONF.service_available.neutron and
CONF.auth.create_isolated_networks):
@@ -154,12 +156,19 @@
CONF.network.region or CONF.identity.region,
endpoint_type='adminURL',
**params)
- return identity_admin, neutron_iso_networks, network_admin, networks_admin
+ subnets_admin = subnets_client.SubnetsClient(
+ _auth,
+ CONF.network.catalog_type,
+ CONF.network.region or CONF.identity.region,
+ endpoint_type='adminURL',
+ **params)
+ return (identity_admin, neutron_iso_networks, network_admin,
+ networks_admin, subnets_admin)
def create_resources(opts, resources):
(identity_admin, neutron_iso_networks,
- network_admin, networks_admin) = get_admin_clients(opts)
+ network_admin, networks_admin, subnets_admin) = get_admin_clients(opts)
roles = identity_admin.list_roles()['roles']
for u in resources['users']:
u['role_ids'] = []
@@ -202,7 +211,8 @@
for u in resources['users']:
tenant = identity_admin.get_tenant_by_name(u['tenant'])
network_name, router_name = create_network_resources(
- network_admin, networks_admin, tenant['id'], u['name'])
+ network_admin, networks_admin, subnets_admin, tenant['id'],
+ u['name'])
u['network'] = network_name
u['router'] = router_name
LOG.info('Networks created')
@@ -229,7 +239,7 @@
def create_network_resources(network_admin_client, networks_admin_client,
- tenant_id, name):
+ subnets_admin_client, tenant_id, name):
def _create_network(name):
resp_body = networks_admin_client.create_network(
@@ -241,7 +251,7 @@
mask_bits = CONF.network.tenant_network_mask_bits
for subnet_cidr in base_cidr.subnet(mask_bits):
try:
- resp_body = network_admin_client.\
+ resp_body = subnets_admin_client.\
create_subnet(
network_id=network_id, cidr=str(subnet_cidr),
name=subnet_name,
diff --git a/tempest/cmd/cleanup_service.py b/tempest/cmd/cleanup_service.py
index 6c79abc..64e1303 100644
--- a/tempest/cmd/cleanup_service.py
+++ b/tempest/cmd/cleanup_service.py
@@ -382,6 +382,7 @@
super(NetworkService, self).__init__(kwargs)
self.client = manager.network_client
self.networks_client = manager.networks_client
+ self.subnets_client = manager.subnets_client
def _filter_by_conf_networks(self, item_list):
if not item_list or not all(('network_id' in i for i in item_list)):
@@ -676,7 +677,7 @@
class NetworkSubnetService(NetworkService):
def list(self):
- client = self.client
+ client = self.subnets_client
subnets = client.list_subnets(**self.tenant_filter)
subnets = subnets['subnets']
if self.is_preserve:
@@ -685,7 +686,7 @@
return subnets
def delete(self):
- client = self.client
+ client = self.subnets_client
subnets = self.list()
for subnet in subnets:
try:
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index 2dbcd98..d9588b3 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -129,6 +129,7 @@
from tempest.services.identity.v2.json import identity_client
from tempest.services.image.v2.json import image_client
from tempest.services.network.json import network_client
+from tempest.services.network.json import subnets_client
from tempest.services.object_storage import container_client
from tempest.services.object_storage import object_client
from tempest.services.telemetry.json import telemetry_client
@@ -240,6 +241,14 @@
build_interval=CONF.network.build_interval,
build_timeout=CONF.network.build_timeout,
**default_params)
+ self.subnets = subnets_client.SubnetsClient(
+ _auth,
+ CONF.network.catalog_type,
+ CONF.network.region or CONF.identity.region,
+ endpoint_type=CONF.network.endpoint_type,
+ build_interval=CONF.network.build_interval,
+ build_timeout=CONF.network.build_timeout,
+ **default_params)
def load_resources(fname):
@@ -769,9 +778,9 @@
LOG.info("Destroying subnets")
for subnet in subnets:
client = client_for_user(subnet['owner'])
- subnet_id = _get_resource_by_name(client.networks,
+ subnet_id = _get_resource_by_name(client.subnets,
'subnets', subnet['name'])['id']
- client.networks.delete_subnet(subnet_id)
+ client.subnets.delete_subnet(subnet_id)
def create_routers(routers):
diff --git a/tempest/common/dynamic_creds.py b/tempest/common/dynamic_creds.py
index f0b6625..8ff189a 100644
--- a/tempest/common/dynamic_creds.py
+++ b/tempest/common/dynamic_creds.py
@@ -41,8 +41,9 @@
'identity_admin', fill_in=True,
identity_version=self.identity_version)
(self.identity_admin_client, self.network_admin_client,
- self.networks_admin_client) = self._get_admin_clients()
- # Domain where dynamic credentials are provisioned (v3 only).
+ self.networks_admin_client,
+ self.subnets_admin_client) = self._get_admin_clients()
+ # Domain where isolated credentials are provisioned (v3 only).
# Use that of the admin account is None is configured.
self.creds_domain_name = None
if self.identity_version == 'v3':
@@ -61,9 +62,11 @@
"""
os = clients.Manager(self.default_admin_creds)
if self.identity_version == 'v2':
- return os.identity_client, os.network_client, os.networks_client
+ return (os.identity_client, os.network_client, os.networks_client,
+ os.subnets_client)
else:
- return os.identity_v3_client, os.network_client, os.networks_client
+ return (os.identity_v3_client, os.network_client,
+ os.networks_client, os.subnets_client)
def _create_creds(self, suffix="", admin=False, roles=None):
"""Create random credentials under the following schema.
@@ -168,7 +171,7 @@
for subnet_cidr in base_cidr.subnet(mask_bits):
try:
if self.network_resources:
- resp_body = self.network_admin_client.\
+ resp_body = self.subnets_admin_client.\
create_subnet(
network_id=network_id, cidr=str(subnet_cidr),
name=subnet_name,
@@ -176,7 +179,7 @@
enable_dhcp=self.network_resources['dhcp'],
ip_version=4)
else:
- resp_body = self.network_admin_client.\
+ resp_body = self.subnets_admin_client.\
create_subnet(network_id=network_id,
cidr=str(subnet_cidr),
name=subnet_name,
@@ -260,9 +263,9 @@
router_name)
def _clear_isolated_subnet(self, subnet_id, subnet_name):
- net_client = self.network_admin_client
+ client = self.subnets_admin_client
try:
- net_client.delete_subnet(subnet_id)
+ client.delete_subnet(subnet_id)
except lib_exc.NotFound:
LOG.warn('subnet with name: %s not found for delete' %
subnet_name)
diff --git a/tempest/config.py b/tempest/config.py
index b9c8aa7..0cda018 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -483,7 +483,16 @@
cfg.IntOpt('build_interval',
default=1,
help="Time in seconds between image operation status "
- "checks.")
+ "checks."),
+ cfg.ListOpt('container_formats',
+ default=['ami', 'ari', 'aki', 'bare', 'ovf', 'ova'],
+ help="A list of image's container formats "
+ "users can specify."),
+ cfg.ListOpt('disk_formats',
+ default=['ami', 'ari', 'aki', 'vhd', 'vmdk', 'raw', 'qcow2',
+ 'vdi', 'iso'],
+ help="A list of image's disk formats "
+ "users can specify.")
]
image_feature_group = cfg.OptGroup(name='image-feature-enabled',
@@ -929,29 +938,32 @@
]
-data_processing_group = cfg.OptGroup(name="data_processing",
+data_processing_group = cfg.OptGroup(name="data-processing",
title="Data Processing options")
DataProcessingGroup = [
cfg.StrOpt('catalog_type',
- default='data_processing',
+ default='data-processing',
+ deprecated_group="data_processing",
help="Catalog type of the data processing service."),
cfg.StrOpt('endpoint_type',
default='publicURL',
choices=['public', 'admin', 'internal',
'publicURL', 'adminURL', 'internalURL'],
+ deprecated_group="data_processing",
help="The endpoint type to use for the data processing "
"service."),
]
data_processing_feature_group = cfg.OptGroup(
- name="data_processing-feature-enabled",
+ name="data-processing-feature-enabled",
title="Enabled Data Processing features")
DataProcessingFeaturesGroup = [
cfg.ListOpt('plugins',
default=["vanilla", "hdp"],
+ deprecated_group="data_processing-feature-enabled",
help="List of enabled data processing plugins")
]
@@ -1297,9 +1309,7 @@
class TempestConfigPrivate(object):
"""Provides OpenStack configuration information."""
- DEFAULT_CONFIG_DIR = os.path.join(
- os.path.abspath(os.path.dirname(os.path.dirname(__file__))),
- "etc")
+ DEFAULT_CONFIG_DIR = os.path.join(os.getcwd(), "etc")
DEFAULT_CONFIG_FILE = "tempest.conf"
@@ -1329,9 +1339,9 @@
self.telemetry = _CONF.telemetry
self.telemetry_feature_enabled = _CONF['telemetry-feature-enabled']
self.dashboard = _CONF.dashboard
- self.data_processing = _CONF.data_processing
+ self.data_processing = _CONF['data-processing']
self.data_processing_feature_enabled = _CONF[
- 'data_processing-feature-enabled']
+ 'data-processing-feature-enabled']
self.boto = _CONF.boto
self.stress = _CONF.stress
self.scenario = _CONF.scenario
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index fd84570..036914e 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -62,6 +62,7 @@
# Neutron network client
cls.network_client = cls.manager.network_client
cls.networks_client = cls.manager.networks_client
+ cls.subnets_client = cls.manager.subnets_client
# Heat client
cls.orchestration_client = cls.manager.orchestration_client
@@ -494,9 +495,23 @@
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
proc.communicate()
+
return (proc.returncode == 0) == should_succeed
- return tempest.test.call_until_true(ping, timeout, 1)
+ caller = misc_utils.find_test_caller()
+ LOG.debug('%(caller)s begins to ping %(ip)s in %(timeout)s sec and the'
+ ' expected result is %(should_succeed)s' % {
+ 'caller': caller, 'ip': ip_address, 'timeout': timeout,
+ 'should_succeed':
+ 'reachable' if should_succeed else 'unreachable'
+ })
+ result = tempest.test.call_until_true(ping, timeout, 1)
+ LOG.debug('%(caller)s finishes ping %(ip)s in %(timeout)s sec and the '
+ 'ping result is %(result)s' % {
+ 'caller': caller, 'ip': ip_address, 'timeout': timeout,
+ 'result': 'expected' if result else 'unexpected'
+ })
+ return result
def check_vm_connectivity(self, ip_address,
username=None,
@@ -630,7 +645,7 @@
def _list_subnets(self, *args, **kwargs):
"""List subnets using admin creds """
- subnets_list = self.admin_manager.network_client.list_subnets(
+ subnets_list = self.admin_manager.subnets_client.list_subnets(
*args, **kwargs)
return subnets_list['subnets']
@@ -652,14 +667,16 @@
*args, **kwargs)
return agents_list['agents']
- def _create_subnet(self, network, client=None, namestart='subnet-smoke',
- **kwargs):
+ def _create_subnet(self, network, client=None, subnets_client=None,
+ namestart='subnet-smoke', **kwargs):
"""
Create a subnet for the given network within the cidr block
configured for tenant networks.
"""
if not client:
client = self.network_client
+ if not subnets_client:
+ subnets_client = self.subnets_client
def cidr_in_use(cidr, tenant_id):
"""
@@ -697,15 +714,16 @@
**kwargs
)
try:
- result = client.create_subnet(**subnet)
+ result = subnets_client.create_subnet(**subnet)
break
except lib_exc.Conflict as e:
is_overlapping_cidr = 'overlaps with another subnet' in str(e)
if not is_overlapping_cidr:
raise
self.assertIsNotNone(result, 'Unable to allocate tenant network')
- subnet = net_resources.DeletableSubnet(client=client,
- **result['subnet'])
+ subnet = net_resources.DeletableSubnet(
+ network_client=client, subnets_client=subnets_client,
+ **result['subnet'])
self.assertEqual(subnet.cidr, str_cidr)
self.addCleanup(self.delete_wrapper, subnet.delete)
return subnet
@@ -726,7 +744,7 @@
return port
def _get_server_port_id_and_ip4(self, server, ip_addr=None):
- ports = self._list_ports(device_id=server['id'],
+ ports = self._list_ports(device_id=server['id'], status='ACTIVE',
fixed_ip=ip_addr)
# it might happen here that this port has more then one ip address
# as in case of dual stack- when this port is created on 2 subnets
@@ -1062,7 +1080,8 @@
self.assertEqual(admin_state_up, router.admin_state_up)
def create_networks(self, client=None, networks_client=None,
- tenant_id=None, dns_nameservers=None):
+ subnets_client=None, tenant_id=None,
+ dns_nameservers=None):
"""Create a network with a subnet connected to a router.
The baremetal driver is a special case since all nodes are
@@ -1092,7 +1111,8 @@
tenant_id=tenant_id)
router = self._get_router(client=client, tenant_id=tenant_id)
- subnet_kwargs = dict(network=network, client=client)
+ subnet_kwargs = dict(network=network, client=client,
+ subnets_client=subnets_client)
# use explicit check because empty list is a valid option
if dns_nameservers is not None:
subnet_kwargs['dns_nameservers'] = dns_nameservers
diff --git a/tempest/scenario/test_security_groups_basic_ops.py b/tempest/scenario/test_security_groups_basic_ops.py
index a35c0b2..3c11c22 100644
--- a/tempest/scenario/test_security_groups_basic_ops.py
+++ b/tempest/scenario/test_security_groups_basic_ops.py
@@ -291,7 +291,8 @@
def _create_tenant_network(self, tenant):
network, subnet, router = self.create_networks(
client=tenant.manager.network_client,
- networks_client=tenant.manager.networks_client)
+ networks_client=tenant.manager.networks_client,
+ subnets_client=tenant.manager.subnets_client)
tenant.set_network(network, subnet, router)
def _set_compute_context(self, tenant):
diff --git a/tempest/services/compute/json/aggregates_client.py b/tempest/services/compute/json/aggregates_client.py
deleted file mode 100644
index c9895db..0000000
--- a/tempest/services/compute/json/aggregates_client.py
+++ /dev/null
@@ -1,100 +0,0 @@
-# Copyright 2013 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 oslo_serialization import jsonutils as json
-from tempest_lib import exceptions as lib_exc
-
-from tempest.api_schema.response.compute.v2_1 import aggregates as schema
-from tempest.common import service_client
-
-
-class AggregatesClient(service_client.ServiceClient):
-
- def list_aggregates(self):
- """Get aggregate list."""
- resp, body = self.get("os-aggregates")
- body = json.loads(body)
- self.validate_response(schema.list_aggregates, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def show_aggregate(self, aggregate_id):
- """Get details of the given aggregate."""
- resp, body = self.get("os-aggregates/%s" % aggregate_id)
- body = json.loads(body)
- self.validate_response(schema.get_aggregate, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def create_aggregate(self, **kwargs):
- """Creates a new aggregate."""
- post_body = json.dumps({'aggregate': kwargs})
- resp, body = self.post('os-aggregates', post_body)
-
- body = json.loads(body)
- self.validate_response(schema.create_aggregate, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def update_aggregate(self, aggregate_id, **kwargs):
- """Update a aggregate."""
- put_body = json.dumps({'aggregate': kwargs})
- resp, body = self.put('os-aggregates/%s' % aggregate_id, put_body)
-
- body = json.loads(body)
- self.validate_response(schema.update_aggregate, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def delete_aggregate(self, aggregate_id):
- """Deletes the given aggregate."""
- resp, body = self.delete("os-aggregates/%s" % aggregate_id)
- self.validate_response(schema.delete_aggregate, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def is_resource_deleted(self, id):
- try:
- self.show_aggregate(id)
- except lib_exc.NotFound:
- return True
- return False
-
- @property
- def resource_type(self):
- """Returns the primary type of resource this client works with."""
- return 'aggregate'
-
- def add_host(self, aggregate_id, **kwargs):
- """Adds a host to the given aggregate."""
- post_body = json.dumps({'add_host': kwargs})
- resp, body = self.post('os-aggregates/%s/action' % aggregate_id,
- post_body)
- body = json.loads(body)
- self.validate_response(schema.aggregate_add_remove_host, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def remove_host(self, aggregate_id, **kwargs):
- """Removes a host from the given aggregate."""
- post_body = json.dumps({'remove_host': kwargs})
- resp, body = self.post('os-aggregates/%s/action' % aggregate_id,
- post_body)
- body = json.loads(body)
- self.validate_response(schema.aggregate_add_remove_host, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def set_metadata(self, aggregate_id, **kwargs):
- """Replaces the aggregate's existing metadata with new metadata."""
- post_body = json.dumps({'set_metadata': kwargs})
- resp, body = self.post('os-aggregates/%s/action' % aggregate_id,
- post_body)
- body = json.loads(body)
- self.validate_response(schema.aggregate_set_metadata, resp, body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/availability_zone_client.py b/tempest/services/compute/json/availability_zone_client.py
deleted file mode 100644
index 0012637..0000000
--- a/tempest/services/compute/json/availability_zone_client.py
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright 2013 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 oslo_serialization import jsonutils as json
-
-from tempest.api_schema.response.compute.v2_1 import availability_zone \
- as schema
-from tempest.common import service_client
-
-
-class AvailabilityZoneClient(service_client.ServiceClient):
-
- def list_availability_zones(self, detail=False):
- url = 'os-availability-zone'
- schema_list = schema.list_availability_zone_list
- if detail:
- url += '/detail'
- schema_list = schema.list_availability_zone_list_detail
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema_list, resp, body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/baremetal_nodes_client.py b/tempest/services/compute/json/baremetal_nodes_client.py
deleted file mode 100644
index 15f883a..0000000
--- a/tempest/services/compute/json/baremetal_nodes_client.py
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright 2015 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
-
-from tempest.api_schema.response.compute.v2_1 import baremetal_nodes \
- as schema
-from tempest.common import service_client
-
-
-class BaremetalNodesClient(service_client.ServiceClient):
- """
- Tests Baremetal API
- """
-
- def list_baremetal_nodes(self, **params):
- """List all baremetal nodes."""
- url = 'os-baremetal-nodes'
- if params:
- url += '?%s' % urllib.urlencode(params)
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.list_baremetal_nodes, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def show_baremetal_node(self, baremetal_node_id):
- """Returns the details of a single baremetal node."""
- url = 'os-baremetal-nodes/%s' % baremetal_node_id
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.get_baremetal_node, resp, body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/certificates_client.py b/tempest/services/compute/json/certificates_client.py
deleted file mode 100644
index d6c72f4..0000000
--- a/tempest/services/compute/json/certificates_client.py
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright 2013 IBM Corp
-# 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 oslo_serialization import jsonutils as json
-
-from tempest.api_schema.response.compute.v2_1 import certificates as schema
-from tempest.common import service_client
-
-
-class CertificatesClient(service_client.ServiceClient):
-
- def show_certificate(self, certificate_id):
- url = "os-certificates/%s" % certificate_id
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.get_certificate, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def create_certificate(self):
- """create certificates."""
- url = "os-certificates"
- resp, body = self.post(url, None)
- body = json.loads(body)
- self.validate_response(schema.create_certificate, resp, body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/extensions_client.py b/tempest/services/compute/json/extensions_client.py
deleted file mode 100644
index 4741812..0000000
--- a/tempest/services/compute/json/extensions_client.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright 2012 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.
-
-from oslo_serialization import jsonutils as json
-
-from tempest.api_schema.response.compute.v2_1 import extensions as schema
-from tempest.common import service_client
-
-
-class ExtensionsClient(service_client.ServiceClient):
-
- def list_extensions(self):
- url = 'extensions'
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.list_extensions, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def show_extension(self, extension_alias):
- resp, body = self.get('extensions/%s' % extension_alias)
- body = json.loads(body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/servers_client.py b/tempest/services/compute/json/servers_client.py
index 1d2c7b2..e54cfe4 100644
--- a/tempest/services/compute/json/servers_client.py
+++ b/tempest/services/compute/json/servers_client.py
@@ -32,8 +32,8 @@
self.enable_instance_password = enable_instance_password
def create_server(self, **kwargs):
- """
- Creates an instance of a server.
+ """Create server
+
Most parameters except the following are passed to the API without
any changes.
:param disk_config: The name is changed to OS-DCF:diskConfig
@@ -69,7 +69,8 @@
return service_client.ResponseBody(resp, body)
def update_server(self, server_id, **kwargs):
- """Updates the properties of an existing server.
+ """Update server
+
Most parameters except the following are passed to the API without
any changes.
:param disk_config: The name is changed to OS-DCF:diskConfig
@@ -84,20 +85,20 @@
return service_client.ResponseBody(resp, body)
def show_server(self, server_id):
- """Returns the details of an existing server."""
+ """Get server details"""
resp, body = self.get("servers/%s" % server_id)
body = json.loads(body)
self.validate_response(schema.get_server, resp, body)
return service_client.ResponseBody(resp, body)
def delete_server(self, server_id):
- """Deletes the given server."""
+ """Delete server"""
resp, body = self.delete("servers/%s" % server_id)
self.validate_response(schema.delete_server, resp, body)
return service_client.ResponseBody(resp, body)
def list_servers(self, detail=False, **params):
- """Lists all servers for a user."""
+ """List servers"""
url = 'servers'
_schema = schema.list_servers
diff --git a/tempest/services/compute/json/services_client.py b/tempest/services/compute/json/services_client.py
index f82a18f..6e2f320 100644
--- a/tempest/services/compute/json/services_client.py
+++ b/tempest/services/compute/json/services_client.py
@@ -33,25 +33,25 @@
self.validate_response(schema.list_services, resp, body)
return service_client.ResponseBody(resp, body)
- def enable_service(self, host_name, binary):
+ def enable_service(self, **kwargs):
"""
Enable service on a host
host_name: Name of host
binary: Service binary
"""
- post_body = json.dumps({'binary': binary, 'host': host_name})
+ post_body = json.dumps(kwargs)
resp, body = self.put('os-services/enable', post_body)
body = json.loads(body)
self.validate_response(schema.enable_disable_service, resp, body)
return service_client.ResponseBody(resp, body)
- def disable_service(self, host_name, binary):
+ def disable_service(self, **kwargs):
"""
Disable service on a host
host_name: Name of host
binary: Service binary
"""
- post_body = json.dumps({'binary': binary, 'host': host_name})
+ post_body = json.dumps(kwargs)
resp, body = self.put('os-services/disable', post_body)
body = json.loads(body)
self.validate_response(schema.enable_disable_service, resp, body)
diff --git a/tempest/services/network/json/network_client.py b/tempest/services/network/json/network_client.py
index d766aa5..7821f37 100644
--- a/tempest/services/network/json/network_client.py
+++ b/tempest/services/network/json/network_client.py
@@ -34,28 +34,6 @@
quotas
"""
- def create_subnet(self, **kwargs):
- uri = '/subnets'
- post_data = {'subnet': kwargs}
- return self.create_resource(uri, post_data)
-
- def update_subnet(self, subnet_id, **kwargs):
- uri = '/subnets/%s' % subnet_id
- post_data = {'subnet': kwargs}
- return self.update_resource(uri, post_data)
-
- def show_subnet(self, subnet_id, **fields):
- uri = '/subnets/%s' % subnet_id
- return self.show_resource(uri, **fields)
-
- def delete_subnet(self, subnet_id):
- uri = '/subnets/%s' % subnet_id
- return self.delete_resource(uri)
-
- def list_subnets(self, **filters):
- uri = '/subnets'
- return self.list_resources(uri, **filters)
-
def create_port(self, **kwargs):
uri = '/ports'
post_data = {'port': kwargs}
diff --git a/tempest/services/network/json/subnets_client.py b/tempest/services/network/json/subnets_client.py
new file mode 100644
index 0000000..957b606
--- /dev/null
+++ b/tempest/services/network/json/subnets_client.py
@@ -0,0 +1,38 @@
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from tempest.services.network.json import base
+
+
+class SubnetsClient(base.BaseNetworkClient):
+
+ def create_subnet(self, **kwargs):
+ uri = '/subnets'
+ post_data = {'subnet': kwargs}
+ return self.create_resource(uri, post_data)
+
+ def update_subnet(self, subnet_id, **kwargs):
+ uri = '/subnets/%s' % subnet_id
+ post_data = {'subnet': kwargs}
+ return self.update_resource(uri, post_data)
+
+ def show_subnet(self, subnet_id, **fields):
+ uri = '/subnets/%s' % subnet_id
+ return self.show_resource(uri, **fields)
+
+ def delete_subnet(self, subnet_id):
+ uri = '/subnets/%s' % subnet_id
+ return self.delete_resource(uri)
+
+ def list_subnets(self, **filters):
+ uri = '/subnets'
+ return self.list_resources(uri, **filters)
diff --git a/tempest/services/network/resources.py b/tempest/services/network/resources.py
index 23d936e..16d9823 100644
--- a/tempest/services/network/resources.py
+++ b/tempest/services/network/resources.py
@@ -41,7 +41,9 @@
def __init__(self, *args, **kwargs):
self.client = kwargs.pop('client', None)
+ self.network_client = kwargs.pop('network_client', None)
self.networks_client = kwargs.pop('networks_client', None)
+ self.subnets_client = kwargs.pop('subnets_client', None)
super(DeletableResource, self).__init__(*args, **kwargs)
def __str__(self):
@@ -83,23 +85,23 @@
self._router_ids = set()
def update(self, *args, **kwargs):
- result = self.client.update_subnet(self.id,
- *args,
- **kwargs)
+ result = self.subnets_client.update_subnet(self.id,
+ *args,
+ **kwargs)
return super(DeletableSubnet, self).update(**result['subnet'])
def add_to_router(self, router_id):
self._router_ids.add(router_id)
- self.client.add_router_interface_with_subnet_id(router_id,
- subnet_id=self.id)
+ self.network_client.add_router_interface_with_subnet_id(
+ router_id, subnet_id=self.id)
def delete(self):
for router_id in self._router_ids.copy():
- self.client.remove_router_interface_with_subnet_id(
+ self.network_client.remove_router_interface_with_subnet_id(
router_id,
subnet_id=self.id)
self._router_ids.remove(router_id)
- self.client.delete_subnet(self.id)
+ self.subnets_client.delete_subnet(self.id)
class DeletableRouter(DeletableResource):
diff --git a/tempest/tests/cmd/test_javelin.py b/tempest/tests/cmd/test_javelin.py
index 4a8f729..fc3d984 100644
--- a/tempest/tests/cmd/test_javelin.py
+++ b/tempest/tests/cmd/test_javelin.py
@@ -380,7 +380,7 @@
javelin.destroy_subnets([self.fake_object])
- mocked_function = self.fake_client.networks.delete_subnet
+ mocked_function = self.fake_client.subnets.delete_subnet
mocked_function.assert_called_once_with(fake_subnet_id)
def test_destroy_routers(self):
diff --git a/tempest/tests/cmd/test_tempest_init.py b/tempest/tests/cmd/test_tempest_init.py
index 2b868be..1d60c67 100644
--- a/tempest/tests/cmd/test_tempest_init.py
+++ b/tempest/tests/cmd/test_tempest_init.py
@@ -12,8 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-# import mock
import os
+import shutil
import fixtures
@@ -40,6 +40,24 @@
self.addCleanup(conf_file.close)
self.assertEqual(conf_file.read(), testr_conf_file)
+ def test_generate_sample_config(self):
+ local_dir = self.useFixture(fixtures.TempDir())
+ etc_dir_path = os.path.join(local_dir.path, 'etc/')
+ os.mkdir(etc_dir_path)
+ tmp_dir = self.useFixture(fixtures.TempDir())
+ config_dir = os.path.join(tmp_dir.path, 'config/')
+ shutil.copytree('etc/', config_dir)
+ init_cmd = init.TempestInit(None, None)
+ local_sample_conf_file = os.path.join(etc_dir_path,
+ 'tempest.conf.sample')
+ # Verify no sample config file exist
+ self.assertFalse(os.path.isfile(local_sample_conf_file))
+ init_cmd.generate_sample_config(local_dir.path, config_dir)
+
+ # Verify sample config file exist with some content
+ self.assertTrue(os.path.isfile(local_sample_conf_file))
+ self.assertGreater(os.path.getsize(local_sample_conf_file), 0)
+
def test_create_working_dir_with_existing_local_dir(self):
fake_local_dir = self.useFixture(fixtures.TempDir())
fake_local_conf_dir = self.useFixture(fixtures.TempDir())
diff --git a/tempest/tests/common/test_service_clients.py b/tempest/tests/common/test_service_clients.py
index e4228a7..4225da8 100644
--- a/tempest/tests/common/test_service_clients.py
+++ b/tempest/tests/common/test_service_clients.py
@@ -17,34 +17,13 @@
import six
from tempest.services.baremetal.v1.json import baremetal_client
-from tempest.services.compute.json import aggregates_client
-from tempest.services.compute.json import availability_zone_client
-from tempest.services.compute.json import certificates_client
-from tempest.services.compute.json import extensions_client
-from tempest.services.compute.json import fixed_ips_client
-from tempest.services.compute.json import flavors_client
-from tempest.services.compute.json import floating_ip_pools_client
-from tempest.services.compute.json import floating_ips_bulk_client
from tempest.services.compute.json import floating_ips_client
-from tempest.services.compute.json import hosts_client
-from tempest.services.compute.json import hypervisor_client
-from tempest.services.compute.json import images_client
-from tempest.services.compute.json import instance_usage_audit_log_client
from tempest.services.compute.json import interfaces_client
-from tempest.services.compute.json import keypairs_client
-from tempest.services.compute.json import limits_client
-from tempest.services.compute.json import migrations_client
-from tempest.services.compute.json import networks_client as nova_net_client
from tempest.services.compute.json import quota_classes_client
-from tempest.services.compute.json import quotas_client
-from tempest.services.compute.json import security_group_default_rules_client \
- as nova_secgrop_default_client
from tempest.services.compute.json import security_group_rules_client
-from tempest.services.compute.json import security_groups_client
from tempest.services.compute.json import server_groups_client
from tempest.services.compute.json import servers_client
from tempest.services.compute.json import services_client
-from tempest.services.compute.json import tenant_usages_client
from tempest.services.compute.json import volumes_client \
as compute_volumes_client
from tempest.services.data_processing.v1_1 import data_processing_client
@@ -108,33 +87,13 @@
def test_service_client_creations_with_specified_args(self, mock_init):
test_clients = [
baremetal_client.BaremetalClient,
- aggregates_client.AggregatesClient,
- availability_zone_client.AvailabilityZoneClient,
- certificates_client.CertificatesClient,
- extensions_client.ExtensionsClient,
- fixed_ips_client.FixedIPsClient,
- flavors_client.FlavorsClient,
- floating_ip_pools_client.FloatingIPPoolsClient,
- floating_ips_bulk_client.FloatingIPsBulkClient,
floating_ips_client.FloatingIPsClient,
- hosts_client.HostsClient,
- hypervisor_client.HypervisorClient,
- images_client.ImagesClient,
- instance_usage_audit_log_client.InstanceUsagesAuditLogClient,
interfaces_client.InterfacesClient,
- keypairs_client.KeyPairsClient,
- limits_client.LimitsClient,
- migrations_client.MigrationsClient,
- nova_net_client.NetworksClient,
- quotas_client.QuotasClient,
quota_classes_client.QuotaClassesClient,
- nova_secgrop_default_client.SecurityGroupDefaultRulesClient,
security_group_rules_client.SecurityGroupRulesClient,
- security_groups_client.SecurityGroupsClient,
server_groups_client.ServerGroupsClient,
servers_client.ServersClient,
services_client.ServicesClient,
- tenant_usages_client.TenantUsagesClient,
compute_volumes_client.VolumesClient,
data_processing_client.DataProcessingClient,
db_flavor_client.DatabaseFlavorsClient,
diff --git a/tempest/tests/services/compute/test_aggregates_client.py b/tempest/tests/services/compute/test_aggregates_client.py
deleted file mode 100644
index e92b76b..0000000
--- a/tempest/tests/services/compute/test_aggregates_client.py
+++ /dev/null
@@ -1,131 +0,0 @@
-# Copyright 2015 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from tempest_lib.tests import fake_auth_provider
-
-from tempest.services.compute.json import aggregates_client
-from tempest.tests.services.compute import base
-
-
-class TestAggregatesClient(base.BaseComputeServiceTest):
- FAKE_SHOW_AGGREGATE = {
- "aggregate":
- {
- "name": "hoge",
- "availability_zone": None,
- "deleted": False,
- "created_at":
- "2015-07-16T03:07:32.000000",
- "updated_at": None,
- "hosts": [],
- "deleted_at": None,
- "id": 1,
- "metadata": {}
- }
- }
-
- FAKE_CREATE_AGGREGATE = {
- "aggregate":
- {
- "name": u'\xf4',
- "availability_zone": None,
- "deleted": False,
- "created_at": "2015-07-21T04:11:18.000000",
- "updated_at": None,
- "deleted_at": None,
- "id": 1
- }
- }
-
- FAKE_UPDATE_AGGREGATE = {
- "aggregate":
- {
- "name": u'\xe9',
- "availability_zone": None,
- "deleted": False,
- "created_at": "2015-07-16T03:07:32.000000",
- "updated_at": "2015-07-23T05:16:29.000000",
- "hosts": [],
- "deleted_at": None,
- "id": 1,
- "metadata": {}
- }
- }
-
- def setUp(self):
- super(TestAggregatesClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = aggregates_client.AggregatesClient(
- fake_auth, 'compute', 'regionOne')
-
- def _test_list_aggregates(self, bytes_body=False):
- self.check_service_client_function(
- self.client.list_aggregates,
- 'tempest.common.service_client.ServiceClient.get',
- {"aggregates": []},
- bytes_body)
-
- def test_list_aggregates_with_str_body(self):
- self._test_list_aggregates()
-
- def test_list_aggregates_with_bytes_body(self):
- self._test_list_aggregates(bytes_body=True)
-
- def _test_show_aggregate(self, bytes_body=False):
- self.check_service_client_function(
- self.client.show_aggregate,
- 'tempest.common.service_client.ServiceClient.get',
- self.FAKE_SHOW_AGGREGATE,
- bytes_body,
- aggregate_id=1)
-
- def test_show_aggregate_with_str_body(self):
- self._test_show_aggregate()
-
- def test_show_aggregate_with_bytes_body(self):
- self._test_show_aggregate(bytes_body=True)
-
- def _test_create_aggregate(self, bytes_body=False):
- self.check_service_client_function(
- self.client.create_aggregate,
- 'tempest.common.service_client.ServiceClient.post',
- self.FAKE_CREATE_AGGREGATE,
- bytes_body,
- name='hoge')
-
- def test_create_aggregate_with_str_body(self):
- self._test_create_aggregate()
-
- def test_create_aggregate_with_bytes_body(self):
- self._test_create_aggregate(bytes_body=True)
-
- def test_delete_aggregate(self):
- self.check_service_client_function(
- self.client.delete_aggregate,
- 'tempest.common.service_client.ServiceClient.delete',
- {}, aggregate_id="1")
-
- def _test_update_aggregate(self, bytes_body=False):
- self.check_service_client_function(
- self.client.update_aggregate,
- 'tempest.common.service_client.ServiceClient.put',
- self.FAKE_UPDATE_AGGREGATE,
- bytes_body,
- aggregate_id=1)
-
- def test_update_aggregate_with_str_body(self):
- self._test_update_aggregate()
-
- def test_update_aggregate_with_bytes_body(self):
- self._test_update_aggregate(bytes_body=True)
diff --git a/tempest/tests/services/compute/test_availability_zone_client.py b/tempest/tests/services/compute/test_availability_zone_client.py
deleted file mode 100644
index e1d94bc..0000000
--- a/tempest/tests/services/compute/test_availability_zone_client.py
+++ /dev/null
@@ -1,82 +0,0 @@
-# Copyright 2015 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import copy
-
-from tempest_lib.tests import fake_auth_provider
-
-from tempest.services.compute.json import availability_zone_client
-from tempest.tests.services.compute import base
-
-
-class TestAvailabilityZoneClient(base.BaseComputeServiceTest):
-
- FAKE_AZ_INFO = {
- "availabilityZoneInfo":
- [
- {
- "zoneState": {
- "available": True
- },
- "hosts": None,
- "zoneName": u'\xf4'
- }
- ]
- }
-
- FAKE_AZ_DETAILS = {
- "testhost": {
- "nova-compute": {
- "available": True,
- "active": True,
- "updated_at": "2015-09-10T07:16:46.000000"
- }
- }
- }
-
- def setUp(self):
- super(TestAvailabilityZoneClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = availability_zone_client.AvailabilityZoneClient(
- fake_auth, 'compute', 'regionOne')
-
- def _test_availability_zones(self, to_utf=False):
- self.check_service_client_function(
- self.client.list_availability_zones,
- 'tempest.common.service_client.ServiceClient.get',
- self.FAKE_AZ_INFO,
- to_utf)
-
- def _test_availability_zones_with_details(self, to_utf=False):
- fake_az_details = copy.deepcopy(self.FAKE_AZ_INFO)
- fake_az_details['availabilityZoneInfo'][0]['hosts'] = \
- self.FAKE_AZ_DETAILS
- self.check_service_client_function(
- self.client.list_availability_zones,
- 'tempest.common.service_client.ServiceClient.get',
- fake_az_details,
- to_utf,
- detail=True)
-
- def test_list_availability_zones_with_str_body(self):
- self._test_availability_zones()
-
- def test_list_availability_zones_with_bytes_body(self):
- self._test_availability_zones(True)
-
- def test_list_availability_zones_with_str_body_and_details(self):
- self._test_availability_zones_with_details()
-
- def test_list_availability_zones_with_bytes_body_and_details(self):
- self._test_availability_zones_with_details(True)
diff --git a/tempest/tests/services/compute/test_baremetal_nodes_client.py b/tempest/tests/services/compute/test_baremetal_nodes_client.py
deleted file mode 100644
index 86c035c..0000000
--- a/tempest/tests/services/compute/test_baremetal_nodes_client.py
+++ /dev/null
@@ -1,75 +0,0 @@
-# Copyright 2015 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import copy
-
-from tempest_lib.tests import fake_auth_provider
-
-from tempest.services.compute.json import baremetal_nodes_client
-from tempest.tests.services.compute import base
-
-
-class TestBareMetalNodesClient(base.BaseComputeServiceTest):
-
- FAKE_NODE_INFO = {'cpus': '8',
- 'disk_gb': '64',
- 'host': '10.0.2.15',
- 'id': 'Identifier',
- 'instance_uuid': "null",
- 'interfaces': [
- {
- "address": "20::01",
- "datapath_id": "null",
- "id": 1,
- "port_no": None
- }
- ],
- 'memory_mb': '8192',
- 'task_state': None}
-
- def setUp(self):
- super(TestBareMetalNodesClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.baremetal_nodes_client = (baremetal_nodes_client.
- BaremetalNodesClient
- (fake_auth, 'compute',
- 'regionOne'))
-
- def _test_bareMetal_nodes(self, operation='list', bytes_body=False):
- if operation != 'list':
- expected = {"node": self.FAKE_NODE_INFO}
- function = self.baremetal_nodes_client.show_baremetal_node
- else:
- node_info = copy.deepcopy(self.FAKE_NODE_INFO)
- del node_info['instance_uuid']
- expected = {"nodes": [node_info]}
- function = self.baremetal_nodes_client.list_baremetal_nodes
-
- self.check_service_client_function(
- function,
- 'tempest.common.service_client.ServiceClient.get',
- expected, bytes_body, 200,
- baremetal_node_id='Identifier')
-
- def test_list_bareMetal_nodes_with_str_body(self):
- self._test_bareMetal_nodes()
-
- def test_list_bareMetal_nodes_with_bytes_body(self):
- self._test_bareMetal_nodes(bytes_body=True)
-
- def test_show_bareMetal_node_with_str_body(self):
- self._test_bareMetal_nodes('show')
-
- def test_show_bareMetal_node_with_bytes_body(self):
- self._test_bareMetal_nodes('show', True)
diff --git a/tempest/tests/services/compute/test_certificates_client.py b/tempest/tests/services/compute/test_certificates_client.py
deleted file mode 100644
index 2ba90d0..0000000
--- a/tempest/tests/services/compute/test_certificates_client.py
+++ /dev/null
@@ -1,65 +0,0 @@
-# Copyright 2015 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import copy
-
-from tempest_lib.tests import fake_auth_provider
-
-from tempest.services.compute.json import certificates_client
-from tempest.tests.services.compute import base
-
-
-class TestCertificatesClient(base.BaseComputeServiceTest):
-
- FAKE_CERTIFICATE = {
- "certificate": {
- "data": "-----BEGIN----MIICyzCCAjSgAwI----END CERTIFICATE-----\n",
- "private_key": None
- }
- }
-
- def setUp(self):
- super(TestCertificatesClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = certificates_client.CertificatesClient(
- fake_auth, 'compute', 'regionOne')
-
- def _test_show_certificate(self, bytes_body=False):
- self.check_service_client_function(
- self.client.show_certificate,
- 'tempest.common.service_client.ServiceClient.get',
- self.FAKE_CERTIFICATE,
- bytes_body,
- certificate_id="fake-id")
-
- def test_show_certificate_with_str_body(self):
- self._test_show_certificate()
-
- def test_show_certificate_with_bytes_body(self):
- self._test_show_certificate(bytes_body=True)
-
- def _test_create_certificate(self, bytes_body=False):
- cert = copy.deepcopy(self.FAKE_CERTIFICATE)
- cert['certificate']['private_key'] = "my_private_key"
- self.check_service_client_function(
- self.client.create_certificate,
- 'tempest.common.service_client.ServiceClient.post',
- cert,
- bytes_body)
-
- def test_create_certificate_with_str_body(self):
- self._test_create_certificate()
-
- def test_create_certificate_with_bytes_body(self):
- self._test_create_certificate(bytes_body=True)
diff --git a/tempest/tests/services/compute/test_extensions_client.py b/tempest/tests/services/compute/test_extensions_client.py
deleted file mode 100644
index 21efc52..0000000
--- a/tempest/tests/services/compute/test_extensions_client.py
+++ /dev/null
@@ -1,66 +0,0 @@
-# Copyright 2015 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from tempest_lib.tests import fake_auth_provider
-
-from tempest.services.compute.json import extensions_client
-from tempest.tests.services.compute import base
-
-
-class TestExtensionsClient(base.BaseComputeServiceTest):
-
- FAKE_SHOW_EXTENSION = {
- "extension": {
- "updated": "2011-06-09T00:00:00Z",
- "name": "Multinic",
- "links": [],
- "namespace":
- "http://docs.openstack.org/compute/ext/multinic/api/v1.1",
- "alias": "NMN",
- "description": u'\u2740(*\xb4\u25e1`*)\u2740'
- }
- }
-
- def setUp(self):
- super(TestExtensionsClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = extensions_client.ExtensionsClient(
- fake_auth, 'compute', 'regionOne')
-
- def _test_list_extensions(self, bytes_body=False):
- self.check_service_client_function(
- self.client.list_extensions,
- 'tempest.common.service_client.ServiceClient.get',
- {"extensions": []},
- bytes_body)
-
- def test_list_extensions_with_str_body(self):
- self._test_list_extensions()
-
- def test_list_extensions_with_bytes_body(self):
- self._test_list_extensions(bytes_body=True)
-
- def _test_show_extension(self, bytes_body=False):
- self.check_service_client_function(
- self.client.show_extension,
- 'tempest.common.service_client.ServiceClient.get',
- self.FAKE_SHOW_EXTENSION,
- bytes_body,
- extension_alias="NMN")
-
- def test_show_extension_with_str_body(self):
- self._test_show_extension()
-
- def test_show_extension_with_bytes_body(self):
- self._test_show_extension(bytes_body=True)
diff --git a/tempest/tests/services/compute/test_servers_client.py b/tempest/tests/services/compute/test_servers_client.py
index 5813318..e347cf1 100644
--- a/tempest/tests/services/compute/test_servers_client.py
+++ b/tempest/tests/services/compute/test_servers_client.py
@@ -77,7 +77,7 @@
}
],
"metadata": {
- u"My Server Nu\1234me": u"Apau\1234che1"
+ u"My Server N\u1234me": u"Apa\u1234che1"
},
"name": u"new\u1234-server-test",
"progress": 0,
@@ -87,7 +87,37 @@
"user_id": "fake"}
}
+ FAKE_SERVER_POST = {"server": {
+ "id": "616fb98f-46ca-475e-917e-2563e5a8cd19",
+ "adminPass": "fake-admin-pass",
+ "security_groups": [
+ 'fake-security-group-1',
+ 'fake-security-group-2'
+ ],
+ "links": [
+ {
+ "href": "http://os.co/v2/616fb98f-46ca-475e-917e-2563e5a8cd19",
+ "rel": "self"
+ },
+ {
+ "href": "http://os.co/616fb98f-46ca-475e-917e-2563e5a8cd19",
+ "rel": "bookmark"
+ }
+ ],
+ "OS-DCF:diskConfig": "fake-disk-config"}
+ }
+
+ FAKE_ADDRESS = {"addresses": {
+ "private": [
+ {
+ "addr": "192.168.0.3",
+ "version": 4
+ }
+ ]}
+ }
+
server_id = FAKE_SERVER_GET['server']['id']
+ network_id = 'a6b0875b-6b5d-4a5a-81eb-0c3aa62e5fdb'
def setUp(self):
super(TestServersClient, self).setUp()
@@ -131,3 +161,52 @@
status=204,
server_id=self.server_id
)
+
+ def test_create_server_with_str_body(self):
+ self._test_create_server()
+
+ def test_create_server_with_bytes_body(self):
+ self._test_create_server(True)
+
+ def _test_create_server(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.create_server,
+ 'tempest.common.service_client.ServiceClient.post',
+ self.FAKE_SERVER_POST,
+ bytes_body,
+ status=202,
+ name='fake-name',
+ imageRef='fake-image-ref',
+ flavorRef='fake-flavor-ref'
+ )
+
+ def test_list_addresses_with_str_body(self):
+ self._test_list_addresses()
+
+ def test_list_addresses_with_bytes_body(self):
+ self._test_list_addresses(True)
+
+ def _test_list_addresses(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.list_addresses,
+ 'tempest.common.service_client.ServiceClient.get',
+ self.FAKE_ADDRESS,
+ bytes_body,
+ server_id=self.server_id
+ )
+
+ def test_list_addresses_by_network_with_str_body(self):
+ self._test_list_addresses_by_network()
+
+ def test_list_addresses_by_network_with_bytes_body(self):
+ self._test_list_addresses_by_network(True)
+
+ def _test_list_addresses_by_network(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.list_addresses_by_network,
+ 'tempest.common.service_client.ServiceClient.get',
+ self.FAKE_ADDRESS['addresses'],
+ bytes_body,
+ server_id=self.server_id,
+ network_id=self.network_id
+ )
diff --git a/tempest/tests/test_dynamic_creds.py b/tempest/tests/test_dynamic_creds.py
index 5f57268..92ed526 100644
--- a/tempest/tests/test_dynamic_creds.py
+++ b/tempest/tests/test_dynamic_creds.py
@@ -127,7 +127,7 @@
def _mock_subnet_create(self, iso_creds, id, name):
subnet_fix = self.useFixture(mockpatch.PatchObject(
- iso_creds.network_admin_client,
+ iso_creds.subnets_admin_client,
'create_subnet',
return_value={'subnet': {'id': id, 'name': name}}))
return subnet_fix
@@ -272,7 +272,7 @@
net = mock.patch.object(creds.networks_admin_client,
'delete_network')
net_mock = net.start()
- subnet = mock.patch.object(creds.network_admin_client,
+ subnet = mock.patch.object(creds.subnets_admin_client,
'delete_subnet')
subnet_mock = subnet.start()
router = mock.patch.object(creds.network_admin_client,
@@ -362,7 +362,7 @@
net = mock.patch.object(creds.networks_admin_client,
'delete_network')
net_mock = net.start()
- subnet = mock.patch.object(creds.network_admin_client,
+ subnet = mock.patch.object(creds.subnets_admin_client,
'delete_subnet')
subnet_mock = subnet.start()
router = mock.patch.object(creds.network_admin_client,
@@ -496,7 +496,7 @@
net = mock.patch.object(creds.networks_admin_client,
'delete_network')
net_mock = net.start()
- subnet = mock.patch.object(creds.network_admin_client,
+ subnet = mock.patch.object(creds.subnets_admin_client,
'delete_subnet')
subnet_mock = subnet.start()
router = mock.patch.object(creds.network_admin_client,