Compare commits
	
		
			64 Commits
		
	
	
		
			ver_3_0_4_
			...
			3.10
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 1c57d2eab8 | ||
|  | 409de77b2c | ||
|  | 3e22e24dc9 | ||
|  | 17b1bdacfe | ||
|  | b570fdbc89 | ||
|  | cceb0f4e5e | ||
|  | 04f8c7f7e2 | ||
|  | 37aca89af7 | ||
|  | 5445a496db | ||
|  | 0ab93b142c | ||
|  | d39dc76949 | ||
|  | c6abd7b62b | ||
|  | 0e572db832 | ||
|  | 602bb15b47 | ||
|  | b4882285c4 | ||
|  | 834b27bdad | ||
|  | 7db148a5a1 | ||
|  | 9e332095a2 | ||
|  | 7bf950026b | ||
|  | f246444d89 | ||
|  | 8e84aea1bf | ||
|  | d6a7a944cc | ||
|  | fb478d3c7b | ||
|  | 24f8a8fdba | ||
|  | 28bbe0ee19 | ||
|  | c21ca2062e | ||
|  | e3e289a27c | ||
|  | 9540f6b9d3 | ||
|  | 539943fb0f | ||
|  | 7a8ebffd40 | ||
|  | 3d48f4e210 | ||
|  | 667cdbea13 | ||
|  | f5fb4dd3b0 | ||
|  | 5a2722d049 | ||
|  | f3b6cfbd01 | ||
|  | e239a6057c | ||
|  | 9b1c439e15 | ||
|  | 074f2e7c8f | ||
|  | 4b1533e925 | ||
|  | 6812a60668 | ||
|  | 6f0cb846f0 | ||
|  | c79307692b | ||
|  | 08b2f50ac7 | ||
|  | 3577fa1e42 | ||
|  | cb6630582a | ||
|  | ca5fff31a7 | ||
|  | 69b1f1e29e | ||
|  | 4e2b642ed1 | ||
|  | 3c26ce2a55 | ||
|  | 7d2cf97c06 | ||
|  | cfce6296fb | ||
|  | 1601703ff2 | ||
|  | 905ad3e2b7 | ||
|  | 15b7e95545 | ||
|  | 247f6f038d | ||
|  | 7c6df7cce3 | ||
|  | 1a92306d51 | ||
|  | 59e9fae1d5 | ||
|  | 998094241d | ||
|  | d6c3313138 | ||
|  | b7e252b91a | ||
|  | 6071beb15d | ||
|  | cda830686d | ||
|  | a29b888620 | 
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| *.db | ||||
							
								
								
									
										97
									
								
								ChangeLog
									
									
									
									
									
								
							
							
						
						
									
										97
									
								
								ChangeLog
									
									
									
									
									
								
							| @@ -1,6 +1,101 @@ | ||||
