ControlScripts: client_script_mappings updated for xbtut support
[p2p-testing-infrastructure.git] / ControlScripts / client_script_mappings
1 #!/bin/bash
2
3 #
4 # Configuration file for mapping client (string) identifiers to
5 # start/stop/detect scripts
6 #
7
8 DEBUG()
9 {
10         test ${_DEBUG} = "on" && $@
11 }
12
13 start_client()
14 {
15         local client_type=$1
16         local download_limit=$2
17         local upload_limit=$3
18         local connection_limit=$4
19
20         download_limit=$(($download_limit * 1024 / 8))
21         upload_limit=$(($upload_limit * 1024 / 8))
22
23         DEBUG echo "starting client ..."
24         case "${client_type}" in
25                 "hrktorrent_seeder")
26                         clients/hrk/start_hrk_seeder.sh &
27                         return $!
28                         ;;
29                 "hrktorrent_leecher")
30                         clients/hrk/start_hrk_leecher.sh &
31                         return $!
32                         ;;
33                 "hrktorrent_seeder_limit")
34                         clients/hrk/start_hrk_seeder_limit.sh ${download_limit} ${upload_limit} ${connection_limit} &
35                         return $!
36                         ;;
37                 "hrktorrent_leecher_limit")
38                         clients/hrk/start_hrk_leecher_limit.sh ${download_limit} ${upload_limit} ${connection_limit} &
39                         return $!
40                         ;;
41                 "tribler_seeder")
42                         clients/tribler/start_tribler_seeder.sh &
43                         return $!
44                         ;;
45                 "tribler_leecher")
46                         clients/tribler/start_tribler_leecher.sh &
47                         return $!
48                         ;;
49                 "tribler_doe")
50                         clients/tribler/start_tribler_doe.sh &
51                         return $!
52                         ;;
53                 "tribler_proxy_01")
54                         clients/tribler/start_tribler_proxy.sh 01 &
55                         return $!
56                         ;;
57                 "tribler_proxy_02")
58                         clients/tribler/start_tribler_proxy.sh 02 &
59                         return $!
60                         ;;
61                 "tribler_proxy_03")
62                         clients/tribler/start_tribler_proxy.sh 03 &
63                         return $!
64                         ;;
65                 "tribler_proxy_04")
66                         clients/tribler/start_tribler_proxy.sh 04 &
67                         return $!
68                         ;;
69                 "xbtut")
70                         clients/xbt-unified-tracker/start_xbtut.sh &
71                         return $!
72                         ;;
73         esac
74 }
75
76 stop_client()
77 {
78         local client_type=$1
79
80         DEBUG echo "stopping client ..."
81         case "${CLIENT_TYPE}" in
82                 "hrktorrent_seeder" | "hrktorrent_leecher" | "hrktorrent_seeder_limit" | "hrktorrent_leecher_limit")
83                         clients/hrk/stop_hrk.sh
84                         ;;
85                 "tribler_seeder")
86                         clients/tribler/stop_tribler.sh
87                         ;;
88                 "tribler_leecher")
89                         clients/tribler/stop_tribler.sh
90                         ;;
91                 "tribler_doe")
92                         clients/tribler/stop_tribler.sh
93                         ;;
94                 "tribler_proxy_01")
95                         clients/tribler/stop_tribler.sh
96                         ;;
97                 "tribler_proxy_02")
98                         clients/tribler/stop_tribler.sh
99                         ;;
100                 "tribler_proxy_03")
101                         clients/tribler/stop_tribler.sh
102                         ;;
103                 "tribler_proxy_04")
104                         clients/tribler/stop_tribler.sh
105                         ;;
106                 "xbtut")
107                         clients/xbt-unified-tracker/stop_xbtut.sh
108                         ;;
109         esac
110 }
111
112 detect_complete_client()
113 {
114         local client_type=$1
115         local log_file=$2
116
117         DEBUG echo "stopping client ..."
118         case "${client_type}" in
119                 "hrktorrent_seeder" | "hrktorrent_leecher" | "hrktorrent_seeder_limit" | "hrktorrent_leecher_limit")
120                         clients/hrk/detect_complete_hrk.sh ${log_file}
121                         ;;
122                 "tribler_seeder")
123                         clients/tribler/detect_complete_tribler_seeder.sh ${log_file}
124                         ;;
125                 "tribler_leecher")
126                         clients/tribler/detect_complete_tribler_leecher.sh ${log_file}
127                         ;;
128                 "tribler_doe")
129                         clients/tribler/detect_complete_tribler_doe.sh ${log_file}
130                         ;;
131                 "tribler_proxy_01")
132                         clients/tribler/detect_complete_tribler_proxy.sh ${log_file}
133                         ;;
134                 "tribler_proxy_02")
135                         clients/tribler/detect_complete_tribler_proxy.sh ${log_file}
136                         ;;
137                 "tribler_proxy_03")
138                         clients/tribler/detect_complete_tribler_proxy.sh ${log_file}
139                         ;;
140                 "tribler_proxy_04")
141                         clients/tribler/detect_complete_tribler_proxy.sh ${log_file}
142                         ;;
143         esac
144 }
145
146 parse_client_log()
147 {
148         local client_type=$1
149         local log_folder=$2
150         local log_file=$3
151
152         DEBUG echo "parsing client ${client_type} (${log_folder}/${log_file})..."
153         case "${client_type}" in
154                 "hrktorrent_seeder" | "hrktorrent_leecher" | "hrktorrent_seeder_limit" | "hrktorrent_leecher_limit")
155                         DEBUG echo "hello hrktorrent_seeder"
156                         clients/hrk/parse_hrk.sh ${log_folder} ${log_file}
157                         ;;
158                 "tribler_seeder")
159                         clients/tribler/parse_tribler.sh ${log_folder} ${log_file}
160                         ;;
161                 "tribler_leecher")
162                         clients/tribler/parse_tribler.sh ${log_folder} ${log_file}
163                         ;;
164                 "tribler_doe")
165                         clients/tribler/parse_tribler.sh ${log_folder} ${log_file}
166                         ;;
167                 "tribler_proxy_01")
168                         clients/tribler/parse_tribler.sh ${log_folder} ${log_file}
169                         ;;
170                 "tribler_proxy_02")
171                         clients/tribler/parse_tribler.sh ${log_folder} ${log_file}
172                         ;;
173                 "tribler_proxy_03")
174                         clients/tribler/parse_tribler.sh ${log_folder} ${log_file}
175                         ;;
176                 "tribler_proxy_04")
177                         clients/tribler/parse_tribler.sh ${log_folder} ${log_file}
178                         ;;
179         esac
180 }