Merge "Whitebox server expects deleted > 0"
diff --git a/tempest/api/compute/admin/test_aggregates.py b/tempest/api/compute/admin/test_aggregates.py
index 107d635..303bc0c 100644
--- a/tempest/api/compute/admin/test_aggregates.py
+++ b/tempest/api/compute/admin/test_aggregates.py
@@ -146,6 +146,7 @@
self.client.get_aggregate, -1)
@attr(type='gate')
+ @lockutils.synchronized('availability_zone', 'tempest-', True)
def test_aggregate_add_remove_host(self):
# Add an host to the given aggregate and remove.
aggregate_name = rand_name(self.aggregate_name_prefix)
@@ -167,6 +168,7 @@
self.assertNotIn(self.host, body['hosts'])
@attr(type='gate')
+ @lockutils.synchronized('availability_zone', 'tempest-', True)
def test_aggregate_add_host_list(self):
# Add an host to the given aggregate and list.
aggregate_name = rand_name(self.aggregate_name_prefix)
@@ -184,6 +186,7 @@
self.assertIn(self.host, agg['hosts'])
@attr(type='gate')
+ @lockutils.synchronized('availability_zone', 'tempest-', True)
def test_aggregate_add_host_get_details(self):
# Add an host to the given aggregate and get details.
aggregate_name = rand_name(self.aggregate_name_prefix)
@@ -245,6 +248,7 @@
aggregate['id'], self.host)
@attr(type=['negative', 'gate'])
+ @lockutils.synchronized('availability_zone', 'tempest-', True)
def test_aggregate_remove_host_as_user(self):
# Regular user is not allowed to remove a host from an aggregate.
aggregate_name = rand_name(self.aggregate_name_prefix)
diff --git a/tempest/api/compute/security_groups/test_security_group_rules.py b/tempest/api/compute/security_groups/test_security_group_rules.py
index 8472561..472b8b4 100644
--- a/tempest/api/compute/security_groups/test_security_group_rules.py
+++ b/tempest/api/compute/security_groups/test_security_group_rules.py
@@ -15,8 +15,11 @@
# License for the specific language governing permissions and limitations
# under the License.
+import testtools
+
from tempest.api.compute import base
from tempest.common.utils.data_utils import rand_name
+from tempest import config
from tempest import exceptions
from tempest.test import attr
@@ -91,6 +94,8 @@
self.addCleanup(self.client.delete_security_group_rule, rule['id'])
self.assertEqual(200, resp.status)
+ @testtools.skipIf(config.TempestConfig().service_available.neutron,
+ "Skipped until the Bug #1182384 is resolved")
@attr(type=['negative', 'gate'])
def test_security_group_rules_create_with_invalid_id(self):
# Negative test: Creation of Security Group rule should FAIL
@@ -181,6 +186,8 @@
self.client.create_security_group_rule,
secgroup_id, ip_protocol, from_port, to_port)
+ @testtools.skipIf(config.TempestConfig().service_available.neutron,
+ "Skipped until the Bug #1182384 is resolved")
@attr(type=['negative', 'gate'])
def test_security_group_rules_delete_with_invalid_id(self):
# Negative test: Deletion of Security Group rule should be FAIL
diff --git a/tempest/api/network/base.py b/tempest/api/network/base.py
index 8785e31..d3fa763 100644
--- a/tempest/api/network/base.py
+++ b/tempest/api/network/base.py
@@ -54,9 +54,12 @@
cls.client = os.network_client
cls.networks = []
cls.subnets = []
+ cls.ports = []
@classmethod
def tearDownClass(cls):
+ for port in cls.ports:
+ cls.client.delete_port(port['id'])
for subnet in cls.subnets:
cls.client.delete_subnet(subnet['id'])
for network in cls.networks:
@@ -98,3 +101,11 @@
subnet = body['subnet']
cls.subnets.append(subnet)
return subnet
+
+ @classmethod
+ def create_port(cls, network):
+ """Wrapper utility that returns a test port."""
+ resp, body = cls.client.create_port(network['id'])
+ port = body['port']
+ cls.ports.append(port)
+ return port
diff --git a/tempest/api/network/test_networks.py b/tempest/api/network/test_networks.py
index 36715a0..00a8ef7 100644
--- a/tempest/api/network/test_networks.py
+++ b/tempest/api/network/test_networks.py
@@ -35,6 +35,13 @@
create a subnet for a tenant
list tenant's subnets
show a tenant subnet details
+ port create
+ port delete
+ port list
+ port show
+ port update
+ network update
+ subnet update
v2.0 of the Neutron API is assumed. It is also assumed that the following
options are defined in the [network] section of etc/tempest.conf:
@@ -53,21 +60,28 @@
cls.name = cls.network['name']
cls.subnet = cls.create_subnet(cls.network)
cls.cidr = cls.subnet['cidr']
+ cls.port = cls.create_port(cls.network)
@attr(type='gate')
- def test_create_delete_network_subnet(self):
+ def test_create_update_delete_network_subnet(self):
# Creates a network
name = rand_name('network-')
resp, body = self.client.create_network(name)
self.assertEqual('201', resp['status'])
network = body['network']
- self.assertTrue(network['id'] is not None)
+ net_id = network['id']
+ # Verification of network update
+ new_name = "New_network"
+ resp, body = self.client.update_network(net_id, new_name)
+ self.assertEqual('200', resp['status'])
+ updated_net = body['network']
+ self.assertEqual(updated_net['name'], new_name)
# Find a cidr that is not in use yet and create a subnet with it
cidr = netaddr.IPNetwork(self.network_cfg.tenant_network_cidr)
mask_bits = self.network_cfg.tenant_network_mask_bits
for subnet_cidr in cidr.subnet(mask_bits):
try:
- resp, body = self.client.create_subnet(network['id'],
+ resp, body = self.client.create_subnet(net_id,
str(subnet_cidr))
break
except exceptions.BadRequest as e:
@@ -76,11 +90,17 @@
raise
self.assertEqual('201', resp['status'])
subnet = body['subnet']
- self.assertTrue(subnet['id'] is not None)
+ subnet_id = subnet['id']
+ # Verification of subnet update
+ new_subnet = "New_subnet"
+ resp, body = self.client.update_subnet(subnet_id, new_subnet)
+ self.assertEqual('200', resp['status'])
+ updated_subnet = body['subnet']
+ self.assertEqual(updated_subnet['name'], new_subnet)
# Deletes subnet and network
- resp, body = self.client.delete_subnet(subnet['id'])
+ resp, body = self.client.delete_subnet(subnet_id)
self.assertEqual('204', resp['status'])
- resp, body = self.client.delete_network(network['id'])
+ resp, body = self.client.delete_network(net_id)
self.assertEqual('204', resp['status'])
@attr(type='gate')
@@ -97,8 +117,12 @@
# Verify the network exists in the list of all networks
resp, body = self.client.list_networks()
networks = body['networks']
- found = any(n for n in networks if n['id'] == self.network['id'])
- self.assertTrue(found)
+ found = None
+ for n in networks:
+ if (n['id'] == self.network['id']):
+ found = n['id']
+ msg = "Network list doesn't contain created network"
+ self.assertIsNotNone(found, msg)
@attr(type='gate')
def test_show_subnet(self):
@@ -114,5 +138,57 @@
# Verify the subnet exists in the list of all subnets
resp, body = self.client.list_subnets()
subnets = body['subnets']
- found = any(n for n in subnets if n['id'] == self.subnet['id'])
- self.assertTrue(found)
+ found = None
+ for n in subnets:
+ if (n['id'] == self.subnet['id']):
+ found = n['id']
+ msg = "Subnet list doesn't contain created subnet"
+ self.assertIsNotNone(found, msg)
+
+ @attr(type='gate')
+ def test_create_update_delete_port(self):
+ # Verify that successful port creation & deletion
+ resp, body = self.client.create_port(self.network['id'])
+ self.assertEqual('201', resp['status'])
+ port = body['port']
+ # Verification of port update
+ new_port = "New_Port"
+ resp, body = self.client.update_port(port['id'], new_port)
+ self.assertEqual('200', resp['status'])
+ updated_port = body['port']
+ self.assertEqual(updated_port['name'], new_port)
+ # Verification of port delete
+ resp, body = self.client.delete_port(port['id'])
+ self.assertEqual('204', resp['status'])
+
+ @attr(type='gate')
+ def test_show_ports(self):
+ # Verify the details of port
+ resp, body = self.client.show_port(self.port['id'])
+ self.assertEqual('200', resp['status'])
+ port = body['port']
+ self.assertEqual(self.port['id'], port['id'])
+
+ @attr(type='gate')
+ def test_list_ports(self):
+ # Verify the port exists in the list of all ports
+ resp, body = self.client.list_ports()
+ self.assertEqual('200', resp['status'])
+ ports_list = body['ports']
+ found = None
+ for n in ports_list:
+ if (n['id'] == self.port['id']):
+ found = n['id']
+ self.assertIsNotNone(found, "Port list doesn't contain created port")
+
+ @attr(type=['negative', 'gate'])
+ def test_show_non_existent_network(self):
+ non_exist_id = rand_name('network')
+ self.assertRaises(exceptions.NotFound, self.client.show_network,
+ non_exist_id)
+
+ @attr(type=['negative', 'gate'])
+ def test_show_non_existent_subnet(self):
+ non_exist_id = rand_name('subnet')
+ self.assertRaises(exceptions.NotFound, self.client.show_subnet,
+ non_exist_id)
diff --git a/tempest/services/network/json/network_client.py b/tempest/services/network/json/network_client.py
index f96ed91..2c808a9 100644
--- a/tempest/services/network/json/network_client.py
+++ b/tempest/services/network/json/network_client.py
@@ -151,3 +151,39 @@
resp, body = self.get(uri, self.headers)
body = json.loads(body)
return resp, body['quotas']
+
+ def update_subnet(self, subnet_id, new_name):
+ put_body = {
+ 'subnet': {
+ 'name': new_name,
+ }
+ }
+ body = json.dumps(put_body)
+ uri = '%s/subnets/%s' % (self.uri_prefix, subnet_id)
+ resp, body = self.put(uri, body=body, headers=self.headers)
+ body = json.loads(body)
+ return resp, body
+
+ def update_port(self, port_id, new_name):
+ put_body = {
+ 'port': {
+ 'name': new_name,
+ }
+ }
+ body = json.dumps(put_body)
+ uri = '%s/ports/%s' % (self.uri_prefix, port_id)
+ resp, body = self.put(uri, body=body, headers=self.headers)
+ body = json.loads(body)
+ return resp, body
+
+ def update_network(self, network_id, new_name):
+ put_body = {
+ "network": {
+ "name": new_name,
+ }
+ }
+ body = json.dumps(put_body)
+ uri = '%s/networks/%s' % (self.uri_prefix, network_id)
+ resp, body = self.put(uri, body=body, headers=self.headers)
+ body = json.loads(body)
+ return resp, body
diff --git a/tempest/whitebox/test_servers_whitebox.py b/tempest/whitebox/test_servers_whitebox.py
index 8bdf01e..1c1cdeb 100644
--- a/tempest/whitebox/test_servers_whitebox.py
+++ b/tempest/whitebox/test_servers_whitebox.py
@@ -25,7 +25,6 @@
@classmethod
def setUpClass(cls):
- raise cls.skipException("Until Bug 1034129 is fixed")
super(ServersWhiteboxTest, cls).setUpClass()
#NOTE(afazekas): Strange relationship
BaseIdentityAdminTest.setUpClass()