Commit 09a9cd61 authored by Leigh B Stoller's avatar Leigh B Stoller

Merge branch 'master' of git-public.flux.utah.edu:/flux/git/emulab-devel

parents d3791318 be6af5b8
......@@ -84,4 +84,8 @@ Other changes:
"kilobits" to be 1024 bits, not 1000 bits as we were assuming. So we now
specify bandwidth in raw bits rather than kilobits.
* Added support for standalone mode (see ROADMAP.standalone)
* Added initial attempt at unlinktest as level 5.
......@@ -2,7 +2,7 @@
Running in Standalone Mode
--------------------------
run-standalone <run-level> <run-path> <log-path> <host-list> [node-list]
run-standalone <run-level> <run-path> <var-path> <log-path> <host-list> [node-list]
Uses pssh to simultaneously run linktest in standalone mode for all
hosts listed.
......@@ -10,7 +10,8 @@ hosts listed.
run-level -- An integer betweeen 1 and 4 with higher numbers
performing more tests (see:
http://users.emulab.net/trac/emulab/wiki/linktest).
run-path -- Contains the standalone package (manifest described below).
run-path -- Contains execution package (manifest described below).
var-path -- Contains configuration files (manifest described below).
log-path -- An empty directory where low-level error logs are kept.
host-list -- Comma-delimeted list of hostnames to run on.
node-list -- If the nodes have different control and experimental
......@@ -25,7 +26,7 @@ Note: Currently node names (those listed in the node-list and the
nickname and syncserver hostname described below) are all assumed to
be a single unqualified name (like node-0).
standalone.sh <run-level> <run-path> <log-path> <node-list>
standalone.sh <run-level> <run-path> <var-path> <log-path> <node-list>
Invokes linktest with the appropriate arguments.
......@@ -34,7 +35,7 @@ Invokes linktest with the appropriate arguments.
Standalone Package Manifest
---------------------------
Executables:
Executables in run-path:
standalone.sh -- Invokes linktest in standalone mode
linktest.pl -- Main linktest script
......@@ -45,15 +46,24 @@ bin/emulab-sync -- Sync client for synchronizing different clients
-------------------------------------------------------------------------------
Configuration:
Configuration in var-path:
boot/nickname -- Contains a single line with the hostname of the
experimental interface on this node.
experimental interface on this node.
Example:
node0
-------------------------------------------------------------------------------
boot/controlif -- Contains a single line with the control interface
name. This is the interface which is not brought up
or down or modified when doing unlinktest.
Example:
eth4
-------------------------------------------------------------------------------
boot/syncserver -- Contains a single line with the hostname of the sync server.
Example:
node4
......@@ -116,7 +126,9 @@ L <first-node> <second-node> <link-name> <mac-address> <mpx-style> <dstyle>
first-node, second-node -- node names of link
link-name -- Name of link or lan. All pairs in the link/lan in every
direction must be represented.
mac-address -- MAC address of specified interface. Used for debugging output.
mac-address -- MAC address of specified interface. Used for debugging
output and unlinktest when determining whether or not
to test this interface node.
mpxstyle -- If 'veth' for virtual ethernet device, changes header size
calculations.
dstyle -- If ends in '-nobw', skips bandwidth test for this link. If
......
......@@ -39,6 +39,7 @@ sub usage()
" [LOGDIR=<path/to/log/root>]\n".
" [BINDIR=<path/to/binary/files>]\n".
" [VARDIR=<path/to/config/files>]\n".
" [STANDALONE=<1|0>]\n".
" [EVENTSERVER=<eventserver hostname>]\n");
print(" <test step>: 1=conn/latency, 2=routing, 3=loss, 4=BW\n".
" COMPAT=<version>: remain compatible with version <version> or earlier\n".
......@@ -109,12 +110,14 @@ use constant TEST_LATENCY => 1; # direct link connectivity & latency
use constant TEST_RT_STATIC => 2; # prior plus static routing
use constant TEST_LOSS => 3; # prior plus loss
use constant TEST_BW => 4; # prior plus bandwidth
use constant TEST_UNLINK => 5; # prior plus unconnected interfaces
# test names
use constant NAME_RT_STATIC => "Routing";
use constant NAME_LATENCY => "Latency";
use constant NAME_LOSS => "Loss";
use constant NAME_BW => "Bandwidth";
use constant NAME_UNLINK => "Unlink";
# error suffix for logs
use constant SUFFIX_ERROR => ".error";
......@@ -240,6 +243,7 @@ our $LOGDIR = "";
our $SHAREDDIR = "";
our $EVENTSERVER = "";
our $EVENTID = "";
our $STANDALONE = 0;
#
# Parse command arguments. Since Linktest is run via the event system,
......@@ -295,6 +299,11 @@ foreach my $arg (@ARGV) {
if($arg =~ /EVENTSERVER=(.+)/) {
$EVENTSERVER = $1;
}
if ($arg =~ /STANDALONE=(.+)/) {
if ($1 eq "1") {
$STANDALONE = 1;
}
}
}
$compat = 99
......@@ -307,6 +316,7 @@ if ($compat < 1.2) {
# path to applications and files
our $PATH_NICKNAME = "$VARDIR/boot/nickname";
our $PATH_CONTROL_IF = "$VARDIR/boot/controlif";
our $PATH_KEYFILE = "$VARDIR/boot/eventkey";
our $PATH_RUDE = "$BINDIR/emulab-rude";
our $PATH_CRUDE = "$BINDIR/emulab-crude";
......@@ -378,7 +388,9 @@ $ptopology_file = $PATH_PTOPOFILE;
# the NFS server.
#
sleep(int(rand(5)));
&my_system($PATH_RCTOPO, "reconfig");
if (! $STANDALONE) {
&my_system($PATH_RCTOPO, "reconfig");
}
&get_topo($topology_file, $ptopology_file);
&debug_top();
......@@ -639,6 +651,22 @@ if(&dotest(TEST_BW)){
&report_status(NAME_BW);
}
if(&dotest(TEST_UNLINK)) {
my $stamp = TimeStamp();
my $msg = "Testing Unconnected Interfaces ... $stamp";
&post_event(EVENT_REPORT,$msg);
&sim_event(EVENT_LOG,$msg);
# Ick, this barrier makes sure the above message gets into the log
# first, so as not to confuse Mike
if ($printsched) {
&schedlog("barrier $barriers_hit: pre-unlink test");
}
&barrier();
&debug("\n$msg\n\n");
&unlink_test;
&report_status(NAME_UNLINK);
}
&cleanup;
if ($printsched) {
......@@ -657,6 +685,113 @@ $msg = "Linktest Done";
exit(EXIT_OK);
##############################################################################
# Unlink Test Functions
##############################################################################
our $control_if = "";
our %interfaces = ();
sub setup_interfaces {
$control_if = `cat $PATH_CONTROL_IF`;
chomp($control_if);
foreach my $link (@{ $hostmap{$hostname}->links }) {
$interfaces{lc($link->mac)} = 1;
my $foo = $link->mac;
}
}
sub get_iflist {
my $raw = `/sbin/ifconfig -a`;
my @result = split("\n\n", $raw);
return \@result;
}
sub gather_stats {
my @result = ();
my @iflist = @{ &get_iflist() };
foreach my $ifline (@iflist) {
if ($ifline =~ /^(\w+)\W.*RX packets:([0-9]+) /) {
if ($1 ne $control_if) {
push(@result, $2);
}
}
}
return \@result;
}
sub check_stats {
my @first = @{ $_[0] };
my @second = @{ $_[1] };
my $result = 0;
if (scalar(@first) == scalar(@second)) {
$result = 1;
for (my $i = 0; $i < scalar(@first); ++$i) {
if ($first[$i] != $second[$i]) {
$result = 0;
last;
}
}
}
return $result;
}
sub arpping {
my @iflist = @{ &get_iflist() };
foreach my $ifline (@iflist) {
if ($ifline =~ /^(\w+)\W.*HWaddr ([0-9a-fA-F:]+)/) {
my $ifname = $1;
my $mac = lc(join('', split(':', $2)));
if (! exists($interfaces{$mac}) && $ifname ne $control_if) {
my $command
= "sudo /sbin/ifconfig $ifname up; ".
"sudo /sbin/arping -c 1 -w 1 -I $ifname 10.0.0.1; ".
"sudo /sbin/ifconfig $ifname down";
# print($command."\n");
system($command);
}
}
}
}
sub modify_interfaces {
my ($speed, $duplex) = @_;
my @iflist = @{ &get_iflist() };
foreach my $ifline (@iflist) {
if ($ifline =~ /^(\w+)\W.*HWaddr ([0-9a-fA-F:]+)/) {
my $ifname = $1;
my $mac = lc(join('', split(':', $2)));
if (! exists($interfaces{$mac}) && $ifname ne $control_if) {
my $command = "sudo /sbin/ethtool -s $ifname speed $speed ".
"duplex $duplex autoneg off";
# print($command."\n");
system($command);
}
}
}
}
sub unlink_test {
my @speeds = ('10', '100', '1000');
my @duplexes = ('half', 'full');
&setup_interfaces();
my $start = &gather_stats();
&barrier();
&arpping();
foreach my $speed (@speeds) {
foreach my $duplex (@duplexes) {
&modify_interfaces($speed, $duplex);
&arpping();
}
}
&barrier();
my $end = &gather_stats();
if (! &check_stats($start, $end)) {
&error(NAME_UNLINK, undef,
"Some interfaces received packets");
}
}
##############################################################################
# Loss Test Functions
......
#!/usr/bin/perl -w
use File::Temp qw/ tempfile /;
if (scalar(@ARGV) < 5) {
print STDERR 'run-standalone <run-level> <run-path> <var-path> <log-path> <host-list> [node-list]
Uses pssh to simultaneously run linktest in standalone mode for all
hosts listed.
run-level -- An integer betweeen 1 and 4 with higher numbers
performing more tests (see:
http://users.emulab.net/trac/emulab/wiki/linktest).
run-path -- Contains execution package (manifest described below).
var-path -- Contains configuration files (manifest described below).
log-path -- An empty directory where low-level error logs are kept.
host-list -- Comma-delimeted list of hostnames to run on.
node-list -- If the nodes have different control and experimental
interfaces, the hostlist should contain the control
interface names (accessed via pssh) and the nodelist
should contain experimental interface names (used
internally in linktest). If the nodes do not have
separate control interfaces, the nodelist may be
omitted.
Note: Currently node names (those listed in the node-list and the
nickname and syncserver hostname described below) are all assumed to
be a single unqualified name (like node-0).
';
exit(1);
}
($level, $runpath, $varpath, $logpath, $hosts, $nodes) = @ARGV;
($fh, $filename) = tempfile();
@hostList = split(",", $hosts);
print $fh join("\n", @hostList);
close $fh;
if (! defined($nodes)) {
$nodes = $hosts;
}
$command = "sh -i -c 'pssh -h $filename -o out -e err -t 3000 sh $runpath/standalone.sh $level $runpath $varpath $logpath $nodes'";
print($command."\n");
system($command);
sudo perl -w -T /proj/tbres/duerig/src/event/linktest/linktest.pl STARTAT=1 STOPAT=$1 DOARP=0 LOGDIR=$3 BINDIR=$2 VARDIR=$2
sudo perl -w -T $2/linktest.pl STARTAT=1 STOPAT=$1 DOARP=0 LOGDIR=$4 BINDIR=$2 VARDIR=$3 STANDALONE=1
......@@ -195,6 +195,14 @@ sub GetElementByVirtualId($$$)
my ($name, $type, $node) = @_;
my @list = FindNodes('n:'.$type.'[@virtual_id = "'.$name.'"]',
$node)->get_nodelist();
if (scalar(@list) == 0) {
@list = FindNodes('n:'.$type.'[@nickname = "'.$name.'"]',
$node)->get_nodelist();
}
if (scalar(@list) == 0) {
@list = FindNodes('n:'.$type.'[@client_id = "'.$name.'"]',
$node)->get_nodelist();
}
my $result = undef;
if (scalar(@list) > 0)
{
......
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