-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtestapp.py
61 lines (52 loc) · 1.33 KB
/
testapp.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
"""
Development application.
"""
import logging
import asyncio
import os
from py3iperf3.iperf3_client import Iperf3Client
from py3iperf3.iperf3_api import Iperf3TestProto
from py3iperf3.utils import setup_logging
def main():
"""
Test app entry point.
"""
loop = asyncio.get_event_loop()
params = {
'server_address':'192.168.137.10',
'server_port':5201,
#'client_port':1337,
'ip_version':4,
'test_duration':10,
'debug': False,
#'log_filename':r'C:\py\test.txt',
'format':'g',
'parallel':1,
#'blockcount':10,
#'bytes': 100000000,
'reverse':True,
'test_protocol': Iperf3TestProto.UDP,
'window':16000
}
setup_logging(**params)
iperf3_client = Iperf3Client(loop=loop)
iperf3_client.create_test(test_parameters=params)
if os.name == 'nt':
def wakeup():
"""
Fake wake-up
"""
# Call again later
loop.call_later(0.5, wakeup)
loop.call_later(0.5, wakeup)
try:
loop.call_soon(iperf3_client.run_all_tests)
loop.run_forever()
except KeyboardInterrupt:
pass
logging.info('Closing client')
iperf3_client.stop_all_tests()
loop.close()
logging.shutdown()
if __name__ == '__main__':
main()