traffic: traffic_replay --latency-timeout to control final wait
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Mon, 22 Oct 2018 21:31:53 +0000 (10:31 +1300)
committerDouglas Bagnall <dbagnall@samba.org>
Tue, 8 Jan 2019 22:55:33 +0000 (23:55 +0100)
Conversations that haven't finished within some acceptable margin of
on-time can be said to have failed. This is where you specify that
margin.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/emulate/traffic.py
script/traffic_replay

index 87c8daf1970ee1f87096a29bbe60cf4a9420411c..1d4316586e6bae5efbc1c2a9c9f44c522a1ae822 100644 (file)
@@ -1534,6 +1534,7 @@ def replay(conversation_seq,
            accounts=None,
            dns_rate=0,
            duration=None,
+           latency_timeout=1.0,
            stop_on_any_error=False,
            **kwargs):
 
@@ -1559,7 +1560,7 @@ def replay(conversation_seq,
         # end slightly after the last packet of the last conversation
         # to start. Conversations other than the last could still be
         # going, but we don't care.
-        duration = conversation_seq[-1][-1][0] + 1.0
+        duration = conversation_seq[-1][-1][0] + latency_timeout
 
     print("We will start in %.1f seconds" % delay,
           file=sys.stderr)
index 6a449a4dbe38d60ee5e9821a225738c9e80b57d6..f1e8372c8bbdfa256aee158aede2802359127157 100755 (executable)
@@ -84,6 +84,8 @@ def main():
     model_group.add_option('-D', '--duration', type='float', default=60.0,
                            help=('Run model for this long (approx). '
                                  'Default 60s for models'))
+    model_group.add_option('--latency-timeout', type='float', default=None,
+                           help=('Wait this long for last packet to finish'))
     model_group.add_option('-r', '--replay-rate', type='float', default=1.0,
                            help='Replay the traffic faster by this factor')
     model_group.add_option('--traffic-summary',
@@ -368,6 +370,7 @@ def main():
                    accounts=accounts,
                    dns_rate=opts.dns_rate,
                    duration=opts.duration,
+                   latency_timeout=opts.latency_timeout,
                    badpassword_frequency=opts.badpassword_frequency,
                    prefer_kerberos=opts.prefer_kerberos,
                    statsdir=statsdir,