Commit 9aea27f2 authored by Jonathon Duerig's avatar Jonathon Duerig

Quick snapshot of scripts needed by Kevin

parent 1957199f
#!/usr/bin/perl -w
# Usage: download-logs.pl <pid> <eid>
if (@ARGV != 3)
{
die("Invalid number of arguments");
}
$pid = $ARGV[0];
$eid = $ARGV[1];
$nodeCount = $ARGV[2];
sub copyFiles
{
my $source = $_[0];
my $dest1 = $_[1];
my $dest2 = $_[2];
system("mkdir -p $prefix/dump/$source/$dest1/$dest2");
system("cp $prefix/node-$source/local/logs/dump-$source-$dest1-$dest2.dump $prefix/dump/$source/$dest1/$dest2/source.dump");
system("cp $prefix/node-$dest1/local/logs/dump-$source-$dest1-$dest2.dump $prefix/dump/$source/$dest1/$dest2/dest1.dump");
system("cp $prefix/node-$dest2/local/logs/dump-$source-$dest1-$dest2.dump $prefix/dump/$source/$dest1/$dest2/dest2.dump");
# system("perl dump2filter.pl $prefix/dump/$source/$dest1/$dest2");
}
print("/usr/testbed/bin/loghole -e $pid/$eid sync -P\n");
system("/usr/testbed/bin/loghole -e $pid/$eid sync -P");
$prefix = "/proj/$pid/exp/$eid/logs";
for ($source = 1; $source <= $nodeCount; ++$source)
{
for ($dest1 = 1; $dest1 <= $nodeCount; ++$dest1)
{
for ($dest2 = $dest1 + 1; $dest2 <= $nodeCount; ++$dest2)
{
if ($source != $dest1 && $source != $dest2)
{
copyFiles($source, $dest1, $dest2);
}
}
}
}
#system("/usr/testbed/bin/loghole -e $pid/$eid archive") or die("Error running loghole archive\n");
......@@ -6,102 +6,73 @@
$usage = <<"END_USAGE";
usage: gather-dest.pl dest <host-file>
Where <host-file> is the path of a file of hosts (one hostname per line)
to be checked and dest is one of those hosts.
usage: gather-dest.pl <project> <experiment> <node-count> <source-number> <duration>
END_USAGE
$serverPort = 1690;
if (@ARGV != 5)
{
die("Invalid number of arguments: ".@ARGV.$usage);
}
# non-blocking system call.
# returns the child process pid.
sub nbSystem
$project = $ARGV[0];
$exp = $ARGV[1];
$nodeCount = $ARGV[2];
$source = $ARGV[3];
$duration = $ARGV[4];
$serverPort = 1690 + $source;
# First argument is the destination node (or
# Second argument is the command to change to (if "", no change).
sub startProgram
{
my $command = $_[0];
my $pid = fork();
if ($pid == 0)
{
exit(system($command));
}
elsif ($pid > 0)
my $dest = $_[0];
my $command = $_[1];
my $string = "/usr/testbed/bin/tevc -e $project/$exp now node-$source-to-node-$dest start";
if ($command ne "")
{
return $pid;
}
else
{
return 0;
$string = $string." COMMAND='".$command."'";
}
print("Starting program event: $string\n");
system($string);
}
sub remoteSystem
sub stopProgram
{
my $blocking = $_[0];
my $dest = $_[1];
my $command = $_[2];
my $result = 0;
my $string = "ssh -o BatchMode=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -lutah_pelab $dest $command";
if ($blocking != 0)
{
system($string);
}
else
{
$result = nbSystem($string);
sleep(1);
}
return $result;
my $dest = $_[0];
system("/usr/testbed/bin/tevc -e $project/$exp now node-$source-to-node-$dest stop");
}
sub runTest
{
my $source1 = $_[0];
my $source2 = $_[1];
my $dest = $_[2];
my @pids;
my $dest1 = $_[0];
my $dest2 = $_[1];
my $i = 0;
# TODO: You are here. Upload an iperf before anything else.
# TODO: Change tcpdump to dump to file rather than to output to stdout.
# Run tcpdump on every machine.
for ($i = 0; $i < 3; ++$i)
{
push(@pids, remoteSystem(0, $_[$i], "sudo tcpdump -i vnet dst port $serverPort"));
}
sleep(5);
push(@pids, remoteSystem(0, $source1, "iperf -c $dest -p $serverPort"));
push(@pids, remoteSystem(1, $source2, "iperf -c $dest -p $serverPort"));
for ($i = 0; $i < @pids; ++$i)
{
if ($pids[$i] != 0)
{
kill($pids[$i], SIGTERM);
}
}
# Copy tcpdump logs back to us.
# Remove logs from node
}
startProgram($dest1, "sh /bw-bottleneck/run-server.sh $serverPort /bw-bottleneck dump-$source-$dest1-$dest2.dump");
startProgram($dest2, "sh /bw-bottleneck/run-server.sh $serverPort /bw-bottleneck dump-$source-$dest1-$dest2.dump");
if (@ARGV != 2)
{
die("Invalid number of arguments: ".@ARGV.$usage);
sleep(2);
startProgram("client", "sh /bw-bottleneck/run-client.sh node-$dest1.$exp.$project.emulab.net node-$dest2.$exp.$project.emulab.net $serverPort /bw-bottleneck dump-$source-$dest1-$dest2.dump $duration");
sleep($duration);
stopProgram($dest1);
stopProgram($dest2);
stopProgram("client");
}
$dest = $ARGV[0];
open(HOSTS, "<".$ARGV[1]) or die("Could not open host file".$usage);
@sourceList = <HOSTS>;
$iperfServerPid = remoteSystem(0, $dest, "iperf -s -p $serverPort");
if ($iperfServerPid != 0)
#-----------------------------------------------------------------------
for ($i = 1; $i <= $nodeCount; ++$i)
{
for ($i = 0; $i < @sourceList; ++$i)
for ($j = $i + 1; $j <= $nodeCount; ++$j)
{
for ($j = $i + 1; $j < @sourceList; ++$j)
if ($i != $source
&& $j != $source)
{
if ($sourceList[$i] ne $dest
&& $sourceList[$j] ne $dest)
{
runTest($sourceList[$i], $sourceList[$j], $dest);
}
runTest($i, $j);
}
}
kill($iperfServerPid, SIGTERM);
}
#!/bin/sh
# Usage: run-client.sh <dest1-ip> <dest2-ip> <port> <base-path> <output-file> <duration>
sudo /usr/sbin/tcpdump -i vnet dst port $3 > /local/logs/$5 &
$4/iperf -c $1 -p $3 -t $6&
$4/iperf -c $2 -p $3 -t $6
#!/bin/sh
# Usage: run-server.sh <port> <base-path> <output-file>
sudo /usr/sbin/tcpdump -i vnet dst port $1 > /local/logs/$3 &
$2/iperf -s -p $1
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment