summaryrefslogtreecommitdiff
path: root/test-cli/test/tests/qiperf.py
diff options
context:
space:
mode:
authorManel Caro <mcaro@iseebcn.com>2019-03-09 21:25:56 +0100
committerManel Caro <mcaro@iseebcn.com>2019-03-09 21:25:56 +0100
commit9332c933fc05f42882640c9a4e35fab09854af84 (patch)
tree2b9b00b5a411b27f9705603c0d93b8925afd4677 /test-cli/test/tests/qiperf.py
downloadboard-9332c933fc05f42882640c9a4e35fab09854af84.zip
board-9332c933fc05f42882640c9a4e35fab09854af84.tar.gz
board-9332c933fc05f42882640c9a4e35fab09854af84.tar.bz2
Board: Client Test Suite Initial Commit
Diffstat (limited to 'test-cli/test/tests/qiperf.py')
-rw-r--r--test-cli/test/tests/qiperf.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/test-cli/test/tests/qiperf.py b/test-cli/test/tests/qiperf.py
new file mode 100644
index 0000000..126b6ee
--- /dev/null
+++ b/test-cli/test/tests/qiperf.py
@@ -0,0 +1,53 @@
+from test.helpers.syscmd import SysCommand
+
+
+class QIperf(object):
+ __sip = None
+ __raw_out = None
+ __MB_req = None
+ __MB_real = None
+ __BW_real = None
+ __dat_list = None
+ __bind = None
+
+ def __init__(self, sip = None):
+ if sip is not None:
+ self.__sip = sip
+ self.__MB_req = '10'
+
+ def execute(self, sip = None, bind = None):
+ if sip is not None:
+ self.__sip = sip
+
+ if bind is None:
+ str_cmd = "iperf -c {} -x CMSV -n {}M".format(self.__sip, self.__MB_req)
+ else:
+ self.__bind = bind
+ str_cmd = "iperf -c {} -x CMSV -n {}M -B {}".format(self.__sip, self.__MB_req, self.__bind)
+ t = SysCommand("iperf", str_cmd)
+ if t.execute() == 0:
+ self.__raw_out = t.getOutput()
+ if self.__raw_out == "":
+ return -1
+ lines = t.getOutput().splitlines()
+ dat = lines[1]
+ dat = dat.decode('ascii')
+ dat_list = dat.split( )
+ for d in dat_list:
+ a = dat_list.pop(0)
+ if a == "sec":
+ break
+ self.__MB_real = dat_list[0]
+ self.__BW_real = dat_list[2]
+ self.__dat_list = dat_list
+ print(self.__MB_real)
+ print(self.__BW_real)
+ else:
+ return -1
+ return 0
+
+ def get_Total_MB(self):
+ return self.__MB_real;
+
+ def get_Total_BW(self):
+ return self.__MB_real;