Commit 2466a91d authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Fixes.

parent cc6ec6ea
...@@ -188,7 +188,8 @@ sub getPathVlanIfaces($$) { ...@@ -188,7 +188,8 @@ sub getPathVlanIfaces($$) {
my $vlanid = shift; my $vlanid = shift;
my $ifaces = shift; my $ifaces = shift;
my $vlan = VLan->Lookup($vlanid); my $vlan = VLan->Lookup($vlanid);
my $vname = $vlan->vname();
my $experiment = $vlan->GetExperiment(); my $experiment = $vlan->GetExperiment();
my $pid = $experiment->pid(); my $pid = $experiment->pid();
my $eid = $experiment->eid(); my $eid = $experiment->eid();
...@@ -198,18 +199,20 @@ sub getPathVlanIfaces($$) { ...@@ -198,18 +199,20 @@ sub getPathVlanIfaces($$) {
# find the underline path of the link # find the underline path of the link
my $query_result = my $query_result =
DBQueryWarn("select distinct implemented_by_path from ". DBQueryWarn("select distinct implemented_by_path from ".
"virt_lans where pid='$pid' and eid='$eid' and vname='". "virt_lans where pid='$pid' and eid='$eid' ".
$vlan->vname()."';"); " and vname='$vname'");
if (!$query_result || !$query_result->numrows) { if (!$query_result || !$query_result->numrows) {
warn "Can't find VLAN $vlanid definition in DB."; # Not an error since encapsulation vlans have generated names.
return -1; %$ifaces = %ifacesonswitchnode;
return 1;
} }
# default implemented_by is empty # default implemented_by is empty
my ($path) = $query_result->fetchrow_array(); my ($path) = $query_result->fetchrow_array();
if (!$path || $path eq "") { if (!defined($path) || $path eq "") {
print "VLAN $vlanid is not implemented by a path\n" if $debug; # Also not an error.
return -1; %$ifaces = %ifacesonswitchnode;
return 1;
} }
# find the segments of the path # find the segments of the path
...@@ -305,7 +308,12 @@ sub getVlanPorts (@) { ...@@ -305,7 +308,12 @@ sub getVlanPorts (@) {
" Unable to load members for $vlan\n"); " Unable to load members for $vlan\n");
} }
my %pathifaces = (); my %pathifaces = ();
if (!getPathVlanIfaces($vlanid, \%pathifaces)) { my $error = getPathVlanIfaces($vlanid, \%pathifaces);
if ($error < 0) {
die("*** $0:\n".
" Error getting path interfaces for $vlan\n");
}
if ($error == 0) {
foreach my $k (keys %pathifaces) { foreach my $k (keys %pathifaces) {
push(@ports, Port->LookupByIface($pathifaces{$k})); push(@ports, Port->LookupByIface($pathifaces{$k}));
} }
...@@ -314,7 +322,7 @@ sub getVlanPorts (@) { ...@@ -314,7 +322,7 @@ sub getVlanPorts (@) {
foreach my $member (@members) { foreach my $member (@members) {
my $nodeid; my $nodeid;
my $iface; my $iface;
if ($member->GetAttribute("node_id", \$nodeid) != 0 || if ($member->GetAttribute("node_id", \$nodeid) != 0 ||
$member->GetAttribute("iface", \$iface) != 0) { $member->GetAttribute("iface", \$iface) != 0) {
die("*** $0:\n". die("*** $0:\n".
......
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