diff options
Diffstat (limited to 'nfvbench/traffic_gen')
-rw-r--r-- | nfvbench/traffic_gen/dummy.py | 4 | ||||
-rw-r--r-- | nfvbench/traffic_gen/traffic_utils.py | 6 | ||||
-rw-r--r-- | nfvbench/traffic_gen/trex_gen.py | 6 |
3 files changed, 15 insertions, 1 deletions
diff --git a/nfvbench/traffic_gen/dummy.py b/nfvbench/traffic_gen/dummy.py index 7fd3fdb..272990a 100644 --- a/nfvbench/traffic_gen/dummy.py +++ b/nfvbench/traffic_gen/dummy.py @@ -147,6 +147,10 @@ class DummyTG(AbstractTrafficGenerator): total_tx_pps += tx_pps # actual total tx rate in pps result['total_tx_rate'] = total_tx_pps + # actual offered tx rate in bps + avg_packet_size = utils.get_average_packet_size(self.l2_frame_size) + total_tx_bps = utils.pps_to_bps(total_tx_pps, avg_packet_size) + result['offered_tx_rate_bps'] = total_tx_bps return result def get_stream_stats(self, tg_stats, if_stats, latencies, chain_idx): diff --git a/nfvbench/traffic_gen/traffic_utils.py b/nfvbench/traffic_gen/traffic_utils.py index c875a5d..4366a6c 100644 --- a/nfvbench/traffic_gen/traffic_utils.py +++ b/nfvbench/traffic_gen/traffic_utils.py @@ -14,7 +14,6 @@ import bitmath -from nfvbench.utils import multiplier_map # IMIX frame size including the 4-byte FCS field IMIX_L2_SIZES = [64, 594, 1518] @@ -23,6 +22,11 @@ IMIX_RATIOS = [7, 4, 1] IMIX_AVG_L2_FRAME_SIZE = sum( [1.0 * imix[0] * imix[1] for imix in zip(IMIX_L2_SIZES, IMIX_RATIOS)]) / sum(IMIX_RATIOS) +multiplier_map = { + 'K': 1000, + 'M': 1000000, + 'G': 1000000000 +} def convert_rates(l2frame_size, rate, intf_speed): """Convert a given rate unit into the other rate units. diff --git a/nfvbench/traffic_gen/trex_gen.py b/nfvbench/traffic_gen/trex_gen.py index 7f48a2a..7220e4b 100644 --- a/nfvbench/traffic_gen/trex_gen.py +++ b/nfvbench/traffic_gen/trex_gen.py @@ -95,6 +95,7 @@ class TRex(AbstractTrafficGenerator): self.rates = [] self.capture_id = None self.packet_list = [] + self.l2_frame_size = 0 def get_version(self): """Get the Trex version.""" @@ -151,6 +152,10 @@ class TRex(AbstractTrafficGenerator): total_tx_pkts = result[0]['tx']['total_pkts'] + result[1]['tx']['total_pkts'] result["total_tx_rate"] = cast_integer(total_tx_pkts / self.config.duration_sec) + # actual offered tx rate in bps + avg_packet_size = utils.get_average_packet_size(self.l2_frame_size) + total_tx_bps = utils.pps_to_bps(result["total_tx_rate"], avg_packet_size) + result['offered_tx_rate_bps'] = total_tx_bps result["flow_stats"] = in_stats["flow_stats"] result["latency"] = in_stats["latency"] return result @@ -820,6 +825,7 @@ class TRex(AbstractTrafficGenerator): .format(pps=r['rate_pps'], bps=r['rate_bps'], load=r['rate_percent'])) + self.l2_frame_size = l2frame_size # a dict of list of streams indexed by port# # in case of fixed size, has self.chain_count * 2 * 2 streams # (1 normal + 1 latency stream per direction per chain) |