diff options
Diffstat (limited to 'yardstick/network_services/traffic_profile/rfc2544.py')
-rw-r--r-- | yardstick/network_services/traffic_profile/rfc2544.py | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/yardstick/network_services/traffic_profile/rfc2544.py b/yardstick/network_services/traffic_profile/rfc2544.py index e33c437c9..b838bf814 100644 --- a/yardstick/network_services/traffic_profile/rfc2544.py +++ b/yardstick/network_services/traffic_profile/rfc2544.py @@ -23,7 +23,7 @@ from yardstick.common import constants from yardstick.network_services.traffic_profile import trex_traffic_profile -LOGGING = logging.getLogger(__name__) +LOG = logging.getLogger(__name__) SRC_PORT = 'sport' DST_PORT = 'dport' @@ -271,17 +271,23 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile): return streams def get_drop_percentage(self, samples, tol_low, tol_high, - correlated_traffic): + correlated_traffic, resolution): """Calculate the drop percentage and run the traffic""" completed = False out_pkt_end = sum(port['out_packets'] for port in samples[-1].values()) in_pkt_end = sum(port['in_packets'] for port in samples[-1].values()) out_pkt_ini = sum(port['out_packets'] for port in samples[0].values()) in_pkt_ini = sum(port['in_packets'] for port in samples[0].values()) + in_bytes_ini = sum(port['in_bytes'] for port in samples[0].values()) + out_bytes_ini = sum(port['out_bytes'] for port in samples[0].values()) + in_bytes_end = sum(port['in_bytes'] for port in samples[-1].values()) + out_bytes_end = sum(port['out_bytes'] for port in samples[-1].values()) time_diff = (list(samples[-1].values())[0]['timestamp'] - list(samples[0].values())[0]['timestamp']).total_seconds() out_packets = out_pkt_end - out_pkt_ini in_packets = in_pkt_end - in_pkt_ini + out_bytes = out_bytes_end - out_bytes_ini + in_bytes = in_bytes_end - in_bytes_ini tx_rate_fps = float(out_packets) / time_diff rx_rate_fps = float(in_packets) / time_diff drop_percent = 100.0 @@ -301,7 +307,13 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile): completed = True last_rate = self.rate - self.rate = round(float(self.max_rate + self.min_rate) / 2.0, 5) + self.rate = self._get_next_rate() + if abs(last_rate - self.rate) < resolution: + # stop test if the difference between the rate transmission + # in two iterations is smaller than the value of the resolution + completed = True + LOG.debug("rate=%s, next_rate=%s, resolution=%s, completed=%s", + last_rate, self.rate, resolution, completed) throughput = rx_rate_fps * 2 if correlated_traffic else rx_rate_fps @@ -314,6 +326,8 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile): output = { 'TxThroughput': tx_rate_fps, 'RxThroughput': rx_rate_fps, + 'RxThroughputBps': round(float(in_bytes) / time_diff, 3), + 'TxThroughputBps': round(float(out_bytes) / time_diff, 3), 'CurrentDropPercentage': drop_percent, 'Throughput': throughput, 'DropPercentage': self.drop_percent_max, |