Andre Puschmann | 6246a9d | 2021-03-12 19:03:58 +0100 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
| 2 | from osmo_gsm_tester.testenv import * |
| 3 | |
| 4 | epc = tenv.epc() |
| 5 | enb = tenv.enb() |
| 6 | ue = tenv.modem() |
| 7 | iperf3srv = tenv.iperf3srv({'addr': epc.tun_addr()}) |
| 8 | iperf3srv.set_run_node(epc.run_node()) |
| 9 | iperf3cli = iperf3srv.create_client() |
| 10 | iperf3cli.set_run_node(ue.run_node()) |
| 11 | |
| 12 | epc.subscriber_add(ue) |
| 13 | epc.start() |
| 14 | enb.ue_add(ue) |
| 15 | enb.start(epc) |
| 16 | |
| 17 | print('waiting for ENB to connect to EPC...') |
| 18 | wait(epc.enb_is_connected, enb) |
| 19 | print('ENB is connected to EPC') |
| 20 | |
| 21 | ue.connect(enb) |
| 22 | |
| 23 | max_rate_ratio = 0.8 |
| 24 | max_rate_dl = enb.ue_max_rate(downlink=True, num_carriers=ue.num_carriers) |
| 25 | max_rate_ul = enb.ue_max_rate(downlink=False, num_carriers=ue.num_carriers) |
| 26 | |
| 27 | iperf3srv.start() |
| 28 | proc = iperf3cli.prepare_test_proc(iperf3cli.DIR_BI, ue.netns(), bitrate=max_rate_dl) |
| 29 | |
| 30 | print('waiting for UE to attach...') |
| 31 | wait(ue.is_registered) |
| 32 | print('UE is attached') |
| 33 | |
| 34 | print("Running iperf3 client to %s through %s" % (str(iperf3cli), ue.netns())) |
| 35 | proc.launch_sync() |
| 36 | iperf3srv.stop() |
| 37 | |
| 38 | iperf3cli.print_results() |
| 39 | iperf3srv.print_results(iperf3cli.proto() == iperf3cli.PROTO_UDP) |
| 40 | |
| 41 | # 80% of the maximum rate for half of the test duration |
| 42 | half_duration = int(round(iperf3cli.time_sec() / 2)) |
| 43 | res_str = ue.verify_metric((max_rate_dl + max_rate_ul) * max_rate_ratio, operation='max_rolling_avg', metric='dl_brate+ul_brate', criterion='gt', window=half_duration) |
| 44 | print(res_str) |
| 45 | test.set_report_stdout(res_str) |