summaryrefslogtreecommitdiffstats
path: root/nfvbench/traffic_gen/traffic_utils.py
diff options
context:
space:
mode:
authorahothan <ahothan@cisco.com>2018-10-07 15:55:25 -0700
committerahothan <ahothan@cisco.com>2018-10-08 10:44:31 -0700
commit391dcf76fefb747888a3411ae3b8df7b1ad26685 (patch)
treeb823ae8a5f0e837bb285f53acb1502e0aad1bdf0 /nfvbench/traffic_gen/traffic_utils.py
parent99260f95219301bb5c0b58921e793bcad6ec4990 (diff)
2.0 beta NFVBENCH-91 Allow multi-chaining with separate edge networks
Includes complete refactoring of code Beta for NFVbench 2.0 Change-Id: I2997f0fb7722d5ac626cd11a68692ae458c7676e Signed-off-by: ahothan <ahothan@cisco.com>
Diffstat (limited to 'nfvbench/traffic_gen/traffic_utils.py')
-rw-r--r--nfvbench/traffic_gen/traffic_utils.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/nfvbench/traffic_gen/traffic_utils.py b/nfvbench/traffic_gen/traffic_utils.py
index 4a7f855..c3428a4 100644
--- a/nfvbench/traffic_gen/traffic_utils.py
+++ b/nfvbench/traffic_gen/traffic_utils.py
@@ -20,18 +20,29 @@ imix_avg_l2_size = None
def convert_rates(l2frame_size, rate, intf_speed):
+ """Convert a given rate unit into the other rate units.
+
+ l2frame_size: size of the L2 frame in bytes or 'IMIX'
+ rate: a dict that has at least one of the following key:
+ 'rate_pps', 'rate_bps', 'rate_percent'
+ with the corresponding input value
+ intf_speed: the line rate speed in bits per second
+ """
avg_packet_size = get_average_packet_size(l2frame_size)
if 'rate_pps' in rate:
+ # input = packets/sec
initial_rate_type = 'rate_pps'
pps = rate['rate_pps']
bps = pps_to_bps(pps, avg_packet_size)
load = bps_to_load(bps, intf_speed)
elif 'rate_bps' in rate:
+ # input = bits per second
initial_rate_type = 'rate_bps'
bps = rate['rate_bps']
load = bps_to_load(bps, intf_speed)
pps = bps_to_pps(bps, avg_packet_size)
elif 'rate_percent' in rate:
+ # input = percentage of the line rate (between 0.0 and 100.0)
initial_rate_type = 'rate_percent'
load = rate['rate_percent']
bps = load_to_bps(load, intf_speed)