def get_bdp_fraction(rtt, bandwidth, fraction): #in packets rtt_ms = delay_convert(rtt) if rtt_ms == 20: bandwidth = '50mbit' elif rtt_ms == 80: bandwidth = '10mbit' return router_buffer_convert(fraction, bandwidth, rtt)
# the parameters for the tests aqm_algorithms=('droptail', 'ared', 'codel') # router buffer policies delay="200ms" # enforced delay tests = ( # where bw is the enforced bandwidth, buffersize is the router buffer upper limits, time is the iperf execution time #{ 'bw': '300kbit', 'buffersize': ('200%', '100%'), 'time': 300 }, { 'bw': '1mbit', 'buffersize': ('200', '200%', '100%', '50%'), 'time': 240 }, { 'bw': '5mbit', 'buffersize': ('200', '200%', '100%', '50%'), 'time': 120 }, { 'bw': '10mbit', 'buffersize': ('200', '200%', '100%', '50%'), 'time': 60 }, ) # end parameters for aqm_algorithm in aqm_algorithms: for i, test in enumerate(tests): for buffersize in test['buffersize']: session_infos = { 'type': 'iperf', 'aqm_algorithm': aqm_algorithm, 'bandwidth': test['bw'], 'delay': delay, 'bandwidth_buffersize': router_buffer_convert(buffersize, test['bw'], delay), 'bandwidth_buffersize_description': buffersize } set_bw_command = 'set_bw_aqm {aqm_algorithm} {bandwidth} {bandwidth_buffersize} {delay}'.format(**session_infos) if aqm_algorithm == 'droptail': set_bw_command = 'set_bw {bandwidth} {bandwidth_buffersize} {delay}'.format(**session_infos) scheduler_commands = '''\ #SESSION{session_infos} client0 0 iperf -s &>$LOGDIR/iperf_s.log & echo $! > /tmp/pid_iperf_server client0 2 sudo tcpdump -i eth1 port 5001 -s0 -w $LOGDIR/receiver.pcap 2>&1 & echo $! > /tmp/pid_tcpdump client0 {killtime} sudo kill -SIGTERM $(cat /tmp/pid_tcpdump) & kill -SIGTERM $(cat /tmp/pid_iperf_server) delay 0 /vagrant/code/tc_helper.sh set_delay {delay} delay {cleantime} /vagrant/code/tc_helper.sh destroy