Commit af1130cb authored by Leigh B. Stoller's avatar Leigh B. Stoller

Minor bug fixes for topomaps with no links.

parent 7bc9596e
......@@ -221,12 +221,21 @@ sub fromtopo($)
return -1;
}
# Special case of experiment with no lans; no hostfile stuff needed.
if (! scalar(@{ $topomap->{"lans"} })) {
@$rptr = ();
return 0;
}
# The nodes section tells us the name of each node, and all its links.
foreach my $noderef (@{ $topomap->{"nodes"} }) {
my $vname = $noderef->{"vname"};
my $links = $noderef->{"links"};
my $count = 0;
next
if (!defined($links));
$nodes{$vname} = [];
# Links is a string of "$lan1:$ip1 $lan2:$ip2 ..."
......
......@@ -361,6 +361,12 @@ sub ddijkstra ($)
return -1;
}
# Special case of experiment with no lans; no routes needed.
if (! scalar(@{ $topomap->{"lans"} })) {
@$rptr = ();
return 0;
}
# Gather up all the link info from the topomap
my %lans = ();
......@@ -369,6 +375,9 @@ sub ddijkstra ($)
my $vname = $noderef->{"vname"};
my $links = $noderef->{"links"};
next
if (!defined($links));
# Links is a string of "$lan1:$ip1 $lan2:$ip2 ..."
foreach my $link (split(" ", $links)) {
my ($lan,$ip) = split(":", $link);
......
......@@ -629,8 +629,8 @@ sub gettopomap($)
my @values = split(",", $_);
my $rowref = {};
for (my $i = 0; $i < scalar(@values); $i++) {
$rowref->{$slots[$i]} = $values[$i];
for (my $i = 0; $i < scalar(@slots); $i++) {
$rowref->{$slots[$i]} = (defined($values[$i]) ? $values[$i] : undef);
}
push(@{ $topomap->{$section} }, $rowref);
}
......
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