aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo_gsm_tester
diff options
context:
space:
mode:
authorAndre Puschmann <andre@softwareradiosystems.com>2020-06-17 15:36:30 +0200
committerAndre Puschmann <andre@softwareradiosystems.com>2020-06-23 16:41:00 +0200
commit55b455cbf64bd057d659ca58d78c2d37e00509a1 (patch)
tree1ee2a985208e54f8d79d513f0af3b88a321403da /src/osmo_gsm_tester
parent0957e9e09570c9d9bd977dde742a6acc9ee96e7a (diff)
iperf3: add getter to retrieve received bitrate
Diffstat (limited to 'src/osmo_gsm_tester')
-rw-r--r--src/osmo_gsm_tester/obj/iperf3.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/osmo_gsm_tester/obj/iperf3.py b/src/osmo_gsm_tester/obj/iperf3.py
index e0e05d8..d61dbb1 100644
--- a/src/osmo_gsm_tester/obj/iperf3.py
+++ b/src/osmo_gsm_tester/obj/iperf3.py
@@ -70,6 +70,14 @@ def print_result_node_tcp(result, node_str):
print("Exception while using iperf3 %s results: %r" % (node_str, repr(result)))
raise e
+def get_received_mbps(result, isUdp=True):
+ try:
+ recv = result['end']['sum' if isUdp else 'sum_received']
+ return recv['bits_per_second']/1e6
+ except Exception as e:
+ print("Exception while using iperf3 results: %r" % (repr(result)))
+ raise e
+
class IPerf3Server(log.Origin):
DEFAULT_SRV_PORT = 5003
@@ -170,6 +178,9 @@ class IPerf3Server(log.Origin):
else:
print_result_node_tcp(self.get_results(), 'server')
+ def get_received_mbps(self, client_was_udp):
+ return get_received_mbps(self.get_results(), client_was_udp)
+
def addr(self):
return self.ip_address.get('addr')
@@ -320,6 +331,12 @@ class IPerf3Client(log.Origin):
else:
print_result_node_tcp(self.get_results(), 'client')
+ def get_received_mbps(self):
+ if self.proto() == self.PROTO_UDP:
+ return get_received_mbps(self.get_results(), isUdp=True)
+ else:
+ return get_received_mbps(self.get_results(), isUdp=False)
+
def set_run_node(self, run_node):
self._run_node = run_node