Commit 06ce613d authored by Kevin Atkinson's avatar Kevin Atkinson

Added an option to skip the standard tests.

Fix bug in the schelling of parallell experments.

Added two new tests: traffic-gen & linkdelay.
parent 9c408064
......@@ -207,6 +207,8 @@ sub single_node_tests ($) {
test_ssh $node;
return if $parms{skip_std_tests};
test_rcmd "sudo-$node", [], $node, 'sudo touch /afile.txt';
test_rcmd "hostname-$node" , [], $node, 'hostname', sub {
......@@ -233,6 +235,8 @@ sub multi_node_tests () {
#test_cmd 'linktest', [], "run_linktest.pl -v -e $pid/$eid";
return if $parms{skip_std_tests};
sleep 10;
test_cmd 'linktest1', [], "run_linktest.pl -v -L 1 -l 1 -e $pid/$eid";
sleep 2;
......@@ -299,15 +303,15 @@ sub test_experiment (%) {
exit (ERR_INT | $status);
};
#sleep 30;
#exit 0;
mkdir $resultsdir, 0777;
chdir $resultsdir;
mkdir "working", 0777;
mkdir "bin", 0777;
#sleep 5;
#exit 0;
$ENV{PATH} = "$resultsdir/bin:$ENV{PATH}";
open STDOUT, ">log" or die;
......
......@@ -50,7 +50,8 @@ sub help() {
" (note 'e' implies 'o')\n".
" -p run experments in parallel\n".
" -m NUM soft limit on the maximum number of nodes to use at once\n".
" -M NUM hard limit on the maximum number of nodes to use at once\n");
" -M NUM hard limit on the maximum number of nodes to use at once\n".
" --skip-std-tests skip standard tests expect for ssh-*\n");
}
die usage unless @ARGV > 0;
......@@ -74,13 +75,13 @@ my $testsdir = "$srcdir/tests";
my ($pid) = $cwd =~ m~^/proj/(.+?)/~;
my @argv;
my %exp_opts;
my $stages = 'cstoe';
my $in_parallel;
my $soft_limit = 5;
my $hard_limit = 0;
my $just_list;
my $skip_std_tests;
Getopt::Long::Configure 'no_ignore_case';
......@@ -90,7 +91,8 @@ GetOptions
"p" => \$in_parallel,
"m=i" => \$soft_limit,
"M=i" => \$hard_limit,
"l|list" => \$just_list
"l|list" => \$just_list,
"skip-std-tests" => \$skip_std_tests
or usage();
$soft_limit = LARGE_NUM if $soft_limit == 0;
......@@ -168,7 +170,7 @@ sub mktests ($$$@) {
resultsdir => "$destdir/$t",
@$what,
stages => $stages,
%exp_opts};
skip_std_tests => $skip_std_tests};
push @exps, $t;
} else {
my $p = shift @parms;
......@@ -445,6 +447,9 @@ sub wait_exp () {
sub get_exps($@) {
my ($avail,@exps_s) = @_;
return (0) unless @exps_s;
while ($exps_s[-1] > $avail) {
pop @exps_s;
}
if ($exps_s[-1] == $avail) {
return ($avail, $exps_s[-1]);
} else {
......
Test Per-Link Traffic Shaping
\ No newline at end of file
set ns [new Simulator]
source tb_compat.tcl
set node0 [$ns node]
tb-set-node-os $node0 @OS@
set node1 [$ns node]
tb-set-node-os $node1 @OS@
set node2 [$ns node]
tb-set-node-os $node2 @OS@
set link0 [$ns duplex-link $node0 $node1 55Mb 10ms DropTail]
set link1 [$ns duplex-link $node0 $node1 100Mb 0ms DropTail]
tb-set-link-loss $link1 0.01
tb-use-endnodeshaping 1
$ns rtproto Static
$ns run
......@@ -23,7 +23,11 @@ sub test_traceroute ($$@) {
# need the delay here to give time for the routes to converge when the
# routing protocol is session
sleep 90 if $parms{rtproto} eq 'Session';
if ($parms{rtproto} eq 'Session') {
print "Sleeping 90 seconds to give time for the routes to converge...";
sleep 90;
print "DONE\n";
}
test_traceroute 'node0', 'node4', qw(node2-link0 node3-link2 node4-link3);
test_traceroute 'node4', 'node0', qw(node3-link3 node2-link2 node0-link0);
......@@ -33,3 +37,5 @@ test_traceroute 'node1', 'node0', qw(node2-link1 node0-link0);
test_traceroute 'node1', 'node4', qw(node2-link1 node3-link2 node4-link3);
test_traceroute 'node4', 'node1', qw(node3-link3 node2-link2 node1-link1);
Test that the traffic generators and link monitoring is working.
set ns [new Simulator]
source tb_compat.tcl
set node0 [$ns node]
set node1 [$ns node]
set link1 [$ns duplex-link $node0 $node1 100Mb 0ms DropTail]
set udp0 [new Agent/UDP]
$ns attach-agent $node0 $udp0
set cbr_udp [new Application/Traffic/CBR]
$cbr_udp set packetSize_ 500
$cbr_udp set interval_ 0.05
$cbr_udp attach-agent $udp0
set null0 [new Agent/Null]
$ns attach-agent $node1 $null0
$ns connect $udp0 $null0
set tcp0 [new Agent/TCP]
$ns attach-agent $node1 $tcp0
set cbr_tcp [new Application/Traffic/CBR]
$cbr_tcp set packetSize_ 500
$cbr_tcp set interval_ 0.01
$cbr_tcp attach-agent $tcp0
set null1 [new Agent/Null]
$ns attach-agent $node0 $null1
$ns connect $tcp0 $null1
set tl [$ns event-timeline]
$tl at 10.0 "$cbr_udp start"
$tl at 12.0 "$cbr_udp stop"
$tl at 15.0 "$cbr_tcp start"
$tl at 17.0 "$cbr_tcp stop"
$tl at 20.0 "$cbr_udp start"
$tl at 20.0 "$cbr_tcp start"
$tl at 22.0 "$cbr_udp stop"
$tl at 22.0 "$cbr_tcp stop"
$link1 trace
$link1 trace_endnode 1
$ns rtproto Static
$ns run
use IO::Socket;
use POSIX ":sys_wait_h";
use Data::Dumper;
local $^W = 1;
sub parse ($) {
local ($_) = @_;
@d = /(\d+)\.\d+ \(icmp:\d+,\d+ tcp:(\d+),\d+ udp:(\d+),\d+ other:\d+,\d+\)/ or die;
return @d;
}
sub fix_times ($\@) {
my ($base,$l) = @_;
foreach (@$l) {
$_->[0] -= $base;
}
}
sub find_intervals ($@) {
my @intervals;
my $w = shift;
my @interval;
foreach (@_) {
if (!@interval && $_->[$w] != 0) {
@interval = ($_->[0], undef, undef);
}
if (@interval) {
if ($_->[$w] != 0) {
$interval[1] = $_->[0];
$interval[2] += $_->[$w];
} else {
push @intervals, [@interval];
undef @interval;
}
}
}
return @intervals;
}
sub find_interval (\$\%$$$$$)
{
my ($res, $intv, $desc, $which, $when, $duration, $traffic) = @_;
my $v;
foreach (@{$intv->{$which}}) {
$v = $_;
last if (abs($v->[0] - $when) <= 1);
}
unless (defined $v) {
print "*** Could not find traffic corresponding to \"$desc\"\n";
$$res = 0;
return;
}
my $real_duration = $v->[1] - $v->[0];
if (abs($real_duration - $duration) > 1) {
print "*** Traffic from \"$desc\" lasted for $real_duration seconds when\n";
print " it was only suppose to last for $duration seconds\n";
$$res = 0;
}
my $real_traffic = $v->[2];
my $tol = 0.20;
if (abs($real_traffic - $traffic) > $traffic*$tol) {
print "*** Traffic from \"$desc\" generated $real_traffic bytes of data\n";
print " but was expecting approximately $traffic bytes with a tolerance of ";
printf "%.0f%%\n", $tol * 100;
$$res = 0;
}
}
test 'event', [], sub {
my $n0s = IO::Socket::INET->new(Proto => 'tcp',
PeerAddr => "node0.$eid.$pid",
PeerPort => 4443)
or die "socket-node0: $!\n";
my $n1s = IO::Socket::INET->new(Proto => 'tcp',
PeerAddr => "node1.$eid.$pid",
PeerPort => 4443)
or die "socket-node1: $!\n";
<$n0s>;
<$n0s>;
<$n1s>;
<$n1s>;
my $cpid = fork();
if ($cpid == 0) {
my $cmd = "tevc -w -e $pid/$eid now tl start";
print "exec $cmd\n";
exec $cmd;
die "exec tevc: $!\n";
}
my @n0_traffic = ();
my @n1_traffic = ();
print $n0s "1000\n";
print $n1s "1000\n";
while (waitpid($cpid,WNOHANG) <= 0) {
push @n0_traffic, [parse(<$n0s>)];
push @n1_traffic, [parse(<$n1s>)];
}
push @n0_traffic, [parse(<$n0s>)];
push @n1_traffic, [parse(<$n1s>)];
close $n0s;
close $n1s;
if ($? >> 8 != 0) {
die "tevc existed with non-zero status: $?\n";
}
my $base = $n0_traffic[0][0];
fix_times $base, @n0_traffic;
fix_times $base, @n1_traffic;
$intervals{node0_tcp} = [find_intervals 1, @n0_traffic];
$intervals{node0_udp} = [find_intervals 2, @n0_traffic];
$intervals{node1_tcp} = [find_intervals 1, @n1_traffic];
$intervals{node1_udp} = [find_intervals 2, @n1_traffic];
open F, ">traffic.txt";
foreach (sort keys %intervals) {
local @_ = @{$intervals{$_}};
print F "$_\n";
foreach (@_) {
print F " $_->[0]-$_->[1]: $_->[2]\n";
}
}
close F;
my $res = 1;
find_interval($res, %intervals,
'$tl at 10.0 "$cbr_udp start"',
'node0_udp', 10, 2, 20000);
find_interval($res, %intervals,
'$tl at 15.0 "$cbr_tcp start"',
'node1_tcp', 15, 2, 100000);
find_interval($res, %intervals,
'$tl at 20.0 "$cbr_udp start"',
'node0_udp', 20, 2, 20000);
find_interval($res, %intervals,
'$tl at 22.0 "$cbr_tcp start"',
'node1_tcp', 20, 2, 100000);
return $res;
};
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