Merge "Handle properly 404 responses from Neutron"
This commit is contained in:
commit
8c80d5fc67
@ -36,6 +36,7 @@ class ExternalNetworksTestJSON(base.BaseAdminNetworkTest):
|
||||
body = self.admin_networks_client.create_network(**post_body)
|
||||
network = body['network']
|
||||
self.addCleanup(
|
||||
test_utils.call_and_ignore_notfound_exc,
|
||||
self.admin_networks_client.delete_network, network['id'])
|
||||
return network
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
from tempest.api.network import base
|
||||
from tempest.common import utils
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import test_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
CONF = config.CONF
|
||||
@ -57,13 +58,17 @@ class FloatingIPAdminTestJSON(base.BaseAdminNetworkTest):
|
||||
# Create floating ip from admin user
|
||||
floating_ip_admin = self.admin_floating_ips_client.create_floatingip(
|
||||
floating_network_id=self.ext_net_id)
|
||||
self.addCleanup(self.admin_floating_ips_client.delete_floatingip,
|
||||
self.addCleanup(
|
||||
test_utils.call_and_ignore_notfound_exc,
|
||||
self.admin_floating_ips_client.delete_floatingip,
|
||||
floating_ip_admin['floatingip']['id'])
|
||||
# Create floating ip from alt user
|
||||
body = self.alt_floating_ips_client.create_floatingip(
|
||||
floating_network_id=self.ext_net_id)
|
||||
floating_ip_alt = body['floatingip']
|
||||
self.addCleanup(self.alt_floating_ips_client.delete_floatingip,
|
||||
self.addCleanup(
|
||||
test_utils.call_and_ignore_notfound_exc,
|
||||
self.alt_floating_ips_client.delete_floatingip,
|
||||
floating_ip_alt['id'])
|
||||
# List floating ips from admin
|
||||
body = self.admin_floating_ips_client.list_floatingips()
|
||||
@ -91,7 +96,9 @@ class FloatingIPAdminTestJSON(base.BaseAdminNetworkTest):
|
||||
tenant_id=self.network['tenant_id'],
|
||||
port_id=self.port['id'])
|
||||
created_floating_ip = body['floatingip']
|
||||
self.addCleanup(self.floating_ips_client.delete_floatingip,
|
||||
self.addCleanup(
|
||||
test_utils.call_and_ignore_notfound_exc,
|
||||
self.floating_ips_client.delete_floatingip,
|
||||
created_floating_ip['id'])
|
||||
self.assertIsNotNone(created_floating_ip['id'])
|
||||
self.assertIsNotNone(created_floating_ip['tenant_id'])
|
||||
|
@ -17,6 +17,7 @@ from tempest.api.network import base
|
||||
from tempest.common import identity
|
||||
from tempest.common import utils
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib.common.utils import test_utils
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
|
||||
@ -58,11 +59,13 @@ class QuotasNegativeTest(base.BaseAdminNetworkTest):
|
||||
# Create two networks
|
||||
n1 = self.admin_networks_client.create_network(
|
||||
tenant_id=self.project['id'])
|
||||
self.addCleanup(self.admin_networks_client.delete_network,
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.admin_networks_client.delete_network,
|
||||
n1['network']['id'])
|
||||
n2 = self.admin_networks_client.create_network(
|
||||
tenant_id=self.project['id'])
|
||||
self.addCleanup(self.admin_networks_client.delete_network,
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.admin_networks_client.delete_network,
|
||||
n2['network']['id'])
|
||||
|
||||
# Try to create a third network while the quota is two
|
||||
@ -71,5 +74,6 @@ class QuotasNegativeTest(base.BaseAdminNetworkTest):
|
||||
r"Quota exceeded for resources: \['network'\].*"):
|
||||
n3 = self.admin_networks_client.create_network(
|
||||
tenant_id=self.project['id'])
|
||||
self.addCleanup(self.admin_networks_client.delete_network,
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.admin_networks_client.delete_network,
|
||||
n3['network']['id'])
|
||||
|
@ -14,6 +14,7 @@
|
||||
# under the License.
|
||||
|
||||
from tempest.api.network import base
|
||||
from tempest.lib.common.utils import test_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
|
||||
@ -37,7 +38,9 @@ class PortsAdminExtendedAttrsTestJSON(base.BaseAdminNetworkTest):
|
||||
"binding:host_id": self.host_id}
|
||||
body = self.admin_ports_client.create_port(**post_body)
|
||||
port = body['port']
|
||||
self.addCleanup(self.admin_ports_client.delete_port, port['id'])
|
||||
self.addCleanup(
|
||||
test_utils.call_and_ignore_notfound_exc,
|
||||
self.admin_ports_client.delete_port, port['id'])
|
||||
host_id = port['binding:host_id']
|
||||
self.assertIsNotNone(host_id)
|
||||
self.assertEqual(self.host_id, host_id)
|
||||
@ -47,7 +50,9 @@ class PortsAdminExtendedAttrsTestJSON(base.BaseAdminNetworkTest):
|
||||
post_body = {"network_id": self.network['id']}
|
||||
body = self.admin_ports_client.create_port(**post_body)
|
||||
port = body['port']
|
||||
self.addCleanup(self.admin_ports_client.delete_port, port['id'])
|
||||
self.addCleanup(
|
||||
test_utils.call_and_ignore_notfound_exc,
|
||||
self.admin_ports_client.delete_port, port['id'])
|
||||
update_body = {"binding:host_id": self.host_id}
|
||||
body = self.admin_ports_client.update_port(port['id'], **update_body)
|
||||
updated_port = body['port']
|
||||
@ -61,7 +66,9 @@ class PortsAdminExtendedAttrsTestJSON(base.BaseAdminNetworkTest):
|
||||
post_body = {"network_id": self.network['id']}
|
||||
body = self.admin_ports_client.create_port(**post_body)
|
||||
port = body['port']
|
||||
self.addCleanup(self.admin_ports_client.delete_port, port['id'])
|
||||
self.addCleanup(
|
||||
test_utils.call_and_ignore_notfound_exc,
|
||||
self.admin_ports_client.delete_port, port['id'])
|
||||
|
||||
# Update the port's binding attributes so that is now 'bound'
|
||||
# to a host
|
||||
@ -85,7 +92,8 @@ class PortsAdminExtendedAttrsTestJSON(base.BaseAdminNetworkTest):
|
||||
body = self.admin_ports_client.create_port(
|
||||
network_id=self.network['id'])
|
||||
port = body['port']
|
||||
self.addCleanup(self.admin_ports_client.delete_port, port['id'])
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.admin_ports_client.delete_port, port['id'])
|
||||
body = self.admin_ports_client.show_port(port['id'])
|
||||
show_port = body['port']
|
||||
self.assertEqual(port['binding:host_id'],
|
||||
|
@ -20,6 +20,7 @@ from tempest.common import identity
|
||||
from tempest.common import utils
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib.common.utils import test_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
CONF = config.CONF
|
||||
@ -38,7 +39,8 @@ class RoutersAdminTest(base.BaseAdminNetworkTest):
|
||||
# associate a cleanup with created routers to avoid quota limits
|
||||
router = self.create_router(name, admin_state_up,
|
||||
external_network_id, enable_snat)
|
||||
self.addCleanup(self._cleanup_router, router)
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self._cleanup_router, router)
|
||||
return router
|
||||
|
||||
@classmethod
|
||||
@ -62,7 +64,8 @@ class RoutersAdminTest(base.BaseAdminNetworkTest):
|
||||
name = data_utils.rand_name('router-')
|
||||
create_body = self.admin_routers_client.create_router(
|
||||
name=name, tenant_id=project_id)
|
||||
self.addCleanup(self.admin_routers_client.delete_router,
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.admin_routers_client.delete_router,
|
||||
create_body['router']['id'])
|
||||
self.assertEqual(project_id, create_body['router']['tenant_id'])
|
||||
|
||||
@ -92,7 +95,8 @@ class RoutersAdminTest(base.BaseAdminNetworkTest):
|
||||
'enable_snat': enable_snat}
|
||||
create_body = self.admin_routers_client.create_router(
|
||||
name=name, external_gateway_info=external_gateway_info)
|
||||
self.addCleanup(self.admin_routers_client.delete_router,
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.admin_routers_client.delete_router,
|
||||
create_body['router']['id'])
|
||||
# Verify snat attributes after router creation
|
||||
self._verify_router_gateway(create_body['router']['id'],
|
||||
|
@ -18,6 +18,7 @@ import testtools
|
||||
from tempest.api.network import base
|
||||
from tempest.common import utils
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib.common.utils import test_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
|
||||
@ -62,7 +63,8 @@ class RoutersTestDVR(base.BaseAdminNetworkTest):
|
||||
name = data_utils.rand_name('router')
|
||||
router = self.admin_routers_client.create_router(name=name,
|
||||
distributed=True)
|
||||
self.addCleanup(self.admin_routers_client.delete_router,
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.admin_routers_client.delete_router,
|
||||
router['router']['id'])
|
||||
self.assertTrue(router['router']['distributed'])
|
||||
|
||||
@ -82,7 +84,8 @@ class RoutersTestDVR(base.BaseAdminNetworkTest):
|
||||
name = data_utils.rand_name('router')
|
||||
router = self.admin_routers_client.create_router(name=name,
|
||||
distributed=False)
|
||||
self.addCleanup(self.admin_routers_client.delete_router,
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.admin_routers_client.delete_router,
|
||||
router['router']['id'])
|
||||
self.assertFalse(router['router']['distributed'])
|
||||
|
||||
@ -112,8 +115,8 @@ class RoutersTestDVR(base.BaseAdminNetworkTest):
|
||||
ha=False,
|
||||
tenant_id=tenant_id)
|
||||
router_id = router['router']['id']
|
||||
self.addCleanup(self.admin_routers_client.delete_router,
|
||||
router_id)
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.admin_routers_client.delete_router, router_id)
|
||||
self.assertFalse(router['router']['distributed'])
|
||||
router = self.admin_routers_client.update_router(
|
||||
router_id, distributed=True)
|
||||
|
@ -18,6 +18,7 @@ import testtools
|
||||
from tempest.api.network import base
|
||||
from tempest.common import utils
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import test_utils
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
|
||||
@ -42,7 +43,8 @@ class RoutersAdminNegativeTest(base.BaseAdminNetworkTest):
|
||||
# At first create a address from public_network_id
|
||||
port = self.admin_ports_client.create_port(
|
||||
network_id=CONF.network.public_network_id)['port']
|
||||
self.addCleanup(self.admin_ports_client.delete_port,
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.admin_ports_client.delete_port,
|
||||
port_id=port['id'])
|
||||
# Add used ip and subnet_id in external_fixed_ips
|
||||
fixed_ip = {
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
from tempest.api.network import base
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib.common.utils import test_utils
|
||||
|
||||
|
||||
class BaseSecGroupTest(base.BaseNetworkTest):
|
||||
@ -24,7 +25,8 @@ class BaseSecGroupTest(base.BaseNetworkTest):
|
||||
name = data_utils.rand_name('secgroup-')
|
||||
group_create_body = (
|
||||
self.security_groups_client.create_security_group(name=name))
|
||||
self.addCleanup(self._delete_security_group,
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self._delete_security_group,
|
||||
group_create_body['security_group']['id'])
|
||||
self.assertEqual(group_create_body['security_group']['name'], name)
|
||||
return group_create_body, name
|
||||
|
@ -17,6 +17,7 @@ import six
|
||||
|
||||
from tempest.api.network import base
|
||||
from tempest.common import utils
|
||||
from tempest.lib.common.utils import test_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
|
||||
@ -62,7 +63,8 @@ class AllowedAddressPairTestJSON(base.BaseNetworkTest):
|
||||
network_id=self.network['id'],
|
||||
allowed_address_pairs=allowed_address_pairs)
|
||||
port_id = body['port']['id']
|
||||
self.addCleanup(self.ports_client.delete_port, port_id)
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.ports_client.delete_port, port_id)
|
||||
|
||||
# Confirm port was created with allowed address pair attribute
|
||||
body = self.ports_client.list_ports()
|
||||
@ -76,7 +78,8 @@ class AllowedAddressPairTestJSON(base.BaseNetworkTest):
|
||||
# Create a port without allowed address pair
|
||||
body = self.ports_client.create_port(network_id=self.network['id'])
|
||||
port_id = body['port']['id']
|
||||
self.addCleanup(self.ports_client.delete_port, port_id)
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.ports_client.delete_port, port_id)
|
||||
if mac_address is None:
|
||||
mac_address = self.mac_address
|
||||
|
||||
@ -106,7 +109,8 @@ class AllowedAddressPairTestJSON(base.BaseNetworkTest):
|
||||
# Create an ip _address and mac_address through port create
|
||||
resp = self.ports_client.create_port(network_id=self.network['id'])
|
||||
newportid = resp['port']['id']
|
||||
self.addCleanup(self.ports_client.delete_port, newportid)
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.ports_client.delete_port, newportid)
|
||||
ipaddress = resp['port']['fixed_ips'][0]['ip_address']
|
||||
macaddress = resp['port']['mac_address']
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
from tempest.api.network import base
|
||||
from tempest.common import utils
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib.common.utils import test_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
|
||||
@ -62,7 +63,8 @@ class ExtraDHCPOptionsTestJSON(base.BaseNetworkTest):
|
||||
network_id=self.network['id'],
|
||||
extra_dhcp_opts=self.extra_dhcp_opts)
|
||||
port_id = body['port']['id']
|
||||
self.addCleanup(self.ports_client.delete_port, port_id)
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.ports_client.delete_port, port_id)
|
||||
|
||||
# Confirm port created has Extra DHCP Options
|
||||
body = self.ports_client.list_ports()
|
||||
|
@ -18,6 +18,7 @@ from tempest.common import utils
|
||||
from tempest.common.utils import data_utils
|
||||
from tempest.common.utils import net_utils
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import test_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
CONF = config.CONF
|
||||
@ -77,7 +78,9 @@ class FloatingIPTestJSON(base.BaseNetworkTest):
|
||||
floating_network_id=self.ext_net_id,
|
||||
port_id=self.ports[0]['id'])
|
||||
created_floating_ip = body['floatingip']
|
||||
self.addCleanup(self.floating_ips_client.delete_floatingip,
|
||||
self.addCleanup(
|
||||
test_utils.call_and_ignore_notfound_exc,
|
||||
self.floating_ips_client.delete_floatingip,
|
||||
created_floating_ip['id'])
|
||||
self.assertIsNotNone(created_floating_ip['id'])
|
||||
self.assertIsNotNone(created_floating_ip['tenant_id'])
|
||||
@ -125,13 +128,18 @@ class FloatingIPTestJSON(base.BaseNetworkTest):
|
||||
self.assertIsNone(updated_floating_ip['fixed_ip_address'])
|
||||
self.assertIsNone(updated_floating_ip['router_id'])
|
||||
|
||||
# Explicity test deletion of floating IP
|
||||
self.floating_ips_client.delete_floatingip(created_floating_ip['id'])
|
||||
|
||||
@decorators.idempotent_id('e1f6bffd-442f-4668-b30e-df13f2705e77')
|
||||
def test_floating_ip_delete_port(self):
|
||||
# Create a floating IP
|
||||
body = self.floating_ips_client.create_floatingip(
|
||||
floating_network_id=self.ext_net_id)
|
||||
created_floating_ip = body['floatingip']
|
||||
self.addCleanup(self.floating_ips_client.delete_floatingip,
|
||||
self.addCleanup(
|
||||
test_utils.call_and_ignore_notfound_exc,
|
||||
self.floating_ips_client.delete_floatingip,
|
||||
created_floating_ip['id'])
|
||||
# Create a port
|
||||
port = self.ports_client.create_port(network_id=self.network['id'])
|
||||
@ -158,23 +166,35 @@ class FloatingIPTestJSON(base.BaseNetworkTest):
|
||||
floating_network_id=self.ext_net_id,
|
||||
port_id=self.ports[1]['id'])
|
||||
created_floating_ip = body['floatingip']
|
||||
self.addCleanup(self.floating_ips_client.delete_floatingip,
|
||||
self.addCleanup(
|
||||
test_utils.call_and_ignore_notfound_exc,
|
||||
self.floating_ips_client.delete_floatingip,
|
||||
created_floating_ip['id'])
|
||||
self.assertEqual(created_floating_ip['router_id'], self.router['id'])
|
||||
network_name = data_utils.rand_name(self.__class__.__name__)
|
||||
network2 = self.networks_client.create_network(
|
||||
name=network_name)['network']
|
||||
self.addCleanup(self.networks_client.delete_network,
|
||||
self.addCleanup(
|
||||
test_utils.call_and_ignore_notfound_exc,
|
||||
self.networks_client.delete_network,
|
||||
network2['id'])
|
||||
subnet2 = self.create_subnet(network2)
|
||||
self.addCleanup(self.subnets_client.delete_subnet, subnet2['id'])
|
||||
self.addCleanup(
|
||||
test_utils.call_and_ignore_notfound_exc,
|
||||
self.subnets_client.delete_subnet, subnet2['id'])
|
||||
router2 = self.create_router(external_network_id=self.ext_net_id)
|
||||
self.addCleanup(self.routers_client.delete_router, router2['id'])
|
||||
self.addCleanup(
|
||||
test_utils.call_and_ignore_notfound_exc,
|
||||
self.routers_client.delete_router, router2['id'])
|
||||
self.create_router_interface(router2['id'], subnet2['id'])
|
||||
self.addCleanup(self.routers_client.remove_router_interface,
|
||||
self.addCleanup(
|
||||
test_utils.call_and_ignore_notfound_exc,
|
||||
self.routers_client.remove_router_interface,
|
||||
router2['id'], subnet_id=subnet2['id'])
|
||||
port_other_router = self.create_port(network2)
|
||||
self.addCleanup(self.ports_client.delete_port,
|
||||
self.addCleanup(
|
||||
test_utils.call_and_ignore_notfound_exc,
|
||||
self.ports_client.delete_port,
|
||||
port_other_router['id'])
|
||||
# Associate floating IP to the other port on another router
|
||||
floating_ip = self.floating_ips_client.update_floatingip(
|
||||
@ -194,7 +214,9 @@ class FloatingIPTestJSON(base.BaseNetworkTest):
|
||||
port_id=self.ports[1]['id'],
|
||||
fixed_ip_address=self.ports[1]['fixed_ips'][0]['ip_address'])
|
||||
created_floating_ip = body['floatingip']
|
||||
self.addCleanup(self.floating_ips_client.delete_floatingip,
|
||||
self.addCleanup(
|
||||
test_utils.call_and_ignore_notfound_exc,
|
||||
self.floating_ips_client.delete_floatingip,
|
||||
created_floating_ip['id'])
|
||||
self.assertIsNotNone(created_floating_ip['id'])
|
||||
self.assertEqual(created_floating_ip['fixed_ip_address'],
|
||||
@ -218,14 +240,16 @@ class FloatingIPTestJSON(base.BaseNetworkTest):
|
||||
body = self.ports_client.create_port(network_id=self.network['id'],
|
||||
fixed_ips=fixed_ips)
|
||||
port = body['port']
|
||||
self.addCleanup(self.ports_client.delete_port, port['id'])
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.ports_client.delete_port, port['id'])
|
||||
# Create floating ip
|
||||
body = self.floating_ips_client.create_floatingip(
|
||||
floating_network_id=self.ext_net_id,
|
||||
port_id=port['id'],
|
||||
fixed_ip_address=list_ips[0])
|
||||
floating_ip = body['floatingip']
|
||||
self.addCleanup(self.floating_ips_client.delete_floatingip,
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.floating_ips_client.delete_floatingip,
|
||||
floating_ip['id'])
|
||||
self.assertIsNotNone(floating_ip['id'])
|
||||
self.assertEqual(floating_ip['fixed_ip_address'], list_ips[0])
|
||||
|
@ -17,6 +17,7 @@
|
||||
from tempest.api.network import base
|
||||
from tempest.common import utils
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import test_utils
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
|
||||
@ -81,6 +82,7 @@ class FloatingIPNegativeTestJSON(base.BaseNetworkTest):
|
||||
floating_network_id=self.ext_net_id)
|
||||
floating_ip = body['floatingip']
|
||||
self.addCleanup(
|
||||
test_utils.call_and_ignore_notfound_exc,
|
||||
self.floating_ips_client.delete_floatingip, floating_ip['id'])
|
||||
# Associate floating IP to the other port
|
||||
self.assertRaises(
|
||||
|
@ -160,7 +160,8 @@ class NetworksTest(BaseNetworkTestResources):
|
||||
def test_create_update_delete_network_subnet(self):
|
||||
# Create a network
|
||||
network = self.create_network()
|
||||
self.addCleanup(self.networks_client.delete_network, network['id'])
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.networks_client.delete_network, network['id'])
|
||||
net_id = network['id']
|
||||
self.assertEqual('ACTIVE', network['status'])
|
||||
# Verify network update
|
||||
@ -176,6 +177,8 @@ class NetworksTest(BaseNetworkTestResources):
|
||||
body = self.subnets_client.update_subnet(subnet_id, name=new_name)
|
||||
updated_subnet = body['subnet']
|
||||
self.assertEqual(updated_subnet['name'], new_name)
|
||||
# Verify network delete
|
||||
self.networks_client.delete_network(network['id'])
|
||||
|
||||
@decorators.attr(type='smoke')
|
||||
@decorators.idempotent_id('2bf13842-c93f-4a69-83ed-717d2ec3b44e')
|
||||
@ -313,7 +316,8 @@ class NetworksTest(BaseNetworkTestResources):
|
||||
@decorators.idempotent_id('3d3852eb-3009-49ec-97ac-5ce83b73010a')
|
||||
def test_update_subnet_gw_dns_host_routes_dhcp(self):
|
||||
network = self.create_network()
|
||||
self.addCleanup(self.networks_client.delete_network, network['id'])
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.networks_client.delete_network, network['id'])
|
||||
|
||||
subnet = self.create_subnet(
|
||||
network, **self.subnet_dict(['gateway', 'host_routes',
|
||||
|
@ -23,6 +23,7 @@ from tempest.api.network import base_security_groups as sec_base
|
||||
from tempest.common import custom_matchers
|
||||
from tempest.common import utils
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib.common.utils import test_utils
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions
|
||||
|
||||
@ -52,7 +53,8 @@ class PortsTestJSON(sec_base.BaseSecGroupTest):
|
||||
def _create_subnet(self, network, gateway='',
|
||||
cidr=None, mask_bits=None, **kwargs):
|
||||
subnet = self.create_subnet(network, gateway, cidr, mask_bits)
|
||||
self.addCleanup(self.subnets_client.delete_subnet, subnet['id'])
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.subnets_client.delete_subnet, subnet['id'])
|
||||
return subnet
|
||||
|
||||
def _create_network(self, network_name=None, **kwargs):
|
||||
@ -60,7 +62,8 @@ class PortsTestJSON(sec_base.BaseSecGroupTest):
|
||||
self.__class__.__name__)
|
||||
network = self.networks_client.create_network(
|
||||
name=network_name, **kwargs)['network']
|
||||
self.addCleanup(self.networks_client.delete_network,
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.networks_client.delete_network,
|
||||
network['id'])
|
||||
return network
|
||||
|
||||
@ -116,13 +119,15 @@ class PortsTestJSON(sec_base.BaseSecGroupTest):
|
||||
mask_bits=address.prefixlen,
|
||||
**allocation_pools)
|
||||
body = self.ports_client.create_port(network_id=net_id)
|
||||
self.addCleanup(self.ports_client.delete_port, body['port']['id'])
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.ports_client.delete_port, body['port']['id'])
|
||||
port = body['port']
|
||||
ip_address = port['fixed_ips'][0]['ip_address']
|
||||
start_ip_address = allocation_pools['allocation_pools'][0]['start']
|
||||
end_ip_address = allocation_pools['allocation_pools'][0]['end']
|
||||
ip_range = netaddr.IPRange(start_ip_address, end_ip_address)
|
||||
self.assertIn(ip_address, ip_range)
|
||||
self.ports_client.delete_port(port['id'])
|
||||
|
||||
@decorators.attr(type='smoke')
|
||||
@decorators.idempotent_id('c9a685bd-e83f-499c-939f-9f7863ca259f')
|
||||
@ -168,9 +173,11 @@ class PortsTestJSON(sec_base.BaseSecGroupTest):
|
||||
self._create_subnet(network)
|
||||
# Create two ports
|
||||
port_1 = self.ports_client.create_port(network_id=network['id'])
|
||||
self.addCleanup(self.ports_client.delete_port, port_1['port']['id'])
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.ports_client.delete_port, port_1['port']['id'])
|
||||
port_2 = self.ports_client.create_port(network_id=network['id'])
|
||||
self.addCleanup(self.ports_client.delete_port, port_2['port']['id'])
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.ports_client.delete_port, port_2['port']['id'])
|
||||
# List ports filtered by fixed_ips
|
||||
port_1_fixed_ip = port_1['port']['fixed_ips'][0]['ip_address']
|
||||
fixed_ips = 'ip_address=' + port_1_fixed_ip
|
||||
@ -219,11 +226,13 @@ class PortsTestJSON(sec_base.BaseSecGroupTest):
|
||||
fixed_ips = [{'subnet_id': subnet['id'], 'ip_address': ip_address_1}]
|
||||
port_1 = self.ports_client.create_port(network_id=network['id'],
|
||||
fixed_ips=fixed_ips)
|
||||
self.addCleanup(self.ports_client.delete_port, port_1['port']['id'])
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.ports_client.delete_port, port_1['port']['id'])
|
||||
fixed_ips = [{'subnet_id': subnet['id'], 'ip_address': ip_address_2}]
|
||||
port_2 = self.ports_client.create_port(network_id=network['id'],
|
||||
fixed_ips=fixed_ips)
|
||||
self.addCleanup(self.ports_client.delete_port, port_2['port']['id'])
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.ports_client.delete_port, port_2['port']['id'])
|
||||
|
||||
# Scenario 1: List port1 (port2 is filtered out)
|
||||
if ip_address_1[:-1] != ip_address_2[:-1]:
|
||||
@ -272,12 +281,14 @@ class PortsTestJSON(sec_base.BaseSecGroupTest):
|
||||
network = self._create_network()
|
||||
self._create_subnet(network)
|
||||
router = self.create_router()
|
||||
self.addCleanup(self.routers_client.delete_router, router['id'])
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.routers_client.delete_router, router['id'])
|
||||
port = self.ports_client.create_port(network_id=network['id'])
|
||||
# Add router interface to port created above
|
||||
self.routers_client.add_router_interface(router['id'],
|
||||
port_id=port['port']['id'])
|
||||
self.addCleanup(self.routers_client.remove_router_interface,
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.routers_client.remove_router_interface,
|
||||
router['id'], port_id=port['port']['id'])
|
||||
# List ports filtered by router_id
|
||||
port_list = self.ports_client.list_ports(device_id=router['id'])
|
||||
@ -311,7 +322,8 @@ class PortsTestJSON(sec_base.BaseSecGroupTest):
|
||||
# Create a port with multiple IP addresses
|
||||
port = self.create_port(network,
|
||||
fixed_ips=fixed_ips)
|
||||
self.addCleanup(self.ports_client.delete_port, port['id'])
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.ports_client.delete_port, port['id'])
|
||||
self.assertEqual(2, len(port['fixed_ips']))
|
||||
check_fixed_ips = [subnet_1['id'], subnet_2['id']]
|
||||
for item in port['fixed_ips']:
|
||||
@ -334,7 +346,8 @@ class PortsTestJSON(sec_base.BaseSecGroupTest):
|
||||
for name in security_groups_names:
|
||||
group_create_body = sec_grps_client.create_security_group(
|
||||
name=name)
|
||||
self.addCleanup(self.security_groups_client.delete_security_group,
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.security_groups_client.delete_security_group,
|
||||
group_create_body['security_group']['id'])
|
||||
security_groups_list.append(group_create_body['security_group']
|
||||
['id'])
|
||||
@ -342,7 +355,8 @@ class PortsTestJSON(sec_base.BaseSecGroupTest):
|
||||
sec_grp_name = data_utils.rand_name('secgroup')
|
||||
security_group = sec_grps_client.create_security_group(
|
||||
name=sec_grp_name)
|
||||
self.addCleanup(self.security_groups_client.delete_security_group,
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.security_groups_client.delete_security_group,
|
||||
security_group['security_group']['id'])
|
||||
post_body = {
|
||||
"name": data_utils.rand_name('port-'),
|
||||
@ -351,7 +365,8 @@ class PortsTestJSON(sec_base.BaseSecGroupTest):
|
||||
"admin_state_up": True,
|
||||
"fixed_ips": fixed_ip_1}
|
||||
body = self.ports_client.create_port(**post_body)
|
||||
self.addCleanup(self.ports_client.delete_port, body['port']['id'])
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.ports_client.delete_port, body['port']['id'])
|
||||
port = body['port']
|
||||
|
||||
# Update the port with security groups
|
||||
@ -402,7 +417,8 @@ class PortsTestJSON(sec_base.BaseSecGroupTest):
|
||||
# Create a new port with user defined mac
|
||||
body = self.ports_client.create_port(network_id=self.network['id'],
|
||||
mac_address=free_mac_address)
|
||||
self.addCleanup(self.ports_client.delete_port, body['port']['id'])
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.ports_client.delete_port, body['port']['id'])
|
||||
port = body['port']
|
||||
body = self.ports_client.show_port(port['id'])
|
||||
show_port = body['port']
|
||||
@ -418,7 +434,8 @@ class PortsTestJSON(sec_base.BaseSecGroupTest):
|
||||
network = self._create_network()
|
||||
self._create_subnet(network)
|
||||
port = self.create_port(network, security_groups=[])
|
||||
self.addCleanup(self.ports_client.delete_port, port['id'])
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.ports_client.delete_port, port['id'])
|
||||
self.assertIsNotNone(port['security_groups'])
|
||||
self.assertEmpty(port['security_groups'])
|
||||
|
||||
|
@ -20,6 +20,7 @@ from tempest.api.network import base
|
||||
from tempest.common import utils
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib.common.utils import test_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
CONF = config.CONF
|
||||
@ -89,10 +90,11 @@ class RoutersTest(base.BaseNetworkTest):
|
||||
network_name = data_utils.rand_name(self.__class__.__name__)
|
||||
network = self.networks_client.create_network(
|
||||
name=network_name)['network']
|
||||
self.addCleanup(self.networks_client.delete_network,
|
||||
network['id'])
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.networks_client.delete_network, network['id'])
|
||||
subnet = self.create_subnet(network)
|
||||
self.addCleanup(self.subnets_client.delete_subnet, subnet['id'])
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.subnets_client.delete_subnet, subnet['id'])
|
||||
router = self.create_router()
|
||||
self.addCleanup(self.delete_router, router)
|
||||
# Add router interface with subnet id
|
||||
@ -114,8 +116,8 @@ class RoutersTest(base.BaseNetworkTest):
|
||||
network_name = data_utils.rand_name(self.__class__.__name__)
|
||||
network = self.networks_client.create_network(
|
||||
name=network_name)['network']
|
||||
self.addCleanup(self.networks_client.delete_network,
|
||||
network['id'])
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.networks_client.delete_network, network['id'])
|
||||
subnet = self.create_subnet(network)
|
||||
self.addCleanup(self.subnets_client.delete_subnet, subnet['id'])
|
||||
router = self.create_router()
|
||||
@ -126,7 +128,8 @@ class RoutersTest(base.BaseNetworkTest):
|
||||
interface = self.routers_client.add_router_interface(
|
||||
router['id'],
|
||||
port_id=port_body['port']['id'])
|
||||
self.addCleanup(self.routers_client.remove_router_interface,
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.routers_client.remove_router_interface,
|
||||
router['id'], port_id=port_body['port']['id'])
|
||||
self.assertIn('subnet_id', interface.keys())
|
||||
self.assertIn('port_id', interface.keys())
|
||||
@ -135,6 +138,8 @@ class RoutersTest(base.BaseNetworkTest):
|
||||
interface['port_id'])
|
||||
self.assertEqual(show_port_body['port']['device_id'],
|
||||
router['id'])
|
||||
self.routers_client.remove_router_interface(
|
||||
router['id'], port_id=port_body['port']['id'])
|
||||
|
||||
@decorators.idempotent_id('cbe42f84-04c2-11e7-8adb-fa163e4fa634')
|
||||
@utils.requires_ext(extension='ext-gw-mode', service='network')
|
||||
@ -160,7 +165,8 @@ class RoutersTest(base.BaseNetworkTest):
|
||||
# Create a router and set gateway to fixed_ip
|
||||
router = self.admin_routers_client.create_router(
|
||||
external_gateway_info=external_gateway_info)['router']
|
||||
self.addCleanup(self.admin_routers_client.delete_router,
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.admin_routers_client.delete_router,
|
||||
router_id=router['id'])
|
||||
# Examine router's gateway is equal to fixed_ip
|
||||
self.assertEqual(router['external_gateway_info'][
|
||||
@ -188,10 +194,12 @@ class RoutersTest(base.BaseNetworkTest):
|
||||
network_name = data_utils.rand_name(self.__class__.__name__)
|
||||
network = self.networks_client.create_network(
|
||||
name=network_name)['network']
|
||||
self.addCleanup(self.networks_client.delete_network,
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.networks_client.delete_network,
|
||||
network['id'])
|
||||
subnet = self.create_subnet(network, cidr=next_cidr)
|
||||
self.addCleanup(self.subnets_client.delete_subnet, subnet['id'])
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.subnets_client.delete_subnet, subnet['id'])
|
||||
next_cidr = next_cidr.next()
|
||||
|
||||
# Add router interface with subnet id
|
||||
@ -254,18 +262,20 @@ class RoutersTest(base.BaseNetworkTest):
|
||||
network_name = data_utils.rand_name(self.__class__.__name__)
|
||||
network01 = self.networks_client.create_network(
|
||||
name=network_name)['network']
|
||||
self.addCleanup(self.networks_client.delete_network,
|
||||
network01['id'])
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.networks_client.delete_network, network01['id'])
|
||||
network_name = data_utils.rand_name(self.__class__.__name__)
|
||||
network02 = self.networks_client.create_network(
|
||||
name=network_name)['network']
|
||||
self.addCleanup(self.networks_client.delete_network,
|
||||
network02['id'])
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.networks_client.delete_network, network02['id'])
|
||||
subnet01 = self.create_subnet(network01)
|
||||
self.addCleanup(self.subnets_client.delete_subnet, subnet01['id'])
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.subnets_client.delete_subnet, subnet01['id'])
|
||||
sub02_cidr = self.cidr.next()
|
||||
subnet02 = self.create_subnet(network02, cidr=sub02_cidr)
|
||||
self.addCleanup(self.subnets_client.delete_subnet, subnet02['id'])
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.subnets_client.delete_subnet, subnet02['id'])
|
||||
router = self.create_router()
|
||||
self.addCleanup(self.delete_router, router)
|
||||
interface01 = self._add_router_interface_with_subnet_id(router['id'],
|
||||
@ -282,10 +292,11 @@ class RoutersTest(base.BaseNetworkTest):
|
||||
network_name = data_utils.rand_name(self.__class__.__name__)
|
||||
network = self.networks_client.create_network(
|
||||
name=network_name)['network']
|
||||
self.addCleanup(self.networks_client.delete_network,
|
||||
network['id'])
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.networks_client.delete_network, network['id'])
|
||||
subnet = self.create_subnet(network)
|
||||
self.addCleanup(self.subnets_client.delete_subnet, subnet['id'])
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.subnets_client.delete_subnet, subnet['id'])
|
||||
router = self.create_router()
|
||||
self.addCleanup(self.delete_router, router)
|
||||
fixed_ip = [{'subnet_id': subnet['id']}]
|
||||
|
@ -16,6 +16,7 @@
|
||||
from tempest.api.network import base_security_groups as base
|
||||
from tempest.common import utils
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib.common.utils import test_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
|
||||
@ -49,8 +50,8 @@ class SecGroupTest(base.BaseSecGroupTest):
|
||||
)
|
||||
|
||||
sec_group_rule = rule_create_body['security_group_rule']
|
||||
self.addCleanup(self._delete_security_group_rule,
|
||||
sec_group_rule['id'])
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self._delete_security_group_rule, sec_group_rule['id'])
|
||||
|
||||
expected = {'direction': direction, 'protocol': protocol,
|
||||
'ethertype': ethertype, 'port_range_min': port_range_min,
|
||||
@ -104,6 +105,8 @@ class SecGroupTest(base.BaseSecGroupTest):
|
||||
self.assertEqual(show_body['security_group']['name'], new_name)
|
||||
self.assertEqual(show_body['security_group']['description'],
|
||||
new_description)
|
||||
# Delete security group
|
||||
self._delete_security_group(group_create_body['security_group']['id'])
|
||||
|
||||
@decorators.attr(type='smoke')
|
||||
@decorators.idempotent_id('cfb99e0e-7410-4a3d-8a0c-959a63ee77e9')
|
||||
@ -138,6 +141,8 @@ class SecGroupTest(base.BaseSecGroupTest):
|
||||
for rule in rule_list_body['security_group_rules']]
|
||||
self.assertIn(rule_create_body['security_group_rule']['id'],
|
||||
rule_list)
|
||||
self._delete_security_group_rule(
|
||||
rule_create_body['security_group_rule']['id'])
|
||||
|
||||
@decorators.idempotent_id('87dfbcf9-1849-43ea-b1e4-efa3eeae9f71')
|
||||
def test_create_security_group_rule_with_additional_args(self):
|
||||
|
Loading…
Reference in New Issue
Block a user