From e387cf92884c55b7945fbd7898312896fbf9cfd9 Mon Sep 17 00:00:00 2001 From: Tim Beale Date: Wed, 10 Apr 2019 13:12:30 +1200 Subject: traffic_replay: Avoid Exception if no packet rate is specified traffic_replay would throw an exception if you didn't specify some sort of packet rate. We can avoid this by using --scale-traffic=1.0 as the default if nothing else was specified. script/traffic_replay model.txt $SERVER.$REALM --duration=10 --fixed-password=blahblah12# -U$USERNAME%$PASSWORD INFO 2019-04-10 01:03:01,809 pid:47755 script/traffic_replay #280: Using the specified model file to generate conversations Traceback (most recent call last): File "script/traffic_replay", line 438, in main() File "script/traffic_replay", line 293, in main opts.conversation_persistence) File "bin/python/samba/emulate/traffic.py", line 1295, in generate_conversation_sequences target_packets = int(packet_rate * duration) TypeError: unsupported operand type(s) for *: 'NoneType' and 'float' Signed-off-by: Tim Beale Reviewed-by: Andrew Bartlett Reviewed-by: Andreas Schneider --- script/traffic_replay | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'script') diff --git a/script/traffic_replay b/script/traffic_replay index 0d06d1c861d..77eef7c0322 100755 --- a/script/traffic_replay +++ b/script/traffic_replay @@ -235,6 +235,10 @@ def main(): "are incompatible. Use one or the other.") sys.exit(1) + if not opts.scale_traffic and not opts.packets_per_second: + logger.info("No packet rate specified. Using --scale-traffic=1.0") + opts.scale_traffic = 1.0 + if opts.timing_data not in ('-', None): try: open(opts.timing_data, 'w').close() -- cgit v1.2.1