Compare commits
	
		
			68 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					a0a8b77f7a | ||
| 
						 | 
					de464b2e6a | ||
| 
						 | 
					e0acc5ce90 | ||
| 
						 | 
					a1f913d91e | ||
| 
						 | 
					d19b71073d | ||
| 
						 | 
					ed66350c27 | ||
| 
						 | 
					51d57b39f5 | ||
| 
						 | 
					68524eb337 | ||
| 
						 | 
					58f8ed29c7 | ||
| 
						 | 
					3b96232e13 | ||
| 
						 | 
					19b5d34c10 | ||
| 
						 | 
					5bb4252cf0 | ||
| 
						 | 
					8191d5f957 | ||
| 
						 | 
					1c458c9ca9 | ||
| 
						 | 
					36f84e357e | ||
| 
						 | 
					c1b7d7dfc0 | ||
| 
						 | 
					bbd45f82ab | ||
| 
						 | 
					02f3e91c5d | ||
| 
						 | 
					d5afa9f592 | ||
| 
						 | 
					dceec4f537 | ||
| 
						 | 
					51b09605df | ||
| 
						 | 
					dc00c7d907 | ||
| 
						 | 
					c6df2928a1 | ||
| 
						 | 
					86bf9fd360 | ||
| 
						 | 
					505de8c6dc | ||
| 
						 | 
					70744f3df2 | ||
| 
						 | 
					96393d5781 | ||
| 
						 | 
					598c075670 | ||
| 
						 | 
					ac8eef8f73 | ||
| 
						 | 
					f5eb4e8bb6 | ||
| 
						 | 
					abb7fe7f3c | ||
| 
						 | 
					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 | 
@@ -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.
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										44
									
								
								ChangeLog
									
									
									
									
									
								
							
							
						
						
									
										44
									
								
								ChangeLog
									
									
									
									
									
								
							@@ -1,7 +1,47 @@
 | 
			
		||||
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.7 ()
 | 
			
		||||
verison 0.9 (11/15/04)
 | 
			
		||||
    + ** Added full Nortel/Bay/BayStack support 
 | 
			
		||||
        by new developer Eric Miller.  
 | 
			
		||||
        L2::Bay now depricated.
 | 
			
		||||
    + Added Alteon Ace support (Eric Miller)
 | 
			
		||||
    + Added Nortel Cotivity support (Eric Miller)
 | 
			
		||||
    + Added Nortel BayRS support (Eric Miller)
 | 
			
		||||
    + Added Nortel Centillion support (Eric Miller)
 | 
			
		||||
    + Added Nortel AP 222x support (Eric Miller)
 | 
			
		||||
    + Added Orinco AP support (Eric Miller) 
 | 
			
		||||
    + Added i_lastchange() per suggestion of Nicolai Petri
 | 
			
		||||
    + Added BULKWALK patch by Bradley Baetz - This should
 | 
			
		||||
          greatly speed up requests on SNMPv2c devices.
 | 
			
		||||
    + Added MibDirs option to new() to allow specifying non-system MIB directories.
 | 
			
		||||
 | 
			
		||||
    * Added C3560s to the C3550 class. Thanks to Nicolai.
 | 
			
		||||
    * Fixed Bug where older Cisco's would append nulls to certain
 | 
			
		||||
      CDP information.  Would come up a 'DBD::Pg parser' error in Netdisco
 | 
			
		||||
    * Changed so a failed _global() call is cached so it won't retry
 | 
			
		||||
      an error over and over again if the same global is used.
 | 
			
		||||
    * Added check in _set() to see if data came from sub or FUNCS/GLOBALS
 | 
			
		||||
        Fails if came from sub.
 | 
			
		||||
 | 
			
		||||
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 ZyXEL 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
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										256
									
								
								DeviceMatrix.txt
									
									
									
									
									
								
							
							
						
						
									
										256
									
								
								DeviceMatrix.txt
									
									
									
									
									
								
							@@ -1,15 +1,16 @@
 | 
			
		||||
# SNMP Device Compatibility Matrix
 | 
			
		||||
# SNMP::Info - Max Baker
 | 
			
		||||
# SNMP::Info - (C) 2004 Max Baker
 | 
			
		||||
 | 
			
		||||
# This file is meant to detail the cababilities
 | 
			
		||||
# of network devices to supply data via SNMP.  
 | 
			
		||||
 | 
			
		||||
# $Id$
 | 
			
		||||
# $Id: DeviceMatrix.txt,Modified by Eric Miller 10/17/2004
 | 
			
		||||
 | 
			
		||||
# Allied
 | 
			
		||||
device-vendor: Allied Telesyn
 | 
			
		||||
cdp:no
 | 
			
		||||
 | 
			
		||||
device-family: Hubs
 | 
			
		||||
device-family: Allied Hubs
 | 
			
		||||
class: Layer1::Allied
 | 
			
		||||
ver: 1
 | 
			
		||||
arpnip: no
 | 
			
		||||
@@ -18,10 +19,15 @@ duplex: no
 | 
			
		||||
 | 
			
		||||
device: AT-3624T
 | 
			
		||||
 | 
			
		||||
device-family: AT-8000 Switches
 | 
			
		||||
class: Layer2::Allied
 | 
			
		||||
ver: 2
 | 
			
		||||
macsuck: yes
 | 
			
		||||
 | 
			
		||||
# Asante
 | 
			
		||||
device-vendor: Asante
 | 
			
		||||
 | 
			
		||||
device-family: Hubs
 | 
			
		||||
device-family: Asante Hubs
 | 
			
		||||
class: Layer1::Asante
 | 
			
		||||
ver: 1
 | 
			
		||||
arpnip: no
 | 
			
		||||
@@ -31,19 +37,8 @@ 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.
 | 
			
		||||
device-vendor: Bay
 | 
			
		||||
note: See Nortel
 | 
			
		||||
 | 
			
		||||
# CISCO
 | 
			
		||||
device-vendor: Cisco
 | 
			
		||||
@@ -55,14 +50,14 @@ device-family: Aironet
 | 
			
		||||
note: IOS and Aironet OS versions
 | 
			
		||||
class: Layer3::Aironet
 | 
			
		||||
 | 
			
		||||
device: AIRAP1100
 | 
			
		||||
device: AIRAP1100, AP1200, C1100
 | 
			
		||||
note: IOS based device
 | 
			
		||||
class: Layer2::Aironet
 | 
			
		||||
 | 
			
		||||
device: AP1200
 | 
			
		||||
device: BR500
 | 
			
		||||
note: Aironet based device
 | 
			
		||||
 | 
			
		||||
device: AP350, AP340
 | 
			
		||||
device: AP350, AP340, CAP350, CAP340, 1200, AP4800
 | 
			
		||||
note: Aironet based device
 | 
			
		||||
 | 
			
		||||
device-family: 1000
 | 
			
		||||
@@ -103,20 +98,14 @@ arpnip: yes
 | 
			
		||||
macsuck: yes
 | 
			
		||||
class: Layer3
 | 
			
		||||
 | 
			
		||||
device:2610
 | 
			
		||||
 | 
			
		||||
device:2611
 | 
			
		||||
 | 
			
		||||
device:2620
 | 
			
		||||
 | 
			
		||||
device:2620XM
 | 
			
		||||
 | 
			
		||||
device:2621
 | 
			
		||||
device:2610,2610XM,2611,2620,2620XM,2621
 | 
			
		||||
 | 
			
		||||
device:2621XM
 | 
			
		||||
 | 
			
		||||
device:2651XM
 | 
			
		||||
 | 
			
		||||
device:2691
 | 
			
		||||
 | 
			
		||||
device-family: 3600
 | 
			
		||||
class: Layer3
 | 
			
		||||
 | 
			
		||||
@@ -143,6 +132,7 @@ device: AS5300
 | 
			
		||||
#
 | 
			
		||||
device-family: Catalyst 1900
 | 
			
		||||
note: !Upgrade older (pre 9.0) versions of CatOS
 | 
			
		||||
note: !CatOS ver 9.00.03 through 9.00.06 have problems when trunking. Upgrade to 9.00.07 or higher.
 | 
			
		||||
ver: 1
 | 
			
		||||
class: Layer2::C1900
 | 
			
		||||
 | 
			
		||||
@@ -172,17 +162,33 @@ 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
 | 
			
		||||
note: L2 only IOS devices
 | 
			
		||||
class: Layer2
 | 
			
		||||
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
 | 
			
		||||
macsuck: no
 | 
			
		||||
 | 
			
		||||
device-family: Catalyst 3550
 | 
			
		||||
macsuck: vlan
 | 
			
		||||
@@ -200,23 +206,25 @@ note: L2/L3 Switch
 | 
			
		||||
arpnip: yes
 | 
			
		||||
 | 
			
		||||
device: 3550-24, 3550-48
 | 
			
		||||
note: L2 only switch
 | 
			
		||||
macsuck: no
 | 
			
		||||
note: !BRIDGE-MIB not implemented.
 | 
			
		||||
macsuck: vlan
 | 
			
		||||
 | 
			
		||||
device-family: Catalyst 3750
 | 
			
		||||
class: Layer3::C6500
 | 
			
		||||
 | 
			
		||||
device-family: Catalyst 4000
 | 
			
		||||
duplex: both
 | 
			
		||||
macsuck: vlan
 | 
			
		||||
class: Layer2::Catalyst
 | 
			
		||||
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.
 | 
			
		||||
note: !IOS Version 12.1.8a reported not to respond to BRIDGE-MIB calls.
 | 
			
		||||
 | 
			
		||||
device: wsc4006
 | 
			
		||||
 | 
			
		||||
device: 4507
 | 
			
		||||
note: !IOS device -- Test against C3550 and C6000 classes
 | 
			
		||||
class: Layer3
 | 
			
		||||
class: Layer3::C6500
 | 
			
		||||
note: !Has serious slowdown/timeout problems with SNMP
 | 
			
		||||
 | 
			
		||||
device: wsc4912g
 | 
			
		||||
note: Dedicated 12 port gig-e switch
 | 
			
		||||
@@ -254,6 +262,7 @@ 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.
 | 
			
		||||
note: !Problem with IOS 12.2.17d-SXB ... upgrade to -SXB1 or higher.
 | 
			
		||||
 | 
			
		||||
device: 6503
 | 
			
		||||
macsuck:no
 | 
			
		||||
@@ -297,7 +306,7 @@ device-vendor: HP
 | 
			
		||||
class:  Layer2::HP
 | 
			
		||||
ver: 2
 | 
			
		||||
 | 
			
		||||
device-family: ProCurve
 | 
			
		||||
device-family: HP ProCurve
 | 
			
		||||
duplex: both
 | 
			
		||||
macsuck: yes
 | 
			
		||||
arpnip: no
 | 
			
		||||
@@ -311,10 +320,175 @@ device: 2524
 | 
			
		||||
ver: 1
 | 
			
		||||
 | 
			
		||||
device: 4000
 | 
			
		||||
note: duplex issues?
 | 
			
		||||
 | 
			
		||||
device: 4104GL
 | 
			
		||||
duplex: link
 | 
			
		||||
 | 
			
		||||
device: 4108GL
 | 
			
		||||
device: 4108GL,8000,2626,2650,8000
 | 
			
		||||
note: VLAN info in Q-BRIDGE-MIB
 | 
			
		||||
 | 
			
		||||
device: 8000
 | 
			
		||||
# NORTEL
 | 
			
		||||
device-vendor: Nortel Networks
 | 
			
		||||
 | 
			
		||||
device-family: BayStack Hub
 | 
			
		||||
macsuck: yes
 | 
			
		||||
duplex: both
 | 
			
		||||
cdp: proprietary
 | 
			
		||||
ver: 1
 | 
			
		||||
class: Layer1::Bayhub
 | 
			
		||||
note: !Uses proprietary MIBs to provide MAC to port mapping.
 | 
			
		||||
 | 
			
		||||
device: 102
 | 
			
		||||
 | 
			
		||||
device-family: Baystack Switch
 | 
			
		||||
macsuck: yes
 | 
			
		||||
duplex: both
 | 
			
		||||
cdp: proprietary
 | 
			
		||||
class: Layer2::Baystack
 | 
			
		||||
 | 
			
		||||
device: 303,304
 | 
			
		||||
 | 
			
		||||
device: 350
 | 
			
		||||
 | 
			
		||||
device: 380
 | 
			
		||||
 | 
			
		||||
device: 410
 | 
			
		||||
 | 
			
		||||
device: 420
 | 
			
		||||
 | 
			
		||||
device: 450
 | 
			
		||||
note: !Some versions > 4.X in stacked configuration have SNMP timeout issues. 
 | 
			
		||||
note: Labels full duplex as 20Mbit connection.
 | 
			
		||||
 | 
			
		||||
device: 460,470
 | 
			
		||||
 | 
			
		||||
device: 5510,5520
 | 
			
		||||
 | 
			
		||||
device: BPS
 | 
			
		||||
 | 
			
		||||
device-family: Centillion
 | 
			
		||||
macsuck: yes
 | 
			
		||||
duplex: both
 | 
			
		||||
cdp: proprietary
 | 
			
		||||
class: Layer2::Centillion
 | 
			
		||||
note: !Must be on version 4.x or 5.x (VLAN based) software.
 | 
			
		||||
 | 
			
		||||
device: 5000BH
 | 
			
		||||
 | 
			
		||||
device: 5005BH
 | 
			
		||||
 | 
			
		||||
device: C100
 | 
			
		||||
 | 
			
		||||
device: C50
 | 
			
		||||
 | 
			
		||||
device-family: AP222x
 | 
			
		||||
macsuck: yes
 | 
			
		||||
duplex: both
 | 
			
		||||
cdp: proprietary
 | 
			
		||||
class: Layer2::NAP222x
 | 
			
		||||
note: !Upgrade to version 1.3 or higher.
 | 
			
		||||
note: Sends out topology packets if enabled but does not build neighbor table.
 | 
			
		||||
 | 
			
		||||
device: AP-2220
 | 
			
		||||
 | 
			
		||||
device: AP-2221
 | 
			
		||||
 | 
			
		||||
device: AP-2225
 | 
			
		||||
 | 
			
		||||
device-family: Alteon AD
 | 
			
		||||
arpnip: yes
 | 
			
		||||
macsuck: yes
 | 
			
		||||
duplex: both
 | 
			
		||||
cdp: no
 | 
			
		||||
class: Layer3::AlteonAD
 | 
			
		||||
note: !Some versions have issues with continuous SNMP polling. Upgrade to 10.0.30.7 or higher.
 | 
			
		||||
 | 
			
		||||
device: AD2
 | 
			
		||||
 | 
			
		||||
device: AD3
 | 
			
		||||
 | 
			
		||||
device: AD4
 | 
			
		||||
 | 
			
		||||
device: 180
 | 
			
		||||
 | 
			
		||||
device: 183
 | 
			
		||||
 | 
			
		||||
device: 184
 | 
			
		||||
 | 
			
		||||
device-family: BayRS
 | 
			
		||||
arpnip: yes
 | 
			
		||||
macsuck: yes
 | 
			
		||||
portmac: yes
 | 
			
		||||
duplex: both
 | 
			
		||||
cdp: no
 | 
			
		||||
class: Layer3::BayRS
 | 
			
		||||
 | 
			
		||||
device: AN
 | 
			
		||||
 | 
			
		||||
device: ARN
 | 
			
		||||
 | 
			
		||||
device: ASN
 | 
			
		||||
 | 
			
		||||
device: BLN
 | 
			
		||||
 | 
			
		||||
device: Passport 2430
 | 
			
		||||
 | 
			
		||||
device: Passport 5430
 | 
			
		||||
 | 
			
		||||
device-family: Contivity
 | 
			
		||||
arpnip: yes
 | 
			
		||||
macsuck: no
 | 
			
		||||
portmac: yes
 | 
			
		||||
duplex: no
 | 
			
		||||
cdp: no
 | 
			
		||||
class: Layer3::Contivity
 | 
			
		||||
 | 
			
		||||
device: 100,400,600
 | 
			
		||||
 | 
			
		||||
device: 1000,1010,1050
 | 
			
		||||
 | 
			
		||||
device: 1500,1600,1700,1740
 | 
			
		||||
 | 
			
		||||
device: 2500,2600,2700
 | 
			
		||||
 | 
			
		||||
device: 4500,4600,5000
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
device-family: Passport LAN
 | 
			
		||||
arpnip: yes
 | 
			
		||||
macsuck: yes
 | 
			
		||||
portmac: yes
 | 
			
		||||
duplex: both
 | 
			
		||||
cdp: proprietary
 | 
			
		||||
class: Layer3::Passport
 | 
			
		||||
note: !Code versions < 3.2 vlan based mac-suck and are unsupported.  Upgrade code.
 | 
			
		||||
note: !3.2 code versions < 3.2.2.2 have Bridge MIB loop.  Upgrade code.
 | 
			
		||||
 | 
			
		||||
device: 8603,8606,8610
 | 
			
		||||
 | 
			
		||||
device: 8610co
 | 
			
		||||
 | 
			
		||||
# Proxim
 | 
			
		||||
device-vendor: Proxim
 | 
			
		||||
 | 
			
		||||
device-family: Orinoco
 | 
			
		||||
macsuck: yes
 | 
			
		||||
duplex: no
 | 
			
		||||
cdp: no
 | 
			
		||||
class: Layer2::Orinoco
 | 
			
		||||
 | 
			
		||||
device: AP-1000
 | 
			
		||||
 | 
			
		||||
device: AP-2000
 | 
			
		||||
 | 
			
		||||
device: WavePOINT-II
 | 
			
		||||
 | 
			
		||||
# Zyxel
 | 
			
		||||
device-vendor: Zyxel
 | 
			
		||||
class: Layer2::ZyXEL_DSLAM
 | 
			
		||||
note: Doesn't report sysServices (layers)
 | 
			
		||||
 | 
			
		||||
device-family: Zyxel DSLAM
 | 
			
		||||
 | 
			
		||||
device:AAM10008-61, AAM1008-63
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										428
									
								
								Info.pm
									
									
									
									
									
								
							
							
						
						
									
										428
									
								
								Info.pm
									
									
									
									
									
								
							@@ -1,13 +1,15 @@
 | 
			
		||||
# SNMP::Info - Max Baker <max@warped.org>
 | 
			
		||||
# $Id$
 | 
			
		||||
# SNMP::Info - Max Baker
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2002-3, Regents of the University of California
 | 
			
		||||
# Copyright (c) 2003,2004 Max Baker 
 | 
			
		||||
# All rights reserved.  
 | 
			
		||||
# Portions Copyright (c) 2002-3, Regents of the University of California
 | 
			
		||||
# All rights reserved.  
 | 
			
		||||
#
 | 
			
		||||
# See COPYRIGHT at bottom
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
package SNMP::Info;
 | 
			
		||||
$VERSION = 0.7;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
use Exporter;
 | 
			
		||||
@@ -27,13 +29,12 @@ SNMP::Info - Object Oriented Perl5 Interface to Network devices and MIBs through
 | 
			
		||||
 | 
			
		||||
=head1 VERSION
 | 
			
		||||
 | 
			
		||||
SNMP::Info - Version 0.6
 | 
			
		||||
SNMP::Info - Version 0.9
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
Max Baker (C<max@warped.org>)
 | 
			
		||||
 | 
			
		||||
SNMP::Info was created at UCSC for the netdisco project (www.netdisco.org)
 | 
			
		||||
and is written and maintained by Max Baker.
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
@@ -47,13 +48,13 @@ SNMP::Info was created at UCSC for the netdisco project (www.netdisco.org)
 | 
			
		||||
                            DestHost    => 'router',
 | 
			
		||||
                            Community   => 'public',
 | 
			
		||||
                            Version     => 2 
 | 
			
		||||
                          ) or die "Can't connect to device.\n"
 | 
			
		||||
                          ) or die "Can't connect to device.\n";
 | 
			
		||||
 | 
			
		||||
 my $err = $info->error();
 | 
			
		||||
 die "SNMP Community or Version probably wrong connecting to device. $err\n" if defined $err;
 | 
			
		||||
 | 
			
		||||
 $name  = $info->name();
 | 
			
		||||
 $class = $info->class()
 | 
			
		||||
 $class = $info->class();
 | 
			
		||||
 print "SNMP::Info is using this device class : $class\n";
 | 
			
		||||
 | 
			
		||||
 # Find out the Duplex status for the ports
 | 
			
		||||
@@ -88,7 +89,7 @@ SNMP::Info was created at UCSC for the netdisco project (www.netdisco.org)
 | 
			
		||||
=head1 SUPPORT
 | 
			
		||||
 | 
			
		||||
Please direct all support, help, and bug requests to the snmp-info-users Mailing List
 | 
			
		||||
at L<http://lists.sourceforge.net/lists/listinfo/snmp-info-users>
 | 
			
		||||
at <http://lists.sourceforge.net/lists/listinfo/snmp-info-users>.
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION 
 | 
			
		||||
 | 
			
		||||
@@ -109,12 +110,12 @@ setting for that port with two methods -- interfaces() and i_duplex().
 | 
			
		||||
The information may be coming from any number of MIB files and is very vendor specific.
 | 
			
		||||
SNMP::Info provides you a common method for all supported devices.
 | 
			
		||||
 | 
			
		||||
Adding support for your own device is easy, and takes little much SNMP knowledge.
 | 
			
		||||
Adding support for your own device is easy, and takes little SNMP knowledge.
 | 
			
		||||
 | 
			
		||||
The module is not limited to network devices. Any MIB or device can be given an objected oriented
 | 
			
		||||
front-end by making a module that consists of a couple hashes.  See EXTENDING SNMP::INFO.
 | 
			
		||||
 | 
			
		||||
=head2 Requirements
 | 
			
		||||
=head1 REQUIREMENTS
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
@@ -134,19 +135,28 @@ of the net-snmp distribution.
 | 
			
		||||
 | 
			
		||||
Net-SNMP can be found at http://net-snmp.sourceforge.net
 | 
			
		||||
 | 
			
		||||
Version 5.0.2 or greater is recommended.  Various version 4's will work, and 5.0.1 is kinda flaky
 | 
			
		||||
Version 5.1.2 or greater is recommended.
 | 
			
		||||
 | 
			
		||||
Various version 4's and 5.0 and 5.1 series will work. 5.0.1 is kinda flaky
 | 
			
		||||
on the Perl side.
 | 
			
		||||
 | 
			
		||||
Note: Net-SNMP was previously called ucd-snmp.
 | 
			
		||||
B<Redhat Users>: Certain versions that comes with certain versions of Redhat/Fedora doesn't have
 | 
			
		||||
the Perl library installed.  Uninstall the RPM and install by hand.
 | 
			
		||||
 | 
			
		||||
=item 2. MIBS
 | 
			
		||||
 | 
			
		||||
SNMP::Info operates on textual descriptors found in MIBs. MIBs are text databases that
 | 
			
		||||
are freely and easily obtainable on the Net.
 | 
			
		||||
SNMP::Info operates on textual descriptors found in MIBs.
 | 
			
		||||
 | 
			
		||||
If you are using SNMP::Info separate from Netdisco, 
 | 
			
		||||
download the Netdisco-MIB package at
 | 
			
		||||
 | 
			
		||||
 http://sourceforge.net/project/showfiles.php?group_id=80033&package_id=135517
 | 
			
		||||
 | 
			
		||||
Make sure that your snmp.conf is updated to point to your MIB directory
 | 
			
		||||
and that the MIBs are world-readable.
 | 
			
		||||
 | 
			
		||||
B<To do it by hand>:
 | 
			
		||||
 | 
			
		||||
Then run C<snmpconf> and setup that directory as default.  Move F<snmp.conf>
 | 
			
		||||
into F</usr/local/share/snmp> when you are done.
 | 
			
		||||
 | 
			
		||||
@@ -178,13 +188,15 @@ Extract
 | 
			
		||||
 | 
			
		||||
=item STAND-ALONE-ETHERNET-SWITCH-MIB (ESSWITCH-MIB)
 | 
			
		||||
 | 
			
		||||
=item TOKEN-RING-RMON-MIB
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
by running 
 | 
			
		||||
 | 
			
		||||
 mkdir -p /usr/local/share/snmp/mibs
 | 
			
		||||
 cd /usr/local/share/snmp/mibs
 | 
			
		||||
 tar xvfz /path/to/v1.tar.gz BRIDGE-MIB.my SNMP-REPEATER-MIB.my ESSWITCH-MIB.my
 | 
			
		||||
 tar xvfz /path/to/v1.tar.gz BRIDGE-MIB.my SNMP-REPEATER-MIB.my ESSWITCH-MIB.my TOKEN-RING-RMON-MIB.my
 | 
			
		||||
 | 
			
		||||
=item More Specific MIBs
 | 
			
		||||
 | 
			
		||||
@@ -196,7 +208,7 @@ Check below under each subclass for requirements.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Design Goals
 | 
			
		||||
=head1 DESIGN GOALS
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
@@ -226,37 +238,48 @@ Or you can override any existing methods from a parent class by making a short s
 | 
			
		||||
 | 
			
		||||
See the section EXTENDING SNMP::INFO for more details.
 | 
			
		||||
 | 
			
		||||
When you make a new subclass for a device, please be sure to send it
 | 
			
		||||
back to the developers at snmp@warped.org for inclusion in the next version.
 | 
			
		||||
When you make a new subclass for a device, please be sure to send it back to
 | 
			
		||||
the developers (via Source Forge or the mailing list) for inclusion in the next
 | 
			
		||||
version.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Subclasses
 | 
			
		||||
=head1 SUBCLASSES
 | 
			
		||||
 | 
			
		||||
These are the subclasses that implement MIBs and support devices:
 | 
			
		||||
 | 
			
		||||
Required MIBs not included in the install instructions above are noted here.
 | 
			
		||||
 | 
			
		||||
=head3 MIB Subclasses
 | 
			
		||||
=head2 MIB Subclasses
 | 
			
		||||
 | 
			
		||||
These subclasses implement method to access one or more MIBs.  These are not 
 | 
			
		||||
used directly, but rather inherited from device subclasses.
 | 
			
		||||
 | 
			
		||||
For more info run C<perldoc> on any of the following module names.
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Bridge
 | 
			
		||||
 | 
			
		||||
BRIDGE-MIB (RFC1286).  Inherited by devices with Layer2 service.
 | 
			
		||||
BRIDGE-MIB (RFC1286).  QBRIDGE-MIB. Inherited by devices with Layer2 support.
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::CDP
 | 
			
		||||
 | 
			
		||||
CISCO-CDP-MIB.  Cisco Discovery Protocol (CDP) Support.  Inherited by devices serving Layer2 or Layer3.
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::CiscoStack
 | 
			
		||||
 | 
			
		||||
CISCO-STACK-MIB and CISCO-PORT-SECURITY-MIB
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::CiscoStats
 | 
			
		||||
 | 
			
		||||
Provides common interfaces for memory, cpu, and os statistics for Cisco devices.  Provides methods for 
 | 
			
		||||
information in : OLD-CISCO-CPU-MIB, CISCO-PROCESS-MIB and CISCO-MEMORY-POOL-MIB
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::CiscoVTP
 | 
			
		||||
 | 
			
		||||
CISCO-VTP-MIB, CISCO-VLAN-MEMBERSHIP-MIB, CISCO-VLAN-IFTABLE-RELATIONSHIP-MIB
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Entity
 | 
			
		||||
 | 
			
		||||
ENTITY-MIB.  Used for device info in Cisco and other vendors.
 | 
			
		||||
@@ -265,16 +288,35 @@ ENTITY-MIB.  Used for device info in Cisco and other vendors.
 | 
			
		||||
 | 
			
		||||
ETHERLIKE-MIB (RFC1398) - Some Layer3 devices implement this MIB, as well as some Aironet Layer 2 devices (non Cisco).
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::FDP
 | 
			
		||||
 | 
			
		||||
Foundry Discovery Protocol.  FOUNDRY-SN-SWITCH-GROUP-MIB
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::MAU
 | 
			
		||||
 | 
			
		||||
MAU-MIB (RFC2668).  Some Layer2 devices use this for extended Ethernet (Media Access Unit) interface information.
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::NortelStack
 | 
			
		||||
 | 
			
		||||
S5-AGENT-MIB, S5-CHASSIS-MIB.
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::RapidCity
 | 
			
		||||
 | 
			
		||||
RAPID-CITY.  Inhertited by Nortel Networks switches for duplex and VLAN information.
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::SONMP
 | 
			
		||||
 | 
			
		||||
SYNOPTICS-ROOT-MIB, S5-ETH-MULTISEG-TOPOLOGY-MIB.  Provides translation from Nortel Networks Topology
 | 
			
		||||
Table information to CDP.  Inherited by Nortel/Bay switches and hubs.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head3 Device Subclasses
 | 
			
		||||
=head2 Device Subclasses
 | 
			
		||||
 | 
			
		||||
These subclasses inherit from one or more classes to provide a common interface to data obtainable
 | 
			
		||||
from network devices. 
 | 
			
		||||
These subclasses inherit from one or more classes to provide a common interface
 | 
			
		||||
to data obtainable from network devices. 
 | 
			
		||||
 | 
			
		||||
All the required MIB files are included in the netdisco-mib package.  (See Above).
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
@@ -300,6 +342,13 @@ Requires ASANTE-HUB1012-MIB
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::Layer1::Asante for where to get MIBs required.
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Layer1::Bayhub
 | 
			
		||||
 | 
			
		||||
Subclass for Nortel/Bay hubs.  This includes System 5000, 100 series,
 | 
			
		||||
200 series, and probably more.
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::Layer1::Bayhub for where to get MIBs required.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Layer2
 | 
			
		||||
@@ -308,14 +357,26 @@ Generic Layer2 Device subclass.
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Layer2::Aironet
 | 
			
		||||
 | 
			
		||||
Class for Cisco Aironet wireless devices that run IOS.  See also
 | 
			
		||||
Layer3::Aironet for Aironet devices that don't run IOS.
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Layer2::Allied
 | 
			
		||||
 | 
			
		||||
Allied Telesys switches.
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Layer2::Bay
 | 
			
		||||
 | 
			
		||||
Bay Networks BayStack switch Support.  Provides translation from Bay Network Topology Table
 | 
			
		||||
information to CDP.
 | 
			
		||||
Depricated.  Use BayStack.
 | 
			
		||||
 | 
			
		||||
Requires SYNOPTICS-ROOT-MIB and S5-ETH-MULTISEG-TOPOLOGY-MIB
 | 
			
		||||
=item SNMP::Info::Layer2::Baystack
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::Bay for where to get MIBs required.
 | 
			
		||||
Subclass for Nortel/Bay Baystack switches.  This includes 303, 304, 350, 380,
 | 
			
		||||
410, 420, 425, 450, 460, 470, 5510, 5520, Business Policy Switch (BPS) and
 | 
			
		||||
probably others.
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::Layer2::Baystack for where to get MIBs required.
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Layer2::C1900
 | 
			
		||||
 | 
			
		||||
@@ -323,22 +384,42 @@ Subclass for Cisco Catalyst 1900 and 1900c Devices running CatOS.
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Layer2::C2900
 | 
			
		||||
 | 
			
		||||
Subclass for Cisco Catalyst 2900 devices running IOS.
 | 
			
		||||
Subclass for Cisco Catalyst 2900, 2950, 3500XL, and 3548 devices running IOS.
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Layer2::Catalyst
 | 
			
		||||
 | 
			
		||||
Subclass for Cisco Catalyst switches running CatOS.  These switches usually
 | 
			
		||||
report a model number that starts with ''wsc''.   Note that this class
 | 
			
		||||
report a model number that starts with C<wsc>.   Note that this class
 | 
			
		||||
does not support everything that has the name Catalyst. 
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Layer2::Centillion
 | 
			
		||||
 | 
			
		||||
Subclass for Nortel/Bay Centillion and 5000BH ATM switches.
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::Layer2::Centillion for where to get MIBs required.
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Layer2::HP
 | 
			
		||||
 | 
			
		||||
Subclass for HP Procurve Swithces
 | 
			
		||||
Subclass for HP Procurve Switches
 | 
			
		||||
 | 
			
		||||
Requires HP-ICF-OID and ENTITY-MIB downloaded from HP.  
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::Layer2::HP for more info.
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Layer2::NAP222x
 | 
			
		||||
 | 
			
		||||
Subclass for Nortel Networks' 222x series wireless access points.
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::Layer2::NAP222x for where to get MIBs required.
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Layer2::Orinoco
 | 
			
		||||
 | 
			
		||||
Subclass for Orinoco wireless access points.
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Layer2::ZyXEL_DSLAM
 | 
			
		||||
 | 
			
		||||
Zyxel DSLAMs.  Need I say more?
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Layer3
 | 
			
		||||
@@ -349,32 +430,68 @@ Generic Layer3 and Layer2+3 Device subclass.
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Layer3::Aironet
 | 
			
		||||
 | 
			
		||||
Subclass for Cisco Aironet wireless access points (AP).
 | 
			
		||||
Subclass for Cisco Aironet wireless access points (AP) not running IOS. These are usually older
 | 
			
		||||
devices.
 | 
			
		||||
 | 
			
		||||
MIBs for these devices now included in v2.tar.gz available from ftp.cisco.com.
 | 
			
		||||
 | 
			
		||||
Note Layer2::Aironet 
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Layer3::AlteonAD
 | 
			
		||||
 | 
			
		||||
Subclass for Nortel Networks' Alteon Ace Director series L2-7 switches.
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::Layer3::AlteonAD for where to get MIBs required.
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Layer3::BayRS
 | 
			
		||||
 | 
			
		||||
Subclass for Nortel Networks' BayRS routers.  This includes BCN, BLN, ASN, ARN,
 | 
			
		||||
and AN routers.
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::Layer3::BayRS for where to get MIBs required.
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Layer3::C3550
 | 
			
		||||
 | 
			
		||||
Subclass for Cisco Catalyst 3550,3540,3560 2/3 switches running IOS.
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Layer3::C6500
 | 
			
		||||
 | 
			
		||||
This class covers Catalyst 6500s in native mode, hybrid mode.  Catalyst 4000's, 3750's, 2970's
 | 
			
		||||
and probably others.
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Layer3::Cisco
 | 
			
		||||
 | 
			
		||||
This is a simple wrapper around Layer3 for IOS devices.  It adds on CiscoVTP.
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Layer3::Contivity
 | 
			
		||||
 | 
			
		||||
Subclass for Nortel Networks' Contivity VPN concentrators.  
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::Layer3::Contivity for where to get MIBs required.
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Layer3::Foundry
 | 
			
		||||
 | 
			
		||||
No longer supported.
 | 
			
		||||
 | 
			
		||||
Subclass for older Foundry Network devices.
 | 
			
		||||
Subclass for older Foundry Network devices.  Outdated, but being updated for newer devices.
 | 
			
		||||
 | 
			
		||||
Requires FOUNDRY-SN-ROOT-MIB.
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::Layer3::Foundry for more info.
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Layer3::C3550
 | 
			
		||||
=item SNMP::Info::Layer3::Passport
 | 
			
		||||
 | 
			
		||||
Subclass for Cisco Catalyst 3550 2/3 switches running IOS.
 | 
			
		||||
Subclass for Nortel Networks' Passport 8600 series switches.
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::Layer3::Passport for where to get MIBs required.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Thanks
 | 
			
		||||
=head1 Thanks
 | 
			
		||||
 | 
			
		||||
Thanks for testing and coding help (in no particular order) to :
 | 
			
		||||
Andy Ford, Brian Wilson, Jean-Philippe Luiggi, D<>na Watanabe 
 | 
			
		||||
Andy Ford, Brian Wilson, Jean-Philippe Luiggi, D<>na Watanabe, Bradley Baetz,
 | 
			
		||||
Eric Miller, and people listed on the Netdisco README!
 | 
			
		||||
 | 
			
		||||
=head1 USAGE
 | 
			
		||||
 | 
			
		||||
@@ -391,20 +508,23 @@ Creates a new object and connects via SNMP::Session.
 | 
			
		||||
                            'BigInt'      => 1
 | 
			
		||||
                            'DestHost'    => 'myrouter',
 | 
			
		||||
                            'Community'   => 'public',
 | 
			
		||||
                            'Version'     => 2
 | 
			
		||||
                            'Version'     => 2,
 | 
			
		||||
                            'MibDirs'     => ['dir1','dir2','dir3'],
 | 
			
		||||
                          ) or die;
 | 
			
		||||
 | 
			
		||||
SNMP::Info Specific Arguments :
 | 
			
		||||
 | 
			
		||||
 AutoSpecify = Returns an object of a more specific device class
 | 
			
		||||
               *See specify() entry*
 | 
			
		||||
 Debug       = Prints Lots of debugging messages
 | 
			
		||||
 Session     = SNMP::Session object to use instead of connecting on own.
 | 
			
		||||
 BigInt      = Return Math::BigInt objects for 64 bit counters.  Sets on a global scope, not object.
 | 
			
		||||
 Debug       = Prints Lots of debugging messages
 | 
			
		||||
 MibDirs     = Array ref to list of directories in which to look for MIBs.  Note this will
 | 
			
		||||
               be in addition to the ones setup in snmp.conf at the system level.
 | 
			
		||||
 RetryNoSuch = When using SNMP Version 1, try reading values even if they come back
 | 
			
		||||
               as "no such variable in this MIB".  Defaults to true, set to false if
 | 
			
		||||
               so desired.  This feature lets you read SNMPv2 data from an SNMP version
 | 
			
		||||
               1 connection, and should probably be left on.
 | 
			
		||||
 Session     = SNMP::Session object to use instead of connecting on own.
 | 
			
		||||
 | 
			
		||||
All other arguments are passed to SNMP::Session.
 | 
			
		||||
 | 
			
		||||
@@ -448,13 +568,6 @@ sub new {
 | 
			
		||||
        $new_obj->{munge}   = \%{$class . '::MUNGE'};
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    # Initialize mibs if not done
 | 
			
		||||
    my $init_ref = $new_obj->{init};
 | 
			
		||||
    unless ( $$init_ref ) {
 | 
			
		||||
        $new_obj->init();
 | 
			
		||||
        $$init_ref=1;    
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    # SNMP::Info specific args :
 | 
			
		||||
    my $auto_specific = 0;
 | 
			
		||||
    if (defined $args{AutoSpecify}){
 | 
			
		||||
@@ -476,6 +589,17 @@ sub new {
 | 
			
		||||
        $BIGINT = $args{BigInt};
 | 
			
		||||
        delete $args{BigInt};
 | 
			
		||||
    }
 | 
			
		||||
    if (defined $args{MibDirs}){
 | 
			
		||||
        $new_obj->{mibdirs} = $args{MibDirs};
 | 
			
		||||
        delete $args{MibDirs};
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    # Initialize mibs if not done
 | 
			
		||||
    my $init_ref = $new_obj->{init};
 | 
			
		||||
    unless ( $$init_ref ) {
 | 
			
		||||
        $new_obj->init();
 | 
			
		||||
        $$init_ref=1;    
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $new_obj->{nosuch} = $args{RetryNoSuch} || $NOSUCH;
 | 
			
		||||
 | 
			
		||||
@@ -577,22 +701,34 @@ SNMP::Info is returned.
 | 
			
		||||
Algorithm for Subclass Detection:
 | 
			
		||||
 | 
			
		||||
        Layer3 Support                     -> SNMP::Info::Layer3
 | 
			
		||||
            Aironet (non IOS)              -> SNMP::Info::Layer3::Aironet
 | 
			
		||||
            Catalyst 3550                  -> SNMP::Info::Layer3::C3550
 | 
			
		||||
            Catalyst 6500                  -> SNMP::Info::Layer3::C6500
 | 
			
		||||
            Aironet (BR500,AP340,350,1200) -> SNMP::Info::Layer3::Aironet
 | 
			
		||||
                     AP4800... All Non IOS
 | 
			
		||||
            Catalyst 3550,3548,3560        -> SNMP::Info::Layer3::C3550
 | 
			
		||||
            Catalyst 6500, 4000, 3750      -> SNMP::Info::Layer3::C6500
 | 
			
		||||
            Cisco Generic L3 IOS device    -> SNMP::Info::Layer3::Cisco
 | 
			
		||||
            Foundry                        -> SNMP::Info::Layer3::Foundry
 | 
			
		||||
            Nortel Passport LAN            -> SNMP::Info::Layer3::Passport
 | 
			
		||||
            Alteon Ace Director            -> SNMP::Info::Layer3::AlteonAD
 | 
			
		||||
            Nortel Contivity               -> SNMP::Info::Layer3::Contivity
 | 
			
		||||
            Nortel BayRS Router            -> SNMP::Info::Layer3::BayRS
 | 
			
		||||
        Elsif Layer2 (no Layer3)           -> SNMP::Info::Layer2
 | 
			
		||||
            Aironet (Cisco) AP1100         -> SNMP::Info::Layer2::Aironet
 | 
			
		||||
            Bay Networks                   -> SNMP::Info::Layer2::Bay
 | 
			
		||||
            Aironet - IOS Devices          -> SNMP::Info::Layer2::Aironet
 | 
			
		||||
            Catalyst 1900                  -> SNMP::Info::Layer2::C1900
 | 
			
		||||
            Catalyst 2900XL/2950(IOS)      -> SNMP::Info::Layer2::C2900
 | 
			
		||||
            Catalyst 2900XL,2950,3500XL    -> SNMP::Info::Layer2::C2900
 | 
			
		||||
            Catalyst 2970                  -> SNMP::Info::Layer3::C6500
 | 
			
		||||
            Catalyst 3550/3548             -> SNMP::Info::Layer3::C3550
 | 
			
		||||
            Catalyst WS-C 2926,5xxx        -> SNMP::Info::Layer2::Catalyst
 | 
			
		||||
            HP Procurve                    -> SNMP::Info::Layer2::HP
 | 
			
		||||
            Nortel/Bay Centillion ATM      -> SNMP::Info::Layer2::Centillion
 | 
			
		||||
            Nortel/Bay Baystack            -> SNMP::Info::Layer2::Baystack
 | 
			
		||||
            Nortel AP 222x                 -> SNMP::Info::Layer2::NAP222x
 | 
			
		||||
            Orinco AP                      -> SNMP::Info::Layer2::Orinoco
 | 
			
		||||
        Elsif Layer1 Support               -> SNMP::Info::Layer1
 | 
			
		||||
            Allied                         -> SNMP::Info::Layer1::Allied
 | 
			
		||||
            Asante                         -> SNMP::Info::Layer1::Asante
 | 
			
		||||
            Nortel/Bay Hub                 -> SNMP::Info::Layer1::Bayhub
 | 
			
		||||
        Else                               -> SNMP::Info
 | 
			
		||||
            ZyXEL_DSLAM                    -> SNMP::Info::Layer2::ZyXEL_DSLAM
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
sub device_type {
 | 
			
		||||
@@ -604,7 +740,9 @@ sub device_type {
 | 
			
		||||
    # if we dont have sysServices, we dont have anything else either probably.
 | 
			
		||||
    return undef unless (defined $layers and length($layers));
 | 
			
		||||
 | 
			
		||||
    my $desc   = $info->description();
 | 
			
		||||
    my $desc   = $info->description() || 'undef';
 | 
			
		||||
    $desc =~ s/[\r\n\l]+/ /g;
 | 
			
		||||
    $info->debug() and print "SNMP::Info::device_type() layers:$layers sysDescr: \"$desc\".\n";
 | 
			
		||||
 | 
			
		||||
    # Layer 3 Supported 
 | 
			
		||||
    #   (usually has layer2 as well, so we check for 3 first)
 | 
			
		||||
@@ -615,11 +753,30 @@ sub device_type {
 | 
			
		||||
 | 
			
		||||
        return $objtype unless (defined $desc and length($desc));
 | 
			
		||||
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer3::C3550'   if $desc =~ /C3550/ ;
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer3::C3550'   if $desc =~ /(C3550|C3560)/ ;
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer3::Foundry' if $desc =~ /foundry/i ;
 | 
			
		||||
        # Aironet - older non-IOS
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer3::Aironet' if ($desc =~ /Cisco/ and $desc =~ /\D(CAP340|AP340|CAP350|350|1200)\D/) ;
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer3::C6500'   if $desc =~ /c6sup2/;
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer3::Aironet' if ($desc =~ /Aironet/ and $desc =~ /\D(AP4800)\D/) ;
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer3::C6500'   if $desc =~ /(c6sup2|c6sup1)/;
 | 
			
		||||
        # Next two untested. Reported working by DA
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer3::C6500'   if ($desc =~ /cisco/i and $desc =~ /3750/);
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer3::C6500'   if $desc =~ /Catalyst 4000/;
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer3::C6500'   if $desc =~ /s72033_rp/;
 | 
			
		||||
        # Nortel Passport 8600
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer3::Passport'  if $desc =~ /Passport/;
 | 
			
		||||
        # Nortel Alteon AD Series
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer3::AlteonAD' if $desc =~ /Alteon\s[1A][8D]/;
 | 
			
		||||
        # Nortel Contivity
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer3::Contivity' if $desc =~ /\bCES\b/;
 | 
			
		||||
        # Nortel BayRS
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer3::BayRS'   if $desc =~ /^\s*Image:\s+rel\//;
 | 
			
		||||
 | 
			
		||||
        # Allied Telesyn Layer2 managed switches. They report they have L3 support
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer2::Allied' if ($desc =~ /Allied.*AT-80\d{2}\S*/i);
 | 
			
		||||
 | 
			
		||||
        # Default generic cisco
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer3::Cisco' if ($objtype eq 'SNMP::Info::Layer3' and $desc =~ /\bIOS\b/);
 | 
			
		||||
 | 
			
		||||
    # Layer 2 Supported
 | 
			
		||||
    } elsif ($info->has_layer(2)) {
 | 
			
		||||
@@ -632,8 +789,8 @@ sub device_type {
 | 
			
		||||
        #   Catalyst 1900 series override
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer2::C1900' if ($desc =~ /catalyst/i and $desc =~ /\D19\d{2}/);
 | 
			
		||||
 | 
			
		||||
        #   Catalyst 2900 (IOS) series override
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer2::C2900' if ($desc =~ /(C2900XL|C2950)/ );
 | 
			
		||||
        #   Catalyst 2900 and 3500XL (IOS) series override
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer2::C2900' if ($desc =~ /(C2900XL|C2950|C3500XL)/i );
 | 
			
		||||
 | 
			
		||||
        #   Catalyst WS-C series override 2926,4k,5k,6k in Hybrid
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer2::Catalyst' if ($desc =~ /WS-C\d{4}/);
 | 
			
		||||
@@ -641,20 +798,45 @@ sub device_type {
 | 
			
		||||
        #   Catalyst 3550 / 3548 Layer2 only switches
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer3::C3550' if ($desc =~ /C3550/);
 | 
			
		||||
 | 
			
		||||
        #   Cisco 2970  
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer3::C6500' if ($desc =~ /C2970/);
 | 
			
		||||
 | 
			
		||||
        #   HP
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer2::HP' if ($desc =~ /HP.*ProCurve/); 
 | 
			
		||||
    
 | 
			
		||||
        #  Bay Switch
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer2::Bay' if ($desc =~ /BayStack/);
 | 
			
		||||
        #  Centillion ATM
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer2::Centillion' if ($desc =~ /MCP/);
 | 
			
		||||
  
 | 
			
		||||
        #  BPS
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer2::Baystack' if ($desc =~ /Business\sPolicy\sSwitch/i);
 | 
			
		||||
        
 | 
			
		||||
        #  BayStack Numbered
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer2::Baystack' if ($desc =~ /BayStack\s[345]\d/);
 | 
			
		||||
        
 | 
			
		||||
        #  Nortel AP 222X
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer2::NAP222x' if ($desc =~ /Access\s+Point\s+222/);
 | 
			
		||||
 | 
			
		||||
        #  Orinco
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer2::Orinoco' if ($desc =~ /AP-\d{3}|WavePOINT/);
 | 
			
		||||
 | 
			
		||||
        #  Aironet - IOS
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer2::Aironet' if ($desc =~ /C1100/);
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer2::Aironet' if ($desc =~ /(C1100|AP1200)/);
 | 
			
		||||
 | 
			
		||||
        # Aironet - non IOS
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer3::Aironet' if ($desc =~ /Cisco/ and $desc =~ /\D(BR500)\D/) ;
 | 
			
		||||
   
 | 
			
		||||
    } elsif ($info->has_layer(1)) {
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer1';
 | 
			
		||||
        #  Allied crap-o-hub
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer1::Allied' if ($desc =~ /allied/i);
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer1::Asante' if ($desc =~ /asante/i);
 | 
			
		||||
 | 
			
		||||
        #  Bay Hub
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer1::Bayhub' if ($desc =~ /NMM.*Agent/);
 | 
			
		||||
 | 
			
		||||
    # These devices don't claim to have Layer1-3 but we like em anyways.
 | 
			
		||||
    } else {
 | 
			
		||||
        $objtype = 'SNMP::Info::Layer2::ZyXEL_DSLAM' if ($desc =~ /8-port .DSL Module\(Annex .\)/i);
 | 
			
		||||
    }   
 | 
			
		||||
 | 
			
		||||
    return $objtype; 
 | 
			
		||||
@@ -695,7 +877,7 @@ sub has_layer {
 | 
			
		||||
 | 
			
		||||
=item $info->snmp_comm()
 | 
			
		||||
 | 
			
		||||
Returns SNMP Community string used in conncetion
 | 
			
		||||
Returns SNMP Community string used in connection.
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
sub snmp_comm {
 | 
			
		||||
@@ -725,7 +907,6 @@ Usually this method is called internally from new(AutoSpecify => 1)
 | 
			
		||||
 | 
			
		||||
See device_type() entry for how a subclass is chosen. 
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
sub specify {
 | 
			
		||||
@@ -759,6 +940,20 @@ sub specify {
 | 
			
		||||
    return $sub_obj;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
=item $info->cisco_comm_indexing()
 | 
			
		||||
 | 
			
		||||
Returns 0.  Is an overridable method used for vlan indexing for
 | 
			
		||||
snmp calls on certain Cisco devices. 
 | 
			
		||||
 | 
			
		||||
See L<ftp://ftp.cisco.com/pub/mibs/supportlists/wsc5000/wsc5000-communityIndexing.html>
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
sub cisco_comm_indexing{
 | 
			
		||||
    0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Globals (Scalar Methods)
 | 
			
		||||
 | 
			
		||||
These are methods to return scalar data from RFC1213.  
 | 
			
		||||
@@ -769,7 +964,7 @@ Some subset of these is probably available for any network device that speaks SN
 | 
			
		||||
 | 
			
		||||
=item $info->uptime()
 | 
			
		||||
 | 
			
		||||
Uptime in hundreths of seconds since device became available.
 | 
			
		||||
Uptime in hundredths of seconds since device became available.
 | 
			
		||||
 | 
			
		||||
(B<sysUpTime>)
 | 
			
		||||
 | 
			
		||||
@@ -839,7 +1034,7 @@ Remember that you must supply the partial IID (a numeric OID).
 | 
			
		||||
 | 
			
		||||
Partial table results are not cached.
 | 
			
		||||
 | 
			
		||||
=head3 Interface Information
 | 
			
		||||
=head2 Interface Information
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
@@ -911,6 +1106,12 @@ Administrative status of the port.  Typical values are 'enabled' and 'disabled'.
 | 
			
		||||
 | 
			
		||||
(B<ifAdminStatus>)
 | 
			
		||||
 | 
			
		||||
=item $info->i_lastchange()
 | 
			
		||||
 | 
			
		||||
The value of sysUpTime when this port last changed states (up,down).
 | 
			
		||||
 | 
			
		||||
(B<IfLastChange>)
 | 
			
		||||
 | 
			
		||||
=item $info->i_name()
 | 
			
		||||
 | 
			
		||||
Interface Name field.  Supported by a smaller subset of devices, this fields is often 
 | 
			
		||||
@@ -927,7 +1128,7 @@ For others it is a human set field like i_name().
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head3 Interface Statistics
 | 
			
		||||
=head2 Interface Statistics
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
@@ -995,7 +1196,7 @@ Number of packets sent to a broadcast address on an interface.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head3 IP Address Table
 | 
			
		||||
=head2 IP Address Table
 | 
			
		||||
 | 
			
		||||
Each entry in this table is an IP address in use on this device.  Usually 
 | 
			
		||||
this is implemented in Layer3 Devices.
 | 
			
		||||
@@ -1028,7 +1229,7 @@ Gives broadcast address for IP table entry.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head3 IP Routing Table
 | 
			
		||||
=head2 IP Routing Table
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
@@ -1161,7 +1362,7 @@ Reference to MIB definition specific to routing protocol.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Setting data via SNMP
 | 
			
		||||
=head1 SETTING DATA VIA SNMP
 | 
			
		||||
 | 
			
		||||
This section explains how to use SNMP::Info to do SNMP Set operations.
 | 
			
		||||
 | 
			
		||||
@@ -1181,21 +1382,21 @@ Table Methods. Set iid of method to value.
 | 
			
		||||
 | 
			
		||||
Returns undef if failed, or the return value from SNMP::Session::set() (snmp_errno)
 | 
			
		||||
 | 
			
		||||
 # Disable a port administratvely
 | 
			
		||||
 # Disable a port administratively
 | 
			
		||||
 my %if_map = reverse %{$info->interfaces()}
 | 
			
		||||
 $info->set_i_up_admin('down', $if_map{'FastEthernet0/0') 
 | 
			
		||||
 $info->set_i_up_admin('down', $if_map{'FastEthernet0/0'}) 
 | 
			
		||||
    or die "Couldn't disable the port. ",$info->error(1);
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
NOTE: You must be connected to your device with a ReadWrite community string in order
 | 
			
		||||
NOTE: You must be connected to your device with a C<ReadWrite> community string in order
 | 
			
		||||
for set operations to work.
 | 
			
		||||
 | 
			
		||||
NOTE: This will only set data listed in %FUNCS and %GLOBALS.  For data aquired from
 | 
			
		||||
NOTE: This will only set data listed in %FUNCS and %GLOBALS.  For data acquired from
 | 
			
		||||
overriden methods (subroutines) specific set_METHOD() subroutines will need to be
 | 
			
		||||
added.
 | 
			
		||||
added if they haven't been already.
 | 
			
		||||
 | 
			
		||||
=head2 Quiet Mode
 | 
			
		||||
=head1 Quiet Mode
 | 
			
		||||
 | 
			
		||||
SNMP::Info will not chirp anything to STDOUT unless there is a serious error (in which case it will probably
 | 
			
		||||
die).
 | 
			
		||||
@@ -1264,6 +1465,7 @@ These are table entries, such as the IfIndex
 | 
			
		||||
            'i_mac'              => 'ifPhysAddress',
 | 
			
		||||
            'i_up'               => 'ifOperStatus',
 | 
			
		||||
            'i_up_admin'         => 'ifAdminStatus',
 | 
			
		||||
            'i_lastchange'       => 'ifLastChange',
 | 
			
		||||
            'i_name'             => 'ifName',
 | 
			
		||||
            'i_octet_in'         => 'ifInOctets',
 | 
			
		||||
            'i_octet_out'        => 'ifOutOctets',
 | 
			
		||||
@@ -1355,7 +1557,8 @@ Sample %MUNGE:
 | 
			
		||||
 | 
			
		||||
=head2 Sample Subclass
 | 
			
		||||
 | 
			
		||||
Let's make a sample Layer 2 Device subclass :
 | 
			
		||||
Let's make a sample Layer 2 Device subclass.  This class
 | 
			
		||||
will inherit the Cisco Vlan module as an example.
 | 
			
		||||
 | 
			
		||||
----------------------- snip --------------------------------
 | 
			
		||||
 | 
			
		||||
@@ -1369,23 +1572,28 @@ Let's make a sample Layer 2 Device subclass :
 | 
			
		||||
 | 
			
		||||
 use Exporter;
 | 
			
		||||
 use SNMP::Info::Layer2;
 | 
			
		||||
 use SNMP::Info::CiscoVTP;
 | 
			
		||||
 | 
			
		||||
 @SNMP::Info::Layer2::Sample::ISA = qw/SNMP::Info::Layer2 Exporter/;
 | 
			
		||||
 @SNMP::Info::Layer2::Sample::ISA = qw/SNMP::Info::Layer2
 | 
			
		||||
                                       SNMP::Info::CiscoVTP Exporter/;
 | 
			
		||||
 @SNMP::Info::Layer2::Sample::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
 use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
 | 
			
		||||
 | 
			
		||||
 %MIBS    = (%SNMP::Info::Layer2::MIBS,
 | 
			
		||||
             %SNMP::Info::CiscoVTP::MIBS,
 | 
			
		||||
             'SUPER-DOOPER-MIB'  => 'supermibobject'
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
 %GLOBALS = (%SNMP::Info::Layer2::GLOBALS,
 | 
			
		||||
             %SNMP::Info::CiscoVTP::GLOBALS,
 | 
			
		||||
             'name'              => 'supermib_supername',
 | 
			
		||||
             'favorite_color'    => 'supermib_fav_color_object',
 | 
			
		||||
             'favorite_movie'    => 'supermib_fav_movie_val'
 | 
			
		||||
             );
 | 
			
		||||
 | 
			
		||||
 %FUNCS   = (%SNMP::Info::Layer2::FUNCS,
 | 
			
		||||
             %SNMP::Info::CiscoVTP::FUNCS,
 | 
			
		||||
             # Super Dooper MIB - Super Hero Table
 | 
			
		||||
             'super_hero_index'  => 'SuperHeroIfIndex',
 | 
			
		||||
             'super_hero_name'   => 'SuperHeroIfName',
 | 
			
		||||
@@ -1394,6 +1602,7 @@ Let's make a sample Layer 2 Device subclass :
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 %MUNGE   = (%SNMP::Info::Layer2::MUNGE,
 | 
			
		||||
             %SNMP::Info::CiscoVTP::MUNGE,
 | 
			
		||||
             'super_hero_powers' => \&munge_powers
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
@@ -1435,7 +1644,7 @@ Let's make a sample Layer 2 Device subclass :
 | 
			
		||||
 1; # don't forget this line
 | 
			
		||||
----------------------- snip --------------------------------
 | 
			
		||||
 | 
			
		||||
Be sure and send the debugged version to snmp@warped.org to be 
 | 
			
		||||
Be sure and send the debugged version to snmp-info-users@lists.sourceforge.net to be 
 | 
			
		||||
included in the next version of SNMP::Info.
 | 
			
		||||
 | 
			
		||||
=head1 SNMP::INFO INTERNALS
 | 
			
		||||
@@ -1505,9 +1714,12 @@ Makes human friendly speed ratings using %SPEED_MAP
 | 
			
		||||
                '11000000'   => '11 Mbps',
 | 
			
		||||
                '20000000'   => '20 Mbps',
 | 
			
		||||
                '16000000'   => '16 Mbps',
 | 
			
		||||
                '16777216'   => '16 Mbps',
 | 
			
		||||
                '44210000'   => 'T3',
 | 
			
		||||
                '44736000'   => 'T3',
 | 
			
		||||
                '45000000'   => '45 Mbps',
 | 
			
		||||
                '45045000'   => 'DS3',
 | 
			
		||||
                '46359642'   => 'DS3',
 | 
			
		||||
                '64000000'   => '64 Mbps',
 | 
			
		||||
                '100000000'  => '100 Mbps',
 | 
			
		||||
                '149760000'  => 'ATM on OC-3',
 | 
			
		||||
@@ -1538,9 +1750,12 @@ Makes human friendly speed ratings using %SPEED_MAP
 | 
			
		||||
                '11000000'   => '11 Mbps',
 | 
			
		||||
                '20000000'   => '20 Mbps',
 | 
			
		||||
                '16000000'   => '16 Mbps',
 | 
			
		||||
                '16777216'   => '16 Mbps',
 | 
			
		||||
                '44210000'   => 'T3',
 | 
			
		||||
                '44736000'   => 'T3',
 | 
			
		||||
                '45000000'   => '45 Mbps',
 | 
			
		||||
                '45045000'   => 'DS3',
 | 
			
		||||
                '46359642'   => 'DS3',
 | 
			
		||||
                '51850000'   => 'OC-1',
 | 
			
		||||
                '64000000'   => '64 Mbps',
 | 
			
		||||
                '100000000'  => '100 Mbps',
 | 
			
		||||
@@ -1660,12 +1875,21 @@ sub init {
 | 
			
		||||
    if ($major < 5){
 | 
			
		||||
        # Seems to work under 4.2.0
 | 
			
		||||
    } elsif ($major == 5 and $minor == 0 and $rev < 2){
 | 
			
		||||
        carp("SNMP 5.0.1 seems to be rather buggy. Upgrade.\n");
 | 
			
		||||
        carp("Net-SNMP 5.0.1 seems to be rather buggy. Upgrade.\n");
 | 
			
		||||
        # This is a bug in net-snmp 5.0.1 perl module
 | 
			
		||||
        # see http://groups.google.com/groups?th=47aed6bf7be6a0f5
 | 
			
		||||
        &SNMP::init_snmp("perl");
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    # Add MibDirs
 | 
			
		||||
    my $mibdirs = $self->{mibdirs} || [];
 | 
			
		||||
    
 | 
			
		||||
    foreach my $d (@$mibdirs){
 | 
			
		||||
        next unless -d $d;
 | 
			
		||||
        print "SNMP::Info::init() - Adding new mibdir:$d\n" if $self->debug(); 
 | 
			
		||||
        &SNMP::addMibDirs($d);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    my $mibs = $self->mibs();
 | 
			
		||||
    
 | 
			
		||||
    foreach my $mib (keys %$mibs){
 | 
			
		||||
@@ -1797,7 +2021,7 @@ sub store {
 | 
			
		||||
 | 
			
		||||
=item $info->_global()
 | 
			
		||||
 | 
			
		||||
Used internally by AUTOLOAD to load dynmaic methods from %GLOBALS. 
 | 
			
		||||
Used internally by AUTOLOAD to load dynamic methods from %GLOBALS. 
 | 
			
		||||
 | 
			
		||||
Example: $info->name() calls autoload which calls $info->_global('name').
 | 
			
		||||
 | 
			
		||||
@@ -1820,6 +2044,9 @@ sub _global{
 | 
			
		||||
    print "SNMP::Info::_global $attr : $oid\n" if $self->debug();
 | 
			
		||||
    my $val = $sess->get($oid); 
 | 
			
		||||
 | 
			
		||||
    # mark as gotten. Even if it fails below, we don't want to keep failing.
 | 
			
		||||
    $self->{"_$attr"}=undef;
 | 
			
		||||
 | 
			
		||||
    if ($sess->{ErrorStr} ){
 | 
			
		||||
        $self->error_throw("SNMP::Info::_global($attr) $sess->{ErrorStr}");
 | 
			
		||||
        return undef;
 | 
			
		||||
@@ -1870,13 +2097,20 @@ sub _set {
 | 
			
		||||
    my $funcs = $self->funcs();
 | 
			
		||||
    my $globals = $self->globals(); 
 | 
			
		||||
 | 
			
		||||
    my $oid = undef;
 | 
			
		||||
    # Check if this method is from a sub or from the tables.
 | 
			
		||||
    if ($self->can($attr)){
 | 
			
		||||
        $self->error_throw("SNMP::Info::_set($attr,$val) - Failed. $attr is generated in a sub(). set_$attr sub required.");
 | 
			
		||||
        # if sub set_attr() existed, we wouldn't have gotten this far.
 | 
			
		||||
        return undef;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    # Lookup oid
 | 
			
		||||
    my $oid = undef;
 | 
			
		||||
    $oid = $globals->{$attr} if defined $globals->{$attr};
 | 
			
		||||
    $oid = $funcs->{$attr} if defined $funcs->{$attr};
 | 
			
		||||
 | 
			
		||||
    unless (defined $oid) { 
 | 
			
		||||
        $self->error_throw("SNMP::Info::_set($attr,$val) - Failed to find $attr in \%GLOBALS or \%FUNCS");
 | 
			
		||||
        $self->error_throw("SNMP::Info::_set($attr,$val) - Failed to find $attr in \%GLOBALS or \%FUNCS.");
 | 
			
		||||
        return undef;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -1996,10 +2230,24 @@ sub _load_attr {
 | 
			
		||||
    }
 | 
			
		||||
    my $localstore = undef;
 | 
			
		||||
 | 
			
		||||
    # Use BULKWALK if we can because its faster
 | 
			
		||||
    my $vars;
 | 
			
		||||
    if ($ver != 1 && !$errornum) {
 | 
			
		||||
        ($vars) = $sess->bulkwalk(0, 20, $var);
 | 
			
		||||
        $errornum = $sess->{ErrorNum};
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    while (! $errornum ){
 | 
			
		||||
        # SNMP v1 use GETNEXT instead of BULKWALK
 | 
			
		||||
        if ($ver == 1) {
 | 
			
		||||
            $sess->getnext($var);
 | 
			
		||||
            $errornum = $sess->{ErrorNum};
 | 
			
		||||
        #print "$var->[0] $var->[1] $var->[2] $var->[3]\n";
 | 
			
		||||
        } else {
 | 
			
		||||
            $var = shift @$vars;
 | 
			
		||||
            last unless $var;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        # Check if we've left the requested subtree
 | 
			
		||||
        last if $var->[0] ne $leaf;
 | 
			
		||||
        my $iid = $var->[1];
 | 
			
		||||
        my $val = $var->[2];
 | 
			
		||||
@@ -2134,7 +2382,7 @@ sub AUTOLOAD {
 | 
			
		||||
    # Next check for entry in %GLOBALS
 | 
			
		||||
    if (defined $globals{$attr} ){
 | 
			
		||||
        # Return Cached Value if exists
 | 
			
		||||
        return $self->{"_${attr}"} if defined $self->{"_${attr}"};
 | 
			
		||||
        return $self->{"_${attr}"} if exists $self->{"_${attr}"};
 | 
			
		||||
        # Fetch New Value
 | 
			
		||||
        return $self->_global( $attr );
 | 
			
		||||
    }
 | 
			
		||||
@@ -2151,6 +2399,10 @@ sub AUTOLOAD {
 | 
			
		||||
 | 
			
		||||
=head1 COPYRIGHT AND LICENCE
 | 
			
		||||
 | 
			
		||||
Changes from SNMP::Info Version 0.7 and on are:
 | 
			
		||||
Copyright (c)2003, 2004 Max Baker - All rights reserved.
 | 
			
		||||
 | 
			
		||||
Original Code is:
 | 
			
		||||
Copyright (c) 2002-3, Regents of the University of California
 | 
			
		||||
All rights reserved.
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,13 @@
 | 
			
		||||
# 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.6;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
@@ -45,7 +49,9 @@ $SNMP::debugging=$DEBUG;
 | 
			
		||||
 | 
			
		||||
$INIT = 0;
 | 
			
		||||
 | 
			
		||||
%MIBS    = ('BRIDGE-MIB' => 'dot1dBaseBridgeAddress');
 | 
			
		||||
%MIBS    = ('BRIDGE-MIB'   => 'dot1dBaseBridgeAddress',
 | 
			
		||||
            'Q-BRIDGE-MIB' => 'dot1qPvid',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
            'b_mac'    => 'dot1dBaseBridgeAddress',
 | 
			
		||||
@@ -55,6 +61,9 @@ $INIT = 0;
 | 
			
		||||
            'stp_ver'  => 'dot1dStpProtocolSpecification',
 | 
			
		||||
            'stp_time' => 'dot1dStpTimeSinceTopologyChange',
 | 
			
		||||
            'stp_root' => 'dot1dStpDesignatedRoot',
 | 
			
		||||
            # Q-BRIDGE-MIB
 | 
			
		||||
            'qb_vlans_max'  => 'dot1qMaxSupportedVlans',
 | 
			
		||||
            'qb_vlans'      => 'dot1qNumVlans',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%FUNCS = (
 | 
			
		||||
@@ -78,6 +87,11 @@ $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 = (
 | 
			
		||||
@@ -145,7 +159,7 @@ Max Baker (C<max@warped.org>)
 | 
			
		||||
 | 
			
		||||
 foreach my $fw_index (keys %$fw_mac){
 | 
			
		||||
    my $mac   = $fw_mac->{$fw_index};
 | 
			
		||||
    my $bp_id = $fw_mac->{$fw_index};
 | 
			
		||||
    my $bp_id = $fw_port->{$fw_index};
 | 
			
		||||
    my $iid   = $bp_index->{$bp_id};
 | 
			
		||||
    my $port  = $interfaces->{$iid};
 | 
			
		||||
 | 
			
		||||
@@ -156,6 +170,9 @@ Max Baker (C<max@warped.org>)
 | 
			
		||||
 | 
			
		||||
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 
 | 
			
		||||
@@ -172,6 +189,10 @@ None.
 | 
			
		||||
 | 
			
		||||
=item BRIDGE-MIB
 | 
			
		||||
 | 
			
		||||
=item Q-BRIDGE-MIB
 | 
			
		||||
 | 
			
		||||
f<rfc2674_q.mib>
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
BRIDGE-MIB needs to be extracted from ftp://ftp.cisco.com/pub/mibs/v1/v1.tar.gz
 | 
			
		||||
@@ -218,6 +239,16 @@ 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 METHODS
 | 
			
		||||
@@ -334,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
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										17
									
								
								Info/CDP.pm
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								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.6;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
@@ -74,9 +77,21 @@ $INIT = 0;
 | 
			
		||||
 | 
			
		||||
%MUNGE = (
 | 
			
		||||
          'c_capabilities' => \&munge_caps,
 | 
			
		||||
          'c_platform'     => \&munge_null,
 | 
			
		||||
          'c_domain'       => \&munge_null,
 | 
			
		||||
          'c_port'         => \&munge_null,
 | 
			
		||||
          'c_id'           => \&munge_null,
 | 
			
		||||
          'c_ver'          => \&munge_null,
 | 
			
		||||
          'c_ip'           => \&SNMP::Info::munge_ip
 | 
			
		||||
         );
 | 
			
		||||
 | 
			
		||||
# munge_null() - removes nulls (\0)
 | 
			
		||||
sub munge_null {
 | 
			
		||||
    my $text = shift || return;
 | 
			
		||||
    
 | 
			
		||||
    $text =~ s/\0//g;
 | 
			
		||||
    return $text;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub munge_caps {
 | 
			
		||||
    my $caps = shift;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
# SNMP::Info::CiscoStack
 | 
			
		||||
# Max Baker <max@warped.org>
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2003 Max Baker
 | 
			
		||||
# Copyright (c)2003,2004 Max Baker 
 | 
			
		||||
# All rights reserved.  
 | 
			
		||||
#
 | 
			
		||||
# Redistribution and use in source and binary forms, with or without 
 | 
			
		||||
@@ -28,7 +28,7 @@
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::CiscoStack;
 | 
			
		||||
$VERSION = 0.7;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
@@ -46,6 +46,7 @@ $SNMP::debugging=$DEBUG;
 | 
			
		||||
$INIT    = 0;
 | 
			
		||||
%MIBS    = (
 | 
			
		||||
            'CISCO-STACK-MIB'         => 'ciscoStackMIB',
 | 
			
		||||
            'CISCO-PORT-SECURITY-MIB' => 'ciscoPortSecurityMIB',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
@@ -61,6 +62,13 @@ $INIT    = 0;
 | 
			
		||||
            'ps2_status'  => 'chassisPs2Status',    
 | 
			
		||||
            'slots'       => 'chassisNumSlots',    
 | 
			
		||||
            'fan'         => 'chassisFanStatus',
 | 
			
		||||
            # CISCO-PORT-SECURITY-MIB
 | 
			
		||||
            'cps_clear'     => 'cpsGlobalClearSecureMacAddresses',
 | 
			
		||||
            'cps_notify'    => 'cpsGlobalSNMPNotifControl',
 | 
			
		||||
            'cps_rate'      => 'cpsGlobalSNMPNotifRate',
 | 
			
		||||
            'cps_enable'    => 'cpsGlobalPortSecurityEnable',
 | 
			
		||||
            'cps_mac_count' => 'cpsGlobalTotalSecureAddress',
 | 
			
		||||
            'cps_mac_max'   => 'cpsGlobalMaxSecureAddress',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%FUNCS   = (
 | 
			
		||||
@@ -92,11 +100,47 @@ $INIT    = 0;
 | 
			
		||||
            # CISCO-STACK-MIB::PortCpbEntry
 | 
			
		||||
            'p_speed_admin'  => 'portCpbSpeed',
 | 
			
		||||
            'p_duplex_admin' => 'portCpbDuplex',
 | 
			
		||||
            # CISCO-PORT-SECURITY-MIB::cpsIfConfigTable
 | 
			
		||||
            'cps_i_limit_val'  => 'cpsIfInvalidSrcRateLimitValue',
 | 
			
		||||
            'cps_i_limit'      => 'cpsIfInvalidSrcRateLimitEnable',
 | 
			
		||||
            'cps_i_sticky'     => 'cpsIfStickyEnable',
 | 
			
		||||
            'cps_i_clear_type' => 'cpsIfClearSecureMacAddresses',
 | 
			
		||||
            'cps_i_shutdown'   => 'cpsIfShutdownTimeout',
 | 
			
		||||
            'cps_i_flood'      => 'cpsIfUnicastFloodingEnable',
 | 
			
		||||
            'cps_i_clear'      => 'cpsIfClearSecureAddresses',
 | 
			
		||||
            'cps_i_mac'        => 'cpsIfSecureLastMacAddress',
 | 
			
		||||
            'cps_i_count'      => 'cpsIfViolationCount',
 | 
			
		||||
            'cps_i_action'     => 'cpsIfViolationAction',
 | 
			
		||||
            'cps_i_mac_static' => 'cpsIfStaticMacAddrAgingEnable',
 | 
			
		||||
            'cps_i_mac_type'   => 'cpsIfSecureMacAddrAgingType',
 | 
			
		||||
            'cps_i_mac_age'    => 'cpsIfSecureMacAddrAgingTime',
 | 
			
		||||
            'cps_i_mac_count'  => 'cpsIfCurrentSecureMacAddrCount',
 | 
			
		||||
            'cps_i_mac_max'    => 'cpsIfMaxSecureMacAddr',
 | 
			
		||||
            'cps_i_status'     => 'cpsIfPortSecurityStatus',
 | 
			
		||||
            'cps_i_enable'     => 'cpsIfPortSecurityEnable',
 | 
			
		||||
            # CISCO-PORT-SECURITY-MIB::cpsIfVlanTable
 | 
			
		||||
            'cps_i_v_mac_count' => 'cpsIfVlanCurSecureMacAddrCount',
 | 
			
		||||
            'cps_i_v_mac_max'   => 'cpsIfVlanMaxSecureMacAddr',
 | 
			
		||||
            'cps_i_v'           => 'cpsIfVlanIndex',
 | 
			
		||||
            # CISCO-PORT-SECURITY-MIB::cpsIfVlanSecureMacAddrTable
 | 
			
		||||
            'cps_i_v_mac_status' => 'cpsIfVlanSecureMacAddrRowStatus',
 | 
			
		||||
            'cps_i_v_mac_age'    => 'cpsIfVlanSecureMacAddrRemainAge',
 | 
			
		||||
            'cps_i_v_mac_type'   => 'cpsIfVlanSecureMacAddrType',
 | 
			
		||||
            'cps_i_v_vlan'       => 'cpsIfVlanSecureVlanIndex',
 | 
			
		||||
            'cps_i_v_mac'        => 'cpsIfVlanSecureMacAddress',
 | 
			
		||||
            # CISCO-PORT-SECURITY-MIB::cpsSecureMacAddressTable
 | 
			
		||||
            'cps_m_status' => 'cpsSecureMacAddrRowStatus',
 | 
			
		||||
            'cps_m_age' => 'cpsSecureMacAddrRemainingAge',
 | 
			
		||||
            'cps_m_type' => 'cpsSecureMacAddrType',
 | 
			
		||||
            'cps_m_mac' => 'cpsSecureMacAddress',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%MUNGE   = (
 | 
			
		||||
            'm_ports_status' => \&munge_port_status,
 | 
			
		||||
            'p_duplex_admin' => \&SNMP::Info::munge_bits,
 | 
			
		||||
            'cps_i_mac'      => \&SNMP::Info::munge_mac, 
 | 
			
		||||
            'cps_m_mac'      => \&SNMP::Info::munge_mac,
 | 
			
		||||
            'cps_i_v_mac'    => \&SNMP::Info::munge_mac,
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%PORTSTAT = (1 => 'other',
 | 
			
		||||
@@ -221,7 +265,7 @@ __END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::CiscoStack - Perl5 Interface to CPU and Memory stats for Cisco Devices
 | 
			
		||||
SNMP::Info::CiscoStack - Intefaces to data from CISCO-STACK-MIB and CISCO-PORT-SECURITY-MIB
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
@@ -261,9 +305,12 @@ none.
 | 
			
		||||
 | 
			
		||||
=item CISCO-STACK-MIB
 | 
			
		||||
 | 
			
		||||
=item CISCO-PORT-SECURITY-MIB
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
 | 
			
		||||
MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz or from
 | 
			
		||||
Netdisco-mib package at netdisco.org. 
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
@@ -311,6 +358,38 @@ MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 CISCO-PORT-SECURITY-MIB globals
 | 
			
		||||
 | 
			
		||||
See CISCO-PORT-SECURITY-MIB for details.
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_clear()
 | 
			
		||||
 | 
			
		||||
B<cpsGlobalClearSecureMacAddresses>
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_notify()
 | 
			
		||||
 | 
			
		||||
B<cpsGlobalSNMPNotifControl>
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_rate()
 | 
			
		||||
 | 
			
		||||
B<cpsGlobalSNMPNotifRate>
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_enable()
 | 
			
		||||
 | 
			
		||||
B<cpsGlobalPortSecurityEnable>
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_mac_count()
 | 
			
		||||
 | 
			
		||||
B<cpsGlobalTotalSecureAddress>
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_mac_max()
 | 
			
		||||
 | 
			
		||||
B<cpsGlobalMaxSecureAddress>
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 TABLE METHODS
 | 
			
		||||
 | 
			
		||||
=head2 Interface Tables
 | 
			
		||||
@@ -481,4 +560,147 @@ To see the status of port 4 :
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
=head2 CISCO-PORT-SECURITY-MIB - Interface Config Table
 | 
			
		||||
 | 
			
		||||
See CISCO-PORT-SECURITY-MIB for details.
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_i_limit_val()
 | 
			
		||||
 | 
			
		||||
B<cpsIfInvalidSrcRateLimitValue>
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_i_limit()
 | 
			
		||||
 | 
			
		||||
B<cpsIfInvalidSrcRateLimitEnable>
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_i_sticky()
 | 
			
		||||
 | 
			
		||||
B<cpsIfStickyEnable>
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_i_clear_type()
 | 
			
		||||
 | 
			
		||||
B<cpsIfClearSecureMacAddresses>
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_i_shutdown()
 | 
			
		||||
 | 
			
		||||
B<cpsIfShutdownTimeout>
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_i_flood()
 | 
			
		||||
 | 
			
		||||
B<cpsIfUnicastFloodingEnable>
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_i_clear()
 | 
			
		||||
 | 
			
		||||
B<cpsIfClearSecureAddresses>
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_i_mac()
 | 
			
		||||
 | 
			
		||||
B<cpsIfSecureLastMacAddress>
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_i_count()
 | 
			
		||||
 | 
			
		||||
B<cpsIfViolationCount>
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_i_action()
 | 
			
		||||
 | 
			
		||||
B<cpsIfViolationAction>
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_i_mac_static()
 | 
			
		||||
 | 
			
		||||
B<cpsIfStaticMacAddrAgingEnable>
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_i_mac_type()
 | 
			
		||||
 | 
			
		||||
B<cpsIfSecureMacAddrAgingType>
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_i_mac_age()
 | 
			
		||||
 | 
			
		||||
B<cpsIfSecureMacAddrAgingTime>
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_i_mac_count()
 | 
			
		||||
 | 
			
		||||
B<cpsIfCurrentSecureMacAddrCount>
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_i_mac_max()
 | 
			
		||||
 | 
			
		||||
B<cpsIfMaxSecureMacAddr>
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_i_status()
 | 
			
		||||
 | 
			
		||||
B<cpsIfPortSecurityStatus>
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_i_enable()
 | 
			
		||||
 | 
			
		||||
B<cpsIfPortSecurityEnable>
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 CISCO-PORT-SECURITY-MIB::cpsIfVlanTable
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_i_v_mac_count()
 | 
			
		||||
 | 
			
		||||
B<cpsIfVlanCurSecureMacAddrCount>
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_i_v_mac_max()
 | 
			
		||||
 | 
			
		||||
B<cpsIfVlanMaxSecureMacAddr>
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_i_v()
 | 
			
		||||
 | 
			
		||||
B<cpsIfVlanIndex>
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 CISCO-PORT-SECURITY-MIB::cpsIfVlanSecureMacAddrTable
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_i_v_mac_status()
 | 
			
		||||
 | 
			
		||||
B<cpsIfVlanSecureMacAddrRowStatus>
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_i_v_mac_age()
 | 
			
		||||
 | 
			
		||||
B<cpsIfVlanSecureMacAddrRemainAge>
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_i_v_mac_type()
 | 
			
		||||
 | 
			
		||||
B<cpsIfVlanSecureMacAddrType>
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_i_v_vlan()
 | 
			
		||||
 | 
			
		||||
B<cpsIfVlanSecureVlanIndex>
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_i_v_mac()
 | 
			
		||||
 | 
			
		||||
B<cpsIfVlanSecureMacAddress>
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 CISCO-PORT-SECURITY-MIB::cpsSecureMacAddressTable
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_m_status()
 | 
			
		||||
 | 
			
		||||
B<cpsSecureMacAddrRowStatus>
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_m_age()
 | 
			
		||||
 | 
			
		||||
B<cpsSecureMacAddrRemainingAge>
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_m_type()
 | 
			
		||||
 | 
			
		||||
B<cpsSecureMacAddrType>
 | 
			
		||||
 | 
			
		||||
=item $stack->cps_m_mac()
 | 
			
		||||
 | 
			
		||||
B<cpsSecureMacAddress>
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,9 @@
 | 
			
		||||
# 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.
 | 
			
		||||
# 
 | 
			
		||||
@@ -28,7 +31,7 @@
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::CiscoStats;
 | 
			
		||||
$VERSION = 0.6;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
@@ -89,12 +92,12 @@ sub os_ver {
 | 
			
		||||
    my $descr = $l2->description();
 | 
			
		||||
    
 | 
			
		||||
    # Older Catalysts
 | 
			
		||||
    if ($os eq 'catalyst' and $descr =~ m/V(\d{1}\.\d{2}\.\d{2})/){
 | 
			
		||||
    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 ($descr =~ m/Version (\d+\.\d+\([^)]+\)[^,\s]*)(,|\s)+/ ){
 | 
			
		||||
    if (defined $descr and $descr =~ m/Version (\d+\.\d+\([^)]+\)[^,\s]*)(,|\s)+/ ){
 | 
			
		||||
        return $1;
 | 
			
		||||
    } 
 | 
			
		||||
    return undef;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										107
									
								
								Info/CiscoVTP.pm
									
									
									
									
									
								
							
							
						
						
									
										107
									
								
								Info/CiscoVTP.pm
									
									
									
									
									
								
							@@ -1,6 +1,8 @@
 | 
			
		||||
# 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.
 | 
			
		||||
# 
 | 
			
		||||
@@ -28,7 +30,7 @@
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::CiscoVTP;
 | 
			
		||||
$VERSION = 0.7;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
@@ -46,6 +48,8 @@ $SNMP::debugging=$DEBUG;
 | 
			
		||||
$INIT    = 0;
 | 
			
		||||
%MIBS    = (
 | 
			
		||||
            'CISCO-VTP-MIB'                       => 'vtpVlanName',
 | 
			
		||||
            'CISCO-VLAN-MEMBERSHIP-MIB'           => 'vmMembershipEntry',
 | 
			
		||||
            'CISCO-VLAN-IFTABLE-RELATIONSHIP-MIB' => 'cviRoutedVlanIfIndex',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
@@ -88,6 +92,20 @@ $INIT    = 0;
 | 
			
		||||
            'v_crf'      => 'vtpVlanIsCRFBackup',
 | 
			
		||||
            'v_type_ext' => 'vtpVlanTypeExt',
 | 
			
		||||
            'v_if'       => 'vtpVlanIfIndex',
 | 
			
		||||
 | 
			
		||||
            # CISCO-VLAN-MEMBERSHIP-MIB
 | 
			
		||||
            # VmMembershipTable
 | 
			
		||||
            'i_vlan_type' => 'vmVlanType',
 | 
			
		||||
            'i_vlan2'     => 'vmVlan',
 | 
			
		||||
            'i_vlan_stat' => 'vmPortStatus',
 | 
			
		||||
            'i_vlan_1'    => 'vmVlans',
 | 
			
		||||
            'i_vlan_2'    => 'vmVlans2k',
 | 
			
		||||
            'i_vlan_3'    => 'vmVlans3k',
 | 
			
		||||
            'i_vlan_4'    => 'vmVlans4k',
 | 
			
		||||
 | 
			
		||||
            # CISCO-VLAN-IFTABLE-RELATIONSHIP-MIB
 | 
			
		||||
            'v_cvi_if'    => 'cviRoutedVlanIfIndex',
 | 
			
		||||
 | 
			
		||||
            # TODO Add these tables if someone wants them..
 | 
			
		||||
            # vtpEditControlTable
 | 
			
		||||
            # vtpVlanEditTable
 | 
			
		||||
@@ -98,12 +116,37 @@ $INIT    = 0;
 | 
			
		||||
%MUNGE   = (
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
sub i_vlan {
 | 
			
		||||
    my $vtp = shift;
 | 
			
		||||
 | 
			
		||||
    # Check for CISCO-VLAN-MIB
 | 
			
		||||
    my $i_vlan = $vtp->i_vlan2();
 | 
			
		||||
    return $i_vlan if defined $i_vlan;
 | 
			
		||||
 | 
			
		||||
    # Check in CISCO-VLAN-IFTABLE-RELATION-MIB
 | 
			
		||||
    my $v_cvi_if = $vtp->v_cvi_if();
 | 
			
		||||
    return undef unless defined $v_cvi_if;
 | 
			
		||||
 | 
			
		||||
    # Translate vlan.physical_interface -> iid
 | 
			
		||||
    #       to iid -> vlan
 | 
			
		||||
    $i_vlan = {};
 | 
			
		||||
    foreach my $i (keys %$v_cvi_if){
 | 
			
		||||
        my ($vlan,$phys) = split(/\./,$i);
 | 
			
		||||
        my $iid = $v_cvi_if->{$i};
 | 
			
		||||
 | 
			
		||||
        $i_vlan->{$iid}=$vlan;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return $i_vlan;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
__END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::CiscoVTP - Perl5 Interface to Cisco's VLAN Management MIB - CISCO-VTP-MIB
 | 
			
		||||
SNMP::Info::CiscoVTP - Perl5 Interface to Cisco's VLAN Management MIBs
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
@@ -128,7 +171,7 @@ Max Baker (C<max@warped.org>)
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
SNMP::Info::CiscoVTP is a subclass of SNMP::Info that provides 
 | 
			
		||||
information about a switch's VLANs.
 | 
			
		||||
information about a cisco device's VLAN and VTP Domain memebership.
 | 
			
		||||
 | 
			
		||||
Use or create in a subclass of SNMP::Info.  Do not use directly.
 | 
			
		||||
 | 
			
		||||
@@ -142,6 +185,10 @@ none.
 | 
			
		||||
 | 
			
		||||
=item CISCO-VTP-MIB
 | 
			
		||||
 | 
			
		||||
=item CISCO-VLAN-MEMBERSHIP-MIB
 | 
			
		||||
 | 
			
		||||
=item CISCO-VLAN-IFTABLE-RELATIONSHIP-MIB
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
 | 
			
		||||
@@ -181,6 +228,8 @@ You device will only implement a subset of these methods.
 | 
			
		||||
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()
 | 
			
		||||
@@ -257,6 +306,58 @@ 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
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,8 @@
 | 
			
		||||
# 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.
 | 
			
		||||
# 
 | 
			
		||||
@@ -28,7 +30,7 @@
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::Entity;
 | 
			
		||||
$VERSION = 0.6;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
 
 | 
			
		||||
@@ -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.6;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										397
									
								
								Info/FDP.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										397
									
								
								Info/FDP.pm
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,397 @@
 | 
			
		||||
# SNMP::Info::FDP
 | 
			
		||||
# Bruce Rodger
 | 
			
		||||
# $Id$
 | 
			
		||||
#
 | 
			
		||||
# (c) 2004 Bruce Rodger, 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:
 | 
			
		||||
# 
 | 
			
		||||
#     * 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::FDP;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
use Exporter;
 | 
			
		||||
use SNMP::Info;
 | 
			
		||||
use Carp;
 | 
			
		||||
 | 
			
		||||
@SNMP::Info::FDP::ISA = qw/SNMP::Info Exporter/;
 | 
			
		||||
@SNMP::Info::FDP::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
use vars qw/$VERSION $DEBUG %FUNCS %GLOBALS %MIBS %MUNGE $INIT/;
 | 
			
		||||
# Debug
 | 
			
		||||
$DEBUG=1;
 | 
			
		||||
$SNMP::debugging=$DEBUG;
 | 
			
		||||
 | 
			
		||||
# Five data structures required by SNMP::Info
 | 
			
		||||
$INIT = 0;
 | 
			
		||||
%MIBS 	= ( 'FOUNDRY-SN-SWITCH-GROUP-MIB' => 'snFdpGlobalRun' );
 | 
			
		||||
 | 
			
		||||
# Notice we dont inherit the default GLOBALS and FUNCS
 | 
			
		||||
# only the default MUNGE.
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
            # CDP-Compatibility
 | 
			
		||||
            'cdp_run'      => 'snFdpGlobalRun',
 | 
			
		||||
            'cdp_interval' => 'snFdpGlobalMessageInterval',
 | 
			
		||||
            'cdp_holdtime' => 'snFdpGlobalHoldTime',
 | 
			
		||||
            'cdp_id'       => 'snFdpGlobalDeviceId',
 | 
			
		||||
            #
 | 
			
		||||
            'fdp_run'      => 'snFdpGlobalRun',
 | 
			
		||||
            'fdp_interval' => 'snFdpGlobalMessageInterval',
 | 
			
		||||
            'fdp_holdtime' => 'snFdpGlobalHoldTime',
 | 
			
		||||
            'fdp_id'       => 'snFdpGlobalDeviceId',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%FUNCS  = (
 | 
			
		||||
            'c_index'        => 'snFdpCacheIfIndex',
 | 
			
		||||
            'c_proto'        => 'snFdpCacheAddressType',
 | 
			
		||||
            'c_ip'           => 'snFdpCacheAddress',
 | 
			
		||||
            'c_ver'          => 'snFdpCacheVersion',
 | 
			
		||||
            'c_id'           => 'snFdpCacheDeviceId',
 | 
			
		||||
            'c_port'         => 'snFdpCacheDevicePort',
 | 
			
		||||
            'c_platform'     => 'snFdpCachePlatform',
 | 
			
		||||
            'c_capabilities' => 'snFdpCacheCapabilities',
 | 
			
		||||
            'c_domain'       => 'snFdpCacheVTPMgmtDomain',
 | 
			
		||||
            'c_vlan'         => 'snFdpCacheNativeVLAN',
 | 
			
		||||
            'c_duplex'       => 'snFdpCacheDuplex'
 | 
			
		||||
          );
 | 
			
		||||
 | 
			
		||||
%MUNGE = (
 | 
			
		||||
          'c_capabilities' => \&munge_caps,
 | 
			
		||||
          'c_ip'           => \&SNMP::Info::munge_ip
 | 
			
		||||
         );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
sub munge_caps {
 | 
			
		||||
    my $caps = shift;
 | 
			
		||||
    return undef unless defined $caps;
 | 
			
		||||
 | 
			
		||||
    my $bits = substr(unpack("B*",$caps),-7);
 | 
			
		||||
    return $bits;
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
}
 | 
			
		||||
sub hasFDP {
 | 
			
		||||
    my $fdp = shift;
 | 
			
		||||
 | 
			
		||||
    my $ver = $fdp->{_version};
 | 
			
		||||
    #my $ver = $fdp->fdp_ver;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    # SNMP v1 clients dont have the globals
 | 
			
		||||
    if (defined $ver and $ver == 1){
 | 
			
		||||
        my $fdp_ip = $fdp->fdp_ip();
 | 
			
		||||
        # See if anything in fdp cache, if so we have fdp
 | 
			
		||||
        return 1 if (defined $fdp_ip and scalar(keys %$fdp_ip)) ;
 | 
			
		||||
        return undef;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    return $fdp->fdp_run();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub c_if {
 | 
			
		||||
    my $fdp  = shift;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    # See if by some miracle Cisco implemented the fdpCacheIfIndex entry
 | 
			
		||||
    my $fdp_index     = $fdp->fdp_index();
 | 
			
		||||
    return $fdp_index if defined $fdp_index;
 | 
			
		||||
 | 
			
		||||
    # Nope, didn't think so. Now we fake it.
 | 
			
		||||
    my $fdp_ip = $fdp->c_ip();
 | 
			
		||||
    unless (defined $fdp_ip){
 | 
			
		||||
        $fdp->{error} = "SNMP::Info::FDP:fdp_if() - Device doesn't have fdp_ip() data.  Can't fake fdp_index()";
 | 
			
		||||
        $DEBUG and carp($fdp->error(1));
 | 
			
		||||
        return undef;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    my %fdp_if;
 | 
			
		||||
    foreach my $key (keys %$fdp_ip){
 | 
			
		||||
      next unless defined $key;
 | 
			
		||||
      my $iid = $key;
 | 
			
		||||
      # Truncate .1 from fdp cache entry
 | 
			
		||||
      $iid =~ s/\.\d+$//;
 | 
			
		||||
      $fdp_if{$key} = $iid;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return \%fdp_if;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
__END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::FDP - Perl5 Interface to Foundry Discovery Protocol (FDP) using SNMP
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
Max Baker (C<max@warped.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 my $fdp = new SNMP::Info ( 
 | 
			
		||||
                             AutoSpecify => 1,
 | 
			
		||||
                             Debug       => 1,
 | 
			
		||||
                             DestHost    => 'router', 
 | 
			
		||||
                             Community   => 'public',
 | 
			
		||||
                             Version     => 2
 | 
			
		||||
                           );
 | 
			
		||||
 | 
			
		||||
 my $class = $fdp->class();
 | 
			
		||||
 print " Using device sub class : $class\n";
 | 
			
		||||
 | 
			
		||||
 $hasfdp   = $fdp->hasFDP() ? 'yes' : 'no';
 | 
			
		||||
 | 
			
		||||
 # Print out a map of device ports with FDP neighbors:
 | 
			
		||||
 my $interfaces = $fdp->interfaces();
 | 
			
		||||
 my $fdp_if       = $fdp->fdp_if();
 | 
			
		||||
 my $fdp_ip       = $fdp->fdp_ip();
 | 
			
		||||
 my $fdp_port     = $fdp->fdp_port();
 | 
			
		||||
 | 
			
		||||
 foreach my $fdp_key (keys %$fdp_ip){
 | 
			
		||||
    my $iid           = $fdp_if->{$fdp_key};
 | 
			
		||||
    my $port          = $interfaces->{$iid};
 | 
			
		||||
    my $neighbor      = $fdp_ip->{$fdp_key};
 | 
			
		||||
    my $neighbor_port = $fdp_port->{$fdp_key};
 | 
			
		||||
    print "Port : $port connected to $neighbor / $neighbor_port\n";
 | 
			
		||||
 }
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
SNMP::Info::FDP is a subclass of SNMP::Info that provides an object oriented 
 | 
			
		||||
interface to FDP information through SNMP.
 | 
			
		||||
 | 
			
		||||
FDP is a Layer 2 protocol that supplies topology information of
 | 
			
		||||
devices that also speak FDP, mostly switches and routers.  It has
 | 
			
		||||
similar functionality to Cisco's CDP, and the SNMP interface is
 | 
			
		||||
virtually identical.  FDP is implemented in Foundry devices, including
 | 
			
		||||
the Bigiron and Fastiron range.
 | 
			
		||||
 | 
			
		||||
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.
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
None.
 | 
			
		||||
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item FOUNDRY-SN-SWITCH-GROUP-MIB
 | 
			
		||||
 | 
			
		||||
Needs a reasonably recent MIB. Works OK with B2R07604A.mib, but doesn't
 | 
			
		||||
work with B2R07600C. 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
MIBs are normally distributed with each code update. Contact your vendor,
 | 
			
		||||
or trawl through google...
 | 
			
		||||
 | 
			
		||||
=head1 GLOBAL METHODS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar values from SNMP
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item  $fdp->hasFDP()
 | 
			
		||||
 | 
			
		||||
Is FDP is active in this device?  
 | 
			
		||||
 | 
			
		||||
Accounts for SNMP version 1 devices which may have FDP but not fdp_run()
 | 
			
		||||
 | 
			
		||||
=item $fdp->fdp_run()
 | 
			
		||||
 | 
			
		||||
Is FDP enabled on this device?  
 | 
			
		||||
 | 
			
		||||
(B<fdpGlobalRun>)
 | 
			
		||||
 | 
			
		||||
=item $fdp->fdp_interval()
 | 
			
		||||
 | 
			
		||||
Interval in seconds at which FDP messages are generated.
 | 
			
		||||
 | 
			
		||||
(B<fdpGlobalMessageInterval>)
 | 
			
		||||
 | 
			
		||||
=item $fdp->fdp_holdtime()
 | 
			
		||||
 | 
			
		||||
Time in seconds that FDP messages are kept. 
 | 
			
		||||
 | 
			
		||||
(B<fdpGlobalHoldTime>)
 | 
			
		||||
 | 
			
		||||
=item  $fdp->fdp_id() 
 | 
			
		||||
 | 
			
		||||
Returns FDP device ID.  
 | 
			
		||||
 | 
			
		||||
This is the device id broadcast via FDP to other devices, and is what is retrieved from remote devices with $fdp->id().
 | 
			
		||||
 | 
			
		||||
(B<fdpGlobalDeviceId>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 TABLE METHODS
 | 
			
		||||
 | 
			
		||||
These are methods that return tables of information in the form of a reference
 | 
			
		||||
to a hash.
 | 
			
		||||
 | 
			
		||||
=head2 FDP CACHE ENTRIES
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $fdp->fdp_capabilities()
 | 
			
		||||
 | 
			
		||||
Returns Device Functional Capabilities.  Results are munged into an ascii
 | 
			
		||||
binary string, 7 digits long, MSB.  Each digit represents a bit from the
 | 
			
		||||
table below.
 | 
			
		||||
 | 
			
		||||
From L<http://www.cisco.com/univercd/cc/td/doc/product/lan/trsrb/frames.htm#18843>:
 | 
			
		||||
 | 
			
		||||
(Bit) - Description
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item (0x40) - Provides level 1 functionality.
 | 
			
		||||
 | 
			
		||||
=item (0x20) - The bridge or switch does not forward IGMP Report packets on nonrouter ports.
 | 
			
		||||
 | 
			
		||||
=item (0x10) - Sends and receives packets for at least one network layer protocol. If the device is routing the protocol, this bit should not be set.
 | 
			
		||||
 | 
			
		||||
=item (0x08) - Performs level 2 switching. The difference between this bit and bit 0x02 is that a switch does not run the Spanning-Tree Protocol. This device is assumed to be deployed in a physical loop-free topology.
 | 
			
		||||
 | 
			
		||||
=item (0x04) - Performs level 2 source-route bridging. A source-route bridge would set both this bit and bit 0x02.
 | 
			
		||||
 | 
			
		||||
=item (0x02) - Performs level 2 transparent bridging.
 | 
			
		||||
 | 
			
		||||
=item (0x01) - Performs level 3 routing for at least one network layer protocol.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
Thanks to Martin Lorensen C<martin -at- lorensen.dk> for a pointer to this information.
 | 
			
		||||
 | 
			
		||||
(B<fdpCacheCapabilities>)
 | 
			
		||||
 | 
			
		||||
=item $fdp->fdp_domain()
 | 
			
		||||
 | 
			
		||||
The CDP version of this returns remote VTP Management Domain as defined in CISCO-VTP-MIB::managementDomainName
 | 
			
		||||
 | 
			
		||||
(B<fdpCacheVTPMgmtDomain>)
 | 
			
		||||
 | 
			
		||||
=item $fdp->fdp_duplex() 
 | 
			
		||||
 | 
			
		||||
Returns the port duplex status from remote devices.
 | 
			
		||||
 | 
			
		||||
(B<fdpCacheDuplex>)
 | 
			
		||||
 | 
			
		||||
=item $fdp->fdp_id()
 | 
			
		||||
 | 
			
		||||
Returns remote device id string
 | 
			
		||||
 | 
			
		||||
(B<fdpCacheDeviceId>)
 | 
			
		||||
 | 
			
		||||
=item $fdp->fdp_if()
 | 
			
		||||
 | 
			
		||||
Returns the mapping to the SNMP Interface Table.
 | 
			
		||||
 | 
			
		||||
Note that a lot devices don't implement $fdp->fdp_index(),  So if it isn't around,
 | 
			
		||||
we fake it. 
 | 
			
		||||
 | 
			
		||||
In order to map the fdp table entry back to the interfaces() entry, we truncate the last number
 | 
			
		||||
off of it :
 | 
			
		||||
 | 
			
		||||
  # it exists, yay.
 | 
			
		||||
  my $fdp_index     = $device->fdp_index();
 | 
			
		||||
  return $fdp_index if defined $fdp_index;
 | 
			
		||||
 | 
			
		||||
  # if not, let's fake it
 | 
			
		||||
  my $fdp_ip       = $device->fdp_ip();
 | 
			
		||||
    
 | 
			
		||||
  my %fdp_if
 | 
			
		||||
  foreach my $key (keys %$fdp_ip){
 | 
			
		||||
      $iid = $key;
 | 
			
		||||
      ## Truncate off .1 from fdp response
 | 
			
		||||
      $iid =~ s/\.\d+$//;
 | 
			
		||||
      $fdp_if{$key} = $iid;
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
  return \%fdp_if;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
=item $fdp->fdp_index()
 | 
			
		||||
 | 
			
		||||
Returns the mapping to the SNMP2 Interface table for FDP Cache Entries. 
 | 
			
		||||
 | 
			
		||||
Most devices don't implement this, so you probably want to use $fdp->fdp_if() instead.
 | 
			
		||||
 | 
			
		||||
See fdp_if() entry.
 | 
			
		||||
 | 
			
		||||
(B<fdpCacheIfIndex>)
 | 
			
		||||
 | 
			
		||||
=item  $fdp->fdp_ip()
 | 
			
		||||
 | 
			
		||||
Returns remote IP address
 | 
			
		||||
 | 
			
		||||
(B<fdpCacheAddress>)
 | 
			
		||||
 | 
			
		||||
=item $fdp->fdp_platform() 
 | 
			
		||||
 | 
			
		||||
Returns remote platform id 
 | 
			
		||||
 | 
			
		||||
(B<fdpCachePlatform>)
 | 
			
		||||
 | 
			
		||||
=item $fdp->fdp_port()
 | 
			
		||||
 | 
			
		||||
Returns remote port ID
 | 
			
		||||
 | 
			
		||||
(B<fdpDevicePort>)
 | 
			
		||||
 | 
			
		||||
=item  $fdp->fdp_proto()
 | 
			
		||||
 | 
			
		||||
Returns remote address type received.  Usually IP.
 | 
			
		||||
 | 
			
		||||
(B<fdpCacheAddressType>)
 | 
			
		||||
 | 
			
		||||
=item $fdp->fdp_ver() 
 | 
			
		||||
 | 
			
		||||
Returns remote hardware version
 | 
			
		||||
 | 
			
		||||
(B<fdpCacheVersion>)
 | 
			
		||||
 | 
			
		||||
=item $fdp->fdp_vlan()
 | 
			
		||||
 | 
			
		||||
Returns the remote interface native VLAN.
 | 
			
		||||
 | 
			
		||||
(B<fdpCacheNativeVLAN>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
@@ -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.6;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
 
 | 
			
		||||
@@ -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.6;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
# $Id$
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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.6;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
# $Id$
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										533
									
								
								Info/Layer1/Bayhub.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										533
									
								
								Info/Layer1/Bayhub.pm
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,533 @@
 | 
			
		||||
# SNMP::Info::Layer1::Bayhub
 | 
			
		||||
# Eric Miller <eric@jeneric.org>
 | 
			
		||||
# $Id$
 | 
			
		||||
#
 | 
			
		||||
# 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.
 | 
			
		||||
# 
 | 
			
		||||
# 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::Layer1::Bayhub;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
use Exporter;
 | 
			
		||||
use SNMP::Info;
 | 
			
		||||
use SNMP::Info::Bridge;
 | 
			
		||||
use SNMP::Info::NortelStack;
 | 
			
		||||
use SNMP::Info::SONMP;
 | 
			
		||||
 | 
			
		||||
@SNMP::Info::Layer1::Bayhub::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::NortelStack SNMP::Info::SONMP Exporter/;
 | 
			
		||||
@SNMP::Info::Layer1::Bayhub::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
 | 
			
		||||
 | 
			
		||||
%MIBS    = (
 | 
			
		||||
	    %SNMP::Info::MIBS,
 | 
			
		||||
            %SNMP::Info::Bridge::MIBS,
 | 
			
		||||
            %SNMP::Info::NortelStack::MIBS,	    
 | 
			
		||||
            %SNMP::Info::SONMP::MIBS,
 | 
			
		||||
            'S5-ETHERNET-COMMON-MIB'	=> 's5EnPortTable',
 | 
			
		||||
            'S5-COMMON-STATS-MIB'	=> 's5CmStat',
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
            %SNMP::Info::GLOBALS,
 | 
			
		||||
            %SNMP::Info::Bridge::GLOBALS,
 | 
			
		||||
            %SNMP::Info::NortelStack::GLOBALS,
 | 
			
		||||
            %SNMP::Info::SONMP::GLOBALS,
 | 
			
		||||
	    );
 | 
			
		||||
 | 
			
		||||
%FUNCS   = (
 | 
			
		||||
            %SNMP::Info::FUNCS,
 | 
			
		||||
            %SNMP::Info::Bridge::FUNCS,
 | 
			
		||||
            %SNMP::Info::NortelStack::FUNCS,
 | 
			
		||||
            %SNMP::Info::SONMP::FUNCS,
 | 
			
		||||
            # S5-ETHERNET-COMMON-MIB::s5EnPortTable
 | 
			
		||||
            'bayhub_pb_index'	=> 's5EnPortBrdIndx',
 | 
			
		||||
            'bayhub_pp_index'	=> 's5EnPortIndx',
 | 
			
		||||
            'bayhub_up_admin'	=> 's5EnPortPartStatus',
 | 
			
		||||
            'bayhub_up'		=> 's5EnPortLinkStatus',
 | 
			
		||||
	    # S5-COMMON-STATS-MIB::s5CmSNodeTable
 | 
			
		||||
            'bayhub_nb_index'	=> 's5CmSNodeBrdIndx',
 | 
			
		||||
            'bayhub_np_index'	=> 's5CmSNodePortIndx',
 | 
			
		||||
            'fw_mac'		=> 's5CmSNodeMacAddr',
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
%MUNGE   = (
 | 
			
		||||
            %SNMP::Info::MUNGE,
 | 
			
		||||
            %SNMP::Info::Bridge::MUNGE,
 | 
			
		||||
            %SNMP::Info::NortelStack::MUNGE,
 | 
			
		||||
            %SNMP::Info::SONMP::MUNGE,
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
sub layers {
 | 
			
		||||
    return '00000011';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os {
 | 
			
		||||
    return 'bay_hub';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vendor {
 | 
			
		||||
    return 'nortel';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub model {
 | 
			
		||||
    my $bayhub = shift;
 | 
			
		||||
    my $id = $bayhub->id();
 | 
			
		||||
    return undef unless defined $id;
 | 
			
		||||
    my $model = &SNMP::translateObj($id);
 | 
			
		||||
    return $id unless defined $model;
 | 
			
		||||
    $model =~ s/^sreg-//i;
 | 
			
		||||
 | 
			
		||||
    return 'Baystack Hub' if ($model =~ /BayStackEth/);
 | 
			
		||||
    return '5000' if ($model =~ /5000/);
 | 
			
		||||
    return '5005' if ($model =~ /5005/);
 | 
			
		||||
    return $model;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Hubs do not support ifMIB requirements for get MAC
 | 
			
		||||
# and port status 
 | 
			
		||||
sub i_index {
 | 
			
		||||
    my $bayhub = shift;
 | 
			
		||||
    my $b_index = $bayhub->bayhub_pb_index();
 | 
			
		||||
    my $p_index = $bayhub->bayhub_pp_index();
 | 
			
		||||
    my $model = $bayhub->model();
 | 
			
		||||
 | 
			
		||||
    my %i_index;
 | 
			
		||||
    foreach my $iid (keys %$b_index){
 | 
			
		||||
        my $board = $b_index->{$iid};
 | 
			
		||||
        next unless defined $board;
 | 
			
		||||
        my $port = $p_index->{$iid}||0;
 | 
			
		||||
 | 
			
		||||
        if ($model eq 'Baystack Hub') {
 | 
			
		||||
            my $comidx = $board;
 | 
			
		||||
               if (! ($comidx % 5)) {
 | 
			
		||||
                  $board = ($board / 5);
 | 
			
		||||
               } elsif ($comidx =~ /[16]$/) {
 | 
			
		||||
                  $board = int($board/5);
 | 
			
		||||
                  $port = 25;          
 | 
			
		||||
               } elsif ($comidx =~ /[27]$/) {
 | 
			
		||||
                  $board = int($board/5);
 | 
			
		||||
                  $port = 26;          
 | 
			
		||||
               }
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
	my $index = ($board*256)+$port;
 | 
			
		||||
 | 
			
		||||
	$i_index{$iid} = $index;
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_index;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub interfaces {
 | 
			
		||||
    my $bayhub = shift;
 | 
			
		||||
    my $i_index = $bayhub->i_index();
 | 
			
		||||
 | 
			
		||||
    my %if;
 | 
			
		||||
    foreach my $iid (keys %$i_index){
 | 
			
		||||
        my $index = $i_index->{$iid};
 | 
			
		||||
        next unless defined $index;
 | 
			
		||||
 | 
			
		||||
	# Index numbers are deterministic slot * 256 + port
 | 
			
		||||
	my $port = $index % 256;
 | 
			
		||||
        my $slot = int($index / 256);
 | 
			
		||||
 | 
			
		||||
        my $slotport = "$slot.$port";
 | 
			
		||||
    
 | 
			
		||||
        $if{$index} = $slotport;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return \%if;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_duplex {
 | 
			
		||||
    my $bayhub = shift;
 | 
			
		||||
    my $port_index  = $bayhub->i_index();
 | 
			
		||||
 | 
			
		||||
    my %i_duplex;
 | 
			
		||||
    foreach my $iid (keys %$port_index){
 | 
			
		||||
        my $index = $port_index->{$iid};
 | 
			
		||||
        next unless defined $index;
 | 
			
		||||
    
 | 
			
		||||
        my $duplex = 'half';
 | 
			
		||||
        $i_duplex{$index}=$duplex; 
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_duplex;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_duplex_admin {
 | 
			
		||||
    my $bayhub = shift;
 | 
			
		||||
    my $port_index  = $bayhub->i_index();
 | 
			
		||||
 | 
			
		||||
    my %i_duplex_admin;
 | 
			
		||||
    foreach my $iid (keys %$port_index){
 | 
			
		||||
        my $index = $port_index->{$iid};
 | 
			
		||||
        next unless defined $index;
 | 
			
		||||
    
 | 
			
		||||
        my $duplex = 'half';
 | 
			
		||||
        $i_duplex_admin{$index}=$duplex; 
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_duplex_admin;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_speed {
 | 
			
		||||
    my $bayhub = shift;
 | 
			
		||||
    my $port_index  = $bayhub->i_index();
 | 
			
		||||
 | 
			
		||||
    my %i_speed;
 | 
			
		||||
    foreach my $iid (keys %$port_index){
 | 
			
		||||
        my $index = $port_index->{$iid};
 | 
			
		||||
        next unless defined $index;
 | 
			
		||||
    
 | 
			
		||||
        my $speed = '10 Mbps';
 | 
			
		||||
        $i_speed{$index}=$speed; 
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_speed;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_up {
 | 
			
		||||
    my $bayhub = shift;
 | 
			
		||||
    my $port_index = $bayhub->i_index();
 | 
			
		||||
    my $link_stat = $bayhub->bayhub_up();
 | 
			
		||||
   
 | 
			
		||||
    my %i_up;
 | 
			
		||||
    foreach my $iid (keys %$port_index){
 | 
			
		||||
        my $index = $port_index->{$iid};
 | 
			
		||||
        next unless defined $index;
 | 
			
		||||
        my $link_stat = $link_stat->{$iid};
 | 
			
		||||
	next unless defined $link_stat;
 | 
			
		||||
	
 | 
			
		||||
        $link_stat = 'up' if $link_stat =~ /on/i;
 | 
			
		||||
        $link_stat = 'down' if $link_stat =~ /off/i;
 | 
			
		||||
             
 | 
			
		||||
        $i_up{$index}=$link_stat; 
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_up;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_up_admin {
 | 
			
		||||
    my $bayhub = shift;
 | 
			
		||||
    my $i_index = $bayhub->i_index();
 | 
			
		||||
    my $link_stat = $bayhub->bayhub_up_admin();
 | 
			
		||||
 
 | 
			
		||||
    my %i_up_admin;
 | 
			
		||||
    foreach my $iid (keys %$i_index){
 | 
			
		||||
    	my $index = $i_index->{$iid};
 | 
			
		||||
    	next unless defined $index;
 | 
			
		||||
        my $link_stat = $link_stat->{$iid};
 | 
			
		||||
	next unless defined $link_stat;
 | 
			
		||||
 
 | 
			
		||||
        $i_up_admin{$index}=$link_stat; 
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_up_admin;
 | 
			
		||||
}
 | 
			
		||||
# Hubs do not support the standard Bridge MIB
 | 
			
		||||
sub bp_index {
 | 
			
		||||
   my $bayhub = shift;
 | 
			
		||||
    my $b_index = $bayhub->bayhub_nb_index();
 | 
			
		||||
    my $p_index = $bayhub->bayhub_np_index();
 | 
			
		||||
    my $model = $bayhub->model();
 | 
			
		||||
 | 
			
		||||
    my %bp_index;
 | 
			
		||||
    foreach my $iid (keys %$b_index){
 | 
			
		||||
        my $board = $b_index->{$iid};
 | 
			
		||||
        next unless defined $board;
 | 
			
		||||
        my $port = $p_index->{$iid}||0;
 | 
			
		||||
		
 | 
			
		||||
        if ($model eq 'Baystack Hub') {
 | 
			
		||||
            my $comidx = $board;
 | 
			
		||||
               if (! ($comidx % 5)) {
 | 
			
		||||
                  $board = ($board / 5);
 | 
			
		||||
               } elsif ($comidx =~ /[16]$/) {
 | 
			
		||||
                  $board = int($board/5);
 | 
			
		||||
                  $port = 25;          
 | 
			
		||||
               } elsif ($comidx =~ /[27]$/) {
 | 
			
		||||
                  $board = int($board/5);
 | 
			
		||||
                  $port = 26;          
 | 
			
		||||
               }
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
	my $index = ($board*256)+$port;
 | 
			
		||||
 | 
			
		||||
	$bp_index{$index} = $index;
 | 
			
		||||
    }
 | 
			
		||||
    return \%bp_index;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub fw_port {
 | 
			
		||||
    my $bayhub = shift;
 | 
			
		||||
    my $b_index = $bayhub->bayhub_nb_index();
 | 
			
		||||
    my $p_index = $bayhub->bayhub_np_index();
 | 
			
		||||
    my $model = $bayhub->model();
 | 
			
		||||
 | 
			
		||||
    my %fw_port;
 | 
			
		||||
    foreach my $iid (keys %$b_index){
 | 
			
		||||
        my $board = $b_index->{$iid};
 | 
			
		||||
        next unless defined $board;
 | 
			
		||||
        my $port = $p_index->{$iid}||0;
 | 
			
		||||
 | 
			
		||||
      if ($model eq 'Baystack Hub') {
 | 
			
		||||
          my $comidx = $board;
 | 
			
		||||
             if (! ($comidx % 5)) {
 | 
			
		||||
                $board = ($board / 5);
 | 
			
		||||
             } elsif ($comidx =~ /[16]$/) {
 | 
			
		||||
                $board = int($board/5);
 | 
			
		||||
                $port = 25;          
 | 
			
		||||
             } elsif ($comidx =~ /[27]$/) {
 | 
			
		||||
                $board = int($board/5);
 | 
			
		||||
                $port = 26;          
 | 
			
		||||
             }
 | 
			
		||||
       }
 | 
			
		||||
	
 | 
			
		||||
	my $index = ($board*256)+$port;
 | 
			
		||||
 | 
			
		||||
      $fw_port{$iid} = $index;
 | 
			
		||||
    }
 | 
			
		||||
    return \%fw_port;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub index_factor {
 | 
			
		||||
    return 256;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub slot_offset {
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
__END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::Layer1::Bayhub - SNMP Interface to Bay / Nortel Hubs
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
Eric Miller (C<eric@jeneric.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
    #Let SNMP::Info determine the correct subclass for you.
 | 
			
		||||
 | 
			
		||||
    my $bayhub = 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 = $bayhub->class();
 | 
			
		||||
    print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Provides abstraction to the configuration information obtainable from a 
 | 
			
		||||
Bayhub device through SNMP.  Also provides device MAC to port mapping through the propietary 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 $bayhub = new SNMP::Info::Layer1::Bayhub(...);
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Bridge
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::NortelStack
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::SONMP
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item S5-ETHERNET-COMMON-MIB
 | 
			
		||||
 | 
			
		||||
=item S5-COMMON-STATS-MIB
 | 
			
		||||
 | 
			
		||||
=item Inherited Classes' MIBs
 | 
			
		||||
 | 
			
		||||
See SNMP::Info for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::Bridge for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::NortelStack for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::SONMP for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
MIBs can be found on the CD that came with your product.
 | 
			
		||||
 | 
			
		||||
Or, they can be downloaded directly from Nortel Networks regardless of support
 | 
			
		||||
contract status.  Go to http://www.nortelnetworks.com Technical Support, Browse Technical Support,
 | 
			
		||||
Select by Product Families, BayStack, BayStack: Hubs - 150 Series, 10BASE-T,
 | 
			
		||||
Software.  Filter on mibs and download the latest version's archive.
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar value from SNMP
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $bayhub->vendor()
 | 
			
		||||
 | 
			
		||||
Returns 'Nortel'
 | 
			
		||||
 | 
			
		||||
=item $bayhub->os()
 | 
			
		||||
 | 
			
		||||
Returns 'Bay Hub'
 | 
			
		||||
 | 
			
		||||
=item $bayhub->model()
 | 
			
		||||
 | 
			
		||||
Cross references $bayhub->id() to the SYNOPTICS-MIB and returns
 | 
			
		||||
the results.
 | 
			
		||||
 | 
			
		||||
Removes sreg- from the model name
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Overrides
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $bayhub->layers()
 | 
			
		||||
 | 
			
		||||
Returns 00000011.  Class emulates Layer 2 functionality through proprietary MIBs.
 | 
			
		||||
 | 
			
		||||
=item  $bayhub->index_factor()
 | 
			
		||||
 | 
			
		||||
Required by SNMP::Info::SONMP.  Number representing the number of ports
 | 
			
		||||
reserved per slot within the device MIB.  Returns 256.
 | 
			
		||||
 | 
			
		||||
=item $bayhub->slot_offset()
 | 
			
		||||
 | 
			
		||||
Required by SNMP::Info::SONMP.  Offset if slot numbering does not
 | 
			
		||||
start at 0.  Returns 0.
 | 
			
		||||
 | 
			
		||||
=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 Global Methods imported from SNMP::Info::NortelStack
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::NortelStack for details.
 | 
			
		||||
 | 
			
		||||
=head2 Global Methods imported from SNMP::Info::SONMP
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::SONMP 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 $bayhub->i_index()
 | 
			
		||||
 | 
			
		||||
Returns reference to map of IIDs to Interface index. 
 | 
			
		||||
 | 
			
		||||
Since hubs do not support ifIndex, the interface index is created using the
 | 
			
		||||
formula (board * 256 + port).
 | 
			
		||||
 | 
			
		||||
=item $bayhub->interfaces()
 | 
			
		||||
 | 
			
		||||
Returns reference to map of IIDs to physical ports. 
 | 
			
		||||
 | 
			
		||||
=item $bayhub->i_duplex()
 | 
			
		||||
 | 
			
		||||
Returns half, hubs do not support full duplex. 
 | 
			
		||||
 | 
			
		||||
=item $bayhub->i_duplex_admin()
 | 
			
		||||
 | 
			
		||||
Returns half, hubs do not support full duplex.
 | 
			
		||||
 | 
			
		||||
=item $bayhub->i_speed()
 | 
			
		||||
 | 
			
		||||
Currently returns 10 Mbps.  The class does not currently support 100 Mbps hubs.
 | 
			
		||||
 | 
			
		||||
=item $bayhub->i_up()
 | 
			
		||||
 | 
			
		||||
Returns (B<s5EnPortLinkStatus>) for each port.  Translates on/off to up/down.
 | 
			
		||||
 | 
			
		||||
=item $bayhub->i_up_admin()
 | 
			
		||||
 | 
			
		||||
Returns (B<s5EnPortPartStatus>) for each port.
 | 
			
		||||
 | 
			
		||||
=item $bayhub->bp_index()
 | 
			
		||||
 | 
			
		||||
Simulates bridge MIB by returning reference to a hash containing the index for
 | 
			
		||||
both the keys and values.
 | 
			
		||||
 | 
			
		||||
=item $bayhub->fw_port()
 | 
			
		||||
 | 
			
		||||
Returns reference to map of IIDs of the S5-COMMON-STATS-MIB::s5CmSNodeTable
 | 
			
		||||
to the Interface index.
 | 
			
		||||
 | 
			
		||||
=item $bayhub->fw_mac()
 | 
			
		||||
 | 
			
		||||
(B<s5CmSNodeMacAddr>)
 | 
			
		||||
 | 
			
		||||
=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::NortelStack
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::NortelStack for details.
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::SONMP
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::SONMP for details.
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
@@ -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.7;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
@@ -57,6 +59,7 @@ $INIT = 0;
 | 
			
		||||
          %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 = (
 | 
			
		||||
@@ -64,6 +67,7 @@ $INIT = 0;
 | 
			
		||||
            %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   = (
 | 
			
		||||
@@ -71,6 +75,8 @@ $INIT = 0;
 | 
			
		||||
            %SNMP::Info::Bridge::FUNCS,
 | 
			
		||||
            %SNMP::Info::CDP::FUNCS,
 | 
			
		||||
            %SNMP::Info::CiscoStats::FUNCS,
 | 
			
		||||
            'ent_serial' => 'entPhysicalSerialNum',
 | 
			
		||||
            'ent_chassis'=> 'entPhysicalDescr',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%MUNGE = (
 | 
			
		||||
@@ -116,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;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,8 @@
 | 
			
		||||
# 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.
 | 
			
		||||
# 
 | 
			
		||||
@@ -28,7 +30,7 @@
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::Layer2::Aironet;
 | 
			
		||||
$VERSION = 0.6;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
# $Id$
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
@@ -36,8 +38,10 @@ use Exporter;
 | 
			
		||||
use SNMP::Info::Layer2;
 | 
			
		||||
use SNMP::Info::Entity;
 | 
			
		||||
use SNMP::Info::EtherLike;
 | 
			
		||||
use SNMP::Info::CiscoVTP;
 | 
			
		||||
 | 
			
		||||
@SNMP::Info::Layer2::Aironet::ISA = qw/SNMP::Info::Layer2 SNMP::Info::Entity SNMP::Info::EtherLike Exporter/;
 | 
			
		||||
@SNMP::Info::Layer2::Aironet::ISA = qw/SNMP::Info::Layer2 SNMP::Info::Entity SNMP::Info::EtherLike 
 | 
			
		||||
                                       SNMP::Info::CiscoVTP Exporter/;
 | 
			
		||||
@SNMP::Info::Layer2::Aironet::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
 | 
			
		||||
@@ -47,24 +51,28 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
 | 
			
		||||
            %SNMP::Info::Layer2::GLOBALS,
 | 
			
		||||
            %SNMP::Info::Entity::GLOBALS,
 | 
			
		||||
            %SNMP::Info::EtherLike::GLOBALS,
 | 
			
		||||
            %SNMP::Info::CiscoVTP::GLOBALS,
 | 
			
		||||
            'serial' => 'entPhysicalSerialNum.1',
 | 
			
		||||
            'descr'  => 'sysDescr'
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
%FUNCS   = (%SNMP::Info::Layer2::FUNCS,
 | 
			
		||||
            %SNMP::Info::Entity::FUNCS,
 | 
			
		||||
            %SNMP::Info::EtherLike::FUNCS
 | 
			
		||||
            %SNMP::Info::EtherLike::FUNCS,
 | 
			
		||||
            %SNMP::Info::CiscoVTP::FUNCS,
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
%MIBS    = (
 | 
			
		||||
            %SNMP::Info::Layer2::MIBS,
 | 
			
		||||
            %SNMP::Info::Entity::MIBS,
 | 
			
		||||
            %SNMP::Info::EtherLike::MIBS
 | 
			
		||||
            %SNMP::Info::EtherLike::MIBS,
 | 
			
		||||
            %SNMP::Info::CiscoVTP::MIBS,
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
%MUNGE   = (%SNMP::Info::Layer2::MUNGE,
 | 
			
		||||
            %SNMP::Info::Entity::MUNGE,
 | 
			
		||||
            %SNMP::Info::EtherLike::MUNGE
 | 
			
		||||
            %SNMP::Info::EtherLike::MUNGE,
 | 
			
		||||
            %SNMP::Info::CiscoVTP::MUNGE,
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -167,6 +175,8 @@ my $aironet = new SNMP::Info::Layer2::Aironet(...);
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::EtherLike
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::CiscoVTP
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										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.9;
 | 
			
		||||
# $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,5 +1,8 @@
 | 
			
		||||
# SNMP::Info::Layer2::Bay
 | 
			
		||||
# Max Baker <max@warped.org>
 | 
			
		||||
# This module depricated.  See Layer2::BayStack
 | 
			
		||||
#
 | 
			
		||||
# 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 +31,7 @@
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::Layer2::Bay;
 | 
			
		||||
$VERSION = 0.6;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
# $Id$
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
@@ -196,7 +199,7 @@ sub c_ip {
 | 
			
		||||
    foreach my $entry (keys %$bay_topo_ip){
 | 
			
		||||
        my $port = $bay_topo_port->{$entry};
 | 
			
		||||
        next unless defined $port;
 | 
			
		||||
        next if $port == 0;
 | 
			
		||||
        next if ($port =~ /^[\d\.]+$/ and $port == 0);
 | 
			
		||||
        my $ip   = $bay_topo_ip->{$entry};
 | 
			
		||||
        push(@{$ip_port{$port}},$ip);
 | 
			
		||||
    }
 | 
			
		||||
@@ -247,7 +250,7 @@ sub c_platform {
 | 
			
		||||
 | 
			
		||||
    my %c_platform;
 | 
			
		||||
    foreach my $entry (keys %$bay_topo_platform){
 | 
			
		||||
        my $port = $bay_topo_port->{$entry};
 | 
			
		||||
        my $port = $bay_topo_port->{$entry} || 0;
 | 
			
		||||
        next if $port == 0;
 | 
			
		||||
 | 
			
		||||
        # For fake remotes (multiple IPs for a c_ip), use first found
 | 
			
		||||
@@ -274,19 +277,7 @@ Max Baker (C<max@warped.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 # 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";
 | 
			
		||||
 | 
			
		||||
 my $class      = $bay->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
This module is Depricated.  Please use Layer2::BayStack instead.
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										426
									
								
								Info/Layer2/Baystack.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										426
									
								
								Info/Layer2/Baystack.pm
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,426 @@
 | 
			
		||||
# SNMP::Info::Layer2::Baystack
 | 
			
		||||
# Eric Miller <eric@jeneric.org>
 | 
			
		||||
# $Id$
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
 | 
			
		||||
# 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::Baystack;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
use Exporter;
 | 
			
		||||
use SNMP::Info;
 | 
			
		||||
use SNMP::Info::Bridge;
 | 
			
		||||
use SNMP::Info::NortelStack;
 | 
			
		||||
use SNMP::Info::SONMP;
 | 
			
		||||
use SNMP::Info::RapidCity;
 | 
			
		||||
 | 
			
		||||
@SNMP::Info::Layer2::Baystack::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::NortelStack SNMP::Info::SONMP SNMP::Info::RapidCity Exporter/;
 | 
			
		||||
@SNMP::Info::Layer2::Baystack::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
 | 
			
		||||
 | 
			
		||||
%MIBS    = (
 | 
			
		||||
            %SNMP::Info::MIBS,
 | 
			
		||||
            %SNMP::Info::Bridge::MIBS,
 | 
			
		||||
            %SNMP::Info::NortelStack::MIBS,
 | 
			
		||||
            %SNMP::Info::SONMP::MIBS,
 | 
			
		||||
            %SNMP::Info::RapidCity::MIBS,
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%GLOBALS = ( 
 | 
			
		||||
            %SNMP::Info::GLOBALS,
 | 
			
		||||
            %SNMP::Info::Bridge::GLOBALS,
 | 
			
		||||
            %SNMP::Info::NortelStack::GLOBALS,            
 | 
			
		||||
            %SNMP::Info::SONMP::GLOBALS,
 | 
			
		||||
            %SNMP::Info::RapidCity::GLOBALS,
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%FUNCS   = (
 | 
			
		||||
            %SNMP::Info::FUNCS,
 | 
			
		||||
            %SNMP::Info::Bridge::FUNCS,
 | 
			
		||||
            %SNMP::Info::NortelStack::FUNCS,            
 | 
			
		||||
            %SNMP::Info::SONMP::FUNCS,
 | 
			
		||||
            %SNMP::Info::RapidCity::FUNCS,
 | 
			
		||||
            'i_name2'    => 'ifName',
 | 
			
		||||
            'i_mac2'      => 'ifPhysAddress',
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
# 450's report full duplex as speed = 20mbps?!
 | 
			
		||||
$SNMP::Info::SPEED_MAP{20_000_000} = '10 Mbps';
 | 
			
		||||
$SNMP::Info::SPEED_MAP{200_000_000} = '100 Mbps';
 | 
			
		||||
$SNMP::Info::SPEED_MAP{2_000_000_000} = '1.0 Gbps';
 | 
			
		||||
 | 
			
		||||
%MUNGE   = (
 | 
			
		||||
            %SNMP::Info::MUNGE,
 | 
			
		||||
            %SNMP::Info::Bridge::MUNGE,
 | 
			
		||||
            %SNMP::Info::NortelStack::MUNGE,
 | 
			
		||||
            %SNMP::Info::SONMP::MUNGE,
 | 
			
		||||
            %SNMP::Info::RapidCity::MUNGE,
 | 
			
		||||
            'i_mac2' => \&SNMP::Info::munge_mac,
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
sub os {
 | 
			
		||||
    my $baystack = shift;
 | 
			
		||||
    my $descr = $baystack->description();
 | 
			
		||||
    my $model = $baystack->model();
 | 
			
		||||
 | 
			
		||||
    if ((defined $model and $model =~ /(470|460|BPS|5510|5520)/) and (defined $descr and $descr =~ m/SW:v[3-5]/i)) {
 | 
			
		||||
       return 'boss';
 | 
			
		||||
    }
 | 
			
		||||
    return 'baystack';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os_bin {
 | 
			
		||||
    my $baystack = shift;
 | 
			
		||||
    my $descr = $baystack->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+)/){
 | 
			
		||||
        return $1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ($descr =~ m/FW:(\d+\.\d+\.\d+\.\d+)/i){
 | 
			
		||||
        return $1;
 | 
			
		||||
    }
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vendor {
 | 
			
		||||
    return 'nortel';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub model {
 | 
			
		||||
    my $baystack = shift;
 | 
			
		||||
    my $id = $baystack->id();
 | 
			
		||||
    return undef unless defined $id;
 | 
			
		||||
    my $model = &SNMP::translateObj($id);
 | 
			
		||||
    return $id unless defined $model;
 | 
			
		||||
    $model =~ s/^sreg-//i;
 | 
			
		||||
 | 
			
		||||
    my $descr = $baystack->description();
 | 
			
		||||
 | 
			
		||||
    return '303' if (defined $descr and $descr =~ /\D303\D/);
 | 
			
		||||
    return '304' if (defined $descr and $descr =~ /\D304\D/);
 | 
			
		||||
    return '350' if ($model =~ /BayStack350/);
 | 
			
		||||
    return '380' if ($model =~ /BayStack380/);
 | 
			
		||||
    return '410' if ($model =~ /BayStack410/);
 | 
			
		||||
    return '420' if ($model =~ /BayStack420/);
 | 
			
		||||
    return '425' if ($model =~ /BayStack425/);
 | 
			
		||||
    return '450' if ($model =~ /BayStack450/);
 | 
			
		||||
    return '470' if ($model =~ /BayStack470/i);
 | 
			
		||||
    return '460' if ($model =~ /BayStack460/i);
 | 
			
		||||
    return 'BPS' if ($model =~ /BPS2000/i);
 | 
			
		||||
    return '5510' if ($model =~ /BayStack5510/i);
 | 
			
		||||
    return '5520' if ($model =~ /BayStack5520/i);
 | 
			
		||||
    
 | 
			
		||||
    return $model;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_ignore {
 | 
			
		||||
    my $baystack = shift;
 | 
			
		||||
    my $i_type = $baystack->i_type();
 | 
			
		||||
 | 
			
		||||
    my %i_ignore;
 | 
			
		||||
    foreach my $if (keys %$i_type){
 | 
			
		||||
        my $type = $i_type->{$if};
 | 
			
		||||
        next unless defined $type;
 | 
			
		||||
        $i_ignore{$if}++ if $type =~ /(54|loopback|propvirtual|cpu)/i;
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_ignore;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub interfaces {
 | 
			
		||||
    my $baystack = shift;
 | 
			
		||||
    my $i_index = $baystack->i_index();
 | 
			
		||||
    my $index_factor = $baystack->index_factor();
 | 
			
		||||
    my $slot_offset = $baystack->slot_offset();
 | 
			
		||||
    
 | 
			
		||||
    my %if;
 | 
			
		||||
    foreach my $iid (keys %$i_index){
 | 
			
		||||
        my $index = $i_index->{$iid};
 | 
			
		||||
        next unless defined $index;
 | 
			
		||||
        # Ignore cascade ports
 | 
			
		||||
        next if $index > 513;
 | 
			
		||||
 | 
			
		||||
	my $port = ($index % $index_factor);
 | 
			
		||||
	my $slot = (int($index / $index_factor)) + $slot_offset;
 | 
			
		||||
 | 
			
		||||
        my $slotport = "$slot.$port";
 | 
			
		||||
        $if{$iid} = $slotport;
 | 
			
		||||
    }
 | 
			
		||||
    return \%if;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_mac { 
 | 
			
		||||
    my $baystack = shift;
 | 
			
		||||
    my $i_mac = $baystack->i_mac2();
 | 
			
		||||
 | 
			
		||||
    my %i_mac;
 | 
			
		||||
    # Baystack 303's with a hw rev < 2.11.4.5 report the mac as all zeros
 | 
			
		||||
    foreach my $iid (keys %$i_mac){
 | 
			
		||||
        my $mac = $i_mac->{$iid};
 | 
			
		||||
        next unless defined $mac;
 | 
			
		||||
        next if $mac eq '00:00:00:00:00:00';
 | 
			
		||||
        $i_mac{$iid}=$mac;
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_mac;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_name {
 | 
			
		||||
    my $baystack = shift;
 | 
			
		||||
    my $i_index = $baystack->i_index();
 | 
			
		||||
    my $i_alias = $baystack->i_alias();
 | 
			
		||||
    my $i_name2  = $baystack->i_name2();
 | 
			
		||||
 | 
			
		||||
    my %i_name;
 | 
			
		||||
    foreach my $iid (keys %$i_name2){
 | 
			
		||||
        my $name = $i_name2->{$iid};
 | 
			
		||||
        my $alias = $i_alias->{$iid};
 | 
			
		||||
        $i_name{$iid} = (defined $alias and $alias !~ /^\s*$/) ?
 | 
			
		||||
                        $alias : 
 | 
			
		||||
                        $name;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return \%i_name;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub index_factor {
 | 
			
		||||
    my $baystack   = shift;
 | 
			
		||||
    my $model   = $baystack->model();
 | 
			
		||||
    my $os      = $baystack->os();
 | 
			
		||||
    my $op_mode = $baystack->ns_op_mode();
 | 
			
		||||
    
 | 
			
		||||
    $op_mode = 'pure' unless defined $op_mode;
 | 
			
		||||
 | 
			
		||||
    my $index_factor = 32;
 | 
			
		||||
    $index_factor = 64 if ((defined $model and $model =~ /(470)/) or ($os eq 'BoSS') and ($op_mode eq 'pure'));
 | 
			
		||||
    
 | 
			
		||||
    return $index_factor;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
__END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::Layer2::Baystack - SNMP Interface to Nortel Networks' Baystack Switches
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
Max Baker (C<max@warped.org>),
 | 
			
		||||
Eric Miller (C<eric@jeneric.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you.
 | 
			
		||||
 my $baystack = 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 = $baystack->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Provides abstraction to the configuration information obtainable from a Nortel Networks' 
 | 
			
		||||
Baystack 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 $baystack = new SNMP::Info::Layer2::Baystack(...);
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Bridge
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::NortelStack
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::SONMP
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::RapidCity
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item Inherited Classes' MIBs
 | 
			
		||||
 | 
			
		||||
See SNMP::Info for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::Bridge for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::NortelStack for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::SONMP for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::RapidCity for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar value from SNMP
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $baystack->vendor()
 | 
			
		||||
 | 
			
		||||
Returns 'Nortel'
 | 
			
		||||
 | 
			
		||||
=item $baystack->model()
 | 
			
		||||
 | 
			
		||||
Cross references $baystack->id() to the SYNOPTICS-MIB and returns
 | 
			
		||||
the results.  303s and 304s have the same ID, so we have a hack
 | 
			
		||||
to return depending on which it is. 
 | 
			
		||||
 | 
			
		||||
Removes sreg- from the model name
 | 
			
		||||
 | 
			
		||||
=item $baystack->os()
 | 
			
		||||
 | 
			
		||||
Returns 'Baystack' or 'BoSS' depending on software version.
 | 
			
		||||
 | 
			
		||||
=item $baystack->os_bin()
 | 
			
		||||
 | 
			
		||||
Returns the firmware version extracted from B<sysDescr>.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Overrides
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item  $baystack->index_factor()
 | 
			
		||||
 | 
			
		||||
Required by SNMP::Info::SONMP.  Number representing the number of ports
 | 
			
		||||
reserved per slot within the device MIB.
 | 
			
		||||
 | 
			
		||||
Index factor on the Baystack switches are determined by the formula: Index
 | 
			
		||||
Factor = 64 if (model = 470 or (os eq 'BoSS' and operating in pure mode))
 | 
			
		||||
or else Index factor = 32.
 | 
			
		||||
 | 
			
		||||
Returns either 32 or 64 based upon the formula.
 | 
			
		||||
 | 
			
		||||
=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::NortelStack
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::NortelStack for details.
 | 
			
		||||
 | 
			
		||||
=head2 Global Methods imported from SNMP::Info::SONMP
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::SONMP for details.
 | 
			
		||||
 | 
			
		||||
=head2 Global Methods imported from SNMP::Info::RapidCity
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::RapidCity 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 $baystack->interfaces()
 | 
			
		||||
 | 
			
		||||
Returns reference to the map between IID and physical Port.
 | 
			
		||||
 | 
			
		||||
  Slot and port numbers on the Baystack switches are determined by the formula:
 | 
			
		||||
  
 | 
			
		||||
  port = (Interface index % Index factor)
 | 
			
		||||
  slot = (int(Interface index / Index factor)) + Slot offset
 | 
			
		||||
 
 | 
			
		||||
  The physical port name is returned as slot.port.
 | 
			
		||||
 | 
			
		||||
=item $baystack->i_ignore()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash of IIDs to ignore.
 | 
			
		||||
 | 
			
		||||
=item $baystack->i_mac()
 | 
			
		||||
 | 
			
		||||
Returns the B<ifPhysAddress> table entries. 
 | 
			
		||||
 | 
			
		||||
Removes all entries matching '00:00:00:00:00:00' -- Certain 
 | 
			
		||||
revisions of Baystack firmware report all zeros for each port mac.
 | 
			
		||||
 | 
			
		||||
=item $baystack->i_name()
 | 
			
		||||
 | 
			
		||||
Crosses ifName with ifAlias and returns the human set port name if exists.
 | 
			
		||||
 | 
			
		||||
=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::NortelStack
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::NortelStack for details.
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::SONMP
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::SONMP for details.
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::RapidCity
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::RapidCity 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,14 +30,15 @@
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::Layer2::C1900;
 | 
			
		||||
$VERSION = 0.6;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
# $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/;
 | 
			
		||||
@@ -43,10 +46,12 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
 | 
			
		||||
# Set for No CDP
 | 
			
		||||
%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
 | 
			
		||||
@@ -62,11 +67,13 @@ 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 {
 | 
			
		||||
@@ -92,6 +99,10 @@ sub os_ver {
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub cisco_comm_indexing {
 | 
			
		||||
    1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub interfaces {
 | 
			
		||||
    my $c1900 = shift;
 | 
			
		||||
    my $i_descr = $c1900->i_description();
 | 
			
		||||
 
 | 
			
		||||
@@ -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,7 +30,7 @@
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::Layer2::C2900;
 | 
			
		||||
$VERSION = 0.7;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
# $Id$
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
@@ -49,6 +51,7 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
 | 
			
		||||
 | 
			
		||||
%FUNCS   = (%SNMP::Info::Layer2::FUNCS,
 | 
			
		||||
            %SNMP::Info::CiscoVTP::FUNCS,
 | 
			
		||||
            'i_name'               => 'ifAlias',
 | 
			
		||||
            # C2900PortEntry
 | 
			
		||||
            'c2900_p_index'        => 'c2900PortIfIndex',
 | 
			
		||||
            'c2900_p_duplex'       => 'c2900PortDuplexStatus',
 | 
			
		||||
@@ -69,6 +72,10 @@ sub vendor {
 | 
			
		||||
    return 'cisco';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub cisco_comm_indexing {
 | 
			
		||||
    1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_duplex {
 | 
			
		||||
    my $c2900 = shift;
 | 
			
		||||
    
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
# Max Baker <max@warped.org>
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2002,2003 Regents of the University of California
 | 
			
		||||
# Copyright (c) 2003      Max Baker
 | 
			
		||||
# 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 
 | 
			
		||||
@@ -29,7 +29,7 @@
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::Layer2::Catalyst;
 | 
			
		||||
$VERSION = 0.7;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
@@ -110,6 +110,10 @@ sub os_ver {
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub cisco_comm_indexing {
 | 
			
		||||
    1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
__END__
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										521
									
								
								Info/Layer2/Centillion.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										521
									
								
								Info/Layer2/Centillion.pm
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,521 @@
 | 
			
		||||
# SNMP::Info::Layer2::Centillion
 | 
			
		||||
# Eric Miller <eric@jeneric.org>
 | 
			
		||||
# $Id$
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2004 Max Baker
 | 
			
		||||
#
 | 
			
		||||
# 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::Centillion;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
use Exporter;
 | 
			
		||||
use SNMP::Info;
 | 
			
		||||
use SNMP::Info::Bridge;
 | 
			
		||||
use SNMP::Info::NortelStack;
 | 
			
		||||
use SNMP::Info::SONMP;
 | 
			
		||||
 | 
			
		||||
@SNMP::Info::Layer2::Centillion::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::NortelStack SNMP::Info::SONMP Exporter/;
 | 
			
		||||
@SNMP::Info::Layer2::Centillion::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
 | 
			
		||||
 | 
			
		||||
%MIBS    = (
 | 
			
		||||
            %SNMP::Info::MIBS,
 | 
			
		||||
            %SNMP::Info::Bridge::MIBS,
 | 
			
		||||
            %SNMP::Info::NortelStack::MIBS,
 | 
			
		||||
            %SNMP::Info::SONMP::MIBS,
 | 
			
		||||
            'CENTILLION-DOT3-EXTENSIONS-MIB' => 'cnDot3ExtnTable',
 | 
			
		||||
            'S5-COMMON-STATS-MIB'            => 's5CmStat',
 | 
			
		||||
            'CENTILLION-VLAN-MIB'            => 'cnVlanENETMgt',
 | 
			
		||||
            'CENTILLION-CONFIG-MIB'          => 'sysTFTPStart',
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
            %SNMP::Info::GLOBALS,
 | 
			
		||||
            %SNMP::Info::Bridge::GLOBALS,
 | 
			
		||||
            %SNMP::Info::NortelStack::GLOBALS,
 | 
			
		||||
            %SNMP::Info::SONMP::GLOBALS,
 | 
			
		||||
            'tftp_action'  => 'sysTFTPStart',
 | 
			
		||||
            'tftp_host'    => 'sysTFTPIpAddress',
 | 
			
		||||
            'tftp_file'    => 'sysTFTPFileName',
 | 
			
		||||
            'tftp_type'    => 'sysTFTPFileType',
 | 
			
		||||
            'tftp_result'  => 'sysTFTPResult',
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
%FUNCS   = (
 | 
			
		||||
            %SNMP::Info::FUNCS,
 | 
			
		||||
            %SNMP::Info::Bridge::FUNCS,
 | 
			
		||||
            %SNMP::Info::NortelStack::FUNCS,
 | 
			
		||||
            %SNMP::Info::SONMP::FUNCS,
 | 
			
		||||
        # CENTILLION-DOT3-EXTENSIONS-MIB::cnDot3ExtnTable
 | 
			
		||||
            'centillion_p_index'        => 'cnDot3ExtnIfIndex',
 | 
			
		||||
            'centillion_p_duplex'       => 'cnDot3ExtnIfOperConnectionType',
 | 
			
		||||
            'centillion_p_duplex_admin' => 'cnDot3ExtnIfAdminConnectionType',
 | 
			
		||||
        # S5-COMMON-STATS-MIB::s5CmSNodeTable
 | 
			
		||||
            'fw_mac'     => 's5CmSNodeMacAddr',
 | 
			
		||||
            'fw_port'    => 's5CmSNodeIfIndx',
 | 
			
		||||
        # CENTILLION-VLAN-MIB::cnVlanPortMemberTable
 | 
			
		||||
            'centillion_i_vlan_index'    => 'cnVlanPortMemberIfIndex',
 | 
			
		||||
            'centillion_i_vlan'        => 'cnVlanPortMemberVID',
 | 
			
		||||
            'centillion_i_vlan_type'    => 'cnVlanPortMemberIngressType',        
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
%MUNGE   = (
 | 
			
		||||
            # Inherit all the built in munging
 | 
			
		||||
            %SNMP::Info::MUNGE,
 | 
			
		||||
            %SNMP::Info::Bridge::MUNGE,
 | 
			
		||||
            %SNMP::Info::NortelStack::MUNGE,
 | 
			
		||||
            %SNMP::Info::SONMP::MUNGE,
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
sub os {
 | 
			
		||||
    return 'centillion';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vendor {
 | 
			
		||||
    return 'nortel';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_ignore {
 | 
			
		||||
    my $centillion = shift;
 | 
			
		||||
    my $descr = $centillion->i_description();
 | 
			
		||||
 | 
			
		||||
    my %i_ignore;
 | 
			
		||||
    foreach my $if (keys %$descr){
 | 
			
		||||
        my $type = $descr->{$if};
 | 
			
		||||
      # Skip virtual interfaces  
 | 
			
		||||
        $i_ignore{$if}++ if $type =~ /(VE|VID|vc|lp)/i;
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_ignore;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub interfaces {
 | 
			
		||||
    my $centillion = shift;
 | 
			
		||||
    my $i_index = $centillion->i_index();
 | 
			
		||||
    my $i_descr = $centillion->i_description();
 | 
			
		||||
 | 
			
		||||
    my %if;
 | 
			
		||||
    foreach my $iid (keys %$i_index){
 | 
			
		||||
        my $index = $i_index->{$iid};
 | 
			
		||||
        next unless defined $index;
 | 
			
		||||
      my $descr = $i_descr->{$iid};
 | 
			
		||||
      # Skip ATM and virtual interfaces
 | 
			
		||||
      next if $descr =~ /(VE|VID|vc|lp)/i;
 | 
			
		||||
 | 
			
		||||
      # Index numbers are deterministic slot * 256 + port
 | 
			
		||||
    my $port = $index % 256;
 | 
			
		||||
        my $slot = int($index / 256);
 | 
			
		||||
        my $slotport = "$slot.$port";
 | 
			
		||||
 | 
			
		||||
    $slotport = "$descr" if $descr =~ /(mcp)/i;
 | 
			
		||||
    
 | 
			
		||||
        $if{$index} = $slotport;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return \%if;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_duplex {
 | 
			
		||||
    my $centillion = shift;
 | 
			
		||||
    
 | 
			
		||||
    my $port_index  = $centillion->centillion_p_index();
 | 
			
		||||
    my $port_duplex = $centillion->centillion_p_duplex();
 | 
			
		||||
 | 
			
		||||
    my %i_duplex;
 | 
			
		||||
    foreach my $iid (keys %$port_index){
 | 
			
		||||
        my $index = $port_index->{$iid};
 | 
			
		||||
        next unless defined $index;
 | 
			
		||||
        my $duplex = $port_duplex->{$iid};
 | 
			
		||||
        next unless defined $duplex; 
 | 
			
		||||
    
 | 
			
		||||
        $duplex = 'half' if $duplex =~ /half/i;
 | 
			
		||||
        $duplex = 'full' if $duplex =~ /full/i;
 | 
			
		||||
        $i_duplex{$index}=$duplex; 
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_duplex;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_duplex_admin {
 | 
			
		||||
    my $centillion = shift;
 | 
			
		||||
    
 | 
			
		||||
    my $port_index = $centillion->centillion_p_index();
 | 
			
		||||
    my $port_admin = $centillion->centillion_p_duplex_admin();
 | 
			
		||||
 | 
			
		||||
    my %i_duplex_admin;
 | 
			
		||||
    foreach my $iid (keys %$port_index){
 | 
			
		||||
        my $index = $port_index->{$iid};
 | 
			
		||||
        next unless defined $index;
 | 
			
		||||
        my $duplex = $port_admin->{$iid};
 | 
			
		||||
        next unless defined $duplex; 
 | 
			
		||||
    
 | 
			
		||||
        $duplex = 'half' if $duplex =~ /half/i;
 | 
			
		||||
        $duplex = 'full' if $duplex =~ /full/i;
 | 
			
		||||
        $duplex = 'auto' if $duplex =~ /auto/i;
 | 
			
		||||
        $i_duplex_admin{$index}=$duplex; 
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_duplex_admin;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_vlan {
 | 
			
		||||
    my $centillion = shift;
 | 
			
		||||
    
 | 
			
		||||
    my $cn_vlan_index = $centillion->centillion_i_vlan_index();
 | 
			
		||||
    my $cn_vlan = $centillion->centillion_i_vlan();
 | 
			
		||||
 | 
			
		||||
    my %i_vlan;
 | 
			
		||||
    foreach my $iid (keys %$cn_vlan_index){
 | 
			
		||||
        my $index = $cn_vlan_index->{$iid};
 | 
			
		||||
        next unless defined $index;
 | 
			
		||||
        my $vlan = $cn_vlan->{$iid};
 | 
			
		||||
        next unless defined $vlan; 
 | 
			
		||||
    
 | 
			
		||||
        $i_vlan{$index}=$vlan; 
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_vlan;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub model {
 | 
			
		||||
    my $centillion = shift;
 | 
			
		||||
    my $id = $centillion->id();
 | 
			
		||||
    return undef unless defined $id;
 | 
			
		||||
    my $model = &SNMP::translateObj($id);
 | 
			
		||||
    return $id unless defined $model;
 | 
			
		||||
    $model =~ s/^sreg-//i;
 | 
			
		||||
 | 
			
		||||
    return '5000BH' if ($model =~ /5000BH/);
 | 
			
		||||
    return '5005BH' if ($model =~ /5005BH/);
 | 
			
		||||
    return 'C100' if ($model =~ /Centillion100/);
 | 
			
		||||
    return 'C50N' if ($model =~ /Centillion50N/);
 | 
			
		||||
    return 'C50T' if ($model =~ /Centillion50T/);
 | 
			
		||||
    return $model;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub bp_index {
 | 
			
		||||
    my $centillion = shift;
 | 
			
		||||
    my $index = $centillion->fw_port();
 | 
			
		||||
 | 
			
		||||
    my %bp_index;
 | 
			
		||||
    foreach my $iid (keys %$index){
 | 
			
		||||
        my $b_index = $index->{$iid};
 | 
			
		||||
        next unless defined $b_index;
 | 
			
		||||
 | 
			
		||||
    #Index value is the same as ifIndex    
 | 
			
		||||
        $bp_index{$b_index} = $b_index;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return \%bp_index;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub index_factor {
 | 
			
		||||
    return 256;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub slot_offset {
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
__END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::Layer2::Centillion - SNMP Interface to Nortel Centillion based ATM Switches
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
Eric Miller (C<eric@jeneric.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you. 
 | 
			
		||||
 my $centillion = 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      = $centillion->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Provides abstraction to the configuration information obtainable from a 
 | 
			
		||||
Centillion 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 $centillion = new SNMP::Info::Layer2::centillion(...);
 | 
			
		||||
 
 | 
			
		||||
Note:  This class supports version 4.X and 5.X which are VLAN based rather
 | 
			
		||||
than bridge group based.
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Bridge
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::NortelStack
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::SONMP
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item CENTILLION-DOT3-EXTENSIONS-MIB
 | 
			
		||||
 | 
			
		||||
=item S5-COMMON-STATS-MIB
 | 
			
		||||
 | 
			
		||||
=item CENTILLION-VLAN-MIB
 | 
			
		||||
 | 
			
		||||
=item CENTILLION-CONFIG-MIB
 | 
			
		||||
 | 
			
		||||
=item Inherited Classes' MIBs
 | 
			
		||||
 | 
			
		||||
See SNMP::Info for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::Bridge for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::NortelStack for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::SONMP for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
MIBs can be found on the CD that came with your product.
 | 
			
		||||
 | 
			
		||||
Or, they can be downloaded directly from Nortel Networks regardless of support
 | 
			
		||||
contract status.
 | 
			
		||||
 | 
			
		||||
Go to http://www.nortelnetworks.com Techninal Support, Browse Technical Support,
 | 
			
		||||
Select by Product Families, Centillion, Centillion C100-C50 ATM Speed Modules,
 | 
			
		||||
Software.  Filter on mibs and download the latest version's archive.
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar value from SNMP
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $centillion->vendor()
 | 
			
		||||
 | 
			
		||||
Returns 'Nortel'
 | 
			
		||||
 | 
			
		||||
=item $centillion->model()
 | 
			
		||||
 | 
			
		||||
Cross references $centillion->id() to the SYNOPTICS-MIB and returns
 | 
			
		||||
the results.
 | 
			
		||||
 | 
			
		||||
Removes sreg- from the model name
 | 
			
		||||
 | 
			
		||||
=item $centillion->os()
 | 
			
		||||
 | 
			
		||||
Returns 'Centillion'
 | 
			
		||||
 | 
			
		||||
=item $centillion->tftp_action()
 | 
			
		||||
 | 
			
		||||
(B<sysTFTPStart>)
 | 
			
		||||
 | 
			
		||||
=item $centillion->tftp_host()
 | 
			
		||||
 | 
			
		||||
(B<sysTFTPIpAddress>)
 | 
			
		||||
 | 
			
		||||
=item $centillion->tftp_file()
 | 
			
		||||
 | 
			
		||||
(B<sysTFTPFileName>)
 | 
			
		||||
 | 
			
		||||
=item $centillion->tftp_type()
 | 
			
		||||
 | 
			
		||||
(B<sysTFTPFileType>)
 | 
			
		||||
 | 
			
		||||
=item $centillion->tftp_result()
 | 
			
		||||
 | 
			
		||||
(B<sysTFTPResult>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Overrides
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $centillion->layers()
 | 
			
		||||
 | 
			
		||||
Returns 00000011.  Class emulates Layer 2 functionality through proprietary MIBs.
 | 
			
		||||
 | 
			
		||||
=item  $centillion->index_factor()
 | 
			
		||||
 | 
			
		||||
Required by SNMP::Info::SONMP.  Number representing the number of ports
 | 
			
		||||
reserved per slot within the device MIB.  Returns 256.
 | 
			
		||||
 | 
			
		||||
=item $centillion->slot_offset()
 | 
			
		||||
 | 
			
		||||
Required by SNMP::Info::SONMP.  Offset if slot numbering does not
 | 
			
		||||
start at 0.  Returns 0.
 | 
			
		||||
 | 
			
		||||
=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::NortelStack
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::NortelStack for details.
 | 
			
		||||
 | 
			
		||||
=head2 Global Methods imported from SNMP::Info::SONMP
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::SONMP 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 $centillion->interfaces()
 | 
			
		||||
 | 
			
		||||
    Returns reference to the map between IID and physical Port.
 | 
			
		||||
 | 
			
		||||
    Slot and port numbers on the Passport switches are determined by the formula:
 | 
			
		||||
      port = index % 256
 | 
			
		||||
      slot = int(index / 256)
 | 
			
		||||
 
 | 
			
		||||
    The physical port name is returned as slot.port.
 | 
			
		||||
 | 
			
		||||
=item $centillion->i_duplex()
 | 
			
		||||
 | 
			
		||||
Returns reference to map of IIDs to current link duplex
 | 
			
		||||
 | 
			
		||||
=item $centillion->i_duplex_admin()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash of IIDs to admin duplex setting
 | 
			
		||||
 | 
			
		||||
=item $centillion->i_ignore()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash of IIDs to ignore.
 | 
			
		||||
 | 
			
		||||
=item $centillion->fw_mac()
 | 
			
		||||
 | 
			
		||||
(B<s5CmSNodeMacAddr>)
 | 
			
		||||
 | 
			
		||||
=item $centillion->fw_port()
 | 
			
		||||
 | 
			
		||||
(B<s5CmSNodeIfIndx>)
 | 
			
		||||
 | 
			
		||||
=item $centillion->bp_index()
 | 
			
		||||
 | 
			
		||||
Returns a mapping between ifIndex and the Bridge Table.
 | 
			
		||||
 | 
			
		||||
=item $centillion->i_vlan()
 | 
			
		||||
 | 
			
		||||
Returns a mapping between ifIndex and the VLAN.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Centillion 802.3 Extension Table (B<cnDot3ExtnTable>)
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $centillion->centillion_p_index()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Maps table IIDs to Interface IIDs 
 | 
			
		||||
 | 
			
		||||
(B<cnDot3ExtnIfIndex>)
 | 
			
		||||
 | 
			
		||||
=item $centillion->centillion_p_duplex()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Maps port operational duplexes to IIDs 
 | 
			
		||||
 | 
			
		||||
(B<cnDot3ExtnIfOperConnectionType>)
 | 
			
		||||
 | 
			
		||||
=item $centillion->rc_centillion_p_duplex_admin()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Maps port admin duplexes to IIDs
 | 
			
		||||
 | 
			
		||||
(B<cnDot3ExtnIfAdminConnectionType>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Centillion VLAN Table (B<cnVlanPortMemberTable>)
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $centillion->centillion_i_vlan_index()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Key: Table entry, Value: Index 
 | 
			
		||||
 | 
			
		||||
(B<cnVlanPortMemberIfIndex>)
 | 
			
		||||
 | 
			
		||||
=item $centillion->centillion_i_vlan()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Key: Table entry, Value: VLAN ID 
 | 
			
		||||
 | 
			
		||||
(B<cnVlanPortMemberVID>)
 | 
			
		||||
 | 
			
		||||
=item $centillion->centillion_i_vlan_type()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Key: Table entry, Value: VLAN Type 
 | 
			
		||||
 | 
			
		||||
(B<cnVlanPortMemberIngressType>)
 | 
			
		||||
 | 
			
		||||
=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::NortelStack
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::NortelStack for details.
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::SONMP
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::SONMP 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.6;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
@@ -51,8 +53,9 @@ $INIT = 0;
 | 
			
		||||
          %SNMP::Info::Entity::MIBS,
 | 
			
		||||
          'RFC1271-MIB' => 'logDescription',
 | 
			
		||||
          'HP-ICF-OID'  => 'hpSwitch4000',
 | 
			
		||||
          'HP-VLAN'     => 'hpVlanMemberIndex',
 | 
			
		||||
          'STATISTICS-MIB' => 'hpSwitchCpuStat',
 | 
			
		||||
          'NETSWITCH-MIB'  => 'hpMsgBufFree'
 | 
			
		||||
          'NETSWITCH-MIB'  => 'hpMsgBufFree',   
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
@@ -66,7 +69,8 @@ $INIT = 0;
 | 
			
		||||
            'mem_used'     => 'hpGlobalMemAllocBytes.1',
 | 
			
		||||
            'os_version'   => 'hpSwitchOsVersion.0',
 | 
			
		||||
            'os_bin'       => 'hpSwitchRomVersion.0',
 | 
			
		||||
            'mac'       => 'hpSwitchBaseMACAddress.0'
 | 
			
		||||
            'mac'          => 'hpSwitchBaseMACAddress.0',
 | 
			
		||||
            'hp_vlans'     => 'hpVlanNumber',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%FUNCS   = (
 | 
			
		||||
@@ -75,7 +79,16 @@ $INIT = 0;
 | 
			
		||||
            %SNMP::Info::Entity::FUNCS,
 | 
			
		||||
            'i_type2'   => 'ifType',
 | 
			
		||||
            # RFC1271
 | 
			
		||||
            'l_descr'   => 'logDescription'
 | 
			
		||||
            '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 = (
 | 
			
		||||
@@ -86,14 +99,31 @@ $INIT = 0;
 | 
			
		||||
         );
 | 
			
		||||
 | 
			
		||||
%MODEL_MAP = ( 
 | 
			
		||||
                'J4093A' => '2424M',
 | 
			
		||||
                'J4110A' => '8000M',
 | 
			
		||||
                'J4120A' => '1600M',
 | 
			
		||||
                'J4121A' => '4000M',
 | 
			
		||||
                'J4122A' => '2400M',
 | 
			
		||||
                'J4138A' => '9308M',
 | 
			
		||||
                'J4139A' => '9304M',
 | 
			
		||||
                'J4812A' => '2512',
 | 
			
		||||
               'J4819A' => '5308XL',
 | 
			
		||||
                'J4813A' => '2524',
 | 
			
		||||
               'J4805A' => '5304XL',
 | 
			
		||||
               'J4815A' => '3324XL',
 | 
			
		||||
                'J4819A' => '5308XL',
 | 
			
		||||
                'J4840A' => '6308M-SX',
 | 
			
		||||
                'J4841A' => '6208M-SX',
 | 
			
		||||
                'J4850A' => '5304XL',
 | 
			
		||||
                'J4865A' => '4108GL',
 | 
			
		||||
                'J4874A' => '9315M',
 | 
			
		||||
                'J4887A' => '4104GL',
 | 
			
		||||
               'J4874A' => '9315',
 | 
			
		||||
                '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
 | 
			
		||||
@@ -127,7 +157,9 @@ sub os_ver {
 | 
			
		||||
sub model {
 | 
			
		||||
    my $hp = shift;
 | 
			
		||||
    my $id = $hp->id();
 | 
			
		||||
    return undef unless defined $id;
 | 
			
		||||
    my $model = &SNMP::translateObj($id);
 | 
			
		||||
    return $id unless defined $model;
 | 
			
		||||
    
 | 
			
		||||
    $model =~ s/^hpswitch//i;
 | 
			
		||||
 | 
			
		||||
@@ -326,6 +358,49 @@ sub i_duplex_admin {
 | 
			
		||||
    return \%i_duplex_admin;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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__
 | 
			
		||||
 | 
			
		||||
@@ -389,13 +464,18 @@ 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 http://www.hp.com/rnd/software
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
@@ -518,6 +598,12 @@ 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()
 | 
			
		||||
 | 
			
		||||
=item $hp->i_vlan()
 | 
			
		||||
 | 
			
		||||
Looks in Q-BRIDGE-MIB -- see SNMP::Info::Bridge
 | 
			
		||||
 | 
			
		||||
and for older devices looks in HP-VLAN.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::Layer2
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										500
									
								
								Info/Layer2/NAP222x.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										500
									
								
								Info/Layer2/NAP222x.pm
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,500 @@
 | 
			
		||||
# SNMP::Info::Layer2::NAP222x
 | 
			
		||||
# Eric Miller <eric@jeneric.org>
 | 
			
		||||
# $Id$
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2004 Max Baker
 | 
			
		||||
#
 | 
			
		||||
# 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::NAP222x;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
use Exporter;
 | 
			
		||||
use SNMP::Info;
 | 
			
		||||
use SNMP::Info::Bridge;
 | 
			
		||||
use SNMP::Info::SONMP;
 | 
			
		||||
 | 
			
		||||
@SNMP::Info::Layer2::NAP222x::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::SONMP Exporter/;
 | 
			
		||||
@SNMP::Info::Layer2::NAP222x::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
 | 
			
		||||
 | 
			
		||||
%MIBS    = (
 | 
			
		||||
            %SNMP::Info::MIBS,
 | 
			
		||||
            %SNMP::Info::Bridge::MIBS,
 | 
			
		||||
            %SNMP::Info::SONMP::MIBS,
 | 
			
		||||
            'NORTEL-WLAN-AP-MIB' => 'ntWlanSwHardwareVer',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
            %SNMP::Info::GLOBALS,
 | 
			
		||||
            %SNMP::Info::Bridge::GLOBALS,
 | 
			
		||||
            %SNMP::Info::SONMP::GLOBALS,
 | 
			
		||||
            'nt_hw_ver'     => 'ntWlanSwHardwareVer',
 | 
			
		||||
            'nt_fw_ver'     => 'ntWlanSwBootRomVer',
 | 
			
		||||
            'nt_sw_ver'     => 'ntWlanSwOpCodeVer',
 | 
			
		||||
            'nt_cc'         => 'ntWlanSwCountryCode',
 | 
			
		||||
            'tftp_action'   => 'ntWlanTransferStart',
 | 
			
		||||
            'tftp_host'     => 'ntWlanFileServer',
 | 
			
		||||
            'tftp_file'     => 'ntWlanDestFile',
 | 
			
		||||
            'tftp_type'     => 'ntWlanFileType',
 | 
			
		||||
            'tftp_result'   => 'ntWlanFileTransferStatus',
 | 
			
		||||
            'tftp_xtype'    => 'ntWlanTransferType',
 | 
			
		||||
            'tftp_src_file' => 'ntWlanSrcFile',
 | 
			
		||||
            'ftp_user'      => 'ntWlanUserName',
 | 
			
		||||
            'ftp_pass'      => 'ntWlanPassword',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%FUNCS   = (
 | 
			
		||||
            %SNMP::Info::FUNCS,
 | 
			
		||||
            %SNMP::Info::Bridge::FUNCS,
 | 
			
		||||
            %SNMP::Info::SONMP::FUNCS,
 | 
			
		||||
            'i_name2'             => 'ifName',
 | 
			
		||||
            'bp_index_2'  => 'dot1dTpFdbPort',
 | 
			
		||||
            # From ntWlanPortTable
 | 
			
		||||
            'nt_prt_name'   => 'ntWlanPortName',
 | 
			
		||||
            'nt_dpx_admin'  => 'ntWlanPortCapabilities',
 | 
			
		||||
            'nt_auto'       => 'ntWlanPortAutonegotiation',
 | 
			
		||||
            'nt_dpx'        => 'ntWlanPortSpeedDpxStatus',
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
%MUNGE   = (
 | 
			
		||||
            %SNMP::Info::MUNGE,
 | 
			
		||||
            %SNMP::Info::Bridge::MUNGE,
 | 
			
		||||
            %SNMP::Info::SONMP::MUNGE,
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
sub os {
 | 
			
		||||
    return 'nortel';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os_ver {
 | 
			
		||||
    my $nap222x = shift;
 | 
			
		||||
    my $ver = $nap222x->nt_sw_ver();
 | 
			
		||||
    return undef unless defined $ver;
 | 
			
		||||
    
 | 
			
		||||
    if ($ver =~ m/(\d+\.\d+\.\d+\.\d+)/){
 | 
			
		||||
        return $1;
 | 
			
		||||
        }
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os_bin {
 | 
			
		||||
    my $nap222x = shift;
 | 
			
		||||
    my $bin = $nap222x->nt_fw_ver();
 | 
			
		||||
    return undef unless defined $bin;
 | 
			
		||||
 | 
			
		||||
    if ($bin =~ m/(\d+\.\d+\.\d+)/){
 | 
			
		||||
        return $1;
 | 
			
		||||
        }
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vendor {
 | 
			
		||||
    return 'nortel';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub model {
 | 
			
		||||
    my $nap222x = shift;
 | 
			
		||||
    my $descr = $nap222x->description();
 | 
			
		||||
    return undef unless defined $descr;
 | 
			
		||||
 | 
			
		||||
    return 'AP-2220' if ($descr =~ /2220/);
 | 
			
		||||
    return 'AP-2221' if ($descr =~ /2221/);
 | 
			
		||||
    return 'AP-2225' if ($descr =~ /2225/);
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub mac {
 | 
			
		||||
    my $nap222x = shift;
 | 
			
		||||
    my $i_mac = $nap222x->i_mac();
 | 
			
		||||
 | 
			
		||||
# Return Interface MAC   
 | 
			
		||||
    foreach my $entry (keys %$i_mac){
 | 
			
		||||
        my $sn = $i_mac->{$entry};
 | 
			
		||||
        next unless $sn;
 | 
			
		||||
        return $sn;
 | 
			
		||||
    }
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub serial {
 | 
			
		||||
    my $nap222x = shift;
 | 
			
		||||
    my $i_mac = $nap222x->i_mac();
 | 
			
		||||
 | 
			
		||||
# Return Interface MAC   
 | 
			
		||||
    foreach my $entry (keys %$i_mac){
 | 
			
		||||
        my $sn = $i_mac->{$entry};
 | 
			
		||||
        next unless $sn;
 | 
			
		||||
        return $sn;
 | 
			
		||||
    }
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_ignore {
 | 
			
		||||
    my $nap222x = shift;
 | 
			
		||||
    my $descr = $nap222x->i_description();
 | 
			
		||||
 | 
			
		||||
    my %i_ignore;
 | 
			
		||||
    foreach my $if (keys %$descr){
 | 
			
		||||
        my $type = $descr->{$if};
 | 
			
		||||
      # Skip virtual interfaces  
 | 
			
		||||
        $i_ignore{$if}++ if $type =~ /(loopback|lo|other)/i;
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_ignore;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub interfaces {
 | 
			
		||||
    my $nap222x = shift;
 | 
			
		||||
    my $interfaces = $nap222x->i_index();
 | 
			
		||||
    my $description = $nap222x->i_description();
 | 
			
		||||
 | 
			
		||||
    my %interfaces = ();
 | 
			
		||||
    foreach my $iid (keys %$interfaces){
 | 
			
		||||
        my $desc = $description->{$iid};
 | 
			
		||||
        next unless defined $desc;
 | 
			
		||||
        next if $desc =~ /lo/i;
 | 
			
		||||
 | 
			
		||||
        $interfaces{$iid} = $desc;
 | 
			
		||||
    }
 | 
			
		||||
    return \%interfaces;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_duplex {
 | 
			
		||||
    my $nap222x = shift;
 | 
			
		||||
    
 | 
			
		||||
    my $mode = $nap222x->nt_dpx();
 | 
			
		||||
    my $port_name = $nap222x->nt_prt_name();
 | 
			
		||||
    my $interfaces = $nap222x->interfaces();
 | 
			
		||||
    
 | 
			
		||||
    my %i_duplex;
 | 
			
		||||
    foreach my $if (keys %$interfaces){
 | 
			
		||||
        my $port = $interfaces->{$if};
 | 
			
		||||
        next unless $port =~ /dp/i;
 | 
			
		||||
        foreach my $idx (keys %$mode) {
 | 
			
		||||
            my $name = $port_name->{$idx}||'unknown';
 | 
			
		||||
            next unless $name eq $port;
 | 
			
		||||
            my $duplex = $mode->{$idx};
 | 
			
		||||
            
 | 
			
		||||
            $duplex = 'other' unless defined $duplex;
 | 
			
		||||
            $duplex = 'half' if $duplex =~ /half/i;
 | 
			
		||||
            $duplex = 'full' if $duplex =~ /full/i;
 | 
			
		||||
    
 | 
			
		||||
            $i_duplex{$if}=$duplex;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_duplex;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_duplex_admin {
 | 
			
		||||
    my $nap222x = shift;
 | 
			
		||||
    
 | 
			
		||||
    my $dpx_admin = $nap222x->nt_dpx_admin();
 | 
			
		||||
    my $nt_auto = $nap222x->nt_auto();
 | 
			
		||||
    my $interfaces = $nap222x->interfaces();
 | 
			
		||||
    my $port_name = $nap222x->nt_prt_name();
 | 
			
		||||
 
 | 
			
		||||
    my %i_duplex_admin;
 | 
			
		||||
    foreach my $if (keys %$interfaces){
 | 
			
		||||
        my $port = $interfaces->{$if};
 | 
			
		||||
        next unless $port =~ /dp/i;
 | 
			
		||||
        foreach my $idx (keys %$dpx_admin) {
 | 
			
		||||
            my $name = $port_name->{$idx}||'unknown';
 | 
			
		||||
            next unless $name eq $port;
 | 
			
		||||
            my $duplex = $dpx_admin->{$idx};
 | 
			
		||||
            my $auto = $nt_auto->{$idx};
 | 
			
		||||
    
 | 
			
		||||
            $duplex = 'other' unless defined $duplex;
 | 
			
		||||
            $duplex = 'half' if ($duplex =~ /half/i and $auto =~ /disabled/i);
 | 
			
		||||
            $duplex = 'full' if ($duplex =~ /full/i and $auto =~ /disabled/i);
 | 
			
		||||
            $duplex = 'auto' if $auto =~ /enabled/i;
 | 
			
		||||
    
 | 
			
		||||
            $i_duplex_admin{$if}=$duplex;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_duplex_admin;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_name {
 | 
			
		||||
    my $nap222x = shift;
 | 
			
		||||
    my $interfaces = $nap222x->interfaces();
 | 
			
		||||
 | 
			
		||||
    my %i_name;
 | 
			
		||||
    foreach my $if (keys %$interfaces){
 | 
			
		||||
        my $desc = $interfaces->{$if};
 | 
			
		||||
    next unless defined $desc;
 | 
			
		||||
        
 | 
			
		||||
        my $name = 'unknown';
 | 
			
		||||
        $name = 'Ethernet Interface' if $desc =~ /dp/i;
 | 
			
		||||
        $name = 'Wireless Interface B' if $desc =~ /ndc/i;
 | 
			
		||||
        $name = 'Wireless Interface A' if $desc =~ /ar/i;
 | 
			
		||||
        
 | 
			
		||||
        $i_name{$if} = $name;
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_name;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# dot1dBasePortTable does not exist and dot1dTpFdbPort does not map to ifIndex
 | 
			
		||||
sub bp_index {
 | 
			
		||||
    my $nap222x = shift;
 | 
			
		||||
    my $interfaces = $nap222x->interfaces();
 | 
			
		||||
 | 
			
		||||
    my %bp_index;
 | 
			
		||||
    foreach my $iid (keys %$interfaces){
 | 
			
		||||
        my $desc = $interfaces->{$iid};
 | 
			
		||||
        next unless defined $desc;
 | 
			
		||||
        next unless $desc =~ /(ndc|ar)/i;
 | 
			
		||||
        
 | 
			
		||||
        my $port = 1;
 | 
			
		||||
        $port = 2 if $desc =~ /ndc/i;
 | 
			
		||||
 | 
			
		||||
    $bp_index{$port} = $iid;
 | 
			
		||||
    }
 | 
			
		||||
    return \%bp_index;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
__END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::Layer2::nap222x - SNMP Interface to Nortel 2220 Series Access Points
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
Eric Miller (C<eric@jeneric.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you. 
 | 
			
		||||
 my $nap222x = 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      = $nap222x->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Provides abstraction to the configuration information obtainable from a Nortel
 | 
			
		||||
2220 series wireless Access Points 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 $nap222x = new SNMP::Info::Layer2::nap222x(...);
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Bridge
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::SONMP
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item NORTEL-WLAN-AP-MIB
 | 
			
		||||
 | 
			
		||||
=item Inherited classes
 | 
			
		||||
 | 
			
		||||
See SNMP::Info for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::Bridge for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::SONMP for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
MIBs can be found on the CD that came with your product.
 | 
			
		||||
 | 
			
		||||
Or, they can be downloaded directly from Nortel Networks regardless of support
 | 
			
		||||
contract status.
 | 
			
		||||
 | 
			
		||||
Go to http://www.nortelnetworks.com Techninal Support, Browse Technical Support,
 | 
			
		||||
Select by Product Families, Wireless LAN, WLAN - Access Point 2220, Software.
 | 
			
		||||
Filter on mibs and download the latest version's archive.
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar value from SNMP
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $nap222x->vendor()
 | 
			
		||||
 | 
			
		||||
Returns 'Nortel'
 | 
			
		||||
 | 
			
		||||
=item $nap222x->model()
 | 
			
		||||
 | 
			
		||||
Returns the model extracted from B<sysDescr>.
 | 
			
		||||
 | 
			
		||||
=item $nap222x->os()
 | 
			
		||||
 | 
			
		||||
Returns 'Nortel'
 | 
			
		||||
 | 
			
		||||
=item $nap222x->os_ver()
 | 
			
		||||
 | 
			
		||||
Returns the software version extracted from B<ntWlanSwOpCodeVer>.
 | 
			
		||||
 | 
			
		||||
=item $nap222x->os_bin()
 | 
			
		||||
 | 
			
		||||
Returns the firmware version extracted from B<ntWlanSwBootRomVer>.
 | 
			
		||||
 | 
			
		||||
=item $nap222x->mac()
 | 
			
		||||
 | 
			
		||||
Returns the MAC address of the first Ethernet Interface.
 | 
			
		||||
 | 
			
		||||
=item $nap222x->serial()
 | 
			
		||||
 | 
			
		||||
Returns the MAC address of the first Ethernet Interface.
 | 
			
		||||
 | 
			
		||||
=item $nap222x->nt_hw_ver()
 | 
			
		||||
 | 
			
		||||
Returns the hardware version.
 | 
			
		||||
 | 
			
		||||
B<ntWlanSwHardwareVer>
 | 
			
		||||
 | 
			
		||||
=item $nap222x->nt_cc()
 | 
			
		||||
 | 
			
		||||
Returns the country code of the AP.
 | 
			
		||||
 | 
			
		||||
B<ntWlanSwHardwareVer>
 | 
			
		||||
 | 
			
		||||
=item $nap222x->tftp_action()
 | 
			
		||||
 | 
			
		||||
B<ntWlanTransferStart>
 | 
			
		||||
 | 
			
		||||
=item $nap222x->tftp_host()
 | 
			
		||||
 | 
			
		||||
B<ntWlanFileServer>
 | 
			
		||||
 | 
			
		||||
=item $nap222x->tftp_file()
 | 
			
		||||
 | 
			
		||||
B<ntWlanDestFile>
 | 
			
		||||
 | 
			
		||||
=item $nap222x->tftp_type()
 | 
			
		||||
 | 
			
		||||
B<ntWlanFileType>
 | 
			
		||||
 | 
			
		||||
=item $nap222x->tftp_result()
 | 
			
		||||
 | 
			
		||||
B<ntWlanFileTransferStatus>
 | 
			
		||||
 | 
			
		||||
=item $nap222x->tftp_xtype()
 | 
			
		||||
 | 
			
		||||
B<ntWlanTransferType>
 | 
			
		||||
 | 
			
		||||
=item $nap222x->tftp_src_file()
 | 
			
		||||
 | 
			
		||||
B<ntWlanSrcFile>
 | 
			
		||||
 | 
			
		||||
=item $nap222x->ftp_user()
 | 
			
		||||
 | 
			
		||||
B<ntWlanUserName>
 | 
			
		||||
 | 
			
		||||
=item $nap222x->ftp_pass()
 | 
			
		||||
 | 
			
		||||
B<ntWlanPassword>
 | 
			
		||||
 | 
			
		||||
=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 Global Methods imported from SNMP::Info::SONMP
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::SONMP 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 $nap222x->interfaces()
 | 
			
		||||
 | 
			
		||||
Returns reference to map of IIDs to physical ports. 
 | 
			
		||||
 | 
			
		||||
=item $nap222x->i_ignore()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash of IIDs to ignore.
 | 
			
		||||
 | 
			
		||||
=item $nap222x->i_duplex()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Maps port operational duplexes to IIDs.
 | 
			
		||||
 | 
			
		||||
B<ntWlanPortSpeedDpxStatus>
 | 
			
		||||
 | 
			
		||||
=item $nap222x->i_duplex_admin()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Maps port admin duplexes to IIDs.
 | 
			
		||||
 | 
			
		||||
B<ntWlanPortCapabilities>
 | 
			
		||||
 | 
			
		||||
=item $nap222x->i_name()
 | 
			
		||||
 | 
			
		||||
Returns a human name based upon port description.
 | 
			
		||||
 | 
			
		||||
=item $nap222x->bp_index()
 | 
			
		||||
 | 
			
		||||
Returns a mapping between ifIndex and the Bridge Table.  This does not exist in
 | 
			
		||||
the MIB and bridge port index is not the same as ifIndex so it is created. 
 | 
			
		||||
 | 
			
		||||
=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::SONMP
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::SONMP for details.
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
							
								
								
									
										278
									
								
								Info/Layer2/Orinoco.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										278
									
								
								Info/Layer2/Orinoco.pm
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,278 @@
 | 
			
		||||
# SNMP::Info::Layer2::Orinoco
 | 
			
		||||
# Eric Miller <eric@jeneric.org>
 | 
			
		||||
# $Id$
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2004 Max Baker
 | 
			
		||||
#
 | 
			
		||||
# 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::Orinoco;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
use Exporter;
 | 
			
		||||
use SNMP::Info;
 | 
			
		||||
use SNMP::Info::Bridge;
 | 
			
		||||
 | 
			
		||||
@SNMP::Info::Layer2::Orinoco::ISA = qw/SNMP::Info SNMP::Info::Bridge Exporter/;
 | 
			
		||||
@SNMP::Info::Layer2::Orinoco::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
 | 
			
		||||
 | 
			
		||||
%MIBS    = (
 | 
			
		||||
            %SNMP::Info::MIBS,
 | 
			
		||||
            %SNMP::Info::Bridge::MIBS,
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
            %SNMP::Info::GLOBALS,
 | 
			
		||||
            %SNMP::Info::Bridge::GLOBALS,
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%FUNCS   = (
 | 
			
		||||
            %SNMP::Info::FUNCS,
 | 
			
		||||
            %SNMP::Info::Bridge::FUNCS,
 | 
			
		||||
             );
 | 
			
		||||
 | 
			
		||||
%MUNGE   = (
 | 
			
		||||
            %SNMP::Info::MUNGE,
 | 
			
		||||
            %SNMP::Info::Bridge::MUNGE,
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
sub os {
 | 
			
		||||
    return 'orinoco';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os_ver {
 | 
			
		||||
    my $orinoco = shift;
 | 
			
		||||
    my $descr = $orinoco->description();
 | 
			
		||||
    return undef unless defined $descr;
 | 
			
		||||
 | 
			
		||||
    if ($descr =~ m/V(\d+\.\d+)/){
 | 
			
		||||
        return $1;
 | 
			
		||||
    }
 | 
			
		||||
    if ($descr =~ m/v(\d+\.\d+\.\d+)/){
 | 
			
		||||
        return $1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os_bin {
 | 
			
		||||
    my $orinoco = shift;
 | 
			
		||||
    my $descr = $orinoco->description();
 | 
			
		||||
    return undef unless defined $descr;
 | 
			
		||||
 | 
			
		||||
    if ($descr =~ m/V(\d+\.\d+)$/){
 | 
			
		||||
        return $1;
 | 
			
		||||
    }
 | 
			
		||||
    if ($descr =~ m/v(\d+\.\d+\.\d+)$/){
 | 
			
		||||
        return $1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vendor {
 | 
			
		||||
    return 'Proxim';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub model {
 | 
			
		||||
    my $orinoco = shift;
 | 
			
		||||
    my $descr = $orinoco->description();
 | 
			
		||||
    return undef unless defined $descr;
 | 
			
		||||
 | 
			
		||||
    return 'AP-1000' if ($descr =~ /AP-1000/);
 | 
			
		||||
    return 'AP-2000' if ($descr =~ /AP-2000/);
 | 
			
		||||
    return 'WavePOINT-II' if ($descr =~ /WavePOINT-II/);
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub serial {
 | 
			
		||||
    my $orinoco = shift;
 | 
			
		||||
    my $descr = $orinoco->description();
 | 
			
		||||
    return undef unless defined $descr;
 | 
			
		||||
 | 
			
		||||
    $descr  = $1 if $descr =~ /SN-(\S+)/;
 | 
			
		||||
    return $descr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_ignore {
 | 
			
		||||
    my $orinoco = shift;
 | 
			
		||||
    my $descr = $orinoco->i_description();
 | 
			
		||||
 | 
			
		||||
    my %i_ignore;
 | 
			
		||||
    foreach my $if (keys %$descr){
 | 
			
		||||
        my $type = $descr->{$if};
 | 
			
		||||
	  # Skip virtual interfaces  
 | 
			
		||||
        $i_ignore{$if}++ if $type =~ /(lo|empty|PCMCIA)/i;
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_ignore;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub interfaces {
 | 
			
		||||
    my $orinoco = shift;
 | 
			
		||||
    my $interfaces = $orinoco->i_index();
 | 
			
		||||
    my $descriptions = $orinoco->i_description();
 | 
			
		||||
 | 
			
		||||
    my %interfaces = ();
 | 
			
		||||
    foreach my $iid (keys %$interfaces){
 | 
			
		||||
        my $desc = $descriptions->{$iid};
 | 
			
		||||
        next unless defined $desc;
 | 
			
		||||
        next if $desc =~ /(lo|empty|PCMCIA)/i;
 | 
			
		||||
 | 
			
		||||
	$desc  = 'AMD' if $desc =~ /AMD/;
 | 
			
		||||
 | 
			
		||||
        $interfaces{$iid} = $desc;
 | 
			
		||||
    }
 | 
			
		||||
    return \%interfaces;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
__END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::Layer2::Orinoco - SNMP Interface to Orinoco Series Access Points
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
Eric Miller (C<eric@jeneric.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you. 
 | 
			
		||||
 my $orinoco = 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      = $orinoco->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Provides abstraction to the configuration information obtainable from a Orinoco
 | 
			
		||||
Access Point 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 $orinoco = new SNMP::Info::Layer2::Orinoco(...);
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Bridge
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item Inherited classes
 | 
			
		||||
 | 
			
		||||
See SNMP::Info for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::Bridge for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar value from SNMP
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $orinoco->vendor()
 | 
			
		||||
 | 
			
		||||
Returns 'Proxim' :)
 | 
			
		||||
 | 
			
		||||
=item $orinoco->model()
 | 
			
		||||
 | 
			
		||||
Returns the model extracted from B<sysDescr>.
 | 
			
		||||
 | 
			
		||||
=item $orinoco->os()
 | 
			
		||||
 | 
			
		||||
Returns 'Orinoco'
 | 
			
		||||
 | 
			
		||||
=item $orinoco->os_ver()
 | 
			
		||||
 | 
			
		||||
Returns the software version extracted from B<sysDescr>.
 | 
			
		||||
 | 
			
		||||
=item $orinoco->os_bin()
 | 
			
		||||
 | 
			
		||||
Returns the firmware version extracted from B<sysDescr>.
 | 
			
		||||
 | 
			
		||||
=item $orinoco->serial()
 | 
			
		||||
 | 
			
		||||
Returns the serial number extracted 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.
 | 
			
		||||
 | 
			
		||||
=head1 TABLE ENTRIES
 | 
			
		||||
 | 
			
		||||
These are methods that return tables of information in the form of a reference
 | 
			
		||||
to a hash.
 | 
			
		||||
 | 
			
		||||
=head2 Overrides
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $orinoco->interfaces()
 | 
			
		||||
 | 
			
		||||
Returns reference to map of IIDs to physical ports. 
 | 
			
		||||
 | 
			
		||||
=item $orinoco->i_ignore()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash of IIDs to ignore.
 | 
			
		||||
 | 
			
		||||
=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
 | 
			
		||||
							
								
								
									
										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.9;
 | 
			
		||||
# $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
 | 
			
		||||
@@ -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.6;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
@@ -69,7 +71,7 @@ $INIT = 0;
 | 
			
		||||
            %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',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
@@ -85,7 +87,9 @@ $INIT = 0;
 | 
			
		||||
            'at_index'   => 'atIfIndex',
 | 
			
		||||
            'at_paddr'   => 'atPhysAddress',
 | 
			
		||||
            'at_netaddr' => 'atNetAddress',
 | 
			
		||||
            'ospf_ip'    => 'ospfHostIpAddress'
 | 
			
		||||
            'ospf_ip'    => 'ospfHostIpAddress',
 | 
			
		||||
            'ent_serial' => 'entPhysicalSerialNum',
 | 
			
		||||
            'ent_chassis'=> 'entPhysicalDescr',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%MUNGE = (
 | 
			
		||||
@@ -111,12 +115,13 @@ sub root_ip {
 | 
			
		||||
    if (defined $ospf_ip and scalar(keys %$ospf_ip)){
 | 
			
		||||
        foreach my $key (keys %$ospf_ip){
 | 
			
		||||
            my $ip = $ospf_ip->{$key};
 | 
			
		||||
            next if $ip eq '0.0.0.0';
 | 
			
		||||
            print " SNMP::Layer3::root_ip() using $ip\n" if $DEBUG;
 | 
			
		||||
            return $ip;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return $router_ip if defined $router_ip;
 | 
			
		||||
    return $router_ip if (defined $router_ip and $router_ip ne '0.0.0.0');
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -138,10 +143,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 
 | 
			
		||||
@@ -149,8 +164,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//;
 | 
			
		||||
 
 | 
			
		||||
@@ -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.6;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
@@ -90,9 +92,9 @@ sub os_ver {
 | 
			
		||||
    my $aironet = shift;
 | 
			
		||||
    my $descr = $aironet->description();
 | 
			
		||||
 | 
			
		||||
    # CAP340 11.21
 | 
			
		||||
    if ($descr =~ /AP\d{3}\s+(\d{2}\.\d{2})/){
 | 
			
		||||
        return $1;
 | 
			
		||||
    # 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})/){
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										470
									
								
								Info/Layer3/AlteonAD.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										470
									
								
								Info/Layer3/AlteonAD.pm
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,470 @@
 | 
			
		||||
# SNMP::Info::Layer3::AlteonAD
 | 
			
		||||
# Eric Miller <eric@jeneric.org>
 | 
			
		||||
# $Id$
 | 
			
		||||
#
 | 
			
		||||
# 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 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::Layer3::AlteonAD;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
use Exporter;
 | 
			
		||||
use SNMP::Info;
 | 
			
		||||
use SNMP::Info::Bridge;
 | 
			
		||||
 | 
			
		||||
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE /;
 | 
			
		||||
 | 
			
		||||
@SNMP::Info::Layer3::AlteonAD::ISA = qw/SNMP::Info SNMP::Info::Bridge Exporter/;
 | 
			
		||||
@SNMP::Info::Layer3::AlteonAD::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
$DEBUG=0;
 | 
			
		||||
 | 
			
		||||
# See SNMP::Info for the details of these data structures and 
 | 
			
		||||
#       the interworkings.
 | 
			
		||||
$INIT = 0;
 | 
			
		||||
 | 
			
		||||
%MIBS = (
 | 
			
		||||
          %SNMP::Info::MIBS,
 | 
			
		||||
          %SNMP::Info::Bridge::MIBS,
 | 
			
		||||
	  'ALTEON-TIGON-SWITCH-MIB' => 'agSoftwareVersion',
 | 
			
		||||
	  'ALTEON-TS-PHYSICAL-MIB'  => 'agPortTableMaxEnt',
 | 
			
		||||
	  'ALTEON-TS-NETWORK-MIB'   => 'agPortTableMaxEnt',
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
            %SNMP::Info::GLOBALS,
 | 
			
		||||
            %SNMP::Info::Bridge::GLOBALS,
 | 
			
		||||
	    'sw_ver'	   => 'agSoftwareVersion',
 | 
			
		||||
	    'tftp_action'  => 'agTftpAction',
 | 
			
		||||
	    'tftp_host'    => 'agTftpServer',
 | 
			
		||||
            'tftp_file'    => 'agTftpCfgFileName',
 | 
			
		||||
            'tftp_result'  => 'agTftpLastActionStatus',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%FUNCS = (
 | 
			
		||||
            %SNMP::Info::FUNCS,
 | 
			
		||||
            %SNMP::Info::Bridge::FUNCS,
 | 
			
		||||
	    'bp_index_2'  => 'dot1dBasePortIfIndex',
 | 
			
		||||
	    'i_name2'    => 'ifName',
 | 
			
		||||
            # From RFC1213-MIB
 | 
			
		||||
            'at_index'    => 'ipNetToMediaIfIndex',
 | 
			
		||||
            'at_paddr'    => 'ipNetToMediaPhysAddress',
 | 
			
		||||
            'at_netaddr'  => 'ipNetToMediaNetAddress',
 | 
			
		||||
            # From agPortCurCfgTable
 | 
			
		||||
            'ag_p_cfg_idx'        => 'agPortCurCfgIndx',
 | 
			
		||||
            'ag_p_cfg_pref'       => 'agPortCurCfgPrefLink',
 | 
			
		||||
            'ag_p_cfg_pvid'       => 'agPortCurCfgPVID',
 | 
			
		||||
            'ag_p_cfg_fe_auto'    => 'agPortCurCfgFastEthAutoNeg',
 | 
			
		||||
            'ag_p_cfg_fe_mode'    => 'agPortCurCfgFastEthMode',
 | 
			
		||||
            'ag_p_cfg_ge_auto'    => 'agPortCurCfgGigEthAutoNeg',
 | 
			
		||||
            'ag_p_cfg_name'       => 'agPortCurCfgPortName',
 | 
			
		||||
            # From portInfoTable
 | 
			
		||||
            'p_info_idx'     => 'portInfoIndx',
 | 
			
		||||
            'p_info_mode'    => 'portInfoMode',
 | 
			
		||||
            # From portInfoTable
 | 
			
		||||
            'ip_cfg_vlan'     => 'ipCurCfgIntfVlan',
 | 
			
		||||
         );
 | 
			
		||||
         
 | 
			
		||||
%MUNGE = (
 | 
			
		||||
            %SNMP::Info::MUNGE,
 | 
			
		||||
            %SNMP::Info::Bridge::MUNGE,
 | 
			
		||||
            'at_paddr' => \&SNMP::Info::munge_mac,
 | 
			
		||||
         );
 | 
			
		||||
 | 
			
		||||
sub model {
 | 
			
		||||
    my $alteon = shift;
 | 
			
		||||
    my $desc = $alteon->description();
 | 
			
		||||
    return undef unless defined $desc;
 | 
			
		||||
 | 
			
		||||
    return 'AD2' if ($desc =~ /AD2/);
 | 
			
		||||
    return 'AD3' if ($desc =~ /AD3/);
 | 
			
		||||
    return 'AD4' if ($desc =~ /AD4/);
 | 
			
		||||
    return '180' if ($desc =~ /180/);
 | 
			
		||||
    return '183' if ($desc =~ /183/);
 | 
			
		||||
    return '184' if ($desc =~ /184/);
 | 
			
		||||
    
 | 
			
		||||
    return $desc;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vendor {
 | 
			
		||||
    return 'nortel';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os {
 | 
			
		||||
    return 'webos';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os_ver {
 | 
			
		||||
    my $alteon = shift;
 | 
			
		||||
    my $version = $alteon->sw_ver();
 | 
			
		||||
    return undef unless defined $version;
 | 
			
		||||
 | 
			
		||||
    return $version;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub interfaces {
 | 
			
		||||
    my $alteon = shift;
 | 
			
		||||
    my $interfaces = $alteon->i_index();
 | 
			
		||||
    my $descriptions = $alteon->i_description();
 | 
			
		||||
 | 
			
		||||
    my %interfaces = ();
 | 
			
		||||
    foreach my $iid (keys %$interfaces){
 | 
			
		||||
        my $desc = $descriptions->{$iid};
 | 
			
		||||
        next unless defined $desc;
 | 
			
		||||
 | 
			
		||||
	if ($desc =~ /(^net\d+)/) {
 | 
			
		||||
	    $desc  = $1;
 | 
			
		||||
	}
 | 
			
		||||
	elsif (($iid > 256) and ($iid < 266)) {
 | 
			
		||||
	    $desc = ($iid % 256);
 | 
			
		||||
	}
 | 
			
		||||
        $interfaces{$iid} = $desc;
 | 
			
		||||
    }
 | 
			
		||||
    return \%interfaces;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_duplex {
 | 
			
		||||
    my $alteon = shift;
 | 
			
		||||
    
 | 
			
		||||
    my $p_mode = $alteon->p_info_mode();
 | 
			
		||||
    
 | 
			
		||||
    my %i_duplex;
 | 
			
		||||
    foreach my $if (keys %$p_mode){
 | 
			
		||||
        my $duplex = $p_mode->{$if};
 | 
			
		||||
        next unless defined $duplex; 
 | 
			
		||||
    
 | 
			
		||||
        $duplex = 'half' if $duplex =~ /half/i;
 | 
			
		||||
        $duplex = 'full' if $duplex =~ /full/i;
 | 
			
		||||
	
 | 
			
		||||
	my $idx = $if + 256;
 | 
			
		||||
	
 | 
			
		||||
        $i_duplex{$idx}=$duplex; 
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_duplex;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_duplex_admin {
 | 
			
		||||
    my $alteon = shift;
 | 
			
		||||
 | 
			
		||||
    my $ag_pref = $alteon->ag_p_cfg_pref();
 | 
			
		||||
    my $ag_fe_auto = $alteon->ag_p_cfg_fe_auto();
 | 
			
		||||
    my $ag_fe_mode = $alteon->ag_p_cfg_fe_mode();
 | 
			
		||||
    my $ag_ge_auto = $alteon->ag_p_cfg_ge_auto();
 | 
			
		||||
 
 | 
			
		||||
    my %i_duplex_admin;
 | 
			
		||||
    foreach my $if (keys %$ag_pref){
 | 
			
		||||
        my $pref = $ag_pref->{$if};
 | 
			
		||||
        next unless defined $pref;
 | 
			
		||||
	
 | 
			
		||||
	my $string = 'other';	
 | 
			
		||||
	if ($pref =~ /gigabit/i) {
 | 
			
		||||
	    my $ge_auto = $ag_ge_auto->{$if};
 | 
			
		||||
	    $string = 'full' if ($ge_auto =~ /off/i);
 | 
			
		||||
	    $string = 'auto' if ($ge_auto =~ /on/i);
 | 
			
		||||
	}
 | 
			
		||||
	elsif ($pref =~ /fast/i) {
 | 
			
		||||
	    my $fe_auto = $ag_fe_auto->{$if};
 | 
			
		||||
	    my $fe_mode = $ag_fe_mode->{$if};
 | 
			
		||||
	    $string = 'half' if ($fe_mode =~ /half/i and $fe_auto =~ /off/i);
 | 
			
		||||
            $string = 'full' if ($fe_mode =~ /full/i and $fe_auto =~ /off/i);
 | 
			
		||||
            $string = 'auto' if $fe_auto =~ /on/i;
 | 
			
		||||
	}
 | 
			
		||||
	my $idx = $if + 256;
 | 
			
		||||
	
 | 
			
		||||
        $i_duplex_admin{$idx}=$string; 
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_duplex_admin;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_vlan {
 | 
			
		||||
    my $alteon = shift;
 | 
			
		||||
 | 
			
		||||
    my $ag_vlans  = $alteon->ag_p_cfg_pvid();
 | 
			
		||||
    my $ip_vlans  = $alteon->ip_cfg_vlan();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    my %i_vlan;
 | 
			
		||||
    foreach my $if (keys %$ip_vlans){
 | 
			
		||||
        my $ip_vlanid = $ip_vlans->{$if};
 | 
			
		||||
	next unless defined $ip_vlanid;
 | 
			
		||||
        
 | 
			
		||||
        $i_vlan{$if}=$ip_vlanid; 
 | 
			
		||||
    }
 | 
			
		||||
    foreach my $if (keys %$ag_vlans){
 | 
			
		||||
        my $ag_vlanid = $ag_vlans->{$if};
 | 
			
		||||
	next unless defined $ag_vlanid;
 | 
			
		||||
        
 | 
			
		||||
	my $idx = $if + 256;   
 | 
			
		||||
        $i_vlan{$idx}=$ag_vlanid; 
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_vlan;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_name {
 | 
			
		||||
    my $alteon = shift;
 | 
			
		||||
    my $p_name = $alteon->ag_p_cfg_name();
 | 
			
		||||
 | 
			
		||||
    my %i_name;
 | 
			
		||||
    foreach my $iid (keys %$p_name){
 | 
			
		||||
        my $name = $p_name->{$iid};
 | 
			
		||||
	next unless defined $name;
 | 
			
		||||
        my $idx = $iid + 256;
 | 
			
		||||
        $i_name{$idx} = $name;
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_name;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Bridge MIB does not map Bridge Port to ifIndex correctly
 | 
			
		||||
sub bp_index {
 | 
			
		||||
    my $alteon = shift;
 | 
			
		||||
    my $b_index = $alteon->bp_index_2();
 | 
			
		||||
 | 
			
		||||
    my %bp_index;
 | 
			
		||||
    foreach my $iid (keys %$b_index){
 | 
			
		||||
        my $port = $b_index->{$iid};
 | 
			
		||||
        next unless defined $port;
 | 
			
		||||
        $port = $port + 256;
 | 
			
		||||
 | 
			
		||||
	$bp_index{$iid} = $port;
 | 
			
		||||
    }
 | 
			
		||||
    return \%bp_index;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub root_ip {
 | 
			
		||||
    my $alteon = shift;
 | 
			
		||||
    my $ip_table = $alteon->ip_table();
 | 
			
		||||
 | 
			
		||||
# Return First IP Address    
 | 
			
		||||
    foreach my $entry (keys %$ip_table){
 | 
			
		||||
        my $router_ip = $ip_table->{$entry};
 | 
			
		||||
        print " SNMP::Layer3::AlteonAD::root_ip() using $router_ip\n" if $DEBUG;
 | 
			
		||||
        next unless $router_ip;
 | 
			
		||||
        return $router_ip if ($router_ip ne '0.0.0.0');
 | 
			
		||||
    }
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
__END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::Layer3::AlteonAD - Perl5 Interface to Nortel Networks' Alteon Ace
 | 
			
		||||
Director Series Layer 2-7 Switches.
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
Eric Miller (C<eric@jeneric.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you. 
 | 
			
		||||
 my $alteon = 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      = $alteon->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Abstraction subclass for Layer 2-7 load balancing switches running Nortel Networks'
 | 
			
		||||
Alteon Web OS Traffic Control Software.
 | 
			
		||||
 | 
			
		||||
For speed or debugging purposes you can call the subclass directly, but not after
 | 
			
		||||
determining a more specific class using the method above. 
 | 
			
		||||
 | 
			
		||||
 my $alteon = new SNMP::Info::Layer3::AlteonAD(...);
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Bridge
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item ALTEON-TIGON-SWITCH-MIB
 | 
			
		||||
 | 
			
		||||
=item ALTEON-TS-PHYSICAL-MIB
 | 
			
		||||
 | 
			
		||||
=item ALTEON-TS-NETWORK-MIB
 | 
			
		||||
 | 
			
		||||
MIBs can be found on the CD that came with your product.
 | 
			
		||||
 | 
			
		||||
Or, they can be downloaded directly from Nortel Networks regardless of support
 | 
			
		||||
contract status.  Go to http://www.nortelnetworks.com Techninal Support,
 | 
			
		||||
Browse Technical Support, Select by Product Families, Alteon,
 | 
			
		||||
Alteon Web OS Traffic Control Software, Software.  Filter on mibs and download
 | 
			
		||||
the latest version's archive.
 | 
			
		||||
 | 
			
		||||
=item Inherited Classes' MIBs
 | 
			
		||||
 | 
			
		||||
See SNMP::Info for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::Bridge for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar value from SNMP
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $alteon->model()
 | 
			
		||||
 | 
			
		||||
Returns the model extracted from B<sysDescr>
 | 
			
		||||
 | 
			
		||||
=item $alteon->vendor()
 | 
			
		||||
 | 
			
		||||
Returns 'Nortel'
 | 
			
		||||
 | 
			
		||||
=item $alteon->os()
 | 
			
		||||
 | 
			
		||||
Returns 'WebOS'
 | 
			
		||||
 | 
			
		||||
=item $alteon->os_ver()
 | 
			
		||||
 | 
			
		||||
Returns the software version reported by B<agSoftwareVersion>
 | 
			
		||||
 | 
			
		||||
=item $alteon->root_ip()
 | 
			
		||||
 | 
			
		||||
Returns the primary IP used to communicate with the device.  Currently returns
 | 
			
		||||
the first interfaces IP.
 | 
			
		||||
 | 
			
		||||
=item $alteon->tftp_action()
 | 
			
		||||
 | 
			
		||||
(B<agTftpAction>)
 | 
			
		||||
 | 
			
		||||
=item $alteon->tftp_host()
 | 
			
		||||
 | 
			
		||||
(B<agTftpServer>)
 | 
			
		||||
 | 
			
		||||
=item $alteon->tftp_file()
 | 
			
		||||
 | 
			
		||||
(B<agTftpCfgFileName>)
 | 
			
		||||
 | 
			
		||||
=item $alteon->tftp_result()
 | 
			
		||||
 | 
			
		||||
(B<agTftpLastActionStatus>)
 | 
			
		||||
 | 
			
		||||
=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 $alteon->interfaces()
 | 
			
		||||
 | 
			
		||||
Returns reference to the map between IID and physical port.
 | 
			
		||||
 | 
			
		||||
Utilizes description for network interfaces.  Ports are determined by
 | 
			
		||||
formula (ifIndex mod 256).
 | 
			
		||||
 | 
			
		||||
=item $alteon->i_duplex()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Maps port operational duplexes to IIDs.
 | 
			
		||||
 | 
			
		||||
=item $alteon->i_duplex_admin()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Maps port admin duplexes to IIDs.
 | 
			
		||||
 | 
			
		||||
=item $alteon->i_vlan()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Maps port VLAN ID to IIDs.
 | 
			
		||||
 | 
			
		||||
=item $alteon->i_name()
 | 
			
		||||
 | 
			
		||||
Maps (B<agPortCurCfgPortName>) to port and returns the human set port name if exists.
 | 
			
		||||
 | 
			
		||||
=item $alteon->bp_index()
 | 
			
		||||
 | 
			
		||||
Returns a mapping between ifIndex and the Bridge Table.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 RFC1213 Arp Cache Table (B<ipNetToMediaTable>)
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $alteon->at_index()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Maps ARP table entries to Interface IIDs 
 | 
			
		||||
 | 
			
		||||
(B<ipNetToMediaIfIndex>)
 | 
			
		||||
 | 
			
		||||
=item $alteon->at_paddr()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Maps ARP table entries to MAC addresses. 
 | 
			
		||||
 | 
			
		||||
(B<ipNetToMediaPhysAddress>)
 | 
			
		||||
 | 
			
		||||
=item $alteon->at_netaddr()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Maps ARP table entries to IPs 
 | 
			
		||||
 | 
			
		||||
(B<ipNetToMediaNetAddress>)
 | 
			
		||||
 | 
			
		||||
=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
 | 
			
		||||
							
								
								
									
										550
									
								
								Info/Layer3/BayRS.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										550
									
								
								Info/Layer3/BayRS.pm
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,550 @@
 | 
			
		||||
# SNMP::Info::Layer3::BayRS
 | 
			
		||||
# Eric Miller <eric@jeneric.org>
 | 
			
		||||
# $Id$
 | 
			
		||||
#
 | 
			
		||||
# 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 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::Layer3::BayRS;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
use Exporter;
 | 
			
		||||
use SNMP::Info;
 | 
			
		||||
use SNMP::Info::Bridge;
 | 
			
		||||
 | 
			
		||||
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE %MODEL_MAP/;
 | 
			
		||||
 | 
			
		||||
@SNMP::Info::Layer3::BayRS::ISA = qw/SNMP::Info SNMP::Info::Bridge Exporter/;
 | 
			
		||||
@SNMP::Info::Layer3::BayRS::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
$DEBUG=0;
 | 
			
		||||
 | 
			
		||||
# See SNMP::Info for the details of these data structures and 
 | 
			
		||||
# the interworkings.
 | 
			
		||||
$INIT = 0;
 | 
			
		||||
 | 
			
		||||
%MIBS = (
 | 
			
		||||
          %SNMP::Info::MIBS,
 | 
			
		||||
          %SNMP::Info::Bridge::MIBS,
 | 
			
		||||
         'Wellfleet-HARDWARE-MIB'	 => 'wfHwBpIdOpt',
 | 
			
		||||
         'Wellfleet-OSPF-MIB'		 => 'wfOspfRouterId',
 | 
			
		||||
	 'Wellfleet-DOT1QTAG-CONFIG-MIB' => 'wfDot1qTagCfgVlanName',
 | 
			
		||||
	 'Wellfleet-CSMACD-MIB'		 => 'wfCSMACDCct',
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
            %SNMP::Info::GLOBALS,
 | 
			
		||||
            %SNMP::Info::Bridge::GLOBALS,
 | 
			
		||||
            'bp_id'         => 'wfHwBpIdOpt',
 | 
			
		||||
            'bp_serial'     => 'wfHwBpSerialNumber',
 | 
			
		||||
            'ospf_rtr_id'   => 'wfOspfRouterId',
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%FUNCS = (
 | 
			
		||||
            %SNMP::Info::FUNCS,
 | 
			
		||||
            %SNMP::Info::Bridge::FUNCS,
 | 
			
		||||
	    'i_name2'             => 'ifName',
 | 
			
		||||
            # From RFC1213-MIB
 | 
			
		||||
            'at_index'    => 'ipNetToMediaIfIndex',
 | 
			
		||||
            'at_paddr'    => 'ipNetToMediaPhysAddress',
 | 
			
		||||
            'at_netaddr'  => 'ipNetToMediaNetAddress',
 | 
			
		||||
            # From Wellfleet-CSMACD-MIB::wfCSMACDTable
 | 
			
		||||
            'wf_csmacd_cct'  	=> 'wfCSMACDCct',
 | 
			
		||||
            'wf_csmacd_slot'    => 'wfCSMACDSlot',
 | 
			
		||||
            'wf_csmacd_conn'    => 'wfCSMACDConnector',
 | 
			
		||||
            'wf_csmacd_mtu'    	=> 'wfCSMACDMtu',
 | 
			
		||||
            'wf_duplex'    	=> 'wfCSMACDLineCapability',
 | 
			
		||||
            'wf_csmacd_line'   	=> 'wfCSMACDLineNumber',
 | 
			
		||||
            # From Wellfleet-CSMACD-MIB::wfCSMACDAutoNegTable
 | 
			
		||||
            'wf_auto'    	=> 'wfCSMACDAutoNegSpeedSelect',
 | 
			
		||||
            # From Wellfleet-DOT1QTAG-CONFIG-MIB::wfDot1qTagConfigTable
 | 
			
		||||
            'wf_vlan_name'        => 'wfDot1qTagCfgVlanName',
 | 
			
		||||
            'wf_local_vlan_id'    => 'wfDot1qTagCfgLocalVlanId',
 | 
			
		||||
            'wf_global_vlan_id'   => 'wfDot1qTagCfgGlobalVlanId',
 | 
			
		||||
            'wf_vlan_port'	  => 'wfDot1qTagCfgPhysicalPortId',
 | 
			
		||||
	    # From Wellfleet-HARDWARE-MIB::wfHwTable
 | 
			
		||||
            'wf_hw_slot'        => 'wfHwSlot',
 | 
			
		||||
            'wf_hw_mod_id'	=> 'wfHwModIdOpt',
 | 
			
		||||
            'wf_hw_mod_rev'	=> 'wfHwModRev',
 | 
			
		||||
            'wf_hw_mod_ser'	=> 'wfHwModSerialNumber',
 | 
			
		||||
            'wf_hw_mobo_id'     => 'wfHwMotherBdIdOpt ',
 | 
			
		||||
            'wf_hw_mobo_rev'    => 'wfHwMotherBdRev',
 | 
			
		||||
            'wf_hw_mobo_ser'	=> 'wfHwMotherBdSerialNumber',
 | 
			
		||||
            'wf_hw_diag'	=> 'wfHwDiagPromRev',
 | 
			
		||||
	    'wf_hw_boot'	=> 'wfHwBootPromRev',
 | 
			
		||||
            'wf_hw_mobo_mem'	=> 'wfHwMotherBdMemorySize',
 | 
			
		||||
            'wf_hw_cfg_time'	=> 'wfHwConfigDateAndTime ',
 | 
			
		||||
         );
 | 
			
		||||
         
 | 
			
		||||
%MUNGE = (
 | 
			
		||||
            %SNMP::Info::MUNGE,
 | 
			
		||||
            %SNMP::Info::Bridge::MUNGE,
 | 
			
		||||
            'at_paddr' => \&SNMP::Info::munge_mac,
 | 
			
		||||
         );
 | 
			
		||||
 | 
			
		||||
%MODEL_MAP = ( 
 | 
			
		||||
	'acefn'     => 'FN',
 | 
			
		||||
	'aceln'     => 'LN',
 | 
			
		||||
	'acecn'     => 'CN',
 | 
			
		||||
	'afn'       => 'AFN',
 | 
			
		||||
	'in'        => 'IN',
 | 
			
		||||
	'an'        => 'AN',
 | 
			
		||||
	'arn'       => 'ARN',
 | 
			
		||||
	'sys5000'   => '5000',
 | 
			
		||||
	'freln'     => 'BLN',
 | 
			
		||||
	'frecn'     => 'BCN',
 | 
			
		||||
	'frerbln'   => 'BLN-2',
 | 
			
		||||
	'asn'       => 'ASN',
 | 
			
		||||
	'asnzcable' => 'ASN-Z',
 | 
			
		||||
	'asnbcable' => 'ASN-B',
 | 
			
		||||
             );
 | 
			
		||||
 | 
			
		||||
sub model {
 | 
			
		||||
    my $bayrs = shift;
 | 
			
		||||
    my $bp_id = $bayrs->bp_id();
 | 
			
		||||
 | 
			
		||||
    return defined $MODEL_MAP{$bp_id} ? $MODEL_MAP{$bp_id} : $bp_id;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vendor {
 | 
			
		||||
    return 'nortel';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os {
 | 
			
		||||
    return 'bayrs';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os_ver {
 | 
			
		||||
    my $bayrs = shift;
 | 
			
		||||
    my $descr = $bayrs->description();
 | 
			
		||||
    return undef unless defined $descr;
 | 
			
		||||
 | 
			
		||||
    if ($descr =~ m/rel\/(\d+\.\d+\.\d+\.\d+)/){
 | 
			
		||||
        return $1;
 | 
			
		||||
    }
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub serial {
 | 
			
		||||
    my $bayrs = shift;
 | 
			
		||||
    my $serialnum = $bayrs->bp_serial(); 
 | 
			
		||||
    $serialnum = hex(join('','0x',map{sprintf "%02X", $_}unpack("C*",$serialnum)));
 | 
			
		||||
    
 | 
			
		||||
    return $serialnum if defined $serialnum ;
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub interfaces {
 | 
			
		||||
    my $bayrs = shift;
 | 
			
		||||
    my $description = $bayrs->i_description();
 | 
			
		||||
    my $vlan_ids = $bayrs->wf_global_vlan_id();
 | 
			
		||||
    my $vlan_idx = $bayrs->wf_local_vlan_id();
 | 
			
		||||
    
 | 
			
		||||
    my %interfaces = ();
 | 
			
		||||
    foreach my $iid (keys %$description){
 | 
			
		||||
        my $desc = $description->{$iid};
 | 
			
		||||
        next unless defined $desc;
 | 
			
		||||
 | 
			
		||||
	$desc  = $1 if $desc =~ /(^[A-Z]\d+)/;
 | 
			
		||||
 | 
			
		||||
        $interfaces{$iid} = $desc;
 | 
			
		||||
    }
 | 
			
		||||
    foreach my $iid (keys %$vlan_ids){
 | 
			
		||||
        my $vlan = $vlan_ids->{$iid};
 | 
			
		||||
        next unless defined $vlan;
 | 
			
		||||
        my $vlan_if = $vlan_idx->{$iid};
 | 
			
		||||
        next unless defined $vlan_if;
 | 
			
		||||
	
 | 
			
		||||
	my $desc = 'V' . $vlan;
 | 
			
		||||
 | 
			
		||||
        $interfaces{$vlan_if} = $desc;
 | 
			
		||||
    }    
 | 
			
		||||
    return \%interfaces;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_name {
 | 
			
		||||
    my $bayrs = shift;
 | 
			
		||||
    my $i_index = $bayrs->i_index();
 | 
			
		||||
    my $description = $bayrs->i_description();
 | 
			
		||||
    my $v_name  = $bayrs->wf_vlan_name();
 | 
			
		||||
    my $vlan_idx = $bayrs->wf_local_vlan_id();
 | 
			
		||||
 | 
			
		||||
    my %i_name;
 | 
			
		||||
    foreach my $iid (keys %$description){
 | 
			
		||||
        my $name = $description->{$iid};
 | 
			
		||||
        next unless defined $name;
 | 
			
		||||
        $i_name{$iid} = $name;
 | 
			
		||||
    }
 | 
			
		||||
    # Get VLAN Virtual Router Interfaces
 | 
			
		||||
    foreach my $vid (keys %$v_name){
 | 
			
		||||
        my $v_name = $v_name->{$vid};
 | 
			
		||||
	next unless defined $v_name;
 | 
			
		||||
        my $vlan_if = $vlan_idx->{$vid};
 | 
			
		||||
        next unless defined $vlan_if;
 | 
			
		||||
 | 
			
		||||
        $i_name{$vlan_if} = $v_name;
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_name;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_duplex {
 | 
			
		||||
    my $bayrs = shift;
 | 
			
		||||
    
 | 
			
		||||
    my $wf_cct = $bayrs->wf_csmacd_cct();
 | 
			
		||||
    my $wf_duplex = $bayrs->wf_duplex();
 | 
			
		||||
    
 | 
			
		||||
    my %i_duplex;
 | 
			
		||||
    foreach my $if (keys %$wf_cct){
 | 
			
		||||
        my $idx = $wf_cct->{$if};
 | 
			
		||||
        next unless defined $idx; 
 | 
			
		||||
        my $duplex = $wf_duplex->{$if};
 | 
			
		||||
        next unless defined $duplex; 
 | 
			
		||||
    
 | 
			
		||||
        my $string = 'half';
 | 
			
		||||
        $string = 'full' if $duplex =~ /duplex/i;
 | 
			
		||||
	
 | 
			
		||||
        $i_duplex{$idx}=$string; 
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_duplex;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_duplex_admin {
 | 
			
		||||
    my $bayrs = shift;
 | 
			
		||||
    
 | 
			
		||||
    my $wf_cct    = $bayrs->wf_csmacd_cct();
 | 
			
		||||
    my $wf_duplex = $bayrs->wf_duplex();
 | 
			
		||||
    my $wf_auto   = $bayrs->wf_auto();
 | 
			
		||||
    my $wf_slot   = $bayrs->wf_csmacd_slot();
 | 
			
		||||
    my $wf_conn   = $bayrs->wf_csmacd_conn();
 | 
			
		||||
 
 | 
			
		||||
    my %i_duplex_admin;
 | 
			
		||||
    foreach my $if (keys %$wf_cct){
 | 
			
		||||
        my $idx = $wf_cct->{$if};
 | 
			
		||||
        next unless defined $idx;
 | 
			
		||||
        my $duplex = $wf_duplex->{$if};
 | 
			
		||||
        next unless defined $duplex; 
 | 
			
		||||
	my $slot = $wf_slot->{$if};
 | 
			
		||||
	my $conn = $wf_conn->{$if};
 | 
			
		||||
	my $auto_idx = "$slot.$conn";
 | 
			
		||||
	my $auto = $wf_auto->{$auto_idx};
 | 
			
		||||
	
 | 
			
		||||
	my $string = 'other';
 | 
			
		||||
	if ($auto) {
 | 
			
		||||
	    $string = 'half';
 | 
			
		||||
	    $string = 'full' if $auto =~ /duplex/i;
 | 
			
		||||
	    $string = 'auto' if $auto =~ /nway/i;
 | 
			
		||||
	}
 | 
			
		||||
	elsif ($duplex) {
 | 
			
		||||
	    $string = 'half';	
 | 
			
		||||
	    $string = 'full' if $duplex =~ /duplex/i;	
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
        $i_duplex_admin{$idx}=$string; 
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_duplex_admin;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_vlan {
 | 
			
		||||
    my $bayrs = shift;
 | 
			
		||||
 | 
			
		||||
    my $wf_cct		= $bayrs->wf_csmacd_cct();
 | 
			
		||||
    my $wf_mtu		= $bayrs->wf_csmacd_mtu();
 | 
			
		||||
    my $wf_line		= $bayrs->wf_csmacd_line();
 | 
			
		||||
    my $wf_local_vid	= $bayrs->wf_local_vlan_id();
 | 
			
		||||
    my $wf_global_vid	= $bayrs->wf_global_vlan_id();
 | 
			
		||||
    my $wf_vport	= $bayrs->wf_vlan_port();
 | 
			
		||||
 | 
			
		||||
    my %i_vlan;
 | 
			
		||||
    # Look for VLANs on Ethernet Interfaces
 | 
			
		||||
    foreach my $if (keys %$wf_cct){
 | 
			
		||||
        my $idx = $wf_cct->{$if};
 | 
			
		||||
	next unless defined $idx;
 | 
			
		||||
	# Check MTU size, if unable to carry VLAN tag skip.
 | 
			
		||||
	my $mtu = $wf_mtu->{$if};
 | 
			
		||||
        next if (($mtu =~ /default/i) or ($mtu < 1522));
 | 
			
		||||
	my $line = $wf_line->{$if};
 | 
			
		||||
	my @vlans = ();
 | 
			
		||||
	foreach my $v_idx (keys %$wf_vport){
 | 
			
		||||
	    my $port = $wf_vport->{$v_idx};
 | 
			
		||||
	    next unless defined $port;
 | 
			
		||||
	    next if ($port != $line);
 | 
			
		||||
	    	    
 | 
			
		||||
	    my $vlan = $wf_global_vid->{$v_idx};
 | 
			
		||||
	    push(@vlans, $vlan);
 | 
			
		||||
	}
 | 
			
		||||
	my $vlans = join (',', @vlans);    
 | 
			
		||||
	$i_vlan{$idx}=$vlans; 
 | 
			
		||||
    }
 | 
			
		||||
    # Add VLAN on VLAN Interfaces
 | 
			
		||||
    foreach my $idx (keys %$wf_global_vid){
 | 
			
		||||
        my $v_if = $wf_local_vid->{$idx};
 | 
			
		||||
	next unless defined $v_if;
 | 
			
		||||
        my $vlan = $wf_global_vid->{$idx};
 | 
			
		||||
	next unless defined $vlan;
 | 
			
		||||
	
 | 
			
		||||
        $i_vlan{$v_if}=$vlan; 
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_vlan;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub root_ip {
 | 
			
		||||
    my $bayrs = shift;
 | 
			
		||||
 | 
			
		||||
    my $ip_index	= $bayrs->ip_index();
 | 
			
		||||
    my $ip_table	= $bayrs->ip_table();
 | 
			
		||||
    
 | 
			
		||||
    # Check for CLIP
 | 
			
		||||
    foreach my $entry (keys %$ip_index){
 | 
			
		||||
        my $idx = $ip_index->{$entry};
 | 
			
		||||
	next unless $idx == 0;
 | 
			
		||||
	my $clip = $ip_table->{$entry};
 | 
			
		||||
	next unless ((defined $clip) and ($clip eq '0.0.0.0'));
 | 
			
		||||
	print " SNMP::Layer3::BayRS::root_ip() using $clip\n" if $DEBUG;
 | 
			
		||||
	return $clip;
 | 
			
		||||
    }
 | 
			
		||||
    # Check for OSPF Router ID
 | 
			
		||||
    my $ospf_ip  = $bayrs->ospf_rtr_id();
 | 
			
		||||
    if ((defined $ospf_ip) and ($ospf_ip ne '0.0.0.0')) {
 | 
			
		||||
	print " SNMP::Layer3::BayRS::root_ip() using $ospf_ip\n" if $DEBUG;
 | 
			
		||||
	return $ospf_ip;
 | 
			
		||||
    }
 | 
			
		||||
    # Else Return First IP Address
 | 
			
		||||
    foreach my $entry (keys %$ip_table){
 | 
			
		||||
        my $ip = $ip_table->{$entry};
 | 
			
		||||
        print " SNMP::Layer3::BayRS::root_ip() using $ip\n" if $DEBUG;
 | 
			
		||||
        next unless $ip;
 | 
			
		||||
        return $ip if ($ip ne '0.0.0.0');
 | 
			
		||||
    }
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
__END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::Layer3::BayRS - Perl5 Interface to Nortel Networks' routers running BayRS.
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
Eric Miller (C<eric@jeneric.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you. 
 | 
			
		||||
 my $bayrs = 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      = $bayrs->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Abstraction subclass for routers running Nortel Networks' BayRS.  
 | 
			
		||||
 | 
			
		||||
For speed or debugging purposes you can call the subclass directly, but not after determining
 | 
			
		||||
a more specific class using the method above. 
 | 
			
		||||
 | 
			
		||||
 my $bayrs = new SNMP::Info::Layer3::BayRS(...);
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Bridge
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item Wellfleet-HARDWARE-MIB
 | 
			
		||||
 | 
			
		||||
=item Wellfleet-OSPF-MIB
 | 
			
		||||
 | 
			
		||||
=item Wellfleet-DOT1QTAG-CONFIG-MIB
 | 
			
		||||
 | 
			
		||||
=item Wellfleet-CSMACD-MIB
 | 
			
		||||
 | 
			
		||||
=item Inherited Classes' MIBs
 | 
			
		||||
 | 
			
		||||
See SNMP::Info for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::Bridge for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
MIBs can be found on the CD that came with your product.
 | 
			
		||||
 | 
			
		||||
Or, they can be downloaded directly from Nortel Networks regardless of support
 | 
			
		||||
contract status.  Go to http://www.nortelnetworks.com Techninal Support, Browse
 | 
			
		||||
Technical Support, Select by Product Families, BayRS Router Software,
 | 
			
		||||
Router Software v 15.x, Software.  Filter on mibs and download the latest
 | 
			
		||||
version's archive.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar value from SNMP
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $bayrs->model()
 | 
			
		||||
 | 
			
		||||
Returns the model of the BayRS router.  Will translate between the MIB model and 
 | 
			
		||||
the common model with this map :
 | 
			
		||||
 | 
			
		||||
%MODEL_MAP = ( 
 | 
			
		||||
	'acefn' => 'FN',
 | 
			
		||||
	'aceln' => 'LN',
 | 
			
		||||
	'acecn' => 'CN',
 | 
			
		||||
	'afn' => 'AFN',
 | 
			
		||||
	'in' => 'IN',
 | 
			
		||||
	'an' => 'AN',
 | 
			
		||||
	'arn' => 'ARN',
 | 
			
		||||
	'sys5000' => '5000',
 | 
			
		||||
	'freln' => 'BLN',
 | 
			
		||||
	'frecn' => 'BCN',
 | 
			
		||||
	'frerbln' => 'BLN-2',
 | 
			
		||||
	'asn' => 'ASN',
 | 
			
		||||
	'asnzcable' => 'ASN-Z',
 | 
			
		||||
	'asnbcable' => 'ASN-B',
 | 
			
		||||
             );
 | 
			
		||||
 | 
			
		||||
=item $bayrs->vendor()
 | 
			
		||||
 | 
			
		||||
Returns 'Nortel'
 | 
			
		||||
 | 
			
		||||
=item $bayrs->os()
 | 
			
		||||
 | 
			
		||||
Returns 'BayRS'
 | 
			
		||||
 | 
			
		||||
=item $bayrs->os_ver()
 | 
			
		||||
 | 
			
		||||
Returns the software version extracted from B<sysDescr>
 | 
			
		||||
 | 
			
		||||
=item $bayrs->serial()
 | 
			
		||||
 | 
			
		||||
Returns (B<wfHwBpSerialNumber>) after conversion to ASCII decimal
 | 
			
		||||
 | 
			
		||||
=item $bayrs->root_ip()
 | 
			
		||||
 | 
			
		||||
Returns the primary IP used to communicate with the router.
 | 
			
		||||
 | 
			
		||||
Returns the first found:  CLIP (CircuitLess IP), (B<wfOspfRouterId>), or the first
 | 
			
		||||
IP interface.
 | 
			
		||||
 | 
			
		||||
=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 $bayrs->interfaces()
 | 
			
		||||
 | 
			
		||||
Returns reference to the map between IID and physical Port.
 | 
			
		||||
 | 
			
		||||
The physical port name is stripped to letter and numbers to signify
 | 
			
		||||
port type and slot port (S11) if the default platform naming was 
 | 
			
		||||
maintained.  Otherwise the port is the interface description. 
 | 
			
		||||
 | 
			
		||||
=item $bayrs->i_name()
 | 
			
		||||
 | 
			
		||||
Returns (B<ifDescr>) along with VLAN name (B<wfDot1qTagCfgVlanName>) for VLAN
 | 
			
		||||
interfaces.
 | 
			
		||||
 | 
			
		||||
=item $bayrs->i_duplex()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Maps port operational duplexes to IIDs for Ethernet
 | 
			
		||||
interfaces. 
 | 
			
		||||
 | 
			
		||||
=item $bayrs->i_duplex_admin()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Maps port admin duplexes to IIDs for Ethernet interfaces.
 | 
			
		||||
 | 
			
		||||
=item $bayrs->i_vlan()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Maps port VLAN ID to IIDs.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 RFC1213 Arp Cache Table (B<ipNetToMediaTable>)
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $bayrs->at_index()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Maps ARP table entries to Interface IIDs 
 | 
			
		||||
 | 
			
		||||
(B<ipNetToMediaIfIndex>)
 | 
			
		||||
 | 
			
		||||
=item $bayrs->at_paddr()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Maps ARP table entries to MAC addresses. 
 | 
			
		||||
 | 
			
		||||
(B<ipNetToMediaPhysAddress>)
 | 
			
		||||
 | 
			
		||||
=item $bayrs->at_netaddr()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Maps ARP table entries to IPs 
 | 
			
		||||
 | 
			
		||||
(B<ipNetToMediaNetAddress>)
 | 
			
		||||
 | 
			
		||||
=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
 | 
			
		||||
@@ -1,8 +1,8 @@
 | 
			
		||||
# 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
 | 
			
		||||
# Copyright (c) 2003  Max Baker
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
# 
 | 
			
		||||
# Redistribution and use in source and binary forms, with or without 
 | 
			
		||||
@@ -29,7 +29,7 @@
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::Layer3::C3550;
 | 
			
		||||
$VERSION = 0.7;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
@@ -115,6 +115,10 @@ sub ports {
 | 
			
		||||
    return $ports2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub cisco_comm_indexing {
 | 
			
		||||
    1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
__END__
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
# SNMP::Info::Layer3::C6500
 | 
			
		||||
# Max Baker <max@warped.org>
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2003  Max Baker
 | 
			
		||||
# Copyright (c) 2003,2004 Max Baker
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
# 
 | 
			
		||||
# Redistribution and use in source and binary forms, with or without 
 | 
			
		||||
@@ -28,7 +28,7 @@
 | 
			
		||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
package SNMP::Info::Layer3::C6500;
 | 
			
		||||
$VERSION = 0.7;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
@@ -93,6 +93,11 @@ sub vendor {
 | 
			
		||||
    return 'cisco';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub cisco_comm_indexing {
 | 
			
		||||
    1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
__END__
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										158
									
								
								Info/Layer3/Cisco.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										158
									
								
								Info/Layer3/Cisco.pm
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,158 @@
 | 
			
		||||
# SNMP::Info::Layer3::Cisco
 | 
			
		||||
# Max Baker <max@warped.org>
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2004 Max Baker
 | 
			
		||||
# 
 | 
			
		||||
# 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::Layer3::Cisco;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
use Exporter;
 | 
			
		||||
use SNMP::Info::Layer3;
 | 
			
		||||
use SNMP::Info::CiscoVTP;
 | 
			
		||||
 | 
			
		||||
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
 | 
			
		||||
@SNMP::Info::Layer3::Cisco::ISA = qw/SNMP::Info::Layer3 SNMP::Info::CiscoVTP Exporter/;
 | 
			
		||||
@SNMP::Info::Layer3::Cisco::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,
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
            %SNMP::Info::Layer3::GLOBALS,
 | 
			
		||||
            %SNMP::Info::CiscoVTP::GLOBALS,
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%FUNCS = (
 | 
			
		||||
            %SNMP::Info::Layer3::FUNCS,
 | 
			
		||||
            %SNMP::Info::CiscoVTP::FUNCS,
 | 
			
		||||
         );
 | 
			
		||||
 | 
			
		||||
%MUNGE = (
 | 
			
		||||
            # Inherit all the built in munging
 | 
			
		||||
            %SNMP::Info::Layer3::MUNGE,
 | 
			
		||||
            %SNMP::Info::CiscoVTP::MUNGE,
 | 
			
		||||
         );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
__END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::Layer3::Cisco - Perl5 Interface to Generic L3 Cisco Device
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
Max Baker (C<max@warped.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you. 
 | 
			
		||||
 my $cisco = 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      = $cisco->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Subclass for Generic Cisco Routers running IOS
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Layer3
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::CiscoVTP
 | 
			
		||||
 | 
			
		||||
=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.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar value from SNMP
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $cisco->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.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
=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.
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
							
								
								
									
										347
									
								
								Info/Layer3/Contivity.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										347
									
								
								Info/Layer3/Contivity.pm
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,347 @@
 | 
			
		||||
# SNMP::Info::Layer3::Contivity
 | 
			
		||||
# Eric Miller <eric@jeneric.org>
 | 
			
		||||
# $Id$
 | 
			
		||||
#
 | 
			
		||||
# 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 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::Layer3::Contivity;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
use Exporter;
 | 
			
		||||
use SNMP::Info;
 | 
			
		||||
use SNMP::Info::Entity;
 | 
			
		||||
 | 
			
		||||
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
 | 
			
		||||
 | 
			
		||||
@SNMP::Info::Layer3::Contivity::ISA = qw/SNMP::Info SNMP::Info::Entity Exporter/;
 | 
			
		||||
@SNMP::Info::Layer3::Contivity::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
$DEBUG=0;
 | 
			
		||||
 | 
			
		||||
# See SNMP::Info for the details of these data structures and 
 | 
			
		||||
# the interworkings.
 | 
			
		||||
$INIT = 0;
 | 
			
		||||
 | 
			
		||||
%MIBS = (
 | 
			
		||||
         %SNMP::Info::MIBS,
 | 
			
		||||
         %SNMP::Info::Entity::MIBS,
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
           %SNMP::Info::GLOBALS,
 | 
			
		||||
           %SNMP::Info::Entity::GLOBALS,
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%FUNCS = (
 | 
			
		||||
          %SNMP::Info::FUNCS,
 | 
			
		||||
          %SNMP::Info::Entity::FUNCS,
 | 
			
		||||
          'i_name2'     => 'ifName',
 | 
			
		||||
          # From RFC1213-MIB
 | 
			
		||||
          'at_index'    => 'ipNetToMediaIfIndex',
 | 
			
		||||
          'at_paddr'    => 'ipNetToMediaPhysAddress',
 | 
			
		||||
          'at_netaddr'  => 'ipNetToMediaNetAddress',
 | 
			
		||||
         );
 | 
			
		||||
         
 | 
			
		||||
%MUNGE = (
 | 
			
		||||
          %SNMP::Info::MUNGE,
 | 
			
		||||
          %SNMP::Info::Entity::MUNGE,
 | 
			
		||||
          'at_paddr' => \&SNMP::Info::munge_mac,
 | 
			
		||||
         );
 | 
			
		||||
 | 
			
		||||
sub layers {
 | 
			
		||||
    return '00000100';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vendor {
 | 
			
		||||
    return 'nortel';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub model {
 | 
			
		||||
    my $contivity = shift;
 | 
			
		||||
    my $e_model = $contivity->e_model() || {};
 | 
			
		||||
 | 
			
		||||
    my $model = $e_model->{1} || undef;
 | 
			
		||||
    
 | 
			
		||||
    return $1 if (defined $model and $model =~ /(CES\d+)/i);
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os {
 | 
			
		||||
    return 'contivity';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os_ver {
 | 
			
		||||
    my $contivity = shift;
 | 
			
		||||
    my $descr = $contivity->description();
 | 
			
		||||
    return undef unless defined $descr;
 | 
			
		||||
 | 
			
		||||
    if ($descr =~ m/V(\d+_\d+\.\d+)/i){
 | 
			
		||||
        return $1;
 | 
			
		||||
    }
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub mac {
 | 
			
		||||
    my $contivity = shift;
 | 
			
		||||
    my $i_mac = $contivity->i_mac();
 | 
			
		||||
 | 
			
		||||
# Return Interface MAC   
 | 
			
		||||
    foreach my $entry (keys %$i_mac){
 | 
			
		||||
        my $sn = $i_mac->{$entry};
 | 
			
		||||
        next unless $sn;
 | 
			
		||||
        return $sn;
 | 
			
		||||
    }
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub serial {
 | 
			
		||||
    my $contivity = shift;
 | 
			
		||||
    my $e_serial = $contivity->e_serial() || {};
 | 
			
		||||
 | 
			
		||||
    my $serial = $e_serial->{1} || undef;
 | 
			
		||||
    
 | 
			
		||||
    return $1 if (defined $serial and $serial =~ /(\d+)/);
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
sub interfaces {
 | 
			
		||||
    my $contivity = shift;
 | 
			
		||||
    my $description = $contivity->i_description();
 | 
			
		||||
    
 | 
			
		||||
    my %interfaces = ();
 | 
			
		||||
    foreach my $iid (keys %$description){
 | 
			
		||||
        my $desc = $description->{$iid};
 | 
			
		||||
        # Skip everything except Ethernet interfaces
 | 
			
		||||
        next unless (defined $desc and $desc =~ /fe/i);
 | 
			
		||||
 | 
			
		||||
        $interfaces{$iid} = $desc;
 | 
			
		||||
    }
 | 
			
		||||
    return \%interfaces;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_name {
 | 
			
		||||
    my $contivity = shift;
 | 
			
		||||
    my $i_name2 = $contivity->i_name2();
 | 
			
		||||
    
 | 
			
		||||
    my %i_name;
 | 
			
		||||
    foreach my $iid (keys %$i_name2){
 | 
			
		||||
	my $name = $i_name2->{$iid};
 | 
			
		||||
       #Skip everything except Ethernet interfaces
 | 
			
		||||
	next unless (defined $name and $name =~ /fe/i);
 | 
			
		||||
	
 | 
			
		||||
	$name = $1 if $name =~ /(fei\.\d+\.\d+)/;
 | 
			
		||||
	
 | 
			
		||||
	$i_name{$iid} = $name;
 | 
			
		||||
     }
 | 
			
		||||
     return \%i_name;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub root_ip {
 | 
			
		||||
    my $contivity = shift;
 | 
			
		||||
    my $ip_table = $contivity->ip_table();
 | 
			
		||||
 | 
			
		||||
# Return First IP Address    
 | 
			
		||||
    foreach my $entry (keys %$ip_table){
 | 
			
		||||
        my $router_ip = $ip_table->{$entry};
 | 
			
		||||
        print " SNMP::Layer3::Contivity::root_ip() using $router_ip\n" if $DEBUG;
 | 
			
		||||
        next unless $router_ip;
 | 
			
		||||
        return $router_ip if ($router_ip ne '0.0.0.0');
 | 
			
		||||
    }
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
__END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::Layer3::Contivity - Perl5 Interface to Nortel Networks' Contivity
 | 
			
		||||
Extranet Switches (CES).
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
Eric Miller (C<eric@jeneric.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you. 
 | 
			
		||||
 my $contivity = 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      = $contivity->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Abstraction subclass for Nortel Networks' Contivity Extranet Switch (CES).  
 | 
			
		||||
 | 
			
		||||
For speed or debugging purposes you can call the subclass directly, but not after determining
 | 
			
		||||
a more specific class using the method above. 
 | 
			
		||||
 | 
			
		||||
 my $contivity = new SNMP::Info::Layer3::Contivity(...);
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Entity
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item Inherited Classes' MIBs
 | 
			
		||||
 | 
			
		||||
See SNMP::Info for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::Entity for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar value from SNMP
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $contivity->vendor()
 | 
			
		||||
 | 
			
		||||
Returns 'Nortel'
 | 
			
		||||
 | 
			
		||||
=item $contivity->model()
 | 
			
		||||
 | 
			
		||||
Returns the chassis name.
 | 
			
		||||
 | 
			
		||||
(B<entPhysicalModelName.1>)
 | 
			
		||||
 | 
			
		||||
=item $contivity->os()
 | 
			
		||||
 | 
			
		||||
Returns 'CES'
 | 
			
		||||
 | 
			
		||||
=item $contivity->os_ver()
 | 
			
		||||
 | 
			
		||||
Returns the software version extracted from (B<sysDescr>).
 | 
			
		||||
 | 
			
		||||
=item $contivity->serial()
 | 
			
		||||
 | 
			
		||||
Returns the chassis serial number.
 | 
			
		||||
 | 
			
		||||
(B<entPhysicalSerialNum.1>)
 | 
			
		||||
 | 
			
		||||
=item $contivity->mac()
 | 
			
		||||
 | 
			
		||||
Returns the MAC address of the first Ethernet Interface.
 | 
			
		||||
 | 
			
		||||
=item $contivity->root_ip()
 | 
			
		||||
 | 
			
		||||
Returns the primary IP used to communicate with the router.  Returns the first
 | 
			
		||||
IP interface.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Overrides
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $contivity->layers()
 | 
			
		||||
 | 
			
		||||
Returns 00000100.  Contivity does not support bridge MIB, so override reported
 | 
			
		||||
layers.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Globals imported from SNMP::Info
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info for details.
 | 
			
		||||
 | 
			
		||||
=head2 Globals imported from SNMP::Info::Entity
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Entity 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 $contivity->interfaces()
 | 
			
		||||
 | 
			
		||||
Returns reference to the map between IID and physical Port.  Skips loopback and
 | 
			
		||||
tunnel interfaces.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 RFC1213 Arp Cache Table (B<ipNetToMediaTable>)
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $contivity->at_index()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Maps ARP table entries to Interface IIDs 
 | 
			
		||||
 | 
			
		||||
(B<ipNetToMediaIfIndex>)
 | 
			
		||||
 | 
			
		||||
=item $contivity->at_paddr()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Maps ARP table entries to MAC addresses. 
 | 
			
		||||
 | 
			
		||||
(B<ipNetToMediaPhysAddress>)
 | 
			
		||||
 | 
			
		||||
=item $contivity->at_netaddr()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Maps ARP table entries to IPs 
 | 
			
		||||
 | 
			
		||||
(B<ipNetToMediaNetAddress>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info for details.
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::Entity
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::Entity 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.6;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
@@ -36,10 +38,11 @@ use strict;
 | 
			
		||||
use Exporter;
 | 
			
		||||
use SNMP::Info;
 | 
			
		||||
use SNMP::Info::Bridge;
 | 
			
		||||
use SNMP::Info::FDP;
 | 
			
		||||
 | 
			
		||||
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
 | 
			
		||||
 | 
			
		||||
@SNMP::Info::Layer3::Foundry::ISA = qw/SNMP::Info SNMP::Info::Bridge Exporter/;
 | 
			
		||||
@SNMP::Info::Layer3::Foundry::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::FDP Exporter/;
 | 
			
		||||
@SNMP::Info::Layer3::Foundry::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
$DEBUG=0;
 | 
			
		||||
@@ -49,6 +52,7 @@ $INIT = 0;
 | 
			
		||||
 | 
			
		||||
%MIBS = ( %SNMP::Info::MIBS,
 | 
			
		||||
          %SNMP::Info::Bridge::MIBS,
 | 
			
		||||
          %SNMP::Info::FDP::MIBS,
 | 
			
		||||
          'FOUNDRY-SN-ROOT-MIB' => 'foundry',
 | 
			
		||||
          # IP-FORWARD-MIB
 | 
			
		||||
          # ETHERLIKE-MIB
 | 
			
		||||
@@ -61,6 +65,7 @@ $INIT = 0;
 | 
			
		||||
            # Inherit the super class ones
 | 
			
		||||
            %SNMP::Info::GLOBALS,
 | 
			
		||||
            %SNMP::Info::Bridge::GLOBALS,
 | 
			
		||||
            %SNMP::Info::FDP::GLOBALS,
 | 
			
		||||
            'mac'        => 'ifPhysAddress.1',
 | 
			
		||||
            'chassis'    => 'entPhysicalDescr.1',
 | 
			
		||||
            'serial'     => 'snChasSerNum',
 | 
			
		||||
@@ -78,6 +83,7 @@ $INIT = 0;
 | 
			
		||||
%FUNCS   = (
 | 
			
		||||
            %SNMP::Info::FUNCS,
 | 
			
		||||
            %SNMP::Info::Bridge::FUNCS,
 | 
			
		||||
            %SNMP::Info::FDP::FUNCS,
 | 
			
		||||
            'i_name2'    => 'ifName',
 | 
			
		||||
            # From RFC1213-MIB
 | 
			
		||||
            'at_index'    => 'ipNetToMediaIfIndex',
 | 
			
		||||
@@ -95,6 +101,7 @@ $INIT = 0;
 | 
			
		||||
            # Inherit all the built in munging
 | 
			
		||||
            %SNMP::Info::MUNGE,
 | 
			
		||||
            %SNMP::Info::Bridge::MUNGE,
 | 
			
		||||
            %SNMP::Info::FDP::MUNGE,
 | 
			
		||||
            'at_paddr' => \&SNMP::Info::munge_mac,
 | 
			
		||||
         );
 | 
			
		||||
 | 
			
		||||
@@ -199,6 +206,28 @@ sub model {
 | 
			
		||||
    return $model;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os {
 | 
			
		||||
    my $foundry = shift;
 | 
			
		||||
    my $descr = $foundry->description();
 | 
			
		||||
    if ($descr =~ m/IronWare/i) {
 | 
			
		||||
        return 'IronWare';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return 'foundry';
 | 
			
		||||
}
 | 
			
		||||
sub os_ver {
 | 
			
		||||
    my $foundry = shift;
 | 
			
		||||
    my $os_version = $foundry->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 = $foundry->description();
 | 
			
		||||
    if ($descr =~ m/Version (\d\S*)/) {
 | 
			
		||||
        return $1;
 | 
			
		||||
    }
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# $foundry->interfaces() - Map the Interfaces to their physical names
 | 
			
		||||
sub interfaces {
 | 
			
		||||
    my $foundry = shift;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										653
									
								
								Info/Layer3/Passport.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										653
									
								
								Info/Layer3/Passport.pm
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,653 @@
 | 
			
		||||
# SNMP::Info::Layer3::Passport
 | 
			
		||||
# Eric Miller <eric@jeneric.org>
 | 
			
		||||
# $Id$
 | 
			
		||||
#
 | 
			
		||||
# 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 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::Layer3::Passport;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
use Exporter;
 | 
			
		||||
use SNMP::Info;
 | 
			
		||||
use SNMP::Info::Bridge;
 | 
			
		||||
use SNMP::Info::SONMP;
 | 
			
		||||
use SNMP::Info::RapidCity;
 | 
			
		||||
 | 
			
		||||
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
 | 
			
		||||
 | 
			
		||||
@SNMP::Info::Layer3::Passport::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::SONMP SNMP::Info::RapidCity Exporter/;
 | 
			
		||||
@SNMP::Info::Layer3::Passport::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
$DEBUG=0;
 | 
			
		||||
 | 
			
		||||
# See SNMP::Info for the details of these data structures and 
 | 
			
		||||
# the interworkings.
 | 
			
		||||
 | 
			
		||||
$INIT = 0;
 | 
			
		||||
 | 
			
		||||
%MIBS = (
 | 
			
		||||
         %SNMP::Info::MIBS,
 | 
			
		||||
         %SNMP::Info::Bridge::MIBS,
 | 
			
		||||
         %SNMP::Info::SONMP::MIBS,
 | 
			
		||||
         %SNMP::Info::RapidCity::MIBS,
 | 
			
		||||
         'OSPF-MIB'     => 'ospfRouterId',
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
            %SNMP::Info::GLOBALS,
 | 
			
		||||
            %SNMP::Info::Bridge::GLOBALS,
 | 
			
		||||
            %SNMP::Info::SONMP::GLOBALS,
 | 
			
		||||
            %SNMP::Info::RapidCity::GLOBALS,            
 | 
			
		||||
            'router_ip' => 'ospfRouterId'
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
%FUNCS = (
 | 
			
		||||
          %SNMP::Info::FUNCS,
 | 
			
		||||
          %SNMP::Info::Bridge::FUNCS,
 | 
			
		||||
          %SNMP::Info::SONMP::FUNCS,
 | 
			
		||||
          %SNMP::Info::RapidCity::FUNCS,
 | 
			
		||||
          'i_index2'            => 'ifIndex',
 | 
			
		||||
          'i_mac2'              => 'ifPhysAddress',
 | 
			
		||||
	  'i_description2'      => 'ifDescr',
 | 
			
		||||
          'i_name2'             => 'ifName',
 | 
			
		||||
          'ip_index2'           => 'ipAdEntIfIndex',
 | 
			
		||||
           # From RFC1213-MIB
 | 
			
		||||
          'at_index'    => 'ipNetToMediaIfIndex',
 | 
			
		||||
          'at_paddr'    => 'ipNetToMediaPhysAddress',
 | 
			
		||||
          'at_netaddr'  => 'ipNetToMediaNetAddress',
 | 
			
		||||
	  'i_name2'	=> 'ifName'
 | 
			
		||||
         );
 | 
			
		||||
         
 | 
			
		||||
%MUNGE = (
 | 
			
		||||
            %SNMP::Info::MUNGE,
 | 
			
		||||
            %SNMP::Info::Bridge::MUNGE,
 | 
			
		||||
            %SNMP::Info::SONMP::MUNGE,
 | 
			
		||||
            %SNMP::Info::RapidCity::MUNGE,
 | 
			
		||||
            'i_mac2' => \&SNMP::Info::munge_mac,
 | 
			
		||||
            'at_paddr' => \&SNMP::Info::munge_mac,
 | 
			
		||||
         );
 | 
			
		||||
 | 
			
		||||
sub model {
 | 
			
		||||
    my $passport = shift;
 | 
			
		||||
    my $desc = $passport->description();
 | 
			
		||||
    return undef unless defined $desc;
 | 
			
		||||
 | 
			
		||||
    return '8603' if ($desc =~ /8603/);
 | 
			
		||||
    return '8606' if ($desc =~ /8606/);
 | 
			
		||||
    return '8610co' if ($desc =~ /8610co/);
 | 
			
		||||
    return '8610' if ($desc =~ /8610/);
 | 
			
		||||
    
 | 
			
		||||
    return $desc;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub vendor {
 | 
			
		||||
    return 'nortel';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os {
 | 
			
		||||
    return 'passport';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os_ver {
 | 
			
		||||
    my $passport = shift;
 | 
			
		||||
    my $descr = $passport->description();
 | 
			
		||||
    return undef unless defined $descr;
 | 
			
		||||
 | 
			
		||||
    if ($descr =~ m/(\d+\.\d+\.\d+\.\d+)/){
 | 
			
		||||
        return $1;
 | 
			
		||||
    }
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_index {
 | 
			
		||||
    my $passport = shift;
 | 
			
		||||
    my $i_index = $passport->i_index2();
 | 
			
		||||
    my $vlan_index = $passport->rc_vlan_if();
 | 
			
		||||
    my $cpu_index = $passport->rc_cpu_ifindex();
 | 
			
		||||
    my $virt_ip = $passport->rc_virt_ip();
 | 
			
		||||
    
 | 
			
		||||
    my %if_index;
 | 
			
		||||
    foreach my $iid (keys %$i_index){
 | 
			
		||||
        my $index = $i_index->{$iid};
 | 
			
		||||
        next unless defined $index;
 | 
			
		||||
        
 | 
			
		||||
       	$if_index{$iid} = $index;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    # Get VLAN Virtual Router Interfaces
 | 
			
		||||
    foreach my $vid (keys %$vlan_index){
 | 
			
		||||
        my $v_index = $vlan_index->{$vid};
 | 
			
		||||
        next unless defined $v_index;
 | 
			
		||||
        next if $v_index == 0;
 | 
			
		||||
 | 
			
		||||
        $if_index{$v_index} = $v_index;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    # Get CPU Ethernet Interfaces
 | 
			
		||||
    foreach my $cid (keys %$cpu_index){
 | 
			
		||||
        my $c_index = $cpu_index->{$cid};
 | 
			
		||||
        next unless defined $c_index;
 | 
			
		||||
        next if $c_index == 0;
 | 
			
		||||
 | 
			
		||||
        $if_index{$c_index} = $c_index;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    # Check for Virtual Mgmt Interface
 | 
			
		||||
    unless ($virt_ip eq '0.0.0.0') {
 | 
			
		||||
        # Make up an index number, 1 is not reserved AFAIK
 | 
			
		||||
        $if_index{1} = 1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return \%if_index;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub interfaces {
 | 
			
		||||
    my $passport = shift;
 | 
			
		||||
    my $i_index = $passport->i_index();
 | 
			
		||||
    my $vlan_id = $passport->rc_vlan_id();
 | 
			
		||||
    my $vlan_index = $passport->rc_vlan_if();
 | 
			
		||||
    my $model = $passport->model();
 | 
			
		||||
 | 
			
		||||
    my %reverse_vlan = reverse %$vlan_index;
 | 
			
		||||
    
 | 
			
		||||
    my %if;
 | 
			
		||||
    foreach my $iid (keys %$i_index){
 | 
			
		||||
        my $index = $i_index->{$iid};
 | 
			
		||||
        next unless defined $index;
 | 
			
		||||
 | 
			
		||||
        if ($index == 1) {
 | 
			
		||||
        $if{$index} = 'CPU.Virtual';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        elsif (($index == 192) and ($model eq '8603')) {
 | 
			
		||||
              $if{$index} = 'CPU3';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        elsif ($index == 320) {
 | 
			
		||||
        $if{$index} = 'CPU5';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        elsif ($index == 384) {
 | 
			
		||||
        $if{$index} = 'CPU6';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        elsif ($index > 2000) {
 | 
			
		||||
        my $vlan_index = $reverse_vlan{$iid};
 | 
			
		||||
        my $v_id = $vlan_id->{$vlan_index};
 | 
			
		||||
        next unless defined $v_id;
 | 
			
		||||
 | 
			
		||||
       	my $v_port = 'V'."$v_id";
 | 
			
		||||
        $if{$index} = $v_port;
 | 
			
		||||
        }           
 | 
			
		||||
 | 
			
		||||
        else {
 | 
			
		||||
       	my $port = ($index % 64) + 1;
 | 
			
		||||
       	my $slot = int($index / 64);
 | 
			
		||||
 | 
			
		||||
        my $slotport = "$slot.$port";
 | 
			
		||||
        $if{$iid} = $slotport;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
    return \%if;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_mac {
 | 
			
		||||
    my $passport = shift;
 | 
			
		||||
    my $i_mac = $passport->i_mac2();
 | 
			
		||||
    my $vlan_mac = $passport->rc_vlan_mac();
 | 
			
		||||
    my $vlan_index = $passport->rc_vlan_if();
 | 
			
		||||
    my $cpu_mac = $passport->rc_cpu_mac();
 | 
			
		||||
    my $chassis_base_mac = $passport->rc_base_mac();
 | 
			
		||||
    my $virt_ip = $passport->rc_virt_ip();
 | 
			
		||||
 | 
			
		||||
    my %if_mac;
 | 
			
		||||
    foreach my $iid (keys %$i_mac){
 | 
			
		||||
        my $mac = $i_mac->{$iid};
 | 
			
		||||
        next unless defined $mac;
 | 
			
		||||
 | 
			
		||||
       	$if_mac{$iid} = $mac;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    # Get VLAN Virtual Router Interfaces
 | 
			
		||||
    foreach my $iid (keys %$vlan_mac){
 | 
			
		||||
        my $v_mac = $vlan_mac->{$iid};
 | 
			
		||||
        my $v_id  = $vlan_index->{$iid};
 | 
			
		||||
        next unless defined $v_mac;
 | 
			
		||||
 | 
			
		||||
        $if_mac{$v_id} = $v_mac;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    # Get CPU Ethernet Interfaces
 | 
			
		||||
    foreach my $iid (keys %$cpu_mac){
 | 
			
		||||
        my $mac = $cpu_mac->{$iid};
 | 
			
		||||
        next unless defined $mac;
 | 
			
		||||
 | 
			
		||||
       	$if_mac{$iid} = $mac;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    # Check for Virtual Mgmt Interface
 | 
			
		||||
    unless ($virt_ip eq '0.0.0.0'){
 | 
			
		||||
	my @virt_mac = split /:/, $chassis_base_mac;
 | 
			
		||||
        $virt_mac[0] = hex($virt_mac[0]);
 | 
			
		||||
        $virt_mac[1] = hex($virt_mac[1]);
 | 
			
		||||
        $virt_mac[2] = hex($virt_mac[2]);
 | 
			
		||||
        $virt_mac[3] = hex($virt_mac[3]);
 | 
			
		||||
        $virt_mac[4] = hex($virt_mac[4]) + 0x03;
 | 
			
		||||
        $virt_mac[5] = hex($virt_mac[5]) + 0xF8;
 | 
			
		||||
 | 
			
		||||
        my $mac = join(':',map { sprintf "%02x",$_ } @virt_mac);
 | 
			
		||||
 | 
			
		||||
       	$if_mac{1} = $mac;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return \%if_mac;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_description {
 | 
			
		||||
    my $passport = shift;
 | 
			
		||||
    my $i_descr = $passport->i_description2();
 | 
			
		||||
    my $v_descr = $passport->rc_vlan_name();
 | 
			
		||||
    my $vlan_index = $passport->rc_vlan_if();
 | 
			
		||||
 | 
			
		||||
    my %descr;
 | 
			
		||||
    foreach my $iid (keys %$i_descr){
 | 
			
		||||
        my $if_descr = $i_descr->{$iid};
 | 
			
		||||
        next unless defined $if_descr;
 | 
			
		||||
 | 
			
		||||
       	$descr{$iid} = $if_descr;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    # Get VLAN Virtual Router Interfaces
 | 
			
		||||
    foreach my $vid (keys %$v_descr){
 | 
			
		||||
        my $vl_descr = $v_descr->{$vid};
 | 
			
		||||
        my $v_id  = $vlan_index->{$vid};
 | 
			
		||||
        next unless defined $vl_descr;
 | 
			
		||||
 | 
			
		||||
        $descr{$v_id} = $vl_descr;
 | 
			
		||||
    }
 | 
			
		||||
    return \%descr;
 | 
			
		||||
}
 | 
			
		||||
    
 | 
			
		||||
sub i_name {
 | 
			
		||||
    my $passport = shift;
 | 
			
		||||
    my $i_index = $passport->i_index();
 | 
			
		||||
    my $rc_alias = $passport->rc_alias();
 | 
			
		||||
    my $i_name2  = $passport->i_name2();
 | 
			
		||||
    my $v_name = $passport->rc_vlan_name();
 | 
			
		||||
    my $vlan_index = $passport->rc_vlan_if();
 | 
			
		||||
    my $model = $passport->model();
 | 
			
		||||
    
 | 
			
		||||
    my %reverse_vlan = reverse %$vlan_index;
 | 
			
		||||
 | 
			
		||||
    my %i_name;
 | 
			
		||||
    foreach my $iid (keys %$i_index){
 | 
			
		||||
	
 | 
			
		||||
	if ($iid == 1) {
 | 
			
		||||
	    $i_name{$iid} = 'CPU Virtual Management IP';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        elsif (($iid == 192) and ($model eq '8603')) {
 | 
			
		||||
            $i_name{$iid} = 'CPU 3 Ethernet Port';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        elsif ($iid == 320) {
 | 
			
		||||
	    $i_name{$iid} = 'CPU 5 Ethernet Port';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        elsif ($iid == 384) {
 | 
			
		||||
	    $i_name{$iid} = 'CPU 5 Ethernet Port';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        elsif ($iid > 2000) {
 | 
			
		||||
	    my $vlan_index = $reverse_vlan{$iid};
 | 
			
		||||
	    my $vlan_name = $v_name->{$vlan_index};
 | 
			
		||||
	    next unless defined $vlan_name;
 | 
			
		||||
 | 
			
		||||
	    $i_name{$iid} = $vlan_name;
 | 
			
		||||
        }           
 | 
			
		||||
 | 
			
		||||
        else {
 | 
			
		||||
	    my $name = $i_name2->{$iid};
 | 
			
		||||
	    my $alias = $rc_alias->{$iid};
 | 
			
		||||
	    $i_name{$iid} = (defined $alias and $alias !~ /^\s*$/) ?
 | 
			
		||||
                        $alias : 
 | 
			
		||||
                        $name;
 | 
			
		||||
	}
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return \%i_name;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub ip_index {
 | 
			
		||||
    my $passport = shift;
 | 
			
		||||
    my $ip_index = $passport->ip_index2();
 | 
			
		||||
    my $cpu_ip = $passport->rc_cpu_ip();
 | 
			
		||||
    my $virt_ip = $passport->rc_virt_ip();
 | 
			
		||||
 | 
			
		||||
    my %ip_index;
 | 
			
		||||
    foreach my $ip (keys %$ip_index){
 | 
			
		||||
        my $iid  = $ip_index->{$ip};
 | 
			
		||||
        next unless defined $iid;
 | 
			
		||||
        
 | 
			
		||||
       	$ip_index{$ip} = $iid;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    # Get CPU Ethernet IP
 | 
			
		||||
    foreach my $cid (keys %$cpu_ip){
 | 
			
		||||
        my $c_ip = $cpu_ip->{$cid};
 | 
			
		||||
        next unless defined $c_ip;
 | 
			
		||||
 | 
			
		||||
        $ip_index{$c_ip} = $cid;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    # Get Virtual Mgmt IP
 | 
			
		||||
    $ip_index{$virt_ip} = 1;
 | 
			
		||||
    
 | 
			
		||||
    return \%ip_index;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub root_ip {
 | 
			
		||||
    my $passport = shift;
 | 
			
		||||
    my $rc_ip_addr = $passport->rc_ip_addr();
 | 
			
		||||
    my $rc_ip_type = $passport->rc_ip_type();
 | 
			
		||||
    my $virt_ip = $passport->rc_virt_ip();
 | 
			
		||||
    my $router_ip  = $passport->router_ip();
 | 
			
		||||
    my $sonmp_topo_port = $passport->sonmp_topo_port();
 | 
			
		||||
    my $sonmp_topo_ip = $passport->sonmp_topo_ip();
 | 
			
		||||
 | 
			
		||||
    # Return CLIP (CircuitLess IP)
 | 
			
		||||
    foreach my $iid (keys %$rc_ip_type){
 | 
			
		||||
        my $ip_type = $rc_ip_type->{$iid};
 | 
			
		||||
        next unless ((defined $ip_type) and ($ip_type =~ /circuitLess/i));
 | 
			
		||||
	my $ip = $rc_ip_addr->{$iid};
 | 
			
		||||
	next unless defined $ip;
 | 
			
		||||
		     
 | 
			
		||||
        return $ip;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    # Return Management Virtual IP address
 | 
			
		||||
    return $virt_ip if ((defined $virt_ip) and ($virt_ip ne '0.0.0.0'));
 | 
			
		||||
 | 
			
		||||
    # Return OSPF Router ID
 | 
			
		||||
    return $router_ip if ((defined $router_ip) and ($router_ip ne '0.0.0.0'));
 | 
			
		||||
 | 
			
		||||
    # Otherwise Return SONMP Advertised IP Address    
 | 
			
		||||
    foreach my $entry (keys %$sonmp_topo_port){
 | 
			
		||||
        my $port = $sonmp_topo_port->{$entry};
 | 
			
		||||
        next unless $port == 0;
 | 
			
		||||
        my $ip = $sonmp_topo_ip->{$entry};
 | 
			
		||||
	return $ip if ((defined $ip) and ($ip ne '0.0.0.0'));
 | 
			
		||||
    }
 | 
			
		||||
    return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Required for SNMP::Info::SONMP
 | 
			
		||||
sub index_factor {
 | 
			
		||||
    return 64;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub slot_offset {
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub port_offset {
 | 
			
		||||
    return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
__END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::Layer3::Passport - Perl5 Interface to Nortel Networks' Passport
 | 
			
		||||
8600 Series Switches
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
Eric Miller (C<eric@jeneric.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you. 
 | 
			
		||||
 my $passport = 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      = $passport->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
Abstraction subclass for Nortel Networks' Passport 8600 Series Switches.  
 | 
			
		||||
 | 
			
		||||
These devices run Passport OS but have some of the same charactersitics as the Baystack family. 
 | 
			
		||||
For example, extended interface information is gleened from RAPID-CITY.
 | 
			
		||||
 | 
			
		||||
For speed or debugging purposes you can call the subclass directly, but not after determining
 | 
			
		||||
a more specific class using the method above. 
 | 
			
		||||
 | 
			
		||||
 my $passport = new SNMP::Info::Layer3::Passport(...);
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::Bridge
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::SONMP
 | 
			
		||||
 | 
			
		||||
=item SNMP::Info::RapidCity
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item OSPF-MIB
 | 
			
		||||
 | 
			
		||||
=item Inherited Classes' MIBs
 | 
			
		||||
 | 
			
		||||
See SNMP::Info for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::Bridge for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::SONMP for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
See SNMP::Info::RapidCity for its own MIB requirements.
 | 
			
		||||
 | 
			
		||||
OSPF-MIB is included in the archive at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 GLOBALS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar value from SNMP
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $passport->model()
 | 
			
		||||
 | 
			
		||||
Returns the model extracted from B<sysDescr>
 | 
			
		||||
 | 
			
		||||
=item $passport->vendor()
 | 
			
		||||
 | 
			
		||||
Returns 'Nortel'
 | 
			
		||||
 | 
			
		||||
=item $passport->os()
 | 
			
		||||
 | 
			
		||||
Returns 'Passport'
 | 
			
		||||
 | 
			
		||||
=item $passport->os_ver()
 | 
			
		||||
 | 
			
		||||
Returns the software version extracted from B<sysDescr>
 | 
			
		||||
 | 
			
		||||
=item $passport->serial()
 | 
			
		||||
 | 
			
		||||
Returns (B<rcChasSerialNumber>)
 | 
			
		||||
 | 
			
		||||
=item $passport->root_ip()
 | 
			
		||||
 | 
			
		||||
Returns the primary IP used to communicate with the device.  Returns the first
 | 
			
		||||
found:  CLIP (CircuitLess IP), Management Virtual IP (B<rcSysVirtualIpAddr>),
 | 
			
		||||
OSPF Router ID (B<ospfRouterId>), SONMP Advertised IP Address.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Overrides
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $passport->index_factor()
 | 
			
		||||
 | 
			
		||||
Required by SNMP::Info::SONMP.  Returns 64.
 | 
			
		||||
 | 
			
		||||
=item $passport->port_offset()
 | 
			
		||||
 | 
			
		||||
Required by SNMP::Info::SONMP.  Returns 1.
 | 
			
		||||
 | 
			
		||||
=item $passport->slot_offset()
 | 
			
		||||
 | 
			
		||||
Required by SNMP::Info::SONMP.  Returns 0.
 | 
			
		||||
 | 
			
		||||
=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 Global Methods imported from SNMP::Info::SONMP
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::SONMP for details.
 | 
			
		||||
 | 
			
		||||
=head2 Global Methods imported from SNMP::Info::RapidCity
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::RapidCity 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 $passport->i_index()
 | 
			
		||||
 | 
			
		||||
Returns SNMP IID to Interface index.  Extends (B<ifIndex>) by adding the index of
 | 
			
		||||
the CPU virtual management IP (if present), each CPU Ethernet port, and each VLAN
 | 
			
		||||
to ensure the virtual router ports are captured.
 | 
			
		||||
 | 
			
		||||
=item $passport->interfaces()
 | 
			
		||||
 | 
			
		||||
Returns reference to the map between IID and physical Port.
 | 
			
		||||
 | 
			
		||||
Slot and port numbers on the Passport switches are determined by the formula:
 | 
			
		||||
port = (ifIndex % 64) + 1, slot = int(ifIndex / 64).
 | 
			
		||||
 | 
			
		||||
The physical port name is returned as slot.port.  CPU Ethernet ports are prefixed
 | 
			
		||||
with CPU and VLAN interfaces are returned as the VLAN ID prefixed with V.
 | 
			
		||||
 | 
			
		||||
=item $passport->i_mac()
 | 
			
		||||
 | 
			
		||||
MAC address of the interface.  Note this is just the MAC of the port, not anything
 | 
			
		||||
connected to it.
 | 
			
		||||
 | 
			
		||||
=item $passport->i_description()
 | 
			
		||||
 | 
			
		||||
Description of the interface. Usually a little longer single word name that is both
 | 
			
		||||
human and machine friendly.  Not always.
 | 
			
		||||
 | 
			
		||||
=item $passport->i_name()
 | 
			
		||||
 | 
			
		||||
Crosses rc_alias() (B<rcPortName>) with ifAlias() and returns the human set port
 | 
			
		||||
name if exists.
 | 
			
		||||
 | 
			
		||||
=item $passport->ip_index()
 | 
			
		||||
 | 
			
		||||
Maps the IP Table to the IID.  Extends (B<ipAdEntIfIndex>) by adding the index of
 | 
			
		||||
the CPU virtual management IP (if present) and each CPU Ethernet port.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 RFC1213 Arp Cache Table (B<ipNetToMediaTable>)
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $passport->at_index()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Maps ARP table entries to Interface IIDs 
 | 
			
		||||
 | 
			
		||||
(B<ipNetToMediaIfIndex>)
 | 
			
		||||
 | 
			
		||||
=item $passport->at_paddr()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Maps ARP table entries to MAC addresses. 
 | 
			
		||||
 | 
			
		||||
(B<ipNetToMediaPhysAddress>)
 | 
			
		||||
 | 
			
		||||
=item $passport->at_netaddr()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Maps ARP table entries to IPs 
 | 
			
		||||
 | 
			
		||||
(B<ipNetToMediaNetAddress>)
 | 
			
		||||
 | 
			
		||||
=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::SONMP
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::SONMP for details.
 | 
			
		||||
 | 
			
		||||
=head2 Table Methods imported from SNMP::Info::RapidCity
 | 
			
		||||
 | 
			
		||||
See documentation in SNMP::Info::RapidCity for details.
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
@@ -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.6;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										406
									
								
								Info/NortelStack.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										406
									
								
								Info/NortelStack.pm
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,406 @@
 | 
			
		||||
# SNMP::Info::NortelStack
 | 
			
		||||
# Eric Miller <eric@jeneric.org>
 | 
			
		||||
# $Id$
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2004 Max Baker
 | 
			
		||||
# 
 | 
			
		||||
# 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::NortelStack;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
use Exporter;
 | 
			
		||||
use SNMP::Info;
 | 
			
		||||
 | 
			
		||||
@SNMP::Info::NortelStack::ISA = qw/SNMP::Info Exporter/;
 | 
			
		||||
@SNMP::Info::NortelStack::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
use vars qw/$VERSION $DEBUG %FUNCS %GLOBALS %MIBS %MUNGE $INIT/;
 | 
			
		||||
# Debug
 | 
			
		||||
$DEBUG=0;
 | 
			
		||||
$SNMP::debugging=$DEBUG;
 | 
			
		||||
 | 
			
		||||
# Five data structures required by SNMP::Info
 | 
			
		||||
$INIT = 0;
 | 
			
		||||
 | 
			
		||||
%MIBS    = (
 | 
			
		||||
            # S5-ROOT-MIB and S5-TCS-MIB required by the MIBs below
 | 
			
		||||
            'S5-AGENT-MIB'   => 's5AgMyGrpIndx',
 | 
			
		||||
            'S5-CHASSIS-MIB' => 's5ChasType',
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
            # From S5-AGENT-MIB
 | 
			
		||||
            'ns_ag_ver'    => 's5AgInfoVer',
 | 
			
		||||
            'ns_op_mode'   => 's5AgSysCurrentOperationalMode',
 | 
			
		||||
            'ns_auto_pvid' => 's5AgSysAutoPvid',
 | 
			
		||||
            'tftp_host'    => 's5AgSysTftpServerAddress',
 | 
			
		||||
            'tftp_file'    => 's5AgSysBinaryConfigFilename',
 | 
			
		||||
            'tftp_action'  => 's5AgInfoFileAction',
 | 
			
		||||
            'tftp_result'  => 's5AgInfoFileStatus',
 | 
			
		||||
            'vlan'         => 's5AgSysManagementVlanId',
 | 
			
		||||
            # From S5-CHASSIS-MIB
 | 
			
		||||
            'serial'       => 's5ChasSerNum',
 | 
			
		||||
            'ns_cfg_chg'   => 's5ChasGblConfChngs',
 | 
			
		||||
            'ns_cfg_time'  => 's5ChasGblConfLstChng',
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
%FUNCS  = (
 | 
			
		||||
            # From S5-AGENT-MIB::s5AgMyIfTable
 | 
			
		||||
            'i_cfg_file'       => 's5AgMyIfCfgFname',
 | 
			
		||||
            'i_cfg_host'       => 's5AgMyIfLdSvrAddr',
 | 
			
		||||
            # From S5-CHASSIS-MIB::s5ChasComTable
 | 
			
		||||
            'ns_com_grp_idx'   => 's5ChasComGrpIndx',
 | 
			
		||||
            'ns_com_ns_com_idx'=> 's5ChasComIndx',
 | 
			
		||||
            'ns_com_sub_idx'   => 's5ChasComSubIndx',
 | 
			
		||||
            'ns_com_type'      => 's5ChasComType',
 | 
			
		||||
            'ns_com_descr'     => 's5ChasComDescr',
 | 
			
		||||
            'ns_com_ver'       => 's5ChasComVer',
 | 
			
		||||
            'ns_com_serial'    => 's5ChasComSerNum',
 | 
			
		||||
            # From S5-CHASSIS-MIB::s5ChasStoreTable
 | 
			
		||||
            'ns_store_grp_idx' => 's5ChasStoreGrpIndx',
 | 
			
		||||
            'ns_store_ns_com_idx' => 's5ChasStoreComIndx',
 | 
			
		||||
            'ns_store_sub_idx' => 's5ChasStoreSubIndx',
 | 
			
		||||
            'ns_store_idx'     => 's5ChasStoreIndx',
 | 
			
		||||
            'ns_store_type'    => 's5ChasStoreType',
 | 
			
		||||
            'ns_store_size'    => 's5ChasStoreCurSize',
 | 
			
		||||
            'ns_store_ver'     => 's5ChasStoreCntntVer',
 | 
			
		||||
          );
 | 
			
		||||
 | 
			
		||||
%MUNGE = (
 | 
			
		||||
 | 
			
		||||
         );
 | 
			
		||||
 | 
			
		||||
sub os_ver {
 | 
			
		||||
    my $bayhub = shift;
 | 
			
		||||
    my $ver = $bayhub->ns_ag_ver();
 | 
			
		||||
    return undef unless defined $ver;
 | 
			
		||||
 | 
			
		||||
    if ($ver =~ m/(\d+\.\d+\.\d+\.\d+)/){
 | 
			
		||||
        return $1;
 | 
			
		||||
    }      
 | 
			
		||||
    if ($ver =~ m/V(\d+\.\d+\.\d+)/i){
 | 
			
		||||
        return $1;
 | 
			
		||||
    }  
 | 
			
		||||
   return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub os_bin {
 | 
			
		||||
    my $bayhub = shift;
 | 
			
		||||
    my $ver = $bayhub->ns_ag_ver();
 | 
			
		||||
    return undef unless defined $ver;
 | 
			
		||||
 | 
			
		||||
    if ($ver =~ m/(\d+\.\d+\.\d+\.\d+)/i){
 | 
			
		||||
        return $1;
 | 
			
		||||
    }     
 | 
			
		||||
    if ($ver =~ m/V(\d+\.\d+.\d+)/i){
 | 
			
		||||
        return $1;
 | 
			
		||||
    }
 | 
			
		||||
   return undef;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
__END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::NortelStack - Perl5 Interface to Nortel Stack information using SNMP
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
Eric Miller (C<eric@jeneric.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you. 
 | 
			
		||||
 my $stack = 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      = $stack->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
SNMP::Info::NortelStack is a subclass of SNMP::Info that provides an interface
 | 
			
		||||
to C<S5-AGENT-MIB> and C<S5-CHASSIS-MIB>.  These MIBs are used across the
 | 
			
		||||
Nortel BayStack family, as well as, older Nortel devices such as the Centillion
 | 
			
		||||
family of ATM switches.
 | 
			
		||||
 | 
			
		||||
Use or create in a subclass of SNMP::Info.  Do not use directly.
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
None.
 | 
			
		||||
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item S5-AGENT-MIB
 | 
			
		||||
 | 
			
		||||
=item S5-CHASSIS-MIB
 | 
			
		||||
 | 
			
		||||
=item S5-ROOT-MIB and S5-TCS-MIB are required by the other MIBs.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
MIBs can be found on the CD that came with your product.
 | 
			
		||||
 | 
			
		||||
Or, they can be downloaded directly from Nortel Networks regardless of support
 | 
			
		||||
contract status.
 | 
			
		||||
 | 
			
		||||
Go to http://www.nortelnetworks.com Techninal Support, Browse Technical Support,
 | 
			
		||||
Select by product, Java Device Manager, Software.  Download the latest version.
 | 
			
		||||
After installation, all mibs are located under the install directory under mibs
 | 
			
		||||
and the repspective product line.
 | 
			
		||||
 | 
			
		||||
Note:  Recommend versions (located in JDM\mibs\bps2000\v3100.zip)
 | 
			
		||||
S5-AGENT-MIB    s5age154.mib
 | 
			
		||||
S5-CHASSIS-MIB  s5cha135.mib
 | 
			
		||||
 | 
			
		||||
=head1 GLOBAL METHODS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar values from SNMP
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $baystack->serial()
 | 
			
		||||
 | 
			
		||||
Returns (B<s5ChasSerNum>)
 | 
			
		||||
 | 
			
		||||
=item $stack->os_ver()
 | 
			
		||||
 | 
			
		||||
Returns the software version extracted from (B<s5AgInfoVer>)
 | 
			
		||||
 | 
			
		||||
=item $stack->os_bin()
 | 
			
		||||
 | 
			
		||||
Returns the firmware version extracted from (B<s5AgInfoVer>)
 | 
			
		||||
 | 
			
		||||
=item $stack->ns_ag_ver()
 | 
			
		||||
 | 
			
		||||
Returns the version of the agent in the form 'major.minor.maintenance[letters]'. 
 | 
			
		||||
 | 
			
		||||
(B<s5AgInfoVer>)
 | 
			
		||||
 | 
			
		||||
=item $stack->ns_op_mode()
 | 
			
		||||
 | 
			
		||||
Returns the stacking mode. 
 | 
			
		||||
 | 
			
		||||
(B<s5AgSysCurrentOperationalMode>)
 | 
			
		||||
 | 
			
		||||
=item $stack->tftp_action()
 | 
			
		||||
 | 
			
		||||
This object is used to download or upload a config file or an image file.
 | 
			
		||||
 | 
			
		||||
(B<s5AgInfoFileAction>)
 | 
			
		||||
 | 
			
		||||
=item $stack->tftp_result()
 | 
			
		||||
 | 
			
		||||
Returns the status of the latest action as shown by $stack->tftp_action().
 | 
			
		||||
 | 
			
		||||
(B<s5AgInfoFileStatus>)
 | 
			
		||||
 | 
			
		||||
=item $stack->ns_auto_pvid()
 | 
			
		||||
 | 
			
		||||
Returns the value indicating whether adding a port as a member of a VLAN
 | 
			
		||||
automatically results in its PVID being set to be the same as that VLAN ID.
 | 
			
		||||
 | 
			
		||||
(B<s5AgSysAutoPvid>)
 | 
			
		||||
 | 
			
		||||
=item $stack->tftp_file()
 | 
			
		||||
 | 
			
		||||
Name of the binary configuration file that will be downloaded/uploaded when
 | 
			
		||||
the $stack->tftp_action() object is set.
 | 
			
		||||
 | 
			
		||||
(B<s5AgSysBinaryConfigFilename>)
 | 
			
		||||
 | 
			
		||||
=item $stack->tftp_host()
 | 
			
		||||
 | 
			
		||||
The IP address of the TFTP server for all TFTP operations.
 | 
			
		||||
 | 
			
		||||
(B<s5AgSysTftpServerAddress>)
 | 
			
		||||
 | 
			
		||||
=item $stack->vlan()
 | 
			
		||||
 | 
			
		||||
Returns the VLAN ID of the system's management VLAN.
 | 
			
		||||
 | 
			
		||||
(B<s5AgSysManagementVlanId>)
 | 
			
		||||
 | 
			
		||||
=item $stack->ch_ser()
 | 
			
		||||
 | 
			
		||||
Returns the serial number of the chassis.
 | 
			
		||||
 | 
			
		||||
(B<s5ChasSerNum>)
 | 
			
		||||
 | 
			
		||||
=item $stack->ns_cfg_chg()
 | 
			
		||||
 | 
			
		||||
Returns the total number of configuration changes (other than attachment changes,
 | 
			
		||||
or physical additions or removals) in the chassis that have been detected since
 | 
			
		||||
cold/warm start.
 | 
			
		||||
 | 
			
		||||
(B<s5ChasGblConfChngs>)
 | 
			
		||||
 | 
			
		||||
=item $stack->ns_cfg_time()
 | 
			
		||||
 | 
			
		||||
Returns the value of sysUpTime when the last configuration change (other than
 | 
			
		||||
attachment changes, or physical additions or removals) in the chassis was
 | 
			
		||||
detected.
 | 
			
		||||
 | 
			
		||||
(B<s5ChasGblConfLstChng>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 TABLE METHODS
 | 
			
		||||
 | 
			
		||||
These are methods that return tables of information in the form of a reference
 | 
			
		||||
to a hash.
 | 
			
		||||
 | 
			
		||||
=head2 Agent Interface Table (s5AgMyIfTable)
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $stack->i_cfg_file()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Key: Table entry, Value: Name of the file
 | 
			
		||||
 | 
			
		||||
(B<s5AgMyIfCfgFname>)
 | 
			
		||||
 | 
			
		||||
=item $stack->i_cfg_host()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Key: Table entry, Value: IP address of the load server
 | 
			
		||||
 | 
			
		||||
(B<s5AgMyIfLdSvrAddr>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Chassis Components Table (s5ChasComTable)
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $stack->ns_com_grp_idx()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Key: Table entry, Value: Index of the chassis level
 | 
			
		||||
group which contains this component.
 | 
			
		||||
 | 
			
		||||
(B<s5ChasComGrpIndx>)
 | 
			
		||||
 | 
			
		||||
=item $stack->ns_com_ns_com_idx()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Key: Table entry, Value: Index of the component in
 | 
			
		||||
the group.  For modules in the 'board' group, this is the slot number.
 | 
			
		||||
 | 
			
		||||
(B<s5ChasComIndx>)
 | 
			
		||||
 | 
			
		||||
=item $stack->ns_com_sub_idx()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Key: Table entry, Value: Index of the sub-component
 | 
			
		||||
in the component.
 | 
			
		||||
 | 
			
		||||
(B<s5ChasComSubIndx>)
 | 
			
		||||
 | 
			
		||||
=item $stack->ns_com_type()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Key: Table entry, Value: Type
 | 
			
		||||
 | 
			
		||||
(B<s5ChasComType>)
 | 
			
		||||
 | 
			
		||||
=item $stack->ns_com_descr()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Key: Table entry, Value: Description
 | 
			
		||||
 | 
			
		||||
(B<s5ChasComDescr>)
 | 
			
		||||
 | 
			
		||||
=item $stack->ns_com_ver()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Key: Table entry, Value: Version
 | 
			
		||||
 | 
			
		||||
(B<s5ChasComVer>)
 | 
			
		||||
 | 
			
		||||
=item $stack->ns_com_serial()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Key: Table entry, Value: Serial Number
 | 
			
		||||
 | 
			
		||||
(B<s5ChasComSerNum>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Storage Area Table (s5ChasStoreTable)
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $stack->ns_store_grp_idx()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Key: Table entry, Value: Index of the chassis level
 | 
			
		||||
group.
 | 
			
		||||
 | 
			
		||||
(B<s5ChasStoreGrpIndx>)
 | 
			
		||||
 | 
			
		||||
=item $stack->ns_store_ns_com_idx()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Key: Table entry, Value: Index of the group.
 | 
			
		||||
 | 
			
		||||
(B<s5ChasStoreComIndx>)
 | 
			
		||||
 | 
			
		||||
=item $stack->ns_store_sub_idx()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Key: Table entry, Value: Index of the sub-component.
 | 
			
		||||
 | 
			
		||||
(B<s5ChasStoreSubIndx>)
 | 
			
		||||
 | 
			
		||||
=item $stack->ns_store_idx()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Key: Table entry, Value: Index of the storage area.
 | 
			
		||||
 | 
			
		||||
(B<s5ChasStoreIndx>)
 | 
			
		||||
 | 
			
		||||
=item $stack->ns_store_type()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Key: Table entry, Value: Type
 | 
			
		||||
 | 
			
		||||
(B<s5ChasStoreType>)
 | 
			
		||||
 | 
			
		||||
=item $stack->ns_store_size()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Key: Table entry, Value: Size
 | 
			
		||||
 | 
			
		||||
(B<s5ChasStoreCurSize>)
 | 
			
		||||
 | 
			
		||||
=item $stack->ns_store_ver()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Key: Table entry, Value: Version
 | 
			
		||||
 | 
			
		||||
(B<s5ChasStoreCntntVer>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
							
								
								
									
										708
									
								
								Info/RapidCity.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										708
									
								
								Info/RapidCity.pm
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,708 @@
 | 
			
		||||
# SNMP::Info::RapidCity
 | 
			
		||||
# Eric Miller <eric@jeneric.org>
 | 
			
		||||
# $Id$
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2004 Max Baker
 | 
			
		||||
#
 | 
			
		||||
# 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::RapidCity;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
use Exporter;
 | 
			
		||||
use SNMP::Info;
 | 
			
		||||
use Carp;
 | 
			
		||||
 | 
			
		||||
@SNMP::Info::RapidCity::ISA = qw/SNMP::Info Exporter/;
 | 
			
		||||
@SNMP::Info::RapidCity::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
use vars qw/$VERSION $DEBUG %FUNCS %GLOBALS %MIBS %MUNGE $INIT/;
 | 
			
		||||
# Debug
 | 
			
		||||
$DEBUG=0;
 | 
			
		||||
$SNMP::debugging=$DEBUG;
 | 
			
		||||
 | 
			
		||||
# Five data structures required by SNMP::Info
 | 
			
		||||
$INIT = 0;
 | 
			
		||||
 | 
			
		||||
%MIBS    = (
 | 
			
		||||
            'RAPID-CITY' => 'rapidCity',
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
            'serial'       => 'rcChasSerialNumber',
 | 
			
		||||
            'chassis'      => 'rcChasType',
 | 
			
		||||
            'slots'        => 'rcChasNumSlots',
 | 
			
		||||
            'tftp_host'    => 'rcTftpHost',
 | 
			
		||||
            'tftp_file'    => 'rcTftpFile',
 | 
			
		||||
            'tftp_action'  => 'rcTftpAction',
 | 
			
		||||
            'tftp_result'  => 'rcTftpResult',
 | 
			
		||||
            'rc_ch_rev'    => 'rcChasHardwareRevision',
 | 
			
		||||
            'rc_base_mac'  => 'rc2kChassisBaseMacAddr',
 | 
			
		||||
            'rc_virt_ip'   => 'rcSysVirtualIpAddr',
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
%FUNCS  = (
 | 
			
		||||
            # From RAPID-CITY::rcPortTable
 | 
			
		||||
            'rc_index'          => 'rcPortIndex',
 | 
			
		||||
            'rc_duplex'         => 'rcPortOperDuplex',
 | 
			
		||||
            'rc_duplex_admin'   => 'rcPortAdminDuplex',
 | 
			
		||||
            'rc_speed_admin'    => 'rcPortAdminSpeed',
 | 
			
		||||
            'rc_auto'           => 'rcPortAutoNegotiate',
 | 
			
		||||
            'rc_alias'	    => 'rcPortName',
 | 
			
		||||
            # From RAPID-CITY::rc2kCpuEthernetPortTable
 | 
			
		||||
            'rc_cpu_ifindex'        => 'rc2kCpuEthernetPortIfIndex',
 | 
			
		||||
            'rc_cpu_admin'         => 'rc2kCpuEthernetPortAdminStatus',
 | 
			
		||||
            'rc_cpu_oper'          => 'rc2kCpuEthernetPortOperStatus',
 | 
			
		||||
            'rc_cpu_ip'            => 'rc2kCpuEthernetPortAddr',
 | 
			
		||||
            'rc_cpu_auto'          => 'rc2kCpuEthernetPortAutoNegotiate',
 | 
			
		||||
            'rc_cpu_duplex_admin'  => 'rc2kCpuEthernetPortAdminDuplex',
 | 
			
		||||
            'rc_cpu_duplex'        => 'rc2kCpuEthernetPortOperDuplex',
 | 
			
		||||
            'rc_cpu_speed_admin'   => 'rc2kCpuEthernetPortAdminSpeed',
 | 
			
		||||
            'rc_cpu_speed_oper'    => 'rc2kCpuEthernetPortOperSpeed',
 | 
			
		||||
            'rc_cpu_mac'           => 'rc2kCpuEthernetPortMgmtMacAddr',
 | 
			
		||||
            # From RAPID-CITY::rcVlanPortTable
 | 
			
		||||
            'rc_i_vlan_if'      => 'rcVlanPortIndex',
 | 
			
		||||
            'rc_i_vlan_num'     => 'rcVlanPortNumVlanIds',
 | 
			
		||||
            'rc_i_vlan'         => 'rcVlanPortVlanIds',
 | 
			
		||||
            'rc_i_vlan_type'    => 'rcVlanPortType',
 | 
			
		||||
            'rc_i_vlan_pvid'    => 'rcVlanPortDefaultVlanId',
 | 
			
		||||
            'rc_i_vlan_tag'     => 'rcVlanPortPerformTagging',
 | 
			
		||||
            # From RAPID-CITY::rcVlanTable
 | 
			
		||||
            'rc_vlan_id'      => 'rcVlanId',
 | 
			
		||||
            'rc_vlan_name'    => 'rcVlanName',
 | 
			
		||||
            'rc_vlan_color'   => 'rcVlanColor',
 | 
			
		||||
            'rc_vlan_if'      => 'rcVlanIfIndex',
 | 
			
		||||
            'rc_vlan_stg'     => 'rcVlanStgId',
 | 
			
		||||
            'rc_vlan_type'    => 'rcVlanType',
 | 
			
		||||
            'rc_vlan_members' => 'rcVlanPortMembers',
 | 
			
		||||
            'rc_vlan_mac'     => 'rcVlanMacAddress',
 | 
			
		||||
            # From RAPID-CITY::rcIpAddrTable
 | 
			
		||||
            'rc_ip_index'  => 'rcIpAdEntIfIndex',
 | 
			
		||||
            'rc_ip_addr'   => 'rcIpAdEntAddr',
 | 
			
		||||
            'rc_ip_type'   => 'rcIpAdEntIfType',
 | 
			
		||||
            # From RAPID-CITY::rcChasFanTable
 | 
			
		||||
            'rc_fan_op'     => 'rcChasFanOperStatus',
 | 
			
		||||
            # From RAPID-CITY::rcChasPowerSupplyTable
 | 
			
		||||
            'rc_ps_op'     => 'rcChasPowerSupplyOperStatus',
 | 
			
		||||
            # From RAPID-CITY::rcChasPowerSupplyDetailTable
 | 
			
		||||
            'rc_ps_type'     => 'rcChasPowerSupplyDetailType',
 | 
			
		||||
            'rc_ps_serial'   => 'rcChasPowerSupplyDetailSerialNumber',
 | 
			
		||||
            'rc_ps_rev'      => 'rcChasPowerSupplyDetailHardwareRevision',
 | 
			
		||||
            'rc_ps_part'     => 'rcChasPowerSupplyDetailPartNumber',
 | 
			
		||||
            'rc_ps_detail'     => 'rcChasPowerSupplyDetailDescription',
 | 
			
		||||
            # From RAPID-CITY::rcCardTable
 | 
			
		||||
            'rc_c_type'     => 'rcCardType',
 | 
			
		||||
            'rc_c_serial'   => 'rcCardSerialNumber',
 | 
			
		||||
            'rc_c_rev'      => 'rcCardHardwareRevision',
 | 
			
		||||
            'rc_c_part'     => 'rcCardPartNumber',
 | 
			
		||||
            # From RAPID-CITY::rc2kCardTable
 | 
			
		||||
            'rc2k_c_ftype'    => 'rc2kCardFrontType',
 | 
			
		||||
            'rc2k_c_fdesc'    => 'rc2kCardFrontDescription',
 | 
			
		||||
            'rc2k_c_fserial'  => 'rc2kCardFrontSerialNum',
 | 
			
		||||
            'rc2k_c_frev'     => 'rc2kCardFrontHwVersion',
 | 
			
		||||
            'rc2k_c_fpart'    => 'rc2kCardFrontPartNumber',
 | 
			
		||||
            'rc2k_c_fdate'    => 'rc2kCardFrontDateCode',
 | 
			
		||||
            'rc2k_c_fdev'     => 'rc2kCardFrontDeviations',
 | 
			
		||||
            'rc2k_c_btype'    => 'rc2kCardBackType',
 | 
			
		||||
            'rc2k_c_bdesc'    => 'rc2kCardBackDescription',
 | 
			
		||||
            'rc2k_c_bserial'  => 'rc2kCardBackSerialNum',
 | 
			
		||||
            'rc2k_c_brev'     => 'rc2kCardBackHwVersion',
 | 
			
		||||
            'rc2k_c_bpart'    => 'rc2kCardBackPartNumber',
 | 
			
		||||
            'rc2k_c_bdate'    => 'rc2kCardBackDateCode',
 | 
			
		||||
            'rc2k_c_bdev'     => 'rc2kCardBackDeviations',
 | 
			
		||||
            # From RAPID-CITY::rc2kMdaCardTable
 | 
			
		||||
            'rc2k_mda_type'    => 'rc2kMdaCardType',
 | 
			
		||||
            'rc2k_mda_desc'    => 'rc2kMdaCardDescription',
 | 
			
		||||
            'rc2k_mda_serial'  => 'rc2kMdaCardSerialNum',
 | 
			
		||||
            'rc2k_mda_rev'     => 'rc2kMdaCardHwVersion',
 | 
			
		||||
            'rc2k_mda_part'    => 'rc2kMdaCardPartNumber',
 | 
			
		||||
            'rc2k_mda_date'    => 'rc2kMdaCardDateCode',
 | 
			
		||||
            'rc2k_mda_dev'     => 'rc2kMdaCardDeviations',
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
%MUNGE = (
 | 
			
		||||
            'rc_base_mac' => \&SNMP::Info::munge_mac,
 | 
			
		||||
            'rc_vlan_mac' => \&SNMP::Info::munge_mac,
 | 
			
		||||
            'rc_cpu_mac' => \&SNMP::Info::munge_mac,         
 | 
			
		||||
         );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
sub i_duplex {
 | 
			
		||||
    my $rapidcity = shift;
 | 
			
		||||
    
 | 
			
		||||
    my $interfaces   = $rapidcity->interfaces();
 | 
			
		||||
    my $rc_index  = $rapidcity->rc_index();
 | 
			
		||||
    my $rc_duplex = $rapidcity->rc_duplex();
 | 
			
		||||
    my $rc_cpu_duplex = $rapidcity->rc_cpu_duplex();
 | 
			
		||||
 | 
			
		||||
    my %i_duplex;
 | 
			
		||||
    foreach my $if (keys %$interfaces){
 | 
			
		||||
        my $duplex = $rc_duplex->{$if};
 | 
			
		||||
        next unless defined $duplex; 
 | 
			
		||||
    
 | 
			
		||||
        $duplex = 'half' if $duplex =~ /half/i;
 | 
			
		||||
        $duplex = 'full' if $duplex =~ /full/i;
 | 
			
		||||
        $i_duplex{$if}=$duplex; 
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    # Get CPU Ethernet Interfaces for 8600 Series
 | 
			
		||||
    foreach my $iid (keys %$rc_cpu_duplex){
 | 
			
		||||
        my $c_duplex = $rc_cpu_duplex->{$iid};
 | 
			
		||||
        next unless defined $c_duplex;
 | 
			
		||||
 | 
			
		||||
       	$i_duplex{$iid} = $c_duplex;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return \%i_duplex;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_duplex_admin {
 | 
			
		||||
    my $rapidcity = shift;
 | 
			
		||||
 | 
			
		||||
    my $interfaces  = $rapidcity->interfaces();
 | 
			
		||||
    my $rc_index = $rapidcity->rc_index();
 | 
			
		||||
    my $rc_duplex_admin = $rapidcity->rc_duplex_admin();
 | 
			
		||||
    my $rc_auto = $rapidcity->rc_auto();
 | 
			
		||||
    my $rc_cpu_auto = $rapidcity->rc_cpu_auto();
 | 
			
		||||
    my $rc_cpu_duplex_admin = $rapidcity->rc_cpu_duplex_admin();
 | 
			
		||||
 
 | 
			
		||||
    my %i_duplex_admin;
 | 
			
		||||
    foreach my $if (keys %$interfaces){
 | 
			
		||||
        my $duplex = $rc_duplex_admin->{$if};
 | 
			
		||||
        next unless defined $duplex;
 | 
			
		||||
        my $auto = $rc_auto->{$if}||'false';
 | 
			
		||||
        
 | 
			
		||||
	my $string = 'other';
 | 
			
		||||
        $string = 'half' if ($duplex =~ /half/i and $auto =~ /false/i);
 | 
			
		||||
        $string = 'full' if ($duplex =~ /full/i and $auto =~ /false/i);
 | 
			
		||||
        $string = 'auto' if $auto =~ /true/i;    
 | 
			
		||||
 | 
			
		||||
        $i_duplex_admin{$if}=$string; 
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    # Get CPU Ethernet Interfaces for 8600 Series
 | 
			
		||||
    foreach my $iid (keys %$rc_cpu_duplex_admin){
 | 
			
		||||
        my $c_duplex = $rc_cpu_duplex_admin->{$iid};
 | 
			
		||||
        next unless defined $c_duplex;
 | 
			
		||||
        my $c_auto = $rc_cpu_auto->{$iid};
 | 
			
		||||
 | 
			
		||||
	my $string = 'other';
 | 
			
		||||
        $string = 'half' if ($c_duplex =~ /half/i and $c_auto =~ /false/i);
 | 
			
		||||
        $string = 'full' if ($c_duplex =~ /full/i and $c_auto =~ /false/i);
 | 
			
		||||
        $string = 'auto' if $c_auto =~ /true/i;    
 | 
			
		||||
 | 
			
		||||
       	$i_duplex_admin{$iid} = $string;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    return \%i_duplex_admin;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub i_vlan {
 | 
			
		||||
    my $rapidcity = shift;
 | 
			
		||||
 | 
			
		||||
    my $rc_vlans  = $rapidcity->rc_i_vlan();
 | 
			
		||||
    my $rc_vlan_id  = $rapidcity->rc_vlan_id();
 | 
			
		||||
    my $rc_vlan_if  = $rapidcity->rc_vlan_if();
 | 
			
		||||
    
 | 
			
		||||
    my %i_vlan;
 | 
			
		||||
        foreach my $if (keys %$rc_vlans){
 | 
			
		||||
            my $rc_vlanid = $rc_vlans->{$if};
 | 
			
		||||
            next unless defined $rc_vlanid;
 | 
			
		||||
            my @vlanids = map { sprintf "%02x",$_ } unpack('C*',$rc_vlanid);
 | 
			
		||||
 | 
			
		||||
            my @vlans = ();
 | 
			
		||||
 | 
			
		||||
            while($#vlanids > 0) {
 | 
			
		||||
                my $h = join('', splice(@vlanids,0,2));
 | 
			
		||||
                push(@vlans, hex($h));
 | 
			
		||||
            }
 | 
			
		||||
        my $vlans = join (',', @vlans);
 | 
			
		||||
        $i_vlan{$if}=$vlans; 
 | 
			
		||||
    }
 | 
			
		||||
        foreach my $if (keys %$rc_vlan_if){
 | 
			
		||||
            my $vlan_if = $rc_vlan_if->{$if};
 | 
			
		||||
            next unless defined $vlan_if;
 | 
			
		||||
            my $vlan = $rc_vlan_id->{$if};
 | 
			
		||||
 | 
			
		||||
        $i_vlan{$vlan_if}=$vlan; 
 | 
			
		||||
    }
 | 
			
		||||
    return \%i_vlan;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
 | 
			
		||||
__END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::Layer2::RapidCity - SNMP Interface to Nortel Networks' RapidCity MIB
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
Eric Miller (C<eric@jeneric.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 # Let SNMP::Info determine the correct subclass for you. 
 | 
			
		||||
 my $rapidcity = 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      = $rapidcity->class();
 | 
			
		||||
 print "SNMP::Info determined this device to fall under subclass : $class\n";
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
SNMP::Info::RapidCity is a subclass of SNMP::Info that provides an interface
 | 
			
		||||
to the C<RAPID-CITY> MIB.  This MIB is used across the Nortel Networks' Passport
 | 
			
		||||
LAN, as well as, the BayStack and Acclear families.
 | 
			
		||||
 | 
			
		||||
Use or create in a subclass of SNMP::Info.  Do not use directly.
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
None.
 | 
			
		||||
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item RAPID-CITY
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
MIBs can be found on the CD that came with your product.
 | 
			
		||||
 | 
			
		||||
Or, they can be downloaded directly from Nortel Networks regardless of support
 | 
			
		||||
contract status.
 | 
			
		||||
 | 
			
		||||
Go to http://www.nortelnetworks.com Techninal Support, Browse Technical Support,
 | 
			
		||||
Select by product, Java Device Manager, Software.  Download the latest version.
 | 
			
		||||
After installation, all mibs are located under the install directory under mibs
 | 
			
		||||
and the repspective product line.
 | 
			
		||||
 | 
			
		||||
Note:  Required version of RAPID-CITY, rapid_city.mib, must be from the Passport
 | 
			
		||||
8600 version 3.3 or higher (located in JDM\mibs\passport8k\).
 | 
			
		||||
 | 
			
		||||
=head1 GLOBAL METHODS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar values from SNMP
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item  $rapidcity->chassis_base_mac()
 | 
			
		||||
 | 
			
		||||
(B<rc2kChassisBaseMacAddr>)
 | 
			
		||||
 | 
			
		||||
=item  $rapidcity->ch_serial()
 | 
			
		||||
 | 
			
		||||
(B<rcChasSerialNumber>)
 | 
			
		||||
 | 
			
		||||
=item  $rapidcity->rc_ch_rev()
 | 
			
		||||
 | 
			
		||||
(B<rcChasHardwareRevision>)
 | 
			
		||||
 | 
			
		||||
=item  $rapidcity->chassis()
 | 
			
		||||
 | 
			
		||||
(B<rcChasType>)
 | 
			
		||||
 | 
			
		||||
=item  $rapidcity->slots()
 | 
			
		||||
 | 
			
		||||
(B<rcChasNumSlots>)
 | 
			
		||||
 | 
			
		||||
=item  $rapidcity->rc_virt_ip()
 | 
			
		||||
 | 
			
		||||
(B<rcSysVirtualIpAddr>)
 | 
			
		||||
 | 
			
		||||
=item  $rapidcity->tftp_host()
 | 
			
		||||
 | 
			
		||||
(B<rcTftpHost>)
 | 
			
		||||
 | 
			
		||||
=item  $rapidcity->tftp_file()
 | 
			
		||||
 | 
			
		||||
(B<rcTftpFile>)
 | 
			
		||||
 | 
			
		||||
=item  $rapidcity->tftp_action()
 | 
			
		||||
 | 
			
		||||
(B<rcTftpAction>)
 | 
			
		||||
 | 
			
		||||
=item  $rapidcity->tftp_result()
 | 
			
		||||
 | 
			
		||||
(B<rcTftpResult>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 TABLE METHODS
 | 
			
		||||
 | 
			
		||||
These are methods that return tables of information in the form of a reference
 | 
			
		||||
to a hash.
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->i_duplex()
 | 
			
		||||
 | 
			
		||||
Returns reference to map of IIDs to current link duplex.
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->i_duplex_admin()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash of IIDs to admin duplex setting.
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->i_vlan()
 | 
			
		||||
 | 
			
		||||
Returns a mapping between ifIndex and the VLAN.
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 RAPID-CITY Port Table (B<rcPortTable>)
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_index()
 | 
			
		||||
 | 
			
		||||
(B<rcPortIndex>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_duplex()
 | 
			
		||||
 | 
			
		||||
(B<rcPortOperDuplex>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_duplex_admin()
 | 
			
		||||
 | 
			
		||||
(B<rcPortAdminDuplex>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_speed_admin()
 | 
			
		||||
 | 
			
		||||
(B<rcPortAdminSpeed>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_auto()
 | 
			
		||||
 | 
			
		||||
(B<rcPortAutoNegotiate>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_alias()
 | 
			
		||||
 | 
			
		||||
(B<rcPortName>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 RAPID-CITY CPU Ethernet Port Table (B<rc2kCpuEthernetPortTable>)
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_cpu_ifindex()
 | 
			
		||||
 | 
			
		||||
(B<rc2kCpuEthernetPortIfIndex>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_cpu_admin()
 | 
			
		||||
 | 
			
		||||
(B<rc2kCpuEthernetPortAdminStatus>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_cpu_oper()
 | 
			
		||||
 | 
			
		||||
(B<rc2kCpuEthernetPortOperStatus>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_cpu_ip()
 | 
			
		||||
 | 
			
		||||
(B<rc2kCpuEthernetPortAddr>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_cpu_auto()
 | 
			
		||||
 | 
			
		||||
(B<rc2kCpuEthernetPortAutoNegotiate>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_cpu_duplex_admin()
 | 
			
		||||
 | 
			
		||||
(B<rc2kCpuEthernetPortAdminDuplex>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_cpu_duplex()
 | 
			
		||||
 | 
			
		||||
(B<rc2kCpuEthernetPortOperDuplex>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_cpu_speed_admin()
 | 
			
		||||
 | 
			
		||||
(B<rc2kCpuEthernetPortAdminSpeed>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_cpu_speed_oper()
 | 
			
		||||
 | 
			
		||||
(B<rc2kCpuEthernetPortOperSpeed>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_cpu_mac()
 | 
			
		||||
 | 
			
		||||
(B<rc2kCpuEthernetPortMgmtMacAddr>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 RAPID-CITY VLAN Port Table (B<rcVlanPortTable>)
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_i_vlan_if()
 | 
			
		||||
 | 
			
		||||
(B<rcVlanPortIndex>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_i_vlan_num()
 | 
			
		||||
 | 
			
		||||
(B<rcVlanPortNumVlanIds>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_i_vlan()
 | 
			
		||||
 | 
			
		||||
(B<rcVlanPortVlanIds>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_i_vlan_type()
 | 
			
		||||
 | 
			
		||||
(B<rcVlanPortType>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_i_vlan_pvid()
 | 
			
		||||
 | 
			
		||||
(B<rcVlanPortDefaultVlanId>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_i_vlan_tag()
 | 
			
		||||
 | 
			
		||||
(B<rcVlanPortPerformTagging>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 RAPID-CITY VLAN Table (B<rcVlanTable>)
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_vlan_id()
 | 
			
		||||
 | 
			
		||||
(B<rcVlanId>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_vlan_name()
 | 
			
		||||
 | 
			
		||||
(B<rcVlanName>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_vlan_color()
 | 
			
		||||
 | 
			
		||||
(B<rcVlanColor>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_vlan_if()
 | 
			
		||||
 | 
			
		||||
(B<rcVlanIfIndex>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_vlan_stg()
 | 
			
		||||
 | 
			
		||||
(B<rcVlanStgId>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_vlan_type()
 | 
			
		||||
 | 
			
		||||
(B<rcVlanType>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_vlan_members()
 | 
			
		||||
 | 
			
		||||
(B<rcVlanPortMembers>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_vlan_mac()
 | 
			
		||||
 | 
			
		||||
(B<rcVlanMacAddress>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 RAPID-CITY IP Address Table (B<rcIpAddrTable>)
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_ip_index()
 | 
			
		||||
 | 
			
		||||
(B<rcIpAdEntIfIndex>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_ip_addr()
 | 
			
		||||
 | 
			
		||||
(B<rcIpAdEntAddr>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_ip_type()
 | 
			
		||||
 | 
			
		||||
(B<rcIpAdEntIfType>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 RAPID-CITY Chassis Fan Table (B<rcChasFanTable>)
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_fan_op()
 | 
			
		||||
 | 
			
		||||
(B<rcChasFanOperStatus>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 RAPID-CITY Power Supply Table (B<rcChasPowerSupplyTable>)
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_ps_op()
 | 
			
		||||
 | 
			
		||||
(B<rcChasPowerSupplyOperStatus>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 RAPID-CITY Power Supply Detail Table (B<rcChasPowerSupplyDetailTable>)
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_ps_type()
 | 
			
		||||
 | 
			
		||||
(B<rcChasPowerSupplyDetailType>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_ps_serial()
 | 
			
		||||
 | 
			
		||||
(B<rcChasPowerSupplyDetailSerialNumber>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_ps_rev()
 | 
			
		||||
 | 
			
		||||
(B<rcChasPowerSupplyDetailHardwareRevision>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_ps_part()
 | 
			
		||||
 | 
			
		||||
(B<rcChasPowerSupplyDetailPartNumber>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_ps_detail()
 | 
			
		||||
 | 
			
		||||
(B<rcChasPowerSupplyDetailDescription>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 RAPID-CITY Card Table (B<rcCardTable>)
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_c_type()
 | 
			
		||||
 | 
			
		||||
(B<rcCardType>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_c_serial()
 | 
			
		||||
 | 
			
		||||
(B<rcCardSerialNumber>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_c_rev()
 | 
			
		||||
 | 
			
		||||
(B<rcCardHardwareRevision>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc_c_part()
 | 
			
		||||
 | 
			
		||||
(B<rcCardPartNumber>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 RAPID-CITY 2k Card Table (B<rc2kCardTable>)
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc2k_c_ftype()
 | 
			
		||||
 | 
			
		||||
(B<rc2kCardFrontType>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc2k_c_fdesc()
 | 
			
		||||
 | 
			
		||||
(B<rc2kCardFrontDescription>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc2k_c_fserial()
 | 
			
		||||
 | 
			
		||||
(B<rc2kCardFrontSerialNum>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc2k_c_frev()
 | 
			
		||||
 | 
			
		||||
(B<rc2kCardFrontHwVersion>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc2k_c_fpart()
 | 
			
		||||
 | 
			
		||||
(B<rc2kCardFrontPartNumber>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc2k_c_fdate()
 | 
			
		||||
 | 
			
		||||
(B<rc2kCardFrontDateCode>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc2k_c_fdev()
 | 
			
		||||
 | 
			
		||||
(B<rc2kCardFrontDeviations>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc2k_c_btype()
 | 
			
		||||
 | 
			
		||||
(B<rc2kCardBackType>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc2k_c_bdesc()
 | 
			
		||||
 | 
			
		||||
(B<rc2kCardBackDescription>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc2k_c_bserial()
 | 
			
		||||
 | 
			
		||||
(B<rc2kCardBackSerialNum>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc2k_c_brev()
 | 
			
		||||
 | 
			
		||||
(B<rc2kCardBackHwVersion>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc2k_c_bpart()
 | 
			
		||||
 | 
			
		||||
(B<rc2kCardBackPartNumber>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc2k_c_bdate()
 | 
			
		||||
 | 
			
		||||
(B<rc2kCardBackDateCode>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc2k_c_bdev()
 | 
			
		||||
 | 
			
		||||
(B<rc2kCardBackDeviations>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 RAPID-CITY MDA Card Table (B<rc2kMdaCardTable>)
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc2k_mda_type()
 | 
			
		||||
 | 
			
		||||
(B<rc2kMdaCardType>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc2k_mda_desc()
 | 
			
		||||
 | 
			
		||||
(B<rc2kMdaCardDescription>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc2k_mda_serial()
 | 
			
		||||
 | 
			
		||||
(B<rc2kMdaCardSerialNum>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc2k_mda_rev()
 | 
			
		||||
 | 
			
		||||
(B<rc2kMdaCardHwVersion>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc2k_mda_part()
 | 
			
		||||
 | 
			
		||||
(B<rc2kMdaCardPartNumber>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc2k_mda_date()
 | 
			
		||||
 | 
			
		||||
(B<rc2kMdaCardDateCode>)
 | 
			
		||||
 | 
			
		||||
=item $rapidcity->rc2k_mda_dev()
 | 
			
		||||
 | 
			
		||||
(B<rc2kMdaCardDeviations>)
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
							
								
								
									
										506
									
								
								Info/SONMP.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										506
									
								
								Info/SONMP.pm
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,506 @@
 | 
			
		||||
# SNMP::Info::SONMP
 | 
			
		||||
# Eric Miller <eric@jeneric.org>
 | 
			
		||||
# $Id$
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2004 Max Baker
 | 
			
		||||
#
 | 
			
		||||
# 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::SONMP;
 | 
			
		||||
$VERSION = 0.9;
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
use Exporter;
 | 
			
		||||
use SNMP::Info;
 | 
			
		||||
use Carp;
 | 
			
		||||
 | 
			
		||||
@SNMP::Info::SONMP::ISA = qw/SNMP::Info Exporter/;
 | 
			
		||||
@SNMP::Info::SONMP::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
use vars qw/$VERSION $DEBUG %FUNCS %GLOBALS %MIBS %MUNGE $INIT/;
 | 
			
		||||
# Debug
 | 
			
		||||
$DEBUG=0;
 | 
			
		||||
$SNMP::debugging=$DEBUG;
 | 
			
		||||
 | 
			
		||||
# Five data structures required by SNMP::Info
 | 
			
		||||
$INIT = 0;
 | 
			
		||||
 | 
			
		||||
%MIBS    = (
 | 
			
		||||
            'SYNOPTICS-ROOT-MIB' => 'synoptics',
 | 
			
		||||
            'S5-ETH-MULTISEG-TOPOLOGY-MIB' => 's5EnMsTop',
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
%GLOBALS = (
 | 
			
		||||
            'cdp_id'  => 's5EnMsTopIpAddr',
 | 
			
		||||
            'cdp_run' => 's5EnMsTopStatus',
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
%FUNCS  = (
 | 
			
		||||
            # From S5-ETH-MULTISEG-TOPOLOGY-MIB::TopNmmTable
 | 
			
		||||
            'sonmp_topo_slot'     => 's5EnMsTopNmmSlot',
 | 
			
		||||
            'sonmp_topo_port'     => 's5EnMsTopNmmPort',
 | 
			
		||||
            'sonmp_topo_ip'       => 's5EnMsTopNmmIpAddr',
 | 
			
		||||
            'sonmp_topo_seg'      => 's5EnMsTopNmmSegId',
 | 
			
		||||
            'sonmp_topo_mac'      => 's5EnMsTopNmmMacAddr',
 | 
			
		||||
            'sonmp_topo_platform' => 's5EnMsTopNmmChassisType',
 | 
			
		||||
            'sonmp_topo_localseg' => 's5EnMsTopNmmLocalSeg',
 | 
			
		||||
          );
 | 
			
		||||
 | 
			
		||||
%MUNGE = (
 | 
			
		||||
         'sonmp_topo_mac'           => \&SNMP::Info::munge_mac
 | 
			
		||||
         );
 | 
			
		||||
 | 
			
		||||
sub index_factor {
 | 
			
		||||
    return 32;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub slot_offset {
 | 
			
		||||
    return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub port_offset {
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub hasCDP {
 | 
			
		||||
    my $sonmp = shift;
 | 
			
		||||
    return $sonmp->cdp_run();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
sub c_if {
 | 
			
		||||
    my $sonmp = shift;
 | 
			
		||||
    my $sonmp_topo_port = $sonmp->sonmp_topo_port();
 | 
			
		||||
    my $sonmp_topo_slot = $sonmp->sonmp_topo_slot();
 | 
			
		||||
    my $index_factor = $sonmp->index_factor();
 | 
			
		||||
    my $slot_offset = $sonmp->slot_offset();
 | 
			
		||||
    my $port_offset = $sonmp->port_offset();
 | 
			
		||||
    my $model = $sonmp->model();
 | 
			
		||||
 | 
			
		||||
    my %c_if;
 | 
			
		||||
    foreach my $entry (keys %$sonmp_topo_port){
 | 
			
		||||
        my $port = $sonmp_topo_port->{$entry};
 | 
			
		||||
        next unless defined $port;
 | 
			
		||||
        next if $port == 0;
 | 
			
		||||
        my $slot = $sonmp_topo_slot->{$entry}||0;
 | 
			
		||||
 | 
			
		||||
        if ($model eq 'Baystack Hub') {
 | 
			
		||||
        my $comidx = $slot;
 | 
			
		||||
            if (! ($comidx % 5)) {
 | 
			
		||||
               $slot = ($slot / 5);
 | 
			
		||||
            } elsif ($comidx =~ /[16]$/) {
 | 
			
		||||
               $slot = int($slot/5);
 | 
			
		||||
               $port = 25;          
 | 
			
		||||
            } elsif ($comidx =~ /[27]$/) {
 | 
			
		||||
               $slot = int($slot/5);
 | 
			
		||||
               $port = 26;          
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        my $index = (($slot-$slot_offset)*$index_factor) + ($port-$port_offset);
 | 
			
		||||
        
 | 
			
		||||
        $c_if{"$index.1"} = $index;
 | 
			
		||||
    }
 | 
			
		||||
    return \%c_if;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub c_ip {
 | 
			
		||||
    my $sonmp = shift;
 | 
			
		||||
    my $sonmp_topo_ip   = $sonmp->sonmp_topo_ip();
 | 
			
		||||
    my $sonmp_topo_port = $sonmp->sonmp_topo_port();
 | 
			
		||||
    my $sonmp_topo_slot = $sonmp->sonmp_topo_slot();
 | 
			
		||||
    my $ip = $sonmp->cdp_id();
 | 
			
		||||
    my $index_factor = $sonmp->index_factor();
 | 
			
		||||
    my $slot_offset = $sonmp->slot_offset();
 | 
			
		||||
    my $port_offset = $sonmp->port_offset();
 | 
			
		||||
    my $model = $sonmp->model();
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
    # Count the number of devices seen on each port.
 | 
			
		||||
    # more than one device seen means connected to a non-sonmp
 | 
			
		||||
    # device, but other sonmp devices are squawking further away.
 | 
			
		||||
    my %ip_port;
 | 
			
		||||
    foreach my $entry (keys %$sonmp_topo_ip){
 | 
			
		||||
        my $port = $sonmp_topo_port->{$entry};
 | 
			
		||||
        next unless defined $port;
 | 
			
		||||
        next if ($port =~ /^[\d\.]+$/ and $port == 0);
 | 
			
		||||
        my $slot = $sonmp_topo_slot->{$entry}||0;
 | 
			
		||||
        
 | 
			
		||||
        if ($model eq 'Baystack Hub') {
 | 
			
		||||
            my $comidx = $slot;
 | 
			
		||||
               if (! ($comidx % 5)) {
 | 
			
		||||
                  $slot = ($slot / 5);
 | 
			
		||||
               } elsif ($comidx =~ /[16]$/) {
 | 
			
		||||
                  $slot = int($slot/5);
 | 
			
		||||
                  $port = 25;          
 | 
			
		||||
               } elsif ($comidx =~ /[27]$/) {
 | 
			
		||||
                  $slot = int($slot/5);
 | 
			
		||||
                  $port = 26;          
 | 
			
		||||
               }
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
        my $index = (($slot-$slot_offset)*$index_factor) + ($port-$port_offset);
 | 
			
		||||
        
 | 
			
		||||
        my $ip = $sonmp_topo_ip->{$entry};
 | 
			
		||||
        push(@{$ip_port{$index}},$ip);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    my %c_ip;
 | 
			
		||||
    foreach my $port (keys %ip_port){
 | 
			
		||||
        my $ips = $ip_port{$port};
 | 
			
		||||
        if (scalar @$ips == 1) {
 | 
			
		||||
            $c_ip{"$port.1"} = $ips->[0];
 | 
			
		||||
        } else {
 | 
			
		||||
            $c_ip{"$port.1"} = $ips;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return \%c_ip;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub c_port {
 | 
			
		||||
    my $sonmp = shift;
 | 
			
		||||
    my $sonmp_topo_port = $sonmp->sonmp_topo_port();
 | 
			
		||||
    my $sonmp_topo_seg = $sonmp->sonmp_topo_seg();
 | 
			
		||||
    my $sonmp_topo_slot = $sonmp->sonmp_topo_slot();
 | 
			
		||||
    my $index_factor = $sonmp->index_factor();
 | 
			
		||||
    my $slot_offset = $sonmp->slot_offset();
 | 
			
		||||
    my $port_offset = $sonmp->port_offset();
 | 
			
		||||
    my $model = $sonmp->model();
 | 
			
		||||
    my $sonmp_topo_platform = $sonmp->sonmp_topo_platform();
 | 
			
		||||
 | 
			
		||||
    my %c_port;
 | 
			
		||||
    foreach my $entry (keys %$sonmp_topo_seg){
 | 
			
		||||
        my $port = $sonmp_topo_port->{$entry};
 | 
			
		||||
        next unless defined $port;
 | 
			
		||||
        next if $port == 0;
 | 
			
		||||
        my $slot = $sonmp_topo_slot->{$entry};
 | 
			
		||||
        $slot = 0 unless defined $slot;
 | 
			
		||||
 | 
			
		||||
        if ($model eq 'Baystack Hub') {
 | 
			
		||||
            my $comidx = $slot;
 | 
			
		||||
               if (! ($comidx % 5)) {
 | 
			
		||||
                  $slot = ($slot / 5);
 | 
			
		||||
               } elsif ($comidx =~ /[16]$/) {
 | 
			
		||||
                  $slot = int($slot/5);
 | 
			
		||||
                  $port = 25;          
 | 
			
		||||
               } elsif ($comidx =~ /[27]$/) {
 | 
			
		||||
                  $slot = int($slot/5);
 | 
			
		||||
                  $port = 26;          
 | 
			
		||||
               }
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
        my $index = (($slot-$slot_offset)*$index_factor) + ($port-$port_offset);
 | 
			
		||||
        
 | 
			
		||||
        # For fake remotes (multiple IPs for a c_ip), use first found
 | 
			
		||||
        next if defined $c_port{"$index.1"};
 | 
			
		||||
 | 
			
		||||
        my $seg  = $sonmp_topo_seg->{$entry};
 | 
			
		||||
        my $platform = $sonmp_topo_platform->{$entry};
 | 
			
		||||
        # AP-222x Series does not adhere to port numbering
 | 
			
		||||
        if ($platform =~ /AccessPoint/i) {
 | 
			
		||||
            $c_port{"$index.1"} = 'dp0';
 | 
			
		||||
        }
 | 
			
		||||
        # BayHubs send the lower three bytes of the MAC not the slot/port        
 | 
			
		||||
        elsif ($seg > 4000) {
 | 
			
		||||
            $c_port{"$index.1"} = 'unknown';
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            # Segment id is (256 * remote slot_num) + (remote_port)
 | 
			
		||||
            my $remote_port = $seg % 256;
 | 
			
		||||
	    my $remote_slot = int($seg / 256);
 | 
			
		||||
    
 | 
			
		||||
           $c_port{"$index.1"} = "$remote_slot.$remote_port";
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return \%c_port;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub c_platform {
 | 
			
		||||
    my $sonmp = shift;
 | 
			
		||||
    my $sonmp_topo_port = $sonmp->sonmp_topo_port();
 | 
			
		||||
    my $sonmp_topo_slot = $sonmp->sonmp_topo_slot();
 | 
			
		||||
    my $sonmp_topo_platform = $sonmp->sonmp_topo_platform();
 | 
			
		||||
    my $index_factor = $sonmp->index_factor();
 | 
			
		||||
    my $slot_offset = $sonmp->slot_offset();
 | 
			
		||||
    my $port_offset = $sonmp->port_offset();
 | 
			
		||||
    my $model = $sonmp->model();
 | 
			
		||||
 | 
			
		||||
    my %c_platform;
 | 
			
		||||
    foreach my $entry (keys %$sonmp_topo_platform){
 | 
			
		||||
        my $port = $sonmp_topo_port->{$entry}||0;
 | 
			
		||||
        next if $port == 0;
 | 
			
		||||
        my $slot = $sonmp_topo_slot->{$entry};
 | 
			
		||||
        $slot = 0 unless defined $slot;
 | 
			
		||||
 | 
			
		||||
        if ($model eq 'Baystack Hub') {
 | 
			
		||||
            my $comidx = $slot;
 | 
			
		||||
               if (! ($comidx % 5)) {
 | 
			
		||||
                  $slot = ($slot / 5);
 | 
			
		||||
               } elsif ($comidx =~ /[16]$/) {
 | 
			
		||||
                  $slot = int($slot/5);
 | 
			
		||||
                  $port = 25;          
 | 
			
		||||
               } elsif ($comidx =~ /[27]$/) {
 | 
			
		||||
                  $slot = int($slot/5);
 | 
			
		||||
                  $port = 26;          
 | 
			
		||||
               }
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
        my $index = (($slot-$slot_offset)*$index_factor) + ($port-$port_offset);
 | 
			
		||||
        
 | 
			
		||||
        # For fake remotes (multiple IPs for a c_ip), use first found
 | 
			
		||||
        next if defined $c_platform{"$index.1"};
 | 
			
		||||
 | 
			
		||||
        my $platform  = $sonmp_topo_platform->{$entry};
 | 
			
		||||
 | 
			
		||||
        $c_platform{"$index.1"} = $platform;
 | 
			
		||||
    }
 | 
			
		||||
    return \%c_platform;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub mac {
 | 
			
		||||
    my $sonmp = shift;
 | 
			
		||||
    my $sonmp_topo_port = $sonmp->sonmp_topo_port();
 | 
			
		||||
    my $sonmp_topo_mac = $sonmp->sonmp_topo_mac();
 | 
			
		||||
    
 | 
			
		||||
    foreach my $entry (keys %$sonmp_topo_port){
 | 
			
		||||
        my $port = $sonmp_topo_port->{$entry};
 | 
			
		||||
        next unless $port == 0;
 | 
			
		||||
        my $mac = $sonmp_topo_mac->{$entry};
 | 
			
		||||
	return $mac;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
1;
 | 
			
		||||
__END__
 | 
			
		||||
 | 
			
		||||
=head1 NAME
 | 
			
		||||
 | 
			
		||||
SNMP::Info::SONMP - Perl5 Interface to SynOptics Network Management Protocol (SONMP) using SNMP
 | 
			
		||||
 | 
			
		||||
=head1 AUTHOR
 | 
			
		||||
 | 
			
		||||
Max Baker (C<max@warped.org>),  
 | 
			
		||||
Eric Miller (C<eric@jeneric.org>)
 | 
			
		||||
 | 
			
		||||
=head1 SYNOPSIS
 | 
			
		||||
 | 
			
		||||
 my $sonmp = new SNMP::Info ( 
 | 
			
		||||
                             AutoSpecify => 1,
 | 
			
		||||
                             Debug       => 1,
 | 
			
		||||
                             DestHost    => 'router', 
 | 
			
		||||
                             Community   => 'public',
 | 
			
		||||
                             Version     => 2
 | 
			
		||||
                           );
 | 
			
		||||
 | 
			
		||||
 my $class = $sonmp->class();
 | 
			
		||||
 print " Using device sub class : $class\n";
 | 
			
		||||
 | 
			
		||||
 $hascdp   = $sonmp->hasCDP() ? 'yes' : 'no';
 | 
			
		||||
 | 
			
		||||
 # Print out a map of device ports with CDP neighbors:
 | 
			
		||||
 my $interfaces = $sonmp->interfaces();
 | 
			
		||||
 my $c_if       = $sonmp->c_if();
 | 
			
		||||
 my $c_ip       = $sonmp->c_ip();
 | 
			
		||||
 my $c_port     = $sonmp->c_port();
 | 
			
		||||
 | 
			
		||||
 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";
 | 
			
		||||
 }
 | 
			
		||||
 | 
			
		||||
=head1 DESCRIPTION
 | 
			
		||||
 | 
			
		||||
SNMP::Info::SONMP is a subclass of SNMP::Info that provides an object oriented 
 | 
			
		||||
interface to the SynOptics Network Management Protocol (SONMP) information
 | 
			
		||||
through SNMP.
 | 
			
		||||
 | 
			
		||||
SONMP is a Layer 2 protocol that supplies topology information of devices that also speak SONMP, 
 | 
			
		||||
mostly switches and hubs.  SONMP is implemented in SynOptics, Bay, and Nortel Networks devices.
 | 
			
		||||
SONMP has been rebranded by Bay then Nortel Networks and is know by several different
 | 
			
		||||
names.
 | 
			
		||||
 | 
			
		||||
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.
 | 
			
		||||
 | 
			
		||||
=head2 Inherited Classes
 | 
			
		||||
 | 
			
		||||
None.
 | 
			
		||||
 | 
			
		||||
=head2 Required MIBs
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item SYNOPTICS-ROOT-MIB
 | 
			
		||||
 | 
			
		||||
=item S5-ETH-MULTISEG-TOPOLOGY-MIB
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
MIBs can be found on the CD that came with your product.
 | 
			
		||||
 | 
			
		||||
Or, they can be downloaded directly from Nortel Networks regardless of support
 | 
			
		||||
contract status.
 | 
			
		||||
 | 
			
		||||
Go to http://www.nortelnetworks.com Techninal Support, Browse Technical Support,
 | 
			
		||||
Select by product, Java Device Manager, Software.  Download the latest version.
 | 
			
		||||
After installation, all mibs are located under the install directory under mibs
 | 
			
		||||
and the repspective product line.
 | 
			
		||||
 | 
			
		||||
Note:  Required version of SYNOPTICS-ROOT-MIB, must be version 199 or higher,
 | 
			
		||||
for example synro199.mib.
 | 
			
		||||
 | 
			
		||||
=head1 GLOBAL METHODS
 | 
			
		||||
 | 
			
		||||
These are methods that return scalar values from SNMP
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item  $sonmp->index_factor()
 | 
			
		||||
 | 
			
		||||
Returns a number representing the number of ports reserved per slot or switch
 | 
			
		||||
within the device MIB.  Defaults to 32.
 | 
			
		||||
 | 
			
		||||
=item $sonmp->slot_offset()
 | 
			
		||||
 | 
			
		||||
Returns the offset if slot numbering does not start at 0.  Defaults to 1.
 | 
			
		||||
 | 
			
		||||
=item $sonmp->port_offset()
 | 
			
		||||
 | 
			
		||||
Returns the offset if port numbering does not start at 0.  Defaults to 0. 
 | 
			
		||||
 | 
			
		||||
=item  $cdp->hasCDP()
 | 
			
		||||
 | 
			
		||||
Is CDP is active in this device?
 | 
			
		||||
 | 
			
		||||
=item $sonmp->cdp_id()
 | 
			
		||||
 | 
			
		||||
Returns the IP that the device is sending out for its Nmm topology info.
 | 
			
		||||
 | 
			
		||||
(B<s5EnMsTopIpAddr>)
 | 
			
		||||
 | 
			
		||||
=item $sonmp->cdp_run()
 | 
			
		||||
 | 
			
		||||
Returns if the S5-ETH-MULTISEG-TOPOLOGY info is on for this device. 
 | 
			
		||||
 | 
			
		||||
(B<s5EnMsTopStatus>)
 | 
			
		||||
 | 
			
		||||
=item $sonmp->mac()
 | 
			
		||||
 | 
			
		||||
Returns MAC of the advertised IP address of the device. 
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head1 TABLE METHODS
 | 
			
		||||
 | 
			
		||||
These are methods that return tables of information in the form of a reference
 | 
			
		||||
to a hash.
 | 
			
		||||
 | 
			
		||||
=head2 Layer2 Topology info (s5EnMsTopNmmTable)
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $sonmp->sonmp_topo_slot()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Key: Table entry, Value:slot number
 | 
			
		||||
 | 
			
		||||
(B<s5EnMsTopNmmSlot>)
 | 
			
		||||
 | 
			
		||||
=item $sonmp->sonmp_topo_port()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Key: Table entry, Value:Port Number (interface iid)
 | 
			
		||||
 | 
			
		||||
(B<s5EnMsTopNmmPort>)
 | 
			
		||||
 | 
			
		||||
=item $sonmp->sonmp_topo_ip()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Key: Table entry, Value:Remote IP address of entry
 | 
			
		||||
 | 
			
		||||
(B<s5EnMsTopNmmIpAddr>)
 | 
			
		||||
 | 
			
		||||
=item $sonmp->sonmp_topo_seg()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Key: Table entry, Value:Remote Segment ID
 | 
			
		||||
 | 
			
		||||
(B<s5EnMsTopNmmSegId>)
 | 
			
		||||
 | 
			
		||||
=item $sonmp->sonmp_topo_mac
 | 
			
		||||
 | 
			
		||||
(B<s5EnMsTopNmmMacAddr>)
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Key: Table entry, Value:Remote MAC address
 | 
			
		||||
 | 
			
		||||
=item $sonmp->sonmp_topo_platform
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Key: Table entry, Value:Remote Device Type
 | 
			
		||||
 | 
			
		||||
(B<s5EnMsTopNmmChassisType>)
 | 
			
		||||
 | 
			
		||||
=item $sonmp->sonmp_topo_localseg
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Key: Table entry, Value:Boolean, if bay_topo_seg() is local
 | 
			
		||||
 | 
			
		||||
(B<s5EnMsTopNmmLocalSeg>)
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=head2 Psuedo CDP information
 | 
			
		||||
 | 
			
		||||
All entries with port=0 are local and ignored.
 | 
			
		||||
 | 
			
		||||
=over
 | 
			
		||||
 | 
			
		||||
=item $sonmp->c_if()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash.  Key: ifIndex.1 Value: port (iid)
 | 
			
		||||
 | 
			
		||||
=item $sonmp->c_ip()
 | 
			
		||||
 | 
			
		||||
Returns referenece to hash.  Key: ifIndex.1 
 | 
			
		||||
 | 
			
		||||
The value of each hash entry can either be a scalar or an array.
 | 
			
		||||
A scalar value is most likely a direct neighbor to that port. 
 | 
			
		||||
It is possible that there is a non-SONMP device in between this device and the remote device.
 | 
			
		||||
 | 
			
		||||
An array value represents a list of seen devices.  The only time you will get an array
 | 
			
		||||
of neighbors, is if there is a non-SONMP device in between two or more devices. 
 | 
			
		||||
 | 
			
		||||
Use the data from the Layer2 Topology Table below to dig deeper.
 | 
			
		||||
 | 
			
		||||
=item $sonmp->c_port()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash. Key: ifIndex.1 Value: remote port
 | 
			
		||||
 | 
			
		||||
=item $sonmp->c_platform()
 | 
			
		||||
 | 
			
		||||
Returns reference to hash. Key: ifIndex.1 Value: Remote Device Type
 | 
			
		||||
 | 
			
		||||
=back
 | 
			
		||||
 | 
			
		||||
=cut
 | 
			
		||||
							
								
								
									
										25
									
								
								MANIFEST
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								MANIFEST
									
									
									
									
									
								
							@@ -1,27 +1,52 @@
 | 
			
		||||
COPYRIGHT
 | 
			
		||||
ChangeLog
 | 
			
		||||
DeviceMatrix.txt
 | 
			
		||||
Info.pm
 | 
			
		||||
Info/Bridge.pm
 | 
			
		||||
Info/CDP.pm
 | 
			
		||||
Info/CiscoStack.pm
 | 
			
		||||
Info/CiscoStats.pm
 | 
			
		||||
Info/CiscoVTP.pm
 | 
			
		||||
Info/Entity.pm
 | 
			
		||||
Info/EtherLike.pm
 | 
			
		||||
Info/FDP.pm
 | 
			
		||||
Info/Layer1.pm
 | 
			
		||||
Info/Layer1/Allied.pm
 | 
			
		||||
Info/Layer1/Asante.pm
 | 
			
		||||
Info/Layer1/Bayhub.pm
 | 
			
		||||
Info/Layer2.pm
 | 
			
		||||
Info/Layer2/Aironet.pm
 | 
			
		||||
Info/Layer2/Allied.pm
 | 
			
		||||
Info/Layer2/Bay.pm
 | 
			
		||||
Info/Layer2/Baystack.pm
 | 
			
		||||
Info/Layer2/C1900.pm
 | 
			
		||||
Info/Layer2/C2900.pm
 | 
			
		||||
Info/Layer2/Catalyst.pm
 | 
			
		||||
Info/Layer2/Centillion.pm
 | 
			
		||||
Info/Layer2/HP.pm
 | 
			
		||||
Info/Layer2/NAP222x.pm
 | 
			
		||||
Info/Layer2/Orinoco.pm
 | 
			
		||||
Info/Layer2/ZyXEL_DSLAM.pm
 | 
			
		||||
Info/Layer3.pm
 | 
			
		||||
Info/Layer3/Aironet.pm
 | 
			
		||||
Info/Layer3/AlteonAD.pm
 | 
			
		||||
Info/Layer3/BayRS.pm
 | 
			
		||||
Info/Layer3/C3550.pm
 | 
			
		||||
Info/Layer3/C6500.pm
 | 
			
		||||
Info/Layer3/Cisco.pm
 | 
			
		||||
Info/Layer3/Contivity.pm
 | 
			
		||||
Info/Layer3/Foundry.pm
 | 
			
		||||
Info/Layer3/Passport.pm
 | 
			
		||||
Info/MAU.pm
 | 
			
		||||
Info/NortelStack.pm
 | 
			
		||||
Info/RapidCity.pm
 | 
			
		||||
Info/SONMP.pm
 | 
			
		||||
MANIFEST
 | 
			
		||||
Makefile.PL
 | 
			
		||||
README
 | 
			
		||||
t/DeviceMatrix.html
 | 
			
		||||
t/DeviceMatrix.png
 | 
			
		||||
t/lucon.ttf
 | 
			
		||||
t/make_dev_matrix.pl
 | 
			
		||||
t/prereq.t
 | 
			
		||||
t/test_class.pl
 | 
			
		||||
 
 | 
			
		||||
@@ -21,5 +21,6 @@ WriteMakefile(
 | 
			
		||||
 | 
			
		||||
sub MY::postamble { "
 | 
			
		||||
.PHONY: readme
 | 
			
		||||
readme:
 | 
			
		||||
readme: README
 | 
			
		||||
README: Info.pm
 | 
			
		||||
	pod2text -l Info.pm > README" }
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										296
									
								
								README
									
									
									
									
									
								
							
							
						
						
									
										296
									
								
								README
									
									
									
									
									
								
							@@ -5,14 +5,12 @@ NAME
 | 
			
		||||
 | 
			
		||||
VERSION
 | 
			
		||||
 | 
			
		||||
    SNMP::Info - Version 0.6
 | 
			
		||||
    SNMP::Info - Version 0.9
 | 
			
		||||
 | 
			
		||||
AUTHOR
 | 
			
		||||
 | 
			
		||||
    Max Baker ("max@warped.org")
 | 
			
		||||
 | 
			
		||||
    SNMP::Info was created at UCSC for the netdisco project
 | 
			
		||||
    (www.netdisco.org)
 | 
			
		||||
    (www.netdisco.org) and is written and maintained by Max Baker.
 | 
			
		||||
 | 
			
		||||
SYNOPSIS
 | 
			
		||||
 | 
			
		||||
@@ -26,13 +24,13 @@ SYNOPSIS
 | 
			
		||||
                                DestHost    => 'router',
 | 
			
		||||
                                Community   => 'public',
 | 
			
		||||
                                Version     => 2 
 | 
			
		||||
                              ) or die "Can't connect to device.\n"
 | 
			
		||||
                              ) or die "Can't connect to device.\n";
 | 
			
		||||
 | 
			
		||||
     my $err = $info->error();
 | 
			
		||||
     die "SNMP Community or Version probably wrong connecting to device. $err\n" if defined $err;
 | 
			
		||||
 | 
			
		||||
     $name  = $info->name();
 | 
			
		||||
     $class = $info->class()
 | 
			
		||||
     $class = $info->class();
 | 
			
		||||
     print "SNMP::Info is using this device class : $class\n";
 | 
			
		||||
 | 
			
		||||
     # Find out the Duplex status for the ports
 | 
			
		||||
@@ -68,7 +66,7 @@ SUPPORT
 | 
			
		||||
 | 
			
		||||
    Please direct all support, help, and bug requests to the snmp-info-users
 | 
			
		||||
    Mailing List at
 | 
			
		||||
    http://lists.sourceforge.net/lists/listinfo/snmp-info-users
 | 
			
		||||
    <http://lists.sourceforge.net/lists/listinfo/snmp-info-users>.
 | 
			
		||||
 | 
			
		||||
DESCRIPTION
 | 
			
		||||
 | 
			
		||||
@@ -93,14 +91,14 @@ DESCRIPTION
 | 
			
		||||
    vendor specific. SNMP::Info provides you a common method for all
 | 
			
		||||
    supported devices.
 | 
			
		||||
 | 
			
		||||
    Adding support for your own device is easy, and takes little much SNMP
 | 
			
		||||
    Adding support for your own device is easy, and takes little SNMP
 | 
			
		||||
    knowledge.
 | 
			
		||||
 | 
			
		||||
    The module is not limited to network devices. Any MIB or device can be
 | 
			
		||||
    given an objected oriented front-end by making a module that consists of
 | 
			
		||||
    a couple hashes. See EXTENDING SNMP::INFO.
 | 
			
		||||
 | 
			
		||||
  Requirements
 | 
			
		||||
REQUIREMENTS
 | 
			
		||||
 | 
			
		||||
    1. Net-SNMP
 | 
			
		||||
        To use this module, you must have Net-SNMP installed on your system.
 | 
			
		||||
@@ -118,18 +116,28 @@ DESCRIPTION
 | 
			
		||||
 | 
			
		||||
        Net-SNMP can be found at http://net-snmp.sourceforge.net
 | 
			
		||||
 | 
			
		||||
        Version 5.0.2 or greater is recommended. Various version 4's will
 | 
			
		||||
        work, and 5.0.1 is kinda flaky on the Perl side.
 | 
			
		||||
        Version 5.1.2 or greater is recommended.
 | 
			
		||||
 | 
			
		||||
        Note: Net-SNMP was previously called ucd-snmp.
 | 
			
		||||
        Various version 4's and 5.0 and 5.1 series will work. 5.0.1 is kinda
 | 
			
		||||
        flaky on the Perl side.
 | 
			
		||||
 | 
			
		||||
        Redhat Users: Certain versions that comes with certain versions of
 | 
			
		||||
        Redhat/Fedora doesn't have the Perl library installed. Uninstall the
 | 
			
		||||
        RPM and install by hand.
 | 
			
		||||
 | 
			
		||||
    2. MIBS
 | 
			
		||||
        SNMP::Info operates on textual descriptors found in MIBs. MIBs are
 | 
			
		||||
        text databases that are freely and easily obtainable on the Net.
 | 
			
		||||
        SNMP::Info operates on textual descriptors found in MIBs.
 | 
			
		||||
 | 
			
		||||
        If you are using SNMP::Info separate from Netdisco, download the
 | 
			
		||||
        Netdisco-MIB package at
 | 
			
		||||
 | 
			
		||||
         http://sourceforge.net/project/showfiles.php?group_id=80033&package_id=135517
 | 
			
		||||
 | 
			
		||||
        Make sure that your snmp.conf is updated to point to your MIB
 | 
			
		||||
        directory and that the MIBs are world-readable.
 | 
			
		||||
 | 
			
		||||
        To do it by hand:
 | 
			
		||||
 | 
			
		||||
        Then run "snmpconf" and setup that directory as default. Move
 | 
			
		||||
        snmp.conf into /usr/local/share/snmp when you are done.
 | 
			
		||||
 | 
			
		||||
@@ -154,11 +162,13 @@ DESCRIPTION
 | 
			
		||||
            BRIDGE-MIB
 | 
			
		||||
            SNMP-REPEATER-MIB
 | 
			
		||||
            STAND-ALONE-ETHERNET-SWITCH-MIB (ESSWITCH-MIB)
 | 
			
		||||
            TOKEN-RING-RMON-MIB
 | 
			
		||||
 | 
			
		||||
            by running
 | 
			
		||||
 | 
			
		||||
             mkdir -p /usr/local/share/snmp/mibs
 | 
			
		||||
             cd /usr/local/share/snmp/mibs
 | 
			
		||||
             tar xvfz /path/to/v1.tar.gz BRIDGE-MIB.my SNMP-REPEATER-MIB.my ESSWITCH-MIB.my
 | 
			
		||||
             tar xvfz /path/to/v1.tar.gz BRIDGE-MIB.my SNMP-REPEATER-MIB.my ESSWITCH-MIB.my TOKEN-RING-RMON-MIB.my
 | 
			
		||||
 | 
			
		||||
        More Specific MIBs
 | 
			
		||||
            Some non-cisco subclasses will need MIBs other than the basic
 | 
			
		||||
@@ -166,16 +176,17 @@ DESCRIPTION
 | 
			
		||||
 | 
			
		||||
            Check below under each subclass for requirements.
 | 
			
		||||
 | 
			
		||||
  Design Goals
 | 
			
		||||
DESIGN GOALS
 | 
			
		||||
 | 
			
		||||
    1. Use of textual MIB leaf identifier and enumerated values
 | 
			
		||||
 | 
			
		||||
        * All values are retrieved via MIB Leaf node names
 | 
			
		||||
            For example SNMP::Info has an entry in its %GLOBALS hash for
 | 
			
		||||
            ``sysName'' instead of 1.3.6.1.2.1.1.5.
 | 
			
		||||
 | 
			
		||||
        * Data returned is in the enumerated value form.
 | 
			
		||||
            For Example instead of looking up 1.3.6.1.2.1.2.2.1.3 and
 | 
			
		||||
            getting back "23"
 | 
			
		||||
            getting back 23
 | 
			
		||||
 | 
			
		||||
            SNMP::Info will ask for "RFC1213-MIB::ifType" and will get back
 | 
			
		||||
            "ppp".
 | 
			
		||||
@@ -190,10 +201,10 @@ DESCRIPTION
 | 
			
		||||
        See the section EXTENDING SNMP::INFO for more details.
 | 
			
		||||
 | 
			
		||||
        When you make a new subclass for a device, please be sure to send it
 | 
			
		||||
        back to the developers at snmp@warped.org for inclusion in the next
 | 
			
		||||
        version.
 | 
			
		||||
        back to the developers (via Source Forge or the mailing list) for
 | 
			
		||||
        inclusion in the next version.
 | 
			
		||||
 | 
			
		||||
  Subclasses
 | 
			
		||||
SUBCLASSES
 | 
			
		||||
 | 
			
		||||
    These are the subclasses that implement MIBs and support devices:
 | 
			
		||||
 | 
			
		||||
@@ -205,18 +216,28 @@ DESCRIPTION
 | 
			
		||||
    These subclasses implement method to access one or more MIBs. These are
 | 
			
		||||
    not used directly, but rather inherited from device subclasses.
 | 
			
		||||
 | 
			
		||||
    For more info run "perldoc" on any of the following module names.
 | 
			
		||||
 | 
			
		||||
    SNMP::Info::Bridge
 | 
			
		||||
        BRIDGE-MIB (RFC1286). Inherited by devices with Layer2 service.
 | 
			
		||||
        BRIDGE-MIB (RFC1286). QBRIDGE-MIB. Inherited by devices with Layer2
 | 
			
		||||
        support.
 | 
			
		||||
 | 
			
		||||
    SNMP::Info::CDP
 | 
			
		||||
        CISCO-CDP-MIB. Cisco Discovery Protocol (CDP) Support. Inherited by
 | 
			
		||||
        devices serving Layer2 or Layer3.
 | 
			
		||||
 | 
			
		||||
    SNMP::Info::CiscoStack
 | 
			
		||||
        CISCO-STACK-MIB and CISCO-PORT-SECURITY-MIB
 | 
			
		||||
 | 
			
		||||
    SNMP::Info::CiscoStats
 | 
			
		||||
        Provides common interfaces for memory, cpu, and os statistics for
 | 
			
		||||
        Cisco devices. Provides methods for information in :
 | 
			
		||||
        OLD-CISCO-CPU-MIB, CISCO-PROCESS-MIB and CISCO-MEMORY-POOL-MIB
 | 
			
		||||
 | 
			
		||||
    SNMP::Info::CiscoVTP
 | 
			
		||||
        CISCO-VTP-MIB, CISCO-VLAN-MEMBERSHIP-MIB,
 | 
			
		||||
        CISCO-VLAN-IFTABLE-RELATIONSHIP-MIB
 | 
			
		||||
 | 
			
		||||
    SNMP::Info::Entity
 | 
			
		||||
        ENTITY-MIB. Used for device info in Cisco and other vendors.
 | 
			
		||||
 | 
			
		||||
@@ -224,15 +245,33 @@ DESCRIPTION
 | 
			
		||||
        ETHERLIKE-MIB (RFC1398) - Some Layer3 devices implement this MIB, as
 | 
			
		||||
        well as some Aironet Layer 2 devices (non Cisco).
 | 
			
		||||
 | 
			
		||||
    SNMP::Info::FDP
 | 
			
		||||
        Foundry Discovery Protocol. FOUNDRY-SN-SWITCH-GROUP-MIB
 | 
			
		||||
 | 
			
		||||
    SNMP::Info::MAU
 | 
			
		||||
        MAU-MIB (RFC2668). Some Layer2 devices use this for extended
 | 
			
		||||
        Ethernet (Media Access Unit) interface information.
 | 
			
		||||
 | 
			
		||||
    SNMP::Info::NortelStack
 | 
			
		||||
        S5-AGENT-MIB, S5-CHASSIS-MIB.
 | 
			
		||||
 | 
			
		||||
    SNMP::Info::RapidCity
 | 
			
		||||
        RAPID-CITY. Inhertited by Nortel Networks switches for duplex and
 | 
			
		||||
        VLAN information.
 | 
			
		||||
 | 
			
		||||
    SNMP::Info::SONMP
 | 
			
		||||
        SYNOPTICS-ROOT-MIB, S5-ETH-MULTISEG-TOPOLOGY-MIB. Provides
 | 
			
		||||
        translation from Nortel Networks Topology Table information to CDP.
 | 
			
		||||
        Inherited by Nortel/Bay switches and hubs.
 | 
			
		||||
 | 
			
		||||
  Device Subclasses
 | 
			
		||||
 | 
			
		||||
    These subclasses inherit from one or more classes to provide a common
 | 
			
		||||
    interface to data obtainable from network devices.
 | 
			
		||||
 | 
			
		||||
    All the required MIB files are included in the netdisco-mib package.
 | 
			
		||||
    (See Above).
 | 
			
		||||
 | 
			
		||||
    SNMP::Info::Layer1
 | 
			
		||||
        Generic Layer1 Device subclass.
 | 
			
		||||
 | 
			
		||||
@@ -250,57 +289,131 @@ DESCRIPTION
 | 
			
		||||
 | 
			
		||||
            See SNMP::Info::Layer1::Asante for where to get MIBs required.
 | 
			
		||||
 | 
			
		||||
        SNMP::Info::Layer1::Bayhub
 | 
			
		||||
            Subclass for Nortel/Bay hubs. This includes System 5000, 100
 | 
			
		||||
            series, 200 series, and probably more.
 | 
			
		||||
 | 
			
		||||
            See SNMP::Info::Layer1::Bayhub for where to get MIBs required.
 | 
			
		||||
 | 
			
		||||
    SNMP::Info::Layer2
 | 
			
		||||
        Generic Layer2 Device subclass.
 | 
			
		||||
 | 
			
		||||
        SNMP::Info::Layer2::Aironet
 | 
			
		||||
            Class for Cisco Aironet wireless devices that run IOS. See also
 | 
			
		||||
            Layer3::Aironet for Aironet devices that don't run IOS.
 | 
			
		||||
 | 
			
		||||
        SNMP::Info::Layer2::Allied
 | 
			
		||||
            Allied Telesys switches.
 | 
			
		||||
 | 
			
		||||
        SNMP::Info::Layer2::Bay
 | 
			
		||||
            Bay Networks BayStack switch Support. Provides translation from
 | 
			
		||||
            Bay Network Topology Table information to CDP.
 | 
			
		||||
            Depricated. Use BayStack.
 | 
			
		||||
 | 
			
		||||
            Requires SYNOPTICS-ROOT-MIB and S5-ETH-MULTISEG-TOPOLOGY-MIB
 | 
			
		||||
        SNMP::Info::Layer2::Baystack
 | 
			
		||||
            Subclass for Nortel/Bay Baystack switches. This includes 303,
 | 
			
		||||
            304, 350, 380, 410, 420, 425, 450, 460, 470, 5510, 5520,
 | 
			
		||||
            Business Policy Switch (BPS) and probably others.
 | 
			
		||||
 | 
			
		||||
            See SNMP::Info::Bay for where to get MIBs required.
 | 
			
		||||
            See SNMP::Info::Layer2::Baystack for where to get MIBs required.
 | 
			
		||||
 | 
			
		||||
        SNMP::Info::Layer2::C1900
 | 
			
		||||
            Subclass for Cisco Catalyst 1900 and 1900c Devices running
 | 
			
		||||
            CatOS.
 | 
			
		||||
 | 
			
		||||
        SNMP::Info::Layer2::C2900
 | 
			
		||||
            Subclass for Cisco Catalyst 2900 devices running IOS.
 | 
			
		||||
            Subclass for Cisco Catalyst 2900, 2950, 3500XL, and 3548 devices
 | 
			
		||||
            running IOS.
 | 
			
		||||
 | 
			
		||||
        SNMP::Info::Layer2::Catalyst
 | 
			
		||||
            Subclass for Cisco Catalyst switches running CatOS. These
 | 
			
		||||
            switches usually report a model number that starts with ''wsc''.
 | 
			
		||||
            switches usually report a model number that starts with "wsc".
 | 
			
		||||
            Note that this class does not support everything that has the
 | 
			
		||||
            name Catalyst.
 | 
			
		||||
 | 
			
		||||
        SNMP::Info::Layer2::Centillion
 | 
			
		||||
            Subclass for Nortel/Bay Centillion and 5000BH ATM switches.
 | 
			
		||||
 | 
			
		||||
            See SNMP::Info::Layer2::Centillion for where to get MIBs
 | 
			
		||||
            required.
 | 
			
		||||
 | 
			
		||||
        SNMP::Info::Layer2::HP
 | 
			
		||||
            Subclass for HP Procurve Swithces
 | 
			
		||||
            Subclass for HP Procurve Switches
 | 
			
		||||
 | 
			
		||||
            Requires HP-ICF-OID and ENTITY-MIB downloaded from HP.
 | 
			
		||||
 | 
			
		||||
            See SNMP::Info::Layer2::HP for more info.
 | 
			
		||||
 | 
			
		||||
        SNMP::Info::Layer2::NAP222x
 | 
			
		||||
            Subclass for Nortel Networks' 222x series wireless access
 | 
			
		||||
            points.
 | 
			
		||||
 | 
			
		||||
            See SNMP::Info::Layer2::NAP222x for where to get MIBs required.
 | 
			
		||||
 | 
			
		||||
        SNMP::Info::Layer2::Orinoco
 | 
			
		||||
            Subclass for Orinoco wireless access points.
 | 
			
		||||
 | 
			
		||||
        SNMP::Info::Layer2::ZyXEL_DSLAM
 | 
			
		||||
            Zyxel DSLAMs. Need I say more?
 | 
			
		||||
 | 
			
		||||
    SNMP::Info::Layer3
 | 
			
		||||
        Generic Layer3 and Layer2+3 Device subclass.
 | 
			
		||||
 | 
			
		||||
        SNMP::Info::Layer3::Aironet
 | 
			
		||||
            Subclass for Cisco Aironet wireless access points (AP).
 | 
			
		||||
            Subclass for Cisco Aironet wireless access points (AP) not
 | 
			
		||||
            running IOS. These are usually older devices.
 | 
			
		||||
 | 
			
		||||
            MIBs for these devices now included in v2.tar.gz available from
 | 
			
		||||
            ftp.cisco.com.
 | 
			
		||||
 | 
			
		||||
        SNMP::Info::Layer3::Foundry
 | 
			
		||||
            No longer supported.
 | 
			
		||||
            Note Layer2::Aironet
 | 
			
		||||
 | 
			
		||||
            Subclass for older Foundry Network devices.
 | 
			
		||||
        SNMP::Info::Layer3::AlteonAD
 | 
			
		||||
            Subclass for Nortel Networks' Alteon Ace Director series L2-7
 | 
			
		||||
            switches.
 | 
			
		||||
 | 
			
		||||
            See SNMP::Info::Layer3::AlteonAD for where to get MIBs required.
 | 
			
		||||
 | 
			
		||||
        SNMP::Info::Layer3::BayRS
 | 
			
		||||
            Subclass for Nortel Networks' BayRS routers. This includes BCN,
 | 
			
		||||
            BLN, ASN, ARN, and AN routers.
 | 
			
		||||
 | 
			
		||||
            See SNMP::Info::Layer3::BayRS for where to get MIBs required.
 | 
			
		||||
 | 
			
		||||
        SNMP::Info::Layer3::C3550
 | 
			
		||||
            Subclass for Cisco Catalyst 3550,3540,3560 2/3 switches running
 | 
			
		||||
            IOS.
 | 
			
		||||
 | 
			
		||||
        SNMP::Info::Layer3::C6500
 | 
			
		||||
            This class covers Catalyst 6500s in native mode, hybrid mode.
 | 
			
		||||
            Catalyst 4000's, 3750's, 2970's and probably others.
 | 
			
		||||
 | 
			
		||||
        SNMP::Info::Layer3::Cisco
 | 
			
		||||
            This is a simple wrapper around Layer3 for IOS devices. It adds
 | 
			
		||||
            on CiscoVTP.
 | 
			
		||||
 | 
			
		||||
        SNMP::Info::Layer3::Contivity
 | 
			
		||||
            Subclass for Nortel Networks' Contivity VPN concentrators.
 | 
			
		||||
 | 
			
		||||
            See SNMP::Info::Layer3::Contivity for where to get MIBs
 | 
			
		||||
            required.
 | 
			
		||||
 | 
			
		||||
        SNMP::Info::Layer3::Foundry
 | 
			
		||||
            Subclass for older Foundry Network devices. Outdated, but being
 | 
			
		||||
            updated for newer devices.
 | 
			
		||||
 | 
			
		||||
            Requires FOUNDRY-SN-ROOT-MIB.
 | 
			
		||||
 | 
			
		||||
            See SNMP::Info::Layer3::Foundry for more info.
 | 
			
		||||
 | 
			
		||||
        SNMP::Info::Layer3::C3550
 | 
			
		||||
            Subclass for Cisco Catalyst 3550 2/3 switches running IOS.
 | 
			
		||||
        SNMP::Info::Layer3::Passport
 | 
			
		||||
            Subclass for Nortel Networks' Passport 8600 series switches.
 | 
			
		||||
 | 
			
		||||
            See SNMP::Info::Layer3::Passport for where to get MIBs required.
 | 
			
		||||
 | 
			
		||||
Thanks
 | 
			
		||||
 | 
			
		||||
    Thanks for testing and coding help (in no particular order) to : Andy
 | 
			
		||||
    Ford, Brian Wilson, Jean-Philippe Luiggi, D<>na Watanabe, Bradley Baetz,
 | 
			
		||||
    Eric Miller, and people listed on the Netdisco README!
 | 
			
		||||
 | 
			
		||||
USAGE
 | 
			
		||||
 | 
			
		||||
@@ -314,20 +427,23 @@ USAGE
 | 
			
		||||
                                    'BigInt'      => 1
 | 
			
		||||
                                    'DestHost'    => 'myrouter',
 | 
			
		||||
                                    'Community'   => 'public',
 | 
			
		||||
                                    'Version'     => 2
 | 
			
		||||
                                    'Version'     => 2,
 | 
			
		||||
                                    'MibDirs'     => ['dir1','dir2','dir3'],
 | 
			
		||||
                                  ) or die;
 | 
			
		||||
 | 
			
		||||
        SNMP::Info Specific Arguments :
 | 
			
		||||
 | 
			
		||||
         AutoSpecify = Returns an object of a more specific device class
 | 
			
		||||
                       *See specify() entry*
 | 
			
		||||
         Debug       = Prints Lots of debugging messages
 | 
			
		||||
         Session     = SNMP::Session object to use instead of connecting on own.
 | 
			
		||||
         BigInt      = Return Math::BigInt objects for 64 bit counters.  Sets on a global scope, not object.
 | 
			
		||||
         Debug       = Prints Lots of debugging messages
 | 
			
		||||
         MibDirs     = Array ref to list of directories in which to look for MIBs.  Note this will
 | 
			
		||||
                       be in addition to the ones setup in snmp.conf at the system level.
 | 
			
		||||
         RetryNoSuch = When using SNMP Version 1, try reading values even if they come back
 | 
			
		||||
                       as "no such variable in this MIB".  Defaults to true, set to false if
 | 
			
		||||
                       so desired.  This feature lets you read SNMPv2 data from an SNMP version
 | 
			
		||||
                       1 connection, and should probably be left on.
 | 
			
		||||
         Session     = SNMP::Session object to use instead of connecting on own.
 | 
			
		||||
 | 
			
		||||
        All other arguments are passed to SNMP::Session.
 | 
			
		||||
 | 
			
		||||
@@ -391,20 +507,34 @@ USAGE
 | 
			
		||||
        Algorithm for Subclass Detection:
 | 
			
		||||
 | 
			
		||||
                Layer3 Support                     -> SNMP::Info::Layer3
 | 
			
		||||
                    Aironet (non IOS)              -> SNMP::Info::Layer3::Aironet
 | 
			
		||||
                    Catalyst 3550                  -> SNMP::Info::Layer3::C3550
 | 
			
		||||
                    Aironet (BR500,AP340,350,1200) -> SNMP::Info::Layer3::Aironet
 | 
			
		||||
                             AP4800... All Non IOS
 | 
			
		||||
                    Catalyst 3550,3548,3560        -> SNMP::Info::Layer3::C3550
 | 
			
		||||
                    Catalyst 6500, 4000, 3750      -> SNMP::Info::Layer3::C6500
 | 
			
		||||
                    Cisco Generic L3 IOS device    -> SNMP::Info::Layer3::Cisco
 | 
			
		||||
                    Foundry                        -> SNMP::Info::Layer3::Foundry
 | 
			
		||||
                    Nortel Passport LAN            -> SNMP::Info::Layer3::Passport
 | 
			
		||||
                    Alteon Ace Director            -> SNMP::Info::Layer3::AlteonAD
 | 
			
		||||
                    Nortel Contivity               -> SNMP::Info::Layer3::Contivity
 | 
			
		||||
                    Nortel BayRS Router            -> SNMP::Info::Layer3::BayRS
 | 
			
		||||
                Elsif Layer2 (no Layer3)           -> SNMP::Info::Layer2
 | 
			
		||||
                    Aironet (Cisco) AP1100         -> SNMP::Info::Layer2::Aironet
 | 
			
		||||
                    Bay Networks                   -> SNMP::Info::Layer2::Bay
 | 
			
		||||
                    Aironet - IOS Devices          -> SNMP::Info::Layer2::Aironet
 | 
			
		||||
                    Catalyst 1900                  -> SNMP::Info::Layer2::C1900
 | 
			
		||||
                    Catalyst 2900XL (IOS)          -> SNMP::Info::Layer2::C2900
 | 
			
		||||
                    Catalyst WS-C (2926,5xxx,6xxx) -> SNMP::Info::Layer2::Catalyst
 | 
			
		||||
                    Catalyst 2900XL,2950,3500XL    -> SNMP::Info::Layer2::C2900
 | 
			
		||||
                    Catalyst 2970                  -> SNMP::Info::Layer3::C6500
 | 
			
		||||
                    Catalyst 3550/3548             -> SNMP::Info::Layer3::C3550
 | 
			
		||||
                    Catalyst WS-C 2926,5xxx        -> SNMP::Info::Layer2::Catalyst
 | 
			
		||||
                    HP Procurve                    -> SNMP::Info::Layer2::HP
 | 
			
		||||
                    Nortel/Bay Centillion ATM      -> SNMP::Info::Layer2::Centillion
 | 
			
		||||
                    Nortel/Bay Baystack            -> SNMP::Info::Layer2::Baystack
 | 
			
		||||
                    Nortel AP 222x                 -> SNMP::Info::Layer2::NAP222x
 | 
			
		||||
                    Orinco AP                      -> SNMP::Info::Layer2::Orinoco
 | 
			
		||||
                Elsif Layer1 Support               -> SNMP::Info::Layer1
 | 
			
		||||
                    Allied                         -> SNMP::Info::Layer1::Allied
 | 
			
		||||
                    Asante                         -> SNMP::Info::Layer1::Asante
 | 
			
		||||
                    Nortel/Bay Hub                 -> SNMP::Info::Layer1::Bayhub
 | 
			
		||||
                Else                               -> SNMP::Info
 | 
			
		||||
                    ZyXEL_DSLAM                    -> SNMP::Info::Layer2::ZyXEL_DSLAM
 | 
			
		||||
 | 
			
		||||
    $info->error(no_clear)
 | 
			
		||||
        Returns Error message if there is an error, or undef if there is
 | 
			
		||||
@@ -420,7 +550,7 @@ USAGE
 | 
			
		||||
        Returns "undef" if the device doesn't support the layers() call.
 | 
			
		||||
 | 
			
		||||
    $info->snmp_comm()
 | 
			
		||||
        Returns SNMP Community string used in conncetion
 | 
			
		||||
        Returns SNMP Community string used in connection.
 | 
			
		||||
 | 
			
		||||
    $info->snmp_ver()
 | 
			
		||||
        Returns SNMP Version used for this connection
 | 
			
		||||
@@ -436,6 +566,14 @@ USAGE
 | 
			
		||||
 | 
			
		||||
        See device_type() entry for how a subclass is chosen.
 | 
			
		||||
 | 
			
		||||
    $info->cisco_comm_indexing()
 | 
			
		||||
        Returns 0. Is an overridable method used for vlan indexing for snmp
 | 
			
		||||
        calls on certain Cisco devices.
 | 
			
		||||
 | 
			
		||||
        See
 | 
			
		||||
        <ftp://ftp.cisco.com/pub/mibs/supportlists/wsc5000/wsc5000-community
 | 
			
		||||
        Indexing.html>
 | 
			
		||||
 | 
			
		||||
  Globals (Scalar Methods)
 | 
			
		||||
 | 
			
		||||
    These are methods to return scalar data from RFC1213.
 | 
			
		||||
@@ -444,7 +582,7 @@ USAGE
 | 
			
		||||
    speaks SNMP.
 | 
			
		||||
 | 
			
		||||
    $info->uptime()
 | 
			
		||||
        Uptime in hundreths of seconds since device became available.
 | 
			
		||||
        Uptime in hundredths of seconds since device became available.
 | 
			
		||||
 | 
			
		||||
        (sysUpTime)
 | 
			
		||||
 | 
			
		||||
@@ -500,7 +638,7 @@ USAGE
 | 
			
		||||
 | 
			
		||||
        $local_routes = $info->ipr_route('192.168.0');
 | 
			
		||||
 | 
			
		||||
    This will only fetch entries in the table that start with "192.168.0",
 | 
			
		||||
    This will only fetch entries in the table that start with 192.168.0,
 | 
			
		||||
    which in this case are routes on the local network.
 | 
			
		||||
 | 
			
		||||
    Remember that you must supply the partial IID (a numeric OID).
 | 
			
		||||
@@ -565,6 +703,11 @@ USAGE
 | 
			
		||||
 | 
			
		||||
        (ifAdminStatus)
 | 
			
		||||
 | 
			
		||||
    $info->i_lastchange()
 | 
			
		||||
        The value of sysUpTime when this port last changed states (up,down).
 | 
			
		||||
 | 
			
		||||
        (IfLastChange)
 | 
			
		||||
 | 
			
		||||
    $info->i_name()
 | 
			
		||||
        Interface Name field. Supported by a smaller subset of devices, this
 | 
			
		||||
        fields is often human set.
 | 
			
		||||
@@ -778,7 +921,7 @@ USAGE
 | 
			
		||||
 | 
			
		||||
        ("ipRouteInfo")
 | 
			
		||||
 | 
			
		||||
  Setting data via SNMP
 | 
			
		||||
SETTING DATA VIA SNMP
 | 
			
		||||
 | 
			
		||||
    This section explains how to use SNMP::Info to do SNMP Set operations.
 | 
			
		||||
 | 
			
		||||
@@ -796,19 +939,19 @@ USAGE
 | 
			
		||||
        Returns undef if failed, or the return value from
 | 
			
		||||
        SNMP::Session::set() (snmp_errno)
 | 
			
		||||
 | 
			
		||||
         # Disable a port administratvely
 | 
			
		||||
         # Disable a port administratively
 | 
			
		||||
         my %if_map = reverse %{$info->interfaces()}
 | 
			
		||||
         $info->set_i_up_admin('down', $if_map{'FastEthernet0/0') 
 | 
			
		||||
         $info->set_i_up_admin('down', $if_map{'FastEthernet0/0'}) 
 | 
			
		||||
            or die "Couldn't disable the port. ",$info->error(1);
 | 
			
		||||
 | 
			
		||||
    NOTE: You must be connected to your device with a ReadWrite community
 | 
			
		||||
    NOTE: You must be connected to your device with a "ReadWrite" community
 | 
			
		||||
    string in order for set operations to work.
 | 
			
		||||
 | 
			
		||||
    NOTE: This will only set data listed in %FUNCS and %GLOBALS. For data
 | 
			
		||||
    aquired from overriden methods (subroutines) specific set_METHOD()
 | 
			
		||||
    subroutines will need to be added.
 | 
			
		||||
    acquired from overriden methods (subroutines) specific set_METHOD()
 | 
			
		||||
    subroutines will need to be added if they haven't been already.
 | 
			
		||||
 | 
			
		||||
  Quiet Mode
 | 
			
		||||
Quiet Mode
 | 
			
		||||
 | 
			
		||||
    SNMP::Info will not chirp anything to STDOUT unless there is a serious
 | 
			
		||||
    error (in which case it will probably die).
 | 
			
		||||
@@ -870,7 +1013,8 @@ EXTENDING SNMP::INFO
 | 
			
		||||
 | 
			
		||||
  Sample Subclass
 | 
			
		||||
 | 
			
		||||
    Let's make a sample Layer 2 Device subclass :
 | 
			
		||||
    Let's make a sample Layer 2 Device subclass. This class will inherit the
 | 
			
		||||
    Cisco Vlan module as an example.
 | 
			
		||||
 | 
			
		||||
    ----------------------- snip --------------------------------
 | 
			
		||||
 | 
			
		||||
@@ -884,23 +1028,28 @@ EXTENDING SNMP::INFO
 | 
			
		||||
 | 
			
		||||
     use Exporter;
 | 
			
		||||
     use SNMP::Info::Layer2;
 | 
			
		||||
     use SNMP::Info::CiscoVTP;
 | 
			
		||||
 | 
			
		||||
     @SNMP::Info::Layer2::Sample::ISA = qw/SNMP::Info::Layer2 Exporter/;
 | 
			
		||||
     @SNMP::Info::Layer2::Sample::ISA = qw/SNMP::Info::Layer2
 | 
			
		||||
                                           SNMP::Info::CiscoVTP Exporter/;
 | 
			
		||||
     @SNMP::Info::Layer2::Sample::EXPORT_OK = qw//;
 | 
			
		||||
 | 
			
		||||
     use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
 | 
			
		||||
 | 
			
		||||
     %MIBS    = (%SNMP::Info::Layer2::MIBS,
 | 
			
		||||
                 %SNMP::Info::CiscoVTP::MIBS,
 | 
			
		||||
                 'SUPER-DOOPER-MIB'  => 'supermibobject'
 | 
			
		||||
                );
 | 
			
		||||
 | 
			
		||||
     %GLOBALS = (%SNMP::Info::Layer2::GLOBALS,
 | 
			
		||||
                 %SNMP::Info::CiscoVTP::GLOBALS,
 | 
			
		||||
                 'name'              => 'supermib_supername',
 | 
			
		||||
                 'favorite_color'    => 'supermib_fav_color_object',
 | 
			
		||||
                 'favorite_movie'    => 'supermib_fav_movie_val'
 | 
			
		||||
                 );
 | 
			
		||||
 | 
			
		||||
     %FUNCS   = (%SNMP::Info::Layer2::FUNCS,
 | 
			
		||||
                 %SNMP::Info::CiscoVTP::FUNCS,
 | 
			
		||||
                 # Super Dooper MIB - Super Hero Table
 | 
			
		||||
                 'super_hero_index'  => 'SuperHeroIfIndex',
 | 
			
		||||
                 'super_hero_name'   => 'SuperHeroIfName',
 | 
			
		||||
@@ -908,6 +1057,7 @@ EXTENDING SNMP::INFO
 | 
			
		||||
                );
 | 
			
		||||
 | 
			
		||||
     %MUNGE   = (%SNMP::Info::Layer2::MUNGE,
 | 
			
		||||
                 %SNMP::Info::CiscoVTP::MUNGE,
 | 
			
		||||
                 'super_hero_powers' => \&munge_powers
 | 
			
		||||
                );
 | 
			
		||||
 | 
			
		||||
@@ -949,8 +1099,9 @@ EXTENDING SNMP::INFO
 | 
			
		||||
     1; # don't forget this line
 | 
			
		||||
    ----------------------- snip --------------------------------
 | 
			
		||||
 | 
			
		||||
    Be sure and send the debugged version to snmp@warped.org to be included
 | 
			
		||||
    in the next version of SNMP::Info.
 | 
			
		||||
    Be sure and send the debugged version to
 | 
			
		||||
    snmp-info-users@lists.sourceforge.net to be included in the next version
 | 
			
		||||
    of SNMP::Info.
 | 
			
		||||
 | 
			
		||||
SNMP::INFO INTERNALS
 | 
			
		||||
 | 
			
		||||
@@ -988,27 +1139,38 @@ SNMP::INFO INTERNALS
 | 
			
		||||
        Makes human friendly speed ratings using %SPEED_MAP
 | 
			
		||||
 | 
			
		||||
         %SPEED_MAP = (
 | 
			
		||||
                        '56000'      => '56 kbps',
 | 
			
		||||
                        '64000'      => '64 kbps',
 | 
			
		||||
                        '1500000'    => '1.5 Mbps',
 | 
			
		||||
                        '1536000'    => 'T1',      
 | 
			
		||||
                        '1544000'    => 'T1',
 | 
			
		||||
                        '2000000'    => '2.0 Mbps',
 | 
			
		||||
                        '2048000'    => '2.048 Mbps',
 | 
			
		||||
                        '3072000'    => 'Dual T1',
 | 
			
		||||
                        '3088000'    => 'Dual T1',   
 | 
			
		||||
                        '4000000'    => '4.0 Mbps',
 | 
			
		||||
                        '10000000'   => '10 Mbps',
 | 
			
		||||
                        '11000000'   => '11 Mbps',
 | 
			
		||||
                        '20000000'   => '20 Mbps',
 | 
			
		||||
                        '16000000'   => '16 Mbps',
 | 
			
		||||
                        '45000000'   => 'DS3',
 | 
			
		||||
                        '16777216'   => '16 Mbps',
 | 
			
		||||
                        '44210000'   => 'T3',
 | 
			
		||||
                        '44736000'   => 'T3',
 | 
			
		||||
                        '45000000'   => '45 Mbps',
 | 
			
		||||
                        '45045000'   => 'DS3',
 | 
			
		||||
                        '46359642'   => 'DS3',
 | 
			
		||||
                        '64000000'   => '64 Mbps',
 | 
			
		||||
                        '100000000'  => '100 Mbps',
 | 
			
		||||
                        '149760000'  => 'OC-1'
 | 
			
		||||
                        '155000000'  => 'OC-1'
 | 
			
		||||
                        '149760000'  => 'ATM on OC-3',
 | 
			
		||||
                        '155000000'  => 'OC-3',
 | 
			
		||||
                        '155519000'  => 'OC-3',
 | 
			
		||||
                        '155520000'  => 'OC-3',
 | 
			
		||||
                        '400000000'  => '400 Mbps',
 | 
			
		||||
                        '599040000'  => 'ATM on OC-12', 
 | 
			
		||||
                        '622000000'  => 'OC-12',
 | 
			
		||||
                        '599040000'  => 'OC-12', 
 | 
			
		||||
                        '622080000'  => 'OC-12',
 | 
			
		||||
                        '1000000000' => '1.0 Gbps',
 | 
			
		||||
                     );
 | 
			
		||||
                     )
 | 
			
		||||
 | 
			
		||||
    munge_ip()
 | 
			
		||||
        Takes a binary IP and makes it dotted ASCII
 | 
			
		||||
@@ -1073,7 +1235,7 @@ SNMP::INFO INTERNALS
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
    $info->_global()
 | 
			
		||||
        Used internally by AUTOLOAD to load dynmaic methods from %GLOBALS.
 | 
			
		||||
        Used internally by AUTOLOAD to load dynamic methods from %GLOBALS.
 | 
			
		||||
 | 
			
		||||
        Example: $info->name() calls autoload which calls
 | 
			
		||||
        $info->_global('name').
 | 
			
		||||
@@ -1133,6 +1295,7 @@ SNMP::INFO INTERNALS
 | 
			
		||||
    3. Method is in %FUNCS
 | 
			
		||||
    4. Run $info->_load_attr(method) if not cached
 | 
			
		||||
    5. Return $info->_show_attr(method).
 | 
			
		||||
 | 
			
		||||
    Override any dynamic method listed in one of these hashes by creating a
 | 
			
		||||
    subroutine with the same name.
 | 
			
		||||
 | 
			
		||||
@@ -1141,8 +1304,11 @@ SNMP::INFO INTERNALS
 | 
			
		||||
 | 
			
		||||
COPYRIGHT AND LICENCE
 | 
			
		||||
 | 
			
		||||
    Copyright (c) 2002-3, Regents of the University of California All rights
 | 
			
		||||
    reserved.
 | 
			
		||||
    Changes from SNMP::Info Version 0.7 and on are: Copyright (c)2003, 2004
 | 
			
		||||
    Max Baker - All rights reserved.
 | 
			
		||||
 | 
			
		||||
    Original Code is: Copyright (c) 2002-3, 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
 | 
			
		||||
 
 | 
			
		||||
@@ -12,10 +12,31 @@ $matrix = parse_data($DevMatrix);
 | 
			
		||||
 | 
			
		||||
# Graph it for fun
 | 
			
		||||
eval "use GraphViz::Data::Structure;";
 | 
			
		||||
if ($@ or 1) {
 | 
			
		||||
    print "GraphViz::Data::Structure not installed.\n";
 | 
			
		||||
if ($@) {
 | 
			
		||||
    print "GraphViz::Data::Structure not installed. $@\n";
 | 
			
		||||
} else {
 | 
			
		||||
    my $gvds = GraphViz::Data::Structure->new($matrix);
 | 
			
		||||
    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);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -94,6 +115,7 @@ close (HTML) or die "Can't write $DevHTML. $!\n";
 | 
			
		||||
#   ( defaults => { cmd => [values] } )
 | 
			
		||||
sub parse_data {
 | 
			
		||||
    my $file = shift;
 | 
			
		||||
    my %ignore = map { $_ => 1  }  @_;
 | 
			
		||||
    my $Matrix;
 | 
			
		||||
 | 
			
		||||
    my @Lines;
 | 
			
		||||
@@ -124,6 +146,9 @@ sub parse_data {
 | 
			
		||||
            next;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (exists $ignore{$cmd}){
 | 
			
		||||
            print "Ignoring $cmd\n";
 | 
			
		||||
        }
 | 
			
		||||
        # Set Class {vendor,family,device}
 | 
			
		||||
        if ($cmd eq 'device-vendor'){
 | 
			
		||||
            $vendor = $value;
 | 
			
		||||
@@ -225,6 +250,8 @@ sub html_tail {
 | 
			
		||||
[<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>
 | 
			
		||||
 
 | 
			
		||||
@@ -13,22 +13,23 @@ use lib '/usr/local/netdisco';
 | 
			
		||||
use SNMP::Info;
 | 
			
		||||
use Getopt::Long;
 | 
			
		||||
use strict;
 | 
			
		||||
use vars qw/$Class $Dev $Comm $Ver/;
 | 
			
		||||
use vars qw/$Class $Dev $Comm $Ver @Dump/;
 | 
			
		||||
 | 
			
		||||
# Default Values
 | 
			
		||||
$Class = '';
 | 
			
		||||
$Dev   = '';
 | 
			
		||||
$Comm  = '';
 | 
			
		||||
$Ver   = 2;
 | 
			
		||||
@Dump  = ();
 | 
			
		||||
 | 
			
		||||
GetOptions ('c|class=s' => \$Class,
 | 
			
		||||
            'd|dev=s'   => \$Dev,
 | 
			
		||||
            's|comm=s'  => \$Comm,
 | 
			
		||||
            'v|ver=i'   => \$Ver,
 | 
			
		||||
            'h|help'    => \&usage,
 | 
			
		||||
            'p|print=s'   => \@Dump,
 | 
			
		||||
           );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
&usage unless ($Dev and $Comm);
 | 
			
		||||
 | 
			
		||||
$Class = $Class ? "SNMP::Info::$Class" : 'SNMP::Info';
 | 
			
		||||
@@ -39,6 +40,8 @@ if ($@) {
 | 
			
		||||
 | 
			
		||||
print "Class $Class loaded.\n";
 | 
			
		||||
 | 
			
		||||
print "Dumping : ",join(',',@Dump),"\n"  if scalar @Dump;
 | 
			
		||||
 | 
			
		||||
my $dev = new $Class( 'AutoSpecify' => 0,
 | 
			
		||||
                      'AutoVerBack' => 0,
 | 
			
		||||
                      'Version'     => $Ver,
 | 
			
		||||
@@ -52,7 +55,7 @@ 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";
 | 
			
		||||
    die "Are you sure you got the right community string and version?\nCan't fetch layers.\n";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
print "Fetching global info...\n\n";
 | 
			
		||||
@@ -67,7 +70,8 @@ foreach my $global (@globals){
 | 
			
		||||
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/;
 | 
			
		||||
             i_up_admin i_name i_duplex i_duplex_admin i_stp_state
 | 
			
		||||
             i_lastchange/;
 | 
			
		||||
 | 
			
		||||
foreach my $fn (@fns){
 | 
			
		||||
    test_fn($dev,$fn);
 | 
			
		||||
@@ -132,6 +136,11 @@ sub test_fn {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    printf "%-20s %d rows.\n",$method, scalar(keys %$results);
 | 
			
		||||
    if (grep(/^$method$/,@Dump)) {
 | 
			
		||||
        foreach my $iid (keys %$results){
 | 
			
		||||
            print "  $iid : $results->{$iid}\n";
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -143,6 +152,8 @@ test_class - Test a device against an SNMP::Info class
 | 
			
		||||
    -d  --dev   myswitch
 | 
			
		||||
    -s  --comm  public
 | 
			
		||||
    -v  --ver   2
 | 
			
		||||
    -p  --print i_blah
 | 
			
		||||
    -p  --print i_blah2
 | 
			
		||||
 | 
			
		||||
end_usage
 | 
			
		||||
    exit;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user