RapidCity.pm : subroutine i_vlan_type is missing
Hello again, I noticed that every MIB Perl Module from SNMP::Info have common subroutines names so that App::Netdisco::Worker::Plugin::Discover::VLANs can call the same function name for any Vendor. RapidCity is missing this specific function making the aforementioned module unable to assign a value to my $i_vlan_type when the vendor is avaya/nortel. The simple fix would be to add this subroutine in SNMP::Info following what you did for the subroutine i_vlan:
sub i_vlan_type {
my $rapidcity = shift;
my $partial = shift;
my $i_vlan_type = $rapidcity->rc_i_vlan_type($partial) || {};
return $i_vlan_type;
}
Again, I would like to thank you for your big work on Netdisco and everything that's around it. It's a really handy opensource project.
Cheers.
i_vlan_type() is not a "default" function, the functions defined in base snmp::info are expected to be globally available and behave in the same way
i_vlan_type() comes from cisco vtp, sometimes those will be used in netdisco like here. and this can lead to such a function spreading to other modules. i know i've done it the first few years :)
so providing the function: easy - figuring out what netdisco expects and how to match that a bit less so.
in this specific case the ciscovtp version is defined as:
vmVlanType OBJECT-TYPE
SYNTAX INTEGER {
static(1),
dynamic(2),
multiVlan(3)
}
MAX-ACCESS read-write
STATUS current
DESCRIPTION
"The type of VLAN membership assigned to this port.
A port with static vlan membership is assigned to a
single VLAN directly. A port with dynamic membership
is assigned a single VLAN based on content of packets
received on the port and via VQP queries to VMPS.
A port with multiVlan membership may be assigned to
one or more VLANs directly.
A static or dynamic port membership is specified
by the value of vmVlan. A multiVlan port membership is
specified by the value of vmVlans."
::= { vmMembershipEntry 1 }
rapidcity:
rcVlanPortType OBJECT-TYPE
SYNTAX INTEGER {
access(1), -- access port type
trunk(2) -- trunk port type
}
MAX-ACCESS read-write
STATUS current
DESCRIPTION "The type of port: access(1) or trunk(2)."
DEFVAL { access }
::= { rcVlanPortEntry 4 }
if a sensible mapping can be made between rapidcity & ciscovtp it should be not that hard, with vendors as big as cisco and nortel it's often a case of not assuming but spitting through the documentation to verify. when i see something like isl (interswitch link) or trunk it's easy to assume they can be interchanged, but they have plenty of differences is snmp.
if you want to go through the mibs & figure out the mapping the rest should be easy. so if you feel like having a closer look...
Hi again, Sorry for keeping you waiting, I was away for some time. Yeah you are right, that would not be the right solution. Originally, I opened this issue because I wrote a plugin to display the Tagging more of one port, but if the Switch was not a Cisco switch, the tagging mode of a port would be undef, as the corresponding function would not exist (see lib/App/Netdisco/Worker/Plugin/Discover/VLANs.pm ).
Another solution would be to still create said function but with another name and check the vendor of the device in [lib/App/Netdisco/Worker/Plugin/Discover/VLANs.pm] and call the correct function. If this is of interest to you, I can open a PR if you want.
Anyway, thanks for your time.
Cheers !