Commit 60bc1ead authored by Leigh Stoller's avatar Leigh Stoller

Some temporary HACKS to deal with multi-switch. Add a -s switch option

to ptopgen to use just one switch, and pass that from assign. Only
until new snmpit is ready.
parent 2c1d5261
......@@ -20,10 +20,11 @@
$delaythresh = 3;
$maxrun = 20;
$delaywithswitch=0;
$assignlog = "assign.log";
$DELAYCAPACITY = @DELAYCAPACITY@;
$TBROOT = "@prefix@";
$ENV{'PATH'} = "/usr/bin:$TBROOT/libexec:$TBROOT/sbin:$TBROOT/bin";
$ENV{'PATH'} = "/bin:/usr/bin:$TBROOT/libexec:$TBROOT/sbin:$TBROOT/bin";
use lib '@prefix@/lib';
use libdb;
......@@ -324,6 +325,9 @@ DBQueryFatal("UPDATE experiments set maximum_nodes=$maximum_nodes, " .
print "Minumum nodes = $minimum_nodes\n";
print "Maximum nodes = $maximum_nodes\n";
# Init assign.log with the topfile.
system("cat $topfile > $assignlog");
######################################################################
# Step 2 - Assign Loop
#
......@@ -354,7 +358,18 @@ while (1) {
undef %plinks;
# Snapshot
system("ptopgen > $ptopfile");
# XXX HACK!!! Alternate switches for now.
my $switchtouse;
if ($currentrun & 1) {
$switchtouse = "-s cisco3";
}
else {
$switchtouse = "-s cisco1";
}
system("ptopgen $switchtouse > $ptopfile");
# Add latest ptop to log.
system("cat $ptopfile >> $assignlog");
# Get number of nodes
my $numnodes_result =
......@@ -373,7 +388,7 @@ while (1) {
# Run assign
$fail = 0;
print "assign -b -t $ptopfile $topfile\n";
open(ASSIGNFP,"assign -b -t $ptopfile $topfile | tee assign.log |");
open(ASSIGNFP,"assign -b -t $ptopfile $topfile | tee -a $assignlog |");
$violations = 0;
$score = -1;
......
#!/usr/bin/perl -w
use English;
use Getopt::Std;
# Settings - Change these to your particular network.
# Switch interface speed - In Mbps
$switch_speed = 100;
sub usage()
{
print STDOUT "Usage: ptopgen [-s switch]\n";
exit(-1);
}
my $optlist = "s:";
######################################################################
my $TBROOT = "@prefix@";
......@@ -14,6 +23,22 @@ use libdb;
%switches=();
%used_switches=();
my $switchtouse;
#
# Parse command arguments. Once we return from getopts, all that should be
# left are the required arguments.
#
%options = ();
if (! getopts($optlist, \%options)) {
usage();
}
if (@ARGV) {
usage();
}
if (defined($options{"s"})) {
$switchtouse = $options{"s"};
}
# Read class/type maps
my $result = DBQueryFatal("select class,type,delay_capacity from node_types");
......@@ -27,12 +52,20 @@ $result->finish;
$nodetypes{"switch"} = 0;
# Print switches
$result = DBQueryFatal("select node_id from nodes where role = \"testswitch\"");
while (($switch) = $result->fetchrow_array) {
print "node $switch switch:1\n";
$switches{$switch} = 1;
if (defined($switchtouse)) {
print "node $switchtouse switch:1\n";
$switches{$switchtouse} = 1;
}
else {
$result =
DBQueryFatal("select node_id from nodes where role = \"testswitch\"");
while (($switch) = $result->fetchrow_array) {
print "node $switch switch:1\n";
$switches{$switch} = 1;
}
$result->finish;
}
$result->finish;
# Find available nodes
$result = DBQueryFatal("select a.node_id,a.type from" .
......
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