aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--yardstick/benchmark/scenarios/networking/vnf_generic.py13
-rw-r--r--yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py41
2 files changed, 31 insertions, 23 deletions
diff --git a/yardstick/benchmark/scenarios/networking/vnf_generic.py b/yardstick/benchmark/scenarios/networking/vnf_generic.py
index ada92121b..f381186de 100644
--- a/yardstick/benchmark/scenarios/networking/vnf_generic.py
+++ b/yardstick/benchmark/scenarios/networking/vnf_generic.py
@@ -62,10 +62,11 @@ class IncorrectSetup(Exception):
class SshManager(object):
- def __init__(self, node):
+ def __init__(self, node, timeout=120):
super(SshManager, self).__init__()
self.node = node
self.conn = None
+ self.timeout = timeout
def __enter__(self):
"""
@@ -74,7 +75,7 @@ class SshManager(object):
"""
try:
self.conn = ssh.SSH.from_node(self.node)
- self.conn.wait()
+ self.conn.wait(timeout=self.timeout)
except SSHError as error:
LOG.info("connect failed to %s, due to %s", self.node["ip"], error)
# self.conn defaults to None
@@ -336,7 +337,7 @@ class NetworkServiceTestCase(base.Scenario):
netdevs = {}
cmd = "PATH=$PATH:/sbin:/usr/sbin ip addr show"
- with SshManager(node_dict) as conn:
+ with SshManager(node_dict, timeout=timeout) as conn:
if conn:
exit_status = conn.execute(cmd)[0]
if exit_status != 0:
@@ -373,6 +374,10 @@ class NetworkServiceTestCase(base.Scenario):
:return: None. Side effect: context_cfg is updated
"""
+ num_nodes = len(self.context_cfg["nodes"])
+ # OpenStack instance creation time is probably proportional to the number
+ # of instances
+ timeout = 120 * num_nodes
for node, node_dict in self.context_cfg["nodes"].items():
for network in node_dict["interfaces"].values():
@@ -383,7 +388,7 @@ class NetworkServiceTestCase(base.Scenario):
# only ssh probe if there are missing values
# ssh probe won't work on Ixia, so we had better define all our values
try:
- netdevs = self._probe_netdevs(node, node_dict)
+ netdevs = self._probe_netdevs(node, node_dict, timeout=timeout)
except (SSHError, SSHTimeout):
raise IncorrectConfig(
"Unable to probe missing interface fields '%s', on node %s "
diff --git a/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py b/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py
index 93e496969..1b2efe34b 100644
--- a/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py
+++ b/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py
@@ -60,6 +60,7 @@ class IxiaResourceHelper(ClientResourceHelper):
self.rfc_helper = rfc_helper_type(self.scenario_helper)
self.priv_ports = None
self.pub_ports = None
+ self._connect()
def _connect(self, client=None):
self.client._connect(self.vnfd_helper)
@@ -68,8 +69,8 @@ class IxiaResourceHelper(ClientResourceHelper):
return self.client.ix_get_statistics()
def stop_collect(self):
- self._terminated.value = 0
- if self.client and self.client.ixnet:
+ self._terminated.value = 1
+ if self.client:
self.client.ix_stop_traffic()
def generate_samples(self, ports, key=None, default=None):
@@ -117,7 +118,6 @@ class IxiaResourceHelper(ClientResourceHelper):
default = "00:00:00:00:00:00"
self._build_ports()
- self._connect()
# we don't know client_file_name until runtime as instantiate
client_file_name = \
@@ -142,24 +142,27 @@ class IxiaResourceHelper(ClientResourceHelper):
ixia_file = find_relative_file("ixia_traffic.cfg",
self.scenario_helper.scenario_cfg["task_path"])
# Generate ixia traffic config...
- while not self._terminated.value:
- traffic_profile.execute_traffic(self, self.client, mac, ixia_file)
- self.client_started.value = 1
- time.sleep(WAIT_FOR_TRAFFIC)
+ try:
+ while not self._terminated.value:
+ traffic_profile.execute(self, self.client, mac, ixia_file)
+ self.client_started.value = 1
+ time.sleep(WAIT_FOR_TRAFFIC)
+ self.client.ix_stop_traffic()
+ samples = self.generate_samples()
+ self._queue.put(samples)
+ status, samples = traffic_profile.get_drop_percentage(self, samples, min_tol,
+ max_tol, self.client, mac,
+ ixia_file)
+
+ current = samples['CurrentDropPercentage']
+ if min_tol <= current <= max_tol or status == 'Completed':
+ self._terminated.value = 1
+
self.client.ix_stop_traffic()
- samples = self.generate_samples(traffic_profile.ports)
self._queue.put(samples)
- status, samples = traffic_profile.get_drop_percentage(self, samples, min_tol,
- max_tol, self.client, mac,
- ixia_file)
-
- current = samples['CurrentDropPercentage']
- if min_tol <= current <= max_tol or status == 'Completed' or \
- self.rfc_helper.is_done():
- break
-
- self.client.ix_stop_traffic()
- self._queue.put(samples)
+ except Exception:
+ LOG.info("Run Traffic terminated")
+ pass
if not self.rfc_helper.is_done():
self._terminated.value = 1