Compare commits

..

284 Commits

Author SHA1 Message Date
Eric Miller
8015e59161 fix C1130, C1240 2006-07-08 02:43:43 +00:00
Eric Miller
7a94ddcc26 date for 1.04 2006-07-08 02:17:21 +00:00
Eric Miller
4e73ff2bae updates for 1.04 2006-07-08 02:04:10 +00:00
Eric Miller
257eb48e70 doc updates for 1.04 2006-07-08 02:02:34 +00:00
Eric Miller
cf1564d598 doc updates 2006-07-08 02:01:22 +00:00
Eric Miller
e83380c7c5 add L2::Cisco 2006-07-08 01:35:52 +00:00
Eric Miller
799a06b63a prep 1.04, capture older versions of BayRS 2006-07-08 01:25:40 +00:00
Eric Miller
b55e15a568 prep 1.04 2006-06-30 21:33:47 +00:00
Eric Miller
6b3edc3232 capture older versions 2006-06-30 21:24:23 +00:00
Max Baker
f65332f9cc added detection for C3400 w/ metrobase to L3/C3550 class 2006-06-26 23:00:27 +00:00
Max Baker
3416928233 added c2940 support, fixed typo in Orinoco detection. 2006-06-20 18:26:52 +00:00
Max Baker
4d262872c8 added sysID to debug messages for data collection purposes 2006-06-20 05:00:23 +00:00
Max Baker
795ae41d68 changed detection of HP ProCurve devices. New firmware doesn't have the string HP in the description... maybe we should use OIDs :-) 2006-06-20 04:34:59 +00:00
Max Baker
2e17b5c64a *** empty log message *** 2006-06-20 03:58:45 +00:00
Max Baker
ddca296e2a added generic L2::Cisco class and fixed warnings in CiscoStack 2006-06-20 03:58:10 +00:00
Eric Miller
af5d1d6c03 device detection 2006-06-20 02:43:50 +00:00
Eric Miller
2f07667560 device detection for Cisco Aironet 1130/1240, Cisco Sup Eng 2/32, Cisco 2960 2006-06-20 02:10:52 +00:00
Bill Fenner
1fac4cb13c Remove CiscoStack from @ISA 2006-04-15 19:02:44 +00:00
Bill Fenner
aa8c86ddcd Add debug option, -x or --debug 2006-04-15 01:20:40 +00:00
Eric Miller
83751acf91 1.03-beta 2006-04-14 15:54:38 +00:00
Eric Miller
01dc21e338 prep 1.03-beta 2006-04-14 03:14:53 +00:00
Eric Miller
0b8f6db97a prep 1.03-beta, ? 2006-04-14 03:14:36 +00:00
Eric Miller
23dd87c294 prep 1.03-beta 2006-04-14 03:09:14 +00:00
Eric Miller
9a19d3a6f6 update for 1.03-beta 2006-04-14 02:49:55 +00:00
Eric Miller
ba6e02ea5e remove ciscostack 2006-04-14 02:39:47 +00:00
Eric Miller
1426f7656d clean up cisco 4000 family 2006-04-14 02:34:43 +00:00
Bill Fenner
53ebeacc09 Don't call mau_i_duplex_admin_old() if the device doesn't implement
the table at all.
2006-04-13 04:03:53 +00:00
Bill Fenner
bd6cc8d7f4 Default to using the ipNetToMediaTable to get arp entries.
The old atTable has been deprecated since 1991; many newer
 devices don't implement it at all.  Fall back to the old
 atTable if the device doesn't implement ipNetToMediaTable
 (but I find it hard to imagine that there are any such devices)
2006-04-13 04:01:24 +00:00
Eric Miller
19018f364e ver in doc 2006-04-08 03:27:59 +00:00
Eric Miller
be0391bfa8 ver in doc 2006-04-08 03:22:08 +00:00
Eric Miller
bfc36df82b rev for beta 2006-04-08 03:01:38 +00:00
Eric Miller
5134f4163c rev version for beta 2006-04-08 02:54:55 +00:00
Eric Miller
4939a18a6c make update 2006-04-07 03:48:24 +00:00
Eric Miller
8aee915872 make update 2006-04-07 03:25:06 +00:00
Eric Miller
eeac8fd9a2 fix namespace snmp_connect_ip() 2006-04-07 02:46:04 +00:00
Eric Miller
07db467827 doc updates, fix namespace snmp_connect_ip() 2006-04-07 02:44:14 +00:00
Eric Miller
8bed2081b9 doc updates, fix namespace snmp_connect_ip() 2006-04-07 02:31:20 +00:00
Eric Miller
f0e0b9063c doc 2006-04-06 21:41:43 +00:00
Bill Fenner
41907297f8 Commit in the directory I thought I was in before, and add
Juniper to the DeviceMatrix.
While I'm fixing mistakes, add the .0 to jnxBoxSerialNo.0
2006-04-06 21:31:48 +00:00
Eric Miller
2e0392a6db Note Sup720-3B and NativeIOS 12.2 (17d)SXB10 problem (Ralf Gross) and misc updates 2006-04-06 21:14:38 +00:00
Bill Fenner
3c4b8911f5 Add i_speed_high(), which i_speed() uses if needed to support
interfaces >4Gbps
2006-04-06 20:50:46 +00:00
Bill Fenner
3db7164f9f Add Juniper.pm and C4000.pm 2006-04-06 20:46:17 +00:00
Bill Fenner
cfe3c34ab6 Add Juniper. 2006-04-06 20:45:07 +00:00
Bill Fenner
ceac50e33e Use CISCO-DOT11-IF-MIB to get SSID and channel info per radio port. 2006-04-05 06:11:18 +00:00
Bill Fenner
b71ba01d32 Create and use a duplex_munge to remove the string "Duplex" from the
return value of el_duplex().

Submitted by:	Justin Hunter (arcanez)
2006-04-05 05:43:36 +00:00
Bill Fenner
5cc00d443c Use SNMP::Info::MAU for mau_i_speed_admin.
Update documentation to note that we use SNMP::Info::MAU and
 remove some bits accidentally copied from another Cisco class.
2006-04-05 05:11:55 +00:00
Bill Fenner
4edb3115e5 Add [the beginning of] a Layer3::Juniper class.
Junipers worked with SNMP::Info::Layer3; this class's main purpose
 is to get the device inventory a bit nicer.
2006-04-05 04:16:36 +00:00
Bill Fenner
33435d89e4 Allow calls to orig_foo, load_orig_foo, set_orig_foo
to be able to call a FUNC that you've overloaded with a function.
2006-04-05 03:59:58 +00:00
Eric Miller
f5c93b3413 updates 2006-04-05 03:58:11 +00:00
Eric Miller
59fbe71c56 fix for models not returning complete bp_index() 2006-04-05 03:42:10 +00:00
Eric Miller
4f6b5f0883 root ip check 2006-04-05 02:38:40 +00:00
Eric Miller
23eb3b596d remove root_ip() 2006-04-05 02:34:19 +00:00
Eric Miller
55b2a27f40 check for unreachable root ip before assignment 2006-04-05 02:30:17 +00:00
Eric Miller
5e46120b52 not really 2006-04-05 02:15:51 +00:00
Eric Miller
4b70bfa7c8 check for unreachable root ip before assignment 2006-04-05 02:09:06 +00:00
Eric Miller
c530e25e02 check for unreachable root ip before assignment 2006-04-05 01:57:12 +00:00
Eric Miller
409065375e add sub _snmp_connect_ip 2006-04-05 01:45:53 +00:00
Bill Fenner
32ccc2857f Implement mau_i_speed_admin based on the strings in the middle of
ifMauDefaultType
2006-03-29 21:46:55 +00:00
Bill Fenner
c1025cb76f Use SNMPv2-MIB instead of RFC1213-MIB for sysDescr 2006-03-29 21:45:30 +00:00
Bill Fenner
1f6a738cda Updated MODEL_MAP from HP-ICF-OID MIB, partly based on email from
Robert Kerr.
2006-03-29 00:33:59 +00:00
Bill Fenner
8f10a4f16e Add a new class for Cisco Catalyst 4000/4500 and move 4000 support to use it. 2006-03-28 22:14:37 +00:00
Bill Fenner
50d9fdefb3 Rewrite mau_i_duplex_admin in terms of mau_type_admin (ifMauDefaultType).
Call the old one (mau_i_duplex_admin_old) if mau_type_admin is empty.

Most modern devices support ifMauDefaultType but not everything
 supports ifMauAutoNegCapAdvertised.
2006-03-28 22:11:44 +00:00
Bill Fenner
d777d98396 Inherit CiscoStats to get the products MIB in scope so that the product
ID gets translated.
Enable CDP.  In bridge mode it's possible that there's something to
 learn from it.
2006-03-28 22:06:48 +00:00
Bill Fenner
75e7b0c6b0 Print the result of device_type().
If you ask for a dump with -p, and it's not in the list of things we're
 already grabbing, grab it at the end.
