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

Bug Fix: don't add undefined ports to list returned by getVlanPorts().

Handles the case where a wire in the wires table has an 'Unused' role
(which is how logical wires begin life -- then once their underlying
physical links are built into vlans, snmpit changes their wires.role
changes to 'Node').  This change ensures undef ports (which is what is
returned for wires entries with 'Unused' roles) don't make it into the
getVlanPorts list, where they cause snmpit to die, of course.
parent 8e1064ae
......@@ -360,13 +360,21 @@ sub getVlanPorts (@) {
foreach my $member (@members) {
my $nodeid;
my $iface;
my $port;
if ($member->GetAttribute("node_id", \$nodeid) != 0 ||
$member->GetAttribute("iface", \$iface) != 0) {
die("*** $0:\n".
" Missing attributes for $member in $vlan\n");
push(@ports, Port->LookupByIface($nodeid, $iface));
$port = Port->LookupByIface($nodeid, $iface);
# Ports can be undef -- i.e., if this is a layer 2 path implemented
# by layer 1 wires, it hasn't been given a type yet.
if (defined($port)) {
push(@ports, $port);
return @ports;
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