aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/unit/network_services/traffic_profile/test_rfc2544.py7
-rw-r--r--yardstick/benchmark/scenarios/networking/vnf_generic.py13
-rw-r--r--yardstick/network_services/traffic_profile/rfc2544.py35
3 files changed, 28 insertions, 27 deletions
diff --git a/tests/unit/network_services/traffic_profile/test_rfc2544.py b/tests/unit/network_services/traffic_profile/test_rfc2544.py
index b63a805f3..2366b8124 100644
--- a/tests/unit/network_services/traffic_profile/test_rfc2544.py
+++ b/tests/unit/network_services/traffic_profile/test_rfc2544.py
@@ -258,9 +258,10 @@ class TestRFC2544Profile(unittest.TestCase):
def test_execute_latency(self):
traffic_generator = mock.Mock(autospec=TrexProfile)
- traffic_generator.my_ports = [0, 1]
- traffic_generator.priv_ports = [-1]
- traffic_generator.pub_ports = [1]
+ traffic_generator.networks = {
+ "private_0": ["xe0"],
+ "public_0": ["xe1"],
+ }
traffic_generator.client = \
mock.Mock(return_value=True)
r_f_c2544_profile = RFC2544Profile(self.TRAFFIC_PROFILE)
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/traffic_profile/rfc2544.py b/yardstick/network_services/traffic_profile/rfc2544.py
index 6a0ecaf99..3dc08df69 100644
--- a/yardstick/network_services/traffic_profile/rfc2544.py
+++ b/yardstick/network_services/traffic_profile/rfc2544.py
@@ -151,34 +151,29 @@ class RFC2544Profile(TrexProfile):
return samples
def execute_latency(self, generator=None, samples=None):
- if generator is None:
- generator = self.generator
+ if generator is not None and self.generator is None:
+ self.generator = generator
if samples is None:
- samples = generator.generate_samples()
+ samples = self.generator.generate_samples()
self.pps, multiplier = self.calculate_pps(samples)
self.ports = []
self.pg_id = self.params['traffic_profile'].get('pg_id', 1)
- priv_ports = generator.priv_ports
- pub_ports = generator.pub_ports
- for index, (priv_port, pub_port) in enumerate(zip(priv_ports, pub_ports), 1):
- profile_data = self.params.get('private_{}'.format(index), '')
- self.ports.append(priv_port)
- generator.client.add_streams(self.get_streams(profile_data),
- ports=priv_port)
-
- profile_data = self.params.get('public_{}'.format(index), '')
- if not profile_data or generator.correlated_traffic:
+ for vld_id, intfs in sorted(self.generator.networks.items()):
+ profile_data = self.params.get(vld_id)
+ if not profile_data:
continue
+ # correlated traffic doesn't use public traffic?
+ if vld_id.startswith("public") and self.generator.rfc2544_helper.correlated_traffic:
+ continue
+ for intf in intfs:
+ port = self.generator.vnfd_helper.port_num(intf)
+ self.ports.append(port)
+ self.generator.client.add_streams(self.get_streams(profile_data), ports=port)
- pub_port = generator.pub_ports[index]
- self.ports.append(pub_port)
- generator.client.add_streams(self.get_streams(profile_data),
- ports=pub_port)
-
- generator.start_client(ports=self.ports, mult=str(multiplier),
- duration=120, force=True)
+ self.generator.start_client(ports=self.ports, mult=str(multiplier),
+ duration=120, force=True)
self.first_run = False
def calculate_pps(self, samples):