Commit 28a7bb26 authored by Kevin Tew's avatar Kevin Tew

testsuite/testswap added node reboot and powercycle

parent f5ae6ca1
Bug Report sync Fix Executor dies
Bug Report TempResourceError Fix Swapin timeout
Fix Exector dies
OldTests OldTests
Cleanup SSH email
Retry Prep Massive Run
test daemonize
Painpoints Painpoints
================================= =================================
Testlayout - Suites and Tests Testlayout - Suites and Tests, buildup, teardown using Test::Class
Testoutput - Testoutput - TestBuilderWrapper
DOCS TODO DOCS TODO
backoff example backoff example
TODO TODO
TESTLWP TESTLWP
scp cleanup SSH SCP Cleanup
VERBOSENESS
Add basic image-test parameterization examples
EXAMPLES, Get some tests
STILL MESSY STILL MESSY
XMLRPC/Client/Experiment TestSuite/Experiment dsl XMLRPC/Client/Experiment TestSuite/Experiment dsl
EXPAND CURRENT IMPLEMENTATION EXPAND CURRENT IMPLEMENTATION
event subsystem event subsystem
Test::Builder support
LATER LATER
Client.pm duplicate code elimination - Maybe this would make the code too unreadable Client.pm duplicate code elimination - Maybe this would make the code too unreadable
test groupings test groupings
Large External Tars and Resources for experiements Large External Tars and Resources for experiements
buildup, teardown using Test::Class
Parallel TODOS Parallel TODOS
clean up FFF, Roles, constructors clean up FFF, Roles, constructors
......
...@@ -33,8 +33,8 @@ sub runtests { ...@@ -33,8 +33,8 @@ sub runtests {
$concurrent_pre_runs ||= $TBConfig::concurrent_prerun_jobs; $concurrent_pre_runs ||= $TBConfig::concurrent_prerun_jobs;
$concurrent_node_count_usage ||= $TBConfig::concurrent_node_usage; $concurrent_node_count_usage ||= $TBConfig::concurrent_node_usage;
if ( $TBConfig::single ) { if ( $TBConfig::runonly) {
$s->Executors = [ (grep { $_->e->eid eq $TBConfig::single } @{$s->executors}) ]; $s->executors([ (grep { my $executor = $_; (grep { $_ eq $executor->e->eid } @{$TBConfig::single}) } @{$s->executors}) ]);
} }
#prerun step #prerun step
......
...@@ -427,6 +427,27 @@ trytest { ...@@ -427,6 +427,27 @@ trytest {
} $e; } $e;
} }
=item C<< $n->reboot >>
=cut
sub reboot {
my ($e) = shift;
my ($pid, $eid) = ($e->pid, $e->eid);
Tools::Network::node_reboot(@_ , "-e $pid.$eid");
}
=item C<< $n->powercycle >>
=cut
sub powercycle {
my ($e) = shift;
my ($pid, $eid) = ($e->pid, $e->eid);
Tools::Network::node_reboot('-f', "-e $pid.$eid");
}
=back =back
=cut =cut
......
...@@ -20,8 +20,47 @@ TestBed::TestSuite::Node ...@@ -20,8 +20,47 @@ TestBed::TestSuite::Node
=cut =cut
sub ping { sub ping {
my ($self) = @_; my ($s) = @_;
Tools::Network::ping($self->name); Tools::Network::ping($s->name);
}
=item C<< $n->reboot >>
=cut
sub reboot {
my ($s) = shift;
Tools::Network::node_reboot(@_, $s->pcXXX_name);
}
=item C<< $n->powercycle >>
=cut
sub powercycle {
my ($s) = shift;
Tools::Network::node_reboot('-f', $s->pcXXX_name);
}
=item C<< $n->hostname >>
=cut
sub hostname {
my ($s) = shift;
my $name = $s->name;
$name =~ /([^\.]*)/;
$1;
}
=item C<< $n->pcXXX_name >>
=cut
sub pcXXX_name {
my ($s) = shift;
return $s->experiment->info(aspect => 'mapping')->{$s->hostname}->{node};
} }
=item C<< $n->single_node_tests >> =item C<< $n->single_node_tests >>
......
...@@ -18,6 +18,8 @@ pings $hostname returning 0 or 1 ...@@ -18,6 +18,8 @@ pings $hostname returning 0 or 1
=cut =cut
our $OPS_PATH = "/usr/testbed/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:";
sub ping { sub ping {
my ($host) = @_; my ($host) = @_;
my $p = Net::Ping->new('tcp', 2); my $p = Net::Ping->new('tcp', 2);
...@@ -26,6 +28,16 @@ sub ping { ...@@ -26,6 +28,16 @@ sub ping {
!$p->ping($host); !$p->ping($host);
} }
=item C<node_reboot(@ARGS)>
node_reboot('pc137');
node_reboot('-f', 'pc137');
=cut
sub node_reboot {
Tools::TBSSH::cmdoutput($TBConfig::OPS_SERVER, "'sh -c \"PATH=$OPS_PATH node_reboot @_\"'", "node_reboot @_ failed");
}
=item C<traceroute($src, $dest, ['hop1_host', 'hop2_host', ...])> =item C<traceroute($src, $dest, ['hop1_host', 'hop2_host', ...])>
ssh to host $src and executes a traceroute to $dest ensuring it follows the path specified ssh to host $src and executes a traceroute to $dest ensuring it follows the path specified
......
...@@ -6,6 +6,7 @@ use TestBed::TestSuite; ...@@ -6,6 +6,7 @@ use TestBed::TestSuite;
use TestBed::XMLRPC::Client::Pretty; use TestBed::XMLRPC::Client::Pretty;
use Data::Dumper; use Data::Dumper;
use Tools; use Tools;
use Tools::Network;
use TestBed::Wrap::tevc; use TestBed::Wrap::tevc;
#$TBConfig::DEBUG_XML_CLIENT = 1; #$TBConfig::DEBUG_XML_CLIENT = 1;
...@@ -55,6 +56,7 @@ ShortCut ...@@ -55,6 +56,7 @@ ShortCut
it // $e->info(aspect => 'traces')) it // $e->info(aspect => 'traces'))
il // $e->info(aspect => 'links')) il // $e->info(aspect => 'links'))
ex execute arbitrary perl code ex execute arbitrary perl code
rn // node_reboot pc137
END END
} }
...@@ -93,6 +95,7 @@ if (@ARGV) { ...@@ -93,6 +95,7 @@ if (@ARGV) {
if (/endall/) { end_all_experiments; } if (/endall/) { end_all_experiments; }
elsif (/end/) { e($_)->end for(@ARGV); } elsif (/end/) { e($_)->end for(@ARGV); }
elsif (/watchall/) { watchall; } elsif (/watchall/) { watchall; }
elsif (/rn/) { (say Dumper(Tools::Network::node_reboot($_))) for @ARGV; }
else { else {
my $e = e(shift); my $e = e(shift);
if (/--help/) { usage; } if (/--help/) { usage; }
...@@ -111,6 +114,7 @@ if (@ARGV) { ...@@ -111,6 +114,7 @@ if (@ARGV) {
elsif (/ip/) { say Dumper($e->info(aspect => 'physical')) ;} elsif (/ip/) { say Dumper($e->info(aspect => 'physical')) ;}
elsif (/it/) { say Dumper($e->info(aspect => 'traces')) ;} elsif (/it/) { say Dumper($e->info(aspect => 'traces')) ;}
elsif (/il/) { say Dumper($e->info(aspect => 'links')) ;} elsif (/il/) { say Dumper($e->info(aspect => 'links')) ;}
elsif (/kk/) { say Dumper($e->node('node1')->reboot) ;}
elsif ($_ eq 'syncs') { prun( map { my $n = $_; sub { $e->node('node1')->ssh->cmdoutput('/usr/testbed/bin/emulab-sync'); } } (1..shift)); } elsif ($_ eq 'syncs') { prun( map { my $n = $_; sub { $e->node('node1')->ssh->cmdoutput('/usr/testbed/bin/emulab-sync'); } } (1..shift)); }
elsif (/watch/) { watch($e); } elsif (/watch/) { watch($e); }
elsif ($_ eq'ex') { elsif ($_ eq'ex') {
......
...@@ -30,7 +30,7 @@ use TBConfig; ...@@ -30,7 +30,7 @@ use TBConfig;
my $concurrent_prerun_jobs; my $concurrent_prerun_jobs;
my $concurrent_node_usage; my $concurrent_node_usage;
my $exclude_steps; my $exclude_steps;
my $single; my $runonly;
my $dontkill; my $dontkill;
my $alreadyalive; my $alreadyalive;
my $daemonize; my $daemonize;
...@@ -43,7 +43,7 @@ use TBConfig; ...@@ -43,7 +43,7 @@ use TBConfig;
"cprj=i" => \$concurrent_prerun_jobs, "cprj=i" => \$concurrent_prerun_jobs,
"cnu=i" => \$concurrent_node_usage, "cnu=i" => \$concurrent_node_usage,
"excludesteps=s" => \$exclude_steps, "excludesteps=s" => \$exclude_steps,
"single=s" => \$single, "runonly=s" => \$runonly,
"dontkill" => \$dontkill, "dontkill" => \$dontkill,
"alreadyalive" => \$alreadyalive, "alreadyalive" => \$alreadyalive,
"daemonize" => \$daemonize, "daemonize" => \$daemonize,
...@@ -57,7 +57,7 @@ use TBConfig; ...@@ -57,7 +57,7 @@ use TBConfig;
if ($concurrent_node_usage) { $TBConfig::concurrent_node_usage = $concurrent_node_usage; } if ($concurrent_node_usage) { $TBConfig::concurrent_node_usage = $concurrent_node_usage; }
if ($cmdline_defines) { $TBConfig::cmdline_defines = $cmdline_defines; } if ($cmdline_defines) { $TBConfig::cmdline_defines = $cmdline_defines; }
if ($exclude_steps) { $TBConfig::exclude_steps = [split(/ /, $exclude_steps)]; } if ($exclude_steps) { $TBConfig::exclude_steps = [split(/ /, $exclude_steps)]; }
if ($single) { $TBConfig::single = $single; } if ($runonly) { $TBConfig::runonly = [split(/ /, $runonly)]; }
if ($dontkill) { $TBConfig::exclude_steps = [qw/swapout end/]} if ($dontkill) { $TBConfig::exclude_steps = [qw/swapout end/]}
if ($alreadyalive) { $TBConfig::exclude_steps = [qw/create swapin swapout end/]} if ($alreadyalive) { $TBConfig::exclude_steps = [qw/create swapin swapout end/]}
if ($daemonize) { Tools::daemonize; } if ($daemonize) { Tools::daemonize; }
......
...@@ -188,7 +188,8 @@ tb_run("tbend",0); ...@@ -188,7 +188,8 @@ tb_run("tbend",0);
'singlenode' => { 'singlenode' => {
'info' => 'One node. 'info' => 'One node.
', ',
'nsfile' => 'set ns [new Simulator] 'nsfile' => 'source tb_compat.tcl
set ns [new Simulator]
set node [$ns node] set node [$ns node]
$ns run $ns run
...@@ -309,8 +310,8 @@ set router [$ns node] ...@@ -309,8 +310,8 @@ set router [$ns node]
set client [$ns node] set client [$ns node]
set server [$ns node] set server [$ns node]
set client-lan [$ns make-lan "$send $router $client" 100Mb 1ms] set client-lan [$ns make-lan "$send $router $client" 100Mb 2ms]
set server-lan [$ns make-lan "$consume $server $router" 100Mb 1ms] set server-lan [$ns make-lan "$consume $server $router" 100Mb 2ms]
tb-set-node-startup $router /users/newbold/trafgen/fbsd-router-startup tb-set-node-startup $router /users/newbold/trafgen/fbsd-router-startup
...@@ -601,8 +602,8 @@ tb_run("tbend",0); ...@@ -601,8 +602,8 @@ tb_run("tbend",0);
node0 to node3 is delayed. node0 to node3 is delayed.
', ',
'nsfile' => 'set ns [new Simulator] 'nsfile' => 'source tb_compat.tcl
set ns [new Simulator]
set node0 [$ns node] set node0 [$ns node]
set node1 [$ns node] set node1 [$ns node]
set node2 [$ns node] set node2 [$ns node]
...@@ -610,11 +611,11 @@ set node3 [$ns node] ...@@ -610,11 +611,11 @@ set node3 [$ns node]
set node4 [$ns node] set node4 [$ns node]
set node5 [$ns node] set node5 [$ns node]
set link0 [$ns duplex-link $node0 $node1 100Mb .1ms DropTail] set link0 [$ns duplex-link $node0 $node1 100Mb 2ms DropTail]
set link1 [$ns duplex-link $node0 $node2 100Mb .1ms DropTail] set link1 [$ns duplex-link $node0 $node2 100Mb 2ms DropTail]
set link2 [$ns duplex-link $node0 $node3 10Mb 100ms DropTail] set link2 [$ns duplex-link $node0 $node3 10Mb 100ms DropTail]
set link3 [$ns duplex-link $node3 $node4 100Mb .1ms DropTail] set link3 [$ns duplex-link $node3 $node4 100Mb 2ms DropTail]
set link4 [$ns duplex-link $node3 $node5 100Mb .1ms DropTail] set link4 [$ns duplex-link $node3 $node5 100Mb 2ms DropTail]
# Turn on manual routing. # Turn on manual routing.
$ns rtproto Manual $ns rtproto Manual
...@@ -858,7 +859,7 @@ tb_run("tbswap out",0); ...@@ -858,7 +859,7 @@ tb_run("tbswap out",0);
tb_run("tbend",0); tb_run("tbend",0);
' '
}, },
'set-ip' => { 'setip' => {
'info' => 'Sets up a basic topology and then tries out all the tb-set-ip commands. 'info' => 'Sets up a basic topology and then tries out all the tb-set-ip commands.
', ',
......
#!/usr/bin/perl
use SemiModern::Perl;
use TestBed::TestSuite;
use Test::More;
use Data::Dumper;
my $ns = <<'NSEND';
source tb_compat.tcl
set ns [new Simulator]
set node1 [$ns node]
$ns run
NSEND
rege(e('sn'), $ns, sub { ok(shift->single_node_tests); }, 1, 'single_node_tests');
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