9292 131072 ,
9393 'Send size to use for TCP_STREAM tests (netperf -m flag)' ,
9494)
95+ _SCTP_SEND_SIZE = flags .DEFINE_integer (
96+ 'netperf_sctp_stream_send_size_in_bytes' ,
97+ 131072 ,
98+ 'Send size to use for SCTP_STREAM tests (netperf -m flag)' ,
99+ )
95100flags .DEFINE_integer (
96101 'netperf_mss' ,
97102 None ,
132137TCP_STREAM = 'TCP_STREAM'
133138UDP_RR = 'UDP_RR'
134139UDP_STREAM = 'UDP_STREAM'
140+ SCTP_STREAM = 'SCTP_STREAM'
135141
136142TCP_BENCHMARKS = [TCP_RR , TCP_CRR , TCP_STREAM ]
137- ALL_BENCHMARKS = TCP_BENCHMARKS + [UDP_RR , UDP_STREAM ]
143+ ALL_BENCHMARKS = TCP_BENCHMARKS + [UDP_RR , UDP_STREAM , SCTP_STREAM ]
138144
139145flags .DEFINE_list (
140146 'netperf_benchmarks' , TCP_BENCHMARKS , 'The netperf benchmark(s) to run.'
@@ -374,20 +380,21 @@ def ParseNetperfOutput(
374380 fp = six .StringIO (stdout )
375381 # "-o" flag above specifies CSV output, but there is one extra header line:
376382 banner = next (fp )
377- assert banner .startswith ('MIGRATED' ), stdout
383+ # It will never start with MIGRATED, but the unit tests are too brittle
384+ assert banner .startswith ('OMNI' ) or banner .startswith ('MIGRATED' ), stdout
378385 r = csv .DictReader (fp )
379386 results = next (r )
380387 logging .info ('Netperf Results: %s' , results )
381388 assert 'Throughput' in results
382- except (StopIteration , AssertionError ):
389+ except (StopIteration , AssertionError ) as e :
383390 # The output returned by netperf was unparseable - usually due to a broken
384391 # connection or other error. Raise KnownIntermittentError to signal the
385392 # benchmark can be retried. Do not automatically retry as an immediate
386393 # retry on these VMs may be adveresly affected (e.g. burstable credits
387394 # partially used)
388395 message = 'Netperf ERROR: Failed to parse stdout. STDOUT: %s' % stdout
389- logging .error (message )
390- raise errors .Benchmarks .KnownIntermittentError (message )
396+ logging .exception (message )
397+ raise errors .Benchmarks .KnownIntermittentError (message ) from e
391398
392399 # Update the metadata with some additional infos
393400 meta_keys = [
@@ -501,6 +508,8 @@ def RunNetperf(vm, benchmark_name, server_ips, num_streams, client_ips):
501508
502509 remote_cmd_list = []
503510 assert server_ips , 'Server VM does not have an IP to use for netperf.'
511+ # Consider making these direct flags, since netperf benchmarks are obsolete.
512+ protocol , direction = benchmark_name .split ('_' )
504513 if len (client_ips ) != len (server_ips ):
505514 logging .warning ('Number of client and server IPs do not match.' )
506515 for server_ip_idx , server_ip in enumerate (server_ips ):
@@ -509,27 +518,30 @@ def RunNetperf(vm, benchmark_name, server_ips, num_streams, client_ips):
509518 f'{ netperf .NETPERF_PATH } '
510519 '-p {command_port} '
511520 f'-j { verbosity } '
512- f'-t { benchmark_name } '
521+ f'-t OMNI '
513522 f'-H { server_ip } -L { client_ip } '
514523 f'-l { FLAGS .netperf_test_length } { confidence } '
515524 ' -- '
525+ f'-T { protocol } '
526+ f'-d { direction } '
516527 '-P ,{data_port} '
517528 f'-o { OUTPUT_SELECTOR } '
518529 )
519530
520- if benchmark_name .upper () == 'UDP_STREAM' :
521- send_size = FLAGS .netperf_udp_stream_send_size_in_bytes
522- netperf_cmd += f' -R 1 -m { send_size } -M { send_size } '
523- metadata ['netperf_send_size_in_bytes' ] = (
524- FLAGS .netperf_udp_stream_send_size_in_bytes
525- )
526-
527- elif benchmark_name .upper () == 'TCP_STREAM' :
528- send_size = FLAGS .netperf_tcp_stream_send_size_in_bytes
531+ if direction == 'STREAM' :
532+ if protocol == 'UDP' :
533+ send_size = FLAGS .netperf_udp_stream_send_size_in_bytes
534+ netperf_cmd += ' -R 1'
535+ elif protocol == 'TCP' :
536+ send_size = FLAGS .netperf_tcp_stream_send_size_in_bytes
537+ elif protocol == 'SCTP' :
538+ send_size = _SCTP_SEND_SIZE .value
539+ else :
540+ raise ValueError (
541+ f'Unsupported protocol for netperf stream benchmark: { protocol } '
542+ )
529543 netperf_cmd += f' -m { send_size } -M { send_size } '
530- metadata ['netperf_send_size_in_bytes' ] = (
531- FLAGS .netperf_tcp_stream_send_size_in_bytes
532- )
544+ metadata ['netperf_send_size_in_bytes' ] = send_size
533545
534546 if FLAGS .netperf_thinktime != 0 :
535547 netperf_cmd += (
@@ -539,7 +551,7 @@ def RunNetperf(vm, benchmark_name, server_ips, num_streams, client_ips):
539551 f'{ FLAGS .netperf_thinktime_run_length } '
540552 )
541553
542- if FLAGS .netperf_mss and 'TCP' in benchmark_name . upper () :
554+ if FLAGS .netperf_mss and protocol == 'TCP' :
543555 netperf_cmd += f' -G { FLAGS .netperf_mss } b'
544556 metadata ['netperf_mss_requested' ] = FLAGS .netperf_mss
545557
0 commit comments