Commit 6b331bfb authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

A few little changes to help with regression mode in the

wrapper/mapper, so that DB tables are ordered in a consistent manner,
and can be easily compared with just diff.

Also some actual fixes to the mapper, as a result of regression mode
comparisons with the wrapper.
parent ecd22e9d
...@@ -1836,7 +1836,7 @@ $delayid = 0; ...@@ -1836,7 +1836,7 @@ $delayid = 0;
printdb "Interpreting results.\n"; printdb "Interpreting results.\n";
TBDebugTimeStamp("interpreting started"); TBDebugTimeStamp("interpreting started");
foreach $plink (keys(%plinks)) { foreach $plink (sort(keys(%plinks))) {
# trivial links do not have physical links, so no delay nodes. But, # trivial links do not have physical links, so no delay nodes. But,
# we *do* use trivial links for intranode links, and thus there could # we *do* use trivial links for intranode links, and thus there could
# be link delays (ie: two jailed nodes on a link/lan assigned to the # be link delays (ie: two jailed nodes on a link/lan assigned to the
...@@ -2307,7 +2307,7 @@ exit(0) ...@@ -2307,7 +2307,7 @@ exit(0)
# #
# Enter delays. # Enter delays.
# #
foreach $delayid (keys(%nodedelays)) { foreach $delayid (sort {$a <=> $b} keys(%nodedelays)) {
# So r* indicates int1->int0 and others are int0->int1 # So r* indicates int1->int0 and others are int0->int1
my ($pnode,$int0,$int1,$vname, my ($pnode,$int0,$int1,$vname,
$member0,$delay,$bandwidth,$backfill,$lossrate, $member0,$delay,$bandwidth,$backfill,$lossrate,
...@@ -2434,7 +2434,7 @@ foreach $delayid (keys(%nodedelays)) { ...@@ -2434,7 +2434,7 @@ foreach $delayid (keys(%nodedelays)) {
# switch, and one for traffic from the switch. Like above, there are also # switch, and one for traffic from the switch. Like above, there are also
# queues associated with output side (to the switch) of a link. # queues associated with output side (to the switch) of a link.
# #
foreach $delayid (keys(%linkdelays)) { foreach $delayid (sort {$a <=> $b} keys(%linkdelays)) {
# backfill unsupported for linkdelays so ignore its entry in linkdelays # backfill unsupported for linkdelays so ignore its entry in linkdelays
my ($pnode,$iface,$lan,$member, my ($pnode,$iface,$lan,$member,
$delay,$bandwidth,undef,$lossrate, $delay,$bandwidth,undef,$lossrate,
...@@ -3152,6 +3152,10 @@ sub InitPnode($$) ...@@ -3152,6 +3152,10 @@ sub InitPnode($$)
if (defined($inner_elab_role)); if (defined($inner_elab_role));
push(@sets, "plab_role='$plab_role'") push(@sets, "plab_role='$plab_role'")
if (defined($plab_role)); if (defined($plab_role));
# Do this in regression mode to avoid timestamp diffs
if ($regression) {
push(@sets, "rsrv_time=0");
}
if (@sets) { if (@sets) {
my $setstr = join(",", @sets); my $setstr = join(",", @sets);
...@@ -3167,6 +3171,13 @@ sub InitPnode($$) ...@@ -3167,6 +3171,13 @@ sub InitPnode($$)
system("os_select $osid $pnode") == 0 or system("os_select $osid $pnode") == 0 or
fatal(" os_select $osid $pnode failed!\n"); fatal(" os_select $osid $pnode failed!\n");
} }
# Clear this after os_select.
if ($regression) {
DBQueryFatal("update nodes set state_timestamp=0, ".
" op_mode_timestamp=0,allocstate_timestamp=0 ".
"where node_id='$pnode'");
}
return 0; return 0;
} }
...@@ -3343,7 +3354,7 @@ sub UploadVlans() ...@@ -3343,7 +3354,7 @@ sub UploadVlans()
printdb "Uploading vlans table.\n"; printdb "Uploading vlans table.\n";
ProtoLan->DumpAll() ProtoLan->DumpAll()
if ($verbose); if ($verbose);
ProtoLan->InstantiateAll() == 0 ProtoLan->InstantiateAll($regression) == 0
or fatal("Could not instantiate protolans!"); or fatal("Could not instantiate protolans!");
# Once the lans are instantiated we have to go back and update the # Once the lans are instantiated we have to go back and update the
...@@ -5089,7 +5100,7 @@ sub CreateTopFile() ...@@ -5089,7 +5100,7 @@ sub CreateTopFile()
join(" ",@{$delaylinks{$plink}}) . "\n"; join(" ",@{$delaylinks{$plink}}) . "\n";
} }
else { else {
my $delayname = "tbsdelay" . $delayid++; my $delayname = "tbdelay" . $delayid++;
my $plink = "linksdelaysrc/$lan/$nodeport0,$nodeport1"; my $plink = "linksdelaysrc/$lan/$nodeport0,$nodeport1";
$delaylinks{$plink} = [$nodeport0,$delay,$bw,$backfill,$loss, $delaylinks{$plink} = [$nodeport0,$delay,$bw,$backfill,$loss,
......
...@@ -160,7 +160,7 @@ sub regression($) { return $_[0]->flags() & $VTOP_FLAGS_REGRESSION; } ...@@ -160,7 +160,7 @@ sub regression($) { return $_[0]->flags() & $VTOP_FLAGS_REGRESSION; }
sub printdb($$) { print $_[1] if ($_[0]->verbose()); } sub printdb($$) { print $_[1] if ($_[0]->verbose()); }
# We name delay nodes internally as they are needed. # We name delay nodes internally as they are needed.
sub nextdelayname($) { return "tbsdelay" . $_[0]->{'DELAYID'}++; } sub nextdelayname($) { return "tbdelay" . $_[0]->{'DELAYID'}++; }
# For when the user wants a specific delay os. Use a desire. # For when the user wants a specific delay os. Use a desire.
sub delay_desire($) { return $_[0]->option("delay_desire_string"); } sub delay_desire($) { return $_[0]->option("delay_desire_string"); }
# For XML # For XML
...@@ -172,10 +172,14 @@ sub virttypeisvtype($$) { return $_[0]->virt_vtypes()->Find($_[1]); } ...@@ -172,10 +172,14 @@ sub virttypeisvtype($$) { return $_[0]->virt_vtypes()->Find($_[1]); }
sub VirtTypes($) { return $_[0]->virt_vtypes()->Rows(); } sub VirtTypes($) { return $_[0]->virt_vtypes()->Rows(); }
# Results are stored until they are spit out in one of several formats. # Results are stored until they are spit out in one of several formats.
sub addnode($$) { push(@{$_[0]->results()->{"nodes"}}, $_[1]); }
sub addlink($$) { push(@{$_[0]->results()->{"links"}}, $_[1]); }
sub addvclass($$) { push(@{$_[0]->results()->{"class"}}, $_[1]); } sub addvclass($$) { push(@{$_[0]->results()->{"class"}}, $_[1]); }
sub addfixed($$) { push(@{$_[0]->results()->{"fixed"}}, $_[1]); } sub addfixed($$) { push(@{$_[0]->results()->{"fixed"}}, $_[1]); }
# The reason for this funkyness is so output order is consistent with
# assign_wrapper when running in regression mode.
sub addnode($$) { push(@{$_[0]->results()->{"nodeslinks"}},
["node", $_[1]]); }
sub addlink($$) { push(@{$_[0]->results()->{"nodeslinks"}},
["link", $_[1]]); }
# Caller will want these. # Caller will want these.
sub minimum_nodes($) { return $_[0]->counter("minimum_nodes"); } sub minimum_nodes($) { return $_[0]->counter("minimum_nodes"); }
...@@ -2010,11 +2014,14 @@ sub PrintTop($;$) ...@@ -2010,11 +2014,14 @@ sub PrintTop($;$)
foreach my $vclass (@{$self->results->{'class'}}) { foreach my $vclass (@{$self->results->{'class'}}) {
print $output "make-vclass $vclass\n"; print $output "make-vclass $vclass\n";
} }
foreach my $node (@{$self->results->{'nodes'}}) { foreach my $ref (@{$self->results->{'nodeslinks'}}) {
print $output "node $node\n"; my ($which, $what) = @{ $ref };
} if ($which eq "node") {
foreach my $link (@{$self->results->{'links'}}) { print $output "node $what\n";
print $output "link $link\n"; }
else {
print $output "link $what\n";
}
} }
foreach my $fixed (@{$self->results->{'fixed'}}) { foreach my $fixed (@{$self->results->{'fixed'}}) {
print $output "fix-node $fixed\n"; print $output "fix-node $fixed\n";
...@@ -2954,7 +2961,7 @@ sub AllocNodes($) ...@@ -2954,7 +2961,7 @@ sub AllocNodes($)
# Node might need the link delay kernel. # Node might need the link delay kernel.
$pnode->_needslinkdelay(0); $pnode->_needslinkdelay(0);
# ipfw pipe numbers. # ipfw pipe numbers.
$pnode->_pipenumber(100); $pnode->_pipenumber(110);
# Routing table id for each vnode on a pnode # Routing table id for each vnode on a pnode
$pnode->_rtabid(0); $pnode->_rtabid(0);
# For assigning dynamic ports. # For assigning dynamic ports.
...@@ -3316,7 +3323,7 @@ sub InterpLinks($) ...@@ -3316,7 +3323,7 @@ sub InterpLinks($)
my %plinks = %{ $self->solution_plinks() }; my %plinks = %{ $self->solution_plinks() };
foreach my $plink (keys(%plinks)) { foreach my $plink (sort(keys(%plinks))) {
my ($linktag,$virtlan,$trivial,$member0,$member1) = @{$plinks{$plink}}; my ($linktag,$virtlan,$trivial,$member0,$member1) = @{$plinks{$plink}};
my $lan = $virtlan->vname(); my $lan = $virtlan->vname();
...@@ -3408,7 +3415,7 @@ sub InterpLinks($) ...@@ -3408,7 +3415,7 @@ sub InterpLinks($)
# The delay node port/links # The delay node port/links
my $nodeB = $member0->_delaynode(); my $nodeB = $member0->_delaynode();
my $portB = $member0->_delayport(); my $portB = $member0->_delayport();
my $nodeD = $member0->_delaynodeB(); my $nodeD = $nodeB;
my $portD = $member0->_delayportB(); my $portD = $member0->_delayportB();
$self->printdb("LAN delay: $virtA - ". $self->printdb("LAN delay: $virtA - ".
...@@ -3447,7 +3454,7 @@ sub InterpLinks($) ...@@ -3447,7 +3454,7 @@ sub InterpLinks($)
$protolanlink->AddMember($nodeA, $portA); $protolanlink->AddMember($nodeA, $portA);
$protolanlink->AddMember($nodeB, $portB); $protolanlink->AddMember($nodeB, $portB);
$self->AddDelay($virtlan, $member0, $member1, $self->AddDelay($virtlan, $member0, $member0,
$nodeB,$portB,$portD,1, $nodeB,$portB,$portD,1,
$self->delaylinks()->{$plink}); $self->delaylinks()->{$plink});
...@@ -3923,7 +3930,7 @@ sub InitializePhysNode($$$) ...@@ -3923,7 +3930,7 @@ sub InitializePhysNode($$$)
"startstatus" => 0, "startstatus" => 0,
"bootstatus" => 'unknown', "bootstatus" => 'unknown',
"ready" => 0, "ready" => 0,
"routertype" => TBDB_ROUTERTYPE_STATIC()); "routertype" => $routertype);
%rsrvsets = ("vname" => $vname, %rsrvsets = ("vname" => $vname,
"erole" => $role); "erole" => $role);
...@@ -3945,7 +3952,7 @@ sub InitializePhysNode($$$) ...@@ -3945,7 +3952,7 @@ sub InitializePhysNode($$$)
if (!defined($cmdline) || $cmdline eq "") { if (!defined($cmdline) || $cmdline eq "") {
# If the user has not overridden the command line, try to # If the user has not overridden the command line, try to
# find a default for this OSID. Only test real physical node. # find a default for this OSID. Only test real physical node.
if (!defined($vpnode) && $pnode->_needslinkdelay()) { if ($pnode->_needslinkdelay()) {
$cmdline = $self->osidbootcmd($osid, "linkdelay", ""); $cmdline = $self->osidbootcmd($osid, "linkdelay", "");
} }
elsif (defined($inner_elab_role) && elsif (defined($inner_elab_role) &&
...@@ -3968,11 +3975,16 @@ sub InitializePhysNode($$$) ...@@ -3968,11 +3975,16 @@ sub InitializePhysNode($$$)
%rsrvsets = ("vname" => $vnodename, %rsrvsets = ("vname" => $vnodename,
"erole" => $role, "erole" => $role,
"inner_elab_role" => $inner_elab_role || "",
"plab_role" => $plab_role); "plab_role" => $plab_role);
$rsrvsets{"inner_elab_role"} = $inner_elab_role
if (defined($inner_elab_role));
} }
$self->printdb("InitPnode: $pnodename $vnodename\n"); $self->printdb("InitPnode: $pnodename $vnodename\n");
# Do this in regression mode to avoid timestamp diffs
if ($self->regression()) {
$rsrvsets{"rsrv_time"} = 0;
}
my $setstr = join(",", map("$_='" . $nodesets{$_} . "'", keys(%nodesets))); my $setstr = join(",", map("$_='" . $nodesets{$_} . "'", keys(%nodesets)));
$self->printdb(" $setstr\n"); $self->printdb(" $setstr\n");
...@@ -3980,6 +3992,7 @@ sub InitializePhysNode($$$) ...@@ -3980,6 +3992,7 @@ sub InitializePhysNode($$$)
or return -1 if (!$self->impotent()); or return -1 if (!$self->impotent());
$setstr = join(",", map("$_='" . $rsrvsets{$_} . "'", keys(%rsrvsets))); $setstr = join(",", map("$_='" . $rsrvsets{$_} . "'", keys(%rsrvsets)));
$self->printdb(" $setstr\n"); $self->printdb(" $setstr\n");
DBQueryWarn("update reserved set $setstr where node_id='$pnodename'") DBQueryWarn("update reserved set $setstr where node_id='$pnodename'")
...@@ -3994,6 +4007,12 @@ sub InitializePhysNode($$$) ...@@ -3994,6 +4007,12 @@ sub InitializePhysNode($$$)
system("$OS_SELECT $osid $pnodename") == 0 system("$OS_SELECT $osid $pnodename") == 0
or return -1 if (!$self->impotent()); or return -1 if (!$self->impotent());
} }
# Clear this after os_select.
if ($self->regression()) {
DBQueryFatal("update nodes set state_timestamp=0, ".
" op_mode_timestamp=0,allocstate_timestamp=0 ".
"where node_id='$pnodename'");
}
return 0; return 0;
} }
...@@ -4236,7 +4255,7 @@ sub AddDelay($$$$$$$$$) ...@@ -4236,7 +4255,7 @@ sub AddDelay($$$$$$$$$)
# ipfw pipe numbers so we can control it remotely. # ipfw pipe numbers so we can control it remotely.
my $pipe0 = $pnode->_pipenumber(); my $pipe0 = $pnode->_pipenumber();
my $pipe1 = $pipe0 + 10; my $pipe1 = $pipe0 + 10;
$pnode->_pipenumber($pipe0 + 10); $pnode->_pipenumber($pipe1 + 10);
$self->printdb(" Delay: \[$iface0:$pnodename:$iface1 pipes:$pipe0+$pipe1,". $self->printdb(" Delay: \[$iface0:$pnodename:$iface1 pipes:$pipe0+$pipe1,".
"$delay,$bandwidth,$backfill,$lossrate,". "$delay,$bandwidth,$backfill,$lossrate,".
...@@ -4596,7 +4615,7 @@ sub UploadVlans($) ...@@ -4596,7 +4615,7 @@ sub UploadVlans($)
$self->printdb("Uploading vlans table.\n"); $self->printdb("Uploading vlans table.\n");
ProtoLan->DumpAll() ProtoLan->DumpAll()
if ($self->verbose()); if ($self->verbose());
if (ProtoLan->InstantiateAll() != 0) { if (ProtoLan->InstantiateAll($self->regression()) != 0) {
tberror("Could not instantiate protolans!\n"); tberror("Could not instantiate protolans!\n");
return -1; return -1;
} }
......
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