Commit 8e1064ae authored by David Johnson's avatar David Johnson

Bug Fix: make port lookup distinguish logical/physical wires.

The stuff in db/ (Port::LookupByIface) wasn't handling the MLE
case where there are two wires table entries for physical wires with a
logical wire implemented by them; for my experiment, when snmpit was
trying to create the physical vlans on the apcon, it would grab the
logical wire instead of the physical one as it populated the Port
objects, and that screwed vlan creation up (the member port for the
physical layer 1 vlan gets labeled with a switch WIRE_END instead of
node -- which is correct for the logical wire, but not the physical).
So, I changed the query to check that wires.logical ==
interfaces.logical ; see the code.  This is a limited fix, maybe --
maybe that method should really do more verification to make sure it's
grabbed the correct wires table entry -- but since we only have 2 layers
it's plenty good for now.
parent 5a80bddf
......@@ -484,6 +484,7 @@ sub LookupByIface($$;$)
my $card = $rowref->{'card'};
my $port = $rowref->{'port'};
my $logical = $rowref->{'logical'};
my $inst = {};
$inst->{"INTERFACES_ROW"} = $rowref;
......@@ -491,7 +492,7 @@ sub LookupByIface($$;$)
# wire mapping
$query_result =
DBQueryWarn("select * from wires ".
"where (node_id1='$nodeid' AND card1='$card' AND port1='$port') OR (node_id2='$nodeid' AND card2='$card' AND port2='$port')");
"where (node_id1='$nodeid' AND card1='$card' AND port1='$port' and logical='$logical') OR (node_id2='$nodeid' AND card2='$card' AND port2='$port' and logical='$logical')");
return undef
if (!$query_result or !$query_result->numrows);
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