def start_client(self, host, port=5001, protocol='TCP', time=60, parallel=None, bandwidth=None): """iperf -D -c host -t 60 """ id = uuid.uuid4() output = OUT_DIR + 'iperf-client-%s' % id utils.replace_file(output) cmd = ['iperf', '-D', '-c', host, '-p', str(port), '-t', str(time)] if not (protocol, 'UDP'): cmd.append('-u') if parallel: cmd.extend(['-P', str(parallel)]) if bandwidth: cmd.extend(['-b', '%sM' % bandwidth]) cmd.extend(['>', output]) utils.create_deamon(cmd) data = dict() data['id'] = id return data
def start_server(self, protocol='TCP', port=5001, mss=None, window=None): """iperf -s -D --mss mss """ id = uuid.uuid4() output = OUT_DIR + 'iperf-server-%s' % id utils.replace_file(output) cmd = ['iperf', '-s', '-D', '-p', str(port), '-o', output] if not cmp(protocol, 'UDP'): cmd.append('-u') if mss: cmd.extend(['-m', str(mss)]) if window: cmd.extend(['-w', str(window)]) cmd.extend(['>', output]) pid = utils.create_deamon(cmd) data = dict() data['id'] = id data['pid'] = pid return data