Merge "Use VM on external network in DVR ingress test"
This commit is contained in:
commit
a022d38865
@ -577,7 +577,7 @@ class BaseTempestWhiteboxTestCase(base.BaseTempestTestCase):
|
||||
|
||||
def _create_server(
|
||||
self, create_floating_ip=True, exclude_hosts=None,
|
||||
network=None, **kwargs):
|
||||
network=None, use_admin_client=False, **kwargs):
|
||||
network = network or self.network
|
||||
kwargs.setdefault('name', data_utils.rand_name('server-test'))
|
||||
kwargs['flavorRef'] = self.flavor_ref
|
||||
@ -602,7 +602,7 @@ class BaseTempestWhiteboxTestCase(base.BaseTempestTestCase):
|
||||
else:
|
||||
kwargs['host'] = self.find_different_compute_host(
|
||||
exclude_hosts)
|
||||
if kwargs.get('host'):
|
||||
if kwargs.get('host') or use_admin_client:
|
||||
servers_client = self.os_admin.servers_client
|
||||
network_client = self.os_admin.network_client
|
||||
else:
|
||||
@ -623,7 +623,7 @@ class BaseTempestWhiteboxTestCase(base.BaseTempestTestCase):
|
||||
"this list: '{}'. Can not proceed.".format(
|
||||
' '.join(exclude_hosts)))
|
||||
self.wait_for_server_active(server, client=servers_client)
|
||||
port = self.client.list_ports(
|
||||
port = network_client.list_ports(
|
||||
network_id=network['id'],
|
||||
device_id=server['id'])['ports'][0]
|
||||
if create_floating_ip:
|
||||
@ -1163,17 +1163,8 @@ class TrafficFlowTest(BaseTempestWhiteboxTestCase):
|
||||
filters += " and ip[2:2]=={} and ip dst {}".format(size, dst_ip)
|
||||
|
||||
self._start_captures(filters)
|
||||
# if the host is localhost, don't use remote connectivity,
|
||||
# ping directly on the host
|
||||
if ssh_client.host in (
|
||||
'localhost', '127.0.0.1', '0:0:0:0:0:0:0:1', '::1'):
|
||||
self.ping_ip_address(dst_ip, mtu=size, should_succeed=True)
|
||||
# tcpdump requires a delay between capturing packets and writing
|
||||
# them to its file.
|
||||
time.sleep(2)
|
||||
else:
|
||||
self.check_remote_connectivity(
|
||||
ssh_client, dst_ip, mtu=size, ping_count=2)
|
||||
self.check_remote_connectivity(
|
||||
ssh_client, dst_ip, mtu=size, ping_count=2)
|
||||
self._stop_captures()
|
||||
LOG.debug('Expected routing nodes: {}'.format(expected_routing_nodes))
|
||||
actual_routing_nodes = [node['name']
|
||||
|
@ -30,6 +30,7 @@ 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
|
||||
from tempest.lib import exceptions as lib_exceptions
|
||||
|
||||
from whitebox_neutron_tempest_plugin.common import utils as local_utils
|
||||
from whitebox_neutron_tempest_plugin.tests.scenario import base
|
||||
@ -213,18 +214,47 @@ class OvnDvrTest(OvnDvrBase):
|
||||
7. Restart the server and verify that routing has not changed
|
||||
|
||||
"""
|
||||
# will the pings be send from self.proxy_host_client or from localhost?
|
||||
if not WB_CONF.bgp:
|
||||
ssh_local_client = self.proxy_host_client
|
||||
else:
|
||||
ssh_local_client = self.get_local_ssh_client()
|
||||
def _get_extra_parameters():
|
||||
ssh_client = None
|
||||
expected_routing_nodes = [self.compute]
|
||||
try:
|
||||
self.proxy_host_client.exec_command(
|
||||
"ping -c 10 -W2 -s56 {}".format(
|
||||
self.server['fip']['floating_ip_address']))
|
||||
ssh_client = self.proxy_host_client
|
||||
except lib_exceptions.SSHExecCommandFailed:
|
||||
# In case VM under test is not responding from the proxy host
|
||||
# this means that there is a limitation of the environment and
|
||||
# as a fallback scenario we create an additional VM
|
||||
# (on external network) that we'll use for pinging the VM under
|
||||
# test.
|
||||
LOG.debug(
|
||||
"VM is not pingable from the proxy host. "
|
||||
"Creating a VM on external_network to complete "
|
||||
"the required setup.")
|
||||
self.external_network = self.client.show_network(
|
||||
CONF.network.public_network_id)['network']
|
||||
ext_vm = self._create_server(
|
||||
network=self.external_network,
|
||||
create_floating_ip=False,
|
||||
use_admin_client=True)
|
||||
self.ext_vm_ssh_client = ssh.Client(
|
||||
ext_vm['port']['fixed_ips'][0]['ip_address'],
|
||||
self.username, pkey=self.keypair['private_key'])
|
||||
ssh_client = self.ext_vm_ssh_client
|
||||
ext_vm_host = self.get_host_for_server(ext_vm['server']['id'])
|
||||
# expected_routing_nodes should not have duplicates
|
||||
expected_routing_nodes = list(set([self.compute, ext_vm_host]))
|
||||
return ssh_client, expected_routing_nodes
|
||||
|
||||
self._setup()
|
||||
ssh_client, expected_routing_nodes = _get_extra_parameters()
|
||||
|
||||
self.check_north_south_icmp_flow(
|
||||
dst_ip=self.server['fip']['floating_ip_address'],
|
||||
expected_routing_nodes=[self.compute],
|
||||
expected_routing_nodes=expected_routing_nodes,
|
||||
expected_mac=self.fip_port_mac,
|
||||
ssh_client=ssh_local_client)
|
||||
ssh_client=ssh_client)
|
||||
|
||||
# Delete fip
|
||||
LOG.debug('Deleting floating ip')
|
||||
@ -239,9 +269,9 @@ class OvnDvrTest(OvnDvrBase):
|
||||
fip_port_mac = self.get_fip_port_details(fip)['mac_address']
|
||||
self.check_north_south_icmp_flow(
|
||||
dst_ip=fip['floating_ip_address'],
|
||||
expected_routing_nodes=[self.compute],
|
||||
expected_routing_nodes=expected_routing_nodes,
|
||||
expected_mac=fip_port_mac,
|
||||
ssh_client=ssh_local_client)
|
||||
ssh_client=ssh_client)
|
||||
|
||||
# Reboot the server and make sure that routing is still via compute.
|
||||
LOG.debug('Rebooting vm')
|
||||
@ -252,9 +282,9 @@ class OvnDvrTest(OvnDvrBase):
|
||||
neutron_constants.SERVER_STATUS_ACTIVE)
|
||||
self.check_north_south_icmp_flow(
|
||||
dst_ip=fip['floating_ip_address'],
|
||||
expected_routing_nodes=[self.compute],
|
||||
expected_routing_nodes=expected_routing_nodes,
|
||||
expected_mac=fip_port_mac,
|
||||
ssh_client=ssh_local_client)
|
||||
ssh_client=ssh_client)
|
||||
|
||||
@decorators.idempotent_id('0fcf9f97-6368-4c5d-a5f5-ff8a7643e3b6')
|
||||
def test_validate_fip2fip_compute(self):
|
||||
|
Loading…
Reference in New Issue
Block a user