summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authorTim Beale <timbeale@catalyst.net.nz>2019-04-10 13:12:30 +1200
committerAndrew Bartlett <abartlet@samba.org>2019-04-30 23:18:28 +0000
commite387cf92884c55b7945fbd7898312896fbf9cfd9 (patch)
tree44ce40c172447c01f3ea652c271c93ffd94b350c /script
parent641d74cb267e87a22df8f9a3d285e3ab4343ce50 (diff)
downloadsamba-e387cf92884c55b7945fbd7898312896fbf9cfd9.tar.gz
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 <module> 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 <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'script')
-rwxr-xr-xscript/traffic_replay4
1 files changed, 4 insertions, 0 deletions
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()