Commit 74d068a9 authored by Leigh Stoller's avatar Leigh Stoller

Add support for the 3rd metric (PLR) when solving. Also use the new

experiment table fields that hold the solver weights that are set by
the user in the front end with the tb-set-wasolver-weights command.
parent 4986f586
......@@ -21,9 +21,9 @@ my $optlist = "dn";
#
my $TB = "@prefix@";
my $wansolve = "$TB/libexec/wanlinksolve";
my $wansolveargs= "-m 4 -2 7 -v";
my $wansolveargs= "-m 4 -v";
my $waninfo = "$TB/libexec/wanlinkinfo";
my $waninfoargs = "-b -m";
my $waninfoargs = "-b -m -p";
#
# Testbed Support libraries
......@@ -109,6 +109,11 @@ my %mappings;
# Use latest data flag. From the experiments table.
my $uselatestwadata = 0;
# Wan solver weights. Also from the experiments table.
my $wa_delay_solverweight = 1.0;
my $wa_bw_solverweight = 7.0;
my $wa_plr_solverweight = 500.0;
#
# A node record (poor man struct). We create a hashed array of these,
# indexed by the vnode name.
......@@ -153,15 +158,27 @@ sub newvlan ($) {
}
#
# Get the flag uselatest data flag.
# Get the various bits we need from the experiments table.
#
$query_result =
DBQueryFatal("select uselatestwadata from experiments ".
DBQueryFatal("select uselatestwadata,wa_delay_solverweight, ".
" wa_bw_solverweight,wa_plr_solverweight ".
" from experiments ".
"where pid='$pid' and eid='$eid'");
($uselatestwadata) = $query_result->fetchrow_array();
($uselatestwadata,$wa_delay_solverweight,
$wa_bw_solverweight,$wa_plr_solverweight) = $query_result->fetchrow_array();
if ($uselatestwadata) {
printdb("Using latest widearea data.\n");
}
printdb("Solver weights:\n");
printdb(" Delay: $wa_delay_solverweight\n");
printdb(" BW: $wa_bw_solverweight\n");
printdb(" PLR: $wa_plr_solverweight\n");
# Add the args for the solver.
$wansolveargs .= " -1 $wa_delay_solverweight";
$wansolveargs .= " -2 $wa_bw_solverweight";
$wansolveargs .= " -3 $wa_plr_solverweight";
#
# Get type map.
......@@ -560,12 +577,13 @@ sub runwansolver() {
}
#
# Now create the latency and bandwidth matricies. We need to map all local
# Now create the delay,bw,and plr matricies. We need to map all local
# nodes onto a single row/column. For that, we use the $seenboss value; all
# local node names are mapped into that name in the matrix (2D hash).
#
my %latmatrix = ();
my %bwmatrix = ();
my %plrmatrix = ();
foreach my $vnode1 (keys(%virtnodes)) {
my $rowname = (!isremotenode($vnode1) ? $seenboss : $vnode1);
......@@ -575,8 +593,9 @@ sub runwansolver() {
my $colname = (!isremotenode($vnode2) ? $seenboss : $vnode2);
if ($colname eq $rowname) {
$latmatrix{$rowname}{$colname} = -1;
$bwmatrix{$rowname}{$colname} = -1;
$latmatrix{$rowname}{$colname} = -1;
$bwmatrix{$rowname}{$colname} = -1;
$plrmatrix{$rowname}{$colname} = -1;
next;
}
if (!defined($virtlan)) {
......@@ -587,12 +606,17 @@ sub runwansolver() {
if (!defined($bwmatrix{$rowname}{$colname})) {
$bwmatrix{$rowname}{$colname} = -1;
}
if (!defined($plrmatrix{$rowname}{$colname})) {
$plrmatrix{$rowname}{$colname} = -1;
}
next;
}
$latmatrix{$rowname}{$colname} =
findlinkvalue($virtlan, "delay", $vnode1, $vnode2);
$bwmatrix{$rowname}{$colname} =
findlinkvalue($virtlan, "bw", $vnode1, $vnode2);
$plrmatrix{$rowname}{$colname} =
findlinkvalue($virtlan, "plr", $vnode1, $vnode2);
}
}
......@@ -616,6 +640,15 @@ sub runwansolver() {
print INPUT "\n";
printdb("\n");
}
foreach my $vnode1 (sort(keys(%plrmatrix))) {
foreach my $vnode2 (sort(keys(%{ $plrmatrix{$vnode1}}))) {
printdb("$vnode1:$vnode2($plrmatrix{$vnode1}{$vnode2}) ");
print INPUT "$plrmatrix{$vnode1}{$vnode2} ";
}
print INPUT "\n";
printdb("\n");
}
close(INPUT) or
die("*** $0:\n".
" Error closing input file: $!\n");
......@@ -812,6 +845,9 @@ sub findlinkvalue($$$$)
elsif ($param eq "delay") {
return $param1{DELAY} + $param2{RDELAY};
}
elsif ($param eq "plr") {
return 1 - (1 - $param1{PLR}) * (1 - $param2{RPLR});
}
else {
die("*** $0:\n".
" Bad param $param in findlinkvalue!\n");
......
......@@ -10,14 +10,15 @@ use Getopt::Std;
sub usage()
{
print STDOUT
"Usage: wanlinkinfo [-d] [-m] [-b] [-l] [-r]\n".
"Usage: wanlinkinfo [-d] [-m] [-b] [-l] [-p] [-r]\n".
" Use -m to output virtual node counts per phys node.\n".
" Use -b to output bandwidth matrix.\n".
" Use -p to output plr matrix.\n".
" Use -r to remove boss from matrix.\n".
" Use -l to use the latest data instead of aged data.\n";
exit(-1);
}
my $optlist = "dmblr";
my $optlist = "dmblrp";
#
# Configure variables
......@@ -34,6 +35,7 @@ use libtestbed;
# Locals
my $debug = 0;
my $dobw = 0;
my $doplr = 0;
my $dovirt = 0;
my $dolatest = 0;
my $noboss = 0;
......@@ -73,19 +75,23 @@ if (defined($options{"l"})) {
if (defined($options{"r"})) {
$noboss = 1;
}
if (defined($options{"p"})) {
$doplr = 1;
}
my $result =
DBQueryFatal("SELECT node_id1,iface1,node_id2,iface2,time,bandwidth " .
"FROM " .
DBQueryFatal("SELECT node_id1,iface1,node_id2,iface2,time, " .
" bandwidth,lossrate FROM " .
($dolatest ? "widearea_recent " : "widearea_delays ") .
($noboss ? "where node_id1!='boss' and ".
" node_id2!='boss'" : ""));
my %nodename = ();
my %speeds = ();
my %bws = ();
my %bws = ();
my %plrs = ();
while (my ($node_id1, $iface1, $node_id2, $iface2, $time, $bw) =
while (my ($node_id1, $iface1, $node_id2, $iface2, $time, $bw, $plr) =
$result->fetchrow) {
my $msectime = $time * 1000;
my $glom1 = $node_id1 . ":" . $iface1;
......@@ -97,6 +103,7 @@ while (my ($node_id1, $iface1, $node_id2, $iface2, $time, $bw) =
$speeds{ $glom1 . "+" . $glom2 } = $msectime;
$bws{ $glom1 . "+" . $glom2 } = $bw;
$plrs{ $glom1 . "+" . $glom2 } = $plr;
}
print scalar( keys %nodename ) . "\n";
......@@ -153,3 +160,16 @@ if ($dobw) {
print "\n";
}
}
if ($doplr) {
foreach my $i (sort (keys %nodename)) {
foreach my $j (sort (keys %nodename)) {
my $s = "0";
if (exists $plrs{ $i."+".$j } ) {
$s = $plrs{ $i . "+" . $j };
}
print sprintf( "%.3f ", $s );
}
print "\n";
}
}
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