Commit 42196a14 authored by Deathcrow's avatar Deathcrow
Browse files

fix iperf3 support

parent d5ef6a61
......@@ -38,7 +38,7 @@ def parse_senders( sender_args, sender ):
if 'interface' not in new_sender or new_sender['interface'] is "":
new_sender['interface'] = "any"
if args.utility == "netperf":
new_sender['src_port'] = new_sender['port'] = str(int(args.netperf_dataport)+len(sender))
new_sender['src_port'] = str(int(args.netperf_dataport)+len(sender))
new_sender['tcpprobe_file'] = open(args.tmp_folder+"/tcpprobe_"+new_sender['congestion']+"_"+str(len(sender)), 'w+')
sender.append(new_sender)
......@@ -48,7 +48,7 @@ def parse_senders( sender_args, sender ):
clone['is_clone'] = True
clone['tcpprobe_file'] = open(args.tmp_folder+"/tcpprobe_"+clone['congestion']+"_"+str(len(sender)), 'w+')
if args.utility == "netperf":
new_sender['src_port'] = new_sender['port'] = str(int(args.netperf_dataport)+len(sender))
new_sender['src_port'] = str(int(args.netperf_dataport)+len(sender))
sender.append(clone)
else:
......@@ -121,7 +121,7 @@ def process_proc_tcpprobe_optimized(sender): #sampling
# try to match current tcpprobe line against all unprocessed senders
for key in unprocessed_senders:
if (line_split[1] == r"["+sender[key]['src']+r"]:"+sender[key]['src_port']):
# and line_split[2] == r"["+sender[key]['dst']+r"]:"+sender[key]['port']): # pointless comparison?!
# or (args.utility == "iperf3" and line_split[2] == r"["+sender[key]['dst']+r"]:"+sender[key]['port']): #<=== use if src_port doesn't work with iperf3
# write time + current tcpprobe line to file for this sender
unprocessed_senders.discard(key)
time_dif = time.perf_counter() - start_time
......@@ -181,7 +181,8 @@ signal.signal(signal.SIGTERM, signal_handler)
parser = argparse.ArgumentParser(description='Configure test environment.')
parser.add_argument('-l', '--label', default="default")
parser.add_argument('-u', '--utility', default='iperf') ## XXX Note: iperf support is not tested!!
parser.add_argument('-u', '--utility', default="netperf", \
help="For iperf3 support run multiple iperf3 servers and specify ports per sender") ## XXX Note: iperf3 support is not tested extensively!!
parser.add_argument('-t', '--time', default="60")
parser.add_argument('-s', '--sender', action='append', nargs='+', required=True, \
help="Specify senders: <src ip>#<dst ip>#<port>#<congestion>#<number>#<interface> -- individual specifications overwrite globals")
......@@ -287,8 +288,10 @@ for key, i in enumerate(sender):
utility_args['connect'], i['dst'], \
utility_args['bind'], i['src'] , \
utility_args['time'], args.time, \
utility_args['port'], args.port, \
utility_args['port'], i['port'], \
utility_args['ipv6'] ]
if args.utility == "iperf3":
i['utility_command'] += [ "-J", "-d"]
if args.utility == "netperf":
i['utility_command'] += [ "--", "-k", "all", "-P", i['src_port'] ]
i['utility_command'] += [ utility_args['congestion'], i['congestion'] ]
......@@ -330,8 +333,10 @@ with multiprocessing.Pool(len(sender)) as pool:
## Find out which src_port belongs to which sender (not necessary for netperf) ##
# TODO: FIXME, SLEEP AS A WORKAROUND IS UNRELIABLE AND DIRTY.
if args.utility != "netperf":
time.sleep(0.1) # sacrifice first-born to satan
ss_file = tempfile.TemporaryFile(mode='r+')
subprocess.call(["ss", "-t", "-i", "-p", "-n"],stdout=ss_file)
ss_file.seek(0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment