ControlScripts/clients/swift: swift integration update
[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                 "swift_seeder")
70                         clients/swift/start_swift_seeder.sh &
71                         return $!
72                         ;;
73                 "swift_leecher")
74                         clients/swift/start_swift_leecher.sh &
75                         return $!
76                         ;;
77                 "xbtut")
78                         clients/xbt-unified-tracker/start_xbtut.sh &
79                         return $!
80                         ;;
81         esac
82 }
83
84 stop_client()
85 {
86         local client_type=$1
87
88         DEBUG echo "stopping client ..."
89         case "${CLIENT_TYPE}" in
90                 "hrktorrent_seeder" | "hrktorrent_leecher" | "hrktorrent_seeder_limit" | "hrktorrent_leecher_limit")
91                         clients/hrk/stop_hrk.sh
92                         ;;
93                 "tribler_seeder")
94                         clients/tribler/stop_tribler.sh
95                         ;;
96                 "tribler_leecher")
97                         clients/tribler/stop_tribler.sh
98                         ;;
99                 "tribler_doe")
100                         clients/tribler/stop_tribler.sh
101                         ;;
102                 "tribler_proxy_01")
103                         clients/tribler/stop_tribler.sh
104                         ;;
105                 "tribler_proxy_02")
106                         clients/tribler/stop_tribler.sh
107                         ;;
108                 "tribler_proxy_03")
109                         clients/tribler/stop_tribler.sh
110                         ;;
111                 "tribler_proxy_04")
112                         clients/tribler/stop_tribler.sh
113                         ;;
114                 "swift_seeder" | "swift_leecher")
115                         clients/swift/stop_swift.sh 
116                         ;;
117                 "xbtut")
118                         clients/xbt-unified-tracker/stop_xbtut.sh
119                         ;;
120         esac
121 }
122
123 detect_complete_client()
124 {
125         local client_type=$1
126         local log_file=$2
127
128         DEBUG echo "stopping client ..."
129         case "${client_type}" in
130                 "hrktorrent_seeder" | "hrktorrent_leecher" | "hrktorrent_seeder_limit" | "hrktorrent_leecher_limit")
131                         clients/hrk/detect_complete_hrk.sh ${log_file}
132                         ;;
133                 "tribler_seeder")
134                         clients/tribler/detect_complete_tribler_seeder.sh ${log_file}
135                         ;;
136                 "tribler_leecher")
137                         clients/tribler/detect_complete_tribler_leecher.sh ${log_file}
138                         ;;
139                 "tribler_doe")
140                         clients/tribler/detect_complete_tribler_doe.sh ${log_file}
141                         ;;
142                 "tribler_proxy_01")
143                         clients/tribler/detect_complete_tribler_proxy.sh ${log_file}
144                         ;;
145                 "tribler_proxy_02")
146                         clients/tribler/detect_complete_tribler_proxy.sh ${log_file}
147                         ;;
148                 "tribler_proxy_03")
149                         clients/tribler/detect_complete_tribler_proxy.sh ${log_file}
150                         ;;
151                 "tribler_proxy_04")
152                         clients/tribler/detect_complete_tribler_proxy.sh ${log_file}
153                         ;;
154                 "swift_seeder" | "swift_leecher")
155                         clients/swift/detect_complete_swift.sh ${log_file}
156                         ;;
157         esac
158 }
159
160 parse_client_log()
161 {
162         local client_type=$1
163         local log_folder=$2
164         local log_file=$3
165
166         DEBUG echo "parsing client ${client_type} (${log_folder}/${log_file})..."
167         case "${client_type}" in
168                 "hrktorrent_seeder" | "hrktorrent_leecher" | "hrktorrent_seeder_limit" | "hrktorrent_leecher_limit")
169                         DEBUG echo "hello hrktorrent_seeder"
170                         clients/hrk/parse_hrk.sh ${log_folder} ${log_file}
171                         ;;
172                 "tribler_seeder")
173                         clients/tribler/parse_tribler.sh ${log_folder} ${log_file}
174                         ;;
175                 "tribler_leecher")
176                         clients/tribler/parse_tribler.sh ${log_folder} ${log_file}
177                         ;;
178                 "tribler_doe")
179                         clients/tribler/parse_tribler.sh ${log_folder} ${log_file}
180                         ;;
181                 "tribler_proxy_01")
182                         clients/tribler/parse_tribler.sh ${log_folder} ${log_file}
183                         ;;
184                 "tribler_proxy_02")
185                         clients/tribler/parse_tribler.sh ${log_folder} ${log_file}
186                         ;;
187                 "tribler_proxy_03")
188                         clients/tribler/parse_tribler.sh ${log_folder} ${log_file}
189                         ;;
190                 "tribler_proxy_04")
191                         clients/tribler/parse_tribler.sh ${log_folder} ${log_file}
192                         ;;
193         esac
194 }