aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/network_services
diff options
context:
space:
mode:
Diffstat (limited to 'yardstick/network_services')
-rw-r--r--yardstick/network_services/traffic_profile/base.py1
-rw-r--r--yardstick/network_services/traffic_profile/ixia_rfc2544.py8
-rw-r--r--yardstick/network_services/traffic_profile/rfc2544.py13
-rw-r--r--yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py46
4 files changed, 31 insertions, 37 deletions
diff --git a/yardstick/network_services/traffic_profile/base.py b/yardstick/network_services/traffic_profile/base.py
index a8f950b7b..4fbceea9b 100644
--- a/yardstick/network_services/traffic_profile/base.py
+++ b/yardstick/network_services/traffic_profile/base.py
@@ -44,6 +44,7 @@ class TrafficProfileConfig(object):
self.lower_bound = tprofile.get('lower_bound')
self.upper_bound = tprofile.get('upper_bound')
self.step_interval = tprofile.get('step_interval')
+ self.enable_latency = tprofile.get('enable_latency', False)
def _parse_rate(self, rate):
"""Parse traffic profile rate
diff --git a/yardstick/network_services/traffic_profile/ixia_rfc2544.py b/yardstick/network_services/traffic_profile/ixia_rfc2544.py
index 26dc1fe04..760b1e8d3 100644
--- a/yardstick/network_services/traffic_profile/ixia_rfc2544.py
+++ b/yardstick/network_services/traffic_profile/ixia_rfc2544.py
@@ -168,12 +168,8 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile):
[samples[iface]['in_packets'] for iface in samples])
out_packets_sum = sum(
[samples[iface]['out_packets'] for iface in samples])
- rx_throughput = sum(
- [samples[iface]['RxThroughput'] for iface in samples])
- rx_throughput = round(float(rx_throughput), 2)
- tx_throughput = sum(
- [samples[iface]['TxThroughput'] for iface in samples])
- tx_throughput = round(float(tx_throughput), 2)
+ rx_throughput = round(float(in_packets_sum) / duration, 3)
+ tx_throughput = round(float(out_packets_sum) / duration, 3)
packet_drop = abs(out_packets_sum - in_packets_sum)
try:
diff --git a/yardstick/network_services/traffic_profile/rfc2544.py b/yardstick/network_services/traffic_profile/rfc2544.py
index 898315671..987029373 100644
--- a/yardstick/network_services/traffic_profile/rfc2544.py
+++ b/yardstick/network_services/traffic_profile/rfc2544.py
@@ -118,7 +118,8 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile):
ports.append(port_num)
port_pg_id.add_port(port_num)
profile = self._create_profile(profile_data,
- self.rate, port_pg_id)
+ self.rate, port_pg_id,
+ self.config.enable_latency)
self.generator.client.add_streams(profile, ports=[port_num])
self.generator.client.start(ports=ports,
@@ -126,7 +127,7 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile):
force=True)
return ports, port_pg_id
- def _create_profile(self, profile_data, rate, port_pg_id):
+ def _create_profile(self, profile_data, rate, port_pg_id, enable_latency):
"""Create a STL profile (list of streams) for a port"""
streams = []
for packet_name in profile_data:
@@ -134,7 +135,8 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile):
get('outer_l2', {}).get('framesize'))
imix_data = self._create_imix_data(imix)
self._create_vm(profile_data[packet_name])
- _streams = self._create_streams(imix_data, rate, port_pg_id)
+ _streams = self._create_streams(imix_data, rate, port_pg_id,
+ enable_latency)
streams.extend(_streams)
return trex_stl_streams.STLProfile(streams)
@@ -213,7 +215,7 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile):
return trex_stl_packet_builder_scapy.STLPktBuilder(
pkt=base_pkt / pad, vm=self.trex_vm)
- def _create_streams(self, imix_data, rate, port_pg_id):
+ def _create_streams(self, imix_data, rate, port_pg_id, enable_latency):
"""Create a list of streams per packet size
The STL TX mode speed of the generated streams will depend on the frame
@@ -237,7 +239,8 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile):
in imix_data.items() if float(weight) > 0):
packet = self._create_single_packet(size)
pg_id = port_pg_id.increase_pg_id()
- stl_flow = trex_stl_streams.STLFlowLatencyStats(pg_id=pg_id)
+ stl_flow = (trex_stl_streams.STLFlowLatencyStats(pg_id=pg_id) if
+ enable_latency else None)
mode = trex_stl_streams.STLTXCont(percentage=weight * rate / 100)
streams.append(trex_stl_client.STLStream(
packet=packet, flow_stats=stl_flow, mode=mode))
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 4d3bc2ce5..94ab06980 100644
--- a/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py
+++ b/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py
@@ -60,7 +60,7 @@ class IxiaResourceHelper(ClientResourceHelper):
def stop_collect(self):
self._terminated.value = 1
- def generate_samples(self, ports, key=None):
+ def generate_samples(self, ports, duration):
stats = self.get_stats()
samples = {}
@@ -70,27 +70,23 @@ class IxiaResourceHelper(ClientResourceHelper):
try:
# reverse lookup port name from port_num so the stats dict is descriptive
intf = self.vnfd_helper.find_interface_by_port(port_num)
- port_name = intf["name"]
+ port_name = intf['name']
+ avg_latency = stats['Store-Forward_Avg_latency_ns'][port_num]
+ min_latency = stats['Store-Forward_Min_latency_ns'][port_num]
+ max_latency = stats['Store-Forward_Max_latency_ns'][port_num]
samples[port_name] = {
- "rx_throughput_kps": float(stats["Rx_Rate_Kbps"][port_num]),
- "tx_throughput_kps": float(stats["Tx_Rate_Kbps"][port_num]),
- "rx_throughput_mbps": float(stats["Rx_Rate_Mbps"][port_num]),
- "tx_throughput_mbps": float(stats["Tx_Rate_Mbps"][port_num]),
- "in_packets": int(stats["Valid_Frames_Rx"][port_num]),
- "out_packets": int(stats["Frames_Tx"][port_num]),
- # NOTE(ralonsoh): we need to make the traffic injection
- # time variable.
- "RxThroughput": int(stats["Valid_Frames_Rx"][port_num]) / 30,
- "TxThroughput": int(stats["Frames_Tx"][port_num]) / 30,
+ 'rx_throughput_kps': float(stats['Rx_Rate_Kbps'][port_num]),
+ 'tx_throughput_kps': float(stats['Tx_Rate_Kbps'][port_num]),
+ 'rx_throughput_mbps': float(stats['Rx_Rate_Mbps'][port_num]),
+ 'tx_throughput_mbps': float(stats['Tx_Rate_Mbps'][port_num]),
+ 'in_packets': int(stats['Valid_Frames_Rx'][port_num]),
+ 'out_packets': int(stats['Frames_Tx'][port_num]),
+ 'RxThroughput': float(stats['Valid_Frames_Rx'][port_num]) / duration,
+ 'TxThroughput': float(stats['Frames_Tx'][port_num]) / duration,
+ 'Store-Forward_Avg_latency_ns': utils.safe_cast(avg_latency, int, 0),
+ 'Store-Forward_Min_latency_ns': utils.safe_cast(min_latency, int, 0),
+ 'Store-Forward_Max_latency_ns': utils.safe_cast(max_latency, int, 0)
}
- if key:
- avg_latency = stats["Store-Forward_Avg_latency_ns"][port_num]
- min_latency = stats["Store-Forward_Min_latency_ns"][port_num]
- max_latency = stats["Store-Forward_Max_latency_ns"][port_num]
- samples[port_name][key] = \
- {"Store-Forward_Avg_latency_ns": avg_latency,
- "Store-Forward_Min_latency_ns": min_latency,
- "Store-Forward_Max_latency_ns": max_latency}
except IndexError:
pass
@@ -129,13 +125,11 @@ class IxiaResourceHelper(ClientResourceHelper):
self, self.client, mac)
self.client_started.value = 1
# pylint: disable=unnecessary-lambda
- utils.wait_until_true(lambda: self.client.is_traffic_stopped())
- samples = self.generate_samples(traffic_profile.ports)
+ utils.wait_until_true(lambda: self.client.is_traffic_stopped(),
+ timeout=traffic_profile.config.duration * 2)
+ samples = self.generate_samples(traffic_profile.ports,
+ traffic_profile.config.duration)
- # NOTE(ralonsoh): the traffic injection duration is fixed to 30
- # seconds. This parameter is configurable and must be retrieved
- # from the traffic_profile.full_profile information.
- # Every flow must have the same duration.
completed, samples = traffic_profile.get_drop_percentage(
samples, min_tol, max_tol, first_run=first_run)
self._queue.put(samples)