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 * |
| 3 | |
| 4 | def print_results(cli_res, srv_res): |
| 5 | cli_sent = cli_res['end']['sum_sent'] |
| 6 | cli_recv = cli_res['end']['sum_received'] |
| 7 | print("RESULT client:") |
| 8 | print("\tSEND: %d KB, %d kbps, %d seconds (%d retrans)" % (cli_sent['bytes']/1000, cli_sent['bits_per_second']/1000, cli_sent['seconds'], cli_sent['retransmits'])) |
| 9 | print("\tRECV: %d KB, %d kbps, %d seconds" % (cli_recv['bytes']/1000, cli_recv['bits_per_second']/1000, cli_recv['seconds'])) |
| 10 | print("RESULT server:") |
| 11 | print("\tSEND: %d KB, %d kbps, %d seconds" % (cli_sent['bytes']/1000, cli_sent['bits_per_second']/1000, cli_sent['seconds'])) |
| 12 | print("\tRECV: %d KB, %d kbps, %d seconds" % (cli_recv['bytes']/1000, cli_recv['bits_per_second']/1000, cli_recv['seconds'])) |
| 13 | |
| 14 | |
| 15 | epc = suite.epc() |
| 16 | enb = suite.enb() |
| 17 | ue = suite.modem() |
| 18 | iperf3srv = suite.iperf3srv({'addr': epc.tun_addr()}) |
| 19 | iperf3srv.set_run_node(epc.run_node()) |
| 20 | iperf3cli = iperf3srv.create_client() |
| 21 | iperf3cli.set_run_node(ue.run_node()) |
| 22 | |
| 23 | epc.subscriber_add(ue) |
| 24 | epc.start() |
| 25 | enb.ue_add(ue) |
| 26 | enb.start(epc) |
| 27 | |
| 28 | print('waiting for ENB to connect to EPC...') |
| 29 | wait(epc.enb_is_connected, enb) |
| 30 | print('ENB is connected to EPC') |
| 31 | |
| 32 | ue.connect(enb) |
| 33 | |
| 34 | iperf3srv.start() |
| 35 | proc = iperf3cli.prepare_test_proc(ue.netns()) |
| 36 | |
| 37 | print('waiting for UE to attach...') |
| 38 | wait(ue.is_connected, None) |
| 39 | print('UE is attached') |
| 40 | |
| 41 | print("Running iperf3 client to %s through %s" % (str(iperf3cli), ue.netns())) |
| 42 | proc.launch_sync() |
| 43 | iperf3srv.stop() |
| 44 | print_results(iperf3cli.get_results(), iperf3srv.get_results()) |