Compare commits
	
		
			120 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					440bb002b6 | ||
| 
						 | 
					6dd3f4b21a | ||
| 
						 | 
					1278117b05 | ||
| 
						 | 
					5c6c75b42e | ||
| 
						 | 
					d78e5d6656 | ||
| 
						 | 
					094c2d548d | ||
| 
						 | 
					4913ac6cdd | ||
| 
						 | 
					ac9efcf8ba | ||
| 
						 | 
					6b4444d97a | ||
| 
						 | 
					607d5f04bd | ||
| 
						 | 
					b46aa416a0 | ||
| 
						 | 
					800aa0b4f0 | ||
| 
						 | 
					a0e0be2d68 | ||
| 
						 | 
					3fa47dc2e6 | ||
| 
						 | 
					25141d3c8e | ||
| 
						 | 
					1f02aeaec4 | ||
| 
						 | 
					5d4aada8f5 | ||
| 
						 | 
					3bd7f78277 | ||
| 
						 | 
					3994706465 | ||
| 
						 | 
					12bf18ac02 | ||
| 
						 | 
					5c6a8f3c45 | ||
| 
						 | 
					ddddb703aa | ||
| 
						 | 
					5ef4c78f8a | ||
| 
						 | 
					05a7f104a4 | ||
| 
						 | 
					da1183b4fa | ||
| 
						 | 
					a51ad7ee88 | ||
| 
						 | 
					df3e0e3b3a | ||
| 
						 | 
					c156584417 | ||
| 
						 | 
					74e649a033 | ||
| 
						 | 
					342a45a424 | ||
| 
						 | 
					7076c236ea | ||
| 
						 | 
					0d90383ea3 | ||
| 
						 | 
					fe59f88dd3 | ||
| 
						 | 
					2f4704b18d | ||
| 
						 | 
					c8c94bbd8b | ||
| 
						 | 
					054e27e827 | ||
| 
						 | 
					766f14d2bf | ||
| 
						 | 
					4e52756a41 | ||
| 
						 | 
					55fc398ddf | ||
| 
						 | 
					a5e8e6c7cd | ||
| 
						 | 
					bb8762835f | ||
| 
						 | 
					7c8b1a8853 | ||
| 
						 | 
					be8140a142 | ||
| 
						 | 
					f7c57860b7 | ||
| 
						 | 
					c44fc3ddbe | ||
| 
						 | 
					c2fd3bd3a4 | ||
| 
						 | 
					dfff2624ac | ||
| 
						 | 
					91c40fddb6 | ||
| 
						 | 
					cafeb36418 | ||
| 
						 | 
					fa56c7b332 | ||
| 
						 | 
					a52f1f3d37 | ||
| 
						 | 
					476053c539 | ||
| 
						 | 
					0530c5d9e9 | ||
| 
						 | 
					b982e95c42 | ||
| 
						 | 
					de286cbfa0 | ||
| 
						 | 
					a94c685c6d | ||
| 
						 | 
					58feb21dec | ||
| 
						 | 
					81f0b821e3 | ||
| 
						 | 
					ea8275677b | ||
| 
						 | 
					c0891ec8c0 | ||
| 
						 | 
					9dd38845a6 | ||
| 
						 | 
					0d8aa25e63 | ||
| 
						 | 
					f57c9333da | ||
| 
						 | 
					f060b67b4a | ||
| 
						 | 
					c59e13ac35 | ||
| 
						 | 
					a49d1522b0 | ||
| 
						 | 
					39e618f761 | ||
| 
						 | 
					3d812e0eae | ||
| 
						 | 
					4f1ac32865 | ||
| 
						 | 
					d176570b1d | ||
| 
						 | 
					393fb71b1a | ||
| 
						 | 
					bd1be7e258 | ||
| 
						 | 
					e296e93b23 | ||
| 
						 | 
					bd457307ff | ||
| 
						 | 
					f988cecc4d | ||
| 
						 | 
					d2f67b2db2 | ||
| 
						 | 
					c4a4c3d5e6 | ||
| 
						 | 
					fa38fdbc2b | ||
| 
						 | 
					2e03e3faca | ||
| 
						 | 
					e448915e0b | ||
| 
						 | 
					37836bedac | ||
| 
						 | 
					a60663b238 | ||
| 
						 | 
					5e879b6822 | ||
| 
						 | 
					c672b914db | ||
| 
						 | 
					f703bdc910 | ||
| 
						 | 
					0752a2403c | ||
| 
						 | 
					f0dc4c4b31 | ||
| 
						 | 
					7269476bad | ||
| 
						 | 
					42d56e62e1 | ||
| 
						 | 
					873fd257cd | ||
| 
						 | 
					43d01c5060 | ||
| 
						 | 
					1d45ab5522 | ||
| 
						 | 
					2674536a55 | ||
| 
						 | 
					cc13a0f850 | ||
| 
						 | 
					f9a97d7a3b | ||
| 
						 | 
					d5f1a1ae95 | ||
| 
						 | 
					466c0daec0 | ||
| 
						 | 
					e127beb2d7 | ||
| 
						 | 
					ff9cab9fe7 | ||
| 
						 | 
					6d9ce57032 | ||
| 
						 | 
					77d854f58f | ||
| 
						 | 
					9e2ac2d880 | ||
| 
						 | 
					4a52fccc20 | ||
| 
						 | 
					d7e524b4a3 | ||
| 
						 | 
					6da7d340a9 | ||
| 
						 | 
					e9fa153e45 | ||
| 
						 | 
					fa99cb39ae | ||
| 
						 | 
					622a35de01 | ||
| 
						 | 
					74c85cae9e | ||
| 
						 | 
					3eba4c6c79 | ||
| 
						 | 
					3f179aa21a | ||
| 
						 | 
					a6a8ed4c55 | ||
| 
						 | 
					d7b6fa2179 | ||
| 
						 | 
					69645321cd | ||
| 
						 | 
					f2754b80bb | ||
| 
						 | 
					1f1ba32c1b | ||
| 
						 | 
					39ed601300 | ||
| 
						 | 
					c2bbd03c2f | ||
| 
						 | 
					3c3c040471 | ||
| 
						 | 
					af51ee7ea4 | 
@@ -1,3 +1,8 @@
 | 
			
		||||
All code from version 0.7 on
 | 
			
		||||
Copyright (c) 2003,2004 Max Baker
 | 
			
		||||
All rights reserved.
 | 
			
		||||
 | 
			
		||||
Original Code
 | 
			
		||||
Copyright (c) 2002,2003 Regents of the University of California
 | 
			
		||||
All rights reserved.
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										63
									
								
								ChangeLog
									
									
									
									
									
								
							
							
						
						
									
										63
									
								
								ChangeLog
									
									
									
									
									
								
							@@ -1,17 +1,74 @@
 | 
			
		||||
SNMP::Info - Perl5 OO Interface to Network Devices and SNMP MIBs
 | 
			
		||||
SNMP::Info - Friendly OO-style interface to Network devices using SNMP.
 | 
			
		||||
ChangeLog $Id$
 | 
			
		||||
 | 
			
		||||
version 0.8 (03/21/04)
 | 
			
		||||
    + Added Q-BRIDGE-MIB support to SNMP::Info::Bridge
 | 
			
		||||
    + Added Aironet AP4800 to Layer3::Aironet class
 | 
			
		||||
    + Added C3500XL devices to the Layer2::C2900 class
 | 
			
		||||
    + Added Cisco 3750 (37xxstack) to Layer3::C6500 class
 | 
			
		||||
    + Added Cisco Catalyst 4000 to Layer3::C6500 class
 | 
			
		||||
    + Added Cisco Catalyst 2970 to Layer3::C6500 Class
 | 
			
		||||
    * Made Cisco Commuinty string indexing a boolean method for clarification
 | 
			
		||||
    * Added VLAN info for HP devices using Q-BRIDGE-MIB
 | 
			
		||||
    * Fixed warning about uninitialized value in CiscoStats line 92
 | 
			
		||||
    * Added for more serial# checking for L2 and L3
 | 
			
		||||
    * Fixed warning in Layer2::Bay about non numeric port line 199
 | 
			
		||||
    Contributions from Dmitry Sergienko:
 | 
			
		||||
    + Added Cisco Aironet BR500 and AP1200 to L2::Aironet Class
 | 
			
		||||
    * Fixed the Port name alias for Catalyst 2900 devices
 | 
			
		||||
    + Added Support For ZiLEX DSLAMs and Allied Telesys Switches
 | 
			
		||||
 | 
			
		||||
version 0.7 (08/14/03)
 | 
			
		||||
    * Added Class for Catalyst 6500 Series - Layer3::C6500
 | 
			
		||||
    * Added CiscoVTP support to 3550,2900, and Catalyst classes
 | 
			
		||||
    * Extracted VLAN stuff from Layer2::Catalyst to SNMP::Info::CiscoVTP
 | 
			
		||||
    * Extracted CISCO-STACK-MIB from Layer2::Catalyst to SNMP::Info::CiscoStack
 | 
			
		||||
    * Added 2950's to the Layer2::C2900 class
 | 
			
		||||
    * Added 3548's and 350x's to the Layer3::C3550 class
 | 
			
		||||
    * Broke out 3550's into separate device types (3550-24, 3550-48)
 | 
			
		||||
    * Added T1,dual T1, and T3 , ATM over OC-12 ... to the SPEED_MAP
 | 
			
		||||
    * Fixed speed map -- OC-1 -> OC-3
 | 
			
		||||
    * Fixed Bug where Catalyst Switch running IOS would report CatOS as os()
 | 
			
		||||
 | 
			
		||||
version 0.6 (06/18/03)
 | 
			
		||||
    * Minor Bug Fix.  SNMP::Info::Layer2::Bay and SNMP::Info::Layer2::C1900
 | 
			
		||||
      didn't return 1 and failed to load on some versions of Perl.
 | 
			
		||||
 | 
			
		||||
version 0.5 (06/10/03)
 | 
			
		||||
    * Added ability to get paritial tables.  For example to get the
 | 
			
		||||
      IP routing table for 128.114.*  you can do 
 | 
			
		||||
      $ipr = $dev->ipr_dest('128.114');
 | 
			
		||||
    * Added IP Routing Table entries from RFC1213 to SNMP::Info
 | 
			
		||||
    * minor bug fixes
 | 
			
		||||
 | 
			
		||||
version 0.4 (04/29/03)
 | 
			
		||||
    * BIG CHANGE ! Internal Data structure has changed.  
 | 
			
		||||
    * Added clear_cache() method
 | 
			
		||||
    * Added NO_SUCH support for snmpget (TABLE) calls to get SNMP MIB II data 
 | 
			
		||||
      from SNMP Version 1 devices.
 | 
			
		||||
    * Methods load_all() and all() have changed their return value. Sorry but the API had to change.
 | 
			
		||||
    * New object methods snmp_comm(), snmp_ver(), store(), class(), nosuch() to make it more OO happy.
 | 
			
		||||
    * Globals are now cached
 | 
			
		||||
    * Added new argument 'AutoSpecify' to new() to auto-connect with subclass 
 | 
			
		||||
      detected in device_type()
 | 
			
		||||
    * New method specify() returns a new subclass object
 | 
			
		||||
    * Subclasses are automatically loaded when specify or autospecify is used!
 | 
			
		||||
    * Added methods for Interface statistics (ifInOctets ...)
 | 
			
		||||
    * Added methods for Memory and CPU statistics 
 | 
			
		||||
    * Added SNMP::Info::Entity, moved out of L2-HP
 | 
			
		||||
    * Added SNMP::Info::Layer2::Aironet
 | 
			
		||||
 | 
			
		||||
version 0.3 (03/06/03)
 | 
			
		||||
    * Fixed HP model() warning
 | 
			
		||||
    * Added error checking for responses of NOSUCHOBJECT and NOSUCHINSTANCE in _global
 | 
			
		||||
      and _load_attr
 | 
			
		||||
    * Added more debugging
 | 
			
		||||
    * Added info and munging for c_capabilities in SNMP::Info::CD
 | 
			
		||||
      Thanks to Martin Lorensen <martin@lorensen.dk>
 | 
			
		||||
      Thanks to Martin Lorensen <martin /at- lorensen.dk>
 | 
			
		||||
    * Removed requirement for SNMP in the Makefile.PL and moved it to t/prereq.t
 | 
			
		||||
      so that the Module will install via CPAN without trying to install the old
 | 
			
		||||
      4.2.0 version of SNMP on CPAN.  Will now fail in the test phase. 
 | 
			
		||||
      Thanks again to Martin Lorensen <martin@lorensen.dk>
 | 
			
		||||
      Thanks again to Martin Lorensen <martin /at- lorensen.dk>
 | 
			
		||||
    * Moved tests from test.pl to t/*
 | 
			
		||||
 | 
			
		||||
version 0.2 (02/19/03)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										345
									
								
								DeviceMatrix.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										345
									
								
								DeviceMatrix.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,345 @@
 | 
			
		||||
# SNMP Device Compatibility Matrix
 | 
			
		||||
# SNMP::Info - (C) 2004 Max Baker
 | 
			
		||||
 | 
			
		||||
# This file is meant to detail the cababilities
 | 
			
		||||
# of network devices to supply data via SNMP.  
 | 
			
		||||
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
# Allied
 | 
			
		||||
device-vendor: Allied Telesyn
 | 
			
		||||
cdp:no
 | 
			
		||||
 | 
			
		||||
device-family: Allied Hubs
 | 
			
		||||
class: Layer1::Allied
 | 
			
		||||
ver: 1
 | 
			
		||||
arpnip: no
 | 
			
		||||
macsuck: no
 | 
			
		||||
duplex: no
 | 
			
		||||
 | 
			
		||||
device: AT-3624T
 | 
			
		||||
 | 
			
		||||
device-family: AT-8000 Switches
 | 
			
		||||
class: Layer2::Allied
 | 
			
		||||
ver: 2
 | 
			
		||||
macsuck: yes
 | 
			
		||||
 | 
			
		||||
# Asante
 | 
			
		||||
device-vendor: Asante
 | 
			
		||||
 | 
			
		||||
device-family: Asante Hubs
 | 
			
		||||
class: Layer1::Asante
 | 
			
		||||
ver: 1
 | 
			
		||||
arpnip: no
 | 
			
		||||
macsuck: no
 | 
			
		||||
duplex: no
 | 
			
		||||
 | 
			
		||||
device: 1012
 | 
			
		||||
 | 
			
		||||
# Bay
 | 
			
		||||
device-vendor: Bay Networks
 | 
			
		||||
class: Layer2::Bay
 | 
			
		||||
ver: 1
 | 
			
		||||
 | 
			
		||||
device-family: BayStack
 | 
			
		||||
macsuck: yes
 | 
			
		||||
cdp: proprietary
 | 
			
		||||
note: SNMP interface does not respond after 2+ months of uptime. Reboot to fix.
 | 
			
		||||
 | 
			
		||||
device: 303
 | 
			
		||||
device: 304
 | 
			
		||||
device: 450
 | 
			
		||||
note: Labels full duplex as 20Mbit connection.
 | 
			
		||||
 | 
			
		||||
# CISCO
 | 
			
		||||
device-vendor: Cisco
 | 
			
		||||
cdp: yes
 | 
			
		||||
ver: 2
 | 
			
		||||
note: Error in CISCO-TC-MIB. See README for how to patch.
 | 
			
		||||
 | 
			
		||||
device-family: Aironet
 | 
			
		||||
note: IOS and Aironet OS versions
 | 
			
		||||
class: Layer3::Aironet
 | 
			
		||||
 | 
			
		||||
device: AIRAP1100, AP1200, C1100
 | 
			
		||||
note: IOS based device
 | 
			
		||||
class: Layer2::Aironet
 | 
			
		||||
 | 
			
		||||
device: BR500
 | 
			
		||||
note: Aironet based device
 | 
			
		||||
 | 
			
		||||
device: AP350, AP340, CAP350, CAP340, 1200, AP4800
 | 
			
		||||
note: Aironet based device
 | 
			
		||||
 | 
			
		||||
device-family: 1000
 | 
			
		||||
duplex: no
 | 
			
		||||
ver: 1
 | 
			
		||||
class: Layer3
 | 
			
		||||
 | 
			
		||||
device: 1003
 | 
			
		||||
 | 
			
		||||
device-family: 1700
 | 
			
		||||
class: Layer3
 | 
			
		||||
 | 
			
		||||
device: 1710
 | 
			
		||||
duplex: link
 | 
			
		||||
 | 
			
		||||
device-family: 2500
 | 
			
		||||
duplex: no
 | 
			
		||||
macsuck: yes
 | 
			
		||||
arpnip: yes
 | 
			
		||||
ver: 1
 | 
			
		||||
class: Layer3
 | 
			
		||||
 | 
			
		||||
device: 2501
 | 
			
		||||
 | 
			
		||||
device: 2503
 | 
			
		||||
 | 
			
		||||
device: AS2509RJ
 | 
			
		||||
 | 
			
		||||
device: AS2511RJ
 | 
			
		||||
 | 
			
		||||
device: 2511
 | 
			
		||||
 | 
			
		||||
device: 2514
 | 
			
		||||
 | 
			
		||||
device-family: 2600
 | 
			
		||||
duplex: link
 | 
			
		||||
arpnip: yes
 | 
			
		||||
macsuck: yes
 | 
			
		||||
class: Layer3
 | 
			
		||||
 | 
			
		||||
device:2610,2610XM,2611,2620,2620XM,2621
 | 
			
		||||
 | 
			
		||||
device:2621XM
 | 
			
		||||
 | 
			
		||||
device:2651XM
 | 
			
		||||
 | 
			
		||||
device:2691
 | 
			
		||||
 | 
			
		||||
device-family: 3600
 | 
			
		||||
class: Layer3
 | 
			
		||||
 | 
			
		||||
device: 3620
 | 
			
		||||
 | 
			
		||||
device: 3640
 | 
			
		||||
duplex: no
 | 
			
		||||
 | 
			
		||||
device-family: 7500
 | 
			
		||||
class: Layer3
 | 
			
		||||
 | 
			
		||||
device: 7507
 | 
			
		||||
duplex: no
 | 
			
		||||
note: !Duplex settings are falsely reported in older IOS versions
 | 
			
		||||
 | 
			
		||||
device-family: AS5000
 | 
			
		||||
duplex: no
 | 
			
		||||
class: Layer3
 | 
			
		||||
 | 
			
		||||
device: AS5300
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Cisco - Catalyst
 | 
			
		||||
#
 | 
			
		||||
device-family: Catalyst 1900
 | 
			
		||||
note: !Upgrade older (pre 9.0) versions of CatOS
 | 
			
		||||
ver: 1
 | 
			
		||||
class: Layer2::C1900
 | 
			
		||||
 | 
			
		||||
device: wsc1900c
 | 
			
		||||
device-family: Catalyst 1900
 | 
			
		||||
 | 
			
		||||
device: wsc1900
 | 
			
		||||
device-family: Catalyst 1900
 | 
			
		||||
 | 
			
		||||
device-family: Catalyst 2900
 | 
			
		||||
note: IOS
 | 
			
		||||
macsuck: vlan
 | 
			
		||||
class: Layer3::C2900
 | 
			
		||||
portmac: yes
 | 
			
		||||
note: !Pre IOS 11.2 (8) SA3 - PortMAC shows up in CAM table.
 | 
			
		||||
 | 
			
		||||
device: 2908xl
 | 
			
		||||
note: !Pre IOS 11.2 (8.6) some features (duplex...) aren't present.
 | 
			
		||||
 | 
			
		||||
device: 2912MfXL
 | 
			
		||||
 | 
			
		||||
device: 2924MXL
 | 
			
		||||
ver: 1
 | 
			
		||||
portmac: yes
 | 
			
		||||
 | 
			
		||||
device: 2924CXL
 | 
			
		||||
 | 
			
		||||
device: 2924CXLv
 | 
			
		||||
 | 
			
		||||
device-family: Catlayst 2940
 | 
			
		||||
 | 
			
		||||
device: 2940-8TT
 | 
			
		||||
 | 
			
		||||
device-family: Catalyst 2950
 | 
			
		||||
 | 
			
		||||
device: 2950-t24
 | 
			
		||||
 | 
			
		||||
device-family: Catalyst 2970
 | 
			
		||||
macsuck:vlan
 | 
			
		||||
note: Acts just like IOS Catalyst 6500 series
 | 
			
		||||
class: Layer3::C6500
 | 
			
		||||
 | 
			
		||||
device: 2970G-24T-E
 | 
			
		||||
 | 
			
		||||
device-family: Catalyst 3500 XL
 | 
			
		||||
portmac: yes
 | 
			
		||||
macsuck: vlan
 | 
			
		||||
note: L2 only IOS devices - Just like Catalyst 2900 series from SNMP
 | 
			
		||||
note: IOS Version 12.0(5)XP is buggy and doesn't do VLAN Community indexing correctly.
 | 
			
		||||
class: Layer2::C2900
 | 
			
		||||
 | 
			
		||||
device: 3508GXL
 | 
			
		||||
 | 
			
		||||
device: 3524XL
 | 
			
		||||
 | 
			
		||||
device: 3548XL
 | 
			
		||||
 | 
			
		||||
device-family: Catalyst 3550
 | 
			
		||||
macsuck: vlan
 | 
			
		||||
duplex: both
 | 
			
		||||
class: Layer3::C3550
 | 
			
		||||
note: Run IOS
 | 
			
		||||
note: Has VLANs that don't accept SNMP connections.  Don't know if they are standard (by name or number).
 | 
			
		||||
note: Uses CISCO-STACK-MIB like Catalyst 5000 series for serial,duplex,type but not name
 | 
			
		||||
note: Comes in flavors that support L2, L3 or combo.
 | 
			
		||||
 | 
			
		||||
device: 3550-12T
 | 
			
		||||
 | 
			
		||||
device: 3550
 | 
			
		||||
note: L2/L3 Switch
 | 
			
		||||
arpnip: yes
 | 
			
		||||
 | 
			
		||||
device: 3550-24, 3550-48
 | 
			
		||||
macsuck: vlan
 | 
			
		||||
 | 
			
		||||
device-family: Catalyst 3750
 | 
			
		||||
class: Layer3::C6500
 | 
			
		||||
 | 
			
		||||
device-family: Catalyst 4000
 | 
			
		||||
duplex: both
 | 
			
		||||
macsuck: vlan
 | 
			
		||||
class: Layer3::C6500
 | 
			
		||||
note: Comes in IOS and CatOS versions like the 6k series.
 | 
			
		||||
note: CatOS versions like L2::Catalyst just fine.
 | 
			
		||||
note: !Reported problems with SNMP taking up all the CPU.  Requests take significantly longer.
 | 
			
		||||
 | 
			
		||||
device: wsc4006
 | 
			
		||||
 | 
			
		||||
device: 4507
 | 
			
		||||
note: !IOS device -- Test against C3550 and C6000 classes
 | 
			
		||||
class: Layer3
 | 
			
		||||
 | 
			
		||||
device: wsc4912g
 | 
			
		||||
note: Dedicated 12 port gig-e switch
 | 
			
		||||
 | 
			
		||||
device-family: Catalyst 5000
 | 
			
		||||
duplex: both
 | 
			
		||||
class: Layer2::Catalyst
 | 
			
		||||
note: Port info in CISCO-STACK-MIB
 | 
			
		||||
 | 
			
		||||
device: wsc2926
 | 
			
		||||
note: !Can give false information over SNMP at times.
 | 
			
		||||
 | 
			
		||||
device: wsc2948g
 | 
			
		||||
 | 
			
		||||
device: wsc2980g
 | 
			
		||||
note: !Macsuck not working?
 | 
			
		||||
 | 
			
		||||
device: wsc5000
 | 
			
		||||
note: !Has nasty tendency to not give you all SNMP data ,flaky for some older Catalyst versions.
 | 
			
		||||
 | 
			
		||||
device: wsc5505
 | 
			
		||||
 | 
			
		||||
device: wsc5509
 | 
			
		||||
 | 
			
		||||
device: wsc5500
 | 
			
		||||
 | 
			
		||||
device: wsx5302
 | 
			
		||||
arpnip: yes
 | 
			
		||||
class: Layer3
 | 
			
		||||
note: Router blade that runs IOS
 | 
			
		||||
 | 
			
		||||
device-family: Catalyst 6500
 | 
			
		||||
macsuck:vlan
 | 
			
		||||
class: Layer3::C6500
 | 
			
		||||
note: Runs in two possible modes, native (IOS) and hybrid (IOS with CatOS on top).
 | 
			
		||||
note: Switch running Hybrid has WS-C in description field and loves L2::Catalyst class
 | 
			
		||||
note: Native Mode (IOS) versions seem to have SNMP problems with L2 data.
 | 
			
		||||
 | 
			
		||||
device: 6503
 | 
			
		||||
macsuck:no
 | 
			
		||||
note: !Macsuck failing even under vlan mode
 | 
			
		||||
note: Native mode (IOS) reports L2+L3
 | 
			
		||||
 | 
			
		||||
device: 6509
 | 
			
		||||
duplex: link
 | 
			
		||||
macsuck:no
 | 
			
		||||
note: Native mode (IOS) reports L2+L3
 | 
			
		||||
note: !Macsuck failing even under vlan mode
 | 
			
		||||
 | 
			
		||||
device: wsc6509
 | 
			
		||||
duplex: both
 | 
			
		||||
class: Layer2::Catalyst
 | 
			
		||||
note: Hybrid Mode (Catalyst) reports L2 only
 | 
			
		||||
 | 
			
		||||
device: 6kMsfc
 | 
			
		||||
class: Layer3
 | 
			
		||||
note: IOS portion of Hybrid mode.  VLAN and other L3 Services.
 | 
			
		||||
 | 
			
		||||
device: 6kMsfc2
 | 
			
		||||
class: Layer3
 | 
			
		||||
note: IOS portion of Hybrid mode.  VLAN and other L3 Services.
 | 
			
		||||
 | 
			
		||||
device-family: Voice Gateway
 | 
			
		||||
class: Layer3
 | 
			
		||||
duplex: no
 | 
			
		||||
 | 
			
		||||
device: VG200
 | 
			
		||||
 | 
			
		||||
# Foundry
 | 
			
		||||
device-vendor: Foundry Networks
 | 
			
		||||
class: Layer3::Foundry
 | 
			
		||||
 | 
			
		||||
device-family: FastIron
 | 
			
		||||
ver: 1
 | 
			
		||||
 | 
			
		||||
# HP
 | 
			
		||||
device-vendor: HP
 | 
			
		||||
class:  Layer2::HP
 | 
			
		||||
ver: 2
 | 
			
		||||
 | 
			
		||||
device-family: HP ProCurve
 | 
			
		||||
duplex: both
 | 
			
		||||
macsuck: yes
 | 
			
		||||
arpnip: no
 | 
			
		||||
cdp: yes
 | 
			
		||||
note: CDP only available with newer ROM versions. 
 | 
			
		||||
 | 
			
		||||
device: 2512
 | 
			
		||||
ver: 1
 | 
			
		||||
 | 
			
		||||
device: 2524
 | 
			
		||||
ver: 1
 | 
			
		||||
 | 
			
		||||
device: 4000
 | 
			
		||||
note: duplex issues?
 | 
			
		||||
 | 
			
		||||
device: 4104GL
 | 
			
		||||
duplex: link
 | 
			
		||||
 | 
			
		||||
device: 4108GL,8000,2626,2650,8000
 | 
			
		||||
note: VLAN info in Q-BRIDGE-MIB
 | 
			
		||||
 | 
			
		||||
device-vendor: Zyxel
 | 
			
		||||
class: Layer2::ZyXEL_DSLAM
 | 
			
		||||
note: Doesn't report sysServices (layers)
 | 
			
		||||
 | 
			
		||||
device-family: Zyxel DSLAM
 | 
			
		||||
 | 
			
		||||
device:AAM10008-61, AAM1008-63
 | 
			
		||||
							
								
								
									
										159
									
								
								Info/Bridge.pm
									
									
									
									
									
								
							
							
						
						
									
										159
									
								
								Info/Bridge.pm
									
									
									
									
									
								
							@@ -1,8 +1,12 @@
 | 
			
		||||
# SNMP::Info::Bridge
 | 
			
		||||
# Max Baker <max@warped.org>
 | 
			
		||||
#
 | 
			
		||||
# Changes since Version 0.7 Copyright (c) 2004 Max Baker 
 | 
			
		||||
# All rights reserved.  
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2002,2003 Regents of the University of California
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
#
 | 
			
		||||
# 
 | 
			
		||||
# Redistribution and use in source and binary forms, with or without 
 | 
			
		||||
# modification, are permitted provided that the following conditions are met:
 | 
			
		||||
@@ -28,7 +32,7 @@
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::Bridge;
 | 
			
		||||
$VERSION = 0.3;
 | 
			
		||||
$VERSION = 0.8;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
@@ -44,15 +48,22 @@ $DEBUG=0;
 | 
			
		||||
$SNMP::debugging=$DEBUG;
 | 
			
		||||
 | 
			
		||||
$INIT = 0;
 | 
			
		||||
%MIBS = ('BRIDGE-MIB' => 'dot1dBaseBridgeAddress');
 | 
			
		||||
 | 
			
		||||
%MIBS    = ('BRIDGE-MIB'   => 'dot1dBaseBridgeAddress',
 | 
			
		||||
            'Q-BRIDGE-MIB' => 'dot1qPvid',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
            'b_mac'   => 'dot1dBaseBridgeAddress',
 | 
			
		||||
            'b_ports' => 'dot1dBaseNumPorts',
 | 
			
		||||
            'b_type'  => 'dot1dBaseType',
 | 
			
		||||
            'b_mac'    => 'dot1dBaseBridgeAddress',
 | 
			
		||||
            'b_ports'  => 'dot1dBaseNumPorts',
 | 
			
		||||
            'b_type'   => 'dot1dBaseType',
 | 
			
		||||
            # Spanning Tree Protocol
 | 
			
		||||
            'stp_ver' => 'dot1dStpProtocolSpecification',
 | 
			
		||||
            'stp_ver'  => 'dot1dStpProtocolSpecification',
 | 
			
		||||
            'stp_time' => 'dot1dStpTimeSinceTopologyChange',
 | 
			
		||||
            'stp_root' => 'dot1dStpDesignatedRoot',
 | 
			
		||||
            # Q-BRIDGE-MIB
 | 
			
		||||
            'qb_vlans_max'  => 'dot1qMaxSupportedVlans',
 | 
			
		||||
            'qb_vlans'      => 'dot1qNumVlans',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%FUNCS = (
 | 
			
		||||
@@ -76,12 +87,18 @@ $INIT = 0;
 | 
			
		||||
          'stp_p_root'     => 'dot1dStpPortDesignatedRoot',
 | 
			
		||||
          'stp_p_bridge'   => 'dot1dStpPortDesignatedBridge',
 | 
			
		||||
          'stp_p_port'     => 'dot1dStpPortDesignatedPort',
 | 
			
		||||
          # Q-BRIDGE-MIB : 
 | 
			
		||||
          'qb_i_vlan'      => 'dot1qPvid',
 | 
			
		||||
          'qb_i_vlan_type' => 'dot1qPortAcceptableFrameTypes',
 | 
			
		||||
          'qb_v_name'      => 'dot1qVlanStaticName',
 | 
			
		||||
          'qb_v_stat'      => 'dot1qVlanStaticRowStatus',
 | 
			
		||||
          );
 | 
			
		||||
 | 
			
		||||
%MUNGE = (
 | 
			
		||||
          # Inherit all the built in munging
 | 
			
		||||
          %SNMP::Info::MUNGE,
 | 
			
		||||
          # Add ones for our class
 | 
			
		||||
          'b_mac'        => \&SNMP::Info::munge_mac,
 | 
			
		||||
          'fw_mac'       => \&SNMP::Info::munge_mac,
 | 
			
		||||
          'bs_mac'       => \&SNMP::Info::munge_mac,
 | 
			
		||||
          'stp_root'     => \&SNMP::Info::munge_mac,
 | 
			
		||||
@@ -115,13 +132,7 @@ __END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::Bridge - Perl5 Interface to BRIDGE-MIB 
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
BRIDGE-MIB is used by most Layer 2 devices like Switches 
 | 
			
		||||
 | 
			
		||||
Inherits all methods from SNMP::Info
 | 
			
		||||
SNMP::Info::Bridge - Perl5 Interface to SNMP data available through the BRIDGE-MIB (RFC1493)
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
@@ -129,40 +140,66 @@ Max Baker (C<max@warped.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 my $bridge = new SNMP::Info::Bridge(DestHost  => 'myswitch',
 | 
			
		||||
                               Community => 'public');
 | 
			
		||||
 my $mac = $bridge->mac(); 
 | 
			
		||||
 my $bridge = new SNMP::Info ( 
 | 
			
		||||
                             AutoSpecify => 1,
 | 
			
		||||
                             Debug       => 1,
 | 
			
		||||
                             DestHost    => 'switch', 
 | 
			
		||||
                             Community   => 'public',
 | 
			
		||||
                             Version     => 2
 | 
			
		||||
                             );
 | 
			
		||||
 | 
			
		||||
=head1 CREATING AN OBJECT
 | 
			
		||||
 my $class = $cdp->class();
 | 
			
		||||
 print " Using device sub class : $class\n";
 | 
			
		||||
 | 
			
		||||
 # Grab Forwarding Tables
 | 
			
		||||
 my $interfaces = $bridge->interfaces();
 | 
			
		||||
 my $fw_mac     = $bridge->fw_mac();
 | 
			
		||||
 my $fw_port    = $bridge->fw_port();
 | 
			
		||||
 my $bp_index   = $bridge->bp_index();
 | 
			
		||||
 | 
			
		||||
 foreach my $fw_index (keys %$fw_mac){
 | 
			
		||||
    my $mac   = $fw_mac->{$fw_index};
 | 
			
		||||
    my $bp_id = $fw_mac->{$fw_index};
 | 
			
		||||
    my $iid   = $bp_index->{$bp_id};
 | 
			
		||||
    my $port  = $interfaces->{$iid};
 | 
			
		||||
 | 
			
		||||
    print "Port:$port forwarding to $mac\n";
 | 
			
		||||
 } 
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
BRIDGE-MIB is used by most Layer 2 devices, and holds information like the MAC Forwarding Table and Spanning Tree Protocol info.
 | 
			
		||||
 | 
			
		||||
Q-BRIDGE-MIB holds 802.11q information -- VLANs and Trunking.  Cisco tends not to use this MIB, but some
 | 
			
		||||
proprietary ones.  HP and some nicer vendors use this.  This is from C<RFC2674_q>.  
 | 
			
		||||
 | 
			
		||||
Create or use a subclass of SNMP::Info that inherits this class.  Do not use directly.
 | 
			
		||||
 | 
			
		||||
For debugging you can call new() directly as you would in SNMP::Info 
 | 
			
		||||
 | 
			
		||||
 my $bridge = new SNMP::Info::Bridge(...);
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
None.
 | 
			
		||||
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item  new SNMP::Info::Bridge()
 | 
			
		||||
=item BRIDGE-MIB
 | 
			
		||||
 | 
			
		||||
Arguments passed to new() are passed on to SNMP::Session::new()
 | 
			
		||||
    
 | 
			
		||||
=item Q-BRIDGE-MIB
 | 
			
		||||
 | 
			
		||||
    my $bridge = new SNMP::Info::Bridge(
 | 
			
		||||
        DestHost => $host,
 | 
			
		||||
        Community => 'public',
 | 
			
		||||
        Version => 3,...
 | 
			
		||||
        ) 
 | 
			
		||||
    die "Couldn't connect.\n" unless defined $bridge;
 | 
			
		||||
 | 
			
		||||
=item  $bridge->session()
 | 
			
		||||
 | 
			
		||||
Sets or returns the SNMP::Session object
 | 
			
		||||
 | 
			
		||||
    # Get
 | 
			
		||||
    my $sess = $bridge->session();
 | 
			
		||||
 | 
			
		||||
    # Set
 | 
			
		||||
    my $newsession = new SNMP::Session(...);
 | 
			
		||||
    $bridge->session($newsession);
 | 
			
		||||
f<rfc2674_q.mib>
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 Bridge Global Configuration Values
 | 
			
		||||
BRIDGE-MIB needs to be extracted from ftp://ftp.cisco.com/pub/mibs/v1/v1.tar.gz
 | 
			
		||||
 | 
			
		||||
=head1 GLOBAL METHODS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar values from SNMP
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
@@ -202,9 +239,22 @@ Returns root of STP.
 | 
			
		||||
 | 
			
		||||
(B<dot1dStpDesignatedRoot>)
 | 
			
		||||
 | 
			
		||||
=item $bridge->qb_vlans_max()
 | 
			
		||||
 | 
			
		||||
(B<dot1qMaxSupportedVlans>)
 | 
			
		||||
 | 
			
		||||
=item $bridge->qb_vlans() 
 | 
			
		||||
 | 
			
		||||
Number of VLANS on this device.
 | 
			
		||||
 | 
			
		||||
(B<dot1qNumVlans>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 TABLE ENTRIES
 | 
			
		||||
=head1 TABLE METHODS
 | 
			
		||||
 | 
			
		||||
These are methods that return tables of information in the form of a reference
 | 
			
		||||
to a hash.
 | 
			
		||||
 | 
			
		||||
=head2 Forwarding Table (dot1dTpFdbEntry)
 | 
			
		||||
 | 
			
		||||
@@ -315,4 +365,35 @@ this port's segment."
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Q-BRIDGE Data
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $bridge->qb_i_vlan()
 | 
			
		||||
 | 
			
		||||
Gives the vlan used by interfaces
 | 
			
		||||
 | 
			
		||||
(B<dot1qPvid>)
 | 
			
		||||
 | 
			
		||||
=item $bridge->qb_i_vlan_type()
 | 
			
		||||
 | 
			
		||||
Either C<admitAll> or C<admitOnlyVlanTagged>.  This is a good spot to find
 | 
			
		||||
trunk ports.
 | 
			
		||||
 | 
			
		||||
(B<dot1qPortAcceptableFrameTypes>)
 | 
			
		||||
 | 
			
		||||
=item $bridge->qb_v_name()
 | 
			
		||||
 | 
			
		||||
Human-entered name for vlans.
 | 
			
		||||
 | 
			
		||||
(B<dot1qVlanStaticName>)
 | 
			
		||||
 | 
			
		||||
=item $bridge->qb_v_stat()
 | 
			
		||||
 | 
			
		||||
uhh. C<active> !
 | 
			
		||||
 | 
			
		||||
(B<dot1qVlanStaticRowStatus>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										232
									
								
								Info/CDP.pm
									
									
									
									
									
								
							
							
						
						
									
										232
									
								
								Info/CDP.pm
									
									
									
									
									
								
							@@ -1,6 +1,9 @@
 | 
			
		||||
# SNMP::Info::CDP
 | 
			
		||||
# Max Baker <max@warped.org>
 | 
			
		||||
#
 | 
			
		||||
# Changes since Version 0.7 Copyright (c) 2004 Max Baker 
 | 
			
		||||
# All rights reserved.  
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2002,2003 Regents of the University of California
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
# 
 | 
			
		||||
@@ -28,7 +31,7 @@
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::CDP;
 | 
			
		||||
$VERSION = 0.3;
 | 
			
		||||
$VERSION = 0.8;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
@@ -59,7 +62,7 @@ $INIT = 0;
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%FUNCS  = (
 | 
			
		||||
            'c_if'           => 'cdpCacheIfIndex',
 | 
			
		||||
            'c_index'        => 'cdpCacheIfIndex',
 | 
			
		||||
            'c_proto'        => 'cdpCacheAddressType',
 | 
			
		||||
            'c_ip'           => 'cdpCacheAddress',
 | 
			
		||||
            'c_ver'          => 'cdpCacheVersion',
 | 
			
		||||
@@ -103,6 +106,34 @@ sub hasCDP {
 | 
			
		||||
    
 | 
			
		||||
    return $cdp->cdp_run();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub c_if {
 | 
			
		||||
    my $cdp  = shift;
 | 
			
		||||
 | 
			
		||||
    # See if by some miracle Cisco implemented the cdpCacheIfIndex entry
 | 
			
		||||
    my $c_index     = $cdp->c_index();
 | 
			
		||||
    return $c_index if defined $c_index;
 | 
			
		||||
 | 
			
		||||
    # Nope, didn't think so. Now we fake it.
 | 
			
		||||
    my $c_ip = $cdp->c_ip();
 | 
			
		||||
    unless (defined $c_ip){
 | 
			
		||||
        $cdp->{error} = "SNMP::Info::CDP::c_if() - Device doesn't have c_ip() data.  Can't fake c_index()";
 | 
			
		||||
        $DEBUG and carp($cdp->error(1));
 | 
			
		||||
        return undef;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    my %c_if;
 | 
			
		||||
    foreach my $key (keys %$c_ip){
 | 
			
		||||
      next unless defined $key;
 | 
			
		||||
      my $iid = $key;
 | 
			
		||||
      # Truncate .1 from cdp cache entry
 | 
			
		||||
      $iid =~ s/\.\d+$//;
 | 
			
		||||
      $c_if{$key} = $iid;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return \%c_if;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
__END__
 | 
			
		||||
 | 
			
		||||
@@ -110,40 +141,69 @@ __END__
 | 
			
		||||
 | 
			
		||||
SNMP::Info::CDP - Perl5 Interface to Cisco Discovery Protocol (CDP) using SNMP
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
SNMP::Info::CDP is a subclass of SNMP::Info that provides an object oriented 
 | 
			
		||||
interface to CDP information through SNMP.
 | 
			
		||||
 | 
			
		||||
CDP is a Layer 2 protocol that supplies topology information of devices that also speak CDP, 
 | 
			
		||||
mostly switches and routers.
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
Max Baker (C<max@warped.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 my $info = new SNMP::Info ( DestHost  => 'router', 
 | 
			
		||||
                             Community => 'public' 
 | 
			
		||||
 my $cdp = new SNMP::Info ( 
 | 
			
		||||
                             AutoSpecify => 1,
 | 
			
		||||
                             Debug       => 1,
 | 
			
		||||
                             DestHost    => 'router', 
 | 
			
		||||
                             Community   => 'public',
 | 
			
		||||
                             Version     => 2
 | 
			
		||||
                           );
 | 
			
		||||
 | 
			
		||||
 my $type = $info->device_type();
 | 
			
		||||
 my $class = $cdp->class();
 | 
			
		||||
 print " Using device sub class : $class\n";
 | 
			
		||||
 | 
			
		||||
 my $cdp  = new $type ( DestHost => 'router',
 | 
			
		||||
                        Community => 'public);
 | 
			
		||||
 $hascdp   = $cdp->hasCDP() ? 'yes' : 'no';
 | 
			
		||||
 | 
			
		||||
 $hascdp = $cdp->hasCDP() ? 'yes' : 'no';
 | 
			
		||||
 @neighbor_ips = values( %{$cdp->c_ip()} );
 | 
			
		||||
 # Print out a map of device ports with CDP neighbors:
 | 
			
		||||
 my $interfaces = $cdp->interfaces();
 | 
			
		||||
 my $c_if       = $cdp->c_if();
 | 
			
		||||
 my $c_ip       = $cdp->c_ip();
 | 
			
		||||
 my $c_port     = $cdp->c_port();
 | 
			
		||||
 | 
			
		||||
See L<SNMP::Info> for all inherited methods.
 | 
			
		||||
 foreach my $cdp_key (keys %$c_ip){
 | 
			
		||||
    my $iid           = $c_if->{$cdp_key};
 | 
			
		||||
    my $port          = $interfaces->{$iid};
 | 
			
		||||
    my $neighbor      = $c_ip->{$cdp_key};
 | 
			
		||||
    my $neighbor_port = $c_port->{$cdp_key};
 | 
			
		||||
    print "Port : $port connected to $neighbor / $neighbor_port\n";
 | 
			
		||||
 }
 | 
			
		||||
 | 
			
		||||
=head2 Your Device May Vary
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
SNMP::Info::CDP is a subclass of SNMP::Info that provides an object oriented 
 | 
			
		||||
interface to CDP information through SNMP.
 | 
			
		||||
 | 
			
		||||
CDP is a Layer 2 protocol that supplies topology information of devices that also speak CDP, 
 | 
			
		||||
mostly switches and routers.  CDP is implemented in Cisco and some HP devices.
 | 
			
		||||
 | 
			
		||||
Create or use a device subclass that inherits this class.  Do not use directly.
 | 
			
		||||
 | 
			
		||||
Each device implements a subset of the global and cache entries. 
 | 
			
		||||
Check the return value to see if that data is held by the device.
 | 
			
		||||
 | 
			
		||||
=head1 CDP GLOBAL VALUES
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
None.
 | 
			
		||||
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item CISCO-CDP-MIB
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
 | 
			
		||||
 | 
			
		||||
=head1 GLOBAL METHODS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar values from SNMP
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
@@ -155,7 +215,8 @@ Accounts for SNMP version 1 devices which may have CDP but not cdp_run()
 | 
			
		||||
 | 
			
		||||
=item $cdp->cdp_run()
 | 
			
		||||
 | 
			
		||||
Is CDP enabled on this device?
 | 
			
		||||
Is CDP enabled on this device?  Note that a lot of Cisco devices that implement
 | 
			
		||||
CDP don't implement this value. @#%$!
 | 
			
		||||
 | 
			
		||||
(B<cdpGlobalRun>)
 | 
			
		||||
 | 
			
		||||
@@ -181,46 +242,15 @@ This is the device id broadcast via CDP to other devices, and is what is retriev
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 CDP CACHE ENTRIES
 | 
			
		||||
=head1 TABLE METHODS
 | 
			
		||||
 | 
			
		||||
These are methods that return tables of information in the form of a reference
 | 
			
		||||
to a hash.
 | 
			
		||||
 | 
			
		||||
=head2 CDP CACHE ENTRIES
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item  $cdp->c_proto()
 | 
			
		||||
 | 
			
		||||
Returns remote address type received.  Usually IP.
 | 
			
		||||
 | 
			
		||||
(B<cdpCacheAddressType>)
 | 
			
		||||
 | 
			
		||||
=item  $cdp->c_ip()
 | 
			
		||||
 | 
			
		||||
Returns remote IP address
 | 
			
		||||
 | 
			
		||||
(B<cdpCacheAddress>)
 | 
			
		||||
 | 
			
		||||
=item $cdp->c_ver() 
 | 
			
		||||
 | 
			
		||||
Returns remote hardware version
 | 
			
		||||
 | 
			
		||||
(B<cdpCacheVersion>)
 | 
			
		||||
 | 
			
		||||
=item $cdp->c_id()
 | 
			
		||||
 | 
			
		||||
Returns remote device id string
 | 
			
		||||
 | 
			
		||||
(B<cdpCacheDeviceId>)
 | 
			
		||||
 | 
			
		||||
=item $cdp->c_port()
 | 
			
		||||
 | 
			
		||||
Returns remote port ID
 | 
			
		||||
 | 
			
		||||
(B<cdpDevicePort>)
 | 
			
		||||
 | 
			
		||||
=item $cdp->c_platform() 
 | 
			
		||||
 | 
			
		||||
Returns remote platform id 
 | 
			
		||||
 | 
			
		||||
(B<cdpCachePlatform>)
 | 
			
		||||
 | 
			
		||||
=item $cdp->c_capabilities()
 | 
			
		||||
 | 
			
		||||
Returns Device Functional Capabilities.  Results are munged into an ascii
 | 
			
		||||
@@ -259,18 +289,92 @@ Returns remote VTP Management Domain as defined in CISCO-VTP-MIB::managementDoma
 | 
			
		||||
 | 
			
		||||
(B<cdpCacheVTPMgmtDomain>)
 | 
			
		||||
 | 
			
		||||
=item $cdp->c_vlan()
 | 
			
		||||
 | 
			
		||||
Returns the remote interface native VLAN.
 | 
			
		||||
 | 
			
		||||
(B<cdpCacheNativeVLAN>)
 | 
			
		||||
 | 
			
		||||
=item $cdp->c_duplex() 
 | 
			
		||||
 | 
			
		||||
Returns the port duplex status from remote devices.
 | 
			
		||||
 | 
			
		||||
(B<cdpCacheDuplex>)
 | 
			
		||||
 | 
			
		||||
=item $cdp->c_id()
 | 
			
		||||
 | 
			
		||||
Returns remote device id string
 | 
			
		||||
 | 
			
		||||
(B<cdpCacheDeviceId>)
 | 
			
		||||
 | 
			
		||||
=item $cdp->c_if()
 | 
			
		||||
 | 
			
		||||
Returns the mapping to the SNMP Interface Table.
 | 
			
		||||
 | 
			
		||||
Note that a lot devices don't implement $cdp->c_index(),  So if it isn't around,
 | 
			
		||||
we fake it. 
 | 
			
		||||
 | 
			
		||||
In order to map the cdp table entry back to the interfaces() entry, we truncate the last number
 | 
			
		||||
off of it :
 | 
			
		||||
 | 
			
		||||
  # it exists, yay.
 | 
			
		||||
  my $c_index     = $device->c_index();
 | 
			
		||||
  return $c_index if defined $c_index;
 | 
			
		||||
 | 
			
		||||
  # if not, let's fake it
 | 
			
		||||
  my $c_ip       = $device->c_ip();
 | 
			
		||||
    
 | 
			
		||||
  my %c_if
 | 
			
		||||
  foreach my $key (keys %$c_ip){
 | 
			
		||||
      $iid = $key;
 | 
			
		||||
      ## Truncate off .1 from cdp response
 | 
			
		||||
      $iid =~ s/\.\d+$//;
 | 
			
		||||
      $c_if{$key} = $iid;
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
  return \%c_if;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
=item $cdp->c_index()
 | 
			
		||||
 | 
			
		||||
Returns the mapping to the SNMP2 Interface table for CDP Cache Entries. 
 | 
			
		||||
 | 
			
		||||
Most devices don't implement this, so you probably want to use $cdp->c_if() instead.
 | 
			
		||||
 | 
			
		||||
See c_if() entry.
 | 
			
		||||
 | 
			
		||||
(B<cdpCacheIfIndex>)
 | 
			
		||||
 | 
			
		||||
=item  $cdp->c_ip()
 | 
			
		||||
 | 
			
		||||
Returns remote IP address
 | 
			
		||||
 | 
			
		||||
(B<cdpCacheAddress>)
 | 
			
		||||
 | 
			
		||||
=item $cdp->c_platform() 
 | 
			
		||||
 | 
			
		||||
Returns remote platform id 
 | 
			
		||||
 | 
			
		||||
(B<cdpCachePlatform>)
 | 
			
		||||
 | 
			
		||||
=item $cdp->c_port()
 | 
			
		||||
 | 
			
		||||
Returns remote port ID
 | 
			
		||||
 | 
			
		||||
(B<cdpDevicePort>)
 | 
			
		||||
 | 
			
		||||
=item  $cdp->c_proto()
 | 
			
		||||
 | 
			
		||||
Returns remote address type received.  Usually IP.
 | 
			
		||||
 | 
			
		||||
(B<cdpCacheAddressType>)
 | 
			
		||||
 | 
			
		||||
=item $cdp->c_ver() 
 | 
			
		||||
 | 
			
		||||
Returns remote hardware version
 | 
			
		||||
 | 
			
		||||
(B<cdpCacheVersion>)
 | 
			
		||||
 | 
			
		||||
=item $cdp->c_vlan()
 | 
			
		||||
 | 
			
		||||
Returns the remote interface native VLAN.
 | 
			
		||||
 | 
			
		||||
(B<cdpCacheNativeVLAN>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										484
									
								
								Info/CiscoStack.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										484
									
								
								Info/CiscoStack.pm
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,484 @@
 | 
			
		||||
# SNMP::Info::CiscoStack
 | 
			
		||||
# Max Baker <max@warped.org>
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c)2003,2004 Max Baker 
 | 
			
		||||
# All rights reserved.  
 | 
			
		||||
#
 | 
			
		||||
# Redistribution and use in source and binary forms, with or without 
 | 
			
		||||
# modification, are permitted provided that the following conditions are met:
 | 
			
		||||
# 
 | 
			
		||||
#     * Redistributions of source code must retain the above copyright notice,
 | 
			
		||||
#       this list of conditions and the following disclaimer.
 | 
			
		||||
#     * Redistributions in binary form must reproduce the above copyright notice,
 | 
			
		||||
#       this list of conditions and the following disclaimer in the documentation
 | 
			
		||||
#       and/or other materials provided with the distribution.
 | 
			
		||||
#     * Neither the name of the author nor the 
 | 
			
		||||
#       names of its contributors may be used to endorse or promote products 
 | 
			
		||||
#       derived from this software without specific prior written permission.
 | 
			
		||||
# 
 | 
			
		||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 | 
			
		||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
 | 
			
		||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
 | 
			
		||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 | 
			
		||||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 | 
			
		||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
 | 
			
		||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 | 
			
		||||
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
 | 
			
		||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::CiscoStack;
 | 
			
		||||
$VERSION = 0.8;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
use Exporter;
 | 
			
		||||
use SNMP::Info;
 | 
			
		||||
 | 
			
		||||
use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE %PORTSTAT $INIT/;
 | 
			
		||||
@SNMP::Info::CiscoStack::ISA = qw/SNMP::Info Exporter/;
 | 
			
		||||
@SNMP::Info::CiscoStack::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
$DEBUG=0;
 | 
			
		||||
$SNMP::debugging=$DEBUG;
 | 
			
		||||
 | 
			
		||||
$INIT    = 0;
 | 
			
		||||
%MIBS    = (
 | 
			
		||||
            'CISCO-STACK-MIB'     => 'ciscoStackMIB',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
            'sysip'       => 'sysIpAddr',    
 | 
			
		||||
            'netmask'     => 'sysNetMask',    
 | 
			
		||||
            'broadcast'   => 'sysBroadcast',
 | 
			
		||||
            'serial1'     => 'chassisSerialNumber',    
 | 
			
		||||
            'serial2'     => 'chassisSerialNumberString',
 | 
			
		||||
            'model1'      => 'chassisModel',    
 | 
			
		||||
            'ps1_type'    => 'chassisPs1Type',    
 | 
			
		||||
            'ps1_status'  => 'chassisPs1Status',    
 | 
			
		||||
            'ps2_type'    => 'chassisPs2Type',    
 | 
			
		||||
            'ps2_status'  => 'chassisPs2Status',    
 | 
			
		||||
            'slots'       => 'chassisNumSlots',    
 | 
			
		||||
            'fan'         => 'chassisFanStatus',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%FUNCS   = (
 | 
			
		||||
            'i_type2'        => 'ifType',
 | 
			
		||||
            # CISCO-STACK-MIB::moduleEntry
 | 
			
		||||
            #   These are blades in a catalyst device
 | 
			
		||||
            'm_type'         => 'moduleType',
 | 
			
		||||
            'm_model'        => 'moduleModel',
 | 
			
		||||
            'm_serial'       => 'moduleSerialNumber',
 | 
			
		||||
            'm_status'       => 'moduleStatus',
 | 
			
		||||
            'm_name'         => 'moduleName',
 | 
			
		||||
            'm_ports'        => 'moduleNumPorts',
 | 
			
		||||
            'm_ports_status' => 'modulePortStatus',
 | 
			
		||||
            'm_hwver'        => 'moduleHwVersion',
 | 
			
		||||
            'm_fwver'        => 'moduleFwVersion',
 | 
			
		||||
            'm_swver'        => 'moduleSwVersion',
 | 
			
		||||
            # Router Blades :
 | 
			
		||||
            'm_ip'           => 'moduleIPAddress',
 | 
			
		||||
            'm_sub1'         => 'moduleSubType',
 | 
			
		||||
            'm_sub2'         => 'moduleSubType2',
 | 
			
		||||
            # CISCO-STACK-MIB::portEntry 
 | 
			
		||||
            'p_name'    => 'portName',
 | 
			
		||||
            'p_type'    => 'portType',
 | 
			
		||||
            'p_status'  => 'portOperStatus',
 | 
			
		||||
            'p_status2' => 'portAdditionalStatus',
 | 
			
		||||
            'p_speed'   => 'portAdminSpeed',
 | 
			
		||||
            'p_duplex'  => 'portDuplex',
 | 
			
		||||
            'p_port'    => 'portIfIndex',
 | 
			
		||||
            # CISCO-STACK-MIB::PortCpbEntry
 | 
			
		||||
            'p_speed_admin'  => 'portCpbSpeed',
 | 
			
		||||
            'p_duplex_admin' => 'portCpbDuplex',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%MUNGE   = (
 | 
			
		||||
            'm_ports_status' => \&munge_port_status,
 | 
			
		||||
            'p_duplex_admin' => \&SNMP::Info::munge_bits,
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%PORTSTAT = (1 => 'other',
 | 
			
		||||
             2 => 'ok',
 | 
			
		||||
             3 => 'minorFault',
 | 
			
		||||
             4 => 'majorFault');
 | 
			
		||||
 | 
			
		||||
# Changes binary byte describing each port into ascii, and returns
 | 
			
		||||
# an ascii list separated by spaces.
 | 
			
		||||
sub munge_port_status {
 | 
			
		||||
    my $status = shift;
 | 
			
		||||
    my @vals = map($PORTSTAT{$_},unpack('C*',$status));
 | 
			
		||||
    return join(' ',@vals);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub serial {
 | 
			
		||||
    my $stack = shift;
 | 
			
		||||
    my $serial1 = $stack->serial1();
 | 
			
		||||
    my $serial2 = $stack->serial2();
 | 
			
		||||
 | 
			
		||||
    return $serial1 if defined $serial1;
 | 
			
		||||
    return $serial2 if defined $serial2;
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_type {
 | 
			
		||||
    my $stack = shift;
 | 
			
		||||
 | 
			
		||||
    my $p_port = $stack->p_port();
 | 
			
		||||
    my $p_type  = $stack->p_type();
 | 
			
		||||
 | 
			
		||||
    # Get more generic port types from IF-MIB
 | 
			
		||||
    my $i_type  = $stack->i_type2();
 | 
			
		||||
 | 
			
		||||
    # Now Override w/ port entries
 | 
			
		||||
    foreach my $port (keys %$p_type) {
 | 
			
		||||
        my $iid = $p_port->{$port};
 | 
			
		||||
        $i_type->{$iid} = $p_type->{$port};  
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return $i_type;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# p_* functions are indexed to physical port.  let's index these
 | 
			
		||||
#   to snmp iid
 | 
			
		||||
sub i_name {
 | 
			
		||||
    my $stack = shift;
 | 
			
		||||
 | 
			
		||||
    my $p_port = $stack->p_port();
 | 
			
		||||
    my $p_name  = $stack->p_name();
 | 
			
		||||
 | 
			
		||||
    my %i_name;
 | 
			
		||||
    foreach my $port (keys %$p_name) {
 | 
			
		||||
        my $iid = $p_port->{$port};
 | 
			
		||||
        next unless defined $iid;
 | 
			
		||||
        $i_name{$iid} = $p_name->{$port};
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_name; 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_duplex {
 | 
			
		||||
    my $stack = shift;
 | 
			
		||||
 | 
			
		||||
    #my $i_duplex = $stack->SUPER::i_duplex();
 | 
			
		||||
    my $p_port = $stack->p_port();
 | 
			
		||||
    my $p_duplex  = $stack->p_duplex();
 | 
			
		||||
 | 
			
		||||
    my $i_duplex = {};
 | 
			
		||||
    foreach my $port (keys %$p_duplex) {
 | 
			
		||||
        my $iid = $p_port->{$port};
 | 
			
		||||
        $i_duplex->{$iid} = $p_duplex->{$port};
 | 
			
		||||
    }
 | 
			
		||||
    return $i_duplex; 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_duplex_admin {
 | 
			
		||||
    my $stack = shift;
 | 
			
		||||
 | 
			
		||||
    my $p_port          = $stack->p_port();
 | 
			
		||||
    my $p_duplex_admin  = $stack->p_duplex_admin();
 | 
			
		||||
 | 
			
		||||
    my %i_duplex_admin;
 | 
			
		||||
    foreach my $port (keys %$p_duplex_admin) {
 | 
			
		||||
        my $iid = $p_port->{$port};
 | 
			
		||||
        next unless defined $iid;
 | 
			
		||||
        my $duplex = $p_duplex_admin->{$port};
 | 
			
		||||
        next unless defined $duplex;
 | 
			
		||||
 | 
			
		||||
        my $string = 'other';
 | 
			
		||||
        # see CISCO-STACK-MIB for a description of the bits
 | 
			
		||||
        $string = 'half' if ($duplex =~ /001$/ or $duplex =~ /0100.$/);
 | 
			
		||||
        $string = 'full' if ($duplex =~ /010$/ or $duplex =~ /100.0$/);
 | 
			
		||||
        # we'll call it auto if both full and half are turned on, or if the
 | 
			
		||||
        #   specifically 'auto' flag bit is set.
 | 
			
		||||
        $string = 'auto' 
 | 
			
		||||
            if ($duplex =~ /1..$/ or $duplex =~ /110..$/ or $duplex =~ /..011$/);
 | 
			
		||||
       
 | 
			
		||||
        $i_duplex_admin{$iid} = $string;
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_duplex_admin; 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# $stack->interfaces() - Maps the ifIndex table to a physical port
 | 
			
		||||
sub interfaces {
 | 
			
		||||
    my $self = shift;
 | 
			
		||||
    my $i_index    = $self->i_index();
 | 
			
		||||
    my $portnames  = $self->p_port();
 | 
			
		||||
    my %portmap    = reverse %$portnames;
 | 
			
		||||
 | 
			
		||||
    my %interfaces = ();
 | 
			
		||||
    foreach my $iid (keys %$i_index) {
 | 
			
		||||
        my $if   = $i_index->{$iid};
 | 
			
		||||
        my $port = $portmap{$iid};
 | 
			
		||||
        $interfaces{$iid} = $port || $if;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return \%interfaces;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
__END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::CiscoStack - Perl5 Interface to CPU and Memory stats for Cisco Devices
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
Max Baker (C<max@warped.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you. 
 | 
			
		||||
 my $ciscostats = new SNMP::Info(
 | 
			
		||||
                          AutoSpecify => 1,
 | 
			
		||||
                          Debug       => 1,
 | 
			
		||||
                          # These arguments are passed directly on to SNMP::Session
 | 
			
		||||
                          DestHost    => 'myswitch',
 | 
			
		||||
                          Community   => 'public',
 | 
			
		||||
                          Version     => 2
 | 
			
		||||
                        ) 
 | 
			
		||||
    or die "Can't connect to DestHost.\n";
 | 
			
		||||
 | 
			
		||||
 my $class      = $ciscostats->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
SNMP::Info::CiscoStack is a subclass of SNMP::Info that provides
 | 
			
		||||
an interface to the C<CISCO-STACK-MIB>.  This MIB is used across
 | 
			
		||||
the Catalyst family under CatOS and IOS.
 | 
			
		||||
 | 
			
		||||
Use or create in a subclass of SNMP::Info.  Do not use directly.
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
none.
 | 
			
		||||
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item CISCO-STACK-MIB
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $stack->broadcast()
 | 
			
		||||
 | 
			
		||||
(B<sysBroadcast>)
 | 
			
		||||
 | 
			
		||||
=item $stack->fan()
 | 
			
		||||
 | 
			
		||||
(B<chassisFanStatus>)
 | 
			
		||||
 | 
			
		||||
=item $stack->model()
 | 
			
		||||
 | 
			
		||||
(B<chassisModel>)
 | 
			
		||||
 | 
			
		||||
=item $stack->netmask()
 | 
			
		||||
 | 
			
		||||
(B<sysNetMask>)
 | 
			
		||||
 | 
			
		||||
=item $stack->ps1_type()
 | 
			
		||||
 | 
			
		||||
(B<chassisPs1Type>)
 | 
			
		||||
 | 
			
		||||
=item $stack->ps2_type()
 | 
			
		||||
 | 
			
		||||
(B<chassisPs2Type>)
 | 
			
		||||
 | 
			
		||||
=item $stack->ps1_status()
 | 
			
		||||
 | 
			
		||||
(B<chassisPs1Status>)
 | 
			
		||||
 | 
			
		||||
=item $stack->ps2_status()
 | 
			
		||||
 | 
			
		||||
(B<chassisPs2Status>)
 | 
			
		||||
 | 
			
		||||
=item $stack->serial()
 | 
			
		||||
 | 
			
		||||
(B<chassisSerialNumberString>) or (B<chassisSerialNumber>)
 | 
			
		||||
 | 
			
		||||
=item $stack->slots()
 | 
			
		||||
 | 
			
		||||
(B<chassisNumSlots>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 TABLE METHODS
 | 
			
		||||
 | 
			
		||||
=head2 Interface Tables
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $stack->interfaces()
 | 
			
		||||
 | 
			
		||||
Crosses p_port() with i_index() to get physical names.
 | 
			
		||||
 | 
			
		||||
=item $stack->i_physical()
 | 
			
		||||
 | 
			
		||||
Returns a map to IID for ports that are physical ports, not vlans, etc.
 | 
			
		||||
 | 
			
		||||
=item $stack->i_type()
 | 
			
		||||
 | 
			
		||||
Crosses p_port() with p_type() and returns the results. 
 | 
			
		||||
 | 
			
		||||
Overrides with ifType if p_type() isn't available.
 | 
			
		||||
 | 
			
		||||
=item $stack->i_name()
 | 
			
		||||
 | 
			
		||||
Crosses p_name with p_port and returns results.
 | 
			
		||||
 | 
			
		||||
=item $stack->i_duplex()
 | 
			
		||||
 | 
			
		||||
Crosses p_duplex with p_port and returns results.
 | 
			
		||||
 | 
			
		||||
=item $stack->i_duplex_admin()
 | 
			
		||||
 | 
			
		||||
Crosses p_duplex_admin with p_port.
 | 
			
		||||
 | 
			
		||||
Munges bit_string returned from p_duplex_admin to get duplex settings.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Module table
 | 
			
		||||
 | 
			
		||||
This table holds configuration information for each of the blades installed in
 | 
			
		||||
the Catalyst device.
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $stack->m_type()
 | 
			
		||||
 | 
			
		||||
(B<moduleType>)
 | 
			
		||||
 | 
			
		||||
=item $stack->m_model()
 | 
			
		||||
 | 
			
		||||
(B<moduleModel>)
 | 
			
		||||
 | 
			
		||||
=item $stack->m_serial()
 | 
			
		||||
 | 
			
		||||
(B<moduleSerialNumber>)
 | 
			
		||||
 | 
			
		||||
=item $stack->m_status()
 | 
			
		||||
 | 
			
		||||
(B<moduleStatus>)
 | 
			
		||||
 | 
			
		||||
=item $stack->m_name()
 | 
			
		||||
 | 
			
		||||
(B<moduleName>)
 | 
			
		||||
 | 
			
		||||
=item $stack->m_ports()
 | 
			
		||||
 | 
			
		||||
(B<moduleNumPorts>)
 | 
			
		||||
 | 
			
		||||
=item $stack->m_ports_status()
 | 
			
		||||
 | 
			
		||||
Returns a list of space separated status strings for the ports.
 | 
			
		||||
 | 
			
		||||
To see the status of port 4 :
 | 
			
		||||
 | 
			
		||||
    @ports_status = split(' ', $stack->m_ports_status() );
 | 
			
		||||
    $port4 = $ports_status[3];
 | 
			
		||||
 | 
			
		||||
(B<modulePortStatus>)
 | 
			
		||||
 | 
			
		||||
=item $stack->m_ports_hwver()
 | 
			
		||||
 | 
			
		||||
(B<moduleHwVersion>)
 | 
			
		||||
 | 
			
		||||
=item $stack->m_ports_fwver()
 | 
			
		||||
 | 
			
		||||
(B<moduleFwVersion>)
 | 
			
		||||
 | 
			
		||||
=item $stack->m_ports_swver()
 | 
			
		||||
 | 
			
		||||
(B<moduleSwVersion>)
 | 
			
		||||
 | 
			
		||||
=item $stack->m_ports_ip()
 | 
			
		||||
 | 
			
		||||
(B<moduleIPAddress>)
 | 
			
		||||
 | 
			
		||||
=item $stack->m_ports_sub1()
 | 
			
		||||
 | 
			
		||||
(B<moduleSubType>)
 | 
			
		||||
 | 
			
		||||
=item $stack->m_ports_sub2()
 | 
			
		||||
 | 
			
		||||
(B<moduleSubType2>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Modules - Router Blades
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $stack->m_ip()
 | 
			
		||||
 | 
			
		||||
(B<moduleIPAddress>)
 | 
			
		||||
 | 
			
		||||
=item $stack->m_sub1()
 | 
			
		||||
 | 
			
		||||
(B<moduleSubType>)
 | 
			
		||||
 | 
			
		||||
=item $stack->m_sub2()
 | 
			
		||||
 | 
			
		||||
(B<moduleSubType2>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Port Entry Table (CISCO-STACK-MIB::portTable)
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $stack->p_name()
 | 
			
		||||
 | 
			
		||||
(B<portName>)
 | 
			
		||||
 | 
			
		||||
=item $stack->p_type()
 | 
			
		||||
 | 
			
		||||
(B<portType>)
 | 
			
		||||
 | 
			
		||||
=item $stack->p_status()
 | 
			
		||||
 | 
			
		||||
(B<portOperStatus>)
 | 
			
		||||
 | 
			
		||||
=item $stack->p_status2()
 | 
			
		||||
 | 
			
		||||
(B<portAdditionalStatus>)
 | 
			
		||||
 | 
			
		||||
=item $stack->p_speed()
 | 
			
		||||
 | 
			
		||||
(B<portAdminSpeed>)
 | 
			
		||||
 | 
			
		||||
=item $stack->p_duplex()
 | 
			
		||||
 | 
			
		||||
(B<portDuplex>)
 | 
			
		||||
 | 
			
		||||
=item $stack->p_port()
 | 
			
		||||
 | 
			
		||||
(B<portIfIndex>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Port Capability Table (CISCO-STACK-MIB::portCpbTable)
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $stack->p_speed_admin()
 | 
			
		||||
 | 
			
		||||
(B<portCpbSpeed>)
 | 
			
		||||
 | 
			
		||||
=item $stack->p_duplex_admin()
 | 
			
		||||
 | 
			
		||||
(B<portCpbDuplex>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
							
								
								
									
										273
									
								
								Info/CiscoStats.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										273
									
								
								Info/CiscoStats.pm
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,273 @@
 | 
			
		||||
# SNMP::Info::CiscoStats
 | 
			
		||||
# Max Baker <max@warped.org>
 | 
			
		||||
#
 | 
			
		||||
# Changes since Version 0.7 Copyright (c) 2004 Max Baker 
 | 
			
		||||
# All rights reserved.  
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2003 Regents of the University of California
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
# 
 | 
			
		||||
# Redistribution and use in source and binary forms, with or without 
 | 
			
		||||
# modification, are permitted provided that the following conditions are met:
 | 
			
		||||
# 
 | 
			
		||||
#     * Redistributions of source code must retain the above copyright notice,
 | 
			
		||||
#       this list of conditions and the following disclaimer.
 | 
			
		||||
#     * Redistributions in binary form must reproduce the above copyright notice,
 | 
			
		||||
#       this list of conditions and the following disclaimer in the documentation
 | 
			
		||||
#       and/or other materials provided with the distribution.
 | 
			
		||||
#     * Neither the name of the University of California, Santa Cruz nor the 
 | 
			
		||||
#       names of its contributors may be used to endorse or promote products 
 | 
			
		||||
#       derived from this software without specific prior written permission.
 | 
			
		||||
# 
 | 
			
		||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 | 
			
		||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
 | 
			
		||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
 | 
			
		||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 | 
			
		||||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 | 
			
		||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
 | 
			
		||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 | 
			
		||||
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
 | 
			
		||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::CiscoStats;
 | 
			
		||||
$VERSION = 0.8;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
use Exporter;
 | 
			
		||||
use SNMP::Info;
 | 
			
		||||
 | 
			
		||||
use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
 | 
			
		||||
@SNMP::Info::CiscoStats::ISA = qw/SNMP::Info Exporter/;
 | 
			
		||||
@SNMP::Info::CiscoStats::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
$DEBUG=0;
 | 
			
		||||
$SNMP::debugging=$DEBUG;
 | 
			
		||||
 | 
			
		||||
$INIT    = 0;
 | 
			
		||||
%MIBS    = (
 | 
			
		||||
            'RFC1213-MIB'           => 'sysDescr',
 | 
			
		||||
            'CISCO-PROCESS-MIB'     => 'cpmCPUTotal5sec',
 | 
			
		||||
            'CISCO-MEMORY-POOL-MIB' => 'ciscoMemoryPoolUsed' 
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
            'description'  => 'sysDescr',
 | 
			
		||||
            # We will use the numeric OID's so that we don't require people
 | 
			
		||||
            # to install v1 MIBs, which can conflict.
 | 
			
		||||
            # OLD-CISCO-CPU-MIB:avgBusyPer
 | 
			
		||||
            'ios_cpu'      => '1.3.6.1.4.1.9.2.1.56.0',
 | 
			
		||||
            'ios_cpu_1min' => '1.3.6.1.4.1.9.2.1.57.0',
 | 
			
		||||
            'ios_cpu_5min' => '1.3.6.1.4.1.9.2.1.58.0',
 | 
			
		||||
            # CISCO-PROCESS-MIB
 | 
			
		||||
            'cat_cpu'      => 'cpmCPUTotal5sec.9',
 | 
			
		||||
            'cat_cpu_1min' => 'cpmCPUTotal1min.9',
 | 
			
		||||
            'cat_cpu_5min' => 'cpmCPUTotal5min.9',
 | 
			
		||||
            # CISCO-MEMORY-POOL-MIB
 | 
			
		||||
            'mem_free'     => 'ciscoMemoryPoolFree.1',
 | 
			
		||||
            'mem_used'     => 'ciscoMemoryPoolUsed.1',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%FUNCS   = (
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%MUNGE   = (
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
sub os {
 | 
			
		||||
    my $l2 = shift;
 | 
			
		||||
    my $descr = $l2->description();
 | 
			
		||||
 | 
			
		||||
    # order here matters - there are Catalysts that run IOS and have catalyst in their description field.
 | 
			
		||||
    return 'ios'      if ($descr =~ /IOS/);
 | 
			
		||||
    return 'catalyst' if ($descr =~ /catalyst/i);
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os_ver {
 | 
			
		||||
    my $l2    = shift;
 | 
			
		||||
    my $os    = $l2->os();
 | 
			
		||||
    my $descr = $l2->description();
 | 
			
		||||
    
 | 
			
		||||
    # Older Catalysts
 | 
			
		||||
    if (defined $os and $os eq 'catalyst' and defined $descr and $descr =~ m/V(\d{1}\.\d{2}\.\d{2})/){
 | 
			
		||||
        return $1;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    # Newer Catalysts and IOS devices
 | 
			
		||||
    if (defined $descr and $descr =~ m/Version (\d+\.\d+\([^)]+\)[^,\s]*)(,|\s)+/ ){
 | 
			
		||||
        return $1;
 | 
			
		||||
    } 
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub cpu {
 | 
			
		||||
    my $self = shift;
 | 
			
		||||
    my $ios_cpu = $self->ios_cpu();
 | 
			
		||||
    return $ios_cpu if defined $ios_cpu;
 | 
			
		||||
    my $cat_cpu = $self->cat_cpu();
 | 
			
		||||
    return $cat_cpu;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub cpu_1min {
 | 
			
		||||
    my $self = shift;
 | 
			
		||||
    my $ios_cpu_1min = $self->ios_cpu_1min();
 | 
			
		||||
    return $ios_cpu_1min if defined $ios_cpu_1min;
 | 
			
		||||
    my $cat_cpu_1min = $self->cat_cpu_1min();
 | 
			
		||||
    return $cat_cpu_1min;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub cpu_5min {
 | 
			
		||||
    my $self = shift;
 | 
			
		||||
    my $ios_cpu_5min = $self->ios_cpu_5min();
 | 
			
		||||
    return $ios_cpu_5min if defined $ios_cpu_5min;
 | 
			
		||||
    my $cat_cpu_5min = $self->cat_cpu_5min();
 | 
			
		||||
    return $cat_cpu_5min;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub mem_total {
 | 
			
		||||
    my $self = shift;
 | 
			
		||||
    my $mem_free = $self->mem_free();
 | 
			
		||||
    my $mem_used = $self->mem_used();
 | 
			
		||||
    return undef unless defined $mem_free and defined $mem_used;
 | 
			
		||||
    return $mem_free + $mem_used;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
__END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::CiscoStats - Perl5 Interface to CPU and Memory stats for Cisco Devices
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
Max Baker (C<max@warped.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you. 
 | 
			
		||||
 my $ciscostats = new SNMP::Info(
 | 
			
		||||
                          AutoSpecify => 1,
 | 
			
		||||
                          Debug       => 1,
 | 
			
		||||
                          # These arguments are passed directly on to SNMP::Session
 | 
			
		||||
                          DestHost    => 'myswitch',
 | 
			
		||||
                          Community   => 'public',
 | 
			
		||||
                          Version     => 2
 | 
			
		||||
                        ) 
 | 
			
		||||
    or die "Can't connect to DestHost.\n";
 | 
			
		||||
 | 
			
		||||
 my $class      = $ciscostats->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
SNMP::Info::CiscoStats is a subclass of SNMP::Info that provides cpu, memory, os and
 | 
			
		||||
version information about Cisco Devices. 
 | 
			
		||||
 | 
			
		||||
Use or create in a subclass of SNMP::Info.  Do not use directly.
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
none.
 | 
			
		||||
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item CISCO-PROCESS-MIB
 | 
			
		||||
 | 
			
		||||
=item CISCO-MEMORY-POOL-MIB
 | 
			
		||||
 | 
			
		||||
=item RFC1213-MIB
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $ciscostats->cpu()
 | 
			
		||||
 | 
			
		||||
Returns ios_cpu() or cat_cpu(), whichever is available.
 | 
			
		||||
 | 
			
		||||
=item $ciscostats->cpu_1min()
 | 
			
		||||
 | 
			
		||||
Returns ios_cpu_1min() or cat_cpu1min(), whichever is available.
 | 
			
		||||
 | 
			
		||||
=item $ciscostats->cpu_5min()
 | 
			
		||||
 | 
			
		||||
Returns ios_cpu_5min() or cat_cpu5min(), whichever is available.
 | 
			
		||||
 | 
			
		||||
=item $ciscostats->mem_total()
 | 
			
		||||
 | 
			
		||||
Returns mem_free() + mem_used()
 | 
			
		||||
 | 
			
		||||
=item $ciscostats->os()
 | 
			
		||||
 | 
			
		||||
Trys to parse if device is running IOS or CatOS from description()
 | 
			
		||||
 | 
			
		||||
=item $ciscostats->os_ver()
 | 
			
		||||
 | 
			
		||||
Trys to parse device operating system version from description()
 | 
			
		||||
 | 
			
		||||
=item $ciscostats->ios_cpu()
 | 
			
		||||
 | 
			
		||||
Current CPU usage in percents of device.
 | 
			
		||||
 | 
			
		||||
B<1.3.6.1.4.1.9.2.1.56.0> = 
 | 
			
		||||
B<OLD-CISCO-CPU-MIB:avgBusyPer>
 | 
			
		||||
 | 
			
		||||
=item $ciscostats->ios_cpu_1min()
 | 
			
		||||
 | 
			
		||||
Average CPU Usage in percents of device over last minute.
 | 
			
		||||
 | 
			
		||||
B<1.3.6.1.4.1.9.2.1.57.0>
 | 
			
		||||
 | 
			
		||||
=item $ciscostats->ios_cpu_5min()
 | 
			
		||||
 | 
			
		||||
Average CPU Usage in percents of device over last 5 minutes.
 | 
			
		||||
 | 
			
		||||
B<1.3.6.1.4.1.9.2.1.58.0>
 | 
			
		||||
 | 
			
		||||
=item $ciscostats->cat_cpu()
 | 
			
		||||
 | 
			
		||||
Current CPU usage in percents of device.
 | 
			
		||||
 | 
			
		||||
B<CISCO-PROCESS-MIB::cpmCPUTotal5sec.9>
 | 
			
		||||
 | 
			
		||||
=item $ciscostats->cat_cpu_1min()
 | 
			
		||||
 | 
			
		||||
Average CPU Usage in percents of device over last minute.
 | 
			
		||||
 | 
			
		||||
B<CISCO-PROCESS-MIB::cpmCPUTotal1min.9>
 | 
			
		||||
 | 
			
		||||
=item $ciscostats->cat_cpu_5min()
 | 
			
		||||
 | 
			
		||||
Average CPU Usage in percents of device over last 5 minutes.
 | 
			
		||||
 | 
			
		||||
B<CISCO-PROCESS-MIB::cpmCPUTotal5min.9>
 | 
			
		||||
 | 
			
		||||
=item $ciscostats->mem_free()
 | 
			
		||||
 | 
			
		||||
Main DRAM free in device.  In bytes.
 | 
			
		||||
 | 
			
		||||
B<CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolFree.1>
 | 
			
		||||
 | 
			
		||||
=item $ciscostats->mem_used()
 | 
			
		||||
 | 
			
		||||
Main DRAM used in device.  In bytes.
 | 
			
		||||
 | 
			
		||||
B<CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolUsed.1>
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 TABLE METHODS
 | 
			
		||||
 | 
			
		||||
None.
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
							
								
								
									
										377
									
								
								Info/CiscoVTP.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										377
									
								
								Info/CiscoVTP.pm
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,377 @@
 | 
			
		||||
# SNMP::Info::CiscoVTP
 | 
			
		||||
# Max Baker <max@warped.org>
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2003 Regents of the University of California
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
# 
 | 
			
		||||
# Redistribution and use in source and binary forms, with or without 
 | 
			
		||||
# modification, are permitted provided that the following conditions are met:
 | 
			
		||||
# 
 | 
			
		||||
#     * Redistributions of source code must retain the above copyright notice,
 | 
			
		||||
#       this list of conditions and the following disclaimer.
 | 
			
		||||
#     * Redistributions in binary form must reproduce the above copyright notice,
 | 
			
		||||
#       this list of conditions and the following disclaimer in the documentation
 | 
			
		||||
#       and/or other materials provided with the distribution.
 | 
			
		||||
#     * Neither the name of the University of California, Santa Cruz nor the 
 | 
			
		||||
#       names of its contributors may be used to endorse or promote products 
 | 
			
		||||
#       derived from this software without specific prior written permission.
 | 
			
		||||
# 
 | 
			
		||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 | 
			
		||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
 | 
			
		||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
 | 
			
		||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 | 
			
		||||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 | 
			
		||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
 | 
			
		||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 | 
			
		||||
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
 | 
			
		||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::CiscoVTP;
 | 
			
		||||
$VERSION = 0.8;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
use Exporter;
 | 
			
		||||
use SNMP::Info;
 | 
			
		||||
 | 
			
		||||
use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
 | 
			
		||||
@SNMP::Info::CiscoVTP::ISA = qw/SNMP::Info Exporter/;
 | 
			
		||||
@SNMP::Info::CiscoVTP::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
$DEBUG=0;
 | 
			
		||||
$SNMP::debugging=$DEBUG;
 | 
			
		||||
 | 
			
		||||
$INIT    = 0;
 | 
			
		||||
%MIBS    = (
 | 
			
		||||
            'CISCO-VTP-MIB'             => 'vtpVlanName',
 | 
			
		||||
            'CISCO-VLAN-MEMBERSHIP-MIB' => 'vmMembershipEntry',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
            'vtp_version'           => 'vtpVersion',
 | 
			
		||||
            'vtp_maxstore'          => 'vtpMaxVlanStorage',
 | 
			
		||||
            'vtp_notify'            => 'vtpNotificationsEnabled',
 | 
			
		||||
            'vtp_notify_create'     => 'vtpVlanCreatedNotifEnabled',
 | 
			
		||||
            'vtp_notify_delete'     => 'vtpVlanDeletedNotifEnabled',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%FUNCS   = (
 | 
			
		||||
            # Management Domain Table
 | 
			
		||||
            'vtp_d_index'     => 'managementDomainIndex',
 | 
			
		||||
            'vtp_d_name'      => 'managementDomainName',
 | 
			
		||||
            'vtp_d_mode'      => 'managementDomainLocalMode',
 | 
			
		||||
            'vtp_d_rev'       => 'managementDomainConfigRevNumber',
 | 
			
		||||
            'vtp_d_updater'   => 'managementDomainLastUpdater',
 | 
			
		||||
            'vtp_d_last'      => 'managementDomainLastChange',
 | 
			
		||||
            'vtp_d_status'    => 'managementDomainRowStatus',
 | 
			
		||||
            'vtp_d_tftp'      => 'managementDomainTftpServer',
 | 
			
		||||
            'vtp_d_tftp_path' => 'managementDomainTftpPathname',
 | 
			
		||||
            'vtp_d_pruning'   => 'managementDomainPruningState',
 | 
			
		||||
            'vtp_d_ver'       => 'managementDomainVersionInUse',
 | 
			
		||||
            #  VLAN Table
 | 
			
		||||
            'v_index'    => 'vtpVlanIndex',
 | 
			
		||||
            'v_state'    => 'vtpVlanState',
 | 
			
		||||
            'v_type'     => 'vtpVlanType',
 | 
			
		||||
            'v_name'     => 'vtpVlanName',
 | 
			
		||||
            'v_mtu'      => 'vtpVlanMtu',
 | 
			
		||||
            'v_said'     => 'vtpVlanDot10Said',
 | 
			
		||||
            'v_ring'     => 'vtpVlanRingNumber',
 | 
			
		||||
            'v_bridge'   => 'vtpVlanBridgeNumber',
 | 
			
		||||
            'v_stp'      => 'vtpVlanStpType',
 | 
			
		||||
            'v_parent'   => 'vtpVlanParentVlan',
 | 
			
		||||
            'v_trans1'   => 'vtpVlanTranslationalVlan1',
 | 
			
		||||
            'v_trans2'   => 'vtpVlanTranslationalVlan2',
 | 
			
		||||
            'v_btype'    => 'vtpVlanBridgeType',
 | 
			
		||||
            'v_hop_are'  => 'vtpVlanAreHopCount',
 | 
			
		||||
            'v_hop_ste'  => 'vtpVlanSteHopCount',
 | 
			
		||||
            'v_crf'      => 'vtpVlanIsCRFBackup',
 | 
			
		||||
            'v_type_ext' => 'vtpVlanTypeExt',
 | 
			
		||||
            'v_if'       => 'vtpVlanIfIndex',
 | 
			
		||||
 | 
			
		||||
            # CISCO-VLAN-MEMBERSHIP-MIB
 | 
			
		||||
            # VmMembershipTable
 | 
			
		||||
            'i_vlan_type' => 'vmVlanType',
 | 
			
		||||
            'i_vlan'      => 'vmVlan',
 | 
			
		||||
            'i_vlan_stat' => 'vmPortStatus',
 | 
			
		||||
            'i_vlan_1'    => 'vmVlans',
 | 
			
		||||
            'i_vlan_2'    => 'vmVlans2k',
 | 
			
		||||
            'i_vlan_3'    => 'vmVlans3k',
 | 
			
		||||
            'i_vlan_4'    => 'vmVlans4k',
 | 
			
		||||
            # TODO Add these tables if someone wants them..
 | 
			
		||||
            # vtpEditControlTable
 | 
			
		||||
            # vtpVlanEditTable
 | 
			
		||||
            # vtpStatsTable
 | 
			
		||||
            # vlanTrunkPortTable
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%MUNGE   = (
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
__END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::CiscoVTP - Perl5 Interface to Cisco's VLAN Management MIB - CISCO-VTP-MIB
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
Max Baker (C<max@warped.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you. 
 | 
			
		||||
 my $vtp = new SNMP::Info(
 | 
			
		||||
                          AutoSpecify => 1,
 | 
			
		||||
                          Debug       => 1,
 | 
			
		||||
                          # These arguments are passed directly on to SNMP::Session
 | 
			
		||||
                          DestHost    => 'myswitch',
 | 
			
		||||
                          Community   => 'public',
 | 
			
		||||
                          Version     => 2
 | 
			
		||||
                        ) 
 | 
			
		||||
    or die "Can't connect to DestHost.\n";
 | 
			
		||||
 | 
			
		||||
 my $class      = $vtp->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
SNMP::Info::CiscoVTP is a subclass of SNMP::Info that provides 
 | 
			
		||||
information about a switch's VLANs.
 | 
			
		||||
 | 
			
		||||
Use or create in a subclass of SNMP::Info.  Do not use directly.
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
none.
 | 
			
		||||
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item CISCO-VTP-MIB
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $vtp->vtp_version()
 | 
			
		||||
 | 
			
		||||
C<vtpVersion>
 | 
			
		||||
 | 
			
		||||
=item $vtp->vtp_maxstore()
 | 
			
		||||
 | 
			
		||||
C<vtpMaxVlanStorage>
 | 
			
		||||
 | 
			
		||||
=item $vtp->vtp_notify()
 | 
			
		||||
 | 
			
		||||
C<vtpNotificationsEnabled>
 | 
			
		||||
 | 
			
		||||
=item $vtp->vtp_notify_create()
 | 
			
		||||
 | 
			
		||||
C<vtpVlanCreatedNotifEnabled>
 | 
			
		||||
 | 
			
		||||
=item $vtp->vtp_notify_delete()
 | 
			
		||||
 | 
			
		||||
C<vtpVlanDeletedNotifEnabled>
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 TABLE METHODS
 | 
			
		||||
 | 
			
		||||
You device will only implement a subset of these methods.
 | 
			
		||||
 | 
			
		||||
=head2 VLAN Table
 | 
			
		||||
 | 
			
		||||
See ftp://ftp.cisco.com/pub/mibs/supportlists/wsc5000/wsc5000-communityIndexing.html
 | 
			
		||||
for a good treaty of how to connect to the VLANs
 | 
			
		||||
 | 
			
		||||
This table is from CISCO-VTP-MIB::vtpVlanTable
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $vtp->v_index()
 | 
			
		||||
 | 
			
		||||
C<vtpVlanIndex>
 | 
			
		||||
 | 
			
		||||
=item $vtp->v_state()
 | 
			
		||||
 | 
			
		||||
C<vtpVlanState>
 | 
			
		||||
 | 
			
		||||
=item $vtp->v_type()
 | 
			
		||||
 | 
			
		||||
C<vtpVlanType>
 | 
			
		||||
 | 
			
		||||
=item $vtp->v_name()
 | 
			
		||||
 | 
			
		||||
C<vtpVlanName>
 | 
			
		||||
 | 
			
		||||
=item $vtp->v_mtu()
 | 
			
		||||
 | 
			
		||||
C<vtpVlanMtu>
 | 
			
		||||
 | 
			
		||||
=item $vtp->v_said()
 | 
			
		||||
 | 
			
		||||
C<vtpVlanDot10Said>
 | 
			
		||||
 | 
			
		||||
=item $vtp->v_ring()
 | 
			
		||||
 | 
			
		||||
C<vtpVlanRingNumber>
 | 
			
		||||
 | 
			
		||||
=item $vtp->v_bridge()
 | 
			
		||||
 | 
			
		||||
C<vtpVlanBridgeNumber>
 | 
			
		||||
 | 
			
		||||
=item $vtp->v_stp()
 | 
			
		||||
 | 
			
		||||
C<vtpVlanStpType>
 | 
			
		||||
 | 
			
		||||
=item $vtp->v_parent()
 | 
			
		||||
 | 
			
		||||
C<vtpVlanParentVlan>
 | 
			
		||||
 | 
			
		||||
=item $vtp->v_trans1()
 | 
			
		||||
 | 
			
		||||
C<vtpVlanTranslationalVlan1>
 | 
			
		||||
 | 
			
		||||
=item $vtp->v_trans2()
 | 
			
		||||
 | 
			
		||||
C<vtpVlanTranslationalVlan2>
 | 
			
		||||
 | 
			
		||||
=item $vtp->v_btype()
 | 
			
		||||
 | 
			
		||||
C<vtpVlanBridgeType>
 | 
			
		||||
 | 
			
		||||
=item $vtp->v_hop_are()
 | 
			
		||||
 | 
			
		||||
C<vtpVlanAreHopCount>
 | 
			
		||||
 | 
			
		||||
=item $vtp->v_hop_ste()
 | 
			
		||||
 | 
			
		||||
C<vtpVlanSteHopCount>
 | 
			
		||||
 | 
			
		||||
=item $vtp->v_crf()
 | 
			
		||||
 | 
			
		||||
C<vtpVlanIsCRFBackup>
 | 
			
		||||
 | 
			
		||||
=item $vtp->v_type_ext()
 | 
			
		||||
 | 
			
		||||
C<vtpVlanTypeExt>
 | 
			
		||||
 | 
			
		||||
=item $vtp->v_if()
 | 
			
		||||
 | 
			
		||||
C<vtpVlanIfIndex>
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 VLAN Interface Table
 | 
			
		||||
 | 
			
		||||
This table is from CISCO-VLAN-MEMBERSHIP-MIB::VmMembershipTable
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $vtp->i_vlan_type()
 | 
			
		||||
 | 
			
		||||
Static, Dynamic, or multiVlan.  
 | 
			
		||||
 | 
			
		||||
C<vmVlanType>
 | 
			
		||||
 | 
			
		||||
=item $vtp->i_vlan()
 | 
			
		||||
 | 
			
		||||
The VLAN that a port is assigned to.
 | 
			
		||||
 | 
			
		||||
0 for no VLAN assigned. 
 | 
			
		||||
 | 
			
		||||
C<vmVlan>
 | 
			
		||||
 | 
			
		||||
=item $vtp->i_vlan_stat()
 | 
			
		||||
 | 
			
		||||
Inactive, active, shutdown.
 | 
			
		||||
 | 
			
		||||
C<vmPortStatus>
 | 
			
		||||
 | 
			
		||||
=item $vtp->i_vlan_1()
 | 
			
		||||
 | 
			
		||||
Each bit represents a VLAN.  This is 0 through 1023
 | 
			
		||||
 | 
			
		||||
C<vmVlans>
 | 
			
		||||
 | 
			
		||||
=item $vtp->i_vlan_2()
 | 
			
		||||
 | 
			
		||||
Each bit represents a VLAN.  This is 1024 through 2047
 | 
			
		||||
 | 
			
		||||
C<vmVlans2k>
 | 
			
		||||
 | 
			
		||||
=item $vtp->i_vlan_3()
 | 
			
		||||
 | 
			
		||||
Each bit represents a VLAN.  This is 2048 through 3071
 | 
			
		||||
 | 
			
		||||
C<vmVlans3k>
 | 
			
		||||
 | 
			
		||||
=item $vtp->i_vlan_4()
 | 
			
		||||
 | 
			
		||||
Each bit represents a VLAN.  This is 3072 through 4095
 | 
			
		||||
 | 
			
		||||
C<vmVlans4k>
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Managment Domain Table
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $vtp->vtp_d_index()
 | 
			
		||||
 | 
			
		||||
C<managementDomainIndex>
 | 
			
		||||
 | 
			
		||||
=item $vtp->vtp_d_name()
 | 
			
		||||
 | 
			
		||||
C<managementDomainName>
 | 
			
		||||
 | 
			
		||||
=item $vtp->vtp_d_mode()
 | 
			
		||||
 | 
			
		||||
C<managementDomainLocalMode>
 | 
			
		||||
 | 
			
		||||
=item $vtp->vtp_d_rev()
 | 
			
		||||
 | 
			
		||||
C<managementDomainConfigRevNumber>
 | 
			
		||||
 | 
			
		||||
=item $vtp->vtp_d_updater()
 | 
			
		||||
 | 
			
		||||
C<managementDomainLastUpdater>
 | 
			
		||||
 | 
			
		||||
=item $vtp->vtp_d_last()
 | 
			
		||||
 | 
			
		||||
C<managementDomainLastChange>
 | 
			
		||||
 | 
			
		||||
=item $vtp->vtp_d_status()
 | 
			
		||||
 | 
			
		||||
C<managementDomainRowStatus>
 | 
			
		||||
 | 
			
		||||
=item $vtp->vtp_d_tftp()
 | 
			
		||||
 | 
			
		||||
C<managementDomainTftpServer>
 | 
			
		||||
 | 
			
		||||
=item $vtp->vtp_d_tftp_path()
 | 
			
		||||
 | 
			
		||||
C<managementDomainTftpPathname>
 | 
			
		||||
 | 
			
		||||
=item $vtp->vtp_d_pruning()
 | 
			
		||||
 | 
			
		||||
C<managementDomainPruningState>
 | 
			
		||||
 | 
			
		||||
=item $vtp->vtp_d_ver()
 | 
			
		||||
 | 
			
		||||
C<managementDomainVersionInUse>
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
							
								
								
									
										200
									
								
								Info/Entity.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										200
									
								
								Info/Entity.pm
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,200 @@
 | 
			
		||||
# SNMP::Info::Entity
 | 
			
		||||
# Max Baker <max@warped.org>
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2003 Regents of the University of California
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
# 
 | 
			
		||||
# Redistribution and use in source and binary forms, with or without 
 | 
			
		||||
# modification, are permitted provided that the following conditions are met:
 | 
			
		||||
# 
 | 
			
		||||
#     * Redistributions of source code must retain the above copyright notice,
 | 
			
		||||
#       this list of conditions and the following disclaimer.
 | 
			
		||||
#     * Redistributions in binary form must reproduce the above copyright notice,
 | 
			
		||||
#       this list of conditions and the following disclaimer in the documentation
 | 
			
		||||
#       and/or other materials provided with the distribution.
 | 
			
		||||
#     * Neither the name of the University of California, Santa Cruz nor the 
 | 
			
		||||
#       names of its contributors may be used to endorse or promote products 
 | 
			
		||||
#       derived from this software without specific prior written permission.
 | 
			
		||||
# 
 | 
			
		||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 | 
			
		||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
 | 
			
		||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
 | 
			
		||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 | 
			
		||||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 | 
			
		||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
 | 
			
		||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 | 
			
		||||
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
 | 
			
		||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::Entity;
 | 
			
		||||
$VERSION = 0.8;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
use Exporter;
 | 
			
		||||
use SNMP::Info;
 | 
			
		||||
 | 
			
		||||
use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
 | 
			
		||||
@SNMP::Info::Entity::ISA = qw/SNMP::Info Exporter/;
 | 
			
		||||
@SNMP::Info::Entity::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
$INIT    = 0;
 | 
			
		||||
%MIBS    = ('ENTITY-MIB' => 'entPhysicalSerialNum');
 | 
			
		||||
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%FUNCS   = (
 | 
			
		||||
            'e_class'   => 'entPhysicalClass',
 | 
			
		||||
            'e_descr'   => 'entPhysicalDescr',
 | 
			
		||||
            'e_fwver'   => 'entPhysicalFirmwareRev',
 | 
			
		||||
            'e_hwver'   => 'entPhysicalHardwareRev',
 | 
			
		||||
            'e_map'     => 'entAliasMappingIdentifier',
 | 
			
		||||
            'e_model'   => 'entPhysicalModelName',
 | 
			
		||||
            'e_name'    => 'entPhysicalName',
 | 
			
		||||
            'e_parent'  => 'entPhysicalContainedIn',
 | 
			
		||||
            'e_serial'  => 'entPhysicalSerialNum',
 | 
			
		||||
            'e_swver'   => 'entPhysicalSoftwareRev',
 | 
			
		||||
            'e_type'    => 'entPhysicalVendorType',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%MUNGE   = (
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
sub e_port {
 | 
			
		||||
    my $entity = shift;
 | 
			
		||||
    my $e_map  = $entity->e_map();
 | 
			
		||||
 | 
			
		||||
    my %e_port;
 | 
			
		||||
 | 
			
		||||
    foreach my $e_id (keys %$e_map) {
 | 
			
		||||
        my $id = $e_id;
 | 
			
		||||
        $id =~ s/\.0$//;
 | 
			
		||||
 | 
			
		||||
        my $iid = $e_map->{$e_id};
 | 
			
		||||
        $iid =~ s/.*\.//;
 | 
			
		||||
 | 
			
		||||
        $e_port{$id} = $iid;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return \%e_port;
 | 
			
		||||
}
 | 
			
		||||
1;
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::Entity - Perl5 Interface to SNMP data stored in ENTITY-MIB.
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
Max Baker (C<max@warped.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you. 
 | 
			
		||||
 my $entity = new SNMP::Info(
 | 
			
		||||
                          AutoSpecify => 1,
 | 
			
		||||
                          Debug       => 1,
 | 
			
		||||
                          # These arguments are passed directly on to SNMP::Session
 | 
			
		||||
                          DestHost    => 'myswitch',
 | 
			
		||||
                          Community   => 'public',
 | 
			
		||||
                          Version     => 2
 | 
			
		||||
                        ) 
 | 
			
		||||
    or die "Can't connect to DestHost.\n";
 | 
			
		||||
 | 
			
		||||
 my $class      = $entity->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
ENTITY-MIB is used by some Layer 2 devices like HP Switches and Aironet Access Points
 | 
			
		||||
 | 
			
		||||
Create or use a device subclass that inherit this class.  Do not use directly.
 | 
			
		||||
 | 
			
		||||
For debugging purposes you can call this class directly as you would SNMP::Info
 | 
			
		||||
 | 
			
		||||
 my $entity = new SNMP::Info::Entity (...);
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
none.
 | 
			
		||||
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item ENTITY-MIB
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
none.
 | 
			
		||||
 | 
			
		||||
=head1 TABLE METHODS
 | 
			
		||||
 | 
			
		||||
These are methods that return tables of information in the form of a reference
 | 
			
		||||
to a hash.
 | 
			
		||||
 | 
			
		||||
=head2 Entity Table
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $entity->e_class()
 | 
			
		||||
 | 
			
		||||
(C<entPhysicalClass>)
 | 
			
		||||
 | 
			
		||||
=item $entity->e_descr()
 | 
			
		||||
 | 
			
		||||
(C<entPhysicalClass>)
 | 
			
		||||
 | 
			
		||||
=item $entity->e_fwver()
 | 
			
		||||
 | 
			
		||||
(C<entPhysicalFirmwareRev>)
 | 
			
		||||
 | 
			
		||||
=item $entity->e_hwver()
 | 
			
		||||
 | 
			
		||||
(C<entPhysicalHardwareRev>)
 | 
			
		||||
 | 
			
		||||
=item $entity->e_map()
 | 
			
		||||
 | 
			
		||||
(C<entAliasMappingIdentifier>)
 | 
			
		||||
 | 
			
		||||
=item $entity->e_model()
 | 
			
		||||
 | 
			
		||||
(C<entPhysicalModelName>)
 | 
			
		||||
 | 
			
		||||
=item $entity->e_name()
 | 
			
		||||
 | 
			
		||||
(C<entPhysicalName>)
 | 
			
		||||
 | 
			
		||||
=item $entity->e_parent()
 | 
			
		||||
 | 
			
		||||
(C<entPhysicalContainedIn>)
 | 
			
		||||
 | 
			
		||||
=item $entity->e_port()
 | 
			
		||||
 | 
			
		||||
Maps EntityTable entries to the Interface Table (IfTable) using
 | 
			
		||||
$entity->e_map()
 | 
			
		||||
 | 
			
		||||
=item $entity->e_serial()
 | 
			
		||||
 | 
			
		||||
(C<entPhysicalSerialNum>)
 | 
			
		||||
 | 
			
		||||
=item $entity->e_swver()
 | 
			
		||||
 | 
			
		||||
(C<entPhysicalSoftwareRev>)
 | 
			
		||||
 | 
			
		||||
=item $entity->e_type()
 | 
			
		||||
 | 
			
		||||
(C<entPhysicalVendorType>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
@@ -1,6 +1,8 @@
 | 
			
		||||
# SNMP::Info::EtherLike
 | 
			
		||||
# Max Baker <max@warped.org>
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2002,2003 Regents of the University of California
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
# 
 | 
			
		||||
@@ -28,7 +30,7 @@
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::EtherLike;
 | 
			
		||||
$VERSION = 0.3;
 | 
			
		||||
$VERSION = 0.8;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
@@ -52,8 +54,25 @@ $INIT = 0;
 | 
			
		||||
 | 
			
		||||
%FUNCS = (
 | 
			
		||||
          # EtherLike StatsTable
 | 
			
		||||
          'el_index'  => 'dot3StatsIndex',
 | 
			
		||||
          'el_duplex' => 'dot3StatsDuplexStatus',
 | 
			
		||||
          'el_chipset'         => 'dot3StatsEtherChipSet',
 | 
			
		||||
          'el_coll_excess'     => 'dot3StatsExcessiveCollisions',
 | 
			
		||||
          'el_coll_late'       => 'dot3StatsLateCollisions',
 | 
			
		||||
          'el_coll_mult'       => 'dot3StatsMultipleCollisionFrames',
 | 
			
		||||
          'el_coll_single'     => 'dot3StatsSingleCollisionFrames',
 | 
			
		||||
          'el_duplex'          => 'dot3StatsDuplexStatus',
 | 
			
		||||
          'el_error_alignment' => 'dot3StatsAlignmentErrors',
 | 
			
		||||
          'el_error_fcs'       => 'dot3StatsFCSErrors',
 | 
			
		||||
          'el_error_cs'        => 'dot3StatsCarrierSenseErrors',
 | 
			
		||||
          'el_error_frame'     => 'dot3StatsFrameTooLongs',
 | 
			
		||||
          'el_error_mac_rec'   => 'dot3StatsInternalMacReceiveErrors',
 | 
			
		||||
          'el_error_mac_xmit'  => 'dot3StatsInternalMacTransmitErrors',
 | 
			
		||||
          'el_error_sqe'       => 'dot3StatsSQETestErrors',
 | 
			
		||||
          'el_error_symbol'    => 'dot3StatsSymbolErrors',
 | 
			
		||||
          'el_index'           => 'dot3StatsIndex',
 | 
			
		||||
          'el_xmit_defer'      => 'dot3StatsDeferredTransmissions',
 | 
			
		||||
          # Ethernet-like Collision Statistics Group
 | 
			
		||||
          'el_coll_count'      => 'dot3CollCount',
 | 
			
		||||
          'el_coll_freq'       => 'dot3CollFrequencies'
 | 
			
		||||
          );
 | 
			
		||||
 | 
			
		||||
%MUNGE = ( %SNMP::Info::MUNGE );
 | 
			
		||||
@@ -66,52 +85,77 @@ __END__
 | 
			
		||||
 | 
			
		||||
SNMP::Info::EtherLike - Perl5 Interface to SNMP ETHERLIKE-MIB 
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
SNMP::Info::EtherLike is a subclass of SNMP::Info that supplies 
 | 
			
		||||
access to the ETHERLIKE-MIB used by some Layer 3 Devices such as Cisco routers.
 | 
			
		||||
 | 
			
		||||
Use SNMP::Info directly, or create a subclass that inherits this one.
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
Max Baker (C<max@warped.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 my $el = new SNMP::Info::EtherLike(DestHost  => 'myrouter',
 | 
			
		||||
                                    Community => 'public');
 | 
			
		||||
 my $el = new SNMP::Info ( 
 | 
			
		||||
                             AutoSpecify => 1,
 | 
			
		||||
                             Debug       => 1,
 | 
			
		||||
                             DestHost    => 'router', 
 | 
			
		||||
                             Community   => 'public',
 | 
			
		||||
                             Version     => 2
 | 
			
		||||
                           );
 | 
			
		||||
 
 | 
			
		||||
 my $class = $cdp->class();
 | 
			
		||||
 print " Using device sub class : $class\n";
 | 
			
		||||
 | 
			
		||||
 my $el_decoder = $el->el_index();
 | 
			
		||||
 my $el_duplex = $el->el_duplex(); 
 | 
			
		||||
 # Find the duplex setting for a port on a device that implements ETHERLIKE-MIB
 | 
			
		||||
 my $interfaces = $el->interfaces();
 | 
			
		||||
 my $el_index   = $el->el_index();
 | 
			
		||||
 my $el_duplex  = $el->el_duplex(); 
 | 
			
		||||
 | 
			
		||||
=head1 CREATING AN OBJECT
 | 
			
		||||
 foreach my $el_port (keys %$el_duplex){
 | 
			
		||||
    my $duplex = $el_duplex->{$el_port};
 | 
			
		||||
    my $iid    = $el_index->{$el_port};
 | 
			
		||||
    my $port   = $interfaces->{$iid};
 | 
			
		||||
 | 
			
		||||
    $duplex = 'half' if $duplex =~/half/i;
 | 
			
		||||
    $duplex = 'full' if $duplex =~/full/i;
 | 
			
		||||
    $duplex = 'auto' if $duplex =~/auto/i;
 | 
			
		||||
 | 
			
		||||
    print "PORT:$port set to duplex:$duplex\n";
 | 
			
		||||
 }
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
SNMP::Info::EtherLike is a subclass of SNMP::Info that supplies 
 | 
			
		||||
access to the ETHERLIKE-MIB used by some Layer 3 Devices such as Cisco routers.
 | 
			
		||||
 | 
			
		||||
Use or create a subclass of SNMP::Info that inherits this one.  Do not use directly.
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
None.  
 | 
			
		||||
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item  new SNMP::Info::EtherLike()
 | 
			
		||||
 | 
			
		||||
Arguments passed to new() are passed on to SNMP::Session::new()
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    my $el = new SNMP::Info::EtherLike(
 | 
			
		||||
        DestHost => $host,
 | 
			
		||||
        Community => 'public',
 | 
			
		||||
        Version => 3,...
 | 
			
		||||
        ) 
 | 
			
		||||
    die "Couldn't connect.\n" unless defined $el;
 | 
			
		||||
=item ETHERLIKE-MIB
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar values from SNMP
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item None
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 ETHERLIKE STATS TABLE (dot3StatsTable)
 | 
			
		||||
=head1 TABLE METHODS
 | 
			
		||||
 | 
			
		||||
These are methods that return tables of information in the form of a reference
 | 
			
		||||
to a hash.
 | 
			
		||||
 | 
			
		||||
=head2 ETHERLIKE STATS TABLE (dot3StatsTable)
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
@@ -127,6 +171,70 @@ Returns reference to hash.  Indexes Stats Table to Duplex Status of port.
 | 
			
		||||
 | 
			
		||||
(B<dot3StatsDuplexStatus>)
 | 
			
		||||
 | 
			
		||||
=item $el->el_chipset()
 | 
			
		||||
 | 
			
		||||
(B<dot3StatsEtherChipSet>)
 | 
			
		||||
 | 
			
		||||
=item $el->el_coll_excess()
 | 
			
		||||
 | 
			
		||||
(B<dot3StatsExcessiveCollisions>)
 | 
			
		||||
 | 
			
		||||
=item $el->el_coll_late()
 | 
			
		||||
 | 
			
		||||
(B<dot3StatsLateCollisions>)
 | 
			
		||||
 | 
			
		||||
=item $el->el_coll_mult()
 | 
			
		||||
 | 
			
		||||
(B<dot3StatsMultipleCollisionFrames>)
 | 
			
		||||
 | 
			
		||||
=item $el->el_coll_single()
 | 
			
		||||
 | 
			
		||||
(B<dot3StatsSingleCollisionFrames>)
 | 
			
		||||
 | 
			
		||||
=item $el->el_error_alignment()
 | 
			
		||||
 | 
			
		||||
(B<dot3StatsAlignmentErrors>)
 | 
			
		||||
 | 
			
		||||
=item $el->el_error_fcs()
 | 
			
		||||
 | 
			
		||||
(B<dot3StatsFCSErrors>)
 | 
			
		||||
 | 
			
		||||
=item $el->el_error_cs()
 | 
			
		||||
 | 
			
		||||
(B<dot3StatsCarrierSenseErrors>)
 | 
			
		||||
 | 
			
		||||
=item $el->el_error_frame()
 | 
			
		||||
 | 
			
		||||
(B<dot3StatsFrameTooLongs>)
 | 
			
		||||
 | 
			
		||||
=item $el->el_error_mac_rec()
 | 
			
		||||
 | 
			
		||||
(B<dot3StatsInternalMacReceiveErrors>)
 | 
			
		||||
 | 
			
		||||
=item $el->el_error_mac_xmit()
 | 
			
		||||
 | 
			
		||||
(B<dot3StatsInternalMacTransmitErrors>)
 | 
			
		||||
 | 
			
		||||
=item $el->el_error_sqe()
 | 
			
		||||
 | 
			
		||||
(B<dot3StatsSQETestErrors>)
 | 
			
		||||
 | 
			
		||||
=item $el->el_error_symbol()
 | 
			
		||||
 | 
			
		||||
(B<dot3StatsSymbolErrors>)
 | 
			
		||||
 | 
			
		||||
=item $el->el_xmit_defer()
 | 
			
		||||
 | 
			
		||||
(B<dot3StatsDeferredTransmissions>)
 | 
			
		||||
 | 
			
		||||
=item $el->el_coll_count()
 | 
			
		||||
 | 
			
		||||
(B<dot3CollCount>)
 | 
			
		||||
 | 
			
		||||
=item $el->el_coll_freq()
 | 
			
		||||
 | 
			
		||||
(B<dot3CollFrequencies>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										114
									
								
								Info/Layer1.pm
									
									
									
									
									
								
							
							
						
						
									
										114
									
								
								Info/Layer1.pm
									
									
									
									
									
								
							@@ -1,6 +1,8 @@
 | 
			
		||||
# SNMP::Info::Layer1 - SNMP Interface to Layer1 Devices 
 | 
			
		||||
# Max Baker <max@warped.org>
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2002,2003 Regents of the University of California
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
# 
 | 
			
		||||
@@ -28,7 +30,7 @@
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::Layer1;
 | 
			
		||||
$VERSION = 0.3;
 | 
			
		||||
$VERSION = 0.8;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
@@ -163,22 +165,7 @@ __END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::Layer1 - Perl5 Interface to Layer1 network devices.
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Provides abstraction to the configuration information obtainable from a 
 | 
			
		||||
Layer1 device through SNMP.  Information is stored in a number of MIBs.
 | 
			
		||||
 | 
			
		||||
Inherits from: 
 | 
			
		||||
 | 
			
		||||
 SNMP::Info
 | 
			
		||||
 | 
			
		||||
MIBS: 
 | 
			
		||||
 | 
			
		||||
 MIBS listed in SNMP::Info
 | 
			
		||||
 | 
			
		||||
Cisco MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
 | 
			
		||||
SNMP::Info::Layer1 - Perl5 Interface to network devices serving Layer1 only.
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
@@ -186,34 +173,72 @@ Max Baker (C<max@warped.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 my $l1 = new SNMP::Info::Layer1(DestHost  => 'mybridge' , 
 | 
			
		||||
                              Community => 'public' ); 
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you. 
 | 
			
		||||
 my $l1 = new SNMP::Info(
 | 
			
		||||
                          AutoSpecify => 1,
 | 
			
		||||
                          Debug       => 1,
 | 
			
		||||
                          # These arguments are passed directly on to SNMP::Session
 | 
			
		||||
                          DestHost    => 'myswitch',
 | 
			
		||||
                          Community   => 'public',
 | 
			
		||||
                          Version     => 1
 | 
			
		||||
                        ) 
 | 
			
		||||
    or die "Can't connect to DestHost.\n";
 | 
			
		||||
 | 
			
		||||
=head1 CREATING AN OBJECT
 | 
			
		||||
 my $class      = $l1->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
 # Let's get some basic Port information
 | 
			
		||||
 my $interfaces = $l1->interfaces();
 | 
			
		||||
 my $i_up       = $l1->i_up();
 | 
			
		||||
 my $i_speed    = $l1->i_speed();
 | 
			
		||||
 | 
			
		||||
 foreach my $iid (keys %$interfaces) {
 | 
			
		||||
    my $port  = $interfaces->{$iid};
 | 
			
		||||
    my $up    = $i_up->{$iid};
 | 
			
		||||
    my $speed = $i_speed->{$iid}
 | 
			
		||||
    print "Port $port is $up. Port runs at $speed.\n";
 | 
			
		||||
 }
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
This class is usually used as a superclass for more specific device classes listed under 
 | 
			
		||||
SNMP::Info::Layer1::*   Please read all docs under SNMP::Info first.
 | 
			
		||||
 | 
			
		||||
Provides abstraction to the configuration information obtainable from a 
 | 
			
		||||
Layer1 device through SNMP.  Information is stored in a number of MIBs.
 | 
			
		||||
 | 
			
		||||
For speed or debugging purposes you can call the subclass directly, but not after determining
 | 
			
		||||
a more specific class using the method above. 
 | 
			
		||||
 | 
			
		||||
 my $l1 = new SNMP::Info::Layer1(...);
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes 
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item  new SNMP::Info::Layer1()
 | 
			
		||||
 | 
			
		||||
Arguments passed to new() are passed on to SNMP::Session::new()
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    my $l1 = new SNMP::Info::Layer1(
 | 
			
		||||
        DestHost => $host,
 | 
			
		||||
        Community => 'public',
 | 
			
		||||
        Version => 3,...
 | 
			
		||||
        ) 
 | 
			
		||||
    die "Couldn't connect.\n" unless defined $l1;
 | 
			
		||||
=item SNMP::Info
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
=head2 Required MIBs 
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $l1->vendor()
 | 
			
		||||
=item SNMP-REPEATER-MIB
 | 
			
		||||
 | 
			
		||||
Trys to discover the vendor from $l1->model() and $l1->vendor()
 | 
			
		||||
=item Inherited Classes
 | 
			
		||||
 | 
			
		||||
MIBs required for SNMP::Info
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
SNMP-REPEATER-MIB needs to be extracted from ftp://ftp.cisco.com/pub/mibs/v1/v1.tar.gz
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar value from SNMP
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $l1->ports_managed()
 | 
			
		||||
 | 
			
		||||
@@ -221,6 +246,16 @@ Gets the number of ports under the interface mib
 | 
			
		||||
 | 
			
		||||
(B<ifNumber>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Overrides
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $l1->vendor()
 | 
			
		||||
 | 
			
		||||
Trys to discover the vendor from $l1->model() and $l1->vendor()
 | 
			
		||||
 | 
			
		||||
=item $l1->ports()
 | 
			
		||||
 | 
			
		||||
Adds the values from rptr_ports() and ports_managed()
 | 
			
		||||
@@ -233,8 +268,15 @@ Number of 'groups' in the Repeater MIB
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Globals imported from SNMP::Info
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info for details.
 | 
			
		||||
 | 
			
		||||
=head1 TABLE ENTRIES
 | 
			
		||||
 | 
			
		||||
These are methods that return tables of information in the form of a reference
 | 
			
		||||
to a hash.
 | 
			
		||||
 | 
			
		||||
=head2 Overrides
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
@@ -279,4 +321,8 @@ Group (slot) Number for given port.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info for details.
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,8 @@
 | 
			
		||||
# SNMP::Info::Layer1::Allied
 | 
			
		||||
# Max Baker <max@warped.org>
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2002,2003 Regents of the University of California
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
# 
 | 
			
		||||
@@ -28,7 +30,7 @@
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::Layer1::Allied;
 | 
			
		||||
$VERSION = 0.3;
 | 
			
		||||
$VERSION = 0.8;
 | 
			
		||||
# $Id$
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
@@ -64,6 +66,19 @@ sub vendor {
 | 
			
		||||
    return 'allied';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os {
 | 
			
		||||
    return 'allied';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os_ver {
 | 
			
		||||
    my $allied = shift;
 | 
			
		||||
    my $descr = $allied->description();
 | 
			
		||||
    
 | 
			
		||||
    if ($descr =~ m/version (\d+\.\d+)/){
 | 
			
		||||
        return $1;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub model {
 | 
			
		||||
    my $allied = shift;
 | 
			
		||||
 | 
			
		||||
@@ -111,57 +126,74 @@ __END__
 | 
			
		||||
 | 
			
		||||
SNMP::Info::Layer1::Allied - SNMP Interface to old Allied Hubs
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Provides abstraction to the configuration information obtainable from a 
 | 
			
		||||
Allied device through SNMP. See inherited classes' documentation for 
 | 
			
		||||
inherited methods.
 | 
			
		||||
 | 
			
		||||
Inherits from:
 | 
			
		||||
 | 
			
		||||
 SNMP::Info::Layer1
 | 
			
		||||
 | 
			
		||||
Required MIBs:
 | 
			
		||||
 | 
			
		||||
 ATI-MIB - Download for your device from http://www.allied-telesyn.com/allied/support/
 | 
			
		||||
 | 
			
		||||
 MIBs listed in SNMP::Info::Layer1
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
Max Baker (C<max@warped.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 my $allied = new SNMP::Info::Layer1::Allied(DestHost  => 'mycat1900' , 
 | 
			
		||||
                              Community => 'public' ); 
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you. 
 | 
			
		||||
 my $allied = new SNMP::Info(
 | 
			
		||||
                          AutoSpecify => 1,
 | 
			
		||||
                          Debug       => 1,
 | 
			
		||||
                          # These arguments are passed directly on to SNMP::Session
 | 
			
		||||
                          DestHost    => 'myhub',
 | 
			
		||||
                          Community   => 'public',
 | 
			
		||||
                          Version     => 1
 | 
			
		||||
                        ) 
 | 
			
		||||
    or die "Can't connect to DestHost.\n";
 | 
			
		||||
 | 
			
		||||
=head1 CREATING AN OBJECT
 | 
			
		||||
 my $class      = $l1->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Provides abstraction to the configuration information obtainable from a 
 | 
			
		||||
Allied device through SNMP. See inherited classes' documentation for 
 | 
			
		||||
inherited methods.
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item  new SNMP::Info::Layer1::Allied()
 | 
			
		||||
=item SNMP::Info::Layer1
 | 
			
		||||
 | 
			
		||||
Arguments passed to new() are passed on to SNMP::Session::new()
 | 
			
		||||
    
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
    my $allied = new SNMP::Info::Layer1::Allied(
 | 
			
		||||
        DestHost => $host,
 | 
			
		||||
        Community => 'public',
 | 
			
		||||
        Version => 3,...
 | 
			
		||||
        ) 
 | 
			
		||||
    die "Couldn't connect.\n" unless defined $allied;
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item ATI-MIB 
 | 
			
		||||
 | 
			
		||||
Download for your device from http://www.allied-telesyn.com/allied/support/
 | 
			
		||||
 | 
			
		||||
=item Inherited Classes
 | 
			
		||||
 | 
			
		||||
MIBs listed in SNMP::Info::Layer1 and its inherited classes.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar value from SNMP
 | 
			
		||||
 | 
			
		||||
=head2 Overrides
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $allied->vendor()
 | 
			
		||||
 | 
			
		||||
Returns 'allied' :)
 | 
			
		||||
 | 
			
		||||
=item $allied->os()
 | 
			
		||||
 | 
			
		||||
Returns 'allied' 
 | 
			
		||||
 | 
			
		||||
=item $allied->os_ver()
 | 
			
		||||
 | 
			
		||||
Culls Version from description()
 | 
			
		||||
 | 
			
		||||
=item $allied->root_ip()
 | 
			
		||||
 | 
			
		||||
Returns IP Address of Managed Hub.
 | 
			
		||||
@@ -174,6 +206,10 @@ Trys to cull out AT-nnnnX out of the description field.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Global Methods imported from SNMP::Info::Layer1
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Layer1 for details.
 | 
			
		||||
 | 
			
		||||
=head1 TABLE ENTRIES
 | 
			
		||||
 | 
			
		||||
=head2 Overrides
 | 
			
		||||
@@ -205,4 +241,8 @@ the values of ati_up() to 'up' and 'down'.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::Layer1
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Layer1 for details.
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,8 @@
 | 
			
		||||
# SNMP::Info::Layer1::Asante
 | 
			
		||||
# Max Baker <max@warped.org>
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2002,2003 Regents of the University of California
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
# 
 | 
			
		||||
@@ -28,7 +30,7 @@
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::Layer1::Asante;
 | 
			
		||||
$VERSION = 0.3;
 | 
			
		||||
$VERSION = 0.8;
 | 
			
		||||
# $Id$
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
@@ -80,6 +82,19 @@ sub interfaces {
 | 
			
		||||
    return \%interfaces;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os {
 | 
			
		||||
    return 'asante';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os_ver {
 | 
			
		||||
    my $asante = shift;
 | 
			
		||||
    my $descr = $asante->description();
 | 
			
		||||
    
 | 
			
		||||
    if ($descr =~ /software v(\d+\.\d+)/){
 | 
			
		||||
        return $1;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
    
 | 
			
		||||
sub vendor {
 | 
			
		||||
    return 'asante';
 | 
			
		||||
}
 | 
			
		||||
@@ -154,53 +169,65 @@ __END__
 | 
			
		||||
 | 
			
		||||
SNMP::Info::Layer1::Asante - SNMP Interface to old Asante 1012 Hubs
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Provides abstraction to the configuration information obtainable from a 
 | 
			
		||||
Asante device through SNMP. See inherited classes' documentation for 
 | 
			
		||||
inherited methods.
 | 
			
		||||
 | 
			
		||||
Inherits from:
 | 
			
		||||
 | 
			
		||||
 SNMP::Info::Layer1
 | 
			
		||||
 | 
			
		||||
Required MIBs:
 | 
			
		||||
 | 
			
		||||
ASANTE-HUB1012-MIB - Download from http://www.mibdepot.com
 | 
			
		||||
 | 
			
		||||
 MIBs listed in SNMP::Info::Layer1
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
Max Baker (C<max@warped.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 my $asante = new SNMP::Info::Layer1::Asante(DestHost  => 'mycat1900' , 
 | 
			
		||||
                              Community => 'public' ); 
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you. 
 | 
			
		||||
 my $asante = new SNMP::Info(
 | 
			
		||||
                          AutoSpecify => 1,
 | 
			
		||||
                          Debug       => 1,
 | 
			
		||||
                          # These arguments are passed directly on to SNMP::Session
 | 
			
		||||
                          DestHost    => 'myswitch',
 | 
			
		||||
                          Community   => 'public',
 | 
			
		||||
                          Version     => 2
 | 
			
		||||
                        ) 
 | 
			
		||||
    or die "Can't connect to DestHost.\n";
 | 
			
		||||
 | 
			
		||||
=head1 CREATING AN OBJECT
 | 
			
		||||
 my $class      = $asante->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Provides abstraction to the configuration information obtainable from a 
 | 
			
		||||
Asante device through SNMP.
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item  new SNMP::Info::Layer1::Asante()
 | 
			
		||||
=item SNMP::Info::Layer1
 | 
			
		||||
 | 
			
		||||
Arguments passed to new() are passed on to SNMP::Session::new()
 | 
			
		||||
    
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
    my $asante = new SNMP::Info::Layer1::Asante(
 | 
			
		||||
        DestHost => $host,
 | 
			
		||||
        Community => 'public',
 | 
			
		||||
        Version => 3,...
 | 
			
		||||
        ) 
 | 
			
		||||
    die "Couldn't connect.\n" unless defined $asante;
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item ASANTE-HUB1012-MIB
 | 
			
		||||
 | 
			
		||||
Download from http://www.mibdepot.com
 | 
			
		||||
 | 
			
		||||
=item MIBs listed in SNMP::Info::Layer1
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
=head2 Overrides
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $asante->os()
 | 
			
		||||
 | 
			
		||||
Returns 'asante'
 | 
			
		||||
 | 
			
		||||
=item $asante->os_ver()
 | 
			
		||||
 | 
			
		||||
Culls software version from description()
 | 
			
		||||
 | 
			
		||||
=item $asante->vendor()
 | 
			
		||||
 | 
			
		||||
Returns 'asante' :)
 | 
			
		||||
@@ -217,6 +244,10 @@ Trys to cull out AT-nnnnX out of the description field.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Globals inherited from SNMP::Info::Layer1
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Layer1 for details.
 | 
			
		||||
 | 
			
		||||
=head1 TABLE ENTRIES
 | 
			
		||||
 | 
			
		||||
=head2 Overrides
 | 
			
		||||
@@ -248,4 +279,8 @@ the values of ati_up() to 'up' and 'down'.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::Layer1
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Layer1 for details.
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										187
									
								
								Info/Layer2.pm
									
									
									
									
									
								
							
							
						
						
									
										187
									
								
								Info/Layer2.pm
									
									
									
									
									
								
							@@ -1,6 +1,8 @@
 | 
			
		||||
# SNMP::Info::Layer2 - SNMP Interface to Layer2 Devices 
 | 
			
		||||
# Max Baker <max@warped.org>
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2004 Max Baker -- All changes from Version 0.7 on
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2002,2003 Regents of the University of California
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
# 
 | 
			
		||||
@@ -28,7 +30,7 @@
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::Layer2;
 | 
			
		||||
$VERSION = 0.3;
 | 
			
		||||
$VERSION = 0.8;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
@@ -37,10 +39,11 @@ use Exporter;
 | 
			
		||||
use SNMP::Info;
 | 
			
		||||
use SNMP::Info::Bridge;
 | 
			
		||||
use SNMP::Info::CDP;
 | 
			
		||||
use SNMP::Info::CiscoStats;
 | 
			
		||||
 | 
			
		||||
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %PORTSTAT %MUNGE $INIT/;
 | 
			
		||||
 | 
			
		||||
@SNMP::Info::Layer2::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::CDP Exporter/;
 | 
			
		||||
@SNMP::Info::Layer2::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::CDP SNMP::Info::CiscoStats Exporter/;
 | 
			
		||||
@SNMP::Info::Layer2::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
$DEBUG=0;
 | 
			
		||||
@@ -53,21 +56,27 @@ $INIT = 0;
 | 
			
		||||
%MIBS = ( %SNMP::Info::MIBS, 
 | 
			
		||||
          %SNMP::Info::Bridge::MIBS,
 | 
			
		||||
          %SNMP::Info::CDP::MIBS,
 | 
			
		||||
          'CISCO-PRODUCTS-MIB' => 'sysName',
 | 
			
		||||
          'CISCO-STACK-MIB'    => 'wsc1900sysID',
 | 
			
		||||
#          'HP-ICF-OID'         => 'hpSwitch4000',
 | 
			
		||||
          %SNMP::Info::CiscoStats::MIBS,
 | 
			
		||||
          'CISCO-PRODUCTS-MIB' => 'sysName',    # for model()
 | 
			
		||||
          'CISCO-STACK-MIB'    => 'wsc1900sysID',    # some older catalysts live here
 | 
			
		||||
          'ENTITY-MIB'         => 'entPhysicalName', # for serial stuff
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
            %SNMP::Info::GLOBALS,
 | 
			
		||||
            %SNMP::Info::Bridge::GLOBALS,
 | 
			
		||||
            %SNMP::Info::CDP::GLOBALS,
 | 
			
		||||
            %SNMP::Info::CiscoStats::GLOBALS,
 | 
			
		||||
            'serial1'   => '.1.3.6.1.4.1.9.3.6.3.0', # OLD-CISCO-CHASSIS-MIB::chassisId.0
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
%FUNCS   = (
 | 
			
		||||
            %SNMP::Info::FUNCS,
 | 
			
		||||
            %SNMP::Info::Bridge::FUNCS,
 | 
			
		||||
            %SNMP::Info::CDP::FUNCS,
 | 
			
		||||
            %SNMP::Info::CiscoStats::FUNCS,
 | 
			
		||||
            'ent_serial' => 'entPhysicalSerialNum',
 | 
			
		||||
            'ent_chassis'=> 'entPhysicalDescr',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%MUNGE = (
 | 
			
		||||
@@ -75,6 +84,7 @@ $INIT = 0;
 | 
			
		||||
            %SNMP::Info::MUNGE,
 | 
			
		||||
            %SNMP::Info::Bridge::MUNGE,
 | 
			
		||||
            %SNMP::Info::CDP::MUNGE,
 | 
			
		||||
            %SNMP::Info::CiscoStats::MUNGE,
 | 
			
		||||
         );
 | 
			
		||||
 | 
			
		||||
# Method OverRides
 | 
			
		||||
@@ -85,7 +95,7 @@ sub model {
 | 
			
		||||
    my $l2 = shift;
 | 
			
		||||
    my $id = $l2->id();
 | 
			
		||||
    my $model = &SNMP::translateObj($id);
 | 
			
		||||
    
 | 
			
		||||
   
 | 
			
		||||
    # HP
 | 
			
		||||
    $model =~ s/^hpswitch//i;
 | 
			
		||||
 | 
			
		||||
@@ -112,6 +122,25 @@ sub vendor {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub serial {
 | 
			
		||||
    my $l2 = shift;
 | 
			
		||||
    
 | 
			
		||||
    my $serial1     = $l2->serial1();
 | 
			
		||||
    my $ent_chassis = $l2->ent_chassis() || {};
 | 
			
		||||
    my $ent_serial  = $l2->ent_serial() || {};
 | 
			
		||||
    
 | 
			
		||||
    my $serial2 = $ent_serial->{1}  || undef;
 | 
			
		||||
    my $chassis = $ent_chassis->{1} || undef;
 | 
			
		||||
 | 
			
		||||
    # precedence
 | 
			
		||||
    #   serial2,chassis parse,serial1
 | 
			
		||||
    return $serial2 if (defined $serial2 and $serial2 !~ /^\s*$/);
 | 
			
		||||
    return $1 if (defined $chassis and $chassis =~ /serial#?:\s*([a-z0-9]+)/i);
 | 
			
		||||
    return $serial1 if (defined $serial1 and $serial1 !~ /^\s*$/);
 | 
			
		||||
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_ignore {
 | 
			
		||||
    my $l2 = shift;
 | 
			
		||||
 | 
			
		||||
@@ -160,31 +189,7 @@ __END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::Layer2 - Perl5 Interface to Layer2 network devices.
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Provides abstraction to the configuration information obtainable from a 
 | 
			
		||||
Layer2 device through SNMP.  Information is stored in a number of MIBs.
 | 
			
		||||
 | 
			
		||||
See super classes for descriptions of other available methods.
 | 
			
		||||
 | 
			
		||||
Inherits from: 
 | 
			
		||||
 | 
			
		||||
 SNMP::Info
 | 
			
		||||
 SNMP::Info::Bridge
 | 
			
		||||
 SNMP::Info::CDP
 | 
			
		||||
 | 
			
		||||
MIBS: 
 | 
			
		||||
 | 
			
		||||
 CISCO-PRODUCTS-MIB - Needed for ID of Cisco Products
 | 
			
		||||
 CISCO-STACK-MIB    - Needed for ID of Cisco Products
 | 
			
		||||
 ##HP-ICF-OID         - Needed for ID of HP    Products
 | 
			
		||||
 MIBS listed in SNMP::Info::Bridge and SNMP::Info::CDP
 | 
			
		||||
 | 
			
		||||
Cisco MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
 | 
			
		||||
 | 
			
		||||
HP MIBs can be found at http://www.hp.com/rnd/software
 | 
			
		||||
SNMP::Info::Layer2 - Perl5 Interface to network devices serving Layer2 only.
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
@@ -192,35 +197,90 @@ Max Baker (C<max@warped.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 my $l2 = new SNMP::Info::Layer2(DestHost  => 'mybridge' , 
 | 
			
		||||
                              Community => 'public' ); 
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you. 
 | 
			
		||||
 my $l2 = new SNMP::Info(
 | 
			
		||||
                          AutoSpecify => 1,
 | 
			
		||||
                          Debug       => 1,
 | 
			
		||||
                          # These arguments are passed directly on to SNMP::Session
 | 
			
		||||
                          DestHost    => 'myswitch',
 | 
			
		||||
                          Community   => 'public',
 | 
			
		||||
                          Version     => 2
 | 
			
		||||
                        ) 
 | 
			
		||||
    or die "Can't connect to DestHost.\n";
 | 
			
		||||
 | 
			
		||||
=head1 CREATING AN OBJECT
 | 
			
		||||
 my $class      = $l2->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
 # Let's get some basic Port information
 | 
			
		||||
 my $interfaces = $l2->interfaces();
 | 
			
		||||
 my $i_up       = $l2->i_up();
 | 
			
		||||
 my $i_speed    = $l2->i_speed();
 | 
			
		||||
 foreach my $iid (keys %$interfaces) {
 | 
			
		||||
    my $port  = $interfaces->{$iid};
 | 
			
		||||
    my $up    = $i_up->{$iid};
 | 
			
		||||
    my $speed = $i_speed->{$iid}
 | 
			
		||||
    print "Port $port is $up. Port runs at $speed.\n";
 | 
			
		||||
 }
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
This class is usually used as a superclass for more specific device classes listed under 
 | 
			
		||||
SNMP::Info::Layer2::*   Please read all docs under SNMP::Info first.
 | 
			
		||||
 | 
			
		||||
Provides abstraction to the configuration information obtainable from a 
 | 
			
		||||
Layer2 device through SNMP.  Information is stored in a number of MIBs.
 | 
			
		||||
 | 
			
		||||
For speed or debugging purposes you can call the subclass directly, but not after determining
 | 
			
		||||
a more specific class using the method above. 
 | 
			
		||||
 | 
			
		||||
 my $l2 = new SNMP::Info::Layer2(...);
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item  new SNMP::Info::Layer2()
 | 
			
		||||
=item SNMP::Info
 | 
			
		||||
 | 
			
		||||
Arguments passed to new() are passed on to SNMP::Session::new()
 | 
			
		||||
    
 | 
			
		||||
=item SNMP::Info::Bridge
 | 
			
		||||
 | 
			
		||||
    my $l2 = new SNMP::Info::Layer2(
 | 
			
		||||
        DestHost => $host,
 | 
			
		||||
        Community => 'public',
 | 
			
		||||
        Version => 3,...
 | 
			
		||||
        ) 
 | 
			
		||||
    die "Couldn't connect.\n" unless defined $l2;
 | 
			
		||||
=item SNMP::Info::CDP
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::CiscoStats
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item CISCO-PRODUCTS-MIB 
 | 
			
		||||
 | 
			
		||||
Needed for ID of Cisco Products
 | 
			
		||||
 | 
			
		||||
=item CISCO-STACK-MIB
 | 
			
		||||
 | 
			
		||||
Needed for ID of Cisco Products
 | 
			
		||||
 | 
			
		||||
=item Inherited Classes
 | 
			
		||||
 | 
			
		||||
MIBs required by the inherited classes listed above.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar value from SNMP
 | 
			
		||||
 | 
			
		||||
=head2 Overrides
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $l2->model()
 | 
			
		||||
 | 
			
		||||
Cross references $l2->id() with product IDs in the 
 | 
			
		||||
Cisco and HP specific MIBs.
 | 
			
		||||
Cisco MIBs.
 | 
			
		||||
 | 
			
		||||
For HP devices, removes 'hpswitch' from the name
 | 
			
		||||
 | 
			
		||||
@@ -228,11 +288,30 @@ For Cisco devices, removes 'sysid' from the name
 | 
			
		||||
 | 
			
		||||
=item $l2->vendor()
 | 
			
		||||
 | 
			
		||||
Trys to discover the vendor from $l2->model() and $l2->vendor()
 | 
			
		||||
Trys to discover the vendor from $l2->model() and $l2->description()
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 TABLE ENTRIES
 | 
			
		||||
=head2 Globals imported from SNMP::Info
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info for details.
 | 
			
		||||
 | 
			
		||||
=head2 Globals imported from SNMP::Info::Bridge
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Bridge for details.
 | 
			
		||||
 | 
			
		||||
=head2 Globals imported from SNMP::Info::CDP
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::CDP for details.
 | 
			
		||||
 | 
			
		||||
=head2 Globals imported from SNMP::Info::CiscoStats
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::CiscoStats for details.
 | 
			
		||||
 | 
			
		||||
=head1 TABLE METHODS
 | 
			
		||||
 | 
			
		||||
These are methods that return tables of information in the form of a reference
 | 
			
		||||
to a hash.
 | 
			
		||||
 | 
			
		||||
=head2 Overrides
 | 
			
		||||
 | 
			
		||||
@@ -252,4 +331,20 @@ Ignores ports with B<ifType> of loopback,propvirtual,other, and cpu
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info for details.
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::Bridge
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Bridge for details.
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::CDP
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::CDP for details.
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::CiscoStats
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::CiscoStats for details.
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										240
									
								
								Info/Layer2/Aironet.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										240
									
								
								Info/Layer2/Aironet.pm
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,240 @@
 | 
			
		||||
# SNMP::Info::Layer2::Aironet
 | 
			
		||||
# Max Baker <max@warped.org>
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2003 Regents of the University of California
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
# 
 | 
			
		||||
# Redistribution and use in source and binary forms, with or without 
 | 
			
		||||
# modification, are permitted provided that the following conditions are met:
 | 
			
		||||
# 
 | 
			
		||||
#     * Redistributions of source code must retain the above copyright notice,
 | 
			
		||||
#       this list of conditions and the following disclaimer.
 | 
			
		||||
#     * Redistributions in binary form must reproduce the above copyright notice,
 | 
			
		||||
#       this list of conditions and the following disclaimer in the documentation
 | 
			
		||||
#       and/or other materials provided with the distribution.
 | 
			
		||||
#     * Neither the name of the University of California, Santa Cruz nor the 
 | 
			
		||||
#       names of its contributors may be used to endorse or promote products 
 | 
			
		||||
#       derived from this software without specific prior written permission.
 | 
			
		||||
# 
 | 
			
		||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 | 
			
		||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
 | 
			
		||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
 | 
			
		||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 | 
			
		||||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 | 
			
		||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
 | 
			
		||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 | 
			
		||||
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
 | 
			
		||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::Layer2::Aironet;
 | 
			
		||||
$VERSION = 0.8;
 | 
			
		||||
# $Id$
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
use Exporter;
 | 
			
		||||
use SNMP::Info::Layer2;
 | 
			
		||||
use SNMP::Info::Entity;
 | 
			
		||||
use SNMP::Info::EtherLike;
 | 
			
		||||
 | 
			
		||||
@SNMP::Info::Layer2::Aironet::ISA = qw/SNMP::Info::Layer2 SNMP::Info::Entity SNMP::Info::EtherLike Exporter/;
 | 
			
		||||
@SNMP::Info::Layer2::Aironet::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
 | 
			
		||||
 | 
			
		||||
# Set for No CDP
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
            %SNMP::Info::Layer2::GLOBALS,
 | 
			
		||||
            %SNMP::Info::Entity::GLOBALS,
 | 
			
		||||
            %SNMP::Info::EtherLike::GLOBALS,
 | 
			
		||||
            'serial' => 'entPhysicalSerialNum.1',
 | 
			
		||||
            'descr'  => 'sysDescr'
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
%FUNCS   = (%SNMP::Info::Layer2::FUNCS,
 | 
			
		||||
            %SNMP::Info::Entity::FUNCS,
 | 
			
		||||
            %SNMP::Info::EtherLike::FUNCS
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
%MIBS    = (
 | 
			
		||||
            %SNMP::Info::Layer2::MIBS,
 | 
			
		||||
            %SNMP::Info::Entity::MIBS,
 | 
			
		||||
            %SNMP::Info::EtherLike::MIBS
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
%MUNGE   = (%SNMP::Info::Layer2::MUNGE,
 | 
			
		||||
            %SNMP::Info::Entity::MUNGE,
 | 
			
		||||
            %SNMP::Info::EtherLike::MUNGE
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
sub vendor {
 | 
			
		||||
    # Sorry, but it's true.
 | 
			
		||||
    return 'cisco';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub interfaces {
 | 
			
		||||
    my $aironet = shift;
 | 
			
		||||
    my $i_description = $aironet->i_description();
 | 
			
		||||
 | 
			
		||||
    return $i_description;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Tag on e_descr.1
 | 
			
		||||
sub description {
 | 
			
		||||
    my $aironet = shift;
 | 
			
		||||
    my $descr = $aironet->descr();
 | 
			
		||||
    my $e_descr = $aironet->e_descr();
 | 
			
		||||
 | 
			
		||||
    $descr = "$e_descr->{1}  $descr" if defined $e_descr->{1};
 | 
			
		||||
 | 
			
		||||
    return $descr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Fetch duplex from EtherLike
 | 
			
		||||
sub i_duplex {
 | 
			
		||||
    my $aironet = shift;
 | 
			
		||||
    my $el_duplex = $aironet->el_duplex();
 | 
			
		||||
 | 
			
		||||
    my %i_duplex;
 | 
			
		||||
    foreach my $d (keys %$el_duplex){
 | 
			
		||||
        my $val = $el_duplex->{$d};
 | 
			
		||||
        next unless defined $val;
 | 
			
		||||
        $i_duplex{$d} = 'full' if $val =~ /full/i;
 | 
			
		||||
        $i_duplex{$d} = 'half' if $val =~ /half/i;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return \%i_duplex;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
__END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::Layer2::Aironet - SNMP Interface to Cisco Aironet devices running IOS.
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
Max Baker (C<max@warped.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you. 
 | 
			
		||||
 my $aironet = new SNMP::Info(
 | 
			
		||||
                          AutoSpecify => 1,
 | 
			
		||||
                          Debug       => 1,
 | 
			
		||||
                          # These arguments are passed directly on to SNMP::Session
 | 
			
		||||
                          DestHost    => 'myswitch',
 | 
			
		||||
                          Community   => 'public',
 | 
			
		||||
                          Version     => 2
 | 
			
		||||
                        ) 
 | 
			
		||||
    or die "Can't connect to DestHost.\n";
 | 
			
		||||
 | 
			
		||||
 my $class      = $aironet->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Provides interface to SNMP Data available on newer Aironet devices running Cisco IOS.
 | 
			
		||||
 | 
			
		||||
Note there are two classes for Aironet devices :
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Layer3::Aironet
 | 
			
		||||
 | 
			
		||||
This class is for devices running Aironet software (older)
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Layer2::Aironet
 | 
			
		||||
 | 
			
		||||
This class is for devices running Cisco IOS software (newer)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
For speed or debugging purposes you can call the subclass directly, but not after determining
 | 
			
		||||
a more specific class using the method above. 
 | 
			
		||||
 | 
			
		||||
my $aironet = new SNMP::Info::Layer2::Aironet(...);
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Layer2
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Entity
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::EtherLike
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item Inherited Classes
 | 
			
		||||
 | 
			
		||||
MIBs required by the inherited classes listed above.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar value from SNMP
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $aironet->discription()
 | 
			
		||||
 | 
			
		||||
Adds info from method e_descr() from SNMP::Info::Entity
 | 
			
		||||
 | 
			
		||||
=item $aironet->vendor()
 | 
			
		||||
 | 
			
		||||
    Returns 'cisco' :)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Globals imported from SNMP::Info::Layer2
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Layer2 for details.
 | 
			
		||||
 | 
			
		||||
=head2 Globals imported from SNMP::Info::Entity
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Entity for details.
 | 
			
		||||
 | 
			
		||||
=head2 Globals imported from SNMP::Info::EtherLike
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::EtherLike for details.
 | 
			
		||||
 | 
			
		||||
=head1 TABLE ENTRIES
 | 
			
		||||
 | 
			
		||||
=head2 Overrides
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $aironet->interfaces()
 | 
			
		||||
 | 
			
		||||
Uses the i_description() field.
 | 
			
		||||
 | 
			
		||||
=item $aironet->i_duplex()
 | 
			
		||||
 | 
			
		||||
Crosses information from SNMP::Info::EtherLike to get duplex info for interfaces.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::Layer2
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Layer2 for details.
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::Entity
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Entity for details.
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::EtherLike
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::EtherLike for details.
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
							
								
								
									
										246
									
								
								Info/Layer2/Allied.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										246
									
								
								Info/Layer2/Allied.pm
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,246 @@
 | 
			
		||||
# SNMP::Info::Layer2::Allied
 | 
			
		||||
# Max Baker <max@warped.org>, Dmitry Sergienko <dmitry@trifle.net>
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2004 Max Baker
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
# 
 | 
			
		||||
# Redistribution and use in source and binary forms, with or without 
 | 
			
		||||
# modification, are permitted provided that the following conditions are met:
 | 
			
		||||
# 
 | 
			
		||||
#     * Redistributions of source code must retain the above copyright notice,
 | 
			
		||||
#       this list of conditions and the following disclaimer.
 | 
			
		||||
#     * Redistributions in binary form must reproduce the above copyright notice,
 | 
			
		||||
#       this list of conditions and the following disclaimer in the documentation
 | 
			
		||||
#       and/or other materials provided with the distribution.
 | 
			
		||||
#     * Neither the name of Netdisco nor the 
 | 
			
		||||
#       names of its contributors may be used to endorse or promote products 
 | 
			
		||||
#       derived from this software without specific prior written permission.
 | 
			
		||||
# 
 | 
			
		||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 | 
			
		||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
 | 
			
		||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
 | 
			
		||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 | 
			
		||||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 | 
			
		||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
 | 
			
		||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 | 
			
		||||
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
 | 
			
		||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::Layer2::Allied;
 | 
			
		||||
$VERSION = 0.8;
 | 
			
		||||
# $Id$
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
use Exporter;
 | 
			
		||||
use SNMP::Info::Layer2;
 | 
			
		||||
use SNMP::Info::Layer1;
 | 
			
		||||
 | 
			
		||||
@SNMP::Info::Layer2::Allied::ISA = qw/SNMP::Info::Layer2 Exporter/;
 | 
			
		||||
@SNMP::Info::Layer2::Allied::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
 | 
			
		||||
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
            %SNMP::Info::Layer2::GLOBALS
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%FUNCS   = (%SNMP::Info::Layer2::FUNCS,
 | 
			
		||||
            'ip_adresses'=> 'atNetAddress',
 | 
			
		||||
            'ip_mac'     => 'atPhysAddress',
 | 
			
		||||
            'i_name'     => 'ifName',
 | 
			
		||||
            'i_up2'	     => 'ifOperStatus',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%MIBS    = (
 | 
			
		||||
            %SNMP::Info::Layer2::MIBS,
 | 
			
		||||
            'AtiSwitch-MIB'    => 'atiswitchProductType',
 | 
			
		||||
            'AtiStackInfo-MIB' => 'atiswitchEnhancedStacking',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%MUNGE   = (%SNMP::Info::Layer2::MUNGE,
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
sub vendor {
 | 
			
		||||
    return 'allied';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os {
 | 
			
		||||
    return 'allied';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os_ver {
 | 
			
		||||
    my $allied = shift;
 | 
			
		||||
    my $descr = $allied->description();
 | 
			
		||||
    
 | 
			
		||||
    if ($descr =~ m/version (\d+\.\d+)/){
 | 
			
		||||
        return $1;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub model {
 | 
			
		||||
    my $allied = shift;
 | 
			
		||||
 | 
			
		||||
    my $desc = $allied->description();
 | 
			
		||||
 | 
			
		||||
    if ($desc =~ /(AT-80\d{2}\S*)/){
 | 
			
		||||
        return $1;
 | 
			
		||||
    }
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub ip {
 | 
			
		||||
    my $allied = shift;
 | 
			
		||||
    my $ip_hash = $allied->ip_addresses();
 | 
			
		||||
    my $ip;
 | 
			
		||||
    my $found_ip;
 | 
			
		||||
    
 | 
			
		||||
    foreach $ip (values %{$ip_hash}) {
 | 
			
		||||
        my $found_ip = SNMP::Info::munge_ip($ip) if (defined $ip);
 | 
			
		||||
        last; # this is only one IP address
 | 
			
		||||
    }
 | 
			
		||||
    return $found_ip;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub mac{
 | 
			
		||||
    my $allied = shift;
 | 
			
		||||
    my $mac_hash = $allied->ip_mac();
 | 
			
		||||
    my $mac;
 | 
			
		||||
    my $found_mac;
 | 
			
		||||
    
 | 
			
		||||
    foreach $mac (values %{$mac_hash}) {
 | 
			
		||||
        $found_mac = SNMP::Info::munge_mac($mac);
 | 
			
		||||
        last; # this is only one MAC address
 | 
			
		||||
    }
 | 
			
		||||
    return $found_mac;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_up {
 | 
			
		||||
    my $allied = shift;
 | 
			
		||||
 | 
			
		||||
    my $i_up  = SNMP::Info::Layer1::i_up($allied);
 | 
			
		||||
    my $i_up2 = $allied->i_up2();
 | 
			
		||||
 | 
			
		||||
    foreach my $port (keys %$ati_up){
 | 
			
		||||
        my $up = $ati_up->{$port};
 | 
			
		||||
        $i_up->{$port} = 'down' if $up eq 'linktesterror';
 | 
			
		||||
        $i_up->{$port} = 'up' if $up eq 'nolinktesterror';
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    return $i_up;
 | 
			
		||||
}
 | 
			
		||||
1;
 | 
			
		||||
__END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::Layer2::Allied - SNMP Interface to Allied Telesyn switches
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
Max Baker (C<max@warped.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you. 
 | 
			
		||||
 my $allied = new SNMP::Info(
 | 
			
		||||
                          AutoSpecify => 1,
 | 
			
		||||
                          Debug       => 1,
 | 
			
		||||
                          # These arguments are passed directly on to SNMP::Session
 | 
			
		||||
                          DestHost    => 'myhub',
 | 
			
		||||
                          Community   => 'public',
 | 
			
		||||
                          Version     => 1
 | 
			
		||||
                        ) 
 | 
			
		||||
    or die "Can't connect to DestHost.\n";
 | 
			
		||||
 | 
			
		||||
 my $class      = $l1->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Provides abstraction to the configuration information obtainable from a 
 | 
			
		||||
Allied device through SNMP. See inherited classes' documentation for 
 | 
			
		||||
inherited methods.
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Layer1
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item ATI-MIB 
 | 
			
		||||
 | 
			
		||||
Download for your device from http://www.allied-telesyn.com/allied/support/
 | 
			
		||||
 | 
			
		||||
=item Inherited Classes
 | 
			
		||||
 | 
			
		||||
MIBs listed in SNMP::Info::Layer1 and its inherited classes.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar value from SNMP
 | 
			
		||||
 | 
			
		||||
=head2 Overrides
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $allied->vendor()
 | 
			
		||||
 | 
			
		||||
Returns 'allied' :)
 | 
			
		||||
 | 
			
		||||
=item $allied->os()
 | 
			
		||||
 | 
			
		||||
Returns 'allied' 
 | 
			
		||||
 | 
			
		||||
=item $allied->os_ver()
 | 
			
		||||
 | 
			
		||||
Culls Version from description()
 | 
			
		||||
 | 
			
		||||
=item $allied->root_ip()
 | 
			
		||||
 | 
			
		||||
Returns IP Address of Managed Hub.
 | 
			
		||||
 | 
			
		||||
(B<actualIpAddr>)
 | 
			
		||||
 | 
			
		||||
=item $allied->model()
 | 
			
		||||
 | 
			
		||||
Trys to cull out AT-nnnnX out of the description field.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Global Methods imported from SNMP::Info::Layer1
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Layer1 for details.
 | 
			
		||||
 | 
			
		||||
=head1 TABLE ENTRIES
 | 
			
		||||
 | 
			
		||||
=head2 Overrides
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $allied->i_name()
 | 
			
		||||
 | 
			
		||||
Returns reference to map of IIDs to human-set port name.
 | 
			
		||||
 | 
			
		||||
=item $allied->i_up()
 | 
			
		||||
 | 
			
		||||
Returns reference to map of IIDs to link status.  Changes
 | 
			
		||||
the values of ati_up() to 'up' and 'down'.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Allied MIB
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
@@ -1,6 +1,8 @@
 | 
			
		||||
# SNMP::Info::Layer2::Bay
 | 
			
		||||
# Max Baker <max@warped.org>
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2002,2003 Regents of the University of California
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
# 
 | 
			
		||||
@@ -28,7 +30,7 @@
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::Layer2::Bay;
 | 
			
		||||
$VERSION = 0.3;
 | 
			
		||||
$VERSION = 0.8;
 | 
			
		||||
# $Id$
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
@@ -73,6 +75,44 @@ $SNMP::Info::SPEED_MAP{200_000_000} = '100 Mbps';
 | 
			
		||||
            'i_mac2' => \&SNMP::Info::munge_mac ,
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
sub os {
 | 
			
		||||
    return 'bay';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os_ver {
 | 
			
		||||
    my $bay = shift;
 | 
			
		||||
    my $descr = $bay->description();
 | 
			
		||||
    return undef unless defined $descr;
 | 
			
		||||
 | 
			
		||||
    # 303 / 304
 | 
			
		||||
    if ($descr =~ m/Rev: \d+\.\d+\.\d+\.\d+-(\d+\.\d+\.\d+\.\d+)/){
 | 
			
		||||
        return $1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    # 450
 | 
			
		||||
    if ($descr =~ m/SW:v(\d+\.\d+\.\d+\.\d+)/){
 | 
			
		||||
        return $1;
 | 
			
		||||
    }
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os_bin {
 | 
			
		||||
    my $bay = shift;
 | 
			
		||||
    my $descr = $bay->description();
 | 
			
		||||
    return undef unless defined $descr;
 | 
			
		||||
 | 
			
		||||
    # 303 / 304
 | 
			
		||||
    if ($descr =~ m/Rev: \d+\.(\d+\.\d+\.\d+)-\d+\.\d+\.\d+\.\d+/){
 | 
			
		||||
        return $1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    # 450
 | 
			
		||||
    if ($descr =~ m/FW:v(\d+\.\d+\.\d+\.\d+)/){
 | 
			
		||||
        return $1;
 | 
			
		||||
    }
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vendor {
 | 
			
		||||
    # or nortel, or synopsis?
 | 
			
		||||
    return 'bay';
 | 
			
		||||
@@ -116,7 +156,9 @@ sub i_mac {
 | 
			
		||||
sub model {
 | 
			
		||||
    my $bay = shift;
 | 
			
		||||
    my $id = $bay->id();
 | 
			
		||||
    return undef unless defined $id;
 | 
			
		||||
    my $model = &SNMP::translateObj($id);
 | 
			
		||||
    return $id unless defined $model;
 | 
			
		||||
    $model =~ s/^sreg-//i;
 | 
			
		||||
 | 
			
		||||
    my $descr = $bay->description();
 | 
			
		||||
@@ -136,6 +178,7 @@ sub c_if {
 | 
			
		||||
    my %c_if;
 | 
			
		||||
    foreach my $entry (keys %$bay_topo_port){
 | 
			
		||||
        my $port = $bay_topo_port->{$entry};
 | 
			
		||||
        next unless defined $port;
 | 
			
		||||
        next if $port == 0;
 | 
			
		||||
        $c_if{"$port.1"} = $port;
 | 
			
		||||
    }
 | 
			
		||||
@@ -154,7 +197,8 @@ sub c_ip {
 | 
			
		||||
    my %ip_port;
 | 
			
		||||
    foreach my $entry (keys %$bay_topo_ip){
 | 
			
		||||
        my $port = $bay_topo_port->{$entry};
 | 
			
		||||
        next if $port == 0;
 | 
			
		||||
        next unless defined $port;
 | 
			
		||||
        next if ($port =~ /^[\d\.]+$/ and $port == 0);
 | 
			
		||||
        my $ip   = $bay_topo_ip->{$entry};
 | 
			
		||||
        push(@{$ip_port{$port}},$ip);
 | 
			
		||||
    }
 | 
			
		||||
@@ -180,6 +224,7 @@ sub c_port {
 | 
			
		||||
    my %c_port;
 | 
			
		||||
    foreach my $entry (keys %$bay_topo_seg){
 | 
			
		||||
        my $port = $bay_topo_port->{$entry};
 | 
			
		||||
        next unless defined $port;
 | 
			
		||||
        next if $port == 0;
 | 
			
		||||
 | 
			
		||||
        # For fake remotes (multiple IPs for a c_ip), use first found
 | 
			
		||||
@@ -218,38 +263,12 @@ sub c_platform {
 | 
			
		||||
    return \%c_platform;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
__END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::Layer2::Bay - SNMP Interface to old Bay Network Switches
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Provides abstraction to the configuration information obtainable from a 
 | 
			
		||||
Bay device through SNMP. 
 | 
			
		||||
 | 
			
		||||
Inherits from 
 | 
			
		||||
 | 
			
		||||
 SNMP::Info::Layer2
 | 
			
		||||
 | 
			
		||||
Required MIBs:
 | 
			
		||||
 | 
			
		||||
 SYNOPTICS-ROOT-MIB
 | 
			
		||||
 S5-ETH-MULTISEG-TOPOLOGY-MIB
 | 
			
		||||
 MIBS listed in SNMP::Info::Layer2
 | 
			
		||||
 | 
			
		||||
Bay MIBs can be found on the CD that came with your product.  
 | 
			
		||||
 | 
			
		||||
Or, if you still have a service contract they can be downloaded at
 | 
			
		||||
www.nortelnetworks.com
 | 
			
		||||
 | 
			
		||||
They have also been seen at : http://www.inotech.com/mibs/vendor/baynetworks/synoptics/synoptics.asp
 | 
			
		||||
 | 
			
		||||
Or http://www.oidview.com/mibs/detail.html under Synoptics.
 | 
			
		||||
 | 
			
		||||
You will need at least the two listed above, and probably a few more.  
 | 
			
		||||
SNMP::Info::Layer2::Bay - SNMP Interface to old Bay Network BayStack Switches
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
@@ -257,29 +276,65 @@ Max Baker (C<max@warped.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 my $bay = new SNMP::Info::Layer2::Bay(DestHost  => 'mybayswitch' , 
 | 
			
		||||
                              Community => 'public' ); 
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you. 
 | 
			
		||||
 my $bay = new SNMP::Info(
 | 
			
		||||
                          AutoSpecify => 1,
 | 
			
		||||
                          Debug       => 1,
 | 
			
		||||
                          # These arguments are passed directly on to SNMP::Session
 | 
			
		||||
                          DestHost    => 'myswitch',
 | 
			
		||||
                          Community   => 'public',
 | 
			
		||||
                          Version     => 2
 | 
			
		||||
                        ) 
 | 
			
		||||
    or die "Can't connect to DestHost.\n";
 | 
			
		||||
 | 
			
		||||
=head1 CREATING AN OBJECT
 | 
			
		||||
 my $class      = $bay->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Provides abstraction to the configuration information obtainable from a 
 | 
			
		||||
Bay device through SNMP. 
 | 
			
		||||
 | 
			
		||||
For speed or debugging purposes you can call the subclass directly, but not after determining
 | 
			
		||||
a more specific class using the method above. 
 | 
			
		||||
 | 
			
		||||
 my $bay = new SNMP::Info::Layer2::Bay(...);
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item  new SNMP::Info::Layer2::Bay()
 | 
			
		||||
 | 
			
		||||
Arguments passed to new() are passed on to SNMP::Session::new()
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    my $bay = new SNMP::Info::Layer2::Bay(
 | 
			
		||||
        DestHost => $host,
 | 
			
		||||
        Community => 'public',
 | 
			
		||||
        Version => 3,...
 | 
			
		||||
        ) 
 | 
			
		||||
    die "Couldn't connect.\n" unless defined $bay;
 | 
			
		||||
=item SNMP::Info::Layer2
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item SYNOPTICS-ROOT-MIB
 | 
			
		||||
 | 
			
		||||
=item S5-ETH-MULTISEG-TOPOLOGY-MIB
 | 
			
		||||
 | 
			
		||||
=item Inherited classes
 | 
			
		||||
 | 
			
		||||
MIBs required by SNMP::Info::Layer2 and its superclasses.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
Bay MIBs can be found on the CD that came with your product.
 | 
			
		||||
 | 
			
		||||
Or, if you still have a service contract they can be downloaded at
 | 
			
		||||
www.nortelnetworks.com
 | 
			
		||||
 | 
			
		||||
They have also been seen at : http://www.inotech.com/mibs/vendor/baynetworks/synoptics/synoptics.asp
 | 
			
		||||
 | 
			
		||||
Or http://www.oidview.com/mibs/detail.html under Synoptics.  Check also www.mibdepot.com
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar value from SNMP
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $bay->vendor()
 | 
			
		||||
@@ -308,8 +363,15 @@ Returns if the S5-ETH-MULTISEG-TOPOLOGY info is on for this device.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Globals imported from SNMP::Info::Layer2
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Layer2 for details.
 | 
			
		||||
 | 
			
		||||
=head1 TABLE ENTRIES
 | 
			
		||||
 | 
			
		||||
These are methods that return tables of information in the form of a reference
 | 
			
		||||
to a hash.
 | 
			
		||||
 | 
			
		||||
=head2 Overrides
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
@@ -416,4 +478,8 @@ Returns reference to hash.  Key: Table entry, Value:Boolean, if bay_topo_seg() i
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::Layer2
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Layer2 for details.
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,8 @@
 | 
			
		||||
# SNMP::Info::Layer2::C1900
 | 
			
		||||
# Max Baker <max@warped.org>
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2002,2003 Regents of the University of California
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
# 
 | 
			
		||||
@@ -28,25 +30,30 @@
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::Layer2::C1900;
 | 
			
		||||
$VERSION = 0.3;
 | 
			
		||||
$VERSION = 0.8;
 | 
			
		||||
# $Id$
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
use Exporter;
 | 
			
		||||
use SNMP::Info::Layer2;
 | 
			
		||||
use SNMP::Info::CiscoVTP;
 | 
			
		||||
 | 
			
		||||
@SNMP::Info::Layer2::C1900::ISA = qw/SNMP::Info::Layer2 Exporter/;
 | 
			
		||||
@SNMP::Info::Layer2::C1900::ISA = qw/SNMP::Info::Layer2 SNMP::Info::CiscoVTP Exporter/;
 | 
			
		||||
@SNMP::Info::Layer2::C1900::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
 | 
			
		||||
 | 
			
		||||
# Set for No CDP
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
            %SNMP::Info::Layer2::GLOBALS
 | 
			
		||||
            %SNMP::Info::Layer2::GLOBALS,
 | 
			
		||||
            %SNMP::Info::CiscoVTP::GLOBALS,
 | 
			
		||||
            'c1900_flash_status'    => 'upgradeFlashBankStatus',
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
%FUNCS   = (%SNMP::Info::Layer2::FUNCS,
 | 
			
		||||
            %SNMP::Info::CiscoVTP::FUNCS,
 | 
			
		||||
            'i_type2'              => 'ifType',
 | 
			
		||||
            'i_name2'              => 'ifName',
 | 
			
		||||
            # ESSWITCH-MIB
 | 
			
		||||
            'c1900_p_index'        => 'swPortIndex',
 | 
			
		||||
            'c1900_p_ifindex'      => 'swPortIfIndex',
 | 
			
		||||
@@ -60,16 +67,51 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
 | 
			
		||||
 | 
			
		||||
%MIBS    = (
 | 
			
		||||
            %SNMP::Info::Layer2::MIBS,
 | 
			
		||||
             %SNMP::Info::CiscoVTP::MIBS,
 | 
			
		||||
            # Also known as the ESSWITCH-MIB
 | 
			
		||||
            'STAND-ALONE-ETHERNET-SWITCH-MIB' =>  'series2000'
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
%MUNGE   = (%SNMP::Info::Layer2::MUNGE,
 | 
			
		||||
            %SNMP::Info::CiscoVTP::MUNGE,
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
sub vendor {
 | 
			
		||||
    return 'cisco';
 | 
			
		||||
}
 | 
			
		||||
sub os {
 | 
			
		||||
    return 'catalyst';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os_ver {
 | 
			
		||||
    my $c1900 = shift;
 | 
			
		||||
 | 
			
		||||
    # Check for superclass one
 | 
			
		||||
    my $os_ver = $c1900->SUPER::os_ver();
 | 
			
		||||
    return $os_ver if defined $os_ver;
 | 
			
		||||
    
 | 
			
		||||
    my $c1900_flash_status = $c1900->c1900_flash_status();
 | 
			
		||||
    return undef unless defined $c1900_flash_status;
 | 
			
		||||
 | 
			
		||||
    if ($c1900_flash_status =~ m/V(\d+\.\d+(\.\d+)?)/){
 | 
			
		||||
        return $1;
 | 
			
		||||
    }  
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub cisco_comm_indexing {
 | 
			
		||||
    1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub interfaces {
 | 
			
		||||
    my $c1900 = shift;
 | 
			
		||||
    my $i_descr = $c1900->i_description();
 | 
			
		||||
 | 
			
		||||
    foreach my $iid (keys %$i_descr){
 | 
			
		||||
        $i_descr->{$iid} =~ s/\s*$//;
 | 
			
		||||
    }
 | 
			
		||||
    return $i_descr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_duplex {
 | 
			
		||||
    my $c1900 = shift;
 | 
			
		||||
@@ -143,29 +185,28 @@ sub i_type {
 | 
			
		||||
 | 
			
		||||
    return $i_type;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_name {
 | 
			
		||||
    my $c1900 = shift;
 | 
			
		||||
    my $i_name = $c1900->i_name2();
 | 
			
		||||
    my $c1900_p_name = $c1900->c1900_p_name();
 | 
			
		||||
    
 | 
			
		||||
    foreach my $port (keys %$c1900_p_name){
 | 
			
		||||
        my $name = $c1900_p_name->{$port};
 | 
			
		||||
        next unless defined $name;
 | 
			
		||||
        next unless $name !~ /^\s*$/;
 | 
			
		||||
        $i_name->{$port} = $name;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    return $i_name;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
__END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::Layer2::C1900 - SNMP Interface to old C1900 Network Switches
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Provides abstraction to the configuration information obtainable from a 
 | 
			
		||||
C1900 device through SNMP. See inherited classes' documentation for 
 | 
			
		||||
inherited methods.
 | 
			
		||||
 | 
			
		||||
Inherits from:
 | 
			
		||||
 | 
			
		||||
 SNMP::Info::Layer2
 | 
			
		||||
 | 
			
		||||
Required MIBs:
 | 
			
		||||
 | 
			
		||||
 STAND-ALONE-ETHERNET-SWITCH-MIB (ESSWITCH-MIB)
 | 
			
		||||
 MIBs listed in SNMP::Info::Layer2
 | 
			
		||||
 | 
			
		||||
ESSWITCH-MIB is included in the Version 1 MIBS from Cisco.
 | 
			
		||||
They can be found at ftp://ftp.cisco.com/pub/mibs/v1/v1.tar.gz
 | 
			
		||||
SNMP::Info::Layer2::C1900 - Perl5 Interface to SNMP data from Cisco Catlyst 1900 Network Switches running CatOS
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
@@ -173,37 +214,90 @@ Max Baker (C<max@warped.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 my $c1900 = new SNMP::Info::Layer2::C1900(DestHost  => 'mycat1900' , 
 | 
			
		||||
                              Community => 'public' ); 
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you. 
 | 
			
		||||
 my $c1900 = new SNMP::Info(
 | 
			
		||||
                          AutoSpecify => 1,
 | 
			
		||||
                          Debug       => 1,
 | 
			
		||||
                          # These arguments are passed directly on to SNMP::Session
 | 
			
		||||
                          DestHost    => 'myswitch',
 | 
			
		||||
                          Community   => 'public',
 | 
			
		||||
                          Version     => 1
 | 
			
		||||
                        ) 
 | 
			
		||||
    or die "Can't connect to DestHost.\n";
 | 
			
		||||
 | 
			
		||||
=head1 CREATING AN OBJECT
 | 
			
		||||
 my $class      = $c1900->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Provides abstraction to the configuration information obtainable from a Catalyst 1900 device through SNMP. 
 | 
			
		||||
See SNMP::Info for full documentation
 | 
			
		||||
 | 
			
		||||
Note that most of these devices only talk SNMP version 1, but not all.
 | 
			
		||||
 | 
			
		||||
For speed or debugging purposes you can call the subclass directly, but not after determining
 | 
			
		||||
a more specific class using the method above. 
 | 
			
		||||
 | 
			
		||||
 my $c1900 = new SNMP::Info::Layer2::C1900(...);
 | 
			
		||||
 | 
			
		||||
=head2 Inherited classes
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item  new SNMP::Info::Layer2::C1900()
 | 
			
		||||
=item SNMP::Info::Layer2
 | 
			
		||||
 | 
			
		||||
Arguments passed to new() are passed on to SNMP::Session::new()
 | 
			
		||||
    
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
    my $c1900 = new SNMP::Info::Layer2::C1900(
 | 
			
		||||
        DestHost => $host,
 | 
			
		||||
        Community => 'public',
 | 
			
		||||
        Version => 3,...
 | 
			
		||||
        ) 
 | 
			
		||||
    die "Couldn't connect.\n" unless defined $c1900;
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item STAND-ALONE-ETHERNET-SWITCH-MIB (ESSWITCH-MIB)
 | 
			
		||||
 | 
			
		||||
ESSWITCH-MIB is included in the Version 1 MIBS from Cisco.
 | 
			
		||||
 | 
			
		||||
They can be found at ftp://ftp.cisco.com/pub/mibs/v1/v1.tar.gz
 | 
			
		||||
 | 
			
		||||
=item Inherited Classes' MIBs
 | 
			
		||||
 | 
			
		||||
MIBs listed in SNMP::Info::Layer2
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar value from SNMP
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $c1900->c1900_flash_status()
 | 
			
		||||
 | 
			
		||||
Usually contains the version of the software loaded in flash.
 | 
			
		||||
Used by os_ver()
 | 
			
		||||
 | 
			
		||||
B<STAND-ALONE-ETHERNET-SWITCH-MIB::upgradeFlashBankStatus>
 | 
			
		||||
 | 
			
		||||
=item $c1900->os()
 | 
			
		||||
 | 
			
		||||
Returns 'catalyst'
 | 
			
		||||
 | 
			
		||||
=item $c1900->os_ver()
 | 
			
		||||
 | 
			
		||||
Returns CatOS version if obtainable.  First tries to use 
 | 
			
		||||
SNMP::Info::CiscoStats->os_ver() .  If that fails then it 
 | 
			
		||||
checks for the presence of $c1900->c1900_flash_status() and culls
 | 
			
		||||
the version from there.
 | 
			
		||||
 | 
			
		||||
=item $c1900->vendor()
 | 
			
		||||
 | 
			
		||||
Returns 'cisco' :)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Globals imported from SNMP::Info::Layer2
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Layer2 for details.
 | 
			
		||||
 | 
			
		||||
=head1 TABLE ENTRIES
 | 
			
		||||
 | 
			
		||||
=head2 Overrides
 | 
			
		||||
@@ -222,6 +316,10 @@ Returns reference to hash of IIDs to admin duplex setting
 | 
			
		||||
 | 
			
		||||
Crosses $c1900->c1900_p_index() with $c1900->c1900_p_duplex_admin;
 | 
			
		||||
 | 
			
		||||
=item $c1900->i_name()
 | 
			
		||||
 | 
			
		||||
Crosses ifName with c1900_p_name() and returns the human set port name if exists.
 | 
			
		||||
 | 
			
		||||
=item $c1900->i_type()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash of IID to port type
 | 
			
		||||
@@ -280,4 +378,8 @@ B<swPortConnectorType>
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::Layer2
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Layer2 for details.
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,8 @@
 | 
			
		||||
# SNMP::Info::Layer2::C2900
 | 
			
		||||
# Max Baker <max@warped.org>
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2002,2003 Regents of the University of California
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
# 
 | 
			
		||||
@@ -28,43 +30,52 @@
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::Layer2::C2900;
 | 
			
		||||
$VERSION = 0.3;
 | 
			
		||||
$VERSION = 0.8;
 | 
			
		||||
# $Id$
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
use Exporter;
 | 
			
		||||
use SNMP::Info::Layer2;
 | 
			
		||||
use SNMP::Info::CiscoVTP;
 | 
			
		||||
 | 
			
		||||
@SNMP::Info::Layer2::C2900::ISA = qw/SNMP::Info::Layer2 Exporter/;
 | 
			
		||||
@SNMP::Info::Layer2::C2900::ISA = qw/SNMP::Info::Layer2 SNMP::Info::CiscoVTP Exporter/;
 | 
			
		||||
@SNMP::Info::Layer2::C2900::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
 | 
			
		||||
 | 
			
		||||
# Set for No CDP
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
            %SNMP::Info::Layer2::GLOBALS
 | 
			
		||||
            %SNMP::Info::Layer2::GLOBALS,
 | 
			
		||||
            %SNMP::Info::CiscoVTP::GLOBALS,
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
%FUNCS   = (%SNMP::Info::Layer2::FUNCS,
 | 
			
		||||
            %SNMP::Info::CiscoVTP::FUNCS,
 | 
			
		||||
            'i_name'               => 'ifAlias',
 | 
			
		||||
            # C2900PortEntry
 | 
			
		||||
            'c2900_p_index' => 'c2900PortIfIndex',
 | 
			
		||||
            'c2900_p_duplex'   => 'c2900PortDuplexStatus',
 | 
			
		||||
            'c2900_p_duplex_admin'   => 'c2900PortDuplexState',
 | 
			
		||||
            'c2900_p_speed_admin'   => 'c2900PortAdminSpeed',
 | 
			
		||||
            );
 | 
			
		||||
            'c2900_p_index'        => 'c2900PortIfIndex',
 | 
			
		||||
            'c2900_p_duplex'       => 'c2900PortDuplexStatus',
 | 
			
		||||
            'c2900_p_duplex_admin' => 'c2900PortDuplexState',
 | 
			
		||||
            'c2900_p_speed_admin'  => 'c2900PortAdminSpeed',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%MIBS    = (
 | 
			
		||||
            %SNMP::Info::Layer2::MIBS,
 | 
			
		||||
            'CISCO-C2900-MIB' =>  'ciscoC2900MIB'
 | 
			
		||||
            );
 | 
			
		||||
%MIBS    = ( %SNMP::Info::Layer2::MIBS,
 | 
			
		||||
             %SNMP::Info::CiscoVTP::MIBS,
 | 
			
		||||
            'CISCO-C2900-MIB' => 'ciscoC2900MIB',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%MUNGE   = (%SNMP::Info::Layer2::MUNGE,
 | 
			
		||||
            );
 | 
			
		||||
            %SNMP::Info::CiscoVTP::MUNGE,
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
sub vendor {
 | 
			
		||||
    return 'cisco';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub cisco_comm_indexing {
 | 
			
		||||
    1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_duplex {
 | 
			
		||||
    my $c2900 = shift;
 | 
			
		||||
    
 | 
			
		||||
@@ -134,20 +145,12 @@ sub interfaces {
 | 
			
		||||
    return \%if
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
__END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::Layer2::C2900 - SNMP Interface to Cisco Catalyst 2900 Network Switches
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Provides abstraction to the configuration information obtainable from a 
 | 
			
		||||
C2900 device through SNMP. 
 | 
			
		||||
 | 
			
		||||
MIBS:  CISCO-C2900-MIB
 | 
			
		||||
 | 
			
		||||
Inherits all SNMP::Info::Layer2 methods.
 | 
			
		||||
SNMP::Info::Layer2::C2900 - SNMP Interface to Cisco Catalyst 2900 Switches running IOS
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
@@ -155,29 +158,62 @@ Max Baker (C<max@warped.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 my $c2900 = new SNMP::Info::Layer2::C2900(DestHost  => 'mycat2900' , 
 | 
			
		||||
                              Community => 'public' ); 
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you. 
 | 
			
		||||
 my $c2900 = new SNMP::Info(
 | 
			
		||||
                          AutoSpecify => 1,
 | 
			
		||||
                          Debug       => 1,
 | 
			
		||||
                          # These arguments are passed directly on to SNMP::Session
 | 
			
		||||
                          DestHost    => 'myswitch',
 | 
			
		||||
                          Community   => 'public',
 | 
			
		||||
                          Version     => 2
 | 
			
		||||
                        ) 
 | 
			
		||||
    or die "Can't connect to DestHost.\n";
 | 
			
		||||
 | 
			
		||||
=head1 CREATING AN OBJECT
 | 
			
		||||
 my $class      = $c2900->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Provides abstraction to the configuration information obtainable from a 
 | 
			
		||||
C2900 device through SNMP. 
 | 
			
		||||
 | 
			
		||||
For speed or debugging purposes you can call the subclass directly, but not after determining
 | 
			
		||||
a more specific class using the method above. 
 | 
			
		||||
 | 
			
		||||
 my $c2900 = new SNMP::Info::Layer2::C2900(...);
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item  new SNMP::Info::Layer2::C2900()
 | 
			
		||||
=item SNMP::Info::Layer2
 | 
			
		||||
 | 
			
		||||
Arguments passed to new() are passed on to SNMP::Session::new()
 | 
			
		||||
    
 | 
			
		||||
=item SNMP::Info::CiscoVTP
 | 
			
		||||
 | 
			
		||||
    my $c2900 = new SNMP::Info::Layer2::C2900(
 | 
			
		||||
        DestHost => $host,
 | 
			
		||||
        Community => 'public',
 | 
			
		||||
        Version => 3,...
 | 
			
		||||
        ) 
 | 
			
		||||
    die "Couldn't connect.\n" unless defined $c2900;
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item CISCO-C2900-MIB
 | 
			
		||||
 | 
			
		||||
Part of the v2 MIBs from Cisco.
 | 
			
		||||
 | 
			
		||||
=item Inherited Classes' MIBs
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::Layer2 for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::CiscoVTP for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar value from SNMP
 | 
			
		||||
 | 
			
		||||
=head2 Overrides
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $c2900->vendor()
 | 
			
		||||
@@ -186,8 +222,19 @@ Arguments passed to new() are passed on to SNMP::Session::new()
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Globals imported from SNMP::Info::Layer2
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Layer2 for details.
 | 
			
		||||
 | 
			
		||||
=head2 Global Methods imported from SNMP::Info::CiscoVTP
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::CiscoVTP for details.
 | 
			
		||||
 | 
			
		||||
=head1 TABLE ENTRIES
 | 
			
		||||
 | 
			
		||||
These are methods that return tables of information in the form of a reference
 | 
			
		||||
to a hash.
 | 
			
		||||
 | 
			
		||||
=head2 Overrides
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
@@ -250,5 +297,12 @@ Arguments passed to new() are passed on to SNMP::Session::new()
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::Layer2
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Layer2 for details.
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::CiscoVTP
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::CiscoVTP for details.
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,7 @@
 | 
			
		||||
# Max Baker <max@warped.org>
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2002,2003 Regents of the University of California
 | 
			
		||||
# Copyright (c) 2003,2004 Max Baker changes from version 0.8 and beyond
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
# 
 | 
			
		||||
# Redistribution and use in source and binary forms, with or without 
 | 
			
		||||
@@ -28,17 +29,19 @@
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::Layer2::Catalyst;
 | 
			
		||||
$VERSION = 0.3;
 | 
			
		||||
$VERSION = 0.8;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
use Exporter;
 | 
			
		||||
use SNMP::Info::Layer2;
 | 
			
		||||
use SNMP::Info::CiscoVTP;
 | 
			
		||||
use SNMP::Info::CiscoStack;
 | 
			
		||||
 | 
			
		||||
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %PORTSTAT 
 | 
			
		||||
            %MYGLOBALS %MYMIBS %MYFUNCS %MYMUNGE %MUNGE $INIT/ ;
 | 
			
		||||
@SNMP::Info::Layer2::Catalyst::ISA = qw/SNMP::Info::Layer2 Exporter/;
 | 
			
		||||
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
 | 
			
		||||
@SNMP::Info::Layer2::Catalyst::ISA = qw/SNMP::Info::CiscoStack SNMP::Info::Layer2 
 | 
			
		||||
                                        SNMP::Info::CiscoVTP Exporter/;
 | 
			
		||||
@SNMP::Info::Layer2::Catalyst::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
$DEBUG=0;
 | 
			
		||||
@@ -47,96 +50,28 @@ $DEBUG=0;
 | 
			
		||||
#       the interworkings.
 | 
			
		||||
$INIT = 0;
 | 
			
		||||
 | 
			
		||||
%MYMIBS = (
 | 
			
		||||
          'CISCO-STACK-MIB' => 'moduleType',
 | 
			
		||||
          'CISCO-VTP-MIB'   => 'vtpVlanIndex'
 | 
			
		||||
          );
 | 
			
		||||
%MIBS =    ( %SNMP::Info::Layer2::MIBS, 
 | 
			
		||||
             %SNMP::Info::CiscoVTP::MIBS,
 | 
			
		||||
             %SNMP::Info::CiscoStack::MIBS,
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%MIBS = ( %SNMP::Info::Layer2::MIBS, 
 | 
			
		||||
          %MYMIBS );
 | 
			
		||||
 | 
			
		||||
%MYGLOBALS = (
 | 
			
		||||
            # these are in CISCO-STACK-MIB
 | 
			
		||||
            'sysip'       => 'sysIpAddr',    
 | 
			
		||||
            'netmask'     => 'sysNetMask',    
 | 
			
		||||
            'broadcast'   => 'sysBroadcast',
 | 
			
		||||
            'serial'      => 'chassisSerialNumberString',    
 | 
			
		||||
            'model'       => 'chassisModel',    
 | 
			
		||||
            'ps1_type'    => 'chassisPs1Type',    
 | 
			
		||||
            'ps1_status'  => 'chassisPs1Status',    
 | 
			
		||||
            'ps2_type'    => 'chassisPs2Type',    
 | 
			
		||||
            'ps2_status'  => 'chassisPs2Status',    
 | 
			
		||||
            'slots'       => 'chassisNumSlots',    
 | 
			
		||||
            'fan'         => 'chassisFanStatus'
 | 
			
		||||
             );
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
            %SNMP::Info::Layer2::GLOBALS,
 | 
			
		||||
            %MYGLOBALS
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
%MYFUNCS = (
 | 
			
		||||
            'i_type2'        => 'ifType',
 | 
			
		||||
            # CISCO-STACK-MIB::moduleEntry
 | 
			
		||||
            #   These are blades in a catalyst device
 | 
			
		||||
            'm_type'         => 'moduleType',
 | 
			
		||||
            'm_model'        => 'moduleModel',
 | 
			
		||||
            'm_serial'       => 'moduleSerialNumber',
 | 
			
		||||
            'm_status'       => 'moduleStatus',
 | 
			
		||||
            'm_name'         => 'moduleName',
 | 
			
		||||
            'm_ports'        => 'moduleNumPorts',
 | 
			
		||||
            'm_ports_status' => 'modulePortStatus',
 | 
			
		||||
            'm_hwver'        => 'moduleHwVersion',
 | 
			
		||||
            'm_fwver'        => 'moduleFwVersion',
 | 
			
		||||
            'm_swver'        => 'moduleSwVersion',
 | 
			
		||||
            # Router Blades :
 | 
			
		||||
            'm_ip'           => 'moduleIPAddress',
 | 
			
		||||
            'm_sub1'         => 'moduleSubType',
 | 
			
		||||
            'm_sub2'         => 'moduleSubType2',
 | 
			
		||||
            # CISCO-STACK-MIB::portEntry 
 | 
			
		||||
            'p_name'    => 'portName',
 | 
			
		||||
            'p_type'    => 'portType',
 | 
			
		||||
            'p_status'  => 'portOperStatus',
 | 
			
		||||
            'p_status2' => 'portAdditionalStatus',
 | 
			
		||||
            'p_speed'   => 'portAdminSpeed',
 | 
			
		||||
            'p_duplex'  => 'portDuplex',
 | 
			
		||||
            'p_port'    => 'portIfIndex',
 | 
			
		||||
            # CISCO-STACK-MIB::PortCpbEntry
 | 
			
		||||
            'p_speed_admin'  => 'portCpbSpeed',
 | 
			
		||||
            'p_duplex_admin' => 'portCpbDuplex',
 | 
			
		||||
            # CISCO-VTP-MIB::VtpVlanEntry 
 | 
			
		||||
            'v_state'   => 'vtpVlanState',
 | 
			
		||||
            'v_type'    => 'vtpVlanType',
 | 
			
		||||
            'v_name'    => 'vtpVlanName',
 | 
			
		||||
            'v_mtu'     => 'vtpVlanMtu',
 | 
			
		||||
            %SNMP::Info::CiscoVTP::GLOBALS,
 | 
			
		||||
            %SNMP::Info::CiscoStack::GLOBALS,
 | 
			
		||||
           );
 | 
			
		||||
%FUNCS   = (
 | 
			
		||||
 | 
			
		||||
%FUNCS =   (
 | 
			
		||||
            %SNMP::Info::Layer2::FUNCS,
 | 
			
		||||
            %MYFUNCS
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
%MYMUNGE = (
 | 
			
		||||
            'm_ports_status' => \&munge_port_status,
 | 
			
		||||
            'p_duplex_admin' => \&SNMP::Info::munge_bits,
 | 
			
		||||
            %SNMP::Info::CiscoVTP::FUNCS,
 | 
			
		||||
            %SNMP::Info::CiscoStack::FUNCS,
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%MUNGE = (
 | 
			
		||||
            # Inherit all the built in munging
 | 
			
		||||
%MUNGE =   (
 | 
			
		||||
            %SNMP::Info::Layer2::MUNGE,
 | 
			
		||||
            %MYMUNGE
 | 
			
		||||
         );
 | 
			
		||||
 | 
			
		||||
%PORTSTAT = (1 => 'other',
 | 
			
		||||
             2 => 'ok',
 | 
			
		||||
             3 => 'minorFault',
 | 
			
		||||
             4 => 'majorFault');
 | 
			
		||||
 | 
			
		||||
# Changes binary byte describing each port into ascii, and returns
 | 
			
		||||
# an ascii list separated by spaces.
 | 
			
		||||
sub munge_port_status {
 | 
			
		||||
    my $status = shift;
 | 
			
		||||
    my @vals = map($PORTSTAT{$_},unpack('C*',$status));
 | 
			
		||||
    return join(' ',@vals);
 | 
			
		||||
}
 | 
			
		||||
            %SNMP::Info::CiscoVTP::MUNGE,
 | 
			
		||||
            %SNMP::Info::CiscoStack::MUNGE,
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
# Overidden Methods
 | 
			
		||||
 | 
			
		||||
@@ -154,115 +89,37 @@ sub i_physical {
 | 
			
		||||
    return \%i_physical;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_type {
 | 
			
		||||
    my $cat = shift;
 | 
			
		||||
 | 
			
		||||
    my $p_port = $cat->p_port();
 | 
			
		||||
    my $p_type  = $cat->p_type();
 | 
			
		||||
 | 
			
		||||
    # Get more generic port types from IF-MIB
 | 
			
		||||
    my $i_type  = $cat->i_type2();
 | 
			
		||||
 | 
			
		||||
    # Now Override w/ port entries
 | 
			
		||||
    foreach my $port (keys %$p_type) {
 | 
			
		||||
        my $iid = $p_port->{$port};
 | 
			
		||||
        $i_type->{$iid} = $p_type->{$port};  
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return $i_type;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# p_* functions are indexed to physical port.  let's index these
 | 
			
		||||
#   to snmp iid
 | 
			
		||||
sub i_name {
 | 
			
		||||
    my $cat = shift;
 | 
			
		||||
 | 
			
		||||
    my $p_port = $cat->p_port();
 | 
			
		||||
    my $p_name  = $cat->p_name();
 | 
			
		||||
 | 
			
		||||
    my %i_name;
 | 
			
		||||
    foreach my $port (keys %$p_name) {
 | 
			
		||||
        my $iid = $p_port->{$port};
 | 
			
		||||
        next unless defined $iid;
 | 
			
		||||
        $i_name{$iid} = $p_name->{$port};
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_name; 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_duplex {
 | 
			
		||||
    my $cat = shift;
 | 
			
		||||
 | 
			
		||||
    my $p_port = $cat->p_port();
 | 
			
		||||
    my $p_duplex  = $cat->p_duplex();
 | 
			
		||||
 | 
			
		||||
    my %i_duplex;
 | 
			
		||||
    foreach my $port (keys %$p_duplex) {
 | 
			
		||||
        my $iid = $p_port->{$port};
 | 
			
		||||
        $i_duplex{$iid} = $p_duplex->{$port};
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_duplex; 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_duplex_admin {
 | 
			
		||||
    my $cat = shift;
 | 
			
		||||
 | 
			
		||||
    my $p_port          = $cat->p_port();
 | 
			
		||||
    my $p_duplex_admin  = $cat->p_duplex_admin();
 | 
			
		||||
 | 
			
		||||
    my %i_duplex_admin;
 | 
			
		||||
    foreach my $port (keys %$p_duplex_admin) {
 | 
			
		||||
        my $iid = $p_port->{$port};
 | 
			
		||||
        next unless defined $iid;
 | 
			
		||||
        my $duplex = $p_duplex_admin->{$port};
 | 
			
		||||
        next unless defined $duplex;
 | 
			
		||||
 | 
			
		||||
        my $string = 'other';
 | 
			
		||||
        # see CISCO-STACK-MIB for a description of the bits
 | 
			
		||||
        $string = 'half' if ($duplex =~ /001$/ or $duplex =~ /0100.$/);
 | 
			
		||||
        $string = 'full' if ($duplex =~ /010$/ or $duplex =~ /100.0$/);
 | 
			
		||||
        # we'll call it auto if both full and half are turned on, or if the
 | 
			
		||||
        #   specifically 'auto' flag bit is set.
 | 
			
		||||
        $string = 'auto' 
 | 
			
		||||
            if ($duplex =~ /1..$/ or $duplex =~ /110..$/ or $duplex =~ /..011$/);
 | 
			
		||||
       
 | 
			
		||||
        $i_duplex_admin{$iid} = $string;
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_duplex_admin; 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# $cat->interfaces() - Maps the ifIndex table to a physical port
 | 
			
		||||
sub interfaces {
 | 
			
		||||
    my $self = shift;
 | 
			
		||||
    my $interfaces = $self->i_index();
 | 
			
		||||
    my $portnames  = $self->p_port();
 | 
			
		||||
    my %portmap = reverse %$portnames;
 | 
			
		||||
 | 
			
		||||
    my %interfaces = ();
 | 
			
		||||
    foreach my $iid (keys %$interfaces) {
 | 
			
		||||
        my $if = $interfaces->{$iid};
 | 
			
		||||
        $interfaces{$if} = $portmap{$iid};
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return \%interfaces;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vendor {
 | 
			
		||||
    return 'cisco';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os {
 | 
			
		||||
    return 'catalyst';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os_ver {
 | 
			
		||||
    my $cat = shift;
 | 
			
		||||
    my $os_ver = $cat->SUPER::os_ver();
 | 
			
		||||
    return $os_ver if defined $os_ver;
 | 
			
		||||
 | 
			
		||||
    my $m_swver = $cat->m_swver();
 | 
			
		||||
    return undef unless defined $m_swver;
 | 
			
		||||
 | 
			
		||||
    # assume .1 entry is the chassis and the sw version we want.
 | 
			
		||||
    return $m_swver->{1} if defined $m_swver->{1};
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub cisco_comm_indexing {
 | 
			
		||||
    1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
__END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::Layer2::Catalyst - Perl5 Interface to Cisco devices running Catalyst OS 
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Provides abstraction to the configuration information obtainable from a 
 | 
			
		||||
Catalyst device through SNMP.  Information is stored in a number of 
 | 
			
		||||
MIB's such as IF-MIB, CISCO-CDP-MIB, CISCO-STACK-MIB, CISCO-VTP-MIB,
 | 
			
		||||
and SWITCH-MIB.
 | 
			
		||||
SNMP::Info::Layer2::Catalyst - Perl5 Interface to Cisco Catalyst 5000 series devices.
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
@@ -270,230 +127,116 @@ Max Baker (C<max@warped.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 my $cat = new SNMP::Info::Layer2::Catalyst(DestHost  => 'router' , 
 | 
			
		||||
                              Community => 'public' ); 
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you. 
 | 
			
		||||
 my $cat = new SNMP::Info(
 | 
			
		||||
                          AutoSpecify => 1,
 | 
			
		||||
                          Debug       => 1,
 | 
			
		||||
                          # These arguments are passed directly on to SNMP::Session
 | 
			
		||||
                          DestHost    => 'myswitch',
 | 
			
		||||
                          Community   => 'public',
 | 
			
		||||
                          Version     => 2
 | 
			
		||||
                        ) 
 | 
			
		||||
    or die "Can't connect to DestHost.\n";
 | 
			
		||||
 | 
			
		||||
=head1 CREATING AN OBJECT
 | 
			
		||||
 my $class      = $cat->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
SNMP::Info subclass to provide information for Cisco Catalyst 5000 series switches running CatOS.
 | 
			
		||||
 | 
			
		||||
This subclass is not for all devices that have the name Catalyst.  Note that some Catalyst
 | 
			
		||||
switches run IOS, like the 2900 and 3550 families.  Cisco Catalyst 1900 switches use their
 | 
			
		||||
own MIB and have a separate subclass.  Use the method above to have SNMP::Info determine the
 | 
			
		||||
appropriate subclass before using this class directly.
 | 
			
		||||
 | 
			
		||||
This class includes the Catalyst 2950 series devices, which fall under the 
 | 
			
		||||
Catalyst 5000 family.
 | 
			
		||||
 | 
			
		||||
Note:  Some older Catalyst switches will only talk SNMP version 1.  Some newer ones will not
 | 
			
		||||
return all their data if connected via Version 1.
 | 
			
		||||
 | 
			
		||||
For speed or debugging purposes you can call the subclass directly, but not after determining
 | 
			
		||||
a more specific class using the method above. 
 | 
			
		||||
 | 
			
		||||
 my $cat = new SNMP::Info::Layer2::Catalyst(...);
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item  new SNMP::Info::Layer2::Catalyst()
 | 
			
		||||
=item SNMP::Info::Layer2
 | 
			
		||||
 | 
			
		||||
Arguments passed to new() are passed on to SNMP::Session::new()
 | 
			
		||||
    
 | 
			
		||||
=item SNMP::Info::CiscoVTP
 | 
			
		||||
 | 
			
		||||
    my $cat = new SNMP::Info::Layer2::Catalyst(
 | 
			
		||||
        DestHost => $host,
 | 
			
		||||
        Community => 'public',
 | 
			
		||||
        Version => 3,...
 | 
			
		||||
        ) 
 | 
			
		||||
    die "Couldn't connect.\n" unless defined $cat;
 | 
			
		||||
=item SNMP::Info::CiscoStack
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 GLOBAL Values
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $cat->netmask()
 | 
			
		||||
(B<sysNetMask>)
 | 
			
		||||
=item Inherited Classes' MIBs
 | 
			
		||||
 | 
			
		||||
=item $cat->broadcast()
 | 
			
		||||
(B<sysBroadcast>)
 | 
			
		||||
See SNMP::Info::Layer2 for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
=item $cat->serial()
 | 
			
		||||
(B<chassisSerialNumberString>)
 | 
			
		||||
See SNMP::Info::CiscoVTP for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
=item $cat->model()
 | 
			
		||||
(B<chassisModel>)
 | 
			
		||||
See SNMP::Info::CiscoStack for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
=item $cat->ps1_type()
 | 
			
		||||
(B<chassisPs1Type>)
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=item $cat->ps2_type()
 | 
			
		||||
(B<chassisPs2Type>)
 | 
			
		||||
These MIBs are found in the standard v2 MIBs from Cisco.
 | 
			
		||||
 | 
			
		||||
=item $cat->ps1_status()
 | 
			
		||||
(B<chassisPs1Status>)
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
=item $cat->ps2_status()
 | 
			
		||||
(B<chassisPs2Status>)
 | 
			
		||||
These are methods that return scalar value from SNMP
 | 
			
		||||
 | 
			
		||||
=item $cat->slots()
 | 
			
		||||
(B<chassisNumSlots>)
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $cat->fan()
 | 
			
		||||
(B<chassisFanStatus>)
 | 
			
		||||
=item $cat->os()
 | 
			
		||||
 | 
			
		||||
Returns 'catalyst'
 | 
			
		||||
 | 
			
		||||
=item $cat->os_ver()
 | 
			
		||||
 | 
			
		||||
Tries to use the value from SNMP::Info::CiscoStats->os_ver() and if it fails 
 | 
			
		||||
it grabs $cat->m_swver()->{1} and uses that.
 | 
			
		||||
 | 
			
		||||
=item $cat->vendor()
 | 
			
		||||
 | 
			
		||||
    Returns 'cisco'
 | 
			
		||||
Returns 'cisco'
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Globals imported from SNMP::Info::Layer2
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Layer2 for details.
 | 
			
		||||
 | 
			
		||||
=head2 Global Methods imported from SNMP::Info::CiscoVTP
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::CiscoVTP for details.
 | 
			
		||||
 | 
			
		||||
=head2 Global Methods imported from SNMP::Info::CiscoStack
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::CiscoStack for details.
 | 
			
		||||
 | 
			
		||||
=head1 TABLE ENTRIES
 | 
			
		||||
 | 
			
		||||
=head2 Overrides
 | 
			
		||||
These are methods that return tables of information in the form of a reference
 | 
			
		||||
to a hash.
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::CiscoVTP
 | 
			
		||||
 | 
			
		||||
=item $cat->interfaces()
 | 
			
		||||
See documentation in SNMP::Info::CiscoVTP for details.
 | 
			
		||||
 | 
			
		||||
    Crosses p_port() with i_index() to get physical names.
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::Layer2
 | 
			
		||||
 | 
			
		||||
=item $cat->i_physical()
 | 
			
		||||
See documentation in SNMP::Info::Layer2 for details.
 | 
			
		||||
 | 
			
		||||
    Returns a map to IID for ports that are physical ports, not vlans, etc.
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::Layer2::CiscoSTack
 | 
			
		||||
 | 
			
		||||
=item $cat->i_type()
 | 
			
		||||
 | 
			
		||||
    Crosses p_port() with p_type() and returns the results. 
 | 
			
		||||
 | 
			
		||||
    Overrides with ifType if p_type() isn't available.
 | 
			
		||||
 | 
			
		||||
=item $cat->i_name()
 | 
			
		||||
 | 
			
		||||
    Crosses p_name with p_port and returns results.
 | 
			
		||||
 | 
			
		||||
=item $cat->i_duplex()
 | 
			
		||||
 | 
			
		||||
    Crosses p_duplex with p_port and returns results.
 | 
			
		||||
 | 
			
		||||
=item $cat->i_duplex_admin()
 | 
			
		||||
 | 
			
		||||
    Crosses p_duplex_admin with p_port.
 | 
			
		||||
 | 
			
		||||
    Munges bit_string returned from p_duplex_admin to get duplex settings.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Module table
 | 
			
		||||
 | 
			
		||||
This table holds configuration information for each of the blades installed in
 | 
			
		||||
the Catalyst device.
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $cat->m_type()
 | 
			
		||||
(B<moduleType>)
 | 
			
		||||
 | 
			
		||||
=item $cat->m_model()
 | 
			
		||||
(B<moduleModel>)
 | 
			
		||||
 | 
			
		||||
=item $cat->m_serial()
 | 
			
		||||
(B<moduleSerialNumber>)
 | 
			
		||||
 | 
			
		||||
=item $cat->m_status()
 | 
			
		||||
(B<moduleStatus>)
 | 
			
		||||
 | 
			
		||||
=item $cat->m_name()
 | 
			
		||||
(B<moduleName>)
 | 
			
		||||
 | 
			
		||||
=item $cat->m_ports()
 | 
			
		||||
(B<moduleNumPorts>)
 | 
			
		||||
 | 
			
		||||
=item $cat->m_ports_status()
 | 
			
		||||
 Returns a list of space separated status strings for the ports.
 | 
			
		||||
   To see the status of port 4 :
 | 
			
		||||
        @ports_status = split(' ', $cat->m_ports_status() );
 | 
			
		||||
        $port4 = $ports_status[3];
 | 
			
		||||
 | 
			
		||||
(B<modulePortStatus>)
 | 
			
		||||
 | 
			
		||||
=item $cat->m_ports_hwver()
 | 
			
		||||
(B<moduleHwVersion>)
 | 
			
		||||
 | 
			
		||||
=item $cat->m_ports_fwver()
 | 
			
		||||
(B<moduleFwVersion>)
 | 
			
		||||
 | 
			
		||||
=item $cat->m_ports_swver()
 | 
			
		||||
(B<moduleSwVersion>)
 | 
			
		||||
 | 
			
		||||
=item $cat->m_ports_ip()
 | 
			
		||||
(B<moduleIPAddress>)
 | 
			
		||||
 | 
			
		||||
=item $cat->m_ports_sub1()
 | 
			
		||||
(B<moduleSubType>)
 | 
			
		||||
 | 
			
		||||
=item $cat->m_ports_sub2()
 | 
			
		||||
(B<moduleSubType2>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Modules - Router Blades
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $cat->m_ip()
 | 
			
		||||
(B<moduleIPAddress>)
 | 
			
		||||
 | 
			
		||||
=item $cat->m_sub1()
 | 
			
		||||
(B<moduleSubType>)
 | 
			
		||||
 | 
			
		||||
=item $cat->m_sub2()
 | 
			
		||||
(B<moduleSubType2>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Port Entry Table (CISCO-STACK-MIB::portTable)
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $cat->p_name()
 | 
			
		||||
(B<portName>)
 | 
			
		||||
 | 
			
		||||
=item $cat->p_type()
 | 
			
		||||
(B<portType>)
 | 
			
		||||
 | 
			
		||||
=item $cat->p_status()
 | 
			
		||||
(B<portOperStatus>)
 | 
			
		||||
 | 
			
		||||
=item $cat->p_status2()
 | 
			
		||||
(B<portAdditionalStatus>)
 | 
			
		||||
 | 
			
		||||
=item $cat->p_speed()
 | 
			
		||||
(B<portAdminSpeed>)
 | 
			
		||||
 | 
			
		||||
=item $cat->p_duplex()
 | 
			
		||||
(B<portDuplex>)
 | 
			
		||||
 | 
			
		||||
=item $cat->p_port()
 | 
			
		||||
(B<portIfIndex>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Port Capability Table (CISCO-STACK-MIB::portCpbTable)
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $cat->p_speed_admin()
 | 
			
		||||
(B<portCpbSpeed>)
 | 
			
		||||
 | 
			
		||||
=item $cat->p_duplex_admin()
 | 
			
		||||
(B<portCpbDuplex>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 VLAN Entry Table
 | 
			
		||||
 | 
			
		||||
See ftp://ftp.cisco.com/pub/mibs/supportlists/wsc5000/wsc5000-communityIndexing.html
 | 
			
		||||
for a good treaty of how to connect to the VLANs
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $cat->v_state()
 | 
			
		||||
(B<vtpVlanState>)
 | 
			
		||||
 | 
			
		||||
=item $cat->v_type()
 | 
			
		||||
(B<vtpVlanType>)
 | 
			
		||||
 | 
			
		||||
=item $cat->v_name()
 | 
			
		||||
(B<vtpVlanName>)
 | 
			
		||||
 | 
			
		||||
=item $cat->v_mtu()
 | 
			
		||||
(B<vtpVlanMtu>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
See documentation in SNMP::Info::Layer2::CiscoStack for details.
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,8 @@
 | 
			
		||||
# SNMP::Info::Layer2::HP - SNMP Interface to HP ProCurve Switches
 | 
			
		||||
# Max Baker <max@warped.org>
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2002,2003 Regents of the University of California
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
# 
 | 
			
		||||
@@ -28,7 +30,7 @@
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::Layer2::HP;
 | 
			
		||||
$VERSION = 0.3;
 | 
			
		||||
$VERSION = 0.8;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
@@ -36,83 +38,121 @@ use strict;
 | 
			
		||||
use Exporter;
 | 
			
		||||
use SNMP::Info::Layer2;
 | 
			
		||||
use SNMP::Info::MAU;
 | 
			
		||||
use SNMP::Info::Entity;
 | 
			
		||||
 | 
			
		||||
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %PORTSTAT %MODEL_MAP 
 | 
			
		||||
            %MYGLOBALS %MYMIBS %MYFUNCS %MYMUNGE %MUNGE $INIT/ ;
 | 
			
		||||
@SNMP::Info::Layer2::HP::ISA = qw/SNMP::Info::Layer2 SNMP::Info::MAU Exporter/;
 | 
			
		||||
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %PORTSTAT %MODEL_MAP %MUNGE $INIT/ ;
 | 
			
		||||
 | 
			
		||||
@SNMP::Info::Layer2::HP::ISA = qw/SNMP::Info::Layer2 SNMP::Info::MAU SNMP::Info::Entity Exporter/;
 | 
			
		||||
@SNMP::Info::Layer2::HP::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
$DEBUG=0;
 | 
			
		||||
$SNMP::debugging=$DEBUG;
 | 
			
		||||
 | 
			
		||||
# See SNMP::Info for the details of these data structures and 
 | 
			
		||||
#       the interworkings.
 | 
			
		||||
# See SNMP::Info for the details of these data structures and interworkings.
 | 
			
		||||
$INIT = 0;
 | 
			
		||||
 | 
			
		||||
%MYMIBS = ( 'ENTITY-MIB'  => 'entPhysicalSerialNum',
 | 
			
		||||
            'RFC1271-MIB' => 'logDescription',
 | 
			
		||||
            'HP-ICF-OID'  => 'hpSwitch4000',
 | 
			
		||||
          );
 | 
			
		||||
 | 
			
		||||
%MIBS = ( %SNMP::Info::Layer2::MIBS,
 | 
			
		||||
          %SNMP::Info::MAU::MIBS,
 | 
			
		||||
          %MYMIBS );
 | 
			
		||||
          %SNMP::Info::Entity::MIBS,
 | 
			
		||||
          'RFC1271-MIB' => 'logDescription',
 | 
			
		||||
          'HP-ICF-OID'  => 'hpSwitch4000',
 | 
			
		||||
          'HP-VLAN'     => 'hpVlanMemberIndex',
 | 
			
		||||
          'STATISTICS-MIB' => 'hpSwitchCpuStat',
 | 
			
		||||
          'NETSWITCH-MIB'  => 'hpMsgBufFree',   
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
%MYGLOBALS = ('serial1' => 'entPhysicalSerialNum.1',
 | 
			
		||||
#              'model'  => 'entPhysicalModelName.1',
 | 
			
		||||
             );
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
            %SNMP::Info::Layer2::GLOBALS,
 | 
			
		||||
            %SNMP::Info::MAU::GLOBALS,
 | 
			
		||||
            %MYGLOBALS
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
%MYFUNCS = (
 | 
			
		||||
            'i_type2'   => 'ifType',
 | 
			
		||||
            'e_class'   => 'entPhysicalClass',
 | 
			
		||||
            'e_descr'   => 'entPhysicalDescr',
 | 
			
		||||
            'e_fwver'   => 'entPhysicalFirmwareRev',
 | 
			
		||||
            'e_hwver'   => 'entPhysicalHardwareRev',
 | 
			
		||||
            'e_map'     => 'entAliasMappingIdentifier',
 | 
			
		||||
            'e_model'   => 'entPhysicalModelName',
 | 
			
		||||
            'e_name'    => 'entPhysicalName',
 | 
			
		||||
            'e_parent'  => 'entPhysicalContainedIn',
 | 
			
		||||
            'e_serial'  => 'entPhysicalSerialNum',
 | 
			
		||||
            'e_swver'   => 'entPhysicalSoftwareRev',
 | 
			
		||||
            'e_type'    => 'entPhysicalVendorType',
 | 
			
		||||
            # RFC1271
 | 
			
		||||
            'l_descr'   => 'logDescription'
 | 
			
		||||
 | 
			
		||||
            %SNMP::Info::Entity::GLOBALS,
 | 
			
		||||
            'serial1'      => 'entPhysicalSerialNum.1',
 | 
			
		||||
            'hp_cpu'       => 'hpSwitchCpuStat.0',
 | 
			
		||||
            'hp_mem_total' => 'hpGlobalMemTotalBytes.1',
 | 
			
		||||
            'mem_free'     => 'hpGlobalMemFreeBytes.1',
 | 
			
		||||
            'mem_used'     => 'hpGlobalMemAllocBytes.1',
 | 
			
		||||
            'os_version'   => 'hpSwitchOsVersion.0',
 | 
			
		||||
            'os_bin'       => 'hpSwitchRomVersion.0',
 | 
			
		||||
            'mac'          => 'hpSwitchBaseMACAddress.0',
 | 
			
		||||
            'hp_vlans'     => 'hpVlanNumber',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%FUNCS   = (
 | 
			
		||||
            %SNMP::Info::Layer2::FUNCS,
 | 
			
		||||
            %SNMP::Info::MAU::FUNCS,
 | 
			
		||||
            %MYFUNCS
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
%MYMUNGE = (
 | 
			
		||||
            %SNMP::Info::Entity::FUNCS,
 | 
			
		||||
            'i_type2'   => 'ifType',
 | 
			
		||||
            # RFC1271
 | 
			
		||||
            'l_descr'   => 'logDescription',
 | 
			
		||||
            # HP-VLAN-MIB
 | 
			
		||||
            'hp_v_index'   => 'hpVlanDot1QID',
 | 
			
		||||
            'hp_v_name'    => 'hpVlanIdentName',
 | 
			
		||||
            'hp_v_state'   => 'hpVlanIdentState',
 | 
			
		||||
            'hp_v_type'    => 'hpVlanIdentType',
 | 
			
		||||
            'hp_v_status'  => 'hpVlanIdentStatus',
 | 
			
		||||
            'hp_v_mac'     => 'hpVlanAddrPhysAddress',
 | 
			
		||||
            'hp_v_if_index'=> 'hpVlanMemberIndex',
 | 
			
		||||
            'hp_v_if_tag'  => 'hpVlanMemberTagged2',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%MUNGE = (
 | 
			
		||||
            # Inherit all the built in munging
 | 
			
		||||
            %SNMP::Info::Layer2::MUNGE,
 | 
			
		||||
            %SNMP::Info::MAU::MUNGE,
 | 
			
		||||
            %MYMUNGE
 | 
			
		||||
            %SNMP::Info::Entity::MUNGE
 | 
			
		||||
         );
 | 
			
		||||
 | 
			
		||||
%MODEL_MAP = ( 
 | 
			
		||||
               'J4812A' => '2512',
 | 
			
		||||
               'J4819A' => '5308XL',
 | 
			
		||||
               'J4813A' => '2524',
 | 
			
		||||
               'J4805A' => '5304XL',
 | 
			
		||||
               'J4815A' => '3324XL',
 | 
			
		||||
               'J4865A' => '4108GL',
 | 
			
		||||
               'J4887A' => '4104GL',
 | 
			
		||||
               'J4874A' => '9315',
 | 
			
		||||
             );
 | 
			
		||||
                'J4093A' => '2424M',
 | 
			
		||||
                'J4110A' => '8000M',
 | 
			
		||||
                'J4120A' => '1600M',
 | 
			
		||||
                'J4121A' => '4000M',
 | 
			
		||||
                'J4122A' => '2400M',
 | 
			
		||||
                'J4138A' => '9308M',
 | 
			
		||||
                'J4139A' => '9304M',
 | 
			
		||||
                'J4812A' => '2512',
 | 
			
		||||
                'J4813A' => '2524',
 | 
			
		||||
                'J4819A' => '5308XL',
 | 
			
		||||
                'J4840A' => '6308M-SX',
 | 
			
		||||
                'J4841A' => '6208M-SX',
 | 
			
		||||
                'J4850A' => '5304XL',
 | 
			
		||||
                'J4865A' => '4108GL',
 | 
			
		||||
                'J4874A' => '9315M',
 | 
			
		||||
                'J4887A' => '4104GL',
 | 
			
		||||
                'J4899A' => '2650',
 | 
			
		||||
                'J4900A' => '2626',
 | 
			
		||||
                'J4902A' => '6108',
 | 
			
		||||
                'J4903A' => '2824',
 | 
			
		||||
                'J4904A' => '2848',
 | 
			
		||||
                'J8130A' => 'WAP-420-NA',
 | 
			
		||||
                'J8131A' => 'WAP-420-WW',
 | 
			
		||||
                'J8164A' => '2626-PWR',
 | 
			
		||||
                'J8165A' => '2650-PWR',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
# Method Overrides
 | 
			
		||||
 | 
			
		||||
sub cpu {
 | 
			
		||||
    my $hp = shift;
 | 
			
		||||
    return $hp->hp_cpu();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub mem_total {
 | 
			
		||||
    my $hp = shift;
 | 
			
		||||
    return $hp->hp_mem_total();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os {
 | 
			
		||||
    return 'hp';
 | 
			
		||||
}
 | 
			
		||||
sub os_ver {
 | 
			
		||||
    my $hp = shift;
 | 
			
		||||
    my $os_version = $hp->os_version();
 | 
			
		||||
    return $os_version if defined $os_version;
 | 
			
		||||
    # Some older ones don't have this value,so we cull it from the description
 | 
			
		||||
    my $descr = $hp->description();
 | 
			
		||||
    if ($descr =~ m/revision ([A-Z]{1}\.\d{2}\.\d{2})/) {
 | 
			
		||||
        return $1;
 | 
			
		||||
    }
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Lookup model number, and translate the part number to the common number
 | 
			
		||||
sub model {
 | 
			
		||||
    my $hp = shift;
 | 
			
		||||
@@ -147,7 +187,6 @@ sub interfaces {
 | 
			
		||||
    foreach my $iid (keys %$interfaces){
 | 
			
		||||
        my $descr = $i_descr->{$iid};
 | 
			
		||||
        next unless defined $descr;
 | 
			
		||||
        #$if{$iid} = $iid;
 | 
			
		||||
        $if{$iid} = $descr if (defined $descr and length $descr);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -155,26 +194,6 @@ sub interfaces {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# e_port maps EntityTable entries to IfTable
 | 
			
		||||
sub e_port {
 | 
			
		||||
    my $hp = shift;
 | 
			
		||||
    my $e_map = $hp->e_map();
 | 
			
		||||
 | 
			
		||||
    my %e_port;
 | 
			
		||||
 | 
			
		||||
    foreach my $e_id (keys %$e_map) {
 | 
			
		||||
        my $id = $e_id;
 | 
			
		||||
        $id =~ s/\.0$//;
 | 
			
		||||
 | 
			
		||||
        my $iid = $e_map->{$e_id};
 | 
			
		||||
        $iid =~ s/.*\.//;
 | 
			
		||||
 | 
			
		||||
        $e_port{$id} = $iid;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return \%e_port;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_type {
 | 
			
		||||
    my $hp = shift;
 | 
			
		||||
    my $e_descr = $hp->e_descr();
 | 
			
		||||
@@ -337,6 +356,57 @@ sub i_duplex_admin {
 | 
			
		||||
    return \%i_duplex_admin;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
=item $hp->i_vlan()
 | 
			
		||||
 | 
			
		||||
Looks in Q-BRIDGE-MIB -- see SNMP::Info::Bridge
 | 
			
		||||
 | 
			
		||||
and for older devices looks in HP-VLAN.
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
sub i_vlan {
 | 
			
		||||
    my $hp = shift;
 | 
			
		||||
 | 
			
		||||
    my $interfaces = $hp->interfaces();
 | 
			
		||||
 | 
			
		||||
    # Newer devices use Q-BRIDGE-MIB
 | 
			
		||||
    my $qb_i_vlan = $hp->qb_i_vlan();
 | 
			
		||||
    my $qb_i_vlan_type = $hp->qb_i_vlan_type();
 | 
			
		||||
        
 | 
			
		||||
    my $i_vlan = {};
 | 
			
		||||
 | 
			
		||||
    foreach my $if (keys %$qb_i_vlan){
 | 
			
		||||
        my $vlan = $qb_i_vlan->{$if};
 | 
			
		||||
        my $tagged = $qb_i_vlan_type->{$if};
 | 
			
		||||
        $tagged = (defined $tagged and $tagged eq 'admitOnlyVlanTagged') ? 1 : 0;
 | 
			
		||||
        next unless defined $vlan;
 | 
			
		||||
        $i_vlan->{$if}= $tagged ? 'trunk' : $vlan;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    # HP4000 ... get it from HP-VLAN
 | 
			
		||||
    # the hpvlanmembertagged2 table has an entry in the form of 
 | 
			
		||||
    #   vlan.interface = /untagged/no/tagged/auto
 | 
			
		||||
    unless (defined $qb_i_vlan and scalar(keys %$qb_i_vlan)){
 | 
			
		||||
        my $hp_v_index = $hp->hp_v_index();
 | 
			
		||||
        my $hp_v_if_tag   = $hp->hp_v_if_tag();
 | 
			
		||||
        foreach my $row (keys %$hp_v_if_tag){
 | 
			
		||||
            my ($index,$if) = split(/\./,$row);
 | 
			
		||||
 | 
			
		||||
            my $tag = $hp_v_if_tag->{$row};
 | 
			
		||||
            my $vlan = $hp_v_index->{$index};
 | 
			
		||||
            
 | 
			
		||||
            next unless defined $tag;
 | 
			
		||||
            $vlan = 'Trunk' if $tag eq 'tagged';
 | 
			
		||||
            $vlan = 'Auto'  if $tag eq 'auto';
 | 
			
		||||
            undef $vlan if $tag eq 'no';
 | 
			
		||||
 | 
			
		||||
            
 | 
			
		||||
            $i_vlan->{$if} = $vlan if defined $vlan;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return $i_vlan;
 | 
			
		||||
}
 | 
			
		||||
1;
 | 
			
		||||
__END__
 | 
			
		||||
 | 
			
		||||
@@ -344,61 +414,105 @@ __END__
 | 
			
		||||
 | 
			
		||||
SNMP::Info::Layer2::HP - SNMP Interface to HP Procurve Switches
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Provides abstraction to the configuration information obtainable from a 
 | 
			
		||||
HP device through SNMP.  Information is stored in a number of 
 | 
			
		||||
MIB's such as IF-MIB, ENTITY-MIB, RFC1271-MIB, HP-ICF-OID, MAU-MIB
 | 
			
		||||
 | 
			
		||||
MIBs required:
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item RFC1271-MIB
 | 
			
		||||
 | 
			
		||||
=item HP-ICF-OID
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
HP MIBs can be found at http://www.hp.com/rnd/software
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
Max Baker (C<max@warped.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 my $hp = new SNMP::Info::Layer2::HP(DestHost  => 'router' , 
 | 
			
		||||
                              Community => 'public' ); 
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you. 
 | 
			
		||||
 my $hp = new SNMP::Info(
 | 
			
		||||
                          AutoSpecify => 1,
 | 
			
		||||
                          Debug       => 1,
 | 
			
		||||
                          # These arguments are passed directly on to SNMP::Session
 | 
			
		||||
                          DestHost    => 'myswitch',
 | 
			
		||||
                          Community   => 'public',
 | 
			
		||||
                          Version     => 2
 | 
			
		||||
                        ) 
 | 
			
		||||
    or die "Can't connect to DestHost.\n";
 | 
			
		||||
 | 
			
		||||
 See SNMP::Info and SNMP::Info::Layer2 for all the inherited methods.
 | 
			
		||||
 my $class      = $hp->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
=head1 CREATING AN OBJECT
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Provides abstraction to the configuration information obtainable from a 
 | 
			
		||||
HP ProCurve Switch via SNMP. 
 | 
			
		||||
 | 
			
		||||
Note:  Some HP Switches will connect via SNMP version 1, but a lot of config data will 
 | 
			
		||||
not be available.  Make sure you try and connect with Version 2 first, and then fail back
 | 
			
		||||
to version 1.
 | 
			
		||||
 | 
			
		||||
For speed or debugging purposes you can call the subclass directly, but not after determining
 | 
			
		||||
a more specific class using the method above. 
 | 
			
		||||
 | 
			
		||||
 my $hp = new SNMP::Info::Layer2::HP(...);
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item  new SNMP::Info::Layer2::HP()
 | 
			
		||||
=item SNMP::Info::Layer2
 | 
			
		||||
 | 
			
		||||
Arguments passed to new() are passed on to SNMP::Session::new()
 | 
			
		||||
    
 | 
			
		||||
=item SNMP::Info::Entity
 | 
			
		||||
 | 
			
		||||
    my $hp = new SNMP::Info::Layer2::HP(
 | 
			
		||||
        DestHost => $host,
 | 
			
		||||
        Community => 'public',
 | 
			
		||||
        Version => 3,...
 | 
			
		||||
        ) 
 | 
			
		||||
    die "Couldn't connect.\n" unless defined $hp;
 | 
			
		||||
=item SNMP::Info::MAU
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 HP Global Configuration Values
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item RFC1271-MIB
 | 
			
		||||
 | 
			
		||||
Included in V2 mibs from Cisco
 | 
			
		||||
 | 
			
		||||
=item HP-ICF-OID
 | 
			
		||||
 | 
			
		||||
=item HP-VLAN
 | 
			
		||||
 | 
			
		||||
(this MIB new with SNMP::Info 0.8)
 | 
			
		||||
 | 
			
		||||
=item STATISTICS-MIB
 | 
			
		||||
 | 
			
		||||
=item NETSWITCH-MIB
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
The last three MIBs listed are from HP and can be found at L<http://www.hp.com/rnd/software>
 | 
			
		||||
or L<http://www.hp.com/rnd/software/MIBs.htm>
 | 
			
		||||
 | 
			
		||||
=head1 ChangeLog
 | 
			
		||||
 | 
			
		||||
Version 0.4 - Removed ENTITY-MIB e_*() methods to separate sub-class - SNMP::Info::Entity
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar value from SNMP
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $hp->cpu()
 | 
			
		||||
 | 
			
		||||
Returns CPU Utilization in percentage.
 | 
			
		||||
 | 
			
		||||
=item $hp->log()
 | 
			
		||||
 | 
			
		||||
Returns all the log entries from the switch's log that are not Link up or down messages.
 | 
			
		||||
 | 
			
		||||
=item $hp->mem_free()
 | 
			
		||||
 | 
			
		||||
Returns bytes of free memory
 | 
			
		||||
 | 
			
		||||
=item $hp->mem_total()
 | 
			
		||||
 | 
			
		||||
Return bytes of total memory
 | 
			
		||||
 | 
			
		||||
=item $hp->mem_used()
 | 
			
		||||
 | 
			
		||||
Returns bytes of used memory
 | 
			
		||||
 | 
			
		||||
=item $hp->model()
 | 
			
		||||
 | 
			
		||||
Returns the model number of the HP Switch.  Will translate between the HP Part number and 
 | 
			
		||||
@@ -415,6 +529,23 @@ the common model number with this map :
 | 
			
		||||
               'J4874A' => '9315',
 | 
			
		||||
              );
 | 
			
		||||
 | 
			
		||||
=item $hp->os()
 | 
			
		||||
 | 
			
		||||
Returns hp
 | 
			
		||||
 | 
			
		||||
=item $hp->os_bin()
 | 
			
		||||
 | 
			
		||||
B<hpSwitchRomVersion.0>
 | 
			
		||||
 | 
			
		||||
=item $hp->os_ver()
 | 
			
		||||
 | 
			
		||||
Tries to use os_version() and if that fails will try and cull the version from
 | 
			
		||||
the description field.
 | 
			
		||||
 | 
			
		||||
=item $hp->os_version()
 | 
			
		||||
 | 
			
		||||
B<hpSwitchOsVersion.0>
 | 
			
		||||
 | 
			
		||||
=item $hp->serial()
 | 
			
		||||
 | 
			
		||||
Returns serial number if available through SNMP
 | 
			
		||||
@@ -429,69 +560,31 @@ hp
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 HP Table Values
 | 
			
		||||
=head2 Globals imported from SNMP::Info::Layer2
 | 
			
		||||
 | 
			
		||||
=head2 Entity Table
 | 
			
		||||
See documentation in SNMP::Info::Layer2 for details.
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
=head2 Globals imported from SNMP::Info::Entity
 | 
			
		||||
 | 
			
		||||
=item $hp->e_class()
 | 
			
		||||
See documentation in SNMP::Info::Entity for details.
 | 
			
		||||
 | 
			
		||||
(C<entPhysicalClass>)
 | 
			
		||||
=head2 Globals imported from SNMP::Info::MAU
 | 
			
		||||
 | 
			
		||||
=item $hp->e_descr()
 | 
			
		||||
See documentation in SNMP::Info::MAU for details.
 | 
			
		||||
 | 
			
		||||
(C<entPhysicalClass>)
 | 
			
		||||
=head1 TABLE METHODS
 | 
			
		||||
 | 
			
		||||
=item $hp->e_fwver()
 | 
			
		||||
These are methods that return tables of information in the form of a reference
 | 
			
		||||
to a hash.
 | 
			
		||||
 | 
			
		||||
(C<entPhysicalFirmwareRev>)
 | 
			
		||||
 | 
			
		||||
=item $hp->e_hwver()
 | 
			
		||||
 | 
			
		||||
(C<entPhysicalHardwareRev>)
 | 
			
		||||
 | 
			
		||||
=item $hp->e_map()
 | 
			
		||||
 | 
			
		||||
(C<entAliasMappingIdentifier>)
 | 
			
		||||
 | 
			
		||||
=item $hp->e_model()
 | 
			
		||||
 | 
			
		||||
(C<entPhysicalModelName>)
 | 
			
		||||
 | 
			
		||||
=item $hp->e_name()
 | 
			
		||||
 | 
			
		||||
(C<entPhysicalName>)
 | 
			
		||||
 | 
			
		||||
=item $hp->e_parent()
 | 
			
		||||
 | 
			
		||||
(C<entPhysicalContainedIn>)
 | 
			
		||||
 | 
			
		||||
=item $hp->e_port()
 | 
			
		||||
 | 
			
		||||
Maps EntityTable entries to the Interface Table (IfTable) using
 | 
			
		||||
$hp->e_map()
 | 
			
		||||
 | 
			
		||||
=item $hp->e_serial()
 | 
			
		||||
 | 
			
		||||
(C<entPhysicalSerialNum>)
 | 
			
		||||
 | 
			
		||||
=item $hp->e_swver()
 | 
			
		||||
 | 
			
		||||
(C<entPhysicalSoftwareRev>)
 | 
			
		||||
 | 
			
		||||
=item $hp->e_type()
 | 
			
		||||
 | 
			
		||||
(C<entPhysicalVendorType>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Overriden Methods from SNMP::Info::Layer2
 | 
			
		||||
=head2 Overrides
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $hp->interfaces() 
 | 
			
		||||
 | 
			
		||||
Uses $hp->i_description()
 | 
			
		||||
 | 
			
		||||
=item $hp->i_duplex()
 | 
			
		||||
 | 
			
		||||
Maps $hp->mau_index() with $hp->mau_link().  Methods inherited from
 | 
			
		||||
@@ -512,3 +605,17 @@ Crosses i_name() with $hp->e_name() using $hp->e_port() and i_alias()
 | 
			
		||||
Crosses i_type() with $hp->e_descr() using $hp->e_port()
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::Layer2
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Layer2 for details.
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::Entity
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Entity for details.
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::MAU
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::MAU for details.
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										224
									
								
								Info/Layer2/ZyXEL_DSLAM.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										224
									
								
								Info/Layer2/ZyXEL_DSLAM.pm
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,224 @@
 | 
			
		||||
# SNMP::Info::Layer2::ZyXEL_DSLAM
 | 
			
		||||
# Dmitry Sergienko <dmitry@trifle.net>
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2004 Max Baker <max@warped.org>
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
# 
 | 
			
		||||
# Redistribution and use in source and binary forms, with or without 
 | 
			
		||||
# modification, are permitted provided that the following conditions are met:
 | 
			
		||||
# 
 | 
			
		||||
#     * Redistributions of source code must retain the above copyright notice,
 | 
			
		||||
#       this list of conditions and the following disclaimer.
 | 
			
		||||
#     * Redistributions in binary form must reproduce the above copyright notice,
 | 
			
		||||
#       this list of conditions and the following disclaimer in the documentation
 | 
			
		||||
#       and/or other materials provided with the distribution.
 | 
			
		||||
#     * Neither the name of Netdisco nor the 
 | 
			
		||||
#       names of its contributors may be used to endorse or promote products 
 | 
			
		||||
#       derived from this software without specific prior written permission.
 | 
			
		||||
# 
 | 
			
		||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 | 
			
		||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
 | 
			
		||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
 | 
			
		||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 | 
			
		||||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 | 
			
		||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
 | 
			
		||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 | 
			
		||||
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
 | 
			
		||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::Layer2::ZyXEL_DSLAM;
 | 
			
		||||
$VERSION = 0.8;
 | 
			
		||||
# $Id$
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
use Exporter;
 | 
			
		||||
use SNMP::Info::Layer2;
 | 
			
		||||
 | 
			
		||||
@SNMP::Info::Layer2::ZyXEL_DSLAM::ISA = qw/SNMP::Info::Layer2 Exporter/;
 | 
			
		||||
@SNMP::Info::Layer2::ZyXEL_DSLAM::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
 | 
			
		||||
 | 
			
		||||
# Set for No CDP
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
            %SNMP::Info::Layer2::GLOBALS
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
%FUNCS   = (%SNMP::Info::Layer2::FUNCS,
 | 
			
		||||
            'ip_adresses' => 'ipAdEntAddr',
 | 
			
		||||
            'i_name'	  => 'ifDescr',
 | 
			
		||||
            'i_description' => 'adslLineConfProfile',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%MIBS    = (
 | 
			
		||||
            %SNMP::Info::Layer2::MIBS,
 | 
			
		||||
            'ADSL-LINE-MIB' => 'adslLineConfProfile'
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%MUNGE   = (%SNMP::Info::Layer2::MUNGE
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
sub layers {
 | 
			
		||||
    my $zyxel = shift;
 | 
			
		||||
    my $layers = $zyxel->layers();
 | 
			
		||||
    return $layers if defined $layers;
 | 
			
		||||
 | 
			
		||||
    # If these don't claim to have any layers, so we'll give them 1+2
 | 
			
		||||
    return '00000011';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vendor {
 | 
			
		||||
    return 'zyxel';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os {
 | 
			
		||||
    return 'zyxel';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os_ver {
 | 
			
		||||
    my $zyxel = shift;
 | 
			
		||||
    my $descr = $zyxel->description();
 | 
			
		||||
    
 | 
			
		||||
    if ($descr =~ m/version (\S+) /){
 | 
			
		||||
        return $1;
 | 
			
		||||
    }
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub model {
 | 
			
		||||
    my $zyxel = shift;
 | 
			
		||||
 | 
			
		||||
    my $desc = $zyxel->description();
 | 
			
		||||
 | 
			
		||||
    if ($desc =~ /8-port ADSL Module\(Annex A\)/){
 | 
			
		||||
        return "AAM1008-61";
 | 
			
		||||
    } elsif ($desc =~ /8-port ADSL Module\(Annex B\)/){
 | 
			
		||||
        return "AAM1008-63";
 | 
			
		||||
    }
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub ip{
 | 
			
		||||
    my $zyxel = shift;
 | 
			
		||||
    my $ip_hash = $zyxel->ip_addresses();
 | 
			
		||||
    my $ip;
 | 
			
		||||
    
 | 
			
		||||
    foreach $ip (keys %{$ip_hash}) {
 | 
			
		||||
        my $found_ip = $ip if (defined $ip and $ip =~ /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/);
 | 
			
		||||
    }
 | 
			
		||||
    return $ip;
 | 
			
		||||
}
 | 
			
		||||
1;
 | 
			
		||||
__END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::Layer2::ZyXEL_DSLAM - SNMP Interface to ZyXEL DSLAM
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
Dmitry Sergienko (C<dmitry@trifle.net>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you. 
 | 
			
		||||
 my $zyxel = new SNMP::Info(
 | 
			
		||||
                          AutoSpecify => 1,
 | 
			
		||||
                          Debug       => 1,
 | 
			
		||||
                          # These arguments are passed directly on to SNMP::Session
 | 
			
		||||
                          DestHost    => 'myhub',
 | 
			
		||||
                          Community   => 'public',
 | 
			
		||||
                          Version     => 1
 | 
			
		||||
                        ) 
 | 
			
		||||
    or die "Can't connect to DestHost.\n";
 | 
			
		||||
 | 
			
		||||
 my $class      = $l2->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Provides abstraction to the configuration information obtainable from a 
 | 
			
		||||
ZyXEL device through SNMP. See inherited classes' documentation for 
 | 
			
		||||
inherited methods.
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Layer2
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item ADSL-LINE-MIB
 | 
			
		||||
 | 
			
		||||
This MIB assumedly obtainable through ZyXEL or possibly included with your device.
 | 
			
		||||
 | 
			
		||||
=item Inherited Classes
 | 
			
		||||
 | 
			
		||||
MIBs listed in SNMP::Info::Layer2 and their inherited classes.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar value from SNMP
 | 
			
		||||
 | 
			
		||||
=head2 Overrides
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $zyxel->vendor()
 | 
			
		||||
 | 
			
		||||
Returns 'ZyXEL' :)
 | 
			
		||||
 | 
			
		||||
=item $zyxel->os()
 | 
			
		||||
 | 
			
		||||
Returns 'ZyXEL' 
 | 
			
		||||
 | 
			
		||||
=item $zyxel->os_ver()
 | 
			
		||||
 | 
			
		||||
Culls Version from description()
 | 
			
		||||
 | 
			
		||||
=item $zyxel->ip()
 | 
			
		||||
 | 
			
		||||
Returns IP Address of DSLAM.
 | 
			
		||||
 | 
			
		||||
(B<ipAdEntAddr>)
 | 
			
		||||
 | 
			
		||||
=item $zyxel->model()
 | 
			
		||||
 | 
			
		||||
Trys to cull out model out of the description field.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Global Methods imported from SNMP::Info::Layer2
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Layer2 for details.
 | 
			
		||||
 | 
			
		||||
=head1 TABLE ENTRIES
 | 
			
		||||
 | 
			
		||||
=head2 Overrides
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $zyxel->i_name()
 | 
			
		||||
 | 
			
		||||
Returns reference to map of IIDs to port name (B<ifDescr>).
 | 
			
		||||
 | 
			
		||||
=item $zyxel->i_description()
 | 
			
		||||
 | 
			
		||||
Returns reference to map of IIDs to human-set port description (profile name).
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::Layer2
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Layer2 for details.
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
							
								
								
									
										209
									
								
								Info/Layer3.pm
									
									
									
									
									
								
							
							
						
						
									
										209
									
								
								Info/Layer3.pm
									
									
									
									
									
								
							@@ -1,6 +1,8 @@
 | 
			
		||||
# SNMP::Info::Layer3 - SNMP Interface to Layer3 devices
 | 
			
		||||
# Max Baker <max@warped.org>
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2004 Max Baker -- All changes from Version 0.7 on
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2002,2003 Regents of the University of California
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
# 
 | 
			
		||||
@@ -28,7 +30,7 @@
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::Layer3;
 | 
			
		||||
$VERSION = 0.3;
 | 
			
		||||
$VERSION = 0.8;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
@@ -36,12 +38,14 @@ use strict;
 | 
			
		||||
use Exporter;
 | 
			
		||||
use SNMP::Info;
 | 
			
		||||
use SNMP::Info::CDP;
 | 
			
		||||
use SNMP::Info::CiscoStats;
 | 
			
		||||
use SNMP::Info::Bridge;
 | 
			
		||||
use SNMP::Info::EtherLike;
 | 
			
		||||
 | 
			
		||||
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
 | 
			
		||||
 | 
			
		||||
@SNMP::Info::Layer3::ISA = qw/SNMP::Info SNMP::Info::CDP SNMP::Info::Bridge SNMP::Info::EtherLike Exporter/;
 | 
			
		||||
@SNMP::Info::Layer3::ISA = qw/SNMP::Info SNMP::Info::CDP SNMP::Info::Bridge 
 | 
			
		||||
                              SNMP::Info::EtherLike SNMP::Info::CiscoStats Exporter/;
 | 
			
		||||
@SNMP::Info::Layer3::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
$DEBUG=0;
 | 
			
		||||
@@ -50,11 +54,11 @@ $SNMP::debugging=$DEBUG;
 | 
			
		||||
$INIT = 0;
 | 
			
		||||
 | 
			
		||||
%MIBS = ( %SNMP::Info::MIBS,
 | 
			
		||||
          %SNMP::Info::CDP::MIBS,
 | 
			
		||||
          %SNMP::Info::Bridge::MIBS,
 | 
			
		||||
          %SNMP::Info::CDP::MIBS,
 | 
			
		||||
          %SNMP::Info::CiscoStats::MIBS,
 | 
			
		||||
          %SNMP::Info::EtherLike::MIBS,
 | 
			
		||||
          'ENTITY-MIB'         => 'entPhysicalName',
 | 
			
		||||
          'HP-ICF-OID'         => 'hpSwitch4000',
 | 
			
		||||
          'CISCO-PRODUCTS-MIB' => 'sysName',
 | 
			
		||||
          'OSPF-MIB'           => 'ospfRouterId',
 | 
			
		||||
        );
 | 
			
		||||
@@ -63,16 +67,18 @@ $INIT = 0;
 | 
			
		||||
            # Inherit the super class ones
 | 
			
		||||
            %SNMP::Info::GLOBALS,
 | 
			
		||||
            %SNMP::Info::CDP::GLOBALS,
 | 
			
		||||
            %SNMP::Info::CiscoStats::GLOBALS,
 | 
			
		||||
            %SNMP::Info::Bridge::GLOBALS,
 | 
			
		||||
            %SNMP::Info::EtherLike::GLOBALS,
 | 
			
		||||
            'mac'       => 'ifPhysAddress.1',
 | 
			
		||||
            'chassis'   => 'entPhysicalDescr.1',
 | 
			
		||||
            'serial1'   => '.1.3.6.1.4.1.9.3.6.3.0', # OLD-CISCO-CHASSIS-MIB::chassisId.0
 | 
			
		||||
            'router_ip' => 'ospfRouterId.0',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%FUNCS   = (
 | 
			
		||||
            %SNMP::Info::FUNCS,
 | 
			
		||||
            %SNMP::Info::CDP::FUNCS,
 | 
			
		||||
            %SNMP::Info::CiscoStats::FUNCS,
 | 
			
		||||
            %SNMP::Info::Bridge::FUNCS,
 | 
			
		||||
            %SNMP::Info::EtherLike::FUNCS,
 | 
			
		||||
            # IFMIB
 | 
			
		||||
@@ -81,13 +87,16 @@ $INIT = 0;
 | 
			
		||||
            'at_index'   => 'atIfIndex',
 | 
			
		||||
            'at_paddr'   => 'atPhysAddress',
 | 
			
		||||
            'at_netaddr' => 'atNetAddress',
 | 
			
		||||
            'ospf_ip'    => 'ospfHostIpAddress'
 | 
			
		||||
            'ospf_ip'    => 'ospfHostIpAddress',
 | 
			
		||||
            'ent_serial' => 'entPhysicalSerialNum',
 | 
			
		||||
            'ent_chassis'=> 'entPhysicalDescr',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%MUNGE = (
 | 
			
		||||
            # Inherit all the built in munging
 | 
			
		||||
            %SNMP::Info::MUNGE,
 | 
			
		||||
            %SNMP::Info::CDP::MUNGE,
 | 
			
		||||
            %SNMP::Info::CiscoStats::MUNGE,
 | 
			
		||||
            %SNMP::Info::Bridge::MUNGE,
 | 
			
		||||
            %SNMP::Info::EtherLike::MUNGE,
 | 
			
		||||
            'at_paddr' => \&SNMP::Info::munge_mac,
 | 
			
		||||
@@ -133,10 +142,20 @@ sub i_ignore {
 | 
			
		||||
sub serial {
 | 
			
		||||
    my $l3 = shift;
 | 
			
		||||
    
 | 
			
		||||
    my $chassis = $l3->chassis();
 | 
			
		||||
    my $serial1     = $l3->serial1();
 | 
			
		||||
    my $ent_chassis = $l3->ent_chassis() || {};
 | 
			
		||||
    my $ent_serial  = $l3->ent_serial() || {};
 | 
			
		||||
    
 | 
			
		||||
    my $serial2 = $ent_serial->{1}  || undef;
 | 
			
		||||
    my $chassis = $ent_chassis->{1} || undef;
 | 
			
		||||
    
 | 
			
		||||
    # precedence
 | 
			
		||||
    #   serial2,chassis parse,serial1
 | 
			
		||||
    return $serial2 if (defined $serial2 and $serial2 !~ /^\s*$/);
 | 
			
		||||
    return $1 if (defined $chassis and $chassis =~ /serial#?:\s*([a-z0-9]+)/i);
 | 
			
		||||
    return $serial1 if (defined $serial1 and $serial1 !~ /^\s*$/);
 | 
			
		||||
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# $l3->model() - the sysObjectID returns an IID to an entry in 
 | 
			
		||||
@@ -144,8 +163,16 @@ sub serial {
 | 
			
		||||
sub model {
 | 
			
		||||
    my $l3 = shift;
 | 
			
		||||
    my $id = $l3->id();
 | 
			
		||||
    
 | 
			
		||||
    unless (defined $id){
 | 
			
		||||
        print " SNMP::Info::Layer3::model() - Device does not support sysObjectID\n" if $DEBUG; 
 | 
			
		||||
        return undef;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    my $model = &SNMP::translateObj($id);
 | 
			
		||||
 | 
			
		||||
    return $id unless defined $model;
 | 
			
		||||
 | 
			
		||||
    $model =~ s/^cisco//i;
 | 
			
		||||
    $model =~ s/^catalyst//;
 | 
			
		||||
    $model =~ s/^cat//;
 | 
			
		||||
@@ -222,31 +249,7 @@ __END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::Layer3 - Perl5 Interface to network devices using Layer3
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Provides generic methods for accessing SNMP data for Layer 3 network devices. 
 | 
			
		||||
Includes support for Layer2+3 devices. See super classes for other inherited
 | 
			
		||||
methods.
 | 
			
		||||
 | 
			
		||||
Inherits from:
 | 
			
		||||
 | 
			
		||||
 SNMP::Info
 | 
			
		||||
 SNMP::Info::Bridge
 | 
			
		||||
 SNMP::Info::CDP
 | 
			
		||||
 SNMP::Info::EtherLike
 | 
			
		||||
 | 
			
		||||
Required MIBs:
 | 
			
		||||
 | 
			
		||||
 ENTITY-MIB         - For model identification
 | 
			
		||||
 CISCO-PRODUCTS-MIB - For model identification
 | 
			
		||||
 HP-ICF-OID         - For model identification
 | 
			
		||||
 MIBS listed in SNMP::Info::CDP, SNMP::Info::Bridge, and SNMP::Info::Etherlike
 | 
			
		||||
 | 
			
		||||
Cisco MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
 | 
			
		||||
 | 
			
		||||
HP MIBs can be found at http://www.hp.com/rnd/software
 | 
			
		||||
SNMP::Info::Layer3 - Perl5 Interface to network devices serving Layer3 or Layers 2 & 3
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
@@ -254,36 +257,83 @@ Max Baker (C<max@warped.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 my $l3 = new SNMP::Info::Layer3(DestHost  => 'router' , 
 | 
			
		||||
                              Community => 'public' ); 
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you. 
 | 
			
		||||
 my $l3 = new SNMP::Info(
 | 
			
		||||
                          AutoSpecify => 1,
 | 
			
		||||
                          Debug       => 1,
 | 
			
		||||
                          # These arguments are passed directly on to SNMP::Session
 | 
			
		||||
                          DestHost    => 'myswitch',
 | 
			
		||||
                          Community   => 'public',
 | 
			
		||||
                          Version     => 2
 | 
			
		||||
                        ) 
 | 
			
		||||
    or die "Can't connect to DestHost.\n";
 | 
			
		||||
 | 
			
		||||
=head1 CREATING AN OBJECT
 | 
			
		||||
 my $class      = $l3->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
 # Let's get some basic Port information
 | 
			
		||||
 my $interfaces = $l3->interfaces();
 | 
			
		||||
 my $i_up       = $l3->i_up();
 | 
			
		||||
 my $i_speed    = $l3->i_speed();
 | 
			
		||||
 foreach my $iid (keys %$interfaces) {
 | 
			
		||||
    my $port  = $interfaces->{$iid};
 | 
			
		||||
    my $up    = $i_up->{$iid};
 | 
			
		||||
    my $speed = $i_speed->{$iid}
 | 
			
		||||
    print "Port $port is $up. Port runs at $speed.\n";
 | 
			
		||||
 }
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
This class is usually used as a superclass for more specific device classes listed under 
 | 
			
		||||
SNMP::Info::Layer3::*   Please read all docs under SNMP::Info first.
 | 
			
		||||
 | 
			
		||||
Provides generic methods for accessing SNMP data for Layer 3 network devices. 
 | 
			
		||||
Includes support for Layer2+3 devices. 
 | 
			
		||||
 | 
			
		||||
For speed or debugging purposes you can call the subclass directly, but not after determining
 | 
			
		||||
a more specific class using the method above. 
 | 
			
		||||
 | 
			
		||||
 my $l3 = new SNMP::Info::Layer3(...);
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item  new SNMP::Info::Layer3()
 | 
			
		||||
=item SNMP::Info
 | 
			
		||||
 | 
			
		||||
Arguments passed to new() are passed on to SNMP::Session::new()
 | 
			
		||||
    
 | 
			
		||||
=item SNMP::Info::Bridge
 | 
			
		||||
 | 
			
		||||
    my $l3 = new SNMP::Info::Layer3(
 | 
			
		||||
        DestHost => $host,
 | 
			
		||||
        Community => 'public',
 | 
			
		||||
        Version => 3,...
 | 
			
		||||
        ) 
 | 
			
		||||
    die "Couldn't connect.\n" unless defined $l3;
 | 
			
		||||
=item SNMP::Info::CDP
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::CiscoStats
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::EtherLike
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $l3->mac()
 | 
			
		||||
=item CISCO-PRODUCTS-MIB
 | 
			
		||||
 | 
			
		||||
Returns root port mac address
 | 
			
		||||
=item ENTITY-MIB
 | 
			
		||||
 | 
			
		||||
(B<ifPhysAddress.1>)
 | 
			
		||||
=item OSPF-MIB
 | 
			
		||||
 | 
			
		||||
=item Inherited Classes
 | 
			
		||||
 | 
			
		||||
MIBs required by the inherited classes listed above.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar value from SNMP
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $l3->chassis()
 | 
			
		||||
 | 
			
		||||
@@ -291,9 +341,21 @@ Returns Chassis type (model).
 | 
			
		||||
 | 
			
		||||
(B<entPhysicalDescr.1>)
 | 
			
		||||
 | 
			
		||||
=item $l3->serial()
 | 
			
		||||
=item $l3->mac()
 | 
			
		||||
 | 
			
		||||
Trys to cull a serial number from $l3->chassis()
 | 
			
		||||
Returns root port mac address
 | 
			
		||||
 | 
			
		||||
(B<ifPhysAddress.1>)
 | 
			
		||||
 | 
			
		||||
=item $l3->router_ip()
 | 
			
		||||
 | 
			
		||||
(B<ospfRouterId.0>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Overrides
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $l3->model()
 | 
			
		||||
 | 
			
		||||
@@ -301,14 +363,41 @@ Trys to reference $l3->id() to one of the product MIBs listed above
 | 
			
		||||
 | 
			
		||||
Removes 'cisco'  from cisco devices for readability.
 | 
			
		||||
 | 
			
		||||
=item $l3->serial()
 | 
			
		||||
 | 
			
		||||
Trys to cull a serial number from $l3->chassis()
 | 
			
		||||
 | 
			
		||||
=item $l3->vendor()
 | 
			
		||||
 | 
			
		||||
Trys to cull a Vendor name from B<sysDescr>
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Globals imported from SNMP::Info
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info for details.
 | 
			
		||||
 | 
			
		||||
=head2 Globals imported from SNMP::Info::Bridge
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Bridge for details.
 | 
			
		||||
 | 
			
		||||
=head2 Globals imported from SNMP::Info::CDP
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::CDP for details.
 | 
			
		||||
 | 
			
		||||
=head2 Globals imported from SNMP::Info::CiscoStats
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::CiscoStats for details.
 | 
			
		||||
 | 
			
		||||
=head2 Globals imported from SNMP::Info::EtherLike
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::EtherLike for details.
 | 
			
		||||
 | 
			
		||||
=head1 TABLE ENTRIES
 | 
			
		||||
 | 
			
		||||
These are methods that return tables of information in the form of a reference
 | 
			
		||||
to a hash.
 | 
			
		||||
 | 
			
		||||
=head2 Overrides
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
@@ -366,4 +455,24 @@ Returns reference to hash of Arp Cache Entries to IP Address
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info for details.
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::Bridge
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Bridge for details.
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::CDP
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::CDP for details.
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::CiscoStats
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::CiscoStats for details.
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::EtherLike
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::EtherLike for details.
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,8 @@
 | 
			
		||||
# SNMP::Info::Layer3::Aironet
 | 
			
		||||
# Max Baker <max@warped.org>
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2002,2003 Regents of the University of California
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
# 
 | 
			
		||||
@@ -28,7 +30,7 @@
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::Layer3::Aironet;
 | 
			
		||||
$VERSION = 0.3;
 | 
			
		||||
$VERSION = 0.8;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
@@ -82,6 +84,26 @@ $INIT = 0;
 | 
			
		||||
          'fw_mac2'     => \&SNMP::Info::munge_mac,
 | 
			
		||||
         );
 | 
			
		||||
 | 
			
		||||
sub os {
 | 
			
		||||
    return 'aironet';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os_ver {
 | 
			
		||||
    my $aironet = shift;
 | 
			
		||||
    my $descr = $aironet->description();
 | 
			
		||||
 | 
			
		||||
    # CAP340 11.21, AP4800-E 11.21
 | 
			
		||||
    if ($descr =~ /AP\d{3,4}(-\D+)?\s+(\d{2}\.\d{2})/){
 | 
			
		||||
        return $2;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    if ($descr =~ /Series\s*AP\s+(\d{2}\.\d{2})/){
 | 
			
		||||
        return $1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Override wireless port with static info
 | 
			
		||||
sub bp_index {
 | 
			
		||||
    my $aironet = shift;
 | 
			
		||||
@@ -110,11 +132,14 @@ sub fw_mac {
 | 
			
		||||
    # remove port 0 forwarding table entries, only port 0 static entries
 | 
			
		||||
    foreach my $fw (keys %$fw_mac){
 | 
			
		||||
        my $port = $fw_port->{$fw};
 | 
			
		||||
        next unless defined $port;
 | 
			
		||||
        delete $fw_mac->{$fw} if $port == 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    foreach my $bs (keys %$bs_mac){
 | 
			
		||||
        $fw_mac->{$bs} = $bs_mac->{$bs};
 | 
			
		||||
        my $entry = $bs;
 | 
			
		||||
        $entry =~ s/\.0$//;
 | 
			
		||||
        $fw_mac->{$entry} = $bs_mac->{$bs};
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return $fw_mac;
 | 
			
		||||
@@ -128,7 +153,9 @@ sub fw_port {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    foreach my $bs (keys %$bs_port){
 | 
			
		||||
        $fw_port->{$bs} = $bs_port->{$bs};
 | 
			
		||||
        my $entry = $bs;
 | 
			
		||||
        $entry =~ s/\.0$//;
 | 
			
		||||
        $fw_port->{$entry} = $bs_port->{$bs};
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return $fw_port;
 | 
			
		||||
@@ -189,11 +216,7 @@ __END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::Layer3::Aironet - Perl5 Interface to Cisco Aironet Wireless Devices
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Inherits all methods from SNMP::Info::Layer3
 | 
			
		||||
SNMP::Info::Layer3::Aironet - Perl5 Interface to Cisco Aironet Wireless Devices running Aironet software, not IOS
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
@@ -201,37 +224,70 @@ Max Baker (C<max@warped.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 my $aironet = new SNMP::Info::Layer3::Aironet(DestHost  => 'myswitch',
 | 
			
		||||
                               Community => 'public');
 | 
			
		||||
 my $mac = $aironet->mac(); 
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you. 
 | 
			
		||||
 my $aironet = new SNMP::Info(
 | 
			
		||||
                          AutoSpecify => 1,
 | 
			
		||||
                          Debug       => 1,
 | 
			
		||||
                          # These arguments are passed directly on to SNMP::Session
 | 
			
		||||
                          DestHost    => 'myswitch',
 | 
			
		||||
                          Community   => 'public',
 | 
			
		||||
                          Version     => 2
 | 
			
		||||
                        ) 
 | 
			
		||||
    or die "Can't connect to DestHost.\n";
 | 
			
		||||
 | 
			
		||||
=head1 CREATING AN OBJECT
 | 
			
		||||
 my $class      = $aironet->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
SNMP::Info subclass to provide access to SNMP data for an Aironet device running Aironet software,
 | 
			
		||||
not cisco IOS.
 | 
			
		||||
 | 
			
		||||
Note there are two classes for Aironet devices :
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item  new SNMP::Info::Layer3::Aironet()
 | 
			
		||||
=item SNMP::Info::Layer3::Aironet
 | 
			
		||||
 | 
			
		||||
Arguments passed to new() are passed on to SNMP::Session::new()
 | 
			
		||||
    
 | 
			
		||||
This class is for devices running Aironet software (older)
 | 
			
		||||
 | 
			
		||||
    my $aironet = new SNMP::Info::Layer3::Aironet(
 | 
			
		||||
        DestHost => $host,
 | 
			
		||||
        Community => 'public',
 | 
			
		||||
        Version => 3,...
 | 
			
		||||
        ) 
 | 
			
		||||
    die "Couldn't connect.\n" unless defined $aironet;
 | 
			
		||||
=item SNMP::Info::Layer2::Aironet
 | 
			
		||||
 | 
			
		||||
This class is for devices running Cisco IOS software (newer)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 Globals
 | 
			
		||||
For speed or debugging purposes you can call the subclass directly, but not after determining
 | 
			
		||||
a more specific class using the method above. 
 | 
			
		||||
 | 
			
		||||
 my $aironet = new SNMP::Info::Layer3::Aironet(...);
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $aironet->mac()
 | 
			
		||||
=item SNMP::Info::Layer3
 | 
			
		||||
 | 
			
		||||
Gives the MAC Address of the wireless side 
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
B<dot11StationID.2>
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item AWCVX-MIB
 | 
			
		||||
 | 
			
		||||
=item IEEE802dot11-MIB
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
These MIBs are now included in the v2.tar.gz archive available from ftp.cisco.com.  Make sure you 
 | 
			
		||||
have a current version. 
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar value from SNMP
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $aironet->awc_duplex()
 | 
			
		||||
 | 
			
		||||
@@ -239,47 +295,34 @@ Gives the admin duplex setting for the Ethernet Port.
 | 
			
		||||
 | 
			
		||||
B<awcEtherDuplex.0>
 | 
			
		||||
 | 
			
		||||
=item $aironet->mac()
 | 
			
		||||
 | 
			
		||||
Gives the MAC Address of the wireless side 
 | 
			
		||||
 | 
			
		||||
B<dot11StationID.2>
 | 
			
		||||
 | 
			
		||||
=item $aironet->os()
 | 
			
		||||
 | 
			
		||||
'aironet'
 | 
			
		||||
 | 
			
		||||
=item $aironet->os_ver
 | 
			
		||||
 | 
			
		||||
Tries to cull the version from the description field.
 | 
			
		||||
 | 
			
		||||
=item $aironet->vendor()
 | 
			
		||||
 | 
			
		||||
Returns 'cisco'.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Globals imported from SNMP::Info::Layer3
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Layer3 for details.
 | 
			
		||||
 | 
			
		||||
=head1 TABLE ENTRIES
 | 
			
		||||
 | 
			
		||||
=head2 Aironet specific items
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item  $aironet->awc_default_mac()
 | 
			
		||||
 | 
			
		||||
Gives the default MAC address of each interface.
 | 
			
		||||
 | 
			
		||||
B<awcIfDefaultPhyAddress>
 | 
			
		||||
 | 
			
		||||
=item $aironet->awc_mac()
 | 
			
		||||
 | 
			
		||||
Gives the actual MAC address of each interface.
 | 
			
		||||
 | 
			
		||||
B<awcIfPhyAddress>
 | 
			
		||||
 | 
			
		||||
=item $aironet->awc_ip()
 | 
			
		||||
 | 
			
		||||
Gives the IP Address assigned to each interface.
 | 
			
		||||
 | 
			
		||||
B<awcIfIpAddress>
 | 
			
		||||
 | 
			
		||||
=item $aironet->awc_netmask()
 | 
			
		||||
 | 
			
		||||
Gives the NetMask for each interface.
 | 
			
		||||
 | 
			
		||||
B<awcIfIpNetMask>
 | 
			
		||||
 | 
			
		||||
=item $aironet->awc_msdu()
 | 
			
		||||
 | 
			
		||||
B<awcIfMSDUMaxLength>
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
These are methods that return tables of information in the form of a reference
 | 
			
		||||
to a hash.
 | 
			
		||||
 | 
			
		||||
=head2 Overrides
 | 
			
		||||
 | 
			
		||||
@@ -314,4 +357,42 @@ Ignores ports that are of type ``rptr'' and ``lo''.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Aironet specific items
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $aironet->awc_default_mac()
 | 
			
		||||
 | 
			
		||||
Gives the default MAC address of each interface.
 | 
			
		||||
 | 
			
		||||
B<awcIfDefaultPhyAddress>
 | 
			
		||||
 | 
			
		||||
=item $aironet->awc_mac()
 | 
			
		||||
 | 
			
		||||
Gives the actual MAC address of each interface.
 | 
			
		||||
 | 
			
		||||
B<awcIfPhyAddress>
 | 
			
		||||
 | 
			
		||||
=item $aironet->awc_ip()
 | 
			
		||||
 | 
			
		||||
Gives the IP Address assigned to each interface.
 | 
			
		||||
 | 
			
		||||
B<awcIfIpAddress>
 | 
			
		||||
 | 
			
		||||
=item $aironet->awc_netmask()
 | 
			
		||||
 | 
			
		||||
Gives the NetMask for each interface.
 | 
			
		||||
 | 
			
		||||
B<awcIfIpNetMask>
 | 
			
		||||
 | 
			
		||||
=item $aironet->awc_msdu()
 | 
			
		||||
 | 
			
		||||
B<awcIfMSDUMaxLength>
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::Layer3
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Layer3 for details.
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
# SNMP::Info::Layer3::C3550
 | 
			
		||||
# Max Baker <max@warped.org>
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
 | 
			
		||||
# Copyright (c) 2003, Regents of the University of California
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
# 
 | 
			
		||||
@@ -28,16 +29,18 @@
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::Layer3::C3550;
 | 
			
		||||
$VERSION = 0.3;
 | 
			
		||||
$VERSION = 0.8;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
use Exporter;
 | 
			
		||||
use SNMP::Info::Layer3;
 | 
			
		||||
use SNMP::Info::CiscoVTP;
 | 
			
		||||
use SNMP::Info::CiscoStack;
 | 
			
		||||
 | 
			
		||||
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %PORTSTAT %MUNGE $INIT/ ;
 | 
			
		||||
@SNMP::Info::Layer3::C3550::ISA = qw/SNMP::Info::Layer3 Exporter/;
 | 
			
		||||
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
 | 
			
		||||
@SNMP::Info::Layer3::C3550::ISA = qw/ SNMP::Info::Layer3 SNMP::Info::CiscoStack SNMP::Info::CiscoVTP  Exporter/;
 | 
			
		||||
@SNMP::Info::Layer3::C3550::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
$DEBUG=0;
 | 
			
		||||
@@ -48,123 +51,38 @@ $INIT = 0;
 | 
			
		||||
 | 
			
		||||
%MIBS = (
 | 
			
		||||
         %SNMP::Info::Layer3::MIBS,  
 | 
			
		||||
         'CISCO-STACK-MIB' => 'moduleType',
 | 
			
		||||
         'CISCO-VTP-MIB'   => 'vtpVlanIndex'
 | 
			
		||||
         %SNMP::Info::CiscoVTP::MIBS,
 | 
			
		||||
         %SNMP::Info::CiscoStack::MIBS,
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
            %SNMP::Info::Layer3::GLOBALS,
 | 
			
		||||
            %SNMP::Info::CiscoVTP::GLOBALS,
 | 
			
		||||
            %SNMP::Info::CiscoStack::GLOBALS,
 | 
			
		||||
            'ports2'      => 'ifNumber',
 | 
			
		||||
            # these are in CISCO-STACK-MIB
 | 
			
		||||
            'serial'      => 'chassisSerialNumberString',    
 | 
			
		||||
            'ps1_type'    => 'chassisPs1Type',    
 | 
			
		||||
            'ps1_status'  => 'chassisPs1Status',    
 | 
			
		||||
            'ps2_type'    => 'chassisPs2Type',    
 | 
			
		||||
            'ps2_status'  => 'chassisPs2Status',    
 | 
			
		||||
            'fan'         => 'chassisFanStatus'
 | 
			
		||||
             );
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%FUNCS = (
 | 
			
		||||
            %SNMP::Info::Layer3::FUNCS,
 | 
			
		||||
            'i_type2'        => 'ifType',
 | 
			
		||||
            # CISCO-STACK-MIB::portEntry 
 | 
			
		||||
            'p_name'    => 'portName',
 | 
			
		||||
            'p_type'    => 'portType',
 | 
			
		||||
            'p_status'  => 'portOperStatus',
 | 
			
		||||
            'p_status2' => 'portAdditionalStatus',
 | 
			
		||||
            'p_speed'   => 'portAdminSpeed',
 | 
			
		||||
            'p_duplex'  => 'portDuplex',
 | 
			
		||||
            'p_port'    => 'portIfIndex',
 | 
			
		||||
            # CISCO-STACK-MIB::PortCpbEntry
 | 
			
		||||
            'p_speed_admin'  => 'portCpbSpeed',
 | 
			
		||||
            'p_duplex_admin' => 'portCpbDuplex',
 | 
			
		||||
            # CISCO-VTP-MIB::VtpVlanEntry 
 | 
			
		||||
            'v_state'   => 'vtpVlanState',
 | 
			
		||||
            'v_type'    => 'vtpVlanType',
 | 
			
		||||
            'v_name'    => 'vtpVlanName',
 | 
			
		||||
            'v_mtu'     => 'vtpVlanMtu',
 | 
			
		||||
        );
 | 
			
		||||
            %SNMP::Info::CiscoVTP::FUNCS,
 | 
			
		||||
            %SNMP::Info::CiscoStack::FUNCS,
 | 
			
		||||
         );
 | 
			
		||||
 | 
			
		||||
%MUNGE = (
 | 
			
		||||
            # Inherit all the built in munging
 | 
			
		||||
            %SNMP::Info::Layer3::MUNGE,
 | 
			
		||||
            'm_ports_status' => \&munge_port_status,
 | 
			
		||||
            'p_duplex_admin' => \&SNMP::Info::munge_bits,
 | 
			
		||||
            %SNMP::Info::CiscoVTP::MUNGE,
 | 
			
		||||
            %SNMP::Info::CiscoStack::MUNGE,
 | 
			
		||||
         );
 | 
			
		||||
 | 
			
		||||
%PORTSTAT = (1 => 'other',
 | 
			
		||||
             2 => 'ok',
 | 
			
		||||
             3 => 'minorFault',
 | 
			
		||||
             4 => 'majorFault');
 | 
			
		||||
# Pick and choose
 | 
			
		||||
 | 
			
		||||
# Changes binary byte describing each port into ascii, and returns
 | 
			
		||||
# an ascii list separated by spaces.
 | 
			
		||||
sub munge_port_status {
 | 
			
		||||
    my $status = shift;
 | 
			
		||||
    my @vals = map($PORTSTAT{$_},unpack('C*',$status));
 | 
			
		||||
    return join(' ',@vals);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Overidden Methods
 | 
			
		||||
 | 
			
		||||
sub i_type {
 | 
			
		||||
    my $c3550 = shift;
 | 
			
		||||
 | 
			
		||||
    my $p_port = $c3550->p_port();
 | 
			
		||||
    my $p_type  = $c3550->p_type();
 | 
			
		||||
 | 
			
		||||
    # Get more generic port types from IF-MIB
 | 
			
		||||
    my $i_type  = $c3550->i_type2();
 | 
			
		||||
 | 
			
		||||
    # Now Override w/ port entries
 | 
			
		||||
    foreach my $port (keys %$p_type) {
 | 
			
		||||
        my $iid = $p_port->{$port};
 | 
			
		||||
        $i_type->{$iid} = $p_type->{$port};  
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return $i_type;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_duplex {
 | 
			
		||||
    my $c3550 = shift;
 | 
			
		||||
 | 
			
		||||
    my $p_port = $c3550->p_port();
 | 
			
		||||
    my $p_duplex  = $c3550->p_duplex();
 | 
			
		||||
 | 
			
		||||
    my %i_duplex;
 | 
			
		||||
    foreach my $port (keys %$p_duplex) {
 | 
			
		||||
        my $iid = $p_port->{$port};
 | 
			
		||||
        $i_duplex{$iid} = $p_duplex->{$port};
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_duplex; 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_duplex_admin {
 | 
			
		||||
    my $c3550 = shift;
 | 
			
		||||
 | 
			
		||||
    my $p_port          = $c3550->p_port();
 | 
			
		||||
    my $p_duplex_admin  = $c3550->p_duplex_admin();
 | 
			
		||||
 | 
			
		||||
    my %i_duplex_admin;
 | 
			
		||||
    foreach my $port (keys %$p_duplex_admin) {
 | 
			
		||||
        my $iid = $p_port->{$port};
 | 
			
		||||
        next unless defined $iid;
 | 
			
		||||
        my $duplex = $p_duplex_admin->{$port};
 | 
			
		||||
        next unless defined $duplex;
 | 
			
		||||
 | 
			
		||||
        my $string = 'other';
 | 
			
		||||
        # see CISCO-STACK-MIB for a description of the bits
 | 
			
		||||
        $string = 'half' if ($duplex =~ /001$/ or $duplex =~ /0100.$/);
 | 
			
		||||
        $string = 'full' if ($duplex =~ /010$/ or $duplex =~ /100.0$/);
 | 
			
		||||
        # we'll call it auto if both full and half are turned on, or if the
 | 
			
		||||
        #   specifically 'auto' flag bit is set.
 | 
			
		||||
        $string = 'auto' 
 | 
			
		||||
            if ($duplex =~ /1..$/ or $duplex =~ /110..$/ or $duplex =~ /..011$/);
 | 
			
		||||
       
 | 
			
		||||
        $i_duplex_admin{$iid} = $string;
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_duplex_admin; 
 | 
			
		||||
}
 | 
			
		||||
*SNMP::Info::Layer3::C3550::serial     = \&SNMP::Info::CiscoStack::serial;
 | 
			
		||||
*SNMP::Info::Layer3::C3550::interfaces = \&SNMP::Info::Layer3::interfaces;
 | 
			
		||||
*SNMP::Info::Layer3::C3550::i_duplex   = \&SNMP::Info::CiscoStack::i_duplex;
 | 
			
		||||
*SNMP::Info::Layer3::C3550::i_duplex_admin = \&SNMP::Info::CiscoStack::i_duplex_admin;
 | 
			
		||||
*SNMP::Info::Layer3::C3550::i_name     = \&SNMP::Info::Layer3::i_name;
 | 
			
		||||
*SNMP::Info::Layer3::C3550::i_type     = \&SNMP::Info::CiscoStack::i_type;
 | 
			
		||||
 | 
			
		||||
sub vendor {
 | 
			
		||||
    return 'cisco';
 | 
			
		||||
@@ -173,10 +91,13 @@ sub vendor {
 | 
			
		||||
sub model {
 | 
			
		||||
    my $c3550 = shift;
 | 
			
		||||
    my $id = $c3550->id();
 | 
			
		||||
    my $model = &SNMP::translateObj($id);
 | 
			
		||||
    my $model = &SNMP::translateObj($id) || $id;
 | 
			
		||||
    $model =~ s/^catalyst//;
 | 
			
		||||
    $model =~ s/(24|48)$//;
 | 
			
		||||
 | 
			
		||||
    # turn 355048 into 3550-48
 | 
			
		||||
    if ($model =~ /^(35\d\d)(\d\d[T]?)$/) {
 | 
			
		||||
        $model = "$1-$2";
 | 
			
		||||
    }
 | 
			
		||||
    return $model;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -188,12 +109,17 @@ sub ports {
 | 
			
		||||
 | 
			
		||||
    my $id = $c3550->id();
 | 
			
		||||
    my $model = &SNMP::translateObj($id);
 | 
			
		||||
    if ($model =~ /(24|48)$/) {
 | 
			
		||||
    if ($model =~ /(12|24|48)[T]?$/) {
 | 
			
		||||
        return $1;
 | 
			
		||||
    }
 | 
			
		||||
    return $ports2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub cisco_comm_indexing {
 | 
			
		||||
    1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
__END__
 | 
			
		||||
 | 
			
		||||
@@ -201,70 +127,70 @@ __END__
 | 
			
		||||
 | 
			
		||||
SNMP::Info::Layer3::C3550 - Perl5 Interface to Cisco Catalyst 3550 Layer 2/3 Switches running IOS
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Abstraction subclass for Cisco Catalyst 3550 Layer 2/3 Switches.  These devices run
 | 
			
		||||
IOS but have some of the same charactersitics as the Catalyst WS-C family (5xxx,6xxx). 
 | 
			
		||||
For example, forwarding tables are held in VLANs, and extened interface information
 | 
			
		||||
is gleened from CISCO-SWITCH-MIB.
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
Max Baker (C<max@warped.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 my $c3550 = new SNMP::Info::Layer3::C3550(DestHost  => 'router' , 
 | 
			
		||||
                              Community => 'public' ); 
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you. 
 | 
			
		||||
 my $c3550 = new SNMP::Info(
 | 
			
		||||
                          AutoSpecify => 1,
 | 
			
		||||
                          Debug       => 1,
 | 
			
		||||
                          # These arguments are passed directly on to SNMP::Session
 | 
			
		||||
                          DestHost    => 'myswitch',
 | 
			
		||||
                          Community   => 'public',
 | 
			
		||||
                          Version     => 2
 | 
			
		||||
                        ) 
 | 
			
		||||
    or die "Can't connect to DestHost.\n";
 | 
			
		||||
 | 
			
		||||
 my $class      = $c3550->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
See L<SNMP::Info> and L<SNMP::Info::Layer3> for all the inherited methods.
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
=head1 CREATING AN OBJECT
 | 
			
		||||
Abstraction subclass for Cisco Catalyst 3550 Layer 2/3 Switches.  
 | 
			
		||||
 | 
			
		||||
These devices run IOS but have some of the same charactersitics as the Catalyst WS-C family (5xxx,6xxx). 
 | 
			
		||||
For example, forwarding tables are held in VLANs, and extened interface information
 | 
			
		||||
is gleened from CISCO-SWITCH-MIB.
 | 
			
		||||
 | 
			
		||||
For speed or debugging purposes you can call the subclass directly, but not after determining
 | 
			
		||||
a more specific class using the method above. 
 | 
			
		||||
 | 
			
		||||
 my $c3550 = new SNMP::Info::Layer3::C3550(...);
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item  new SNMP::Info::Layer3::C3550()
 | 
			
		||||
=item SNMP::Info::Layer3
 | 
			
		||||
 | 
			
		||||
Arguments passed to new() are passed on to SNMP::Session::new()
 | 
			
		||||
    
 | 
			
		||||
=item SNMP::Info::CiscoVTP
 | 
			
		||||
 | 
			
		||||
    my $c3550 = new SNMP::Info::Layer3::C3550(
 | 
			
		||||
        DestHost => $host,
 | 
			
		||||
        Community => 'public',
 | 
			
		||||
        Version => 3,...
 | 
			
		||||
        ) 
 | 
			
		||||
    die "Couldn't connect.\n" unless defined $c3550;
 | 
			
		||||
=item SNMP::Info::CiscoStack
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 GLOBAL Values
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $c3550->serial()
 | 
			
		||||
(B<chassisSerialNumberString>)
 | 
			
		||||
=item Inherited Classes' MIBs
 | 
			
		||||
 | 
			
		||||
=item $c3550->model()
 | 
			
		||||
(B<chassisModel>)
 | 
			
		||||
See SNMP::Info::Layer3 for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
=item $c3550->ps1_type()
 | 
			
		||||
(B<chassisPs1Type>)
 | 
			
		||||
See SNMP::Info::CiscoVTP for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
=item $c3550->ps2_type()
 | 
			
		||||
(B<chassisPs2Type>)
 | 
			
		||||
See SNMP::Info::CiscoStack for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
=item $c3550->ps1_status()
 | 
			
		||||
(B<chassisPs1Status>)
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=item $c3550->ps2_status()
 | 
			
		||||
(B<chassisPs2Status>)
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
=item $c3550->slots()
 | 
			
		||||
(B<chassisNumSlots>)
 | 
			
		||||
These are methods that return scalar value from SNMP
 | 
			
		||||
 | 
			
		||||
=item $c3550->fan()
 | 
			
		||||
(B<chassisFanStatus>)
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $c3550->vendor()
 | 
			
		||||
 | 
			
		||||
@@ -272,94 +198,33 @@ Arguments passed to new() are passed on to SNMP::Session::new()
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Globals imported from SNMP::Info::Layer3
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Layer3 for details.
 | 
			
		||||
 | 
			
		||||
=head2 Global Methods imported from SNMP::Info::CiscoVTP
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::CiscoVTP for details.
 | 
			
		||||
 | 
			
		||||
=head2 Global Methods imported from SNMP::Info::CiscoStack
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::CiscoStack for details.
 | 
			
		||||
 | 
			
		||||
=head1 TABLE ENTRIES
 | 
			
		||||
 | 
			
		||||
=head2 Overrides
 | 
			
		||||
These are methods that return tables of information in the form of a reference
 | 
			
		||||
to a hash.
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::Layer3
 | 
			
		||||
 | 
			
		||||
=item $c3550->i_type()
 | 
			
		||||
See documentation in SNMP::Info::Layer3 for details.
 | 
			
		||||
 | 
			
		||||
    Crosses p_port() with p_type() and returns the results. 
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::CiscoVTP
 | 
			
		||||
 | 
			
		||||
    Overrides with ifType if p_type() isn't available.
 | 
			
		||||
See documentation in SNMP::Info::CiscoVTP for details.
 | 
			
		||||
 | 
			
		||||
=item $c3550->i_name()
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::CiscoStack
 | 
			
		||||
 | 
			
		||||
    Crosses p_name with p_port and returns results.
 | 
			
		||||
 | 
			
		||||
=item $c3550->i_duplex()
 | 
			
		||||
 | 
			
		||||
    Crosses p_duplex with p_port and returns results.
 | 
			
		||||
 | 
			
		||||
=item $c3550->i_duplex_admin()
 | 
			
		||||
 | 
			
		||||
    Crosses p_duplex_admin with p_port.
 | 
			
		||||
 | 
			
		||||
    Munges bit_string returned from p_duplex_admin to get duplex settings.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Port Entry Table (CISCO-STACK-MIB::portTable)
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $c3550->p_name()
 | 
			
		||||
(B<portName>)
 | 
			
		||||
 | 
			
		||||
=item $c3550->p_type()
 | 
			
		||||
(B<portType>)
 | 
			
		||||
 | 
			
		||||
=item $c3550->p_status()
 | 
			
		||||
(B<portOperStatus>)
 | 
			
		||||
 | 
			
		||||
=item $c3550->p_status2()
 | 
			
		||||
(B<portAdditionalStatus>)
 | 
			
		||||
 | 
			
		||||
=item $c3550->p_speed()
 | 
			
		||||
(B<portAdminSpeed>)
 | 
			
		||||
 | 
			
		||||
=item $c3550->p_duplex()
 | 
			
		||||
(B<portDuplex>)
 | 
			
		||||
 | 
			
		||||
=item $c3550->p_port()
 | 
			
		||||
(B<portIfIndex>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Port Capability Table (CISCO-STACK-MIB::portCpbTable)
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $c3550->p_speed_admin()
 | 
			
		||||
(B<portCpbSpeed>)
 | 
			
		||||
 | 
			
		||||
=item $c3550->p_duplex_admin()
 | 
			
		||||
(B<portCpbDuplex>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 VLAN Entry Table
 | 
			
		||||
 | 
			
		||||
See ftp://ftp.cisco.com/pub/mibs/supportlists/wsc5000/wsc5000-communityIndexing.html
 | 
			
		||||
for a good treaty of how to connect to the VLANs
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $c3550->v_state()
 | 
			
		||||
(B<vtpVlanState>)
 | 
			
		||||
 | 
			
		||||
=item $c3550->v_type()
 | 
			
		||||
(B<vtpVlanType>)
 | 
			
		||||
 | 
			
		||||
=item $c3550->v_name()
 | 
			
		||||
(B<vtpVlanName>)
 | 
			
		||||
 | 
			
		||||
=item $c3550->v_mtu()
 | 
			
		||||
(B<vtpVlanMtu>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
See documentation in SNMP::Info::CiscoStack for details.
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										209
									
								
								Info/Layer3/C6500.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										209
									
								
								Info/Layer3/C6500.pm
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,209 @@
 | 
			
		||||
# SNMP::Info::Layer3::C6500
 | 
			
		||||
# Max Baker <max@warped.org>
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2003,2004 Max Baker
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
# 
 | 
			
		||||
# Redistribution and use in source and binary forms, with or without 
 | 
			
		||||
# modification, are permitted provided that the following conditions are met:
 | 
			
		||||
# 
 | 
			
		||||
#     * Redistributions of source code must retain the above copyright notice,
 | 
			
		||||
#       this list of conditions and the following disclaimer.
 | 
			
		||||
#     * Redistributions in binary form must reproduce the above copyright notice,
 | 
			
		||||
#       this list of conditions and the following disclaimer in the documentation
 | 
			
		||||
#       and/or other materials provided with the distribution.
 | 
			
		||||
#     * Neither the name of the Author, nor 
 | 
			
		||||
#       names of its contributors may be used to endorse or promote products 
 | 
			
		||||
#       derived from this software without specific prior written permission.
 | 
			
		||||
# 
 | 
			
		||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 | 
			
		||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
 | 
			
		||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
 | 
			
		||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 | 
			
		||||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 | 
			
		||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
 | 
			
		||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 | 
			
		||||
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
 | 
			
		||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::Layer3::C6500;
 | 
			
		||||
$VERSION = 0.8;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
use Exporter;
 | 
			
		||||
use SNMP::Info::Layer3;
 | 
			
		||||
use SNMP::Info::CiscoVTP;
 | 
			
		||||
use SNMP::Info::CiscoStack;
 | 
			
		||||
 | 
			
		||||
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
 | 
			
		||||
@SNMP::Info::Layer3::C6500::ISA = qw/ SNMP::Info::Layer3 SNMP::Info::CiscoStack SNMP::Info::CiscoVTP  Exporter/;
 | 
			
		||||
@SNMP::Info::Layer3::C6500::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
$DEBUG=0;
 | 
			
		||||
 | 
			
		||||
# See SNMP::Info for the details of these data structures and 
 | 
			
		||||
#       the interworkings.
 | 
			
		||||
$INIT = 0;
 | 
			
		||||
 | 
			
		||||
%MIBS = (
 | 
			
		||||
         %SNMP::Info::Layer3::MIBS,  
 | 
			
		||||
         %SNMP::Info::CiscoVTP::MIBS,
 | 
			
		||||
         %SNMP::Info::CiscoStack::MIBS,
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
            %SNMP::Info::Layer3::GLOBALS,
 | 
			
		||||
            %SNMP::Info::CiscoVTP::GLOBALS,
 | 
			
		||||
            %SNMP::Info::CiscoStack::GLOBALS,
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%FUNCS = (
 | 
			
		||||
            %SNMP::Info::Layer3::FUNCS,
 | 
			
		||||
            %SNMP::Info::CiscoVTP::FUNCS,
 | 
			
		||||
            %SNMP::Info::CiscoStack::FUNCS,
 | 
			
		||||
         );
 | 
			
		||||
 | 
			
		||||
%MUNGE = (
 | 
			
		||||
            # Inherit all the built in munging
 | 
			
		||||
            %SNMP::Info::Layer3::MUNGE,
 | 
			
		||||
            %SNMP::Info::CiscoVTP::MUNGE,
 | 
			
		||||
            %SNMP::Info::CiscoStack::MUNGE,
 | 
			
		||||
         );
 | 
			
		||||
 | 
			
		||||
# Pick and choose
 | 
			
		||||
 | 
			
		||||
*SNMP::Info::Layer3::C6500::serial     = \&SNMP::Info::CiscoStack::serial;
 | 
			
		||||
*SNMP::Info::Layer3::C6500::interfaces = \&SNMP::Info::Layer3::interfaces;
 | 
			
		||||
*SNMP::Info::Layer3::C6500::i_duplex   = \&SNMP::Info::CiscoStack::i_duplex;
 | 
			
		||||
#*SNMP::Info::Layer3::C6500::i_duplex_admin = \&SNMP::Info::Layer3::i_duplex_admin;
 | 
			
		||||
*SNMP::Info::Layer3::C6500::i_name     = \&SNMP::Info::Layer3::i_name;
 | 
			
		||||
*SNMP::Info::Layer3::C6500::i_type     = \&SNMP::Info::CiscoStack::i_type;
 | 
			
		||||
 | 
			
		||||
sub model {
 | 
			
		||||
    my $c6500 = shift;
 | 
			
		||||
    my $model1 = $c6500->model1();
 | 
			
		||||
    return $model1 if defined $model1;
 | 
			
		||||
    return $c6500->SUPER::model();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vendor {
 | 
			
		||||
    return 'cisco';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub cisco_comm_indexing {
 | 
			
		||||
    1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
__END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::Layer3::C6500 - Perl5 Interface to Cisco Catalyst 6500 Layer 2/3 Switches running IOS and/or CatOS
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
Max Baker (C<max@warped.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you. 
 | 
			
		||||
 my $c6500 = new SNMP::Info(
 | 
			
		||||
                          AutoSpecify => 1,
 | 
			
		||||
                          Debug       => 1,
 | 
			
		||||
                          # These arguments are passed directly on to SNMP::Session
 | 
			
		||||
                          DestHost    => 'myswitch',
 | 
			
		||||
                          Community   => 'public',
 | 
			
		||||
                          Version     => 2
 | 
			
		||||
                        ) 
 | 
			
		||||
    or die "Can't connect to DestHost.\n";
 | 
			
		||||
 | 
			
		||||
 my $class      = $c6500->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Abstraction subclass for Cisco Catalyst 6500 Layer 2/3 Switches.  
 | 
			
		||||
 | 
			
		||||
These devices run IOS but have some of the same charactersitics as the Catalyst WS-C family (5xxx). 
 | 
			
		||||
For example, forwarding tables are held in VLANs, and extened interface information
 | 
			
		||||
is gleened from CISCO-SWITCH-MIB.
 | 
			
		||||
 | 
			
		||||
For speed or debugging purposes you can call the subclass directly, but not after determining
 | 
			
		||||
a more specific class using the method above. 
 | 
			
		||||
 | 
			
		||||
 my $c6500 = new SNMP::Info::Layer3::C6500(...);
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Layer3
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::CiscoVTP
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::CiscoStack
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item Inherited Classes' MIBs
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::Layer3 for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::CiscoVTP for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::CiscoStack for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar value from SNMP
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $c6500->vendor()
 | 
			
		||||
 | 
			
		||||
    Returns 'cisco'
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Globals imported from SNMP::Info::Layer3
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Layer3 for details.
 | 
			
		||||
 | 
			
		||||
=head2 Global Methods imported from SNMP::Info::CiscoVTP
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::CiscoVTP for details.
 | 
			
		||||
 | 
			
		||||
=head2 Global Methods imported from SNMP::Info::CiscoStack
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::CiscoStack for details.
 | 
			
		||||
 | 
			
		||||
=head1 TABLE ENTRIES
 | 
			
		||||
 | 
			
		||||
These are methods that return tables of information in the form of a reference
 | 
			
		||||
to a hash.
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::Layer3
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Layer3 for details.
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::CiscoVTP
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::CiscoVTP for details.
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::CiscoStack
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::CiscoStack for details.
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
 | 
			
		||||
@@ -1,6 +1,8 @@
 | 
			
		||||
# SNMP::Info::Layer3::Foundry - SNMP Interface to Foundry devices
 | 
			
		||||
# Max Baker <max@warped.org>
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2002,2003 Regents of the University of California
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
# 
 | 
			
		||||
@@ -28,7 +30,7 @@
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::Layer3::Foundry;
 | 
			
		||||
$VERSION = 0.3;
 | 
			
		||||
$VERSION = 0.8;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
@@ -222,16 +224,7 @@ __END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::Layer3::Foundry - Perl5 Interface to Foundry Network Devices
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
This module provides limited functionality from older Foundry devices.
 | 
			
		||||
Specifically designed for a FI4802
 | 
			
		||||
 | 
			
		||||
Data comes RFC1213 and FOUNDRY-SN-ROOT-MIB
 | 
			
		||||
 | 
			
		||||
Inherits all methods from both SNMP::Info and SNMP::Info::Bridge
 | 
			
		||||
SNMP::Info::Layer3::Foundry - Perl5 Interface to Foundry FastIron Network Devices
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
@@ -239,127 +232,168 @@ Max Baker (C<max@warped.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 my $foundry = new SNMP::Info::Layer3::Foundry(DestHost  => 'switch' , 
 | 
			
		||||
                              Community => 'public' ); 
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you. 
 | 
			
		||||
 my $foundry = new SNMP::Info(
 | 
			
		||||
                          AutoSpecify => 1,
 | 
			
		||||
                          Debug       => 1,
 | 
			
		||||
                          # These arguments are passed directly on to SNMP::Session
 | 
			
		||||
                          DestHost    => 'myswitch',
 | 
			
		||||
                          Community   => 'public',
 | 
			
		||||
                          Version     => 1
 | 
			
		||||
                        ) 
 | 
			
		||||
    or die "Can't connect to DestHost.\n";
 | 
			
		||||
 | 
			
		||||
See L<SNMP::Info> and L<SNMP::Info::Layer3> for all inherited methods.
 | 
			
		||||
 my $class      = $foundry->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
=head1 CREATING AN OBJECT
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
This subclass no longer supported.
 | 
			
		||||
 | 
			
		||||
This module provides limited functionality from older Foundry devices.
 | 
			
		||||
 | 
			
		||||
Specifically designed for a FI4802.
 | 
			
		||||
 | 
			
		||||
For speed or debugging purposes you can call the subclass directly, but not after determining
 | 
			
		||||
a more specific class using the method above.  Turn off the AutoSpecify flag.
 | 
			
		||||
 | 
			
		||||
 my $foundry = new SNMP::Info::Layer3::Foundry(...);
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item  new SNMP::Info::Layer3::Foundry()
 | 
			
		||||
=item SNMP::Info
 | 
			
		||||
 | 
			
		||||
Arguments passed to new() are passed on to SNMP::Session::new()
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    my $foundry = new SNMP::Info::Layer3::Foundry(
 | 
			
		||||
        DestHost => $host,
 | 
			
		||||
        Community => 'public',
 | 
			
		||||
        Version => 3,...
 | 
			
		||||
        ) 
 | 
			
		||||
    die "Couldn't connect.\n" unless defined $foundry;
 | 
			
		||||
=item SNMP::Info::Bridge
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 GLOBAL VALUES
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item FOUNDRY-SN-ROOT-MIB
 | 
			
		||||
 | 
			
		||||
=item Inherited Classes' MIBs
 | 
			
		||||
 | 
			
		||||
See classes listed above for their required MIBs.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
The Foundry MIBS can be downloaded from www.mibdepot.com and ??
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar value from SNMP
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $foundry->model()
 | 
			
		||||
 | 
			
		||||
    Returns model type.  Checks $foundry->id() against the 
 | 
			
		||||
    FOUNDRY-SN-ROOT-MIB and then parses out xxNNNN
 | 
			
		||||
Returns model type.  Checks $foundry->id() against the 
 | 
			
		||||
FOUNDRY-SN-ROOT-MIB and then parses out xxNNNN
 | 
			
		||||
 | 
			
		||||
=item $foundry->vendor()
 | 
			
		||||
 | 
			
		||||
    Returns 'foundry' :)
 | 
			
		||||
Returns 'foundry' :)
 | 
			
		||||
 | 
			
		||||
=item $foundry->mac()
 | 
			
		||||
 | 
			
		||||
    Returns MAC Address of root port.
 | 
			
		||||
Returns MAC Address of root port.
 | 
			
		||||
 | 
			
		||||
    (B<ifPhysAddress.1>)
 | 
			
		||||
(B<ifPhysAddress.1>)
 | 
			
		||||
 | 
			
		||||
=item $foundry->chassis()
 | 
			
		||||
 | 
			
		||||
    Returns Chassis type.
 | 
			
		||||
Returns Chassis type.
 | 
			
		||||
 | 
			
		||||
    (B<entPhysicalDescr.1>)
 | 
			
		||||
(B<entPhysicalDescr.1>)
 | 
			
		||||
 | 
			
		||||
=item $foundry->serial()
 | 
			
		||||
 | 
			
		||||
    Returns serial number of device.
 | 
			
		||||
Returns serial number of device.
 | 
			
		||||
 | 
			
		||||
    (B<snChasSerNum>)
 | 
			
		||||
(B<snChasSerNum>)
 | 
			
		||||
 | 
			
		||||
=item $foundry->temp()
 | 
			
		||||
 | 
			
		||||
    Returns the chassis temperature
 | 
			
		||||
Returns the chassis temperature
 | 
			
		||||
 | 
			
		||||
    (B<snChasActualTemperature>)
 | 
			
		||||
(B<snChasActualTemperature>)
 | 
			
		||||
 | 
			
		||||
=item $foundry->ps1_type()
 | 
			
		||||
 | 
			
		||||
    Returns the Description for the power supply
 | 
			
		||||
Returns the Description for the power supply
 | 
			
		||||
 | 
			
		||||
    (B<snChasPwrSupplyDescription.1>)
 | 
			
		||||
(B<snChasPwrSupplyDescription.1>)
 | 
			
		||||
 | 
			
		||||
=item $foundry->ps1_status()
 | 
			
		||||
 | 
			
		||||
    Returns the status of the power supply.
 | 
			
		||||
Returns the status of the power supply.
 | 
			
		||||
 | 
			
		||||
    (B<snChasPwrSupplyOperStatus.1>)
 | 
			
		||||
(B<snChasPwrSupplyOperStatus.1>)
 | 
			
		||||
 | 
			
		||||
=item $foundry->fan()
 | 
			
		||||
 | 
			
		||||
    Returns the status of the chassis fan.
 | 
			
		||||
Returns the status of the chassis fan.
 | 
			
		||||
 | 
			
		||||
    (B<snChasFanOperStatus.1>)
 | 
			
		||||
(B<snChasFanOperStatus.1>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Globals imported from SNMP::Info
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info for details.
 | 
			
		||||
 | 
			
		||||
=head2 Globals imported from SNMP::Info::Bridge
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Bridge for details.
 | 
			
		||||
 | 
			
		||||
=head1 TABLE ENTRIES
 | 
			
		||||
 | 
			
		||||
These are methods that return tables of information in the form of a reference
 | 
			
		||||
to a hash.
 | 
			
		||||
 | 
			
		||||
=head2 Overrides
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $foundry->interfaces()
 | 
			
		||||
 | 
			
		||||
    Returns reference to hash of interface names to iids.
 | 
			
		||||
Returns reference to hash of interface names to iids.
 | 
			
		||||
 | 
			
		||||
    Uses B<ifDescr>.
 | 
			
		||||
Uses B<ifDescr>.
 | 
			
		||||
 | 
			
		||||
=item $foundry->i_name()
 | 
			
		||||
 | 
			
		||||
   Returns reference to hash of interface names.  
 | 
			
		||||
   Trys for B<ifAlias> and Defaults to B<ifName>
 | 
			
		||||
Returns reference to hash of interface names.  
 | 
			
		||||
Trys for B<ifAlias> and Defaults to B<ifName>
 | 
			
		||||
 | 
			
		||||
=item $foundry->i_ignore()
 | 
			
		||||
 | 
			
		||||
   Returns reference to hash of interfaces to be ignored.
 | 
			
		||||
Returns reference to hash of interfaces to be ignored.
 | 
			
		||||
 | 
			
		||||
   Ignores interfaces with descriptions of  tunnel,loopback,null 
 | 
			
		||||
Ignores interfaces with descriptions of  tunnel,loopback,null 
 | 
			
		||||
 | 
			
		||||
=item $foundry->i_duplex()
 | 
			
		||||
 | 
			
		||||
    Returns reference to hash of interface link duplex status. 
 | 
			
		||||
Returns reference to hash of interface link duplex status. 
 | 
			
		||||
 | 
			
		||||
    Crosses $foundry->sw_duplex() with $foundry->sw_index()
 | 
			
		||||
Crosses $foundry->sw_duplex() with $foundry->sw_index()
 | 
			
		||||
 | 
			
		||||
=item $foundry->i_type()
 | 
			
		||||
 | 
			
		||||
    Returns reference to hash of interface types.
 | 
			
		||||
    
 | 
			
		||||
    Crosses $foundry->sw_type() with $foundry->sw_index()
 | 
			
		||||
Returns reference to hash of interface types.
 | 
			
		||||
 | 
			
		||||
Crosses $foundry->sw_type() with $foundry->sw_index()
 | 
			
		||||
 | 
			
		||||
=item $foundry->i_speed()
 | 
			
		||||
 | 
			
		||||
    Returns reference to hash of interface speeds .
 | 
			
		||||
Returns reference to hash of interface speeds .
 | 
			
		||||
 | 
			
		||||
    Crosses $foundry->sw_speeD() with $foundry->sw_index() and 
 | 
			
		||||
    does a little munging.
 | 
			
		||||
Crosses $foundry->sw_speeD() with $foundry->sw_index() and 
 | 
			
		||||
does a little munging.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
@@ -369,21 +403,21 @@ Arguments passed to new() are passed on to SNMP::Session::new()
 | 
			
		||||
 | 
			
		||||
=item $foundry->at_index()
 | 
			
		||||
 | 
			
		||||
    Returns reference to hash.  Maps ARP table entries to Interface IIDs 
 | 
			
		||||
Returns reference to hash.  Maps ARP table entries to Interface IIDs 
 | 
			
		||||
 | 
			
		||||
    (B<ipNetToMediaIfIndex>)
 | 
			
		||||
(B<ipNetToMediaIfIndex>)
 | 
			
		||||
 | 
			
		||||
=item $foundry->at_paddr()
 | 
			
		||||
 | 
			
		||||
   Returns reference to hash.  Maps ARP table entries to MAC addresses. 
 | 
			
		||||
Returns reference to hash.  Maps ARP table entries to MAC addresses. 
 | 
			
		||||
 | 
			
		||||
    (B<ipNetToMediaPhysAddress>)
 | 
			
		||||
(B<ipNetToMediaPhysAddress>)
 | 
			
		||||
 | 
			
		||||
=item $foundry->at_netaddr()
 | 
			
		||||
 | 
			
		||||
   Returns reference to hash.  Maps ARP table entries to IPs 
 | 
			
		||||
Returns reference to hash.  Maps ARP table entries to IPs 
 | 
			
		||||
 | 
			
		||||
    (B<ipNetToMediaNetAddress>)
 | 
			
		||||
(B<ipNetToMediaNetAddress>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
@@ -393,28 +427,36 @@ Arguments passed to new() are passed on to SNMP::Session::new()
 | 
			
		||||
 | 
			
		||||
=item $foundry->sw_index()
 | 
			
		||||
 | 
			
		||||
    Returns reference to hash.  Maps Table to Interface IID. 
 | 
			
		||||
Returns reference to hash.  Maps Table to Interface IID. 
 | 
			
		||||
 | 
			
		||||
    (B<snSwPortIfIndex>)
 | 
			
		||||
(B<snSwPortIfIndex>)
 | 
			
		||||
 | 
			
		||||
=item $foundry->sw_duplex()
 | 
			
		||||
 | 
			
		||||
   Returns reference to hash.   Current duplex status for switch ports. 
 | 
			
		||||
Returns reference to hash.   Current duplex status for switch ports. 
 | 
			
		||||
 | 
			
		||||
    (B<snSwPortInfoChnMode>)
 | 
			
		||||
(B<snSwPortInfoChnMode>)
 | 
			
		||||
 | 
			
		||||
=item $foundry->sw_type()
 | 
			
		||||
 | 
			
		||||
    Returns reference to hash.  Current Port Type .
 | 
			
		||||
Returns reference to hash.  Current Port Type .
 | 
			
		||||
 | 
			
		||||
    (B<snSwPortInfoMediaType>)
 | 
			
		||||
(B<snSwPortInfoMediaType>)
 | 
			
		||||
 | 
			
		||||
=item $foundry->sw_speed()
 | 
			
		||||
 | 
			
		||||
   Returns reference to hash.  Current Port Speed. 
 | 
			
		||||
Returns reference to hash.  Current Port Speed. 
 | 
			
		||||
 | 
			
		||||
    (B<snSwPortInfoSpeed>)
 | 
			
		||||
(B<snSwPortInfoSpeed>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info for details.
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::Bridge
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Bridge for details.
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										71
									
								
								Info/MAU.pm
									
									
									
									
									
								
							
							
						
						
									
										71
									
								
								Info/MAU.pm
									
									
									
									
									
								
							@@ -1,6 +1,8 @@
 | 
			
		||||
# SNMP::Info::MAU - Media Access Unit - RFC2668
 | 
			
		||||
# Max Baker <max@warped.org>
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2002,2003 Regents of the University of California
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
# 
 | 
			
		||||
@@ -28,7 +30,7 @@
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::MAU;
 | 
			
		||||
$VERSION = 0.3;
 | 
			
		||||
$VERSION = 0.8;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
@@ -109,15 +111,7 @@ __END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::MAU - Perl5 Interface to SNMP Medium Access Unit (MAU) MIB (RFC2668) 
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
MAU-MIB is used by Layer 2 devices like HP Switches . The MAU table
 | 
			
		||||
contains link and duplex info for the port itself and the device
 | 
			
		||||
connected to that port.
 | 
			
		||||
 | 
			
		||||
Inherits all methods from SNMP::Info
 | 
			
		||||
SNMP::Info::MAU - Perl5 Interface to Medium Access Unit (MAU) MIB (RFC2668) via SNMP
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
@@ -125,28 +119,47 @@ Max Baker (C<max@warped.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 my $mau = new SNMP::Info::MAU(      DestHost  => 'myswitch',
 | 
			
		||||
                               Community => 'public');
 | 
			
		||||
 my $mau = new SNMP::Info ( 
 | 
			
		||||
                             AutoSpecify => 1,
 | 
			
		||||
                             Debug       => 1,
 | 
			
		||||
                             DestHost    => 'hpswitch', 
 | 
			
		||||
                             Community   => 'public',
 | 
			
		||||
                             Version     => 2
 | 
			
		||||
                           );
 | 
			
		||||
 
 | 
			
		||||
 my $class = $mau->class();
 | 
			
		||||
 print " Using device sub class : $class\n";
 | 
			
		||||
 | 
			
		||||
=head1 CREATING AN OBJECT
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
SNMP::Info::MAU is a sublcass of SNMP::Info that supplies access to the
 | 
			
		||||
MAU-MIB (RFC2668). This MIB is sometimes implemented on Layer 2 network devices like HP Switches.
 | 
			
		||||
MAU = Media Access Unit.
 | 
			
		||||
 | 
			
		||||
The MAU table contains link and duplex info for the port itself and the device
 | 
			
		||||
connected to that port.
 | 
			
		||||
 | 
			
		||||
Normally you use or create a subclass of SNMP::Info that inherits this one.  Do not use directly.
 | 
			
		||||
 | 
			
		||||
For debugging purposes call the class directly as you would SNMP::Info
 | 
			
		||||
 | 
			
		||||
 my $mau = new SNMP::Info::MAU(...);
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
None.
 | 
			
		||||
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item  new SNMP::Info::MAU()
 | 
			
		||||
 | 
			
		||||
Arguments passed to new() are passed on to SNMP::Session::new()
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    my $mau = new SNMP::Info::MAU(
 | 
			
		||||
        DestHost => $host,
 | 
			
		||||
        Community => 'public',
 | 
			
		||||
        Version => 3,...
 | 
			
		||||
        ) 
 | 
			
		||||
    die "Couldn't connect.\n" unless defined $mau;
 | 
			
		||||
=item MAU-MIB
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 MAU Global Configuration Values
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar value from SNMP
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
@@ -154,7 +167,12 @@ Arguments passed to new() are passed on to SNMP::Session::new()
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 MAU INTERFACE TABLE ENTRIES
 | 
			
		||||
=head1 TABLE METHODS
 | 
			
		||||
 | 
			
		||||
These are methods that return tables of information in the form of a reference
 | 
			
		||||
to a hash.
 | 
			
		||||
 | 
			
		||||
=head2 MAU INTERFACE TABLE ENTRIES
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
@@ -254,4 +272,5 @@ capabilities of the device on the other end.
 | 
			
		||||
    high.  Currently bits 10,12,15,17,19.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										15
									
								
								MANIFEST
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								MANIFEST
									
									
									
									
									
								
							@@ -1,13 +1,18 @@
 | 
			
		||||
ChangeLog
 | 
			
		||||
COPYRIGHT
 | 
			
		||||
ChangeLog
 | 
			
		||||
Info.pm
 | 
			
		||||
Info/Bridge.pm
 | 
			
		||||
Info/CDP.pm
 | 
			
		||||
Info/CiscoStats.pm
 | 
			
		||||
Info/CiscoStack.pm
 | 
			
		||||
Info/CiscoVTP.pm
 | 
			
		||||
Info/Entity.pm
 | 
			
		||||
Info/EtherLike.pm
 | 
			
		||||
Info/Layer1.pm
 | 
			
		||||
Info/Layer1/Allied.pm
 | 
			
		||||
Info/Layer1/Asante.pm
 | 
			
		||||
Info/Layer2.pm
 | 
			
		||||
Info/Layer2/Aironet.pm
 | 
			
		||||
Info/Layer2/Bay.pm
 | 
			
		||||
Info/Layer2/C1900.pm
 | 
			
		||||
Info/Layer2/C2900.pm
 | 
			
		||||
@@ -15,10 +20,14 @@ Info/Layer2/Catalyst.pm
 | 
			
		||||
Info/Layer2/HP.pm
 | 
			
		||||
Info/Layer3.pm
 | 
			
		||||
Info/Layer3/Aironet.pm
 | 
			
		||||
Info/Layer3/Foundry.pm
 | 
			
		||||
Info/Layer3/C3550.pm
 | 
			
		||||
Info/Layer3/C6500.pm
 | 
			
		||||
Info/Layer3/Foundry.pm
 | 
			
		||||
Info/MAU.pm
 | 
			
		||||
MANIFEST
 | 
			
		||||
Makefile.PL
 | 
			
		||||
README
 | 
			
		||||
test.pl
 | 
			
		||||
t/prereq.t
 | 
			
		||||
t/test_class.pl
 | 
			
		||||
t/make_dev_matrix.pl
 | 
			
		||||
DeviceMatrix.txt
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										11
									
								
								Makefile.PL
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								Makefile.PL
									
									
									
									
									
								
							@@ -5,8 +5,12 @@ use ExtUtils::MakeMaker;
 | 
			
		||||
WriteMakefile(
 | 
			
		||||
    'NAME'               => 'SNMP::Info',
 | 
			
		||||
    'VERSION_FROM'       => 'Info.pm',
 | 
			
		||||
# SNMP not available on CPAN -- not installable by CPAN
 | 
			
		||||
#    'PREREQ_PM'          => {'SNMP' => '4'},
 | 
			
		||||
    'PREREQ_PM'          => {
 | 
			
		||||
                                'Math::BigInt' => 0
 | 
			
		||||
                                # SNMP not available on CPAN . 
 | 
			
		||||
                                # Install with net-snmp.sourceforge.net
 | 
			
		||||
                                # 'SNMP' => '4'
 | 
			
		||||
                            },
 | 
			
		||||
    ($] >= 5.005 ?    
 | 
			
		||||
          (ABSTRACT_FROM => 'Info.pm', 
 | 
			
		||||
           AUTHOR        => 'Max Baker <max@warped.org>')
 | 
			
		||||
@@ -17,5 +21,6 @@ WriteMakefile(
 | 
			
		||||
 | 
			
		||||
sub MY::postamble { "
 | 
			
		||||
.PHONY: readme
 | 
			
		||||
readme:
 | 
			
		||||
readme: README
 | 
			
		||||
README: Info.pm
 | 
			
		||||
	pod2text -l Info.pm > README" }
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										321
									
								
								t/make_dev_matrix.pl
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										321
									
								
								t/make_dev_matrix.pl
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,321 @@
 | 
			
		||||
#!/usr/bin/perl -w
 | 
			
		||||
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
$DevMatrix = '../DeviceMatrix.txt';
 | 
			
		||||
$DevHTML   = 'DeviceMatrix.html';
 | 
			
		||||
$DevPNG    = 'DeviceMatrix.png';
 | 
			
		||||
$Attributes= {};
 | 
			
		||||
 | 
			
		||||
# Parse Data File
 | 
			
		||||
$matrix = parse_data($DevMatrix);
 | 
			
		||||
 | 
			
		||||
# Graph it for fun
 | 
			
		||||
eval "use GraphViz::Data::Structure;";
 | 
			
		||||
if ($@) {
 | 
			
		||||
    print "GraphViz::Data::Structure not installed. $@\n";
 | 
			
		||||
} else {
 | 
			
		||||
    my %graph = ();
 | 
			
		||||
    foreach my $vendor (sort sort_nocase keys %$matrix){
 | 
			
		||||
        $graph{$vendor} = {};
 | 
			
		||||
        foreach my $family  (sort sort_nocase keys %{$matrix->{$vendor}->{families}} ){
 | 
			
		||||
            my @models;
 | 
			
		||||
            foreach my $mod (keys %{$matrix->{$vendor}->{families}->{$family}->{models}}){
 | 
			
		||||
                push(@models,split(/\s*,\s*/,$mod));
 | 
			
		||||
            }
 | 
			
		||||
            if (scalar @models){
 | 
			
		||||
                $graph{$vendor}->{$family}=\@models;
 | 
			
		||||
            } else {
 | 
			
		||||
                $graph{$vendor}->{$family}=[];
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    my $now = scalar localtime;
 | 
			
		||||
    my $gvds = GraphViz::Data::Structure->new(\%graph,Orientation=>'vertical',
 | 
			
		||||
        Colors=> 'Deep',
 | 
			
		||||
        graph => {label=>"SNMP::Info and Netdisco Supported Devices \n $now",'fontpath'=>'/usr/local/netdisco','fontname'=>'lucon',concentrate=>'true','overlap'=>'false',spline=>'true',bgcolor=>'wheat'},
 | 
			
		||||
        node  => {fontname=>'lucon'},
 | 
			
		||||
        );
 | 
			
		||||
    $gvds->graph()->as_png($DevPNG);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
open (HTML, "> $DevHTML") or die "Can't open $DevHTML. $!\n";
 | 
			
		||||
$old_fh = select(HTML);
 | 
			
		||||
&html_head;
 | 
			
		||||
print_vendors($matrix);
 | 
			
		||||
foreach my $vendor (sort sort_nocase keys %$matrix){
 | 
			
		||||
    print "<A NAME=\"$vendor\"><SPAN CLASS=\"vendor\"><B>$vendor</B></SPAN></A>\n";
 | 
			
		||||
    print "<DL>\n";
 | 
			
		||||
 | 
			
		||||
    my $vendor_defaults = $matrix->{$vendor}->{defaults};
 | 
			
		||||
    print_notes($vendor_defaults,1);
 | 
			
		||||
 | 
			
		||||
    my $families = $matrix->{$vendor}->{families};
 | 
			
		||||
    foreach my $family (sort sort_nocase keys %$families ) {
 | 
			
		||||
        print "<DT>$family Family\n";
 | 
			
		||||
 | 
			
		||||
        my $family_defaults = $families->{$family}->{defaults};
 | 
			
		||||
        print_notes($family_defaults,2);
 | 
			
		||||
 | 
			
		||||
        my $models = $families->{$family}->{models};
 | 
			
		||||
        foreach my $model (sort sort_nocase keys %$models ){
 | 
			
		||||
            my $model_defaults = $models->{$model}->{defaults};
 | 
			
		||||
            print "<DD>$model\n";
 | 
			
		||||
            print "<DL>\n";
 | 
			
		||||
            print_notes($model_defaults,3);
 | 
			
		||||
 | 
			
		||||
            print "<DT><DD><TABLE BORDER=1>\n";
 | 
			
		||||
            print_headers();
 | 
			
		||||
            print "<TR>\n";
 | 
			
		||||
            foreach my $a (sort sort_nocase keys %$Attributes) {
 | 
			
		||||
                my $val;
 | 
			
		||||
                next if $a eq 'note';
 | 
			
		||||
                $val = ['-'];
 | 
			
		||||
                $class = 'none';
 | 
			
		||||
                if (defined $model_defaults->{$a}) {
 | 
			
		||||
                    $val = $model_defaults->{$a};
 | 
			
		||||
                    $class = 'model';
 | 
			
		||||
                } elsif (defined $family_defaults->{$a}){
 | 
			
		||||
                    $val = $family_defaults->{$a};
 | 
			
		||||
                    $class = 'family';
 | 
			
		||||
                } elsif (defined $vendor_defaults->{$a}){
 | 
			
		||||
                    $val = $vendor_defaults->{$a};
 | 
			
		||||
                    $class = 'vendor';
 | 
			
		||||
                } 
 | 
			
		||||
                print "  <TD CLASS='$class'>",join("<BR>\n",@$val),"</TD>\n";
 | 
			
		||||
            }
 | 
			
		||||
            print "</TR></TABLE>\n";
 | 
			
		||||
            print "</DL>\n";
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    print "</DL>\n";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
&html_tail;
 | 
			
		||||
 | 
			
		||||
select ($old_fh);
 | 
			
		||||
close (HTML) or die "Can't write $DevHTML. $!\n";
 | 
			
		||||
 | 
			
		||||
# Data Structures
 | 
			
		||||
 | 
			
		||||
# Matrix =
 | 
			
		||||
#   ( vendor => { families  => { family => family_hash },
 | 
			
		||||
#                  defaults => { cmd    => [values]    },
 | 
			
		||||
#               }
 | 
			
		||||
#   )
 | 
			
		||||
 | 
			
		||||
# Family Hash
 | 
			
		||||
#   ( models   => { model => model_hash },
 | 
			
		||||
#     defaults => { cmd   => [values]   }
 | 
			
		||||
#   )
 | 
			
		||||
 | 
			
		||||
# Model Hash
 | 
			
		||||
#   ( defaults => { cmd => [values] } )
 | 
			
		||||
sub parse_data {
 | 
			
		||||
    my $file = shift;
 | 
			
		||||
    my %ignore = map { $_ => 1  }  @_;
 | 
			
		||||
    my $Matrix;
 | 
			
		||||
 | 
			
		||||
    my @Lines;
 | 
			
		||||
    open (DM, "< $file") or die "Can't open $file. $!\n";
 | 
			
		||||
    {
 | 
			
		||||
        @Lines = <DM>;
 | 
			
		||||
    }
 | 
			
		||||
    close (DM);
 | 
			
		||||
 | 
			
		||||
    my ($device,$family,$vendor,$class);
 | 
			
		||||
    foreach my $line (@Lines){
 | 
			
		||||
        chomp($line);
 | 
			
		||||
        # Comments
 | 
			
		||||
        $line =~ s/#.*//;
 | 
			
		||||
 | 
			
		||||
        # Blank Lines
 | 
			
		||||
        next if $line =~ /^\s*$/;
 | 
			
		||||
 | 
			
		||||
        # Trim whitespace
 | 
			
		||||
        $line =~ s/^\s+//;
 | 
			
		||||
        $line =~ s/\s+$//;
 | 
			
		||||
 | 
			
		||||
        my ($cmd,$value);
 | 
			
		||||
        if ($line =~ /^([a-z-_]+)\s*:\s*(.*)$/) {
 | 
			
		||||
            $cmd = $1;  $value = $2; 
 | 
			
		||||
        } else {
 | 
			
		||||
            print "What do i do with this line : $line \n";
 | 
			
		||||
            next;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (exists $ignore{$cmd}){
 | 
			
		||||
            print "Ignoring $cmd\n";
 | 
			
		||||
        }
 | 
			
		||||
        # Set Class {vendor,family,device}
 | 
			
		||||
        if ($cmd eq 'device-vendor'){
 | 
			
		||||
            $vendor = $value;
 | 
			
		||||
            $family = $model = undef;
 | 
			
		||||
            $Matrix->{$vendor} = {} unless defined $Matrix->{$vendor};
 | 
			
		||||
            $class = $Matrix->{$vendor};
 | 
			
		||||
            $class->{defaults}->{type}='vendor';
 | 
			
		||||
            next;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($cmd eq 'device-family'){
 | 
			
		||||
            $family = $value;
 | 
			
		||||
            $model = undef;
 | 
			
		||||
            print "$family has no vendor.\n" unless defined $vendor;
 | 
			
		||||
            $Matrix->{$vendor}->{families}->{$family} = {} 
 | 
			
		||||
                unless defined $Matrix->{$vendor}->{families}->{$family};
 | 
			
		||||
            $class = $Matrix->{$vendor}->{families}->{$family};
 | 
			
		||||
            $class->{defaults}->{type}='family';
 | 
			
		||||
            next;
 | 
			
		||||
        }   
 | 
			
		||||
 | 
			
		||||
        if ($cmd eq 'device') {
 | 
			
		||||
            $model = $value;
 | 
			
		||||
            print "$model has no family.\n" unless defined $family;
 | 
			
		||||
            print "$model has no vendor.\n" unless defined $vendor;
 | 
			
		||||
            $Matrix->{$vendor}->{families}->{$family}->{models}->{$model} = {} 
 | 
			
		||||
                unless defined $Matrix->{$vendor}->{families}->{$family}->{models}->{$model};
 | 
			
		||||
            $class = $Matrix->{$vendor}->{families}->{$family}->{models}->{$model};
 | 
			
		||||
            $class->{defaults}->{type}='device';
 | 
			
		||||
            next;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        # Store attribute
 | 
			
		||||
        push (@{$class->{defaults}->{$cmd}} , $value);
 | 
			
		||||
        $Attributes->{$cmd}++;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return $Matrix;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub sort_nocase {
 | 
			
		||||
    return lc($a) cmp lc($b);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub print_notes {
 | 
			
		||||
    my $defaults = shift;
 | 
			
		||||
    my $level    = shift;
 | 
			
		||||
    my $notes    = $defaults->{note} || [];
 | 
			
		||||
    foreach my $note (@$notes){
 | 
			
		||||
        if ($note =~ s/^!//){
 | 
			
		||||
            $note = '<SPAN CLASS="note">' . $note . '</SPAN>';
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    if (scalar @$notes){
 | 
			
		||||
        print "<DT>\n";
 | 
			
		||||
        my $print_note = join("\n<LI>",@$notes);
 | 
			
		||||
        print "<UL TYPE='square'><LI>$print_note</UL>\n";
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub print_vendors {
 | 
			
		||||
    my $matrix=shift;
 | 
			
		||||
    print "<h1>Device Vendors</h1>\n";
 | 
			
		||||
    foreach my $vendor (sort sort_nocase keys %$matrix){
 | 
			
		||||
        print "[<A HREF=\"#$vendor\">$vendor</A>]\n";
 | 
			
		||||
    }
 | 
			
		||||
    print "<HR>\n";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub html_head {
 | 
			
		||||
    print <<"end_head";
 | 
			
		||||
<HTML>
 | 
			
		||||
<HEAD>
 | 
			
		||||
<TITLE>SNMP::Info - Device Compatibility Matrix</TITLE>
 | 
			
		||||
<STYLE TYPE="text/css" MEDIA="screen">
 | 
			
		||||
<!--
 | 
			
		||||
    BODY    { font-family:arial,helvetica,sans-serif; font-size:12pt; }
 | 
			
		||||
    TD      { font-family:arial,helvetica,sans-serif; font-size:10pt; }
 | 
			
		||||
    TH      { font-family:arial,helvetica,sans-serif; font-size:10pt; background:#F0F0F0; }
 | 
			
		||||
    H1      { font-family:arial,helvetica,sans-serif; font-size:14pt; }
 | 
			
		||||
    .vendor { font-size:12pt; color:#777777; }
 | 
			
		||||
    .family { font-size:12pt; color:blue; }
 | 
			
		||||
    .model  { font-size:12pt; color:red; }
 | 
			
		||||
    .note   { color:red; } 
 | 
			
		||||
//-->
 | 
			
		||||
</STYLE>
 | 
			
		||||
</HEAD>
 | 
			
		||||
<BODY>
 | 
			
		||||
<h1>SNMP::Info - Device Compatibility Matrix</h1>
 | 
			
		||||
<P>
 | 
			
		||||
end_head
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub html_tail {
 | 
			
		||||
    print <<'end_tail';
 | 
			
		||||
<HR>
 | 
			
		||||
<h1>Color Key</h1>
 | 
			
		||||
[<SPAN CLASS="model">Model Attribute</SPAN>]
 | 
			
		||||
[<SPAN CLASS="family">Family Attribute</SPAN>]
 | 
			
		||||
[<SPAN CLASS="vendor">Vendor Attribute</SPAN>]
 | 
			
		||||
<h1>Attribute Key</h1>
 | 
			
		||||
A value of <B>-</B> signifies the information is not specified and can
 | 
			
		||||
be assumed working.
 | 
			
		||||
<TABLE BORDER=1>
 | 
			
		||||
<TR>
 | 
			
		||||
    <TD>Arpnip</TD>
 | 
			
		||||
    <TD>Ability to collect ARP tables for MAC to IP translation.</TD>
 | 
			
		||||
</TR>
 | 
			
		||||
<TR>
 | 
			
		||||
    <TD>CDP</TD>
 | 
			
		||||
    <TD>Cisco Discovery Protocol usable.
 | 
			
		||||
        <UL>
 | 
			
		||||
            <LI><tt>Yes</tt> - Has CDP information through CISCO-CDP-MIB
 | 
			
		||||
            <LI><tt>Proprietary</tt> means the device has its own L2 Discovery Protocol.
 | 
			
		||||
        </UL>
 | 
			
		||||
    </TD>
 | 
			
		||||
</TR>
 | 
			
		||||
<TR>
 | 
			
		||||
    <TD>Class</TD>
 | 
			
		||||
    <TD>SNMP::Info Class the the device currently uses.  Devices using more generic
 | 
			
		||||
        interfaces like <tt>Layer2</tt> or <tt>Layer3</tt> may eventually get their
 | 
			
		||||
        own subclass.
 | 
			
		||||
    </TD>
 | 
			
		||||
</TR>
 | 
			
		||||
<TR>
 | 
			
		||||
    <TD>Duplex</TD>
 | 
			
		||||
    <TD>Ability to cull duplex settings from device.<BR>
 | 
			
		||||
        <UL>
 | 
			
		||||
            <LI><tt>no</tt> - Can't recover current or admin setting.
 | 
			
		||||
            <LI><tt>link</tt> - Can get current setting only.
 | 
			
		||||
            <LI><tt>both</tt> - Can get admin and link setting.
 | 
			
		||||
        </UL>
 | 
			
		||||
    </TD>
 | 
			
		||||
</TR>
 | 
			
		||||
<TR>
 | 
			
		||||
    <TD>Macsuck</TD>
 | 
			
		||||
    <TD>Ability to get CAM tables for MAC to switch port mapping.<BR>
 | 
			
		||||
        <UL>
 | 
			
		||||
            <LI><TT>no</TT> - Have not found an SNMP method to get data yet.
 | 
			
		||||
            <LI><TT>yes</TT> - Can get through normal SWITCH-MIB method.
 | 
			
		||||
            <LI><TT>vlan</TT> - Have to re-connect to each VLAN and then fetch with normal
 | 
			
		||||
        method.
 | 
			
		||||
        </UL>
 | 
			
		||||
    </TD>
 | 
			
		||||
</TR>
 | 
			
		||||
<TR>
 | 
			
		||||
    <TD>Portmac</TD>
 | 
			
		||||
    <TD>Whether the device will list the MAC address of the switch port on each
 | 
			
		||||
        switch port when doing a Macsuck.
 | 
			
		||||
    </TD>
 | 
			
		||||
</TR>
 | 
			
		||||
<TR>
 | 
			
		||||
    <TD>Ver</TD>
 | 
			
		||||
    <TD>SNMP Protocol Version the device has to use.</TD>
 | 
			
		||||
</TR>
 | 
			
		||||
</TABLE>
 | 
			
		||||
</BODY>
 | 
			
		||||
</HTML>
 | 
			
		||||
end_tail
 | 
			
		||||
    
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub print_headers {
 | 
			
		||||
    print "<TR>\n";
 | 
			
		||||
    foreach my $a (sort sort_nocase keys %$Attributes) {
 | 
			
		||||
        next if $a eq 'note';
 | 
			
		||||
        print "  <TH>$a</TH>\n";
 | 
			
		||||
    }
 | 
			
		||||
    print "</TR>\n";
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										81
									
								
								t/prereq.t
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										81
									
								
								t/prereq.t
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,81 @@
 | 
			
		||||
#!/usr/local/bin/perl -w
 | 
			
		||||
# prereq.t - Test file for prerequesites for SNMP::Info
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use Test::More tests=> 3;
 | 
			
		||||
 | 
			
		||||
# Check for SNMP Module
 | 
			
		||||
my $have_snmp=0;
 | 
			
		||||
 | 
			
		||||
eval {
 | 
			
		||||
    require SNMP;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
if ($@){
 | 
			
		||||
    print STDERR <<'end_snmp';
 | 
			
		||||
 | 
			
		||||
Net-SNMP not found.  Net-SNMP installs the perl modules
 | 
			
		||||
SNMP and SNMP::Session.  As of version 4.2.1 and greater the Perl
 | 
			
		||||
modules are no longer distributed on CPAN, as they are specific to different
 | 
			
		||||
versions of SNMP. 
 | 
			
		||||
 | 
			
		||||
Install Net-SNMP from http://net-snmp.sourceforge.net and make sure you run
 | 
			
		||||
configure with the --with-perl-modules switch!
 | 
			
		||||
 | 
			
		||||
Note to Redhat Users:  Redhat, in its infinite wisdom, does not install the 
 | 
			
		||||
Perl modules as part of their 8.0 RPMS.  Please uninstall them and install the
 | 
			
		||||
newest version by hand.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
end_snmp
 | 
			
		||||
    ok(0,'Net-SNMP not installed, or missing Perl modules.');
 | 
			
		||||
} else {
 | 
			
		||||
    $have_snmp=1;
 | 
			
		||||
    ok(1,'Net-SNMP installed');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Check for version
 | 
			
		||||
SKIP: {
 | 
			
		||||
    skip('SNMP not installed, no further testing',2) unless $have_snmp;
 | 
			
		||||
 | 
			
		||||
    my $VERSION = $SNMP::VERSION;
 | 
			
		||||
    ok(defined $VERSION ? 1 : 1, "found version for SNMP");
 | 
			
		||||
 | 
			
		||||
    my ($ver_maj,$ver_min,$ver_rev) = split(/\./,$VERSION);
 | 
			
		||||
 | 
			
		||||
    ok ($ver_maj >= 4, 'Net-SNMP ver 4 or higher');
 | 
			
		||||
    
 | 
			
		||||
    if ($ver_maj == 4 and $ver_min == 2 and $ver_rev == 0){
 | 
			
		||||
        print STDERR << "end_420";
 | 
			
		||||
 | 
			
		||||
SNMP module version 4.2.0 found.  Please triple check that you have
 | 
			
		||||
version 4.2.0 of Net-SNMP installed, and that you did not accidently install
 | 
			
		||||
the SNMP module found on CPAN.  All newer versions are bundled with 
 | 
			
		||||
Net-SNMP, and are not available on CPAN.  Please find them at 
 | 
			
		||||
http://net-snmp.sourceforge.net .  Make sure you run configure with the 
 | 
			
		||||
--with-perl-modules switch.
 | 
			
		||||
 | 
			
		||||
end_420
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
    if( $ver_maj == 5 and $ver_min == 0 and $ver_rev == 1 ){
 | 
			
		||||
        print STDERR << "end_501";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Perl module of Net-SNMP 5.0.1 is buggy. Please upgrade.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
end_501
 | 
			
		||||
 | 
			
		||||
    } 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
print STDERR << "end_mibs";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Make sure you download and install the MIBS needed for SNMP::Info.   
 | 
			
		||||
See Man page or perldoc for SNMP::Info.
 | 
			
		||||
 | 
			
		||||
end_mibs
 | 
			
		||||
# vim:syntax=perl
 | 
			
		||||
							
								
								
									
										149
									
								
								t/test_class.pl
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										149
									
								
								t/test_class.pl
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,149 @@
 | 
			
		||||
#!/usr/bin/perl -w
 | 
			
		||||
#
 | 
			
		||||
# test_class.pl
 | 
			
		||||
#
 | 
			
		||||
#   Test a device class in SNMP::Info against a device.
 | 
			
		||||
#
 | 
			
		||||
# Max Baker <max@warped.org>
 | 
			
		||||
#
 | 
			
		||||
# $Id$
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
use lib '/usr/local/netdisco';
 | 
			
		||||
use SNMP::Info;
 | 
			
		||||
use Getopt::Long;
 | 
			
		||||
use strict;
 | 
			
		||||
use vars qw/$Class $Dev $Comm $Ver/;
 | 
			
		||||
 | 
			
		||||
# Default Values
 | 
			
		||||
$Class = '';
 | 
			
		||||
$Dev   = '';
 | 
			
		||||
$Comm  = '';
 | 
			
		||||
$Ver   = 2;
 | 
			
		||||
 | 
			
		||||
GetOptions ('c|class=s' => \$Class,
 | 
			
		||||
            'd|dev=s'   => \$Dev,
 | 
			
		||||
            's|comm=s'  => \$Comm,
 | 
			
		||||
            'v|ver=i'   => \$Ver,
 | 
			
		||||
            'h|help'    => \&usage,
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
&usage unless ($Dev and $Comm);
 | 
			
		||||
 | 
			
		||||
$Class = $Class ? "SNMP::Info::$Class" : 'SNMP::Info';
 | 
			
		||||
eval "require $Class;";
 | 
			
		||||
if ($@) {
 | 
			
		||||
    die "Can't load Class specified : $Class.\n\n$@\n";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
print "Class $Class loaded.\n";
 | 
			
		||||
 | 
			
		||||
my $dev = new $Class( 'AutoSpecify' => 0,
 | 
			
		||||
                      'AutoVerBack' => 0,
 | 
			
		||||
                      'Version'     => $Ver,
 | 
			
		||||
                      'Debug'       => 0,
 | 
			
		||||
                      'DestHost'    => $Dev,
 | 
			
		||||
                      'Community'   => $Comm
 | 
			
		||||
                    ) or die "\n"; 
 | 
			
		||||
 | 
			
		||||
print "Connected to $Dev.\n";
 | 
			
		||||
    
 | 
			
		||||
my $layers = $dev->layers();
 | 
			
		||||
 | 
			
		||||
unless (defined $layers){
 | 
			
		||||
    warn "Are you sure you got the right community string and version?\nCan't fetch layers.\n";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
print "Fetching global info...\n\n";
 | 
			
		||||
 | 
			
		||||
my @globals = qw/description uptime contact name location layers ports mac serial
 | 
			
		||||
                ps1_type ps2_type ps1_status ps2_status fan slots vendor os os_ver/;
 | 
			
		||||
 | 
			
		||||
foreach my $global (@globals){
 | 
			
		||||
    test_global($dev,$global);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
print "\nFetching interface info...\n\n";
 | 
			
		||||
 | 
			
		||||
my @fns = qw/interfaces i_type i_ignore i_description i_mtu i_speed i_mac i_up
 | 
			
		||||
             i_up_admin i_name i_duplex i_duplex_admin i_stp_state/;
 | 
			
		||||
 | 
			
		||||
foreach my $fn (@fns){
 | 
			
		||||
    test_fn($dev,$fn);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
print "\nTesting Misc...\n\n";
 | 
			
		||||
my @misc = qw/v_name v_port/;
 | 
			
		||||
foreach my $fn (@misc){
 | 
			
		||||
    test_fn($dev,$fn);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#--------------------------------
 | 
			
		||||
sub test_global {
 | 
			
		||||
    my $dev    = shift;
 | 
			
		||||
    my $method = shift;
 | 
			
		||||
 | 
			
		||||
    my $value;
 | 
			
		||||
    eval {
 | 
			
		||||
        $value = $dev->$method();
 | 
			
		||||
    };
 | 
			
		||||
    
 | 
			
		||||
    if ($@){
 | 
			
		||||
        my $err = $@;
 | 
			
		||||
        $err =~ s/[[:cntrl:]]+/ /g;
 | 
			
		||||
        printf "%-20s Blew up. $err\n",$method;
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    unless (defined $value){
 | 
			
		||||
        printf "%-20s Does not exist.\n",$method;
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
    $value =~ s/[[:cntrl:]]+/ /g;
 | 
			
		||||
    if (length $value > 60) {
 | 
			
		||||
        $value = substr($value,0,60);
 | 
			
		||||
        $value .= '...';
 | 
			
		||||
    }
 | 
			
		||||
    printf "%-20s %s \n",$method,$value;
 | 
			
		||||
    return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub test_fn {
 | 
			
		||||
    my $dev = shift;    
 | 
			
		||||
    my $method = shift;
 | 
			
		||||
 | 
			
		||||
    my $results;
 | 
			
		||||
 | 
			
		||||
    eval {
 | 
			
		||||
        $results = $dev->$method();
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    if ($@){
 | 
			
		||||
        my $err = $@;
 | 
			
		||||
        $err =~ s/\n/ /g;
 | 
			
		||||
        printf "%-20s Blew up. $err\n",$method;
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    unless (defined $results and scalar keys %$results) {
 | 
			
		||||
        printf "%-20s Empty Results.\n",$method;
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    printf "%-20s %d rows.\n",$method, scalar(keys %$results);
 | 
			
		||||
    return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub usage {
 | 
			
		||||
    print << "end_usage";
 | 
			
		||||
 | 
			
		||||
test_class - Test a device against an SNMP::Info class
 | 
			
		||||
    -c  --class Layer2::Catalyst
 | 
			
		||||
    -d  --dev   myswitch
 | 
			
		||||
    -s  --comm  public
 | 
			
		||||
    -v  --ver   2
 | 
			
		||||
 | 
			
		||||
end_usage
 | 
			
		||||
    exit;
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user