Merge "Add resource prefix string"
diff --git a/HACKING.rst b/HACKING.rst
index 04b5eb6..c776c49 100644
--- a/HACKING.rst
+++ b/HACKING.rst
@@ -14,6 +14,7 @@
- [T105] Tests cannot use setUpClass/tearDownClass
- [T106] vim configuration should not be kept in source files.
- [T107] Check that a service tag isn't in the module path
+- [T108] Check no hyphen at the end of rand_name() argument
- [N322] Method's default argument shouldn't be mutable
Test Data/Configuration
diff --git a/etc/accounts.yaml.sample b/etc/accounts.yaml.sample
index 3f57eb7..decc659 100644
--- a/etc/accounts.yaml.sample
+++ b/etc/accounts.yaml.sample
@@ -41,3 +41,4 @@
- 'admin'
resources:
network: 'public'
+ router: 'admin_tenant_1-router'
diff --git a/etc/javelin-resources.yaml.sample b/etc/javelin-resources.yaml.sample
new file mode 100644
index 0000000..fb270a4
--- /dev/null
+++ b/etc/javelin-resources.yaml.sample
@@ -0,0 +1,65 @@
+tenants:
+ - javelin
+ - discuss
+
+users:
+ - name: javelin
+ pass: gungnir
+ tenant: javelin
+ - name: javelin2
+ pass: gungnir2
+ tenant: discuss
+
+secgroups:
+ - name: secgroup1
+ owner: javelin
+ description: SecurityGroup1
+ rules:
+ - 'icmp -1 -1 0.0.0.0/0'
+ - 'tcp 22 22 0.0.0.0/0'
+ - name: secgroup2
+ owner: javelin2
+ description: SecurityGroup2
+ rules:
+ - 'tcp 80 80 0.0.0.0/0'
+
+images:
+ - name: cirros1
+ owner: javelin
+ imgdir: images
+ file: cirros.img
+ container_format: bare
+ disk_format: qcow2
+ - name: cirros2
+ owner: javelin2
+ imgdir: files/images/cirros-0.3.2-x86_64-uec
+ file: cirros-0.3.2-x86_64-blank.img
+ container_format: ami
+ disk_format: ami
+ aki: cirros-0.3.2-x86_64-vmlinuz
+ ari: cirros-0.3.2-x86_64-initrd
+
+networks:
+ - name: network1
+ owner: javelin
+ - name: network2
+ owner: javelin2
+
+subnets:
+ - name: net1-subnet1
+ range: 10.1.0.0/24
+ network: network1
+ owner: javelin
+ - name: net2-subnet2
+ range: 192.168.1.0/24
+ network: network2
+ owner: javelin2
+
+objects:
+ - container: container1
+ name: object1
+ owner: javelin
+ file: /etc/hosts
+ swift_role: Member
+
+telemetry: true
\ No newline at end of file
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index e3eace3..840983c 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -39,8 +39,8 @@
# Deprecated group/name - [DEFAULT]/logdir
#log_dir = <None>
-# Use syslog for logging. Existing syslog format is DEPRECATED during
-# I, and changed in J to honor RFC5424. (boolean value)
+# Use syslog for logging. Existing syslog format is DEPRECATED and
+# will be changed later to honor RFC5424. (boolean value)
#use_syslog = false
# (Optional) Enables or disables syslog rfc5424 format for logging. If
@@ -77,9 +77,6 @@
# Enables or disables publication of error events. (boolean value)
#publish_errors = false
-# Enables or disables fatal status of deprecations. (boolean value)
-#fatal_deprecations = false
-
# The format for an instance that is passed with the log message.
# (string value)
#instance_format = "[instance: %(uuid)s] "
@@ -263,6 +260,10 @@
# value)
#build_timeout = 300
+# Shell fragments to use before executing a command when sshing to a
+# guest. (string value)
+#ssh_shell_prologue = set -eu -o pipefail; PATH=$$PATH:/sbin;
+
# Auth method used for authenticate to the instance. Valid choices
# are: keypair, configured, adminpass and disabled. Keypair: start the
# servers with a ssh keypair. Configured: use the configured user and
@@ -436,6 +437,12 @@
# value)
#preserve_ports = false
+# Does the test environment support attaching an encrypted volume to a
+# running server instance? This may depend on the combination of
+# compute_driver in nova and the volume_driver(s) in cinder. (boolean
+# value)
+#attach_encrypted_volume = true
+
[dashboard]
@@ -806,7 +813,8 @@
# A list of enabled network extensions with a special entry all which
# indicates every extension is enabled. Empty list indicates all
-# extensions are disabled (list value)
+# extensions are disabled. To get the list of extensions run: 'neutron
+# ext-list' (list value)
#api_extensions = all
# Allow the execution of IPv6 subnet tests that use the extended IPv6
diff --git a/requirements.txt b/requirements.txt
index 7fe8858..60dee97 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,22 +1,22 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
-pbr>=0.11,<2.0
+pbr<2.0,>=0.11
anyjson>=0.3.3
httplib2>=0.7.5
-jsonschema>=2.0.0,<3.0.0
-testtools>=0.9.36,!=1.2.0
+jsonschema!=2.5.0,<3.0.0,>=2.0.0
+testtools>=1.4.0
boto>=2.32.1
paramiko>=1.13.0
netaddr>=0.7.12
testrepository>=0.0.18
pyOpenSSL>=0.11
-oslo.concurrency>=1.8.0 # Apache-2.0
-oslo.config>=1.11.0 # Apache-2.0
-oslo.i18n>=1.5.0 # Apache-2.0
-oslo.log>=1.0.0 # Apache-2.0
-oslo.serialization>=1.4.0 # Apache-2.0
-oslo.utils>=1.4.0 # Apache-2.0
+oslo.concurrency>=2.1.0 # Apache-2.0
+oslo.config>=1.11.0 # Apache-2.0
+oslo.i18n>=1.5.0 # Apache-2.0
+oslo.log>=1.2.0 # Apache-2.0
+oslo.serialization>=1.4.0 # Apache-2.0
+oslo.utils>=1.6.0 # Apache-2.0
six>=1.9.0
iso8601>=0.1.9
fixtures>=0.3.14
diff --git a/setup.py b/setup.py
old mode 100755
new mode 100644
index 7363757..056c16c
--- a/setup.py
+++ b/setup.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/tempest/api/compute/admin/test_flavors.py b/tempest/api/compute/admin/test_flavors.py
index f12784e..d4b8311 100644
--- a/tempest/api/compute/admin/test_flavors.py
+++ b/tempest/api/compute/admin/test_flavors.py
@@ -125,7 +125,7 @@
self.addCleanup(self.flavor_clean_up, flavor['id'])
flag = False
# Verify flavor is retrieved
- flavors = self.client.list_flavors_with_detail()
+ flavors = self.client.list_flavors(detail=True)
for flavor in flavors:
if flavor['name'] == flavor_name:
flag = True
@@ -165,7 +165,7 @@
verify_flavor_response_extension(flavor)
# Check if flavor is present in list
- flavors = self.user_client.list_flavors_with_detail()
+ flavors = self.user_client.list_flavors(detail=True)
for flavor in flavors:
if flavor['name'] == flavor_name:
verify_flavor_response_extension(flavor)
@@ -190,7 +190,7 @@
self.addCleanup(self.flavor_clean_up, flavor['id'])
# Verify flavor is retrieved
flag = False
- flavors = self.client.list_flavors_with_detail()
+ flavors = self.client.list_flavors(detail=True)
for flavor in flavors:
if flavor['name'] == flavor_name:
flag = True
@@ -198,7 +198,7 @@
# Verify flavor is not retrieved with other user
flag = False
- flavors = self.user_client.list_flavors_with_detail()
+ flavors = self.user_client.list_flavors(detail=True)
for flavor in flavors:
if flavor['name'] == flavor_name:
flag = True
@@ -240,7 +240,7 @@
flag = False
self.new_client = self.flavors_client
# Verify flavor is retrieved with new user
- flavors = self.new_client.list_flavors_with_detail()
+ flavors = self.new_client.list_flavors(detail=True)
for flavor in flavors:
if flavor['name'] == flavor_name:
flag = True
@@ -278,7 +278,7 @@
def _test_string_variations(variations, flavor_name):
for string in variations:
params = {'is_public': string}
- flavors = self.client.list_flavors_with_detail(params)
+ flavors = self.client.list_flavors(detail=True, **params)
flavor = _flavor_lookup(flavors, flavor_name)
self.assertIsNotNone(flavor)
diff --git a/tempest/api/compute/admin/test_flavors_access.py b/tempest/api/compute/admin/test_flavors_access.py
index 61d3dc6..4c743dc 100644
--- a/tempest/api/compute/admin/test_flavors_access.py
+++ b/tempest/api/compute/admin/test_flavors_access.py
@@ -87,7 +87,7 @@
self.assertIn(resp_body, add_body)
# The flavor is present in list.
- flavors = self.flavors_client.list_flavors_with_detail()
+ flavors = self.flavors_client.list_flavors(detail=True)
self.assertIn(new_flavor['id'], map(lambda x: x['id'], flavors))
# Remove flavor access from a tenant.
@@ -96,5 +96,5 @@
self.assertNotIn(resp_body, remove_body)
# The flavor is not present in list.
- flavors = self.flavors_client.list_flavors_with_detail()
+ flavors = self.flavors_client.list_flavors(detail=True)
self.assertNotIn(new_flavor['id'], map(lambda x: x['id'], flavors))
diff --git a/tempest/api/compute/admin/test_hosts.py b/tempest/api/compute/admin/test_hosts.py
index a91c9bf..9fee2a1 100644
--- a/tempest/api/compute/admin/test_hosts.py
+++ b/tempest/api/compute/admin/test_hosts.py
@@ -69,7 +69,7 @@
for host in hosts:
hostname = host['host_name']
- resources = self.client.show_host_detail(hostname)
+ resources = self.client.show_host(hostname)
self.assertTrue(len(resources) >= 1)
host_resource = resources[0]['resource']
self.assertIsNotNone(host_resource)
diff --git a/tempest/api/compute/admin/test_hosts_negative.py b/tempest/api/compute/admin/test_hosts_negative.py
index 042d1fb..930d686 100644
--- a/tempest/api/compute/admin/test_hosts_negative.py
+++ b/tempest/api/compute/admin/test_hosts_negative.py
@@ -48,7 +48,7 @@
def test_show_host_detail_with_nonexistent_hostname(self):
nonexitent_hostname = data_utils.rand_name('rand_hostname')
self.assertRaises(lib_exc.NotFound,
- self.client.show_host_detail, nonexitent_hostname)
+ self.client.show_host, nonexitent_hostname)
@test.attr(type=['negative'])
@test.idempotent_id('19ebe09c-bfd4-4b7c-81a2-e2e0710f59cc')
@@ -56,7 +56,7 @@
hostname = self._get_host_name()
self.assertRaises(lib_exc.Forbidden,
- self.non_admin_client.show_host_detail,
+ self.non_admin_client.show_host,
hostname)
@test.attr(type=['negative'])
diff --git a/tempest/api/compute/admin/test_hypervisor.py b/tempest/api/compute/admin/test_hypervisor.py
index 9483f52..47f66af 100644
--- a/tempest/api/compute/admin/test_hypervisor.py
+++ b/tempest/api/compute/admin/test_hypervisor.py
@@ -30,7 +30,7 @@
def _list_hypervisors(self):
# List of hypervisors
- hypers = self.client.get_hypervisor_list()
+ hypers = self.client.list_hypervisors()
return hypers
def assertHypervisors(self, hypers):
@@ -45,7 +45,7 @@
@test.idempotent_id('1e7fdac2-b672-4ad1-97a4-bad0e3030118')
def test_get_hypervisor_list_details(self):
# Display the details of the all hypervisor
- hypers = self.client.get_hypervisor_list_details()
+ hypers = self.client.list_hypervisors(detail=True)
self.assertHypervisors(hypers)
@test.idempotent_id('94ff9eae-a183-428e-9cdb-79fde71211cc')
@@ -54,7 +54,7 @@
hypers = self._list_hypervisors()
self.assertHypervisors(hypers)
- details = self.client.get_hypervisor_show_details(hypers[0]['id'])
+ details = self.client.show_hypervisor(hypers[0]['id'])
self.assertTrue(len(details) > 0)
self.assertEqual(details['hypervisor_hostname'],
hypers[0]['hypervisor_hostname'])
@@ -66,13 +66,13 @@
self.assertHypervisors(hypers)
hostname = hypers[0]['hypervisor_hostname']
- hypervisors = self.client.get_hypervisor_servers(hostname)
+ hypervisors = self.client.list_servers_on_hypervisor(hostname)
self.assertTrue(len(hypervisors) > 0)
@test.idempotent_id('797e4f28-b6e0-454d-a548-80cc77c00816')
def test_get_hypervisor_stats(self):
# Verify the stats of the all hypervisor
- stats = self.client.get_hypervisor_stats()
+ stats = self.client.show_hypervisor_statistics()
self.assertTrue(len(stats) > 0)
@test.idempotent_id('91a50d7d-1c2b-4f24-b55a-a1fe20efca70')
@@ -88,7 +88,7 @@
ironic_only = True
hypers_without_ironic = []
for hyper in hypers:
- details = self.client.get_hypervisor_show_details(hypers[0]['id'])
+ details = self.client.show_hypervisor(hypers[0]['id'])
if details['hypervisor_type'] != 'ironic':
hypers_without_ironic.append(hyper)
ironic_only = False
@@ -102,7 +102,7 @@
# because hypervisors might be disabled, this loops looking
# for any good hit.
try:
- uptime = self.client.get_hypervisor_uptime(hyper['id'])
+ uptime = self.client.show_hypervisor_uptime(hyper['id'])
if len(uptime) > 0:
has_valid_uptime = True
break
diff --git a/tempest/api/compute/admin/test_hypervisor_negative.py b/tempest/api/compute/admin/test_hypervisor_negative.py
index 24b0090..a5c2f0d 100644
--- a/tempest/api/compute/admin/test_hypervisor_negative.py
+++ b/tempest/api/compute/admin/test_hypervisor_negative.py
@@ -36,7 +36,7 @@
def _list_hypervisors(self):
# List of hypervisors
- hypers = self.client.get_hypervisor_list()
+ hypers = self.client.list_hypervisors()
return hypers
@test.attr(type=['negative'])
@@ -46,7 +46,7 @@
self.assertRaises(
lib_exc.NotFound,
- self.client.get_hypervisor_show_details,
+ self.client.show_hypervisor,
nonexistent_hypervisor_id)
@test.attr(type=['negative'])
@@ -57,7 +57,7 @@
self.assertRaises(
lib_exc.Forbidden,
- self.non_adm_client.get_hypervisor_show_details,
+ self.non_adm_client.show_hypervisor,
hypers[0]['id'])
@test.attr(type=['negative'])
@@ -68,7 +68,7 @@
self.assertRaises(
lib_exc.Forbidden,
- self.non_adm_client.get_hypervisor_servers,
+ self.non_adm_client.list_servers_on_hypervisor,
hypers[0]['id'])
@test.attr(type=['negative'])
@@ -78,7 +78,7 @@
self.assertRaises(
lib_exc.NotFound,
- self.client.get_hypervisor_servers,
+ self.client.list_servers_on_hypervisor,
nonexistent_hypervisor_id)
@test.attr(type=['negative'])
@@ -86,7 +86,7 @@
def test_get_hypervisor_stats_with_non_admin_user(self):
self.assertRaises(
lib_exc.Forbidden,
- self.non_adm_client.get_hypervisor_stats)
+ self.non_adm_client.show_hypervisor_statistics)
@test.attr(type=['negative'])
@test.idempotent_id('f60aa680-9a3a-4c7d-90e1-fae3a4891303')
@@ -95,7 +95,7 @@
self.assertRaises(
lib_exc.NotFound,
- self.client.get_hypervisor_uptime,
+ self.client.show_hypervisor_uptime,
nonexistent_hypervisor_id)
@test.attr(type=['negative'])
@@ -106,7 +106,7 @@
self.assertRaises(
lib_exc.Forbidden,
- self.non_adm_client.get_hypervisor_uptime,
+ self.non_adm_client.show_hypervisor_uptime,
hypers[0]['id'])
@test.attr(type=['negative'])
@@ -115,7 +115,7 @@
# List of hypervisor and available services with non admin user
self.assertRaises(
lib_exc.Forbidden,
- self.non_adm_client.get_hypervisor_list)
+ self.non_adm_client.list_hypervisors)
@test.attr(type=['negative'])
@test.idempotent_id('dc02db05-e801-4c5f-bc8e-d915290ab345')
@@ -123,7 +123,7 @@
# List of hypervisor details and available services with non admin user
self.assertRaises(
lib_exc.Forbidden,
- self.non_adm_client.get_hypervisor_list_details)
+ self.non_adm_client.list_hypervisors, detail=True)
@test.attr(type=['negative'])
@test.idempotent_id('19a45cc1-1000-4055-b6d2-28e8b2ec4faa')
diff --git a/tempest/api/compute/admin/test_instance_usage_audit_log.py b/tempest/api/compute/admin/test_instance_usage_audit_log.py
index 9da7901..189c316 100644
--- a/tempest/api/compute/admin/test_instance_usage_audit_log.py
+++ b/tempest/api/compute/admin/test_instance_usage_audit_log.py
@@ -44,7 +44,7 @@
def test_get_instance_usage_audit_log(self):
# Get instance usage audit log before specified time
now = datetime.datetime.now()
- body = self.adm_client.get_instance_usage_audit_log(
+ body = self.adm_client.show_instance_usage_audit_log(
urllib.quote(now.strftime("%Y-%m-%d %H:%M:%S")))
expected_items = ['total_errors', 'total_instances', 'log',
diff --git a/tempest/api/compute/admin/test_instance_usage_audit_log_negative.py b/tempest/api/compute/admin/test_instance_usage_audit_log_negative.py
index 97d665b..eea3103 100644
--- a/tempest/api/compute/admin/test_instance_usage_audit_log_negative.py
+++ b/tempest/api/compute/admin/test_instance_usage_audit_log_negative.py
@@ -39,12 +39,12 @@
now = datetime.datetime.now()
self.assertRaises(lib_exc.Forbidden,
self.instance_usages_audit_log_client.
- get_instance_usage_audit_log,
+ show_instance_usage_audit_log,
urllib.quote(now.strftime("%Y-%m-%d %H:%M:%S")))
@test.attr(type=['negative'])
@test.idempotent_id('9b952047-3641-41c7-ba91-a809fc5974c8')
def test_get_instance_usage_audit_logs_with_invalid_time(self):
self.assertRaises(lib_exc.BadRequest,
- self.adm_client.get_instance_usage_audit_log,
+ self.adm_client.show_instance_usage_audit_log,
"invalid_time")
diff --git a/tempest/api/compute/admin/test_networks.py b/tempest/api/compute/admin/test_networks.py
index 477dc61..981a5c9 100644
--- a/tempest/api/compute/admin/test_networks.py
+++ b/tempest/api/compute/admin/test_networks.py
@@ -47,7 +47,7 @@
else:
configured_network = networks
configured_network = configured_network[0]
- network = self.client.get_network(configured_network['id'])
+ network = self.client.show_network(configured_network['id'])
self.assertEqual(configured_network['label'], network['label'])
@test.idempotent_id('df3d1046-6fa5-4b2c-ad0c-cfa46a351cb9')
diff --git a/tempest/api/compute/admin/test_quotas.py b/tempest/api/compute/admin/test_quotas.py
index 01db25c..029e578 100644
--- a/tempest/api/compute/admin/test_quotas.py
+++ b/tempest/api/compute/admin/test_quotas.py
@@ -58,7 +58,7 @@
def test_get_default_quotas(self):
# Admin can get the default resource quota set for a tenant
expected_quota_set = self.default_quota_set | set(['id'])
- quota_set = self.adm_client.get_default_quota_set(
+ quota_set = self.adm_client.show_default_quota_set(
self.demo_tenant_id)
self.assertEqual(quota_set['id'], self.demo_tenant_id)
for quota in expected_quota_set:
@@ -67,7 +67,7 @@
@test.idempotent_id('55fbe2bf-21a9-435b-bbd2-4162b0ed799a')
def test_update_all_quota_resources_for_tenant(self):
# Admin can update all the resource quota limits for a tenant
- default_quota_set = self.adm_client.get_default_quota_set(
+ default_quota_set = self.adm_client.show_default_quota_set(
self.demo_tenant_id)
new_quota_set = {'injected_file_content_bytes': 20480,
'metadata_items': 256, 'injected_files': 10,
@@ -107,7 +107,7 @@
self.addCleanup(identity_client.delete_tenant, tenant_id)
self.adm_client.update_quota_set(tenant_id, ram='5120')
- quota_set = self.adm_client.get_quota_set(tenant_id)
+ quota_set = self.adm_client.show_quota_set(tenant_id)
self.assertEqual(5120, quota_set['ram'])
# Verify that GET shows the updated quota set of user
@@ -124,8 +124,8 @@
self.adm_client.update_quota_set(tenant_id,
user_id=user_id,
ram='2048')
- quota_set = self.adm_client.get_quota_set(tenant_id,
- user_id=user_id)
+ quota_set = self.adm_client.show_quota_set(tenant_id,
+ user_id=user_id)
self.assertEqual(2048, quota_set['ram'])
@test.idempotent_id('389d04f0-3a41-405f-9317-e5f86e3c44f0')
@@ -138,14 +138,14 @@
description=tenant_desc)
tenant_id = tenant['id']
self.addCleanup(identity_client.delete_tenant, tenant_id)
- quota_set_default = self.adm_client.get_quota_set(tenant_id)
+ quota_set_default = self.adm_client.show_quota_set(tenant_id)
ram_default = quota_set_default['ram']
self.adm_client.update_quota_set(tenant_id, ram='5120')
self.adm_client.delete_quota_set(tenant_id)
- quota_set_new = self.adm_client.get_quota_set(tenant_id)
+ quota_set_new = self.adm_client.show_quota_set(tenant_id)
self.assertEqual(ram_default, quota_set_new['ram'])
@@ -176,7 +176,7 @@
@test.idempotent_id('7932ab0f-5136-4075-b201-c0e2338df51a')
def test_update_default_quotas(self):
LOG.debug("get the current 'default' quota class values")
- body = self.adm_client.get_quota_class_set('default')
+ body = self.adm_client.show_quota_class_set('default')
self.assertIn('id', body)
self.assertEqual('default', body.pop('id'))
# restore the defaults when the test is done
diff --git a/tempest/api/compute/admin/test_quotas_negative.py b/tempest/api/compute/admin/test_quotas_negative.py
index d20ebf3..c450a1d 100644
--- a/tempest/api/compute/admin/test_quotas_negative.py
+++ b/tempest/api/compute/admin/test_quotas_negative.py
@@ -54,7 +54,7 @@
@test.idempotent_id('91058876-9947-4807-9f22-f6eb17140d9b')
def test_create_server_when_cpu_quota_is_full(self):
# Disallow server creation when tenant's vcpu quota is full
- quota_set = self.adm_client.get_quota_set(self.demo_tenant_id)
+ quota_set = self.adm_client.show_quota_set(self.demo_tenant_id)
default_vcpu_quota = quota_set['cores']
vcpu_quota = 0 # Set the quota to zero to conserve resources
@@ -71,7 +71,7 @@
@test.idempotent_id('6fdd7012-584d-4327-a61c-49122e0d5864')
def test_create_server_when_memory_quota_is_full(self):
# Disallow server creation when tenant's memory quota is full
- quota_set = self.adm_client.get_quota_set(self.demo_tenant_id)
+ quota_set = self.adm_client.show_quota_set(self.demo_tenant_id)
default_mem_quota = quota_set['ram']
mem_quota = 0 # Set the quota to zero to conserve resources
@@ -88,7 +88,7 @@
@test.idempotent_id('7c6be468-0274-449a-81c3-ac1c32ee0161')
def test_create_server_when_instances_quota_is_full(self):
# Once instances quota limit is reached, disallow server creation
- quota_set = self.adm_client.get_quota_set(self.demo_tenant_id)
+ quota_set = self.adm_client.show_quota_set(self.demo_tenant_id)
default_instances_quota = quota_set['instances']
instances_quota = 0 # Set quota to zero to disallow server creation
@@ -107,7 +107,7 @@
def test_security_groups_exceed_limit(self):
# Negative test: Creation Security Groups over limit should FAIL
- quota_set = self.adm_client.get_quota_set(self.demo_tenant_id)
+ quota_set = self.adm_client.show_quota_set(self.demo_tenant_id)
default_sg_quota = quota_set['security_groups']
sg_quota = 0 # Set the quota to zero to conserve resources
@@ -136,7 +136,7 @@
# Negative test: Creation of Security Group Rules should FAIL
# when we reach limit maxSecurityGroupRules
- quota_set = self.adm_client.get_quota_set(self.demo_tenant_id)
+ quota_set = self.adm_client.show_quota_set(self.demo_tenant_id)
default_sg_rules_quota = quota_set['security_group_rules']
sg_rules_quota = 0 # Set the quota to zero to conserve resources
diff --git a/tempest/api/compute/admin/test_servers_negative.py b/tempest/api/compute/admin/test_servers_negative.py
index d325bd7..cda4bc4 100644
--- a/tempest/api/compute/admin/test_servers_negative.py
+++ b/tempest/api/compute/admin/test_servers_negative.py
@@ -68,7 +68,7 @@
self.useFixture(fixtures.LockFixture('compute_quotas'))
flavor_name = data_utils.rand_name("flavor")
flavor_id = self._get_unused_flavor_id()
- quota_set = self.quotas_client.get_default_quota_set(self.tenant_id)
+ quota_set = self.quotas_client.show_default_quota_set(self.tenant_id)
ram = int(quota_set['ram']) + 1
vcpus = 8
disk = 10
@@ -91,7 +91,7 @@
flavor_name = data_utils.rand_name("flavor")
flavor_id = self._get_unused_flavor_id()
ram = 512
- quota_set = self.quotas_client.get_default_quota_set(self.tenant_id)
+ quota_set = self.quotas_client.show_default_quota_set(self.tenant_id)
vcpus = int(quota_set['cores']) + 1
disk = 10
flavor_ref = self.flavors_client.create_flavor(flavor_name,
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index 9aacfa5..a1f6f99 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -16,11 +16,10 @@
import time
from oslo_log import log as logging
-from oslo_utils import excutils
from tempest_lib.common.utils import data_utils
from tempest_lib import exceptions as lib_exc
-from tempest.common import fixed_network
+from tempest.common import compute
from tempest import config
from tempest import exceptions
import tempest.test
@@ -192,41 +191,21 @@
server_group_id)
@classmethod
- def create_test_server(cls, **kwargs):
- """Wrapper utility that returns a test server."""
- name = data_utils.rand_name(cls.__name__ + "-instance")
- if 'name' in kwargs:
- name = kwargs.pop('name')
- flavor = kwargs.get('flavor', cls.flavor_ref)
- image_id = kwargs.get('image_id', cls.image_ref)
+ def create_test_server(cls, validatable=False, **kwargs):
+ """Wrapper utility that returns a test server.
- kwargs = fixed_network.set_networks_kwarg(
- cls.get_tenant_network(), kwargs) or {}
- body = cls.servers_client.create_server(
- name, image_id, flavor, **kwargs)
-
- # handle the case of multiple servers
- servers = [body]
- if 'min_count' in kwargs or 'max_count' in kwargs:
- # Get servers created which name match with name param.
- b = cls.servers_client.list_servers()
- servers = [s for s in b['servers'] if s['name'].startswith(name)]
-
- if 'wait_until' in kwargs:
- for server in servers:
- try:
- cls.servers_client.wait_for_server_status(
- server['id'], kwargs['wait_until'])
- except Exception:
- with excutils.save_and_reraise_exception():
- if ('preserve_server_on_error' not in kwargs
- or kwargs['preserve_server_on_error'] is False):
- for server in servers:
- try:
- cls.servers_client.delete_server(
- server['id'])
- except Exception:
- pass
+ This wrapper utility calls the common create test server and
+ returns a test server. The purpose of this wrapper is to minimize
+ the impact on the code of the tests already using this
+ function.
+ """
+ tenant_network = cls.get_tenant_network()
+ body, servers = compute.create_test_server(
+ cls.os,
+ validatable,
+ validation_resources=cls.validation_resources,
+ tenant_network=tenant_network,
+ **kwargs)
cls.servers.extend(servers)
diff --git a/tempest/api/compute/flavors/test_flavors.py b/tempest/api/compute/flavors/test_flavors.py
index 251f4ec..728fefb 100644
--- a/tempest/api/compute/flavors/test_flavors.py
+++ b/tempest/api/compute/flavors/test_flavors.py
@@ -41,7 +41,7 @@
@test.idempotent_id('6e85fde4-b3cd-4137-ab72-ed5f418e8c24')
def test_list_flavors_with_detail(self):
# Detailed list of all flavors should contain the expected flavor
- flavors = self.client.list_flavors_with_detail()
+ flavors = self.client.list_flavors(detail=True)
flavor = self.client.show_flavor(self.flavor_ref)
self.assertIn(flavor, flavors)
@@ -56,14 +56,14 @@
def test_list_flavors_limit_results(self):
# Only the expected number of flavors should be returned
params = {'limit': 1}
- flavors = self.client.list_flavors(params)
+ flavors = self.client.list_flavors(**params)
self.assertEqual(1, len(flavors))
@test.idempotent_id('b26f6327-2886-467a-82be-cef7a27709cb')
def test_list_flavors_detailed_limit_results(self):
# Only the expected number of flavors (detailed) should be returned
params = {'limit': 1}
- flavors = self.client.list_flavors_with_detail(params)
+ flavors = self.client.list_flavors(detail=True, **params)
self.assertEqual(1, len(flavors))
@test.idempotent_id('e800f879-9828-4bd0-8eae-4f17189951fb')
@@ -73,7 +73,7 @@
flavor_id = flavor['id']
params = {'marker': flavor_id}
- flavors = self.client.list_flavors(params)
+ flavors = self.client.list_flavors(**params)
self.assertFalse(any([i for i in flavors if i['id'] == flavor_id]),
'The list of flavors did not start after the marker.')
@@ -84,7 +84,7 @@
flavor_id = flavor['id']
params = {'marker': flavor_id}
- flavors = self.client.list_flavors_with_detail(params)
+ flavors = self.client.list_flavors(detail=True, **params)
self.assertFalse(any([i for i in flavors if i['id'] == flavor_id]),
'The list of flavors did not start after the marker.')
@@ -95,7 +95,7 @@
flavor_id = flavor['id']
params = {self._min_disk: flavor['disk'] + 1}
- flavors = self.client.list_flavors_with_detail(params)
+ flavors = self.client.list_flavors(detail=True, **params)
self.assertFalse(any([i for i in flavors if i['id'] == flavor_id]))
@test.idempotent_id('09fe7509-b4ee-4b34-bf8b-39532dc47292')
@@ -105,7 +105,7 @@
flavor_id = flavor['id']
params = {self._min_ram: flavor['ram'] + 1}
- flavors = self.client.list_flavors_with_detail(params)
+ flavors = self.client.list_flavors(detail=True, **params)
self.assertFalse(any([i for i in flavors if i['id'] == flavor_id]))
@test.idempotent_id('10645a4d-96f5-443f-831b-730711e11dd4')
@@ -115,7 +115,7 @@
flavor_id = flavor['id']
params = {self._min_disk: flavor['disk'] + 1}
- flavors = self.client.list_flavors(params)
+ flavors = self.client.list_flavors(**params)
self.assertFalse(any([i for i in flavors if i['id'] == flavor_id]))
@test.idempotent_id('935cf550-e7c8-4da6-8002-00f92d5edfaa')
@@ -125,5 +125,5 @@
flavor_id = flavor['id']
params = {self._min_ram: flavor['ram'] + 1}
- flavors = self.client.list_flavors(params)
+ flavors = self.client.list_flavors(**params)
self.assertFalse(any([i for i in flavors if i['id'] == flavor_id]))
diff --git a/tempest/api/compute/images/test_image_metadata.py b/tempest/api/compute/images/test_image_metadata.py
index 9664c61..4e0ed97 100644
--- a/tempest/api/compute/images/test_image_metadata.py
+++ b/tempest/api/compute/images/test_image_metadata.py
@@ -93,8 +93,8 @@
@test.idempotent_id('4f5db52f-6685-4c75-b848-f4bb363f9aa6')
def test_get_image_metadata_item(self):
# The value for a specific metadata key should be returned
- meta = self.client.get_image_metadata_item(self.image_id,
- 'os_distro')
+ meta = self.client.show_image_metadata_item(self.image_id,
+ 'os_distro')
self.assertEqual('value2', meta['os_distro'])
@test.idempotent_id('f2de776a-4778-4d90-a5da-aae63aee64ae')
diff --git a/tempest/api/compute/images/test_image_metadata_negative.py b/tempest/api/compute/images/test_image_metadata_negative.py
index e44fbfc..0c1971a 100644
--- a/tempest/api/compute/images/test_image_metadata_negative.py
+++ b/tempest/api/compute/images/test_image_metadata_negative.py
@@ -49,7 +49,7 @@
def test_get_nonexistent_image_metadata_item(self):
# Negative test: Get on non-existent image should not happen
self.assertRaises(lib_exc.NotFound,
- self.client.get_image_metadata_item,
+ self.client.show_image_metadata_item,
data_utils.rand_uuid(), 'os_version')
@test.attr(type=['negative'])
diff --git a/tempest/api/compute/images/test_list_image_filters.py b/tempest/api/compute/images/test_list_image_filters.py
index e2d4bd9..111398b 100644
--- a/tempest/api/compute/images/test_list_image_filters.py
+++ b/tempest/api/compute/images/test_list_image_filters.py
@@ -105,7 +105,7 @@
# The list of images should contain only images with the
# provided status
params = {'status': 'ACTIVE'}
- images = self.client.list_images(params)
+ images = self.client.list_images(**params)
self.assertTrue(any([i for i in images if i['id'] == self.image1_id]))
self.assertTrue(any([i for i in images if i['id'] == self.image2_id]))
@@ -116,7 +116,7 @@
# List of all images should contain the expected images filtered
# by name
params = {'name': self.image1['name']}
- images = self.client.list_images(params)
+ images = self.client.list_images(**params)
self.assertTrue(any([i for i in images if i['id'] == self.image1_id]))
self.assertFalse(any([i for i in images if i['id'] == self.image2_id]))
@@ -128,7 +128,7 @@
def test_list_images_filter_by_server_id(self):
# The images should contain images filtered by server id
params = {'server': self.server1['id']}
- images = self.client.list_images(params)
+ images = self.client.list_images(**params)
self.assertTrue(any([i for i in images
if i['id'] == self.snapshot1_id]),
@@ -149,7 +149,7 @@
# Try all server link types
for link in server_links:
params = {'server': link['href']}
- images = self.client.list_images(params)
+ images = self.client.list_images(**params)
self.assertFalse(any([i for i in images
if i['id'] == self.snapshot1_id]))
@@ -164,7 +164,7 @@
def test_list_images_filter_by_type(self):
# The list of servers should be filtered by image type
params = {'type': 'snapshot'}
- images = self.client.list_images(params)
+ images = self.client.list_images(**params)
self.assertTrue(any([i for i in images
if i['id'] == self.snapshot1_id]))
@@ -179,7 +179,7 @@
def test_list_images_limit_results(self):
# Verify only the expected number of results are returned
params = {'limit': '1'}
- images = self.client.list_images(params)
+ images = self.client.list_images(**params)
self.assertEqual(1, len([x for x in images if 'id' in x]))
@test.idempotent_id('18bac3ae-da27-436c-92a9-b22474d13aab')
@@ -189,7 +189,7 @@
# Becoming ACTIVE will modify the updated time
# Filter by the image's created time
params = {'changes-since': self.image3['created']}
- images = self.client.list_images(params)
+ images = self.client.list_images(**params)
found = any([i for i in images if i['id'] == self.image3_id])
self.assertTrue(found)
@@ -198,7 +198,7 @@
# Detailed list of all images should only contain images
# with the provided status
params = {'status': 'ACTIVE'}
- images = self.client.list_images_with_detail(params)
+ images = self.client.list_images(detail=True, **params)
self.assertTrue(any([i for i in images if i['id'] == self.image1_id]))
self.assertTrue(any([i for i in images if i['id'] == self.image2_id]))
@@ -209,7 +209,7 @@
# Detailed list of all images should contain the expected
# images filtered by name
params = {'name': self.image1['name']}
- images = self.client.list_images_with_detail(params)
+ images = self.client.list_images(detail=True, **params)
self.assertTrue(any([i for i in images if i['id'] == self.image1_id]))
self.assertFalse(any([i for i in images if i['id'] == self.image2_id]))
@@ -220,7 +220,7 @@
# Verify only the expected number of results (with full details)
# are returned
params = {'limit': '1'}
- images = self.client.list_images_with_detail(params)
+ images = self.client.list_images(detail=True, **params)
self.assertEqual(1, len(images))
@test.idempotent_id('8c78f822-203b-4bf6-8bba-56ebd551cf84')
@@ -233,7 +233,7 @@
# Try all server link types
for link in server_links:
params = {'server': link['href']}
- images = self.client.list_images_with_detail(params)
+ images = self.client.list_images(detail=True, **params)
self.assertFalse(any([i for i in images
if i['id'] == self.snapshot1_id]))
@@ -248,7 +248,7 @@
def test_list_images_with_detail_filter_by_type(self):
# The detailed list of servers should be filtered by image type
params = {'type': 'snapshot'}
- images = self.client.list_images_with_detail(params)
+ images = self.client.list_images(detail=True, **params)
self.client.show_image(self.image_ref)
self.assertTrue(any([i for i in images
@@ -267,5 +267,5 @@
# Becoming ACTIVE will modify the updated time
# Filter by the image's created time
params = {'changes-since': self.image1['created']}
- images = self.client.list_images_with_detail(params)
+ images = self.client.list_images(detail=True, **params)
self.assertTrue(any([i for i in images if i['id'] == self.image1_id]))
diff --git a/tempest/api/compute/images/test_list_images.py b/tempest/api/compute/images/test_list_images.py
index 5b80c72..b67378c 100644
--- a/tempest/api/compute/images/test_list_images.py
+++ b/tempest/api/compute/images/test_list_images.py
@@ -50,6 +50,6 @@
@test.idempotent_id('9f94cb6b-7f10-48c5-b911-a0b84d7d4cd6')
def test_list_images_with_detail(self):
# Detailed list of all images should contain the expected images
- images = self.client.list_images_with_detail()
+ images = self.client.list_images(detail=True)
found = any([i for i in images if i['id'] == self.image_ref])
self.assertTrue(found)
diff --git a/tempest/api/compute/keypairs/test_keypairs.py b/tempest/api/compute/keypairs/test_keypairs.py
index 01e3c86..50ebdeb 100644
--- a/tempest/api/compute/keypairs/test_keypairs.py
+++ b/tempest/api/compute/keypairs/test_keypairs.py
@@ -82,7 +82,7 @@
# Keypair should be created, Got details by name and deleted
k_name = data_utils.rand_name('keypair')
self._create_keypair(k_name)
- keypair_detail = self.client.get_keypair(k_name)
+ keypair_detail = self.client.show_keypair(k_name)
self.assertIn('name', keypair_detail)
self.assertIn('public_key', keypair_detail)
self.assertEqual(keypair_detail['name'], k_name,
diff --git a/tempest/api/compute/limits/test_absolute_limits.py b/tempest/api/compute/limits/test_absolute_limits.py
index 974814c..0029bb9 100644
--- a/tempest/api/compute/limits/test_absolute_limits.py
+++ b/tempest/api/compute/limits/test_absolute_limits.py
@@ -27,7 +27,8 @@
@test.idempotent_id('b54c66af-6ab6-4cf0-a9e5-a0cb58d75e0b')
def test_absLimits_get(self):
# To check if all limits are present in the response
- absolute_limits = self.client.get_absolute_limits()
+ limits = self.client.show_limits()
+ absolute_limits = limits['absolute']
expected_elements = ['maxImageMeta', 'maxPersonality',
'maxPersonalitySize',
'maxServerMeta', 'maxTotalCores',
diff --git a/tempest/api/compute/limits/test_absolute_limits_negative.py b/tempest/api/compute/limits/test_absolute_limits_negative.py
index bdbe3f1..cbd2004 100644
--- a/tempest/api/compute/limits/test_absolute_limits_negative.py
+++ b/tempest/api/compute/limits/test_absolute_limits_negative.py
@@ -38,7 +38,8 @@
def test_max_image_meta_exceed_limit(self):
# We should not create vm with image meta over maxImageMeta limit
# Get max limit value
- max_meta = self.client.get_specific_absolute_limit('maxImageMeta')
+ limits = self.client.show_limits()
+ max_meta = limits['absolute']['maxImageMeta']
# No point in running this test if there is no limit.
if int(max_meta) == -1:
diff --git a/tempest/api/compute/servers/test_create_server.py b/tempest/api/compute/servers/test_create_server.py
index 16b1597..408d4ee 100644
--- a/tempest/api/compute/servers/test_create_server.py
+++ b/tempest/api/compute/servers/test_create_server.py
@@ -53,14 +53,16 @@
personality = [{'path': '/test.txt',
'contents': base64.b64encode(file_contents)}]
disk_config = cls.disk_config
- cls.server_initial = cls.create_test_server(name=cls.name,
- meta=cls.meta,
- accessIPv4=cls.accessIPv4,
- accessIPv6=cls.accessIPv6,
- personality=personality,
- disk_config=disk_config)
+ cls.server_initial = cls.create_test_server(
+ validatable=True,
+ wait_until='ACTIVE',
+ name=cls.name,
+ meta=cls.meta,
+ accessIPv4=cls.accessIPv4,
+ accessIPv6=cls.accessIPv6,
+ personality=personality,
+ disk_config=disk_config)
cls.password = cls.server_initial['adminPass']
- cls.client.wait_for_server_status(cls.server_initial['id'], 'ACTIVE')
cls.server = cls.client.get_server(cls.server_initial['id'])
@test.attr(type='smoke')
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index 10b08a1..6fcd38a 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -430,7 +430,7 @@
server = self.client.get_server(self.server_id)
image_name = server['name'] + '-shelved'
params = {'name': image_name}
- images = self.images_client.list_images(params)
+ images = self.images_client.list_images(**params)
self.assertEqual(1, len(images))
self.assertEqual(image_name, images[0]['name'])
diff --git a/tempest/api/compute/servers/test_server_metadata_negative.py b/tempest/api/compute/servers/test_server_metadata_negative.py
index 1a977ab..a8f7597 100644
--- a/tempest/api/compute/servers/test_server_metadata_negative.py
+++ b/tempest/api/compute/servers/test_server_metadata_negative.py
@@ -137,7 +137,7 @@
# A 403 Forbidden or 413 Overlimit (old behaviour) exception
# will be raised while exceeding metadata items limit for
# tenant.
- quota_set = self.quotas.get_quota_set(self.tenant_id)
+ quota_set = self.quotas.show_quota_set(self.tenant_id)
quota_metadata = quota_set['metadata_items']
if quota_metadata == -1:
raise self.skipException("No limit for metadata_items")
diff --git a/tempest/api/compute/servers/test_server_personality.py b/tempest/api/compute/servers/test_server_personality.py
index 3a019b4..b3cc072 100644
--- a/tempest/api/compute/servers/test_server_personality.py
+++ b/tempest/api/compute/servers/test_server_personality.py
@@ -34,8 +34,8 @@
# number of files are injected into the server.
file_contents = 'This is a test file.'
personality = []
- max_file_limit = \
- self.user_client.get_specific_absolute_limit("maxPersonality")
+ limits = self.user_client.show_limits()
+ max_file_limit = limits['absolute']['maxPersonality']
if max_file_limit == -1:
raise self.skipException("No limit for personality files")
for i in range(0, int(max_file_limit) + 1):
@@ -52,8 +52,8 @@
# Server should be created successfully if maximum allowed number of
# files is injected into the server during creation.
file_contents = 'This is a test file.'
- max_file_limit = \
- self.user_client.get_specific_absolute_limit("maxPersonality")
+ limits = self.user_client.show_limits()
+ max_file_limit = limits['absolute']['maxPersonality']
if max_file_limit == -1:
raise self.skipException("No limit for personality files")
person = []
diff --git a/tempest/api/compute/servers/test_servers_negative.py b/tempest/api/compute/servers/test_servers_negative.py
index 82ef7f5..08bebc0 100644
--- a/tempest/api/compute/servers/test_servers_negative.py
+++ b/tempest/api/compute/servers/test_servers_negative.py
@@ -475,7 +475,7 @@
server = self.client.get_server(self.server_id)
image_name = server['name'] + '-shelved'
params = {'name': image_name}
- images = self.images_client.list_images(params)
+ images = self.images_client.list_images(**params)
self.assertEqual(1, len(images))
self.assertEqual(image_name, images[0]['name'])
diff --git a/tempest/api/compute/test_authorization.py b/tempest/api/compute/test_authorization.py
index 63b78a0..af29425 100644
--- a/tempest/api/compute/test_authorization.py
+++ b/tempest/api/compute/test_authorization.py
@@ -219,7 +219,7 @@
def test_get_keypair_of_alt_account_fails(self):
# A GET request for another user's keypair should fail
self.assertRaises(lib_exc.NotFound,
- self.alt_keypairs_client.get_keypair,
+ self.alt_keypairs_client.show_keypair,
self.keypairname)
@test.idempotent_id('6d841683-a8e0-43da-a1b8-b339f7692b61')
@@ -356,7 +356,7 @@
self.images_client.set_image_metadata(self.image['id'],
req_metadata)
self.assertRaises(lib_exc.NotFound,
- self.alt_images_client.get_image_metadata_item,
+ self.alt_images_client.show_image_metadata_item,
self.image['id'], 'meta1')
@test.idempotent_id('79531e2e-e721-493c-8b30-a35db36fdaa6')
diff --git a/tempest/api/compute/test_quotas.py b/tempest/api/compute/test_quotas.py
index a6e877c..e302798 100644
--- a/tempest/api/compute/test_quotas.py
+++ b/tempest/api/compute/test_quotas.py
@@ -47,14 +47,14 @@
def test_get_quotas(self):
# User can get the quota set for it's tenant
expected_quota_set = self.default_quota_set | set(['id'])
- quota_set = self.client.get_quota_set(self.tenant_id)
+ quota_set = self.client.show_quota_set(self.tenant_id)
self.assertEqual(quota_set['id'], self.tenant_id)
for quota in expected_quota_set:
self.assertIn(quota, quota_set.keys())
# get the quota set using user id
- quota_set = self.client.get_quota_set(self.tenant_id,
- self.user_id)
+ quota_set = self.client.show_quota_set(self.tenant_id,
+ self.user_id)
self.assertEqual(quota_set['id'], self.tenant_id)
for quota in expected_quota_set:
self.assertIn(quota, quota_set.keys())
@@ -63,7 +63,7 @@
def test_get_default_quotas(self):
# User can get the default quota set for it's tenant
expected_quota_set = self.default_quota_set | set(['id'])
- quota_set = self.client.get_default_quota_set(self.tenant_id)
+ quota_set = self.client.show_default_quota_set(self.tenant_id)
self.assertEqual(quota_set['id'], self.tenant_id)
for quota in expected_quota_set:
self.assertIn(quota, quota_set.keys())
@@ -72,6 +72,6 @@
def test_compare_tenant_quotas_with_default_quotas(self):
# Tenants are created with the default quota values
defualt_quota_set = \
- self.client.get_default_quota_set(self.tenant_id)
- tenant_quota_set = self.client.get_quota_set(self.tenant_id)
+ self.client.show_default_quota_set(self.tenant_id)
+ tenant_quota_set = self.client.show_quota_set(self.tenant_id)
self.assertEqual(defualt_quota_set, tenant_quota_set)
diff --git a/tempest/api/database/flavors/test_flavors.py b/tempest/api/database/flavors/test_flavors.py
index eeb472c..e698baa 100644
--- a/tempest/api/database/flavors/test_flavors.py
+++ b/tempest/api/database/flavors/test_flavors.py
@@ -58,7 +58,7 @@
@test.services('compute')
def test_compare_db_flavors_with_os(self):
db_flavors = self.client.list_db_flavors()
- os_flavors = self.os_flavors_client.list_flavors_with_detail()
+ os_flavors = self.os_flavors_client.list_flavors(detail=True)
self.assertEqual(len(os_flavors), len(db_flavors),
"OS flavors %s do not match DB flavors %s" %
(os_flavors, db_flavors))
diff --git a/tempest/api/identity/admin/v3/test_domains.py b/tempest/api/identity/admin/v3/test_domains.py
index b1a9d3b..94aab5b 100644
--- a/tempest/api/identity/admin/v3/test_domains.py
+++ b/tempest/api/identity/admin/v3/test_domains.py
@@ -101,7 +101,7 @@
@test.idempotent_id('2abf8764-309a-4fa9-bc58-201b799817ad')
def test_create_domain_without_description(self):
# Create domain only with name
- d_name = data_utils.rand_name('domain-')
+ d_name = data_utils.rand_name('domain')
domain = self.client.create_domain(d_name)
self.addCleanup(self._delete_domain, domain['id'])
self.assertIn('id', domain)
diff --git a/tempest/api/identity/admin/v3/test_trusts.py b/tempest/api/identity/admin/v3/test_trusts.py
index 3ebb90d..8a2d797 100644
--- a/tempest/api/identity/admin/v3/test_trusts.py
+++ b/tempest/api/identity/admin/v3/test_trusts.py
@@ -46,7 +46,7 @@
def create_trustor_and_roles(self):
# create a project that trusts will be granted on
- self.trustor_project_name = data_utils.rand_name(name='project-')
+ self.trustor_project_name = data_utils.rand_name(name='project')
project = self.client.create_project(self.trustor_project_name,
domain_id='default')
self.trustor_project_id = project['id']
diff --git a/tempest/api/identity/v2/test_api_discovery.py b/tempest/api/identity/v2/test_api_discovery.py
new file mode 100644
index 0000000..8132ee1
--- /dev/null
+++ b/tempest/api/identity/v2/test_api_discovery.py
@@ -0,0 +1,57 @@
+# Copyright 2015 OpenStack Foundation.
+# Copyright 2015, Red Hat, Inc.
+#
+# 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.api.identity import base
+from tempest import test
+
+
+class TestApiDiscovery(base.BaseIdentityV2Test):
+ """Tests for API discovery features."""
+
+ @test.attr(type='smoke')
+ @test.idempotent_id('ea889a68-a15f-4166-bfb1-c12456eae853')
+ def test_api_version_resources(self):
+ descr = self.non_admin_client.get_api_description()
+ expected_resources = ('id', 'links', 'media-types', 'status',
+ 'updated')
+
+ keys = descr.keys()
+ for res in expected_resources:
+ self.assertIn(res, keys)
+
+ @test.attr(type='smoke')
+ @test.idempotent_id('007a0be0-78fe-4fdb-bbee-e9216cc17bb2')
+ def test_api_media_types(self):
+ descr = self.non_admin_client.get_api_description()
+ # Get MIME type bases and descriptions
+ media_types = [(media_type['base'], media_type['type']) for
+ media_type in descr['media-types']]
+ # These are supported for API version 2
+ supported_types = [('application/json',
+ 'application/vnd.openstack.identity-v2.0+json')]
+
+ # Check if supported types exist in response body
+ for s_type in supported_types:
+ self.assertIn(s_type, media_types)
+
+ @test.attr(type='smoke')
+ @test.idempotent_id('77fd6be0-8801-48e6-b9bf-38cdd2f253ec')
+ def test_api_version_statuses(self):
+ descr = self.non_admin_client.get_api_description()
+ status = descr['status'].lower()
+ supported_statuses = ['current', 'stable', 'experimental',
+ 'supported', 'deprecated']
+
+ self.assertIn(status, supported_statuses)
diff --git a/tempest/api/identity/v3/test_api_discovery.py b/tempest/api/identity/v3/test_api_discovery.py
new file mode 100644
index 0000000..2ec8ad8
--- /dev/null
+++ b/tempest/api/identity/v3/test_api_discovery.py
@@ -0,0 +1,57 @@
+# Copyright 2015 OpenStack Foundation.
+# Copyright 2015, Red Hat, Inc.
+#
+# 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.api.identity import base
+from tempest import test
+
+
+class TestApiDiscovery(base.BaseIdentityV3Test):
+ """Tests for API discovery features."""
+
+ @test.attr(type='smoke')
+ @test.idempotent_id('b9232f5e-d9e5-4d97-b96c-28d3db4de1bd')
+ def test_api_version_resources(self):
+ descr = self.non_admin_client.get_api_description()
+ expected_resources = ('id', 'links', 'media-types', 'status',
+ 'updated')
+
+ keys = descr.keys()
+ for res in expected_resources:
+ self.assertIn(res, keys)
+
+ @test.attr(type='smoke')
+ @test.idempotent_id('657c1970-4722-4189-8831-7325f3bc4265')
+ def test_api_media_types(self):
+ descr = self.non_admin_client.get_api_description()
+ # Get MIME type bases and descriptions
+ media_types = [(media_type['base'], media_type['type']) for
+ media_type in descr['media-types']]
+ # These are supported for API version 2
+ supported_types = [('application/json',
+ 'application/vnd.openstack.identity-v3+json')]
+
+ # Check if supported types exist in response body
+ for s_type in supported_types:
+ self.assertIn(s_type, media_types)
+
+ @test.attr(type='smoke')
+ @test.idempotent_id('8879a470-abfb-47bb-bb8d-5a7fd279ad1e')
+ def test_api_version_statuses(self):
+ descr = self.non_admin_client.get_api_description()
+ status = descr['status'].lower()
+ supported_statuses = ['current', 'stable', 'experimental',
+ 'supported', 'deprecated']
+
+ self.assertIn(status, supported_statuses)
diff --git a/tempest/api/image/admin/v2/test_images.py b/tempest/api/image/admin/v2/test_images.py
index 83efc7d..1608b76 100644
--- a/tempest/api/image/admin/v2/test_images.py
+++ b/tempest/api/image/admin/v2/test_images.py
@@ -44,7 +44,7 @@
self.addCleanup(self.client.delete_image, image_id)
# upload an image file
image_file = moves.cStringIO(data_utils.random_bytes())
- self.client.store_image(image_id, image_file)
+ self.client.store_image_file(image_id, image_file)
# deactivate image
self.admin_client.deactivate_image(image_id)
body = self.client.show_image(image_id)
diff --git a/tempest/api/image/v2/test_images.py b/tempest/api/image/v2/test_images.py
index 8cccddd..2859cfe 100644
--- a/tempest/api/image/v2/test_images.py
+++ b/tempest/api/image/v2/test_images.py
@@ -56,7 +56,7 @@
# Now try uploading an image file
file_content = data_utils.random_bytes()
image_file = moves.cStringIO(file_content)
- self.client.store_image(image_id, image_file)
+ self.client.store_image_file(image_id, image_file)
# Now try to get image details
body = self.client.show_image(image_id)
@@ -67,7 +67,7 @@
self.assertEqual(1024, body.get('size'))
# Now try get image file
- body = self.client.get_image_file(image_id)
+ body = self.client.load_image_file(image_id)
self.assertEqual(file_content, body.data)
@test.attr(type='smoke')
@@ -109,7 +109,7 @@
# Now try uploading an image file
image_file = moves.cStringIO(data_utils.random_bytes())
- self.client.store_image(image_id, image_file)
+ self.client.store_image_file(image_id, image_file)
# Update Image
new_image_name = data_utils.rand_name('new-image')
@@ -156,7 +156,7 @@
disk_format=disk_format,
visibility='private')
image_id = body['id']
- cls.client.store_image(image_id, data=image_file)
+ cls.client.store_image_file(image_id, data=image_file)
return image_id
@@ -244,12 +244,12 @@
def test_get_image_schema(self):
# Test to get image schema
schema = "image"
- body = self.client.get_schema(schema)
+ body = self.client.show_schema(schema)
self.assertEqual("image", body['name'])
@test.idempotent_id('25c8d7b2-df21-460f-87ac-93130bcdc684')
def test_get_images_schema(self):
# Test to get images schema
schema = "images"
- body = self.client.get_schema(schema)
+ body = self.client.show_schema(schema)
self.assertEqual("images", body['name'])
diff --git a/tempest/api/image/v2/test_images_member.py b/tempest/api/image/v2/test_images_member.py
index eb6ffeb..d497005 100644
--- a/tempest/api/image/v2/test_images_member.py
+++ b/tempest/api/image/v2/test_images_member.py
@@ -82,10 +82,10 @@
@test.idempotent_id('634dcc3f-f6e2-4409-b8fd-354a0bb25d83')
def test_get_image_member_schema(self):
- body = self.os_img_client.get_schema("member")
+ body = self.os_img_client.show_schema("member")
self.assertEqual("member", body['name'])
@test.idempotent_id('6ae916ef-1052-4e11-8d36-b3ae14853cbb')
def test_get_image_members_schema(self):
- body = self.os_img_client.get_schema("members")
+ body = self.os_img_client.show_schema("members")
self.assertEqual("members", body['name'])
diff --git a/tempest/api/messaging/test_queues.py b/tempest/api/messaging/test_queues.py
index 2dac346..a3541b3 100644
--- a/tempest/api/messaging/test_queues.py
+++ b/tempest/api/messaging/test_queues.py
@@ -33,7 +33,7 @@
@test.idempotent_id('9f1c4c72-80c5-4dac-acf3-188cef42e36c')
def test_create_delete_queue(self):
# Create & Delete Queue
- queue_name = data_utils.rand_name('test-')
+ queue_name = data_utils.rand_name('test')
_, body = self.create_queue(queue_name)
self.addCleanup(self.client.delete_queue, queue_name)
diff --git a/tempest/api/network/admin/test_l3_agent_scheduler.py b/tempest/api/network/admin/test_l3_agent_scheduler.py
index 160cc06..38d68c2 100644
--- a/tempest/api/network/admin/test_l3_agent_scheduler.py
+++ b/tempest/api/network/admin/test_l3_agent_scheduler.py
@@ -27,6 +27,7 @@
class L3AgentSchedulerTestJSON(base.BaseAdminNetworkTest):
_agent_mode = 'legacy'
+ is_dvr_router = False
"""
Tests the following operations in the Neutron API using the REST client for
@@ -72,15 +73,22 @@
# query and setup steps are only required if the extension is available
# and only if the router's default type is distributed.
if test.is_extension_enabled('dvr', 'network'):
- is_dvr_router = cls.admin_client.show_router(
+ cls.is_dvr_router = cls.admin_client.show_router(
cls.router['id'])['router'].get('distributed', False)
- if is_dvr_router:
+ if cls.is_dvr_router:
cls.network = cls.create_network()
- cls.create_subnet(cls.network)
+ cls.subnet = cls.create_subnet(cls.network)
cls.port = cls.create_port(cls.network)
cls.client.add_router_interface_with_port_id(
cls.router['id'], cls.port['id'])
+ @classmethod
+ def resource_cleanup(cls):
+ if cls.is_dvr_router:
+ cls.client.remove_router_interface_with_port_id(
+ cls.router['id'], cls.port['id'])
+ super(L3AgentSchedulerTestJSON, cls).resource_cleanup()
+
@test.idempotent_id('b7ce6e89-e837-4ded-9b78-9ed3c9c6a45a')
def test_list_routers_on_l3_agent(self):
self.admin_client.list_routers_on_l3_agent(self.agent['id'])
diff --git a/tempest/api/network/admin/test_lbaas_agent_scheduler.py b/tempest/api/network/admin/test_lbaas_agent_scheduler.py
deleted file mode 100644
index 7234348..0000000
--- a/tempest/api/network/admin/test_lbaas_agent_scheduler.py
+++ /dev/null
@@ -1,74 +0,0 @@
-# Copyright 2013 IBM Corp.
-#
-# 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.common.utils import data_utils
-
-from tempest.api.network import base
-from tempest import test
-
-
-class LBaaSAgentSchedulerTestJSON(base.BaseAdminNetworkTest):
- """
- Tests the following operations in the Neutron API using the REST client for
- Neutron:
-
- List pools the given LBaaS agent is hosting.
- Show a LBaaS agent hosting the given pool.
-
- v2.0 of the Neutron API is assumed. It is also assumed that the following
- options are defined in the [networki-feature-enabled] section of
- etc/tempest.conf:
-
- api_extensions
- """
-
- @classmethod
- def skip_checks(cls):
- super(LBaaSAgentSchedulerTestJSON, cls).skip_checks()
- if not test.is_extension_enabled('lbaas_agent_scheduler', 'network'):
- msg = "LBaaS Agent Scheduler Extension not enabled."
- raise cls.skipException(msg)
-
- @classmethod
- def resource_setup(cls):
- super(LBaaSAgentSchedulerTestJSON, cls).resource_setup()
- cls.network = cls.create_network()
- cls.subnet = cls.create_subnet(cls.network)
- pool_name = data_utils.rand_name('pool-')
- cls.pool = cls.create_pool(pool_name, "ROUND_ROBIN",
- "HTTP", cls.subnet)
-
- @test.idempotent_id('e5ea8b15-4f44-4350-963c-e0fcb533ee79')
- def test_list_pools_on_lbaas_agent(self):
- found = False
- 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 = (
- self.admin_client.list_pools_hosted_by_one_lbaas_agent(
- a['id']))
- pools = body['pools']
- if self.pool['id'] in [p['id'] for p in pools]:
- found = True
- msg = 'Unable to find Load Balancer agent hosting pool'
- self.assertTrue(found, msg)
-
- @test.idempotent_id('e2745593-fd79-4b98-a262-575fd7865796')
- def test_show_lbaas_agent_hosting_pool(self):
- 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
deleted file mode 100644
index 24a04be..0000000
--- a/tempest/api/network/admin/test_load_balancer_admin_actions.py
+++ /dev/null
@@ -1,118 +0,0 @@
-# Copyright 2014 Mirantis.inc
-# 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.common.utils import data_utils
-
-from tempest.api.network import base
-from tempest import test
-
-
-class LoadBalancerAdminTestJSON(base.BaseAdminNetworkTest):
- """
- Test admin actions for load balancer.
-
- Create VIP for another tenant
- Create health monitor for another tenant
- """
-
- force_tenant_isolation = True
-
- @classmethod
- def skip_checks(cls):
- super(LoadBalancerAdminTestJSON, cls).skip_checks()
- if not test.is_extension_enabled('lbaas', 'network'):
- msg = "lbaas extension not enabled."
- raise cls.skipException(msg)
-
- @classmethod
- def setup_clients(cls):
- super(LoadBalancerAdminTestJSON, cls).setup_clients()
- cls.client = cls.manager.network_client
-
- @classmethod
- def resource_setup(cls):
- super(LoadBalancerAdminTestJSON, cls).resource_setup()
- cls.tenant_id = cls.os.credentials.tenant_id
- cls.network = cls.create_network()
- cls.subnet = cls.create_subnet(cls.network)
- cls.pool = cls.create_pool(data_utils.rand_name('pool-'),
- "ROUND_ROBIN", "HTTP", cls.subnet)
-
- @test.idempotent_id('6b0a20d8-4fcd-455e-b54f-ec4db5199518')
- def test_create_vip_as_admin_for_another_tenant(self):
- name = data_utils.rand_name('vip-')
- body = self.admin_client.create_pool(
- name=data_utils.rand_name('pool-'),
- lb_method="ROUND_ROBIN",
- protocol="HTTP",
- subnet_id=self.subnet['id'],
- 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)
- 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'])
- show_vip = body['vip']
- self.assertEqual(vip['id'], show_vip['id'])
- self.assertEqual(vip['name'], show_vip['name'])
-
- @test.idempotent_id('74552cfc-ab78-4fb6-825b-f67bca379921')
- def test_create_health_monitor_as_admin_for_another_tenant(self):
- body = (
- self.admin_client.create_health_monitor(delay=4,
- max_retries=3,
- type="TCP",
- timeout=1,
- tenant_id=self.tenant_id))
- health_monitor = body['health_monitor']
- self.addCleanup(self.admin_client.delete_health_monitor,
- 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'])
- show_health_monitor = body['health_monitor']
- self.assertEqual(health_monitor['id'], show_health_monitor['id'])
-
- @test.idempotent_id('266a192d-3c22-46c4-a8fb-802450301e82')
- def test_create_pool_from_admin_user_other_tenant(self):
- body = self.admin_client.create_pool(
- name=data_utils.rand_name('pool-'),
- lb_method="ROUND_ROBIN",
- protocol="HTTP",
- subnet_id=self.subnet['id'],
- tenant_id=self.tenant_id)
- pool = body['pool']
- self.addCleanup(self.admin_client.delete_pool, pool['id'])
- self.assertIsNotNone(pool['id'])
- self.assertEqual(self.tenant_id, pool['tenant_id'])
-
- @test.idempotent_id('158bb272-b9ed-4cfc-803c-661dac46f783')
- 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)
- member = body['member']
- self.addCleanup(self.admin_client.delete_member, member['id'])
- self.assertIsNotNone(member['id'])
- self.assertEqual(self.tenant_id, member['tenant_id'])
diff --git a/tempest/api/network/admin/test_quotas.py b/tempest/api/network/admin/test_quotas.py
index 46d6651..f6046d3 100644
--- a/tempest/api/network/admin/test_quotas.py
+++ b/tempest/api/network/admin/test_quotas.py
@@ -90,10 +90,3 @@
def test_quotas(self):
new_quotas = {'network': 0, 'security_group': 0}
self._check_quotas(new_quotas)
-
- @test.idempotent_id('a7add2b1-691e-44d6-875f-697d9685f091')
- @test.requires_ext(extension='lbaas', service='network')
- def test_lbaas_quotas(self):
- new_quotas = {'vip': 1, 'pool': 2,
- 'member': 3, 'health_monitor': 4}
- self._check_quotas(new_quotas)
diff --git a/tempest/api/network/base.py b/tempest/api/network/base.py
index f864f95..bbefc25 100644
--- a/tempest/api/network/base.py
+++ b/tempest/api/network/base.py
@@ -82,64 +82,19 @@
cls.subnets = []
cls.ports = []
cls.routers = []
- cls.pools = []
- cls.vips = []
- cls.members = []
- cls.health_monitors = []
- cls.vpnservices = []
- cls.ikepolicies = []
cls.floating_ips = []
cls.metering_labels = []
cls.metering_label_rules = []
- cls.fw_rules = []
- cls.fw_policies = []
- cls.ipsecpolicies = []
cls.ethertype = "IPv" + str(cls._ip_version)
@classmethod
def resource_cleanup(cls):
if CONF.service_available.neutron:
- # Clean up ipsec policies
- for ipsecpolicy in cls.ipsecpolicies:
- cls._try_delete_resource(cls.client.delete_ipsecpolicy,
- ipsecpolicy['id'])
- # Clean up firewall policies
- for fw_policy in cls.fw_policies:
- cls._try_delete_resource(cls.client.delete_firewall_policy,
- fw_policy['id'])
- # Clean up firewall rules
- for fw_rule in cls.fw_rules:
- cls._try_delete_resource(cls.client.delete_firewall_rule,
- fw_rule['id'])
- # Clean up ike policies
- for ikepolicy in cls.ikepolicies:
- cls._try_delete_resource(cls.client.delete_ikepolicy,
- ikepolicy['id'])
- # Clean up vpn services
- for vpnservice in cls.vpnservices:
- cls._try_delete_resource(cls.client.delete_vpnservice,
- vpnservice['id'])
# Clean up floating IPs
for floating_ip in cls.floating_ips:
cls._try_delete_resource(cls.client.delete_floatingip,
floating_ip['id'])
- # Clean up health monitors
- for health_monitor in cls.health_monitors:
- cls._try_delete_resource(cls.client.delete_health_monitor,
- health_monitor['id'])
- # Clean up members
- for member in cls.members:
- cls._try_delete_resource(cls.client.delete_member,
- member['id'])
- # Clean up vips
- for vip in cls.vips:
- cls._try_delete_resource(cls.client.delete_vip,
- vip['id'])
- # Clean up pools
- for pool in cls.pools:
- cls._try_delete_resource(cls.client.delete_pool,
- pool['id'])
# Clean up metering label rules
for metering_label_rule in cls.metering_label_rules:
cls._try_delete_resource(
@@ -284,78 +239,6 @@
return fip
@classmethod
- def create_pool(cls, name, lb_method, protocol, subnet):
- """Wrapper utility that returns a test pool."""
- body = cls.client.create_pool(
- name=name,
- lb_method=lb_method,
- protocol=protocol,
- subnet_id=subnet['id'])
- pool = body['pool']
- cls.pools.append(pool)
- return pool
-
- @classmethod
- def update_pool(cls, name):
- """Wrapper utility that returns a test pool."""
- 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."""
- 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):
- body = cls.client.update_vip(name=name)
- vip = body['vip']
- return vip
-
- @classmethod
- def create_member(cls, protocol_port, pool, ip_version=None):
- """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"
- 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):
- 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."""
- 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):
- 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."""
interface = cls.client.add_router_interface_with_subnet_id(
@@ -363,44 +246,6 @@
return interface
@classmethod
- def create_vpnservice(cls, subnet_id, router_id):
- """Wrapper utility that returns a test vpn service."""
- 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']
- cls.vpnservices.append(vpnservice)
- return vpnservice
-
- @classmethod
- def create_ikepolicy(cls, name):
- """Wrapper utility that returns a test ike policy."""
- body = cls.client.create_ikepolicy(name=name)
- ikepolicy = body['ikepolicy']
- cls.ikepolicies.append(ikepolicy)
- return ikepolicy
-
- @classmethod
- def create_firewall_rule(cls, action, protocol):
- """Wrapper utility that returns a test firewall rule."""
- body = cls.client.create_firewall_rule(
- name=data_utils.rand_name("fw-rule"),
- action=action,
- protocol=protocol)
- fw_rule = body['firewall_rule']
- cls.fw_rules.append(fw_rule)
- return fw_rule
-
- @classmethod
- def create_firewall_policy(cls):
- """Wrapper utility that returns a test 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)
- return fw_policy
-
- @classmethod
def delete_router(cls, router):
body = cls.client.list_router_interfaces(router['id'])
interfaces = body['ports']
@@ -412,14 +257,6 @@
pass
cls.client.delete_router(router['id'])
- @classmethod
- def create_ipsecpolicy(cls, name):
- """Wrapper utility that returns a test ipsec policy."""
- body = cls.client.create_ipsecpolicy(name=name)
- ipsecpolicy = body['ipsecpolicy']
- cls.ipsecpolicies.append(ipsecpolicy)
- return ipsecpolicy
-
class BaseAdminNetworkTest(BaseNetworkTest):
diff --git a/tempest/api/network/test_extensions.py b/tempest/api/network/test_extensions.py
index e9f1bf4..be7174b 100644
--- a/tempest/api/network/test_extensions.py
+++ b/tempest/api/network/test_extensions.py
@@ -57,7 +57,6 @@
self.assertIn('updated', ext_details.keys())
self.assertIn('name', ext_details.keys())
self.assertIn('description', ext_details.keys())
- self.assertIn('namespace', ext_details.keys())
self.assertIn('links', ext_details.keys())
self.assertIn('alias', ext_details.keys())
self.assertEqual(ext_details['name'], ext_name)
diff --git a/tempest/api/network/test_fwaas_extensions.py b/tempest/api/network/test_fwaas_extensions.py
deleted file mode 100644
index 651b4ab..0000000
--- a/tempest/api/network/test_fwaas_extensions.py
+++ /dev/null
@@ -1,333 +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 six
-from tempest_lib.common.utils import data_utils
-from tempest_lib import exceptions as lib_exc
-
-from tempest.api.network import base
-from tempest import config
-from tempest import exceptions
-from tempest import test
-
-CONF = config.CONF
-
-
-class FWaaSExtensionTestJSON(base.BaseNetworkTest):
- """
- Tests the following operations in the Neutron API using the REST client for
- Neutron:
-
- List firewall rules
- Create firewall rule
- Update firewall rule
- Delete firewall rule
- Show firewall rule
- List firewall policies
- Create firewall policy
- Update firewall policy
- Insert firewall rule to policy
- Remove firewall rule from policy
- Insert firewall rule after/before rule in policy
- Update firewall policy audited attribute
- Delete firewall policy
- Show firewall policy
- List firewall
- Create firewall
- Update firewall
- Delete firewall
- Show firewall
- """
-
- @classmethod
- def skip_checks(cls):
- super(FWaaSExtensionTestJSON, cls).skip_checks()
- if not test.is_extension_enabled('fwaas', 'network'):
- msg = "FWaaS Extension not enabled."
- raise cls.skipException(msg)
-
- @classmethod
- def resource_setup(cls):
- super(FWaaSExtensionTestJSON, cls).resource_setup()
- cls.fw_rule = cls.create_firewall_rule("allow", "tcp")
- cls.fw_policy = cls.create_firewall_policy()
-
- def _try_delete_policy(self, policy_id):
- # delete policy, if it exists
- try:
- self.client.delete_firewall_policy(policy_id)
- # if policy is not found, this means it was deleted in the test
- except lib_exc.NotFound:
- pass
-
- def _try_delete_rule(self, rule_id):
- # delete rule, if it exists
- try:
- self.client.delete_firewall_rule(rule_id)
- # if rule is not found, this means it was deleted in the test
- except lib_exc.NotFound:
- pass
-
- def _try_delete_firewall(self, fw_id):
- # delete firewall, if it exists
- try:
- self.client.delete_firewall(fw_id)
- # if firewall is not found, this means it was deleted in the test
- except lib_exc.NotFound:
- pass
-
- self.client.wait_for_resource_deletion('firewall', fw_id)
-
- def _wait_until_ready(self, fw_id):
- target_states = ('ACTIVE', 'CREATED')
-
- def _wait():
- firewall = self.client.show_firewall(fw_id)
- firewall = firewall['firewall']
- return firewall['status'] in target_states
-
- if not test.call_until_true(_wait, CONF.network.build_timeout,
- CONF.network.build_interval):
- status = self.client.show_firewall(fw_id)['firewall']['status']
- m = ("Timed out waiting for firewall %s to reach %s state(s) "
- "after %ss, currently in %s state." %
- (fw_id,
- target_states,
- CONF.network.build_interval,
- status))
- raise exceptions.TimeoutException(m)
-
- @test.idempotent_id('1b84cf01-9c09-4ce7-bc72-b15e39076468')
- def test_list_firewall_rules(self):
- # 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'],
- self.fw_rule['action'],
- self.fw_rule['protocol'],
- self.fw_rule['ip_version'],
- self.fw_rule['enabled']),
- [(m['id'],
- m['name'],
- m['action'],
- m['protocol'],
- m['ip_version'],
- m['enabled']) for m in fw_rules])
-
- @test.idempotent_id('563564f7-7077-4f5e-8cdc-51f37ae5a2b9')
- def test_create_update_delete_firewall_rule(self):
- # 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)
- self.assertTrue(body["firewall_rule"]['shared'])
-
- # Delete firewall rule
- self.client.delete_firewall_rule(fw_rule_id)
- # Confirm deletion
- fw_rules = self.client.list_firewall_rules()
- self.assertNotIn(fw_rule_id,
- [m['id'] for m in fw_rules['firewall_rules']])
-
- @test.idempotent_id('3ff8c08e-26ff-4034-ae48-810ed213a998')
- def test_show_firewall_rule(self):
- # show a created firewall rule
- fw_rule = self.client.show_firewall_rule(self.fw_rule['id'])
- for key, value in six.iteritems(fw_rule['firewall_rule']):
- self.assertEqual(self.fw_rule[key], value)
-
- @test.idempotent_id('1086dd93-a4c0-4bbb-a1bd-6d4bc62c199f')
- def test_list_firewall_policies(self):
- fw_policies = self.client.list_firewall_policies()
- fw_policies = fw_policies['firewall_policies']
- self.assertIn((self.fw_policy['id'],
- self.fw_policy['name'],
- self.fw_policy['firewall_rules']),
- [(m['id'],
- m['name'],
- m['firewall_rules']) for m in fw_policies])
-
- @test.idempotent_id('bbf37b6c-498c-421e-9c95-45897d3ed775')
- def test_create_update_delete_firewall_policy(self):
- # 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")
- updated_fw_policy = body["firewall_policy"]
- self.assertTrue(updated_fw_policy['shared'])
- self.assertEqual("updated_policy", updated_fw_policy['name'])
-
- # Delete firewall policy
- self.client.delete_firewall_policy(fw_policy_id)
- # Confirm deletion
- 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])
-
- @test.idempotent_id('1df59b3a-517e-41d4-96f6-fc31cf4ecff2')
- def test_show_firewall_policy(self):
- # show a created firewall policy
- fw_policy = self.client.show_firewall_policy(self.fw_policy['id'])
- fw_policy = fw_policy['firewall_policy']
- for key, value in six.iteritems(fw_policy):
- self.assertEqual(self.fw_policy[key], value)
-
- @test.idempotent_id('02082a03-3cdd-4789-986a-1327dd80bfb7')
- def test_create_show_delete_firewall(self):
- # Create tenant network resources required for an ACTIVE firewall
- network = self.create_network()
- subnet = self.create_subnet(network)
- router = self.create_router(
- data_utils.rand_name('router-'),
- admin_state_up=True)
- self.client.add_router_interface_with_subnet_id(
- router['id'], subnet['id'])
-
- # Create firewall
- body = self.client.create_firewall(
- name=data_utils.rand_name("firewall"),
- firewall_policy_id=self.fw_policy['id'])
- created_firewall = body['firewall']
- firewall_id = created_firewall['id']
- self.addCleanup(self._try_delete_firewall, firewall_id)
-
- # Wait for the firewall resource to become ready
- self._wait_until_ready(firewall_id)
-
- # show a created firewall
- firewall = self.client.show_firewall(firewall_id)
- firewall = firewall['firewall']
-
- for key, value in six.iteritems(firewall):
- if key == 'status':
- continue
- self.assertEqual(created_firewall[key], value)
-
- # list firewall
- firewalls = self.client.list_firewalls()
- firewalls = firewalls['firewalls']
- self.assertIn((created_firewall['id'],
- created_firewall['name'],
- created_firewall['firewall_policy_id']),
- [(m['id'],
- m['name'],
- m['firewall_policy_id']) for m in firewalls])
-
- # Delete firewall
- self.client.delete_firewall(firewall_id)
-
- @test.idempotent_id('53305b4b-9897-4e01-87c0-2ae386083180')
- def test_firewall_rule_insertion_position_removal_rule_from_policy(self):
- # 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(
- name=data_utils.rand_name("fw-policy"))
- fw_policy_id = body['firewall_policy']['id']
- self.addCleanup(self._try_delete_policy, fw_policy_id)
-
- # Insert rule to firewall policy
- self.client.insert_firewall_rule_in_policy(
- fw_policy_id, fw_rule_id1, '', '')
-
- # 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(
- name=data_utils.rand_name("fw-rule"),
- action="allow",
- protocol="icmp")
- fw_rule_id2 = body['firewall_rule']['id']
- self.addCleanup(self._try_delete_rule, fw_rule_id2)
-
- # Insert rule to firewall policy after the first rule
- 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_id2)
-
- self.assertEqual(int(fw_rule['firewall_rule']['position']), 2)
- # Remove rule from the firewall policy
- self.client.remove_firewall_rule_from_policy(
- fw_policy_id, fw_rule_id2)
- # Insert rule to firewall policy before the first rule
- 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_id2)
- self.assertEqual(int(fw_rule['firewall_rule']['position']), 1)
- # Remove rule from the firewall policy
- self.client.remove_firewall_rule_from_policy(
- fw_policy_id, fw_rule_id2)
- # Verify removal of rule from firewall policy
- self.assertNotIn(fw_rule_id2, self._get_list_fw_rule_ids(fw_policy_id))
-
- # Remove rule from the firewall policy
- self.client.remove_firewall_rule_from_policy(
- fw_policy_id, fw_rule_id1)
-
- # Verify removal of rule from firewall policy
- 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_id)
- return [ruleid for ruleid in fw_policy['firewall_policy']
- ['firewall_rules']]
-
- @test.idempotent_id('8515ca8a-0d2f-4298-b5ff-6f924e4587ca')
- def test_update_firewall_policy_audited_attribute(self):
- # 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(
- name=data_utils.rand_name('fw-policy'))
- fw_policy_id = body['firewall_policy']['id']
- self.addCleanup(self._try_delete_policy, fw_policy_id)
- self.assertFalse(body['firewall_policy']['audited'])
- # Update firewall policy audited attribute to ture
- self.client.update_firewall_policy(fw_policy_id,
- audited=True)
- # 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(
- 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
deleted file mode 100644
index 38a6fe9..0000000
--- a/tempest/api/network/test_load_balancer.py
+++ /dev/null
@@ -1,432 +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 six
-from tempest_lib.common.utils import data_utils
-from tempest_lib import decorators
-
-from tempest.api.network import base
-from tempest import test
-
-
-class LoadBalancerTestJSON(base.BaseNetworkTest):
- """
- Tests the following operations in the Neutron API using the REST client for
- Neutron:
-
- create vIP, and Pool
- show vIP
- list vIP
- update vIP
- delete vIP
- update pool
- delete pool
- show pool
- list pool
- health monitoring operations
- """
-
- @classmethod
- def skip_checks(cls):
- super(LoadBalancerTestJSON, cls).skip_checks()
- if not test.is_extension_enabled('lbaas', 'network'):
- msg = "lbaas extension not enabled."
- raise cls.skipException(msg)
-
- @classmethod
- def resource_setup(cls):
- super(LoadBalancerTestJSON, cls).resource_setup()
- cls.network = cls.create_network()
- cls.name = cls.network['name']
- cls.subnet = cls.create_subnet(cls.network)
- pool_name = data_utils.rand_name('pool-')
- vip_name = data_utils.rand_name('vip-')
- cls.pool = cls.create_pool(pool_name, "ROUND_ROBIN",
- "HTTP", cls.subnet)
- cls.vip = cls.create_vip(name=vip_name,
- protocol="HTTP",
- protocol_port=80,
- subnet=cls.subnet,
- pool=cls.pool)
- cls.member = cls.create_member(80, cls.pool, cls._ip_version)
- cls.member_address = ("10.0.9.47" if cls._ip_version == 4
- else "2015::beef")
- cls.health_monitor = cls.create_health_monitor(delay=4,
- max_retries=3,
- Type="TCP",
- timeout=1)
-
- def _check_list_with_filter(self, obj_name, attr_exceptions, **kwargs):
- create_obj = getattr(self.client, 'create_' + obj_name)
- delete_obj = getattr(self.client, 'delete_' + obj_name)
- list_objs = getattr(self.client, 'list_' + obj_name + 's')
-
- body = create_obj(**kwargs)
- obj = body[obj_name]
- self.addCleanup(delete_obj, obj['id'])
- for key, value in six.iteritems(obj):
- # 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})
- objs = [v[key] for v in body[obj_name + 's']]
- self.assertIn(value, objs)
-
- @test.idempotent_id('c96dbfab-4a80-4e74-a535-e950b5bedd47')
- def test_list_vips(self):
- # Verify the vIP exists in the list of all vIPs
- body = self.client.list_vips()
- vips = body['vips']
- self.assertIn(self.vip['id'], [v['id'] for v in vips])
-
- @test.idempotent_id('b8853f65-5089-4e69-befd-041a143427ff')
- 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'])
- pool = body['pool']
- self.addCleanup(self.client.delete_pool, pool['id'])
- attr_exceptions = ['status', 'session_persistence',
- 'status_description']
- self._check_list_with_filter(
- 'vip', attr_exceptions, name=name, protocol="HTTPS",
- protocol_port=81, subnet_id=self.subnet['id'], pool_id=pool['id'],
- description=data_utils.rand_name('description-'),
- admin_state_up=False)
-
- @test.idempotent_id('27f56083-9af9-4a48-abe9-ca1bcc6c9035')
- def test_create_update_delete_pool_vip(self):
- # Creates a vip
- name = data_utils.rand_name('vip-')
- address = self.subnet['allocation_pools'][0]['end']
- 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)
- vip = body['vip']
- vip_id = vip['id']
- # Confirm VIP's address correctness with a show
- body = self.client.show_vip(vip_id)
- vip = body['vip']
- self.assertEqual(address, vip['address'])
- # Verification of vip update
- new_name = "New_vip"
- new_description = "New description"
- 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)
- updated_vip = body['vip']
- self.assertEqual(new_name, updated_vip['name'])
- self.assertEqual(new_description, updated_vip['description'])
- self.assertEqual(10, updated_vip['connection_limit'])
- self.assertFalse(updated_vip['admin_state_up'])
- self.assertEqual(persistence_type,
- updated_vip['session_persistence']['type'])
- self.client.delete_vip(vip['id'])
- 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')
- updated_pool = body['pool']
- self.assertEqual(new_name, updated_pool['name'])
- self.assertEqual('new_description', updated_pool['description'])
- self.assertEqual('LEAST_CONNECTIONS', updated_pool['lb_method'])
- self.client.delete_pool(pool['id'])
-
- @test.idempotent_id('0435a95e-1d19-4d90-9e9f-3b979e9ad089')
- def test_show_vip(self):
- # Verifies the details of a vip
- body = self.client.show_vip(self.vip['id'])
- vip = body['vip']
- for key, value in six.iteritems(vip):
- # 'status' should not be confirmed in api tests
- if key != 'status':
- self.assertEqual(self.vip[key], value)
-
- @test.idempotent_id('6e7a7d31-8451-456d-b24a-e50479ce42a7')
- 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'])
- pool = body['pool']
- self.addCleanup(self.client.delete_pool, pool['id'])
- # Verifies the details of a pool
- body = self.client.show_pool(pool['id'])
- shown_pool = body['pool']
- for key, value in six.iteritems(pool):
- # 'status' should not be confirmed in api tests
- if key != 'status':
- self.assertEqual(value, shown_pool[key])
-
- @test.idempotent_id('d1ab1ffa-e06a-487f-911f-56418cb27727')
- def test_list_pools(self):
- # Verify the pool exists in the list of all pools
- body = self.client.list_pools()
- pools = body['pools']
- self.assertIn(self.pool['id'], [p['id'] for p in pools])
-
- @test.idempotent_id('27cc4c1a-caac-4273-b983-2acb4afaad4f')
- def test_list_pools_with_filters(self):
- attr_exceptions = ['status', 'vip_id', 'members', 'provider',
- 'status_description']
- self._check_list_with_filter(
- 'pool', attr_exceptions, name=data_utils.rand_name("pool-"),
- lb_method="ROUND_ROBIN", protocol="HTTPS",
- subnet_id=self.subnet['id'],
- description=data_utils.rand_name('description-'),
- admin_state_up=False)
-
- @test.idempotent_id('282d0dfd-5c3a-4c9b-b39c-c99782f39193')
- def test_list_members(self):
- # Verify the member exists in the list of all members
- body = self.client.list_members()
- members = body['members']
- self.assertIn(self.member['id'], [m['id'] for m in members])
-
- @test.idempotent_id('243b5126-24c6-4879-953e-7c7e32d8a57f')
- def test_list_members_with_filters(self):
- attr_exceptions = ['status', 'status_description']
- self._check_list_with_filter('member', attr_exceptions,
- address=self.member_address,
- protocol_port=80,
- pool_id=self.pool['id'])
-
- @test.idempotent_id('fb833ee8-9e69-489f-b540-a409762b78b2')
- 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'])
- member = body['member']
- # Verification of member update
- 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
- self.client.delete_member(member['id'])
-
- @test.idempotent_id('893cd71f-a7dd-4485-b162-f6ab9a534914')
- def test_show_member(self):
- # Verifies the details of a member
- body = self.client.show_member(self.member['id'])
- member = body['member']
- for key, value in six.iteritems(member):
- # 'status' should not be confirmed in api tests
- if key != 'status':
- self.assertEqual(self.member[key], value)
-
- @test.idempotent_id('8e5822c5-68a4-4224-8d6c-a617741ebc2d')
- def test_list_health_monitors(self):
- # Verify the health monitor exists in the list of all 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])
-
- @test.idempotent_id('49bac58a-511c-4875-b794-366698211d25')
- def test_list_health_monitors_with_filters(self):
- attr_exceptions = ['status', 'status_description', 'pools']
- self._check_list_with_filter('health_monitor', attr_exceptions,
- delay=5, max_retries=4, type="TCP",
- timeout=2)
-
- @test.idempotent_id('e8ce05c4-d554-4d1e-a257-ad32ce134bb5')
- 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)
- health_monitor = body['health_monitor']
- # Verification of health_monitor update
- 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'])
-
- @test.idempotent_id('d3e1aebc-06c2-49b3-9816-942af54012eb')
- 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)
- health_monitor = body['health_monitor']
- self.addCleanup(self.client.delete_health_monitor,
- health_monitor['id'])
- self.assertEqual(hm_type, health_monitor['type'])
-
- @test.idempotent_id('0eff9f67-90fb-4bb1-b4ed-c5fda99fff0c')
- def test_update_health_monitor_http_method(self):
- 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"))
- updated_health_monitor = body['health_monitor']
- self.assertEqual("POST", updated_health_monitor['http_method'])
- self.assertEqual("/home/user", updated_health_monitor['url_path'])
- self.assertEqual("290", updated_health_monitor['expected_codes'])
-
- @test.idempotent_id('08e126ab-1407-483f-a22e-b11cc032ca7c')
- def test_show_health_monitor(self):
- # Verifies the details of a health_monitor
- body = self.client.show_health_monitor(self.health_monitor['id'])
- health_monitor = body['health_monitor']
- for key, value in six.iteritems(health_monitor):
- # 'status' should not be confirmed in api tests
- if key != 'status':
- self.assertEqual(self.health_monitor[key], value)
-
- @test.idempotent_id('87f7628e-8918-493d-af50-0602845dbb5b')
- def test_associate_disassociate_health_monitor_with_pool(self):
- # Verify that a health monitor can be associated with a pool
- 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']
- body = self.client.show_pool(self.pool['id'])
- pool = body['pool']
- self.assertIn(pool['id'],
- [p['pool_id'] for p in health_monitor['pools']])
- self.assertIn(health_monitor['id'], pool['health_monitors'])
- # 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'])
- pool = body['pool']
- body = self.client.show_health_monitor(
- self.health_monitor['id'])
- health_monitor = body['health_monitor']
- self.assertNotIn(health_monitor['id'], pool['health_monitors'])
- self.assertNotIn(pool['id'],
- [p['pool_id'] for p in health_monitor['pools']])
-
- @test.idempotent_id('525fc7dc-be24-408d-938d-822e9783e027')
- def test_get_lb_pool_stats(self):
- # Verify the details of pool stats
- body = self.client.list_lb_pool_stats(self.pool['id'])
- stats = body['stats']
- self.assertIn("bytes_in", stats)
- self.assertIn("total_connections", stats)
- self.assertIn("active_connections", stats)
- self.assertIn("bytes_out", stats)
-
- @test.idempotent_id('66236be2-5121-4047-8cde-db4b83b110a5')
- def test_update_list_of_health_monitors_associated_with_pool(self):
- (self.client.associate_health_monitor_with_pool
- (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'])
- health_monitors = body['pool']['health_monitors']
- for health_monitor_id in health_monitors:
- 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']))
-
- @test.idempotent_id('44ec9b40-b501-41e2-951f-4fc673b15ac0')
- 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'])
- pool = body['pool']
- self.assertFalse(pool['admin_state_up'])
-
- @test.idempotent_id('466a9d4c-37c6-4ea2-b807-133437beb48c')
- def test_show_vip_associated_with_pool(self):
- body = self.client.show_pool(self.pool['id'])
- pool = body['pool']
- 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.idempotent_id('7b97694e-69d0-4151-b265-e1052a465aa8')
- def test_show_members_associated_with_pool(self):
- body = self.client.show_pool(self.pool['id'])
- members = body['pool']['members']
- for member_id in members:
- 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'])
-
- @test.idempotent_id('73ed6f27-595b-4b2c-969c-dbdda6b8ab34')
- 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'])
- 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'])
- # Confirm with show that pool_id change
- 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'])
-
- @test.idempotent_id('cf63f071-bbe3-40ba-97a0-a33e11923162')
- def test_update_member_weight(self):
- self.client.update_member(self.member['id'],
- weight=2)
- body = self.client.show_member(self.member['id'])
- member = body['member']
- self.assertEqual(2, member['weight'])
-
-
-@decorators.skip_because(bug="1402007")
-class LoadBalancerIpV6TestJSON(LoadBalancerTestJSON):
- _ip_version = 6
diff --git a/tempest/api/network/test_vpnaas_extensions.py b/tempest/api/network/test_vpnaas_extensions.py
deleted file mode 100644
index 9fe2a56..0000000
--- a/tempest/api/network/test_vpnaas_extensions.py
+++ /dev/null
@@ -1,319 +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 six
-from tempest_lib.common.utils import data_utils
-from tempest_lib import exceptions as lib_exc
-
-from tempest.api.network import base
-from tempest import config
-from tempest import test
-
-CONF = config.CONF
-
-
-class VPNaaSTestJSON(base.BaseAdminNetworkTest):
- """
- Tests the following operations in the Neutron API using the REST client for
- Neutron:
- List, Show, Create, Delete, and Update VPN Service
- List, Show, Create, Delete, and Update IKE policy
- List, Show, Create, Delete, and Update IPSec policy
- """
-
- @classmethod
- def skip_checks(cls):
- super(VPNaaSTestJSON, cls).skip_checks()
- if not test.is_extension_enabled('vpnaas', 'network'):
- msg = "vpnaas extension not enabled."
- raise cls.skipException(msg)
-
- @classmethod
- def resource_setup(cls):
- super(VPNaaSTestJSON, cls).resource_setup()
- cls.ext_net_id = CONF.network.public_network_id
- cls.network = cls.create_network()
- cls.subnet = cls.create_subnet(cls.network)
- cls.router = cls.create_router(
- data_utils.rand_name("router"),
- external_network_id=CONF.network.public_network_id)
- cls.create_router_interface(cls.router['id'], cls.subnet['id'])
- cls.vpnservice = cls.create_vpnservice(cls.subnet['id'],
- cls.router['id'])
-
- cls.ikepolicy = cls.create_ikepolicy(
- data_utils.rand_name("ike-policy-"))
- cls.ipsecpolicy = cls.create_ipsecpolicy(
- data_utils.rand_name("ipsec-policy-"))
-
- def _delete_ike_policy(self, ike_policy_id):
- # Deletes a ike policy and verifies if it is deleted or not
- ike_list = list()
- 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
- ikepolicies = self.client.list_ikepolicies()
- ike_id_list = list()
- for i in ikepolicies['ikepolicies']:
- ike_id_list.append(i['id'])
- self.assertNotIn(ike_policy_id, ike_id_list)
-
- def _delete_ipsec_policy(self, ipsec_policy_id):
- # Deletes an ike policy if it exists
- try:
- self.client.delete_ipsecpolicy(ipsec_policy_id)
-
- except lib_exc.NotFound:
- pass
-
- def _assertExpected(self, expected, actual):
- # Check if not expected keys/values exists in actual response body
- for key, value in six.iteritems(expected):
- self.assertIn(key, actual)
- self.assertEqual(value, actual[key])
-
- 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()
- vpn_services = [vs['id'] for vs in body['vpnservices']]
- self.assertNotIn(vpn_service_id, vpn_services)
-
- def _get_tenant_id(self):
- """
- Returns the tenant_id of the client current user
- """
- # 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'])
- return body['network']['tenant_id']
-
- @test.idempotent_id('14311574-0737-4e53-ac05-f7ae27742eed')
- def test_admin_create_ipsec_policy_for_tenant(self):
- 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))
- 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()
- ipsecpolicies = [policy['id'] for policy in body['ipsecpolicies']]
- self.assertIn(ipsecpolicy['id'], ipsecpolicies)
-
- @test.idempotent_id('b62acdc6-0c53-4d84-84aa-859b22b79799')
- def test_admin_create_vpn_service_for_tenant(self):
- tenant_id = self._get_tenant_id()
-
- # Create vpn service for the newly created tenant
- network2 = self.create_network()
- subnet2 = self.create_subnet(network2)
- router2 = self.create_router(data_utils.rand_name('router-'),
- 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(
- subnet_id=subnet2['id'],
- router_id=router2['id'],
- name=name,
- admin_state_up=True,
- tenant_id=tenant_id)
- vpnservice = body['vpnservice']
- 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()
- vpn_services = [vs['id'] for vs in body['vpnservices']]
- self.assertIn(vpnservice['id'], vpn_services)
-
- @test.idempotent_id('58cc4a1c-443b-4f39-8fb6-c19d39f343ab')
- def test_admin_create_ike_policy_for_tenant(self):
- tenant_id = self._get_tenant_id()
-
- # 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))
- 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()
- ikepolicies = [ikp['id'] for ikp in body['ikepolicies']]
- self.assertIn(ikepolicy['id'], ikepolicies)
-
- @test.idempotent_id('de5bb04c-3a1f-46b1-b329-7a8abba5c7f1')
- def test_list_vpn_services(self):
- # Verify the VPN service exists in the list of all VPN services
- body = self.client.list_vpnservices()
- vpnservices = body['vpnservices']
- self.assertIn(self.vpnservice['id'], [v['id'] for v in vpnservices])
-
- @test.idempotent_id('aacb13b1-fdc7-41fd-bab2-32621aee1878')
- def test_create_update_delete_vpn_service(self):
- # Creates a VPN service and sets up deletion
- network1 = self.create_network()
- subnet1 = self.create_subnet(network1)
- router1 = self.create_router(data_utils.rand_name('router-'),
- 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)
- vpnservice = body['vpnservice']
- self.addCleanup(self._delete_vpn_service, vpnservice['id'])
- # Assert if created vpnservices are not found in vpnservices list
- body = self.client.list_vpnservices()
- vpn_services = [vs['id'] for vs in body['vpnservices']]
- self.assertIsNotNone(vpnservice['id'])
- self.assertIn(vpnservice['id'], vpn_services)
-
- # TODO(raies): implement logic to update vpnservice
- # VPNaaS client function to update is implemented.
- # But precondition is that current state of vpnservice
- # should be "ACTIVE" not "PENDING*"
-
- @test.idempotent_id('0dedfc1d-f8ee-4e2a-bfd4-7997b9dc17ff')
- def test_show_vpn_service(self):
- # Verifies the details of a vpn service
- 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'])
- self.assertEqual(self.vpnservice['description'],
- vpnservice['description'])
- self.assertEqual(self.vpnservice['router_id'], vpnservice['router_id'])
- self.assertEqual(self.vpnservice['subnet_id'], vpnservice['subnet_id'])
- self.assertEqual(self.vpnservice['tenant_id'], vpnservice['tenant_id'])
- valid_status = ["ACTIVE", "DOWN", "BUILD", "ERROR", "PENDING_CREATE",
- "PENDING_UPDATE", "PENDING_DELETE"]
- self.assertIn(vpnservice['status'], valid_status)
-
- @test.idempotent_id('e0fb6200-da3d-4869-8340-a8c1956ca618')
- def test_list_ike_policies(self):
- # Verify the ike policy exists in the list of all IKE policies
- body = self.client.list_ikepolicies()
- ikepolicies = body['ikepolicies']
- self.assertIn(self.ikepolicy['id'], [i['id'] for i in ikepolicies])
-
- @test.idempotent_id('d61f29a5-160c-487d-bc0d-22e32e731b44')
- 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"))
- ikepolicy = body['ikepolicy']
- self.assertIsNotNone(ikepolicy['id'])
- self.addCleanup(self._delete_ike_policy, ikepolicy['id'])
-
- # Update IKE Policy
- new_ike = {'name': data_utils.rand_name("New-IKE"),
- 'description': "Updated ike policy",
- 'encryption_algorithm': "aes-256",
- 'ike_version': "v2",
- 'pfs': "group14",
- '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'])
- ike_policy = body['ikepolicy']
- for key, value in six.iteritems(new_ike):
- self.assertIn(key, ike_policy)
- self.assertEqual(value, ike_policy[key])
-
- # Verification of ike policy delete
- self.client.delete_ikepolicy(ikepolicy['id'])
- body = self.client.list_ikepolicies()
- ikepolicies = [ikp['id'] for ikp in body['ikepolicies']]
- self.assertNotIn(ike_policy['id'], ikepolicies)
-
- @test.idempotent_id('b5fcf3a3-9407-452d-b8a8-e7c6c32baea8')
- def test_show_ike_policy(self):
- # Verifies the details of a ike policy
- 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'])
- self.assertEqual(self.ikepolicy['description'],
- ikepolicy['description'])
- self.assertEqual(self.ikepolicy['encryption_algorithm'],
- ikepolicy['encryption_algorithm'])
- self.assertEqual(self.ikepolicy['auth_algorithm'],
- ikepolicy['auth_algorithm'])
- self.assertEqual(self.ikepolicy['tenant_id'],
- ikepolicy['tenant_id'])
- self.assertEqual(self.ikepolicy['pfs'],
- ikepolicy['pfs'])
- self.assertEqual(self.ikepolicy['phase1_negotiation_mode'],
- ikepolicy['phase1_negotiation_mode'])
- self.assertEqual(self.ikepolicy['ike_version'],
- ikepolicy['ike_version'])
-
- @test.idempotent_id('19ea0a2f-add9-44be-b732-ffd8a7b42f37')
- def test_list_ipsec_policies(self):
- # Verify the ipsec policy exists in the list of all ipsec policies
- body = self.client.list_ipsecpolicies()
- ipsecpolicies = body['ipsecpolicies']
- self.assertIn(self.ipsecpolicy['id'], [i['id'] for i in ipsecpolicies])
-
- @test.idempotent_id('9c1701c9-329a-4e5d-930a-1ead1b3f86ad')
- def test_create_update_delete_ipsec_policy(self):
- # Creates an ipsec policy
- ipsec_policy_body = {'name': data_utils.rand_name('ipsec-policy'),
- 'pfs': 'group5',
- 'encryption_algorithm': "aes-128",
- 'auth_algorithm': 'sha1'}
- 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)
- # Verification of ipsec policy update
- new_ipsec = {'description': 'Updated ipsec policy',
- 'pfs': 'group2',
- '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)
- updated_ipsec_policy = body['ipsecpolicy']
- self._assertExpected(new_ipsec, updated_ipsec_policy)
- # Verification of ipsec policy delete
- self.client.delete_ipsecpolicy(ipsecpolicy['id'])
- self.assertRaises(lib_exc.NotFound,
- self.client.delete_ipsecpolicy, ipsecpolicy['id'])
-
- @test.idempotent_id('601f8a05-9d3c-4539-a400-1c4b3a21b03b')
- def test_show_ipsec_policy(self):
- # Verifies the details of an ipsec policy
- body = self.client.show_ipsecpolicy(self.ipsecpolicy['id'])
- ipsecpolicy = body['ipsecpolicy']
- self._assertExpected(self.ipsecpolicy, ipsecpolicy)
diff --git a/tempest/api/object_storage/test_object_expiry.py b/tempest/api/object_storage/test_object_expiry.py
index fec6873..b263050 100644
--- a/tempest/api/object_storage/test_object_expiry.py
+++ b/tempest/api/object_storage/test_object_expiry.py
@@ -56,18 +56,33 @@
# we want to ensure that we will sleep long enough for things to
# actually expire, so figure out how many secs in the future that is.
sleepy_time = int(resp['x-delete-at']) - int(time.time())
-
+ sleepy_time = sleepy_time if sleepy_time > 0 else 0
resp, body = self.object_client.get_object(self.container_name,
self.object_name)
self.assertHeaders(resp, 'Object', 'GET')
self.assertIn('x-delete-at', resp)
- # add a couple of seconds for safety.
- time.sleep(sleepy_time + 3)
+ # add several seconds for safety.
+ time.sleep(sleepy_time)
+
+ # Checking whether object still exists for several seconds:
+ # sometimes object is not deleted immediately, so we are making
+ # get calls for an approximately 1 minute in a total. Get calls
+ # can take 3s each sometimes so we are making the requests in
+ # exponential periodicity
+ for i in range(1, 6):
+ time.sleep(2 ** i)
+ try:
+ self.object_client.get_object(self.container_name,
+ self.object_name)
+ except lib_exc.NotFound:
+ break
# object should not be there anymore
- self.assertRaises(lib_exc.NotFound, self.object_client.get_object,
- self.container_name, self.object_name)
+ self.assertRaises(lib_exc.NotFound,
+ self.object_client.get_object,
+ self.container_name,
+ self.object_name)
@test.idempotent_id('fb024a42-37f3-4ba5-9684-4f40a7910b41')
def test_get_object_after_expiry_time(self):
diff --git a/tempest/api/object_storage/test_object_services.py b/tempest/api/object_storage/test_object_services.py
index 627895e..3396d8f 100644
--- a/tempest/api/object_storage/test_object_services.py
+++ b/tempest/api/object_storage/test_object_services.py
@@ -827,8 +827,8 @@
resp, _ = self.object_client.create_object(src_container_name,
object_name, data)
# set object metadata
- meta_key = data_utils.rand_name(name='test-')
- meta_value = data_utils.rand_name(name='MetaValue-')
+ meta_key = data_utils.rand_name(name='test')
+ meta_value = data_utils.rand_name(name='MetaValue')
orig_metadata = {meta_key: meta_value}
resp, _ = self.object_client.update_object_metadata(src_container_name,
object_name,
diff --git a/tempest/api/telemetry/base.py b/tempest/api/telemetry/base.py
index 43180e5..cce8e2a 100644
--- a/tempest/api/telemetry/base.py
+++ b/tempest/api/telemetry/base.py
@@ -55,8 +55,7 @@
cls.nova_notifications = ['memory', 'vcpus', 'disk.root.size',
'disk.ephemeral.size']
- cls.glance_notifications = ['image.update', 'image.upload',
- 'image.delete']
+ cls.glance_notifications = ['image.size']
cls.glance_v2_notifications = ['image.download', 'image.serve']
diff --git a/tempest/api/telemetry/test_telemetry_notification_api.py b/tempest/api/telemetry/test_telemetry_notification_api.py
index 73a5fd4..52793c8 100644
--- a/tempest/api/telemetry/test_telemetry_notification_api.py
+++ b/tempest/api/telemetry/test_telemetry_notification_api.py
@@ -10,7 +10,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest_lib import decorators
import testtools
from tempest.api.telemetry import base
@@ -46,7 +45,6 @@
@test.services("image")
@testtools.skipIf(not CONF.image_feature_enabled.api_v1,
"Glance api v1 is disabled")
- @decorators.skip_because(bug='1351627')
def test_check_glance_v1_notifications(self):
body = self.create_image(self.image_client)
self.image_client.update_image(body['id'], data='data')
@@ -63,12 +61,11 @@
@test.services("image")
@testtools.skipIf(not CONF.image_feature_enabled.api_v2,
"Glance api v2 is disabled")
- @decorators.skip_because(bug='1351627')
def test_check_glance_v2_notifications(self):
body = self.create_image(self.image_client_v2)
- self.image_client_v2.store_image(body['id'], "file")
- self.image_client_v2.get_image_file(body['id'])
+ self.image_client_v2.store_image_file(body['id'], "file")
+ self.image_client_v2.load_image_file(body['id'])
query = 'resource', 'eq', body['id']
diff --git a/tempest/api/volume/admin/test_volume_quotas.py b/tempest/api/volume/admin/test_volume_quotas.py
index 24c7c63..ec8e040 100644
--- a/tempest/api/volume/admin/test_volume_quotas.py
+++ b/tempest/api/volume/admin/test_volume_quotas.py
@@ -98,7 +98,7 @@
@test.idempotent_id('874b35a9-51f1-4258-bec5-cd561b6690d3')
def test_delete_quota(self):
# Admin can delete the resource quota set for a tenant
- tenant_name = data_utils.rand_name('quota_tenant_')
+ tenant_name = data_utils.rand_name('quota_tenant')
identity_client = self.os_adm.identity_client
tenant = identity_client.create_tenant(tenant_name)
tenant_id = tenant['id']
diff --git a/tempest/api_schema/response/compute/v2_1/agents.py b/tempest/api_schema/response/compute/v2_1/agents.py
index 84c5fd3..da38198 100644
--- a/tempest/api_schema/response/compute/v2_1/agents.py
+++ b/tempest/api_schema/response/compute/v2_1/agents.py
@@ -23,6 +23,7 @@
'url': {'type': 'string', 'format': 'uri'},
'md5hash': {'type': 'string'}
},
+ 'additionalProperties': False,
'required': ['agent_id', 'hypervisor', 'os', 'architecture',
'version', 'url', 'md5hash']
}
@@ -37,6 +38,7 @@
'items': common_agent_info
}
},
+ 'additionalProperties': False,
'required': ['agents']
}
}
@@ -48,6 +50,7 @@
'properties': {
'agent': common_agent_info
},
+ 'additionalProperties': False,
'required': ['agent']
}
}
diff --git a/tempest/api_schema/response/compute/v2_1/aggregates.py b/tempest/api_schema/response/compute/v2_1/aggregates.py
index c935592..1a9fe41 100644
--- a/tempest/api_schema/response/compute/v2_1/aggregates.py
+++ b/tempest/api_schema/response/compute/v2_1/aggregates.py
@@ -26,6 +26,7 @@
'name': {'type': 'string'},
'updated_at': {'type': ['string', 'null']}
},
+ 'additionalProperties': False,
'required': ['availability_zone', 'created_at', 'deleted',
'deleted_at', 'id', 'name', 'updated_at'],
}
@@ -47,6 +48,7 @@
'items': common_aggregate_info
}
},
+ 'additionalProperties': False,
'required': ['aggregates'],
}
}
@@ -58,6 +60,7 @@
'properties': {
'aggregate': common_aggregate_info
},
+ 'additionalProperties': False,
'required': ['aggregate'],
}
}
@@ -81,6 +84,7 @@
'properties': {
'aggregate': aggregate_for_create
},
+ 'additionalProperties': False,
'required': ['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
index 5c1224e..d9aebce 100644
--- a/tempest/api_schema/response/compute/v2_1/availability_zone.py
+++ b/tempest/api_schema/response/compute/v2_1/availability_zone.py
@@ -31,16 +31,19 @@
'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']
}
}
@@ -60,6 +63,7 @@
'active': {'type': 'boolean'},
'updated_at': {'type': ['string', 'null']}
},
+ 'additionalProperties': False,
'required': ['available', 'active', 'updated_at']
}
}
diff --git a/tempest/api_schema/response/compute/v2_1/baremetal_nodes.py b/tempest/api_schema/response/compute/v2_1/baremetal_nodes.py
index 82506e7..d1ee877 100644
--- a/tempest/api_schema/response/compute/v2_1/baremetal_nodes.py
+++ b/tempest/api_schema/response/compute/v2_1/baremetal_nodes.py
@@ -25,6 +25,7 @@
'memory_mb': {'type': ['integer', 'string']},
'disk_gb': {'type': ['integer', 'string']},
},
+ 'additionalProperties': False,
'required': ['id', 'interfaces', 'host', 'task_state', 'cpus', 'memory_mb',
'disk_gb']
}
@@ -39,6 +40,7 @@
'items': node
}
},
+ 'additionalProperties': False,
'required': ['nodes']
}
}
@@ -50,6 +52,7 @@
'properties': {
'node': node
},
+ 'additionalProperties': False,
'required': ['node']
}
}
diff --git a/tempest/api_schema/response/compute/v2_1/certificates.py b/tempest/api_schema/response/compute/v2_1/certificates.py
index 35445d8..4e7cbe4 100644
--- a/tempest/api_schema/response/compute/v2_1/certificates.py
+++ b/tempest/api_schema/response/compute/v2_1/certificates.py
@@ -25,9 +25,11 @@
'data': {'type': 'string'},
'private_key': {'type': 'string'},
},
+ 'additionalProperties': False,
'required': ['data', 'private_key']
}
},
+ 'additionalProperties': False,
'required': ['certificate']
}
}
diff --git a/tempest/api_schema/response/compute/v2_1/extensions.py b/tempest/api_schema/response/compute/v2_1/extensions.py
index 570cd03..a6a455c 100644
--- a/tempest/api_schema/response/compute/v2_1/extensions.py
+++ b/tempest/api_schema/response/compute/v2_1/extensions.py
@@ -35,11 +35,13 @@
'alias': {'type': 'string'},
'description': {'type': 'string'}
},
+ 'additionalProperties': False,
'required': ['updated', 'name', 'links', 'namespace',
'alias', 'description']
}
}
},
+ 'additionalProperties': False,
'required': ['extensions']
}
}
diff --git a/tempest/api_schema/response/compute/v2_1/fixed_ips.py b/tempest/api_schema/response/compute/v2_1/fixed_ips.py
index 13e70bf..6d5ba67 100644
--- a/tempest/api_schema/response/compute/v2_1/fixed_ips.py
+++ b/tempest/api_schema/response/compute/v2_1/fixed_ips.py
@@ -28,9 +28,11 @@
'host': {'type': 'string'},
'hostname': {'type': 'string'}
},
+ 'additionalProperties': False,
'required': ['address', 'cidr', 'host', 'hostname']
}
},
+ 'additionalProperties': False,
'required': ['fixed_ip']
}
}
diff --git a/tempest/api_schema/response/compute/v2_1/flavors.py b/tempest/api_schema/response/compute/v2_1/flavors.py
index 26760ac..5f5b2e3 100644
--- a/tempest/api_schema/response/compute/v2_1/flavors.py
+++ b/tempest/api_schema/response/compute/v2_1/flavors.py
@@ -28,11 +28,13 @@
'links': parameter_types.links,
'id': {'type': 'string'}
},
+ 'additionalProperties': False,
'required': ['name', 'links', 'id']
}
},
'flavors_links': parameter_types.links
},
+ 'additionalProperties': False,
# NOTE(gmann): flavors_links attribute is not necessary
# to be present always So it is not 'required'.
'required': ['flavors']
@@ -56,6 +58,7 @@
'rxtx_factor': {'type': 'number'},
'OS-FLV-EXT-DATA:ephemeral': {'type': 'integer'}
},
+ 'additionalProperties': False,
# 'OS-FLV-DISABLED', 'os-flavor-access', 'rxtx_factor' and
# 'OS-FLV-EXT-DATA' are API extensions. So they are not 'required'.
'required': ['name', 'links', 'ram', 'vcpus', 'swap', 'disk', 'id']
@@ -74,6 +77,7 @@
# to be present always So it is not 'required'.
'flavors_links': parameter_types.links
},
+ 'additionalProperties': False,
'required': ['flavors']
}
}
@@ -89,6 +93,7 @@
'properties': {
'flavor': common_flavor_info
},
+ 'additionalProperties': False,
'required': ['flavor']
}
}
diff --git a/tempest/api_schema/response/compute/v2_1/flavors_access.py b/tempest/api_schema/response/compute/v2_1/flavors_access.py
index cd31b0a..a4d6af0 100644
--- a/tempest/api_schema/response/compute/v2_1/flavors_access.py
+++ b/tempest/api_schema/response/compute/v2_1/flavors_access.py
@@ -25,10 +25,12 @@
'flavor_id': {'type': 'string'},
'tenant_id': {'type': 'string'},
},
+ 'additionalProperties': False,
'required': ['flavor_id', 'tenant_id'],
}
}
},
+ 'additionalProperties': False,
'required': ['flavor_access']
}
}
diff --git a/tempest/api_schema/response/compute/v2_1/flavors_extra_specs.py b/tempest/api_schema/response/compute/v2_1/flavors_extra_specs.py
index faa25d0..a438d48 100644
--- a/tempest/api_schema/response/compute/v2_1/flavors_extra_specs.py
+++ b/tempest/api_schema/response/compute/v2_1/flavors_extra_specs.py
@@ -24,6 +24,7 @@
}
}
},
+ 'additionalProperties': False,
'required': ['extra_specs']
}
}
diff --git a/tempest/api_schema/response/compute/v2_1/floating_ips.py b/tempest/api_schema/response/compute/v2_1/floating_ips.py
index ad1c531..28dd40a 100644
--- a/tempest/api_schema/response/compute/v2_1/floating_ips.py
+++ b/tempest/api_schema/response/compute/v2_1/floating_ips.py
@@ -30,6 +30,7 @@
'format': 'ip-address'
}
},
+ 'additionalProperties': False,
'required': ['id', 'pool', 'instance_id',
'ip', 'fixed_ip'],
@@ -44,6 +45,7 @@
'items': common_floating_ip_info
},
},
+ 'additionalProperties': False,
'required': ['floating_ips'],
}
}
@@ -55,6 +57,7 @@
'properties': {
'floating_ip': common_floating_ip_info
},
+ 'additionalProperties': False,
'required': ['floating_ip'],
}
}
@@ -71,10 +74,12 @@
'properties': {
'name': {'type': 'string'}
},
+ 'additionalProperties': False,
'required': ['name'],
}
}
},
+ 'additionalProperties': False,
'required': ['floating_ip_pools'],
}
}
@@ -95,9 +100,11 @@
'ip_range': {'type': 'string'},
'pool': {'type': ['string', 'null']},
},
+ 'additionalProperties': False,
'required': ['interface', 'ip_range', 'pool'],
}
},
+ 'additionalProperties': False,
'required': ['floating_ips_bulk_create'],
}
}
@@ -109,6 +116,7 @@
'properties': {
'floating_ips_bulk_delete': {'type': 'string'}
},
+ 'additionalProperties': False,
'required': ['floating_ips_bulk_delete'],
}
}
@@ -136,6 +144,7 @@
'format': 'ip-address'
}
},
+ 'additionalProperties': False,
# NOTE: fixed_ip is introduced after JUNO release,
# So it is not defined as 'required'.
'required': ['address', 'instance_uuid', 'interface',
@@ -143,6 +152,7 @@
}
}
},
+ 'additionalProperties': False,
'required': ['floating_ip_info'],
}
}
diff --git a/tempest/api_schema/response/compute/v2_1/hosts.py b/tempest/api_schema/response/compute/v2_1/hosts.py
index 72d5a07..ae70ff1 100644
--- a/tempest/api_schema/response/compute/v2_1/hosts.py
+++ b/tempest/api_schema/response/compute/v2_1/hosts.py
@@ -29,10 +29,12 @@
'service': {'type': 'string'},
'zone': {'type': 'string'}
},
+ 'additionalProperties': False,
'required': ['host_name', 'service', 'zone']
}
}
},
+ 'additionalProperties': False,
'required': ['hosts']
}
}
@@ -56,14 +58,17 @@
'memory_mb': {'type': 'integer'},
'project': {'type': 'string'}
},
+ 'additionalProperties': False,
'required': ['cpu', 'disk_gb', 'host',
'memory_mb', 'project']
}
},
+ 'additionalProperties': False,
'required': ['resource']
}
}
},
+ 'additionalProperties': False,
'required': ['host']
}
}
@@ -76,6 +81,7 @@
'host': {'type': 'string'},
'power_action': {'enum': ['startup']}
},
+ 'additionalProperties': False,
'required': ['host', 'power_action']
}
}
@@ -104,6 +110,7 @@
'off_maintenance']},
'status': {'enum': ['enabled', 'disabled']}
},
+ 'additionalProperties': False,
'required': ['host', 'maintenance_mode', 'status']
}
}
diff --git a/tempest/api_schema/response/compute/v2_1/hypervisors.py b/tempest/api_schema/response/compute/v2_1/hypervisors.py
index 3efa46b..e24389d 100644
--- a/tempest/api_schema/response/compute/v2_1/hypervisors.py
+++ b/tempest/api_schema/response/compute/v2_1/hypervisors.py
@@ -35,6 +35,7 @@
'vcpus': {'type': 'integer'},
'vcpus_used': {'type': 'integer'}
},
+ 'additionalProperties': False,
'required': ['count', 'current_workload',
'disk_available_least', 'free_disk_gb',
'free_ram_mb', 'local_gb', 'local_gb_used',
@@ -42,6 +43,7 @@
'vcpus', 'vcpus_used']
}
},
+ 'additionalProperties': False,
'required': ['hypervisor_statistics']
}
}
@@ -77,11 +79,13 @@
'id': {'type': ['integer', 'string']},
'disabled_reason': {'type': ['string', 'null']}
},
+ 'additionalProperties': False,
'required': ['host', 'id']
},
'vcpus': {'type': 'integer'},
'vcpus_used': {'type': 'integer'}
},
+ 'additionalProperties': False,
# NOTE: When loading os-hypervisor-status extension,
# a response contains status and state. So these params
# should not be required.
@@ -104,6 +108,7 @@
'items': hypervisor_detail
}
},
+ 'additionalProperties': False,
'required': ['hypervisors']
}
}
@@ -115,6 +120,7 @@
'properties': {
'hypervisor': hypervisor_detail
},
+ 'additionalProperties': False,
'required': ['hypervisor']
}
}
@@ -134,6 +140,7 @@
'id': {'type': ['integer', 'string']},
'hypervisor_hostname': {'type': 'string'}
},
+ 'additionalProperties': False,
# NOTE: When loading os-hypervisor-status extension,
# a response contains status and state. So these params
# should not be required.
@@ -141,6 +148,7 @@
}
}
},
+ 'additionalProperties': False,
'required': ['hypervisors']
}
}
@@ -159,12 +167,14 @@
'hypervisor_hostname': {'type': 'string'},
'uptime': {'type': 'string'}
},
+ 'additionalProperties': False,
# NOTE: When loading os-hypervisor-status extension,
# a response contains status and state. So these params
# should not be required.
'required': ['id', 'hypervisor_hostname', 'uptime']
}
},
+ 'additionalProperties': False,
'required': ['hypervisor']
}
}
@@ -178,7 +188,8 @@
'properties': {
'uuid': {'type': 'string'},
'name': {'type': 'string'}
- }
+ },
+ 'additionalProperties': False,
}
}
# In V2 API, if there is no servers (VM) on the Hypervisor host then 'servers'
diff --git a/tempest/api_schema/response/compute/v2_1/images.py b/tempest/api_schema/response/compute/v2_1/images.py
index e6f8db6..a513dcb 100644
--- a/tempest/api_schema/response/compute/v2_1/images.py
+++ b/tempest/api_schema/response/compute/v2_1/images.py
@@ -38,11 +38,13 @@
'id': {'type': 'string'},
'links': parameter_types.links
},
+ 'additionalProperties': False,
'required': ['id', 'links']
},
'OS-EXT-IMG-SIZE:size': {'type': 'integer'},
'OS-DCF:diskConfig': {'type': 'string'}
},
+ 'additionalProperties': False,
# 'server' attributes only comes in response body if image is
# associated with any server. 'OS-EXT-IMG-SIZE:size' & 'OS-DCF:diskConfig'
# are API extension, So those are not defined as 'required'.
@@ -58,6 +60,7 @@
'properties': {
'image': common_image_schema
},
+ 'additionalProperties': False,
'required': ['image']
}
}
@@ -76,11 +79,13 @@
'links': image_links,
'name': {'type': 'string'}
},
+ 'additionalProperties': False,
'required': ['id', 'links', 'name']
}
},
'images_links': parameter_types.links
},
+ 'additionalProperties': False,
# NOTE(gmann): images_links attribute is not necessary to be
# present always So it is not 'required'.
'required': ['images']
@@ -113,6 +118,7 @@
'properties': {
'metadata': {'type': 'object'}
},
+ 'additionalProperties': False,
'required': ['metadata']
}
}
@@ -124,6 +130,7 @@
'properties': {
'meta': {'type': 'object'}
},
+ 'additionalProperties': False,
'required': ['meta']
}
}
@@ -139,6 +146,7 @@
},
'images_links': parameter_types.links
},
+ 'additionalProperties': False,
# NOTE(gmann): images_links attribute is not necessary to be
# present always So it is not 'required'.
'required': ['images']
diff --git a/tempest/api_schema/response/compute/v2_1/instance_usage_audit_logs.py b/tempest/api_schema/response/compute/v2_1/instance_usage_audit_logs.py
index 658f574..c6c4deb 100644
--- a/tempest/api_schema/response/compute/v2_1/instance_usage_audit_logs.py
+++ b/tempest/api_schema/response/compute/v2_1/instance_usage_audit_logs.py
@@ -30,6 +30,7 @@
'total_errors': {'type': 'integer'},
'total_instances': {'type': 'integer'}
},
+ 'additionalProperties': False,
'required': ['hosts_not_run', 'log', 'num_hosts', 'num_hosts_done',
'num_hosts_not_run', 'num_hosts_running', 'overall_status',
'period_beginning', 'period_ending', 'total_errors',
@@ -43,6 +44,7 @@
'properties': {
'instance_usage_audit_log': common_instance_usage_audit_log
},
+ 'additionalProperties': False,
'required': ['instance_usage_audit_log']
}
}
@@ -54,6 +56,7 @@
'properties': {
'instance_usage_audit_logs': common_instance_usage_audit_log
},
+ 'additionalProperties': False,
'required': ['instance_usage_audit_logs']
}
}
diff --git a/tempest/api_schema/response/compute/v2_1/interfaces.py b/tempest/api_schema/response/compute/v2_1/interfaces.py
index 033f816..b18fba6 100644
--- a/tempest/api_schema/response/compute/v2_1/interfaces.py
+++ b/tempest/api_schema/response/compute/v2_1/interfaces.py
@@ -32,6 +32,7 @@
'format': 'ipv4'
}
},
+ 'additionalProperties': False,
'required': ['subnet_id', 'ip_address']
}
},
@@ -39,6 +40,7 @@
'net_id': {'type': 'string', 'format': 'uuid'},
'mac_addr': parameter_types.mac_address
},
+ 'additionalProperties': False,
'required': ['port_state', 'fixed_ips', 'port_id', 'net_id', 'mac_addr']
}
@@ -49,6 +51,7 @@
'properties': {
'interfaceAttachment': interface_common_info
},
+ 'additionalProperties': False,
'required': ['interfaceAttachment']
}
}
@@ -63,6 +66,7 @@
'items': interface_common_info
}
},
+ 'additionalProperties': False,
'required': ['interfaceAttachments']
}
}
diff --git a/tempest/api_schema/response/compute/v2_1/keypairs.py b/tempest/api_schema/response/compute/v2_1/keypairs.py
index ceae6cf..9c04c79 100644
--- a/tempest/api_schema/response/compute/v2_1/keypairs.py
+++ b/tempest/api_schema/response/compute/v2_1/keypairs.py
@@ -31,6 +31,7 @@
'id': {'type': 'integer'}
},
+ 'additionalProperties': False,
# When we run the get keypair API, response body includes
# all the above mentioned attributes.
# But in Nova API sample file, response body includes only
@@ -39,6 +40,7 @@
'required': ['public_key', 'name', 'fingerprint']
}
},
+ 'additionalProperties': False,
'required': ['keypair']
}
}
@@ -57,12 +59,14 @@
'user_id': {'type': 'string'},
'private_key': {'type': 'string'}
},
+ 'additionalProperties': False,
# When create keypair API is being called with 'Public key'
# (Importing keypair) then, response body does not contain
# 'private_key' So it is not defined as 'required'
'required': ['fingerprint', 'name', 'public_key', 'user_id']
}
},
+ 'additionalProperties': False,
'required': ['keypair']
}
}
@@ -88,13 +92,16 @@
'name': {'type': 'string'},
'fingerprint': {'type': 'string'}
},
+ 'additionalProperties': False,
'required': ['public_key', 'name', 'fingerprint']
}
},
+ 'additionalProperties': False,
'required': ['keypair']
}
}
},
+ 'additionalProperties': False,
'required': ['keypairs']
}
}
diff --git a/tempest/api_schema/response/compute/v2_1/limits.py b/tempest/api_schema/response/compute/v2_1/limits.py
index a7decb7..81f175f 100644
--- a/tempest/api_schema/response/compute/v2_1/limits.py
+++ b/tempest/api_schema/response/compute/v2_1/limits.py
@@ -43,6 +43,7 @@
'maxServerGroups': {'type': 'integer'},
'totalServerGroupsUsed': {'type': 'integer'}
},
+ 'additionalProperties': False,
# NOTE(gmann): maxServerGroupMembers, maxServerGroups
# and totalServerGroupsUsed are API extension,
# and some environments return a response without these
@@ -84,18 +85,22 @@
{'type': 'integer'},
'verb':
{'type': 'string'}
- }
+ },
+ 'additionalProperties': False,
}
},
'regex': {'type': 'string'},
'uri': {'type': 'string'}
- }
+ },
+ 'additionalProperties': False,
}
}
},
+ 'additionalProperties': False,
'required': ['absolute', 'rate']
}
},
+ 'additionalProperties': False,
'required': ['limits']
}
}
diff --git a/tempest/api_schema/response/compute/v2_1/migrations.py b/tempest/api_schema/response/compute/v2_1/migrations.py
index 6549272..722372c 100644
--- a/tempest/api_schema/response/compute/v2_1/migrations.py
+++ b/tempest/api_schema/response/compute/v2_1/migrations.py
@@ -35,6 +35,7 @@
'created_at': {'type': 'string'},
'updated_at': {'type': ['string', 'null']}
},
+ 'additionalProperties': False,
'required': [
'id', 'status', 'instance_uuid', 'source_node',
'source_compute', 'dest_node', 'dest_compute',
@@ -44,6 +45,7 @@
}
}
},
+ 'additionalProperties': False,
'required': ['migrations']
}
}
diff --git a/tempest/api_schema/response/compute/v2_1/parameter_types.py b/tempest/api_schema/response/compute/v2_1/parameter_types.py
index 90d4c8f..7b4264c 100644
--- a/tempest/api_schema/response/compute/v2_1/parameter_types.py
+++ b/tempest/api_schema/response/compute/v2_1/parameter_types.py
@@ -23,6 +23,7 @@
},
'rel': {'type': 'string'}
},
+ 'additionalProperties': False,
'required': ['href', 'rel']
}
}
@@ -60,6 +61,7 @@
]
}
},
+ 'additionalProperties': False,
'required': ['version', 'addr']
}
}
diff --git a/tempest/api_schema/response/compute/v2_1/quotas.py b/tempest/api_schema/response/compute/v2_1/quotas.py
index 9141f7e..7953983 100644
--- a/tempest/api_schema/response/compute/v2_1/quotas.py
+++ b/tempest/api_schema/response/compute/v2_1/quotas.py
@@ -37,6 +37,7 @@
'injected_file_content_bytes': {'type': 'integer'},
'injected_file_path_bytes': {'type': 'integer'}
},
+ 'additionalProperties': False,
# NOTE: server_group_members and server_groups are represented
# when enabling quota_server_group extension. So they should
# not be required.
@@ -48,6 +49,7 @@
'injected_file_path_bytes']
}
},
+ 'additionalProperties': False,
'required': ['quota_set']
}
}
diff --git a/tempest/api_schema/response/compute/v2_1/security_group_default_rule.py b/tempest/api_schema/response/compute/v2_1/security_group_default_rule.py
index 9246ab8..2ec2826 100644
--- a/tempest/api_schema/response/compute/v2_1/security_group_default_rule.py
+++ b/tempest/api_schema/response/compute/v2_1/security_group_default_rule.py
@@ -23,10 +23,12 @@
'properties': {
'cidr': {'type': 'string'}
},
+ 'additionalProperties': False,
'required': ['cidr'],
},
'to_port': {'type': 'integer'},
},
+ 'additionalProperties': False,
'required': ['from_port', 'id', 'ip_protocol', 'ip_range', 'to_port'],
}
@@ -38,6 +40,7 @@
'security_group_default_rule':
common_security_group_default_rule_info
},
+ 'additionalProperties': False,
'required': ['security_group_default_rule']
}
}
@@ -56,6 +59,7 @@
'items': common_security_group_default_rule_info
}
},
+ 'additionalProperties': False,
'required': ['security_group_default_rules']
}
}
diff --git a/tempest/api_schema/response/compute/v2_1/security_groups.py b/tempest/api_schema/response/compute/v2_1/security_groups.py
index 9a852e5..5ed5a5c 100644
--- a/tempest/api_schema/response/compute/v2_1/security_groups.py
+++ b/tempest/api_schema/response/compute/v2_1/security_groups.py
@@ -20,7 +20,8 @@
'properties': {
'tenant_id': {'type': 'string'},
'name': {'type': 'string'}
- }
+ },
+ 'additionalProperties': False,
},
'ip_protocol': {'type': ['string', 'null']},
# 'parent_group_id' can be UUID so defining it as 'string' also.
@@ -29,7 +30,8 @@
'type': 'object',
'properties': {
'cidr': {'type': 'string'}
- }
+ },
+ 'additionalProperties': False,
# When optional argument is provided in request body
# like 'group_id' then, attribute 'cidr' does not
# comes in response body. So it is not 'required'.
@@ -47,11 +49,13 @@
'type': 'array',
'items': {
'type': ['object', 'null'],
- 'properties': common_security_group_rule
+ 'properties': common_security_group_rule,
+ 'additionalProperties': False,
}
},
'description': {'type': 'string'},
},
+ 'additionalProperties': False,
'required': ['id', 'name', 'tenant_id', 'rules', 'description'],
}
@@ -65,6 +69,7 @@
'items': common_security_group
}
},
+ 'additionalProperties': False,
'required': ['security_groups']
}
}
@@ -76,6 +81,7 @@
'properties': {
'security_group': common_security_group
},
+ 'additionalProperties': False,
'required': ['security_group']
}
}
@@ -92,10 +98,12 @@
'security_group_rule': {
'type': 'object',
'properties': common_security_group_rule,
+ 'additionalProperties': False,
'required': ['from_port', 'to_port', 'group', 'ip_protocol',
'parent_group_id', 'id', 'ip_range']
}
},
+ 'additionalProperties': False,
'required': ['security_group_rule']
}
}
diff --git a/tempest/api_schema/response/compute/v2_1/servers.py b/tempest/api_schema/response/compute/v2_1/servers.py
index 875f607..44ab9e9 100644
--- a/tempest/api_schema/response/compute/v2_1/servers.py
+++ b/tempest/api_schema/response/compute/v2_1/servers.py
@@ -29,12 +29,14 @@
'links': parameter_types.links,
'OS-DCF:diskConfig': {'type': 'string'}
},
+ 'additionalProperties': False,
# NOTE: OS-DCF:diskConfig & security_groups are API extension,
# and some environments return a response without these
# attributes.So they are not 'required'.
'required': ['id', 'links']
}
},
+ 'additionalProperties': False,
'required': ['server']
}
}
@@ -59,11 +61,13 @@
'links': parameter_types.links,
'name': {'type': 'string'}
},
+ 'additionalProperties': False,
'required': ['id', 'links', 'name']
}
},
'servers_links': parameter_types.links
},
+ 'additionalProperties': False,
# NOTE(gmann): servers_links attribute is not necessary to be
# present always So it is not 'required'.
'required': ['servers']
@@ -86,6 +90,7 @@
'id': {'type': 'string'},
'links': parameter_types.links
},
+ 'additionalProperties': False,
'required': ['id', 'links']},
{'type': ['string', 'null']}
]},
@@ -95,6 +100,7 @@
'id': {'type': 'string'},
'links': parameter_types.links
},
+ 'additionalProperties': False,
'required': ['id', 'links']
},
'fault': {
@@ -105,6 +111,7 @@
'message': {'type': 'string'},
'details': {'type': 'string'},
},
+ 'additionalProperties': False,
# NOTE(gmann): 'details' is not necessary to be present
# in the 'fault'. So it is not defined as 'required'.
'required': ['code', 'created', 'message']
@@ -122,6 +129,7 @@
'accessIPv4': parameter_types.access_ip_v4,
'accessIPv6': parameter_types.access_ip_v6
},
+ 'additionalProperties': False,
# NOTE(GMann): 'progress' attribute is present in the response
# only when server's status is one of the progress statuses
# ("ACTIVE","BUILD", "REBUILD", "RESIZE","VERIFY_RESIZE")
@@ -142,6 +150,7 @@
'properties': {
'server': common_show_server
},
+ 'additionalProperties': False,
'required': ['server']
}
}
@@ -184,6 +193,7 @@
'properties': {
'server': server_detail
},
+ 'additionalProperties': False,
'required': ['server']
}
}
@@ -199,6 +209,7 @@
},
'servers_links': parameter_types.links
},
+ 'additionalProperties': False,
# NOTE(gmann): servers_links attribute is not necessary to be
# present always So it is not 'required'.
'required': ['servers']
@@ -221,6 +232,7 @@
'properties': {
'adminPass': {'type': 'string'}
},
+ 'additionalProperties': False,
'required': ['adminPass']
}
}
@@ -239,12 +251,14 @@
'mac_address': parameter_types.mac_address,
'OS-EXT-VIF-NET:net_id': {'type': 'string'}
},
+ 'additionalProperties': False,
# 'OS-EXT-VIF-NET:net_id' is API extension So it is
# not defined as 'required'
'required': ['id', 'mac_address']
}
}
},
+ 'additionalProperties': False,
'required': ['virtual_interfaces']
}
}
@@ -257,6 +271,7 @@
'volumeId': {'type': 'string'},
'serverId': {'type': ['integer', 'string']}
},
+ 'additionalProperties': False,
'required': ['id', 'device', 'volumeId', 'serverId']
}
@@ -267,6 +282,7 @@
'properties': {
'volumeAttachment': common_attach_volume_info
},
+ 'additionalProperties': False,
'required': ['volumeAttachment']
}
}
@@ -289,6 +305,7 @@
'items': common_attach_volume_info
}
},
+ 'additionalProperties': False,
'required': ['volumeAttachments']
}
}
@@ -308,6 +325,7 @@
'properties': {
'addresses': parameter_types.addresses
},
+ 'additionalProperties': False,
'required': ['addresses']
}
}
@@ -329,6 +347,7 @@
},
'metadata': {'type': 'object'}
},
+ 'additionalProperties': False,
'required': ['id', 'name', 'policies', 'members', 'metadata']
}
@@ -339,6 +358,7 @@
'properties': {
'server_group': common_server_group
},
+ 'additionalProperties': False,
'required': ['server_group']
}
}
@@ -357,6 +377,7 @@
'items': common_server_group
}
},
+ 'additionalProperties': False,
'required': ['server_groups']
}
}
@@ -372,6 +393,7 @@
'message': {'type': ['string', 'null']},
'instance_uuid': {'type': 'string'}
},
+ 'additionalProperties': False,
'required': ['action', 'request_id', 'user_id', 'project_id',
'start_time', 'message', 'instance_uuid']
}
@@ -387,6 +409,7 @@
'result': {'type': 'string'},
'traceback': {'type': ['string', 'null']}
},
+ 'additionalProperties': False,
'required': ['event', 'start_time', 'finish_time', 'result',
'traceback']
}
@@ -402,6 +425,7 @@
'items': instance_actions
}
},
+ 'additionalProperties': False,
'required': ['instanceActions']
}
}
@@ -419,6 +443,7 @@
'properties': {
'instanceAction': instance_actions_with_events
},
+ 'additionalProperties': False,
'required': ['instanceAction']
}
}
@@ -430,6 +455,7 @@
'properties': {
'password': {'type': 'string'}
},
+ 'additionalProperties': False,
'required': ['password']
}
}
@@ -448,9 +474,11 @@
'format': 'uri'
}
},
+ 'additionalProperties': False,
'required': ['type', 'url']
}
},
+ 'additionalProperties': False,
'required': ['console']
}
}
@@ -462,6 +490,7 @@
'properties': {
'output': {'type': 'string'}
},
+ 'additionalProperties': False,
'required': ['output']
}
}
@@ -478,6 +507,7 @@
}
}
},
+ 'additionalProperties': False,
'required': ['metadata']
}
}
@@ -502,6 +532,7 @@
}
}
},
+ 'additionalProperties': False,
'required': ['meta']
}
}
diff --git a/tempest/api_schema/response/compute/v2_1/services.py b/tempest/api_schema/response/compute/v2_1/services.py
index 6f361ef..c2c7a51 100644
--- a/tempest/api_schema/response/compute/v2_1/services.py
+++ b/tempest/api_schema/response/compute/v2_1/services.py
@@ -32,11 +32,13 @@
'updated_at': {'type': ['string', 'null']},
'disabled_reason': {'type': ['string', 'null']}
},
+ 'additionalProperties': False,
'required': ['id', 'zone', 'host', 'state', 'binary',
'status', 'updated_at', 'disabled_reason']
}
}
},
+ 'additionalProperties': False,
'required': ['services']
}
}
@@ -53,9 +55,11 @@
'binary': {'type': 'string'},
'host': {'type': 'string'}
},
+ 'additionalProperties': False,
'required': ['status', 'binary', 'host']
}
},
+ 'additionalProperties': False,
'required': ['service']
}
}
diff --git a/tempest/api_schema/response/compute/v2_1/tenant_networks.py b/tempest/api_schema/response/compute/v2_1/tenant_networks.py
index 0b2868a..ddfab96 100644
--- a/tempest/api_schema/response/compute/v2_1/tenant_networks.py
+++ b/tempest/api_schema/response/compute/v2_1/tenant_networks.py
@@ -19,6 +19,7 @@
'cidr': {'type': ['string', 'null']},
'label': {'type': 'string'}
},
+ 'additionalProperties': False,
'required': ['id', 'cidr', 'label']
}
@@ -33,6 +34,7 @@
'items': param_network
}
},
+ 'additionalProperties': False,
'required': ['networks']
}
}
@@ -45,6 +47,7 @@
'properties': {
'network': param_network
},
+ 'additionalProperties': False,
'required': ['network']
}
}
diff --git a/tempest/api_schema/response/compute/v2_1/volumes.py b/tempest/api_schema/response/compute/v2_1/volumes.py
index 541d3ff..bb34acb 100644
--- a/tempest/api_schema/response/compute/v2_1/volumes.py
+++ b/tempest/api_schema/response/compute/v2_1/volumes.py
@@ -39,7 +39,8 @@
'device': {'type': 'string'},
'volumeId': {'type': 'string'},
'serverId': {'type': 'string'}
- }
+ },
+ 'additionalProperties': False,
# NOTE- If volume is not attached to any server
# then, 'attachments' attributes comes as array
# with empty objects "[{}]" due to that elements
@@ -49,11 +50,13 @@
}
}
},
+ 'additionalProperties': False,
'required': ['id', 'status', 'displayName', 'availabilityZone',
'createdAt', 'displayDescription', 'volumeType',
'snapshotId', 'metadata', 'size', 'attachments']
}
},
+ 'additionalProperties': False,
'required': ['volume']
}
}
@@ -87,7 +90,8 @@
'device': {'type': 'string'},
'volumeId': {'type': 'string'},
'serverId': {'type': 'string'}
- }
+ },
+ 'additionalProperties': False,
# NOTE- If volume is not attached to any server
# then, 'attachments' attributes comes as array
# with empty object "[{}]" due to that elements
@@ -97,6 +101,7 @@
}
}
},
+ 'additionalProperties': False,
'required': ['id', 'status', 'displayName',
'availabilityZone', 'createdAt',
'displayDescription', 'volumeType',
@@ -105,6 +110,7 @@
}
}
},
+ 'additionalProperties': False,
'required': ['volumes']
}
}
diff --git a/tempest/clients.py b/tempest/clients.py
index 9f6a9bb..f0aedd5 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -56,7 +56,8 @@
from tempest.services.compute.json.migrations_client import \
MigrationsClientJSON
from tempest.services.compute.json.networks_client import NetworksClientJSON
-from tempest.services.compute.json.quotas_client import QuotaClassesClientJSON
+from tempest.services.compute.json.quota_classes_client import \
+ QuotaClassesClientJSON
from tempest.services.compute.json.quotas_client import QuotasClientJSON
from tempest.services.compute.json.security_group_default_rules_client import \
SecurityGroupDefaultRulesClientJSON
diff --git a/tempest/cmd/account_generator.py b/tempest/cmd/account_generator.py
index 892e051..fbfbbb7 100755
--- a/tempest/cmd/account_generator.py
+++ b/tempest/cmd/account_generator.py
@@ -191,10 +191,11 @@
if network_admin:
for u in resources['users']:
tenant = identity_admin.get_tenant_by_name(u['tenant'])
- network_name = create_network_resources(network_admin,
- tenant['id'],
- u['name'])
+ network_name, router_name = create_network_resources(network_admin,
+ tenant['id'],
+ u['name'])
u['network'] = network_name
+ u['router'] = router_name
LOG.info('Networks created')
for u in resources['users']:
try:
@@ -266,7 +267,7 @@
router_name = name + "-router"
router = _create_router(router_name)
_add_router_interface(router['id'], subnet['id'])
- return network_name
+ return network_name, router_name
def random_user_name(tag, prefix):
@@ -330,8 +331,12 @@
'password': user['pass'],
'roles': user['roles']
}
+ if 'network' or 'router' in user:
+ account['resources'] = {}
if 'network' in user:
- account['resources'] = {'network': user['network']}
+ account['resources']['network'] = user['network']
+ if 'router' in user:
+ account['resources']['router'] = user['router']
accounts.append(account)
if os.path.exists(opts.accounts):
os.rename(opts.accounts, '.'.join((opts.accounts, 'bak')))
diff --git a/tempest/cmd/cleanup_service.py b/tempest/cmd/cleanup_service.py
index eb6f143..1de20d6 100644
--- a/tempest/cmd/cleanup_service.py
+++ b/tempest/cmd/cleanup_service.py
@@ -377,8 +377,8 @@
def dry_run(self):
client = self.limits_client
- quotas = client.get_absolute_limits()
- self.data['compute_quotas'] = quotas
+ quotas = client.show_limits()
+ self.data['compute_quotas'] = quotas['absolute']
# Begin network service classes
@@ -420,131 +420,6 @@
self.data['networks'] = networks
-class NetworkIpSecPolicyService(NetworkService):
-
- def list(self):
- client = self.client
- ipsecpols = client.list_ipsecpolicies()
- ipsecpols = ipsecpols['ipsecpolicies']
- ipsecpols = self._filter_by_tenant_id(ipsecpols)
- LOG.debug("List count, %s IP Security Policies" % len(ipsecpols))
- return ipsecpols
-
- def delete(self):
- client = self.client
- ipsecpols = self.list()
- for ipsecpol in ipsecpols:
- try:
- client.delete_ipsecpolicy(ipsecpol['id'])
- except Exception as e:
- LOG.exception("Delete IP Securty Policy exception: %s" % e)
- pass
-
- def dry_run(self):
- ipsecpols = self.list()
- self.data['ip_security_policies'] = ipsecpols
-
-
-class NetworkFwPolicyService(NetworkService):
-
- def list(self):
- client = self.client
- 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))
- return fwpols
-
- def delete(self):
- client = self.client
- fwpols = self.list()
- for fwpol in fwpols:
- try:
- client.delete_firewall_policy(fwpol['id'])
- except Exception as e:
- LOG.exception("Delete Firewall Policy exception: %s" % e)
- pass
-
- def dry_run(self):
- fwpols = self.list()
- self.data['firewall_policies'] = fwpols
-
-
-class NetworkFwRulesService(NetworkService):
-
- def list(self):
- client = self.client
- 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))
- return fwrules
-
- def delete(self):
- client = self.client
- fwrules = self.list()
- for fwrule in fwrules:
- try:
- client.delete_firewall_rule(fwrule['id'])
- except Exception as e:
- LOG.exception("Delete Firewall Rule exception: %s" % e)
- pass
-
- def dry_run(self):
- fwrules = self.list()
- self.data['firewall_rules'] = fwrules
-
-
-class NetworkIkePolicyService(NetworkService):
-
- def list(self):
- client = self.client
- ikepols = client.list_ikepolicies()
- ikepols = ikepols['ikepolicies']
- ikepols = self._filter_by_tenant_id(ikepols)
- LOG.debug("List count, %s IKE Policies" % len(ikepols))
- return ikepols
-
- def delete(self):
- client = self.client
- ikepols = self.list()
- for ikepol in ikepols:
- try:
- client.delete_firewall_rule(ikepol['id'])
- except Exception as e:
- LOG.exception("Delete IKE Policy exception: %s" % e)
- pass
-
- def dry_run(self):
- ikepols = self.list()
- self.data['ike_policies'] = ikepols
-
-
-class NetworkVpnServiceService(NetworkService):
-
- def list(self):
- client = self.client
- vpnsrvs = client.list_vpnservices()
- vpnsrvs = vpnsrvs['vpnservices']
- vpnsrvs = self._filter_by_tenant_id(vpnsrvs)
- LOG.debug("List count, %s VPN Services" % len(vpnsrvs))
- return vpnsrvs
-
- def delete(self):
- client = self.client
- vpnsrvs = self.list()
- for vpnsrv in vpnsrvs:
- try:
- client.delete_vpnservice(vpnsrv['id'])
- except Exception as e:
- LOG.exception("Delete VPN Service exception: %s" % e)
- pass
-
- def dry_run(self):
- vpnsrvs = self.list()
- self.data['vpn_services'] = vpnsrvs
-
-
class NetworkFloatingIpService(NetworkService):
def list(self):
@@ -1094,18 +969,6 @@
if IS_HEAT:
tenant_services.append(StackService)
if IS_NEUTRON:
- if test.is_extension_enabled('vpnaas', 'network'):
- tenant_services.append(NetworkIpSecPolicyService)
- tenant_services.append(NetworkIkePolicyService)
- tenant_services.append(NetworkVpnServiceService)
- if test.is_extension_enabled('fwaas', 'network'):
- tenant_services.append(NetworkFwPolicyService)
- tenant_services.append(NetworkFwRulesService)
- if test.is_extension_enabled('lbaas', 'network'):
- tenant_services.append(NetworkHealthMonitorService)
- tenant_services.append(NetworkMemberService)
- tenant_services.append(NetworkVipService)
- tenant_services.append(NetworkPoolService)
if test.is_extension_enabled('metering', 'network'):
tenant_services.append(NetworkMeteringLabelRuleService)
tenant_services.append(NetworkMeteringLabelService)
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index d3426c6..5871628 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -651,13 +651,13 @@
name, fname = _resolve_image(image, 'aki')
aki = client.images.create_image(
'javelin_' + name, 'aki', 'aki')
- client.images.store_image(aki.get('id'), open(fname, 'r'))
+ client.images.store_image_file(aki.get('id'), open(fname, 'r'))
extras['kernel_id'] = aki.get('id')
name, fname = _resolve_image(image, 'ari')
ari = client.images.create_image(
'javelin_' + name, 'ari', 'ari')
- client.images.store_image(ari.get('id'), open(fname, 'r'))
+ client.images.store_image_file(ari.get('id'), open(fname, 'r'))
extras['ramdisk_id'] = ari.get('id')
_, fname = _resolve_image(image, 'file')
@@ -665,7 +665,7 @@
image['name'], image['container_format'],
image['disk_format'], **extras)
image_id = body.get('id')
- client.images.store_image(image_id, open(fname, 'r'))
+ client.images.store_image_file(image_id, open(fname, 'r'))
def destroy_images(images):
diff --git a/tempest/common/compute.py b/tempest/common/compute.py
new file mode 100644
index 0000000..5de4b0e
--- /dev/null
+++ b/tempest/common/compute.py
@@ -0,0 +1,124 @@
+# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
+# 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_log import log as logging
+from oslo_utils import excutils
+from tempest_lib.common.utils import data_utils
+
+from tempest.common import fixed_network
+from tempest import config
+
+CONF = config.CONF
+
+LOG = logging.getLogger(__name__)
+
+
+def create_test_server(clients, validatable, validation_resources=None,
+ tenant_network=None, **kwargs):
+ """Common wrapper utility returning a test server.
+
+ This method is a common wrapper returning a test server that can be
+ pingable or sshable.
+
+ :param clients: Client manager which provides Openstack Tempest clients.
+ :param validatable: Whether the server will be pingable or sshable.
+ :param validation_resources: Resources created for the connection to the
+ server. Include a keypair, a security group and an IP.
+ :returns a tuple
+ """
+
+ # TODO(jlanoux) add support of wait_until PINGABLE/SSHABLE
+
+ if 'name' in kwargs:
+ name = kwargs.pop('name')
+ else:
+ name = data_utils.rand_name(__name__ + "-instance")
+
+ flavor = kwargs.get('flavor', CONF.compute.flavor_ref)
+ image_id = kwargs.get('image_id', CONF.compute.image_ref)
+
+ kwargs = fixed_network.set_networks_kwarg(
+ tenant_network, kwargs) or {}
+
+ if CONF.validation.run_validation and validatable:
+ # As a first implementation, multiple pingable or sshable servers will
+ # not be supported
+ if 'min_count' in kwargs or 'max_count' in kwargs:
+ msg = ("Multiple pingable or sshable servers not supported at "
+ "this stage.")
+ raise ValueError(msg)
+
+ if 'security_groups' in kwargs:
+ kwargs['security_groups'].append(
+ {'name': validation_resources['security_group']['name']})
+ else:
+ try:
+ kwargs['security_groups'] = [
+ {'name': validation_resources['security_group']['name']}]
+ except KeyError:
+ LOG.debug("No security group provided.")
+
+ if 'key_name' not in kwargs:
+ try:
+ kwargs['key_name'] = validation_resources['keypair']['name']
+ except KeyError:
+ LOG.debug("No key provided.")
+
+ if CONF.validation.connect_method == 'floating':
+ if 'wait_until' not in kwargs:
+ kwargs['wait_until'] = 'ACTIVE'
+
+ body = clients.servers_client.create_server(name, image_id, flavor,
+ **kwargs)
+
+ # handle the case of multiple servers
+ servers = [body]
+ if 'min_count' in kwargs or 'max_count' in kwargs:
+ # Get servers created which name match with name param.
+ body_servers = clients.servers_client.list_servers()
+ servers = \
+ [s for s in body_servers['servers'] if s['name'].startswith(name)]
+
+ # The name of the method to associate a floating IP to as server is too
+ # long for PEP8 compliance so:
+ assoc = clients.floating_ips_client.associate_floating_ip_to_server
+
+ if 'wait_until' in kwargs:
+ for server in servers:
+ try:
+ clients.servers_client.wait_for_server_status(
+ server['id'], kwargs['wait_until'])
+
+ # Multiple validatable servers are not supported for now. Their
+ # creation will fail with the condition above (l.58).
+ if CONF.validation.run_validation and validatable:
+ if CONF.validation.connect_method == 'floating':
+ assoc(floating_ip=validation_resources[
+ 'floating_ip']['ip'],
+ server_id=servers[0]['id'])
+
+ except Exception:
+ with excutils.save_and_reraise_exception():
+ if ('preserve_server_on_error' not in kwargs
+ or kwargs['preserve_server_on_error'] is False):
+ for server in servers:
+ try:
+ clients.servers_client.delete_server(
+ server['id'])
+ except Exception:
+ LOG.exception('Deleting server %s failed'
+ % server['id'])
+
+ return body, servers
diff --git a/tempest/common/fixed_network.py b/tempest/common/fixed_network.py
index 2c6e334..de44c4d 100644
--- a/tempest/common/fixed_network.py
+++ b/tempest/common/fixed_network.py
@@ -14,7 +14,6 @@
from oslo_log import log as logging
from tempest_lib.common.utils import misc as misc_utils
-from tempest_lib import exceptions as lib_exc
from tempest import config
from tempest import exceptions
@@ -41,19 +40,8 @@
if not name:
raise exceptions.InvalidConfiguration()
- try:
- networks = compute_networks_client.list_networks(name=name)
- except lib_exc.NotFound:
- # In case of nova network, if the fixed_network_name is not
- # owned by the tenant, and the network client is not an admin
- # one, list_networks will not find it
- msg = ('Unable to find network %s. '
- 'Starting instance without specifying a network.' %
- name)
- if caller:
- msg = '(%s) %s' % (caller, msg)
- LOG.info(msg)
- raise exceptions.InvalidConfiguration()
+ networks = compute_networks_client.list_networks()
+ networks = [n for n in networks if n['label'] == name]
# Check that a network exists, else raise an InvalidConfigurationException
if len(networks) == 1:
diff --git a/tempest/common/utils/linux/remote_client.py b/tempest/common/utils/linux/remote_client.py
index 4b3995b..d4e6eb8 100644
--- a/tempest/common/utils/linux/remote_client.py
+++ b/tempest/common/utils/linux/remote_client.py
@@ -14,6 +14,7 @@
import re
import time
+from oslo_log import log as logging
import six
from tempest_lib.common import ssh
@@ -22,6 +23,8 @@
CONF = config.CONF
+LOG = logging.getLogger(__name__)
+
class RemoteClient(object):
@@ -48,7 +51,8 @@
def exec_command(self, cmd):
# Shell options below add more clearness on failures,
# path is extended for some non-cirros guest oses (centos7)
- cmd = "set -eu -o pipefail; PATH=$PATH:/sbin; " + cmd
+ cmd = CONF.compute.ssh_shell_prologue + " " + cmd
+ LOG.debug("Remote command: %s" % cmd)
return self.ssh_client.exec_command(cmd)
def validate_authentication(self):
diff --git a/tempest/config.py b/tempest/config.py
index 75bec4c..e3f9f0a 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -207,6 +207,10 @@
help="Timeout in seconds to wait for an instance to build. "
"Other services that do not define build_timeout will "
"inherit this value."),
+ cfg.StrOpt('ssh_shell_prologue',
+ default="set -eu -o pipefail; PATH=$$PATH:/sbin;",
+ help="Shell fragments to use before executing a command "
+ "when sshing to a guest."),
cfg.StrOpt('ssh_auth_method',
default='keypair',
help="Auth method used for authenticate to the instance. "
@@ -388,7 +392,13 @@
default=False,
help='Does Nova preserve preexisting ports from Neutron '
'when deleting an instance? This should be set to True '
- 'if testing Kilo+ Nova.')
+ 'if testing Kilo+ Nova.'),
+ cfg.BoolOpt('attach_encrypted_volume',
+ default=True,
+ help='Does the test environment support attaching an '
+ 'encrypted volume to a running server instance? This may '
+ 'depend on the combination of compute_driver in nova and '
+ 'the volume_driver(s) in cinder.'),
]
@@ -517,9 +527,10 @@
help="Allow the execution of IPv6 tests"),
cfg.ListOpt('api_extensions',
default=['all'],
- help='A list of enabled network extensions with a special '
- 'entry all which indicates every extension is enabled. '
- 'Empty list indicates all extensions are disabled'),
+ help="A list of enabled network extensions with a special "
+ "entry all which indicates every extension is enabled. "
+ "Empty list indicates all extensions are disabled. "
+ "To get the list of extensions run: 'neutron ext-list'"),
cfg.BoolOpt('ipv6_subnet_attributes',
default=False,
help="Allow the execution of IPv6 subnet tests that use "
diff --git a/tempest/hacking/checks.py b/tempest/hacking/checks.py
index 29898a9..db6375f 100644
--- a/tempest/hacking/checks.py
+++ b/tempest/hacking/checks.py
@@ -27,6 +27,7 @@
SETUP_TEARDOWN_CLASS_DEFINITION = re.compile(r'^\s+def (setUp|tearDown)Class')
SCENARIO_DECORATOR = re.compile(r'\s*@.*services\((.*)\)')
VI_HEADER_RE = re.compile(r"^#\s+vim?:.+")
+RAND_NAME_HYPHEN_RE = re.compile(r".*rand_name\(.+[\-\_][\"\']\)")
mutable_default_args = re.compile(r"^\s*def .+\((.+=\{\}|.+=\[\])")
@@ -106,6 +107,21 @@
"T107: service tag should not be in path")
+def no_hyphen_at_end_of_rand_name(logical_line, filename):
+ """Check no hyphen at the end of rand_name() argument
+
+ T108
+ """
+ if './tempest/api/network/' in filename:
+ # Network API tests are migrating from Tempest to Neutron repo now.
+ # So here should avoid network API tests checks.
+ return
+
+ msg = "T108: hyphen should not be specified at the end of rand_name()"
+ if RAND_NAME_HYPHEN_RE.match(logical_line):
+ return 0, msg
+
+
def no_mutable_default_args(logical_line):
"""Check that mutable object isn't used as default argument
@@ -122,4 +138,5 @@
register(no_setup_teardown_class_for_tests)
register(no_vi_headers)
register(service_tags_not_in_module_path)
+ register(no_hyphen_at_end_of_rand_name)
register(no_mutable_default_args)
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 5f8d605..fff8a5c 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -934,41 +934,6 @@
return rules
- def _create_pool(self, lb_method, protocol, subnet_id):
- """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)
- pool = net_resources.DeletablePool(client=client, **resp_pool['pool'])
- self.assertEqual(pool['name'], name)
- self.addCleanup(self.delete_wrapper, pool.delete)
- return pool
-
- 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)
- member = net_resources.DeletableMember(client=client,
- **resp_member['member'])
- self.addCleanup(self.delete_wrapper, member.delete)
- return member
-
- def _create_vip(self, protocol, protocol_port, subnet_id, pool_id):
- """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)
- vip = net_resources.DeletableVip(client=client, **resp_vip['vip'])
- self.assertEqual(vip['name'], name)
- self.addCleanup(self.delete_wrapper, vip.delete)
- return vip
-
def _ssh_to_server(self, server, private_key):
ssh_login = CONF.compute.image_ssh_user
return self.get_remote_client(server,
diff --git a/tempest/scenario/test_encrypted_cinder_volumes.py b/tempest/scenario/test_encrypted_cinder_volumes.py
index e6912d8..b66eb59 100644
--- a/tempest/scenario/test_encrypted_cinder_volumes.py
+++ b/tempest/scenario/test_encrypted_cinder_volumes.py
@@ -13,9 +13,12 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest import config
from tempest.scenario import manager
from tempest import test
+CONF = config.CONF
+
class TestEncryptedCinderVolumes(manager.EncryptionScenarioTest):
@@ -31,6 +34,12 @@
* Attaches and detaches the encrypted volume to the instance
"""
+ @classmethod
+ def skip_checks(cls):
+ super(TestEncryptedCinderVolumes, cls).skip_checks()
+ if not CONF.compute_feature_enabled.attach_encrypted_volume:
+ raise cls.skipException('Encrypted volume attach is not supported')
+
def launch_instance(self):
self.glance_image_create()
self.nova_boot()
diff --git a/tempest/scenario/test_load_balancer_basic.py b/tempest/scenario/test_load_balancer_basic.py
deleted file mode 100644
index 691c7c9..0000000
--- a/tempest/scenario/test_load_balancer_basic.py
+++ /dev/null
@@ -1,321 +0,0 @@
-# Copyright 2014 Mirantis.inc
-# 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 tempfile
-import time
-
-import six
-from six.moves.urllib import request as urllib2
-
-from tempest.common import commands
-from tempest import config
-from tempest import exceptions
-from tempest.scenario import manager
-from tempest.services.network import resources as net_resources
-from tempest import test
-
-config = config.CONF
-
-
-class TestLoadBalancerBasic(manager.NetworkScenarioTest):
-
- """
- This test checks basic load balancing.
-
- The following is the scenario outline:
- 1. Create an instance
- 2. SSH to the instance and start two servers
- 3. Create a load balancer with two members and with ROUND_ROBIN algorithm
- associate the VIP with a floating ip
- 4. Send NUM requests to the floating ip and check that they are shared
- between the two servers.
- """
-
- @classmethod
- def skip_checks(cls):
- super(TestLoadBalancerBasic, cls).skip_checks()
- cfg = config.network
- if not test.is_extension_enabled('lbaas', 'network'):
- msg = 'LBaaS Extension is not enabled'
- raise cls.skipException(msg)
- if not (cfg.tenant_networks_reachable or cfg.public_network_id):
- msg = ('Either tenant_networks_reachable must be "true", or '
- 'public_network_id must be defined.')
- raise cls.skipException(msg)
-
- @classmethod
- def resource_setup(cls):
- super(TestLoadBalancerBasic, cls).resource_setup()
- cls.servers_keypairs = {}
- cls.members = []
- cls.floating_ips = {}
- cls.server_ips = {}
- cls.port1 = 80
- cls.port2 = 88
- cls.num = 50
-
- def setUp(self):
- super(TestLoadBalancerBasic, self).setUp()
- self.server_ips = {}
- self.server_fixed_ips = {}
- self._create_security_group_for_test()
- self._set_net_and_subnet()
-
- def _set_net_and_subnet(self):
- """
- Query and set appropriate network and subnet attributes to be used
- for the test. Existing tenant networks are used if they are found.
- The configured private network and associated subnet is used as a
- fallback in absence of tenant networking.
- """
- try:
- tenant_net = self._list_networks(tenant_id=self.tenant_id)[0]
- except IndexError:
- tenant_net = None
-
- if tenant_net:
- tenant_subnet = self._list_subnets(tenant_id=self.tenant_id)[0]
- self.subnet = net_resources.DeletableSubnet(
- client=self.network_client,
- **tenant_subnet)
- self.network = tenant_net
- else:
- self.network = self._get_network_by_name(
- config.compute.fixed_network_name)
- # TODO(adam_g): We are assuming that the first subnet associated
- # with the fixed network is the one we want. In the future, we
- # should instead pull a subnet id from config, which is set by
- # devstack/admin/etc.
- subnet = self._list_subnets(network_id=self.network['id'])[0]
- self.subnet = net_resources.AttributeDict(subnet)
-
- def _create_security_group_for_test(self):
- self.security_group = self._create_security_group(
- tenant_id=self.tenant_id)
- self._create_security_group_rules_for_port(self.port1)
- self._create_security_group_rules_for_port(self.port2)
-
- def _create_security_group_rules_for_port(self, port):
- rule = {
- 'direction': 'ingress',
- 'protocol': 'tcp',
- 'port_range_min': port,
- 'port_range_max': port,
- }
- self._create_security_group_rule(
- secgroup=self.security_group,
- tenant_id=self.tenant_id,
- **rule)
-
- def _create_server(self, name):
- keypair = self.create_keypair()
- security_groups = [{'name': self.security_group['name']}]
- create_kwargs = {
- 'networks': [
- {'uuid': self.network['id']},
- ],
- 'key_name': keypair['name'],
- 'security_groups': security_groups,
- }
- net_name = self.network['name']
- server = self.create_server(name=name, create_kwargs=create_kwargs)
- self.servers_keypairs[server['id']] = keypair
- if (config.network.public_network_id and not
- config.network.tenant_networks_reachable):
- public_network_id = config.network.public_network_id
- floating_ip = self.create_floating_ip(
- server, public_network_id)
- self.floating_ips[floating_ip] = server
- self.server_ips[server['id']] = floating_ip.floating_ip_address
- else:
- self.server_ips[server['id']] =\
- server['addresses'][net_name][0]['addr']
- self.server_fixed_ips[server['id']] =\
- server['addresses'][net_name][0]['addr']
- self.assertTrue(self.servers_keypairs)
- return server
-
- def _create_servers(self):
- for count in range(2):
- self._create_server(name=("server%s" % (count + 1)))
- self.assertEqual(len(self.servers_keypairs), 2)
-
- def _start_servers(self):
- """
- Start two backends
-
- 1. SSH to the instance
- 2. Start two http backends listening on ports 80 and 88 respectively
- """
- for server_id, ip in six.iteritems(self.server_ips):
- private_key = self.servers_keypairs[server_id]['private_key']
- server_name = self.servers_client.get_server(server_id)['name']
- username = config.scenario.ssh_user
- ssh_client = self.get_remote_client(
- server_or_ip=ip,
- private_key=private_key)
-
- # Write a backend's response into a file
- resp = ('echo -ne "HTTP/1.1 200 OK\r\nContent-Length: 7\r\n'
- 'Connection: close\r\nContent-Type: text/html; '
- 'charset=UTF-8\r\n\r\n%s"; cat >/dev/null')
-
- with tempfile.NamedTemporaryFile() as script:
- script.write(resp % server_name)
- script.flush()
- with tempfile.NamedTemporaryFile() as key:
- key.write(private_key)
- key.flush()
- commands.copy_file_to_host(script.name,
- "/tmp/script1",
- ip,
- username, key.name)
-
- # Start netcat
- start_server = ('while true; do '
- 'sudo nc -ll -p %(port)s -e sh /tmp/%(script)s; '
- 'done > /dev/null &')
- cmd = start_server % {'port': self.port1,
- 'script': 'script1'}
- ssh_client.exec_command(cmd)
-
- if len(self.server_ips) == 1:
- with tempfile.NamedTemporaryFile() as script:
- script.write(resp % 'server2')
- script.flush()
- with tempfile.NamedTemporaryFile() as key:
- key.write(private_key)
- key.flush()
- commands.copy_file_to_host(script.name,
- "/tmp/script2", ip,
- username, key.name)
- cmd = start_server % {'port': self.port2,
- 'script': 'script2'}
- ssh_client.exec_command(cmd)
-
- def _check_connection(self, check_ip, port=80):
- def try_connect(ip, port):
- try:
- resp = urllib2.urlopen("http://{0}:{1}/".format(ip, port))
- if resp.getcode() == 200:
- return True
- return False
- except IOError:
- return False
- except urllib2.HTTPError:
- return False
- timeout = config.compute.ping_timeout
- start = time.time()
- while not try_connect(check_ip, port):
- if (time.time() - start) > timeout:
- message = "Timed out trying to connect to %s" % check_ip
- raise exceptions.TimeoutException(message)
-
- def _create_pool(self):
- """Create a pool with ROUND_ROBIN algorithm."""
- self.pool = super(TestLoadBalancerBasic, self)._create_pool(
- lb_method='ROUND_ROBIN',
- protocol='HTTP',
- subnet_id=self.subnet.id)
- self.assertTrue(self.pool)
-
- def _create_members(self):
- """
- Create two members.
-
- In case there is only one server, create both members with the same ip
- but with different ports to listen on.
- """
-
- for server_id, ip in six.iteritems(self.server_fixed_ips):
- if len(self.server_fixed_ips) == 1:
- member1 = self._create_member(address=ip,
- protocol_port=self.port1,
- pool_id=self.pool.id)
- member2 = self._create_member(address=ip,
- protocol_port=self.port2,
- pool_id=self.pool.id)
- self.members.extend([member1, member2])
- else:
- member = self._create_member(address=ip,
- protocol_port=self.port1,
- pool_id=self.pool.id)
- self.members.append(member)
- self.assertTrue(self.members)
-
- def _assign_floating_ip_to_vip(self, vip):
- public_network_id = config.network.public_network_id
- port_id = vip.port_id
- floating_ip = self.create_floating_ip(vip, public_network_id,
- port_id=port_id)
- self.floating_ips.setdefault(vip.id, [])
- self.floating_ips[vip.id].append(floating_ip)
- # Check for floating ip status before you check load-balancer
- self.check_floating_ip_status(floating_ip, "ACTIVE")
-
- def _create_load_balancer(self):
- self._create_pool()
- self._create_members()
- self.vip = self._create_vip(protocol='HTTP',
- protocol_port=80,
- subnet_id=self.subnet.id,
- pool_id=self.pool.id)
- self.vip.wait_for_status('ACTIVE')
- if (config.network.public_network_id and not
- config.network.tenant_networks_reachable):
- self._assign_floating_ip_to_vip(self.vip)
- self.vip_ip = self.floating_ips[
- self.vip.id][0]['floating_ip_address']
- else:
- self.vip_ip = self.vip.address
-
- # Currently the ovs-agent is not enforcing security groups on the
- # vip port - see https://bugs.launchpad.net/neutron/+bug/1163569
- # However the linuxbridge-agent does, and it is necessary to add a
- # security group with a rule that allows tcp port 80 to the vip port.
- self.network_client.update_port(
- self.vip.port_id, security_groups=[self.security_group.id])
-
- def _check_load_balancing(self):
- """
- 1. Send NUM requests on the floating ip associated with the VIP
- 2. Check that the requests are shared between the two servers
- """
-
- self._check_connection(self.vip_ip)
- self._send_requests(self.vip_ip, ["server1", "server2"])
-
- def _send_requests(self, vip_ip, servers):
- counters = dict.fromkeys(servers, 0)
- for i in range(self.num):
- try:
- server = urllib2.urlopen("http://{0}/".format(vip_ip)).read()
- counters[server] += 1
- # HTTP exception means fail of server, so don't increase counter
- # of success and continue connection tries
- except urllib2.HTTPError:
- continue
- # Assert that each member of the pool gets balanced at least once
- for member, counter in six.iteritems(counters):
- self.assertGreater(counter, 0, 'Member %s never balanced' % member)
-
- @test.idempotent_id('c0c6f1ca-603b-4509-9c0f-2c63f0d838ee')
- @test.services('compute', 'network')
- def test_load_balancer_basic(self):
- self._create_server('server1')
- self._start_servers()
- self._create_load_balancer()
- self._check_load_balancing()
diff --git a/tempest/services/compute/json/flavors_client.py b/tempest/services/compute/json/flavors_client.py
index dee56ac..ebe4117 100644
--- a/tempest/services/compute/json/flavors_client.py
+++ b/tempest/services/compute/json/flavors_client.py
@@ -27,24 +27,19 @@
class FlavorsClientJSON(service_client.ServiceClient):
- def list_flavors(self, params=None):
+ def list_flavors(self, detail=False, **params):
url = 'flavors'
+ _schema = schema.list_flavors
+
+ if detail:
+ url += '/detail'
+ _schema = schema.list_flavors_details
if params:
url += '?%s' % urllib.urlencode(params)
resp, body = self.get(url)
body = json.loads(body)
- self.validate_response(schema.list_flavors, resp, body)
- return service_client.ResponseBodyList(resp, body['flavors'])
-
- def list_flavors_with_detail(self, params=None):
- url = 'flavors/detail'
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.list_flavors_details, resp, body)
+ self.validate_response(_schema, resp, body)
return service_client.ResponseBodyList(resp, body['flavors'])
def show_flavor(self, flavor_id):
@@ -87,7 +82,7 @@
# Did not use show_flavor(id) for verification as it gives
# 200 ok even for deleted id. LP #981263
# we can remove the loop here and use get by ID when bug gets sortedout
- flavors = self.list_flavors_with_detail()
+ flavors = self.list_flavors(detail=True)
for flavor in flavors:
if flavor['id'] == id:
return False
diff --git a/tempest/services/compute/json/hosts_client.py b/tempest/services/compute/json/hosts_client.py
index 287482f..223b80f 100644
--- a/tempest/services/compute/json/hosts_client.py
+++ b/tempest/services/compute/json/hosts_client.py
@@ -34,7 +34,7 @@
self.validate_response(schema.list_hosts, resp, body)
return service_client.ResponseBodyList(resp, body['hosts'])
- def show_host_detail(self, hostname):
+ def show_host(self, hostname):
"""Show detail information for the host."""
resp, body = self.get("os-hosts/%s" % str(hostname))
diff --git a/tempest/services/compute/json/hypervisor_client.py b/tempest/services/compute/json/hypervisor_client.py
index 49ac266..2f9f701 100644
--- a/tempest/services/compute/json/hypervisor_client.py
+++ b/tempest/services/compute/json/hypervisor_client.py
@@ -21,42 +21,41 @@
class HypervisorClientJSON(service_client.ServiceClient):
- def get_hypervisor_list(self):
+ def list_hypervisors(self, detail=False):
"""List hypervisors information."""
- resp, body = self.get('os-hypervisors')
+ url = 'os-hypervisors'
+ _schema = schema.list_search_hypervisors
+ if detail:
+ url += '/detail'
+ _schema = schema.list_hypervisors_detail
+
+ resp, body = self.get(url)
body = json.loads(body)
- self.validate_response(schema.list_search_hypervisors, resp, body)
+ self.validate_response(_schema, resp, body)
return service_client.ResponseBodyList(resp, body['hypervisors'])
- def get_hypervisor_list_details(self):
- """Show detailed hypervisors information."""
- resp, body = self.get('os-hypervisors/detail')
- body = json.loads(body)
- self.validate_response(schema.list_hypervisors_detail, resp, body)
- return service_client.ResponseBodyList(resp, body['hypervisors'])
-
- def get_hypervisor_show_details(self, hyper_id):
+ def show_hypervisor(self, hyper_id):
"""Display the details of the specified hypervisor."""
resp, body = self.get('os-hypervisors/%s' % hyper_id)
body = json.loads(body)
self.validate_response(schema.get_hypervisor, resp, body)
return service_client.ResponseBody(resp, body['hypervisor'])
- def get_hypervisor_servers(self, hyper_name):
+ def list_servers_on_hypervisor(self, hyper_name):
"""List instances belonging to the specified hypervisor."""
resp, body = self.get('os-hypervisors/%s/servers' % hyper_name)
body = json.loads(body)
self.validate_response(schema.get_hypervisors_servers, resp, body)
return service_client.ResponseBodyList(resp, body['hypervisors'])
- def get_hypervisor_stats(self):
+ def show_hypervisor_statistics(self):
"""Get hypervisor statistics over all compute nodes."""
resp, body = self.get('os-hypervisors/statistics')
body = json.loads(body)
self.validate_response(schema.get_hypervisor_statistics, resp, body)
return service_client.ResponseBody(resp, body['hypervisor_statistics'])
- def get_hypervisor_uptime(self, hyper_id):
+ def show_hypervisor_uptime(self, hyper_id):
"""Display the uptime of the specified hypervisor."""
resp, body = self.get('os-hypervisors/%s/uptime' % hyper_id)
body = json.loads(body)
diff --git a/tempest/services/compute/json/images_client.py b/tempest/services/compute/json/images_client.py
index 30aa962..3736a15 100644
--- a/tempest/services/compute/json/images_client.py
+++ b/tempest/services/compute/json/images_client.py
@@ -43,26 +43,20 @@
self.validate_response(schema.create_image, resp, body)
return service_client.ResponseBody(resp, body)
- def list_images(self, params=None):
+ def list_images(self, detail=False, **params):
"""Returns a list of all images filtered by any parameters."""
url = 'images'
+ _schema = schema.list_images
+ if detail:
+ url += '/detail'
+ _schema = schema.list_images_details
+
if params:
url += '?%s' % urllib.urlencode(params)
resp, body = self.get(url)
body = json.loads(body)
- self.validate_response(schema.list_images, resp, body)
- return service_client.ResponseBodyList(resp, body['images'])
-
- def list_images_with_detail(self, params=None):
- """Returns a detailed list of images filtered by any parameters."""
- url = 'images/detail'
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.list_images_details, resp, body)
+ self.validate_response(_schema, resp, body)
return service_client.ResponseBodyList(resp, body['images'])
def show_image(self, image_id):
@@ -106,7 +100,7 @@
self.validate_response(schema.image_metadata, resp, body)
return service_client.ResponseBody(resp, body['metadata'])
- def get_image_metadata_item(self, image_id, key):
+ def show_image_metadata_item(self, image_id, key):
"""Returns the value for a specific image metadata key."""
resp, body = self.get("images/%s/metadata/%s" % (str(image_id), key))
body = json.loads(body)
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 33ba76f..2b6dbb7 100644
--- a/tempest/services/compute/json/instance_usage_audit_log_client.py
+++ b/tempest/services/compute/json/instance_usage_audit_log_client.py
@@ -31,7 +31,7 @@
return service_client.ResponseBody(resp,
body["instance_usage_audit_logs"])
- def get_instance_usage_audit_log(self, time_before):
+ def show_instance_usage_audit_log(self, time_before):
url = 'os-instance_usage_audit_log/%s' % time_before
resp, body = self.get(url)
body = json.loads(body)
diff --git a/tempest/services/compute/json/keypairs_client.py b/tempest/services/compute/json/keypairs_client.py
index 7fe335b..143fe72 100644
--- a/tempest/services/compute/json/keypairs_client.py
+++ b/tempest/services/compute/json/keypairs_client.py
@@ -32,7 +32,7 @@
self.validate_response(schema.list_keypairs, resp, body)
return service_client.ResponseBodyList(resp, body['keypairs'])
- def get_keypair(self, key_name):
+ def show_keypair(self, key_name):
resp, body = self.get("os-keypairs/%s" % str(key_name))
body = json.loads(body)
self.validate_response(schema.get_keypair, resp, body)
diff --git a/tempest/services/compute/json/limits_client.py b/tempest/services/compute/json/limits_client.py
index d2aaec6..1454b73 100644
--- a/tempest/services/compute/json/limits_client.py
+++ b/tempest/services/compute/json/limits_client.py
@@ -21,17 +21,8 @@
class LimitsClientJSON(service_client.ServiceClient):
- def get_absolute_limits(self):
+ def show_limits(self):
resp, body = self.get("limits")
body = json.loads(body)
self.validate_response(schema.get_limit, resp, body)
- return service_client.ResponseBody(resp, body['limits']['absolute'])
-
- def get_specific_absolute_limit(self, absolute_limit):
- resp, body = self.get("limits")
- body = json.loads(body)
- self.validate_response(schema.get_limit, resp, body)
- if absolute_limit not in body['limits']['absolute']:
- return None
- else:
- return body['limits']['absolute'][absolute_limit]
+ return service_client.ResponseBody(resp, body['limits'])
diff --git a/tempest/services/compute/json/networks_client.py b/tempest/services/compute/json/networks_client.py
index 0ae0920..e641787 100644
--- a/tempest/services/compute/json/networks_client.py
+++ b/tempest/services/compute/json/networks_client.py
@@ -20,17 +20,13 @@
class NetworksClientJSON(service_client.ServiceClient):
- def list_networks(self, name=None):
+ def list_networks(self):
resp, body = self.get("os-networks")
body = json.loads(body)
self.expected_success(200, resp.status)
- if name:
- networks = [n for n in body['networks'] if n['label'] == name]
- else:
- networks = body['networks']
- return service_client.ResponseBodyList(resp, networks)
+ return service_client.ResponseBodyList(resp, body['networks'])
- def get_network(self, network_id):
+ def show_network(self, network_id):
resp, body = self.get("os-networks/%s" % str(network_id))
body = json.loads(body)
self.expected_success(200, resp.status)
diff --git a/tempest/services/compute/json/quota_classes_client.py b/tempest/services/compute/json/quota_classes_client.py
new file mode 100644
index 0000000..ad35e3f
--- /dev/null
+++ b/tempest/services/compute/json/quota_classes_client.py
@@ -0,0 +1,46 @@
+# Copyright 2012 NTT Data
+# 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 json
+
+from tempest.api_schema.response.compute.v2_1\
+ import quota_classes as classes_schema
+from tempest.common import service_client
+
+
+class QuotaClassesClientJSON(service_client.ServiceClient):
+
+ def show_quota_class_set(self, quota_class_id):
+ """List the quota class set for a quota class."""
+
+ url = 'os-quota-class-sets/%s' % quota_class_id
+ resp, body = self.get(url)
+ body = json.loads(body)
+ self.validate_response(classes_schema.get_quota_class_set, resp, body)
+ return service_client.ResponseBody(resp, body['quota_class_set'])
+
+ def update_quota_class_set(self, quota_class_id, **kwargs):
+ """
+ Updates the quota class's limits for one or more resources.
+ """
+ post_body = json.dumps({'quota_class_set': kwargs})
+
+ resp, body = self.put('os-quota-class-sets/%s' % quota_class_id,
+ post_body)
+
+ body = json.loads(body)
+ self.validate_response(classes_schema.update_quota_class_set,
+ resp, body)
+ return service_client.ResponseBody(resp, body['quota_class_set'])
diff --git a/tempest/services/compute/json/quotas_client.py b/tempest/services/compute/json/quotas_client.py
index 6e38c47..f488817 100644
--- a/tempest/services/compute/json/quotas_client.py
+++ b/tempest/services/compute/json/quotas_client.py
@@ -15,29 +15,27 @@
import json
-from tempest.api_schema.response.compute.v2_1\
- import quota_classes as classes_schema
from tempest.api_schema.response.compute.v2_1 import quotas as schema
from tempest.common import service_client
class QuotasClientJSON(service_client.ServiceClient):
- def get_quota_set(self, tenant_id, user_id=None):
+ def show_quota_set(self, tenant_id, user_id=None):
"""List the quota set for a tenant."""
- url = 'os-quota-sets/%s' % str(tenant_id)
+ url = 'os-quota-sets/%s' % tenant_id
if user_id:
- url += '?user_id=%s' % str(user_id)
+ url += '?user_id=%s' % user_id
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.get_quota_set, resp, body)
return service_client.ResponseBody(resp, body['quota_set'])
- def get_default_quota_set(self, tenant_id):
+ def show_default_quota_set(self, tenant_id):
"""List the default quota set for a tenant."""
- url = 'os-quota-sets/%s/defaults' % str(tenant_id)
+ url = 'os-quota-sets/%s/defaults' % tenant_id
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.get_quota_set, resp, body)
@@ -99,9 +97,9 @@
if user_id:
resp, body = self.put('os-quota-sets/%s?user_id=%s' %
- (str(tenant_id), str(user_id)), post_body)
+ (tenant_id, user_id), post_body)
else:
- resp, body = self.put('os-quota-sets/%s' % str(tenant_id),
+ resp, body = self.put('os-quota-sets/%s' % tenant_id,
post_body)
body = json.loads(body)
@@ -110,32 +108,6 @@
def delete_quota_set(self, tenant_id):
"""Delete the tenant's quota set."""
- resp, body = self.delete('os-quota-sets/%s' % str(tenant_id))
+ resp, body = self.delete('os-quota-sets/%s' % tenant_id)
self.validate_response(schema.delete_quota, resp, body)
return service_client.ResponseBody(resp, body)
-
-
-class QuotaClassesClientJSON(service_client.ServiceClient):
-
- def get_quota_class_set(self, quota_class_id):
- """List the quota class set for a quota class."""
-
- url = 'os-quota-class-sets/%s' % str(quota_class_id)
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(classes_schema.get_quota_class_set, resp, body)
- return service_client.ResponseBody(resp, body['quota_class_set'])
-
- def update_quota_class_set(self, quota_class_id, **kwargs):
- """
- Updates the quota class's limits for one or more resources.
- """
- post_body = json.dumps({'quota_class_set': kwargs})
-
- resp, body = self.put('os-quota-class-sets/%s' % str(quota_class_id),
- post_body)
-
- body = json.loads(body)
- self.validate_response(classes_schema.update_quota_class_set,
- resp, body)
- return service_client.ResponseBody(resp, body['quota_class_set'])
diff --git a/tempest/services/identity/v2/json/identity_client.py b/tempest/services/identity/v2/json/identity_client.py
index 039f9bb..c5f7338 100644
--- a/tempest/services/identity/v2/json/identity_client.py
+++ b/tempest/services/identity/v2/json/identity_client.py
@@ -18,6 +18,13 @@
class IdentityClientJSON(service_client.ServiceClient):
+ def get_api_description(self):
+ """Retrieves info about the v2.0 Identity API"""
+ url = ''
+ resp, body = self.get(url)
+ self.expected_success([200, 203], resp.status)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
+
def has_admin_extensions(self):
"""
Returns True if the KSADM Admin Extensions are supported
diff --git a/tempest/services/identity/v3/json/identity_client.py b/tempest/services/identity/v3/json/identity_client.py
index f3d02a8..30fb3e1 100644
--- a/tempest/services/identity/v3/json/identity_client.py
+++ b/tempest/services/identity/v3/json/identity_client.py
@@ -23,6 +23,13 @@
class IdentityV3ClientJSON(service_client.ServiceClient):
api_version = "v3"
+ def get_api_description(self):
+ """Retrieves info about the v3 Identity API"""
+ url = ''
+ resp, body = self.get(url)
+ self.expected_success(200, resp.status)
+ return service_client.ResponseBody(resp, self._parse_resp(body))
+
def create_user(self, user_name, password=None, project_id=None,
email=None, domain_id='default', **kwargs):
"""Creates a user."""
diff --git a/tempest/services/image/v2/json/image_client.py b/tempest/services/image/v2/json/image_client.py
index 9e37f6e..383c72b 100644
--- a/tempest/services/image/v2/json/image_client.py
+++ b/tempest/services/image/v2/json/image_client.py
@@ -52,7 +52,7 @@
def _validate_schema(self, body, type='image'):
if type in ['image', 'images']:
- schema = self.get_schema(type)
+ schema = self.show_schema(type)
else:
raise ValueError("%s is not a valid schema type" % type)
@@ -145,7 +145,7 @@
"""Returns the primary type of resource this client works with."""
return 'image'
- def store_image(self, image_id, data):
+ def store_image_file(self, image_id, data):
url = 'v2/images/%s/file' % image_id
headers = {'Content-Type': 'application/octet-stream'}
resp, body = self.http.raw_request('PUT', url, headers=headers,
@@ -153,7 +153,7 @@
self.expected_success(204, resp.status)
return service_client.ResponseBody(resp, body)
- def get_image_file(self, image_id):
+ def load_image_file(self, image_id):
url = 'v2/images/%s/file' % image_id
resp, body = self.get(url)
self.expected_success(200, resp.status)
@@ -206,7 +206,7 @@
self.expected_success(204, resp.status)
return service_client.ResponseBody(resp)
- def get_schema(self, schema):
+ def show_schema(self, schema):
url = 'v2/schemas/%s' % schema
resp, body = self.get(url)
self.expected_success(200, resp.status)
diff --git a/tempest/services/network/json/network_client.py b/tempest/services/network/json/network_client.py
index e93cc47..5f85199 100644
--- a/tempest/services/network/json/network_client.py
+++ b/tempest/services/network/json/network_client.py
@@ -42,34 +42,18 @@
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',
- 'ipsec-site-connections': '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("_", "-")
+ plural_name = plural_name.replace("_", "-")
if service_prefix:
uri = '%s/%s/%s' % (self.uri_prefix, service_prefix,
plural_name)
@@ -85,11 +69,7 @@
resource_plural_map = {
'security_groups': 'security_groups',
'security_group_rules': 'security_group_rules',
- 'ipsecpolicy': 'ipsecpolicies',
- 'ikepolicy': 'ikepolicies',
- 'ipsec_site_connection': 'ipsec-site-connections',
'quotas': 'quotas',
- 'firewall_policy': 'firewall_policies'
}
return resource_plural_map.get(resource_name, resource_name + 's')
@@ -131,17 +111,13 @@
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 service_client.ResponseBody(resp, body)
-
- return _create
+ def _create_resource(self, uri, post_data):
+ req_uri = self.uri_prefix + uri
+ req_post_data = self.serialize(post_data)
+ resp, body = self.post(req_uri, req_post_data)
+ body = self.deserialize_single(body)
+ self.expected_success(201, resp.status)
+ return service_client.ResponseBody(resp, body)
def _updater(self, resource_name):
def _update(res_id, **kwargs):
@@ -156,11 +132,10 @@
return _update
def __getattr__(self, name):
- method_prefixes = ["list_", "delete_", "show_", "create_", "update_"]
+ method_prefixes = ["list_", "delete_", "show_", "update_"]
method_functors = [self._lister,
self._deleter,
self._shower,
- self._creater,
self._updater]
for index, prefix in enumerate(method_prefixes):
prefix_len = len(prefix)
@@ -168,6 +143,46 @@
return method_functors[index](name[prefix_len:])
raise AttributeError(name)
+ def create_network(self, **kwargs):
+ uri = '/networks'
+ post_data = {'network': kwargs}
+ return self._create_resource(uri, post_data)
+
+ def create_subnet(self, **kwargs):
+ uri = '/subnets'
+ post_data = {'subnet': kwargs}
+ return self._create_resource(uri, post_data)
+
+ def create_port(self, **kwargs):
+ uri = '/ports'
+ post_data = {'port': kwargs}
+ return self._create_resource(uri, post_data)
+
+ def create_floatingip(self, **kwargs):
+ uri = '/floatingips'
+ post_data = {'floatingip': kwargs}
+ return self._create_resource(uri, post_data)
+
+ def create_metering_label(self, **kwargs):
+ uri = '/metering/metering-labels'
+ post_data = {'metering_label': kwargs}
+ return self._create_resource(uri, post_data)
+
+ def create_metering_label_rule(self, **kwargs):
+ uri = '/metering/metering-label-rules'
+ post_data = {'metering_label_rule': kwargs}
+ return self._create_resource(uri, post_data)
+
+ def create_security_group(self, **kwargs):
+ uri = '/security-groups'
+ post_data = {'security_group': kwargs}
+ return self._create_resource(uri, post_data)
+
+ def create_security_group_rule(self, **kwargs):
+ uri = '/security-group-rules'
+ post_data = {'security_group_rule': kwargs}
+ return self._create_resource(uri, post_data)
+
# Common methods that are hard to automate
def create_bulk_network(self, names):
network_list = [{'name': name} for name in names]
@@ -385,29 +400,6 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def associate_health_monitor_with_pool(self, health_monitor_id,
- pool_id):
- post_body = {
- "health_monitor": {
- "id": health_monitor_id,
- }
- }
- body = json.dumps(post_body)
- uri = '%s/lb/pools/%s/health_monitors' % (self.uri_prefix,
- pool_id)
- resp, body = self.post(uri, body)
- self.expected_success(201, resp.status)
- body = json.loads(body)
- return service_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.expected_success(204, resp.status)
- return service_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)
@@ -428,21 +420,6 @@
body = json.loads(body)
return service_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.expected_success(200, resp.status)
- body = json.loads(body)
- return service_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.expected_success(200, resp.status)
- body = json.loads(body)
- return service_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)
@@ -494,21 +471,6 @@
self.expected_success(204, resp.status)
return service_client.ResponseBody(resp, body)
- def create_ikepolicy(self, name, **kwargs):
- post_body = {
- "ikepolicy": {
- "name": name,
- }
- }
- for key, val in kwargs.items():
- post_body['ikepolicy'][key] = val
- body = json.dumps(post_body)
- uri = '%s/vpn/ikepolicies' % (self.uri_prefix)
- resp, body = self.post(uri, body)
- self.expected_success(201, resp.status)
- body = json.loads(body)
- return service_client.ResponseBody(resp, body)
-
def update_extra_routes(self, router_id, nexthop, destination):
uri = '%s/routers/%s' % (self.uri_prefix, router_id)
put_body = {
@@ -537,13 +499,6 @@
body = json.loads(body)
return service_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.expected_success(200, resp.status)
- body = json.loads(body)
- return service_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)
@@ -552,30 +507,3 @@
self.expected_success(201, resp.status)
body = json.loads(body)
return service_client.ResponseBody(resp, body)
-
- def insert_firewall_rule_in_policy(self, firewall_policy_id,
- firewall_rule_id, insert_after="",
- insert_before=""):
- uri = '%s/fw/firewall_policies/%s/insert_rule' % (self.uri_prefix,
- firewall_policy_id)
- body = {
- "firewall_rule_id": firewall_rule_id,
- "insert_after": insert_after,
- "insert_before": insert_before
- }
- body = json.dumps(body)
- resp, body = self.put(uri, body)
- self.expected_success(200, resp.status)
- body = json.loads(body)
- return service_client.ResponseBody(resp, body)
-
- def remove_firewall_rule_from_policy(self, firewall_policy_id,
- firewall_rule_id):
- uri = '%s/fw/firewall_policies/%s/remove_rule' % (self.uri_prefix,
- firewall_policy_id)
- update_body = {"firewall_rule_id": firewall_rule_id}
- update_body = json.dumps(update_body)
- resp, body = self.put(uri, update_body)
- self.expected_success(200, resp.status)
- body = json.loads(body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/stress/actions/ssh_floating.py b/tempest/stress/actions/ssh_floating.py
index 9fdb394..b2a30e9 100644
--- a/tempest/stress/actions/ssh_floating.py
+++ b/tempest/stress/actions/ssh_floating.py
@@ -91,8 +91,8 @@
def _create_sec_group(self):
sec_grp_cli = self.manager.security_groups_client
- s_name = data_utils.rand_name('sec_grp-')
- s_description = data_utils.rand_name('desc-')
+ s_name = data_utils.rand_name('sec_grp')
+ s_description = data_utils.rand_name('desc')
self.sec_grp = sec_grp_cli.create_security_group(s_name,
s_description)
create_rule = sec_grp_cli.create_security_group_rule
diff --git a/tempest/tests/cmd/test_javelin.py b/tempest/tests/cmd/test_javelin.py
index f98f8ba..f0921d5 100644
--- a/tempest/tests/cmd/test_javelin.py
+++ b/tempest/tests/cmd/test_javelin.py
@@ -61,6 +61,26 @@
javelin.client_for_user(fake_non_existing_user['name'])
self.assertFalse(javelin.OSClient.called)
+ def test_attach_volumes(self):
+ self.useFixture(mockpatch.PatchObject(javelin, "client_for_user",
+ return_value=self.fake_client))
+
+ self.useFixture(mockpatch.PatchObject(
+ javelin, "_get_volume_by_name",
+ return_value=self.fake_object.volume))
+
+ self.useFixture(mockpatch.PatchObject(
+ javelin, "_get_server_by_name",
+ return_value=self.fake_object.server))
+
+ javelin.attach_volumes([self.fake_object])
+
+ mocked_function = self.fake_client.volumes.attach_volume
+ mocked_function.assert_called_once_with(
+ self.fake_object.volume['id'],
+ self.fake_object.server['id'],
+ self.fake_object['device'])
+
class TestCreateResources(JavelinUnitTest):
def test_create_tenants(self):
@@ -89,7 +109,7 @@
self.fake_client.identity.get_tenant_by_name.return_value = \
self.fake_object['tenant']
self.fake_client.identity.get_user_by_username.side_effect = \
- lib_exc.NotFound()
+ lib_exc.NotFound("user is not found")
self.useFixture(mockpatch.PatchObject(javelin, "keystone_admin",
return_value=self.fake_client))
@@ -106,7 +126,7 @@
def test_create_user_missing_tenant(self):
self.fake_client.identity.get_tenant_by_name.side_effect = \
- lib_exc.NotFound()
+ lib_exc.NotFound("tenant is not found")
self.useFixture(mockpatch.PatchObject(javelin, "keystone_admin",
return_value=self.fake_client))
@@ -152,7 +172,7 @@
self.fake_object['format'],
self.fake_object['format'])
- mocked_function = self.fake_client.images.store_image
+ mocked_function = self.fake_client.images.store_image_file
fake_image_id = self.fake_object['body'].get('id')
mocked_function.assert_called_once_with(fake_image_id, open_mock())
@@ -190,14 +210,84 @@
name=self.fake_object['name'],
ip_version=fake_version)
+ def test_create_volumes(self):
+
+ self.useFixture(mockpatch.PatchObject(javelin, "client_for_user",
+ return_value=self.fake_client))
+ self.useFixture(mockpatch.PatchObject(javelin, "_get_volume_by_name",
+ return_value=None))
+ self.fake_client.volumes.create_volume.return_value = \
+ self.fake_object.body
+
+ javelin.create_volumes([self.fake_object])
+
+ mocked_function = self.fake_client.volumes.create_volume
+ mocked_function.assert_called_once_with(
+ size=self.fake_object['gb'],
+ display_name=self.fake_object['name'])
+ mocked_function = self.fake_client.volumes.wait_for_volume_status
+ mocked_function.assert_called_once_with(
+ self.fake_object.body['id'],
+ 'available')
+
+ def test_create_volume_existing(self):
+ self.useFixture(mockpatch.PatchObject(javelin, "client_for_user",
+ return_value=self.fake_client))
+ self.useFixture(mockpatch.PatchObject(javelin, "_get_volume_by_name",
+ return_value=self.fake_object))
+ self.fake_client.volumes.create_volume.return_value = \
+ self.fake_object.body
+
+ javelin.create_volumes([self.fake_object])
+
+ mocked_function = self.fake_client.volumes.create_volume
+ self.assertFalse(mocked_function.called)
+ mocked_function = self.fake_client.volumes.wait_for_volume_status
+ self.assertFalse(mocked_function.called)
+
+ def test_create_router(self):
+
+ self.fake_client.networks.list_routers.return_value = {'routers': []}
+ self.useFixture(mockpatch.PatchObject(javelin, "client_for_user",
+ return_value=self.fake_client))
+
+ javelin.create_routers([self.fake_object])
+
+ mocked_function = self.fake_client.networks.create_router
+ mocked_function.assert_called_once_with(self.fake_object['name'])
+
+ def test_create_router_existing(self):
+ self.fake_client.networks.list_routers.return_value = {
+ 'routers': [self.fake_object]}
+ self.useFixture(mockpatch.PatchObject(javelin, "client_for_user",
+ return_value=self.fake_client))
+
+ javelin.create_routers([self.fake_object])
+
+ mocked_function = self.fake_client.networks.create_router
+ self.assertFalse(mocked_function.called)
+
+ def test_create_secgroup(self):
+ self.useFixture(mockpatch.PatchObject(javelin, "client_for_user",
+ return_value=self.fake_client))
+ self.fake_client.secgroups.list_security_groups.return_value = []
+ self.fake_client.secgroups.create_security_group.return_value = \
+ {'id': self.fake_object['secgroup_id']}
+
+ javelin.create_secgroups([self.fake_object])
+
+ mocked_function = self.fake_client.secgroups.create_security_group
+ mocked_function.assert_called_once_with(
+ self.fake_object['name'],
+ self.fake_object['description'])
+
class TestDestroyResources(JavelinUnitTest):
def test_destroy_tenants(self):
fake_tenant = self.fake_object['tenant']
-
- fake_auth = mock.MagicMock()
+ fake_auth = self.fake_client
fake_auth.identity.get_tenant_by_name.return_value = fake_tenant
self.useFixture(mockpatch.PatchObject(javelin, "keystone_admin",
@@ -212,7 +302,7 @@
fake_user = self.fake_object['user']
fake_tenant = self.fake_object['tenant']
- fake_auth = mock.MagicMock()
+ fake_auth = self.fake_client
fake_auth.identity.get_tenant_by_name.return_value = fake_tenant
fake_auth.identity.get_user_by_username.return_value = fake_user
@@ -226,41 +316,98 @@
def test_destroy_objects(self):
- fake_client = mock.MagicMock()
- fake_client.objects.delete_object.return_value = {'status': "200"}, ""
+ self.fake_client.objects.delete_object.return_value = \
+ {'status': "200"}, ""
self.useFixture(mockpatch.PatchObject(javelin, "client_for_user",
- return_value=fake_client))
+ return_value=self.fake_client))
javelin.destroy_objects([self.fake_object])
- mocked_function = fake_client.objects.delete_object
+ mocked_function = self.fake_client.objects.delete_object
mocked_function.asswert_called_once(self.fake_object['container'],
self.fake_object['name'])
def test_destroy_images(self):
- fake_client = mock.MagicMock()
self.useFixture(mockpatch.PatchObject(javelin, "client_for_user",
- return_value=fake_client))
+ return_value=self.fake_client))
self.useFixture(mockpatch.PatchObject(javelin, "_get_image_by_name",
return_value=self.fake_object['image']))
javelin.destroy_images([self.fake_object])
- mocked_function = fake_client.images.delete_image
+ mocked_function = self.fake_client.images.delete_image
mocked_function.assert_called_once_with(
self.fake_object['image']['id'])
def test_destroy_networks(self):
- fake_client = mock.MagicMock()
self.useFixture(mockpatch.PatchObject(javelin, "client_for_user",
- return_value=fake_client))
+ return_value=self.fake_client))
self.useFixture(mockpatch.PatchObject(
javelin, "_get_resource_by_name",
return_value=self.fake_object['resource']))
javelin.destroy_networks([self.fake_object])
- mocked_function = fake_client.networks.delete_network
+ mocked_function = self.fake_client.networks.delete_network
mocked_function.assert_called_once_with(
self.fake_object['resource']['id'])
+
+ def test_destroy_volumes(self):
+ self.useFixture(mockpatch.PatchObject(javelin, "client_for_user",
+ return_value=self.fake_client))
+
+ self.useFixture(mockpatch.PatchObject(
+ javelin, "_get_volume_by_name",
+ return_value=self.fake_object.volume))
+
+ javelin.destroy_volumes([self.fake_object])
+
+ mocked_function = self.fake_client.volumes.detach_volume
+ mocked_function.assert_called_once_with(self.fake_object.volume['id'])
+ mocked_function = self.fake_client.volumes.delete_volume
+ mocked_function.assert_called_once_with(self.fake_object.volume['id'])
+
+ def test_destroy_subnets(self):
+
+ self.useFixture(mockpatch.PatchObject(javelin, "client_for_user",
+ return_value=self.fake_client))
+ fake_subnet_id = self.fake_object['subnet_id']
+ self.useFixture(mockpatch.PatchObject(javelin, "_get_resource_by_name",
+ return_value={
+ 'id': fake_subnet_id}))
+
+ javelin.destroy_subnets([self.fake_object])
+
+ mocked_function = self.fake_client.networks.delete_subnet
+ mocked_function.assert_called_once_with(fake_subnet_id)
+
+ def test_destroy_routers(self):
+ self.useFixture(mockpatch.PatchObject(javelin, "client_for_user",
+ return_value=self.fake_client))
+
+ # this function is used on 2 different occasions in the code
+ def _fake_get_resource_by_name(*args):
+ if args[1] == "routers":
+ return {"id": self.fake_object['router_id']}
+ elif args[1] == "subnets":
+ return {"id": self.fake_object['subnet_id']}
+ javelin._get_resource_by_name = _fake_get_resource_by_name
+
+ javelin.destroy_routers([self.fake_object])
+
+ mocked_function = self.fake_client.networks.delete_router
+ mocked_function.assert_called_once_with(
+ self.fake_object['router_id'])
+
+ def test_destroy_secgroup(self):
+ self.useFixture(mockpatch.PatchObject(javelin, "client_for_user",
+ return_value=self.fake_client))
+ fake_secgroup = {'id': self.fake_object['id']}
+ self.useFixture(mockpatch.PatchObject(javelin, "_get_resource_by_name",
+ return_value=fake_secgroup))
+
+ javelin.destroy_secgroups([self.fake_object])
+
+ mocked_function = self.fake_client.secgroups.delete_security_group
+ mocked_function.assert_called_once_with(self.fake_object['id'])
diff --git a/tempest/tests/common/test_accounts.py b/tempest/tests/common/test_accounts.py
index 596e811..f2e8b20 100644
--- a/tempest/tests/common/test_accounts.py
+++ b/tempest/tests/common/test_accounts.py
@@ -292,14 +292,14 @@
'password': 'p', 'roles': ['role-7', 'role-11'],
'resources': {'network': 'network-2'}}]
# Clear previous mock using self.test_accounts
- self.accounts_mock.cleanUp()
self.useFixture(mockpatch.Patch(
'tempest.common.accounts.read_accounts_yaml',
return_value=test_accounts))
test_accounts_class = accounts.Accounts('v2', 'test_name')
with mock.patch('tempest.services.compute.json.networks_client.'
'NetworksClientJSON.list_networks',
- return_value=[{'name': 'network-2', 'id': 'fake-id'}]):
+ return_value=[{'name': 'network-2', 'id': 'fake-id',
+ 'label': 'network-2'}]):
creds = test_accounts_class.get_creds_by_roles(['role-7'])
self.assertTrue(isinstance(creds, cred_provider.TestResources))
network = creds.network
diff --git a/tempest/tests/common/test_service_clients.py b/tempest/tests/common/test_service_clients.py
index 9bb58b0..c6c1053 100644
--- a/tempest/tests/common/test_service_clients.py
+++ b/tempest/tests/common/test_service_clients.py
@@ -34,6 +34,7 @@
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
@@ -122,7 +123,7 @@
migrations_client.MigrationsClientJSON,
nova_net_client.NetworksClientJSON,
quotas_client.QuotasClientJSON,
- quotas_client.QuotaClassesClientJSON,
+ quota_classes_client.QuotaClassesClientJSON,
nova_secgrop_default_client.SecurityGroupDefaultRulesClientJSON,
security_groups_client.SecurityGroupsClientJSON,
servers_client.ServersClientJSON,
diff --git a/tempest/tests/test_decorators.py b/tempest/tests/test_decorators.py
index e5f51f2..ce3eb7e 100644
--- a/tempest/tests/test_decorators.py
+++ b/tempest/tests/test_decorators.py
@@ -213,8 +213,8 @@
service='compute')
def test_requires_ext_decorator_with_all_ext_enabled(self):
- # disable fixture so the default (all) is used.
- self.config_fixture.cleanUp()
+ cfg.CONF.set_default('api_extensions', 'all',
+ group='compute-feature-enabled')
self._test_requires_ext_helper(expected_to_skip=False,
extension='random_ext',
service='compute')
diff --git a/tempest/tests/test_hacking.py b/tempest/tests/test_hacking.py
index fd01887..9bc9cfe 100644
--- a/tempest/tests/test_hacking.py
+++ b/tempest/tests/test_hacking.py
@@ -119,6 +119,13 @@
self.assertFalse(checks.service_tags_not_in_module_path(
"@test.services('compute')", './tempest/api/image/fake_test.py'))
+ def test_no_hyphen_at_end_of_rand_name(self):
+ self.assertIsNone(checks.no_hyphen_at_end_of_rand_name(
+ 'data_utils.rand_name("fake-resource")', './tempest/test_foo.py'))
+ self.assertEqual(2, len(list(checks.no_hyphen_at_end_of_rand_name(
+ 'data_utils.rand_name("fake-resource-")', './tempest/test_foo.py')
+ )))
+
def test_no_mutable_default_args(self):
self.assertEqual(1, len(list(checks.no_mutable_default_args(
" def function1(para={}):"))))
diff --git a/tempest/tests/test_tenant_isolation.py b/tempest/tests/test_tenant_isolation.py
index 72a63c3..95008a2 100644
--- a/tempest/tests/test_tenant_isolation.py
+++ b/tempest/tests/test_tenant_isolation.py
@@ -211,20 +211,15 @@
iso_creds = isolated_creds.IsolatedCreds(name='test class',
password='fake_password')
self._mock_assign_user_role()
- roles_fix = self._mock_list_role()
- tenant_fix = self._mock_tenant_create('1234', 'fake_prim_tenant')
- user_fix = self._mock_user_create('1234', 'fake_prim_user')
+ self._mock_list_role()
+ self._mock_tenant_create('1234', 'fake_prim_tenant')
+ self._mock_user_create('1234', 'fake_prim_user')
iso_creds.get_primary_creds()
- tenant_fix.cleanUp()
- user_fix.cleanUp()
- tenant_fix = self._mock_tenant_create('12345', 'fake_alt_tenant')
- user_fix = self._mock_user_create('12345', 'fake_alt_user')
+ self._mock_tenant_create('12345', 'fake_alt_tenant')
+ self._mock_user_create('12345', 'fake_alt_user')
iso_creds.get_alt_creds()
- tenant_fix.cleanUp()
- user_fix.cleanUp()
- roles_fix.cleanUp()
- tenant_fix = self._mock_tenant_create('123456', 'fake_admin_tenant')
- user_fix = self._mock_user_create('123456', 'fake_admin_user')
+ self._mock_tenant_create('123456', 'fake_admin_tenant')
+ self._mock_user_create('123456', 'fake_admin_user')
self._mock_list_roles('123456', 'admin')
iso_creds.get_admin_creds()
user_mock = self.patch(
@@ -335,47 +330,36 @@
password='fake_password')
# Create primary tenant and network
self._mock_assign_user_role()
- roles_fix = self._mock_list_role()
- user_fix = self._mock_user_create('1234', 'fake_prim_user')
- tenant_fix = self._mock_tenant_create('1234', 'fake_prim_tenant')
- net_fix = self._mock_network_create(iso_creds, '1234', 'fake_net')
- subnet_fix = self._mock_subnet_create(iso_creds, '1234', 'fake_subnet')
- router_fix = self._mock_router_create('1234', 'fake_router')
+ self._mock_list_role()
+ self._mock_user_create('1234', 'fake_prim_user')
+ self._mock_tenant_create('1234', 'fake_prim_tenant')
+ self._mock_network_create(iso_creds, '1234', 'fake_net')
+ self._mock_subnet_create(iso_creds, '1234', 'fake_subnet')
+ self._mock_router_create('1234', 'fake_router')
router_interface_mock = self.patch(
'tempest.services.network.json.network_client.NetworkClientJSON.'
'add_router_interface_with_subnet_id')
iso_creds.get_primary_creds()
router_interface_mock.called_once_with('1234', '1234')
router_interface_mock.reset_mock()
- tenant_fix.cleanUp()
- user_fix.cleanUp()
- net_fix.cleanUp()
- subnet_fix.cleanUp()
- router_fix.cleanUp()
# Create alternate tenant and network
- user_fix = self._mock_user_create('12345', 'fake_alt_user')
- tenant_fix = self._mock_tenant_create('12345', 'fake_alt_tenant')
- net_fix = self._mock_network_create(iso_creds, '12345', 'fake_alt_net')
- subnet_fix = self._mock_subnet_create(iso_creds, '12345',
- 'fake_alt_subnet')
- router_fix = self._mock_router_create('12345', 'fake_alt_router')
+ self._mock_user_create('12345', 'fake_alt_user')
+ self._mock_tenant_create('12345', 'fake_alt_tenant')
+ self._mock_network_create(iso_creds, '12345', 'fake_alt_net')
+ self._mock_subnet_create(iso_creds, '12345',
+ 'fake_alt_subnet')
+ self._mock_router_create('12345', 'fake_alt_router')
iso_creds.get_alt_creds()
router_interface_mock.called_once_with('12345', '12345')
router_interface_mock.reset_mock()
- tenant_fix.cleanUp()
- user_fix.cleanUp()
- net_fix.cleanUp()
- subnet_fix.cleanUp()
- router_fix.cleanUp()
- roles_fix.cleanUp()
# Create admin tenant and networks
- user_fix = self._mock_user_create('123456', 'fake_admin_user')
- tenant_fix = self._mock_tenant_create('123456', 'fake_admin_tenant')
- net_fix = self._mock_network_create(iso_creds, '123456',
- 'fake_admin_net')
- subnet_fix = self._mock_subnet_create(iso_creds, '123456',
- 'fake_admin_subnet')
- router_fix = self._mock_router_create('123456', 'fake_admin_router')
+ self._mock_user_create('123456', 'fake_admin_user')
+ self._mock_tenant_create('123456', 'fake_admin_tenant')
+ self._mock_network_create(iso_creds, '123456',
+ 'fake_admin_net')
+ self._mock_subnet_create(iso_creds, '123456',
+ 'fake_admin_subnet')
+ self._mock_router_create('123456', 'fake_admin_router')
self._mock_list_roles('123456', 'admin')
iso_creds.get_admin_creds()
self.patch('tempest.services.identity.v2.json.identity_client.'
diff --git a/test-requirements.txt b/test-requirements.txt
index 32f33bc..9bd3f46 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -3,11 +3,11 @@
# process, which may cause wedges in the gate later.
hacking<0.11,>=0.10.0
# needed for doc build
-sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3
+sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2
python-subunit>=0.0.18
-oslosphinx>=2.5.0 # Apache-2.0
+oslosphinx>=2.5.0 # Apache-2.0
mox>=0.5.3
mock>=1.0
coverage>=3.6
-oslotest>=1.5.1 # Apache-2.0
-stevedore>=1.3.0 # Apache-2.0
+oslotest>=1.5.1 # Apache-2.0
+stevedore>=1.5.0 # Apache-2.0
diff --git a/tox.ini b/tox.ini
index 4bb5df6..cf7013d 100644
--- a/tox.ini
+++ b/tox.ini
@@ -13,6 +13,7 @@
[testenv]
setenv = VIRTUAL_ENV={envdir}
OS_TEST_PATH=./tempest/tests
+passenv = OS_STDOUT_CAPTURE OS_STDERR_CAPTURE OS_TEST_TIMEOUT OS_TEST_LOCK_PATH OS_TEST_PATH TEMPEST_CONFIG TEMPEST_CONFIG_DIR http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
usedevelop = True
install_command = pip install -U {opts} {packages}
whitelist_externals = *