-
Notifications
You must be signed in to change notification settings - Fork 4
/
generate-traffic.py
executable file
·41 lines (31 loc) · 1.02 KB
/
generate-traffic.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
#!/usr/bin/env python3
#
# This script allows to run a traffic generator outside
# the testcase. E.g. on a manual setup!
#
import sys
from aqmt import MBIT, Testbed, TestEnv, processes, traffic
from aqmt.traffic import greedy, udp
def run_test(test_fn):
testbed = Testbed()
testenv = TestEnv(testbed, is_interactive=True)
def run_traffic(traffic_fn, **kwargs):
traffic_fn(
dry_run=False,
testbed=testbed,
hint_fn=lambda hint: None,
run_fn=testenv.run,
**kwargs,
)
test_fn(run_traffic)
sys.stdout.write('Press enter to stop traffic and cleanup ')
input()
processes.kill_known_pids()
testenv.get_terminal().cleanup()
if __name__ == '__main__':
def test(run_traffic):
run_traffic(greedy, node='a')
run_traffic(greedy, node='b')
#run_traffic(udp, node='a', bitrate=150*MBIT, ect='nonect') # ect1,nonect
#run_traffic(udp, node='b', bitrate=150*MBIT, ect='ect1') # ect1,nonect
run_test(test)