From ce4349a188bc2e2340f21c90fcba1aa6a179c9d6 Mon Sep 17 00:00:00 2001 From: Jeroen van Ingen Date: Tue, 2 Jun 2015 18:03:43 +0200 Subject: [PATCH] Try to determine whether a device in generic Layer3::Cisco class needs community based indexing Layer3 capable Cisco device without a mapping to a more specific class fall under the Layer3::Cisco class. These can be "real" routers that don't need community based indexing, or Layer 3 switches that do need community based indexing (to fetch L2 forwarding tables for different VLANs). Generally, if community based indexing is needed on a platform, it also supports the CISCO-VTP-MIB. Dynamically return cisco_comm_indexing based on vtpVersion. --- ChangeLog | 2 ++ Info/Layer3/Cisco.pm | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/ChangeLog b/ChangeLog index c03488f9..2b5a0348 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,8 @@ version 3.28 (TBD) [ENHANCEMENTS] * Add Layer3::Huawei class for Huawei Quidway switches + * Modified generic Layer3::Cisco class: use community based indexing if + the device returns a value for vtpVersion version 3.27 (2015-05-05) diff --git a/Info/Layer3/Cisco.pm b/Info/Layer3/Cisco.pm index 2e4cfe95..8446f5b7 100644 --- a/Info/Layer3/Cisco.pm +++ b/Info/Layer3/Cisco.pm @@ -136,6 +136,13 @@ sub i_vlan { return $i_vlan; } +sub cisco_comm_indexing { + my $cisco = shift; + # If we get a VTP version, it's *extremely* likely that the device needs community based indexing + my $vtp = $cisco->vtp_version() || '0'; + return ($vtp ne '0'); +} + 1; __END__ @@ -237,6 +244,11 @@ These are methods that return scalar value from SNMP (C) +=item $switch->cisco_comm_indexing() + +Returns 1 when the device is likely to need vlan indexing. +Determined by checking C. + =back =head2 Global Methods imported from SNMP::Info::CiscoVTP