From 17579dd81052813cde2ed3aad0738540d417e60b Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Tue, 23 Oct 2018 10:31:53 +1300 Subject: [PATCH] traffic: traffic_replay --latency-timeout to control final wait 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 Reviewed-by: Andrew Bartlett --- python/samba/emulate/traffic.py | 3 ++- script/traffic_replay | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/python/samba/emulate/traffic.py b/python/samba/emulate/traffic.py index 87c8daf1970..1d4316586e6 100644 --- a/python/samba/emulate/traffic.py +++ b/python/samba/emulate/traffic.py @@ -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) diff --git a/script/traffic_replay b/script/traffic_replay index 6a449a4dbe3..f1e8372c8bb 100755 --- a/script/traffic_replay +++ b/script/traffic_replay @@ -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,