Commit 639758e6 authored by Dan Gebhardt's avatar Dan Gebhardt

Some very basic infrastructure for generalized tools was added.

Some parts very "hacky", lots of XXX / TODOs.
BARELY tested!!!! Don't use on the production system yet.
Need to verify that things didn't break, especially with the automanager,
the bgmon.pl "outage detection stuff", etc...

See code's todos and also the file
flexlab-canonicalization-misc-notes.txe

At this point:
 - mangerclient & automanagerclient did not change.
 - The manager, when a probe request is received, looks at the DB table
   "tool_spec" to retrieve the proper wrapperpath, formal parameter list, etc..
 - The manager assembles a message and sends it out to the appropriate
   path probers, which operate on the request as they have been
   (no major internal changes to the path probers).
 - The path probers call the toolwrapper to run the tests
 - The toolwrappers return a canonical result for that type of metric.
 - The path probers send the result and the actual parameters used by the
   tool to the data collector.
 - The data collector uses the toolname and actual parameters to get an
   idx number. This idx is stored in the "measured_by" field of this
   measurement's entry in the "pair_data" table.
parent caa4023a
This diff is collapsed.
NOTICE: The "measured_by" field in the table "pair_data" is
a short integer... should be longer (?)
TODO:
2) Change bgmon queuing so that different tools of the
same class do not overwrite each other.
3) Add generalization into the managerclient
4) Make Iperfwrapper do the iperf timeout stuff.
5) move probe "target" into the actual param list? NO:
don't want a new entry in tool_idx for every destination!
6) make "outage detection system" a separate tool.
Data Collector
Gets result packet from path prober, containing extra
info about the tool type and actual parameters used.
Find the proper ToolID in the "ToolParamTable" indexing with
toolname and actual_params. If no match, add new entry
with new ID number.
Manager:
For now, just "hardwires" the tool parameters so that the
managerclient does not need to be changed
Managerclient:
no changes for now.
Wrapper scripts for iperf, fping, and ping:
- iperf
- input: list of arguments, e.g.: duration=5,target=plab222
- output: result, e.g: 500
wrapper executes actual tool with appropriate command-lines
wrapper outputs a key-value pair of results and error codes.
Path Prober:
bgmon.pl receives probe request:
cmdtype: INIT
toolname: iperf
type: one-shot
duration: 12000
wrapper_path: /tmp/iperfwrapper
required_params: target=plab222,period=600,port=6666,duration=5
optional_params:
bgmon.pl stores request into "testevents"
Test is started at appropriate time by running the wrapper_path with the argument fields. Wrapper output read from file, as is currently done.
......@@ -6,6 +6,10 @@
#
#
# TODO: Watch iperf, and kill if a timeout (30 sec) is exceeded.
#
use strict;
my %params = (@ARGV);
......
......@@ -89,8 +89,9 @@ sub serialize_hash($)
my $out = "";
for my $key (keys %hash){
$out .= $separator if( $out ne "" );
$out .= $key.$separator.$hash{$key};
$out .= $separator if( $out ne "" );
$out .= $key.$separator;
$out .= $hash{$key} if( defined $hash{$key} );
}
return $out;
}
......
......@@ -168,6 +168,51 @@ while (1) {
}
}
#
#XXX / TODO: stuff for tool generalization
# hacked in here for now, but source should be from the
# managerclient' message (?)
#
sub addToolSpecificFields
{
my ($cmdRef) = @_;
my $testtype = $cmdRef->{testtype};
my $toolname;
my ($req_params_actual, $opt_params_actual);
if( $testtype eq "bw" ){
$toolname = "iperf";
# $toolwrapperpath = "/tmp/iperfwrapper";
# $tooltype = "one-shot";
$req_params_actual = "port 5002 duration 5";
}elsif( $testtype eq "latency"){
$toolname = "fping";
# $toolwrapperpath = "/tmp/fpingwrapper";
# $tooltype = "one-shot";
$req_params_actual = "timeout 10000 retries 1";
}
my $sth = DBQuery("select * from tool_spec where toolname='$toolname'");
my ( $toolname, $metric, $type, $toolwrapperpath,
$req_params_formal, $opt_params_formal)
= ( $sth->fetchrow_array() );
#XXX / TODO Check that all given actual parameters match the formal params
#
$cmdRef->{toolname} = $toolname;
$cmdRef->{toolwrapperpath} = $toolwrapperpath;
$cmdRef->{tooltype} = $type;
$cmdRef->{req_params} = $req_params_actual;
$cmdRef->{opt_params} = $opt_params_actual;
print "CMD: \n";
foreach my $key (keys %{$cmdRef}){
my $value = ${$cmdRef}{$key};
print " $key=$value \n";
}
}
#
# callback for managerclient requests
......@@ -236,28 +281,6 @@ sub callbackFunc($$$) {
$notification,
"expid");
#
#XXX / TODO: stuff for tool generalization
# hacked in here for now, but source should be from the
# managerclient' message (?)
#
my $toolname;
my $toolwrapperpath;
my $tooltype; #one-shot or continuous
my $req_params; #params required, but universal for each tool instance
my $opt_params = "";
if( $testtype eq "bw" ){
$toolname = "iperf";
$toolwrapperpath = "/tmp/iperfwrapper";
$tooltype = "one-shot";
$req_params = "port 5002 duration 5";
}elsif( $testtype eq "latency"){
$toolname = "fping";
$toolwrapperpath = "/tmp/fpingwrapper";
$tooltype = "one-shot";
$req_params = "timeout 10000 printstats 1 retries 1";
}
if( !defined $newexpid || $newexpid eq "" ){
$newexpid = $bgmonexpt;
......@@ -270,13 +293,9 @@ sub callbackFunc($$$) {
testper => "$period",
duration => "$duration",
managerID => $managerID
,toolname => $toolname
,toolwrapperpath=>$toolwrapperpath
,tooltype => $tooltype
,req_params=> $req_params
,opt_params=> $opt_params
);
addToolSpecificFields(\%cmd);
print "got EDIT: $srcnode, $dstnode: $newexpid\n";
......@@ -310,28 +329,6 @@ sub callbackFunc($$$) {
my $newexpid = event_notification_get_string($handle,
$notification,
"expid");
#
#XXX / TODO: stuff for tool generalization
# hacked in here for now, but source should be from the
# managerclient' message (?)
#
my $toolname;
my $toolwrapperpath;
my $tooltype; #one-shot or continuous
my $req_params; #params required, but universal for each tool instance
my $opt_params = "";
if( $testtype eq "bw" ){
$toolname = "iperf";
$toolwrapperpath = "/tmp/iperfwrapper.pl";
$tooltype = "one-shot";
$req_params = "port 5002 duration 5";
}elsif( $testtype eq "latency"){
$toolname = "fping";
$toolwrapperpath = "/tmp/fpingwrapper.pl";
$tooltype = "one-shot";
$req_params = "timeout 10000 retries 1";
}
if( !defined $newexpid || $newexpid eq "" ){
$newexpid = $bgmonexpt;
......@@ -345,27 +342,18 @@ sub callbackFunc($$$) {
testper => "$testper",
duration => "$duration"
,managerID => $managerID
,toolname => $toolname
,toolwrapperpath=>$toolwrapperpath
,tooltype => $tooltype
,req_params=> $req_params
,opt_params=> $opt_params
);
addToolSpecificFields(\%cmd);
print "got $eventtype:$srcnode,$destnodes,$testtype,".
"$testper,$duration,$managerID,$newexpid\n";
# only automanager can send "forever" edits (duration=0)
# if( $duration > 0 ){ #|| $managerID eq "automanagerclient" ){
# print "sending cmd from $srcnode\n";
# sendcmd( $srcnode, \%cmd );
# }
if( isCmdValid(\%cmd) ){
# print "sending cmd from $srcnode\n";
print "sending cmd to $srcnode on behalf of $managerID\n";
sendcmd( $srcnode, \%cmd );
}else{
print "rejecting $testtype cmd for $srcnode\n";
print "rejecting $testtype cmd for $srcnode\n";
}
}
elsif( $eventtype eq "STOPALL" ){
......@@ -611,6 +599,7 @@ sub getBandwidth() {
}
}
=pod
sub event_poll_amc($){
my ($handle) = @_;
......
This diff is collapsed.
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