Add case for router east west traffic
In order to avoid unexpected regression, this patch adds one test case for router east west traffic. Change-Id: I695e833ccedddafaf9f5b7ccbd4831f02efde733
This commit is contained in:
parent
cbec36256a
commit
68ab245db7
@ -238,21 +238,24 @@ class BaseTempestTestCase(base_api.BaseNetworkTest):
|
||||
LOG.debug("Server %s disappeared(deleted) while looking "
|
||||
"for the console log", server['id'])
|
||||
|
||||
def _check_remote_connectivity(self, source, dest, should_succeed=True,
|
||||
def _check_remote_connectivity(self, source, dest, count,
|
||||
should_succeed=True,
|
||||
nic=None, mtu=None, fragmentation=True,
|
||||
timeout=None):
|
||||
"""check ping server via source ssh connection
|
||||
|
||||
:param source: RemoteClient: an ssh connection from which to ping
|
||||
:param dest: and IP to ping against
|
||||
:param count: Number of ping packet(s) to send
|
||||
:param should_succeed: boolean should ping succeed or not
|
||||
:param nic: specific network interface to ping from
|
||||
:param mtu: mtu size for the packet to be sent
|
||||
:param fragmentation: Flag for packet fragmentation
|
||||
:param timeout: Timeout for all ping packet(s) to succeed
|
||||
:returns: boolean -- should_succeed == ping
|
||||
:returns: ping is false if ping failed
|
||||
"""
|
||||
def ping_host(source, host, count=CONF.validation.ping_count,
|
||||
def ping_host(source, host, count,
|
||||
size=CONF.validation.ping_size, nic=None, mtu=None,
|
||||
fragmentation=True):
|
||||
IP_VERSION_4 = neutron_lib_constants.IP_VERSION_4
|
||||
@ -275,7 +278,7 @@ class BaseTempestTestCase(base_api.BaseNetworkTest):
|
||||
|
||||
def ping_remote():
|
||||
try:
|
||||
result = ping_host(source, dest, nic=nic, mtu=mtu,
|
||||
result = ping_host(source, dest, count, nic=nic, mtu=mtu,
|
||||
fragmentation=fragmentation)
|
||||
|
||||
except lib_exc.SSHExecCommandFailed:
|
||||
@ -296,10 +299,12 @@ class BaseTempestTestCase(base_api.BaseNetworkTest):
|
||||
|
||||
def check_remote_connectivity(self, source, dest, should_succeed=True,
|
||||
nic=None, mtu=None, fragmentation=True,
|
||||
servers=None, timeout=None):
|
||||
servers=None, timeout=None,
|
||||
ping_count=CONF.validation.ping_count):
|
||||
try:
|
||||
self.assertTrue(self._check_remote_connectivity(
|
||||
source, dest, should_succeed, nic, mtu, fragmentation,
|
||||
source, dest, ping_count, should_succeed, nic, mtu,
|
||||
fragmentation,
|
||||
timeout=timeout))
|
||||
except lib_exc.SSHTimeout as ssh_e:
|
||||
LOG.debug(ssh_e)
|
||||
|
@ -109,3 +109,40 @@ class NetworkConnectivityTest(base.BaseTempestTestCase):
|
||||
|
||||
self.check_remote_connectivity(
|
||||
ap1_sshclient, ap2_internal_port['fixed_ips'][0]['ip_address'])
|
||||
|
||||
@decorators.idempotent_id('b72c3b77-3396-4144-b05d-9cd3c0099893')
|
||||
def test_connectivity_router_east_west_traffic(self):
|
||||
"""This case is intended to test router east west taffic
|
||||
|
||||
The case can be used in various scenarios: legacy/distributed router,
|
||||
same/different host.
|
||||
"""
|
||||
net_1 = self.create_network()
|
||||
net_2 = self.create_network()
|
||||
subnet_1 = self.create_subnet(net_1, cidr="10.10.1.0/24")
|
||||
subnet_2 = self.create_subnet(net_2, cidr="10.10.2.0/24")
|
||||
|
||||
router = self.create_router(
|
||||
router_name=data_utils.rand_name("east_west_traffic_router"),
|
||||
admin_state_up=True,
|
||||
external_network_id=CONF.network.public_network_id)
|
||||
|
||||
internal_port_1 = self.create_port(
|
||||
net_1, security_groups=[self.secgroup['id']])
|
||||
internal_port_2 = self.create_port(
|
||||
net_2, security_groups=[self.secgroup['id']])
|
||||
|
||||
self._create_servers(internal_port_1, internal_port_2)
|
||||
|
||||
self.create_router_interface(router['id'], subnet_1['id'])
|
||||
self.create_router_interface(router['id'], subnet_2['id'])
|
||||
|
||||
fip = self.create_and_associate_floatingip(
|
||||
internal_port_1['id'])
|
||||
sshclient = ssh.Client(
|
||||
fip['floating_ip_address'], CONF.validation.image_ssh_user,
|
||||
pkey=self.keypair['private_key'])
|
||||
|
||||
self.check_remote_connectivity(
|
||||
sshclient, internal_port_2['fixed_ips'][0]['ip_address'],
|
||||
ping_count=10)
|
||||
|
Loading…
x
Reference in New Issue
Block a user