blob: 3c94a88ca5a3f54a70b49dfa1989e026bd60ad27 [file] [log] [blame]
Andre Puschmann6246a9d2021-03-12 19:03:58 +01001#!/usr/bin/env python3
2from osmo_gsm_tester.testenv import *
Andre Puschmann44620672021-04-15 10:50:36 +02003import os
4
5# Overlay suite-specific templates folder if it exists
6if 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'))
Andre Puschmann6246a9d2021-03-12 19:03:58 +01008
9epc = tenv.epc()
10enb = tenv.enb()
11ue = tenv.modem()
12iperf3srv = tenv.iperf3srv({'addr': epc.tun_addr()})
13iperf3srv.set_run_node(epc.run_node())
14iperf3cli = iperf3srv.create_client()
15iperf3cli.set_run_node(ue.run_node())
16
17epc.subscriber_add(ue)
18epc.start()
19enb.ue_add(ue)
20enb.start(epc)
21
22print('waiting for ENB to connect to EPC...')
23wait(epc.enb_is_connected, enb)
24print('ENB is connected to EPC')
25
26ue.connect(enb)
27
28max_rate_ratio = 0.8
29max_rate_dl = enb.ue_max_rate(downlink=True, num_carriers=ue.num_carriers)
30max_rate_ul = enb.ue_max_rate(downlink=False, num_carriers=ue.num_carriers)
31
32iperf3srv.start()
33proc = iperf3cli.prepare_test_proc(iperf3cli.DIR_BI, ue.netns(), bitrate=max_rate_dl)
34
35print('waiting for UE to attach...')
36wait(ue.is_registered)
37print('UE is attached')
38
39print("Running iperf3 client to %s through %s" % (str(iperf3cli), ue.netns()))
40proc.launch_sync()
41iperf3srv.stop()
42
43iperf3cli.print_results()
44iperf3srv.print_results(iperf3cli.proto() == iperf3cli.PROTO_UDP)
45
46# 80% of the maximum rate for half of the test duration
47half_duration = int(round(iperf3cli.time_sec() / 2))
48res_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)
49print(res_str)
50test.set_report_stdout(res_str)