From deb1ce15e6dd0e64c981dbedbf764e5c426e6ec4 Mon Sep 17 00:00:00 2001 From: Yaroslav Brustinov Date: Mon, 14 Nov 2016 10:58:56 +0200 Subject: fix STL push pcap: start from zero (or explicit delay) Signed-off-by: Yaroslav Brustinov --- .../trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py index e63f9125..63e61b1d 100755 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py @@ -1073,6 +1073,8 @@ class STLProfile(object): def __pkts_to_streams (pkts, ipg_usec, speedup, loop_count, vm, packet_hook, start_delay_usec = 0): streams = [] + if speedup == 0: + raise STLError('Speedup should not be 0') # 10 ms delay before starting the PCAP last_ts_usec = -(start_delay_usec) @@ -1084,7 +1086,10 @@ class STLProfile(object): for i, (cap, meta) in enumerate(pkts, start = 1): # IPG - if not provided, take from cap if ipg_usec == None: - ts_usec = (meta[0] * 1e6 + meta[1]) / float(speedup) + packet_time = meta[0] * 1e6 + meta[1] + if i == 1: + base_time = packet_time + ts_usec = (packet_time - base_time) / float(speedup) else: ts_usec = (ipg_usec * i) / float(speedup) -- cgit 1.2.3-korg