@@ -154,7 +154,7 @@ def test_rx_rate_limiting_cpu_load(test_microvm_with_api, network_config):
154
154
test_microvm .start ()
155
155
156
156
# Start iperf server on guest.
157
- _start_iperf_on_guest (test_microvm , guest_ip )
157
+ _start_iperf_server_on_guest (test_microvm , guest_ip )
158
158
159
159
# Run iperf client sending UDP traffic.
160
160
iperf_cmd = "{} {} -u -c {} -b 1000000000 -t{} -f KBytes" .format (
@@ -177,13 +177,13 @@ def test_rx_rate_limiting_cpu_load(test_microvm_with_api, network_config):
177
177
threshold = 20 ,
178
178
)
179
179
with cpu_load_monitor :
180
- _run_local_iperf (iperf_cmd )
180
+ _run_iperf_on_host (iperf_cmd )
181
181
182
182
183
183
def _check_tx_rate_limiting (test_microvm , guest_ips , host_ips ):
184
184
"""Check that the transmit rate is within expectations."""
185
- # Start iperf on the host as this is the tx rate limiting test.
186
- _start_local_iperf (test_microvm .jailer .netns_cmd_prefix ())
185
+ # Start iperf server on the host as this is the tx rate limiting test.
186
+ _start_iperf_server_on_host (test_microvm .jailer .netns_cmd_prefix ())
187
187
188
188
# First step: get the transfer rate when no rate limiting is enabled.
189
189
# We are receiving the result in KBytes from iperf.
@@ -226,8 +226,8 @@ def _check_tx_rate_limiting(test_microvm, guest_ips, host_ips):
226
226
227
227
def _check_rx_rate_limiting (test_microvm , guest_ips ):
228
228
"""Check that the receiving rate is within expectations."""
229
- # Start iperf on guest.
230
- _start_iperf_on_guest (test_microvm , guest_ips [0 ])
229
+ # Start iperf server on guest.
230
+ _start_iperf_server_on_guest (test_microvm , guest_ips [0 ])
231
231
232
232
# First step: get the transfer rate when no rate limiting is enabled.
233
233
# We are receiving the result in KBytes from iperf.
@@ -251,7 +251,7 @@ def _check_rx_rate_limiting(test_microvm, guest_ips):
251
251
252
252
# Third step: get the number of bytes when rate limiting is on and there is
253
253
# an initial burst size from where to consume.
254
- print ("Run guest TX iperf with exact burst size" )
254
+ print ("Run guest RX iperf with exact burst size" )
255
255
# Use iperf to obtain the bandwidth when there is burst to consume from,
256
256
# send exactly BURST_SIZE packets.
257
257
iperf_cmd = "{} {} -c {} -n {} -f KBytes -w {} -N" .format (
@@ -261,7 +261,7 @@ def _check_rx_rate_limiting(test_microvm, guest_ips):
261
261
BURST_SIZE ,
262
262
IPERF_TCP_WINDOW ,
263
263
)
264
- iperf_out = _run_local_iperf (iperf_cmd )
264
+ iperf_out = _run_iperf_on_host (iperf_cmd )
265
265
print (iperf_out )
266
266
_ , burst_kbps = _process_iperf_output (iperf_out )
267
267
print ("RX burst_kbps: {}" .format (burst_kbps ))
@@ -395,7 +395,7 @@ def _get_rx_bandwidth_with_duration(test_microvm, guest_ip, duration):
395
395
duration ,
396
396
IPERF_TCP_WINDOW ,
397
397
)
398
- iperf_out = _run_local_iperf (iperf_cmd )
398
+ iperf_out = _run_iperf_on_host (iperf_cmd )
399
399
print (iperf_out )
400
400
401
401
_ , observed_kbps = _process_iperf_output (iperf_out )
@@ -420,7 +420,7 @@ def _patch_iface_bw(test_microvm, iface_id, rx_or_tx, new_bucket_size, new_refil
420
420
assert test_microvm .api_session .is_status_no_content (resp .status_code )
421
421
422
422
423
- def _start_iperf_on_guest (test_microvm , hostname ):
423
+ def _start_iperf_server_on_guest (test_microvm , hostname ):
424
424
"""Start iperf in server mode through an SSH connection."""
425
425
test_microvm .ssh_config ["hostname" ] = hostname
426
426
@@ -441,7 +441,7 @@ def _run_iperf_on_guest(test_microvm, iperf_cmd, hostname):
441
441
return out
442
442
443
443
444
- def _start_local_iperf (netns_cmd_prefix ):
444
+ def _start_iperf_server_on_host (netns_cmd_prefix ):
445
445
"""Start iperf in server mode after killing any leftover iperf daemon."""
446
446
iperf_cmd = "pkill {}\n " .format (IPERF_BINARY )
447
447
@@ -457,7 +457,7 @@ def _start_local_iperf(netns_cmd_prefix):
457
457
time .sleep (1 )
458
458
459
459
460
- def _run_local_iperf (iperf_cmd ):
460
+ def _run_iperf_on_host (iperf_cmd ):
461
461
"""Execute a client related iperf command locally."""
462
462
code , stdout , stderr = utils .run_cmd (iperf_cmd )
463
463
assert code == 0 , f"stdout: { stdout } \n stderr: { stderr } "
0 commit comments