Pau Espin Pedrol | c8b0f93 | 2020-02-11 17:45:26 +0100 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
| 2 | from osmo_gsm_tester.testenv import * |
Andre Puschmann | 4462067 | 2021-04-15 10:50:36 +0200 | [diff] [blame] | 3 | import os |
| 4 | |
| 5 | # Overlay suite-specific templates folder if it exists |
| 6 | if os.path.isdir(os.path.join(os.path.dirname(__file__), 'templates')): |
| 7 | tenv.set_overlay_template_dir(os.path.join(os.path.dirname(__file__), 'templates')) |
Pau Espin Pedrol | c8b0f93 | 2020-02-11 17:45:26 +0100 | [diff] [blame] | 8 | |
Pau Espin Pedrol | 40c7bc7 | 2020-05-05 13:41:42 +0200 | [diff] [blame] | 9 | epc = tenv.epc() |
| 10 | enb = tenv.enb() |
| 11 | ue = tenv.modem() |
| 12 | iperf3srv = tenv.iperf3srv({'addr': epc.tun_addr()}) |
Pau Espin Pedrol | c8b0f93 | 2020-02-11 17:45:26 +0100 | [diff] [blame] | 13 | iperf3srv.set_run_node(epc.run_node()) |
| 14 | iperf3cli = iperf3srv.create_client() |
| 15 | iperf3cli.set_run_node(ue.run_node()) |
| 16 | |
| 17 | epc.subscriber_add(ue) |
| 18 | epc.start() |
| 19 | enb.ue_add(ue) |
| 20 | enb.start(epc) |
| 21 | |
| 22 | print('waiting for ENB to connect to EPC...') |
| 23 | wait(epc.enb_is_connected, enb) |
| 24 | print('ENB is connected to EPC') |
| 25 | |
| 26 | ue.connect(enb) |
| 27 | |
Andre Puschmann | 7d3b83e | 2020-09-02 22:17:54 +0200 | [diff] [blame] | 28 | max_rate = enb.ue_max_rate(downlink=False, num_carriers=ue.num_carriers) |
Pau Espin Pedrol | d84a838 | 2020-05-25 14:23:37 +0200 | [diff] [blame] | 29 | |
Pau Espin Pedrol | c8b0f93 | 2020-02-11 17:45:26 +0100 | [diff] [blame] | 30 | iperf3srv.start() |
Pau Espin Pedrol | d84a838 | 2020-05-25 14:23:37 +0200 | [diff] [blame] | 31 | proc = iperf3cli.prepare_test_proc(iperf3cli.DIR_UL, ue.netns(), bitrate=max_rate) |
Pau Espin Pedrol | c8b0f93 | 2020-02-11 17:45:26 +0100 | [diff] [blame] | 32 | |
| 33 | print('waiting for UE to attach...') |
Pau Espin Pedrol | 57e37f9 | 2020-06-11 17:12:26 +0200 | [diff] [blame] | 34 | wait(ue.is_registered) |
Pau Espin Pedrol | c8b0f93 | 2020-02-11 17:45:26 +0100 | [diff] [blame] | 35 | print('UE is attached') |
| 36 | |
| 37 | print("Running iperf3 client to %s through %s" % (str(iperf3cli), ue.netns())) |
| 38 | proc.launch_sync() |
| 39 | iperf3srv.stop() |
Pau Espin Pedrol | 3a0dea6 | 2020-05-21 14:54:46 +0200 | [diff] [blame] | 40 | |
| 41 | iperf3cli.print_results() |
| 42 | iperf3srv.print_results(iperf3cli.proto() == iperf3cli.PROTO_UDP) |
Pau Espin Pedrol | 151b08a | 2020-03-02 14:14:27 +0100 | [diff] [blame] | 43 | |
Andre Puschmann | d253a10 | 2020-10-28 21:11:14 +0100 | [diff] [blame] | 44 | # 80% of the maximum rate for half of the test duration |
| 45 | half_duration = int(round(iperf3cli.time_sec() / 2)) |
| 46 | res_str = ue.verify_metric(max_rate * 0.8, operation='max_rolling_avg', metric='ul_brate', criterion='gt', window=half_duration) |
Pau Espin Pedrol | 644cb41 | 2020-03-04 16:14:31 +0100 | [diff] [blame] | 47 | print(res_str) |
| 48 | test.set_report_stdout(res_str) |