| SNMP::Info - Friendly OO-style interface to Network devices using SNMP. | ||||
|  | ||||
| version 3.04_001 (2013-08-16) | ||||
| version 3.10 (2013-12-16) | ||||
|  | ||||
|    [BUG FIXES] | ||||
|  | ||||
|     * Data values of zero are now sent to munge method instead of skipped | ||||
|  | ||||
| version 3.09 (2013-12-15) | ||||
|  | ||||
|    [NEW FEATURES] | ||||
|  | ||||
|     * [#45] IBM (Blade Network Technologies) Rackswitch support in new class | ||||
|       L3::IBMGbTor | ||||
|     * [] set_i_untagged combines both set_i_vlan and set_i_pvid in one method | ||||
|     * [#41] Riverbed Steelhead support added in new class L3::Steelhead | ||||
|     * New c_cap(), cdp_cap(), and lldp_cap() methods which return a hash of | ||||
|       arrays with each array containing the system capabilities reported as | ||||
|       supported by the remote system via CDP or LLDP. | ||||
|  | ||||
|    [ENHANCEMENTS] | ||||
|  | ||||
|     * Remove "Switch" from model name in L3::Foundry | ||||
|     * [#49] IOS-XR support, add identification of IOS XR and version in | ||||
|       CiscoStats | ||||
|     * Aruba POE Support | ||||
|     * Aruba utilizes Q-BRIDGE-MIB when available for VLAN information to | ||||
|       better support wired switches | ||||
|     * Add lldp_platform() method which uses lldp_rem_sysdesc() or | ||||
|       lldp_rem_sysname() to provide a clue to type of remote LLDP capable | ||||
|       device. | ||||
|     * [RT#78232] Extend cdpCacheCapabilities to show more CDP bits | ||||
|  | ||||
|    [BUG FIXES] | ||||
|  | ||||
|     * Modify _xos_i_vlan_membership() in L3::Extreme to only include tagged | ||||
|       ports | ||||
|     * When determining the BSSID in Airespace there is only one hexadecimal | ||||
|       digit available so skip if outside the range of 1-16, 17 is reserved | ||||
|       for 3rd party AP's | ||||
|     * Don't assume entity index 1 is the chassis and has serial in Layer3 | ||||
|     * Capture serial number on newer Aruba devices | ||||
|     * munge_bits() correctly unpacks BITS | ||||
|     * Fix for single instance table leafs in test_class_mocked.pl | ||||
|     * Fix power module indexing | ||||
|  | ||||
| version 3.08 (2013-10-22) | ||||
|  | ||||
|    [ENHANCEMENTS] | ||||
|  | ||||
|     * Rewrite of L3::Aruba, now supports pseudo ENTITY-MIB methods to gather | ||||
|       module information, more interface information for APs, more | ||||
|       wireless information to include client stats, and arpnip information | ||||
|       from wireless clients.  WARNING: AP device interfaces are now based on | ||||
|       AP MAC and radio versus BSSID to align with other wireless classes. | ||||
|     * [#64] Add i_speed_admin() to L2::2900 (psychiatric) | ||||
|     * [#66] Support for VSS via CISCO-VIRTUAL-SWITCH-MIB in L3::6500 | ||||
|     * [#67] Add the possibility to set speed for Layer3::C4000 (psychiatric) | ||||
|     * [#69] set speed and duplex on Cisco VSS system (psychiatric) | ||||
|     * munge_null() now removes all non-printable control characters | ||||
|     * Support Aironet standalone access points (Layer2::Aironet) running IOS15 | ||||
|     * lldp_port() returns port ID instead of port description if the port ID | ||||
|       subtype is "interface name".  This improves the ability to correlate | ||||
|       ports by name when a port description is also set. | ||||
|     * Add docs note about make_snmpdata.pl under EXTENDING SNMP::Info | ||||
|     * [#46] Brocade (Foundry) Module Support | ||||
|     * Brocade (Foundry) POE Support | ||||
|     * Support peth_port_power() power supplied by PoE ports in L2::Baystack | ||||
|     * Update test_class.pl utility to allow ignore of snmp.conf and test | ||||
|       summarize more standard class methods | ||||
|     * On EOS, the LLDP port ID is a dot1d port | ||||
|     * Use LLDP in Layer3::Aruba, for switches | ||||
|     * Clean up more model names in L2::Baystack | ||||
|  | ||||
|    [BUG FIXES] | ||||
|  | ||||
|     * [#68] Fix device_port entries for switches with non-unique | ||||
|       ifDesc (Nic Bernstein) | ||||
|     * Don't try to munge undef values | ||||
|     * [#49] Perl 5.18 UNIVERSAL::can change could cause infinite loop  | ||||
|     * Silence warning from uninitialized variable in L3::Passport e_descr() | ||||
|  | ||||
| version 3.07 (2013-10-01) | ||||
|  | ||||
|    [ENHANCEMENTS] | ||||
|  | ||||
|     * Support for Pica8 switches in L3::Pica8 | ||||
|     * Factor out cache/munge code from global/attr methods | ||||
|  | ||||
|    [BUG FIXES] | ||||
|  | ||||
|    * [#48] Switch duplicate J9624A for J9626A in Layer2/HP (R. Kerr) | ||||
|    * Correct device serial number reporting for Nexus devices | ||||
|    * Override ipAddrTable methods in L3::Nexus as some versions do not | ||||
|      index the table with the IPv4 address in accordance with the MIB | ||||
|      definition. | ||||
|  | ||||
| version 3.05 (2013-08-16) | ||||
|  | ||||
|    [ENHANCEMENTS] | ||||
|  | ||||
|   | ||||
							
								
								
									
										260
									
								
								Info.pm
									
									
									
									
									
								
							
							
						
						
									
										260
									
								
								Info.pm
									
									
									
									
									
								
							| @@ -24,7 +24,7 @@ use vars | ||||
|     qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG %SPEED_MAP | ||||
|     $NOSUCH $BIGINT $REPEATERS/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| =head1 NAME | ||||
|  | ||||
| @@ -32,7 +32,7 @@ SNMP::Info - OO Interface to Network devices and MIBs through SNMP | ||||
|  | ||||
| =head1 VERSION | ||||
|  | ||||
| SNMP::Info - Version 3.04_001 | ||||
| SNMP::Info - Version 3.10 | ||||
|  | ||||
| =head1 AUTHOR | ||||
|  | ||||
| @@ -766,6 +766,13 @@ Original Equipment Manufacturer (OEM) such as the HP ProCurve 9300 and 6300 seri | ||||
|  | ||||
| See documentation in L<SNMP::Info::Layer3::HP9300> for details. | ||||
|  | ||||
| =item SNMP::Info::Layer3::IBMGbTor | ||||
|  | ||||
| SNMP Interface to IBM Rackswitch (formerly Blade Network Technologies) | ||||
| network devices. | ||||
|  | ||||
| See documentation in L<SNMP::Info::Layer3::IBMGbTor> for details. | ||||
|  | ||||
| =item SNMP::Info::Layer3::Juniper | ||||
|  | ||||
| Subclass for Juniper devices | ||||
| @@ -833,11 +840,22 @@ Subclass for FreeBSD-Based Firewalls using Pf /Pf Sense | ||||
|  | ||||
| See documentation in L<SNMP::Info::Layer3::Pf> for details. | ||||
|  | ||||
| =item SNMP::Info::Layer3::Pica8 | ||||
|  | ||||
| Subclass for Pica8 devices. | ||||
|  | ||||
| See documentation in L<SNMP::Info::Layer3::Pica8> for details. | ||||
|  | ||||
| =item SNMP::Info::Layer3::SonicWALL | ||||
|  | ||||
| Subclass for generic SonicWALL devices. See documentation in | ||||
| L<SNMP::Info::Layer3::SonicWALL> for details. | ||||
|  | ||||
| =item SNMP::Info::Layer3::Steelhead | ||||
|  | ||||
| Subclass for  Riverbed Steelhead WAN optimization appliances. See | ||||
| documentation in L<SNMP::Info::Layer3::Steelhead> for details. | ||||
|  | ||||
| =item SNMP::Info::Layer3::Sun | ||||
|  | ||||
| Subclass for Generic Sun Routers running SunOS. | ||||
| @@ -1390,8 +1408,11 @@ sub device_type { | ||||
|         12325 => 'SNMP::Info::Layer3::Pf', | ||||
|         14525 => 'SNMP::Info::Layer2::Trapeze', | ||||
|         14988 => 'SNMP::Info::Layer3::Mikrotik', | ||||
|         17163 => 'SNMP::Info::Layer3::Steelhead', | ||||
|         25506 => 'SNMP::Info::Layer3::H3C', | ||||
|         26543 => 'SNMP::Info::Layer3::IBMGbTor', | ||||
|         30065 => 'SNMP::Info::Layer3::Arista', | ||||
|         35098 => 'SNMP::Info::Layer3::Pica8', | ||||
|     ); | ||||
|  | ||||
|     my %l2sysoidmap = ( | ||||
| @@ -1415,6 +1436,8 @@ sub device_type { | ||||
|         14179 => 'SNMP::Info::Layer2::Airespace', | ||||
|         14525 => 'SNMP::Info::Layer2::Trapeze', | ||||
|         14823 => 'SNMP::Info::Layer3::Aruba', | ||||
|         17163 => 'SNMP::Info::Layer3::Steelhead', | ||||
|         26543 => 'SNMP::Info::Layer3::IBMGbTor', | ||||
|     ); | ||||
|  | ||||
|     my %l7sysoidmap = ( | ||||
| @@ -1527,6 +1550,13 @@ sub device_type { | ||||
|         $objtype = 'SNMP::Info::Layer2::HPVC' | ||||
|             if ( $desc =~ /HP\sVC\s/ ); | ||||
|  | ||||
|         # Aironet - IOS | ||||
|         # Starting with IOS 15, Aironet reports sysServices 6, even though | ||||
|         # it still is the same layer2 access point. | ||||
|         $objtype = 'SNMP::Info::Layer2::Aironet' | ||||
|             if ($desc =~ /\b(C1100|C1130|C1140|AP1200|C350|C1200|C1240|C1250)\b/ | ||||
|             and $desc =~ /\bIOS\b/ ); | ||||
|  | ||||
|         # Generic device classification based upon sysObjectID | ||||
|         if (    ( $objtype eq 'SNMP::Info::Layer3' ) | ||||
|             and ( defined($id) ) | ||||
| @@ -2447,7 +2477,7 @@ sub _get_topo_data { | ||||
|     my $topo_cap = shift; | ||||
|     my $method   = shift; | ||||
|  | ||||
|     return unless $method =~ /(ip|if|port|id|platform)/; | ||||
|     return unless $method =~ /(ip|if|port|id|platform|cap)/; | ||||
|  | ||||
|     my %t_data; | ||||
|     foreach my $proto (@$topo_cap) { | ||||
| @@ -2602,7 +2632,8 @@ sub c_id { | ||||
|  | ||||
| Returns reference to hash.  Key: iid, Value: Remote Device Type | ||||
|  | ||||
| Note:  LLDP and EDP do not provide this information. | ||||
| Note:  EDP does not provide this information.  LLDP uses (C<lldpRemSysDesc>) | ||||
| or C<lldp_rem_sysname> as the closest match. | ||||
|  | ||||
| =cut | ||||
|  | ||||
| @@ -2624,6 +2655,34 @@ sub c_platform { | ||||
|     return _get_topo_data ($self, $partial, $topo_cap, 'platform'); | ||||
| } | ||||
|  | ||||
| =item $info->c_cap(partial, topology_protocol_arrayref) | ||||
|  | ||||
| Returns reference to hash of arrays.  Key: iid, Value: Array of capabilities  | ||||
| supported by the device.  See the specific protocol class for string values | ||||
| which could be elements within the array.  | ||||
|  | ||||
| Note:  Only CDP and LLDP support this method. | ||||
|  | ||||
| =cut | ||||
|  | ||||
| sub c_cap { | ||||
|     my $self     = shift; | ||||
|     my $partial  = shift; | ||||
|     my $topo_cap = shift; | ||||
|  | ||||
|     # Default to old behavior if not called with topo_cap | ||||
|     if ( !$topo_cap ) { | ||||
|         my $topo_test = $self->has_topo(); | ||||
|         if ($topo_test) { | ||||
|             $topo_cap = $topo_test; | ||||
|         } | ||||
|         else { | ||||
|             return; | ||||
|         } | ||||
|     } | ||||
|     return _get_topo_data ($self, $partial, $topo_cap, 'cap'); | ||||
| } | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head1 SETTING DATA VIA SNMP | ||||
| @@ -2677,6 +2736,38 @@ Beware, calling $info->error() clears the error. | ||||
|  | ||||
| =head1 EXTENDING SNMP::INFO | ||||
|  | ||||
| To support a new class (vendor or platform) of device, add a Perl package with | ||||
| the data structures and methods listed below. | ||||
|  | ||||
| If this seems a little scary, then the SNMP::Info developers are usually happy | ||||
| to accept the SNMP data from your device and make an attempt at the class | ||||
| themselves. Usually a "beta" release will go to CPAN for you to verify the | ||||
| implementation. | ||||
|  | ||||
| =head2 Gathering MIB data for SNMP::Info Developers | ||||
|  | ||||
| The preference is to open a feature request in the SourceForge project.  This | ||||
| allows all developers to have visibility into the request.  Please include | ||||
| pointers to the applicable platform MIBs.  For development we will need an | ||||
| C<snmpwalk> of the device.  There is a tool now included in the SNMP::Info | ||||
| distribution to help with this task, although you'll most likely need to | ||||
| download the distribution from CPAN as it's included in the "C<t/util>" | ||||
| directory. | ||||
|  | ||||
| The utility is named C<make_snmpdata.pl>. Run it with a command line like: | ||||
|  | ||||
|  ./make_snmpdata.pl -c community -i -d device_ip \ | ||||
|   -m /home/netdisco-mibs/rfc:/home/netdisco-mibs/net-snmp:/home/netdisco-mibs/dir3 \ | ||||
|   SNMPv2-MIB IF-MIB EtherLike-MIB BRIDGE-MIB Q-BRIDGE-MIB ENTITY-MIB \ | ||||
|   POWER-ETHERNET-MIB IPV6-MIB LLDP-MIB DEVICE-SPECIFIC-MIB-NAME(s) > output.txt | ||||
|  | ||||
| This will print to the file every MIB entry with data in a format that the | ||||
| developers can use to emulate read operations without needing access to the | ||||
| device.  Preference would be to mask any sensitive data in the output, zip the | ||||
| file, and upload as an attachment to the Sourceforge tracker.  However, if you | ||||
| do not feel comfortable  uploading the output to the tracker you could e-mail | ||||
| it to the developer that has claimed the ticket. | ||||
|  | ||||
| =head2 Data Structures required in new Subclass | ||||
|  | ||||
| A class inheriting this class must implement these data structures :  | ||||
| @@ -3217,21 +3308,7 @@ sub munge_bits { | ||||
|     my $bits = shift; | ||||
|     return unless defined $bits; | ||||
|  | ||||
|     return unpack( "b*", $bits ); | ||||
| } | ||||
|  | ||||
| =item munge_caps | ||||
|  | ||||
| Takes an octet string and returns an ascii binary string, 7 digits long, MSB. | ||||
|  | ||||
| =cut | ||||
|  | ||||
| sub munge_caps { | ||||
|     my $caps = shift; | ||||
|     return unless defined $caps; | ||||
|  | ||||
|     my $bits = substr( unpack( "B*", $caps ), -7 ); | ||||
|     return $bits; | ||||
|     return unpack( "B*", $bits ); | ||||
| } | ||||
|  | ||||
| =item munge_counter64 | ||||
| @@ -3292,15 +3369,15 @@ sub munge_port_list { | ||||
|  | ||||
| =item munge_null() | ||||
|  | ||||
| Removes nulls from a string | ||||
| Removes control characters from a string | ||||
|  | ||||
| =cut | ||||
|  | ||||
| # munge_null() - removes nulls (\0) | ||||
| # munge_null() - removes nulls (\0) and other control characters | ||||
| sub munge_null { | ||||
|     my $text = shift || return; | ||||
|  | ||||
|     $text =~ s/\0//g; | ||||
|     $text =~ s/[[:cntrl:]]//g; | ||||
|     return $text; | ||||
| } | ||||
|  | ||||
| @@ -3541,19 +3618,16 @@ sub _global { | ||||
|         $attr =~ s/^(load|orig)_//; | ||||
|         $attr =~ s/_raw$//; | ||||
|  | ||||
|         # Get the callback hash for data munging | ||||
|         my $munge = $self->munge(); | ||||
|  | ||||
|         # Return cached data unless loading | ||||
|         # We now store in raw format so munge before returning | ||||
|         # unless expecting raw data | ||||
|         if ( defined $self->{"_$attr"} && !$load ) { | ||||
|             if ( defined $munge->{$attr} && !$raw ) { | ||||
|                 my $val    = $self->{"_$attr"}; | ||||
|                 my $subref = $munge->{$attr}; | ||||
|                 return &$subref($val); | ||||
|             my $val = $self->{"_$attr"}; | ||||
|  | ||||
|             if ( !$raw ) { | ||||
|                 return $self->_munge($attr, $val); | ||||
|             } else{ | ||||
|                 return $self->{"_$attr"}; | ||||
|                 return $val; | ||||
|             }  | ||||
|         } | ||||
|  | ||||
| @@ -3584,12 +3658,11 @@ sub _global { | ||||
|         } | ||||
|  | ||||
|         # Save Cached Value | ||||
|         $self->{"_$attr"} = $val; | ||||
|         $self->_cache($attr, $val); | ||||
|  | ||||
|         # Data Munging | ||||
|         if ( defined $munge->{$attr} && !$raw ) { | ||||
|             my $subref = $munge->{$attr}; | ||||
|             $val = &$subref($val); | ||||
|         if ( !$raw ) { | ||||
|             $val = $self->_munge($attr, $val); | ||||
|         } | ||||
|  | ||||
|         return $val; | ||||
| @@ -3866,7 +3939,6 @@ sub _load_attr { | ||||
|         my $ver    = $self->snmp_ver(); | ||||
|         my $nosuch = $self->nosuch(); | ||||
|         my $store  = $self->store(); | ||||
|         my $munge  = $self->munge(); | ||||
|  | ||||
|         my $load = $method =~ /^load/; | ||||
|         my $raw  = $method =~ /raw$/; | ||||
| @@ -4046,24 +4118,14 @@ sub _load_attr { | ||||
|  | ||||
|         # Cache data if we are not getting partial data: | ||||
|         if ( !defined $partial ) { | ||||
|             $self->{"_${attr}"}++; | ||||
|             $store->{$attr} = $localstore; | ||||
|             $self->_cache($attr, $localstore); | ||||
|         } | ||||
|  | ||||
|         # Data Munging | ||||
|         # Checks for an entry in %munge and munges values unless we expect | ||||
|         # raw data | ||||
|         if ( defined $munge->{$attr} && !$raw ) { | ||||
|             my $subref = $munge->{$attr}; | ||||
|             my %munged; | ||||
|             foreach my $key ( keys %$localstore ) { | ||||
|                 my $value = $localstore->{$key}; | ||||
|                 next unless $key; | ||||
|                 my $munged_value = &$subref($value); | ||||
|                 $munged{$key} = $munged_value; | ||||
|             } | ||||
|             return \%munged; | ||||
|         if ( !$raw ) { | ||||
|             $localstore = $self->_munge($attr, $localstore); | ||||
|         } | ||||
|  | ||||
|         return $localstore; | ||||
|     } | ||||
| } | ||||
| @@ -4072,11 +4134,6 @@ sub _load_attr { | ||||
|  | ||||
| Used internally by AUTOLOAD to return data called by methods listed in %FUNCS. | ||||
|  | ||||
| Called like $info->METHOD(). | ||||
|  | ||||
| The first time ran, it will call $info->load_METHOD().   | ||||
| Every time after it will return cached data. | ||||
|  | ||||
| =cut | ||||
|  | ||||
| sub _show_attr { | ||||
| @@ -4086,20 +4143,9 @@ sub _show_attr { | ||||
|  | ||||
|     my $store = $self->store(); | ||||
|  | ||||
|     # Get the callback hash for data munging | ||||
|     my $munge = $self->munge(); | ||||
|  | ||||
|     if ( defined $munge->{$attr} && !$raw ) { | ||||
|     if ( !$raw ) { | ||||
|         my $localstore = $store->{$attr}; | ||||
|         my $subref = $munge->{$attr}; | ||||
|         my %munged; | ||||
|         foreach my $key ( keys %$localstore ) { | ||||
|             my $value = $localstore->{$key}; | ||||
|             next unless $key; | ||||
|             my $munged_value = &$subref($value); | ||||
|             $munged{$key} = $munged_value; | ||||
|         } | ||||
|         return \%munged; | ||||
|         return $self->_munge($attr, $localstore); | ||||
|     } | ||||
|     else { | ||||
|         return $store->{$attr}; | ||||
| @@ -4173,6 +4219,66 @@ sub modify_port_list { | ||||
|     return pack( "B*", join( '', @$portlist ) ); | ||||
| } | ||||
|  | ||||
| =item $info->_cache(attr, data) | ||||
|  | ||||
| Cache retrieved data so that if it's asked for again, we use the cache instead | ||||
| of going back to Net-SNMP. Data is cached inside the blessed hashref C<$self>. | ||||
|  | ||||
| Accepts the leaf and value (scalar, or hashref for a table). Does not return | ||||
| anything useful. | ||||
|  | ||||
| =cut | ||||
|  | ||||
| sub _cache { | ||||
|     my $self = shift; | ||||
|     my ($attr, $data) = @_; | ||||
|     my $store = $self->store(); | ||||
|  | ||||
|     if (ref {} eq ref $data) { | ||||
|         $self->{"_${attr}"}++; | ||||
|         $store->{$attr} = $data; | ||||
|     } | ||||
|     else { | ||||
|         $self->{"_$attr"} = $data; | ||||
|     } | ||||
| } | ||||
|  | ||||
| =item $info->_munge(attr, data) | ||||
|  | ||||
| Raw data returned from Net-SNMP might not be formatted correctly or might have | ||||
| platform-specific bugs or mistakes. The MUNGE feature of SNMP::Info allows for | ||||
| fixups to take place. | ||||
|  | ||||
| Accepts the leaf and value (scalar, or hashref for a table) and returns the raw | ||||
| or the munged data, as appropriate. That is, you do not need to know whether | ||||
| MUNGE is installed, and it's safe to call this method regardless. | ||||
|  | ||||
| =cut | ||||
|  | ||||
| sub _munge { | ||||
|     my $self = shift; | ||||
|     my ($attr, $data) = @_; | ||||
|     my $munge = $self->munge(); | ||||
|  | ||||
|     return $data unless defined $munge->{$attr}; | ||||
|  | ||||
|     if (ref {} eq ref $data) { | ||||
|         my $subref = $munge->{$attr}; | ||||
|         my %munged; | ||||
|         foreach my $key ( keys %$data ) { | ||||
|             my $value = $data->{$key}; | ||||
|             next unless defined $value; | ||||
|             $munged{$key} = $subref->($value); | ||||
|         } | ||||
|         return \%munged; | ||||
|     } | ||||
|     else { | ||||
|         return unless $data; | ||||
|         my $subref = $munge->{$attr}; | ||||
|         return $subref->($data); | ||||
|     } | ||||
| } | ||||
|  | ||||
| =item _validate_autoload_method(method) | ||||
|  | ||||
| Used internally by AUTOLOAD to validate that a dynamic method should be | ||||
| @@ -4285,14 +4391,7 @@ sub can { | ||||
|     my $method = shift; | ||||
|  | ||||
|     # use results of parent can() | ||||
|     my $meth_ref = $self->SUPER::can($method); | ||||
|  | ||||
|     # Don't return if passed $super as it means we were called | ||||
|     # from AUTOLOAD for a method that hasn't been generated yet. | ||||
|     if ($meth_ref) { | ||||
|         return $meth_ref | ||||
|             unless ( defined $AUTOLOAD && $AUTOLOAD =~ /SUPER::$method$/ ); | ||||
|     } | ||||
|     return $self->SUPER::can($method) if $self->SUPER::can($method); | ||||
|  | ||||
|     my $validated = $self->_validate_autoload_method($method); | ||||
|     return unless $validated; | ||||
| @@ -4359,7 +4458,7 @@ subclass. | ||||
| =cut | ||||
|  | ||||
| sub AUTOLOAD { | ||||
|     my $self    = shift; | ||||
|     my $self = shift; | ||||
|     my ($sub_name) = $AUTOLOAD =~ /::(\w+)$/; | ||||
|  | ||||
|     return if $sub_name =~ /DESTROY$/; | ||||
| @@ -4377,10 +4476,19 @@ sub AUTOLOAD { | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     # This enables us to use SUPER:: for AUTOLOAD methods as well | ||||
|     # as the true OO methods.  Method needs to be renamed to prevent | ||||
|     # namespace collision when we insert into the symbol table later. | ||||
|     if ( $AUTOLOAD =~ /SUPER::$sub_name$/ ) { | ||||
|         $AUTOLOAD =~ s/SUPER::$sub_name/orig_$sub_name/; | ||||
|         $sub_name = "orig_$sub_name"; | ||||
|     } | ||||
|  | ||||
|     return unless my $meth_ref = $self->can($sub_name, @_); | ||||
|     return $self->$meth_ref(@_); | ||||
|  | ||||
| } | ||||
|  | ||||
| 1; | ||||
|  | ||||
| =head1 COPYRIGHT AND LICENSE | ||||
|   | ||||
| @@ -38,7 +38,7 @@ use SNMP::Info; | ||||
|  | ||||
| use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS | ||||
|     = ( 'ALCATEL-IND1-INTERSWITCH-PROTOCOL-MIB' => 'aipAMAPRemDeviceType', ); | ||||
|   | ||||
| @@ -38,7 +38,7 @@ use SNMP::Info; | ||||
|  | ||||
| use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( 'ADSL-LINE-MIB' => 'adslLineType' ); | ||||
|  | ||||
|   | ||||
| @@ -39,7 +39,7 @@ use SNMP::Info; | ||||
|  | ||||
| use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::MIBS, | ||||
| @@ -688,42 +688,52 @@ sub i_ssidmac { | ||||
|     foreach my $oid ( keys %$ssidlist ) { | ||||
|  | ||||
|         my @parts    = split( /\./, $oid ); | ||||
|         my $ssid_idx = pop (@parts); | ||||
|         my $slot     = pop (@parts); | ||||
|         my $last     = pop (@parts); | ||||
|         my $ssid_idx = pop(@parts); | ||||
|         my $slot     = pop(@parts); | ||||
|         my $last     = pop(@parts); | ||||
|  | ||||
|         my $iid = $oid; | ||||
|  | ||||
|         # Get radio band | ||||
|         $iid =~ s/\.\d+$//; | ||||
|         my $ap_type = $apif_type->{$iid}; | ||||
|  | ||||
|         # Determine if IOS based | ||||
|         $iid =~ s/\.\d+$//; | ||||
|         my $ios = $ap_ios->{$iid} || ''; | ||||
|          | ||||
|         # Four cases: | ||||
|         # IOS and 2.4Ghz count up, starts at zero | ||||
|         if ($ios and $ap_type =~ /b$/) { | ||||
|             $last = $last + ($ssid_idx - 1); | ||||
|  | ||||
|         # 17 can be used as index for 3rd Party AP's.  We only have one | ||||
|         # hexadecimal digit to work with so skip if outside the range | ||||
|         if ( $ssid_idx > 0 and $ssid_idx < 17 ) { | ||||
|  | ||||
|             # Four cases: | ||||
|             # IOS and 2.4Ghz count up, starts at zero | ||||
|             if ( $ios and $ap_type =~ /b$/ ) { | ||||
|                 $last = $last + ( $ssid_idx - 1 ); | ||||
|             } | ||||
|  | ||||
|             # IOS and 5Ghz - count down from maximum of 16 | ||||
|             elsif ( $ios and $ap_type =~ /a$/ ) { | ||||
|                 $last = $last + ( 16 - $ssid_idx ); | ||||
|             } | ||||
|  | ||||
|             # VxWorks and 5Ghz - count up, starts at zero | ||||
|             elsif ( $ios and $ap_type =~ /a$/ ) { | ||||
|                 $last = $last + ( $ssid_idx - 1 ); | ||||
|             } | ||||
|  | ||||
|             # VxWorks and 2.4Ghz - count down from maximum of 16 | ||||
|             else { | ||||
|                 $last = $last + ( 16 - $ssid_idx ); | ||||
|             } | ||||
|         } | ||||
|         # IOS and 5Ghz - count down from maximum of 16 | ||||
|         elsif ($ios and $ap_type =~ /a$/) { | ||||
|             $last = $last + (16 - $ssid_idx); | ||||
|         } | ||||
|         # VxWorks and 5Ghz - count up, starts at zero | ||||
|         elsif ($ios and $ap_type =~ /a$/) { | ||||
|             $last = $last + ($ssid_idx - 1); | ||||
|         } | ||||
|         # VxWorks and 2.4Ghz - count down from maximum of 16 | ||||
|         else { | ||||
|             $last = $last + (16 - $ssid_idx); | ||||
|         } | ||||
|          | ||||
|        push (@parts, $last); | ||||
|        my $bssid = join( ':', map { sprintf( "%02x", $_ ) } @parts ); | ||||
|        $i_ssidmac{$oid} = $bssid; | ||||
|  | ||||
|         push( @parts, $last ); | ||||
|         my $bssid = join( ':', map { sprintf( "%02x", $_ ) } @parts ); | ||||
|         $i_ssidmac{$oid} = $bssid; | ||||
|     } | ||||
|  | ||||
|    return \%i_ssidmac; | ||||
|     return \%i_ssidmac; | ||||
| } | ||||
|  | ||||
| sub i_80211channel { | ||||
| @@ -1225,12 +1235,9 @@ switch. | ||||
|  | ||||
| =item $airespace->layers() | ||||
|  | ||||
| Returns 00000011.  Class emulates Layer 2 functionality for Thin APs through | ||||
| Returns 00000111.  Class emulates Layer 2 functionality for Thin APs through | ||||
| proprietary MIBs. | ||||
|  | ||||
| =item $airespace->at_netaddr() | ||||
| =item $airespace->at_paddr() | ||||
|  | ||||
| =item $airespace->serial() | ||||
|  | ||||
| (C<agentInventorySerialNumber>) | ||||
| @@ -1257,7 +1264,7 @@ Returns reference to hash.  Indicates whether the SSID is broadcast. | ||||
| Returns reference to hash.  Current operating frequency channel of the radio | ||||
| interface. | ||||
|  | ||||
| =item $dot11->dot11_cur_tx_pwr_mw() | ||||
| =item $airespace->dot11_cur_tx_pwr_mw() | ||||
|  | ||||
| Returns reference to hash.  Current transmit power, in milliwatts, of the | ||||
| radio interface. | ||||
| @@ -1678,15 +1685,15 @@ airespace_if_name() for virtual interfaces. | ||||
|  | ||||
| =item $airespace->i_description() | ||||
|  | ||||
| Returns reference to map of IIDs to interface types.  Returns C<ifDescr> | ||||
| for Ethernet interfaces, airespace_ap_loc() for thin AP interfaces, and | ||||
| airespace_if_name() for virtual interfaces. | ||||
| Returns reference to map of IIDs to interface descriptions.  Returns | ||||
| C<ifDescr> for Ethernet interfaces, airespace_ap_loc() for thin AP | ||||
| interfaces, and airespace_if_name() for virtual interfaces. | ||||
|  | ||||
| =item $airespace->i_type() | ||||
|  | ||||
| Returns reference to map of IIDs to interface descriptions.  Returns | ||||
| C<ifType> for Ethernet interfaces, airespace_apif_type() for thin AP | ||||
| interfaces, and airespace_if_type() for virtual interfaces. | ||||
| Returns reference to map of IIDs to interface types.  Returns C<ifType> | ||||
| for Ethernet interfaces, airespace_apif_type() for thin AP interfaces, and | ||||
| airespace_if_type() for virtual interfaces. | ||||
|  | ||||
| =item $airespace->i_up() | ||||
|  | ||||
| @@ -1809,6 +1816,24 @@ entity which 'contains' this entity. | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Arp Cache Table Augmentation | ||||
|  | ||||
| The controller has knowledge of MAC->IP mappings for wireless clients. | ||||
| Augmenting the arp cache data with these MAC->IP mappings enables visibility | ||||
| for stations that only communicate locally. | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item $airespace->at_paddr() | ||||
|  | ||||
| Adds MAC addresses extracted from the index of C<bsnMobileStationIpAddress>. | ||||
|  | ||||
| =item $airespace->at_netaddr() | ||||
|  | ||||
| Adds IP addresses from C<bsnMobileStationIpAddress>. | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head1 Data Munging Callback Subroutines | ||||
|  | ||||
| =over | ||||
|   | ||||
| @@ -42,7 +42,7 @@ use SNMP::Info; | ||||
|  | ||||
| use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     'BRIDGE-MIB'   => 'dot1dBaseBridgeAddress', | ||||
| @@ -308,6 +308,8 @@ sub i_vlan { | ||||
|     return $i_vlan; | ||||
| } | ||||
|  | ||||
| sub i_untagged { goto &i_vlan } | ||||
|  | ||||
| sub i_vlan_membership { | ||||
|     my $bridge  = shift; | ||||
|     my $partial = shift; | ||||
| @@ -365,6 +367,8 @@ sub set_i_vlan { | ||||
|     return; | ||||
| } | ||||
|  | ||||
| sub set_i_untagged { goto &set_i_vlan } | ||||
|  | ||||
| sub set_add_i_vlan_tagged { | ||||
|     my $bridge = shift; | ||||
|  | ||||
| @@ -597,6 +601,10 @@ to a hash. | ||||
|  | ||||
| Returns a mapping between C<ifIndex> and the PVID or default VLAN. | ||||
|  | ||||
| =item $vtp->i_untagged() | ||||
|  | ||||
| An alias for C<i_vlan>. | ||||
|  | ||||
| =item $bridge->i_vlan_membership() | ||||
|  | ||||
| Returns reference to hash of arrays: key = C<ifIndex>, value = array of VLAN | ||||
| @@ -893,6 +901,10 @@ operations. | ||||
|  | ||||
| Currently unsupported.  Throws an error and returns. | ||||
|  | ||||
| =item $bridge->set_i_untagged(vlan, ifIndex) | ||||
|  | ||||
| An alias for C<set_i_vlan>. | ||||
|  | ||||
| =item $bridge->set_i_pvid(pvid, ifIndex) | ||||
|  | ||||
| Currently unsupported.  Throws an error and returns. | ||||
|   | ||||
							
								
								
									
										86
									
								
								Info/CDP.pm
									
									
									
									
									
								
							
							
						
						
									
										86
									
								
								Info/CDP.pm
									
									
									
									
									
								
							| @@ -40,9 +40,10 @@ use SNMP::Info; | ||||
| @SNMP::Info::CDP::ISA       = qw/SNMP::Info Exporter/; | ||||
| @SNMP::Info::CDP::EXPORT_OK = qw//; | ||||
|  | ||||
| use vars qw/$VERSION $DEBUG %FUNCS %GLOBALS %MIBS %MUNGE $INIT/; | ||||
| use vars | ||||
|     qw/$VERSION $DEBUG %FUNCS %GLOBALS %MIBS %MUNGE $INIT %CDP_CAPABILITIES/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| # Five data structures required by SNMP::Info | ||||
| %MIBS = ( 'CISCO-CDP-MIB' => 'cdpGlobalRun' ); | ||||
| @@ -65,6 +66,7 @@ $VERSION = '3.04_001'; | ||||
|     'cdp_port'         => 'cdpCacheDevicePort', | ||||
|     'cdp_platform'     => 'cdpCachePlatform', | ||||
|     'cdp_capabilities' => 'cdpCacheCapabilities', | ||||
|     'cdp_cap_hex'      => 'cdpCacheCapabilities', | ||||
|     'cdp_domain'       => 'cdpCacheVTPMgmtDomain', | ||||
|     'cdp_vlan'         => 'cdpCacheNativeVLAN', | ||||
|     'cdp_duplex'       => 'cdpCacheDuplex', | ||||
| @@ -76,7 +78,8 @@ $VERSION = '3.04_001'; | ||||
| ); | ||||
|  | ||||
| %MUNGE = ( | ||||
|     'cdp_capabilities' => \&SNMP::Info::munge_caps, | ||||
|     'cdp_cap_hex'      => \&SNMP::Info::munge_octet2hex, | ||||
|     'cdp_capabilities' => \&SNMP::Info::munge_bits, | ||||
|     'cdp_platform'     => \&SNMP::Info::munge_null, | ||||
|     'cdp_domain'       => \&SNMP::Info::munge_null, | ||||
|     'cdp_port'         => \&SNMP::Info::munge_null, | ||||
| @@ -87,6 +90,20 @@ $VERSION = '3.04_001'; | ||||
|  | ||||
| ); | ||||
|  | ||||
| %CDP_CAPABILITIES = ( | ||||
|     'Router'                  => 0x001, | ||||
|     'Trans-Bridge'            => 0x002, | ||||
|     'Source-Route-Bridge'     => 0x004, | ||||
|     'Switch'                  => 0x008, | ||||
|     'Host'                    => 0x010, | ||||
|     'IGMP'                    => 0x020, | ||||
|     'Repeater'                => 0x040, | ||||
|     'VoIP-Phone'              => 0x080, | ||||
|     'Remotely-Managed-Device' => 0x100, | ||||
|     'Supports-STP-Dispute'    => 0x200, | ||||
|     'Two-port Mac Relay'      => 0x400, | ||||
| ); | ||||
|  | ||||
| sub munge_power { | ||||
|     my $power = shift; | ||||
|     my $decimal = substr( $power, -3 ); | ||||
| @@ -160,6 +177,26 @@ sub cdp_ip { | ||||
|     return \%cdp_ip; | ||||
| } | ||||
|  | ||||
| sub cdp_cap { | ||||
|     my $cdp     = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $cdp_caps  = $cdp->cdp_cap_hex($partial)  || {}; | ||||
|  | ||||
|     my %cdp_cap; | ||||
|     foreach my $key ( keys %$cdp_caps ) { | ||||
|         my $cap_hex = $cdp_caps->{$key}; | ||||
|         next unless $cap_hex; | ||||
|  | ||||
|         foreach my $capability (keys %CDP_CAPABILITIES) { | ||||
|             if ( (hex $cap_hex) & $CDP_CAPABILITIES{$capability}) { | ||||
|                 push ( @{$cdp_cap{$key}}, $capability); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|     return \%cdp_cap; | ||||
| } | ||||
|  | ||||
| 1; | ||||
| __END__ | ||||
|  | ||||
| @@ -283,39 +320,48 @@ to a hash. | ||||
| =item $cdp->cdp_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>: | ||||
| binary string, MSB.  Each digit represents a bit from the table below from  | ||||
| the CDP Capabilities Mapping to Smartport Type table within the | ||||
| Cisco Small Business 200 Series Smart Switch Administration Guide,  | ||||
| L<http://www.cisco.com/c/en/us/support/switches/small-business-200-series-smart-switches/products-maintenance-guides-list.html>: | ||||
|  | ||||
| (Bit) - Description | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item (0x40) - Provides level 1 functionality. | ||||
| =item (0x400) - Two-Port MAC Relay. | ||||
|  | ||||
| =item (0x20) - The bridge or switch does not forward IGMP Report packets on | ||||
| =item (0x200) - CAST Phone Port / CVTA / Supports-STP-Dispute depending | ||||
|                 upon platform. | ||||
|  | ||||
| =item (0x100) - Remotely-Managed Device. | ||||
|  | ||||
| =item (0x80)  - VoIP Phone. | ||||
|  | ||||
| =item (0x40)  - Provides level 1 functionality. | ||||
|  | ||||
| =item (0x20)  - The bridge or switch does not forward IGMP Report packets on | ||||
| non router ports. | ||||
|  | ||||
| =item (0x10) - Sends and receives packets for at least one network layer | ||||
| =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 | ||||
| =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 | ||||
| =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 (0x02)  - Performs level 2 transparent bridging. | ||||
|  | ||||
| =item (0x01) - Performs level 3 routing for at least one network layer | ||||
| =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. | ||||
| Thanks to Martin Lorensen for a pointer to the original information and | ||||
| CPAN user Alex for updates. | ||||
|  | ||||
| (C<cdpCacheCapabilities>) | ||||
|  | ||||
| @@ -427,6 +473,14 @@ for decimal placement. | ||||
|  | ||||
| (C<cdpCachePowerConsumption>) | ||||
|  | ||||
| =item  $cdp->cdp_cap()  | ||||
|  | ||||
| Returns hash of arrays with each array containing the system capabilities | ||||
| supported by the remote system.  Possible elements in the array are | ||||
| C<Router>, C<Trans-Bridge>, C<Source-Route-Bridge>, C<Switch>, C<Host>, | ||||
| C<IGMP>, C<Repeater>, C<VoIP-Phone>, C<Remotely-Managed-Device>, | ||||
| C<Supports-STP-Dispute>, and C<Two-port Mac Relay>. | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head1 Data Munging Callback Subroutines | ||||
|   | ||||
| @@ -39,7 +39,7 @@ use SNMP::Info; | ||||
|  | ||||
| use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     'CISCO-CONFIG-COPY-MIB' => 'ccCopyTable', | ||||
|   | ||||
| @@ -38,7 +38,7 @@ use SNMP::Info; | ||||
|  | ||||
| use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( 'CISCO-IMAGE-MIB' => 'ciscoImageString', ); | ||||
|  | ||||
|   | ||||
| @@ -38,7 +38,7 @@ use Exporter; | ||||
|  | ||||
| use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE %PAECAPABILITIES/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     'CISCO-PORT-SECURITY-MIB' => 'ciscoPortSecurityMIB', | ||||
|   | ||||
| @@ -39,7 +39,7 @@ use SNMP::Info; | ||||
|  | ||||
| use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( 'CISCO-POWER-ETHERNET-EXT-MIB' => 'cpeExtPsePortEntPhyIndex', | ||||
|           'CISCO-CDP-MIB' => 'cdpCachePowerConsumption' ); | ||||
|   | ||||
| @@ -39,7 +39,7 @@ use SNMP::Info; | ||||
|  | ||||
| use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( 'CISCO-CLASS-BASED-QOS-MIB' => 'cbQosIfIndex', ); | ||||
|  | ||||
|   | ||||
| @@ -39,7 +39,7 @@ use SNMP::Info; | ||||
|  | ||||
| use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( 'CISCO-RTTMON-MIB' => 'rttMonCtrlAdminOwner', ); | ||||
|  | ||||
|   | ||||
| @@ -39,7 +39,7 @@ use SNMP::Info; | ||||
|  | ||||
| use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE %PORTSTAT/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( 'CISCO-STACK-MIB' => 'ciscoStackMIB', ); | ||||
|  | ||||
|   | ||||
| @@ -42,7 +42,7 @@ use SNMP::Info; | ||||
|  | ||||
| use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     'SNMPv2-MIB'            => 'sysDescr', | ||||
| @@ -103,6 +103,7 @@ sub os { | ||||
|     # order here matters - there are Catalysts that run IOS and have catalyst | ||||
|     # in their description field, as well as Catalysts that run IOS-XE. | ||||
|     return 'ios-xe'   if ( $descr =~ /IOS-XE/ ); | ||||
|     return 'ios-xr'   if ( $descr =~ /IOS XR/ ); | ||||
|     return 'ios'      if ( $descr =~ /IOS/ ); | ||||
|     return 'catalyst' if ( $descr =~ /catalyst/i ); | ||||
|     return 'css'      if ( $descr =~ /Content Switch SW/ ); | ||||
| @@ -198,6 +199,13 @@ sub os_ver { | ||||
|         return $1; | ||||
|     } | ||||
|  | ||||
|     if ( defined $os | ||||
|         and $os eq 'ios-xr' | ||||
|         and defined $descr | ||||
|         and $descr =~ m/Version (\d+[\.\d]+)/ ) | ||||
|     { | ||||
|         return $1; | ||||
|     } | ||||
|  | ||||
|     # Newer Catalysts and IOS devices | ||||
|     if ( defined $descr | ||||
| @@ -409,6 +417,7 @@ Available values: | ||||
|  | ||||
|  'ios'          for Cisco IOS | ||||
|  'ios-xe'       for Cisco IOS XE | ||||
|  'ios-xr'       for Cisco IOS XR | ||||
|  'pix'          for Cisco PIX | ||||
|  'asa'          for Cisco ASA | ||||
|  'fwsm'         for Single-mode FWSM | ||||
|   | ||||
| @@ -36,7 +36,7 @@ use SNMP::Info::Bridge; | ||||
|  | ||||
| use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE %PORTSTAT $INIT/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| @SNMP::Info::CiscoStpExtensions::ISA = qw/SNMP::Info::Bridge SNMP::Info Exporter/; | ||||
| @SNMP::Info::CiscoStpExtensions::EXPORT_OK = qw//; | ||||
|   | ||||
| @@ -41,7 +41,7 @@ use SNMP::Info; | ||||
|  | ||||
| use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     'CISCO-VTP-MIB'                       => 'vtpVlanName', | ||||
| @@ -191,6 +191,22 @@ sub i_vlan { | ||||
|     return \%i_vlans; | ||||
| } | ||||
|  | ||||
| sub i_untagged { | ||||
|     my $vtp = shift; | ||||
|     my ( $ifindex ) = @_; | ||||
|  | ||||
|     # cannot defer to i_vlan - vtp_trunk_dyn_stat is not useful for down ports | ||||
|     # so we use vtp_trunk_dyn as a hint to use i_pvid | ||||
|  | ||||
|     my $trunking = eval { $vtp->vtp_trunk_dyn($ifindex)->{$ifindex} }; | ||||
|     if ($trunking and (($trunking eq 'on') or ($trunking eq 'onNoNegotiate'))) { | ||||
|         return $vtp->i_pvid(@_); | ||||
|     } | ||||
|     else { | ||||
|         return $vtp->i_vlan(@_); | ||||
|     } | ||||
| } | ||||
|  | ||||
| sub i_vlan_membership { | ||||
|     my $vtp     = shift; | ||||
|     my $partial = shift; | ||||
| @@ -306,6 +322,22 @@ sub set_i_vlan { | ||||
|     return; | ||||
| } | ||||
|  | ||||
| sub set_i_untagged { | ||||
|     my $vtp = shift; | ||||
|     my ( $vlan_id, $ifindex ) = @_; | ||||
|  | ||||
|     # cannot defer to i_vlan - vtp_trunk_dyn_stat is not useful for down ports | ||||
|     # so we use vtp_trunk_dyn as a hint to use i_pvid | ||||
|  | ||||
|     my $trunking = eval { $vtp->vtp_trunk_dyn($ifindex)->{$ifindex} }; | ||||
|     if ($trunking and (($trunking eq 'on') or ($trunking eq 'onNoNegotiate'))) { | ||||
|         return $vtp->set_i_pvid(@_); | ||||
|     } | ||||
|     else { | ||||
|         return $vtp->set_i_vlan(@_); | ||||
|     } | ||||
| } | ||||
|  | ||||
| sub set_add_i_vlan_tagged { | ||||
|     my $vtp = shift; | ||||
|     my ( $vlan_id, $ifindex ) = @_; | ||||
| @@ -540,6 +572,10 @@ Your device will only implement a subset of these methods. | ||||
| Returns a mapping between C<ifIndex> and assigned VLAN ID for access ports | ||||
| and the default VLAN ID for trunk ports. | ||||
|  | ||||
| =item $vtp->i_untagged() | ||||
|  | ||||
| An alias for C<i_vlan>. | ||||
|  | ||||
| =item $vtp->i_vlan_membership() | ||||
|  | ||||
| Returns reference to hash of arrays: key = C<ifIndex>, value = array of VLAN | ||||
| @@ -835,6 +871,12 @@ port C<ifIndex>.  This method should only be used on trunk ports. | ||||
|   $vtp->set_i_pvid('2', $if_map{'FastEthernet0/1'})  | ||||
|     or die "Couldn't change port default VLAN. ",$vtp->error(1); | ||||
|  | ||||
| =item $vtp->set_i_untagged ( vlan, ifIndex ) | ||||
|  | ||||
| This method attempts to work out whether the port referenced by ifIndex is | ||||
| trunking, and if so will return the value of C<set_i_pvid>. Otherwise, the | ||||
| value of C<set_i_vlan> is returned. | ||||
|  | ||||
| =item $vtp->set_add_i_vlan_tagged ( vlan, ifIndex ) | ||||
|  | ||||
| Adds the VLAN to the enabled VLANs list of the port, must be supplied with the | ||||
|   | ||||
| @@ -39,7 +39,7 @@ use SNMP::Info; | ||||
|  | ||||
| use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     'EXTREME-EDP-MIB'   => 'extremeEdpPortIfIndex', | ||||
|   | ||||
| @@ -41,7 +41,7 @@ use SNMP::Info; | ||||
|  | ||||
| use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( 'ENTITY-MIB' => 'entPhysicalSerialNum' ); | ||||
|  | ||||
|   | ||||
| @@ -41,7 +41,7 @@ use SNMP::Info; | ||||
|  | ||||
| use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( 'EtherLike-MIB' => 'etherMIB' ); | ||||
|  | ||||
|   | ||||
							
								
								
									
										10
									
								
								Info/FDP.pm
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								Info/FDP.pm
									
									
									
									
									
								
							| @@ -42,7 +42,7 @@ use SNMP::Info; | ||||
|  | ||||
| use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( 'FOUNDRY-SN-SWITCH-GROUP-MIB' => 'snFdpGlobalRun' ); | ||||
|  | ||||
| @@ -68,7 +68,7 @@ $VERSION = '3.04_001'; | ||||
| ); | ||||
|  | ||||
| %MUNGE = ( | ||||
|     'fdp_capabilities' => \&SNMP::Info::munge_caps, | ||||
|     'fdp_capabilities' => \&SNMP::Info::munge_bits, | ||||
|     'fdp_ip'           => \&SNMP::Info::munge_ip | ||||
| ); | ||||
|  | ||||
| @@ -289,8 +289,7 @@ CDP compatibility | ||||
| =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. | ||||
| binary string, 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>: | ||||
|  | ||||
| @@ -320,8 +319,7 @@ protocol. | ||||
|  | ||||
| =back | ||||
|  | ||||
| Thanks to Martin Lorensen C<martin -at- lorensen.dk> for a pointer to | ||||
| this information. | ||||
| Thanks to Martin Lorensen for a pointer to this information. | ||||
|  | ||||
| (C<fdpCacheCapabilities>) | ||||
|  | ||||
|   | ||||
| @@ -38,7 +38,7 @@ use Exporter; | ||||
|  | ||||
| use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( 'IEEE802dot11-MIB' => 'dot11DesiredSSID', ); | ||||
|  | ||||
|   | ||||
| @@ -44,7 +44,7 @@ use constant { | ||||
|     IPV6MIB => 3, | ||||
| }; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
|  | ||||
|  | ||||
|   | ||||
							
								
								
									
										72
									
								
								Info/LLDP.pm
									
									
									
									
									
								
							
							
						
						
									
										72
									
								
								Info/LLDP.pm
									
									
									
									
									
								
							| @@ -39,7 +39,7 @@ use SNMP::Info; | ||||
|  | ||||
| use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     'LLDP-MIB'          => 'lldpLocSysCapEnabled', | ||||
| @@ -67,6 +67,7 @@ $VERSION = '3.04_001'; | ||||
|     'lldp_rem_sysname'  => 'lldpRemSysName', | ||||
|     'lldp_rem_sysdesc'  => 'lldpRemSysDesc', | ||||
|     'lldp_rem_sys_cap'  => 'lldpRemSysCapEnabled', | ||||
|     'lldp_rem_cap_spt'  => 'lldpRemSysCapSupported', | ||||
|  | ||||
|     # LLDP-MIB::lldpRemManAddrTable | ||||
|     'lldp_rman_addr' => 'lldpRemManAddrIfSubtype', | ||||
| @@ -80,6 +81,7 @@ $VERSION = '3.04_001'; | ||||
|     'lldp_rem_port_desc' => \&SNMP::Info::munge_null, | ||||
|     'lldp_sys_cap'       => \&SNMP::Info::munge_bits, | ||||
|     'lldp_rem_sys_cap'   => \&SNMP::Info::munge_bits, | ||||
|     'lldp_rem_cap_spt'   => \&SNMP::Info::munge_bits, | ||||
| ); | ||||
|  | ||||
| sub hasLLDP { | ||||
| @@ -168,10 +170,15 @@ sub lldp_port { | ||||
|     my %lldp_port; | ||||
|     foreach my $key ( sort keys %$pid ) { | ||||
|         my $port = $pdesc->{$key}; | ||||
|         my $type = $ptype->{$key}; | ||||
|         if ( $type and $type eq 'interfaceName' ) { | ||||
|             # If the pid claims to be an interface name, | ||||
|             # believe it. | ||||
|             $port = $pid->{$key}; | ||||
|         } | ||||
|         unless ($port) { | ||||
|             $port = $pid->{$key}; | ||||
|             next unless $port; | ||||
|             my $type = $ptype->{$key}; | ||||
|             next unless $type; | ||||
|  | ||||
|           # May need to format other types in the future, i.e. Network address | ||||
| @@ -222,6 +229,50 @@ sub lldp_id { | ||||
|     return \%lldp_id; | ||||
| } | ||||
|  | ||||
| sub lldp_platform { | ||||
|     my $lldp    = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $rid  = $lldp->lldp_rem_id($partial) || {}; | ||||
|     my $desc = $lldp->lldp_rem_sysdesc($partial) || {}; | ||||
|     my $name = $lldp->lldp_rem_sysname($partial) || {}; | ||||
|      | ||||
|     my %lldp_platform; | ||||
|     foreach my $key (keys %$rid) { | ||||
|         $lldp_platform{$key} = $desc->{$key} || $name->{$key}; | ||||
|     } | ||||
|     return \%lldp_platform; | ||||
| } | ||||
|  | ||||
| sub lldp_cap { | ||||
|     my $lldp     = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $lldp_caps  = $lldp->lldp_rem_cap_spt($partial)  || {}; | ||||
|      | ||||
|     # Encoded as BITS which Perl Net-SNMP implementation doesn't seem to | ||||
|     # be able to enumerate for us, so we have to get it from the MIB | ||||
|     # and enumerate ourselves | ||||
|     my $oid = SNMP::translateObj('lldpRemSysCapEnabled',0,1) || ''; | ||||
|     my $enums = ((ref {} eq ref $SNMP::MIB{$oid}{'enums'}) ? $SNMP::MIB{$oid}{'enums'} : {}); | ||||
|     my %r_enums = reverse %$enums; | ||||
|  | ||||
|     my %lldp_cap; | ||||
|     foreach my $key ( keys %$lldp_caps ) { | ||||
|         my $cap_bits = $lldp_caps->{$key}; | ||||
|         next unless $cap_bits; | ||||
|          | ||||
|         my $count = 0; | ||||
|         foreach my $bit (split //,$cap_bits) { | ||||
|             if ( $bit ) { | ||||
|                 push ( @{$lldp_cap{$key}}, $r_enums{$count}); | ||||
|             } | ||||
|             $count++; | ||||
|         } | ||||
|     } | ||||
|     return \%lldp_cap; | ||||
| } | ||||
|  | ||||
| #sub root_ip { | ||||
| #    my $lldp = shift; | ||||
| # | ||||
| @@ -435,6 +486,17 @@ Currently only returns IPv4 or MAC addresses. | ||||
|  | ||||
| Returns remote port ID | ||||
|  | ||||
| =item $lldp->lldp_platform() | ||||
|  | ||||
| Tries to return something useful from C<lldp_rem_sysdesc()> or | ||||
| C<lldp_rem_sysname()>. | ||||
|  | ||||
| =item  $lldp->lldp_cap()  | ||||
|  | ||||
| Returns hash of arrays with each array containing the system capabilities | ||||
| supported by the remote system.  Possible elements in the array are | ||||
| enumerated from C<LldpSystemCapabilitiesMap>. | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 LLDP Remote Table (C<lldpRemTable>) | ||||
| @@ -498,9 +560,9 @@ Nulls are removed before the value is returned. | ||||
|  | ||||
| =item  $lldp->lldp_rem_sys_cap()  | ||||
|  | ||||
| Returns which system capabilities are enabled on the local system.  Results | ||||
| are munged into an ascii binary string, LSB.  Each digit | ||||
| represents a bit from the table below: | ||||
| Returns which system capabilities are enabled on the remote system.  Results | ||||
| are munged into an ascii binary string, LSB.  Each digit represents a bit | ||||
| from the table below: | ||||
|  | ||||
| =over | ||||
|  | ||||
|   | ||||
| @@ -41,7 +41,7 @@ use SNMP::Info; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %PORTSTAT %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( %SNMP::Info::MIBS, 'SNMP-REPEATER-MIB' => 'rptrPortGroupIndex' ); | ||||
|  | ||||
|   | ||||
| @@ -41,7 +41,7 @@ use SNMP::Info::Layer1; | ||||
|  | ||||
| use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| # Set for No CDP | ||||
| %GLOBALS = ( %SNMP::Info::Layer1::GLOBALS, 'root_ip' => 'actualIPAddr', ); | ||||
|   | ||||
| @@ -41,7 +41,7 @@ use SNMP::Info::Layer1; | ||||
|  | ||||
| use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| # Set for No CDP | ||||
| %GLOBALS = ( %SNMP::Info::Layer1::GLOBALS, ); | ||||
|   | ||||
| @@ -42,7 +42,7 @@ use SNMP::Info::Layer2; | ||||
|  | ||||
| use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer2::MIBS, | ||||
|   | ||||
| @@ -39,7 +39,7 @@ use SNMP::Info::Layer1; | ||||
|  | ||||
| use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer1::MIBS, | ||||
|   | ||||
| @@ -39,7 +39,7 @@ use SNMP::Info::Layer2; | ||||
|  | ||||
| use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer2::MIBS, | ||||
|   | ||||
| @@ -45,7 +45,7 @@ use SNMP::Info::PowerEthernet; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %PORTSTAT %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::MIBS,         %SNMP::Info::Bridge::MIBS, | ||||
| @@ -123,8 +123,11 @@ sub serial { | ||||
|     # 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 ); | ||||
|  | ||||
|     if ( defined $chassis and $chassis =~ /serial#?:\s*([a-z0-9]+)/i ) { | ||||
|         return $1; | ||||
|     } | ||||
|  | ||||
|     return $serial1 if ( defined $serial1 and $serial1 !~ /^\s*$/ ); | ||||
|  | ||||
|     return; | ||||
| @@ -155,10 +158,18 @@ sub interfaces { | ||||
|     my $i_descr    = $l2->i_description($partial) || {}; | ||||
|  | ||||
|     # Replace the Index with the ifDescr field. | ||||
|     # Check for duplicates in ifDescr, if so uniquely identify by adding | ||||
|     # ifIndex to repeated values | ||||
|     my %seen; | ||||
|     foreach my $iid ( keys %$i_descr ) { | ||||
|         my $port = $i_descr->{$iid}; | ||||
|         next unless defined $port; | ||||
|         $interfaces->{$iid} = $port; | ||||
|         if ( $seen{$port}++ ) { | ||||
|             $interfaces->{$iid} = sprintf( "%s (%d)", $port, $iid ); | ||||
|         } | ||||
|         else { | ||||
|             $interfaces->{$iid} = $port; | ||||
|         } | ||||
|     } | ||||
|     return $interfaces; | ||||
| } | ||||
|   | ||||
| @@ -40,7 +40,7 @@ use SNMP::Info::Airespace; | ||||
|  | ||||
| use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::MIBS,      %SNMP::Info::Bridge::MIBS, | ||||
|   | ||||
| @@ -49,7 +49,7 @@ use SNMP::Info::IEEE802dot11; | ||||
|  | ||||
| use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %GLOBALS = ( | ||||
|     %SNMP::Info::IEEE802dot11::GLOBALS, | ||||
|   | ||||
| @@ -40,7 +40,7 @@ use SNMP::Info::Layer1; | ||||
|  | ||||
| use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %GLOBALS = ( %SNMP::Info::Layer2::GLOBALS ); | ||||
|  | ||||
|   | ||||
| @@ -46,12 +46,13 @@ use SNMP::Info::Layer3; | ||||
|  | ||||
| use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::MIBS,    %SNMP::Info::LLDP::MIBS, | ||||
|     %SNMP::Info::RapidCity::MIBS, %SNMP::Info::NortelStack::MIBS, | ||||
|     %SNMP::Info::SONMP::MIBS, | ||||
|     'BAY-STACK-PETH-EXT-MIB' => 'bspePethPsePortExtMeasuredPower', | ||||
| ); | ||||
|  | ||||
| %GLOBALS = ( | ||||
| @@ -64,6 +65,7 @@ $VERSION = '3.04_001'; | ||||
|     %SNMP::Info::Layer3::FUNCS,    %SNMP::Info::LLDP::FUNCS, | ||||
|     %SNMP::Info::RapidCity::FUNCS, %SNMP::Info::NortelStack::FUNCS, | ||||
|     %SNMP::Info::SONMP::FUNCS, | ||||
|     'peth_port_power' => 'bspePethPsePortExtMeasuredPower', | ||||
| ); | ||||
|  | ||||
| # 450's report full duplex as speed = 20mbps?! | ||||
| @@ -139,6 +141,7 @@ sub model { | ||||
|     $model =~ s/^sreg-//; | ||||
|     # Strip ES/ERS/BayStack etc. from those families | ||||
|     $model =~ s/^(E(R)?S|BayStack|Ethernet(Routing)?Switch)-?//; | ||||
|     $model =~ s/-ethSwitchNMM//; | ||||
|  | ||||
|     return $model; | ||||
| } | ||||
| @@ -393,6 +396,14 @@ my $baystack = new SNMP::Info::Layer2::Baystack(...); | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Required MIBs | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item F<BAY-STACK-PETH-EXT-MIBB> | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Inherited MIBs | ||||
|  | ||||
| See L<SNMP::Info::SONMP/"Required MIBs"> for its MIB requirements. | ||||
| @@ -509,10 +520,16 @@ revisions of Baystack firmware report all zeros for each port mac. | ||||
| Crosses C<ifName> with C<ifAlias> and returns the human set port name if | ||||
| exists. | ||||
|  | ||||
| =item $poe->peth_port_ifindex() | ||||
| =item $baystack->peth_port_ifindex() | ||||
|  | ||||
| Maps the C<pethPsePortTable> to C<ifIndex> by way of the F<ENTITY-MIB>. | ||||
|  | ||||
| =item $baystack->peth_port_power() | ||||
|  | ||||
| Power supplied by PoE ports, in milliwatts | ||||
|  | ||||
| (C<bspePethPsePortExtMeasuredPower>) | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 F<ENTITY-MIB> Information | ||||
|   | ||||
| @@ -46,7 +46,7 @@ use SNMP::Info::Layer2; | ||||
|  | ||||
| use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %GLOBALS = ( | ||||
|     %SNMP::Info::Layer2::GLOBALS, | ||||
|   | ||||
| @@ -47,7 +47,7 @@ use SNMP::Info::Layer2; | ||||
|  | ||||
| use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %GLOBALS = ( | ||||
|     %SNMP::Info::Layer2::GLOBALS,     %SNMP::Info::CiscoConfig::GLOBALS, | ||||
| @@ -139,6 +139,32 @@ sub i_duplex_admin { | ||||
|     return \%i_duplex_admin; | ||||
| } | ||||
|  | ||||
| sub i_speed_admin { | ||||
|     my $c2900   = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my %i_speed_admin; | ||||
|     my $p_port        = $c2900->p_port() || {}; | ||||
|     my $interfaces    = $c2900->interfaces($partial); | ||||
|     my $c2900_p_index = $c2900->c2900_p_index() || {}; | ||||
|  | ||||
|     my %reverse_2900 = reverse %$c2900_p_index; | ||||
|     my $c2900_p_speed | ||||
|         = $c2900->c2900_p_speed_admin( $reverse_2900{$partial} ); | ||||
|  | ||||
|     my %speeds = ( | ||||
|         'autoDetect' => 'auto', | ||||
|         's10000000'  => '10 Mbps', | ||||
|         's100000000' => '100 Mbps', | ||||
|     ); | ||||
|  | ||||
|     %i_speed_admin | ||||
|         = map { $c2900_p_index->{$_} => $speeds{ $c2900_p_speed->{$_} } } | ||||
|         keys %$c2900_p_index; | ||||
|  | ||||
|     return \%i_speed_admin; | ||||
| } | ||||
|  | ||||
| sub set_i_speed_admin { | ||||
|     my $c2900 = shift; | ||||
|     my ( $speed, $iid ) = @_; | ||||
| @@ -349,6 +375,10 @@ Returns reference to hash of IIDs to admin duplex setting | ||||
|  | ||||
| Crosses $c2900->c2900_p_index() with $c2900->c2900_p_duplex_admin() | ||||
|  | ||||
| =item $c2900->i_speed_admin() | ||||
|  | ||||
| Returns reference to hash of IIDs to admin speed setting. | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 F<C2900-MIB> Port Entry Table  | ||||
|   | ||||
| @@ -49,7 +49,7 @@ use SNMP::Info::Layer2; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer2::MIBS,     %SNMP::Info::CiscoPortSecurity::MIBS, | ||||
|   | ||||
| @@ -43,7 +43,7 @@ use SNMP::Info::SONMP; | ||||
|  | ||||
| use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::MIBS, | ||||
|   | ||||
| @@ -50,7 +50,7 @@ use SNMP::Info::Layer2; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer2::MIBS,     %SNMP::Info::CiscoConfig::MIBS, | ||||
|   | ||||
| @@ -50,7 +50,7 @@ use SNMP::Info::CDP; | ||||
|  | ||||
| use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| # This will be filled in with the device's index into the EntPhysicalEntry | ||||
| # table by the serial() function. | ||||
| @@ -216,15 +216,16 @@ Returns 'cisco' | ||||
|  | ||||
| =item $ciscosb->os_ver() | ||||
|  | ||||
| Returns software version (entPhysicalSoftwareRev) | ||||
| Returns software version (C<entPhysicalSoftwareRev>) | ||||
|  | ||||
| =item $ciscosb->serial() | ||||
|  | ||||
| Returns serial number of unit (entPhysicalSerialNum) | ||||
| Returns serial number of unit (C<entPhysicalSerialNum>) | ||||
|  | ||||
| =item $ciscosb->model() | ||||
|  | ||||
| Returns model and hardware revision of unit (entPhysicalModelName+entPhysicalHardwareRev) | ||||
| Returns model and hardware revision of unit | ||||
| (C<entPhysicalModelName+entPhysicalHardwareRev>) | ||||
|  | ||||
| =back | ||||
|  | ||||
|   | ||||
| @@ -46,7 +46,7 @@ use SNMP::Info::CDP; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %PORTSTAT %MODEL_MAP %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::MIBS, | ||||
| @@ -191,7 +191,7 @@ $VERSION = '3.04_001'; | ||||
|     'J4900B' => '2626-CR', | ||||
|     'J4900A' => '2626', | ||||
|     'J9627A' => '2620-48-PoE+', | ||||
|     'J9624A' => '2620-48', | ||||
|     'J9626A' => '2620-48', | ||||
|     'J9625A' => '2620-24-PoE+', | ||||
|     'J9624A' => '2620-24-PPoE+', | ||||
|     'J9623A' => '2620-24', | ||||
| @@ -710,7 +710,7 @@ number and the common model number with this map : | ||||
|     'J4900C' => '2626C', | ||||
|     'J4900A' => '2626', | ||||
|     'J9627A' => '2620-48-PoE+', | ||||
|     'J9624A' => '2620-48', | ||||
|     'J9626A' => '2620-48', | ||||
|     'J9624A' => '2620-24-PPoE+', | ||||
|     'J9625A' => '2620-24-PoE+', | ||||
|     'J9623A' => '2620-24', | ||||
|   | ||||
| @@ -44,7 +44,7 @@ use SNMP::Info::CDP; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %PORTSTAT %MODEL_MAP %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::MIBS, | ||||
|   | ||||
| @@ -40,7 +40,7 @@ use SNMP::Info::Layer2; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer2::MIBS, | ||||
|   | ||||
| @@ -36,7 +36,7 @@ use SNMP::Info::Layer2; | ||||
|  | ||||
| use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer2::MIBS, | ||||
|   | ||||
| @@ -43,7 +43,7 @@ use SNMP::Info::Airespace; | ||||
|  | ||||
| use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::MIBS,        %SNMP::Info::Bridge::MIBS, | ||||
|   | ||||
| @@ -42,7 +42,7 @@ use SNMP::Info::Layer2; | ||||
|  | ||||
| use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer2::MIBS, %SNMP::Info::IEEE802dot11::MIBS, | ||||
|   | ||||
| @@ -39,7 +39,7 @@ use SNMP::Info::Bridge; | ||||
|  | ||||
| use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::MIBS, | ||||
|   | ||||
| @@ -41,7 +41,7 @@ use SNMP::Info::LLDP; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| # This will be filled in with the device's index into the EntPhysicalEntry | ||||
| # table by the serial() function. | ||||
|   | ||||
| @@ -41,7 +41,7 @@ use SNMP::Info::Layer2; | ||||
|  | ||||
| use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer2::MIBS, | ||||
|   | ||||
| @@ -40,7 +40,7 @@ use SNMP::Info::LLDP; | ||||
|  | ||||
| use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::MIBS, | ||||
|   | ||||
| @@ -39,7 +39,7 @@ use SNMP::Info::Layer2; | ||||
|  | ||||
| use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| # Set for No CDP | ||||
| %GLOBALS = ( %SNMP::Info::Layer2::GLOBALS ); | ||||
|   | ||||
| @@ -51,7 +51,7 @@ use SNMP::Info::AdslLine; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::MIBS, | ||||
| @@ -132,11 +132,11 @@ $VERSION = '3.04_001'; | ||||
|     'bgp_peer_out_upd'        => 'bgpPeerOutUpdates', | ||||
|  | ||||
|     # IP-MIB Net to Physical Table (ARP Cache) | ||||
|     'n2p_paddr' => 'ipNetToPhysicalPhysAddress', | ||||
|     'n2p_paddr'      => 'ipNetToPhysicalPhysAddress', | ||||
|     'n2p_lastupdate' => 'ipNetToPhysicalLastUpdated', | ||||
|     'n2p_ptype' => 'ipNetToPhysicalType', | ||||
|     'n2p_pstate' => 'ipNetToPhysicalState', | ||||
|     'n2p_pstatus' => 'ipNetToPhysicalRowStatus', | ||||
|     'n2p_ptype'      => 'ipNetToPhysicalType', | ||||
|     'n2p_pstate'     => 'ipNetToPhysicalState', | ||||
|     'n2p_pstatus'    => 'ipNetToPhysicalRowStatus', | ||||
|  | ||||
| ); | ||||
|  | ||||
| @@ -152,7 +152,7 @@ $VERSION = '3.04_001'; | ||||
|     %SNMP::Info::IPv6::MUNGE, | ||||
|     'old_at_paddr' => \&SNMP::Info::munge_mac, | ||||
|     'at_paddr'     => \&SNMP::Info::munge_mac, | ||||
|     'n2p_paddr' => \&SNMP::Info::munge_mac, | ||||
|     'n2p_paddr'    => \&SNMP::Info::munge_mac, | ||||
| ); | ||||
|  | ||||
| # Method OverRides | ||||
| @@ -163,12 +163,12 @@ sub root_ip { | ||||
|     my $router_ip = $l3->router_ip(); | ||||
|     my $ospf_ip   = $l3->ospf_ip(); | ||||
|  | ||||
|     # if the router ip exists and is a route advertised by the device we prefer | ||||
|     # it over the others | ||||
|    # if the router ip exists and is a route advertised by the device we prefer | ||||
|    # it over the others | ||||
|     return $router_ip | ||||
|         if (( defined $router_ip ) | ||||
|         and ( $router_ip ne '0.0.0.0' ) | ||||
|         and ( grep { $ospf_ip->{$_} eq $router_ip } (keys %$ospf_ip)) | ||||
|         and ( grep { $ospf_ip->{$_} eq $router_ip } ( keys %$ospf_ip ) ) | ||||
|         and ( $l3->snmp_connect_ip($router_ip) ) ); | ||||
|  | ||||
|     # return the first one found here (should be only one) | ||||
| @@ -205,18 +205,26 @@ sub i_ignore { | ||||
| sub serial { | ||||
|     my $l3 = shift; | ||||
|  | ||||
|     my $serial1  = $l3->serial1(); | ||||
|     my $e_descr  = $l3->e_descr() || {}; | ||||
|     my $e_serial = $l3->e_serial() || {}; | ||||
|     my $serial1 = $l3->serial1(); | ||||
|     my $e_parent = $l3->e_parent() || {}; | ||||
|  | ||||
|     my $serial2 = $e_serial->{1} || undef; | ||||
|     my $chassis = $e_descr->{1}  || undef; | ||||
|     foreach my $iid ( keys %$e_parent ) { | ||||
|         my $parent = $e_parent->{$iid}; | ||||
|         if ( $parent eq '0' ) { | ||||
|             my $serial = $l3->e_serial($iid); | ||||
|             if ( $serial ) { | ||||
|                 return $serial->{$iid}; | ||||
|             } | ||||
|             else { | ||||
|                 my $descr = $l3->e_descr($iid); | ||||
|                 if ( $descr and $descr =~ /serial#?:\s*([a-z0-9]+)/i ) | ||||
|                 { | ||||
|                     return $1; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     # 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; | ||||
| @@ -293,30 +301,35 @@ sub interfaces { | ||||
|     my $l3      = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $interfaces   = $l3->i_index($partial); | ||||
|     my $descriptions = $l3->i_description($partial); | ||||
|     my $interfaces = $l3->i_index($partial); | ||||
|     my $i_descr    = $l3->i_description($partial); | ||||
|  | ||||
|     my %interfaces = (); | ||||
|     foreach my $iid ( keys %$interfaces ) { | ||||
|         my $desc = $descriptions->{$iid}; | ||||
|         next unless defined $desc; | ||||
|  | ||||
|         $interfaces{$iid} = $desc; | ||||
|     # Check for duplicates in ifDescr, if so uniquely identify by adding | ||||
|     # ifIndex to repeated values | ||||
|     my %seen; | ||||
|     foreach my $iid ( keys %$i_descr ) { | ||||
|         my $port = $i_descr->{$iid}; | ||||
|         next unless defined $port; | ||||
|         if ( $seen{$port}++ ) { | ||||
|             $interfaces->{$iid} = sprintf( "%s (%d)", $port, $iid ); | ||||
|         } | ||||
|         else { | ||||
|             $interfaces->{$iid} = $port; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     return \%interfaces; | ||||
|     return $interfaces; | ||||
| } | ||||
|  | ||||
| sub vendor { | ||||
|     my $l3 = shift; | ||||
|  | ||||
|     my $descr = $l3->description(); | ||||
|     my $id = $l3->id(); | ||||
|     my $id    = $l3->id(); | ||||
|  | ||||
|     # .1.3.6.1.4.1.9.1 is the CISCO-PRODUCTS-MIB | ||||
|     # .1.3.6.1.4.1.9.9.368.4 is an old tree that Cisco CSSs were numbered from | ||||
|     return 'cisco'   if $id =~ /^\Q.1.3.6.1.4.1.9.1.\E\d+$/; | ||||
|     return 'cisco'   if $id =~ /^\Q.1.3.6.1.4.1.9.9.368.4.\E\d+/; | ||||
|     return 'cisco' if $id =~ /^\Q.1.3.6.1.4.1.9.1.\E\d+$/; | ||||
|     return 'cisco' if $id =~ /^\Q.1.3.6.1.4.1.9.9.368.4.\E\d+/; | ||||
|     return 'cisco'   if ( $descr =~ /(cisco|\bios\b)/i ); | ||||
|     return 'brocade' if ( $descr =~ /foundry/i ); | ||||
|  | ||||
|   | ||||
| @@ -41,7 +41,7 @@ use SNMP::Info::Layer3; | ||||
|  | ||||
| use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::MIBS, | ||||
|   | ||||
| @@ -49,7 +49,7 @@ use SNMP::Info::LLDP; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::MIBS, | ||||
|   | ||||
| @@ -39,7 +39,7 @@ use SNMP::Info::Layer3; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::MIBS, | ||||
|   | ||||
| @@ -40,7 +40,7 @@ use SNMP::Info::Layer3; | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE  | ||||
|             $int_include_vpn $fake_idx $type_class/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|             %SNMP::Info::Layer3::MIBS, | ||||
|   | ||||
| @@ -43,7 +43,7 @@ use SNMP::Info::LLDP; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::MIBS, | ||||
| @@ -120,6 +120,27 @@ sub fw_port { | ||||
|     return $arista->qb_fw_port($partial); | ||||
| } | ||||
|  | ||||
| # The LLDP MIB leaves it up in the air what the index means. | ||||
| # On EOS, it's a dot1d port. | ||||
| sub lldp_if { | ||||
|     my $arista  = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     # We pick a column that someone else is likely to want, | ||||
|     # so that the cache means that hopefully this doesn't | ||||
|     # cause any more SNMP transactions in total. | ||||
|     my $desc     = $arista->lldp_rem_desc($partial) || {}; | ||||
|     my $bp_index = $arista->bp_index() || {}; | ||||
|  | ||||
|     my $lldp_if = {}; | ||||
|     foreach my $key ( keys %$desc ) { | ||||
|         my @aOID = split( '\.', $key ); | ||||
|         my $port = $aOID[1]; | ||||
|         $lldp_if->{$key} = $bp_index->{$port}; | ||||
|     } | ||||
|     return $lldp_if; | ||||
| } | ||||
|  | ||||
| 1; | ||||
| __END__ | ||||
|  | ||||
| @@ -240,6 +261,10 @@ Returns info from F<MAU-MIB> | ||||
|  | ||||
| Returns info from F<MAU-MIB> | ||||
|  | ||||
| =item $arista->lldp_if() | ||||
|  | ||||
| Returns the mapping to the SNMP Interface Table. | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Table Methods imported from SNMP::Info::Layer3 | ||||
|   | ||||
							
								
								
									
										1672
									
								
								Info/Layer3/Aruba.pm
									
									
									
									
									
								
							
							
						
						
									
										1672
									
								
								Info/Layer3/Aruba.pm
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -43,7 +43,7 @@ use SNMP::Info::Bridge; | ||||
| use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE %MODEL_MAP | ||||
|     %MODID_MAP %PROCID_MAP/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::MIBS, | ||||
| @@ -1635,11 +1635,11 @@ See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details. | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item $extreme->munge_hw_rev() | ||||
| =item $bayrs->munge_hw_rev() | ||||
|  | ||||
| Converts octets to a decimal major.minor string. | ||||
|  | ||||
| =item $extreme->munge_wf_serial() | ||||
| =item $bayrs->munge_wf_serial() | ||||
|  | ||||
| Coverts octets to a decimal string. | ||||
|  | ||||
|   | ||||
| @@ -36,7 +36,7 @@ use SNMP::Info::Layer3; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer2::MIBS, %SNMP::Info::Layer3::MIBS, | ||||
|   | ||||
| @@ -64,7 +64,7 @@ use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| @SNMP::Info::Layer3::C3550::EXPORT_OK = qw//; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| # NOTE: Order creates precedence | ||||
| #       Example: v_name exists in Bridge.pm and CiscoVTP.pm | ||||
|   | ||||
| @@ -50,7 +50,7 @@ use SNMP::Info::Layer3; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::MIBS, | ||||
| @@ -106,6 +106,12 @@ $VERSION = '3.04_001'; | ||||
| *SNMP::Info::Layer3::C4000::i_speed_admin | ||||
|     = \&SNMP::Info::MAU::mau_i_speed_admin; | ||||
|  | ||||
| *SNMP::Info::Layer3::C4000::set_i_duplex_admin | ||||
|     = \&SNMP::Info::MAU::mau_set_i_duplex_admin; | ||||
| *SNMP::Info::Layer3::C4000::set_i_speed_admin | ||||
|     = \&SNMP::Info::MAU::mau_set_i_speed_admin; | ||||
|  | ||||
|  | ||||
| sub fan { | ||||
|     my $c4000     = shift; | ||||
|     my $fan_state = $c4000->fan_state(); | ||||
| @@ -281,6 +287,18 @@ Returns either (auto,full,half). | ||||
|  | ||||
| Returns administrative speed for interfaces. | ||||
|  | ||||
| =item $c4000->set_i_speed_admin(speed, ifIndex) | ||||
|  | ||||
| Sets port speed, must be supplied with speed and port C<ifIndex>. | ||||
|  | ||||
| Speed choices are '10', '100', '1000', 'auto'. | ||||
|  | ||||
| =item $c4000->set_i_duplex_admin(duplex, ifIndex) | ||||
|  | ||||
| Sets port duplex, must be supplied with duplex and port C<ifIndex>. | ||||
|  | ||||
| Duplex choices are 'auto', 'half', 'full'. | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Table Methods imported from SNMP::Info::CiscoVTP | ||||
|   | ||||
| @@ -43,6 +43,7 @@ use SNMP::Info::CiscoPower; | ||||
| use SNMP::Info::Layer3; | ||||
| use SNMP::Info::CiscoStpExtensions; | ||||
| use SNMP::Info::CiscoVTP; | ||||
| use SNMP::Info::MAU; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| @@ -59,6 +60,7 @@ use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|     SNMP::Info::CiscoConfig | ||||
|     SNMP::Info::CiscoPower | ||||
|     SNMP::Info::Layer3 | ||||
|     SNMP::Info::MAU | ||||
|     Exporter | ||||
| /; | ||||
|  | ||||
| @@ -66,7 +68,7 @@ use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| # NOTE: Order creates precedence | ||||
| #       Example: v_name exists in Bridge.pm and CiscoVTP.pm | ||||
| @@ -75,15 +77,23 @@ $VERSION = '3.04_001'; | ||||
| # The @ISA order should match these orders. | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::MIBS,             %SNMP::Info::CiscoPower::MIBS, | ||||
|     %SNMP::Info::CiscoConfig::MIBS,        %SNMP::Info::CiscoPortSecurity::MIBS, | ||||
|     %SNMP::Info::CiscoImage::MIBS,         %SNMP::Info::CiscoStats::MIBS, | ||||
|     %SNMP::Info::CDP::MIBS,                %SNMP::Info::LLDP::MIBS, | ||||
|     %SNMP::Info::CiscoStack::MIBS,         %SNMP::Info::CiscoStpExtensions::MIBS,  | ||||
|     %SNMP::Info::CiscoVTP::MIBS,     | ||||
|     %SNMP::Info::MAU::MIBS, | ||||
|     %SNMP::Info::Layer3::MIBS, | ||||
|     %SNMP::Info::CiscoPower::MIBS, | ||||
|     %SNMP::Info::CiscoConfig::MIBS, | ||||
|     %SNMP::Info::CiscoPortSecurity::MIBS, | ||||
|     %SNMP::Info::CiscoImage::MIBS, | ||||
|     %SNMP::Info::CiscoStats::MIBS, | ||||
|     %SNMP::Info::CDP::MIBS, | ||||
|     %SNMP::Info::LLDP::MIBS, | ||||
|     %SNMP::Info::CiscoStack::MIBS, | ||||
|     %SNMP::Info::CiscoStpExtensions::MIBS, | ||||
|     %SNMP::Info::CiscoVTP::MIBS, | ||||
|     'CISCO-VIRTUAL-SWITCH-MIB' => 'cvsSwitchMode', | ||||
| ); | ||||
|  | ||||
| %GLOBALS = ( | ||||
|     %SNMP::Info::MAU::GLOBALS, | ||||
|     %SNMP::Info::Layer3::GLOBALS, | ||||
|     %SNMP::Info::CiscoPower::GLOBALS, | ||||
|     %SNMP::Info::CiscoConfig::GLOBALS, | ||||
| @@ -98,22 +108,21 @@ $VERSION = '3.04_001'; | ||||
| ); | ||||
|  | ||||
| %FUNCS = ( | ||||
|     %SNMP::Info::Layer3::FUNCS,             %SNMP::Info::CiscoPower::FUNCS, | ||||
|     %SNMP::Info::CiscoConfig::FUNCS,        %SNMP::Info::CiscoPortSecurity::FUNCS, | ||||
|     %SNMP::Info::CiscoImage::FUNCS,         %SNMP::Info::CiscoStats::FUNCS, | ||||
|     %SNMP::Info::CDP::FUNCS,                %SNMP::Info::LLDP::FUNCS, | ||||
|     %SNMP::Info::CiscoStack::FUNCS,         %SNMP::Info::CiscoStpExtensions::FUNCS,  | ||||
|     %SNMP::Info::CiscoVTP::FUNCS,     | ||||
|     %SNMP::Info::MAU::FUNCS,                %SNMP::Info::Layer3::FUNCS, | ||||
|     %SNMP::Info::CiscoPower::FUNCS,         %SNMP::Info::CiscoConfig::FUNCS, | ||||
|     %SNMP::Info::CiscoPortSecurity::FUNCS,  %SNMP::Info::CiscoImage::FUNCS, | ||||
|     %SNMP::Info::CiscoStats::FUNCS,         %SNMP::Info::CDP::FUNCS, | ||||
|     %SNMP::Info::LLDP::FUNCS,               %SNMP::Info::CiscoStack::FUNCS, | ||||
|     %SNMP::Info::CiscoStpExtensions::FUNCS, %SNMP::Info::CiscoVTP::FUNCS, | ||||
| ); | ||||
|  | ||||
|  | ||||
| %MUNGE = ( | ||||
|     %SNMP::Info::Layer3::MUNGE,             %SNMP::Info::CiscoPower::MUNGE, | ||||
|     %SNMP::Info::CiscoConfig::MUNGE,        %SNMP::Info::CiscoPortSecurity::MUNGE, | ||||
|     %SNMP::Info::CiscoImage::MUNGE,         %SNMP::Info::CiscoStats::MUNGE, | ||||
|     %SNMP::Info::CDP::MUNGE,                %SNMP::Info::LLDP::MUNGE, | ||||
|     %SNMP::Info::CiscoStack::MUNGE,         %SNMP::Info::CiscoStpExtensions::MUNGE,  | ||||
|     %SNMP::Info::CiscoVTP::MUNGE,     | ||||
|     %SNMP::Info::MAU::MUNGE,                %SNMP::Info::Layer3::MUNGE, | ||||
|     %SNMP::Info::CiscoPower::MUNGE,         %SNMP::Info::CiscoConfig::MUNGE, | ||||
|     %SNMP::Info::CiscoPortSecurity::MUNGE,  %SNMP::Info::CiscoImage::MUNGE, | ||||
|     %SNMP::Info::CiscoStats::MUNGE,         %SNMP::Info::CDP::MUNGE, | ||||
|     %SNMP::Info::LLDP::MUNGE,               %SNMP::Info::CiscoStack::MUNGE, | ||||
|     %SNMP::Info::CiscoStpExtensions::MUNGE, %SNMP::Info::CiscoVTP::MUNGE, | ||||
| ); | ||||
|  | ||||
| sub vendor { | ||||
| @@ -179,6 +188,16 @@ sub i_duplex_admin { | ||||
|     } | ||||
| } | ||||
|  | ||||
| sub is_virtual_switch { | ||||
|     my $cvs = shift; | ||||
|     my $cvsSwM = $cvs->cvsSwitchMode() || ''; | ||||
|  | ||||
|     if ( $cvsSwM eq 'multiNode' ) { | ||||
|         return 1; | ||||
|     } | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| sub set_i_duplex_admin { | ||||
|  | ||||
|     # map a textual duplex to an integer one the switch understands | ||||
| @@ -186,6 +205,20 @@ sub set_i_duplex_admin { | ||||
|  | ||||
|     my $c6500 = shift; | ||||
|     my ( $duplex, $iid ) = @_; | ||||
|   | ||||
|     if ( $c6500->is_virtual_switch() ) { | ||||
|  | ||||
|         # VSS -> MAU | ||||
|         # Due to VSS bug | ||||
|         # 1. Set the ifMauDefaultType | ||||
|         # 2. Disable ifMauAutoNegAdminStatus | ||||
|         # If the second set is not done, this is not going to be | ||||
|         # working... Cisco Bug id CSCty97033. | ||||
|         # SXI is not working (up to at least relase SXI9). | ||||
|         # SXJ is working at SXJ3 (not before). | ||||
|  | ||||
|         return $c6500->mau_set_i_duplex_admin( $duplex, $iid ); | ||||
|     } | ||||
|  | ||||
|     my $el_duplex = $c6500->el_duplex($iid); | ||||
|  | ||||
| @@ -203,7 +236,31 @@ sub set_i_duplex_admin { | ||||
|         return $c6500->set_p_duplex( $duplexes{$duplex}, $iid ); | ||||
|     } | ||||
|     else { | ||||
|         return $c6500->SUPER::set_i_duplex_admin; | ||||
|         return $c6500->SUPER::set_i_duplex_admin( $duplex, $iid ); | ||||
|     } | ||||
| } | ||||
|  | ||||
| sub set_i_speed_admin { | ||||
|     my $c6500   = shift; | ||||
|     my ( $speed, $iid ) = @_; | ||||
|  | ||||
|     if ( $c6500->is_virtual_switch() ) { | ||||
|  | ||||
|         # VSS -> MAU | ||||
|         # Due to VSS bug | ||||
|         # 1. Set the ifMauDefaultType | ||||
|         # 2. Disable ifMauAutoNegAdminStatus | ||||
|         # If the second set is not done, this is not going to be working... | ||||
|         # Cisco Bug id CSCty97033. | ||||
|         # SXI is not working (at least up to relase SXI9). | ||||
|         # SXJ is working at SXJ3 (not before). | ||||
|  | ||||
|         return $c6500->mau_set_i_speed_admin( $speed, $iid ); | ||||
|     } | ||||
|     else { | ||||
|  | ||||
|         # normal behavior using the CiscoStack method | ||||
|         return $c6500->SUPER::set_i_speed_admin( $speed, $iid ); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -317,6 +374,14 @@ These are methods that return scalar value from SNMP | ||||
|  | ||||
| Returns 1.  Use vlan indexing. | ||||
|  | ||||
| =item $c6500->cvsSwitchMode() | ||||
|  | ||||
| Returns the Switch status: multiNode or standalone. | ||||
|  | ||||
| =item $c6500->is_virtual_switch() | ||||
|  | ||||
| Return 1 if the switch (C<cvsSwitchMode>) is in multimode (VSS). | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Global Methods imported from SNMP::Info::CiscoVTP | ||||
| @@ -402,6 +467,14 @@ Crosses $c6500->p_port() with $c6500->p_duplex() to utilize port C<ifIndex>. | ||||
|     $c6500->set_i_duplex_admin('auto', $if_map{'FastEthernet0/1'})  | ||||
|         or die "Couldn't change port duplex. ",$c6500->error(1); | ||||
|  | ||||
| =item $c6500->set_i_speed_admin(speed, ifIndex) | ||||
|  | ||||
| Sets port speed, must be supplied with speed and port C<ifIndex>. | ||||
|  | ||||
| Speed choices are '10', '100', '1000'. | ||||
|  | ||||
| Crosses $c6500->p_port() with $c6500->p_speed() to utilize port C<ifIndex>. | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Table Methods imported from SNMP::Info::CiscoVTP | ||||
| @@ -439,11 +512,12 @@ See documentation in L<SNMP::Info::CiscoPower/"TABLE METHODS"> for details. | ||||
|  | ||||
| =head2 Table Methods imported from SNMP::Info::CiscoStpExtensions | ||||
|  | ||||
| See documentation in L<SNMP::Info::CiscoStpExtensions/"TABLE METHODS"> for | ||||
| details. | ||||
|  | ||||
| =head2 Table Methods imported from SNMP::Info::Layer3 | ||||
|  | ||||
| See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details. | ||||
|  | ||||
| See documentation in L<SNMP::Info::CiscoStpExtensions/"TABLE METHODS"> for details. | ||||
|  | ||||
| =cut | ||||
|  | ||||
|   | ||||
| @@ -52,7 +52,7 @@ use SNMP::Info::Layer3; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::MIBS, | ||||
|   | ||||
| @@ -55,7 +55,7 @@ use SNMP::Info::Layer3::Cisco; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|        %SNMP::Info::Layer3::Cisco::MIBS, | ||||
| @@ -135,7 +135,7 @@ Moe Kraus | ||||
|  | ||||
| =head1 DESCRIPTION | ||||
|  | ||||
| Subclass for Cisco ASAs | ||||
| Subclass for Cisco ASA Devices | ||||
|  | ||||
| =head2 Inherited Classes | ||||
|  | ||||
|   | ||||
| @@ -40,7 +40,7 @@ use SNMP::Info::Layer3::Cisco; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::Cisco::MIBS, | ||||
|   | ||||
| @@ -42,7 +42,7 @@ use SNMP::Info::Entity; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::MIBS, %SNMP::Info::Layer3::MIBS, %SNMP::Info::Entity::MIBS, | ||||
|   | ||||
| @@ -40,7 +40,7 @@ use SNMP::Info::LLDP; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::MIBS, | ||||
|   | ||||
| @@ -44,7 +44,7 @@ use SNMP::Info::Layer3; | ||||
|  | ||||
| use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::MIBS, %SNMP::Info::CDP::MIBS, | ||||
|   | ||||
| @@ -46,7 +46,7 @@ use SNMP::Info::EDP; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::MIBS, | ||||
| @@ -485,34 +485,29 @@ sub _xos_i_vlan_membership { | ||||
|     my $index   = $extreme->i_index(); | ||||
|     my $vlans   = $extreme->ex_vlan_id(); | ||||
|     my $slotx   = $extreme->_slot_factor() || 1000; | ||||
|     my $u_ports = $extreme->ex_vlan_untagged() || {}; | ||||
|     my $t_ports = $extreme->ex_vlan_tagged() || {}; | ||||
|  | ||||
|     my $i_vlan_membership = {}; | ||||
|     foreach my $idx ( keys %$u_ports ) { | ||||
|         next unless ( defined $u_ports->{$idx} ); | ||||
|         my $u_portlist = $u_ports->{$idx}; | ||||
|     foreach my $idx ( keys %$t_ports ) { | ||||
|         next unless ( defined $t_ports->{$idx} ); | ||||
|         my $t_portlist = $t_ports->{$idx}; | ||||
|         my $ret        = []; | ||||
|  | ||||
|         my ( $vlan_if, $slot ) = $idx =~ /^(\d+)\.(\d+)/; | ||||
|         my $vlan = $vlans->{$vlan_if} || ''; | ||||
|  | ||||
|         foreach my $portlist ( $u_portlist, $t_portlist ) { | ||||
|         # Convert portlist bit array to bp_index array | ||||
|         for ( my $i = 0; $i <= $#$t_portlist; $i++ ) { | ||||
|             push( @{$ret}, ( $slotx * $slot + $i + 1 ) ) | ||||
|                 if ( @$t_portlist[$i] ); | ||||
|         } | ||||
|  | ||||
|             # Convert portlist bit array to bp_index array | ||||
|             for ( my $i = 0; $i <= $#$portlist; $i++ ) { | ||||
|                 push( @{$ret}, ( $slotx * $slot + $i + 1 ) ) | ||||
|                     if ( @$portlist[$i] ); | ||||
|             } | ||||
|  | ||||
|             #Create HoA ifIndex -> VLAN array | ||||
|             foreach my $port ( @{$ret} ) { | ||||
|                 my $ifindex = $index->{$port}; | ||||
|                 next unless ( defined($ifindex) );    # shouldn't happen | ||||
|                 next if ( defined $partial and $ifindex !~ /^$partial$/ ); | ||||
|                 push( @{ $i_vlan_membership->{$ifindex} }, $vlan ); | ||||
|             } | ||||
|         #Create HoA ifIndex -> VLAN array | ||||
|         foreach my $port ( @{$ret} ) { | ||||
|             my $ifindex = $index->{$port}; | ||||
|             next unless ( defined($ifindex) );    # shouldn't happen | ||||
|             next if ( defined $partial and $ifindex !~ /^$partial$/ ); | ||||
|             push( @{ $i_vlan_membership->{$ifindex} }, $vlan ); | ||||
|         } | ||||
|     } | ||||
|     return $i_vlan_membership; | ||||
|   | ||||
| @@ -38,7 +38,7 @@ use SNMP::Info::Layer3; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::MIBS, | ||||
|   | ||||
| @@ -43,7 +43,7 @@ use SNMP::Info::LLDP; | ||||
|  | ||||
| use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::MIBS, | ||||
|   | ||||
| @@ -44,7 +44,7 @@ use SNMP::Info::LLDP; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::MIBS, | ||||
| @@ -53,6 +53,8 @@ $VERSION = '3.04_001'; | ||||
|     'FOUNDRY-SN-ROOT-MIB'         => 'foundry', | ||||
|     'FOUNDRY-SN-AGENT-MIB'        => 'snChasPwrSupplyDescription', | ||||
|     'FOUNDRY-SN-SWITCH-GROUP-MIB' => 'snSwGroupOperMode', | ||||
|     'FOUNDRY-SN-STACKING-MIB'     => 'snStackingOperUnitRole', | ||||
|     'FOUNDRY-POE-MIB'             => 'snAgentPoeGblPowerCapacityTotal', | ||||
| ); | ||||
|  | ||||
| %GLOBALS = ( | ||||
| @@ -81,11 +83,20 @@ $VERSION = '3.04_001'; | ||||
|     'sw_duplex' => 'snSwPortInfoChnMode', | ||||
|     'sw_type'   => 'snSwPortInfoMediaType', | ||||
|     'sw_speed'  => 'snSwPortInfoSpeed', | ||||
|  | ||||
|     # FOUNDRY-SN-AGENT-MIB::snAgentConfigModule2Table | ||||
|     'ag_mod2_type' => 'snAgentConfigModule2Type', | ||||
|  | ||||
|     # FOUNDRY-SN-AGENT-MIB::snAgentConfigModuleTable | ||||
|     'ag_mod_type' => 'snAgentConfigModuleType', | ||||
|  | ||||
| ); | ||||
|  | ||||
| %MUNGE = ( | ||||
|     %SNMP::Info::Layer3::MUNGE, %SNMP::Info::LLDP::MUNGE, | ||||
|     %SNMP::Info::FDP::MUNGE, | ||||
|     'ag_mod2_type' => \&SNMP::Info::munge_e_type, | ||||
|     'ag_mod_type'  => \&SNMP::Info::munge_e_type, | ||||
| ); | ||||
|  | ||||
| sub i_ignore { | ||||
| @@ -152,6 +163,7 @@ sub model { | ||||
|     return $id unless defined $model; | ||||
|  | ||||
|     $model =~ s/^sn//; | ||||
|     $model =~ s/Switch//; | ||||
|  | ||||
|     return $model; | ||||
| } | ||||
| @@ -270,6 +282,509 @@ sub stp_p_state { | ||||
|  | ||||
| } | ||||
|  | ||||
| # Entity MIB is supported on the Brocade NetIron XMR, NetIron MLX, MLXe, | ||||
| # NetIron CES, NetIron CER, and older EdgeIron series devices. | ||||
| # Try Entity MIB methods first and fall back to Pseudo ENTITY-MIB methods for | ||||
| # other devices. | ||||
| # e_fwver, e_hwver, e_swver not supported in psuedo methods, no need to | ||||
| # override | ||||
|  | ||||
| sub e_index { | ||||
|     my $foundry = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $foundry->SUPER::e_index($partial) | ||||
|         || $foundry->brcd_e_index($partial); | ||||
| } | ||||
|  | ||||
| sub e_class { | ||||
|     my $foundry = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $foundry->SUPER::e_class($partial) | ||||
|         || $foundry->brcd_e_class($partial); | ||||
| } | ||||
|  | ||||
| sub e_descr { | ||||
|     my $foundry = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $foundry->SUPER::e_descr($partial) | ||||
|         || $foundry->brcd_e_descr($partial); | ||||
| } | ||||
|  | ||||
| sub e_name { | ||||
|     my $foundry = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $foundry->SUPER::e_name($partial) | ||||
|         || $foundry->brcd_e_name($partial); | ||||
| } | ||||
|  | ||||
| sub e_parent { | ||||
|     my $foundry = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $foundry->SUPER::e_parent($partial) | ||||
|         || $foundry->brcd_e_parent($partial); | ||||
| } | ||||
|  | ||||
| sub e_pos { | ||||
|     my $foundry = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $foundry->SUPER::e_pos($partial) || $foundry->brcd_e_pos($partial); | ||||
| } | ||||
|  | ||||
| sub e_serial { | ||||
|     my $foundry = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $foundry->SUPER::e_serial($partial) | ||||
|         || $foundry->brcd_e_serial($partial); | ||||
| } | ||||
|  | ||||
| sub e_type { | ||||
|     my $foundry = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $foundry->SUPER::e_type($partial) | ||||
|         || $foundry->brcd_e_type($partial); | ||||
| } | ||||
|  | ||||
| sub e_vendor { | ||||
|     my $foundry = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $foundry->SUPER::e_vendor($partial) | ||||
|         || $foundry->brcd_e_vendor($partial); | ||||
| } | ||||
|  | ||||
| # Pseudo ENTITY-MIB methods | ||||
|  | ||||
| # This class supports both stackable and chassis based switches, identify if | ||||
| # we have a stackable so that we return appropriate entPhysicalClass | ||||
|  | ||||
| # Identify if the stackable is actually a stack vs. single switch | ||||
| sub _brcd_stack_master { | ||||
|     my $foundry = shift; | ||||
|  | ||||
|     my $roles = $foundry->snStackingOperUnitRole() || {}; | ||||
|  | ||||
|     foreach my $iid ( keys %$roles ) { | ||||
|         my $role = $roles->{$iid}; | ||||
|         next unless $role; | ||||
|         if ( $role eq 'active' ) { | ||||
|             return $iid; | ||||
|         } | ||||
|     } | ||||
|     return; | ||||
| } | ||||
|  | ||||
| sub brcd_e_index { | ||||
|     my $foundry = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $stack_master = $foundry->_brcd_stack_master(); | ||||
|     my $brcd_e_idx  | ||||
|         = $foundry->snAgentConfigModule2Description($partial) | ||||
|         || $foundry->snAgentConfigModuleDescription($partial) | ||||
|         || {}; | ||||
|  | ||||
|     my %brcd_e_index; | ||||
|     if ($stack_master) { | ||||
|  | ||||
|         # Stack Entity | ||||
|         $brcd_e_index{0} = 1; | ||||
|     } | ||||
|  | ||||
|     foreach my $iid ( keys %$brcd_e_idx ) { | ||||
|  | ||||
|         my $index = $iid; | ||||
|  | ||||
|         # Format into consistent integer format so that numeric sorting works | ||||
|         if ( $iid =~ /(\d+)\.(\d+)/ ) { | ||||
|             $index = "$1" . sprintf "%02d", $2; | ||||
|         } | ||||
|         $brcd_e_index{$iid} = $index; | ||||
|     } | ||||
|     return \%brcd_e_index; | ||||
| } | ||||
|  | ||||
| sub brcd_e_class { | ||||
|     my $foundry = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $e_idx = $foundry->brcd_e_index($partial) || {}; | ||||
|  | ||||
|     my %e_class; | ||||
|     foreach my $iid ( keys %$e_idx ) { | ||||
|         if ( $iid == 0 ) { | ||||
|             $e_class{$iid} = 'stack'; | ||||
|         } | ||||
|  | ||||
|         # Were going to assume chassis at slot/index 1 | ||||
|         # If this turns out to be false in some cases we can check | ||||
|         # snAgentConfigModuleNumberOfCpus as other modules won't have cpus? | ||||
|         elsif ( $iid =~ /1$/ ) { | ||||
|             $e_class{$iid} = 'chassis'; | ||||
|         } | ||||
|         else { | ||||
|             $e_class{$iid} = 'module'; | ||||
|         } | ||||
|     } | ||||
|     return \%e_class; | ||||
| } | ||||
|  | ||||
| sub brcd_e_descr { | ||||
|     my $foundry = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $brcd_e_idx = $foundry->brcd_e_index($partial) || {}; | ||||
|     my $m_descrs  | ||||
|         = $foundry->snAgentConfigModule2Description($partial) | ||||
|         || $foundry->snAgentConfigModuleDescription($partial) | ||||
|         || {}; | ||||
|  | ||||
|     my %brcd_e_descr; | ||||
|     foreach my $iid ( keys %$brcd_e_idx ) { | ||||
|  | ||||
|         if ( $iid == 0 ) { | ||||
|             $brcd_e_descr{$iid} = $foundry->description(); | ||||
|         } | ||||
|  | ||||
|         my $descr = $m_descrs->{$iid}; | ||||
|         next unless defined $descr; | ||||
|  | ||||
|         $brcd_e_descr{$iid} = $descr; | ||||
|     } | ||||
|     return \%brcd_e_descr; | ||||
| } | ||||
|  | ||||
| sub brcd_e_name { | ||||
|     my $foundry = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $stack_master = $foundry->_brcd_stack_master(); | ||||
|     my $e_idx = $foundry->brcd_e_index($partial) || {}; | ||||
|  | ||||
|     my %brcd_e_name; | ||||
|     foreach my $iid ( keys %$e_idx ) { | ||||
|         if ( $iid == 0 ) { | ||||
|             $brcd_e_name{$iid} = 'Stack Master Unit'; | ||||
|         } | ||||
|  | ||||
|         elsif ( $stack_master && $iid =~ /(\d+)\.1$/ ) { | ||||
|             $brcd_e_name{$iid} = "Switch Stack Unit $1"; | ||||
|         } | ||||
|         elsif ( $iid =~ /1$/ ) { | ||||
|             $brcd_e_name{$iid} = "Switch"; | ||||
|         } | ||||
|         else { | ||||
|             $brcd_e_name{$iid} = 'Module'; | ||||
|         } | ||||
|     } | ||||
|     return \%brcd_e_name; | ||||
| } | ||||
|  | ||||
| sub brcd_e_vendor { | ||||
|     my $foundry = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $e_idx = $foundry->brcd_e_index($partial) || {}; | ||||
|  | ||||
|     my %brcd_e_vendor; | ||||
|     foreach my $iid ( keys %$e_idx ) { | ||||
|         my $vendor = 'brocade'; | ||||
|  | ||||
|         $brcd_e_vendor{$iid} = $vendor; | ||||
|     } | ||||
|     return \%brcd_e_vendor; | ||||
| } | ||||
|  | ||||
| sub brcd_e_serial { | ||||
|     my $foundry = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $e_idx = $foundry->brcd_e_index($partial) || {}; | ||||
|     my $serials  | ||||
|         = $foundry->snAgentConfigModule2SerialNumber($partial) | ||||
|         || $foundry->snAgentConfigModuleSerialNumber($partial) | ||||
|         || {}; | ||||
|  | ||||
|     my %brcd_e_serial; | ||||
|     foreach my $iid ( keys %$e_idx ) { | ||||
|  | ||||
|         if ( $iid == 0 ) { | ||||
|             $brcd_e_serial{$iid} = $foundry->serial(); | ||||
|         } | ||||
|  | ||||
|         my $serial = $serials->{$iid}; | ||||
|         next unless defined $serial; | ||||
|  | ||||
|         $brcd_e_serial{$iid} = $serial; | ||||
|     } | ||||
|     return \%brcd_e_serial; | ||||
| } | ||||
|  | ||||
| sub brcd_e_type { | ||||
|     my $foundry = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $e_idx = $foundry->brcd_e_index($partial) || {}; | ||||
|     my $types  | ||||
|         = $foundry->ag_mod2_type($partial) | ||||
|         || $foundry->ag_mod_type($partial) | ||||
|         || {}; | ||||
|  | ||||
|     my %brcd_e_type; | ||||
|     foreach my $iid ( keys %$e_idx ) { | ||||
|  | ||||
|         if ( $iid == 0 ) { | ||||
|             $brcd_e_type{$iid} = $foundry->model(); | ||||
|         } | ||||
|  | ||||
|         my $type = $types->{$iid}; | ||||
|         next unless defined $type; | ||||
|  | ||||
|         $brcd_e_type{$iid} = $type; | ||||
|     } | ||||
|     return \%brcd_e_type; | ||||
| } | ||||
|  | ||||
| sub brcd_e_pos { | ||||
|     my $foundry = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $e_idx = $foundry->brcd_e_index($partial) || {}; | ||||
|  | ||||
|     my %brcd_e_pos; | ||||
|     foreach my $iid ( keys %$e_idx ) { | ||||
|  | ||||
|         my $pos; | ||||
|         if ( $iid == 0 ) { | ||||
|             $pos = -1; | ||||
|         } | ||||
|         elsif ( $iid =~ /(\d+)\.1$/ ) { | ||||
|             $pos = $1; | ||||
|         } | ||||
|         elsif ( $iid =~ /(\d+)$/ ) { | ||||
|             $pos = $1; | ||||
|         } | ||||
|  | ||||
|         $brcd_e_pos{$iid} = $pos; | ||||
|     } | ||||
|     return \%brcd_e_pos; | ||||
| } | ||||
|  | ||||
| sub brcd_e_parent { | ||||
|     my $foundry = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $stack_master = $foundry->_brcd_stack_master(); | ||||
|     my $e_idx = $foundry->brcd_e_index($partial) || {}; | ||||
|  | ||||
|     my %brcd_e_parent; | ||||
|     foreach my $iid ( keys %$e_idx ) { | ||||
|  | ||||
|         if ( $iid == 0 ) { | ||||
|             $brcd_e_parent{$iid} = 0; | ||||
|         } | ||||
|         elsif ( $stack_master && $iid =~ /(\d+)\.1$/ ) { | ||||
|             $brcd_e_parent{$iid} = 1; | ||||
|         } | ||||
|         elsif ( $iid =~ /1$/ ) { | ||||
|             $brcd_e_parent{$iid} = 0; | ||||
|         } | ||||
|         elsif ( $iid =~ /(\d+).\d+/ ) { | ||||
|             $brcd_e_parent{$iid} = "$1" . "01"; | ||||
|         } | ||||
|  | ||||
|         # assume non-stacked and chassis at index 1 | ||||
|         else { | ||||
|             $brcd_e_parent{$iid} = 1; | ||||
|         } | ||||
|     } | ||||
|     return \%brcd_e_parent; | ||||
| } | ||||
|  | ||||
| # The index of snAgentPoePortTable is snAgentPoePortNumber which equals | ||||
| # ifIndex; however, to emulate POWER-ETHERNET-MIB we need a "module.port" | ||||
| # index.  If ifDescr has the format x/x/x use it to determine the module | ||||
| # otherwise default to 1.  Unfortunately, this means we can't map any | ||||
| # snAgentPoePortTable leafs directly and partials will not be supported. | ||||
| sub peth_port_ifindex { | ||||
|     my $foundry = shift; | ||||
|  | ||||
|     my $indexes = $foundry->snAgentPoePortNumber(); | ||||
|     my $descrs  = $foundry->i_description(); | ||||
|  | ||||
|     my $peth_port_ifindex = {}; | ||||
|     foreach my $i ( keys %$indexes ) { | ||||
|         my $descr = $descrs->{$i}; | ||||
|         next unless $descr; | ||||
|  | ||||
|         my $new_idx = "1.$i"; | ||||
|  | ||||
|         if ( $descr =~ /(\d+)\/\d+\/\d+/ ) { | ||||
|             $new_idx = "$1.$i"; | ||||
|         } | ||||
|         $peth_port_ifindex->{$new_idx} = $i; | ||||
|     } | ||||
|     return $peth_port_ifindex; | ||||
| } | ||||
|  | ||||
| sub peth_port_admin { | ||||
|     my $foundry = shift; | ||||
|  | ||||
|     my $p_index      = $foundry->peth_port_ifindex()     || {}; | ||||
|     my $admin_states = $foundry->snAgentPoePortControl() || {}; | ||||
|  | ||||
|     my $peth_port_admin = {}; | ||||
|     foreach my $i ( keys %$p_index ) { | ||||
|         my ( $module, $port ) = split( /\./, $i ); | ||||
|         my $state = $admin_states->{$port}; | ||||
|  | ||||
|         if ( $state =~ /enable/ ) { | ||||
|             $peth_port_admin->{$i} = 'true'; | ||||
|         } | ||||
|         else { | ||||
|             $peth_port_admin->{$i} = 'false'; | ||||
|         } | ||||
|     } | ||||
|     return $peth_port_admin; | ||||
| } | ||||
|  | ||||
| sub peth_port_neg_power { | ||||
|     my $foundry = shift; | ||||
|  | ||||
|     my $p_index         = $foundry->peth_port_ifindex()   || {}; | ||||
|     my $peth_port_class = $foundry->snAgentPoePortClass() || {}; | ||||
|  | ||||
|     my $poemax = { | ||||
|         '0' => 12950, | ||||
|         '1' => 3840, | ||||
|         '2' => 6490, | ||||
|         '3' => 12950, | ||||
|         '4' => 25500 | ||||
|     }; | ||||
|  | ||||
|     my $peth_port_neg_power = {}; | ||||
|     foreach my $i ( keys %$p_index ) { | ||||
|         my ( $module, $port ) = split( /\./, $i ); | ||||
|         my $power = $poemax->{ $peth_port_class->{$port} }; | ||||
|         next unless $power; | ||||
|  | ||||
|         $peth_port_neg_power->{$i} = $power; | ||||
|     } | ||||
|     return $peth_port_neg_power; | ||||
| } | ||||
|  | ||||
| sub peth_port_power { | ||||
|     my $foundry = shift; | ||||
|  | ||||
|     my $p_index       = $foundry->peth_port_ifindex()      || {}; | ||||
|     my $port_consumed = $foundry->snAgentPoePortConsumed() || {}; | ||||
|  | ||||
|     my $peth_port_power = {}; | ||||
|     foreach my $i ( keys %$p_index ) { | ||||
|         my ( $module, $port ) = split( /\./, $i ); | ||||
|         my $power = $port_consumed->{$port}; | ||||
|         next unless $power; | ||||
|  | ||||
|         $peth_port_power->{$i} = $power; | ||||
|     } | ||||
|     return $peth_port_power; | ||||
| } | ||||
|  | ||||
| sub peth_port_class { | ||||
|     my $foundry = shift; | ||||
|  | ||||
|     my $p_index    = $foundry->peth_port_ifindex()   || {}; | ||||
|     my $port_class = $foundry->snAgentPoePortClass() || {}; | ||||
|  | ||||
|     my $peth_port_class = {}; | ||||
|     foreach my $i ( keys %$p_index ) { | ||||
|         my ( $module, $port ) = split( /\./, $i ); | ||||
|         my $power = $port_class->{$port}; | ||||
|         next unless $power; | ||||
|  | ||||
|         $peth_port_class->{$i} = "class$power"; | ||||
|     } | ||||
|     return $peth_port_class; | ||||
| } | ||||
|  | ||||
| sub peth_port_status { | ||||
|     my $foundry = shift; | ||||
|  | ||||
|     my $p_index      = $foundry->peth_port_ifindex()     || {}; | ||||
|     my $admin_states = $foundry->snAgentPoePortControl() || {}; | ||||
|  | ||||
|     my $peth_port_status = {}; | ||||
|     foreach my $i ( keys %$p_index ) { | ||||
|         my ( $module, $port ) = split( /\./, $i ); | ||||
|         my $state = $admin_states->{$port}; | ||||
|  | ||||
|         if ( $state =~ /enable/ ) { | ||||
|             $peth_port_status->{$i} = 'deliveringPower'; | ||||
|         } | ||||
|         else { | ||||
|             $peth_port_status->{$i} = 'disabled'; | ||||
|         } | ||||
|     } | ||||
|     return $peth_port_status; | ||||
| } | ||||
|  | ||||
| sub peth_power_status { | ||||
|     my $foundry = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $watts = $foundry->snAgentPoeUnitPowerCapacityTotal($partial) || {}; | ||||
|  | ||||
|     my $peth_power_status = {}; | ||||
|     foreach my $i ( keys %$watts ) { | ||||
|         $peth_power_status->{$i} = 'on'; | ||||
|     } | ||||
|     return $peth_power_status; | ||||
| } | ||||
|  | ||||
| sub peth_power_watts { | ||||
|     my $foundry = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $watts_total = $foundry->snAgentPoeUnitPowerCapacityTotal($partial) | ||||
|         || {}; | ||||
|  | ||||
|     my $peth_power_watts = {}; | ||||
|     foreach my $i ( keys %$watts_total ) { | ||||
|         my $total = $watts_total->{$i}; | ||||
|         next unless $total; | ||||
|  | ||||
|         $peth_power_watts->{$i} = $total / 1000; | ||||
|     } | ||||
|     return $peth_power_watts; | ||||
| } | ||||
|  | ||||
| sub peth_power_consumption { | ||||
|     my $foundry = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $watts_total = $foundry->snAgentPoeUnitPowerCapacityTotal($partial) | ||||
|         || {}; | ||||
|     my $watts_free = $foundry->snAgentPoeUnitPowerCapacityFree($partial) | ||||
|         || {}; | ||||
|  | ||||
|     my $peth_power_consumed = {}; | ||||
|     foreach my $i ( keys %$watts_total ) { | ||||
|         my $total = $watts_total->{$i}; | ||||
|         next unless $total; | ||||
|         my $free = $watts_free->{$i} || 0; | ||||
|  | ||||
|         $peth_power_consumed->{$i} = ( $total - $free ) / 1000; | ||||
|     } | ||||
|     return $peth_power_consumed; | ||||
| } | ||||
|  | ||||
| 1; | ||||
| __END__ | ||||
|  | ||||
| @@ -329,6 +844,10 @@ after determining a more specific class using the method above. | ||||
|  | ||||
| =item F<FOUNDRY-SN-SWITCH-GROUP-MIB> | ||||
|  | ||||
| =item F<FOUNDRY-SN-STACKING-MIB> | ||||
|  | ||||
| =item F<FOUNDRY-POE-MIB> | ||||
|  | ||||
| =item Inherited Classes' MIBs | ||||
|  | ||||
| See L<SNMP::Info::Layer3/"Required MIBs"> for its own MIB requirements. | ||||
| @@ -348,7 +867,8 @@ These are methods that return scalar value from SNMP | ||||
| =item $foundry->model() | ||||
|  | ||||
| Returns model type.  Checks $foundry->id() against the F<FOUNDRY-SN-ROOT-MIB> | ||||
| and removes 'C<sn>'.  EdgeIron models determined through F<ENTITY-MIB>.   | ||||
| and removes 'C<sn>' and 'C<Switch>'.  EdgeIron models determined | ||||
| through F<ENTITY-MIB>.   | ||||
|  | ||||
| =item $foundry->vendor() | ||||
|  | ||||
| @@ -430,8 +950,8 @@ See documentation in L<SNMP::Info::LLDP/"GLOBALS"> for details. | ||||
|  | ||||
| =head1 TABLE METHODS | ||||
|  | ||||
| These are methods that return tables of information in the form of a reference | ||||
| to a hash. | ||||
| These are methods that return tables of information in the form of a | ||||
| reference to a hash. | ||||
|  | ||||
| =head2 Overrides | ||||
|  | ||||
| @@ -464,6 +984,130 @@ Skipped if device is an EdgeIron 24G due to reports of hangs. | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 F<ENTITY-MIB> Information | ||||
|  | ||||
| F<ENTITY-MIB> is supported on the Brocade NetIron XMR, NetIron MLX, MLXe, | ||||
| NetIron CES, NetIron CER, and older EdgeIron series devices.  For other | ||||
| devices which do not support it, these methods emulate Physical Table methods | ||||
| using F<FOUNDRY-SN-AGENT-MIB>.  See Pseudo F<ENTITY-MIB> information below | ||||
| for details on brcd_e_* methods. | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item $foundry->e_index()  | ||||
|  | ||||
| If the device doesn't support C<entPhysicalDescr>, this will | ||||
| try brcd_e_index(). | ||||
|  | ||||
| Note that this is based on C<entPhysicalDescr> due to implementation | ||||
| details of SNMP::Info::Entity::e_index(). | ||||
|  | ||||
| =item $foundry->e_class()  | ||||
|  | ||||
| If the device doesn't support C<entPhysicalClass>, this will try | ||||
| brcd_e_class(). | ||||
|  | ||||
| =item $foundry->e_descr()  | ||||
|  | ||||
| If the device doesn't support C<entPhysicalDescr>, this will try | ||||
| brcd_e_descr(). | ||||
|  | ||||
| =item $foundry->e_name()  | ||||
|  | ||||
| If the device doesn't support C<entPhysicalName>, this will try | ||||
| brcd_e_name(). | ||||
|  | ||||
| =item $foundry->e_parent()  | ||||
|  | ||||
| If the device doesn't support C<entPhysicalContainedIn>, this will try | ||||
| brcd_e_parent(). | ||||
|  | ||||
| =item $foundry->e_pos()  | ||||
|  | ||||
| If the device doesn't support C<entPhysicalParentRelPos>, this will try | ||||
| brcd_e_pos(). | ||||
|  | ||||
| =item $foundry->e_serial()  | ||||
|  | ||||
| If the device doesn't support C<entPhysicalSerialNum>, this will try | ||||
| brcd_e_serial(). | ||||
|  | ||||
| =item $foundry->e_type()  | ||||
|  | ||||
| If the device doesn't support C<entPhysicalVendorType>, this will try | ||||
| brcd_e_type(). | ||||
|  | ||||
| =item $foundry->e_vendor()  | ||||
|  | ||||
| If the device doesn't support C<entPhysicalMfgName>, this will try | ||||
| brcd_e_vendor(). | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Pseudo F<ENTITY-MIB> information | ||||
|  | ||||
| These methods emulate F<ENTITY-MIB> Physical Table methods using | ||||
| F<FOUNDRY-SN-AGENT-MIB>.  | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item $foundry->brcd_e_index() | ||||
|  | ||||
| Returns reference to hash.  Key: IID, Value: Integer, Indices are combined | ||||
| into an integer, each index is two digits padded with leading zero if | ||||
| required. | ||||
|  | ||||
| =item $foundry->brcd_e_class() | ||||
|  | ||||
| Returns reference to hash.  Key: IID, Value: General hardware type. | ||||
|  | ||||
| Returns 'stack' for the stack master in an active stack, 'chassis' for | ||||
| base switches that contain modules, and 'module' for others. | ||||
|  | ||||
| =item $foundry->brcd_e_descr() | ||||
|  | ||||
| Returns reference to hash.  Key: IID, Value: Human friendly name | ||||
|  | ||||
| (C<snAgentConfigModule2Description>) or | ||||
| (C<snAgentConfigModuleDescription>)  | ||||
|  | ||||
| =item $foundry->brcd_e_name() | ||||
|  | ||||
| Returns reference to hash.  Key: IID, Value: Human friendly name | ||||
|  | ||||
| =item $foundry->brcd_e_vendor() | ||||
|  | ||||
| Returns reference to hash.  Key: IID, Value: brocade | ||||
|  | ||||
| =item $foundry->brcd_e_serial() | ||||
|  | ||||
| Returns reference to hash.  Key: IID, Value: Serial number | ||||
|  | ||||
| Serial number is $foundry->serial() for a stack master unit and  | ||||
| (C<snAgentConfigModule2SerialNumber>) or | ||||
| (C<snAgentConfigModuleSerialNumber>) for all others. | ||||
|  | ||||
| =item $foundry->brcd_e_type() | ||||
|  | ||||
| Returns reference to hash.  Key: IID, Value: Type of component/sub-component | ||||
| as defined under C<snAgentConfigModule2Type> or C<snAgentConfigModule2Type>  | ||||
| in F<FOUNDRY-SN-AGENT-MIB>. | ||||
|  | ||||
| =item $foundry->brcd_e_pos() | ||||
|  | ||||
| Returns reference to hash.  Key: IID, Value: The relative position among all | ||||
| entities sharing the same parent. | ||||
|  | ||||
| (C<s5ChasComSubIndx>) | ||||
|  | ||||
| =item $foundry->brcd_e_parent() | ||||
|  | ||||
| Returns reference to hash.  Key: IID, Value: The value of brcd_e_index() | ||||
| for the entity which 'contains' this entity.  A value of zero indicates | ||||
| this entity is not contained in any other entity. | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Foundry Switch Port Information Table (C<snSwPortIfTable>) | ||||
|  | ||||
| =over | ||||
| @@ -494,6 +1138,70 @@ Returns reference to hash.  Current Port Speed. | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Power Over Ethernet Port Table | ||||
|  | ||||
| These methods emulate the F<POWER-ETHERNET-MIB> Power Source Entity (PSE) | ||||
| Port Table C<pethPsePortTable> methods using the F<FOUNDRY-POE-MIB> Power | ||||
| over Ethernet Port Table C<snAgentPoePortTable>. | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item $foundry->peth_port_ifindex() | ||||
|  | ||||
| Creates an index of module.port to align with the indexing of the | ||||
| C<pethPsePortTable> with a value of C<ifIndex>.  The module defaults 1 | ||||
| if otherwise unknown. | ||||
|  | ||||
| =item $foundry->peth_port_admin() | ||||
|  | ||||
| Administrative status: is this port permitted to deliver power? | ||||
|  | ||||
| C<pethPsePortAdminEnable> | ||||
|  | ||||
| =item $foundry->peth_port_status() | ||||
|  | ||||
| Current status: is this port delivering power. | ||||
|  | ||||
| =item $foundry->peth_port_class() | ||||
|  | ||||
| Device class: if status is delivering power, this represents the 802.3af | ||||
| class of the device being powered. | ||||
|  | ||||
| =item $foundry->peth_port_neg_power() | ||||
|  | ||||
| The power, in milliwatts, that has been committed to this port. | ||||
| This value is derived from the 802.3af class of the device being | ||||
| powered. | ||||
|  | ||||
| =item $foundry->peth_port_power() | ||||
|  | ||||
| The power, in milliwatts, that the port is delivering. | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Power Over Ethernet Module Table | ||||
|  | ||||
| These methods emulate the F<POWER-ETHERNET-MIB> Main Power Source Entity | ||||
| (PSE) Table C<pethMainPseTable> methods using the F<FOUNDRY-POE-MIB> Power | ||||
| over Ethernet Port Table C<snAgentPoeModuleTable >. | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item $foundry->peth_power_watts() | ||||
|  | ||||
| The power supply's capacity, in watts. | ||||
|  | ||||
| =item $foundry->peth_power_status() | ||||
|  | ||||
| The power supply's operational status. | ||||
|  | ||||
| =item $foundry->peth_power_consumption() | ||||
|  | ||||
| How much power, in watts, this power supply has been committed to | ||||
| deliver. | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Table Methods imported from SNMP::Info::Layer3 | ||||
|  | ||||
| See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details. | ||||
|   | ||||
| @@ -39,7 +39,7 @@ use SNMP::Info::LLDP; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::MIBS, | ||||
|   | ||||
| @@ -42,7 +42,7 @@ use SNMP::Info::LLDP; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::MIBS, | ||||
|   | ||||
							
								
								
									
										407
									
								
								Info/Layer3/IBMGbTor.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										407
									
								
								Info/Layer3/IBMGbTor.pm
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,407 @@ | ||||
| # SNMP::Info::Layer3::IBMGbTor - SNMP Interface to IBM Rackswitch devices | ||||
| # $Id$ | ||||
| # | ||||
| # Copyright (c) 2013 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::IBMGbTor; | ||||
|  | ||||
| use strict; | ||||
| use Exporter; | ||||
| use SNMP::Info::Layer3; | ||||
| use SNMP::Info::LLDP; | ||||
|  | ||||
| @SNMP::Info::Layer3::IBMGbTor::ISA | ||||
|     = qw/SNMP::Info::LLDP SNMP::Info::Layer3 Exporter/; | ||||
| @SNMP::Info::Layer3::IBMGbTor::EXPORT_OK = qw//; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::MIBS, | ||||
|  | ||||
|     # LLDP MIBs not loaded to prevent possible unqualified namespace conflict | ||||
|     # with IBM definitions | ||||
|     'IBM-GbTOR-10G-L2L3-MIB' => 'lldpInfoRemoteDevicesLocalPort', | ||||
| ); | ||||
|  | ||||
| %GLOBALS = ( | ||||
|     %SNMP::Info::Layer3::GLOBALS, | ||||
|     %SNMP::Info::LLDP::GLOBALS, | ||||
|     'temp' => 'hwTempSensors', | ||||
|     'fan'  => 'hwFanSpeed', | ||||
|  | ||||
|     # Can't find the equivalent in IBM-GbTOR-10G-L2L3-MIB | ||||
|     # use a different strategy for lldp_sys_cap in hasLLDP() | ||||
|     #'lldp_sysname' => 'lldpLocSysName', | ||||
|     #'lldp_sysdesc' => 'lldpLocSysDesc', | ||||
|     #'lldp_sys_cap' => 'lldpLocSysCapEnabled', | ||||
| ); | ||||
|  | ||||
| %FUNCS = ( | ||||
|     %SNMP::Info::Layer3::FUNCS, | ||||
|     %SNMP::Info::LLDP::FUNCS, | ||||
|  | ||||
|     # IBM-GbTOR-10G-L2L3-MIB::portInfoTable | ||||
|     'sw_duplex' => 'portInfoMode', | ||||
|  | ||||
|     # Can't find the equivalent in IBM-GbTOR-10G-L2L3-MIB | ||||
|     # not currently used in LLDP class | ||||
|     #'lldp_lman_addr' => 'lldpLocManAddrIfId', | ||||
|  | ||||
|     # IBM-GbTOR-10G-L2L3-MIB::lldpInfoPortTable | ||||
|     'lldp_port_status' => 'lldpInfoPortAdminStatus', | ||||
|  | ||||
|     # IBM-GbTOR-10G-L2L3-MIB::lldpInfoRemoteDevicesTable | ||||
|     'lldp_rem_id_type'  => 'lldpInfoRemoteDevicesChassisSubtype', | ||||
|     'lldp_rem_id'       => 'lldpInfoRemoteDevicesSystemName', | ||||
|     'lldp_rem_pid_type' => 'lldpInfoRemoteDevicesPortSubtype', | ||||
|     'lldp_rem_pid'      => 'lldpInfoRemoteDevicesPortId', | ||||
|     'lldp_rem_desc'     => 'lldpInfoRemoteDevicesPortDescription', | ||||
|     'lldp_rem_sysname'  => 'lldpInfoRemoteDevicesSystemName', | ||||
|     'lldp_rem_sysdesc'  => 'lldpInfoRemoteDevicesSystemDescription', | ||||
|     'lldp_rem_sys_cap'  => 'lldpInfoRemoteDevicesSystemCapEnabled', | ||||
|  | ||||
|     # IBM-GbTOR-10G-L2L3-MIB::lldpInfoRemoteDevicesManAddrTable | ||||
|     'lldp_rman_type' => 'lldpInfoRemoteDevicesManAddrSubtype', | ||||
|     'lldp_rman_addr' => 'lldpInfoRemoteDevicesManAddr', | ||||
| ); | ||||
|  | ||||
| %MUNGE = ( %SNMP::Info::Layer3::MUNGE, %SNMP::Info::LLDP::MUNGE, ); | ||||
|  | ||||
| sub hasLLDP { | ||||
|     my $ibm = shift; | ||||
|  | ||||
|     # We may be have LLDP, but nothing in lldpRemoteSystemsData Tables | ||||
|     # Look to see if LLDP Rx enabled on any port | ||||
|     my $lldp_cap = $ibm->lldp_port_status(); | ||||
|  | ||||
|     foreach my $if ( keys %$lldp_cap ) { | ||||
|         if ( $lldp_cap->{$if} =~ /enabledRx/i ) { | ||||
|             return 1; | ||||
|         } | ||||
|     } | ||||
|     return; | ||||
| } | ||||
|  | ||||
| sub lldp_ip { | ||||
|     my $ibm     = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $rman_type = $ibm->lldp_rman_type($partial) || {}; | ||||
|     my $rman_addr = $ibm->lldp_rman_addr($partial) || {}; | ||||
|  | ||||
|     my %lldp_ip; | ||||
|     foreach my $key ( keys %$rman_addr ) { | ||||
|         my $type = $rman_type->{$key}; | ||||
|         next unless defined $type; | ||||
|         next unless $type eq 'ipV4'; | ||||
|         if ( $key =~ /^(\d+)\./ ) { | ||||
|             $lldp_ip{$1} = $rman_addr->{$key}; | ||||
|         } | ||||
|     } | ||||
|     return \%lldp_ip; | ||||
| } | ||||
|  | ||||
| sub lldp_if { | ||||
|     my $lldp    = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $lldp_desc = $lldp->lldpInfoRemoteDevicesLocalPort($partial) || {}; | ||||
|     my $i_descr   = $lldp->i_description()                          || {}; | ||||
|     my $i_alias   = $lldp->i_alias()                                || {}; | ||||
|     my %r_i_descr = reverse %$i_descr; | ||||
|     my %r_i_alias = reverse %$i_alias; | ||||
|  | ||||
|     my %lldp_if; | ||||
|     foreach my $key ( keys %$lldp_desc ) { | ||||
|  | ||||
|     # Cross reference lldpLocPortDesc with ifDescr and ifAlias to get ifIndex, | ||||
|     # prefer ifAlias over ifDescr since MIB says 'alias'. | ||||
|         my $desc = $lldp_desc->{$key}; | ||||
|         next unless $desc; | ||||
|         my $port = $desc; | ||||
|  | ||||
|     # If cross reference is successful use it, otherwise stick with | ||||
|     # lldpRemLocalPortNum | ||||
|         if ( exists $r_i_alias{$desc} ) { | ||||
|             $port = $r_i_alias{$desc}; | ||||
|         } | ||||
|         elsif ( exists $r_i_descr{$desc} ) { | ||||
|             $port = $r_i_descr{$desc}; | ||||
|         } | ||||
|  | ||||
|         $lldp_if{$key} = $port; | ||||
|     } | ||||
|     return \%lldp_if; | ||||
| } | ||||
|  | ||||
| sub lldp_platform { | ||||
|     my $ibm = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $ibm->lldpInfoRemoteDevicesSystemDescription($partial); | ||||
| } | ||||
|  | ||||
| sub i_ignore { | ||||
|     my $ibm     = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $interfaces = $ibm->interfaces($partial) || {}; | ||||
|  | ||||
|     my %i_ignore; | ||||
|     foreach my $if ( keys %$interfaces ) { | ||||
|         if ( $interfaces->{$if} =~ /(tunnel|loopback|\blo\b|lb|null)/i ) { | ||||
|             $i_ignore{$if}++; | ||||
|         } | ||||
|     } | ||||
|     return \%i_ignore; | ||||
| } | ||||
|  | ||||
| sub i_duplex { | ||||
|     my $ibm     = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $ibm->sw_duplex($partial); | ||||
| } | ||||
|  | ||||
| sub model { | ||||
|     my $ibm   = shift; | ||||
|     my $id    = $ibm->id(); | ||||
|     my $descr = $ibm->description(); | ||||
|     my $model = &SNMP::translateObj($id); | ||||
|  | ||||
|     if ( $descr =~ /RackSwitch\s(.*)/ ) { | ||||
|         return $1; | ||||
|     } | ||||
|  | ||||
|     return $model || $id; | ||||
| } | ||||
|  | ||||
| sub os { | ||||
|     return 'ibm'; | ||||
| } | ||||
|  | ||||
| sub vendor { | ||||
|     return 'ibm'; | ||||
| } | ||||
|  | ||||
| sub os_ver { | ||||
|     my $ibm = shift; | ||||
|  | ||||
|     return $ibm->agSoftwareVersion(); | ||||
| } | ||||
|  | ||||
| sub interfaces { | ||||
|     my $ibm     = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $i_descr = $ibm->i_description($partial) || {}; | ||||
|     my $i_name  = $ibm->i_name($partial)        || {}; | ||||
|  | ||||
|     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; | ||||
| } | ||||
|  | ||||
| 1; | ||||
| __END__ | ||||
|  | ||||
| =head1 NAME | ||||
|  | ||||
| SNMP::Info::Layer3::IBMGbTor - SNMP Interface to IBM Rackswitch devices | ||||
|  | ||||
| =head1 AUTHOR | ||||
|  | ||||
| Eric Miller | ||||
|  | ||||
| =head1 SYNOPSIS | ||||
|  | ||||
|  # Let SNMP::Info determine the correct subclass for you.  | ||||
|  my $ibm = new SNMP::Info( | ||||
|                           AutoSpecify => 1, | ||||
|                           Debug       => 1, | ||||
|                           DestHost    => 'myswitch', | ||||
|                           Community   => 'public', | ||||
|                           Version     => 1 | ||||
|                         )  | ||||
|     or die "Can't connect to DestHost.\n"; | ||||
|  | ||||
|  my $class = $ibm->class(); | ||||
|  | ||||
|  print "SNMP::Info determined this device to fall under subclass : $class\n"; | ||||
|  | ||||
| =head1 DESCRIPTION | ||||
|  | ||||
| Abstraction subclass for IBM Rackswitch (formerly Blade Network Technologies) | ||||
| network devices. | ||||
|  | ||||
| For speed or debugging purposes you can call the subclass directly, but not | ||||
| after determining a more specific class using the method above. | ||||
|  | ||||
|  my $ibm = new SNMP::Info::Layer3::IBMGbTor(...); | ||||
|  | ||||
| =head2 Inherited Classes | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item SNMP::Info::Layer3; | ||||
|  | ||||
| =item SNMP::Info::LLDP; | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Required MIBs | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item F<IBM-GbTOR-10G-L2L3-MIB> | ||||
|  | ||||
| =item Inherited Classes' MIBs | ||||
|  | ||||
| See L<SNMP::Info::Layer3/"Required MIBs"> for its own MIB requirements. | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head1 GLOBALS | ||||
|  | ||||
| These are methods that return scalar value from SNMP | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item $ibm->model() | ||||
|  | ||||
| Returns model type.  Attempts to pull model from device description. | ||||
| Otherwise checks $ibm->id() against the F<IBM-GbTOR-10G-L2L3-MIB>. | ||||
|  | ||||
| =item $ibm->vendor() | ||||
|  | ||||
| Returns 'ibm' | ||||
|  | ||||
| =item $ibm->os() | ||||
|  | ||||
| Returns 'ibm' | ||||
|  | ||||
| =item $ibm->os_ver() | ||||
|  | ||||
| Returns the software version | ||||
|  | ||||
| (C<agSoftwareVersion>) | ||||
|  | ||||
| =item $ibm->temp() | ||||
|  | ||||
| (C<hwTempSensors>) | ||||
|  | ||||
| =item $ibm->fan() | ||||
|  | ||||
| (C<hwFanSpeed>) | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Overrides | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item $ibm->hasLLDP() | ||||
|  | ||||
| Is LLDP is active in this device?   | ||||
|  | ||||
| Note:  LLDP may be active, but nothing in C<lldpRemoteSystemsData> Tables so | ||||
| the device would not return any useful topology information. | ||||
|  | ||||
| Checks to see if at least one interface is enabled to receive LLDP packets. | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Global Methods imported from SNMP::Info::Layer3 | ||||
|  | ||||
| See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details. | ||||
|  | ||||
| =head2 Global Methods imported from SNMP::Info::LLDP | ||||
|  | ||||
| See documentation in L<SNMP::Info::LLDP/"GLOBALS"> for details. | ||||
|  | ||||
| =head1 TABLE METHODS | ||||
|  | ||||
| These are methods that return tables of information in the form of a reference | ||||
| to a hash. | ||||
|  | ||||
| =head2 Overrides | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item $ibm->interfaces() | ||||
|  | ||||
| Returns reference to hash of interface names to iids. | ||||
|  | ||||
| =item $ibm->i_ignore() | ||||
|  | ||||
| Returns reference to hash of interfaces to be ignored. | ||||
|  | ||||
| Ignores interfaces with descriptions of tunnel, loopback, and null. | ||||
|  | ||||
| =item $ibm->i_duplex() | ||||
|  | ||||
| Returns reference to hash of interface link duplex status.  | ||||
|  | ||||
| (C<portInfoMode>) | ||||
|  | ||||
| =item $ibm->lldp_if() | ||||
|  | ||||
| Returns the mapping to the SNMP Interface Table. Tries to cross reference  | ||||
| (C<lldpInfoRemoteDevicesLocalPort>) with (C<ifDescr>) and (C<ifAlias>) | ||||
| to get (C<ifIndex>). | ||||
|  | ||||
| =item $ibm->lldp_ip() | ||||
|  | ||||
| Returns remote IPv4 address.  Returns for all other address types, use | ||||
| lldp_addr if you want any return address type. | ||||
|  | ||||
| =item $ibm->lldp_platform() | ||||
|  | ||||
| Returns remote device system description. | ||||
|  | ||||
| (C<lldpInfoRemoteDevicesSystemDescription>) | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Table Methods imported from SNMP::Info::Layer3 | ||||
|  | ||||
| See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details. | ||||
|  | ||||
| =head2 Table Methods imported from SNMP::Info::LLDP | ||||
|  | ||||
| See documentation in L<SNMP::Info::LLDP/"TABLE METHODS"> for details. | ||||
|  | ||||
| =cut | ||||
| @@ -40,7 +40,7 @@ use SNMP::Info::LLDP; | ||||
|  | ||||
| use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::MIBS, | ||||
|   | ||||
| @@ -41,7 +41,7 @@ use SNMP::Info::Layer3; | ||||
|  | ||||
| use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::MIBS, | ||||
|   | ||||
| @@ -39,7 +39,7 @@ use SNMP::Info::Layer3; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( %SNMP::Info::Layer3::MIBS, ); | ||||
|  | ||||
|   | ||||
| @@ -39,7 +39,7 @@ use SNMP::Info::Layer3; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::MIBS, | ||||
|   | ||||
| @@ -41,7 +41,7 @@ use SNMP::Info::SONMP; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::MIBS, | ||||
|   | ||||
| @@ -40,7 +40,7 @@ use SNMP::Info::LLDP; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::MIBS, | ||||
|   | ||||
| @@ -40,7 +40,7 @@ use SNMP::Info::IEEE802dot11; | ||||
|  | ||||
| use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::MIBS, | ||||
|   | ||||
| @@ -61,7 +61,7 @@ use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| # NOTE: Order creates precedence | ||||
| #       Example: v_name exists in Bridge.pm and CiscoVTP.pm | ||||
| @@ -141,11 +141,11 @@ sub os_ver { | ||||
| sub serial { | ||||
|     my $nexus = shift; | ||||
|  | ||||
|     my $e_class = $nexus->e_class(); | ||||
|     my $e_parent = $nexus->e_parent(); | ||||
|  | ||||
|     foreach my $iid ( keys %$e_class ) { | ||||
|         my $class = $e_class->{$iid} || ''; | ||||
|         if ($class =~ /chassis/) { | ||||
|     foreach my $iid ( keys %$e_parent ) { | ||||
| 	my $parent = $e_parent->{$iid}; | ||||
|         if ($parent eq '0') { | ||||
| 	    my $serial = $nexus->e_serial($iid); | ||||
| 	    return $serial->{$iid}; | ||||
| 	} | ||||
| @@ -174,6 +174,73 @@ sub model { | ||||
|     return $model; | ||||
| } | ||||
|  | ||||
| # Reported version 6.x of NX-OS doesn't use the IPv4 address as index | ||||
| # override methods in ipAddrTable | ||||
| sub ip_table { | ||||
|     my $nexus         = shift; | ||||
|     my $orig_ip_table = $nexus->orig_ip_table(); | ||||
|  | ||||
|     my %ip_table; | ||||
|     foreach my $iid ( keys %$orig_ip_table ) { | ||||
| 	my $ip = $orig_ip_table->{$iid}; | ||||
| 	next unless defined $ip; | ||||
|  | ||||
| 	$ip_table{$ip} = $ip; | ||||
|     } | ||||
|     return \%ip_table; | ||||
| } | ||||
|  | ||||
| sub ip_index { | ||||
|     my $nexus         = shift; | ||||
|     my $orig_ip_table = $nexus->orig_ip_table(); | ||||
|     my $orig_ip_index = $nexus->orig_ip_index(); | ||||
|  | ||||
|     my %ip_index; | ||||
|     foreach my $iid ( keys %$orig_ip_table ) { | ||||
| 	my $ip    = $orig_ip_table->{$iid}; | ||||
| 	my $index = $orig_ip_index->{$iid}; | ||||
|  | ||||
| 	next unless ( defined $ip && defined $index ); | ||||
|  | ||||
| 	$ip_index{$ip} = $index; | ||||
|     } | ||||
|     return \%ip_index; | ||||
| } | ||||
|  | ||||
| sub ip_netmask { | ||||
|     my $nexus           = shift; | ||||
|     my $orig_ip_table   = $nexus->orig_ip_table(); | ||||
|     my $orig_ip_netmask = $nexus->orig_ip_netmask(); | ||||
|  | ||||
|     my %ip_netmask; | ||||
|     foreach my $iid ( keys %$orig_ip_table ) { | ||||
| 	my $ip      = $orig_ip_table->{$iid}; | ||||
| 	my $netmask = $orig_ip_netmask->{$iid}; | ||||
|  | ||||
| 	next unless ( defined $ip && defined $netmask ); | ||||
|  | ||||
| 	$ip_netmask{$ip} = $netmask; | ||||
|     } | ||||
|     return \%ip_netmask; | ||||
| } | ||||
|  | ||||
| sub ip_broadcast { | ||||
|     my $nexus             = shift; | ||||
|     my $orig_ip_table     = $nexus->orig_ip_table(); | ||||
|     my $orig_ip_broadcast = $nexus->orig_ip_broadcast(); | ||||
|  | ||||
|     my %ip_broadcast; | ||||
|     foreach my $iid ( keys %$orig_ip_table ) { | ||||
| 	my $ip        = $orig_ip_table->{$iid}; | ||||
| 	my $broadcast = $orig_ip_broadcast->{$iid}; | ||||
|  | ||||
| 	next unless ( defined $ip && defined $broadcast ); | ||||
|  | ||||
| 	$ip_broadcast{$ip} = $broadcast; | ||||
|     } | ||||
|     return \%ip_broadcast; | ||||
| } | ||||
|  | ||||
| 1; | ||||
| __END__ | ||||
|  | ||||
| @@ -306,6 +373,42 @@ Returns 1.  Use vlan indexing. | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Overrides | ||||
|  | ||||
| =head3 IP Address Table | ||||
|  | ||||
| Each entry in this table is an IP address in use on this device.  Some  | ||||
| versions do not index the table with the IPv4 address in accordance with | ||||
| the MIB definition, these overrides correct that behavior. | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item $nexus->ip_index() | ||||
|  | ||||
| Maps the IP Table to the IID | ||||
|  | ||||
| (C<ipAdEntIfIndex>) | ||||
|  | ||||
| =item $nexus->ip_table() | ||||
|  | ||||
| Maps the Table to the IP address | ||||
|  | ||||
| (C<ipAdEntAddr>) | ||||
|  | ||||
| =item $nexus->ip_netmask() | ||||
|  | ||||
| Gives netmask setting for IP table entry. | ||||
|  | ||||
| (C<ipAdEntNetMask>) | ||||
|  | ||||
| =item $nexus->ip_broadcast() | ||||
|  | ||||
| Gives broadcast address for IP table entry. | ||||
|  | ||||
| (C<ipAdEntBcastAddr>) | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Globals imported from SNMP::Info::Layer3 | ||||
|  | ||||
| See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details. | ||||
|   | ||||
| @@ -39,7 +39,7 @@ use SNMP::Info::Layer3; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::MIBS, | ||||
|   | ||||
| @@ -43,7 +43,7 @@ use SNMP::Info::Layer3; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::MIBS, %SNMP::Info::RapidCity::MIBS, | ||||
| @@ -683,7 +683,7 @@ sub e_descr { | ||||
|  | ||||
|     my $model = $passport->model(); | ||||
|     my $rc_ps = $passport->rc_ps_detail() || {}; | ||||
|     my $rc_ch = $passport->chassis(); | ||||
|     my $rc_ch = $passport->chassis() || ''; | ||||
|     $rc_ch =~ s/a//; | ||||
|  | ||||
|     my %rc_e_descr; | ||||
|   | ||||
| @@ -41,7 +41,7 @@ use SNMP::Info::LLDP; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::MIBS, | ||||
|   | ||||
							
								
								
									
										221
									
								
								Info/Layer3/Pica8.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										221
									
								
								Info/Layer3/Pica8.pm
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,221 @@ | ||||
| # SNMP::Info::Layer3::Pica8 | ||||
| # | ||||
| # Copyright (c) 2013 Jeroen van Ingen | ||||
| # 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::Pica8; | ||||
|  | ||||
| use strict; | ||||
| use Exporter; | ||||
| use SNMP::Info::Layer3; | ||||
| use SNMP::Info::LLDP; | ||||
|  | ||||
| @SNMP::Info::Layer3::Pica8::ISA       = qw/SNMP::Info::LLDP SNMP::Info::Layer3 Exporter/; | ||||
| @SNMP::Info::Layer3::Pica8::EXPORT_OK = qw//; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::MIBS, | ||||
|     %SNMP::Info::LLDP::MIBS, | ||||
| ); | ||||
|  | ||||
| %GLOBALS = ( | ||||
|     %SNMP::Info::Layer3::GLOBALS, | ||||
|     %SNMP::Info::LLDP::GLOBALS, | ||||
| ); | ||||
|  | ||||
| %FUNCS = ( | ||||
|     %SNMP::Info::Layer3::FUNCS, | ||||
|     %SNMP::Info::LLDP::FUNCS, | ||||
| ); | ||||
|  | ||||
| %MUNGE = ( | ||||
|     %SNMP::Info::Layer3::MUNGE, | ||||
|     %SNMP::Info::LLDP::MUNGE, | ||||
| ); | ||||
|  | ||||
| sub vendor { | ||||
|     return 'Pica8'; | ||||
| } | ||||
|  | ||||
| sub os { | ||||
|     my $pica8 = shift; | ||||
|     my $descr   = $pica8->description(); | ||||
|  | ||||
|     return $1 if ( $descr =~ /(\S+)\s+Platform Software/i ); | ||||
|     return; | ||||
| } | ||||
|  | ||||
| sub os_ver { | ||||
|     my $pica8 = shift; | ||||
|     my $descr   = $pica8->description(); | ||||
|  | ||||
|     return $1 if ( $descr =~ /Software version ([\d\.]+)/i ); | ||||
|     return; | ||||
| } | ||||
|  | ||||
| sub model { | ||||
|     my $pica8 = shift; | ||||
|     my $descr   = $pica8->description(); | ||||
|  | ||||
|     return $1 if ( $descr =~ /Hardware model (P-\d{4})/i ); | ||||
|     return; | ||||
| } | ||||
|  | ||||
| # Use Q-BRIDGE-MIB | ||||
|  | ||||
| sub fw_mac { | ||||
|     my $l3  = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $l3->qb_fw_mac($partial); | ||||
| } | ||||
|  | ||||
| sub fw_port { | ||||
|     my $l3  = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $l3->qb_fw_port($partial); | ||||
| } | ||||
|  | ||||
| 1; | ||||
| __END__ | ||||
|  | ||||
| =head1 NAME | ||||
|  | ||||
| SNMP::Info::Layer3::Pica8 - SNMP Interface to L3 Devices, Pica8 | ||||
|  | ||||
| =head1 AUTHORS | ||||
|  | ||||
| Jeroen van Ingen | ||||
|  | ||||
| =head1 SYNOPSIS | ||||
|  | ||||
|  # Let SNMP::Info determine the correct subclass for you.  | ||||
|  my $pica8 = new SNMP::Info( | ||||
|                           AutoSpecify => 1, | ||||
|                           Debug       => 1, | ||||
|                           DestHost    => 'myrouter', | ||||
|                           Community   => 'public', | ||||
|                           Version     => 2 | ||||
|                         )  | ||||
|     or die "Can't connect to DestHost.\n"; | ||||
|  | ||||
|  my $class      = $pica8->class(); | ||||
|  print "SNMP::Info determined this device to fall under subclass : $class\n"; | ||||
|  | ||||
| =head1 DESCRIPTION | ||||
|  | ||||
| Subclass for Pica8 devices | ||||
|  | ||||
| =head2 Inherited Classes | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item SNMP::Info::Layer3 | ||||
|  | ||||
| =item SNMP::Info::LLDP | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Required MIBs | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item F<PICA-PRIVATE-MIB> | ||||
|  | ||||
| =item Inherited Classes' MIBs | ||||
|  | ||||
| See L<SNMP::Info::Layer3> for its own MIB requirements. | ||||
|  | ||||
| See L<SNMP::Info::LLDP> for its own MIB requirements. | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head1 GLOBALS | ||||
|  | ||||
| These are methods that return scalar value from SNMP | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item $pica8->vendor() | ||||
|  | ||||
| Returns 'Pica8' | ||||
|  | ||||
| =item $pica8->model() | ||||
|  | ||||
| Returns the model name extracted from C<sysDescr>. | ||||
|  | ||||
| =item $pica8->os() | ||||
|  | ||||
| Returns the OS extracted from C<sysDescr>. | ||||
|  | ||||
| =item $pica8->os_ver() | ||||
|  | ||||
| Returns the OS version extracted from C<sysDescr>. | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Globals imported from SNMP::Info::Layer3 | ||||
|  | ||||
| See documentation in L<SNMP::Info::Layer3> for details. | ||||
|  | ||||
| =head2 Globals imported from SNMP::Info::LLDP | ||||
|  | ||||
| See documentation in L<SNMP::Info::LLDP> 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 $pica8->fw_mac() | ||||
|  | ||||
| Use the F<Q-BRIDGE-MIB> instead of F<BRIDGE-MIB> | ||||
|  | ||||
| =item $pica8->fw_port() | ||||
|  | ||||
| Use the F<Q-BRIDGE-MIB> instead of F<BRIDGE-MIB> | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Table Methods imported from SNMP::Info::Layer3 | ||||
|  | ||||
| See documentation in L<SNMP::Info::Layer3> for details. | ||||
|  | ||||
| =head2 Table Methods imported from SNMP::Info::LLDP | ||||
|  | ||||
| See documentation in L<SNMP::Info::LLDP> for details. | ||||
|  | ||||
| =cut | ||||
| @@ -36,7 +36,7 @@ use SNMP::Info::Layer3; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer2::MIBS, %SNMP::Info::Layer3::MIBS, | ||||
|   | ||||
							
								
								
									
										216
									
								
								Info/Layer3/Steelhead.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										216
									
								
								Info/Layer3/Steelhead.pm
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,216 @@ | ||||
| # SNMP::Info::Layer3::Steelhead | ||||
| # | ||||
| # Copyright (c) 2013 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::Steelhead; | ||||
|  | ||||
| use strict; | ||||
| use Exporter; | ||||
| use SNMP::Info::Layer3; | ||||
|  | ||||
| @SNMP::Info::Layer3::Steelhead::ISA | ||||
|     = qw/SNMP::Info::Layer3 Exporter/; | ||||
| @SNMP::Info::Layer3::Steelhead::EXPORT_OK = qw//; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::MIBS, | ||||
|     'STEELHEAD-MIB' => 'serialNumber', | ||||
| ); | ||||
|  | ||||
| %GLOBALS = ( | ||||
|     %SNMP::Info::Layer3::GLOBALS, | ||||
|     # Fully qualified to remove ambiguity of 'model' | ||||
|     'rb_model' => 'STEELHEAD-MIB::model', | ||||
| ); | ||||
|  | ||||
| %FUNCS = ( | ||||
|     %SNMP::Info::Layer3::FUNCS, | ||||
| ); | ||||
|  | ||||
| %MUNGE = ( | ||||
|     %SNMP::Info::Layer3::MUNGE, | ||||
| ); | ||||
|  | ||||
| sub layers { | ||||
|     return '01001100'; | ||||
| } | ||||
|  | ||||
| sub vendor { | ||||
|     return 'riverbed'; | ||||
| } | ||||
|  | ||||
| sub model { | ||||
|     my $riverbed = shift; | ||||
|  | ||||
|     my $model = $riverbed->rb_model() || ''; | ||||
|      | ||||
|     if ($model =~ /^(\d+)/) { | ||||
|         return $1; | ||||
|     } | ||||
|     return $model; | ||||
| } | ||||
|  | ||||
| sub os { | ||||
|     return 'steelhead'; | ||||
| } | ||||
|  | ||||
| sub os_ver { | ||||
|     my $riverbed = shift; | ||||
|      | ||||
|     my $ver = $riverbed->systemVersion() || ''; | ||||
|  | ||||
|     if ( $ver =~ /(\d+[\.\d]+)/ ) { | ||||
|         return $1; | ||||
|     } | ||||
|      | ||||
|     return $ver; | ||||
| } | ||||
|  | ||||
| sub serial { | ||||
|     my $riverbed = shift; | ||||
|      | ||||
|     return $riverbed->serialNumber(); | ||||
| } | ||||
|  | ||||
| 1; | ||||
| __END__ | ||||
|  | ||||
| =head1 NAME | ||||
|  | ||||
| SNMP::Info::Layer3::Steelhead - SNMP Interface to Riverbed Steelhead WAN | ||||
| optimization appliances. | ||||
|  | ||||
| =head1 AUTHOR | ||||
|  | ||||
| Eric Miller | ||||
|  | ||||
| =head1 SYNOPSIS | ||||
|  | ||||
|  # Let SNMP::Info determine the correct subclass for you.  | ||||
|  my $riverbed = new SNMP::Info( | ||||
|                           AutoSpecify => 1, | ||||
|                           Debug       => 1, | ||||
|                           DestHost    => 'myswitch', | ||||
|                           Community   => 'public', | ||||
|                           Version     => 2 | ||||
|                         )  | ||||
|     or die "Can't connect to DestHost.\n"; | ||||
|  | ||||
|  my $class = $riverbed->class(); | ||||
|  print "SNMP::Info determined this device to fall under subclass : $class\n"; | ||||
|  | ||||
| =head1 DESCRIPTION | ||||
|  | ||||
| Abstraction subclass for Riverbed Steelhead WAN optimization appliances. | ||||
|  | ||||
| For speed or debugging purposes you can call the subclass directly, but not | ||||
| after determining a more specific class using the method above.  | ||||
|  | ||||
|  my $riverbed = new SNMP::Info::Layer3::Steelhead(...); | ||||
|  | ||||
| =head2 Inherited Classes | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item SNMP::Info::Layer3 | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Required MIBs | ||||
|  | ||||
| F<STEELHEAD-MIB> | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item Inherited Classes' MIBs | ||||
|  | ||||
| See L<SNMP::Info::Layer3/"Required MIBs"> for its own MIB requirements. | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head1 GLOBALS | ||||
|  | ||||
| These are methods that return scalar value from SNMP | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item $riverbed->vendor() | ||||
|  | ||||
| Returns 'riverbed' | ||||
|  | ||||
| =item $riverbed->model() | ||||
|  | ||||
| Returns the chassis model. | ||||
|  | ||||
| (C<STEELHEAD-MIB::model>) | ||||
|  | ||||
| =item $riverbed->os() | ||||
|  | ||||
| Returns 'steelhead' | ||||
|  | ||||
| =item $riverbed->os_ver() | ||||
|  | ||||
| Returns the software version extracted from (C<systemVersion>). | ||||
|  | ||||
| =item $riverbed->serial() | ||||
|  | ||||
| Returns the chassis serial number. | ||||
|  | ||||
| (C<serialNumber>) | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Overrides | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item $riverbed->layers() | ||||
|  | ||||
| Returns 01001100.  Steelhead does not support bridge MIB, so override reported | ||||
| layers. | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Globals imported from SNMP::Info::Layer3 | ||||
|  | ||||
| See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details. | ||||
|  | ||||
| =head1 TABLE METHODS | ||||
|  | ||||
| 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/"TABLE METHODS"> for details. | ||||
|  | ||||
| =cut | ||||
| @@ -39,7 +39,7 @@ use SNMP::Info::Layer3; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( %SNMP::Info::Layer3::MIBS, ); | ||||
|  | ||||
|   | ||||
| @@ -41,7 +41,7 @@ use SNMP::Info::MAU; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer3::MIBS, | ||||
|   | ||||
| @@ -40,7 +40,7 @@ use SNMP::Info::Layer3; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( %SNMP::Info::Layer3::MIBS, 'TIMETRA-GLOBAL-MIB' => 'timetraReg', ); | ||||
|  | ||||
|   | ||||
| @@ -39,7 +39,7 @@ use SNMP::Info; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::MIBS, | ||||
|   | ||||
| @@ -40,7 +40,7 @@ use SNMP::Info::Layer7; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer7::MIBS, | ||||
|   | ||||
| @@ -38,7 +38,7 @@ use SNMP::Info::Layer7; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer7::MIBS, | ||||
|   | ||||
| @@ -38,7 +38,7 @@ use SNMP::Info::Layer7; | ||||
|  | ||||
| use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( | ||||
|     %SNMP::Info::Layer7::MIBS, | ||||
|   | ||||
							
								
								
									
										255
									
								
								Info/MAU.pm
									
									
									
									
									
								
							
							
						
						
									
										255
									
								
								Info/MAU.pm
									
									
									
									
									
								
							| @@ -41,9 +41,9 @@ use SNMP::Info; | ||||
|  | ||||
| use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/; | ||||
|  | ||||
| $VERSION = '3.04_001'; | ||||
| $VERSION = '3.10'; | ||||
|  | ||||
| %MIBS = ( 'MAU-MIB' => 'mauMod' ); | ||||
| %MIBS = ( 'MAU-MIB' => 'mauMod', 'IANA-MAU-MIB' => 'dot3MauType' ); | ||||
|  | ||||
| %GLOBALS = (); | ||||
|  | ||||
| @@ -235,10 +235,10 @@ sub mau_i_duplex_admin_old { | ||||
|  | ||||
|     my %i_duplex_admin; | ||||
|     foreach my $iid ( keys %$interfaces ) { | ||||
|         my $mau_index = $mau_reverse{$iid}; | ||||
|         next unless defined $mau_index; | ||||
|         my $mau_idx = $mau_reverse{$iid}; | ||||
|         next unless defined $mau_idx; | ||||
|  | ||||
|         my $autostat = $mau_autostat->{$mau_index}; | ||||
|         my $autostat = $mau_autostat->{$mau_idx}; | ||||
|  | ||||
|         # HP25xx has this value | ||||
|         if ( defined $autostat and $autostat =~ /enabled/i ) { | ||||
| @@ -246,7 +246,7 @@ sub mau_i_duplex_admin_old { | ||||
|             next; | ||||
|         } | ||||
|  | ||||
|         my $type = $mau_autosent->{$mau_index}; | ||||
|         my $type = $mau_autosent->{$mau_idx}; | ||||
|  | ||||
|         next unless defined $type; | ||||
|  | ||||
| @@ -258,7 +258,7 @@ sub mau_i_duplex_admin_old { | ||||
|         my $full = $mau->_isfullduplex($type); | ||||
|         my $half = $mau->_ishalfduplex($type); | ||||
|  | ||||
|         if ( $full and !$half ) { | ||||
|         if ( $full && !$half ) { | ||||
|             $i_duplex_admin{$iid} = 'full'; | ||||
|         } | ||||
|         elsif ($half) { | ||||
| @@ -269,6 +269,182 @@ sub mau_i_duplex_admin_old { | ||||
|     return \%i_duplex_admin; | ||||
| } | ||||
|  | ||||
| sub mau_set_i_speed_admin { | ||||
|     my $mau          = shift; | ||||
|     my $speed    = shift; | ||||
|     my $iid = shift; | ||||
|  | ||||
|     my $rv; | ||||
|  | ||||
|     $speed = lc($speed); | ||||
|     if ( !( $speed =~ /(10|100|1000|auto)/io and $iid =~ /\d+/o ) ) { | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|     # map a speed value to an integer the switch understands based on duplex | ||||
|     my %speeds; | ||||
|  | ||||
|     # 10 = dot3MauType10BaseTHD, 15 = dot3MauType100BaseTXHD | ||||
|     # 29 = dot3MauType1000BaseTHD from IANA-MAU-MIB | ||||
|     %{ $speeds{'HD'} } = qw/10 10 100 15 1000 29/;    # half duplex settings | ||||
|          # 11 = dot3MauType10BaseTFD, 16 = dot3MauType100BaseTXFD | ||||
|          # 30 = dot3MauType1000BaseTFD from IANA-MAU-MIB | ||||
|     %{ $speeds{'FD'} } = qw/10 11 100 16 1000 30/;    # full duplex settings | ||||
|  | ||||
|     my $myhash    = $mau->mau_autostat; | ||||
|     my $key       = $iid . '.1'; | ||||
|     my $i_autoneg = $myhash->{$key}; | ||||
|  | ||||
|     my $myduplex; | ||||
|  | ||||
|     my $i_mau_def_type | ||||
|         = &SNMP::translateObj( $mau->mau_type_admin($iid)->{ $iid . '.1' } ); | ||||
|  | ||||
|     if ( $i_mau_def_type =~ /^dot3MauType.*Base.*(..)$/ | ||||
|         && ( $1 eq "HD" or $1 eq "FD" ) ) | ||||
|     { | ||||
|         $myduplex = $1; | ||||
|     } | ||||
|     else { | ||||
|  | ||||
|         # this is not a valid speed known, assuming auto | ||||
|         $myduplex = "auto"; | ||||
|     } | ||||
|  | ||||
|     if ( $speed eq "auto" && $i_autoneg eq "enabled" ) { | ||||
|         return (1); | ||||
|     } | ||||
|     elsif ( $speed eq "auto" ) { | ||||
|         $rv = $mau->set_mau_autostat( 'enabled', $iid . '.1' ); | ||||
|         return ($rv); | ||||
|     } | ||||
|     else { | ||||
|         if ( $i_autoneg eq "enabled" ) { | ||||
|             $mau->set_mau_autostat( 'disabled', $iid . '.1' ); | ||||
|         } | ||||
|         $rv | ||||
|             = $mau->set_mau_type_admin( | ||||
|             '.1.3.6.1.2.1.26.4.' . $speeds{$myduplex}{$speed}, | ||||
|             $iid . '.1' ); | ||||
|  | ||||
|         return ($rv); | ||||
|     } | ||||
| } | ||||
|  | ||||
| sub mau_set_i_duplex_admin { | ||||
|     my $mau = shift; | ||||
|     my $duplex = shift; | ||||
|     my $iid = shift; | ||||
|  | ||||
|     my $rv; | ||||
|  | ||||
|     $duplex = lc($duplex); | ||||
|  | ||||
|     if ( !( $duplex =~ /(full|half|auto)/i and $iid =~ /\d+/ ) ) { | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|  # map a textual duplex setting to an integer value the switch will understand | ||||
|     my %duplexes; | ||||
|     %{ $duplexes{'10'} }   = qw/full 11 half 10/; | ||||
|     %{ $duplexes{'100'} }  = qw/full 16 half 15/; | ||||
|     %{ $duplexes{'1000'} } = qw/full 30 half 29/; | ||||
|  | ||||
|     # current port values: | ||||
|     my $myhash    = $mau->mau_autostat; | ||||
|     my $key       = $iid . '.1'; | ||||
|     my $i_autoneg = $myhash->{$key}; | ||||
|  | ||||
|     my $i_speed | ||||
|         = &SNMP::translateObj( $mau->mau_type_admin($iid)->{ $iid . '.1' } ); | ||||
|  | ||||
|     if ( $i_speed =~ /^dot3MauType(.*)Base/ && $_mau_i_speed_map{$1} ) { | ||||
|         $i_speed = $1; | ||||
|     } | ||||
|     else { | ||||
|  | ||||
|         # this is not a valid speed setting, assuming auto | ||||
|         $duplex = "auto"; | ||||
|     } | ||||
|  | ||||
|     if ( $duplex eq "auto" && $i_autoneg eq "enabled" ) { | ||||
|         return (1); | ||||
|     } | ||||
|     elsif ( $duplex eq "auto" ) { | ||||
|         $rv = $mau->set_mau_autostat( 'enabled', $iid . '.1' ); | ||||
|         return ($rv); | ||||
|     } | ||||
|     else { | ||||
|  | ||||
|         # Can't always do it here, if not... | ||||
|         if ( $i_autoneg eq "enabled" | ||||
|             && defined( $duplexes{$i_speed}{$duplex} ) ) | ||||
|         { | ||||
|             $mau->set_mau_autostat( 'disabled', $iid . '.1' ); | ||||
|         } | ||||
|         $rv | ||||
|             = $mau->set_mau_type_admin( | ||||
|             '.1.3.6.1.2.1.26.4.' . $duplexes{$i_speed}{$duplex}, | ||||
|             $iid . '.1' ); | ||||
|         return ($rv); | ||||
|     } | ||||
| } | ||||
|  | ||||
| # | ||||
| # mau_set_i_speed_duplex_admin() accepts the following values for speed/duplex | ||||
| # | ||||
|  | ||||
| # auto/auto (special case) | ||||
| # 10/half | ||||
| # 10/full | ||||
| # 100/half | ||||
| # 100/full | ||||
| # 1000/half | ||||
| # 1000/full | ||||
|  | ||||
| sub mau_set_i_speed_duplex_admin { | ||||
|     my $mau = shift; | ||||
|     my $speed = shift; | ||||
|     my $duplex = shift; | ||||
|     my $iid = shift; | ||||
|  | ||||
|     my $rv; | ||||
|  | ||||
|     $speed  = lc($speed); | ||||
|     $duplex = lc($duplex); | ||||
|  | ||||
|     if (   ( $speed !~ m/auto|10|100|1000/io ) | ||||
|         or ( $duplex !~ m/full|half|auto/io ) | ||||
|         or ( $iid !~ /\d+/ ) ) | ||||
|     { | ||||
|         return ("bad arguments"); | ||||
|     } | ||||
|  | ||||
|     # map input speed and duplex paramters to 'mau_type_admin' settings | ||||
|     # From IANA-MAU-MIB | ||||
|     # 11 = dot3MauType10BaseTFD, 10 = dot3MauType10BaseTHD, | ||||
|     # 16 = dot3MauType100BaseTXFD, 15 = dot3MauType100BaseTXHD | ||||
|     # 30 = dot3MauType1000BaseTFD, 29 = dot3MauType1000BaseTHD | ||||
|     my %params; | ||||
|     %{ $params{'10'} }   = qw/full 11 half 10/; | ||||
|     %{ $params{'100'} }  = qw/full 16 half 15/; | ||||
|     %{ $params{'1000'} } = qw/full 30 half 29/; | ||||
|  | ||||
|     # if given "auto/auto", set 'mau_autostat' to "enable" and exit | ||||
|  | ||||
|     if ( ( $speed eq "auto" ) or ( $duplex eq "auto" ) ) { | ||||
|         $rv = $mau->set_mau_autostat( 'enabled', $iid . '.1' ); | ||||
|         return ($rv); | ||||
|     } | ||||
|  | ||||
|     $rv | ||||
|         = $mau->set_mau_type_admin( | ||||
|         '.1.3.6.1.2.1.26.4.' . $params{$speed}{$duplex}, | ||||
|         $iid . '.1' ); | ||||
|     $rv = $mau->set_mau_autostat( 'disabled', $iid . '.1' ); | ||||
|     return ($rv); | ||||
| } | ||||
|  | ||||
| 1; | ||||
| __END__ | ||||
|  | ||||
| @@ -335,9 +511,8 @@ These are methods that return scalar value from SNMP | ||||
|  | ||||
| =head1 TABLE METHODS | ||||
|  | ||||
| These are methods that return tables of information in the form of a reference | ||||
| to a hash. | ||||
|  | ||||
| These are methods that return tables of information in the form | ||||
| of a reference to a hash. | ||||
|  | ||||
| =over | ||||
|  | ||||
| @@ -367,7 +542,7 @@ Returns admin speed setting for all the interfaces. | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 MAU INTERFACE TABLE METHODS | ||||
| =head2 MAU Interface Table Methods | ||||
|  | ||||
| =over | ||||
|  | ||||
| @@ -433,11 +608,13 @@ of the port from a MAU POV. | ||||
|  | ||||
| (C<ifMauDefaultType>) | ||||
|  | ||||
| =item $mau->mau_auto() - Returns status of auto-negotiation mode for ports. | ||||
| =item $mau->mau_auto() - Indicates whether or not auto-negotiation is | ||||
| supported. | ||||
|  | ||||
| (C<ifMauAutoNegAdminStatus>) | ||||
| (C<ifMauAutoNegSupported>) | ||||
|  | ||||
| =item $mau->mau_autostat() | ||||
| =item $mau->mau_autostat() - Returns status of auto-negotiation mode for | ||||
| ports. | ||||
|  | ||||
| (C<ifMauAutoNegAdminStatus>) | ||||
|  | ||||
| @@ -457,6 +634,54 @@ capabilities of the device on the other end. | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head1 SET METHODS | ||||
|  | ||||
| These are methods that provide SNMP set functionality for overridden methods | ||||
| or provide a simpler interface to complex set operations.  See | ||||
| L<SNMP::Info/"SETTING DATA VIA SNMP"> for general information on set | ||||
| operations. | ||||
|  | ||||
| =over  | ||||
|  | ||||
| =item $mau->mau_set_i_speed_admin(speed, ifIndex) | ||||
|  | ||||
| Sets port speed, must be supplied with speed and port C<ifIndex>. | ||||
|  | ||||
| Note that this method has some limitations since there is no way | ||||
| to reliably set the port speed independently of the port duplex | ||||
| setting on certain devices, notably the Cisco Cat4k series. | ||||
|  | ||||
| Speed choices are '10', '100', '1000', 'auto'. | ||||
|  | ||||
| =item $mau->mau_set_i_duplex_admin(duplex, ifIndex) | ||||
|  | ||||
| Sets port duplex, must be supplied with duplex and port C<ifIndex>. | ||||
|  | ||||
| Note that this method has some limitations since there is no way | ||||
| to reliably set the port duplex independently of the port speed | ||||
| setting on certain devices, notably the Cisco Cat4k series. | ||||
|  | ||||
| Duplex choices are 'auto', 'half', 'full'. | ||||
|  | ||||
| =item $mau->mau_set_i_speed_duplex_admin(speed, duplex, ifIndex) | ||||
|  | ||||
| Sets port speed and duplex settings, must be supplied with speed, | ||||
| duplex and port C<ifIndex>. | ||||
|  | ||||
| Accepts the following values for speed and duplex: | ||||
|  | ||||
|         Speed/Duplex | ||||
|         ------------ | ||||
|         auto/auto (this is a special case) | ||||
|         10/half | ||||
|         10/full | ||||
|         100/half | ||||
|         100/full | ||||
|         1000/half | ||||
|         1000/full | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head1 Utility Functions | ||||
|  | ||||
| =over  | ||||
| @@ -469,7 +694,7 @@ capabilities of the device on the other end. | ||||
|     are     high.  Currently bits 11,13,16,18,20. | ||||
|  | ||||
| =item $mau->_ishalfduplex(bitstring) | ||||
|      | ||||
|  | ||||
|     Boolean.  Checks to see if any of the half_duplex types from mau_type() | ||||
|     are high.  Currently bits 10,12,15,17,19. | ||||
|  | ||||
|   | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user