-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexecute-measurements.sh
1186 lines (1095 loc) · 34.7 KB
/
execute-measurements.sh
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
# cellular-satcom-emulator : Multipath Cellular and Satellite Emulation Testbed
# Copyright (C) 2023 Kaushik Chavali
#
# This file is part of the cellular-satcom-emulator.
#
# cellular-satcom-emulator is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
set -o nounset
set -o errtrace
set -o functrace
export SCRIPT_VERSION="3.0.1"
export SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
export CONFIG_DIR="${SCRIPT_DIR}/config"
export OSND_DIR="${SCRIPT_DIR}/quic-opensand-emulation"
set -o allexport
source "${CONFIG_DIR}/testbed-config.sh"
source "${CONFIG_DIR}/moon-config.sh"
set +o allexport
source "${OSND_DIR}/setup.sh"
source "${OSND_DIR}/setup-namespaces.sh"
source "${OSND_DIR}/setup-opensand.sh"
source "${OSND_DIR}/teardown.sh"
source "${OSND_DIR}/teardown-namespaces.sh"
source "${OSND_DIR}/teardown-opensand.sh"
source "${OSND_DIR}/run-ping.sh"
source "${OSND_DIR}/run-quic.sh"
source "${OSND_DIR}/run-tcp.sh"
source "${OSND_DIR}/run-http.sh"
source "${OSND_DIR}/stats.sh"
source "${SCRIPT_DIR}/setup.sh"
source "${SCRIPT_DIR}/setup-namespaces.sh"
source "${SCRIPT_DIR}/setup-moongen.sh"
source "${SCRIPT_DIR}/setup-lte.sh"
source "${SCRIPT_DIR}/setup-lte-namespaces.sh"
source "${SCRIPT_DIR}/setup-dependencies.sh"
source "${SCRIPT_DIR}/teardown.sh"
source "${SCRIPT_DIR}/teardown-namespaces.sh"
source "${SCRIPT_DIR}/teardown-moongen.sh"
source "${SCRIPT_DIR}/teardown-lte.sh"
source "${SCRIPT_DIR}/teardown-lte-namespaces.sh"
source "${SCRIPT_DIR}/teardown-dependencies.sh"
source "${SCRIPT_DIR}/run-ping.sh"
source "${SCRIPT_DIR}/run-quic.sh"
source "${SCRIPT_DIR}/run-tcp.sh"
source "${SCRIPT_DIR}/run-http.sh"
source "${SCRIPT_DIR}/run-rtp.sh"
source "${SCRIPT_DIR}/run-duplex.sh"
source "${SCRIPT_DIR}/run-iperf-duplex.sh"
source "${SCRIPT_DIR}/run-dccp-duplex.sh"
declare -A pids
# log(level, message...)
# Log a message of the specified level to the output and the log file.
function log() {
local level="$1"
shift
local msg="$@"
if [[ "$level" == "-" ]] || [[ "$msg" == "-" ]]; then
if [[ "$level" == "-" ]]; then
# Level will be read from stdin
level=""
fi
# Log each line in stdin as separate log message
while read -r err_line; do
log $level $err_line
done < <(cat -)
return
fi
local log_time="$(date --rfc-3339=seconds)"
local level_name="INFO"
local level_color="\e[0m"
local visible=true
case $level in
D | d)
level_name="DEBUG"
level_color="\e[2m"
;;
S | s)
level_name="STAT"
level_color="\e[34m"
visible=$show_stats
;;
I | i)
level_name="INFO"
level_color="\e[0m"
;;
W | w)
level_name="WARN"
level_color="\e[33m"
;;
E | e)
level_name="ERROR"
level_color="\e[31m"
;;
*)
# No level given, assume info
msg="$level $msg"
level="I"
level_name="INFO"
level_color="\e[0m"
;;
esac
# Build and print log message
local log_entry="$log_time [$level_name]: $msg"
if [[ "$visible" == true ]]; then
echo -e "$level_color$log_entry\e[0m"
fi
if [ -d "$EMULATION_DIR" ]; then
echo "$log_entry" >>"$EMULATION_DIR/opensand.log"
fi
}
# _osnd_moon_cleanup()
function _osnd_moon_cleanup() {
# Ensure all tmux sessions are closed
tmux -L ${TMUX_SOCKET} kill-server &>/dev/null
# Remove temporary directory
rm -rf "$OSND_MOON_TMP" &>/dev/null
}
# _osnd_moon_abort_measurements()
# Trap function executed on the EXIT trap during active measurements.
function _osnd_moon_abort_measurements() {
log E "Aborting measurements"
osnd_moon_teardown 2>/dev/null
for pid in "${pids[@]}"; do
kill $pid &>/dev/null
done
_osnd_moon_cleanup
}
# _osnd_moon_interrupt_measurements()
# Trap function executed when the SIGINT signal is received
function _osnd_moon_interrupt_measurements() {
# Don't just stop the current command, exit the entire script instead
exit 1
}
# _osnd_moon_check_running_emulation()
function _osnd_moon_check_running_emulation() {
# Check for running tmux sessions
if [ ! tmux -L ${TMUX_SOCKET} list-sessions ] &>/dev/null; then
echo >&2 "Active tmux sessions found!"
echo >&2 "Another emulation might already be running, or this is a leftover of a previous run."
echo >&2 "Execute the ./teardown.sh script to get rid of any leftovers."
exit 2
fi
# Check if namespaces exist
for ns in $(sudo ip netns list); do
if [[ "$ns" == "osnd"* ]]; then
echo >&2 "Existing namespace $ns!"
echo >&2 "Another emulation might already be running, or this is a leftover of a previous run."
echo >&2 "Execute the ./teardown.sh script to get rid of any leftovers."
exit 3
fi
done
}
# _osnd_moon_create_emulation_output_dir()
function _osnd_moon_create_emulation_output_dir() {
log D "Creating output directory"
if [ -e "$EMULATION_DIR" ]; then
echo >&2 "Output directory $EMULATION_DIR already exists"
exit 4
fi
mkdir -p "$EMULATION_DIR"
if [ $? -ne 0 ]; then
echo >&2 "Failed to create output directory $EMULATION_DIR"
exit 5
fi
# Create 'latest' symlink
local latest_link="$RESULTS_DIR/latest"
if [ -h "$latest_link" ]; then
rm "$latest_link"
fi
if [ ! -e "$latest_link" ]; then
ln -s "$EMULATION_DIR" "$latest_link"
fi
}
# _osnd_moon_create_emulation_tmp_dir()
function _osnd_moon_create_emulation_tmp_dir() {
log D "Creating temporary directory"
local tmp_dir=$(mktemp -d --tmpdir opensand-moongen.XXXXXX)
if [ "$?" -ne 0 ]; then
echo >&2 "Failed to create temporary directory"
exit 6
fi
export OSND_TMP="$tmp_dir"
export OSND_MOON_TMP="${OSND_TMP}"
}
# _osnd_moon_start_logging_pipe()
# Creates a named pipe to be used by processes in tmux sessions to output log messages
function _osnd_moon_start_logging_pipe() {
log D "Starting log pipe"
mkfifo "${OSND_MOON_TMP}/logging"
tail -f -n +0 "${OSND_MOON_TMP}/logging" > >(log -) &
pids['logpipe']=$!
}
# _osnd_moon_stop_logging_pipe()
function _osnd_moon_stop_logging_pipe() {
log D "Stopping log pipe"
kill ${pids['logpipe']} &>/dev/null
unset pids['logpipe']
rm "${OSND_MOON_TMP}/logging"
}
# _osnd_moon_generate_scenarios()
function _osnd_moon_generate_scenarios() {
scenario_file="$OSND_MOON_TMP/scenarios"
echo "# Scenario config generated at $(date)" >"$scenario_file"
local common_options="-N ${run_cnt} -T ${ttfb_run_cnt} -P ${env_prime_secs} -D ${dump_packets}"
if [[ "$exec_plain" != "true" ]]; then
common_options="$common_options -V"
fi
if [[ "$exec_pep" != "true" ]]; then
common_options="$common_options -W"
fi
if [[ "$exec_ping" != "true" ]]; then
common_options="$common_options -X"
fi
if [[ "$exec_quic" != "true" ]]; then
common_options="$common_options -Y"
fi
if [[ "$exec_tcp" != "true" ]]; then
common_options="$common_options -Z"
fi
if [[ "$exec_http" != "true" ]]; then
common_options="$common_options -H"
fi
if [[ "$exec_rtp" != "true" ]]; then
common_options="$common_options -R"
fi
if [[ "$exec_duplex" != "true" ]]; then
common_options="$common_options -d"
fi
if [[ "$exec_iperf_duplex" != "true" ]]; then
common_options="$common_options -i"
fi
if [[ "$exec_dccp_duplex" != "true" ]]; then
common_options="$common_options -j"
fi
if [[ "$save_video" != "false" ]]; then
common_options="$common_options -o"
fi
if [[ ${#qlog_file} -le 0 ]]; then
qlog_file="${EMULATION_DIR}/client.qlog,${EMULATION_DIR}/server.qlog"
fi
for orbit in "${orbits[@]}"; do
for attenuation in "${attenuations[@]}"; do
for ccs in "${cc_algorithms[@]}"; do
for tbs in "${transfer_buffer_sizes[@]}"; do
for qbs in "${quicly_buffer_sizes[@]}"; do
for ubs in "${udp_buffer_sizes[@]}"; do
for delay in "${delays[@]}"; do
for loss in "${packet_losses[@]}"; do
for iw in "${iws[@]}"; do
for ack_freq in "${ack_freqs[@]}"; do
for bw in "${iperf_bw[@]}"; do
for route in "${routing_strategy[@]}"; do
for gds in "${ground_delays[@]}"; do
for mp_ccs in "${mptcp_cc_algorithms[@]}"; do
for mp_pm in "${mptcp_path_managers[@]}"; do
for mp_sched in "${mptcp_schedulers[@]}"; do
for mp_prot in "${mp_protocols[@]}"; do
for mp_re in "${mp_reordering_engine[@]}"; do
local scenario_options="-O ${orbit} -A ${attenuation} -C ${ccs} -B ${tbs} -Q ${qbs} -U ${ubs} -E ${delay} -L ${loss} -I ${iw} -F ${ack_freq} -l ${qlog_file} -b ${bw} -r ${route} -g ${gds} -c ${mp_ccs} -p ${mp_pm} -S ${mp_sched} -m ${mp_prot} -e ${mp_re}"
echo "$common_options $scenario_options" >>"$scenario_file"
done
done
done
done
done
done
done
done
done
done
done
done
done
done
done
done
done
done
}
# _osnd_moon_count_scenarios()
function _osnd_moon_count_scenarios() {
awk '!/^(#.*)?$/' "$scenario_file" | wc -l
}
# _osnd_moon_read_scenario(config_ref, scenario)
function _osnd_moon_read_scenario() {
local -n config_ref="$1"
local scenario="$2"
local parsed_scenario_args=$(getopt -n "opensand-moongen scenario" -o "A:b:B:c:C:dD:e:E:F:g:HiI:jl:L:m:M:N:oO:p:P:Q:r:RS:T:U:VWXYZ" -l "attenuation:,iperf-bandwidth:,transport-buffers:,mptcp-congestion-control:,congestion-control:,disable-duplex,dump:,mpdccp-reordering-engine:,delay:,ack-frequency:,ground-delays:,disable-http,disable-iperf-duplex,initial-window:,disable-dccp-duplex,qlog-file:,loss:,multipath-protocol:,modulation:,runs:,--enable-video-logging,orbit:,mptcp-path-manager:,prime:,quicly-buffers:,routing-strategy:,disable-rtp,mptcp-scheduler:,timing-runs:,udp-buffers:,disable-plain,disable-pep,disable-ping,disable-quic,disable-tcp" -- $scenario)
local parsing_status=$?
if [ "$parsing_status" != "0" ]; then
return 1
fi
set +o nounset
eval set -- "$parsed_scenario_args"
while :; do
case "$1" in
-A | --attenuation)
config_ref['attenuation']="$2"
shift 2
;;
-b | --iperf-bandwidth)
config_ref['bw']="$2"
shift 2
;;
-B | --transport-buffers)
config_ref['tbs']="$2"
shift 2
;;
-c | --mptcp-congestion-control)
config_ref['mp_cc']="$2"
shift 2
;;
-C | --congestion-control)
config_ref['ccs']="$2"
shift 2
;;
-d | --disable-duplex)
config_ref['exec_duplex']="false"
shift 1
;;
-D | --dump)
config_ref['dump']="$2"
shift 2
;;
-e | --mpdccp-reordering-engine)
config_ref['mp_re']="$2"
shift 2
;;
-E | --delay)
config_ref['delay']="$2"
shift 2
;;
-F | --ack-frequency)
config_ref['ack_freq']="$2"
shift 2
;;
-g | --ground-delays)
config_ref['gds']="$2"
shift 2
;;
-H | --disable-http)
config_ref['exec_http']="false"
shift 1
;;
-i | --disable-iperf-duplex)
config_ref['exec_iperf_duplex']="false"
shift 1
;;
-I | --initial-window)
config_ref['iw']="$2"
shift 2
;;
-j | --disable-dccp-duplex)
config_ref['exec_dccp_duplex']="false"
shift 1
;;
-m | --multipath-protocol)
config_ref['mp_prot']="$2"
shift 2
;;
-M | --modulation)
config_ref['modulation_id']="$2"
shift 2
;;
-N | --runs)
config_ref['runs']="$2"
shift 2
;;
-l | --qlog-file)
config_ref['qlog_file']="$2"
shift 2
;;
-L | --loss)
config_ref['loss']="$2"
shift 2
;;
-o | --enable-video-logging)
config_ref['save_video']="true"
shift 1
;;
-O | --orbit)
config_ref['orbit']="$2"
shift 2
;;
-p | --mptcp-path-manager)
config_ref['mp_pm']="$2"
shift 2
;;
-P | --prime)
config_ref['prime']="$2"
shift 2
;;
-Q | --quicly-buffers)
config_ref['qbs']="$2"
shift 2
;;
-r | --routing-strategy)
config_ref['route']="$2"
shift 2
;;
-R | --disable-rtp)
config_ref['exec_rtp']="false"
shift 1
;;
-S | --mptcp-scheduler)
config_ref['mp_sched']="$2"
shift 2
;;
-T | --timing-runs)
config_ref['timing_runs']="$2"
shift 2
;;
-U | --udp-buffers)
config_ref['ubs']="$2"
shift 2
;;
-V | --disable-plain)
config_ref['exec_plain']="false"
shift 1
;;
-W | --disable-pep)
config_ref['exec_pep']="false"
shift 1
;;
-X | --disable-ping)
config_ref['exec_ping']="false"
shift 1
;;
-Y | --disable-quic)
config_ref['exec_quic']="false"
shift 1
;;
-Z | --disable-tcp)
config_ref['exec_tcp']="false"
shift 1
;;
--)
# Stop parsing args
shift 1
break
;;
*)
echo >&2 "Unknown argument while reading scenario: $1"
return 2
;;
esac
done
set -o nounset
}
# _osnd_moon_exec_scenario_with_config(config_name)
function _osnd_moon_exec_scenario_with_config() {
local config_name="$1"
local -n config_ref="$1"
# Create output directory for measurements in this configuration
local measure_output_dir="${EMULATION_DIR}/${config_ref['id']}"
if [ -d "$measure_output_dir" ]; then
log W "Output directory $measure_output_dir already exists"
fi
mkdir -p "$measure_output_dir"
# Save configuration
{
echo "script_version=${SCRIPT_VERSION}"
for config_key in "${!config_ref[@]}"; do
echo "${config_key}=${config_ref[$config_key]}"
done
} | sort >"$measure_output_dir/config.txt"
local run_cnt=${config_ref['runs']:-1}
local run_timing_cnt=${config_ref['timing_runs']:-2}
local sel_route=${config_ref['route']:-"LTE"}
if [[ "${config_ref['route']:-"LTE"}" == "LTE" ]]; then
config_ref['exec_pep']=false
fi
if [[ "${config_ref['route']:-"LTE"}" == "MP" ]]; then
config_ref['exec_quic']=false
config_ref['exec_http']=false
fi
if [[ "${config_ref['exec_ping']:-true}" == true ]]; then
osnd_moon_measure_ping "$config_name" "$measure_output_dir" "$sel_route"
fi
if [[ "${config_ref['exec_quic']:-true}" == true ]]; then
if [[ "${config_ref['exec_plain']:-true}" == true ]]; then
osnd_moon_measure_quic_goodput "$config_name" "$measure_output_dir" false "$sel_route" $run_cnt
osnd_moon_measure_quic_timing "$config_name" "$measure_output_dir" false "$sel_route" $run_timing_cnt
fi
if [[ "${config_ref['exec_pep']:-true}" == true ]]; then
osnd_moon_measure_quic_goodput "$config_name" "$measure_output_dir" true "$sel_route" $run_cnt
osnd_moon_measure_quic_timing "$config_name" "$measure_output_dir" true "$sel_route" $run_timing_cnt
fi
fi
if [[ "${config_ref['exec_tcp']:-true}" == true ]]; then
if [[ "${config_ref['exec_plain']:-true}" == true ]]; then
osnd_moon_measure_tcp_goodput "$config_name" "$measure_output_dir" false "$sel_route" $run_cnt
osnd_moon_measure_tcp_timing "$config_name" "$measure_output_dir" false "$sel_route" $run_timing_cnt
fi
if [[ "${config_ref['exec_pep']:-true}" == true ]]; then
osnd_moon_measure_tcp_goodput "$config_name" "$measure_output_dir" true "$sel_route" $run_cnt
osnd_moon_measure_tcp_timing "$config_name" "$measure_output_dir" true "$sel_route" $run_timing_cnt
fi
fi
if [[ "${config_ref['exec_http']:-true}" == true ]]; then
if [[ "${config_ref['exec_tcp']:-true}" == true ]]; then
if [[ "${config_ref['exec_plain']:-true}" == true ]]; then
osnd_moon_measure_http "$config_name" "$measure_output_dir" false "$sel_route" $run_cnt false
fi
if [[ "${config_ref['exec_pep']:-false}" == true ]]; then
osnd_moon_measure_http "$config_name" "$measure_output_dir" true "$sel_route" $run_cnt false
fi
fi
if [[ "${config_ref['exec_quic']:-true}" == true ]]; then
if [[ "${config_ref['exec_plain']:-true}" == true ]]; then
osnd_moon_measure_http "$config_name" "$measure_output_dir" false "$sel_route" $run_cnt true
fi
if [[ "${config_ref['exec_pep']:-true}" == true ]]; then
osnd_moon_measure_http "$config_name" "$measure_output_dir" true "$sel_route" $run_cnt true
fi
fi
fi
if [[ "${config_ref['exec_rtp']:-true}" == true ]]; then
if [[ "${config_ref['exec_plain']:-true}" == true ]]; then
osnd_moon_measure_rtp_metrics_with_roq "$config_name" "$measure_output_dir" false "$sel_route" $run_cnt
fi
if [[ "${config_ref['exec_pep']:-true}" == true ]]; then
osnd_moon_measure_rtp_metrics_with_roq "$config_name" "$measure_output_dir" true "$sel_route" $run_cnt
fi
fi
if [[ "${config_ref['exec_duplex']:-true}" == true ]]; then
if [[ "${config_ref['exec_plain']:-true}" == true ]]; then
osnd_moon_measure_tcp_duplex_metrics "$config_name" "$measure_output_dir" false "$sel_route" $run_cnt
fi
if [[ "${config_ref['exec_pep']:-true}" == true ]]; then
osnd_moon_measure_tcp_duplex_metrics "$config_name" "$measure_output_dir" true "$sel_route" $run_cnt
fi
fi
if [[ "${config_ref['exec_iperf_duplex']:-true}" == true ]]; then
if [[ "${config_ref['exec_plain']:-true}" == true ]]; then
osnd_moon_measure_iperf_tcp_duplex_metrics "$config_name" "$measure_output_dir" false "$sel_route" $run_cnt
fi
if [[ "${config_ref['exec_pep']:-true}" == true ]]; then
osnd_moon_measure_iperf_tcp_duplex_metrics "$config_name" "$measure_output_dir" true "$sel_route" $run_cnt
fi
fi
if [[ "${config_ref['exec_dccp_duplex']:-true}" == true ]]; then
osnd_moon_measure_iperf_dccp_duplex_metrics "$config_name" "$measure_output_dir" false "$sel_route" $run_cnt
fi
}
#_osnd_moon_get_cc(ccs, index)
function _osnd_moon_get_cc() {
local ccs="$1"
local index=$2
case ${ccs:$index:1} in
c | C)
echo "cubic"
;;
r | R)
echo "reno"
;;
esac
}
# _osnd_moon_run_scenarios()
function _osnd_moon_run_scenarios() {
local measure_cnt=$(_osnd_moon_count_scenarios)
local measure_nr=0
env | sort >"${EMULATION_DIR}/environment.txt"
while read scenario; do
((measure_nr++))
log I "Starting measurement ${measure_nr}/${measure_cnt}"
log D "Reading scenario: $scenario"
unset scenario_config
declare -A scenario_config
# Default configuration values
scenario_config['exec_plain']="true"
scenario_config['exec_pep']="true"
scenario_config['exec_ping']="true"
scenario_config['exec_quic']="true"
scenario_config['exec_tcp']="true"
scenario_config['exec_http']="true"
scenario_config['exec_rtp']="true"
scenario_config['exec_duplex']="true"
scenario_config['exec_iperf_duplex']="true"
scenario_config['exec_dccp_duplex']="true"
scenario_config['save_video']="false"
scenario_config['prime']=5
scenario_config['runs']=1
scenario_config['timing_runs']=4
scenario_config['dump']=0
scenario_config['orbit']="GEO"
scenario_config['attenuation']=0
scenario_config['modulation_id']=1
scenario_config['ccs']="rrrr"
scenario_config['tbs']="1M,1M"
scenario_config['qbs']="1M,1M,1M,1M"
scenario_config['ubs']="1M,1M,1M,1M"
scenario_config['delay']="125,125"
scenario_config['loss']=0
scenario_config['iw']="10,10,10,10"
scenario_config['ack_freq']="25,1000,8"
scenario_config['qlog_file']="${EMULATION_DIR}/client.qlog,${EMULATION_DIR}/server.qlog"
scenario_config['bw']="20M,5M"
scenario_config['route']="LTE"
scenario_config['gds']="0,0,0"
scenario_config['mp_cc']="lia"
scenario_config['mp_pm']="fullmesh"
scenario_config['mp_sched']="default"
scenario_config['mp_prot']="MPTCP"
scenario_config['mp_re']="default"
_osnd_moon_read_scenario scenario_config "$scenario"
local read_status=$?
if [ "$read_status" != "0" ]; then
log E "Failed to read scenario($read_status): '$scenario'"
sleep $MEASURE_WAIT
continue
fi
scenario_config['id']="$(md5sum <<<"$scenario" | cut -d' ' -f 1)"
# Extract combined values
scenario_config['cc_sv']="$(_osnd_moon_get_cc "${scenario_config['ccs']}", 0)"
scenario_config['cc_gw']="$(_osnd_moon_get_cc "${scenario_config['ccs']}", 1)"
scenario_config['cc_st']="$(_osnd_moon_get_cc "${scenario_config['ccs']}", 2)"
scenario_config['cc_cl']="$(_osnd_moon_get_cc "${scenario_config['ccs']}", 3)"
local -a tbuf_sizes=()
IFS=',' read -ra tbuf_sizes <<<"${scenario_config['tbs']}"
scenario_config['tbs_gw']="${tbuf_sizes[0]}"
scenario_config['tbs_st']="${tbuf_sizes[1]}"
local -a qbuf_sizes=()
IFS=',' read -ra qbuf_sizes <<<"${scenario_config['qbs']}"
scenario_config['qbs_sv']="${qbuf_sizes[0]}"
scenario_config['qbs_gw']="${qbuf_sizes[1]}"
scenario_config['qbs_st']="${qbuf_sizes[2]}"
scenario_config['qbs_cl']="${qbuf_sizes[3]}"
local -a ubuf_sizes=()
IFS=',' read -ra ubuf_sizes <<<"${scenario_config['ubs']}"
scenario_config['ubs_sv']="${ubuf_sizes[0]}"
scenario_config['ubs_gw']="${ubuf_sizes[1]}"
scenario_config['ubs_st']="${ubuf_sizes[2]}"
scenario_config['ubs_cl']="${ubuf_sizes[3]}"
local -a delays=()
IFS=',' read -ra delays <<<"${scenario_config['delay']}"
scenario_config['delay_gw']="${delays[0]}"
scenario_config['delay_st']="${delays[1]}"
local -a iw_sizes=()
IFS=',' read -ra iw_sizes <<<"${scenario_config['iw']}"
scenario_config['iw_sv']="${iw_sizes[0]}"
scenario_config['iw_gw']="${iw_sizes[1]}"
scenario_config['iw_st']="${iw_sizes[2]}"
scenario_config['iw_cl']="${iw_sizes[3]}"
local -a ack_freq_params=()
IFS=',' read -ra ack_freq_params <<<"${scenario_config['ack_freq']}"
scenario_config['max_ack_delay']="${ack_freq_params[0]}"
scenario_config['first_ack_freq_packet_number']="${ack_freq_params[1]}"
scenario_config['ack_freq_cwnd_fraction']="${ack_freq_params[2]}"
local -a qlog_files=()
IFS=',' read -ra qlog_files <<<"${scenario_config['qlog_file']}"
scenario_config['qlog_file_client']="${qlog_files[0]}"
scenario_config['qlog_file_server']="${qlog_files[1]}"
local -a bw_vals=()
IFS=',' read -ra bw_vals <<<"${scenario_config['bw']}"
scenario_config['bw_ul']="${bw_vals[0]}"
scenario_config['bw_dl']="${bw_vals[1]}"
local -a gd_vals=()
IFS=',' read -ra gd_vals <<<"${scenario_config['gds']}"
scenario_config['delay_cl_sat']="${gd_vals[0]}"
scenario_config['delay_cl_lte']="${gd_vals[1]}"
scenario_config['delay_sv']="${gd_vals[2]}"
# Execute scenario
echo "${scenario_config['id']} $scenario" >>"${EMULATION_DIR}/scenarios.txt"
_osnd_moon_exec_scenario_with_config scenario_config
sleep $MEASURE_WAIT
done < <(awk '!/^(#.*)?$/' "$scenario_file")
}
# _osnd_moon_print_usage()
function _osnd_moon_print_usage() {
cat <<USAGE
Usage: $1 [options]
General:
-f <file> read the scenarios from this file instead of the command line arguments.
-h print this help message
-s show statistic logs in stdout
-t <tag> optional tag to identify this measurement
-v print version and exit
Scenario configuration:
-A <#,> csl of attenuations to measure (default: 0db)
-B <#,>* QUIC-specific: csl of two qperf transfer buffer sizes for G and T (default: 1M)
-b <#,> iPerf bandwith vis-à-vis the defined QoS requirements [UL/DL] (default: 20M,5M)
-c <#,> MPTCP-specific: congestion control - Uncoupled [reno|cubic], Coupled [lia|olia|balia|wVegas] (default: lia); MPDCCP-specific: congestion control ID (CCID) [2|5] (default: 2)
-C <SGTC,> csl of congestion control algorithms to measure (c = cubic, r = reno) (default: r)
-d disable duplex measurements
-D # dump the first # packets of a measurement
-e <#,> MPDCCP-specific: reordering engine selection - [default|fixed]
-E <GT,> csl of two delay values: each one value or multiple seconds-delay values (default: 125)
-g <#,> csl of ground delays at the client and the server [CL_SAT,CL_LTE,SV] (default: 0,0,0)
-H disable http measurements
-F <#,>* QUIC-specific: csl of three values: max. ACK Delay, packet no. after which first ack frequency packet is sent, fraction of CWND to be used in ACK frequency frame (default: 25, 1000, 8)
-i disable iperf duplex measurements
-I <#,>* csl of four initial window sizes for SGTC (default: 10)
-j disable dccp duplex measurements
-l <#,> QUIC-specific: csl of two file paths for qlog file output: client, server (default: server.qlog und client.qlog in output directory)
-L <#,> percentages of packets to be dropped (default: 0%)
-m <#,> Multipath protcol [MPTCP|MPDCCP] (default: MPTCP)
-N # number of goodput measurements per config (default: 1)
-o enable rtp-over-quic (ROQ) video logging at end-hosts
-O <#,> csl of orbits to measure [GEO|MEO|LEO] (default: GEO)
-p <#,> MPTCP-specific: advanced path-manager control [default|fullmesh|binder|netlink] (default: fullmesh); MPDCCP-specific: path-manager [default] (default: default)
-P # seconds to prime a new environment with some pings (default: 5)
-Q <#,>* QUIC-specific: csl of four qperf quicly buffer sizes for SGTC (default: 1M)
-R disable rtp measurements
-r <#,> Select a routing strategy [LTE|SAT|MP] (default: LTE)
-S <#,> MPTCP-specific: scheduler [default|roundrobin|redundant|blest] (default: default); MPDCCP-specific: scheduler [default|srtt|rr|redundant|otias|cpf|handover] (default: srtt)
-T # number of timing measurements per config (default: 4)
-U <#,>* QUIC-specific: csl of four qperf udp buffer sizes for SGTC (default: 1M)
-V disable plain (non pep) measurements
-W disable pep measurements
-X disable ping measurement
-Y disable quic measurements
-Z disable tcp measurements
Scenario file format:
Each line in the file describes a single scenario, blank lines and lines
starting with a # are ignored. A scenario can be configured using the arguments
in the scenario configuration section above. However all arguments that accept
a comma separated list of values only accept a single value in the scenario
file. Same goes for the repeated arguments, only one value is accepted.
<#,> indicates that the argument accepts a comma separated list (csl) of values
...* indicates, that the argument can be repeated multiple times
SGTC specifies one value for each of the emulation components:
server, gateway, satellite terminal and client
USAGE
}
function _osnd_moon_parse_args() {
show_stats=false
osnd_moon_tag=""
env_prime_secs=5
ttfb_run_cnt=4
run_cnt=1
exec_plain=true
exec_pep=true
exec_ping=true
exec_quic=true
exec_tcp=true
exec_http=true
exec_rtp=true
exec_duplex=true
exec_iperf_duplex=true
exec_dccp_duplex=true
save_video=false
scenario_file=""
dump_packets=0
qlog_file=""
local -a new_transfer_buffer_sizes=()
local -a new_quicly_buffer_sizes=()
local -a new_udp_buffer_sizes=()
local -a new_delays=()
local -a new_quicly_iw_sizes=()
local -a new_quicly_ack_freq=()
local -a new_iperf_bw=()
local -a new_ground_delays=()
local measure_cli_args="false"
while getopts "b:c:df:g:hl:op:r:st:vA:B:C:D:e:E:F:HiI:jL:m:N:O:P:Q:RS:T:U:VWXYZ" opt; do
if [[ "${opt^^}" == "$opt" ]]; then
measure_cli_args="true"
if [[ "$scenario_file" != "" ]]; then
echo >&2 "Cannot configure measurements with cli args when scenario file is given"
exit 1
fi
fi
case "$opt" in
b)
IFS=',' read -ra bw_vals <<<"$OPTARG"
if [[ "${#bw_vals[@]}" != 2 ]]; then
echo "Need exactly two bandwith values for UL and DL, respectively, ${#bw_vals[@]} given in '$OPTARG'"
exit 1
fi
new_iperf_bw+=("$OPTARG")
;;
c)
IFS=',' read -ra mptcp_cc_algorithms <<<"$OPTARG"
;;
d)
exec_duplex=false
;;
e)
IFS=',' read -ra mp_reordering_engine <<<"$OPTARG"
;;
f)
if [[ "$measure_cli_args" == "true" ]]; then
echo >&2 "Cannot set scenario file and configure measurements with cli args at the same time"
exit 1
fi
scenario_file="$OPTARG"
;;
g)
IFS=',' read -ra gd_vals <<<"$OPTARG"
if [[ "${#gd_vals[@]}" != 3 ]]; then
echo "Need exactly three ground delay values, ${#gd_vals[@]} given in '$OPTARG'"
exit 1
else
for ground_delay in "${gd_vals[@]}"; do
if ! [[ "${ground_delay}" =~ ^[0-9]+$ ]]; then
echo "Invalid integer value for -g"
exit 1
fi
done
fi
new_ground_delays+=("$OPTARG")
;;
h)
_osnd_moon_print_usage "$0"
exit 0
;;
i)
exec_iperf_duplex=false
;;
j)
exec_dccp_duplex=false
;;
l)
IFS=',' read -ra qlog_files <<<"$OPTARG"
if [[ "${#qlog_files[@]}" != 2 ]]; then
echo "Need exactly two files, ${#qlog_files[@]} given in '$OPTARG'"
exit 1
fi
qlog_file=$OPTARG
;;
m)
IFS=',' read -ra mp_protocols <<<"$OPTARG"
;;
o)
save_video=true
;;
p)
IFS=',' read -ra mptcp_path_managers <<<"$OPTARG"
;;
r)
IFS=',' read -ra routing_strategy <<<"$OPTARG"
;;
s)
show_stats=true
;;
t)
osnd_moon_tag="_$OPTARG"
;;
v)
echo "opensand-moongen-measurement $SCRIPT_VERSION"
exit 0
;;
A)
IFS=',' read -ra attenuations <<<"$OPTARG"
;;
B)
IFS=',' read -ra buffer_sizes_config <<<"$OPTARG"
if [[ "${#buffer_sizes_config[@]}" != 2 ]]; then
echo "Need exactly two transfer buffer size configurations for G and T, ${#buffer_sizes_config[@]} given in '$OPTARG'"
exit 1
fi
new_transfer_buffer_sizes+=("$OPTARG")
;;
C)
IFS=',' read -ra cc_algorithms <<<"$OPTARG"
for ccs in "${cc_algorithms[@]}"; do
if [[ "${#ccs}" != 4 ]]; then
echo "Need exactly four cc algorithms for SGT, ${#ccs} given in '$ccs'"
exit 1
fi
for i in 0 1 2 3; do
if [[ "$(_osnd_moon_get_cc "$ccs" $i)" == "" ]]; then
echo "Unknown cc algorithm '${ccs:$i:1}' in '$ccs'"
exit 1
fi
done
done
;;
D)
if [[ "$OPTARG" =~ ^[0-9]+$ ]]; then
dump_packets=$OPTARG
else
echo "Invalid integer value for -D"
exit 1
fi
;;
E)
IFS=',' read -ra delay_values <<<"$OPTARG"
if [[ "${#delay_values[@]}" != 2 ]]; then
echo "Need exactly two delay values, ${#delay_values[@]} given in '${delay_values[@]}'"
exit 1
fi
new_delays+=("$OPTARG")
;;
F)
IFS=',' read -ra ack_freq_values <<<"$OPTARG"
if [[ "${#ack_freq_values[@]}" != 3 ]]; then
echo "Need exactly three ack frequency values, ${#ack_freq_values[@]} given in '${ack_freq_values[@]}'"
exit 1
else
for ack_freq in "${ack_freq_values[@]}"; do
if ! [[ "${ack_freq}" =~ ^[0-9]+$ ]]; then
echo "Invalid integer value for -F"
exit 1
fi
done
if [[ ack_freq_values[1] -gt 65535 ]]; then
echo "First packet number has the type uint16 and cannot be larger than 65535"
exit 1
fi
if [[ ack_freq_values[2] -gt 255 ]]; then
echo "CWND fraction has the type uint8 and cannot be larger than 255"
exit 1
fi
fi
new_quicly_ack_freq+=("$OPTARG")
;;
H)
exec_http=false
;;
I)
IFS=',' read -ra iw_sizes_config <<<"$OPTARG"