Merge "Adding description for testcases - network part3"

This commit is contained in:
Zuul 2020-07-30 10:58:50 +00:00 committed by Gerrit Code Review
commit c1d71ca445
8 changed files with 146 additions and 51 deletions

View File

@ -57,7 +57,7 @@ class AllowedAddressPairTestJSON(base.BaseNetworkTest):
@decorators.idempotent_id('86c3529b-1231-40de-803c-00e40882f043')
def test_create_list_port_with_address_pair(self):
# Create port with allowed address pair attribute
"""Create and list port with allowed address pair attribute"""
allowed_address_pairs = [{'ip_address': self.ip_address,
'mac_address': self.mac_address}]
body = self.ports_client.create_port(
@ -100,17 +100,17 @@ class AllowedAddressPairTestJSON(base.BaseNetworkTest):
@decorators.idempotent_id('9599b337-272c-47fd-b3cf-509414414ac4')
def test_update_port_with_address_pair(self):
# Update port with allowed address pair
"""Update port with allowed address pair"""
self._update_port_with_address(self.ip_address)
@decorators.idempotent_id('4d6d178f-34f6-4bff-a01c-0a2f8fe909e4')
def test_update_port_with_cidr_address_pair(self):
# Update allowed address pair with cidr
"""Update allowed address pair with cidr"""
self._update_port_with_address(str(self.cidr))
@decorators.idempotent_id('b3f20091-6cd5-472b-8487-3516137df933')
def test_update_port_with_multiple_ip_mac_address_pair(self):
# Create an ip _address and mac_address through port create
"""Update allowed address pair port with multiple ip and mac"""
resp = self.ports_client.create_port(
network_id=self.network['id'],
name=data_utils.rand_name(self.__class__.__name__))

View File

@ -104,9 +104,12 @@ class NetworksTestDHCPv6(base.BaseNetworkTest):
@decorators.idempotent_id('e5517e62-6f16-430d-a672-f80875493d4c')
def test_dhcpv6_stateless_eui64(self):
# NOTE: When subnets configured with RAs SLAAC (AOM=100) and DHCP
# stateless (AOM=110) both for radvd and dnsmasq, port shall receive
# IP address calculated from its MAC.
"""Test eui64 ip when setting slaac and statelss for subnet
NOTE: When subnets configured with RAs SLAAC (AOM=100) and DHCP
stateless (AOM=110) both for radvd and dnsmasq, port shall receive
IP address calculated from its MAC.
"""
for ra_mode, add_mode in (
('slaac', 'slaac'),
('dhcpv6-stateless', 'dhcpv6-stateless'),
@ -122,9 +125,12 @@ class NetworksTestDHCPv6(base.BaseNetworkTest):
@decorators.idempotent_id('ae2f4a5d-03ff-4c42-a3b0-ce2fcb7ea832')
def test_dhcpv6_stateless_no_ra(self):
# NOTE: When subnets configured with dnsmasq SLAAC and DHCP stateless
# and there is no radvd, port shall receive IP address calculated
# from its MAC and mask of subnet.
"""Test eui64 ip when setting stateless and no radvd for subnets
NOTE: When subnets configured with dnsmasq SLAAC and DHCP stateless
and there is no radvd, port shall receive IP address calculated
from its MAC and mask of subnet.
"""
for ra_mode, add_mode in (
(None, 'slaac'),
(None, 'dhcpv6-stateless'),
@ -161,8 +167,11 @@ class NetworksTestDHCPv6(base.BaseNetworkTest):
@decorators.idempotent_id('21635b6f-165a-4d42-bf49-7d195e47342f')
def test_dhcpv6_stateless_no_ra_no_dhcp(self):
# NOTE: If no radvd option and no dnsmasq option is configured
# port shall receive IP from fixed IPs list of subnet.
"""Test eui64 ip when setting no radvd and no dnsmasq for subnets
NOTE: If no radvd option and no dnsmasq option is configured
port shall receive IP from fixed IPs list of subnet.
"""
real_ip, eui_ip = self._get_ips_from_subnet()
self._clean_network()
self.assertNotEqual(eui_ip, real_ip,
@ -173,10 +182,13 @@ class NetworksTestDHCPv6(base.BaseNetworkTest):
@decorators.idempotent_id('4544adf7-bb5f-4bdc-b769-b3e77026cef2')
def test_dhcpv6_two_subnets(self):
# NOTE: When one IPv6 subnet configured with dnsmasq SLAAC or DHCP
# stateless and other IPv6 is with DHCP stateful, port shall receive
# EUI-64 IP addresses from first subnet and DHCP address from second
# one. Order of subnet creating should be unimportant.
"""Test eui64 ip when creating port under network with two subnets
NOTE: When one IPv6 subnet configured with dnsmasq SLAAC or DHCP
stateless and other IPv6 is with DHCP stateful, port shall receive
EUI-64 IP addresses from first subnet and DHCP address from second
one. Order of subnet creating should be unimportant.
"""
for order in ("slaac_first", "dhcp_first"):
for ra_mode, add_mode in (
('slaac', 'slaac'),
@ -225,10 +237,13 @@ class NetworksTestDHCPv6(base.BaseNetworkTest):
@decorators.idempotent_id('4256c61d-c538-41ea-9147-3c450c36669e')
def test_dhcpv6_64_subnets(self):
# NOTE: When one IPv6 subnet configured with dnsmasq SLAAC or DHCP
# stateless and other IPv4 is with DHCP of IPv4, port shall receive
# EUI-64 IP addresses from first subnet and IPv4 DHCP address from
# second one. Order of subnet creating should be unimportant.
"""Test eui64 ip when setting slaac and stateless for subnets
NOTE: When one IPv6 subnet configured with dnsmasq SLAAC or DHCP
stateless and other IPv4 is with DHCP of IPv4, port shall receive
EUI-64 IP addresses from first subnet and IPv4 DHCP address from
second one. Order of subnet creating should be unimportant.
"""
for order in ("slaac_first", "dhcp_first"):
for ra_mode, add_mode in (
('slaac', 'slaac'),
@ -271,8 +286,11 @@ class NetworksTestDHCPv6(base.BaseNetworkTest):
@decorators.idempotent_id('4ab211a0-276f-4552-9070-51e27f58fecf')
def test_dhcp_stateful(self):
# NOTE: With all options below, DHCPv6 shall allocate address from
# subnet pool to port.
"""Test creating port when setting stateful for subnets
NOTE: With all options below, DHCPv6 shall allocate address from
subnet pool to port.
"""
for ra_mode, add_mode in (
('dhcpv6-stateful', 'dhcpv6-stateful'),
('dhcpv6-stateful', None),
@ -294,9 +312,12 @@ class NetworksTestDHCPv6(base.BaseNetworkTest):
@decorators.idempotent_id('51a5e97f-f02e-4e4e-9a17-a69811d300e3')
def test_dhcp_stateful_fixedips(self):
# NOTE: With all options below, port shall be able to get
# requested IP from fixed IP range not depending on
# DHCP stateful (not SLAAC!) settings configured.
"""Test creating port with fixed ip when setting stateful for subnets
NOTE: With all options below, port shall be able to get
requested IP from fixed IP range not depending on
DHCP stateful (not SLAAC!) settings configured.
"""
for ra_mode, add_mode in (
('dhcpv6-stateful', 'dhcpv6-stateful'),
('dhcpv6-stateful', None),
@ -324,8 +345,11 @@ class NetworksTestDHCPv6(base.BaseNetworkTest):
@decorators.idempotent_id('98244d88-d990-4570-91d4-6b25d70d08af')
def test_dhcp_stateful_fixedips_outrange(self):
# NOTE: When port gets IP address from fixed IP range it
# shall be checked if it's from subnets range.
"""Test creating port with fixed ip that is not in the range
NOTE: When port gets IP address from fixed IP range it
shall be checked if it's from subnets range.
"""
kwargs = {'ipv6_ra_mode': 'dhcpv6-stateful',
'ipv6_address_mode': 'dhcpv6-stateful'}
subnet = self.create_subnet(self.network, **kwargs)
@ -342,8 +366,11 @@ class NetworksTestDHCPv6(base.BaseNetworkTest):
@decorators.idempotent_id('57b8302b-cba9-4fbb-8835-9168df029051')
def test_dhcp_stateful_fixedips_duplicate(self):
# NOTE: When port gets IP address from fixed IP range it
# shall be checked if it's not duplicate.
"""Test creating port with duplicate fixed ip
NOTE: When port gets IP address from fixed IP range it
shall be checked if it's not duplicate.
"""
kwargs = {'ipv6_ra_mode': 'dhcpv6-stateful',
'ipv6_address_mode': 'dhcpv6-stateful'}
subnet = self.create_subnet(self.network, **kwargs)
@ -376,8 +403,11 @@ class NetworksTestDHCPv6(base.BaseNetworkTest):
@decorators.idempotent_id('e98f65db-68f4-4330-9fea-abd8c5192d4d')
def test_dhcp_stateful_router(self):
# NOTE: With all options below the router interface shall
# receive DHCPv6 IP address from allocation pool.
"""Test creating router with dhcp stateful
NOTE: With all options below the router interface shall
receive DHCPv6 IP address from allocation pool.
"""
for ra_mode, add_mode in (
('dhcpv6-stateful', 'dhcpv6-stateful'),
('dhcpv6-stateful', None),

View File

@ -58,7 +58,7 @@ class ExtraDHCPOptionsTestJSON(base.BaseNetworkTest):
@decorators.idempotent_id('d2c17063-3767-4a24-be4f-a23dbfa133c9')
def test_create_list_port_with_extra_dhcp_options(self):
# Create a port with Extra DHCP Options
"""Test creating a port with Extra DHCP Options and list those"""
body = self.ports_client.create_port(
network_id=self.network['id'],
name=data_utils.rand_name(self.__class__.__name__),
@ -76,7 +76,7 @@ class ExtraDHCPOptionsTestJSON(base.BaseNetworkTest):
@decorators.idempotent_id('9a6aebf4-86ee-4f47-b07a-7f7232c55607')
def test_update_show_port_with_extra_dhcp_options(self):
# Update port with extra dhcp options
"""Test updating port with extra DHCP options and show that port"""
name = data_utils.rand_name('new-port-name')
self.ports_client.update_port(
self.port['id'],

View File

@ -58,6 +58,7 @@ class FloatingIPNegativeTestJSON(base.BaseNetworkTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('22996ea8-4a81-4b27-b6e1-fa5df92fa5e8')
def test_create_floatingip_with_port_ext_net_unreachable(self):
"""Creating floating ip when port's external network is unreachable"""
self.assertRaises(
lib_exc.NotFound, self.floating_ips_client.create_floatingip,
floating_network_id=self.ext_net_id, port_id=self.port['id'],
@ -67,6 +68,7 @@ class FloatingIPNegativeTestJSON(base.BaseNetworkTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('50b9aeb4-9f0b-48ee-aa31-fa955a48ff54')
def test_create_floatingip_in_private_network(self):
"""Test creating floating in private network"""
self.assertRaises(lib_exc.BadRequest,
self.floating_ips_client.create_floatingip,
floating_network_id=self.network['id'],
@ -77,6 +79,7 @@ class FloatingIPNegativeTestJSON(base.BaseNetworkTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('6b3b8797-6d43-4191-985c-c48b773eb429')
def test_associate_floatingip_port_ext_net_unreachable(self):
"""Associate floating ip to port with unreachable external network"""
# Create floating ip
body = self.floating_ips_client.create_floatingip(
floating_network_id=self.ext_net_id)

View File

@ -29,6 +29,7 @@ CONF = config.CONF
class BaseNetworkTestResources(base.BaseNetworkTest):
"""Test networks"""
@classmethod
def resource_setup(cls):
@ -158,6 +159,7 @@ class NetworksTest(BaseNetworkTestResources):
@decorators.attr(type='smoke')
@decorators.idempotent_id('0e269138-0da6-4efc-a46d-578161e7b221')
def test_create_update_delete_network_subnet(self):
"""Verify creating, updating and deleting network subnet"""
# Create a network
network = self.create_network()
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
@ -183,7 +185,7 @@ class NetworksTest(BaseNetworkTestResources):
@decorators.attr(type='smoke')
@decorators.idempotent_id('2bf13842-c93f-4a69-83ed-717d2ec3b44e')
def test_show_network(self):
# Verify the details of a network
"""Verify the details of a network"""
body = self.networks_client.show_network(self.network['id'])
network = body['network']
for key in ['id', 'name']:
@ -191,7 +193,7 @@ class NetworksTest(BaseNetworkTestResources):
@decorators.idempotent_id('867819bb-c4b6-45f7-acf9-90edcf70aa5e')
def test_show_network_fields(self):
# Verify specific fields of a network
"""Verify specific fields of a network"""
fields = ['id', 'name']
if utils.is_extension_enabled('net-mtu', 'network'):
fields.append('mtu')
@ -207,7 +209,7 @@ class NetworksTest(BaseNetworkTestResources):
@decorators.attr(type='smoke')
@decorators.idempotent_id('f7ffdeda-e200-4a7a-bcbe-05716e86bf43')
def test_list_networks(self):
# Verify the network exists in the list of all networks
"""Verify the network exists in the list of all networks"""
body = self.networks_client.list_networks()
networks = [network['id'] for network in body['networks']
if network['id'] == self.network['id']]
@ -215,7 +217,7 @@ class NetworksTest(BaseNetworkTestResources):
@decorators.idempotent_id('6ae6d24f-9194-4869-9c85-c313cb20e080')
def test_list_networks_fields(self):
# Verify specific fields of the networks
"""Verify specific fields of the networks"""
fields = ['id', 'name']
if utils.is_extension_enabled('net-mtu', 'network'):
fields.append('mtu')
@ -228,7 +230,7 @@ class NetworksTest(BaseNetworkTestResources):
@decorators.attr(type='smoke')
@decorators.idempotent_id('bd635d81-6030-4dd1-b3b9-31ba0cfdf6cc')
def test_show_subnet(self):
# Verify the details of a subnet
"""Verify the details of a subnet"""
body = self.subnets_client.show_subnet(self.subnet['id'])
subnet = body['subnet']
self.assertNotEmpty(subnet, "Subnet returned has no fields")
@ -238,7 +240,7 @@ class NetworksTest(BaseNetworkTestResources):
@decorators.idempotent_id('270fff0b-8bfc-411f-a184-1e8fd35286f0')
def test_show_subnet_fields(self):
# Verify specific fields of a subnet
"""Verify specific fields of a subnet"""
fields = ['id', 'network_id']
body = self.subnets_client.show_subnet(self.subnet['id'],
fields=fields)
@ -250,7 +252,7 @@ class NetworksTest(BaseNetworkTestResources):
@decorators.attr(type='smoke')
@decorators.idempotent_id('db68ba48-f4ea-49e9-81d1-e367f6d0b20a')
def test_list_subnets(self):
# Verify the subnet exists in the list of all subnets
"""Verify the subnet exists in the list of all subnets"""
body = self.subnets_client.list_subnets()
subnets = [subnet['id'] for subnet in body['subnets']
if subnet['id'] == self.subnet['id']]
@ -258,7 +260,7 @@ class NetworksTest(BaseNetworkTestResources):
@decorators.idempotent_id('842589e3-9663-46b0-85e4-7f01273b0412')
def test_list_subnets_fields(self):
# Verify specific fields of subnets
"""Verify specific fields of subnets"""
fields = ['id', 'network_id']
body = self.subnets_client.list_subnets(fields=fields)
subnets = body['subnets']
@ -268,6 +270,7 @@ class NetworksTest(BaseNetworkTestResources):
@decorators.idempotent_id('f04f61a9-b7f3-4194-90b2-9bcf660d1bfe')
def test_delete_network_with_subnet(self):
"""Verify deleting network with subnet"""
# Creates a network
network = self.create_network()
net_id = network['id']
@ -287,34 +290,41 @@ class NetworksTest(BaseNetworkTestResources):
@decorators.idempotent_id('d2d596e2-8e76-47a9-ac51-d4648009f4d3')
def test_create_delete_subnet_without_gateway(self):
"""Verify creating and deleting subnet without gateway"""
self._create_verify_delete_subnet()
@decorators.idempotent_id('9393b468-186d-496d-aa36-732348cd76e7')
def test_create_delete_subnet_with_gw(self):
"""Verify creating and deleting subnet with gateway"""
self._create_verify_delete_subnet(
**self.subnet_dict(['gateway']))
@decorators.idempotent_id('bec949c4-3147-4ba6-af5f-cd2306118404')
def test_create_delete_subnet_with_allocation_pools(self):
"""Verify creating and deleting subnet with allocation pools"""
self._create_verify_delete_subnet(
**self.subnet_dict(['allocation_pools']))
@decorators.idempotent_id('8217a149-0c6c-4cfb-93db-0486f707d13f')
def test_create_delete_subnet_with_gw_and_allocation_pools(self):
"""Verify create/delete subnet with gateway and allocation pools"""
self._create_verify_delete_subnet(**self.subnet_dict(
['gateway', 'allocation_pools']))
@decorators.idempotent_id('d830de0a-be47-468f-8f02-1fd996118289')
def test_create_delete_subnet_with_host_routes_and_dns_nameservers(self):
"""Verify create/delete subnet with host routes and name servers"""
self._create_verify_delete_subnet(
**self.subnet_dict(['host_routes', 'dns_nameservers']))
@decorators.idempotent_id('94ce038d-ff0a-4a4c-a56b-09da3ca0b55d')
def test_create_delete_subnet_with_dhcp_enabled(self):
"""Verify create/delete subnet with dhcp enabled"""
self._create_verify_delete_subnet(enable_dhcp=True)
@decorators.idempotent_id('3d3852eb-3009-49ec-97ac-5ce83b73010a')
def test_update_subnet_gw_dns_host_routes_dhcp(self):
"""Verify updating subnet's gateway/nameserver/routes/dhcp"""
network = self.create_network()
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
self.networks_client.delete_network, network['id'])
@ -349,6 +359,7 @@ class NetworksTest(BaseNetworkTestResources):
@decorators.idempotent_id('a4d9ec4c-0306-4111-a75c-db01a709030b')
def test_create_delete_subnet_all_attributes(self):
"""Verify create/delete subnet's all attributes"""
self._create_verify_delete_subnet(
enable_dhcp=True,
**self.subnet_dict(['gateway', 'host_routes', 'dns_nameservers']))
@ -359,6 +370,7 @@ class NetworksTest(BaseNetworkTestResources):
@testtools.skipUnless(CONF.network.public_network_id,
'The public_network_id option must be specified.')
def test_external_network_visibility(self):
"""Verify external network's visibility"""
public_network_id = CONF.network.public_network_id
# find external network matching public_network_id
@ -394,6 +406,7 @@ class NetworksTest(BaseNetworkTestResources):
@utils.requires_ext(extension="standard-attr-description",
service="network")
def test_create_update_network_description(self):
"""Verify creating and updating network's description"""
body = self.create_network(description='d1')
self.assertEqual('d1', body['description'])
net_id = body['id']
@ -454,6 +467,7 @@ class BulkNetworkOpsTest(base.BaseNetworkTest):
@decorators.attr(type='smoke')
@decorators.idempotent_id('d4f9024d-1e28-4fc1-a6b1-25dbc6fa11e2')
def test_bulk_create_delete_network(self):
"""Verify creating and deleting multiple networks in one request"""
# Creates 2 networks in one request
network_list = [{'name': data_utils.rand_name('network-')},
{'name': data_utils.rand_name('network-')}]
@ -470,6 +484,7 @@ class BulkNetworkOpsTest(base.BaseNetworkTest):
@decorators.attr(type='smoke')
@decorators.idempotent_id('8936533b-c0aa-4f29-8e53-6cc873aec489')
def test_bulk_create_delete_subnet(self):
"""Verify creating and deleting multiple subnets in one request"""
networks = [self.create_network(), self.create_network()]
# Creates 2 subnets in one request
cidrs = [subnet_cidr
@ -499,6 +514,7 @@ class BulkNetworkOpsTest(base.BaseNetworkTest):
@decorators.attr(type='smoke')
@decorators.idempotent_id('48037ff2-e889-4c3b-b86a-8e3f34d2d060')
def test_bulk_create_delete_port(self):
"""Verify creating and deleting multiple ports in one request"""
networks = [self.create_network(), self.create_network()]
# Creates 2 ports in one request
names = [data_utils.rand_name('port-') for i in range(len(networks))]
@ -532,6 +548,7 @@ class NetworksIpV6Test(NetworksTest):
@decorators.idempotent_id('e41a4888-65a6-418c-a095-f7c2ef4ad59a')
def test_create_delete_subnet_with_gw(self):
"""Verify creating and deleting subnet with gateway"""
net = netaddr.IPNetwork(CONF.network.project_network_v6_cidr)
gateway = str(netaddr.IPAddress(net.first + 2))
network = self.create_network()
@ -541,6 +558,7 @@ class NetworksIpV6Test(NetworksTest):
@decorators.idempotent_id('ebb4fd95-524f-46af-83c1-0305b239338f')
def test_create_delete_subnet_with_default_gw(self):
"""Verify creating and deleting subnet without specified gateway"""
net = netaddr.IPNetwork(CONF.network.project_network_v6_cidr)
gateway_ip = str(netaddr.IPAddress(net.first + 1))
network = self.create_network()
@ -550,6 +568,12 @@ class NetworksIpV6Test(NetworksTest):
@decorators.idempotent_id('a9653883-b2a4-469b-8c3c-4518430a7e55')
def test_create_list_subnet_with_no_gw64_one_network(self):
"""Verify subnets with and without gateway are in one network
First we create a network, then we create one ipv6 subnet with
gateway and one ipv4 subnet without gateway, the two subnets
should be in the same network
"""
network = self.create_network()
ipv6_gateway = self.subnet_dict(['gateway'])['gateway']
subnet1 = self.create_subnet(network,
@ -589,6 +613,7 @@ class NetworksIpV6TestAttrs(BaseNetworkTestResources):
@decorators.idempotent_id('da40cd1b-a833-4354-9a85-cd9b8a3b74ca')
def test_create_delete_subnet_with_v6_attributes_stateful(self):
"""Test create/delete subnet with ipv6 attributes stateful"""
self._create_verify_delete_subnet(
gateway=self._subnet_data[self._ip_version]['gateway'],
ipv6_ra_mode='dhcpv6-stateful',
@ -596,12 +621,14 @@ class NetworksIpV6TestAttrs(BaseNetworkTestResources):
@decorators.idempotent_id('176b030f-a923-4040-a755-9dc94329e60c')
def test_create_delete_subnet_with_v6_attributes_slaac(self):
"""Test create/delete subnet with ipv6 attributes slaac"""
self._create_verify_delete_subnet(
ipv6_ra_mode='slaac',
ipv6_address_mode='slaac')
@decorators.idempotent_id('7d410310-8c86-4902-adf9-865d08e31adb')
def test_create_delete_subnet_with_v6_attributes_stateless(self):
"""Test create/delete subnet with ipv6 attributes stateless"""
self._create_verify_delete_subnet(
ipv6_ra_mode='dhcpv6-stateless',
ipv6_address_mode='dhcpv6-stateless')

View File

@ -21,10 +21,12 @@ from tempest.lib import exceptions as lib_exc
class NetworksNegativeTestJSON(base.BaseNetworkTest):
"""Negative tests of network"""
@decorators.attr(type=['negative'])
@decorators.idempotent_id('9293e937-824d-42d2-8d5b-e985ea67002a')
def test_show_non_existent_network(self):
"""Test showing non existent network"""
non_exist_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound, self.networks_client.show_network,
non_exist_id)
@ -32,6 +34,7 @@ class NetworksNegativeTestJSON(base.BaseNetworkTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('d746b40c-5e09-4043-99f7-cba1be8b70df')
def test_show_non_existent_subnet(self):
"""Test showing non existent subnet"""
non_exist_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound, self.subnets_client.show_subnet,
non_exist_id)
@ -39,6 +42,7 @@ class NetworksNegativeTestJSON(base.BaseNetworkTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('a954861d-cbfd-44e8-b0a9-7fab111f235d')
def test_show_non_existent_port(self):
"""Test showing non existent port"""
non_exist_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound, self.ports_client.show_port,
non_exist_id)
@ -46,6 +50,7 @@ class NetworksNegativeTestJSON(base.BaseNetworkTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('98bfe4e3-574e-4012-8b17-b2647063de87')
def test_update_non_existent_network(self):
"""Test updating non existent network"""
non_exist_id = data_utils.rand_uuid()
self.assertRaises(
lib_exc.NotFound, self.networks_client.update_network,
@ -54,6 +59,7 @@ class NetworksNegativeTestJSON(base.BaseNetworkTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('03795047-4a94-4120-a0a1-bd376e36fd4e')
def test_delete_non_existent_network(self):
"""Test deleting non existent network"""
non_exist_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound,
self.networks_client.delete_network,
@ -62,6 +68,7 @@ class NetworksNegativeTestJSON(base.BaseNetworkTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('1cc47884-ac52-4415-a31c-e7ce5474a868')
def test_update_non_existent_subnet(self):
"""Test updating non existent subnet"""
non_exist_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound, self.subnets_client.update_subnet,
non_exist_id, name='new_name')
@ -69,6 +76,7 @@ class NetworksNegativeTestJSON(base.BaseNetworkTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('a176c859-99fb-42ec-a208-8a85b552a239')
def test_delete_non_existent_subnet(self):
"""Test deleting non existent subnet"""
non_exist_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound,
self.subnets_client.delete_subnet, non_exist_id)
@ -76,6 +84,7 @@ class NetworksNegativeTestJSON(base.BaseNetworkTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('13d3b106-47e6-4b9b-8d53-dae947f092fe')
def test_create_port_on_non_existent_network(self):
"""Test creating port on non existent network"""
non_exist_net_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound,
self.ports_client.create_port,
@ -85,6 +94,7 @@ class NetworksNegativeTestJSON(base.BaseNetworkTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('cf8eef21-4351-4f53-adcd-cc5cb1e76b92')
def test_update_non_existent_port(self):
"""Test updating non existent port"""
non_exist_port_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound, self.ports_client.update_port,
non_exist_port_id, name='new_name')
@ -92,6 +102,7 @@ class NetworksNegativeTestJSON(base.BaseNetworkTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('49ec2bbd-ac2e-46fd-8054-798e679ff894')
def test_delete_non_existent_port(self):
"""Test deleting non existent port"""
non_exist_port_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound,
self.ports_client.delete_port, non_exist_port_id)

View File

@ -21,6 +21,7 @@ from tempest.lib import decorators
class SecGroupTest(base.BaseSecGroupTest):
"""Test security groups"""
@classmethod
def skip_checks(cls):
@ -67,7 +68,7 @@ class SecGroupTest(base.BaseSecGroupTest):
@decorators.attr(type='smoke')
@decorators.idempotent_id('e30abd17-fef9-4739-8617-dc26da88e686')
def test_list_security_groups(self):
# Verify the security group belonging to project exist in list
"""Verify that default security group exist"""
body = self.security_groups_client.list_security_groups()
security_groups = body['security_groups']
found = None
@ -80,6 +81,7 @@ class SecGroupTest(base.BaseSecGroupTest):
@decorators.attr(type='smoke')
@decorators.idempotent_id('bfd128e5-3c92-44b6-9d66-7fe29d22c802')
def test_create_list_update_show_delete_security_group(self):
"""Verify create/list/update/show/delete of security group"""
group_create_body, _ = self._create_security_group()
# List security groups and verify if created group is there in response
@ -111,6 +113,7 @@ class SecGroupTest(base.BaseSecGroupTest):
@decorators.attr(type='smoke')
@decorators.idempotent_id('cfb99e0e-7410-4a3d-8a0c-959a63ee77e9')
def test_create_show_delete_security_group_rule(self):
"""Test create/show/delete of security group rule"""
group_create_body, _ = self._create_security_group()
# Create rules for each protocol
@ -191,7 +194,7 @@ class SecGroupTest(base.BaseSecGroupTest):
@decorators.idempotent_id('c2ed2deb-7a0c-44d8-8b4c-a5825b5c310b')
def test_create_security_group_rule_with_remote_group_id(self):
# Verify creating security group rule with remote_group_id works
"""Verify creating security group rule with remote_group_id works"""
sg1_body, _ = self._create_security_group()
sg2_body, _ = self._create_security_group()
@ -209,7 +212,7 @@ class SecGroupTest(base.BaseSecGroupTest):
@decorators.idempotent_id('16459776-5da2-4634-bce4-4b55ee3ec188')
def test_create_security_group_rule_with_remote_ip_prefix(self):
# Verify creating security group rule with remote_ip_prefix works
"""Verify creating security group rule with remote_ip_prefix works"""
sg1_body, _ = self._create_security_group()
sg_id = sg1_body['security_group']['id']
@ -226,9 +229,10 @@ class SecGroupTest(base.BaseSecGroupTest):
@decorators.idempotent_id('0a307599-6655-4220-bebc-fd70c64f2290')
def test_create_security_group_rule_with_protocol_integer_value(self):
# Verify creating security group rule with the
# protocol as integer value
# arguments : "protocol": 17
"""Verify creating security group rule with the integer protocol value
arguments : "protocol": 17
"""
group_create_body, _ = self._create_security_group()
direction = 'ingress'
protocol = 17

View File

@ -24,6 +24,7 @@ CONF = config.CONF
class NegativeSecGroupTest(base.BaseSecGroupTest):
"""Negative tests of security groups"""
@classmethod
def skip_checks(cls):
@ -35,6 +36,7 @@ class NegativeSecGroupTest(base.BaseSecGroupTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('424fd5c3-9ddc-486a-b45f-39bf0c820fc6')
def test_show_non_existent_security_group(self):
"""Test showing non existent security group"""
non_exist_id = data_utils.rand_uuid()
self.assertRaises(
lib_exc.NotFound, self.security_groups_client.show_security_group,
@ -43,6 +45,7 @@ class NegativeSecGroupTest(base.BaseSecGroupTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('4c094c09-000b-4e41-8100-9617600c02a6')
def test_show_non_existent_security_group_rule(self):
"""Test showing non existent security group rule"""
non_exist_id = data_utils.rand_uuid()
self.assertRaises(
lib_exc.NotFound,
@ -52,6 +55,7 @@ class NegativeSecGroupTest(base.BaseSecGroupTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('1f1bb89d-5664-4956-9fcd-83ee0fa603df')
def test_delete_non_existent_security_group(self):
"""Test deleting non existent security group"""
non_exist_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound,
self.security_groups_client.delete_security_group,
@ -61,6 +65,7 @@ class NegativeSecGroupTest(base.BaseSecGroupTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('981bdc22-ce48-41ed-900a-73148b583958')
def test_create_security_group_rule_with_bad_protocol(self):
"""Test creating security group rule with bad protocol"""
group_create_body, _ = self._create_security_group()
# Create rule with bad protocol name
@ -74,6 +79,7 @@ class NegativeSecGroupTest(base.BaseSecGroupTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('5f8daf69-3c5f-4aaa-88c9-db1d66f68679')
def test_create_security_group_rule_with_bad_remote_ip_prefix(self):
"""Test creating security group rule with bad remote ip prefix"""
group_create_body, _ = self._create_security_group()
# Create rule with bad remote_ip_prefix
@ -89,6 +95,7 @@ class NegativeSecGroupTest(base.BaseSecGroupTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('4bf786fd-2f02-443c-9716-5b98e159a49a')
def test_create_security_group_rule_with_non_existent_remote_groupid(self):
"""Creating security group rule with non existent remote group id"""
group_create_body, _ = self._create_security_group()
non_exist_id = data_utils.rand_uuid()
@ -105,6 +112,7 @@ class NegativeSecGroupTest(base.BaseSecGroupTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('b5c4b247-6b02-435b-b088-d10d45650881')
def test_create_security_group_rule_with_remote_ip_and_group(self):
"""Test creating security group rule with remote ip and group"""
sg1_body, _ = self._create_security_group()
sg2_body, _ = self._create_security_group()
@ -121,6 +129,7 @@ class NegativeSecGroupTest(base.BaseSecGroupTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('5666968c-fff3-40d6-9efc-df1c8bd01abb')
def test_create_security_group_rule_with_bad_ethertype(self):
"""Test creating security group rule with bad bad ethertype"""
group_create_body, _ = self._create_security_group()
# Create rule with bad ethertype
@ -134,6 +143,7 @@ class NegativeSecGroupTest(base.BaseSecGroupTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('0d9c7791-f2ad-4e2f-ac73-abf2373b0d2d')
def test_create_security_group_rule_with_invalid_ports(self):
"""Test creating security group rule with invalid ports"""
group_create_body, _ = self._create_security_group()
# Create rule for tcp protocol with invalid ports
@ -168,7 +178,10 @@ class NegativeSecGroupTest(base.BaseSecGroupTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('2323061e-9fbf-4eb0-b547-7e8fafc90849')
def test_create_additional_default_security_group_fails(self):
# Create security group named 'default', it should be failed.
"""Test creating additional default security group
Create security group named 'default', it should be failed.
"""
name = 'default'
self.assertRaises(lib_exc.Conflict,
self.security_groups_client.create_security_group,
@ -177,7 +190,10 @@ class NegativeSecGroupTest(base.BaseSecGroupTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('966e2b96-023a-11e7-a9e4-fa163e4fa634')
def test_create_security_group_update_name_default(self):
# Update security group name to 'default', it should be failed.
"""Test updating security group's name to default
Update security group name to 'default', it should be failed.
"""
group_create_body, _ = self._create_security_group()
self.assertRaises(lib_exc.Conflict,
self.security_groups_client.update_security_group,
@ -187,7 +203,10 @@ class NegativeSecGroupTest(base.BaseSecGroupTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('8fde898f-ce88-493b-adc9-4e4692879fc5')
def test_create_duplicate_security_group_rule_fails(self):
# Create duplicate security group rule, it should fail.
"""Test creating duplicate security group rule
Create duplicate security group rule, it should fail.
"""
body, _ = self._create_security_group()
min_port = 66
@ -213,7 +232,7 @@ class NegativeSecGroupTest(base.BaseSecGroupTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('be308db6-a7cf-4d5c-9baf-71bafd73f35e')
def test_create_security_group_rule_with_non_existent_security_group(self):
# Create security group rules with not existing security group.
"""Creating security group rules with not existing security group"""
non_existent_sg = data_utils.rand_uuid()
self.assertRaises(
lib_exc.NotFound,
@ -228,6 +247,7 @@ class NegativeSecGroupIPv6Test(NegativeSecGroupTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('7607439c-af73-499e-bf64-f687fd12a842')
def test_create_security_group_rule_wrong_ip_prefix_version(self):
"""Test creating security group rule with wrong ip prefix version"""
group_create_body, _ = self._create_security_group()
# Create rule with bad remote_ip_prefix