def _RunTest(sending_vm, receiving_vm): """Runs the tests depending on what is enabled. Args: sending_vm: The vm that will initiate the stream. receiving_vm: The vm that will act as server. """ if vm_util.ShouldRunOnExternalIpAddress(): if FLAGS.run_udp: results.extend( iperf3.RunIperf3UDPStream(sending_vm, receiving_vm, use_internal_ip=False)) if FLAGS.run_tcp: results.extend( iperf3.RunIperf3TCPMultiStream(sending_vm, receiving_vm, use_internal_ip=False)) if vm_util.ShouldRunOnInternalIpAddress(sending_vm, receiving_vm): if FLAGS.run_udp: results.extend( iperf3.RunIperf3UDPStream(sending_vm, receiving_vm, use_internal_ip=True)) if FLAGS.run_tcp: results.extend( iperf3.RunIperf3TCPMultiStream(sending_vm, receiving_vm, use_internal_ip=True))
def Run(benchmark_spec): """Run iperf on the target vm. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. Returns: A list of sample.Sample objects. """ vms = benchmark_spec.vms results = [] logging.info('Iperf Results:') # Send traffic in both directions for sending_vm, receiving_vm in vms, reversed(vms): # Send using external IP addresses if vm_util.ShouldRunOnExternalIpAddress(): results.append( _RunIperf(sending_vm, receiving_vm, receiving_vm.ip_address, 'external')) # Send using internal IP addresses if vm_util.ShouldRunOnInternalIpAddress(sending_vm, receiving_vm): results.append( _RunIperf(sending_vm, receiving_vm, receiving_vm.internal_ip, 'internal')) return results
def Run(benchmark_spec): """Measure TCP stream throughput between two VMs. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. Returns: A list of sample.Sample objects with the benchmark results. """ vms = benchmark_spec.vms results = [] # Send traffic in both directions for originator in [0, 1]: sending_vm = vms[originator] receiving_vm = vms[originator ^ 1] # Send using external IP addresses if vm_util.ShouldRunOnExternalIpAddress(): results.extend( ntttcp.RunNtttcp(sending_vm, receiving_vm, receiving_vm.ip_address, 'external')) # Send using internal IP addresses if vm_util.ShouldRunOnInternalIpAddress(sending_vm, receiving_vm): results.extend( ntttcp.RunNtttcp(sending_vm, receiving_vm, receiving_vm.internal_ip, 'internal')) return results
def Prepare(benchmark_spec): """Install iperf and start the server on all machines. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. """ vms = benchmark_spec.vms if len(vms) != 2: raise ValueError( f'iperf benchmark requires exactly two machines, found {len(vms)}') for vm in vms: vm.Install('iperf') if vm_util.ShouldRunOnExternalIpAddress(): if TCP in FLAGS.iperf_benchmarks: vm.AllowPort(IPERF_PORT) if UDP in FLAGS.iperf_benchmarks: vm.AllowPort(IPERF_UDP_PORT) if TCP in FLAGS.iperf_benchmarks: stdout, _ = vm.RemoteCommand( f'nohup iperf --server --port {IPERF_PORT}' ' &> /dev/null & echo $!') # TODO(ssabhaya): store this in a better place once we have a better place vm.iperf_tcp_server_pid = stdout.strip() if UDP in FLAGS.iperf_benchmarks: stdout, _ = vm.RemoteCommand( f'nohup iperf --server --udp --port {IPERF_UDP_PORT}' ' &> /dev/null & echo $!') # TODO(ssabhaya): store this in a better place once we have a better place vm.iperf_udp_server_pid = stdout.strip()
def Prepare(benchmark_spec): """Install netperf on the target vm. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. """ vms = benchmark_spec.vms vms = vms[:2] vm_util.RunThreaded(PrepareNetperf, vms) num_streams = max(FLAGS.netperf_num_streams) # See comments where _COS_RE is defined. if vms[1].image and re.search(_COS_RE, vms[1].image): _SetupHostFirewall(benchmark_spec) # Start the netserver processes if vm_util.ShouldRunOnExternalIpAddress(): # Open all of the command and data ports vms[1].AllowPort(PORT_START, PORT_START + num_streams * 2 - 1) netserver_cmd = ('for i in $(seq {port_start} 2 {port_end}); do ' '{netserver_path} -p $i & done').format( port_start=PORT_START, port_end=PORT_START + num_streams * 2 - 1, netserver_path=netperf.NETSERVER_PATH) vms[1].RemoteCommand(netserver_cmd) # Copy remote test script to client path = data.ResourcePath(os.path.join(REMOTE_SCRIPTS_DIR, REMOTE_SCRIPT)) logging.info('Uploading %s to %s', path, vms[0]) vms[0].PushFile(path, REMOTE_SCRIPT) vms[0].RemoteCommand('sudo chmod 777 %s' % REMOTE_SCRIPT)
def Run(benchmark_spec): """Run ping on the target vm. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. Returns: A list of sample.Sample objects. """ vms = benchmark_spec.vms results = [] for sending_vm, receiving_vm in vms, reversed(vms): if vm_util.ShouldRunOnExternalIpAddress(): ip_type = vm_util.IpAddressMetadata.EXTERNAL results = results + _RunPing(sending_vm, receiving_vm, receiving_vm.ip_address, ip_type) if vm_util.ShouldRunOnInternalIpAddress(sending_vm, receiving_vm): ip_type = vm_util.IpAddressMetadata.INTERNAL results = results + _RunPing(sending_vm, receiving_vm, receiving_vm.internal_ip, ip_type) return results
def _RunNuttcpTest(sending_vm, receiving_vm): if vm_util.ShouldRunOnExternalIpAddress(): results.extend( nuttcp.RunNuttcp(sending_vm, receiving_vm, exec_path, receiving_vm.ip_address, 'external')) if vm_util.ShouldRunOnInternalIpAddress(sending_vm, receiving_vm): results.extend( nuttcp.RunNuttcp(sending_vm, receiving_vm, exec_path, receiving_vm.internal_ip, 'internal'))
def _RunTest(sending_vm, receiving_vm): if vm_util.ShouldRunOnExternalIpAddress(): results.extend( psping.RunLatencyTest(sending_vm, receiving_vm, use_internal_ip=False)) if vm_util.ShouldRunOnInternalIpAddress(sending_vm, receiving_vm): results.extend( psping.RunLatencyTest(sending_vm, receiving_vm, use_internal_ip=True))
def _RunTest(sending_vm, receiving_vm): if vm_util.ShouldRunOnExternalIpAddress(): results.extend( iperf3.RunIperf3UDPStream(sending_vm, receiving_vm, use_internal_ip=False)) if vm_util.ShouldRunOnInternalIpAddress(sending_vm, receiving_vm): results.extend( iperf3.RunIperf3UDPStream(sending_vm, receiving_vm, use_internal_ip=True))
def RunScpSingleDirection(sending_vm, receiving_vm, cipher, data_size_in_mb, base_metadata): """Run scp from sending_vm to receiving_vm and parse results. If 'receiving_vm' is accessible via internal IP from 'sending_vm', throughput over internal IP addresses will be tested in addition to external IP addresses. Args: sending_vm: The originating VM for the scp command. receiving_vm: The destination VM for the scp command. cipher: Name of the SSH cipher to use. data_size_in_mb: The size of the data file in MB. base_metadata: The base metadata to attach to the sample. Returns: A list of sample.Sample objects. """ results = [] metadata = base_metadata.copy() for vm_specifier, vm in ('receiving', receiving_vm), ('sending', sending_vm): for k, v in six.iteritems(vm.GetResourceMetadata()): metadata['{0}_{1}'.format(vm_specifier, k)] = v cmd_template = ( 'sudo sync; sudo sysctl vm.drop_caches=3; ' 'time /usr/bin/scp -o StrictHostKeyChecking=no -i %s -c %s ' '%s %s@%%s:%%s/;') % (linux_virtual_machine.REMOTE_KEY_PATH, cipher, '%s/data/*' % sending_vm.GetScratchDir(0), receiving_vm.user_name) def RunForIpAddress(ip_address, ip_type): """Run SCP benchmark against a destination IP address.""" target_dir = posixpath.join(receiving_vm.GetScratchDir(0), ip_type) cmd = cmd_template % (ip_address, target_dir) receiving_vm.RemoteCommand('mkdir %s' % target_dir) meta = metadata.copy() meta['ip_type'] = ip_type _, res = sending_vm.RemoteCommand(cmd) time_used = vm_util.ParseTimeCommandResult(res) result = data_size_in_mb / time_used receiving_vm.RemoteCommand('rm -rf %s' % target_dir) return sample.Sample('scp throughput', result, UNIT, meta) if vm_util.ShouldRunOnExternalIpAddress(): results.append(RunForIpAddress(receiving_vm.ip_address, 'external')) if vm_util.ShouldRunOnInternalIpAddress(sending_vm, receiving_vm): results.append(RunForIpAddress(receiving_vm.internal_ip, 'internal')) return results
def Prepare(benchmark_spec): """Install iperf and start the server on all machines. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. """ vms = benchmark_spec.vms for vm in vms: vm.Install('iperf') if vm_util.ShouldRunOnExternalIpAddress(): vm.AllowPort(IPERF_PORT) vm.RemoteCommand('nohup iperf --server --port %s &> /dev/null &' % IPERF_PORT)
def RunScpSingleDirection(sending_vm, receiving_vm): """Run scp from sending_vm to receiving_vm and parse results. If 'receiving_vm' is accessible via internal IP from 'sending_vm', throughput over internal IP addresses will be tested in addition to external IP addresses. Args: sending_vm: The originating VM for the scp command. receiving_vm: The destination VM for the scp command. Returns: A list of sample.Sample objects. """ results = [] metadata = { 'sending_zone': sending_vm.zone, 'receiving_zone': receiving_vm.zone, 'server_machine_type': receiving_vm.machine_type, 'client_machine_type': sending_vm.machine_type, } cmd_template = ( 'sudo sync; sudo sysctl vm.drop_caches=3; ' 'time /usr/bin/scp -o StrictHostKeyChecking=no -i %s -c %s ' '%s %s@%%s:%%s/;') % (virtual_machine.REMOTE_KEY_PATH, CIPHER, '%s/data/*' % sending_vm.GetScratchDir(0), receiving_vm.user_name) def RunForIpAddress(ip_address, ip_type): """Run SCP benchmark against a destination IP address.""" target_dir = os.path.join(receiving_vm.GetScratchDir(0), ip_type) cmd = cmd_template % (ip_address, target_dir) receiving_vm.RemoteCommand('mkdir %s' % target_dir) meta = metadata.copy() meta['ip_type'] = ip_type _, res = sending_vm.RemoteCommand(cmd) time_used = vm_util.ParseTimeCommandResult(res) result = DATA_SIZE_IN_MB / time_used receiving_vm.RemoteCommand('rm -rf %s' % target_dir) return sample.Sample('scp throughput', result, UNIT, meta) if vm_util.ShouldRunOnExternalIpAddress(): results.append(RunForIpAddress(receiving_vm.ip_address, 'external')) if vm_util.ShouldRunOnInternalIpAddress(sending_vm, receiving_vm): results.append(RunForIpAddress(receiving_vm.internal_ip, 'internal')) return results
def Run(benchmark_spec): """Run netperf TCP_RR on the target vm. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. Returns: A list of sample.Sample objects. """ vms = benchmark_spec.vms client_vm = vms[0] # Client aka "sending vm" server_vm = vms[1] # Server aka "receiving vm" logging.info('netperf running on %s', client_vm) results = [] metadata = { 'sending_zone': client_vm.zone, 'sending_machine_type': client_vm.machine_type, 'receiving_zone': server_vm.zone, 'receiving_machine_type': server_vm.machine_type } for num_streams in FLAGS.netperf_num_streams: assert num_streams >= 1 for netperf_benchmark in FLAGS.netperf_benchmarks: if vm_util.ShouldRunOnExternalIpAddress(): external_ip_results = RunNetperf(client_vm, netperf_benchmark, server_vm.ip_address, num_streams, server_vm=server_vm) for external_ip_result in external_ip_results: external_ip_result.metadata['ip_type'] = 'external' external_ip_result.metadata.update(metadata) results.extend(external_ip_results) if vm_util.ShouldRunOnInternalIpAddress(client_vm, server_vm): internal_ip_results = RunNetperf(client_vm, netperf_benchmark, server_vm.internal_ip, num_streams, server_vm=server_vm) for internal_ip_result in internal_ip_results: internal_ip_result.metadata.update(metadata) internal_ip_result.metadata['ip_type'] = 'internal' results.extend(internal_ip_results) return results
def Prepare(benchmark_spec): # pylint: disable=unused-argument """Install ping on the target vm. Checks that there are exactly two vms specified. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. """ if len(benchmark_spec.vms) != 2: raise ValueError( 'Ping benchmark requires exactly two machines, found {0}'.format( len(benchmark_spec.vms))) if vm_util.ShouldRunOnExternalIpAddress(): vms = benchmark_spec.vms for vm in vms: vm.AllowIcmp()
def Prepare(benchmark_spec): """Install netperf on the target vm. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. """ vms = benchmark_spec.vms vms = vms[:2] vm_util.RunThreaded(PrepareNetperf, vms) if vm_util.ShouldRunOnExternalIpAddress(): vms[1].AllowPort(COMMAND_PORT) vms[1].AllowPort(DATA_PORT) vms[1].RemoteCommand('%s -p %s' % (netperf.NETSERVER_PATH, COMMAND_PORT))
def PrepareNetperfAggregate(vm): """Installs netperf on a single vm.""" vm.Install('texinfo') vm.Install('python_rrdtool') vm.Install('netperf') port_end = PORT_START if vm_util.ShouldRunOnExternalIpAddress(): vm.AllowPort(PORT_START, port_end) netserver_cmd = ('{netserver_path} -p {port_start}').format( port_start=PORT_START, netserver_path=netperf.NETSERVER_PATH) vm.RemoteCommand(netserver_cmd) remote_path = netperf.NETPERF_EXAMPLE_DIR + REMOTE_SCRIPT vm.RemoteCommand('chmod +x %s' % (remote_path))
def Prepare(benchmark_spec): """Install iperf and start the server on all machines. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. """ vms = benchmark_spec.vms if len(vms) != 2: raise ValueError( 'iperf benchmark requires exactly two machines, found {0}'.format( len(vms))) for vm in vms: vm.Install('iperf') if vm_util.ShouldRunOnExternalIpAddress(): vm.AllowPort(IPERF_PORT) vm.RemoteCommand('nohup iperf --server --port %s &> /dev/null &' % IPERF_PORT)
def Run(benchmark_spec): """Run netperf TCP_RR on the target vm. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. Returns: A list of sample.Sample objects. """ vms = benchmark_spec.vms client_vm = vms[0] server_vm = vms[1] logging.info('netperf running on %s', client_vm) results = [] metadata = {'ip_type': 'external'} for vm_specifier, vm in ('receiving', server_vm), ('sending', client_vm): metadata['{0}_zone'.format(vm_specifier)] = vm.zone for k, v in vm.GetMachineTypeDict().iteritems(): metadata['{0}_{1}'.format(vm_specifier, k)] = v for num_streams in FLAGS.netperf_num_streams: assert (num_streams >= 1) for netperf_benchmark in FLAGS.netperf_benchmarks: if vm_util.ShouldRunOnExternalIpAddress(): external_ip_results = RunNetperf(client_vm, netperf_benchmark, server_vm.ip_address, num_streams) for external_ip_result in external_ip_results: external_ip_result.metadata.update(metadata) results.extend(external_ip_results) if vm_util.ShouldRunOnInternalIpAddress(client_vm, server_vm): internal_ip_results = RunNetperf(client_vm, netperf_benchmark, server_vm.internal_ip, num_streams) for internal_ip_result in internal_ip_results: internal_ip_result.metadata.update(metadata) internal_ip_result.metadata['ip_type'] = 'internal' results.extend(internal_ip_results) return results
def Run(benchmark_spec): """Run netperf TCP_RR on the target vm. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. Returns: A list of sample.Sample objects. """ vms = benchmark_spec.vms vm = vms[0] server_vm = vms[1] logging.info('netperf running on %s', vm) results = [] metadata = { 'ip_type': 'external', 'server_machine_type': server_vm.machine_type, 'server_zone': server_vm.zone, 'receiving_zone': server_vm.zone, 'client_machine_type': vm.machine_type, 'client_zone': vm.zone, 'sending_zone': vm.zone } for netperf_benchmark in NETPERF_BENCHMARKS: if vm_util.ShouldRunOnExternalIpAddress(): external_ip_results = RunNetperf(vm, netperf_benchmark, server_vm.ip_address) for external_ip_result in external_ip_results: external_ip_result.metadata.update(metadata) results.extend(external_ip_results) if vm_util.ShouldRunOnInternalIpAddress(vm, server_vm): internal_ip_results = RunNetperf(vm, netperf_benchmark, server_vm.internal_ip) for internal_ip_result in internal_ip_results: internal_ip_result.metadata.update(metadata) internal_ip_result.metadata['ip_type'] = 'internal' results.extend(internal_ip_results) return results
def Run(benchmark_spec): """Run netperf TCP_RR on the target vm. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. Returns: A list of sample.Sample objects. """ # set client and server vms vm_dict = benchmark_spec.vm_groups client_vms = vm_dict['client'] server_vms = vm_dict['servers'] client_vm = client_vms[0] results = [] if vm_util.ShouldRunOnExternalIpAddress(): server_ips = list((vm.ip_address for vm in server_vms)) external_ip_results = RunNetperfAggregate(client_vm, server_ips) for external_ip_result in external_ip_results: external_ip_result.metadata['ip_type'] = 'external' results.extend(external_ip_results) # check if all server vms internal ips are reachable run_internal = True for tmp_vm in server_vms: if not vm_util.ShouldRunOnInternalIpAddress(client_vm, tmp_vm): run_internal = False break if run_internal: server_ips = list((vm.internal_ip for vm in server_vms)) internal_ip_results = RunNetperfAggregate(client_vm, server_ips) for internal_ip_result in internal_ip_results: internal_ip_result.metadata['ip_type'] = 'internal' results.extend(internal_ip_results) return results
def Run(benchmark_spec): """Measure TCP stream throughput between two VMs. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. Returns: A list of sample.Sample objects with the benchmark results. """ vm_sets = [(benchmark_spec.vms[0], benchmark_spec.vms[1]), (benchmark_spec.vms[1], benchmark_spec.vms[0])] parsed_configs = ntttcp.ParseConfigList() # Keep accounting of failed configs. failed_confs = [] # Send traffic in both directions for ((sender, receiver), conf) in itertools.product(vm_sets, parsed_configs): # Send using external IP addresses if vm_util.ShouldRunOnExternalIpAddress(conf.ip_type): if not _RunTest(benchmark_spec, sender, receiver, receiver.ip_address, 'external', conf, True): failed_confs.append(('external', conf)) # Send using internal IP addresses if vm_util.ShouldRunOnInternalIpAddress(sender, receiver, conf.ip_type): if not _RunTest(benchmark_spec, sender, receiver, receiver.internal_ip, 'internal', conf, len(parsed_configs) > 1): failed_confs.append(('internal', conf)) if failed_confs: logging.info('Failed to run test and/or gather results for %s', str(failed_confs)) return []
def _SetupHostFirewall(benchmark_spec): """Set up host firewall to allow incoming traffic. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. """ client_vm = benchmark_spec.vms[0] server_vm = benchmark_spec.vms[1] ip_addrs = [client_vm.internal_ip] if vm_util.ShouldRunOnExternalIpAddress(): ip_addrs.append(client_vm.ip_address) logging.info('setting up host firewall on %s running %s for client at %s', server_vm.name, server_vm.image, ip_addrs) cmd = 'sudo iptables -A INPUT -p %s -s %s -j ACCEPT' for protocol in 'tcp', 'udp': for ip_addr in ip_addrs: server_vm.RemoteHostCommand(cmd % (protocol, ip_addr))
def Prepare(benchmark_spec): """Install iperf and start the server on all machines. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. """ vms = benchmark_spec.vms if len(vms) != 2: raise ValueError( 'iperf benchmark requires exactly two machines, found {0}'.format(len( vms))) for vm in vms: vm.Install('iperf') if vm_util.ShouldRunOnExternalIpAddress(): vm.AllowPort(IPERF_PORT) stdout, _ = vm.RemoteCommand(('nohup iperf --server --port %s &> /dev/null' '& echo $!') % IPERF_PORT) # TODO store this in a better place once we have a better place vm.iperf_server_pid = stdout.strip()
def Run(benchmark_spec): """Run iperf on the target vm. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. Returns: A list of sample.Sample objects. """ vms = benchmark_spec.vms results = [] logging.info('Iperf Results:') for protocol in FLAGS.iperf_benchmarks: for thread_count in FLAGS.iperf_sending_thread_count: # Send traffic in both directions for sending_vm, receiving_vm in vms, reversed(vms): # Send using external IP addresses if vm_util.ShouldRunOnExternalIpAddress(): results.append( _RunIperf(sending_vm, receiving_vm, receiving_vm.ip_address, thread_count, vm_util.IpAddressMetadata.EXTERNAL, protocol)) # Send using internal IP addresses if vm_util.ShouldRunOnInternalIpAddress( sending_vm, receiving_vm): results.append( _RunIperf(sending_vm, receiving_vm, receiving_vm.internal_ip, thread_count, vm_util.IpAddressMetadata.INTERNAL, protocol)) return results
def Prepare(benchmark_spec): """Install netperf on the target vm. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. """ vms = benchmark_spec.vms vms = vms[:2] vm_util.RunThreaded(PrepareNetperf, vms) num_streams = max(FLAGS.netperf_num_streams) # Start the netserver processes if vm_util.ShouldRunOnExternalIpAddress(): # Open all of the command and data ports vms[1].AllowPort(PORT_START, PORT_START + num_streams * 2 - 1) netserver_cmd = ('for i in $(seq {port_start} 2 {port_end}); do ' '{netserver_path} -p $i & done').format( port_start=PORT_START, port_end=PORT_START + num_streams * 2 - 1, netserver_path=netperf.NETSERVER_PATH) vms[1].RemoteCommand(netserver_cmd) # Install some stuff on the client vm vms[0].Install('pip') vms[0].RemoteCommand('sudo pip install python-gflags==2.0') # Create a scratch directory for the remote test script vms[0].RemoteCommand('sudo mkdir -p /tmp/run/') vms[0].RemoteCommand('sudo chmod 777 /tmp/run/') # Copy remote test script to client path = data.ResourcePath(os.path.join(REMOTE_SCRIPTS_DIR, REMOTE_SCRIPT)) logging.info('Uploading %s to %s', path, vms[0]) vms[0].PushFile(path, '/tmp/run/') vms[0].RemoteCommand('sudo chmod 777 /tmp/run/%s' % REMOTE_SCRIPT)
def PrepareNetperfAggregate(vm): """Installs netperf on a single vm.""" vm.Install('python3') vm.Install('pip3') vm.RemoteCommand('sudo pip3 install --upgrade pip') vm.Install('texinfo') vm.Install('python_rrdtool') vm.Install('netperf') # Enable test types in the script runemomniaggdemo.sh for benchmark in FLAGS.netperf_aggregate_benchmarks: vm.RemoteCommand( f'sed -i "s/DO_{benchmark}=0;/DO_{benchmark}=1;/g" /opt/pkb/netperf-netperf-2.7.0/doc/examples/runemomniaggdemo.sh' ) port_end = PORT_START if vm_util.ShouldRunOnExternalIpAddress(): vm.AllowPort(PORT_START, port_end) netserver_cmd = ('{netserver_path} -p {port_start}').format( port_start=PORT_START, netserver_path=netperf.NETSERVER_PATH) vm.RemoteCommand(netserver_cmd)