Add methods to perform background iperf3 tests by various topologies
Those tests can be for now performed in the Tripleo and Podified topologies. For the podified topology it can be run only from VM to VM as running iperf3 client in the POD is not yet implemented. Related: #TOBIKO-128 Change-Id: I42a10082715468689cd74fed02f4d89299f2f9b5
This commit is contained in:
parent
9a0cd1d012
commit
29c6578172
@ -0,0 +1,12 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Added support for running ``iperf3`` client and server in background. Iperf3
|
||||
client can be run in guest VM is ``ssh_client`` object is provided or
|
||||
locally on the machine where Tobiko is run.
|
||||
Added two new config options for the RHOSO topologies:
|
||||
|
||||
* ``max_traffic_break_allowed`` - to specify longest allowed single break
|
||||
in the traffic tested with iperf3,
|
||||
* ``max_total_breaks_allowed`` - to specify total allowed breaks time
|
||||
in the traffic tested with iperf3.
|
@ -654,6 +654,16 @@ class OpenStackTopology(tobiko.SharedFixture):
|
||||
tobiko.skip_test("Background ping not supported by "
|
||||
"this topology class.")
|
||||
|
||||
def check_or_start_background_iperf_connection(
|
||||
self,
|
||||
server_ip: typing.Union[str, netaddr.IPAddress], # noqa; pylint: disable=W0613
|
||||
port: int, # noqa; pylint: disable=W0613
|
||||
protocol: str, # noqa; pylint: disable=W0613
|
||||
ssh_client: ssh.SSHClientType = None, # noqa; pylint: disable=W0613
|
||||
iperf3_server_ssh_client: ssh.SSHClientType = None): # noqa; pylint: disable=W0613
|
||||
tobiko.skip_test("Background iperf not supported by "
|
||||
"this topology class.")
|
||||
|
||||
|
||||
def get_openstack_topology(topology_class: typing.Type = None) -> \
|
||||
OpenStackTopology:
|
||||
|
@ -15,6 +15,7 @@ from __future__ import absolute_import
|
||||
|
||||
import typing
|
||||
|
||||
import netaddr
|
||||
from oslo_log import log
|
||||
|
||||
import tobiko
|
||||
@ -24,6 +25,7 @@ from tobiko.podified import _edpm
|
||||
from tobiko.podified import _openshift
|
||||
from tobiko.podified import containers
|
||||
from tobiko import rhosp
|
||||
from tobiko.shell import iperf3
|
||||
from tobiko.shell import sh
|
||||
from tobiko.shell import ssh
|
||||
|
||||
@ -179,6 +181,29 @@ class PodifiedTopology(rhosp.RhospTopology):
|
||||
server_ip=server_ip
|
||||
)
|
||||
|
||||
def check_or_start_background_iperf_connection(
|
||||
self,
|
||||
server_ip: typing.Union[str, netaddr.IPAddress],
|
||||
port: int,
|
||||
protocol: str,
|
||||
ssh_client: ssh.SSHClientType = None,
|
||||
iperf3_server_ssh_client: ssh.SSHClientType = None):
|
||||
|
||||
if not ssh_client:
|
||||
LOG.debug("Running iperf3 client in the POD is "
|
||||
"implemented yet.")
|
||||
else:
|
||||
sh.check_or_start_external_process(
|
||||
start_function=iperf3.execute_iperf3_client_in_background,
|
||||
check_function=iperf3.check_iperf3_client_results,
|
||||
liveness_function=iperf3.iperf3_client_alive,
|
||||
stop_function=iperf3.stop_iperf3_client,
|
||||
address=server_ip,
|
||||
port=port,
|
||||
protocol=protocol,
|
||||
ssh_client=ssh_client,
|
||||
iperf3_server_ssh_client=iperf3_server_ssh_client)
|
||||
|
||||
|
||||
class EdpmNode(rhosp.RhospNode):
|
||||
|
||||
|
@ -198,6 +198,30 @@ class TripleoTopology(rhosp.RhospTopology):
|
||||
else:
|
||||
tripleo_nova.check_or_start_background_vm_ping(server_ip)
|
||||
|
||||
def check_or_start_background_iperf_connection(
|
||||
self,
|
||||
server_ip: typing.Union[str, netaddr.IPAddress],
|
||||
port: int,
|
||||
protocol: str,
|
||||
ssh_client: ssh.SSHClientType = None,
|
||||
iperf3_server_ssh_client: ssh.SSHClientType = None):
|
||||
|
||||
if (not ssh_client and
|
||||
CONF.tobiko.tripleo.run_background_services_in_pod):
|
||||
# this fails if `oc` (openshift client) is not available
|
||||
# so, if `run_background_services_in_pod` is true, make sure `oc`
|
||||
# is available
|
||||
# _openshift.check_or_start_tobiko_iperf_command(server_ip)
|
||||
LOG.debug("Running iperf3 client in the POD is not "
|
||||
"implemented yet")
|
||||
else:
|
||||
tripleo_nova.check_or_start_background_iperf_connection(
|
||||
server_ip=server_ip,
|
||||
port=port,
|
||||
protocol=protocol,
|
||||
ssh_client=ssh_client,
|
||||
iperf3_server_ssh_client=iperf3_server_ssh_client)
|
||||
|
||||
|
||||
class TripleoTopologyNode(rhosp.RhospNode):
|
||||
|
||||
|
@ -5,13 +5,16 @@ import typing # noqa
|
||||
from functools import wraps
|
||||
|
||||
|
||||
import netaddr
|
||||
from oslo_log import log
|
||||
import pandas
|
||||
|
||||
import tobiko
|
||||
from tobiko.tripleo import overcloud
|
||||
from tobiko.shell import iperf3
|
||||
from tobiko.shell import ping
|
||||
from tobiko.shell import sh
|
||||
from tobiko.shell import ssh
|
||||
from tobiko.openstack import nova
|
||||
from tobiko.openstack import topology
|
||||
from tobiko.tripleo import containers
|
||||
@ -281,3 +284,30 @@ def skip_background_vm_ping_checks_when_nondvr(server_ip):
|
||||
func(*args, **kwargs)
|
||||
return wrapper
|
||||
return decor
|
||||
|
||||
|
||||
# Test is inteded for D/S env
|
||||
@overcloud.skip_if_missing_overcloud
|
||||
def check_or_start_background_iperf_connection(
|
||||
server_ip: typing.Union[str, netaddr.IPAddress],
|
||||
port: int,
|
||||
protocol: str,
|
||||
ssh_client: ssh.SSHClientType = None,
|
||||
iperf3_server_ssh_client: ssh.SSHClientType = None):
|
||||
"""Check if process exists, if so stop and check ping health
|
||||
if not : start a new separate iperf client process.
|
||||
Iperf server runs on the vm which is behind IP address given
|
||||
as the 'server_ip'.
|
||||
If `iperf3_server_ssh_client` is given, Tobiko will make sure
|
||||
that iperf3 server is running on the server behind this ssh_client
|
||||
"""
|
||||
sh.check_or_start_external_process(
|
||||
start_function=iperf3.execute_iperf3_client_in_background,
|
||||
check_function=iperf3.check_iperf3_client_results,
|
||||
liveness_function=iperf3.iperf3_client_alive,
|
||||
stop_function=iperf3.stop_iperf3_client,
|
||||
address=server_ip,
|
||||
port=port,
|
||||
protocol=protocol,
|
||||
ssh_client=ssh_client,
|
||||
iperf3_server_ssh_client=iperf3_server_ssh_client)
|
||||
|
Loading…
x
Reference in New Issue
Block a user