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

testsuite/testswap added node reboot and powercycle

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