Merge "Fix tempest scenario tests"
This commit is contained in:
commit
b322615e48
@ -28,9 +28,9 @@ from six.moves.urllib import request as urllib2
|
|||||||
from tempest.common import waiters
|
from tempest.common import waiters
|
||||||
from tempest import config
|
from tempest import config
|
||||||
from tempest import exceptions
|
from tempest import exceptions
|
||||||
|
from tempest.lib.common.utils import test_utils
|
||||||
from tempest.lib import exceptions as lib_exc
|
from tempest.lib import exceptions as lib_exc
|
||||||
from tempest.scenario import manager
|
from tempest.scenario import manager
|
||||||
from tempest.scenario import network_resources as net_resources
|
|
||||||
from tempest import test
|
from tempest import test
|
||||||
|
|
||||||
from neutron_lbaas._i18n import _
|
from neutron_lbaas._i18n import _
|
||||||
@ -124,11 +124,10 @@ class BaseTestCase(manager.NetworkScenarioTest):
|
|||||||
tenant_net = None
|
tenant_net = None
|
||||||
|
|
||||||
if tenant_net:
|
if tenant_net:
|
||||||
tenant_subnet = self._list_subnets(tenant_id=self.tenant_id)[0]
|
self.subnet = self._list_subnets(tenant_id=self.tenant_id)[0]
|
||||||
self.subnet = net_resources.DeletableSubnet(
|
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||||
subnets_client=self.subnets_client,
|
self.networks_client.delete_network,
|
||||||
routers_client=self.routers_client,
|
self.subnet['id'])
|
||||||
**tenant_subnet)
|
|
||||||
self.network = tenant_net
|
self.network = tenant_net
|
||||||
else:
|
else:
|
||||||
self.network = self._get_network_by_name(
|
self.network = self._get_network_by_name(
|
||||||
@ -138,7 +137,7 @@ class BaseTestCase(manager.NetworkScenarioTest):
|
|||||||
# should instead pull a subnet id from config, which is set by
|
# should instead pull a subnet id from config, which is set by
|
||||||
# devstack/admin/etc.
|
# devstack/admin/etc.
|
||||||
subnet = self._list_subnets(network_id=self.network['id'])[0]
|
subnet = self._list_subnets(network_id=self.network['id'])[0]
|
||||||
self.subnet = net_resources.AttributeDict(subnet)
|
self.subnet = subnet
|
||||||
|
|
||||||
def _create_security_group_for_test(self):
|
def _create_security_group_for_test(self):
|
||||||
self.security_group = self._create_security_group(
|
self.security_group = self._create_security_group(
|
||||||
@ -192,8 +191,8 @@ class BaseTestCase(manager.NetworkScenarioTest):
|
|||||||
public_network_id = config.network.public_network_id
|
public_network_id = config.network.public_network_id
|
||||||
floating_ip = self.create_floating_ip(
|
floating_ip = self.create_floating_ip(
|
||||||
server, public_network_id)
|
server, public_network_id)
|
||||||
self.floating_ips[floating_ip] = server
|
self.floating_ips[floating_ip['id']] = server
|
||||||
self.server_ips[server['id']] = floating_ip.floating_ip_address
|
self.server_ips[server['id']] = floating_ip['floating_ip_address']
|
||||||
else:
|
else:
|
||||||
self.server_ips[server['id']] =\
|
self.server_ips[server['id']] =\
|
||||||
server['addresses'][net_name][0]['addr']
|
server['addresses'][net_name][0]['addr']
|
||||||
@ -320,23 +319,25 @@ class BaseTestCase(manager.NetworkScenarioTest):
|
|||||||
return self.pool
|
return self.pool
|
||||||
|
|
||||||
def _cleanup_load_balancer(self, load_balancer_id):
|
def _cleanup_load_balancer(self, load_balancer_id):
|
||||||
self.delete_wrapper(self.load_balancers_client.delete_load_balancer,
|
test_utils.call_and_ignore_notfound_exc(
|
||||||
load_balancer_id)
|
self.load_balancers_client.delete_load_balancer, load_balancer_id)
|
||||||
self._wait_for_load_balancer_status(load_balancer_id, delete=True)
|
self._wait_for_load_balancer_status(load_balancer_id, delete=True)
|
||||||
|
|
||||||
def _cleanup_listener(self, listener_id, load_balancer_id=None):
|
def _cleanup_listener(self, listener_id, load_balancer_id=None):
|
||||||
self.delete_wrapper(self.listeners_client.delete_listener, listener_id)
|
test_utils.call_and_ignore_notfound_exc(
|
||||||
|
self.listeners_client.delete_listener, listener_id)
|
||||||
if load_balancer_id:
|
if load_balancer_id:
|
||||||
self._wait_for_load_balancer_status(load_balancer_id)
|
self._wait_for_load_balancer_status(load_balancer_id)
|
||||||
|
|
||||||
def _cleanup_pool(self, pool_id, load_balancer_id=None):
|
def _cleanup_pool(self, pool_id, load_balancer_id=None):
|
||||||
self.delete_wrapper(self.pools_client.delete_pool, pool_id)
|
test_utils.call_and_ignore_notfound_exc(
|
||||||
|
self.pools_client.delete_pool, pool_id)
|
||||||
if load_balancer_id:
|
if load_balancer_id:
|
||||||
self._wait_for_load_balancer_status(load_balancer_id)
|
self._wait_for_load_balancer_status(load_balancer_id)
|
||||||
|
|
||||||
def _cleanup_health_monitor(self, hm_id, load_balancer_id=None):
|
def _cleanup_health_monitor(self, hm_id, load_balancer_id=None):
|
||||||
self.delete_wrapper(self.health_monitors_client.delete_health_monitor,
|
test_utils.call_and_ignore_notfound_exc(
|
||||||
hm_id)
|
self.health_monitors_client.delete_health_monitor, hm_id)
|
||||||
if load_balancer_id:
|
if load_balancer_id:
|
||||||
self._wait_for_load_balancer_status(load_balancer_id)
|
self._wait_for_load_balancer_status(load_balancer_id)
|
||||||
|
|
||||||
@ -375,11 +376,11 @@ class BaseTestCase(manager.NetworkScenarioTest):
|
|||||||
|
|
||||||
def _assign_floating_ip_to_lb_vip(self, lb):
|
def _assign_floating_ip_to_lb_vip(self, lb):
|
||||||
public_network_id = config.network.public_network_id
|
public_network_id = config.network.public_network_id
|
||||||
port_id = lb.vip_port_id
|
port_id = lb['vip_port_id']
|
||||||
floating_ip = self.create_floating_ip(lb, public_network_id,
|
floating_ip = self.create_floating_ip(lb, public_network_id,
|
||||||
port_id=port_id)
|
port_id=port_id)
|
||||||
self.floating_ips.setdefault(lb.id, [])
|
self.floating_ips.setdefault(lb['id'], [])
|
||||||
self.floating_ips[lb.id].append(floating_ip)
|
self.floating_ips[lb['id']].append(floating_ip)
|
||||||
# Check for floating ip status before you check load-balancer
|
# Check for floating ip status before you check load-balancer
|
||||||
self.check_floating_ip_status(floating_ip, "ACTIVE")
|
self.check_floating_ip_status(floating_ip, "ACTIVE")
|
||||||
|
|
||||||
@ -410,10 +411,9 @@ class BaseTestCase(manager.NetworkScenarioTest):
|
|||||||
if ip_version == 4:
|
if ip_version == 4:
|
||||||
if (config.network.public_network_id and not
|
if (config.network.public_network_id and not
|
||||||
config.network.project_networks_reachable):
|
config.network.project_networks_reachable):
|
||||||
load_balancer = net_resources.AttributeDict(self.load_balancer)
|
self._assign_floating_ip_to_lb_vip(self.load_balancer)
|
||||||
self._assign_floating_ip_to_lb_vip(load_balancer)
|
|
||||||
self.vip_ip = self.floating_ips[
|
self.vip_ip = self.floating_ips[
|
||||||
load_balancer.id][0]['floating_ip_address']
|
self.load_balancer['id']][0]['floating_ip_address']
|
||||||
|
|
||||||
# Currently the ovs-agent is not enforcing security groups on the
|
# Currently the ovs-agent is not enforcing security groups on the
|
||||||
# vip port - see https://bugs.launchpad.net/neutron/+bug/1163569
|
# vip port - see https://bugs.launchpad.net/neutron/+bug/1163569
|
||||||
@ -421,7 +421,7 @@ class BaseTestCase(manager.NetworkScenarioTest):
|
|||||||
# security group with a rule that allows tcp port 80 to the vip port.
|
# security group with a rule that allows tcp port 80 to the vip port.
|
||||||
self.ports_client.update_port(
|
self.ports_client.update_port(
|
||||||
self.load_balancer.get('vip_port_id'),
|
self.load_balancer.get('vip_port_id'),
|
||||||
security_groups=[self.security_group.id])
|
security_groups=[self.security_group['id']])
|
||||||
|
|
||||||
def _wait_for_load_balancer_status(self, load_balancer_id,
|
def _wait_for_load_balancer_status(self, load_balancer_id,
|
||||||
provisioning_status='ACTIVE',
|
provisioning_status='ACTIVE',
|
||||||
|
Loading…
Reference in New Issue
Block a user