2006-03-28 22:02:00 +00:00
Eric Miller
9fc965d095 try to capture all the names 2006-02-21 03:25:41 +00:00
Eric Miller
10b4611e81 update for duplex, vlan properties 2006-02-21 02:26:54 +00:00
Eric Miller
f416f7cc49 duplex write, vlan properties 2006-02-21 02:25:14 +00:00
Eric Miller
50d9070f36 updates for 1.0 2006-02-21 01:07:02 +00:00
Eric Miller
14db80441c doc update 2006-02-18 04:33:02 +00:00
Eric Miller
6193e661f5 remove e-mail 2006-02-18 04:31:24 +00:00
Eric Miller
3e69394cca updates 2006-02-18 04:08:59 +00:00
Eric Miller
88cdcebe2d use EXTREME-FDB-MIB instead of BRIDGE-MIB since BRIDGE-MIB must be explicitly enabled on these devices and does not respond by default. Fix duplex status reporting. 2006-02-18 04:03:34 +00:00
Eric Miller
20024f8c50 add set_i_duplex_admin() and set_i_speed_admin() methods, add portCrossIndex in %FUNCS to support bp_index() patch in Catalyst class 2006-02-18 03:55:36 +00:00
Eric Miller
40caf6cc0e use CISCO-STACK-MIB for bridge port mapping rather than BRIDGE-MIB due to some devices not returning complete index 2006-02-18 03:49:55 +00:00
Eric Miller
2d3b28b973 Carlos Vicente's ipforwarding patch - SF 1431212 and doc updates 2006-02-16 04:58:42 +00:00
Eric Miller
325b087bd1 Carlos Vicente's BGP patch - SF 1431212 2006-02-16 03:42:20 +00:00
Eric Miller
0703a5f777 Alexander Barthel's STP patches SF 1424342 2006-02-16 02:35:28 +00:00
Eric Miller
c4a4749bcf new features 2006-02-02 04:22:48 +00:00
Eric Miller
1fd0facbe0 cisco qos, cisco rtt, synoptics 2006-02-02 04:21:56 +00:00
Eric Miller
bc9ab17f2d update supported lists with new models 2006-02-02 04:20:35 +00:00
Eric Miller
22fd4f73a9 Alexander Hartmaier's patch - SF 1369007 2006-02-02 03:37:06 +00:00
Eric Miller
4de346fa39 synoptics hub support 2006-02-01 22:30:42 +00:00
Eric Miller
e14c749f66 Alexander Hartmaier's patch, Cisco RTT - SF 1369007 2006-02-01 22:27:32 +00:00
Eric Miller
c0f1872f04 Alexander Hartmaier's patch, Cisco QOS - SF 1369007 2006-02-01 22:26:08 +00:00
Eric Miller
70944f0589 Aruba os name change - Brian Chow 2006-01-31 13:10:58 +00:00
Eric Miller
d2b4c85d37 doc updates 2006-01-26 04:46:18 +00:00
Eric Miller
a4cc2f5514 Nortel arpnip support for stackable layer 3 models 2006-01-26 04:41:07 +00:00
Eric Miller
fa8f91d508 Nortel name changes and arpnip support for Layer 3 models 2006-01-26 04:39:06 +00:00
Eric Miller
7966400cf2 Nortel name changes 2006-01-25 19:35:11 +00:00
Eric Miller
3227540322 capture more models 2006-01-25 19:30:18 +00:00
Eric Miller
183f8bde3a Extreme Summit fix 2006-01-25 17:57:24 +00:00
Eric Miller
62133dfedf Nortel 2270, Extreme, Aruba 2006-01-25 03:19:22 +00:00
Eric Miller
eb833c69e3 add support for disabling/enabling ports 2006-01-24 21:47:39 +00:00
Eric Miller
53d96a2e32 documentation changes 2006-01-24 21:19:06 +00:00
Eric Miller
efc1682877 documentation 2006-01-24 20:56:01 +00:00
Eric Miller
8846bb2f0f documentation 2006-01-24 20:47:58 +00:00
Eric Miller
558c80aa84 Aruba wireless support 2006-01-24 20:15:16 +00:00
Eric Miller
f905638e5b 2270 wireless switch (airespace) support 2006-01-24 19:58:27 +00:00
Max Baker
d1636f0fe9 fix a small warning 2006-01-17 04:18:10 +00:00
Max Baker
1d1193c459 Fixed manifest with changes from Benny Kj�rgaard <benny@catpipe.net>
and other recent additions
2006-01-17 04:17:15 +00:00
Eric Miller
4a2e62be2d aruba wireless switch support 2005-11-16 21:41:23 +00:00
Eric Miller
137cc84ca6 nortel 2270 wireless switch support 2005-11-16 21:28:02 +00:00
Eric Miller
e744df1dca airespace wireless switch support 2005-11-16 21:23:32 +00:00
Eric Miller
378dc6bc19 doc again 2005-11-14 04:16:24 +00:00
Eric Miller
3f2f722dab doc correction 2005-11-14 04:08:07 +00:00
Eric Miller
25f57d65a5 Justin Hunter's patch, SF ID 1341140 2005-11-14 03:38:26 +00:00
Eric Miller
f5dba96839 Justin Hunter's patch, SF ID 1341140, add set_i_duplex_admin and set_i_speed_admin methods 2005-11-13 04:18:33 +00:00
Eric Miller
3a1d04eb38 bp_index fix - some 8600's not working properly 2005-11-11 21:34:15 +00:00
Eric Miller
adac25b3dd extreme networks support 2005-09-29 02:50:36 +00:00
Eric Miller
9b2229e3eb remove root_ip() 2005-09-29 02:48:45 +00:00
Eric Miller
bf040dffa9 add extreme networks support 2005-09-29 02:06:32 +00:00
Eric Miller
86a12cd2a6 Initial Import 2005-09-22 19:15:24 +00:00
Eric Miller
bfcb56f06d correct Nortel 1600 definition 2005-06-03 18:12:32 +00:00
Eric Miller
9a4a336c78 add support for Nortel 1600 and 8100 series 2005-06-03 04:27:20 +00:00
Eric Miller
6696eeeb9d add support for Nortel 1600 and 8100 series 2005-06-03 04:20:22 +00:00
Eric Miller
4da90c4f9b add support for Nortel 1600 and 8100 series 2005-06-03 04:14:55 +00:00
Eric Miller
88f31110a7 doc cleanup 2005-06-03 04:01:48 +00:00
Eric Miller
afab6191b2 add support for Nortel N16XX series 2005-06-03 03:46:47 +00:00
Eric Miller
7ce87ebd3d add support for 8100 series, doc cleanup 2005-06-03 03:39:56 +00:00
Eric Miller
d8e1e932ae fix for mac() when topology off 2005-06-03 03:02:36 +00:00
Max Baker
089430de17 Added basic i_set_vlan() 2005-04-27 04:31:11 +00:00
Max Baker
dce0a40ebb some device isn't returning a description? 2005-04-27 04:30:37 +00:00
Eric Miller
2347edad82 add support for Accelar Layer 3 2005-04-07 04:09:03 +00:00
Eric Miller
0ab5eb2bf1 add support for Accelar Layer 3 2005-04-07 04:03:17 +00:00
Eric Miller
d314ffe897 add support for Accelar Layer 3 2005-04-07 03:54:40 +00:00
Eric Miller
1162dc3a7b add endofmibview exception handling 2005-03-28 00:52:17 +00:00
Eric Miller
0967634043 change vendor to be consistent 2005-03-10 03:54:04 +00:00
Eric Miller
133355bc9d only use OSPF router ID if IP interface exists 2005-03-10 03:42:16 +00:00
Eric Miller
76c734dc01 restrict Passport class to 8600 2005-03-10 03:14:55 +00:00
Eric Miller
3128e3e5f6 correct vlan port id, typo 2005-03-09 22:06:28 +00:00
Eric Miller
c9ebd5ae28 correct vlan port id 2005-03-09 22:02:12 +00:00
Max Baker
b6efcd86dd vi typo too :-| 2005-02-21 05:16:20 +00:00
Max Baker
a0323aacd2 oops forgot a comma 2005-02-21 05:14:51 +00:00
Max Baker
258b7551ff still trying to get interfaces() right for l2/* 2005-02-18 18:32:41 +00:00
Max Baker
7a023554eb Added CDP back to HP 2005-02-18 03:52:10 +00:00
Max Baker
b557c9d890 removed all cisco stuff from l2 and readded it to L2::C* classes 2005-02-18 03:50:42 +00:00
Max Baker
8dae0aad96 took out some kludy cisco-specific stuff from interfaces() 2005-02-18 03:34:23 +00:00
Max Baker
902383cab7 oops 2005-02-17 06:11:14 +00:00
Max Baker
a1eb6e5831 added interface flowcontrol stuff to ciscostack (n. petri) 2005-02-17 02:02:24 +00:00
Max Baker
3656d4c514 *** empty log message *** 2005-02-17 01:50:47 +00:00
Max Baker
e899f76249 aesthetic.. remove sn from the beg. of model names 2005-02-17 01:45:46 +00:00
Max Baker
d38bfcbbf7 removed Carp and changed to error_throw(). 2005-02-17 01:45:21 +00:00
Max Baker
0f654f5aaa - removed some MIB documentation. expect ppl to use my mib package or suffer.
- added bulkwalk() method so it can be changed dynamically.
- added support for L2::Foundry
- removed rfc1213-mib -- net-snmp does this for us
- fixed some typos in _load_attr()
2005-02-17 01:44:22 +00:00
Max Baker
6cab3ad6b3 *** empty log message *** 2005-02-17 01:41:34 +00:00
Max Baker
6685e4dd77 brought this thing back to life 2005-02-17 01:31:49 +00:00
Max Baker
2b42f25d1e added CiscoImage class 2005-02-17 01:30:26 +00:00
Max Baker
85359ddf59 *** empty log message *** 2005-02-17 01:16:49 +00:00
Max Baker
1e198a8d8e turned off bulkwalk 2005-02-16 23:24:46 +00:00
Max Baker
6bd545d307 foundry fixes 2005-01-28 09:26:53 +00:00
Max Baker
bc53167731 *** empty log message *** 2005-01-28 08:56:27 +00:00
Max Baker
9a5135b9e1 Prep for 1.0:
- removed all references to $DEBUG, $INIT and $SNMP::debugging
- rev'd version number
- doc updates
- added cdp_run() to FDP.pm
- removed my email addr from all over the place
2005-01-28 08:55:51 +00:00
Max Baker
8193143459 doc improvements 2005-01-28 08:54:04 +00:00
Max Baker
61ac00d7fb - Moved i_duplex and i_duplex_admin routines over from L2::HP so they could
be used by other classes (foundry...)
- removed DEBUG and INIT references.
- rev'd to 1.0
2005-01-28 08:44:26 +00:00
Max Baker
7944613d42 1.0 prep :
- whitespace changes
    - remove email
    - rev vers no.
2005-01-28 08:41:19 +00:00
Max Baker
ff07325a05 Prepped for 1.0 :
- some minor white space changes (\t -> spaces)
    - removed email
    - removed $DEBUG, $INIT and $SNMP::debugging references
    - rev'd version
2005-01-28 08:39:35 +00:00
Max Baker
afe5436749 preped for 1.0 :
- removed INIT and DEBUG specific stuff
    - removed SNMP::debugging stuff
    - removed my email addr
    - set VERSION
2005-01-28 08:38:00 +00:00
Max Baker
ade9d7ef32 moved i_duplex and i_duplex_admin to MAU
moved i_vlan code to BRIDGE-MIB
preped for 1.0
2005-01-28 08:37:26 +00:00
Max Baker
6a397d7c72 moved i_vlan() from l2::hp over here as qb_i_vlan_t(). rev'd to 1.0 2005-01-28 08:34:50 +00:00
Max Baker
933bbaf00b - Rev'd to 1.0
- Added DebugSNMP option
- fixed [ 1111284 ] Parameters not being set with AutoSpecify
  by changing around arg passing in new() and specify()
- took out the bulkwalk_no for net-snmp 5.1 thing
- fixed up the check for $INIT and $DEBUG so they don't have to be explicitly
   set in every subclass.
- Fixed error detection when creating a new SNMP Session
+ Added L2::Foundry to device_type()
+ Added munge_i_up() to account for bug where IF-MIB and RFC1213-MIB data collide
2005-01-28 08:33:16 +00:00
Max Baker
1bd53dda51 added all methods from mib and expanded docs 2005-01-28 03:56:57 +00:00
Max Baker
5595fea427 documentation catch up 2005-01-26 19:22:02 +00:00
Max Baker
31661b1374 added ciscostats and cdp back into 3550 and 6500 classes. rev'd to 1.0 2005-01-26 19:05:28 +00:00
Max Baker
780965728e added net-snmp 2005-01-21 00:12:57 +00:00
Max Baker
a7570d9e58 cleanup 2005-01-18 02:42:19 +00:00
Max Baker
b6989e8ada added entity-mib to l2 and l3 classes. abstracted non cisco stuff from L3 to L3::Cisco and CiscoStats 2005-01-18 01:59:19 +00:00
Max Baker
f9f4daea94 minor fix in os_ver() to remove warning 2005-01-17 06:16:43 +00:00
Max Baker
ab175a747c change 0.1 to 0.10. doh. 2005-01-06 02:35:46 +00:00
Max Baker
2a10991980 heh, nice catch 2004-11-20 05:18:24 +00:00
Max Baker
95d3d45e66 oops 2004-11-20 05:11:13 +00:00
Max Baker
d808fc1e6f typo found by diabolic_mdog 2004-11-20 05:10:42 +00:00
Max Baker
e8f81b17fa *** empty log message *** 2004-11-19 01:02:54 +00:00
Max Baker
db871c590c added bulkwalk and bulkrepeaters options 2004-11-19 01:01:27 +00:00
Max Baker
de464b2e6a prep 2004-11-16 01:42:32 +00:00
Max Baker
e0acc5ce90 doc upgrades 2004-11-16 01:40:56 +00:00
Max Baker
a1f913d91e doc upgrades for 0.9 2004-11-16 01:32:10 +00:00
Max Baker
d19b71073d Added L3::Cisco class, added method check to _set() 2004-11-15 23:31:20 +00:00
Max Baker
ed66350c27 added cisco-vlan-iftable vlan info 2004-11-15 23:30:07 +00:00
Max Baker
51d57b39f5 Added ciscovtp 2004-11-15 23:28:40 +00:00
Max Baker
68524eb337 *** empty log message *** 2004-11-15 23:28:00 +00:00
Max Baker
58f8ed29c7 added CISCO-PORT-SECURITY-MIB in its entirety 2004-11-14 23:07:53 +00:00
Eric Miller
3b96232e13 fix for serial and index_factor 2004-11-04 18:17:55 +00:00
Eric Miller
19b5d34c10 fix bayrs match, rcs tag 2004-11-04 17:46:28 +00:00
Max Baker
5bb4252cf0 pod error 2004-11-01 20:33:33 +00:00
Max Baker
8191d5f957 bruce roger's foundry changes 2004-11-01 19:19:38 +00:00
Max Baker
1c458c9ca9 missed this one 2004-10-28 21:57:32 +00:00
Max Baker
36f84e357e added RCS id tag and rev'd all version numbers to 0.9 2004-10-28 21:53:15 +00:00
Max Baker
c1b7d7dfc0 +jeneric's massive Nortel functionality patch. L2::Bay depricated 2004-10-28 21:45:00 +00:00
Max Baker
bbd45f82ab + MibDir addition to allow for specifying mib dirs.
* _global() change so that failed data is cached and not
            attempted to be retrieved.
            This includes NOSUCH* type returns
+ All of jerneric's kick-ass Nortel additions and typo fixes.
2004-10-28 21:43:53 +00:00
Max Baker
02f3e91c5d added null string removal in CDP info 2004-10-28 21:40:11 +00:00
Max Baker
d5afa9f592 got rid of some warnings for undef models 2004-10-28 21:37:36 +00:00
Max Baker
dceec4f537 added c3560 to c3550 class 2004-10-13 16:38:30 +00:00
Max Baker
51b09605df added dump 2004-09-27 14:48:42 +00:00
Max Baker
dc00c7d907 Added BULKWALK patch from b.baetz 2004-09-27 14:48:19 +00:00
Max Baker
c6df2928a1 *** empty log message *** 2004-06-29 17:35:17 +00:00
Max Baker
86bf9fd360 *** empty log message *** 2004-06-29 02:00:17 +00:00
Max Baker
505de8c6dc *** empty log message *** 2004-06-29 01:58:51 +00:00
Max Baker
70744f3df2 added i_lastchange() 2004-06-21 15:33:12 +00:00
Max Baker
96393d5781 added check for root_ip() addresses of all zeros 2004-06-19 23:21:01 +00:00
Max Baker
598c075670 *** empty log message *** 2004-06-19 23:20:34 +00:00
Max Baker
ac8eef8f73 typo 2004-06-19 23:20:19 +00:00
Max Baker
f5eb4e8bb6 doc info found by IAN@CPAN 2004-06-19 23:14:09 +00:00
Max Baker
abb7fe7f3c removed small warning if no bay_topo_platform() entry was found in c_platform() 2004-04-23 20:18:08 +00:00
Max Baker
440bb002b6 doc changes 2004-03-22 04:22:00 +00:00
Max Baker
6dd3f4b21a a little undef checking gets rid of warnings 2004-03-14 17:31:20 +00:00
Max Baker
1278117b05 added c6sup1 to l3:c6500 2004-03-14 17:30:26 +00:00
Max Baker
5c6c75b42e Fixed Bug [ 911235 ] -- added sub os() by accident.. Cut and paste happy.
Reported by Bradley Baetz - bbaetz
2004-03-07 19:53:34 +00:00
Max Baker
d78e5d6656 added cisco_comm_indexing() method for clarification/customization purposed. 2004-03-02 05:46:14 +00:00
Max Baker
094c2d548d added device_type() debugging info. 2004-03-02 05:22:35 +00:00
Max Baker
4913ac6cdd added q-bridge-mib stuff. and some docs 2004-03-02 05:15:40 +00:00
Max Baker
ac9efcf8ba added q-bridge mib stuff 2004-03-02 04:57:04 +00:00
Max Baker
6b4444d97a version and copyright change for 0.8 prep 2004-02-13 06:30:31 +00:00
Max Baker
607d5f04bd graph changes 2004-02-13 06:19:20 +00:00
Max Baker
b46aa416a0 order of precedence on serial no. entry 2004-02-13 06:18:57 +00:00
Max Baker
800aa0b4f0 Added device matrix graphing fun 2004-02-13 05:15:32 +00:00
Max Baker
a0e0be2d68 added more serial() support for L2 and L3 2004-02-12 21:16:37 +00:00
Max Baker
3fa47dc2e6 added HP-VLAN 2004-02-10 17:29:26 +00:00
Max Baker
25141d3c8e Added C1900 to ::CiscoVTP 2004-02-10 17:28:34 +00:00
Max Baker
1f02aeaec4 added support for CISCO-VLAN-MEMBERSHIP and all the i_vlan* funcs. 2004-02-10 17:24:22 +00:00
Max Baker
5d4aada8f5 added Q-BRIDGE 2004-02-10 17:23:45 +00:00
Max Baker
3bd7f78277 added weird description for c6500's 2004-02-10 17:23:11 +00:00
Max Baker
3994706465 fix by dana watanabe to support C3500xl in description string. Added new T3 to speed map 2004-02-06 03:25:10 +00:00
Max Baker
12bf18ac02 added more devices to model map 2004-01-28 06:41:40 +00:00
Max Baker
5c6a8f3c45 checked for empty id in model() 2004-01-28 06:41:19 +00:00
Max Baker
ddddb703aa *** empty log message *** 2004-01-28 06:19:56 +00:00
Max Baker
5ef4c78f8a Added ap4800 to l3:aironet class 2004-01-28 06:14:18 +00:00
Max Baker
05a7f104a4 *** empty log message *** 2004-01-28 06:13:58 +00:00
Max Baker
da1183b4fa fixed up os_ver to parse old AP4800's 2004-01-28 06:13:23 +00:00
Max Baker
a51ad7ee88 added Cisco 2970 to l3:c6500 class 2004-01-28 06:06:03 +00:00
Max Baker
df3e0e3b3a *** empty log message *** 2004-01-21 07:13:39 +00:00
Max Baker
c156584417 *** empty log message *** 2004-01-20 16:47:48 +00:00
Max Baker
74e649a033 removed warning about non numeric port line 199 2004-01-20 16:44:20 +00:00
Max Baker
342a45a424 added check for os() and descr() in model() 2004-01-20 16:39:23 +00:00
Max Baker
7076c236ea *** empty log message *** 2004-01-07 00:11:39 +00:00
Max Baker
0d90383ea3 case on model/os 2004-01-07 00:10:26 +00:00
Max Baker
fe59f88dd3 added older aironet, l2:allied, l2:zyxel 2004-01-06 23:56:17 +00:00
Max Baker
2f4704b18d *** empty log message *** 2004-01-06 23:55:47 +00:00
Max Baker
c8c94bbd8b added cat4000 and 3750s to l3:c6500 class 2004-01-05 00:16:07 +00:00
Max Baker
054e27e827 added C3500XL support 2003-09-23 02:56:51 +00:00
Max Baker
766f14d2bf ver 0.7 prep 2003-08-14 18:24:56 +00:00
Max Baker
4e52756a41 *** empty log message *** 2003-08-05 19:16:38 +00:00
Max Baker
55fc398ddf added classes, snmp_ver 2003-08-05 19:11:17 +00:00
Max Baker
a5e8e6c7cd *** empty log message *** 2003-08-05 19:10:57 +00:00
Max Baker
bb8762835f *** empty log message *** 2003-08-05 18:37:38 +00:00
Max Baker
7c8b1a8853 *** empty log message *** 2003-08-05 16:41:12 +00:00
Max Baker
be8140a142 *** empty log message *** 2003-08-05 01:49:04 +00:00
Max Baker
f7c57860b7 *** empty log message *** 2003-08-04 21:50:25 +00:00
Max Baker
c44fc3ddbe added v_name and v_port tests 2003-08-04 21:49:43 +00:00
Max Baker
c2fd3bd3a4 fixed os() for IOS Catalyst devices to report IOS and not CatOS 2003-08-04 21:49:14 +00:00
Max Baker
dfff2624ac added support for AP1200 2003-08-04 21:48:14 +00:00
Max Baker
91c40fddb6 *** empty log message *** 2003-08-04 21:47:43 +00:00
Max Baker
cafeb36418 *** empty log message *** 2003-08-04 19:56:25 +00:00
Max Baker
fa56c7b332 extracted CiscoStack stuff, included new class 2003-07-29 19:31:03 +00:00
Max Baker
a52f1f3d37 added serial, fixed i_duplex(), interfaces 2003-07-29 19:30:28 +00:00
Max Baker
476053c539 added C6500 class. Added dual t1 to speed map 2003-07-29 19:29:38 +00:00
Max Baker
0530c5d9e9 *** empty log message *** 2003-07-29 19:27:12 +00:00
Max Baker
b982e95c42 Extracted CISCO-STACK-MIB to SNMP::Info::CiscoStack 2003-07-29 18:03:24 +00:00
Max Baker
de286cbfa0 extracted from l2::catalyst 2003-07-29 18:03:02 +00:00
Max Baker
a94c685c6d changed speed_map 2003-07-29 15:43:50 +00:00
Max Baker
58feb21dec made static table entries appear in same format as cam table entries 2003-07-29 15:33:03 +00:00
Max Baker
81f0b821e3 changed speedmap 2003-07-29 15:32:07 +00:00
Max Baker
ea8275677b changed device_type() to not falsepositive for Bay and HP classes. Changed error_throw to not give line feeds. 2003-07-28 16:22:36 +00:00
Max Baker
c0891ec8c0 re-added cisco-stack-mib -- needed to id old catalysts 2003-07-28 16:01:10 +00:00
Max Baker
9dd38845a6 kept model numbers and added a dash 2003-07-28 15:49:14 +00:00
Max Baker
0d8aa25e63 added defaults and thanks 2003-07-24 00:25:36 +00:00
Max Baker
f57c9333da removed dependency on CISCO-STACK-MIB 2003-07-03 18:49:45 +00:00
Max Baker
f060b67b4a switched over to CiscoVTP subclass for vlan processing 2003-07-03 17:18:26 +00:00
Max Baker
c59e13ac35 *** empty log message *** 2003-07-03 17:04:57 +00:00
Max Baker
a49d1522b0 added t1s to speed_map and added l2 c3550's to device_type() 2003-07-02 20:51:48 +00:00
Max Baker
39e618f761 escaped all control characters, not just line feed 2003-07-02 19:24:49 +00:00
Max Baker
3d812e0eae added test_class.pl 2003-06-30 18:27:51 +00:00
Max Baker
4f1ac32865 *** empty log message *** 2003-06-30 18:27:13 +00:00
Max Baker
d176570b1d case sensitive for 2900s and 2950s in device_type() 2003-06-27 23:54:15 +00:00
Max Baker
393fb71b1a added 2950s to the C2900 class 2003-06-27 23:09:35 +00:00
Max Baker
bd1be7e258 added vlans 2003-06-27 22:03:29 +00:00
Max Baker
e296e93b23 push ver_0_6 2003-06-18 16:26:39 +00:00
Max Baker
bd457307ff Module did not return 1 and failed to load under specify() 2003-06-18 16:25:08 +00:00
Max Baker
f988cecc4d version 0.5 prep 2003-06-10 16:50:44 +00:00
Max Baker
d2f67b2db2 Added partial table lookup capabilities 2003-05-30 21:04:56 +00:00
Max Baker
c4a4c3d5e6 *** empty log message *** 2003-05-30 21:04:06 +00:00
Max Baker
fa38fdbc2b Added IP Route Table 2003-05-30 19:22:15 +00:00
Max Baker
2e03e3faca added undef checking in os_*() 2003-05-27 15:38:59 +00:00
Max Baker
e448915e0b Added SUPPORT section 2003-05-14 01:07:28 +00:00
Max Baker
37836bedac minor undef warnings 2003-05-12 21:20:48 +00:00
Max Baker
a60663b238 doc change 2003-04-29 18:24:23 +00:00
61 changed files with 16474 additions and 1440 deletions

View File

@@ -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.

144
ChangeLog
View File

@@ -1,6 +1,144 @@
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 1.04 (07/08/06)
+ Added C1130 and C1240 to L2::Aironet (Ralf Gross)
+ Added detection for Cisco 2960, 2940, 3400 w/ MetroBase
+ Added generic L2::Cisco Class
* Corrected detection for Cisco Supervisor Engine 2 and 32 (IOS).
* Fixed warnings in CiscoStack
* Updated ProCurve HP device detection for newer firmwares
version 1.03 (04/14/06) - Beta/developer release
* Use ipNetToMedia table instead of atTable for ARP
* Remove CiscoStack from Layer3::C4000
* Fixed bug in MAU class when polling devices without MAU-MIB support
version 1.01 (04/08/06) - Beta/developer release
+ Change version numbers to X.XX format. Odd releases are beta
or developer only releases. Even are official releases.
version 1.0 (04/07/06) - CVS only. No official release
+ Added Interface FlowControl status to CiscoStack (Nicolai Petri)
+ Added CiscoImage class (Matthew Tuttle)
+ Added C1200 and C350 IOS devices to L2::Aironet (Matthew Tuttle)
+ Added support for Foundry IronWare and gave L3::Foundry CPR
+ Added support for Foundry EdgeIrons as new class L2::Foundry
+ Added BulkWalk and BulkRepeaters options to new()
+ Added DebugSNMP option to new()
+ Added CISCO-ENTITY-VENDORTYPE-OID-MIB,CISCO-PRODUCTS-MIB,CISCO-STACK-MIB
to CiscoStats.pm for model()
+ Check for bulkwalk_no() method
+ Added Entity.pm to L3 and L2 classes per N. Petri's suggestion.
+ Added support for Passport/Accelar 1100 and 1200 series in L3::Passport
+ Added support for Passport/Accelar 8100 series in L3::Passport
+ Added support for Passport 1600 series as new class, L3::N1600
+ Added support for Extreme Alpine and Summit switches as new class
L3:Extreme (Mike Hunter and Eric Miller)
+ Added support for Aruba wireless switches (Eric Miller and Brian Chow)
+ Added support for Nortel 2700 series (Airespace) wireless switches
+ Added support for Synoptics hubs as new class L1:S3000
+ Added Cisco QOS and RTT classes (Alexander Hartmaier)
+ Added BGP Peer Table to L3 class (Carlos Vicente)
+ Added ipforwarding status to Info base class (Carlos Vicente)
+ Added STP port state to Bridge class (Alexander Barthel)
+ Added L3 support (arpnip) to Baystack class for routing capable switches
+ Added set_i_duplex_admin() and set_i_speed_admin() to C2900 class (Justin Hunter)
+ Added set_i_duplex_admin() and set_i_speed_admin() to CiscoStack class
+ CDP added to Aironet class
+ Added Juniper class
+ Added support for Catalyst 4000 and 4500, get admin. duplex
and speed properly
+ Added i_speed_high(), which i_speed() uses if needed to support
interfaces >4Gbps
* More error checking in _load_attr() around bulkwalk code
* Minor warning fix in L3::Aironet::os_ver()
* Abstracted remaining Cisco stuff from L3 to L3::Cisco
* Removed all Cisco stuff from L2
* Expanded Entity.pm to cover the whole ENTITY-MIB and improved docs.
* changed all refs to $DEBUG to $self->debug() for reentrant code
* [ 1111284 ] Parameters not being set with AutoSpecify - fixed.
* Turned off BULKWALK for C1900 and C6500 classes.
* Added exception handling for V2 ENDOFMIBVIEW
* Fix in SONMP when topology not enabled
* Fix in L3::Passport root_ip()
* Fix in L3::Passport bp_index() some devices not returning complete index.
* Enable set_i_up_admin() in Bayhub
* Recognize new Nortel model names in Baystack and Passport classes
* Orinoco class should now recognize more models
* Cleanup model recognition in Baystack class, recognize more models
* Modify Catalyst class to use CISCO-STACK-MIB for brige port index mapping
some devices having problems returning complete index from BRIDGE-MIB
* Check root ip for reachability before assignment
* HP class should recognize more models
* Fix in HP class for models not returning full bp_index
* [ 1436103 ] L2::Aironet devices weren't getting their model
translated properly
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
* Extracted CISCO-STACK-MIB from Layer2::Catalyst to SNMP::Info::CiscoStack
* Added 2950's to the Layer2::C2900 class
* Added 3548's and 350x's to the Layer3::C3550 class
* Broke out 3550's into separate device types (3550-24, 3550-48)
* Added T1,dual T1, and T3 , ATM over OC-12 ... to the SPEED_MAP
* Fixed speed map -- OC-1 -> OC-3
* Fixed Bug where Catalyst Switch running IOS would report CatOS as os()
version 0.6 (06/18/03)
* Minor Bug Fix. SNMP::Info::Layer2::Bay and SNMP::Info::Layer2::C1900
didn't return 1 and failed to load on some versions of Perl.
version 0.5 (06/10/03)
* Added ability to get paritial tables. For example to get the
IP routing table for 128.114.* you can do
$ipr = $dev->ipr_dest('128.114');
* Added IP Routing Table entries from RFC1213 to SNMP::Info
* minor bug fixes
version 0.4 (04/29/03)
* BIG CHANGE ! Internal Data structure has changed.
* Added clear_cache() method
@@ -24,11 +162,11 @@ version 0.3 (03/06/03)
and _load_attr
* Added more debugging
* Added info and munging for c_capabilities in SNMP::Info::CD
Thanks to Martin Lorensen <martin@lorensen.dk>
Thanks to Martin Lorensen <martin /at- lorensen.dk>
* Removed requirement for SNMP in the Makefile.PL and moved it to t/prereq.t
so that the Module will install via CPAN without trying to install the old
4.2.0 version of SNMP on CPAN. Will now fail in the test phase.
Thanks again to Martin Lorensen <martin@lorensen.dk>
Thanks again to Martin Lorensen <martin /at- lorensen.dk>
* Moved tests from test.pl to t/*
version 0.2 (02/19/03)

669
DeviceMatrix.txt Normal file
View File

@@ -0,0 +1,669 @@
# SNMP Device Compatibility Matrix
# SNMP::Info - (C) 2004 Max Baker
# This file is meant to detail the cababilities
# of network devices to supply data via SNMP.
# $Id$
# Allied
device-vendor: Allied Telesyn
cdp:no
device-family: Allied Hubs
class: Layer1::Allied
ver: 1
arpnip: no
macsuck: no
duplex: no
device: AT-3624T
device-family: AT-8000 Switches
class: Layer2::Allied
ver: 2
macsuck: yes
# Aruba
device-vendor: Aruba
device-family: Aruba Wireless Controllers
arpnip: no
macsuck: yes
portmac: yes
duplex: no
class: Layer2::Aruba
note: Uses proprietary MIBs to provide MAC to port mapping. APs appear as switch ports.
device: 5000
# Asante
device-vendor: Asante
device-family: Asante Hubs
class: Layer1::Asante
ver: 1
arpnip: no
macsuck: no
duplex: no
device: 1012
# Bay
device-vendor: Bay
note: See Nortel
# CISCO
device-vendor: Cisco
cdp: yes
ver: 2
note: Error in CISCO-TC-MIB. See README for how to patch.
device-family: Aironet
note: IOS and Aironet OS versions
class: Layer3::Aironet
device: AIRAP1100, AP1200, C1100, C1130, C1240
note: IOS based device
class: Layer2::Aironet
device: BR500
note: Aironet based device
device: AP350, AP340, CAP350, CAP340, 1200, AP4800
note: Aironet based device
device-family: 1000
duplex: no
ver: 1
class: Layer3::Cisco
device: 1003
device-family: 1700
class: Layer3::Cisco
device: 1710
duplex: link
device-family: 2500
duplex: no
macsuck: yes
arpnip: yes
ver: 1
class: Layer3::Cisco
device: 2501
device: 2503
device: AS2509RJ
device: AS2511RJ
device: 2511
device: 2514
device-family: 2600
duplex: link
arpnip: yes
macsuck: yes
class: Layer3::Cisco
device:2610,2610XM,2611,2620,2620XM,2621
device:2621XM
device:2651XM
device:2691
device-family: 3600
class: Layer3::Cisco
device: 3620
device: 3640
duplex: no
device-family: 7500
class: Layer3::Cisco
device: 7507
duplex: no
note: !Duplex settings are falsely reported in older IOS versions
device-family: AS5000
duplex: no
class: Layer3::Cisco
device: AS5300
#
# Cisco - Catalyst
#
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
duplex: both
vlan: write
class: Layer2::C1900
device: wsc1900c
device-family: Catalyst 1900
device: wsc1900
device-family: Catalyst 1900
device-family: Catalyst 2900
note: IOS
macsuck: vlan
duplex: write
vlan: write
class: Layer2::C2900
portmac: yes
note: !Pre IOS 11.2 (8) SA3 - PortMAC shows up in CAM table.
device: 2908xl
note: !Pre IOS 11.2 (8.6) some features (duplex...) aren't present.
device: 2912MfXL
device: 2924MXL
ver: 1
device: 2924CXL
device: 2924CXLv
device-family: Catalyst 2940
note: IOS
macsuck: vlan
duplex: write
vlan: write
class: Layer2::C2900
portmac: yes
device: 2940-8TT
device-family: Catalyst 2950
note: IOS
macsuck: vlan
duplex: write
vlan: write
class: Layer2::C2900
portmac: yes
device: 2950-t24
device-family: Catalyst 2970
macsuck:vlan
duplex: write
vlan: write
note: Acts just like IOS Catalyst 6500 series
class: Layer3::C6500
device: 2960, 2970G-24T-E
device-family: Catalyst 3500 XL
portmac: yes
macsuck: vlan
duplex: write
vlan: write
note: L2 only IOS devices - Just like Catalyst 2900 series from SNMP
note: IOS Version 12.0(5)XP is buggy and doesn't do VLAN Community indexing correctly.
class: Layer2::C2900
device: 3508GXL
device: 3524XL
device: 3548XL
device-family: Catalyst 3550
macsuck: vlan
duplex: write
vlan: write
class: Layer3::C3550
note: Run IOS
note: Has VLANs that don't accept SNMP connections. Don't know if they are standard (by name or number).
note: Uses CISCO-STACK-MIB like Catalyst 5000 series for serial,duplex,type but not name
note: Comes in flavors that support L2, L3 or combo.
device: 3550-12T
device: 3400 w/ MetroBase Image
device: 3550
note: L2/L3 Switch
arpnip: yes
device: 3550-24, 3550-48
macsuck: vlan
device-family: Catalyst 3750
class: Layer3::C6500
device: 3750
device-family: Catalyst 4000
duplex: write
macsuck: vlan
vlan: write
class: Layer2::Catalyst
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: wsc4003, wsc4006
device: wsc4503, wsc4506
device: wsc4912g
note: Dedicated 12 port gig-e switch
device: 4006
duplex: both
class: Layer3::C4000
note: !Has serious slowdown/timeout problems with SNMP
note: !IOS Software Release 12.2(20)EW or higher required for duplex support
device: 4503, 4506, 4507, 4510
duplex: both
class: Layer3::C4000
note: !Has serious slowdown/timeout problems with SNMP
note: !IOS Software Release 12.2(20)EW or higher required for duplex support
device-family: Catalyst 5000
duplex: write
vlan: write
class: Layer2::Catalyst
note: Port info in CISCO-STACK-MIB
device: wsc2926
note: !Can give false information over SNMP at times.
device: wsc2948g
device: wsc2980g
note: !Macsuck not working?
device: wsc5000
note: !Has nasty tendency to not give you all SNMP data ,flaky for some older Catalyst versions.
device: wsc5505
device: wsc5509
device: wsc5500
device: wsx5302
arpnip: yes
class: Layer3
note: Router blade that runs IOS
device-family: Catalyst 6500
macsuck:vlan
duplex: write
vlan: write
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.
note: !Sup720-3B and NativeIOS 12.2 (17d)SXB10 may report 127.0.0.51 as CDP neighbor address.
device: 6503
macsuck:no
note: !Macsuck failing even under vlan mode
note: Native mode (IOS) reports L2+L3
device: 6509
duplex: link
macsuck:no
note: Native mode (IOS) reports L2+L3
note: !Macsuck failing even under vlan mode
device: wsc6509
duplex: write
class: Layer2::Catalyst
note: Hybrid Mode (Catalyst) reports L2 only
device: 6kMsfc
class: Layer3
duplex: no
vlan: no
note: IOS portion of Hybrid mode. VLAN and other L3 Services.
device: 6kMsfc2
class: Layer3
duplex: no
vlan: no
note: IOS portion of Hybrid mode. VLAN and other L3 Services.
device-family: Voice Gateway
class: Layer3
duplex: no
device: VG200
# Extreme
device-vendor: Extreme Networks
device-family: Alpine and Summit
arpnip: yes
macsuck: yes
duplex: both
vlan: yes
cdp: no
class: Layer3::Extreme
device: Alpine 3808
device: Summit 7i, 48si
# Foundry
device-vendor: Foundry Networks
note: CDP --> FDP.
device-family: FastIron
class: Layer3::Foundry
ver: 1
note: Support very limited
device: FastIron 4802
device-family: EdgeIron
ver: 2
class: Layer2::Foundry
cdp: yes
duplex: yes
macsuck: yes
device: EdgeIron 24G
note: Bug where spanning tree stuff loops forever when polled by SNMP.
device-family: IronWare
class: Layer3::Foundry
ver: 2
cdp: yes
note: FDP enabled.
duplex: yes
macsuck: yes
arpnip: yes
device:FWSX424
device:SI400 Router
# HP
device-vendor: HP
class: Layer2::HP
ver: 2
device-family: HP ProCurve
duplex: both
macsuck: yes
arpnip: no
cdp: yes
vlan: yes
note: CDP only available with newer ROM versions.
device: 2512
ver: 1
device: 2524
ver: 1
device: 4000
note: duplex issues?
device: 4104GL
duplex: link
device: 4108GL,8000,2626,2650,8000
note: VLAN info in Q-BRIDGE-MIB
# Net-SNMP
device-vendor: Net-SNMP
class: Layer3
ver: 2
device-family: Linux
note: net-snmp 4.x agent and 5.x agent.
device-family: BSD
# Juniper
device-vendor: Juniper
device-family: M-series router
arpnip: yes
# NORTEL
device-vendor: Nortel
note: CDP --> SONMP.
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.
note: !Requires Advanced or Advanced Analyzer NMM
device: 102
device: System 5000
device-family: Ethernet Switch/Baystack Switch
arpnip: no
macsuck: yes
duplex: both
vlan: yes
cdp: proprietary
class: Layer2::Baystack
device: 303,304
device: 350
device: 380
device: 410
device: 420,425
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: BPS
device-family: Ethernet Routing Switch/Baystack Switch
arpnip: yes
macsuck: yes
duplex: both
vlan: yes
cdp: proprietary
class: Layer2::Baystack
device: 3510
device: 5510,5520,5530
device-family: Centillion
macsuck: yes
duplex: both
cdp: proprietary
vlan: yes
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-family: Alteon AD
arpnip: yes
macsuck: yes
duplex: both
cdp: no
vlan: yes
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: Multiprotocol Router/BayRS
arpnip: yes
macsuck: yes
portmac: yes
duplex: both
cdp: no
vlan: yes
class: Layer3::BayRS
device: AN
device: ARN
device: ASN
device: BLN
device: Passport 2430
device: Passport 5430
device-family: VPN Router/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: Ethernet Routing Switch/Passport/Accelar LAN
arpnip: yes
macsuck: yes
portmac: yes
duplex: both
cdp: proprietary
vlan: yes
class: Layer3::Passport
note: !8600 Code versions < 3.2 vlan based mac-suck and are unsupported. Upgrade code.
note: !8600 3.2 code versions < 3.2.2.2 have Bridge MIB loop. Upgrade code.
device: 8603,8606,8610
device: 8610co
device: 8106,8110
device: 1050,1100,1150,1200
device-family: Ethernet Routing Switch/Passport 1600
arpnip: yes
macsuck: yes
portmac: yes
duplex: both
cdp: proprietary
vlan: yes
class: Layer3::N1600
device: 1612,1624,1648
device-family: Synoptics
macsuck: yes
duplex: both
cdp: proprietary
ver: 1
class: Layer1::S3000
note: Uses proprietary MIBs to provide MAC to port mapping.
note: !Requires Advanced or Advanced Analyzer NMM
device: 281X
device: System 3000
device-family: Wireless Switch 2270
arpnip: no
macsuck: yes
portmac: yes
duplex: both
cdp: proprietary
class: Layer2::N2270
note: Uses proprietary MIBs to provide MAC to port mapping. APs appear as switch ports.
device: 2270
# Proxim
device-vendor: Proxim
device-family: Orinoco
macsuck: yes
duplex: no
cdp: no
class: Layer2::Orinoco
device: AP-1000
device: AP-2000
device: AP-4000
device: WavePOINT-II
# Synoptics
device-vendor: Synoptics
note: See Nortel
# Zyxel
device-vendor: Zyxel
class: Layer2::ZyXEL_DSLAM
note: Doesn't report sysServices (layers)
device-family: Zyxel DSLAM
device:AAM10008-61, AAM1008-63

1251
Info.pm

File diff suppressed because it is too large Load Diff

448
Info/Airespace.pm Normal file
View File

@@ -0,0 +1,448 @@
# SNMP::Info::Airespace
# Eric Miller
# $Id$
#
# Copyright (c) 2005 Eric Miller
#
# 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::Airespace;
$VERSION = '1.04';
use strict;
use Exporter;
use SNMP::Info;
@SNMP::Info::Airespace::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::Airespace::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
%MIBS = (
%SNMP::Info::MIBS,
'AIRESPACE-WIRELESS-MIB' => 'bsnAPName',
'AIRESPACE-SWITCHING-MIB' => 'agentInventorySerialNumber',
);
%GLOBALS = (
%SNMP::Info::GLOBALS,
'serial' => 'agentInventorySerialNumber',
'os_ver' => 'agentInventoryProductVersion',
);
%FUNCS = (
%SNMP::Info::FUNCS,
'i_index2' => 'ifIndex',
'i_name2' => 'ifName',
'i_description2' => 'ifDescr',
# AIRESPACE-WIRELESS-MIB::bsnAPTable
'airespace_ap_mac' => 'bsnAPDot3MacAddress',
'airespace_ap_name' => 'bsnAPName',
'airespace_ap_ip' => 'bsnApIpAddress',
'airespace_ap_loc' => 'bsnAPLocation',
'airespace_ap_model' => 'bsnAPModel',
'airespace_ap_serial' => 'bsnAPSerialNumber',
# AIRESPACE-WIRELESS-MIB::bsnMobileStationTable
'fw_port' => 'bsnMobileStationAPMacAddr',
'fw_mac' => 'bsnMobileStationMacAddress',
# AIRESPACE-SWITCHING-MIB::agentPortConfigTable
'airespace_duplex_admin' => 'agentPortPhysicalMode',
'airespace_duplex' => 'agentPortPhysicalStatus',
);
%MUNGE = (
%SNMP::Info::MUNGE,
# Add ones for our class
'airespace_ap_mac' => \&SNMP::Info::munge_mac,
'fw_port' => \&SNMP::Info::munge_mac,
);
sub layers {
return '00000011';
}
# Wirless switches do not support ifMIB requirements for get MAC
# and port status
sub i_index {
my $airespace = shift;
my $i_index = $airespace->i_index2();
my $ap_index = $airespace->airespace_ap_mac();
my %if_index;
foreach my $iid (keys %$i_index){
my $index = $i_index->{$iid};
next unless defined $index;
$if_index{$iid} = $index;
}
# Get Attached APs as Interfaces
foreach my $ap_id (keys %$ap_index){
my $ap_index = $ap_index->{$ap_id};
next unless defined $ap_index;
$if_index{$ap_id} = $ap_index;
}
return \%if_index;
}
sub interfaces {
my $airespace = shift;
my $i_index = $airespace->i_index();
my $ap_index = $airespace->airespace_ap_mac();
my %if;
foreach my $iid (keys %$i_index){
my $index = $i_index->{$iid};
next unless defined $index;
if ($index =~ /^\d+$/ ) {
$if{$index} = "1.$index";
}
elsif ($index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/) {
my $ap = $ap_index->{$iid};
next unless defined $ap;
$if{$index} = $ap;
}
else {
next;
}
}
return \%if;
}
sub i_name {
my $airespace = shift;
my $i_index = $airespace->i_index();
my $i_name2 = $airespace->i_name2();
my $ap_name = $airespace->airespace_ap_name();
my %i_name;
foreach my $iid (keys %$i_index){
my $index = $i_index->{$iid};
next unless defined $index;
if ($index =~ /^\d+$/ ) {
my $name = $i_name2->{$iid};
next unless defined $name;
$i_name{$index} = $name;
}
elsif ($index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/) {
my $name = $ap_name->{$iid};
next unless defined $name;
$i_name{$index} = $name;
}
else {
next;
}
}
return \%i_name;
}
sub i_description {
my $airespace = shift;
my $i_index = $airespace->i_index();
my $i_descr = $airespace->i_description2();
my $ap_loc = $airespace->airespace_ap_loc();
my %descr;
foreach my $iid (keys %$i_index){
my $index = $i_index->{$iid};
next unless defined $index;
if ($index =~ /^\d+$/ ) {
my $descr = $i_descr->{$iid};
next unless defined $descr;
$descr{$index} = $descr;
}
elsif ($index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/) {
my $name = $ap_loc->{$iid};
next unless defined $name;
$descr{$index} = $name;
}
else {
next;
}
}
return \%descr;
}
sub i_duplex {
my $airespace = shift;
my $interfaces = $airespace->interfaces();
my $ap_duplex = $airespace->airespace_duplex();
my %i_duplex;
foreach my $if (keys %$interfaces){
my $duplex = $ap_duplex->{$if};
next unless defined $duplex;
$duplex = 'half' if $duplex =~ /half/i;
$duplex = 'full' if $duplex =~ /full/i;
$duplex = 'auto' if $duplex =~ /auto/i;
$i_duplex{$if}=$duplex;
}
return \%i_duplex;
}
sub i_duplex_admin {
my $airespace = shift;
my $interfaces = $airespace->interfaces();
my $ap_duplex_admin = $airespace->airespace_duplex_admin();
my %i_duplex_admin;
foreach my $if (keys %$interfaces){
my $duplex = $ap_duplex_admin->{$if};
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{$if}=$duplex;
}
return \%i_duplex_admin;
}
# Wireless switches do not support the standard Bridge MIB
sub bp_index {
my $airespace = shift;
my $i_index = $airespace->i_index2();
my $ap_index = $airespace->airespace_ap_mac();
my %bp_index;
foreach my $iid (keys %$i_index){
my $index = $i_index->{$iid};
next unless defined $index;
$bp_index{$iid} = $index;
}
# Get Attached APs as Interfaces
foreach my $ap_id (keys %$ap_index){
my $ap_index = $ap_index->{$ap_id};
next unless defined $ap_index;
$bp_index{$ap_index} = $ap_index;
}
return \%bp_index;
}
1;
__END__
=head1 NAME
SNMP::Info::Airespace - SNMP Interface to Airespace wireless switches
=head1 AUTHOR
Eric Miller
=head1 SYNOPSIS
my $airespace = new SNMP::Info(
AutoSpecify => 1,
Debug => 1,
DestHost => 'myswitch',
Community => 'public',
Version => 2
)
or die "Can't connect to DestHost.\n";
my $class = $airespace->class();
print " Using device sub class : $class\n";
=head1 DESCRIPTION
SNMP::Info::Airespace is a subclass of SNMP::Info that provides an interface
to C<AIRESPACE-WIRELESS-MIB> and C<AIRESPACE-SWITCHING-MIB>. These MIBs are
used in Airespace wireless switches, as well as, products from Cisco, Nortel,
and Alcatel which are based upon the Airespace platform.
The Airespace platform utilizes intelligent wireless switches which control
thin access points. The thin access points themselves are unable to be polled
for end station information.
This class emulates bridge functionality for the wireless switch. This enables
end station MAC addresses collection and correlation to the thin access point
the end station is using for communication.
Normally you use or create a subclass of SNMP::Info that inherits this one. Do not use directly.
For debugging purposes call the class directly as you would SNMP::Info
my $airespace = new SNMP::Info::Airespace(...);
=head2 Inherited Classes
=over
=item SNMP::Info
=back
=head2 Required MIBs
=over
=item AIRESPACE-WIRELESS-MIB
=item AIRESPACE-SWITCHING-MIB
=back
=head1 GLOBALS
These are methods that return scalar value from SNMP
=over
=item $airespace->serial()
(B<agentInventorySerialNumber>)
=item $airespace->os_ver()
(B<agentInventoryProductVersion>)
=back
=head2 Overrides
=over
=item $airespace->layers()
Returns 00000011. Class emulates Layer 2 functionality for Thin APs through
proprietary MIBs.
=back
=head1 TABLE ENTRIES
These are methods that return tables of information in the form of a reference
to a hash.
=head2 Overrides
=over
=item $airespace->i_index()
Returns reference to map of IIDs to Interface index.
Extends ifIndex to support thin APs as device interfaces.
=item $airespace->interfaces()
Returns reference to map of IIDs to ports. Thin APs are implemented as device
interfaces. The thin AP MAC address is used as the port identifier.
=item $airespace->i_name()
Interface name. Returns (B<ifName>) for Ethernet interfaces and (B<bsnAPName>)
for thin AP interfaces.
=item $airespace->i_description()
Description of the interface. Returns (B<ifDescr>) for Ethernet interfaces and
(B<bsnAPLocation>) for thin AP interfaces.
=item $airespace->i_duplex()
Returns reference to map of IIDs to current link duplex. Ethernet interfaces only.
=item $airespace->i_duplex_admin()
Returns reference to hash of IIDs to admin duplex setting. Ethernet interfaces
only.
=item $airespace->bp_index()
Simulates bridge MIB by returning reference to a hash containing the index for
both the keys and values.
=item $airespace->fw_port()
(B<bsnMobileStationAPMacAddr>)
=item $airespace->fw_mac()
(B<bsnMobileStationMacAddress>)
=back
=head2 AIRESPACE AP Table (B<bsnAPTable>)
=over
=item $airespace->airespace_ap_mac()
(B<bsnAPDot3MacAddress>)
=item $airespace->airespace_ap_name()
(B<bsnAPName>)
=item $airespace->airespace_ap_ip()
(B<bsnApIpAddress>)
=item $airespace->airespace_ap_loc()
(B<bsnAPLocation>)
=item $airespace->airespace_ap_model()
(B<bsnAPModel>)
=item $airespace->airespace_ap_serial()
(B<bsnAPSerialNumber>)
=back
=head2 AIRESPACE Agent Port Config Table (B<agentPortConfigTable>)
=over
=item $airespace->airespace_duplex_admin()
(B<agentPortPhysicalMode>)
=item $airespace->airespace_duplex()
(B<agentPortPhysicalStatus>)
=cut

View File

@@ -1,9 +1,13 @@
# SNMP::Info::Bridge
# Max Baker <max@warped.org>
# Max Baker
#
# 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.4;
$VERSION = '1.04';
# $Id$
use strict;
@@ -40,12 +44,9 @@ use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
@SNMP::Info::Bridge::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::Bridge::EXPORT_OK = qw//;
$DEBUG=0;
$SNMP::debugging=$DEBUG;
$INIT = 0;
%MIBS = ('BRIDGE-MIB' => 'dot1dBaseBridgeAddress');
%MIBS = ('BRIDGE-MIB' => 'dot1dBaseBridgeAddress',
'Q-BRIDGE-MIB' => 'dot1qPvid',
);
%GLOBALS = (
'b_mac' => 'dot1dBaseBridgeAddress',
@@ -55,6 +56,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 +82,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 = (
@@ -93,6 +102,22 @@ $INIT = 0;
'stp_p_port' => \&SNMP::Info::munge_mac
);
sub qb_i_vlan_t {
my $bridge = shift;
my $qb_i_vlan = $bridge->qb_i_vlan();
my $qb_i_vlan_type = $bridge->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} || '';
next unless defined $vlan;
$i_vlan->{$if} = $tagged eq 'admitOnlyVlanTagged' ? 'trunk' : $vlan;
}
return $i_vlan;
}
sub i_stp_state {
my $bridge = shift;
@@ -112,7 +137,60 @@ sub i_stp_state {
return \%i_stp_state;
}
sub i_stp_port {
my $bridge = shift;
my $bp_index = $bridge->bp_index();
my $stp_p_port = $bridge->stp_p_port();
my %i_stp_port;
foreach my $index (keys %$stp_p_port){
my $bridge = $stp_p_port->{$index};
my $iid = $bp_index->{$index};
next unless defined $iid;
next unless defined $bridge;
$i_stp_port{$iid}=$bridge;
}
return \%i_stp_port;
}
sub i_stp_id {
my $bridge = shift;
my $bp_index = $bridge->bp_index();
my $stp_p_id = $bridge->stp_p_id();
my %i_stp_id;
foreach my $index (keys %$stp_p_id){
my $bridge = $stp_p_id->{$index};
my $iid = $bp_index->{$index};
next unless defined $iid;
next unless defined $bridge;
$i_stp_id{$iid}=$bridge;
}
return \%i_stp_id;
}
sub i_stp_bridge {
my $bridge = shift;
my $bp_index = $bridge->bp_index();
my $stp_p_bridge = $bridge->stp_p_bridge();
my %i_stp_bridge;
foreach my $index (keys %$stp_p_bridge){
my $bridge = $stp_p_bridge->{$index};
my $iid = $bp_index->{$index};
next unless defined $iid;
next unless defined $bridge;
$i_stp_bridge{$iid}=$bridge;
}
return \%i_stp_bridge;
}
1;
__END__
@@ -122,7 +200,7 @@ SNMP::Info::Bridge - Perl5 Interface to SNMP data available through the BRIDGE-M
=head1 AUTHOR
Max Baker (C<max@warped.org>)
Max Baker
=head1 SYNOPSIS
@@ -145,7 +223,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 +234,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 +253,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 +303,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
@@ -332,6 +427,49 @@ this port's segment."
"The Port Identifier of the port on the Designated Bridge for this port's segment."
=item $bridge->i_stp_port()
Returns the mapping of (B<dot1dStpPortDesignatedPort>) to the interface index (iid).
=item $bridge->i_stp_id()
Returns the mapping of (B<dot1dStpPort>) to the interface index (iid).
=item $bridge->i_stp_bridge()
Returns the mapping of (B<dot1dStpPortDesignatedBridge>) to the interface index (iid).
=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

View File

@@ -1,5 +1,8 @@
# SNMP::Info::CDP
# Max Baker <max@warped.org>
# Max Baker
#
# 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,27 +31,22 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::CDP;
$VERSION = 0.4;
$VERSION = '1.04';
# $Id$
use strict;
use Exporter;
use SNMP::Info;
use Carp;
@SNMP::Info::CDP::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::CDP::EXPORT_OK = qw//;
use vars qw/$VERSION $DEBUG %FUNCS %GLOBALS %MIBS %MIBS_V1 %MUNGE $INIT/;
# Debug
$DEBUG=0;
$SNMP::debugging=$DEBUG;
use vars qw/$VERSION $DEBUG %FUNCS %GLOBALS %MIBS %MUNGE $INIT/;
# Five data structures required by SNMP::Info
$INIT = 0;
%MIBS = ( 'CISCO-CDP-MIB' => 'cdpGlobalRun' );
%MIBS_V1 = ( 'CISCO-CDP-MIB-V1SMI' => 'cdpGlobalRun' );
# Notice we dont inherit the default GLOBALS and FUNCS
# only the default MUNGE.
%GLOBALS = (
@@ -74,9 +72,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;
@@ -114,8 +124,7 @@ sub c_if {
# Nope, didn't think so. Now we fake it.
my $c_ip = $cdp->c_ip();
unless (defined $c_ip){
$cdp->{error} = "SNMP::Info::CDP::c_if() - Device doesn't have c_ip() data. Can't fake c_index()";
$DEBUG and carp($cdp->error(1));
$cdp->error_throw("SNMP::Info::CDP:c_if() - Device doesn't have cdp_ip() data. Can't fake cdp_index()");
return undef;
}
@@ -140,7 +149,7 @@ SNMP::Info::CDP - Perl5 Interface to Cisco Discovery Protocol (CDP) using SNMP
=head1 AUTHOR
Max Baker (C<max@warped.org>)
Max Baker
=head1 SYNOPSIS

118
Info/CiscoImage.pm Normal file
View File

@@ -0,0 +1,118 @@
package SNMP::Info::CiscoImage;
#$Id$
# Copyright (c) 2005 Matt Tuttle
#
# 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.
use strict;
use Exporter;
use SNMP::Info;
use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
$VERSION = '1.04';
@SNMP::Info::CiscoImage::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::CiscoImage::EXPORT_OK = qw//;
%MIBS = (
'CISCO-IMAGE-MIB' => 'ciscoImageString',
);
%GLOBALS = (
);
%FUNCS = (
'ci_images' => 'ciscoImageString',
);
%MUNGE = (
);
1;
__END__
=head1 NAME
SNMP::Info::CiscoImage - Perl5 Interface to image strings for Cisco Devices
=head1 AUTHOR
Matt Tuttle (C<mtuttle@americanhebrewacademy.org>)
=head1 SYNOPSIS
# Let SNMP::Info determine the correct subclass for you.
my $ci = 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 = $ci->class();
print "SNMP::Info determined this device to fall under subclass : $class\n";
=head1 DESCRIPTION
SNMP::Info::CiscoImage is a subclass of SNMP::Info that provides access to
image strings embedded in an image running on Cisco Devices.
Use or create in a subclass of SNMP::Info. Do not use directly.
=head2 Inherited Classes
none.
=head2 Required MIBs
=over
=item CISCO-IMAGE-MIB
=back
MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
=head1 GLOBALS
None.
=head1 TABLE METHODS
=over
=item $ci->ci_images()
Returns the table of image strings.
B<ciscoImageString>
=back
=cut

151
Info/CiscoQOS.pm Normal file
View File

@@ -0,0 +1,151 @@
# SNMP::Info::CiscoQOS
# Alexander Hartmaier <alexander.hartmaier@t-systems.at>
# $Id$
#
# Copyright (c) 2005 Alexander Hartmaier
#
# 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::CiscoQOS;
$VERSION = '1.04';
use strict;
use Exporter;
use SNMP::Info;
@SNMP::Info::CiscoQOS::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::CiscoQOS::EXPORT_OK = qw//;
use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
%MIBS = (
'CISCO-CLASS-BASED-QOS-MIB' => 'cbQosIfIndex',
);
%GLOBALS = (
);
%FUNCS = (
# CISCO-CLASS-BASED-QOS-MIB
'qos_i_index' => 'cbQosIfIndex',
'qos_i_type' => 'cbQosIfType',
'qos_pol_direction' => 'cbQosPolicyDirection',
'qos_obj_index' => 'cbQosConfigIndex',
'qos_obj_type' => 'cbQosObjectsType',
'qos_obj_parent' => 'cbQosParentObjectsIndex',
'qos_cm_name' => 'cbQosCMName',
'qos_cm_desc' => 'cbQosCMDesc',
'qos_cm_info' => 'cbQosCMInfo',
'qos_octet_pre' => 'cbQosCMPrePolicyByte',
'qos_octet_post' => 'cbQosCMPostPolicyByte',
);
%MUNGE = (
);
1;
__END__
=head1 NAME
SNMP::Info::CiscoQOS - Perl5 Interface to Cisco's Quality of Service MIBs
=head1 AUTHOR
Alexander Hartmaier (C<alexander.hartmaier@t-systems.at>)
=head1 SYNOPSIS
# Let SNMP::Info determine the correct subclass for you.
my $qos = 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 = $qos->class();
print "SNMP::Info determined this device to fall under subclass : $class\n";
=head1 DESCRIPTION
SNMP::Info::CiscoQOS is a subclass of SNMP::Info that provides
information about a cisco device's QoS config.
Use or create in a subclass of SNMP::Info. Do not use directly.
=head2 Inherited Classes
none.
=head2 Required MIBs
=over
=item CISCO-CLASS-BASED-QOS-MIB
=back
MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
=head1 GLOBALS
=over
none
=back
=head1 TABLE METHODS
=head2 ServicePolicy Table
This table is from CISCO-CLASS-BASED-QOS-MIB::cbQosServicePolicyTable
This table describes the interfaces/media types and the policymap that are attached to it.
=over
=item $qos->qos_i_index()
(B<cbQosIfIndex>)
=item $qos->qos_i_type()
(B<cbQosIfType>)
=head2 ClassMap configuration Table
This table is from CISCO-CLASS-BASED-QOS-MIB::cbQosCMCfgTable
=over
=back
=cut

143
Info/CiscoRTT.pm Normal file
View File

@@ -0,0 +1,143 @@
# SNMP::Info::CiscoRTT
# Alexander Hartmaier <alexander.hartmaier@t-systems.at>
# $Id$
#
# Copyright (c) 2005 Alexander Hartmaier
#
# 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::CiscoRTT;
$VERSION = '1.04';
use strict;
use Exporter;
use SNMP::Info;
@SNMP::Info::CiscoRTT::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::CiscoRTT::EXPORT_OK = qw//;
use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
%MIBS = (
'CISCO-RTTMON-MIB' => 'rttMonCtrlAdminOwner',
);
%GLOBALS = (
);
%FUNCS = (
# CISCO-RTTMON-MIB
'rtt_desc' => 'rttMonCtrlAdminOwner',
'rtt_last' => 'rttMonLatestRttOperCompletionTime',
);
%MUNGE = (
);
1;
__END__
=head1 NAME
SNMP::Info::CiscoRTT - Perl5 Interface to Cisco's Round Trip Time MIBs
=head1 AUTHOR
Alexander Hartmaier (C<alexander.hartmaier@t-systems.at>)
=head1 SYNOPSIS
# Let SNMP::Info determine the correct subclass for you.
my $rtt = 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 = $rtt->class();
print "SNMP::Info determined this device to fall under subclass : $class\n";
=head1 DESCRIPTION
SNMP::Info::CiscoRTT is a subclass of SNMP::Info that provides
information about a cisco device's RTT values.
Use or create in a subclass of SNMP::Info. Do not use directly.
=head2 Inherited Classes
none.
=head2 Required MIBs
=over
=item CISCO-RTTMON-MIB
=back
MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
=head1 GLOBALS
=over
none
=back
=head1 TABLE METHODS
=head2 Overall Control Group Table
This table is from CISCO-RTTMAN-MIB::rttMonCtrlAdminTable
=over
=item $rtt->rtt_desc()
(B<rttMonCtrlAdminOwner>)
=back
=head2 Overall Control Group Table
This table is from CISCO-RTTMON-MIB::rttMonCtrl
=over
=item $rtt->rtt_last()
(B<rttMonLatestRttOperCompletionTime>)
=back
=cut

819
Info/CiscoStack.pm Normal file
View File

@@ -0,0 +1,819 @@
# SNMP::Info::CiscoStack
# Max Baker
#
# Copyright (c)2003,2004,2006 Max Baker
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of the author nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::CiscoStack;
$VERSION = '1.04';
# $Id$
use strict;
use Exporter;
use SNMP::Info;
use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE %PORTSTAT $INIT/;
@SNMP::Info::CiscoStack::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::CiscoStack::EXPORT_OK = qw//;
%MIBS = (
'CISCO-STACK-MIB' => 'ciscoStackMIB',
'CISCO-PORT-SECURITY-MIB' => 'ciscoPortSecurityMIB',
);
%GLOBALS = (
'sysip' => 'sysIpAddr',
'netmask' => 'sysNetMask',
'broadcast' => 'sysBroadcast',
'serial1' => 'chassisSerialNumber',
'serial2' => 'chassisSerialNumberString',
'model1' => 'chassisModel',
'ps1_type' => 'chassisPs1Type',
'ps1_status' => 'chassisPs1Status',
'ps2_type' => 'chassisPs2Type',
'ps2_status' => 'chassisPs2Status',
'slots' => 'chassisNumSlots',
'fan' => 'chassisFanStatus',
# 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 = (
'i_type2' => 'ifType',
# CISCO-STACK-MIB::moduleEntry
# These are blades in a catalyst device
'm_type' => 'moduleType',
'm_model' => 'moduleModel',
'm_serial' => 'moduleSerialNumber',
'm_status' => 'moduleStatus',
'm_name' => 'moduleName',
'm_ports' => 'moduleNumPorts',
'm_ports_status' => 'modulePortStatus',
'm_hwver' => 'moduleHwVersion',
'm_fwver' => 'moduleFwVersion',
'm_swver' => 'moduleSwVersion',
# Router Blades :
'm_ip' => 'moduleIPAddress',
'm_sub1' => 'moduleSubType',
'm_sub2' => 'moduleSubType2',
# CISCO-STACK-MIB::portEntry
'p_name' => 'portName',
'p_type' => 'portType',
'p_status' => 'portOperStatus',
'p_status2' => 'portAdditionalStatus',
'p_speed' => 'portAdminSpeed',
'p_duplex' => 'portDuplex',
'p_port' => 'portIfIndex',
'p_rx_flow_control' => 'portOperRxFlowControl',
'p_tx_flow_control' => 'portOperTxFlowControl',
'p_rx_flow_control_admin' => 'portAdminRxFlowControl',
'p_tx_flow_control_admin' => 'portAdminTxFlowControl',
'p_oidx' => 'portCrossIndex',
# 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',
2 => 'ok',
3 => 'minorFault',
4 => 'majorFault');
# Changes binary byte describing each port into ascii, and returns
# an ascii list separated by spaces.
sub munge_port_status {
my $status = shift;
my @vals = map($PORTSTAT{$_},unpack('C*',$status));
return join(' ',@vals);
}
sub serial {
my $stack = shift;
my $serial1 = $stack->serial1();
my $serial2 = $stack->serial2();
return $serial1 if defined $serial1;
return $serial2 if defined $serial2;
return undef;
}
sub i_type {
my $stack = shift;
my $p_port = $stack->p_port() || {};
my $p_type = $stack->p_type() || {};
# Get more generic port types from IF-MIB
my $i_type = $stack->i_type2() || {};
# Now Override w/ port entries
foreach my $port (keys %$p_type) {
my $iid = $p_port->{$port};
next unless defined $iid;
$i_type->{$iid} = $p_type->{$port};
}
return $i_type;
}
# p_* functions are indexed to physical port. let's index these
# to snmp iid
sub i_name {
my $stack = shift;
my $p_port = $stack->p_port() || {};
my $p_name = $stack->p_name() || {};
my %i_name;
foreach my $port (keys %$p_name) {
my $iid = $p_port->{$port};
next unless defined $iid;
$i_name{$iid} = $p_name->{$port};
}
return \%i_name;
}
sub i_duplex {
my $stack = shift;
#my $i_duplex = $stack->SUPER::i_duplex();
my $p_port = $stack->p_port() || {};
my $p_duplex = $stack->p_duplex() || {};
my $i_duplex = {};
foreach my $port (keys %$p_duplex) {
my $iid = $p_port->{$port};
next unless defined $iid;
$i_duplex->{$iid} = $p_duplex->{$port};
}
return $i_duplex;
}
sub i_duplex_admin {
my $stack = shift;
my $p_port = $stack->p_port() || {};
my $p_duplex_admin = $stack->p_duplex_admin() || {};
my %i_duplex_admin;
foreach my $port (keys %$p_duplex_admin) {
my $iid = $p_port->{$port};
next unless defined $iid;
my $duplex = $p_duplex_admin->{$port};
next unless defined $duplex;
my $string = 'other';
# see CISCO-STACK-MIB for a description of the bits
$string = 'half' if ($duplex =~ /001$/ or $duplex =~ /0100.$/);
$string = 'full' if ($duplex =~ /010$/ or $duplex =~ /100.0$/);
# we'll call it auto if both full and half are turned on, or if the
# specifically 'auto' flag bit is set.
$string = 'auto'
if ($duplex =~ /1..$/ or $duplex =~ /110..$/ or $duplex =~ /..011$/);
$i_duplex_admin{$iid} = $string;
}
return \%i_duplex_admin;
}
sub set_i_speed_admin {
# map speeds to those the switch will understand
my %speeds = qw/auto 1 10 10000000 100 100000000 1000 1000000000/;
my $stack = shift;
my ($speed, $iid) = @_;
my $p_port = $stack->p_port() || {};
my %reverse_p_port = reverse %$p_port;
$speed = lc($speed);
return 0 unless defined $speeds{$speed};
$iid = $reverse_p_port{$iid};
return $stack->set_p_speed($speeds{$speed}, $iid);
}
sub set_i_duplex_admin {
# map a textual duplex to an integer one the switch understands
my %duplexes = qw/half 1 full 2 auto 4/;
my $stack = shift;
my ($duplex, $iid) = @_;
my $p_port = $stack->p_port() || {};
my %reverse_p_port = reverse %$p_port;
$duplex = lc($duplex);
return 0 unless defined $duplexes{$duplex};
$iid = $reverse_p_port{$iid};
return $stack->set_p_duplex($duplexes{$duplex}, $iid);
}
# $stack->interfaces() - Maps the ifIndex table to a physical port
sub interfaces {
my $self = shift;
my $i_index = $self->i_index();
my $portnames = $self->p_port() || {};
my %portmap = reverse %$portnames;
my %interfaces = ();
foreach my $iid (keys %$i_index) {
next unless defined $iid;
my $if = $i_index->{$iid};
my $port = $portmap{$iid};
$interfaces{$iid} = $port || $if;
}
return \%interfaces;
}
1;
__END__
=head1 NAME
SNMP::Info::CiscoStack - Intefaces to data from CISCO-STACK-MIB and CISCO-PORT-SECURITY-MIB
=head1 AUTHOR
Max Baker
=head1 SYNOPSIS
# Let SNMP::Info determine the correct subclass for you.
my $ciscostats = new SNMP::Info(
AutoSpecify => 1,
Debug => 1,
# These arguments are passed directly on to SNMP::Session
DestHost => 'myswitch',
Community => 'public',
Version => 2
)
or die "Can't connect to DestHost.\n";
my $class = $ciscostats->class();
print "SNMP::Info determined this device to fall under subclass : $class\n";
=head1 DESCRIPTION
SNMP::Info::CiscoStack is a subclass of SNMP::Info that provides
an interface to the C<CISCO-STACK-MIB>. This MIB is used across
the Catalyst family under CatOS and IOS.
Use or create in a subclass of SNMP::Info. Do not use directly.
=head2 Inherited Classes
none.
=head2 Required MIBs
=over
=item CISCO-STACK-MIB
=item CISCO-PORT-SECURITY-MIB
=back
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
=over
=item $stack->broadcast()
(B<sysBroadcast>)
=item $stack->fan()
(B<chassisFanStatus>)
=item $stack->model()
(B<chassisModel>)
=item $stack->netmask()
(B<sysNetMask>)
=item $stack->ps1_type()
(B<chassisPs1Type>)
=item $stack->ps2_type()
(B<chassisPs2Type>)
=item $stack->ps1_status()
(B<chassisPs1Status>)
=item $stack->ps2_status()
(B<chassisPs2Status>)
=item $stack->serial()
(B<chassisSerialNumberString>) or (B<chassisSerialNumber>)
=item $stack->slots()
(B<chassisNumSlots>)
=back
=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
=over
=item $stack->interfaces()
Crosses p_port() with i_index() to get physical names.
=item $stack->i_physical()
Returns a map to IID for ports that are physical ports, not vlans, etc.
=item $stack->i_type()
Crosses p_port() with p_type() and returns the results.
Overrides with ifType if p_type() isn't available.
=item $stack->i_name()
Crosses p_name with p_port and returns results.
=item $stack->i_duplex()
Crosses p_duplex with p_port and returns results.
=item $stack->i_duplex_admin()
Crosses p_duplex_admin with p_port.
Munges bit_string returned from p_duplex_admin to get duplex settings.
=item $stack->set_i_speed_admin(speed, ifIndex)
Sets port speed, must be supplied with speed and port ifIndex
Speed choices are 'auto', '10', '100', '1000'
Crosses $stack->p_port() with $stack->p_duplex() to
utilize port ifIndex.
Example:
my %if_map = reverse %{$stack->interfaces()};
$stack->set_i_speed_admin('auto', $if_map{'FastEthernet0/1'})
or die "Couldn't change port speed. ",$stack->error(1);
=item $stack->set_i_duplex_admin(duplex, ifIndex)
Sets port duplex, must be supplied with duplex and port ifIndex
Speed choices are 'auto', 'half', 'full'
Crosses $stack->p_port() with $stack->p_duplex() to
utilize port ifIndex.
Example:
my %if_map = reverse %{$stack->interfaces()};
$stack->set_i_duplex_admin('auto', $if_map{'FastEthernet0/1'})
or die "Couldn't change port duplex. ",$stack->error(1);
=back
=head2 Module table
This table holds configuration information for each of the blades installed in
the Catalyst device.
=over
=item $stack->m_type()
(B<moduleType>)
=item $stack->m_model()
(B<moduleModel>)
=item $stack->m_serial()
(B<moduleSerialNumber>)
=item $stack->m_status()
(B<moduleStatus>)
=item $stack->m_name()
(B<moduleName>)
=item $stack->m_ports()
(B<moduleNumPorts>)
=item $stack->m_ports_status()
Returns a list of space separated status strings for the ports.
To see the status of port 4 :
@ports_status = split(' ', $stack->m_ports_status() );
$port4 = $ports_status[3];
(B<modulePortStatus>)
=item $stack->m_ports_hwver()
(B<moduleHwVersion>)
=item $stack->m_ports_fwver()
(B<moduleFwVersion>)
=item $stack->m_ports_swver()
(B<moduleSwVersion>)
=item $stack->m_ports_ip()
(B<moduleIPAddress>)
=item $stack->m_ports_sub1()
(B<moduleSubType>)
=item $stack->m_ports_sub2()
(B<moduleSubType2>)
=back
=head2 Modules - Router Blades
=over
=item $stack->m_ip()
(B<moduleIPAddress>)
=item $stack->m_sub1()
(B<moduleSubType>)
=item $stack->m_sub2()
(B<moduleSubType2>)
=back
=head2 Port Entry Table (CISCO-STACK-MIB::portTable)
=over
=item $stack->p_name()
(B<portName>)
=item $stack->p_type()
(B<portType>)
=item $stack->p_status()
(B<portOperStatus>)
=item $stack->p_status2()
(B<portAdditionalStatus>)
=item $stack->p_speed()
(B<portAdminSpeed>)
=item $stack->p_duplex()
(B<portDuplex>)
=item $stack->p_port()
(B<portIfIndex>)
=item $stack->p_rx_flow_control()
Can be either C<on> C<off> or C<disagree>
"Indicates the receive flow control operational status of the port. If the port
could not agree with the far end on a link protocol, its operational status
will be disagree(3)."
B<portOperRxFlowControl>
=item $stack->p_tx_flow_control()
Can be either C<on> C<off> or C<disagree>
"Indicates the transmit flow control operational status of the port. If the
port could not agree with the far end on a link protocol, its operational
status will be disagree(3)."
B<portOperTxFlowControl>
=item $stack->p_rx_flow_control_admin()
Can be either C<on> C<off> or C<desired>
"Indicates the receive flow control administrative status set on the port. If
the status is set to on(1), the port will require the far end to send flow
control. If the status is set to off(2), the port will not allow far end to
send flow control. If the status is set to desired(3), the port will allow the
far end to send the flow control."
B<portAdminRxFlowControl>
=item $stack->p_tx_flow_control_admin()
Can be either C<on> C<off> or C<desired>
"Indicates the transmit flow control administrative status set on the port. If
the status is set to on(1), the port will send flow control to the far end. If
the status is set to off(2), the port will not send flow control to the far
end. If the status is set to desired(3), the port will send flow control to the
far end if the far end supports it."
B<portAdminTxFlowControl>
=back
=head2 Port Capability Table (CISCO-STACK-MIB::portCpbTable)
=over
=item $stack->p_speed_admin()
(B<portCpbSpeed>)
=item $stack->p_duplex_admin()
(B<portCpbDuplex>)
=back
=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

View File

@@ -1,5 +1,8 @@
# SNMP::Info::CiscoStats
# Max Baker <max@warped.org>
# Max Baker
#
# 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.4;
$VERSION = '1.04';
# $Id$
use strict;
@@ -40,14 +43,14 @@ use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
@SNMP::Info::CiscoStats::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::CiscoStats::EXPORT_OK = qw//;
$DEBUG=0;
$SNMP::debugging=$DEBUG;
$INIT = 0;
%MIBS = (
'RFC1213-MIB' => 'sysDescr',
'SNMPv2-MIB' => 'sysDescr',
'CISCO-PROCESS-MIB' => 'cpmCPUTotal5sec',
'CISCO-MEMORY-POOL-MIB' => 'ciscoMemoryPoolUsed'
'CISCO-MEMORY-POOL-MIB' => 'ciscoMemoryPoolUsed',
'OLD-CISCO-SYSTEM-MIB' => 'writeMem',
'CISCO-PRODUCTS-MIB' => 'sysName',
'CISCO-STACK-MIB' => 'wsc1900sysID', # some older catalysts live here
'CISCO-ENTITY-VENDORTYPE-OID-MIB' => 'cevChassis',
);
%GLOBALS = (
@@ -65,6 +68,8 @@ $INIT = 0;
# CISCO-MEMORY-POOL-MIB
'mem_free' => 'ciscoMemoryPoolFree.1',
'mem_used' => 'ciscoMemoryPoolUsed.1',
# OLD-CISCO-SYSTEM-MIB
'write_mem' => 'writeMem',
);
%FUNCS = (
@@ -75,10 +80,11 @@ $INIT = 0;
sub os {
my $l2 = shift;
my $descr = $l2->description();
my $descr = $l2->description() || '';
return 'catalyst' if ($descr =~ /catalyst/i);
# order here matters - there are Catalysts that run IOS and have catalyst in their description field.
return 'ios' if ($descr =~ /IOS/);
return 'catalyst' if ($descr =~ /catalyst/i);
return undef;
}
@@ -88,12 +94,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;
@@ -140,7 +146,7 @@ SNMP::Info::CiscoStats - Perl5 Interface to CPU and Memory stats for Cisco Devic
=head1 AUTHOR
Max Baker (C<max@warped.org>)
Max Baker
=head1 SYNOPSIS
@@ -173,11 +179,19 @@ none.
=over
=item CISCO-PRODUCTS-MIB
=item CISCO-PROCESS-MIB
=item CISCO-MEMORY-POOL-MIB
=item RFC1213-MIB
=item SNMPv2-MIB
=item OLD-CISCO-SYSTEM-MIB
=item CISCO-STACK-MIB
=item CISCO-ENTITY-VENDORTYPE-OID-MIB
=back

420
Info/CiscoVTP.pm Normal file
View File

@@ -0,0 +1,420 @@
# SNMP::Info::CiscoVTP
# Max Baker
#
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
#
# Copyright (c) 2003 Regents of the University of California
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of the University of California, Santa Cruz nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::CiscoVTP;
$VERSION = '1.04';
# $Id$
use strict;
use Exporter;
use SNMP::Info;
use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
@SNMP::Info::CiscoVTP::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::CiscoVTP::EXPORT_OK = qw//;
%MIBS = (
'CISCO-VTP-MIB' => 'vtpVlanName',
'CISCO-VLAN-MEMBERSHIP-MIB' => 'vmMembershipEntry',
'CISCO-VLAN-IFTABLE-RELATIONSHIP-MIB' => 'cviRoutedVlanIfIndex',
);
%GLOBALS = (
'vtp_version' => 'vtpVersion',
'vtp_maxstore' => 'vtpMaxVlanStorage',
'vtp_notify' => 'vtpNotificationsEnabled',
'vtp_notify_create' => 'vtpVlanCreatedNotifEnabled',
'vtp_notify_delete' => 'vtpVlanDeletedNotifEnabled',
);
%FUNCS = (
# Management Domain Table
'vtp_d_index' => 'managementDomainIndex',
'vtp_d_name' => 'managementDomainName',
'vtp_d_mode' => 'managementDomainLocalMode',
'vtp_d_rev' => 'managementDomainConfigRevNumber',
'vtp_d_updater' => 'managementDomainLastUpdater',
'vtp_d_last' => 'managementDomainLastChange',
'vtp_d_status' => 'managementDomainRowStatus',
'vtp_d_tftp' => 'managementDomainTftpServer',
'vtp_d_tftp_path' => 'managementDomainTftpPathname',
'vtp_d_pruning' => 'managementDomainPruningState',
'vtp_d_ver' => 'managementDomainVersionInUse',
# VLAN Table
'v_index' => 'vtpVlanIndex',
'v_state' => 'vtpVlanState',
'v_type' => 'vtpVlanType',
'v_name' => 'vtpVlanName',
'v_mtu' => 'vtpVlanMtu',
'v_said' => 'vtpVlanDot10Said',
'v_ring' => 'vtpVlanRingNumber',
'v_bridge' => 'vtpVlanBridgeNumber',
'v_stp' => 'vtpVlanStpType',
'v_parent' => 'vtpVlanParentVlan',
'v_trans1' => 'vtpVlanTranslationalVlan1',
'v_trans2' => 'vtpVlanTranslationalVlan2',
'v_btype' => 'vtpVlanBridgeType',
'v_hop_are' => 'vtpVlanAreHopCount',
'v_hop_ste' => 'vtpVlanSteHopCount',
'v_crf' => 'vtpVlanIsCRFBackup',
'v_type_ext' => 'vtpVlanTypeExt',
'v_if' => 'vtpVlanIfIndex',
# CISCO-VLAN-MEMBERSHIP-MIB
# VmMembershipTable
'i_vlan_type' => 'vmVlanType',
'i_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',
# vlanTrunkPortTable
# TODO Add these tables if someone wants them..
# vtpEditControlTable
# vtpVlanEditTable
# vtpStatsTable
);
%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;
}
sub set_i_vlan {
my $vtp = shift;
# Check for CISCO-VLAN-MIB
my $i_vlan = $vtp->i_vlan2();
if (defined $i_vlan) {
return $vtp->set_i_vlan2(@_);
}
# only support the first case for now.
return undef;
}
1;
__END__
=head1 NAME
SNMP::Info::CiscoVTP - Perl5 Interface to Cisco's VLAN Management MIBs
=head1 AUTHOR
Max Baker
=head1 SYNOPSIS
# Let SNMP::Info determine the correct subclass for you.
my $vtp = new SNMP::Info(
AutoSpecify => 1,
Debug => 1,
# These arguments are passed directly on to SNMP::Session
DestHost => 'myswitch',
Community => 'public',
Version => 2
)
or die "Can't connect to DestHost.\n";
my $class = $vtp->class();
print "SNMP::Info determined this device to fall under subclass : $class\n";
=head1 DESCRIPTION
SNMP::Info::CiscoVTP is a subclass of SNMP::Info that provides
information about a cisco device's VLAN and VTP Domain memebership.
Use or create in a subclass of SNMP::Info. Do not use directly.
=head2 Inherited Classes
none.
=head2 Required MIBs
=over
=item CISCO-VTP-MIB
=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
=head1 GLOBALS
=over
=item $vtp->vtp_version()
C<vtpVersion>
=item $vtp->vtp_maxstore()
C<vtpMaxVlanStorage>
=item $vtp->vtp_notify()
C<vtpNotificationsEnabled>
=item $vtp->vtp_notify_create()
C<vtpVlanCreatedNotifEnabled>
=item $vtp->vtp_notify_delete()
C<vtpVlanDeletedNotifEnabled>
=back
=head1 TABLE METHODS
You device will only implement a subset of these methods.
=head2 VLAN Table
See ftp://ftp.cisco.com/pub/mibs/supportlists/wsc5000/wsc5000-communityIndexing.html
for a good treaty of how to connect to the VLANs
This table is from CISCO-VTP-MIB::vtpVlanTable
=over
=item $vtp->v_index()
C<vtpVlanIndex>
=item $vtp->v_state()
C<vtpVlanState>
=item $vtp->v_type()
C<vtpVlanType>
=item $vtp->v_name()
C<vtpVlanName>
=item $vtp->v_mtu()
C<vtpVlanMtu>
=item $vtp->v_said()
C<vtpVlanDot10Said>
=item $vtp->v_ring()
C<vtpVlanRingNumber>
=item $vtp->v_bridge()
C<vtpVlanBridgeNumber>
=item $vtp->v_stp()
C<vtpVlanStpType>
=item $vtp->v_parent()
C<vtpVlanParentVlan>
=item $vtp->v_trans1()
C<vtpVlanTranslationalVlan1>
=item $vtp->v_trans2()
C<vtpVlanTranslationalVlan2>
=item $vtp->v_btype()
C<vtpVlanBridgeType>
=item $vtp->v_hop_are()
C<vtpVlanAreHopCount>
=item $vtp->v_hop_ste()
C<vtpVlanSteHopCount>
=item $vtp->v_crf()
C<vtpVlanIsCRFBackup>
=item $vtp->v_type_ext()
C<vtpVlanTypeExt>
=item $vtp->v_if()
C<vtpVlanIfIndex>
=back
=head2 VLAN Interface Table
This table is from CISCO-VLAN-MEMBERSHIP-MIB::VmMembershipTable
=over
=item $vtp->i_vlan_type()
Static, Dynamic, or multiVlan.
C<vmVlanType>
=item $vtp->i_vlan()
The VLAN that a port is assigned to.
0 for no VLAN assigned.
C<vmVlan>
=item $vtp->i_vlan_stat()
Inactive, active, shutdown.
C<vmPortStatus>
=item $vtp->i_vlan_1()
Each bit represents a VLAN. This is 0 through 1023
C<vmVlans>
=item $vtp->i_vlan_2()
Each bit represents a VLAN. This is 1024 through 2047
C<vmVlans2k>
=item $vtp->i_vlan_3()
Each bit represents a VLAN. This is 2048 through 3071
C<vmVlans3k>
=item $vtp->i_vlan_4()
Each bit represents a VLAN. This is 3072 through 4095
C<vmVlans4k>
=back
=head2 Managment Domain Table
=over
=item $vtp->vtp_d_index()
C<managementDomainIndex>
=item $vtp->vtp_d_name()
C<managementDomainName>
=item $vtp->vtp_d_mode()
C<managementDomainLocalMode>
=item $vtp->vtp_d_rev()
C<managementDomainConfigRevNumber>
=item $vtp->vtp_d_updater()
C<managementDomainLastUpdater>
=item $vtp->vtp_d_last()
C<managementDomainLastChange>
=item $vtp->vtp_d_status()
C<managementDomainRowStatus>
=item $vtp->vtp_d_tftp()
C<managementDomainTftpServer>
=item $vtp->vtp_d_tftp_path()
C<managementDomainTftpPathname>
=item $vtp->vtp_d_pruning()
C<managementDomainPruningState>
=item $vtp->vtp_d_ver()
C<managementDomainVersionInUse>
=back
=cut

View File

@@ -1,5 +1,7 @@
# SNMP::Info::Entity
# Max Baker <max@warped.org>
# Max Baker
#
# 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.4;
$VERSION = '1.04';
# $Id$
use strict;
@@ -40,24 +42,29 @@ use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
@SNMP::Info::Entity::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::Entity::EXPORT_OK = qw//;
$INIT = 0;
%MIBS = ('ENTITY-MIB' => 'entPhysicalSerialNum');
%GLOBALS = (
);
%FUNCS = (
'e_index' => 'entPhysicalIndex',
'e_alias' => 'entPhysicalAlias',
'e_class' => 'entPhysicalClass',
'e_descr' => 'entPhysicalDescr',
'e_fwver' => 'entPhysicalFirmwareRev',
'e_fru' => 'entPhysicalIsFRU',
'e_hwver' => 'entPhysicalHardwareRev',
'e_id' => 'entPhysicalAssetID',
'e_map' => 'entAliasMappingIdentifier',
'e_model' => 'entPhysicalModelName',
'e_name' => 'entPhysicalName',
'e_parent' => 'entPhysicalContainedIn',
'e_pos' => 'entParentRelPos',
'e_serial' => 'entPhysicalSerialNum',
'e_swver' => 'entPhysicalSoftwareRev',
'e_type' => 'entPhysicalVendorType',
'e_vendor' => 'entPhysicalMfgName',
);
%MUNGE = (
@@ -85,11 +92,11 @@ sub e_port {
=head1 NAME
SNMP::Info::Entity - Perl5 Interface to SNMP data stored in ENTITY-MIB.
SNMP::Info::Entity - Perl5 Interface to SNMP data stored in ENTITY-MIB. RFC 2737
=head1 AUTHOR
Max Baker (C<max@warped.org>)
Max Baker
=head1 SYNOPSIS
@@ -109,7 +116,9 @@ Max Baker (C<max@warped.org>)
=head1 DESCRIPTION
ENTITY-MIB is used by some Layer 2 devices like HP Switches and Aironet Access Points
ENTITY-MIB is used by Layer 2 devices from HP,Aironet,Foundry,Cisco and more.
See RFC 2737 for full details.
Create or use a device subclass that inherit this class. Do not use directly.
@@ -144,36 +153,72 @@ to a hash.
=over
=item $entity->e_index()
Not normally implemented
(C<entPhysicalIndex>)
=item $entity->e_alias()
Human entered, not usually used.
(C<entPhysicalAlias>)
=item $entity->e_class()
Stack, Module, Container, Port ...
(C<entPhysicalClass>)
=item $entity->e_descr()
Human Friendly
(C<entPhysicalClass>)
=item $entity->e_fwver()
(C<entPhysicalFirmwareRev>)
=item $entity->e_fru()
BOOLEAN. Field Replaceable unit?
(C<entPhysicalFRU>)
=item $entity->e_hwver()
(C<entPhysicalHardwareRev>)
=item $entity->e_id()
This is human entered and not normally used.
(C<entPhysicalAssetID>)
=item $entity->e_map()
See MIB.
(C<entAliasMappingIdentifier>)
=item $entity->e_model()
Model Name of Entity.
(C<entPhysicalModelName>)
=item $entity->e_name()
More computer friendly name of entity. Parse me.
(C<entPhysicalName>)
=item $entity->e_parent()
0 if root.
(C<entPhysicalContainedIn>)
=item $entity->e_port()
@@ -191,8 +236,16 @@ $entity->e_map()
=item $entity->e_type()
This is an OID.
(C<entPhysicalVendorType>)
=item $entity->e_vendor()
Vendor of Module.
(C<entPhysicalMfgName>)
=back
=cut

View File

@@ -1,5 +1,7 @@
# SNMP::Info::EtherLike
# Max Baker <max@warped.org>
# Max Baker
#
# 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.4;
$VERSION = '1.04';
# $Id$
use strict;
@@ -40,12 +42,6 @@ use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
@SNMP::Info::EtherLike::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::EtherLike::EXPORT_OK = qw//;
$DEBUG=0;
$SNMP::debugging=$DEBUG;
$INIT = 0;
# Same info in both rfc1398 and this?
%MIBS = ('ETHERLIKE-MIB' => 'etherMIB' );
%GLOBALS = ();
@@ -73,7 +69,18 @@ $INIT = 0;
'el_coll_freq' => 'dot3CollFrequencies'
);
%MUNGE = ( %SNMP::Info::MUNGE );
%MUNGE = ( %SNMP::Info::MUNGE,
'el_duplex' => \&munge_el_duplex,
);
sub munge_el_duplex {
my $duplex = shift;
return unless defined $duplex;
$duplex =~ s/Duplex$//;
return $duplex;
}
1;
__END__
@@ -81,11 +88,11 @@ __END__
=head1 NAME
SNMP::Info::EtherLike - Perl5 Interface to SNMP ETHERLIKE-MIB
SNMP::Info::EtherLike - Perl5 Interface to SNMP ETHERLIKE-MIB RFC 1398
=head1 AUTHOR
Max Baker (C<max@warped.org>)
Max Baker
=head1 SYNOPSIS
@@ -110,10 +117,6 @@ Max Baker (C<max@warped.org>)
my $iid = $el_index->{$el_port};
my $port = $interfaces->{$iid};
$duplex = 'half' if $duplex =~/half/i;
$duplex = 'full' if $duplex =~/full/i;
$duplex = 'auto' if $duplex =~/auto/i;
print "PORT:$port set to duplex:$duplex\n";
}
@@ -122,6 +125,8 @@ Max Baker (C<max@warped.org>)
SNMP::Info::EtherLike is a subclass of SNMP::Info that supplies
access to the ETHERLIKE-MIB used by some Layer 3 Devices such as Cisco routers.
See RFC 1398 for more details.
Use or create a subclass of SNMP::Info that inherits this one. Do not use directly.
=head2 Inherited Classes

395
Info/FDP.pm Normal file
View File

@@ -0,0 +1,395 @@
# 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;
use strict;
use Exporter;
use SNMP::Info;
@SNMP::Info::FDP::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::FDP::EXPORT_OK = qw//;
use vars qw/$VERSION $DEBUG %FUNCS %GLOBALS %MIBS %MUNGE $INIT/;
$VERSION = '1.04';
%MIBS = ( 'FOUNDRY-SN-SWITCH-GROUP-MIB' => 'snFdpGlobalRun' );
%GLOBALS = (
# CDP-Compatibility
'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 cdp_run {
my $fdp = shift;
my $fdp_run = $fdp->fdp_run();
# if fdp_run isn't implemented on device, assume FDP is on
return $fdp_run if defined $fdp_run;
return 1;
}
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_throw("SNMP::Info::FDP:fdp_if() - Device doesn't have fdp_ip() data. Can't fake fdp_index()");
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
Bruce Rodger, Max Baker
=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

View File

@@ -1,5 +1,7 @@
# SNMP::Info::Layer1 - SNMP Interface to Layer1 Devices
# Max Baker <max@warped.org>
# Max Baker
#
# 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.4;
$VERSION = '1.04';
# $Id$
use strict;
@@ -41,13 +43,6 @@ use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %PORTSTAT %MUNGE $INIT/;
@SNMP::Info::Layer1::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::Layer1::EXPORT_OK = qw//;
$DEBUG=0;
$SNMP::debugging=$DEBUG;
# See SNMP::Info for the details of these data structures and
# the interworkings.
$INIT = 0;
%MIBS = ( %SNMP::Info::MIBS,
'SNMP-REPEATER-MIB' => 'rptrPortGroupIndex'
);
@@ -167,7 +162,7 @@ SNMP::Info::Layer1 - Perl5 Interface to network devices serving Layer1 only.
=head1 AUTHOR
Max Baker (C<max@warped.org>)
Max Baker
=head1 SYNOPSIS

View File

@@ -1,5 +1,7 @@
# SNMP::Info::Layer1::Allied
# Max Baker <max@warped.org>
# Max Baker
#
# 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.4;
$VERSION = '1.04';
# $Id$
use strict;
@@ -126,7 +128,7 @@ SNMP::Info::Layer1::Allied - SNMP Interface to old Allied Hubs
=head1 AUTHOR
Max Baker (C<max@warped.org>)
Max Baker
=head1 SYNOPSIS

View File

@@ -1,5 +1,7 @@
# SNMP::Info::Layer1::Asante
# Max Baker <max@warped.org>
# Max Baker
#
# 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.4;
$VERSION = '1.04';
# $Id$
use strict;
@@ -169,7 +171,7 @@ SNMP::Info::Layer1::Asante - SNMP Interface to old Asante 1012 Hubs
=head1 AUTHOR
Max Baker (C<max@warped.org>)
Max Baker
=head1 SYNOPSIS
@@ -208,7 +210,7 @@ Asante device through SNMP.
Download from http://www.mibdepot.com
=items MIBs listed in SNMP::Info::Layer1
=item MIBs listed in SNMP::Info::Layer1
=back
@@ -230,12 +232,6 @@ Culls software version from description()
Returns 'asante' :)
=item $asante->root_ip()
Returns IP Address of Managed Hub.
(B<actualIpAddr>)
=item $asante->model()
Trys to cull out AT-nnnnX out of the description field.

554
Info/Layer1/Bayhub.pm Normal file
View File

@@ -0,0 +1,554 @@
# SNMP::Info::Layer1::Bayhub
# Eric Miller
# $Id$
#
# Copyright (c) 2004-6 Eric Miller, 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::Layer1::Bayhub;
$VERSION = '1.04';
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;
}
sub set_i_up_admin {
# map setting to those the hub will understand
my %setting = qw/up 2 down 3/;
my $bayhub = shift;
my ($setting, $iid) = @_;
my $i_index = $bayhub->i_index();
my %reverse_i_index = reverse %$i_index;
$setting = lc($setting);
return 0 unless defined $setting{$setting};
$iid = $reverse_i_index{$iid};
return $bayhub->set_bayhub_up_admin($setting{$setting}, $iid);
}
# 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
=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
=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->set_i_up_admin(state, ifIndex)
Sets port state, must be supplied with state and port ifIndex
State choices are 'up'or 'down'
Example:
my %if_map = reverse %{$bayhub->interfaces()};
$bayhub->set_i_up_admin('down', $if_map{'1.1'})
or die "Couldn't change port state. ",$bayhub->error(1);
=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

524
Info/Layer1/S3000.pm Normal file
View File

@@ -0,0 +1,524 @@
# SNMP::Info::Layer1::S3000
# Eric Miller
# $Id$
#
# Copyright (c) 2006 Eric Miller
#
# 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::S3000;
$VERSION = '1.04';
use strict;
use Exporter;
use SNMP::Info::Layer1;
use SNMP::Info::Bridge;
@SNMP::Info::Layer1::S3000::ISA = qw/SNMP::Info::Layer1 SNMP::Info::Bridge/;
@SNMP::Info::Layer1::S3000::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
%MIBS = (
%SNMP::Info::Layer1::MIBS,
%SNMP::Info::Bridge::MIBS,
'SYNOPTICS-ETHERNET-MIB' => 's3EnetPortTable',
'SYNOPTICS-COMMON-MIB' => 's3AgentType',
);
%GLOBALS = (
%SNMP::Info::Layer1::GLOBALS,
%SNMP::Info::Bridge::GLOBALS,
# From SYNOPTICS-COMMON-MIB
'os_bin' => 's3AgentFwVer',
's3000_major_ver' => 's3AgentSwMajorVer',
's3000_minor_ver' => 's3AgentSwMinorVer',
's3000_maint_ver' => 's3AgentSwMaintVer',
);
%FUNCS = (
%SNMP::Info::Layer1::FUNCS,
%SNMP::Info::Bridge::FUNCS,
# SYNOPTICS-ETHERNET-MIB::s3EnetPortTable
's3000_pb_index' => 's3EnetPortBoardIndex',
's3000_pp_index' => 's3EnetPortIndex',
's3000_up_admin' => 's3EnetPortPartStatus',
's3000_up' => 's3EnetPortLinkStatus',
# SYNOPTICS-ETHERNET-MIB::s3EnetShowNodesTable
's3000_nb_index' => 's3EnetShowNodesSlotIndex',
's3000_np_index' => 's3EnetShowNodesPortIndex',
'fw_mac' => 's3EnetShowNodesMacAddress',
# SYNOPTICS-ETHERNET-MIB::s3EnetTopNmmTable
's3000_topo_port' => 's3EnetTopNmmPort',
's3000_topo_mac' => 's3EnetTopNmmMacAddr',
);
%MUNGE = (
%SNMP::Info::Layer1::MUNGE,
%SNMP::Info::Bridge::MUNGE,
's3000_topo_mac' => \&SNMP::Info::munge_mac
);
sub layers {
return '00000011';
}
sub os {
return 'synoptics';
}
sub vendor {
return 'nortel';
}
sub model {
my $s3000 = shift;
my $id = $s3000->id();
return undef unless defined $id;
my $model = &SNMP::translateObj($id);
return $id unless defined $model;
$model =~ s/^s3reg-//i;
return $1 if ($model =~ /((\d+){3}[\dX])/);
return $model;
}
sub os_ver {
my $s3000 = shift;
my $major_ver = $s3000->s3000_major_ver() || 0;
my $minor_ver = $s3000->s3000_minor_ver() || 0;
my $maint_ver = $s3000->s3000_maint_ver() || 0;
my $ver = "$major_ver.$minor_ver.$maint_ver";
return $ver;
}
sub mac {
my $s3000 = shift;
my $topo_port = $s3000->s3000_topo_port();
my $topo_mac = $s3000->s3000_topo_mac();
foreach my $entry (keys %$topo_port){
my $port = $topo_port->{$entry};
next unless $port == 0;
my $mac = $topo_mac->{$entry};
return $mac;
}
# Topology turned off, not supported.
return undef;
}
# Hubs do not support ifMIB requirements for get MAC
# and port status
sub i_index {
my $s3000 = shift;
my $b_index = $s3000->s3000_pb_index();
my $p_index = $s3000->s3000_pp_index();
my %i_index;
foreach my $iid (keys %$b_index){
my $board = $b_index->{$iid};
next unless defined $board;
my $port = $p_index->{$iid}||0;
# We need to make up an index for multiple board instances.
my $index = ($board*256)+$port;
$i_index{$iid} = $index;
}
return \%i_index;
}
sub interfaces {
my $s3000 = shift;
my $i_index = $s3000->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 - see i_index()
my $port = $index % 256;
my $slot = int($index / 256);
my $slotport = "$slot.$port";
$if{$index} = $slotport;
}
return \%if;
}
sub i_duplex {
my $s3000 = shift;
my $port_index = $s3000->i_index();
my %i_duplex;
foreach my $iid (keys %$port_index){
my $index = $port_index->{$iid};
next unless defined $index;
# Hubs only function half duplex
my $duplex = 'half';
$i_duplex{$index}=$duplex;
}
return \%i_duplex;
}
sub i_duplex_admin {
my $s3000 = shift;
my $port_index = $s3000->i_index();
my %i_duplex_admin;
foreach my $iid (keys %$port_index){
my $index = $port_index->{$iid};
next unless defined $index;
# Hubs only function half duplex
my $duplex = 'half';
$i_duplex_admin{$index}=$duplex;
}
return \%i_duplex_admin;
}
sub i_speed {
my $s3000 = shift;
my $port_index = $s3000->i_index();
my %i_speed;
foreach my $iid (keys %$port_index){
my $index = $port_index->{$iid};
next unless defined $index;
# These hubs only support 10Mbs
my $speed = '10000000';
$i_speed{$index}=$speed;
}
return \%i_speed;
}
sub i_up {
my $s3000 = shift;
my $port_index = $s3000->i_index();
my $link_stat = $s3000->s3000_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 $s3000 = shift;
my $i_index = $s3000->i_index();
my $link_stat = $s3000->s3000_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;
}
sub set_i_up_admin {
# map setting to those the hub will understand
my %setting = qw/up 2 down 3/;
my $s3000 = shift;
my ($setting, $iid) = @_;
my $i_index = $s3000->i_index();
my %reverse_i_index = reverse %$i_index;
$setting = lc($setting);
return 0 unless defined $setting{$setting};
$iid = $reverse_i_index{$iid};
return $s3000->set_s3000_up_admin($setting{$setting}, $iid);
}
# Hubs do not support the standard Bridge MIB
sub bp_index {
my $s3000 = shift;
my $b_index = $s3000->s3000_nb_index();
my $p_index = $s3000->s3000_np_index();
my $model = $s3000->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;
my $index = ($board*256)+$port;
$bp_index{$index} = $index;
}
return \%bp_index;
}
sub fw_port {
my $s3000 = shift;
my $b_index = $s3000->s3000_nb_index();
my $p_index = $s3000->s3000_np_index();
my $model = $s3000->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;
my $index = ($board*256)+$port;
$fw_port{$iid} = $index;
}
return \%fw_port;
}
1;
__END__
=head1 NAME
SNMP::Info::Layer1::S3000 - SNMP Interface to Synoptics / Nortel Hubs
=head1 AUTHOR
Eric Miller
=head1 SYNOPSIS
#Let SNMP::Info determine the correct subclass for you.
my $s3000 = 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 = $s3000->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 $s3000 = new SNMP::Info::Layer1::S3000(...);
=head2 Inherited Classes
=over
=item SNMP::Info::Layer1
=item SNMP::Info::Bridge
=back
=head2 Required MIBs
=over
=item SYNOPTICS-COMMON-MIB
=item SYNOPTICS-ETHERNET-MIB
=item Inherited Classes' MIBs
See SNMP::Info::Layer1 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 $s3000->vendor()
Returns 'nortel'
=item $s3000->os()
Returns 'synoptics'
=item $s3000->model()
Cross references $s3000->id() to the SYNOPTICS-MIB and returns
the results.
Removes sreg- from the model name and returns only the numeric model identifier.
=item $stack->os_ver()
Returns the software version specified as major.minor.maint.
(B<s3AgentSwMajorVer>).(B<s3AgentSwMinorVer>).(B<s3AgentSwMaintVer>)
=item $stack->os_bin()
Returns the firmware version. (B<s3AgentFwVer>)
=item $s3000->mac()
Returns MAC of the advertised IP address of the device.
=back
=head2 Overrides
=over
=item $s3000->layers()
Returns 00000011. Class emulates Layer 2 functionality through proprietary MIBs.
=back
=head2 Globals imported from SNMP::Info::Layer1
See documentation in SNMP::Info::Layer1 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 $s3000->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). This is required to support devices with more than one module.
=item $s3000->interfaces()
Returns reference to map of IIDs to physical ports.
=item $s3000->i_duplex()
Returns half, hubs do not support full duplex.
=item $s3000->i_duplex_admin()
Returns half, hubs do not support full duplex.
=item $s3000->i_speed()
Returns 10000000. The hubs only support 10Mbs Ethernet.
=item $s3000->i_up()
Returns (B<s3EnetPortLinkStatus>) for each port. Translates on/off to up/down.
=item $s3000->i_up_admin()
Returns (B<s3EnetPortPartStatus>) for each port.
=item $s3000->set_i_up_admin(state, ifIndex)
Sets port state, must be supplied with state and port ifIndex
State choices are 'up'or 'down'
Example:
my %if_map = reverse %{$s3000->interfaces()};
$s3000->set_i_up_admin('down', $if_map{'1.1'})
or die "Couldn't change port state. ",$s3000->error(1);
=item $s3000->bp_index()
Simulates bridge MIB by returning reference to a hash containing the index for
both the keys and values.
=item $s3000->fw_port()
Returns reference to map of IIDs of the SYNOPTICS-ETHERNET-MIB::s3EnetShowNodesTable
to the Interface index.
=item $s3000->fw_mac()
(B<s3EnetShowNodesMacAddress>)
=item $s3000->s3000_topo_port()
Returns reference to hash. Key: Table entry, Value:Port Number (interface iid)
(B<s3EnetTopNmmPort>)
=item $s3000->s3000_topo_mac()
(B<s3EnetTopNmmMacAddr>)
Returns reference to hash. Key: Table entry, Value:Remote MAC address
=back
=head2 Table Methods imported from SNMP::Info::Layer1
See documentation in SNMP::Info::Layer1 for details.
=head2 Table Methods imported from SNMP::Info::Bridge
See documentation in SNMP::Info::Bridge for details.
=cut

View File

@@ -1,5 +1,7 @@
# SNMP::Info::Layer2 - SNMP Interface to Layer2 Devices
# Max Baker <max@warped.org>
# Max Baker
#
# Copyright (c) 2004,2005 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.4;
$VERSION = '1.04';
# $Id$
use strict;
@@ -36,49 +38,36 @@ use strict;
use Exporter;
use SNMP::Info;
use SNMP::Info::Bridge;
use SNMP::Info::CDP;
use SNMP::Info::CiscoStats;
use SNMP::Info::Entity;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %PORTSTAT %MUNGE $INIT/;
@SNMP::Info::Layer2::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::CDP SNMP::Info::CiscoStats Exporter/;
@SNMP::Info::Layer2::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::Entity Exporter/;
@SNMP::Info::Layer2::EXPORT_OK = qw//;
$DEBUG=0;
$SNMP::debugging=$DEBUG;
# 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::CDP::MIBS,
%SNMP::Info::CiscoStats::MIBS,
'CISCO-PRODUCTS-MIB' => 'sysName',
'CISCO-STACK-MIB' => 'wsc1900sysID',
%SNMP::Info::Entity::MIBS,
);
%GLOBALS = (
%SNMP::Info::GLOBALS,
%SNMP::Info::Bridge::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
%SNMP::Info::CiscoStats::GLOBALS,
%SNMP::Info::Entity::GLOBALS,
'serial1' => '.1.3.6.1.4.1.9.3.6.3.0', # OLD-CISCO-CHASSIS-MIB::chassisId.0
);
%FUNCS = (
%SNMP::Info::FUNCS,
%SNMP::Info::Bridge::FUNCS,
%SNMP::Info::CDP::FUNCS,
%SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::Entity::FUNCS,
);
%MUNGE = (
# Inherit all the built in munging
%SNMP::Info::MUNGE,
%SNMP::Info::Bridge::MUNGE,
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoStats::MUNGE,
%SNMP::Info::Entity::MUNGE,
);
# Method OverRides
@@ -106,7 +95,7 @@ sub vendor {
my $model = $l2->model();
my $descr = $l2->description();
if ($model =~ /hp/i or $descr =~ /hp/i) {
if ($model =~ /hp/i or $descr =~ /\bhp\b/i) {
return 'hp';
}
@@ -116,6 +105,25 @@ sub vendor {
}
sub serial {
my $l2 = shift;
my $serial1 = $l2->serial1();
my $e_descr = $l2->e_descr() || {};
my $e_serial = $l2->e_serial() || {};
my $serial2 = $e_serial->{1} || undef;
my $chassis = $e_descr->{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;
@@ -132,31 +140,18 @@ sub i_ignore {
return \%i_ignore;
}
# By Default we'll use the description field
sub interfaces {
my $l2 = shift;
my $interfaces = $l2->i_index();
my $i_descr = $l2->i_description();
my $i_name = $l2->i_name();
my %if;
foreach my $iid (keys %$interfaces){
# Replace the Index with the ifDescr field.
foreach my $iid (keys %$i_descr){
my $port = $i_descr->{$iid};
my $name = $i_name->{$iid};
$port = $name if (defined $name and $name !~ /^\s*$/);
next unless defined $port;
# Cisco 1900 has a space in some of its port descr.
# get rid of any weird characters
$port =~ s/[^\d\/,()\w]+//gi;
# Translate Cisco 2926,etc. from 1/5 to 1.5
$port =~ s/\//\./ if ($port =~ /^\d+\/\d+$/);
$if{$iid} = $port;
$interfaces->{$iid} = $port;
}
return \%if
return $interfaces;
}
1;
@@ -168,7 +163,7 @@ SNMP::Info::Layer2 - Perl5 Interface to network devices serving Layer2 only.
=head1 AUTHOR
Max Baker (C<max@warped.org>)
Max Baker
=head1 SYNOPSIS
@@ -218,9 +213,7 @@ a more specific class using the method above.
=item SNMP::Info::Bridge
=item SNMP::Info::CDP
=item SNMP::Info::CiscoStats
=item SNMP::Info::Entity
=back
@@ -228,21 +221,13 @@ a more specific class using the method above.
=over
=item CISCO-PRODUCTS-MIB
Needed for ID of Cisco Products
=item CISCO-STACK-MIB
Needed for ID of Cisco Products
=item Inherited Classes
MIBs required by the inherited classes listed above.
=back
MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
MIBs can be found in netdisco-mibs package.
=head1 GLOBALS
@@ -275,13 +260,9 @@ See documentation in SNMP::Info for details.
See documentation in SNMP::Info::Bridge for details.
=head2 Globals imported from SNMP::Info::CDP
=head2 Globals imported from SNMP::Info::Entity
See documentation in SNMP::Info::CDP for details.
=head2 Globals imported from SNMP::Info::CiscoStats
See documentation in SNMP::Info::CiscoStats for details.
See documentation in SNMP::Info::Entity for details.
=head1 TABLE METHODS
@@ -314,12 +295,8 @@ See documentation in SNMP::Info for details.
See documentation in SNMP::Info::Bridge for details.
=head2 Table Methods imported from SNMP::Info::CDP
=head2 Table Methods imported from SNMP::Info::Entity
See documentation in SNMP::Info::CDP for details.
=head2 Table Methods imported from SNMP::Info::CiscoStats
See documentation in SNMP::Info::CiscoStats for details.
See documentation in SNMP::Info::Entity for details.
=cut

View File

@@ -1,5 +1,7 @@
# SNMP::Info::Layer2::Aironet
# Max Baker <max@warped.org>
# Max Baker
#
# 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.4;
$VERSION = '1.04';
# $Id$
use strict;
@@ -36,35 +38,54 @@ use Exporter;
use SNMP::Info::Layer2;
use SNMP::Info::Entity;
use SNMP::Info::EtherLike;
use SNMP::Info::CiscoStats;
use SNMP::Info::CiscoVTP;
use SNMP::Info::CDP;
@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::CiscoStats SNMP::Info::CiscoVTP SNMP::Info::CDP Exporter/;
@SNMP::Info::Layer2::Aironet::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
# Set for No CDP
%GLOBALS = (
%SNMP::Info::Layer2::GLOBALS,
%SNMP::Info::Entity::GLOBALS,
%SNMP::Info::EtherLike::GLOBALS,
%SNMP::Info::CiscoStats::GLOBALS,
%SNMP::Info::CiscoVTP::GLOBALS,
%SNMP::Info::CDP::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::CiscoStats::FUNCS,
%SNMP::Info::CiscoVTP::FUNCS,
%SNMP::Info::CDP::FUNCS,
'i_ssidlist' => 'cd11IfAuxSsid',
'i_ssidbcast' => 'cd11IfAuxSsidBroadcastSsid',
'i_80211channel' => 'cd11IfPhyDsssCurrentChannel',
);
%MIBS = (
%SNMP::Info::Layer2::MIBS,
%SNMP::Info::Entity::MIBS,
%SNMP::Info::EtherLike::MIBS
%SNMP::Info::EtherLike::MIBS,
%SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::CiscoVTP::MIBS,
%SNMP::Info::CDP::MIBS,
'CISCO-DOT11-IF-MIB' => 'cd11IfAuxSsid',
);
%MUNGE = (%SNMP::Info::Layer2::MUNGE,
%SNMP::Info::Entity::MUNGE,
%SNMP::Info::EtherLike::MUNGE
%SNMP::Info::EtherLike::MUNGE,
%SNMP::Info::CiscoStats::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE,
%SNMP::Info::CDP::MUNGE,
);
@@ -116,7 +137,7 @@ SNMP::Info::Layer2::Aironet - SNMP Interface to Cisco Aironet devices running IO
=head1 AUTHOR
Max Baker (C<max@warped.org>)
Max Baker
=head1 SYNOPSIS
@@ -167,6 +188,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
View File

@@ -0,0 +1,246 @@
# SNMP::Info::Layer2::Allied
# Max Baker, 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 = '1.04';
# $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 %$i_up){
my $up = $i_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, Dmitry Sergienko <dmitry@trifle.net>
=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

420
Info/Layer2/Aruba.pm Normal file
View File

@@ -0,0 +1,420 @@
# SNMP::Info::Layer2::Aruba
# Eric Miller
# $Id$
#
# Copyright (c) 2005 Eric Miller
#
# 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::Aruba;
$VERSION = '1.04';
use strict;
use Exporter;
use SNMP::Info;
use SNMP::Info::Bridge;
@SNMP::Info::Layer2::Aruba::ISA = qw/SNMP::Info SNMP::Info::Bridge Exporter/;
@SNMP::Info::Layer2::Aruba::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
%MIBS = (
%SNMP::Info::MIBS,
%SNMP::Info::Bridge::MIBS,
'WLSX-SWITCH-MIB' => 'wlsxHostname',
);
%GLOBALS = (
%SNMP::Info::GLOBALS,
%SNMP::Info::Bridge::GLOBALS,
);
%FUNCS = (
%SNMP::Info::FUNCS,
%SNMP::Info::Bridge::FUNCS,
'i_index2' => 'ifIndex',
'i_name2' => 'ifName',
# WLSX-SWITCH-MIB::wlsxSwitchAccessPointTable
# Table index leafs do not return information
# therefore unable to use apESSID. We extract
# the information from the IID instead.
#'aruba_ap_essid' => 'apESSID',
'aruba_ap_name' => 'apLocation',
'aruba_ap_ip' => 'apIpAddress',
# WLSX-SWITCH-MIB::wlsxSwitchStationMgmtTable
# Table index leafs do not return information
# therefore unable to use staAccessPointBSSID
# or staPhyAddress. We extract the information from
# the IID instead.
#'fw_port' => 'staAccessPointBSSID',
#'fw_mac' => 'staPhyAddress',
'fw_user' => 'staUserName',
);
%MUNGE = (
%SNMP::Info::MUNGE,
%SNMP::Info::Bridge::MUNGE,
);
sub layers {
return '00000011';
}
sub os {
return 'airos';
}
sub vendor {
return 'aruba';
}
sub os_ver {
my $aruba = shift;
my $descr = $aruba->description();
return undef unless defined $descr;
if ($descr =~ m/Version\s+(\d+\.\d+\.\d+\.\d+)/){
return $1;
}
return undef;
}
sub model {
my $aruba = shift;
my $id = $aruba->id();
return undef unless defined $id;
my $model = &SNMP::translateObj($id);
return $id unless defined $model;
return $model;
}
# Thin APs do not support ifMIB requirement
sub i_index {
my $aruba = shift;
my $i_index = $aruba->i_index2();
my $ap_index = $aruba->aruba_ap_name();
my %if_index;
foreach my $iid (keys %$i_index){
my $index = $i_index->{$iid};
next unless defined $index;
$if_index{$iid} = $index;
}
# Get Attached APs as Interfaces
foreach my $ap_id (keys %$ap_index){
# Convert the 0.254.123.456 index entry to a MAC address.
my $mac = join(':',map {sprintf("%02x",$_)} split(/\./,$ap_id));
$if_index{$ap_id} = $mac;
}
return \%if_index;
}
sub interfaces {
my $aruba = shift;
my $i_index = $aruba->i_index();
my $i_descr = $aruba->i_description();
my %if;
foreach my $iid (keys %$i_index){
my $index = $i_index->{$iid};
next unless defined $index;
if ($index =~ /^\d+$/ ) {
# Replace the Index with the ifDescr field.
my $port = $i_descr->{$iid};
next unless defined $port;
$if{$iid} = $port;
}
elsif ($index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/) {
$if{$index} = $index;
}
else {
next;
}
}
return \%if;
}
sub i_name {
my $aruba = shift;
my $i_index = $aruba->i_index();
my $i_name2 = $aruba->i_name2();
my $ap_name = $aruba->aruba_ap_name();
my %i_name;
foreach my $iid (keys %$i_index){
my $index = $i_index->{$iid};
next unless defined $index;
if ($index =~ /^\d+$/ ) {
my $name = $i_name2->{$iid};
next unless defined $name;
$i_name{$index} = $name;
}
elsif ($index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/) {
my $name = $ap_name->{$iid};
next unless defined $name;
$i_name{$index} = $name;
}
else {
next;
}
}
return \%i_name;
}
# Wireless switches do not support the standard Bridge MIB
sub bp_index {
my $aruba = shift;
my $i_index = $aruba->i_index2();
my $ap_index = $aruba->aruba_ap_name();
my %bp_index;
foreach my $iid (keys %$i_index){
my $index = $i_index->{$iid};
next unless defined $index;
$bp_index{$iid} = $index;
}
# Get Attached APs as Interfaces
foreach my $ap_id (keys %$ap_index){
# Convert the 0.254.123.456 index entry to a MAC address.
my $mac = join(':',map {sprintf("%02x",$_)} split(/\./,$ap_id));
$bp_index{$mac} = $mac;
}
return \%bp_index;
}
sub fw_port {
my $aruba = shift;
my $fw_idx = $aruba->fw_user();
my %fw_port;
foreach my $iid (keys %$fw_idx){
if ($iid =~ /(\d+\.\d+\.\d+\.\d+\.\d+\.\d+).(\d+\.\d+\.\d+\.\d+\.\d+\.\d+)/) {
my $port = join(':',map {sprintf("%02x",$_)} split(/\./,$2));
$fw_port{$iid} = $port;
}
else {
next;
}
}
return \%fw_port;
}
sub fw_mac {
my $aruba = shift;
my $fw_idx = $aruba->fw_user();
my %fw_mac;
foreach my $iid (keys %$fw_idx){
if ($iid =~ /(\d+\.\d+\.\d+\.\d+\.\d+\.\d+).(\d+\.\d+\.\d+\.\d+\.\d+\.\d+)/) {
my $mac = join(':',map {sprintf("%02x",$_)} split(/\./,$1));
$fw_mac{$iid} = $mac;
}
else {
next;
}
}
return \%fw_mac;
}
1;
__END__
=head1 NAME
SNMP::Info::Layer2::Aruba - SNMP Interface to Aruba wireless switches
=head1 AUTHOR
Eric Miller
=head1 SYNOPSIS
my $aruba = new SNMP::Info(
AutoSpecify => 1,
Debug => 1,
DestHost => 'myswitch',
Community => 'public',
Version => 2
)
or die "Can't connect to DestHost.\n";
my $class = $aruba->class();
print " Using device sub class : $class\n";
=head1 DESCRIPTION
SNMP::Info::Layer2::Aruba is a subclass of SNMP::Info that provides an interface
to Aruba wireless switches. The Aruba platform utilizes intelligent wireless
switches which control thin access points. The thin access points themselves
are unable to be polled for end station information.
This class emulates bridge functionality for the wireless switch. This enables
end station MAC addresses collection and correlation to the thin access point
the end station is using for communication.
For speed or debugging purposes you can call the subclass directly, but not after
determining a more specific class using the method above.
my $aruba = new SNMP::Info::Layer2::Aruba(...);
=head2 Inherited Classes
=over
=item SNMP::Info
=item SNMP::Info::Bridge
=back
=head2 Required MIBs
=over
=item WLSX-SWITCH-MIB
=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 $aruba->model()
Returns model type. Cross references $aruba->id() with product IDs in the
Aruba MIB.
=item $aruba->vendor()
Returns 'aruba'
=item $aruba->os()
Returns 'airos'
=item $aruba->os_ver()
Returns the software version extracted from B<sysDescr>
=back
=head2 Overrides
=over
=item $aruba->layers()
Returns 00000011. Class emulates Layer 2 functionality for Thin APs through
proprietary MIBs.
=back
=head1 TABLE ENTRIES
These are methods that return tables of information in the form of a reference
to a hash.
=head2 Overrides
=over
=item $aruba->i_index()
Returns reference to map of IIDs to Interface index.
Extends ifIndex to support thin APs as device interfaces.
=item $aruba->interfaces()
Returns reference to map of IIDs to ports. Thin APs are implemented as device
interfaces. The thin AP MAC address is used as the port identifier.
=item $aruba->i_name()
Interface name. Returns (B<ifName>) for Ethernet interfaces and (B<apLocation>)
for thin AP interfaces.
=item $aruba->bp_index()
Simulates bridge MIB by returning reference to a hash containing the index for
both the keys and values.
=item $aruba->fw_port()
(B<staAccessPointBSSID>) as extracted from the IID.
=item $aruba->fw_mac()
(B<staPhyAddress>) as extracted from the IID.
=back
=head2 Aruba Switch AP Table (B<wlsxSwitchAccessPointTable>)
=over
=item $aruba->aruba_ap_name()
(B<apLocation>)
=item $aruba->aruba_ap_ip()
(B<apIpAddress>)
=back
=head2 Aruba Switch Station Management Table (B<wlsxSwitchStationMgmtTable>)
=over
=item $aruba->fw_user()
(B<staUserName>)
=cut

View File

@@ -1,5 +1,8 @@
# SNMP::Info::Layer2::Bay
# Max Baker <max@warped.org>
# Max Baker
# 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.4;
$VERSION = '1.04';
# $Id$
use strict;
@@ -80,6 +83,7 @@ sub os {
sub os_ver {
my $bay = shift;
my $descr = $bay->description();
return undef unless defined $descr;
# 303 / 304
if ($descr =~ m/Rev: \d+\.\d+\.\d+\.\d+-(\d+\.\d+\.\d+\.\d+)/){
@@ -96,6 +100,7 @@ sub os_ver {
sub os_bin {
my $bay = shift;
my $descr = $bay->description();
return undef unless defined $descr;
# 303 / 304
if ($descr =~ m/Rev: \d+\.(\d+\.\d+\.\d+)-\d+\.\d+\.\d+\.\d+/){
@@ -152,7 +157,9 @@ sub i_mac {
sub model {
my $bay = shift;
my $id = $bay->id();
return undef unless defined $id;
my $model = &SNMP::translateObj($id);
return $id unless defined $model;
$model =~ s/^sreg-//i;
my $descr = $bay->description();
@@ -192,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);
}
@@ -243,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
@@ -257,7 +264,7 @@ sub c_platform {
return \%c_platform;
}
1;
__END__
=head1 NAME
@@ -266,23 +273,11 @@ SNMP::Info::Layer2::Bay - SNMP Interface to old Bay Network BayStack Switches
=head1 AUTHOR
Max Baker (C<max@warped.org>)
Max Baker
=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

447
Info/Layer2/Baystack.pm Normal file
View File

@@ -0,0 +1,447 @@
# SNMP::Info::Layer2::Baystack
# Eric Miller
# $Id$
#
# Copyright (c) 2004-6 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 = '1.04';
use strict;
use Exporter;
use SNMP::Info;
use SNMP::Info::Bridge;
use SNMP::Info::SONMP;
use SNMP::Info::RapidCity;
use SNMP::Info::NortelStack;
@SNMP::Info::Layer2::Baystack::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::SONMP SNMP::Info::RapidCity SNMP::Info::NortelStack 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::SONMP::MIBS,
%SNMP::Info::RapidCity::MIBS,
%SNMP::Info::NortelStack::MIBS,
);
%GLOBALS = (
%SNMP::Info::GLOBALS,
%SNMP::Info::Bridge::GLOBALS,
%SNMP::Info::SONMP::GLOBALS,
%SNMP::Info::RapidCity::GLOBALS,
%SNMP::Info::NortelStack::GLOBALS,
);
%FUNCS = (
%SNMP::Info::FUNCS,
%SNMP::Info::Bridge::FUNCS,
%SNMP::Info::SONMP::FUNCS,
%SNMP::Info::RapidCity::FUNCS,
%SNMP::Info::NortelStack::FUNCS,
'i_name2' => 'ifName',
'i_mac2' => 'ifPhysAddress',
# From RFC1213-MIB
'at_index' => 'ipNetToMediaIfIndex',
'at_paddr' => 'ipNetToMediaPhysAddress',
'at_netaddr' => 'ipNetToMediaNetAddress',
);
# 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::SONMP::MUNGE,
%SNMP::Info::RapidCity::MUNGE,
%SNMP::Info::NortelStack::MUNGE,
'i_mac2' => \&SNMP::Info::munge_mac,
'at_paddr' => \&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|5530)/) 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;
my $descr = $baystack->description();
return '303' if (defined $descr and $descr =~ /\D303\D/);
return '304' if (defined $descr and $descr =~ /\D304\D/);
return 'BPS' if ($model =~ /BPS2000/i);
return $2 if ($model =~ /(ES|ERS|BayStack|EthernetRoutingSwitch|EthernetSwitch)(\d+)/);
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 Ethernet (Baystack) Switches
=head1 AUTHOR
Eric Miller
=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
Ethernet Switch (Baystack) 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.
Returns BPS for Business Policy Switch
For BayStack, EthernetRoutingSwitch, or EthernetSwitch extracts and returns
the switch numeric designation.
=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 RFC1213 Arp Cache Table (B<ipNetToMediaTable>)
=over
=item $baystack->at_index()
Returns reference to hash. Maps ARP table entries to Interface IIDs
(B<ipNetToMediaIfIndex>)
=item $baystack->at_paddr()
Returns reference to hash. Maps ARP table entries to MAC addresses.
(B<ipNetToMediaPhysAddress>)
=item $baystack->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::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

View File

@@ -1,5 +1,7 @@
# SNMP::Info::Layer2::C1900
# Max Baker <max@warped.org>
# Max Baker
#
# 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,18 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::C1900;
$VERSION = 0.4;
$VERSION = '1.04';
# $Id$
use strict;
use Exporter;
use SNMP::Info::Layer2;
use SNMP::Info::CiscoVTP;
use SNMP::Info::CDP;
use SNMP::Info::CiscoStats;
@SNMP::Info::Layer2::C1900::ISA = qw/SNMP::Info::Layer2 Exporter/;
@SNMP::Info::Layer2::C1900::ISA = qw/SNMP::Info::Layer2 SNMP::Info::CiscoVTP
SNMP::Info::CDP SNMP::Info::CiscoStats Exporter/;
@SNMP::Info::Layer2::C1900::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
@@ -43,10 +49,16 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
# Set for No CDP
%GLOBALS = (
%SNMP::Info::Layer2::GLOBALS,
%SNMP::Info::CiscoVTP::GLOBALS,
%SNMP::Info::CiscoStats::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
'c1900_flash_status' => 'upgradeFlashBankStatus',
);
%FUNCS = (%SNMP::Info::Layer2::FUNCS,
%SNMP::Info::CiscoVTP::FUNCS,
%SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::CDP::FUNCS,
'i_type2' => 'ifType',
'i_name2' => 'ifName',
# ESSWITCH-MIB
@@ -62,11 +74,17 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
%MIBS = (
%SNMP::Info::Layer2::MIBS,
%SNMP::Info::CiscoVTP::MIBS,
%SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::CDP::MIBS,
# Also known as the ESSWITCH-MIB
'STAND-ALONE-ETHERNET-SWITCH-MIB' => 'series2000'
);
%MUNGE = (%SNMP::Info::Layer2::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE,
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoStats::MUNGE,
);
sub vendor {
@@ -92,6 +110,9 @@ sub os_ver {
return undef;
}
sub bulkwalk_no { 1; }
sub cisco_comm_indexing { 1; }
sub interfaces {
my $c1900 = shift;
my $i_descr = $c1900->i_description();
@@ -189,6 +210,8 @@ sub i_name {
return $i_name;
}
1;
__END__
=head1 NAME
@@ -197,7 +220,7 @@ SNMP::Info::Layer2::C1900 - Perl5 Interface to SNMP data from Cisco Catlyst 1900
=head1 AUTHOR
Max Baker (C<max@warped.org>)
Max Baker
=head1 SYNOPSIS
@@ -257,6 +280,10 @@ These are methods that return scalar value from SNMP
=over
=item $c1900->bulkwalk_no
Return C<1>. Bulkwalk is turned off for this class.
=item $c1900->c1900_flash_status()
Usually contains the version of the software loaded in flash.

View File

@@ -1,5 +1,7 @@
# SNMP::Info::Layer2::C2900
# Max Baker <max@warped.org>
# Max Baker
#
# 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,24 +30,35 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::C2900;
$VERSION = 0.4;
$VERSION = '1.04';
# $Id$
use strict;
use Exporter;
use SNMP::Info::Layer2;
use SNMP::Info::CiscoVTP;
use SNMP::Info::CDP;
use SNMP::Info::CiscoStats;
@SNMP::Info::Layer2::C2900::ISA = qw/SNMP::Info::Layer2 Exporter/;
@SNMP::Info::Layer2::C2900::ISA = qw/SNMP::Info::Layer2 SNMP::Info::CiscoVTP
SNMP::Info::CDP SNMP::Info::CiscoStats Exporter/;
@SNMP::Info::Layer2::C2900::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
# Set for No CDP
%GLOBALS = (
%SNMP::Info::Layer2::GLOBALS
%SNMP::Info::Layer2::GLOBALS,
%SNMP::Info::CiscoVTP::GLOBALS,
%SNMP::Info::CiscoStats::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
);
%FUNCS = (%SNMP::Info::Layer2::FUNCS,
%SNMP::Info::CiscoVTP::FUNCS,
%SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::CDP::FUNCS,
'i_name' => 'ifAlias',
# C2900PortEntry
'c2900_p_index' => 'c2900PortIfIndex',
'c2900_p_duplex' => 'c2900PortDuplexStatus',
@@ -53,18 +66,27 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
'c2900_p_speed_admin' => 'c2900PortAdminSpeed',
);
%MIBS = (
%SNMP::Info::Layer2::MIBS,
'CISCO-C2900-MIB' => 'ciscoC2900MIB'
%MIBS = ( %SNMP::Info::Layer2::MIBS,
%SNMP::Info::CiscoVTP::MIBS,
%SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::CDP::MIBS,
'CISCO-C2900-MIB' => 'ciscoC2900MIB',
);
%MUNGE = (%SNMP::Info::Layer2::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE,
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoStats::MUNGE,
);
sub vendor {
return 'cisco';
}
sub cisco_comm_indexing {
1;
}
sub i_duplex {
my $c2900 = shift;
@@ -114,6 +136,54 @@ sub i_duplex_admin {
return \%i_duplex_admin;
}
### we want to be able to set speed on 2900 class switches
###
### $info->set_i_speed_admin("100", ifIndex);
### speed choices are 'auto', '10', '100'
###
sub set_i_speed_admin {
# map speeds to those the switch will understand
my %speeds = qw/auto 1 10 10000000 100 100000000/;
my $c2900 = shift;
my ($speed, $iid) = @_;
my $c2900_p_index = $c2900->c2900_p_index();
my %reverse_2900 = reverse %$c2900_p_index;
$speed = lc($speed);
return 0 unless defined $speeds{$speed};
# account for weirdness of c2900 mib
$iid = $reverse_2900{$iid};
return $c2900->set_c2900_p_speed_admin($speeds{$speed}, $iid);
}
### we want to be able to set duplex on 2900 class switches
###
### $info->set_i_duplex_admin("half", ifIndex);
### duplex choices are 'auto', 'half', 'full'
###
sub set_i_duplex_admin {
# map a textual duplex to an integer one the switch understands
my %duplexes = qw/full 1 half 2 auto 3/;
my $c2900 = shift;
my ($duplex, $iid) = @_;
my $c2900_p_index = $c2900->c2900_p_index();
my %reverse_2900 = reverse %$c2900_p_index;
$duplex = lc($duplex);
return 0 unless defined $duplexes{$duplex};
# account for weirdness of c2900 mib
$iid = $reverse_2900{$iid};
return $c2900->set_c2900_p_duplex_admin($duplexes{$duplex}, $iid);
}
# Use i_descritption for port key, cuz i_name can be manually entered.
sub interfaces {
my $c2900 = shift;
@@ -134,6 +204,7 @@ sub interfaces {
return \%if
}
1;
__END__
=head1 NAME
@@ -142,7 +213,7 @@ SNMP::Info::Layer2::C2900 - SNMP Interface to Cisco Catalyst 2900 Switches runni
=head1 AUTHOR
Max Baker (C<max@warped.org>)
Max Baker
=head1 SYNOPSIS
@@ -176,6 +247,8 @@ a more specific class using the method above.
=item SNMP::Info::Layer2
=item SNMP::Info::CiscoVTP
=back
=head2 Required MIBs
@@ -186,6 +259,12 @@ a more specific class using the method above.
Part of the v2 MIBs from Cisco.
=item Inherited Classes' MIBs
See SNMP::Info::Layer2 for its own MIB requirements.
See SNMP::Info::CiscoVTP for its own MIB requirements.
=back
=head1 GLOBALS
@@ -206,6 +285,10 @@ These are methods that return scalar value from SNMP
See documentation in SNMP::Info::Layer2 for details.
=head2 Global Methods imported from SNMP::Info::CiscoVTP
See documentation in SNMP::Info::CiscoVTP for details.
=head1 TABLE ENTRIES
These are methods that return tables of information in the form of a reference
@@ -239,6 +322,33 @@ to a hash.
Crosses $c2900->c2900_p_index() with $c2900->c2900_p_duplex_admin;
=item $c2900->set_i_speed_admin(speed, ifIndex)
Sets port speed, must be supplied with speed and port ifIndex
Speed choices are 'auto', '10', '100'
Crosses $c2900->c2900_p_index() with $c2900->c2900_p_duplex_admin to
utilize port ifIndex.
Example:
my %if_map = reverse %{$c2900->interfaces()};
$c2900->set_i_speed_admin('auto', $if_map{'FastEthernet0/1'})
or die "Couldn't change port speed. ",$c2900->error(1);
=item $c2900->set_i_duplex_admin(duplex, ifIndex)
Sets port duplex, must be supplied with duplex and port ifIndex
Speed choices are 'auto', 'half', 'full'
Crosses $c2900->c2900_p_index() with $c2900->c2900_p_duplex_admin to
utilize port ifIndex.
Example:
my %if_map = reverse %{$c2900->interfaces()};
$c2900->set_i_duplex_admin('auto', $if_map{'FastEthernet0/1'})
or die "Couldn't change port duplex. ",$c2900->error(1);
=back
@@ -277,4 +387,8 @@ to a hash.
See documentation in SNMP::Info::Layer2 for details.
=head2 Table Methods imported from SNMP::Info::CiscoVTP
See documentation in SNMP::Info::CiscoVTP for details.
=cut

View File

@@ -1,7 +1,8 @@
# SNMP::Info::Layer2::Catalyst
# Max Baker <max@warped.org>
# Max Baker
#
# Copyright (c) 2002,2003 Regents of the University of California
# Copyright (c) 2003,2004 Max Baker changes from version 0.8 and beyond
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -28,100 +29,61 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::Catalyst;
$VERSION = 0.4;
$VERSION = '1.04';
# $Id$
use strict;
use Exporter;
use SNMP::Info::Layer2;
use SNMP::Info::CiscoVTP;
use SNMP::Info::CiscoStack;
use SNMP::Info::CDP;
use SNMP::Info::CiscoStats;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %PORTSTAT %MUNGE $INIT/ ;
@SNMP::Info::Layer2::Catalyst::ISA = qw/SNMP::Info::Layer2 Exporter/;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
@SNMP::Info::Layer2::Catalyst::ISA = qw/SNMP::Info::Layer2 SNMP::Info::CiscoStack
SNMP::Info::CiscoVTP SNMP::Info::CDP SNMP::Info::CiscoStats Exporter/;
@SNMP::Info::Layer2::Catalyst::EXPORT_OK = qw//;
$DEBUG=0;
# See SNMP::Info for the details of these data structures and
# the interworkings.
$INIT = 0;
%MIBS = ( %SNMP::Info::Layer2::MIBS,
'CISCO-STACK-MIB' => 'moduleType',
'CISCO-VTP-MIB' => 'vtpVlanIndex'
%SNMP::Info::CiscoVTP::MIBS,
%SNMP::Info::CiscoStack::MIBS,
%SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::CDP::MIBS,
);
%GLOBALS = (
%SNMP::Info::Layer2::GLOBALS,
# these are in CISCO-STACK-MIB
'sysip' => 'sysIpAddr',
'netmask' => 'sysNetMask',
'broadcast' => 'sysBroadcast',
'serial' => 'chassisSerialNumber',
'model' => 'chassisModel',
'ps1_type' => 'chassisPs1Type',
'ps1_status' => 'chassisPs1Status',
'ps2_type' => 'chassisPs2Type',
'ps2_status' => 'chassisPs2Status',
'slots' => 'chassisNumSlots',
'fan' => 'chassisFanStatus',
%SNMP::Info::CiscoVTP::GLOBALS,
%SNMP::Info::CiscoStack::GLOBALS,
%SNMP::Info::CiscoStats::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
);
%FUNCS = (
%SNMP::Info::Layer2::FUNCS,
'i_type2' => 'ifType',
# CISCO-STACK-MIB::moduleEntry
# These are blades in a catalyst device
'm_type' => 'moduleType',
'm_model' => 'moduleModel',
'm_serial' => 'moduleSerialNumber',
'm_status' => 'moduleStatus',
'm_name' => 'moduleName',
'm_ports' => 'moduleNumPorts',
'm_ports_status' => 'modulePortStatus',
'm_hwver' => 'moduleHwVersion',
'm_fwver' => 'moduleFwVersion',
'm_swver' => 'moduleSwVersion',
# Router Blades :
'm_ip' => 'moduleIPAddress',
'm_sub1' => 'moduleSubType',
'm_sub2' => 'moduleSubType2',
# CISCO-STACK-MIB::portEntry
'p_name' => 'portName',
'p_type' => 'portType',
'p_status' => 'portOperStatus',
'p_status2' => 'portAdditionalStatus',
'p_speed' => 'portAdminSpeed',
'p_duplex' => 'portDuplex',
'p_port' => 'portIfIndex',
# CISCO-STACK-MIB::PortCpbEntry
'p_speed_admin' => 'portCpbSpeed',
'p_duplex_admin' => 'portCpbDuplex',
# CISCO-VTP-MIB::VtpVlanEntry
'v_state' => 'vtpVlanState',
'v_type' => 'vtpVlanType',
'v_name' => 'vtpVlanName',
'v_mtu' => 'vtpVlanMtu',
%SNMP::Info::CiscoVTP::FUNCS,
%SNMP::Info::CiscoStack::FUNCS,
%SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::CDP::FUNCS,
);
%MUNGE = (
%SNMP::Info::Layer2::MUNGE,
'm_ports_status' => \&munge_port_status,
'p_duplex_admin' => \&SNMP::Info::munge_bits,
%SNMP::Info::CiscoVTP::MUNGE,
%SNMP::Info::CiscoStack::MUNGE,
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoStats::MUNGE,
);
%PORTSTAT = (1 => 'other',
2 => 'ok',
3 => 'minorFault',
4 => 'majorFault');
# Changes binary byte describing each port into ascii, and returns
# an ascii list separated by spaces.
sub munge_port_status {
my $status = shift;
my @vals = map($PORTSTAT{$_},unpack('C*',$status));
return join(' ',@vals);
}
# Need to specify this or it might grab the ones out of L2 instead of CiscoStack
*SNMP::Info::Layer2::Catalyst::serial = \&SNMP::Info::CiscoStack::serial;
*SNMP::Info::Layer2::Catalyst::interfaces = \&SNMP::Info::CiscoStack::interfaces;
*SNMP::Info::Layer2::Catalyst::i_duplex = \&SNMP::Info::CiscoStack::i_duplex;
*SNMP::Info::Layer2::Catalyst::i_type = \&SNMP::Info::CiscoStack::i_type;
*SNMP::Info::Layer2::Catalyst::i_name = \&SNMP::Info::CiscoStack::i_name;
*SNMP::Info::Layer2::Catalyst::i_duplex_admin = \&SNMP::Info::CiscoStack::i_duplex_admin;
# Overidden Methods
@@ -139,98 +101,6 @@ sub i_physical {
return \%i_physical;
}
sub i_type {
my $cat = shift;
my $p_port = $cat->p_port();
my $p_type = $cat->p_type();
# Get more generic port types from IF-MIB
my $i_type = $cat->i_type2();
# Now Override w/ port entries
foreach my $port (keys %$p_type) {
my $iid = $p_port->{$port};
$i_type->{$iid} = $p_type->{$port};
}
return $i_type;
}
# p_* functions are indexed to physical port. let's index these
# to snmp iid
sub i_name {
my $cat = shift;
my $p_port = $cat->p_port();
my $p_name = $cat->p_name();
my %i_name;
foreach my $port (keys %$p_name) {
my $iid = $p_port->{$port};
next unless defined $iid;
$i_name{$iid} = $p_name->{$port};
}
return \%i_name;
}
sub i_duplex {
my $cat = shift;
my $p_port = $cat->p_port();
my $p_duplex = $cat->p_duplex();
my %i_duplex;
foreach my $port (keys %$p_duplex) {
my $iid = $p_port->{$port};
$i_duplex{$iid} = $p_duplex->{$port};
}
return \%i_duplex;
}
sub i_duplex_admin {
my $cat = shift;
my $p_port = $cat->p_port();
my $p_duplex_admin = $cat->p_duplex_admin();
my %i_duplex_admin;
foreach my $port (keys %$p_duplex_admin) {
my $iid = $p_port->{$port};
next unless defined $iid;
my $duplex = $p_duplex_admin->{$port};
next unless defined $duplex;
my $string = 'other';
# see CISCO-STACK-MIB for a description of the bits
$string = 'half' if ($duplex =~ /001$/ or $duplex =~ /0100.$/);
$string = 'full' if ($duplex =~ /010$/ or $duplex =~ /100.0$/);
# we'll call it auto if both full and half are turned on, or if the
# specifically 'auto' flag bit is set.
$string = 'auto'
if ($duplex =~ /1..$/ or $duplex =~ /110..$/ or $duplex =~ /..011$/);
$i_duplex_admin{$iid} = $string;
}
return \%i_duplex_admin;
}
# $cat->interfaces() - Maps the ifIndex table to a physical port
sub interfaces {
my $self = shift;
my $interfaces = $self->i_index();
my $portnames = $self->p_port();
my %portmap = reverse %$portnames;
my %interfaces = ();
foreach my $iid (keys %$interfaces) {
my $if = $interfaces->{$iid};
$interfaces{$if} = $portmap{$iid};
}
return \%interfaces;
}
sub vendor {
return 'cisco';
}
@@ -252,16 +122,37 @@ sub os_ver {
return undef;
}
# Workaround for incomplete bp_index
sub bp_index {
my $cat = shift;
my $p_index = $cat->p_port();
my $b_index = $cat->p_oidx();
my %bp_index;
foreach my $iid (keys %$p_index){
my $ifidx = $p_index->{$iid};
next unless defined $ifidx;
my $bpidx = $b_index->{$iid}||0;
$bp_index{$bpidx} = $ifidx;
}
return \%bp_index;
}
sub cisco_comm_indexing {
1;
}
1;
__END__
=head1 NAME
SNMP::Info::Layer2::Catalyst - Perl5 Interface to Cisco devices running Catalyst OS
SNMP::Info::Layer2::Catalyst - Perl5 Interface to Cisco Catalyst devices running Catalyst OS.
=head1 AUTHOR
Max Baker (C<max@warped.org>)
Max Baker
=head1 SYNOPSIS
@@ -281,13 +172,17 @@ Max Baker (C<max@warped.org>)
=head1 DESCRIPTION
SNMP::Info subclass to provide information for Cisco Catalyst switches running CatOS.
SNMP::Info subclass to provide information for Cisco Catalyst series switches running CatOS.
This class includes the Catalyst 2920, 4000, 5000, 6000 (hybrid mode) families.
This subclass is not for all devices that have the name Catalyst. Note that some Catalyst
switches run IOS, like the 2900 and 3550 families. Cisco Catalyst 1900 switches use their
own MIB and have a separate subclass. Use the method above to have SNMP::Info determine the
appropriate subclass before using this class directly.
See SNMP::Info::device_type() for specifics.
Note: Some older Catalyst switches will only talk SNMP version 1. Some newer ones will not
return all their data if connected via Version 1.
@@ -302,20 +197,24 @@ a more specific class using the method above.
=item SNMP::Info::Layer2
=item SNMP::Info::CiscoVTP
=item SNMP::Info::CiscoStack
=back
=head2 Required MIBs
=over
=item CISCO-STACK-MIB
=item CISCO-VTP-MIB
=item Inherited Classes' MIBs
See SNMP::Info::Layer2 for its own MIB requirements.
See SNMP::Info::CiscoVTP for its own MIB requirements.
See SNMP::Info::CiscoStack for its own MIB requirements.
=back
These MIBs are found in the standard v2 MIBs from Cisco.
@@ -326,22 +225,6 @@ These are methods that return scalar value from SNMP
=over
=item $cat->broadcast()
(B<sysBroadcast>)
=item $cat->fan()
(B<chassisFanStatus>)
=item $cat->model()
(B<chassisModel>)
=item $cat->netmask()
(B<sysNetMask>)
=item $cat->os()
Returns 'catalyst'
@@ -351,30 +234,6 @@ Returns 'catalyst'
Tries to use the value from SNMP::Info::CiscoStats->os_ver() and if it fails
it grabs $cat->m_swver()->{1} and uses that.
=item $cat->ps1_type()
(B<chassisPs1Type>)
=item $cat->ps2_type()
(B<chassisPs2Type>)
=item $cat->ps1_status()
(B<chassisPs1Status>)
=item $cat->ps2_status()
(B<chassisPs2Status>)
=item $cat->serial()
(B<chassisSerialNumberString>)
=item $cat->slots()
(B<chassisNumSlots>)
=item $cat->vendor()
Returns 'cisco'
@@ -385,6 +244,14 @@ Returns 'cisco'
See documentation in SNMP::Info::Layer2 for details.
=head2 Global Methods imported from SNMP::Info::CiscoVTP
See documentation in SNMP::Info::CiscoVTP for details.
=head2 Global Methods imported from SNMP::Info::CiscoStack
See documentation in SNMP::Info::CiscoStack for details.
=head1 TABLE ENTRIES
These are methods that return tables of information in the form of a reference
@@ -394,197 +261,25 @@ to a hash.
=over
=item $cat->interfaces()
=item $cat->bp_index()
Crosses p_port() with i_index() to get physical names.
Returns reference to hash of bridge port table entries map back to interface identifier (iid)
=item $cat->i_physical()
Returns a map to IID for ports that are physical ports, not vlans, etc.
=item $cat->i_type()
Crosses p_port() with p_type() and returns the results.
Overrides with ifType if p_type() isn't available.
=item $cat->i_name()
Crosses p_name with p_port and returns results.
=item $cat->i_duplex()
Crosses p_duplex with p_port and returns results.
=item $cat->i_duplex_admin()
Crosses p_duplex_admin with p_port.
Munges bit_string returned from p_duplex_admin to get duplex settings.
Crosses (B<portCrossIndex>) to (B<portIfIndex>) since some devices seem to have
problems with BRIDGE-MIB
=back
=head2 Module table
=head2 Table Methods imported from SNMP::Info::CiscoVTP
This table holds configuration information for each of the blades installed in
the Catalyst device.
=over
=item $cat->m_type()
(B<moduleType>)
=item $cat->m_model()
(B<moduleModel>)
=item $cat->m_serial()
(B<moduleSerialNumber>)
=item $cat->m_status()
(B<moduleStatus>)
=item $cat->m_name()
(B<moduleName>)
=item $cat->m_ports()
(B<moduleNumPorts>)
=item $cat->m_ports_status()
Returns a list of space separated status strings for the ports.
To see the status of port 4 :
@ports_status = split(' ', $cat->m_ports_status() );
$port4 = $ports_status[3];
(B<modulePortStatus>)
=item $cat->m_ports_hwver()
(B<moduleHwVersion>)
=item $cat->m_ports_fwver()
(B<moduleFwVersion>)
=item $cat->m_ports_swver()
(B<moduleSwVersion>)
=item $cat->m_ports_ip()
(B<moduleIPAddress>)
=item $cat->m_ports_sub1()
(B<moduleSubType>)
=item $cat->m_ports_sub2()
(B<moduleSubType2>)
=back
=head2 Modules - Router Blades
=over
=item $cat->m_ip()
(B<moduleIPAddress>)
=item $cat->m_sub1()
(B<moduleSubType>)
=item $cat->m_sub2()
(B<moduleSubType2>)
=back
=head2 Port Entry Table (CISCO-STACK-MIB::portTable)
=over
=item $cat->p_name()
(B<portName>)
=item $cat->p_type()
(B<portType>)
=item $cat->p_status()
(B<portOperStatus>)
=item $cat->p_status2()
(B<portAdditionalStatus>)
=item $cat->p_speed()
(B<portAdminSpeed>)
=item $cat->p_duplex()
(B<portDuplex>)
=item $cat->p_port()
(B<portIfIndex>)
=back
=head2 Port Capability Table (CISCO-STACK-MIB::portCpbTable)
=over
=item $cat->p_speed_admin()
(B<portCpbSpeed>)
=item $cat->p_duplex_admin()
(B<portCpbDuplex>)
=back
=head2 VLAN Entry Table
See ftp://ftp.cisco.com/pub/mibs/supportlists/wsc5000/wsc5000-communityIndexing.html
for a good treaty of how to connect to the VLANs
=over
=item $cat->v_state()
(B<vtpVlanState>)
=item $cat->v_type()
(B<vtpVlanType>)
=item $cat->v_name()
(B<vtpVlanName>)
=item $cat->v_mtu()
(B<vtpVlanMtu>)
=back
See documentation in SNMP::Info::CiscoVTP for details.
=head2 Table Methods imported from SNMP::Info::Layer2
See documentation in SNMP::Info::Layer2 for details.
=head2 Table Methods imported from SNMP::Info::Layer2::CiscoStack
See documentation in SNMP::Info::Layer2::CiscoStack for details.
=cut

521
Info/Layer2/Centillion.pm Normal file
View File

@@ -0,0 +1,521 @@
# SNMP::Info::Layer2::Centillion
# Eric Miller
# $Id$
#
# Copyright (c) 2004 Eric Miller
#
# 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 = '1.04';
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
=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

214
Info/Layer2/Cisco.pm Normal file
View File

@@ -0,0 +1,214 @@
# SNMP::Info::Layer2::Cisco
# Max Baker
#
# Copyright (c) 2006 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::Cisco;
# $Id$
use strict;
use Exporter;
use SNMP::Info::Layer2;
use SNMP::Info::CiscoVTP;
use SNMP::Info::CDP;
use SNMP::Info::CiscoStats;
use SNMP::Info::CiscoImage;
use SNMP::Info::CiscoRTT;
use SNMP::Info::CiscoQOS;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
$VERSION = 1.04;
@SNMP::Info::Layer2::Cisco::ISA = qw/SNMP::Info::Layer2 SNMP::Info::CiscoVTP
SNMP::Info::CDP SNMP::Info::CiscoStats
SNMP::Info::CiscoImage SNMP::Info::CiscoRTT
SNMP::Info::CiscoQOS Exporter/;
@SNMP::Info::Layer2::Cisco::EXPORT_OK = qw//;
%MIBS = (
%SNMP::Info::Layer2::MIBS,
%SNMP::Info::CiscoVTP::MIBS,
%SNMP::Info::CDP::MIBS,
%SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::CiscoImage::MIBS,
%SNMP::Info::CiscoRTT::MIBS,
%SNMP::Info::CiscoQOS::MIBS,
);
%GLOBALS = (
%SNMP::Info::Layer2::GLOBALS,
%SNMP::Info::CiscoVTP::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
%SNMP::Info::CiscoStats::GLOBALS,
%SNMP::Info::CiscoImage::GLOBALS,
%SNMP::Info::CiscoRTT::GLOBALS,
%SNMP::Info::CiscoQOS::GLOBALS,
);
%FUNCS = (
%SNMP::Info::Layer2::FUNCS,
%SNMP::Info::CiscoVTP::FUNCS,
%SNMP::Info::CDP::FUNCS,
%SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::CiscoImage::FUNCS,
%SNMP::Info::CiscoRTT::FUNCS,
%SNMP::Info::CiscoQOS::FUNCS,
);
%MUNGE = (
%SNMP::Info::Layer2::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE,
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoStats::MUNGE,
%SNMP::Info::CiscoImage::MUNGE,
%SNMP::Info::CiscoRTT::MUNGE,
%SNMP::Info::CiscoQOS::MUNGE,
);
1;
__END__
=head1 NAME
SNMP::Info::Layer2::Cisco - Perl5 Interface to L3 and L2+L3 IOS Cisco Device
that are not covered in other classes.
=head1 AUTHOR
Max Baker
=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::Layer2
=item SNMP::Info::CiscoVTP
=item SNMP::Info::CDP
=item SNMP::Info::CiscoStats
=item SNMP::Info::CiscoImage
=back
=head2 Required MIBs
=over
=item Inherited Classes' MIBs
See SNMP::Info::Layer2 for its own MIB requirements.
See SNMP::Info::CiscoVTP for its own MIB requirements.
See SNMP::Info::CiscoStats for its own MIB requirements.
See SNMP::Info::CDP for its own MIB requirements.
See SNMP::Info::CiscoImage 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::Layer2
See documentation in SNMP::Info::Layer2 for details.
=head2 Global Methods imported from SNMP::Info::CiscoVTP
See documentation in SNMP::Info::CiscoVTP for details.
=head2 Globals imported from SNMP::Info::CDP
See documentation in SNMP::Info::CDP for details.
=head2 Globals imported from SNMP::Info::CiscoStats
See documentation in SNMP::Info::CiscoStats for details.
=head2 Globals imported from SNMP::Info::CiscoImage
See documentation in SNMP::Info::CiscoImage 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::Layer2
See documentation in SNMP::Info::Layer2 for details.
=head2 Table Methods imported from SNMP::Info::CiscoVTP
See documentation in SNMP::Info::CiscoVTP for details.
=head2 Table Methods imported from SNMP::Info::CDP
See documentation in SNMP::Info::CDP for details.
=head2 Table Methods imported from SNMP::Info::CiscoStats
See documentation in SNMP::Info::CiscoStats for details.
=head2 Table Methods imported from SNMP::Info::CiscoImage
See documentation in SNMP::Info::CiscoImage for details.
=cut

299
Info/Layer2/Foundry.pm Normal file
View File

@@ -0,0 +1,299 @@
# SNMP::Info::Layer2::Foundry - SNMP Interface to Foundry Switches
#
# Copyright (c) 2005 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::Foundry;
$VERSION = '1.04';
# $Id$
use strict;
use Exporter;
use SNMP::Info::Layer2;
use SNMP::Info::FDP;
use SNMP::Info::EtherLike;
use SNMP::Info::MAU;
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
@SNMP::Info::Layer2::Foundry::ISA = qw/SNMP::Info::Layer2 SNMP::Info::FDP SNMP::Info::EtherLike
SNMP::Info::MAU Exporter/;
@SNMP::Info::Layer2::Foundry::EXPORT_OK = qw//;
%MIBS = ( %SNMP::Info::Layer2::MIBS,
%SNMP::Info::FDP::MIBS,
%SNMP::Info::EtherLike::MIBS,
%SNMP::Info::MAU::MIBS,
'FOUNDRY-SN-ROOT-MIB' => 'foundry',
);
%GLOBALS = (
%SNMP::Info::Layer2::GLOBALS,
%SNMP::Info::FDP::GLOBALS,
%SNMP::Info::EtherLike::GLOBALS,
%SNMP::Info::MAU::GLOBALS,
);
%FUNCS = (
%SNMP::Info::Layer2::FUNCS,
%SNMP::Info::FDP::FUNCS,
%SNMP::Info::EtherLike::FUNCS,
%SNMP::Info::MAU::FUNCS,
'test' => 'dot1dStpPortState',
);
%MUNGE = (
%SNMP::Info::Layer2::MUNGE,
%SNMP::Info::FDP::MUNGE,
%SNMP::Info::EtherLike::MUNGE,
%SNMP::Info::MAU::MUNGE,
);
# Method OverRides
#sub bulkwalk_no { 1;}
*SNMP::Info::Layer2::Foundry::i_duplex = \&SNMP::Info::MAU::mau_i_duplex;
*SNMP::Info::Layer2::Foundry::i_duplex_admin = \&SNMP::Info::MAU::mau_i_duplex_admin;
*SNMP::Info::Layer2::Foundry::i_vlan = \&SNMP::Info::Bridge::qb_i_vlan_t;
# todo doc these
sub os_ver {
my $foundry = shift;
my $e_name = $foundry->e_name();
# find entity table entry for "stackmanaget.1"
my $unit_iid = undef;
foreach my $e (keys %$e_name){
my $name = $e_name->{$e} || '';
$unit_iid = $e if $name eq 'stackmanaget.1';
}
# Default to OID method if no dice.
unless (defined $unit_iid){
return $foundry->SUPER::model();
}
# Find Model Name
my $e_fwver = $foundry->e_fwver();
if (defined $e_fwver->{$unit_iid}){
return $e_fwver->{$unit_iid};
}
# Not found in ENTITY-MIB, go up a level.
return $foundry->SUPER::os_ver();
}
sub model {
my $foundry = shift;
my $e_name = $foundry->e_name();
# find entity table entry for "unit.1"
my $unit_iid = undef;
foreach my $e (keys %$e_name){
my $name = $e_name->{$e} || '';
$unit_iid = $e if $name eq 'unit.1';
}
# Default to OID method if no dice.
unless (defined $unit_iid){
return $foundry->SUPER::model();
}
# Find Model Name
my $e_model = $foundry->e_model();
if (defined $e_model->{$unit_iid}){
return $e_model->{$unit_iid};
}
# Not found in ENTITY-MIB, go up a level.
return $foundry->SUPER::model();
}
sub serial {
my $foundry = shift;
my $e_name = $foundry->e_name();
# find entity table entry for "unit.1"
my $unit_iid = undef;
foreach my $e (keys %$e_name){
my $name = $e_name->{$e} || '';
$unit_iid = $e if $name eq 'unit.1';
}
return undef unless defined $unit_iid;
# Look up serial of found entry.
my $e_serial = $foundry->e_serial();
return $e_serial->{$unit_iid} if defined $e_serial->{$unit_iid};
return $foundry->SUPER::serial();
}
sub interfaces {
my $foundry = shift;
my $i_descr = $foundry->i_description;
my $i_name = $foundry->i_name;
# use ifName only if it is in portn
# format. For EdgeIrons
# else use ifDescr
foreach my $iid (keys %$i_name){
my $name = $i_name->{$iid};
next unless defined $name;
$i_descr->{$iid} = $name
if $name =~ /^port\d+/i;
}
return $i_descr;
}
sub i_ignore {
my $foundry = shift;
my $i_type = $foundry->i_type();
my %i_ignore = ();
foreach my $iid (keys %$i_type){
my $type = $i_type->{$iid} || '';
$i_ignore{$iid}++
# 33 is the console port
if $type =~ /(loopback|propvirtual|other|cpu|33)/i;
}
return \%i_ignore;
}
sub os {
return 'foundry';
}
sub vendor {
return 'foundry';
}
# this hangs on a edgeiron24g
# TODO: check by devicetype and deferr to SUPER if not bad device
sub stp_p_state { undef; }
1;
__END__
=head1 NAME
SNMP::Info::Layer2::Foundry - Perl5 Interface to Foundry FastIron Network Devices
=head1 AUTHOR
Max Baker
=head1 SYNOPSIS
# Let SNMP::Info determine the correct subclass for you.
my $foundry = new SNMP::Info(
AutoSpecify => 1,
Debug => 1,
# These arguments are passed directly on to SNMP::Session
DestHost => 'myswitch',
Community => 'public',
Version => 1
)
or die "Can't connect to DestHost.\n";
my $class = $foundry->class();
print "SNMP::Info determined this device to fall under subclass : $class\n";
=head1 DESCRIPTION
This module provides support for Foundry EdgeIron Switches
=head2 Inherited Classes
=over
=item SNMP::Info::Layer2
=item SNMP::Info::FDP
=back
=head2 Required MIBs
=over
=item FOUNDRY-SN-ROOT-MIB
=item Inherited Classes' MIBs
See classes listed above for their required MIBs.
=back
=head1 GLOBALS
These are methods that return scalar value from SNMP
=over
=item todo
=back
=head2 Globals imported from SNMP::Info::Layer2
See documentation in SNMP::Info::Layer2 for details.
=head2 Globals imported from SNMP::Info::FDP
See documentation in SNMP::Info::FDP 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 todo2
=back
=head2 Table Methods imported from SNMP::Info::Layer2
See documentation in SNMP::Info::Layer2 for details.
=head2 Table Methods imported from SNMP::Info::FDP
See documentation in SNMP::Info::FDP for details.
=cut

View File

@@ -1,5 +1,7 @@
# SNMP::Info::Layer2::HP - SNMP Interface to HP ProCurve Switches
# Max Baker <max@warped.org>
# Max Baker
#
# Copyright (c) 2004,2005 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.4;
$VERSION = '1.04';
# $Id$
use strict;
@@ -37,28 +39,30 @@ use Exporter;
use SNMP::Info::Layer2;
use SNMP::Info::MAU;
use SNMP::Info::Entity;
use SNMP::Info::CDP;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %PORTSTAT %MODEL_MAP %MUNGE $INIT/ ;
@SNMP::Info::Layer2::HP::ISA = qw/SNMP::Info::Layer2 SNMP::Info::MAU SNMP::Info::Entity Exporter/;
@SNMP::Info::Layer2::HP::ISA = qw/SNMP::Info::Layer2 SNMP::Info::MAU SNMP::Info::Entity
SNMP::Info::CDP Exporter/;
@SNMP::Info::Layer2::HP::EXPORT_OK = qw//;
# See SNMP::Info for the details of these data structures and interworkings.
$INIT = 0;
%MIBS = ( %SNMP::Info::Layer2::MIBS,
%SNMP::Info::MAU::MIBS,
%SNMP::Info::Entity::MIBS,
%SNMP::Info::CDP::MIBS,
'RFC1271-MIB' => 'logDescription',
'HP-ICF-OID' => 'hpSwitch4000',
'HP-VLAN' => 'hpVlanMemberIndex',
'STATISTICS-MIB' => 'hpSwitchCpuStat',
'NETSWITCH-MIB' => 'hpMsgBufFree'
'NETSWITCH-MIB' => 'hpMsgBufFree',
);
%GLOBALS = (
%SNMP::Info::Layer2::GLOBALS,
%SNMP::Info::MAU::GLOBALS,
%SNMP::Info::Entity::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
'serial1' => 'entPhysicalSerialNum.1',
'hp_cpu' => 'hpSwitchCpuStat.0',
'hp_mem_total' => 'hpGlobalMemTotalBytes.1',
@@ -66,38 +70,82 @@ $INIT = 0;
'mem_used' => 'hpGlobalMemAllocBytes.1',
'os_version' => 'hpSwitchOsVersion.0',
'os_bin' => 'hpSwitchRomVersion.0',
'mac' => 'hpSwitchBaseMACAddress.0'
'mac' => 'hpSwitchBaseMACAddress.0',
'hp_vlans' => 'hpVlanNumber',
);
%FUNCS = (
%SNMP::Info::Layer2::FUNCS,
%SNMP::Info::MAU::FUNCS,
%SNMP::Info::Entity::FUNCS,
%SNMP::Info::CDP::FUNCS,
'bp_index2' => 'dot1dBasePortIfIndex',
'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 = (
# Inherit all the built in munging
%SNMP::Info::Layer2::MUNGE,
%SNMP::Info::MAU::MUNGE,
%SNMP::Info::Entity::MUNGE
%SNMP::Info::Entity::MUNGE,
%SNMP::Info::CDP::MUNGE
);
%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',
'J4851A' => '3124',
'J4865A' => '4108GL',
'J4874A' => '9315M',
'J4887A' => '4104GL',
'J4874A' => '9315',
'J4899A' => '2650',
'J4899B' => '2650-CR',
'J4900A' => '2626',
'J4900B' => '2626-CR',
'J4902A' => '6108',
'J4903A' => '2824',
'J4904A' => '2848',
'J4905A' => '3400cl-24G',
'J4906A' => '3400cl-48G',
'J8130A' => 'WAP-420-NA',
'J8131A' => 'WAP-420-WW',
'J8133A' => 'AP520WL',
'J8164A' => '2626-PWR',
'J8165A' => '2650-PWR',
'J8433A' => 'CX4-6400cl-6XG',
'J8474A' => 'MF-6400cl-6XG',
'J8718A' => '5404yl',
'J8719A' => '5408yl',
);
# Method Overrides
*SNMP::Info::Layer2::HP::i_duplex = \&SNMP::Info::MAU::mau_i_duplex;
*SNMP::Info::Layer2::HP::i_duplex_admin = \&SNMP::Info::MAU::mau_i_duplex_admin;
sub cpu {
my $hp = shift;
return $hp->hp_cpu();
@@ -127,7 +175,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;
@@ -250,80 +300,55 @@ sub slots {
#
#}
sub i_duplex {
sub i_vlan {
my $hp = shift;
my $mau_index = $hp->mau_index();
my $mau_link = $hp->mau_link();
my %i_duplex;
foreach my $mau_port (keys %$mau_link){
my $iid = $mau_index->{$mau_port};
next unless defined $iid;
my $linkoid = $mau_link->{$mau_port};
my $link = &SNMP::translateObj($linkoid);
next unless defined $link;
my $duplex = undef;
if ($link =~ /fd$/i) {
$duplex = 'full';
} elsif ($link =~ /hd$/i){
$duplex = 'half';
# Newer devices use Q-BRIDGE-MIB
my $qb_i_vlan = $hp->qb_i_vlan_t();
if (defined $qb_i_vlan and scalar(keys %$qb_i_vlan)){
return $qb_i_vlan;
}
$i_duplex{$iid} = $duplex if defined $duplex;
}
return \%i_duplex;
}
# HP4000 ... get it from HP-VLAN
# the hpvlanmembertagged2 table has an entry in the form of
# vlan.interface = /untagged/no/tagged/auto
my $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';
sub i_duplex_admin {
$i_vlan->{$if} = $vlan if defined $vlan;
}
return $i_vlan;
}
# Bridge MIB does not map Bridge Port to ifIndex correctly on all models
sub bp_index {
my $hp = shift;
my $if_index = $hp->i_index();
my $model = $hp->model();
my $bp_index = $hp->bp_index2();
my $interfaces = $hp->interfaces();
my $mau_index = $hp->mau_index();
my $mau_auto = $hp->mau_auto();
my $mau_autostat = $hp->mau_autostat();
my $mau_typeadmin = $hp->mau_type_admin();
my $mau_autosent = $hp->mau_autosent();
my %mau_reverse = reverse %$mau_index;
my %i_duplex_admin;
foreach my $iid (keys %$interfaces){
my $mau_index = $mau_reverse{$iid};
next unless defined $mau_index;
my $autostat = $mau_autostat->{$mau_index};
# HP25xx has this value
if (defined $autostat and $autostat =~ /enabled/i){
$i_duplex_admin{$iid} = 'auto';
next;
unless (defined $model and $model =~ /(1600|2424|4000|8000)/) {
return $bp_index;
}
my $type = $mau_autosent->{$mau_index};
next unless defined $type;
if ($type == 0) {
$i_duplex_admin{$iid} = 'none';
next;
my %mod_bp_index;
foreach my $iid (keys %$if_index){
$mod_bp_index{$iid} = $iid;
}
my $full = $hp->_isfullduplex($type);
my $half = $hp->_ishalfduplex($type);
if ($full and !$half){
$i_duplex_admin{$iid} = 'full';
} elsif ($half) {
$i_duplex_admin{$iid} = 'half';
}
}
return \%i_duplex_admin;
return \%mod_bp_index;
}
1;
@@ -335,7 +360,7 @@ SNMP::Info::Layer2::HP - SNMP Interface to HP Procurve Switches
=head1 AUTHOR
Max Baker (C<max@warped.org>)
Max Baker
=head1 SYNOPSIS
@@ -389,13 +414,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
@@ -433,14 +463,43 @@ Returns the model number of the HP Switch. Will translate between the HP Part n
the common model number with this map :
%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',
'J4851A' => '3124',
'J4865A' => '4108GL',
'J4874A' => '9315M',
'J4887A' => '4104GL',
'J4874A' => '9315',
'J4899A' => '2650',
'J4899B' => '2650-CR',
'J4900A' => '2626',
'J4900B' => '2626-CR',
'J4902A' => '6108',
'J4903A' => '2824',
'J4904A' => '2848',
'J4905A' => '3400cl-24G',
'J4906A' => '3400cl-48G',
'J8130A' => 'WAP-420-NA',
'J8131A' => 'WAP-420-WW',
'J8133A' => 'AP520WL',
'J8164A' => '2626-PWR',
'J8165A' => '2650-PWR',
'J8433A' => 'CX4-6400cl-6XG',
'J8474A' => 'MF-6400cl-6XG',
'J8718A' => '5404yl',
'J8719A' => '5408yl',
);
=item $hp->os()
@@ -518,6 +577,19 @@ 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.
=item $hp->bp_index()
Returns reference to hash of bridge port table entries map back to interface identifier (iid)
Returns (B<ifIndex>) for both key and value for 1600, 2424, 4000, and 8000 models
since they seem to have problems with BRIDGE-MIB
=back
=head2 Table Methods imported from SNMP::Info::Layer2

253
Info/Layer2/N2270.pm Normal file
View File

@@ -0,0 +1,253 @@
# SNMP::Info::Layer2::N2270
# Eric Miller
# $Id$
#
# Copyright (c) 2005 Eric Miller
#
# 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::N2270;
$VERSION = '1.04';
use strict;
use Exporter;
use SNMP::Info;
use SNMP::Info::Bridge;
use SNMP::Info::SONMP;
use SNMP::Info::Airespace;
@SNMP::Info::Layer2::N2270::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::SONMP SNMP::Info::Airespace Exporter/;
@SNMP::Info::Layer2::N2270::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,
%SNMP::Info::Airespace::MIBS,
);
%GLOBALS = (
%SNMP::Info::GLOBALS,
%SNMP::Info::Bridge::GLOBALS,
%SNMP::Info::SONMP::GLOBALS,
%SNMP::Info::Airespace::GLOBALS,
);
%FUNCS = (
%SNMP::Info::FUNCS,
%SNMP::Info::Bridge::FUNCS,
%SNMP::Info::SONMP::FUNCS,
%SNMP::Info::Airespace::FUNCS,
);
%MUNGE = (
%SNMP::Info::MUNGE,
%SNMP::Info::Bridge::MUNGE,
%SNMP::Info::SONMP::MUNGE,
%SNMP::Info::Airespace::MUNGE,
);
sub os {
return 'nortel';
}
sub vendor {
return 'nortel';
}
sub model {
my $n2270 = shift;
my $id = $n2270->id();
return undef unless defined $id;
my $model = &SNMP::translateObj($id);
return $id unless defined $model;
$model =~ s/^sreg-WLANSecuritySwitch//i;
return $model;
}
sub index_factor {
return 256;
}
sub slot_offset {
return 0;
}
1;
__END__
=head1 NAME
SNMP::Info::Layer2::N2270 - SNMP Interface to Nortel 2270 Series Wireless Switch
=head1 AUTHOR
Eric Miller
=head1 SYNOPSIS
#Let SNMP::Info determine the correct subclass for you.
my $n2270 = 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 = $n2270->class();
print " Using device sub class : $class\n";
=head1 DESCRIPTION
Provides abstraction to the configuration information obtainable from a
Nortel 2270 Series Wireless Switch 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 $n2270 = new SNMP::Info::Layer2::N2270(...);
=head2 Inherited Classes
=over
=item SNMP::Info
=item SNMP::Info::Bridge
=item SNMP::Info::SONMP
=item SNMP::Info::Airespace
=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::SONMP for its own MIB requirements.
See SNMP::Info::Airespace for its own MIB requirements.
=back
=head1 GLOBALS
These are methods that return scalar value from SNMP
=over
=item $n2270->vendor()
Returns 'nortel'
=item $n2270->os()
Returns 'nortel'
=item $n2270->model()
Cross references $bayhub->id() to the SYNOPTICS-ROOT-MIB and returns
the results.
Removes sreg-WLANSecuritySwitch from the model name
=back
=head2 Overrides
=over
=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::SONMP
See documentation in SNMP::Info::SONMP for details.
=head2 Global Methods imported from SNMP::Info::Airespace
See documentation in SNMP::Info::Airespace 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 None
=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::Airespace
See documentation in SNMP::Info::Airespace for details.
=cut

500
Info/Layer2/NAP222x.pm Normal file
View File

@@ -0,0 +1,500 @@
# SNMP::Info::Layer2::NAP222x
# Eric Miller
# $Id$
#
# Copyright (c) 2004 Eric Miller
#
# 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 = '1.04';
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
=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

277
Info/Layer2/Orinoco.pm Normal file
View File

@@ -0,0 +1,277 @@
# SNMP::Info::Layer2::Orinoco
# Eric Miller
# $Id$
#
# Copyright (c) 2004-6 Eric Miller
#
# 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 = '1.04';
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 $1 if ($descr =~ /(AP-\d+)/);
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
=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
View File

@@ -0,0 +1,224 @@
# SNMP::Info::Layer2::ZyXEL_DSLAM
# 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::ZyXEL_DSLAM;
$VERSION = '1.04';
# $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

View File

@@ -1,5 +1,7 @@
# SNMP::Info::Layer3 - SNMP Interface to Layer3 devices
# Max Baker <max@warped.org>
# Max Baker
#
# 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,73 +30,83 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer3;
$VERSION = 0.4;
$VERSION = '1.04';
# $Id$
use strict;
use Exporter;
use SNMP::Info;
use SNMP::Info::CDP;
use SNMP::Info::CiscoStats;
use SNMP::Info::Bridge;
use SNMP::Info::EtherLike;
use SNMP::Info::Entity;
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
@SNMP::Info::Layer3::ISA = qw/SNMP::Info SNMP::Info::CDP SNMP::Info::Bridge
SNMP::Info::EtherLike SNMP::Info::CiscoStats Exporter/;
@SNMP::Info::Layer3::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::EtherLike
SNMP::Info::Entity Exporter/;
@SNMP::Info::Layer3::EXPORT_OK = qw//;
$DEBUG=0;
$SNMP::debugging=$DEBUG;
$INIT = 0;
%MIBS = ( %SNMP::Info::MIBS,
%SNMP::Info::Bridge::MIBS,
%SNMP::Info::CDP::MIBS,
%SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::EtherLike::MIBS,
'ENTITY-MIB' => 'entPhysicalName',
'CISCO-PRODUCTS-MIB' => 'sysName',
%SNMP::Info::Entity::MIBS,
'IP-MIB' => 'ipNetToMediaIfIndex',
'OSPF-MIB' => 'ospfRouterId',
'BGP4-MIB' => 'bgpIdentifier',
);
%GLOBALS = (
# Inherit the super class ones
%SNMP::Info::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
%SNMP::Info::CiscoStats::GLOBALS,
%SNMP::Info::Bridge::GLOBALS,
%SNMP::Info::EtherLike::GLOBALS,
%SNMP::Info::Entity::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',
'bgp_id' => 'bgpIdentifier.0',
'bgp_local_as' => 'bgpLocalAs.0',
);
%FUNCS = (
%SNMP::Info::FUNCS,
%SNMP::Info::CDP::FUNCS,
%SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::Bridge::FUNCS,
%SNMP::Info::EtherLike::FUNCS,
%SNMP::Info::Entity::FUNCS,
# IFMIB
'i_name2' => 'ifName',
# Address Translation Table (ARP Cache)
'at_index' => 'atIfIndex',
'at_paddr' => 'atPhysAddress',
'at_netaddr' => 'atNetAddress',
'ospf_ip' => 'ospfHostIpAddress'
# Obsolete Address Translation Table (ARP Cache)
'old_at_index' => 'atIfIndex',
'old_at_paddr' => 'atPhysAddress',
'old_at_netaddr' => 'atNetAddress',
# IP-MIB IP Net to Media Table (ARP Cache)
'at_index' => 'ipNetToMediaIfIndex',
'at_paddr' => 'ipNetToMediaPhysAddress',
'at_netaddr' => 'ipNetToMediaNetAddress',
# OSPF
'ospf_ip' => 'ospfHostIpAddress',
# BGP Peer Table
'bgp_peers' => 'bgpPeerLocalAddr',
'bgp_peer_id' => 'bgpPeerIdentifier',
'bgp_peer_state' => 'bgpPeerState',
'bgp_peer_as' => 'bgpPeerRemoteAs',
'bgp_peer_addr' => 'bgpPeerRemoteAddr',
'bgp_peer_fsm_est_trans' => 'bgpPeerFsmEstablishedTransitions',
'bgp_peer_in_tot_msgs' => 'bgpPeerInTotalMessages',
'bgp_peer_in_upd_el_time' => 'bgpPeerInUpdateElapsedTime',
'bgp_peer_in_upd' => 'bgpPeerInUpdates',
'bgp_peer_out_tot_msgs' => 'bgpPeerOutTotalMessages',
'bgp_peer_out_upd' => 'bgpPeerOutUpdates',
);
%MUNGE = (
# Inherit all the built in munging
%SNMP::Info::MUNGE,
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoStats::MUNGE,
%SNMP::Info::Bridge::MUNGE,
%SNMP::Info::EtherLike::MUNGE,
%SNMP::Info::Entity::MUNGE,
'old_at_paddr' => \&SNMP::Info::munge_mac,
'at_paddr' => \&SNMP::Info::munge_mac,
);
@@ -107,16 +119,18 @@ sub root_ip {
my $router_ip = $l3->router_ip();
my $ospf_ip = $l3->ospf_ip();
# return the first one found here (should be only)
# return the first one found here (should be only one)
if (defined $ospf_ip and scalar(keys %$ospf_ip)){
foreach my $key (keys %$ospf_ip){
my $ip = $ospf_ip->{$key};
print " SNMP::Layer3::root_ip() using $ip\n" if $DEBUG;
next if $ip eq '0.0.0.0';
next unless $l3->snmp_connect_ip($ip);
print " SNMP::Layer3::root_ip() using $ip\n" if $l3->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') and ($l3->snmp_connect_ip($router_ip)) );
return undef;
}
@@ -128,7 +142,7 @@ sub i_ignore {
my %i_ignore;
foreach my $if (keys %$interfaces) {
# lo -> cisco aironet 350 loopback
if ($interfaces->{$if} =~ /(tunnel|loopback|lo|null)/i){
if ($interfaces->{$if} =~ /(tunnel|loopback|\blo\b|null)/i){
$i_ignore{$if}++;
}
}
@@ -138,10 +152,20 @@ sub i_ignore {
sub serial {
my $l3 = shift;
my $chassis = $l3->chassis();
my $serial1 = $l3->serial1();
my $e_descr = $l3->e_descr() || {};
my $e_serial = $l3->e_serial() || {};
my $serial2 = $e_serial->{1} || undef;
my $chassis = $e_descr->{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 +173,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 $l3->debug();
return undef;
}
my $model = &SNMP::translateObj($id);
return $id unless defined $model;
$model =~ s/^cisco//i;
$model =~ s/^catalyst//;
$model =~ s/^cat//;
@@ -218,11 +250,32 @@ sub vendor {
my $descr = $l3->description();
return 'cisco' if ($descr =~ /(cisco|ios)/i);
return 'cisco' if ($descr =~ /(cisco|\bios\b)/i);
return 'foundry' if ($descr =~ /foundry/i);
}
sub at_index {
my $l3 = shift;
return $l3->orig_at_index() || $l3->old_at_index();
}
sub at_paddr {
my $l3 = shift;
return $l3->orig_at_paddr() || $l3->old_at_paddr();
}
sub at_netaddr {
my $l3 = shift;
return $l3->orig_at_netaddr() || $l3->old_at_netaddr();
}
1;
__END__
=head1 NAME
@@ -231,7 +284,7 @@ SNMP::Info::Layer3 - Perl5 Interface to network devices serving Layer3 or Layers
=head1 AUTHOR
Max Baker (C<max@warped.org>)
Max Baker
=head1 SYNOPSIS
@@ -281,9 +334,7 @@ a more specific class using the method above.
=item SNMP::Info::Bridge
=item SNMP::Info::CDP
=item SNMP::Info::CiscoStats
For L2/L3 devices.
=item SNMP::Info::EtherLike
@@ -293,19 +344,17 @@ a more specific class using the method above.
=over
=item CISCO-PRODUCTS-MIB
=item ENTITY-MIB
=item OSPF-MIB
=item BGP4-MIB
=item Inherited Classes
MIBs required by the inherited classes listed above.
=back
MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
MIBs can be found in the netdisco-mibs package.
=head1 GLOBALS
@@ -313,12 +362,6 @@ These are methods that return scalar value from SNMP
=over
=item $l3->chassis()
Returns Chassis type (model).
(B<entPhysicalDescr.1>)
=item $l3->mac()
Returns root port mac address
@@ -329,6 +372,18 @@ Returns root port mac address
(B<ospfRouterId.0>)
=item $l3->bgp_id()
(B<bgpIdentifier.0>)
Returns the BGP identifier of the local system
=item $l3->bgp_local_as()
Returns the local autonomous system number
(B<bgpLocalAs.0>)
=back
=head2 Overrides
@@ -343,7 +398,7 @@ Removes 'cisco' from cisco devices for readability.
=item $l3->serial()
Trys to cull a serial number from $l3->chassis()
Trys to cull a serial number from ENTITY-MIB, description, and OLD-CISCO-... mib
=item $l3->vendor()
@@ -359,18 +414,14 @@ See documentation in SNMP::Info for details.
See documentation in SNMP::Info::Bridge for details.
=head2 Globals imported from SNMP::Info::CDP
See documentation in SNMP::Info::CDP for details.
=head2 Globals imported from SNMP::Info::CiscoStats
See documentation in SNMP::Info::CiscoStats for details.
=head2 Globals imported from SNMP::Info::EtherLike
See documentation in SNMP::Info::EtherLike for details.
=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
@@ -409,23 +460,59 @@ see SNMP::Info::Etherlike for the el_index() and el_duplex() methods.
=back
=head2 ARP Cache Entries
=head2 IP-MIB Arp Cache Table (B<ipNetToMediaTable>)
=over
=item $l3->at_index()
Returns reference to hash. Maps ARP table entries to Interface IIDs
(B<ipNetToMediaIfIndex>)
If the device doesn't support B<ipNetToMediaIfIndex>, this will try
the deprecated B<atIfIndex>.
=item $l3->at_paddr()
Returns reference to hash. Maps ARP table entries to MAC addresses.
(B<ipNetToMediaPhysAddress>)
If the device doesn't support B<ipNetToMediaPhysAddress>, this will try
the deprecated B<atPhysAddress>.
=item $l3->at_netaddr()
Returns reference to hash. Maps ARP table entries to IPs
(B<ipNetToMediaNetAddress>)
If the device doesn't support B<ipNetToMediaNetAddress>, this will try
the deprecated B<atNetAddress>.
=back
=head2 ARP Cache Entries
The B<atTable> has been deprecated since 1991. You should never need
to use these methods. See B<ipNetToMediaTable> above.
=over
=item $l3->old_at_index()
Returns reference to map of IID to Arp Cache Entry
(B<atIfIndex>)
=item $l3->at_paddr()
=item $l3->old_at_paddr()
Returns reference to hash of Arp Cache Entries to MAC address
(B<atPhysAddress>)
=item $l3->at_netaddr()
=item $l3->old_at_netaddr()
Returns reference to hash of Arp Cache Entries to IP Address
@@ -433,6 +520,84 @@ Returns reference to hash of Arp Cache Entries to IP Address
=back
=head2 BGP Peer Table
=over
=item $l3->bgp_peers()
Returns reference to hash of BGP peer to local IP address
(B<bgpPeerLocalAddr>)
=item $l3->bgp_peer_id()
Returns reference to hash of BGP peer to BGP peer identifier
(B<bgpPeerIdentifier>)
=item $l3->bgp_peer_state()
Returns reference to hash of BGP peer to BGP peer state
(B<bgpPeerState>)
=item $l3->bgp_peer_as()
Returns reference to hash of BGP peer to BGP peer autonomous system number
(B<bgpPeerRemoteAs>)
=item $l3->bgp_peer_addr()
Returns reference to hash of BGP peer to BGP peer IP address
(B<bgpPeerRemoteAddr>)
=item $l3->bgp_peer_fsm_est_trans()
Returns reference to hash of BGP peer to the total number of times the BGP FSM
transitioned into the established state
(B<bgpPeerFsmEstablishedTransitions>)
=item $l3->bgp_peer_in_tot_msgs()
Returns reference to hash of BGP peer to the total number of messages received
from the remote peer on this connection
(B<bgpPeerInTotalMessages>)
=item $l3->bgp_peer_in_upd_el_time()
Returns reference to hash of BGP peer to the elapsed time in seconds since
the last BGP UPDATE message was received from the peer.
(B<bgpPeerInUpdateElapsedTime>)
=item $l3->bgp_peer_in_upd()
Returns reference to hash of BGP peer to the number of BGP UPDATE messages
received on this connection
(B<bgpPeerInUpdates>)
=item $l3->bgp_peer_out_tot_msgs()
Returns reference to hash of BGP peer to the total number of messages transmitted
to the remote peer on this connection
(B<bgpPeerOutTotalMessages>)
=item $l3->bgp_peer_out_upd()
Returns reference to hash of BGP peer to the number of BGP UPDATE messages
transmitted on this connection
(B<bgpPeerOutUpdates>)
=back
=head2 Table Methods imported from SNMP::Info
See documentation in SNMP::Info for details.
@@ -441,16 +606,12 @@ See documentation in SNMP::Info for details.
See documentation in SNMP::Info::Bridge for details.
=head2 Table Methods imported from SNMP::Info::CDP
See documentation in SNMP::Info::CDP for details.
=head2 Table Methods imported from SNMP::Info::CiscoStats
See documentation in SNMP::Info::CiscoStats for details.
=head2 Table Methods imported from SNMP::Info::EtherLike
See documentation in SNMP::Info::EtherLike for details.
=head2 Table Methods imported from SNMP::Info::Entity
See documentation in SNMP::Info::Entity for details.
=cut

View File

@@ -1,5 +1,7 @@
# SNMP::Info::Layer3::Aironet
# Max Baker <max@warped.org>
# Max Baker
#
# 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.4;
$VERSION = '1.04';
# $Id$
use strict;
@@ -40,10 +42,6 @@ use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
@SNMP::Info::Layer3::Aironet::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::Aironet::EXPORT_OK = qw//;
$DEBUG=0;
$SNMP::debugging=$DEBUG;
$INIT = 0;
%MIBS = (
%SNMP::Info::Layer3::MIBS,
'AWCVX-MIB' => 'awcIfTable',
@@ -88,11 +86,11 @@ sub os {
sub os_ver {
my $aironet = shift;
my $descr = $aironet->description();
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})/){
@@ -135,7 +133,9 @@ sub fw_mac {
}
foreach my $bs (keys %$bs_mac){
$fw_mac->{$bs} = $bs_mac->{$bs};
my $entry = $bs;
$entry =~ s/\.0$//;
$fw_mac->{$entry} = $bs_mac->{$bs};
}
return $fw_mac;
@@ -149,7 +149,9 @@ sub fw_port {
foreach my $bs (keys %$bs_port){
$fw_port->{$bs} = $bs_port->{$bs};
my $entry = $bs;
$entry =~ s/\.0$//;
$fw_port->{$entry} = $bs_port->{$bs};
}
return $fw_port;
@@ -214,7 +216,7 @@ SNMP::Info::Layer3::Aironet - Perl5 Interface to Cisco Aironet Wireless Devices
=head1 AUTHOR
Max Baker (C<max@warped.org>)
Max Baker
=head1 SYNOPSIS

444
Info/Layer3/AlteonAD.pm Normal file
View File

@@ -0,0 +1,444 @@
# SNMP::Info::Layer3::AlteonAD
# Eric Miller
# $Id$
#
# Copyright (c) 2004 Eric Miller
# 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 = '1.04';
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//;
%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;
}
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
=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->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

529
Info/Layer3/BayRS.pm Normal file
View File

@@ -0,0 +1,529 @@
# SNMP::Info::Layer3::BayRS
# Eric Miller
# $Id$
#
# Copyright (c) 2004 Eric Miller, 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 = '1.04';
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//;
%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/^\s*Image:\s+re[lv]\/((\d+\.){1,3}\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 = 'Vlan' . $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 ne '0.0.0.0') and ($bayrs->snmp_connect_ip($clip)) );
print " SNMP::Layer3::BayRS::root_ip() using $clip\n" if $bayrs->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') and ($bayrs->snmp_connect_ip($ospf_ip)) ) {
print " SNMP::Layer3::BayRS::root_ip() using $ospf_ip\n" if $bayrs->debug();
return $ospf_ip;
}
return undef;
}
1;
__END__
=head1 NAME
SNMP::Info::Layer3::BayRS - Perl5 Interface to Nortel routers running BayRS.
=head1 AUTHOR
Eric Miller
=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 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.
=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 undefined.
=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

View File

@@ -1,6 +1,7 @@
# SNMP::Info::Layer3::C3550
# Max Baker <max@warped.org>
# Max Baker
#
# 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,143 +29,71 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer3::C3550;
$VERSION = 0.4;
$VERSION = '1.04';
# $Id$
use strict;
use Exporter;
use SNMP::Info::Layer3;
use SNMP::Info::CiscoVTP;
use SNMP::Info::CiscoStack;
use SNMP::Info::CDP;
use SNMP::Info::CiscoStats;
use SNMP::Info::CiscoImage;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %PORTSTAT %MUNGE $INIT/ ;
@SNMP::Info::Layer3::C3550::ISA = qw/SNMP::Info::Layer3 Exporter/;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
@SNMP::Info::Layer3::C3550::ISA = qw/SNMP::Info::Layer3 SNMP::Info::CiscoStack SNMP::Info::CiscoVTP
SNMP::Info::CiscoStats SNMP::Info::CDP Exporter
SNMP::Info::CiscoImage/;
@SNMP::Info::Layer3::C3550::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,
'CISCO-STACK-MIB' => 'moduleType',
'CISCO-VTP-MIB' => 'vtpVlanIndex'
%SNMP::Info::CiscoVTP::MIBS,
%SNMP::Info::CiscoStack::MIBS,
%SNMP::Info::CDP::MIBS,
%SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::CiscoImage::MIBS,
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::CiscoVTP::GLOBALS,
%SNMP::Info::CiscoStack::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
%SNMP::Info::CiscoStats::GLOBALS,
%SNMP::Info::CiscoImage::GLOBALS,
'ports2' => 'ifNumber',
# these are in CISCO-STACK-MIB
'serial' => 'chassisSerialNumberString',
'ps1_type' => 'chassisPs1Type',
'ps1_status' => 'chassisPs1Status',
'ps2_type' => 'chassisPs2Type',
'ps2_status' => 'chassisPs2Status',
'fan' => 'chassisFanStatus'
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
'i_type2' => 'ifType',
# CISCO-STACK-MIB::portEntry
'p_name' => 'portName',
'p_type' => 'portType',
'p_status' => 'portOperStatus',
'p_status2' => 'portAdditionalStatus',
'p_speed' => 'portAdminSpeed',
'p_duplex' => 'portDuplex',
'p_port' => 'portIfIndex',
# CISCO-STACK-MIB::PortCpbEntry
'p_speed_admin' => 'portCpbSpeed',
'p_duplex_admin' => 'portCpbDuplex',
# CISCO-VTP-MIB::VtpVlanEntry
'v_state' => 'vtpVlanState',
'v_type' => 'vtpVlanType',
'v_name' => 'vtpVlanName',
'v_mtu' => 'vtpVlanMtu',
%SNMP::Info::CiscoVTP::FUNCS,
%SNMP::Info::CiscoStack::FUNCS,
%SNMP::Info::CDP::FUNCS,
%SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::CiscoImage::FUNCS,
);
%MUNGE = (
# Inherit all the built in munging
%SNMP::Info::Layer3::MUNGE,
'm_ports_status' => \&munge_port_status,
'p_duplex_admin' => \&SNMP::Info::munge_bits,
%SNMP::Info::CiscoVTP::MUNGE,
%SNMP::Info::CiscoStack::MUNGE,
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoStats::MUNGE,
%SNMP::Info::CiscoImage::MUNGE,
);
%PORTSTAT = (1 => 'other',
2 => 'ok',
3 => 'minorFault',
4 => 'majorFault');
# Pick and choose
# Changes binary byte describing each port into ascii, and returns
# an ascii list separated by spaces.
sub munge_port_status {
my $status = shift;
my @vals = map($PORTSTAT{$_},unpack('C*',$status));
return join(' ',@vals);
}
# Overidden Methods
sub i_type {
my $c3550 = shift;
my $p_port = $c3550->p_port();
my $p_type = $c3550->p_type();
# Get more generic port types from IF-MIB
my $i_type = $c3550->i_type2();
# Now Override w/ port entries
foreach my $port (keys %$p_type) {
my $iid = $p_port->{$port};
$i_type->{$iid} = $p_type->{$port};
}
return $i_type;
}
sub i_duplex {
my $c3550 = shift;
my $p_port = $c3550->p_port();
my $p_duplex = $c3550->p_duplex();
my %i_duplex;
foreach my $port (keys %$p_duplex) {
my $iid = $p_port->{$port};
$i_duplex{$iid} = $p_duplex->{$port};
}
return \%i_duplex;
}
sub i_duplex_admin {
my $c3550 = shift;
my $p_port = $c3550->p_port();
my $p_duplex_admin = $c3550->p_duplex_admin();
my %i_duplex_admin;
foreach my $port (keys %$p_duplex_admin) {
my $iid = $p_port->{$port};
next unless defined $iid;
my $duplex = $p_duplex_admin->{$port};
next unless defined $duplex;
my $string = 'other';
# see CISCO-STACK-MIB for a description of the bits
$string = 'half' if ($duplex =~ /001$/ or $duplex =~ /0100.$/);
$string = 'full' if ($duplex =~ /010$/ or $duplex =~ /100.0$/);
# we'll call it auto if both full and half are turned on, or if the
# specifically 'auto' flag bit is set.
$string = 'auto'
if ($duplex =~ /1..$/ or $duplex =~ /110..$/ or $duplex =~ /..011$/);
$i_duplex_admin{$iid} = $string;
}
return \%i_duplex_admin;
}
*SNMP::Info::Layer3::C3550::serial = \&SNMP::Info::CiscoStack::serial;
*SNMP::Info::Layer3::C3550::interfaces = \&SNMP::Info::Layer3::interfaces;
*SNMP::Info::Layer3::C3550::i_duplex = \&SNMP::Info::CiscoStack::i_duplex;
*SNMP::Info::Layer3::C3550::i_duplex_admin = \&SNMP::Info::CiscoStack::i_duplex_admin;
*SNMP::Info::Layer3::C3550::i_name = \&SNMP::Info::Layer3::i_name;
*SNMP::Info::Layer3::C3550::i_type = \&SNMP::Info::CiscoStack::i_type;
sub vendor {
return 'cisco';
@@ -173,10 +102,13 @@ sub vendor {
sub model {
my $c3550 = shift;
my $id = $c3550->id();
my $model = &SNMP::translateObj($id);
my $model = &SNMP::translateObj($id) || $id;
$model =~ s/^catalyst//;
$model =~ s/(24|48)$//;
# turn 355048 into 3550-48
if ($model =~ /^(35\d\d)(\d\d(T|G)?)$/) {
$model = "$1-$2";
}
return $model;
}
@@ -188,12 +120,17 @@ sub ports {
my $id = $c3550->id();
my $model = &SNMP::translateObj($id);
if ($model =~ /(24|48)$/) {
if ($model =~ /(12|24|48)(C|T|TS|G|TS-E|TS-S|T-E)?$/) {
return $1;
}
return $ports2;
}
sub cisco_comm_indexing {
1;
}
1;
__END__
@@ -203,7 +140,7 @@ SNMP::Info::Layer3::C3550 - Perl5 Interface to Cisco Catalyst 3550 Layer 2/3 Swi
=head1 AUTHOR
Max Baker (C<max@warped.org>)
Max Baker
=head1 SYNOPSIS
@@ -240,15 +177,35 @@ a more specific class using the method above.
=item SNMP::Info::Layer3
=item SNMP::Info::CiscoVTP
=item SNMP::Info::CiscoStack
=item SNMP::Info::CDP
=item SNMP::Info::CiscoStats
=item SNMP::Info::CiscoImage
=back
=head2 Required MIBs
=over
=item CISCO-STACK-MIB
=item Inherited Classes' MIBs
=item CISCO-VTP-MIB
See SNMP::Info::Layer3 for its own MIB requirements.
See SNMP::Info::CiscoVTP for its own MIB requirements.
See SNMP::Info::CiscoStack for its own MIB requirements.
See SNMP::Info::CiscoStats for its own MIB requirements.
See SNMP::Info::CiscoImage for its own MIB requirements.
See SNMP::Info::CDP for its own MIB requirements.
=back
@@ -258,146 +215,74 @@ These are methods that return scalar value from SNMP
=over
=item $c3550->serial()
(B<chassisSerialNumberString>)
=item $c3550->model()
(B<chassisModel>)
=item $c3550->ps1_type()
(B<chassisPs1Type>)
=item $c3550->ps2_type()
(B<chassisPs2Type>)
=item $c3550->ps1_status()
(B<chassisPs1Status>)
=item $c3550->ps2_status()
(B<chassisPs2Status>)
=item $c3550->slots()
(B<chassisNumSlots>)
=item $c3550->fan()
(B<chassisFanStatus>)
=item $c3550->vendor()
Returns 'cisco'
=item $c3550->model()
Will take the translated model number and try to format it better.
355048 -> 3550-48
355012G -> 3550-12G
=item $c3550->ports()
Trys to cull the number of ports from the model number.
=back
=head2 Globals imported from SNMP::Info::Layer3
See documentation in SNMP::Info::Layer3 for details.
=head2 Global Methods imported from SNMP::Info::CiscoVTP
See documentation in SNMP::Info::CiscoVTP for details.
=head2 Global Methods imported from SNMP::Info::CiscoStack
See documentation in SNMP::Info::CiscoStack for details.
=head2 Globals imported from SNMP::Info::CDP
See documentation in SNMP::Info::CDP for details.
=head2 Globals imported from SNMP::Info::CiscoStats
See documentation in SNMP::Info::CiscoStats for details.
=head2 Globals imported from SNMP::Info::CiscoImage
See documentation in SNMP::Info::CiscoImage 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 $c3550->i_type()
Crosses p_port() with p_type() and returns the results.
Overrides with ifType if p_type() isn't available.
=item $c3550->i_name()
Crosses p_name with p_port and returns results.
=item $c3550->i_duplex()
Crosses p_duplex with p_port and returns results.
=item $c3550->i_duplex_admin()
Crosses p_duplex_admin with p_port.
Munges bit_string returned from p_duplex_admin to get duplex settings.
=back
=head2 Port Entry Table (CISCO-STACK-MIB::portTable)
=over
=item $c3550->p_name()
(B<portName>)
=item $c3550->p_type()
(B<portType>)
=item $c3550->p_status()
(B<portOperStatus>)
=item $c3550->p_status2()
(B<portAdditionalStatus>)
=item $c3550->p_speed()
(B<portAdminSpeed>)
=item $c3550->p_duplex()
(B<portDuplex>)
=item $c3550->p_port()
(B<portIfIndex>)
=back
=head2 Port Capability Table (CISCO-STACK-MIB::portCpbTable)
=over
=item $c3550->p_speed_admin()
(B<portCpbSpeed>)
=item $c3550->p_duplex_admin()
(B<portCpbDuplex>)
=back
=head2 VLAN Entry Table
See ftp://ftp.cisco.com/pub/mibs/supportlists/wsc5000/wsc5000-communityIndexing.html
for a good treaty of how to connect to the VLANs
=over
=item $c3550->v_state()
(B<vtpVlanState>)
=item $c3550->v_type()
(B<vtpVlanType>)
=item $c3550->v_name()
(B<vtpVlanName>)
=item $c3550->v_mtu()
(B<vtpVlanMtu>)
=back
=head2 Table Methods imported from SNMP::Info::Layer3
See documentation in SNMP::Info::Layer3 for details.
=head2 Table Methods imported from SNMP::Info::CiscoVTP
See documentation in SNMP::Info::CiscoVTP for details.
=head2 Table Methods imported from SNMP::Info::CiscoStack
See documentation in SNMP::Info::CiscoStack for details.
=head2 Table Methods imported from SNMP::Info::CDP
See documentation in SNMP::Info::CDP for details.
=head2 Table Methods imported from SNMP::Info::CiscoStats
See documentation in SNMP::Info::CiscoStats for details.
=head2 Table Methods imported from SNMP::Info::CiscoImage
See documentation in SNMP::Info::CiscoImage for details.
=cut

245
Info/Layer3/C4000.pm Normal file
View File

@@ -0,0 +1,245 @@
# SNMP::Info::Layer3::C4000
# Bill Fenner
#
# Copyright (c) 2006 Bill Fenner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of the Author, nor
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer3::C4000;
# $Id$
use strict;
use Exporter;
use SNMP::Info::Layer3;
use SNMP::Info::CiscoVTP;
use SNMP::Info::CDP;
use SNMP::Info::CiscoStats;
use SNMP::Info::CiscoImage;
use SNMP::Info::MAU;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
$VERSION = '1.04';
@SNMP::Info::Layer3::C4000::ISA = qw/ SNMP::Info::Layer3 SNMP::Info::CiscoVTP
SNMP::Info::CiscoStats SNMP::Info::CDP
SNMP::Info::CiscoImage SNMP::Info::MAU Exporter/;
@SNMP::Info::Layer3::C4000::EXPORT_OK = qw//;
%MIBS = (
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::CiscoVTP::MIBS,
%SNMP::Info::CDP::MIBS,
%SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::CiscoImage::MIBS,
%SNMP::Info::MAU::MIBS,
'CISCO-ENVMON-MIB' => 'ciscoEnvMonMIB',
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::CiscoVTP::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
%SNMP::Info::CiscoStats::GLOBALS,
%SNMP::Info::CiscoImage::GLOBALS,
%SNMP::Info::MAU::GLOBALS,
'ps1_type' => 'ciscoEnvMonSupplyStatusDescr.1',
'ps1_status' => 'ciscoEnvMonSupplyState.1',
'ps2_type' => 'ciscoEnvMonSupplyStatusDescr.2',
'ps2_status' => 'ciscoEnvMonSupplyState.2',
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::CiscoVTP::FUNCS,
%SNMP::Info::CDP::FUNCS,
%SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::CiscoImage::FUNCS,
%SNMP::Info::MAU::FUNCS,
'fan_state' => 'ciscoEnvMonFanState',
'fan_descr' => 'ciscoEnvMonFanStatusDescr',
);
%MUNGE = (
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE,
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoStats::MUNGE,
%SNMP::Info::CiscoImage::MUNGE,
%SNMP::Info::MAU::MUNGE,
);
# use MAU-MIB for admin. duplex and admin. speed
*SNMP::Info::Layer3::C4000::i_duplex_admin = \&SNMP::Info::MAU::mau_i_duplex_admin;
*SNMP::Info::Layer3::C4000::i_speed_admin = \&SNMP::Info::MAU::mau_i_speed_admin;
sub fan {
my $c4000 = shift;
my $fan_state = $c4000->fan_state();
my $fan_descr = $c4000->fan_descr();
my $ret = "";
my $s = "";
foreach my $i (sort {$a <=> $b} keys %$fan_state) {
$ret .= $s . $fan_descr->{$i} . ": " . $fan_state->{$i};
$s = ", ";
}
return undef if ($s eq "");
$ret;
}
sub cisco_comm_indexing { 1; }
1;
__END__
=head1 NAME
SNMP::Info::Layer3::C4000 - Perl5 Interface to Cisco Catalyst 4000 Layer 2/3 Switches running IOS
=head1 AUTHOR
Bill Fenner
=head1 SYNOPSIS
# Let SNMP::Info determine the correct subclass for you.
my $c4000 = 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 = $c4000->class();
print "SNMP::Info determined this device to fall under subclass : $class\n";
=head1 DESCRIPTION
Abstraction subclass for Cisco Catalyst 4000 Layer 2/3 Switches.
For speed or debugging purposes you can call the subclass directly, but not after determining
a more specific class using the method above.
my $c4000 = new SNMP::Info::Layer3::C4000(...);
=head2 Inherited Classes
=over
=item SNMP::Info::Layer3
=item SNMP::Info::CiscoVTP
=item SNMP::Info::CiscoStats
=item SNMP::Info::CDP
=item SNMP::Info::CiscoImage
=item SNMP::Info::MAU
=back
=head2 Required MIBs
=over
=item Inherited Classes' MIBs
See SNMP::Info::Layer3 for its own MIB requirements.
See SNMP::Info::CiscoVTP for its own MIB requirements.
See SNMP::Info::CiscoStats for its own MIB requirements.
See SNMP::Info::CDP for its own MIB requirements.
See SNMP::Info::CiscoImage for its own MIB requirements.
See SNMP::Info::MAU for its own MIB requirements.
=back
=head1 GLOBALS
These are methods that return scalar value from SNMP
=head2 Globals imported from SNMP::Info::Layer3
See documentation in SNMP::Info::Layer3 for details.
=head2 Global Methods imported from SNMP::Info::CiscoVTP
See documentation in SNMP::Info::CiscoVTP for details.
=head2 Globals imported from SNMP::Info::CDP
See documentation in SNMP::Info::CDP for details.
=head2 Globals imported from SNMP::Info::CiscoStats
See documentation in SNMP::Info::CiscoStats for details.
=head2 Globals imported from SNMP::Info::CiscoImage
See documentation in SNMP::Info::CiscoImage for details.
=head2 Globals imported from SNMP::Info::MAU
See documentation in SNMP::Info::MAU for details.
=head1 TABLE ENTRIES
These are methods that return tables of information in the form of a reference
to a hash.
=head2 Table Methods imported from SNMP::Info::Layer3
See documentation in SNMP::Info::Layer3 for details.
=head2 Table Methods imported from SNMP::Info::CiscoVTP
See documentation in SNMP::Info::CiscoVTP for details.
=head2 Table Methods imported from SNMP::Info::CDP
See documentation in SNMP::Info::CDP for details.
=head2 Table Methods imported from SNMP::Info::CiscoStats
See documentation in SNMP::Info::CiscoStats for details.
=head2 Table Methods imported from SNMP::Info::CiscoImage
See documentation in SNMP::Info::CiscoImage for details.
=head2 Table Methods imported from SNMP::Info::MAU
See documentation in SNMP::Info::MAU for details.
=cut

252
Info/Layer3/C6500.pm Normal file
View File

@@ -0,0 +1,252 @@
# SNMP::Info::Layer3::C6500
# Max Baker
#
# Copyright (c) 2003,2004,2005 Max Baker
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of the Author, nor
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer3::C6500;
# $Id$
use strict;
use Exporter;
use SNMP::Info::Layer3;
use SNMP::Info::CiscoVTP;
use SNMP::Info::CiscoStack;
use SNMP::Info::CDP;
use SNMP::Info::CiscoStats;
use SNMP::Info::CiscoImage;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
$VERSION = '1.04';
@SNMP::Info::Layer3::C6500::ISA = qw/ SNMP::Info::Layer3 SNMP::Info::CiscoStack SNMP::Info::CiscoVTP
SNMP::Info::CiscoStats SNMP::Info::CDP Exporter
SNMP::Info::CiscoImage/;
@SNMP::Info::Layer3::C6500::EXPORT_OK = qw//;
%MIBS = (
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::CiscoVTP::MIBS,
%SNMP::Info::CiscoStack::MIBS,
%SNMP::Info::CDP::MIBS,
%SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::CiscoImage::MIBS,
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::CiscoVTP::GLOBALS,
%SNMP::Info::CiscoStack::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
%SNMP::Info::CiscoStats::GLOBALS,
%SNMP::Info::CiscoImage::GLOBALS,
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::CiscoVTP::FUNCS,
%SNMP::Info::CiscoStack::FUNCS,
%SNMP::Info::CDP::FUNCS,
%SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::CiscoImage::FUNCS,
);
%MUNGE = (
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE,
%SNMP::Info::CiscoStack::MUNGE,
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoStats::MUNGE,
%SNMP::Info::CiscoImage::MUNGE,
);
# Pick and choose
*SNMP::Info::Layer3::C6500::serial = \&SNMP::Info::CiscoStack::serial;
*SNMP::Info::Layer3::C6500::interfaces = \&SNMP::Info::Layer3::interfaces;
*SNMP::Info::Layer3::C6500::i_duplex = \&SNMP::Info::CiscoStack::i_duplex;
#*SNMP::Info::Layer3::C6500::i_duplex_admin = \&SNMP::Info::Layer3::i_duplex_admin;
*SNMP::Info::Layer3::C6500::i_name = \&SNMP::Info::Layer3::i_name;
*SNMP::Info::Layer3::C6500::i_type = \&SNMP::Info::CiscoStack::i_type;
sub vendor {
return 'cisco';
}
# There are some buggy 6509's out there.
sub bulkwalk_no { 1; }
sub cisco_comm_indexing { 1; }
1;
__END__
=head1 NAME
SNMP::Info::Layer3::C6500 - Perl5 Interface to Cisco Catalyst 6500 Layer 2/3 Switches running IOS and/or CatOS
=head1 AUTHOR
Max Baker
=head1 SYNOPSIS
# Let SNMP::Info determine the correct subclass for you.
my $c6500 = new SNMP::Info(
AutoSpecify => 1,
Debug => 1,
# These arguments are passed directly on to SNMP::Session
DestHost => 'myswitch',
Community => 'public',
Version => 2
)
or die "Can't connect to DestHost.\n";
my $class = $c6500->class();
print "SNMP::Info determined this device to fall under subclass : $class\n";
=head1 DESCRIPTION
Abstraction subclass for Cisco Catalyst 6500 Layer 2/3 Switches.
These devices run IOS but have some of the same charactersitics as the Catalyst WS-C family (5xxx).
For example, forwarding tables are held in VLANs, and extened interface information
is gleened from CISCO-SWITCH-MIB.
For speed or debugging purposes you can call the subclass directly, but not after determining
a more specific class using the method above.
my $c6500 = new SNMP::Info::Layer3::C6500(...);
=head2 Inherited Classes
=over
=item SNMP::Info::Layer3
=item SNMP::Info::CiscoVTP
=item SNMP::Info::CiscoStack
=item SNMP::Info::CiscoStats
=item SNMP::Info::CDP
=item SNMP::Info::CiscoImage
=back
=head2 Required MIBs
=over
=item Inherited Classes' MIBs
See SNMP::Info::Layer3 for its own MIB requirements.
See SNMP::Info::CiscoVTP for its own MIB requirements.
See SNMP::Info::CiscoStack for its own MIB requirements.
See SNMP::Info::CiscoStats for its own MIB requirements.
See SNMP::Info::CDP for its own MIB requirements.
See SNMP::Info::CiscoImage for its own MIB requirements.
=back
=head1 GLOBALS
These are methods that return scalar value from SNMP
=over
=item $c6500->bulkwalk_no
Return C<1>. There are some buggy 6509's out there, so bulkwalk
is turned off for this class.
=item $c6500->vendor()
Returns 'cisco'
=back
=head2 Globals imported from SNMP::Info::Layer3
See documentation in SNMP::Info::Layer3 for details.
=head2 Global Methods imported from SNMP::Info::CiscoVTP
See documentation in SNMP::Info::CiscoVTP for details.
=head2 Global Methods imported from SNMP::Info::CiscoStack
See documentation in SNMP::Info::CiscoStack for details.
=head2 Globals imported from SNMP::Info::CDP
See documentation in SNMP::Info::CDP for details.
=head2 Globals imported from SNMP::Info::CiscoStats
See documentation in SNMP::Info::CiscoStats for details.
=head2 Globals imported from SNMP::Info::CiscoImage
See documentation in SNMP::Info::CiscoImage for details.
=head1 TABLE ENTRIES
These are methods that return tables of information in the form of a reference
to a hash.
=head2 Table Methods imported from SNMP::Info::Layer3
See documentation in SNMP::Info::Layer3 for details.
=head2 Table Methods imported from SNMP::Info::CiscoVTP
See documentation in SNMP::Info::CiscoVTP for details.
=head2 Table Methods imported from SNMP::Info::CiscoStack
See documentation in SNMP::Info::CiscoStack for details.
=head2 Table Methods imported from SNMP::Info::CDP
See documentation in SNMP::Info::CDP for details.
=head2 Table Methods imported from SNMP::Info::CiscoStats
See documentation in SNMP::Info::CiscoStats for details.
=head2 Table Methods imported from SNMP::Info::CiscoImage
See documentation in SNMP::Info::CiscoImage for details.
=cut

214
Info/Layer3/Cisco.pm Normal file
View File

@@ -0,0 +1,214 @@
# SNMP::Info::Layer3::Cisco
# Max Baker
#
# Copyright (c) 2004-6 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;
# $Id$
use strict;
use Exporter;
use SNMP::Info::Layer3;
use SNMP::Info::CiscoVTP;
use SNMP::Info::CDP;
use SNMP::Info::CiscoStats;
use SNMP::Info::CiscoImage;
use SNMP::Info::CiscoRTT;
use SNMP::Info::CiscoQOS;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
$VERSION = '1.04';
@SNMP::Info::Layer3::Cisco::ISA = qw/SNMP::Info::Layer3 SNMP::Info::CiscoVTP
SNMP::Info::CDP SNMP::Info::CiscoStats
SNMP::Info::CiscoImage SNMP::Info::CiscoRTT
SNMP::Info::CiscoQOS Exporter/;
@SNMP::Info::Layer3::Cisco::EXPORT_OK = qw//;
%MIBS = (
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::CiscoVTP::MIBS,
%SNMP::Info::CDP::MIBS,
%SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::CiscoImage::MIBS,
%SNMP::Info::CiscoRTT::MIBS,
%SNMP::Info::CiscoQOS::MIBS,
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::CiscoVTP::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
%SNMP::Info::CiscoStats::GLOBALS,
%SNMP::Info::CiscoImage::GLOBALS,
%SNMP::Info::CiscoRTT::GLOBALS,
%SNMP::Info::CiscoQOS::GLOBALS,
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::CiscoVTP::FUNCS,
%SNMP::Info::CDP::FUNCS,
%SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::CiscoImage::FUNCS,
%SNMP::Info::CiscoRTT::FUNCS,
%SNMP::Info::CiscoQOS::FUNCS,
);
%MUNGE = (
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE,
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoStats::MUNGE,
%SNMP::Info::CiscoImage::MUNGE,
%SNMP::Info::CiscoRTT::MUNGE,
%SNMP::Info::CiscoQOS::MUNGE,
);
1;
__END__
=head1 NAME
SNMP::Info::Layer3::Cisco - Perl5 Interface to L3 and L2+L3 IOS Cisco Device
that are not covered in other classes.
=head1 AUTHOR
Max Baker
=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
=item SNMP::Info::CDP
=item SNMP::Info::CiscoStats
=item SNMP::Info::CiscoImage
=back
=head2 Required MIBs
=over
=item Inherited Classes' MIBs
See SNMP::Info::Layer3 for its own MIB requirements.
See SNMP::Info::CiscoVTP for its own MIB requirements.
See SNMP::Info::CiscoStats for its own MIB requirements.
See SNMP::Info::CDP for its own MIB requirements.
See SNMP::Info::CiscoImage 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.
=head2 Globals imported from SNMP::Info::CDP
See documentation in SNMP::Info::CDP for details.
=head2 Globals imported from SNMP::Info::CiscoStats
See documentation in SNMP::Info::CiscoStats for details.
=head2 Globals imported from SNMP::Info::CiscoImage
See documentation in SNMP::Info::CiscoImage for details.
=head1 TABLE ENTRIES
These are methods that return tables of information in the form of a reference
to a hash.
=head2 Table Methods imported from SNMP::Info::Layer3
See documentation in SNMP::Info::Layer3 for details.
=head2 Table Methods imported from SNMP::Info::CiscoVTP
See documentation in SNMP::Info::CiscoVTP for details.
=head2 Table Methods imported from SNMP::Info::CDP
See documentation in SNMP::Info::CDP for details.
=head2 Table Methods imported from SNMP::Info::CiscoStats
See documentation in SNMP::Info::CiscoStats for details.
=head2 Table Methods imported from SNMP::Info::CiscoImage
See documentation in SNMP::Info::CiscoImage for details.
=cut

322
Info/Layer3/Contivity.pm Normal file
View File

@@ -0,0 +1,322 @@
# SNMP::Info::Layer3::Contivity
# Eric Miller
# $Id$
#
# Copyright (c) 2004 Eric Miller, 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 = '1.04';
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//;
%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;
}
1;
__END__
=head1 NAME
SNMP::Info::Layer3::Contivity - Perl5 Interface to Nortel Networks' Contivity
Extranet Switches (CES).
=head1 AUTHOR
Eric Miller
=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.
=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

331
Info/Layer3/Extreme.pm Normal file
View File

@@ -0,0 +1,331 @@
# SNMP::Info::Layer3::Extreme - SNMP Interface to Extreme devices
# Eric Miller
#
# Copyright (c) 2005 Eric Miller
#
# 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::Layer3::Extreme;
# $Id$
use strict;
use Exporter;
use SNMP::Info::Layer3;
use SNMP::Info::MAU;
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
$VERSION = '1.04';
@SNMP::Info::Layer3::Extreme::ISA = qw/SNMP::Info::Layer3 SNMP::Info::MAU Exporter/;
@SNMP::Info::Layer3::Extreme::EXPORT_OK = qw//;
%MIBS = ( %SNMP::Info::Layer3::MIBS,
%SNMP::Info::MAU::MIBS,
'EXTREME-BASE-MIB' => 'extremeAgent',
'EXTREME-SYSTEM-MIB' => 'extremeSystem',
'EXTREME-FDB-MIB' => 'extremeSystem',
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::MAU::GLOBALS,
'serial' => 'extremeSystemID',
'temp' => 'extremeCurrentTemperature',
'ps1_status' => 'extremePowerSupplyStatus.1',
'fan' => 'extremeFanOperational.1',
'mac' => 'dot1dBaseBridgeAddress',
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::MAU::FUNCS,
# EXTREME-FDB-MIB:extremeFdbMacFdbTable
'fw_mac' => 'extremeFdbMacFdbMacAddress',
'fw_port' => 'extremeFdbMacFdbPortIfIndex',
'fw_status' => 'extremeFdbMacFdbStatus',
);
%MUNGE = (
# Inherit all the built in munging
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::MAU::MUNGE,
);
# Method OverRides
sub bulkwalk_no { 1; }
*SNMP::Info::Layer3::Extreme::i_duplex = \&SNMP::Info::MAU::mau_i_duplex;
*SNMP::Info::Layer3::Extreme::i_duplex_admin = \&SNMP::Info::MAU::mau_i_duplex_admin;
sub model {
my $extreme = shift;
my $id = $extreme->id();
unless (defined $id){
print " SNMP::Info::Layer3::Extreme::model() - Device does not support sysObjectID\n" if $extreme->debug();
return undef;
}
my $model = &SNMP::translateObj($id);
return $id unless defined $model;
return $model;
}
sub vendor {
return 'extreme';
}
sub os {
return 'extreme';
}
sub os_ver {
my $extreme = shift;
my $descr = $extreme->description();
return undef unless defined $descr;
if ($descr =~ m/Version ([\d.]*)/){
return $1;
}
return undef;
}
# We're not using BRIDGE-MIB
sub bp_index {
my $extreme = shift;
my $if_index = $extreme->i_index();
my %bp_index;
foreach my $iid (keys %$if_index){
$bp_index{$iid} = $iid;
}
return \%bp_index;
}
# Index values in the Q-BRIDGE-MIB are the same
# as in the BRIDGE-MIB and do not match ifIndex.
sub i_vlan {
my $extreme = shift;
my $qb_i_vlan = $extreme->qb_i_vlan();
my $bp_index = $extreme->bp_index();
my %i_vlan;
foreach my $v_index (keys %$qb_i_vlan){
my $vlan = $qb_i_vlan->{$v_index};
my $iid = $bp_index->{$v_index};
unless (defined $iid) {
print " Port $v_index has no bp_index mapping. Skipping\n"
if $DEBUG;
next;
}
$i_vlan{$iid}=$vlan;
}
return \%i_vlan;
}
1;
__END__
=head1 NAME
SNMP::Info::Layer3::Extreme - Perl5 Interface to Extreme Network Devices
=head1 AUTHOR
Eric Miller
=head1 SYNOPSIS
# Let SNMP::Info determine the correct subclass for you.
my $extreme = new SNMP::Info(
AutoSpecify => 1,
Debug => 1,
# These arguments are passed directly on to SNMP::Session
DestHost => 'myswitch',
Community => 'public',
Version => 1
)
or die "Can't connect to DestHost.\n";
my $class = $extreme->class();
print "SNMP::Info determined this device to fall under subclass : $class\n";
=head1 DESCRIPTION
Provides abstraction to the configuration information obtainable from an
Extreme 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 $extreme = new SNMP::Info::Layer3::Extreme(...);
=head2 Inherited Classes
=over
=item SNMP::Info::Layer3
=item SNMP::Info::MAU
=back
=head2 Required MIBs
=over
=item EXTREME-BASE-MIB
=item EXTREME-SYSTEM-MIB
=item EXTREME-FDB-MIB
=item Inherited Classes' MIBs
See classes listed above for their required MIBs.
=back
=head1 GLOBALS
These are methods that return scalar value from SNMP
=over
=item $extreme->bulkwalk_no
Return C<1>. Bulkwalk is currently turned off for this class.
=item $extreme->model()
Returns model type. Checks $extreme->id() against the EXTREME-BASE-MIB.
=item $extreme->vendor()
Returns extreme
=item $extreme->os()
Returns extreme
=item $extreme->serial()
Returns serial number
(B<extremeSystemID>)
=item $extreme->temp()
Returns system temperature
(B<extremeCurrentTemperature>)
=item $extreme->ps1_status()
Returns status of power supply 1
(B<extremePowerSupplyStatus.1>)
=item $extreme->fan()
Returns fan status
(B<extremeFanOperational.1>)
=item $extreme->mac()
Returns base mac
(B<dot1dBaseBridgeAddress>)
=back
=head2 Overrides
=over
=back
=head2 Globals imported from SNMP::Info::Layer3
See documentation in SNMP::Info::Layer3 for details.
=head2 Globals imported from SNMP::Info::MAU
See documentation in SNMP::Info::MAU 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 $extreme->fw_mac()
(B<extremeFdbMacFdbMacAddress>)
=item $extreme->fw_port()
(B<extremeFdbMacFdbPortIfIndex>)
=item $extreme->fw_status()
(B<extremeFdbMacFdbStatus>)
=item $extreme->i_vlan()
Returns a mapping between ifIndex and the VLAN.
=item $stack->bp_index()
Returns reference to hash of bridge port table entries map back to interface identifier (iid)
Returns (B<ifIndex>) for both key and value since we're using EXTREME-FDB-MIB
rather than BRIDGE-MIB.
=back
=head2 Table Methods imported from SNMP::Info::Layer3
See documentation in SNMP::Info::Layer3 for details.
=head2 Table Methods imported from SNMP::Info::MAU
See documentation in SNMP::Info::MAU for details.
=cut

View File

@@ -1,5 +1,7 @@
# SNMP::Info::Layer3::Foundry - SNMP Interface to Foundry devices
# Max Baker <max@warped.org>
# Max Baker
#
# Copyright (c) 2004,2005 Max Baker changes from version 0.8 and beyond.
#
# Copyright (c) 2002,2003 Regents of the University of California
# All rights reserved.
@@ -28,28 +30,25 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer3::Foundry;
$VERSION = 0.4;
# $Id$
use strict;
use Exporter;
use SNMP::Info;
use SNMP::Info::Bridge;
use SNMP::Info::Layer3;
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/;
$VERSION = '1.04';
@SNMP::Info::Layer3::Foundry::ISA = qw/SNMP::Info::Layer3 SNMP::Info::FDP Exporter/;
@SNMP::Info::Layer3::Foundry::EXPORT_OK = qw//;
$DEBUG=0;
$SNMP::debugging=$DEBUG;
$INIT = 0;
%MIBS = ( %SNMP::Info::MIBS,
%SNMP::Info::Bridge::MIBS,
%MIBS = ( %SNMP::Info::Layer3::MIBS,
%SNMP::Info::FDP::MIBS,
'FOUNDRY-SN-ROOT-MIB' => 'foundry',
'FOUNDRY-SN-AGENT-MIB' => 'snChasPwrSupplyDescription',
# IP-FORWARD-MIB
# ETHERLIKE-MIB
# RFC1398-MIB
@@ -58,9 +57,8 @@ $INIT = 0;
);
%GLOBALS = (
# Inherit the super class ones
%SNMP::Info::GLOBALS,
%SNMP::Info::Bridge::GLOBALS,
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::FDP::GLOBALS,
'mac' => 'ifPhysAddress.1',
'chassis' => 'entPhysicalDescr.1',
'serial' => 'snChasSerNum',
@@ -76,13 +74,9 @@ $INIT = 0;
);
%FUNCS = (
%SNMP::Info::FUNCS,
%SNMP::Info::Bridge::FUNCS,
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::FDP::FUNCS,
'i_name2' => 'ifName',
# From RFC1213-MIB
'at_index' => 'ipNetToMediaIfIndex',
'at_paddr' => 'ipNetToMediaPhysAddress',
'at_netaddr' => 'ipNetToMediaNetAddress',
# FOUNDRY-MIB
# snSwPortInfoTable - Switch Port Information Group
'sw_index' => 'snSwPortIfIndex',
@@ -93,14 +87,16 @@ $INIT = 0;
%MUNGE = (
# Inherit all the built in munging
%SNMP::Info::MUNGE,
%SNMP::Info::Bridge::MUNGE,
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::FDP::MUNGE,
'at_paddr' => \&SNMP::Info::munge_mac,
);
# Method OverRides
sub bulkwalk_no { 1; }
# Add our i_aliases if they are set (manually)
sub i_name {
my $foundry = shift;
@@ -139,6 +135,10 @@ sub i_duplex {
my $sw_index = $foundry->sw_index();
my $sw_duplex= $foundry->sw_duplex();
unless (defined $sw_index and defined $sw_duplex){
return $foundry->SUPER::i_duplex();
}
my %i_duplex;
foreach my $sw_port (keys %$sw_duplex){
my $iid = $sw_index->{$sw_port};
@@ -155,6 +155,10 @@ sub i_type {
my $sw_index = $foundry->sw_index();
my $sw_type= $foundry->sw_type();
unless (defined $sw_index and defined $sw_type){
return $foundry->SUPER::i_type();
}
my %i_type;
foreach my $sw_port (keys %$sw_type){
my $iid = $sw_index->{$sw_port};
@@ -170,6 +174,10 @@ sub i_speed {
my $sw_index = $foundry->sw_index();
my $sw_speed= $foundry->sw_speed();
unless (defined $sw_index and defined $sw_speed){
return $foundry->SUPER::i_speed();
}
my %i_speed;
foreach my $sw_port (keys %$sw_speed){
my $iid = $sw_index->{$sw_port};
@@ -194,11 +202,35 @@ sub model {
my $model = &SNMP::translateObj($id);
$model = $1 if $desc =~ /\s+([a-z]{2}\d{4})\D/i;
$model = $1 if $desc =~ /\b(FW[A-Z\d]+)/;
$model =~ s/^sn//;
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;
@@ -217,6 +249,7 @@ sub interfaces {
sub vendor {
return 'foundry';
}
1;
__END__
@@ -226,7 +259,7 @@ SNMP::Info::Layer3::Foundry - Perl5 Interface to Foundry FastIron Network Device
=head1 AUTHOR
Max Baker (C<max@warped.org>)
Max Baker
=head1 SYNOPSIS
@@ -242,15 +275,14 @@ Max Baker (C<max@warped.org>)
or die "Can't connect to DestHost.\n";
my $class = $foundry->class();
print "SNMP::Info determined this device to fall under subclass : $class\n";
=head1 DESCRIPTION
This subclass no longer supported.
This module provides limited functionality from some L2+L3 and L3 Foundry devices.
This module provides limited functionality from older Foundry devices.
Specifically designed for a FI4802.
Specifically designed for a FI4802. Works on a FWSX424.
For speed or debugging purposes you can call the subclass directly, but not after determining
a more specific class using the method above. Turn off the AutoSpecify flag.
@@ -263,7 +295,6 @@ a more specific class using the method above. Turn off the AutoSpecify flag.
=item SNMP::Info
=item SNMP::Info::Bridge
=back
@@ -344,10 +375,6 @@ Returns the status of the chassis fan.
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
@@ -453,8 +480,4 @@ Returns reference to hash. Current Port Speed.
See documentation in SNMP::Info for details.
=head2 Table Methods imported from SNMP::Info::Bridge
See documentation in SNMP::Info::Bridge for details.
=cut

181
Info/Layer3/Juniper.pm Normal file
View File

@@ -0,0 +1,181 @@
# SNMP::Info::Layer3::Juniper
# Bill Fenner
#
#
# 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::Juniper;
# $Id$
use Exporter;
use SNMP::Info::Layer3;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
$VERSION = '1.04';
@SNMP::Info::Layer3::Juniper::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::Juniper::EXPORT_OK = qw//;
%MIBS = (
%SNMP::Info::Layer3::MIBS,
'JUNIPER-CHASSIS-DEFINES-MIB' => 'jnxChassisDefines',
'JUNIPER-MIB' => 'jnxBoxAnatomy',
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
'serial' => 'jnxBoxSerialNo.0',
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
);
%MUNGE = (
%SNMP::Info::Layer3::MUNGE,
);
sub vendor {
return 'juniper';
}
sub os {
return 'junos';
}
sub os_ver {
my $juniper = shift;
my $descr = $juniper->description();
return undef unless defined $descr;
if ($descr =~ m/kernel JUNOS (\S+)/) {
return $1;
}
return undef;
}
sub model {
my $l3 = shift;
my $id = $l3->id();
unless (defined $id){
print " SNMP::Info::Layer3::Juniper::model() - Device does not support sysObjectID\n" if $l3->debug();
return undef;
}
my $model = &SNMP::translateObj($id);
return $id unless defined $model;
$model =~ s/^jnxProductName//i;
return $model;
}
1;
__END__
=head1 NAME
SNMP::Info::Layer3::Juniper - Perl5 Interface to L3 Juniper Devices
=head1 AUTHOR
Bill Fenner
=head1 SYNOPSIS
# Let SNMP::Info determine the correct subclass for you.
my $juniper = new SNMP::Info(
AutoSpecify => 1,
Debug => 1,
# These arguments are passed directly on to SNMP::Session
DestHost => 'myrouter',
Community => 'public',
Version => 2
)
or die "Can't connect to DestHost.\n";
my $class = $juniper->class();
print "SNMP::Info determined this device to fall under subclass : $class\n";
=head1 DESCRIPTION
Subclass for Generic Juniper Routers running JUNOS
=head2 Inherited Classes
=over
=item SNMP::Info::Layer3
=back
=head2 Required MIBs
=over
=item Inherited Classes' MIBs
See L<SNMP::Info::Layer3> for its own MIB requirements.
=back
=head1 GLOBALS
These are methods that return scalar value from SNMP
=over
=item $juniper->vendor()
Returns 'juniper'
=item $juniper->os()
Returns 'junos'
=item $juniper->os_ver()
Returns the software version extracted from sysDescr.
=item $juniper->model()
Returns the model from sysObjectID, with jnxProductName
removed from the beginning.
=back
=head2 Globals imported from SNMP::Info::Layer3
See documentation in L<SNMP::Info::Layer3> 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 L<SNMP::Info::Layer3> for details.
=cut

320
Info/Layer3/N1600.pm Normal file
View File

@@ -0,0 +1,320 @@
# SNMP::Info::Layer3::N1600 - SNMP Interface to Nortel N16XX devices
# Eric Miller
#
# Copyright (c) 2004,2005 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::Layer3::N1600;
# $Id$
use strict;
use Exporter;
use SNMP::Info::Layer3;
use SNMP::Info::SONMP;
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
$VERSION = '1.04';
@SNMP::Info::Layer3::N1600::ISA = qw/SNMP::Info::Layer3 SNMP::Info::SONMP Exporter/;
@SNMP::Info::Layer3::N1600::EXPORT_OK = qw//;
%MIBS = ( %SNMP::Info::Layer3::MIBS,
%SNMP::Info::SONMP::MIBS,
'SWL2MGMT-MIB' => 'swL2MgmtMIB',
'RAPID-CITY' => 'rapidCity',
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::SONMP::GLOBALS,
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::SONMP::FUNCS,
# SWL2MGMT-MIB
# swL2PortInfoTable
'n1600_nway_status' => 'swL2PortInfoNwayStatus',
# swL2PortCtrlTable
'n1600_nway_state' => 'swL2PortCtrlNwayState',
);
%MUNGE = (
# Inherit all the built in munging
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::SONMP::MUNGE,
);
# Method OverRides
sub bulkwalk_no { 1; }
sub model {
my $n1600 = shift;
my $id = $n1600->id();
unless (defined $id){
print " SNMP::Info::Layer3::N1600::model() - Device does not support sysObjectID\n" if $n1600->debug();
return undef;
}
my $model = &SNMP::translateObj($id);
return $id unless defined $model;
$model =~ s/^rcA//i;
return $model;
}
sub vendor {
return 'nortel';
}
sub os {
return 'passport';
}
sub os_ver {
my $n1600 = shift;
my $descr = $n1600->description();
return undef unless defined $descr;
if ($descr =~ m/(\d+\.\d+\.\d+\.\d+)/){
return $1;
}
return undef;
}
sub interfaces {
my $n1600 = shift;
my $i_index = $n1600->i_index();
my %if;
foreach my $iid (keys %$i_index){
my $index = $i_index->{$iid};
next unless defined $index;
my $slotport = "1.$index";
$if{$iid} = $slotport;
}
return \%if;
}
sub i_duplex {
my $n1600 = shift;
my $nway_status = $n1600->n1600_nway_status();
my %i_duplex;
foreach my $iid (keys %$nway_status){
my $duplex = $nway_status->{$iid};
next unless defined $duplex;
next if $duplex =~ /other/i;
$i_duplex{$iid} = 'half' if $duplex =~ /half/i;
$i_duplex{$iid} = 'full' if $duplex =~ /full/i;
}
return \%i_duplex;
}
sub i_duplex_admin {
my $n1600 = shift;
my $nway_state = $n1600->n1600_nway_state();
my %i_duplex;
foreach my $iid (keys %$nway_state){
my $duplex = $nway_state->{$iid};
next unless defined $duplex;
next if $duplex =~ /other/i;
$i_duplex{$iid} = 'half' if $duplex =~ /half/i;
$i_duplex{$iid} = 'full' if $duplex =~ /full/i;
$i_duplex{$iid} = 'auto' if $duplex =~ /nway-enabled/i;
}
return \%i_duplex;
}
# Required for SNMP::Info::SONMP
sub index_factor {
return 64;
}
1;
__END__
=head1 NAME
SNMP::Info::Layer3::N1600 - Perl5 Interface to Nortel 16XX Network Devices
=head1 AUTHOR
Eric Miller
=head1 SYNOPSIS
# Let SNMP::Info determine the correct subclass for you.
my $n1600 = new SNMP::Info(
AutoSpecify => 1,
Debug => 1,
# These arguments are passed directly on to SNMP::Session
DestHost => 'myswitch',
Community => 'public',
Version => 1
)
or die "Can't connect to DestHost.\n";
my $class = $n1600->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
N16XX 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 $n1600 = new SNMP::Info::Layer3::N1600(...);
=head2 Inherited Classes
=over
=item SNMP::Info::Layer3
=item SNMP::Info::SONMP
=back
=head2 Required MIBs
=over
=item SWL2MGMT-MIB
=item RAPID-CITY
=item Inherited Classes' MIBs
See classes listed above for their required MIBs.
=back
MIBs can be found on the CD that came with your product.
Or, they can be downloaded directly from Nortel regardless of support
contract status.
Go to http://www.nortel.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.
=head1 GLOBALS
These are methods that return scalar value from SNMP
=over
=item $n1600->bulkwalk_no
Return C<1>. Bulkwalk is currently turned off for this class.
=item $n1600->model()
Returns model type. Checks $n1600->id() against the
RAPID-CITY-MIB and then parses out rcA.
=item $n1600->vendor()
Returns 'nortel'
=item $n1600->os()
Returns 'passport'
=back
=head2 Overrides
=over
=item $n1600->index_factor()
Required by SNMP::Info::SONMP. Number representing the number of ports
reserved per slot within the device MIB.
Returns 64 since largest switch has 48 ports. Since these switches can
not stack, the only requirment to reserve more than the max number of ports.
=back
=head2 Globals imported from SNMP::Info::Layer3
See documentation in SNMP::Info::Layer3 for details.
=head2 Globals imported from SNMP::Info::SONMP
See documentation in SNMP::SONMP::Layer3 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 $n1600->interfaces()
Returns reference to hash of interface names to iids.
Places a 1 in front of index number. This is required for compatibilty with
SNMP::Info::SONMP.
=item $n1600->i_duplex()
Returns reference to hash of interface operational link duplex status.
=item $n1600->i_duplex_admin()
Returns reference to hash of interface administrative link duplex status.
=back
=head2 Table Methods imported from SNMP::Info::Layer3
See documentation in SNMP::Info::Layer3 for details.
=head2 Table Methods imported from SNMP::Info::SONMP
See documentation in SNMP::Info::SONMP for details.
=cut

710
Info/Layer3/Passport.pm Normal file
View File

@@ -0,0 +1,710 @@
# SNMP::Info::Layer3::Passport
# Eric Miller
# $Id$
#
# Copyright (c) 2004 Eric Miller, 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 = '1.04';
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//;
%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 $id = $passport->id();
unless (defined $id){
print " SNMP::Info::Layer3::Passport::model() - Device does not support sysObjectID\n" if $passport->debug();
return undef;
}
my $model = &SNMP::translateObj($id);
return $id unless defined $model;
$model =~ s/^rcA//i;
return $model;
}
sub vendor {
return 'nortel';
}
sub os {
return 'passport';
}
sub os_ver {
my $passport = shift;
my $descr = $passport->description();
return undef unless defined $descr;
#Passport
if ($descr =~ m/(\d+\.\d+\.\d+\.\d+)/){
return $1;
}
#Accelar
if ($descr =~ m/(\d+\.\d+\.\d+)/){
return $1;
}
return undef;
}
sub i_index {
my $passport = shift;
my $model = $passport->model();
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;
}
if (defined $model and $model =~ /(86)/) {
# 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 $model = $passport->model();
my $index_factor = $passport->index_factor();
my $port_offset = $passport->port_offset();
my $i_index = $passport->i_index();
my $vlan_id = $passport->rc_vlan_id();
my $vlan_index = $passport->rc_vlan_if();
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) and ($model =~ /(86)/)) {
$if{$index} = 'Cpu.Virtual';
}
elsif (($index == 192) and ($model eq '8603')) {
$if{$index} = 'Cpu.3';
}
elsif (($index == 320) and ($model =~ /(8606|8610|8610co)/)) {
$if{$index} = 'Cpu.5';
}
elsif (($index == 384) and ($model =~ /(8606|8610|8610co)/)) {
$if{$index} = 'Cpu.6';
}
elsif (($index > 2000 and $model =~ /(86|81)/) or
($index > 256 and $model =~ /(105|11|12)/)) {
my $vlan_index = $reverse_vlan{$iid};
my $v_id = $vlan_id->{$vlan_index};
next unless defined $v_id;
my $v_port = 'Vlan'."$v_id";
$if{$index} = $v_port;
}
else {
my $port = ($index % $index_factor) + $port_offset;
my $slot = int($index / $index_factor);
my $slotport = "$slot.$port";
$if{$iid} = $slotport;
}
}
return \%if;
}
sub i_mac {
my $passport = shift;
my $model = $passport->model();
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;
}
if (defined $model and $model =~ /(86)/) {
# 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 $model = $passport->model();
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 %reverse_vlan = reverse %$vlan_index;
my %i_name;
foreach my $iid (keys %$i_index){
if (($iid == 1) and ($model =~ /(86)/)) {
$i_name{$iid} = 'CPU Virtual Management IP';
}
elsif (($iid == 192) and ($model eq '8603')) {
$i_name{$iid} = 'CPU 3 Ethernet Port';
}
elsif (($iid == 320) and ($model =~ /(8606|8610|8610co)/)) {
$i_name{$iid} = 'CPU 5 Ethernet Port';
}
elsif (($iid == 384) and ($model =~ /(8606|8610|8610co)/)) {
$i_name{$iid} = 'CPU 6 Ethernet Port';
}
elsif (($iid > 2000 and defined $model and $model =~ /(86|81)/) or
($iid > 256 and defined $model and $model =~ /(105|11|12)/)) {
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 $model = $passport->model();
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;
}
# Only 8600 has CPU and Virtual Management IP
if (defined $model and $model =~ /(86)/) {
# 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 $model = $passport->model();
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();
# Only 8600 has CLIP or Management Virtual IP
if (defined $model and $model =~ /(86)/) {
# 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 if $passport->snmp_connect_ip($ip);
}
# Return Management Virtual IP address
if ( (defined $virt_ip) and ($virt_ip ne '0.0.0.0') ) {
return $virt_ip if $passport->snmp_connect_ip($virt_ip);
}
}
# Return OSPF Router ID
if ((defined $router_ip) and ($router_ip ne '0.0.0.0')) {
foreach my $iid (keys %$rc_ip_addr){
my $ip = $rc_ip_addr->{$iid};
next unless $router_ip eq $ip;
return $router_ip if $passport->snmp_connect_ip($router_ip);
}
}
# 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') and ($passport->snmp_connect_ip($ip)) );
}
return undef;
}
# Required for SNMP::Info::SONMP
sub index_factor {
my $passport = shift;
my $model = $passport->model();
my $index_factor = 64;
# Older Accelar models use base 16 instead of 64
$index_factor = 16 if (defined $model and $model =~ /(105|11|12)/);
return $index_factor;
}
sub slot_offset {
return 0;
}
sub port_offset {
return 1;
}
# Bridge MIB does not map Bridge Port to ifIndex correctly
sub bp_index {
my $passport = shift;
my $if_index = $passport->i_index();
my %bp_index;
foreach my $iid (keys %$if_index){
$bp_index{$iid} = $iid;
}
return \%bp_index;
}
1;
__END__
=head1 NAME
SNMP::Info::Layer3::Passport - Perl5 Interface to modular Nortel Ethernet Routing
Switches (formerly Passport / Accelar)
=head1 AUTHOR
Eric Miller
=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 modular Nortel Ethernet Routing Switches (formerly
Passport and Accelar Series Switches).
These devices have some of the same charactersitics as the stackable Nortel
Ethernet Switches (Baystack). 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 model type. Checks $passport->id() against the
RAPID-CITY-MIB and then parses out rcA.
=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 for 8600, 16 for Accelar.
=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 % index_factor) + port_offset, slot = int(ifIndex / index_factor).
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 Vlan.
=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.
=item $passport->bp_index()
Returns reference to hash of bridge port table entries map back to interface identifier (iid)
Returns (B<ifIndex>) for both key and value since some devices seem to have
problems with BRIDGE-MIB
=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

View File

@@ -1,5 +1,7 @@
# SNMP::Info::MAU - Media Access Unit - RFC 2668
# Max Baker <max@warped.org>
# Max Baker
#
# Copyright (c) 2004,2005 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.4;
$VERSION = '1.04';
# $Id$
use strict;
@@ -40,11 +42,6 @@ use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
@SNMP::Info::MAU::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::MAU::EXPORT_OK = qw//;
$DEBUG=0;
$SNMP::debugging=$DEBUG;
$INIT = 0;
%MIBS = ('MAU-MIB' => 'mauMod');
%GLOBALS = (
@@ -103,6 +100,155 @@ sub _ishalfduplex{
return 0;
}
my %_mau_i_speed_map = (
'10' => '10 Mbps',
'100' => '100 Mbps',
'1000' => '1.0 Gbps',
'10Gig' => '10 Gbps',
);
sub mau_i_speed_admin {
my $mau = shift;
my $mau_index = $mau->mau_index();
my $mau_type_admin = $mau->mau_type_admin();
my %i_speed_admin;
foreach my $mau_port (keys %$mau_type_admin){
my $iid = $mau_index->{$mau_port};
next unless defined $iid;
my $type_adminoid = $mau_type_admin->{$mau_port};
my $type_admin = &SNMP::translateObj($type_adminoid);
next unless defined $type_admin;
if ($type_adminoid eq '.0.0') {
$i_speed_admin{$iid} = 'auto';
} elsif ($type_admin =~ /^dot3MauType(.*)Base/ && $_mau_i_speed_map{$1}) {
$i_speed_admin{$iid} = $_mau_i_speed_map{$1};
}
}
return \%i_speed_admin;
}
sub mau_i_duplex {
my $mau = shift;
my $mau_index = $mau->mau_index();
my $mau_link = $mau->mau_link();
my %i_duplex;
foreach my $mau_port (keys %$mau_link){
my $iid = $mau_index->{$mau_port};
next unless defined $iid;
my $linkoid = $mau_link->{$mau_port};
my $link = &SNMP::translateObj($linkoid);
next unless defined $link;
my $duplex = undef;
if ($link =~ /fd$/i) {
$duplex = 'full';
} elsif ($link =~ /hd$/i){
$duplex = 'half';
}
$i_duplex{$iid} = $duplex if defined $duplex;
}
return \%i_duplex;
}
sub mau_i_duplex_admin {
my $mau = shift;
my $mau_index = $mau->mau_index();
my $mau_autostat = $mau->mau_autostat();
my $mau_type_admin = $mau->mau_type_admin();
# Older HP4000's don't implement ifMauDefaultType, but we can
# figure out from ifMauAutoNegCapAdvertised what we'd like.
if (!defined($mau_type_admin)) {
if (defined($mau_index)) {
return mau_i_duplex_admin_old($mau,$mau_index,$mau_autostat);
} else {
return undef;
}
}
my %i_duplex_admin;
foreach my $mau_port (keys %$mau_type_admin){
my $iid = $mau_index->{$mau_port};
next unless defined $iid;
my $autostat = $mau_autostat->{$mau_port};
if (defined $autostat and $autostat =~ /enabled/i){
$i_duplex_admin{$iid} = 'auto';
next;
}
my $type_adminoid = $mau_type_admin->{$mau_port};
my $type_admin = &SNMP::translateObj($type_adminoid);
next unless defined $type_admin;
my $duplex = undef;
if ($type_admin =~ /fd$/i) {
$duplex = 'full';
} elsif ($type_admin =~ /hd$/i){
$duplex = 'half';
}
$i_duplex_admin{$iid} = $duplex if defined $duplex;
}
return \%i_duplex_admin;
}
sub mau_i_duplex_admin_old {
my $mau = shift;
my $mau_index = shift;
my $mau_autostat = shift;
my $interfaces = $mau->interfaces();
my $mau_autosent = $mau->mau_autosent();
my %mau_reverse = reverse %$mau_index;
my %i_duplex_admin;
foreach my $iid (keys %$interfaces){
my $mau_index = $mau_reverse{$iid};
next unless defined $mau_index;
my $autostat = $mau_autostat->{$mau_index};
# HP25xx has this value
if (defined $autostat and $autostat =~ /enabled/i){
$i_duplex_admin{$iid} = 'auto';
next;
}
my $type = $mau_autosent->{$mau_index};
next unless defined $type;
if ($type == 0) {
$i_duplex_admin{$iid} = 'none';
next;
}
my $full = $mau->_isfullduplex($type);
my $half = $mau->_ishalfduplex($type);
if ($full and !$half){
$i_duplex_admin{$iid} = 'full';
} elsif ($half) {
$i_duplex_admin{$iid} = 'half';
}
}
return \%i_duplex_admin;
}
1;
__END__
@@ -113,7 +259,7 @@ SNMP::Info::MAU - Perl5 Interface to Medium Access Unit (MAU) MIB (RFC2668) via
=head1 AUTHOR
Max Baker (C<max@warped.org>)
Max Baker
=head1 SYNOPSIS
@@ -170,6 +316,31 @@ These are methods that return scalar value from SNMP
These are methods that return tables of information in the form of a reference
to a hash.
=over
=item $mau->mau_i_duplex()
Parses mau_index and mau_link to return the duplex information for
interfaces.
=item $mau->mau_i_duplex_admin()
Parses C<mac_index>,C<mau_autostat>,C<mau_type_admin> in
order to find the admin duplex setting for all the interfaces.
Returns either (auto,full,half).
=item $mau->mau_i_duplex_admin_old()
Called by mau_i_duplex_admin() if C<mau_type_admin> is empty.
Parses C<mau_index>,C<mau_autostat>,C<mau_autosent> in
order to find the admin duplex setting for all the interfaces.
Returns either (auto,none,full,half).
=back
=head2 MAU INTERFACE TABLE ENTRIES
=over
@@ -232,10 +403,18 @@ of the port from a MAU POV.
(B<ifMauTypeList>)
=item $mau->mau_type_admin()
(C<ifMauDefaultType>)
=item $mau->mau_auto() - Returns status of auto-negotiation mode for ports.
(B<ifMauAutoNegAdminStatus>)
=item $mau->mau_autostat()
(C<ifMauAutoNegAdminStatus>)
=item $mau->mau_autosent() - Returns a 32 bit bit-string representing the
capabilities we are broadcasting on that port

386
Info/NortelStack.pm Normal file
View File

@@ -0,0 +1,386 @@
# SNMP::Info::NortelStack
# Eric Miller
# $Id$
#
# Copyright (c) 2004-6 Eric Miller, 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 = '1.04';
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/;
%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
=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 Stackable Ethernet Switches (BayStack), 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
=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

689
Info/RapidCity.pm Normal file
View File

@@ -0,0 +1,689 @@
# SNMP::Info::RapidCity
# $Id$
#
# Copyright (c) 2004-6 Eric Miller, 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 = '1.04';
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/;
%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 the Nortel RapidCity MIB
=head1 AUTHOR
Eric Miller
=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 Ethernet Routing
Switch and Ethernet Switch product lines (Formerly known as Passport,
BayStack, and Acclear).
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
=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

501
Info/SONMP.pm Normal file
View File

@@ -0,0 +1,501 @@
# SNMP::Info::SONMP
# Eric Miller
# $Id$
#
# Copyright (c) 2004 Eric Miller, 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 = '1.04';
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/;
%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;
}
# Topology turned off, not supported.
return undef;
}
1;
__END__
=head1 NAME
SNMP::Info::SONMP - Perl5 Interface to SynOptics Network Management Protocol (SONMP) using SNMP
=head1 AUTHOR
Eric Miller
=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

View File

@@ -1,26 +1,62 @@
COPYRIGHT
ChangeLog
COPYRIGHT
DeviceMatrix.txt
Info.pm
Info/Airespace.pm
Info/Bridge.pm
Info/CDP.pm
Info/CiscoImage.pm
Info/CiscoQOS.pm
Info/CiscoRTT.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/Layer1/S3000.pm
Info/Layer2.pm
Info/Layer2/Aironet.pm
Info/Layer2/Allied.pm
Info/Layer2/Aruba.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/Cisco.pm
Info/Layer2/Foundry.pm
Info/Layer2/HP.pm
Info/Layer2/N2270.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/C4000.pm
Info/Layer3/C6500.pm
Info/Layer3/Cisco.pm
Info/Layer3/Contivity.pm
Info/Layer3/Extreme.pm
Info/Layer3/Foundry.pm
Info/Layer3/Juniper.pm
Info/Layer3/N1600.pm
Info/Layer3/Passport.pm
Info/MAU.pm
MANIFEST
Info/NortelStack.pm
Info/RapidCity.pm
Info/SONMP.pm
Makefile.PL
MANIFEST This list of files
README
t/make_dev_matrix.pl
t/prereq.t
t/test_class.pl

View File

@@ -21,5 +21,6 @@ WriteMakefile(
sub MY::postamble { "
.PHONY: readme
readme:
readme: README
README: Info.pm
pod2text -l Info.pm > README" }

630
README
View File

@@ -5,14 +5,15 @@ NAME
VERSION
SNMP::Info - Version 0.4
SNMP::Info - Version 1.04
AUTHOR
Max Baker ("max@warped.org")
SNMP::Info was created at UCSC for the netdisco project
(www.netdisco.org)
(www.netdisco.org) and was orginally written by Max Baker.
Currently being maintained by team of Open Source authors headed by Eric
Miller and Bill Fenner.
SYNOPSIS
@@ -26,13 +27,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
@@ -50,20 +51,32 @@ SYNOPSIS
# Print out physical port name, not snmp iid
my $port = $interfaces->{$iid};
print "$port: ";
print "$duplex duplex" if defined $duplex;
# The CDP Table has table entries different than the interface tables.
# So we use c_if to get the map from cdp table to interface table.
my %c_map = reverse %$c_if;
my $c_key = $c_map{$iid};
unless (defined $c_key) {
print "\n\n";
next;
}
my $neighbor_ip = $c_ip->{$c_key};
my $neighbor_port = $c_port->{$c_key};
print "$port: $duplex duplex";
print " connected to $neighbor_ip / $neighbor_port\n" if defined $remote_ip;
print " connected to $neighbor_ip / $neighbor_port\n" if defined $neighbor_ip;
print "\n";
}
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>.
DESCRIPTION
SNMP::Info gives an object oriented interface to information obtained
@@ -87,14 +100,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.
@@ -112,64 +125,37 @@ 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.
Then run "snmpconf" and setup that directory as default. Move
snmp.conf into /usr/local/share/snmp when you are done.
Basic MIBs
A minimum amount of MIBs to have are the Version 2 MIBs from
Cisco, found at
ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
To install them :
mkdir -p /usr/local/share/snmp/mibs && cd /usr/local/share/snmp/mibs && tar xvfz /path/to/v2.tar.gz
Version 1 MIBs
You will also need to install some of the version one MIBs from
Cisco :
ftp://ftp.cisco.com/pub/mibs/v1/v1.tar.gz
Extract
BRIDGE-MIB
SNMP-REPEATER-MIB
STAND-ALONE-ETHERNET-SWITCH-MIB (ESSWITCH-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
More Specific MIBs
Some non-cisco subclasses will need MIBs other than the basic
one available from Cisco.
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".
@@ -184,10 +170,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:
@@ -199,18 +185,44 @@ 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::Airespace
AIRESPACE-WIRELESS-MIB and AIRESPACE-SWITCHING-MIB. Inherited by
devices based on the Airespace wireless platform.
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.
Cisco and HP devices.
SNMP::Info::CiscoImage
CISCO-IMAGE-MIB. A collection of OIDs providing IOS image
characteristics.
SNMP::Info::CiscoQOS
CISCO-CLASS-BASED-QOS-MIB. A collection of OIDs providing
information about a Cisco device's QOS config.
SNMP::Info::CiscoRTT
CISCO-RTTMON-MIB. A collection of OIDs providing information about a
Cisco device's RTT values.
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.
@@ -218,15 +230,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 switches for duplex and VLAN
information.
SNMP::Info::SONMP
SYNOPTICS-ROOT-MIB, S5-ETH-MULTISEG-TOPOLOGY-MIB. Provides
translation from Nortel Topology Table information to CDP. Inherited
by Nortel/Bay/Synoptics 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.
@@ -235,66 +265,149 @@ DESCRIPTION
Requires ATI-MIB
See SNMP::Info::Layer1::Allied for where to get MIBs required.
SNMP::Info::Layer1::Asante
Subclass for Asante 1012 Hubs.
Requires ASANTE-HUB1012-MIB
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.
SNMP::Info::Layer1::S3000
Subclass for Bay/Synoptics hubs. This includes System 3000,
281X, and probably more.
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::Aruba
Subclass for Aruba wireless switches.
SNMP::Info::Layer2::Bay
Bay Networks BayStack switch Support. Provides translation from
Bay Network Topology Table information to CDP.
Depreciated. Use BayStack.
Requires SYNOPTICS-ROOT-MIB and S5-ETH-MULTISEG-TOPOLOGY-MIB
See SNMP::Info::Bay for where to get MIBs required.
SNMP::Info::Layer2::Baystack
Subclass for Nortel/Bay Ethernet Switch/Baystack switches. This
includes 303, 304, 350, 380, 410, 420, 425, 450, 460, 470, 5510,
5520, 5530, Business Policy Switch (BPS) and probably others.
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.
SNMP::Info::Layer2::Cisco
Generic Cisco subclass for layer2 devices that are not yet
supported in more specific subclasses.
SNMP::Info::Layer2::Foundry
Subclass for Foundry Switches. Tested on EdgeIron 24G.
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::N2270
Subclass for Nortel 2270 wireless switches.
SNMP::Info::Layer2::NAP222x
Subclass for Nortel 222x series wireless access points.
SNMP::Info::Layer2::Orinoco
Subclass for Orinoco/Proxim 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 Alteon Ace Director series L2-7 switches.
SNMP::Info::Layer3::BayRS
Subclass for Nortel Multiprotocol/BayRS routers. This includes
BCN, BLN, ASN, ARN, AN, 2430, and 5430 routers.
SNMP::Info::Layer3::C3550
Subclass for Cisco Catalyst 3550,3540,3560 2/3 switches running
IOS.
SNMP::Info::Layer3::C4000
This class covers Catalyst 4000s and 4500s.
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 Contivity/VPN Routers.
SNMP::Info::Layer3::Extreme
Subclass for Extreme Networks switches.
See SNMP::Info::Layer3::Extreme for more info.
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::Juniper
Subclass for Juniper devices.
SNMP::Info::Layer3::N1600
Subclass for Nortel Ethernet Routing Switch 1600 series.
SNMP::Info::Layer3::Passport
Subclass for Nortel Ethernet Routing Switch/Passport 8000 series
and Accelar series switches.
Thanks
Thanks for testing and coding help (in no particular order) to : Andy
Ford, Brian Wilson, Jean-Philippe Luiggi, D<>na Watanabe, Bradley Baetz,
Mike Hunter, Justin Hunter, Brian Chow and people listed on the Netdisco
README!
USAGE
@@ -305,24 +418,73 @@ USAGE
my $info = new SNMP::Info( 'Debug' => 1,
'AutoSpecify' => 1,
'BigInt' => 1
'BigInt' => 1,
'BulkWalk' => 1,
'BulkRepeaters'=> 20,
'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.
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.
AutoSpecify
Returns an object of a more specific device class
(default on)
BigInt
Return Math::BigInt objects for 64 bit counters. Sets on a
global scope, not object.
(default off)
BulkWalk
Set to 0 to turn off BULKWALK commands for SNMPv2 connections.
Note that BULKWALK is turned off for Net-SNMP versions 5.1.x
because of a bug.
(default on)
BulkRepeaters
Set number of MaxRepeaters for BULKWALK operation. See "perldoc
SNMP" -> bulkwalk() for more info.
(default 20)
Debug
Prints Lots of debugging messages
(default off)
DebugSNMP
Set $SNMP::debugging level for Net-SNMP.
See SNMP for more details.
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.
(default use net-snmp settings only)
RetryNoSuch
When using SNMP Version 1, try reading values even if they come
back as "no such variable in this MIB". 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.
(default true)
Session
SNMP::Session object to use instead of connecting on own.
(default creates session automatically)
OTHER
All other arguments are passed to SNMP::Session.
See SNMP::Session for a list of other possible arguments.
@@ -369,6 +531,11 @@ USAGE
Returns current debug status, and optionally toggles debugging info
for this object.
$info->bulkwalk([1|0])
Returns if bulkwalk is currently turned on for this object.
Optionally sets the bulkwalk parameter.
$info->device_type()
Returns the Subclass name for this device. "SNMP::Info" is returned
if no more specific class is available.
@@ -385,20 +552,47 @@ 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 4000,4500 -> SNMP::Info::Layer3::C4000
Catalyst 6500, 3750 -> SNMP::Info::Layer3::C6500
Cisco Generic L3 IOS device -> SNMP::Info::Layer3::Cisco
Extreme -> SNMP::Info::Layer3::Extreme
Foundry -> SNMP::Info::Layer3::Foundry
Juniper -> SNMP::Info::Layer3::Juniper
Nortel Passport/Accelar LAN -> SNMP::Info::Layer3::Passport
Nortel/Bay Baystack -> SNMP::Info::Layer2::Baystack
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,2940,2950,
3500XL -> SNMP::Info::Layer2::C2900
Catalyst 2960, 2970 -> SNMP::Info::Layer3::C6500
Catalyst 3550/3548 -> SNMP::Info::Layer3::C3550
Cisco 3400 w/ MetroBase -> SNMP::Info::Layer3::C3550
Catalyst WS-C 2926,5xxx -> SNMP::Info::Layer2::Catalyst
Cisco (not covered by above) -> SNMP::Info::Layer2::Cisco
Extreme -> SNMP::Info::Layer3::Extreme
Foundry (EdgeIron,????) -> SNMP::Info::Layer2::Foundry
HP Procurve -> SNMP::Info::Layer2::HP
Nortel/Bay Centillion ATM -> SNMP::Info::Layer2::Centillion
Nortel/Bay Baystack -> SNMP::Info::Layer2::Baystack
Nortel Passport/Accelar 8100 -> SNMP::Info::Layer3::Passport
Nortel AP 222x -> SNMP::Info::Layer2::NAP222x
Orinco AP -> SNMP::Info::Layer2::Orinoco
Nortel 2270 WSS -> SNMP::Info::Layer2::N2270
Elsif Layer1 Support -> SNMP::Info::Layer1
Allied -> SNMP::Info::Layer1::Allied
Asante -> SNMP::Info::Layer1::Asante
Nortel/Bay Hub -> SNMP::Info::Layer1::Bayhub
Bay/Synoptics Hub -> SNMP::Info::Layer1::S3000
Else -> SNMP::Info
ZyXEL_DSLAM -> SNMP::Info::Layer2::ZyXEL_DSLAM
Aruba wireless -> SNMP::Info::Layer2::Aruba
$info->error(no_clear)
Returns Error message if there is an error, or undef if there is
@@ -414,7 +608,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
@@ -430,6 +624,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.
@@ -438,7 +640,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)
@@ -472,17 +674,42 @@ USAGE
(ifNumber)
$info->ipforwarding()
The indication of whether the entity is acting as an IP gateway
Returns either forwarding or not-forwarding
(ipForwarding)
Table Methods
Each of these methods returns a hash_reference to a hash keyed on the
interface index in SNMP.
Example : $info->interfaces() might return { '1.12' => 'FastEthernet/0',
'2.15' => 'FastEthernet/1', '9.99' => 'FastEthernet/2' }
Example : $info->interfaces() might return
{ '1.12' => 'FastEthernet/0',
'2.15' => 'FastEthernet/1',
'9.99' => 'FastEthernet/2'
}
The key is what you would see if you were to do an snmpwalk, and in some
cases changes between reboots of the network device.
Partial Table Fetches
If you want to get only a part of an SNMP table and you know the IID for
the part of the table that you want, you can specify it in the call:
$local_routes = $info->ipr_route('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).
Partial table results are not cached.
Interface Information
$info->interfaces()
@@ -522,7 +749,14 @@ USAGE
Speed of the link, human format. See munge_speed() later in document
for details.
(ifSpeed)
(ifSpeed, ifHighSpeed if necessary)
$info->i_speed_high()
Speed of a high-speed link, human format. See munge_highspeed()
later in document for details. You should not need to call this
directly, as i_speed() will call it if it needs to.
(ifHighSpeed)
$info->i_mac()
MAC address of the interface. Note this is just the MAC of the port,
@@ -541,6 +775,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.
@@ -638,7 +877,123 @@ USAGE
(ipAdEntBcastAddr)
Setting data via SNMP
IP Routing Table
$info->ipr_route()
The route in question. A value of 0.0.0.0 is the default gateway
route.
("ipRouteDest")
$info->ipr_if()
The interface (IID) that the route is on. Use interfaces() to map.
("ipRouteIfIndex")
$info->ipr_1()
Primary routing metric for this route.
("ipRouteMetric1")
$info->ipr_2()
If metrics are not used, they should be set to -1
("ipRouteMetric2")
$info->ipr_3()
("ipRouteMetric3")
$info->ipr_4()
("ipRouteMetric4")
$info->ipr_5()
("ipRouteMetric5")
$info->ipr_dest()
From RFC1213:
"The IP address of the next hop of this route.
(In the case of a route bound to an interface
which is realized via a broadcast media, the value
of this field is the agent's IP address on that
interface.)"
("ipRouteNextHop")
$info->ipr_type()
From RFC1213:
other(1), -- none of the following
invalid(2), -- an invalidated route
-- route to directly
direct(3), -- connected (sub-)network
-- route to a non-local
indirect(4) -- host/network/sub-network
"The type of route. Note that the values
direct(3) and indirect(4) refer to the notion of
direct and indirect routing in the IP
architecture.
Setting this object to the value invalid(2) has
the effect of invalidating the corresponding entry
in the ipRouteTable object. That is, it
effectively disassociates the destination
identified with said entry from the route
identified with said entry. It is an
implementation-specific matter as to whether the
agent removes an invalidated entry from the table.
Accordingly, management stations must be prepared
to receive tabular information from agents that
corresponds to entries not currently in use.
Proper interpretation of such entries requires
examination of the relevant ipRouteType object."
("ipRouteType")
$info->ipr_proto()
From RFC1213:
other(1), -- none of the following
-- non-protocol information,
-- e.g., manually configured
local(2), -- entries
-- set via a network
netmgmt(3), -- management protocol
-- obtained via ICMP,
icmp(4), -- e.g., Redirect
-- the remaining values are
-- all gateway routing
-- protocols
egp(5),
ggp(6),
hello(7),
rip(8),
is-is(9),
es-is(10),
ciscoIgrp(11),
bbnSpfIgp(12),
ospf(13),
bgp(14)
("ipRouteProto")
$info->ipr_age()
Seconds since route was last updated or validated.
("ipRouteAge")
$info->ipr_mask()
Subnet Mask of route. 0.0.0.0 for default gateway.
("ipRouteMask")
$info->ipr_info()
Reference to MIB definition specific to routing protocol.
("ipRouteInfo")
SETTING DATA VIA SNMP
This section explains how to use SNMP::Info to do SNMP Set operations.
@@ -656,17 +1011,17 @@ 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
@@ -730,7 +1085,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 --------------------------------
@@ -744,23 +1100,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',
@@ -768,6 +1129,7 @@ EXTENDING SNMP::INFO
);
%MUNGE = (%SNMP::Info::Layer2::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE,
'super_hero_powers' => \&munge_powers
);
@@ -806,10 +1168,12 @@ EXTENDING SNMP::INFO
=head2 Overrides
=cut
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
@@ -841,33 +1205,54 @@ SNMP::INFO INTERNALS
Default 1. Set to false to disable RetryNoSuch option for
SNMP::Session. Or see method in new() to do it on an object scope.
$REPEATERS
Default 20. MaxRepeaters for BULKWALK operations. See "perldoc SNMP"
for more info. Can change by passing BulkRepeaters option in new()
Data Munging Callback Subroutines
munge_speed()
Makes human friendly speed ratings using %SPEED_MAP
%SPEED_MAP = (
'56000' => '56 kbps',
'64000' => '64 kbps',
'115000' => '115 kpbs',
'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',
'51850000' => 'OC-1',
'54000000' => '54 Mbps',
'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_highspeed()
Makes human friendly speed ratings for ifHighSpeed
munge_ip()
Takes a binary IP and makes it dotted ASCII
@@ -889,6 +1274,14 @@ SNMP::INFO INTERNALS
If $BIGINT is set to true, then a Math::BigInt object is returned.
See Math::BigInt for details.
munge_i_up
There is a collision between data in IF-MIB and RFC-1213. For
devices that fully implement IF-MIB it might return 7 for a port
that is down. This munges the data against the IF-MIB by hand.
TODO: Get the precidence of MIBs and overriding of MIB data in
Net-SNMP figured out. Heirarchy/precendence of MIBS in SNMP::Info.
Internaly Used Functions
$info->init()
@@ -932,7 +1325,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').
@@ -976,6 +1369,9 @@ SNMP::INFO INTERNALS
The first time ran, it will call $info->load_METHOD(). Every time
after it will return cached data.
$info->snmp_connect_ip()
Returns true or false based upon snmp connectivity to an IP.
AUTOLOAD
Each entry in either %FUNCS or %GLOBALS is used by AUTOLOAD() to create
@@ -992,6 +1388,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.
@@ -1000,8 +1397,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

332
t/make_dev_matrix.pl Executable file
View File

@@ -0,0 +1,332 @@
#!/usr/bin/perl -w
# $Id$
$DevMatrix = '../DeviceMatrix.txt';
$DevHTML = 'DeviceMatrix.html';
$DevPNG = 'DeviceMatrix.png';
$Attributes= {};
# Parse Data File
$matrix = parse_data($DevMatrix);
# Graph it for fun
eval "use GraphViz::Data::Structure;";
if ($@) {
print "GraphViz::Data::Structure not installed. $@\n";
} else {
my %graph = ();
foreach my $vendor (sort sort_nocase keys %$matrix){
$graph{$vendor} = {};
foreach my $family (sort sort_nocase keys %{$matrix->{$vendor}->{families}} ){
my @models;
foreach my $mod (keys %{$matrix->{$vendor}->{families}->{$family}->{models}}){
push(@models,split(/\s*,\s*/,$mod));
}
if (scalar @models){
$graph{$vendor}->{$family}=\@models;
} else {
$graph{$vendor}->{$family}=[];
}
}
}
my $now = scalar localtime;
my $gvds = GraphViz::Data::Structure->new(\%graph,Orientation=>'vertical',
Colors=> 'Deep',
graph => {label=>"SNMP::Info and Netdisco Supported Devices \n $now",'fontpath'=>'/usr/local/netdisco','fontname'=>'lucon',concentrate=>'true','overlap'=>'false',spline=>'true',bgcolor=>'wheat'},
node => {fontname=>'lucon'},
);
$gvds->graph()->as_png($DevPNG);
}
open (HTML, "> $DevHTML") or die "Can't open $DevHTML. $!\n";
$old_fh = select(HTML);
&html_head;
print_vendors($matrix);
foreach my $vendor (sort sort_nocase keys %$matrix){
print "<A NAME=\"$vendor\"><SPAN CLASS=\"vendor\"><B>$vendor</B></SPAN></A>\n";
print "<DL>\n";
my $vendor_defaults = $matrix->{$vendor}->{defaults};
print_notes($vendor_defaults,1);
my $families = $matrix->{$vendor}->{families};
foreach my $family (sort sort_nocase keys %$families ) {
print "<DT>$family Family\n";
my $family_defaults = $families->{$family}->{defaults};
print_notes($family_defaults,2);
my $models = $families->{$family}->{models};
foreach my $model (sort sort_nocase keys %$models ){
my $model_defaults = $models->{$model}->{defaults};
print "<DD>$model\n";
print "<DL>\n";
print_notes($model_defaults,3);
print "<DT><DD><TABLE BORDER=1>\n";
print_headers();
print "<TR>\n";
foreach my $a (sort sort_nocase keys %$Attributes) {
my $val;
next if $a eq 'note';
$val = ['-'];
$class = 'none';
if (defined $model_defaults->{$a}) {
$val = $model_defaults->{$a};
$class = 'model';
} elsif (defined $family_defaults->{$a}){
$val = $family_defaults->{$a};
$class = 'family';
} elsif (defined $vendor_defaults->{$a}){
$val = $vendor_defaults->{$a};
$class = 'vendor';
}
print " <TD CLASS='$class'>",join("<BR>\n",@$val),"</TD>\n";
}
print "</TR></TABLE>\n";
print "</DL>\n";
}
}
print "</DL>\n";
}
&html_tail;
select ($old_fh);
close (HTML) or die "Can't write $DevHTML. $!\n";
# Data Structures
# Matrix =
# ( vendor => { families => { family => family_hash },
# defaults => { cmd => [values] },
# }
# )
# Family Hash
# ( models => { model => model_hash },
# defaults => { cmd => [values] }
# )
# Model Hash
# ( defaults => { cmd => [values] } )
sub parse_data {
my $file = shift;
my %ignore = map { $_ => 1 } @_;
my $Matrix;
my @Lines;
open (DM, "< $file") or die "Can't open $file. $!\n";
{
@Lines = <DM>;
}
close (DM);
my ($device,$family,$vendor,$class);
foreach my $line (@Lines){
chomp($line);
# Comments
$line =~ s/#.*//;
# Blank Lines
next if $line =~ /^\s*$/;
# Trim whitespace
$line =~ s/^\s+//;
$line =~ s/\s+$//;
my ($cmd,$value);
if ($line =~ /^([a-z-_]+)\s*:\s*(.*)$/) {
$cmd = $1; $value = $2;
} else {
print "What do i do with this line : $line \n";
next;
}
if (exists $ignore{$cmd}){
print "Ignoring $cmd\n";
}
# Set Class {vendor,family,device}
if ($cmd eq 'device-vendor'){
$vendor = $value;
$family = $model = undef;
$Matrix->{$vendor} = {} unless defined $Matrix->{$vendor};
$class = $Matrix->{$vendor};
$class->{defaults}->{type}='vendor';
next;
}
if ($cmd eq 'device-family'){
$family = $value;
$model = undef;
print "$family has no vendor.\n" unless defined $vendor;
$Matrix->{$vendor}->{families}->{$family} = {}
unless defined $Matrix->{$vendor}->{families}->{$family};
$class = $Matrix->{$vendor}->{families}->{$family};
$class->{defaults}->{type}='family';
next;
}
if ($cmd eq 'device') {
$model = $value;
print "$model has no family.\n" unless defined $family;
print "$model has no vendor.\n" unless defined $vendor;
$Matrix->{$vendor}->{families}->{$family}->{models}->{$model} = {}
unless defined $Matrix->{$vendor}->{families}->{$family}->{models}->{$model};
$class = $Matrix->{$vendor}->{families}->{$family}->{models}->{$model};
$class->{defaults}->{type}='device';
next;
}
# Store attribute
push (@{$class->{defaults}->{$cmd}} , $value);
$Attributes->{$cmd}++;
}
return $Matrix;
}
sub sort_nocase {
return lc($a) cmp lc($b);
}
sub print_notes {
my $defaults = shift;
my $level = shift;
my $notes = $defaults->{note} || [];
foreach my $note (@$notes){
if ($note =~ s/^!//){
$note = '<SPAN CLASS="note">' . $note . '</SPAN>';
}
}
if (scalar @$notes){
print "<DT>\n";
my $print_note = join("\n<LI>",@$notes);
print "<UL TYPE='square'><LI>$print_note</UL>\n";
}
}
sub print_vendors {
my $matrix=shift;
print "<h1>Device Vendors</h1>\n";
foreach my $vendor (sort sort_nocase keys %$matrix){
print "[<A HREF=\"#$vendor\">$vendor</A>]\n";
}
print "<HR>\n";
}
sub html_head {
print <<"end_head";
<HTML>
<HEAD>
<TITLE>SNMP::Info - Device Compatibility Matrix</TITLE>
<STYLE TYPE="text/css" MEDIA="screen">
<!--
BODY { font-family:arial,helvetica,sans-serif; font-size:12pt; }
TD { font-family:arial,helvetica,sans-serif; font-size:10pt; }
TH { font-family:arial,helvetica,sans-serif; font-size:10pt; background:#F0F0F0; }
H1 { font-family:arial,helvetica,sans-serif; font-size:14pt; }
.vendor { font-size:12pt; color:#777777; }
.family { font-size:12pt; color:blue; }
.model { font-size:12pt; color:red; }
.note { color:red; }
//-->
</STYLE>
</HEAD>
<BODY>
<h1>SNMP::Info - Device Compatibility Matrix</h1>
<P>
end_head
}
sub html_tail {
print <<'end_tail';
<HR>
<h1>Color Key</h1>
[<SPAN CLASS="model">Model Attribute</SPAN>]
[<SPAN CLASS="family">Family Attribute</SPAN>]
[<SPAN CLASS="vendor">Vendor Attribute</SPAN>]
<h1>Attribute Key</h1>
A value of <B>-</B> signifies the information is not specified and can
be assumed working.
<TABLE BORDER=1>
<TR>
<TD>Arpnip</TD>
<TD>Ability to collect ARP tables for MAC to IP translation.</TD>
</TR>
<TR>
<TD>CDP</TD>
<TD>Cisco Discovery Protocol usable.
<UL>
<LI><tt>Yes</tt> - Has CDP information through CISCO-CDP-MIB
<LI><tt>Proprietary</tt> means the device has its own L2 Discovery Protocol.
</UL>
</TD>
</TR>
<TR>
<TD>Class</TD>
<TD>SNMP::Info Class the the device currently uses. Devices using more generic
interfaces like <tt>Layer2</tt> or <tt>Layer3</tt> may eventually get their
own subclass.
</TD>
</TR>
<TR>
<TD>Duplex</TD>
<TD>Ability to cull duplex settings from device.<BR>
<UL>
<LI><tt>no</tt> - Can't recover current or admin setting.
<LI><tt>link</tt> - Can get current setting only.
<LI><tt>both</tt> - Can get admin and link setting.
<LI><tt>write</tt> - Can get admin and link setting and perform sets.
</UL>
</TD>
</TR>
<TR>
<TD>Macsuck</TD>
<TD>Ability to get CAM tables for MAC to switch port mapping.<BR>
<UL>
<LI><TT>no</TT> - Have not found an SNMP method to get data yet.
<LI><TT>yes</TT> - Can get through normal SWITCH-MIB method.
<LI><TT>vlan</TT> - Have to re-connect to each VLAN and then fetch with normal
method.
</UL>
</TD>
</TR>
<TR>
<TD>Portmac</TD>
<TD>Whether the device will list the MAC address of the switch port on each
switch port when doing a Macsuck.
</TD>
</TR>
<TR>
<TD>Ver</TD>
<TD>SNMP Protocol Version the device has to use.</TD>
</TR>
<TR>
<TD>Vlan</TD>
<TD>Ability to get VLAN port assignments.<BR>
<UL>
<LI><TT>no</TT> - Have not found an SNMP method to get data yet.
<LI><TT>yes</TT> - Can read information.
<LI><TT>write</TT> - Can read and write (set).
</UL>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
end_tail
}
sub print_headers {
print "<TR>\n";
foreach my $a (sort sort_nocase keys %$Attributes) {
next if $a eq 'note';
print " <TH>$a</TH>\n";
}
print "</TR>\n";
}

168
t/test_class.pl Executable file
View File

@@ -0,0 +1,168 @@
#!/usr/bin/perl -w
#
# test_class.pl
#
# Test a device class in SNMP::Info against a device.
#
# Max Baker
#
# $Id$
#
use lib '/usr/local/netdisco';
use SNMP::Info;
use Getopt::Long;
use strict;
use vars qw/$Class $Dev $Comm $Ver @Dump %Dumped $Debug/;
# Default Values
$Class = '';
$Dev = '';
$Comm = '';
$Ver = 2;
@Dump = ();
$Debug = 0;
GetOptions ('c|class=s' => \$Class,
'd|dev=s' => \$Dev,
's|comm=s' => \$Comm,
'v|ver=i' => \$Ver,
'h|help' => \&usage,
'p|print=s' => \@Dump,
'x|debug' => \$Debug,
);
&usage unless ($Dev and $Comm);
$Class = $Class ? "SNMP::Info::$Class" : 'SNMP::Info';
eval "require $Class;";
if ($@) {
die "Can't load Class specified : $Class.\n\n$@\n";
}
print "Class $Class loaded.\n";
print "Dumping : ",join(',',@Dump),"\n" if scalar @Dump;
my $dev = new $Class( 'AutoSpecify' => 0,
'AutoVerBack' => 0,
'Version' => $Ver,
'Debug' => $Debug,
'DestHost' => $Dev,
'Community' => $Comm
) or die "\n";
print "Connected to $Dev.\n";
print "It's a ", $dev->device_type(), ".\n";
my $layers = $dev->layers();
unless (defined $layers){
die "Are you sure you got the right community string and version?\nCan't fetch layers.\n";
}
print "Fetching global info...\n\n";
my @globals = qw/description uptime contact name location layers ports mac serial
ps1_type ps2_type ps1_status ps2_status fan slots vendor os os_ver/;
foreach my $global (@globals){
test_global($dev,$global);
}
print "\nFetching interface info...\n\n";
my @fns = qw/interfaces i_type i_ignore i_description i_mtu i_speed i_mac i_up
i_up_admin i_name i_duplex i_duplex_admin i_stp_state
i_lastchange/;
foreach my $fn (@fns){
test_fn($dev,$fn);
}
print "\nTesting Misc...\n\n";
my @misc = qw/v_name v_port/;
foreach my $fn (@misc){
test_fn($dev,$fn);
}
foreach my $fn (@Dump) {
test_fn($dev,$fn) unless $Dumped{$fn};
}
#--------------------------------
sub test_global {
my $dev = shift;
my $method = shift;
my $value;
eval {
$value = $dev->$method();
};
if ($@){
my $err = $@;
$err =~ s/[[:cntrl:]]+/ /g;
printf "%-20s Blew up. $err\n",$method;
return 0;
}
unless (defined $value){
printf "%-20s Does not exist.\n",$method;
return 0;
}
$value =~ s/[[:cntrl:]]+/ /g;
if (length $value > 60) {
$value = substr($value,0,60);
$value .= '...';
}
printf "%-20s %s \n",$method,$value;
return 1;
}
sub test_fn {
my $dev = shift;
my $method = shift;
my $results;
eval {
$results = $dev->$method();
};
if ($@){
my $err = $@;
$err =~ s/\n/ /g;
printf "%-20s Blew up. $err\n",$method;
return 0;
}
unless (defined $results and scalar keys %$results) {
printf "%-20s Empty Results.\n",$method;
return 0;
}
printf "%-20s %d rows.\n",$method, scalar(keys %$results);
if (grep(/^$method$/,@Dump)) {
$Dumped{$method} = 1;
foreach my $iid (keys %$results){
print " $iid : $results->{$iid}\n";
}
}
return 1;
}
sub usage {
print << "end_usage";
test_class - Test a device against an SNMP::Info class
-c --class Layer2::Catalyst
-d --dev myswitch
-s --comm public
-v --ver 2
-p --print i_blah
-p --print i_blah2
end_usage
exit;
}