Change in osmo-gsm-tester[master]: 4g-iperf3-ul: modified the test to parameterize the number of ue in t...

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Alejandro Leal gerrit-no-reply at lists.osmocom.org
Wed May 19 14:38:55 UTC 2021


Alejandro Leal has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-gsm-tester/+/24274 )


Change subject: 4g-iperf3-ul: modified the test to parameterize the number of ue in the test.
......................................................................

4g-iperf3-ul: modified the test to parameterize the number of ue in the test.

Parameterize the iperf3 uplink test for the 4g test suite to execute a
given number of UEs. By default, the number of ue is 1.

Change-Id: I4b006df04bd1af6c117bcb25e6a6b1609ac732fb
---
M sysmocom/suites/4g/iperf3_ul.py
1 file changed, 73 insertions(+), 23 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/74/24274/1

diff --git a/sysmocom/suites/4g/iperf3_ul.py b/sysmocom/suites/4g/iperf3_ul.py
index e243774..541b0d0 100755
--- a/sysmocom/suites/4g/iperf3_ul.py
+++ b/sysmocom/suites/4g/iperf3_ul.py
@@ -1,48 +1,98 @@
 #!/usr/bin/env python3
 from osmo_gsm_tester.testenv import *
 import os
+import threading
+
+def run_iperf(proc):
+  proc.launch_sync()
 
 # Overlay suite-specific templates folder if it exists
 if os.path.isdir(os.path.join(os.path.dirname(__file__), 'templates')):
   tenv.set_overlay_template_dir(os.path.join(os.path.dirname(__file__), 'templates'))
 
+# Retrieve the number of physical ue from the test suite configuration.
+test_config = tenv.config_test_specific()
+nof_ue = int(test_config.get("nof_physical_ue", 1))
+
+print(f'Number of physical ue: {nof_ue}')
+
+ue = []
+
+# Get the ue from the test configuration.
+for n in range(0, nof_ue):
+  ue.append(tenv.modem())
+  print(f'ue index{n}: {ue[n]}')
+
 epc = tenv.epc()
 enb = tenv.enb()
-ue = tenv.modem()
-iperf3srv = tenv.iperf3srv({'addr': epc.tun_addr()})
-iperf3srv.set_run_node(epc.run_node())
-iperf3cli = iperf3srv.create_client()
-iperf3cli.set_run_node(ue.run_node())
 
-epc.subscriber_add(ue)
+iperf3srv = []
+for n in range(0, nof_ue):
+  iperf3srv.append(tenv.iperf3srv({'addr': epc.tun_addr()}, n))
+  iperf3srv[n].set_run_node(epc.run_node())
+
+# Set the iperf clients in the ue.
+iperf3cli = []
+for n in range(0, nof_ue):
+  iperf3cli.append(iperf3srv[n].create_client())
+  iperf3cli[n].set_run_node(ue[n].run_node())
+
+for n in range(0, nof_ue):
+  epc.subscriber_add(ue[n])
 epc.start()
-enb.ue_add(ue)
+
+for n in range(0, nof_ue):
+  enb.ue_add(ue[n])
 enb.start(epc)
 
 print('waiting for ENB to connect to EPC...')
 wait(epc.enb_is_connected, enb)
 print('ENB is connected to EPC')
 
-ue.connect(enb)
+for n in range(0, nof_ue):
+  ue[n].connect(enb)
 
-max_rate = enb.ue_max_rate(downlink=False, num_carriers=ue.num_carriers)
+for n in range(0, nof_ue):
+  iperf3srv[n].start()
 
-iperf3srv.start()
-proc = iperf3cli.prepare_test_proc(iperf3cli.DIR_UL, ue.netns(), bitrate=max_rate)
+proc = []
 
-print('waiting for UE to attach...')
-wait(ue.is_registered)
-print('UE is attached')
+# Attach all the ue's.
+for n in range(0, nof_ue):
+  max_rate = enb.ue_max_rate(downlink=False, num_carriers=ue[n].num_carriers)
+  client = iperf3cli[n].prepare_test_proc(iperf3cli[n].DIR_UL, ue[n].netns(), bitrate=max_rate)
+  print(f'Iperf client type: {type(client)}')
+  proc.append(client)
+  print(f'waiting for UE {n} to attach...')
+  wait(ue[n].is_registered)
+  print(f'UE {n} is attached')
 
-print("Running iperf3 client to %s through %s" % (str(iperf3cli), ue.netns()))
-proc.launch_sync()
-iperf3srv.stop()
+# Start every iperf client.
+threads = []
+for n in range(0, nof_ue):
+  print("Running iperf3 %u client to %s through %s" % (n, str(iperf3cli[n]), ue[n].netns()))
+  threads.append(threading.Thread(target=run_iperf, args=(proc[n],)))
+  threads[n].start()
 
-iperf3cli.print_results()
-iperf3srv.print_results(iperf3cli.proto() == iperf3cli.PROTO_UDP)
+# Wait for all the iperfs to finish.
+for n in range(0, nof_ue):
+  threads[n].join()
+  print(f'Iperf {n} finished')
+  iperf3srv[n].stop()
+
+for n in range(0, nof_ue):
+  iperf3cli[n].print_results() 
+  iperf3srv[n].print_results(iperf3cli[n].proto() == iperf3cli[n].PROTO_UDP)
 
 # 80% of the maximum rate for half of the test duration
-half_duration = int(round(iperf3cli.time_sec() / 2))
-res_str = ue.verify_metric(max_rate * 0.8, operation='max_rolling_avg', metric='ul_brate', criterion='gt', window=half_duration)
-print(res_str)
-test.set_report_stdout(res_str)
+out = ''
+for n in range(0, nof_ue):
+  half_duration = int(round(iperf3cli[n].time_sec() / 2))
+  max_rate = enb.ue_max_rate(downlink=False, num_carriers=ue[n].num_carriers)
+  res_str = ue[n].verify_metric(max_rate * 0.8, operation='max_rolling_avg', metric='ul_brate', criterion='gt', window=half_duration)
+  print(res_str)
+  out += res_str
+  if n != nof_ue - 1:
+    out += '\n'
+
+test.set_report_stdout(out)

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/24274
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Change-Id: I4b006df04bd1af6c117bcb25e6a6b1609ac732fb
Gerrit-Change-Number: 24274
Gerrit-PatchSet: 1
Gerrit-Owner: Alejandro Leal <alejandro.leal at srs.io>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210519/7bd15c30/attachment.htm>


More information about the gerrit-log mailing list