4 # Test scenario generators - generates *.cfg files
6 # 2010, Razvan Deaconescu, razvan.deaconescu@cs.pub.ro
9 # ./tgen gogu P2P_Experimente_Swarm-metrics.csv
12 if test $# -ne 2; then
13 echo "Usage: $0 campaign-name test-description-file" 1>&2
22 echo "" | awk -v var="$1" '{print var + 0;}'
27 echo "" | awk -v var="$1" '{print var + 0;}'
32 size=$(echo "" | awk -v var="$2" '{print var + 0;}')
33 tracker_no=$(echo "" | awk -v var="$1" '{print var + 0;}')
34 echo "Data.${size}M.tracker${tracker_no}.torrent"
46 echo -e "#\n# Campaign $campaign_name; scenario $exp_no\n#"
47 echo "### BEGIN SCENARIO INFO"
48 echo "# Campaign: $campaign_name"
50 echo "# Description: $description"
51 echo "# Number of trackers: $num_trackers"
52 echo "# Number of leechers: $num_leechers"
53 echo "# Maximum download: $down_bw"
54 echo "# Maximum upload: $down_bw"
55 echo "# Client type: hrktorrent (libtorrent-rasterbar)"
56 echo "### END SCENARIO INFO"
59 echo -e "# Hostname\t\t\tSSHport\t\tUser\t\tRemoteFolder\t\tNetInterface\t\tDownload(Mbps)\tDownloadBurst(K)\tUpload(Mbps)\tUploadBurst(K)\tOverallNoOfConnections\tPreRunScript\t\tPostRunScript\t\tClientType\t\t\tTorrentFile\t\tPeriods"
62 for t_index in 301 302 303 304 305 306 307 308 309 310 311 312; do
63 echo -en "p2p-next-08.grid.pub.ro\t\t"
64 echo -en "${t_index}22\t\t"
66 echo -en "/home/p2p/george\t"
73 echo -en "pre-run_nop.sh\t\t"
74 echo -en "post-run_nop.sh\t\t"
75 echo -en "xbtut_tracker\t\t"
81 if test $index -ge $(($num_trackers)); then
87 num_clients_per_tracker=4
88 num_leechers=$(($num_trackers * $num_clients_per_tracker - $num_seeders))
90 for sys_index in 01 03 04 05 06 07 08 09 10; do
91 for ce_index in 1 2 3 4 5 6 7 8 9 10; do
92 echo -en "p2p-next-$sys_index.grid.pub.ro\t\t"
93 echo -en "1$(printf %02g $ce_index)22\t\t"
95 echo -en "/home/p2p/george\t"
97 echo -en "$down_bw\t\t"
102 echo -en "pre-run_nop.sh\t\t"
103 echo -en "post-run_nop.sh\t\t"
105 if test $index -lt $num_seeders; then
106 echo -en "hrktorrent_seeder_limit\t\t"
107 elif test $index -lt $(($num_seeders+$num_leechers)); then
108 echo -en "hrktorrent_leecher_limit\t"
111 tracker_index=$(($index / $num_clients_per_tracker + 1))
112 seed_torrent=$(parse_file $tracker_index $data_size)
113 echo -en "$seed_torrent\t"
118 if test $index -ge $(($num_seeders+$num_leechers)); then
125 campaign_file=${campaign_name}.cfg
127 > "${campaign_file}" cat <<END
131 # Scenario description R script for plotting
134 html_file=${campaign_name}.html
135 cat start.html > ${html_file}
136 cat >> ${html_file} <<END
137 <table id="box-table-a" summary="${campaign_name} results">
140 <th scope="col">Name</th>
141 <th scope="col">No. of Seeders</th>
142 <th scope="col">No. of Leechers</th>
143 <th scope="col">Bandwidth Rectrictions</th>
144 <th scope="col">Graphs</th>
150 while IFS="," read exp_no num_trackers data_size down_bw up_bw description; do
151 # generate test scenario
152 generate_scenario "$exp_no" "$num_trackers" "$down_bw" "$up_bw" "$data_size" "$description" > "${campaign_name}-${exp_no}".cfg
154 # update campaign configuration file
155 echo -e "${campaign_name}-${exp_no}.cfg\t${campaign_name}-${exp_no}.R" >> "${campaign_file}"
157 # update campaign HTML file
158 cat >> ${html_file} <<END
160 <td>${campaign_name}-${exp_no}</td>
164 <td><a href="${campaign_name}-${exp_no}/${campaign_name}-${exp_no}-dlspeed-percent.png">dlspeed vs percent</a>; <a href="${campaign_name}-${exp_no}/${campaign_name}-${exp_no}-dlspeed-time.png">dlspeed vs time</a></td>
167 done < <(grep -v '^#' $input)
169 cat >> ${html_file} <<END
174 cat end.html >> ${html_file}