Commit 99a5aa1a authored by Jonathon Duerig's avatar Jonathon Duerig

Made sure new libvtop_test changes are backwards compatible with old ptopgen.

Added a '-Z' option to ptopgen to force old version.
Added '-z' (force new ptopgen) and '-Z' (force old ptopgen) options to mapper.
parent a368b5a1
......@@ -4087,17 +4087,26 @@ sub ReadTextSolution($$)
if (!$trivial) {
($nodeportA,$switchportA) = getnodeport($rawA);
if (! defined($nodeportA) || ! defined($switchportA)) {
tberror("Malformed interface pair A: $rawA\n");
return -1;
}
# TODO: Add this error checking code in once ptopgen_new
# becomes standard
# if (! defined($nodeportA) || ! defined($switchportA)) {
# tberror("Malformed interface pair A: $rawA\n");
# return -1;
# }
# Convert back to node:iface format.
$nodeportA =~ s/\//:/;
($nodeA,$portA) = split(":", $nodeportA);
if (defined($nodeportA)) {
$nodeportA =~ s/\//:/;
($nodeA,$portA) = split(":", $nodeportA);
}
$switchportA =~ s/\//:/;
my ($switchA, $swportA) = split(":", $switchportA);
my $isswitch = 1;
if (defined($switchportA)) {
$switchportA =~ s/\//:/;
my ($switchA, $swportA) = split(":", $switchportA);
my $noderef = Node->Lookup($switchA);
$isswitch = $noderef->isswitch();
}
#
# If the link is direct and switchA is not a switch, this is
......@@ -4105,9 +4114,7 @@ sub ReadTextSolution($$)
#
# $rawA hold both sides of the link (switchportA is really
# $nodeportB).
my $noderef = Node->Lookup($switchA);
if ($direct && ! $noderef->isswitch()) {
if ($direct && ! $isswitch) {
$nodeportB = $switchportA;
$switchportB = undef;
}
......@@ -4115,13 +4122,18 @@ sub ReadTextSolution($$)
($nodeportB,$switchportB) = getnodeport($rawB);
}
if (! defined($nodeportA)) {
tberror("Malformed interface pair B: $rawB\n");
return -1;
# TODO: Add this error checking code in once ptopgen_new
# become standard
# if (! defined($nodeportA)) {
# tberror("Malformed interface pair B: $rawB\n");
# return -1;
# }
if (defined($nodeportB)) {
# Convert back to node:iface format.
$nodeportB =~ s/\//:/;
($nodeB,$portB) = split(":", $nodeportB);
}
# Convert back to node:iface format.
$nodeportB =~ s/\//:/;
($nodeB,$portB) = split(":", $nodeportB);
}
$self->AddLinkToSolution($vlink, $trivial, $direct,
$nodeA, $portA, $nodeB, $portB, $swpath);
......@@ -8155,6 +8167,11 @@ sub getnodeport($)
my $macstring=$_[0];
my ($A,$B) = ($macstring =~ /^\(([^,]+),([^,]+)\)$/);
$A = undef
if ($A eq "(null)");
$B = undef
if ($B eq "(null)");
return ($A, $B);
}
......
......@@ -49,10 +49,11 @@ sub usage ()
print STDERR " -p - Do a precheck for mapability on an empty testbed - ".
"implies -n\n";
print STDERR " -l - Use rspec v2 instead of the text file format\n";
print STDERR " -z - Randomize node order printed by ptopgen\n";
print STDERR " -z - Force new ptopgen\n";
print STDERR " -Z - Force old ptopgen\n";
exit($WRAPPER_FAILED);
}
my $optlist = "dvunfprqczxm:ko:altz";
my $optlist = "dvunfprqczxm:ko:altzZ";
my $verbose = 0;
my $debug = 0;
my $fixmode = 0;
......@@ -74,7 +75,7 @@ my $warnings = 0;
my $maxrun = 3; # Maximum number of times we run assign.
my $gotlock = 0;
my $userspec = 0;
my $randomize = 0;
my $use_old_ptopgen = 0;
my $vtop;
#
......@@ -86,6 +87,7 @@ my $TBOPS = "@TBOPSEMAIL@";
my $ASSIGN = "$TB/libexec/assign";
my $WRAPPER2 = "$TB/libexec/assign_wrapper2";
my $PTOPGEN = "$TB/libexec/ptopgen";
my $PTOPGEN_NEW = "$TB/libexec/ptopgen_new";
my $VTOPGEN = "$TB/bin/vtopgen";
my $NFREE = "$TB/bin/nfree";
my $XERCES = "@HAVE_XERCES@";
......@@ -201,8 +203,12 @@ if (defined($options{"l"})) {
fatal("Rspec v2 support requires that Xerces be installed");
}
}
if (defined($options{"Z"})) {
$use_old_ptopgen = 1;
}
if (defined($options{"z"})) {
$randomize = 1;
$use_old_ptopgen = 0;
$PTOPGEN = $PTOPGEN_NEW;
}
my $pid = $ARGV[0];
......@@ -567,8 +573,8 @@ sub RunAssign($$)
if ($userspec == 1) {
$ptopargs .= "-x -g 2 ";
}
if ($randomize == 1) {
$ptopargs .= "-z ";
if ($use_old_ptopgen == 1) {
$ptopargs .= "-Z ";
}
$ptopargs .= "-l $typelimitfile"
if (scalar(keys(%admission_control)));
......
......@@ -392,12 +392,13 @@ sub usage()
" -x Output into the new xml ptop format\n".
" -g version With -x, geni version. Must be '0', '0.1' or '2'\n".
" -l specifies the location of the type limit file\n" .
" -1 Print an rspec containing only the node component-name" .
" -z Randomize node output order");
" -1 Print an rspec containing only the node component-name\n" .
" -z Randomize node output order\n" .
" -Z Force old ptopgen\n");
exit(-1);
}
my $optlist = "s:e:m:vp:rSan:c:uxg:h1:l:z";
my $optlist = "s:e:m:vp:rSan:c:uxg:h1:l:zZ";
my $mfactor;
my $virtstuff = 0;
my $widearea = 0;
......@@ -572,7 +573,7 @@ usage()
&& $genimode ne $V_0_2
&& $genimode ne $V_2));
if (defined($pid)) {
if (defined($pid) && ! defined($options{"Z"})) {
my $group = Group->Lookup($pid, $pid);
if (defined($group)) {
my $newptopgen = EmulabFeatures->FeatureEnabled("NewPtopgen", undef,
......
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