Merge branch 'em-autoload-topo'
Conflicts: ChangeLog
This commit is contained in:
		| @@ -34,6 +34,12 @@ use strict; | ||||
| use Exporter; | ||||
| use SNMP::Info::Layer3; | ||||
| use SNMP::Info::MAU; | ||||
| # Use LLDP | ||||
| # (or at least try.  The versions I've seen have two problems: | ||||
| # 1. they report ifIndex values as 'local'; we don't support ifIndex | ||||
| #    but *could* | ||||
| # 2. They report 0.0.0.0 as the management address | ||||
| # ) | ||||
| use SNMP::Info::LLDP; | ||||
|  | ||||
| @SNMP::Info::Layer3::AlcatelLucent::ISA = qw/SNMP::Info::LLDP SNMP::Info::MAU | ||||
| @@ -285,53 +291,6 @@ sub bp_index { | ||||
| #    return $i_vlan; | ||||
| #} | ||||
|  | ||||
| # Use LLDP | ||||
| # (or at least try.  The versions I've seen have two problems: | ||||
| # 1. they report ifIndex values as 'local'; we don't support ifIndex | ||||
| #    but *could* | ||||
| # 2. They report 0.0.0.0 as the management address | ||||
| # ) | ||||
| sub hasCDP { | ||||
|     my $alu = shift; | ||||
|  | ||||
|     return $alu->hasLLDP(); | ||||
| } | ||||
|  | ||||
| sub c_ip { | ||||
|     my $alu     = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $alu->lldp_ip($partial); | ||||
| } | ||||
|  | ||||
| sub c_if { | ||||
|     my $alu     = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $alu->lldp_if($partial); | ||||
| } | ||||
|  | ||||
| sub c_port { | ||||
|     my $alu     = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $alu->lldp_port($partial); | ||||
| } | ||||
|  | ||||
| sub c_id { | ||||
|     my $alu     = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $alu->lldp_id($partial); | ||||
| } | ||||
|  | ||||
| sub c_platform { | ||||
|     my $alu     = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $alu->lldp_rem_sysdesc($partial); | ||||
| } | ||||
|  | ||||
| # Power-Ethernet ifIndex mapping.  I've only seen this from a | ||||
| # fixed-config single-module system, so this is only a plausible | ||||
| # guess as to the mapping on a stack or modular system. | ||||
| @@ -428,10 +387,6 @@ These are methods that return scalar value from SNMP | ||||
|  | ||||
|     Returns 'alcatel-lucent' | ||||
|  | ||||
| =item $alu->hasCDP() | ||||
|  | ||||
|     Returns whether LLDP is enabled. | ||||
|  | ||||
| =item $alu->model() | ||||
|  | ||||
| Tries to reference $alu->id() to one of the product MIBs listed above | ||||
| @@ -502,26 +457,6 @@ Work around various bugs in the F<BRIDGE-MIB> and | ||||
| F<Q-BRIDGE-MIB> implementations, by returning both | ||||
| C<ifIndex> and C<dot1dBasePort> mappings to C<ifIndex> values. | ||||
|  | ||||
| =item $alu->c_id() | ||||
|  | ||||
| Returns LLDP information. | ||||
|  | ||||
| =item $alu->c_if() | ||||
|  | ||||
| Returns LLDP information. | ||||
|  | ||||
| =item $alu->c_ip() | ||||
|  | ||||
| Returns LLDP information. | ||||
|  | ||||
| =item $alu->c_platform() | ||||
|  | ||||
| Returns LLDP information. | ||||
|  | ||||
| =item $alu->c_port() | ||||
|  | ||||
| Returns LLDP information. | ||||
|  | ||||
| =item $alu->i_duplex_admin() | ||||
|  | ||||
| Returns info from F<MAU-MIB> | ||||
|   | ||||
| @@ -152,10 +152,6 @@ sub os { | ||||
|     return 'altiga'; | ||||
| } | ||||
|  | ||||
| sub hasCDP { | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| # $altiga->interfaces() - Map the Interfaces to their physical names | ||||
| # Add interface number to interface name to prevent duplicate ifDescr | ||||
| # Included statically configured VPN tunnels if ($int_include_vpn) | ||||
| @@ -350,10 +346,6 @@ Tries to determine OS version from the C<sysDescr.0> field. Returns version or C | ||||
|  | ||||
| Combines results from C<fan1_alarm>, C<fan2_alarm>, and C<fam3_alarm> methods. | ||||
|  | ||||
| =item $altiga->hasCDP() | ||||
|  | ||||
| No. | ||||
|  | ||||
| =item $altiga->ps1_status() | ||||
|  | ||||
| Combines C<ps1_3v_alarm> and C<ps1_5v_alarm> methods. | ||||
|   | ||||
| @@ -120,49 +120,6 @@ sub fw_port { | ||||
|     return $arista->qb_fw_port($partial); | ||||
| } | ||||
|  | ||||
| # Use LLDP | ||||
|  | ||||
| sub hasCDP { | ||||
|     my $arista = shift; | ||||
|  | ||||
|     return $arista->hasLLDP(); | ||||
| } | ||||
|  | ||||
| sub c_ip { | ||||
|     my $arista  = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $arista->lldp_ip($partial); | ||||
| } | ||||
|  | ||||
| sub c_if { | ||||
|     my $arista  = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $arista->lldp_if($partial); | ||||
| } | ||||
|  | ||||
| sub c_port { | ||||
|     my $arista  = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $arista->lldp_port($partial); | ||||
| } | ||||
|  | ||||
| sub c_id { | ||||
|     my $arista  = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $arista->lldp_id($partial); | ||||
| } | ||||
|  | ||||
| sub c_platform { | ||||
|     my $arista  = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $arista->lldp_rem_sysdesc($partial); | ||||
| } | ||||
|  | ||||
| 1; | ||||
| __END__ | ||||
|  | ||||
| @@ -232,10 +189,6 @@ These are methods that return scalar values from SNMP | ||||
|  | ||||
|     Returns 'Arista Networks, Inc.' | ||||
|  | ||||
| =item $arista->hasCDP() | ||||
|  | ||||
|     Returns whether LLDP is enabled. | ||||
|  | ||||
| =item $arista->model() | ||||
|  | ||||
| Tries to reference $arista->id() to one of the product MIBs listed above | ||||
| @@ -279,26 +232,6 @@ Use the F<Q-BRIDGE-MIB> instead of F<BRIDGE-MIB> | ||||
|  | ||||
| Use the F<Q-BRIDGE-MIB> instead of F<BRIDGE-MIB> | ||||
|  | ||||
| =item $arista->c_id() | ||||
|  | ||||
| Returns LLDP information. | ||||
|  | ||||
| =item $arista->c_if() | ||||
|  | ||||
| Returns LLDP information. | ||||
|  | ||||
| =item $arista->c_ip() | ||||
|  | ||||
| Returns LLDP information. | ||||
|  | ||||
| =item $arista->c_platform() | ||||
|  | ||||
| Returns LLDP information. | ||||
|  | ||||
| =item $arista->c_port() | ||||
|  | ||||
| Returns LLDP information. | ||||
|  | ||||
| =item $arista->i_duplex_admin() | ||||
|  | ||||
| Returns info from F<MAU-MIB> | ||||
|   | ||||
| @@ -236,141 +236,6 @@ sub cisco_comm_indexing { | ||||
|     return 1; | ||||
| } | ||||
|  | ||||
| #  Use CDP and/or LLDP | ||||
| sub hasCDP { | ||||
|     my $c3550 = shift; | ||||
|     return $c3550->hasLLDP() || $c3550->SUPER::hasCDP(); | ||||
| } | ||||
|  | ||||
| sub c_ip { | ||||
|     my $c3550      = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $cdp  = $c3550->SUPER::c_ip($partial) || {}; | ||||
|     my $lldp = $c3550->lldp_ip($partial)     || {}; | ||||
|  | ||||
|     my %c_ip; | ||||
|     foreach my $iid ( keys %$cdp ) { | ||||
|         my $ip = $cdp->{$iid}; | ||||
|         next unless defined $ip; | ||||
|  | ||||
|         $c_ip{$iid} = $ip; | ||||
|     } | ||||
|  | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
|         my $ip = $lldp->{$iid}; | ||||
|         next unless defined $ip; | ||||
|  | ||||
|         $c_ip{$iid} = $ip; | ||||
|     } | ||||
|     return \%c_ip; | ||||
| } | ||||
|  | ||||
| sub c_if { | ||||
|     my $c3550      = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $cdp  = $c3550->SUPER::c_if($partial)  || {}; | ||||
|  | ||||
|     my %c_if; | ||||
|     foreach my $iid ( keys %$cdp ) { | ||||
|         my $if = $cdp->{$iid}; | ||||
|         next unless defined $if; | ||||
|  | ||||
|         $c_if{$iid} = $if; | ||||
|     } | ||||
|  | ||||
|     # We need to match the lldp key with the ifIndex | ||||
|     # via lldpLocPortId and ifName | ||||
|     my $i_name = $c3550->ifName($partial) || {}; | ||||
|     my $i_name_rev = {}; | ||||
|     while ( my($key,$val) = each %$i_name ){ | ||||
| 	$i_name_rev->{$val} = $key; | ||||
|     } | ||||
|     my $loc_port_id = $c3550->lldpLocPortId($partial) || {}; | ||||
|     my $lldp = $c3550->lldp_if($partial) || {}; | ||||
|  | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
|         my $if = $lldp->{$iid} || next; | ||||
| 	my $name = $loc_port_id->{$if} || next; | ||||
| 	my $i_index = $i_name_rev->{$name} || next; | ||||
|         $c_if{$iid} = $i_index; | ||||
|     } | ||||
|     return \%c_if; | ||||
| } | ||||
|  | ||||
| sub c_port { | ||||
|     my $c3550   = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $lldp = $c3550->lldp_port($partial)     || {}; | ||||
|     my $cdp  = $c3550->SUPER::c_port($partial) || {}; | ||||
|  | ||||
|     my %c_port; | ||||
|     foreach my $iid ( keys %$cdp ) { | ||||
|         my $port = $cdp->{$iid}; | ||||
|         next unless defined $port; | ||||
|  | ||||
|         $c_port{$iid} = $port; | ||||
|     } | ||||
|  | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
|         my $port = $lldp->{$iid}; | ||||
|         next unless defined $port; | ||||
|         $c_port{$iid} = $port; | ||||
|     } | ||||
|     return \%c_port; | ||||
| } | ||||
|  | ||||
| sub c_id { | ||||
|     my $c3550   = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $lldp = $c3550->lldp_id($partial)     || {}; | ||||
|     my $cdp  = $c3550->SUPER::c_id($partial) || {}; | ||||
|  | ||||
|     my %c_id; | ||||
|     foreach my $iid ( keys %$cdp ) { | ||||
|         my $id = $cdp->{$iid}; | ||||
|         next unless defined $id; | ||||
| 	 | ||||
|         $c_id{$iid} = $id; | ||||
|     } | ||||
|      | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
| 	my $id = $lldp->{$iid}; | ||||
| 	next unless defined $id; | ||||
| 	 | ||||
| 	$c_id{$iid} = $id; | ||||
|     } | ||||
|     return \%c_id; | ||||
| } | ||||
|  | ||||
| sub c_platform { | ||||
|     my $c3550      = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $lldp = $c3550->lldp_rem_sysdesc($partial)  || {}; | ||||
|     my $cdp  = $c3550->SUPER::c_platform($partial) || {}; | ||||
|  | ||||
|     my %c_platform; | ||||
|     foreach my $iid ( keys %$cdp ) { | ||||
|         my $platform = $cdp->{$iid}; | ||||
|         next unless defined $platform; | ||||
|  | ||||
|         $c_platform{$iid} = $platform; | ||||
|     } | ||||
|  | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
|         my $platform = $lldp->{$iid}; | ||||
|         next unless defined $platform; | ||||
|  | ||||
|         $c_platform{$iid} = $platform; | ||||
|     } | ||||
|     return \%c_platform; | ||||
| } | ||||
|  | ||||
|  | ||||
| 1; | ||||
| __END__ | ||||
|  | ||||
| @@ -494,23 +359,6 @@ Returns 1.  Use vlan indexing. | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Topology information | ||||
|  | ||||
| Based upon the firmware version Cisco devices may support Link Layer Discovery  | ||||
| Protocol (LLDP) in addition to Cisco Discovery Protocol (CDP).  These methods | ||||
| will query both and return the combination of all information.  As a result, | ||||
| there may be identical topology information returned from the two protocols | ||||
| causing duplicate entries.  It is the calling program's responsibility to | ||||
| identify any duplicate entries and remove duplicates if necessary. | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item $c3550->hasCDP() | ||||
|  | ||||
| Returns true if the device is running either CDP or LLDP. | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Globals imported from SNMP::Info::Layer3 | ||||
|  | ||||
| See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details. | ||||
| @@ -556,40 +404,6 @@ See documentation in L<SNMP::Info::CiscoImage/"GLOBALS"> for details. | ||||
| These are methods that return tables of information in the form of a reference | ||||
| to a hash. | ||||
|  | ||||
| =over  | ||||
|  | ||||
| =item $c3550->c_if() | ||||
|  | ||||
| Returns reference to hash.  Key: iid Value: local device port (interfaces) | ||||
|  | ||||
| =item $c3550->c_ip() | ||||
|  | ||||
| Returns reference to hash.  Key: iid Value: remote IPv4 address | ||||
|  | ||||
| If multiple entries exist with the same local port, c_if(), with the same IPv4 | ||||
| address, c_ip(), it may be a duplicate entry. | ||||
|  | ||||
| If multiple entries exist with the same local port, c_if(), with different | ||||
| IPv4 addresses, c_ip(), there is either a non-CDP/LLDP device in between two | ||||
| or more devices or multiple devices which are not directly connected.   | ||||
|  | ||||
| Use the data from the Layer2 Topology Table below to dig deeper. | ||||
|  | ||||
| =item $c3550->c_port() | ||||
|  | ||||
| Returns reference to hash. Key: iid Value: remote port (interfaces) | ||||
|  | ||||
| =item $c3550->c_id() | ||||
|  | ||||
| Returns reference to hash. Key: iid Value: string value used to identify the | ||||
| chassis component associated with the remote system. | ||||
|  | ||||
| =item $c3550->c_platform() | ||||
|  | ||||
| Returns reference to hash.  Key: iid Value: Remote Device Type | ||||
|  | ||||
| =back  | ||||
|  | ||||
| =head2 Overrides | ||||
|  | ||||
| =over | ||||
|   | ||||
| @@ -207,133 +207,6 @@ sub set_i_duplex_admin { | ||||
|     } | ||||
| } | ||||
|  | ||||
| #  Use CDP and/or LLDP | ||||
| sub hasCDP { | ||||
|     my $c6500 = shift; | ||||
|  | ||||
|     return $c6500->hasLLDP() || $c6500->SUPER::hasCDP(); | ||||
| } | ||||
|  | ||||
| sub c_ip { | ||||
|     my $c6500   = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $cdp  = $c6500->SUPER::c_ip($partial) || {}; | ||||
|     my $lldp = $c6500->lldp_ip($partial)     || {}; | ||||
|  | ||||
|     my %c_ip; | ||||
|     foreach my $iid ( keys %$cdp ) { | ||||
|         my $ip = $cdp->{$iid}; | ||||
|         next unless defined $ip; | ||||
|  | ||||
|         $c_ip{$iid} = $ip; | ||||
|     } | ||||
|  | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
|         my $ip = $lldp->{$iid}; | ||||
|         next unless defined $ip; | ||||
|  | ||||
|         $c_ip{$iid} = $ip; | ||||
|     } | ||||
|     return \%c_ip; | ||||
| } | ||||
|  | ||||
| sub c_if { | ||||
|     my $c6500   = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $lldp = $c6500->lldp_if($partial)     || {}; | ||||
|     my $cdp  = $c6500->SUPER::c_if($partial) || {}; | ||||
|  | ||||
|     my %c_if; | ||||
|     foreach my $iid ( keys %$cdp ) { | ||||
|         my $if = $cdp->{$iid}; | ||||
|         next unless defined $if; | ||||
|  | ||||
|         $c_if{$iid} = $if; | ||||
|     } | ||||
|  | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
|         my $if = $lldp->{$iid}; | ||||
|         next unless defined $if; | ||||
|  | ||||
|         $c_if{$iid} = $if; | ||||
|     } | ||||
|     return \%c_if; | ||||
| } | ||||
|  | ||||
| sub c_port { | ||||
|     my $c6500   = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $lldp = $c6500->lldp_port($partial)     || {}; | ||||
|     my $cdp  = $c6500->SUPER::c_port($partial) || {}; | ||||
|  | ||||
|     my %c_port; | ||||
|     foreach my $iid ( keys %$cdp ) { | ||||
|         my $port = $cdp->{$iid}; | ||||
|         next unless defined $port; | ||||
|  | ||||
|         $c_port{$iid} = $port; | ||||
|     } | ||||
|  | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
|         my $port = $lldp->{$iid}; | ||||
|         next unless defined $port; | ||||
|         $c_port{$iid} = $port; | ||||
|     } | ||||
|     return \%c_port; | ||||
| } | ||||
|  | ||||
| sub c_id { | ||||
|     my $c6500   = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $lldp = $c6500->lldp_id($partial)     || {}; | ||||
|     my $cdp  = $c6500->SUPER::c_id($partial) || {}; | ||||
|  | ||||
|     my %c_id; | ||||
|     foreach my $iid ( keys %$cdp ) { | ||||
|         my $id = $cdp->{$iid}; | ||||
|         next unless defined $id; | ||||
| 	 | ||||
|         $c_id{$iid} = $id; | ||||
|     } | ||||
|      | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
| 	my $id = $lldp->{$iid}; | ||||
| 	next unless defined $id; | ||||
| 	 | ||||
| 	$c_id{$iid} = $id; | ||||
|     } | ||||
|     return \%c_id; | ||||
| } | ||||
|  | ||||
| sub c_platform { | ||||
|     my $c6500   = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $lldp = $c6500->lldp_rem_sysdesc($partial)  || {}; | ||||
|     my $cdp  = $c6500->SUPER::c_platform($partial) || {}; | ||||
|  | ||||
|     my %c_platform; | ||||
|     foreach my $iid ( keys %$cdp ) { | ||||
|         my $platform = $cdp->{$iid}; | ||||
|         next unless defined $platform; | ||||
|  | ||||
|         $c_platform{$iid} = $platform; | ||||
|     } | ||||
|  | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
|         my $platform = $lldp->{$iid}; | ||||
|         next unless defined $platform; | ||||
|  | ||||
|         $c_platform{$iid} = $platform; | ||||
|     } | ||||
|     return \%c_platform; | ||||
| } | ||||
|  | ||||
|  | ||||
| 1; | ||||
| __END__ | ||||
|  | ||||
| @@ -531,53 +404,6 @@ Crosses $c6500->p_port() with $c6500->p_duplex() to utilize port C<ifIndex>. | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Topology information | ||||
|  | ||||
| Based upon the firmware version Cisco devices may support Link Layer Discover | ||||
| Protocol (LLDP) in addition to the Cisco-proprietary CDP.  These methods | ||||
| will query both and return the combination of all information.  As a result, | ||||
| there may be identical topology information returned from the two protocols | ||||
| causing duplicate entries.  It is the calling program's responsibility to | ||||
| identify any duplicate entries and remove duplicates if necessary. | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item $c6500->hasCDP() | ||||
|  | ||||
| Returns true if the device is running either CDP or LLDP. | ||||
|  | ||||
| =item $c6500->c_if() | ||||
|  | ||||
| Returns reference to hash.  Key: iid Value: local device port (interfaces) | ||||
|  | ||||
| =item $c6500->c_ip() | ||||
|  | ||||
| Returns reference to hash.  Key: iid Value: remote IPv4 address | ||||
|  | ||||
| If multiple entries exist with the same local port, c_if(), with the same IPv4 | ||||
| address, c_ip(), it may be a duplicate entry. | ||||
|  | ||||
| If multiple entries exist with the same local port, c_if(), with different | ||||
| IPv4 addresses, c_ip(), there is either a non-CDP/LLDP device in between two | ||||
| or more devices or multiple devices which are not directly connected.   | ||||
|  | ||||
| Use the data from the Layer2 Topology Table below to dig deeper. | ||||
|  | ||||
| =item $c6500->c_port() | ||||
|  | ||||
| Returns reference to hash. Key: iid Value: remote port (interfaces) | ||||
|  | ||||
| =item $c6500->c_id() | ||||
|  | ||||
| Returns reference to hash. Key: iid Value: string value used to identify the | ||||
| chassis component associated with the remote system. | ||||
|  | ||||
| =item $c6500->c_platform() | ||||
|  | ||||
| Returns reference to hash.  Key: iid Value: Remote Device Type | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Table Methods imported from SNMP::Info::CiscoVTP | ||||
|  | ||||
| See documentation in L<SNMP::Info::CiscoVTP/"TABLE METHODS"> for details. | ||||
|   | ||||
| @@ -232,47 +232,6 @@ sub _vendor { | ||||
|     } | ||||
| } | ||||
|  | ||||
| # lldp support | ||||
| sub hasCDP { | ||||
|     my $dell = shift; | ||||
|     return $dell->hasLLDP(); | ||||
| } | ||||
|  | ||||
| sub c_ip { | ||||
|     my $dell    = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $dell->lldp_ip($partial); | ||||
| } | ||||
|  | ||||
| sub c_if { | ||||
|     my $dell    = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $dell->lldp_if($partial); | ||||
| } | ||||
|  | ||||
| sub c_port { | ||||
|     my $dell    = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $dell->lldp_port($partial); | ||||
| } | ||||
|  | ||||
| sub c_id { | ||||
|     my $dell    = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $dell->lldp_id($partial); | ||||
| } | ||||
|  | ||||
| sub c_platform { | ||||
|     my $dell    = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $dell->lldp_rem_sysdesc($partial); | ||||
| } | ||||
|  | ||||
| 1; | ||||
| __END__ | ||||
|  | ||||
| @@ -368,10 +327,6 @@ id().  Defaults to 'dlink'. | ||||
| Returns 'dell', 'dlink', or 'ibm' based upon the IANA enterprise number in | ||||
| id().  Defaults to 'dlink'. | ||||
|  | ||||
| =item $dell->hasCDP() | ||||
|  | ||||
| Returns whether LLDP is enabled. | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Overrides | ||||
| @@ -389,6 +344,10 @@ otherwise uses the Layer3 serial method. | ||||
|  | ||||
| See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details. | ||||
|  | ||||
| =head2 Globals 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 | ||||
| @@ -464,30 +423,14 @@ Some devices don't implement the C<BRIDGE-MIB> forwarding table, so we use | ||||
| the C<Q-BRIDGE-MIB> forwarding table.  Fall back to the C<BRIDGE-MIB> if | ||||
| C<Q-BRIDGE-MIB> doesn't return anything. | ||||
|  | ||||
| =item $dell->c_id() | ||||
|  | ||||
| Returns LLDP information. | ||||
|  | ||||
| =item $dell->c_if() | ||||
|  | ||||
| Returns LLDP information. | ||||
|  | ||||
| =item $dell->c_ip() | ||||
|  | ||||
| Returns LLDP information. | ||||
|  | ||||
| =item $dell->c_platform() | ||||
|  | ||||
| Returns LLDP information. | ||||
|  | ||||
| =item $dell->c_port() | ||||
|  | ||||
| Returns LLDP information. | ||||
|  | ||||
| =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 | ||||
|   | ||||
| @@ -165,138 +165,45 @@ sub fw_port { | ||||
|     return $enterasys->qb_fw_port($partial); | ||||
| } | ||||
|  | ||||
| #  Use CDP and/or LLDP | ||||
| # | ||||
| #  LLDP table timefilter implementation continuously increments when walked | ||||
| #  and we may never reach the end of the table.  This behavior can be | ||||
| #  modified with the "set snmp timefilter break disable" command, | ||||
| #  unfortunately it is not the default.  Query with a partial value of zero | ||||
| #  which means no time filter. | ||||
|  | ||||
| sub hasCDP { | ||||
| sub lldp_ip { | ||||
|     my $enterasys = shift; | ||||
|     my $partial   = shift || 0; | ||||
|  | ||||
|     return $enterasys->hasLLDP() || $enterasys->SUPER::hasCDP(); | ||||
|     return $enterasys->SUPER::lldp_ip($partial); | ||||
| } | ||||
|  | ||||
| sub c_ip { | ||||
| sub lldp_if { | ||||
|     my $enterasys = shift; | ||||
|     my $partial   = shift; | ||||
|     my $partial   = shift || 0; | ||||
|  | ||||
|     my $cdp  = $enterasys->SUPER::c_ip($partial) || {}; | ||||
|     my $lldp = $enterasys->lldp_ip(0)            || {}; | ||||
|  | ||||
|     my %c_ip; | ||||
|     foreach my $iid ( keys %$cdp ) { | ||||
|         my $ip = $cdp->{$iid}; | ||||
|         next unless defined $ip; | ||||
|  | ||||
|         $c_ip{$iid} = $ip; | ||||
|     } | ||||
|  | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
|         my $ip = $lldp->{$iid}; | ||||
|         next unless defined $ip; | ||||
|  | ||||
|         $c_ip{$iid} = $ip; | ||||
|     } | ||||
|     return \%c_ip; | ||||
|     return $enterasys->SUPER::lldp_if($partial); | ||||
| } | ||||
|  | ||||
| sub c_if { | ||||
| sub lldp_port { | ||||
|     my $enterasys = shift; | ||||
|     my $partial   = shift; | ||||
|     my $partial   = shift || 0; | ||||
|  | ||||
|     my $lldp = $enterasys->lldp_if(0)            || {}; | ||||
|     my $cdp  = $enterasys->SUPER::c_if($partial) || {}; | ||||
|  | ||||
|     my %c_if; | ||||
|     foreach my $iid ( keys %$cdp ) { | ||||
|         my $if = $cdp->{$iid}; | ||||
|         next unless defined $if; | ||||
|  | ||||
|         $c_if{$iid} = $if; | ||||
|     } | ||||
|  | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
|         my $if = $lldp->{$iid}; | ||||
|         next unless defined $if; | ||||
|  | ||||
|         $c_if{$iid} = $if; | ||||
|     } | ||||
|     return \%c_if; | ||||
|     return $enterasys->SUPER::lldp_port($partial); | ||||
| } | ||||
|  | ||||
| sub c_port { | ||||
| sub lldp_id { | ||||
|     my $enterasys = shift; | ||||
|     my $partial   = shift; | ||||
|     my $partial   = shift || 0; | ||||
|  | ||||
|     my $lldp = $enterasys->lldp_port(0)            || {}; | ||||
|     my $cdp  = $enterasys->SUPER::c_port($partial) || {}; | ||||
|  | ||||
|     my %c_port; | ||||
|     foreach my $iid ( keys %$cdp ) { | ||||
|         my $port = $cdp->{$iid}; | ||||
|         next unless defined $port; | ||||
|  | ||||
|         $c_port{$iid} = $port; | ||||
|     } | ||||
|  | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
|         my $port = $lldp->{$iid}; | ||||
|         next unless defined $port; | ||||
|  | ||||
|         $c_port{$iid} = $port; | ||||
|     } | ||||
|     return \%c_port; | ||||
|     return  $enterasys->SUPER::lldp_id($partial); | ||||
| } | ||||
|  | ||||
| sub c_id { | ||||
| sub lldp_platform { | ||||
|     my $enterasys = shift; | ||||
|     my $partial   = shift; | ||||
|     my $partial   = shift || 0; | ||||
|  | ||||
|     my $lldp = $enterasys->lldp_id(0)            || {}; | ||||
|     my $cdp  = $enterasys->SUPER::c_id($partial) || {}; | ||||
|  | ||||
|     my %c_id; | ||||
|     foreach my $iid ( keys %$cdp ) { | ||||
|         my $id = $cdp->{$iid}; | ||||
|         next unless defined $id; | ||||
|  | ||||
|         $c_id{$iid} = $id; | ||||
|     } | ||||
|  | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
|         my $id = $lldp->{$iid}; | ||||
|         next unless defined $id; | ||||
|  | ||||
|         $c_id{$iid} = $id; | ||||
|     } | ||||
|     return \%c_id; | ||||
| } | ||||
|  | ||||
| sub c_platform { | ||||
|     my $enterasys = shift; | ||||
|     my $partial   = shift; | ||||
|  | ||||
|     my $lldp = $enterasys->lldp_rem_sysdesc(0)         || {}; | ||||
|     my $cdp  = $enterasys->SUPER::c_platform($partial) || {}; | ||||
|  | ||||
|     my %c_platform; | ||||
|     foreach my $iid ( keys %$cdp ) { | ||||
|         my $platform = $cdp->{$iid}; | ||||
|         next unless defined $platform; | ||||
|  | ||||
|         $c_platform{$iid} = $platform; | ||||
|     } | ||||
|  | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
|         my $platform = $lldp->{$iid}; | ||||
|         next unless defined $platform; | ||||
|  | ||||
|         $c_platform{$iid} = $platform; | ||||
|     } | ||||
|     return \%c_platform; | ||||
|     return  $enterasys->SUPER::lldp_rem_sysdesc($partial); | ||||
| } | ||||
|  | ||||
| 1; | ||||
| @@ -399,12 +306,6 @@ Returns base mac | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Overrides | ||||
|  | ||||
| =over | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Globals imported from SNMP::Info::MAU | ||||
|  | ||||
| See documentation in L<SNMP::Info::MAU/"GLOBALS"> for details. | ||||
| @@ -463,52 +364,25 @@ identifier (iid). | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Topology information | ||||
| =head2 Link Layer Discovery Protocol (LLDP) Overrides | ||||
|  | ||||
| Based upon the firmware version Enterasys devices may support Cabletron | ||||
| Discovery Protocol (CTRON CDP), Cisco Discovery Protocol (CDP), Link Layer | ||||
| Discovery Protocol (LLDP), or all.  This module currently supports CDP and | ||||
| LLDP, but not CTRON CDP.  These methods will query both CDP and LLDP and | ||||
| return the combination of all information.  As a result, there may be | ||||
| identical topology information returned from the two protocols | ||||
| causing duplicate entries.  It is the calling program's responsibility to | ||||
| identify any duplicate entries and remove duplicates if necessary. | ||||
| The LLDP table timefilter implementation continuously increments when | ||||
| walked and we may never reach the end of the table.  This behavior can be | ||||
| modified with the "set snmp timefilter break disable" command, | ||||
| unfortunately it is not the default.  These methods are overriden to | ||||
| supply a partial value of zero which means no time filter. | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item $enterasys->hasCDP() | ||||
| =item $enterasys->lldp_if() | ||||
|  | ||||
| Returns true if the device is running either CDP or LLDP. | ||||
| =item $enterasys->lldp_ip() | ||||
|  | ||||
| =item $enterasys->c_if() | ||||
| =item $enterasys->lldp_port() | ||||
|  | ||||
| Returns reference to hash.  Key: iid Value: local device port (interfaces) | ||||
| =item $enterasys->lldp_id() | ||||
|  | ||||
| =item $enterasys->c_ip() | ||||
|  | ||||
| Returns reference to hash.  Key: iid Value: remote IPv4 address | ||||
|  | ||||
| If multiple entries exist with the same local port, c_if(), with the same IPv4 | ||||
| address, c_ip(), it may be a duplicate entry. | ||||
|  | ||||
| If multiple entries exist with the same local port, c_if(), with different | ||||
| IPv4 addresses, c_ip(), there is either a non-CDP/LLDP device in between two | ||||
| or more devices or multiple devices which are not directly connected.   | ||||
|  | ||||
| Use the data from the Layer2 Topology Table below to dig deeper. | ||||
|  | ||||
| =item $enterasys->c_port() | ||||
|  | ||||
| Returns reference to hash. Key: iid Value: remote port (interfaces) | ||||
|  | ||||
| =item $enterasys->c_id() | ||||
|  | ||||
| Returns reference to hash. Key: iid Value: string value used to identify the | ||||
| chassis component associated with the remote system. | ||||
|  | ||||
| =item $enterasys->c_platform() | ||||
|  | ||||
| Returns reference to hash.  Key: iid Value: Remote Device Type | ||||
| =item $enterasys->lldp_platform() | ||||
|  | ||||
| =back | ||||
|  | ||||
|   | ||||
| @@ -80,19 +80,18 @@ $VERSION = '2.09'; | ||||
|     %SNMP::Info::LLDP::FUNCS, | ||||
|     %SNMP::Info::EDP::FUNCS, | ||||
|     'fan_state' => 'extremeFanOperational', | ||||
|  | ||||
|     # EXTREME-FDB-MIB:extremeFdbMacFdbTable | ||||
|     'ex_fw_mac'    => 'extremeFdbMacFdbMacAddress', | ||||
|     'ex_fw_port'   => 'extremeFdbMacFdbPortIfIndex', | ||||
|     'ex_fw_status' => 'extremeFdbMacFdbStatus', | ||||
|  | ||||
|     # EXTREME-VLAN-MIB:extremeVlanIfTable | ||||
|     'ex_vlan_descr'     => 'extremeVlanIfDescr', | ||||
|     'ex_vlan_global_id' => 'extremeVlanIfGlobalIdentifier', | ||||
|  | ||||
|     # EXTREME-VLAN-MIB:extremeVlanEncapsIfTable | ||||
|     'ex_vlan_encap_tag' => 'extremeVlanEncapsIfTag', | ||||
|  | ||||
|     # EXTREME-POE-MIB::extremePethPseSlotTable | ||||
|     'peth_power_watts'  => 'extremePethSlotPowerLimit', | ||||
|     # EXTREME-POE-MIB::extremePethPsePortTable | ||||
|     'peth_port_power'   => 'extremePethPortMeasuredPower', | ||||
| ); | ||||
|  | ||||
| @@ -549,125 +548,6 @@ sub set_add_i_vlan_tagged { | ||||
|     return $rv; | ||||
| } | ||||
|  | ||||
| #  Use EDP and/or LLDP | ||||
| sub hasCDP { | ||||
|     my $extreme = shift; | ||||
|  | ||||
|     return $extreme->hasLLDP() || $extreme->hasEDP(); | ||||
| } | ||||
|  | ||||
| sub c_ip { | ||||
|     my $extreme = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $edp  = $extreme->edp_ip() || {}; | ||||
|     my $lldp = $extreme->lldp_ip($partial) || {}; | ||||
|  | ||||
|     my %c_ip; | ||||
|     foreach my $iid ( keys %$edp ) { | ||||
|         my $ip = $edp->{$iid}; | ||||
|         next unless defined $ip; | ||||
|  | ||||
|         $c_ip{$iid} = $ip; | ||||
|     } | ||||
|  | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
|         my $ip = $lldp->{$iid}; | ||||
|         next unless defined $ip; | ||||
|  | ||||
|         $c_ip{$iid} = $ip; | ||||
|     } | ||||
|     return \%c_ip; | ||||
| } | ||||
|  | ||||
| sub c_if { | ||||
|     my $extreme = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $lldp = $extreme->lldp_if($partial) || {}; | ||||
|     my $edp  = $extreme->edp_if() || {}; | ||||
|  | ||||
|     my %c_if; | ||||
|     foreach my $iid ( keys %$edp ) { | ||||
|         my $if = $edp->{$iid}; | ||||
|         next unless defined $if; | ||||
|  | ||||
|         $c_if{$iid} = $if; | ||||
|     } | ||||
|  | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
|         my $if = $lldp->{$iid}; | ||||
|         next unless defined $if; | ||||
|  | ||||
|         $c_if{$iid} = $if; | ||||
|     } | ||||
|     return \%c_if; | ||||
| } | ||||
|  | ||||
| sub c_port { | ||||
|     my $extreme      = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $lldp = $extreme->lldp_port($partial) || {}; | ||||
|     my $edp  = $extreme->edp_port() || {}; | ||||
|  | ||||
|     my %c_port; | ||||
|     foreach my $iid ( keys %$edp ) { | ||||
|         my $port = $edp->{$iid}; | ||||
|         next unless defined $port; | ||||
|  | ||||
|         $c_port{$iid} = $port; | ||||
|     } | ||||
|  | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
|         my $port = $lldp->{$iid}; | ||||
|         next unless defined $port; | ||||
|         $c_port{$iid} = $port; | ||||
|     } | ||||
|     return \%c_port; | ||||
| } | ||||
|  | ||||
| sub c_id { | ||||
|     my $extreme      = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $lldp = $extreme->lldp_id($partial) || {}; | ||||
|     my $edp  = $extreme->edp_id() || {}; | ||||
|  | ||||
|     my %c_id; | ||||
|     foreach my $iid ( keys %$edp ) { | ||||
|         my $id = $edp->{$iid}; | ||||
|         next unless defined $id; | ||||
| 	 | ||||
|         $c_id{$iid} = $id; | ||||
|     } | ||||
|      | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
| 	my $id = $lldp->{$iid}; | ||||
| 	next unless defined $id; | ||||
| 	 | ||||
| 	$c_id{$iid} = $id; | ||||
|     } | ||||
|     return \%c_id; | ||||
| } | ||||
|  | ||||
| sub c_platform { | ||||
|     my $extreme      = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $lldp = $extreme->lldp_rem_sysdesc($partial)  || {}; | ||||
|  | ||||
|     my %c_platform; | ||||
|  | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
|         my $platform = $lldp->{$iid}; | ||||
|         next unless defined $platform; | ||||
|  | ||||
|         $c_platform{$iid} = $platform; | ||||
|     } | ||||
|     return \%c_platform; | ||||
| } | ||||
|  | ||||
| 1; | ||||
|  | ||||
| __END__ | ||||
| @@ -900,59 +780,14 @@ F<EXTREME-FDB-MIB> rather than F<BRIDGE-MIB>. | ||||
| =item $extreme->peth_port_power() | ||||
|  | ||||
| Power supplied by PoE ports, in milliwatts | ||||
| ("extremePethPortMeasuredPower") | ||||
|  | ||||
| =back | ||||
| (C<extremePethPortMeasuredPower>) | ||||
|  | ||||
| =head2 Topology information | ||||
| =item $extreme->peth_power_watts() | ||||
|  | ||||
| Based upon the firmware version Extreme devices may support Extreme Discovery | ||||
| Protocol (EDP), Link Layer Discovery Protocol (LLDP), or both.  These methods | ||||
| will query both and return the combination of all information.  As a result, | ||||
| there may be identical topology information returned from the two protocols | ||||
| causing duplicate entries.  It is the calling program's responsibility to | ||||
| identify any duplicate entries and remove duplicates if necessary. | ||||
| The configured maximum amount of inline power available to the slot. | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item $extreme->hasCDP() | ||||
|  | ||||
| Returns true if the device is running either EDP or LLDP. | ||||
|  | ||||
| =item $extreme->c_if() | ||||
|  | ||||
| Returns reference to hash.  Key: iid Value: local device port (interfaces) | ||||
|  | ||||
| =item $extreme->c_ip() | ||||
|  | ||||
| Returns reference to hash.  Key: iid Value: remote IPv4 address | ||||
|  | ||||
| If multiple entries exist with the same local port, c_if(), with the same IPv4 | ||||
| address, c_ip(), it may be a duplicate entry. | ||||
|  | ||||
| With EDP multiple entries may exist with the same local port, c_if(), and | ||||
| different IPv4 addresses, c_ip(), as EDP reports addresses for each VLAN | ||||
| transported across the trunk.  In the case of LLDP with multiple addresses | ||||
| there is either a non-LLDP device in between two or more devices or multiple | ||||
| devices which are not directly connected.   | ||||
|  | ||||
| Use the data from the Layer2 Topology Table below to dig deeper. | ||||
|  | ||||
| =item $extreme->c_port() | ||||
|  | ||||
| Returns reference to hash. Key: iid Value: remote port (interfaces) | ||||
|  | ||||
| =item $extreme->c_id() | ||||
|  | ||||
| Returns reference to hash. Key: iid Value: string value used to identify the | ||||
| chassis component associated with the remote system. | ||||
|  | ||||
| =item $extreme->c_platform() | ||||
|  | ||||
| Returns reference to hash.  Key: iid Value: Remote Device Type | ||||
|  | ||||
| This information is only available from LLDP.  EDP does not provide an  | ||||
| equivalent. | ||||
| (C<extremePethSlotPowerLimit>) | ||||
|  | ||||
| =back | ||||
|  | ||||
|   | ||||
| @@ -65,6 +65,8 @@ $VERSION = '2.09'; | ||||
|     'ps1_type'   => 'snChasPwrSupplyDescription.1', | ||||
|     'ps1_status' => 'snChasPwrSupplyOperStatus.1', | ||||
|     'fan'        => 'snChasFanOperStatus.1', | ||||
|     'img_ver'    => 'snAgImgVer', | ||||
|     'ch_serial'  => 'snChasSerNum', | ||||
|  | ||||
| ); | ||||
|  | ||||
| @@ -165,7 +167,7 @@ sub vendor { | ||||
| sub os_ver { | ||||
|     my $foundry = shift; | ||||
|  | ||||
|     return $foundry->snAgImgVer() if ( defined $foundry->snAgImgVer() ); | ||||
|     return $foundry->img_ver() if ( defined $foundry->img_ver() ); | ||||
|  | ||||
|     # Some older ones don't have this value,so we cull it from the description | ||||
|     my $descr = $foundry->description(); | ||||
| @@ -204,10 +206,10 @@ sub serial { | ||||
|     my $foundry = shift; | ||||
|  | ||||
|     # Return chassis serial number if available | ||||
|     return $foundry->snChasSerNum() if ( $foundry->snChasSerNum() ); | ||||
|     return $foundry->ch_serial() if ( $foundry->ch_serial() ); | ||||
|  | ||||
|     # If no chassis serial use first module serial | ||||
|     my $mod_serials = $foundry->snAgentConfigModuleSerialNumber(); | ||||
|     my $mod_serials = $foundry->snAgentConfigModuleSerialNumber() || {}; | ||||
|  | ||||
|     foreach my $mod ( sort keys %$mod_serials ) { | ||||
|         my $serial = $mod_serials->{$mod} || ''; | ||||
| @@ -268,134 +270,6 @@ sub stp_p_state { | ||||
|  | ||||
| } | ||||
|  | ||||
| #  Use FDP and/or LLDP | ||||
|  | ||||
| sub hasCDP { | ||||
|     my $foundry = shift; | ||||
|  | ||||
|     return $foundry->hasLLDP() || $foundry->hasFDP(); | ||||
| } | ||||
|  | ||||
| sub c_ip { | ||||
|     my $foundry = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $cdp  = $foundry->SUPER::c_ip($partial) || {}; | ||||
|     my $lldp = $foundry->lldp_ip($partial)     || {}; | ||||
|  | ||||
|     my %c_ip; | ||||
|     foreach my $iid ( keys %$cdp ) { | ||||
|         my $ip = $cdp->{$iid}; | ||||
|         next unless defined $ip; | ||||
|  | ||||
|         $c_ip{$iid} = $ip; | ||||
|     } | ||||
|  | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
|         my $ip = $lldp->{$iid}; | ||||
|         next unless defined $ip; | ||||
|  | ||||
|         $c_ip{$iid} = $ip; | ||||
|     } | ||||
|     return \%c_ip; | ||||
| } | ||||
|  | ||||
| sub c_if { | ||||
|     my $foundry = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $lldp = $foundry->lldp_if($partial)     || {}; | ||||
|     my $cdp  = $foundry->SUPER::c_if($partial) || {}; | ||||
|  | ||||
|     my %c_if; | ||||
|     foreach my $iid ( keys %$cdp ) { | ||||
|         my $if = $cdp->{$iid}; | ||||
|         next unless defined $if; | ||||
|  | ||||
|         $c_if{$iid} = $if; | ||||
|     } | ||||
|  | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
|         my $if = $lldp->{$iid}; | ||||
|         next unless defined $if; | ||||
|  | ||||
|         $c_if{$iid} = $if; | ||||
|     } | ||||
|     return \%c_if; | ||||
| } | ||||
|  | ||||
| sub c_port { | ||||
|     my $foundry = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $lldp = $foundry->lldp_port($partial)     || {}; | ||||
|     my $cdp  = $foundry->SUPER::c_port($partial) || {}; | ||||
|  | ||||
|     my %c_port; | ||||
|     foreach my $iid ( keys %$cdp ) { | ||||
|         my $port = $cdp->{$iid}; | ||||
|         next unless defined $port; | ||||
|  | ||||
|         $c_port{$iid} = $port; | ||||
|     } | ||||
|  | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
|         my $port = $lldp->{$iid}; | ||||
|         next unless defined $port; | ||||
|  | ||||
|         $c_port{$iid} = $port; | ||||
|     } | ||||
|     return \%c_port; | ||||
| } | ||||
|  | ||||
| sub c_id { | ||||
|     my $foundry = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $lldp = $foundry->lldp_id($partial)     || {}; | ||||
|     my $cdp  = $foundry->SUPER::c_id($partial) || {}; | ||||
|  | ||||
|     my %c_id; | ||||
|     foreach my $iid ( keys %$cdp ) { | ||||
|         my $id = $cdp->{$iid}; | ||||
|         next unless defined $id; | ||||
|  | ||||
|         $c_id{$iid} = $id; | ||||
|     } | ||||
|  | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
|         my $id = $lldp->{$iid}; | ||||
|         next unless defined $id; | ||||
|  | ||||
|         $c_id{$iid} = $id; | ||||
|     } | ||||
|     return \%c_id; | ||||
| } | ||||
|  | ||||
| sub c_platform { | ||||
|     my $foundry = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $lldp = $foundry->lldp_rem_sysdesc($partial)  || {}; | ||||
|     my $cdp  = $foundry->SUPER::c_platform($partial) || {}; | ||||
|  | ||||
|     my %c_platform; | ||||
|     foreach my $iid ( keys %$cdp ) { | ||||
|         my $platform = $cdp->{$iid}; | ||||
|         next unless defined $platform; | ||||
|  | ||||
|         $c_platform{$iid} = $platform; | ||||
|     } | ||||
|  | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
|         my $platform = $lldp->{$iid}; | ||||
|         next unless defined $platform; | ||||
|  | ||||
|         $c_platform{$iid} = $platform; | ||||
|     } | ||||
|     return \%c_platform; | ||||
| } | ||||
|  | ||||
| 1; | ||||
| __END__ | ||||
|  | ||||
| @@ -527,6 +401,18 @@ Returns the status of the chassis fan. | ||||
|  | ||||
| (C<snChasFanOperStatus.1>) | ||||
|  | ||||
| =item $foundry->img_ver() | ||||
|  | ||||
| Returns device image version. | ||||
|  | ||||
| (C<snAgImgVer.0>) | ||||
|  | ||||
| =item $foundry->ch_serial() | ||||
|  | ||||
| Returns chassis serial number. | ||||
|  | ||||
| (C<snChasSerNum.0>) | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Global Methods imported from SNMP::Info::Layer3 | ||||
| @@ -607,54 +493,6 @@ Returns reference to hash.  Current Port Speed. | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Topology information | ||||
|  | ||||
| Based upon the software version devices may support Foundry Discovery | ||||
| Protocol (FDP) and Link Layer Discovery Protocol (LLDP). These | ||||
| methods will query both and return the combination of all information. As a | ||||
| result, there may be identical topology information returned from the two | ||||
| protocols causing duplicate entries.  It is the calling program's | ||||
| responsibility to identify any duplicate entries and remove duplicates if | ||||
| necessary. | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item $foundry->hasCDP() | ||||
|  | ||||
| Returns true if the device is running either FDP or LLDP. | ||||
|  | ||||
| =item $foundry->c_if() | ||||
|  | ||||
| Returns reference to hash.  Key: iid Value: local device port (interfaces) | ||||
|  | ||||
| =item $foundry->c_ip() | ||||
|  | ||||
| Returns reference to hash.  Key: iid Value: remote IPv4 address | ||||
|  | ||||
| If multiple entries exist with the same local port, c_if(), with the same IPv4 | ||||
| address, c_ip(), it may be a duplicate entry. | ||||
|  | ||||
| If multiple entries exist with the same local port, c_if(), with different | ||||
| IPv4 addresses, c_ip(), there is either a non-FDP/LLDP device in between two | ||||
| or more devices or multiple devices which are not directly connected.   | ||||
|  | ||||
| Use the data from the Layer2 Topology Table below to dig deeper. | ||||
|  | ||||
| =item $foundry->c_port() | ||||
|  | ||||
| Returns reference to hash. Key: iid Value: remote port (interfaces) | ||||
|  | ||||
| =item $foundry->c_id() | ||||
|  | ||||
| Returns reference to hash. Key: iid Value: string value used to identify the | ||||
| chassis component associated with the remote system. | ||||
|  | ||||
| =item $foundry->c_platform() | ||||
|  | ||||
| Returns reference to hash.  Key: iid Value: Remote Device Type | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Table Methods imported from SNMP::Info::Layer3 | ||||
|  | ||||
| See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details. | ||||
|   | ||||
| @@ -196,134 +196,6 @@ sub interfaces { | ||||
|     return $i_descr; | ||||
| } | ||||
|  | ||||
| #  Use FDP and/or LLDP | ||||
|  | ||||
| sub hasCDP { | ||||
|     my $hp9300 = shift; | ||||
|  | ||||
|     return $hp9300->hasLLDP() || $hp9300->SUPER::hasCDP(); | ||||
| } | ||||
|  | ||||
| sub c_ip { | ||||
|     my $hp9300  = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $cdp  = $hp9300->SUPER::c_ip($partial) || {}; | ||||
|     my $lldp = $hp9300->lldp_ip($partial)     || {}; | ||||
|  | ||||
|     my %c_ip; | ||||
|     foreach my $iid ( keys %$cdp ) { | ||||
|         my $ip = $cdp->{$iid}; | ||||
|         next unless defined $ip; | ||||
|  | ||||
|         $c_ip{$iid} = $ip; | ||||
|     } | ||||
|  | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
|         my $ip = $lldp->{$iid}; | ||||
|         next unless defined $ip; | ||||
|  | ||||
|         $c_ip{$iid} = $ip; | ||||
|     } | ||||
|     return \%c_ip; | ||||
| } | ||||
|  | ||||
| sub c_if { | ||||
|     my $hp9300  = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $lldp = $hp9300->lldp_if($partial)     || {}; | ||||
|     my $cdp  = $hp9300->SUPER::c_if($partial) || {}; | ||||
|  | ||||
|     my %c_if; | ||||
|     foreach my $iid ( keys %$cdp ) { | ||||
|         my $if = $cdp->{$iid}; | ||||
|         next unless defined $if; | ||||
|  | ||||
|         $c_if{$iid} = $if; | ||||
|     } | ||||
|  | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
|         my $if = $lldp->{$iid}; | ||||
|         next unless defined $if; | ||||
|  | ||||
|         $c_if{$iid} = $if; | ||||
|     } | ||||
|     return \%c_if; | ||||
| } | ||||
|  | ||||
| sub c_port { | ||||
|     my $hp9300  = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $lldp = $hp9300->lldp_port($partial)     || {}; | ||||
|     my $cdp  = $hp9300->SUPER::c_port($partial) || {}; | ||||
|  | ||||
|     my %c_port; | ||||
|     foreach my $iid ( keys %$cdp ) { | ||||
|         my $port = $cdp->{$iid}; | ||||
|         next unless defined $port; | ||||
|  | ||||
|         $c_port{$iid} = $port; | ||||
|     } | ||||
|  | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
|         my $port = $lldp->{$iid}; | ||||
|         next unless defined $port; | ||||
|  | ||||
|         $c_port{$iid} = $port; | ||||
|     } | ||||
|     return \%c_port; | ||||
| } | ||||
|  | ||||
| sub c_id { | ||||
|     my $hp9300  = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $lldp = $hp9300->lldp_id($partial)     || {}; | ||||
|     my $cdp  = $hp9300->SUPER::c_id($partial) || {}; | ||||
|  | ||||
|     my %c_id; | ||||
|     foreach my $iid ( keys %$cdp ) { | ||||
|         my $id = $cdp->{$iid}; | ||||
|         next unless defined $id; | ||||
|  | ||||
|         $c_id{$iid} = $id; | ||||
|     } | ||||
|  | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
|         my $id = $lldp->{$iid}; | ||||
|         next unless defined $id; | ||||
|  | ||||
|         $c_id{$iid} = $id; | ||||
|     } | ||||
|     return \%c_id; | ||||
| } | ||||
|  | ||||
| sub c_platform { | ||||
|     my $hp9300  = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $lldp = $hp9300->lldp_rem_sysdesc($partial)  || {}; | ||||
|     my $cdp  = $hp9300->SUPER::c_platform($partial) || {}; | ||||
|  | ||||
|     my %c_platform; | ||||
|     foreach my $iid ( keys %$cdp ) { | ||||
|         my $platform = $cdp->{$iid}; | ||||
|         next unless defined $platform; | ||||
|  | ||||
|         $c_platform{$iid} = $platform; | ||||
|     } | ||||
|  | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
|         my $platform = $lldp->{$iid}; | ||||
|         next unless defined $platform; | ||||
|  | ||||
|         $c_platform{$iid} = $platform; | ||||
|     } | ||||
|     return \%c_platform; | ||||
| } | ||||
|  | ||||
| 1; | ||||
| __END__ | ||||
|  | ||||
| @@ -527,54 +399,6 @@ Returns reference to hash.  Current Port Speed. | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Topology information | ||||
|  | ||||
| Based upon the software version devices may support Foundry Discovery | ||||
| Protocol (FDP) and Link Layer Discovery Protocol (LLDP). These | ||||
| methods will query both and return the combination of all information. As a | ||||
| result, there may be identical topology information returned from the two | ||||
| protocols causing duplicate entries.  It is the calling program's | ||||
| responsibility to identify any duplicate entries and remove duplicates | ||||
| if necessary. | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item $hp9300->hasCDP() | ||||
|  | ||||
| Returns true if the device is running either FDP or LLDP. | ||||
|  | ||||
| =item $hp9300->c_if() | ||||
|  | ||||
| Returns reference to hash.  Key: iid Value: local device port (interfaces) | ||||
|  | ||||
| =item $hp9300->c_ip() | ||||
|  | ||||
| Returns reference to hash.  Key: iid Value: remote IPv4 address | ||||
|  | ||||
| If multiple entries exist with the same local port, c_if(), with the same IPv4 | ||||
| address, c_ip(), it may be a duplicate entry. | ||||
|  | ||||
| If multiple entries exist with the same local port, c_if(), with different | ||||
| IPv4 addresses, c_ip(), there is either a non-FDP/LLDP device in between two | ||||
| or more devices or multiple devices which are not directly connected.   | ||||
|  | ||||
| Use the data from the Layer2 Topology Table below to dig deeper. | ||||
|  | ||||
| =item $hp9300->c_port() | ||||
|  | ||||
| Returns reference to hash. Key: iid Value: remote port (interfaces) | ||||
|  | ||||
| =item $hp9300->c_id() | ||||
|  | ||||
| Returns reference to hash. Key: iid Value: string value used to identify the | ||||
| chassis component associated with the remote system. | ||||
|  | ||||
| =item $hp9300->c_platform() | ||||
|  | ||||
| Returns reference to hash.  Key: iid Value: Remote Device Type | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Table Methods imported from SNMP::Info::Layer3 | ||||
|  | ||||
| See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details. | ||||
|   | ||||
| @@ -53,8 +53,9 @@ $VERSION = '2.09'; | ||||
|  | ||||
| %GLOBALS = ( %SNMP::Info::Layer3::GLOBALS,  | ||||
| 	     %SNMP::Info::LLDP::GLOBALS, | ||||
| 	     'serial' => 'jnxBoxSerialNo.0', | ||||
| 	     'mac'    => 'dot1dBaseBridgeAddress', | ||||
| 	     'serial'    => 'jnxBoxSerialNo.0', | ||||
| 	     'mac'       => 'dot1dBaseBridgeAddress', | ||||
| 	     'box_descr' => 'jnxBoxDescr' | ||||
| 	     ); | ||||
|  | ||||
| %FUNCS = ( %SNMP::Info::Layer3::FUNCS,  | ||||
| @@ -248,49 +249,6 @@ sub fw_port { | ||||
|     return $juniper->qb_fw_port($partial); | ||||
| } | ||||
|  | ||||
| # Use LLDP | ||||
|  | ||||
| sub hasCDP { | ||||
|     my $juniper = shift; | ||||
|  | ||||
|     return $juniper->hasLLDP(); | ||||
| } | ||||
|  | ||||
| sub c_ip { | ||||
|     my $juniper  = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $juniper->lldp_ip($partial); | ||||
| } | ||||
|  | ||||
| sub c_if { | ||||
|     my $juniper  = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $juniper->lldp_if($partial); | ||||
| } | ||||
|  | ||||
| sub c_port { | ||||
|     my $juniper  = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $juniper->lldp_port($partial); | ||||
| } | ||||
|  | ||||
| sub c_id { | ||||
|     my $juniper  = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $juniper->lldp_id($partial); | ||||
| } | ||||
|  | ||||
| sub c_platform { | ||||
|     my $juniper  = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     return $juniper->lldp_rem_sysdesc($partial); | ||||
| } | ||||
|  | ||||
| # Pseudo ENTITY-MIB methods | ||||
|  | ||||
| # This class supports both virtual chassis (stackable) and physical chassis | ||||
| @@ -406,7 +364,7 @@ sub e_descr { | ||||
|     my $juniper = shift; | ||||
|  | ||||
|     my $e_index    = $juniper->e_index() || {}; | ||||
|     my $box_descr  = $juniper->jnxBoxDescr || 0; | ||||
|     my $box_descr  = $juniper->box_descr; | ||||
|     my $contents   = $juniper->jnxContentsDescr() || {}; | ||||
|     my $containers = $juniper->jnxContainersDescr() || {}; | ||||
|  | ||||
| @@ -663,16 +621,18 @@ Returns serial number | ||||
|  | ||||
| (C<jnxBoxSerialNo.0>) | ||||
|  | ||||
| =item $juniper->serial() | ||||
| =item $juniper->mac() | ||||
|  | ||||
| Returns the MAC address used by this bridge when it must be referred | ||||
| to in a unique fashion. | ||||
|  | ||||
| (C<dot1dBaseBridgeAddress>) | ||||
|  | ||||
| =item $juniper->hasCDP() | ||||
| =item $juniper->box_descr() | ||||
|  | ||||
| Returns whether LLDP is enabled. | ||||
| The name, model, or detailed description of the device. | ||||
|  | ||||
| (C<jnxBoxDescr.0>) | ||||
|  | ||||
| =back | ||||
|  | ||||
| @@ -718,35 +678,6 @@ IDs.  These are the VLANs which are members of the egress list for the port. | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Topology information | ||||
|  | ||||
| These methods return Link Layer Discovery Protocol (LLDP) information.  See | ||||
| documentation in L<SNMP::Info::LLDP/"TABLE METHODS"> for details. | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item $juniper->c_id() | ||||
|  | ||||
| Returns C<lldp_id> | ||||
|  | ||||
| =item $juniper->c_if() | ||||
|  | ||||
| Returns C<lldp_if> | ||||
|  | ||||
| =item $juniper->c_ip() | ||||
|  | ||||
| Returns C<lldp_ip> | ||||
|  | ||||
| =item $juniper->c_platform() | ||||
|  | ||||
| Returns C<lldp_rem_sysdesc> | ||||
|  | ||||
| =item $juniper->c_port() | ||||
|  | ||||
| Returns C<lldp_port> | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Forwarding Table (C<dot1dTpFdbEntry>) | ||||
|  | ||||
| =over  | ||||
|   | ||||
| @@ -130,42 +130,6 @@ sub i_ignore { | ||||
|     return \%i_ignore; | ||||
| } | ||||
|  | ||||
| # Use LLDP | ||||
| sub hasCDP { | ||||
|     my $netsnmp = shift; | ||||
|     return $netsnmp->hasLLDP(); | ||||
| } | ||||
|  | ||||
| sub c_ip { | ||||
|     my $netsnmp  = shift; | ||||
|     my $partial = shift; | ||||
|     return $netsnmp->lldp_ip($partial); | ||||
| } | ||||
|  | ||||
| sub c_if { | ||||
|     my $netsnmp  = shift; | ||||
|     my $partial = shift; | ||||
|     return $netsnmp->lldp_if($partial); | ||||
| } | ||||
|  | ||||
| sub c_port { | ||||
|     my $netsnmp  = shift; | ||||
|     my $partial = shift; | ||||
|     return $netsnmp->lldp_port($partial); | ||||
| } | ||||
|  | ||||
| sub c_id { | ||||
|     my $netsnmp  = shift; | ||||
|     my $partial = shift; | ||||
|     return $netsnmp->lldp_id($partial); | ||||
| } | ||||
|  | ||||
| sub c_platform { | ||||
|     my $netsnmp  = shift; | ||||
|     my $partial = shift; | ||||
|     return $netsnmp->lldp_rem_sysdesc($partial); | ||||
| } | ||||
|  | ||||
| 1; | ||||
| __END__ | ||||
|  | ||||
| @@ -278,46 +242,6 @@ Ignores loopback | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Topology information | ||||
|  | ||||
| Link Layer Discovery Protocol (LLDP) support.  The device must be running | ||||
| an optional LLDP agent, such as lldpd, which can integrate with the SNMP agent.  | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item $netsnmp->hasCDP() | ||||
|  | ||||
| Returns true if the device is running LLDP. | ||||
|  | ||||
| =item $netsnmp->c_if() | ||||
|  | ||||
| Returns reference to hash.  Key: iid Value: local device port (interfaces) | ||||
|  | ||||
| =item $netsnmp->c_ip() | ||||
|  | ||||
| Returns reference to hash.  Key: iid Value: remote IPv4 address | ||||
|  | ||||
| If multiple entries exist with the same local port, c_if(), with different | ||||
| IPv4 addresses, c_ip(), there is either a non-LLDP device in between two | ||||
| or more devices or multiple devices which are not directly connected.   | ||||
|  | ||||
| Use the data from the Layer2 Topology Table below to dig deeper. | ||||
|  | ||||
| =item $netsnmp->c_port() | ||||
|  | ||||
| Returns reference to hash. Key: iid Value: remote port (interfaces) | ||||
|  | ||||
| =item $netsnmp->c_id() | ||||
|  | ||||
| Returns reference to hash. Key: iid Value: string value used to identify the | ||||
| chassis component associated with the remote system. | ||||
|  | ||||
| =item $netsnmp->c_platform() | ||||
|  | ||||
| Returns reference to hash.  Key: iid Value: Remote Device Type | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Table Methods imported from SNMP::Info::Layer3 | ||||
|  | ||||
| See documentation in L<SNMP::Info::Layer3> for details. | ||||
|   | ||||
| @@ -174,132 +174,6 @@ sub model { | ||||
|     return $model; | ||||
| } | ||||
|  | ||||
| #  Use CDP and/or LLDP | ||||
| sub hasCDP { | ||||
|     my $nexus = shift; | ||||
|  | ||||
|     return $nexus->hasLLDP() || $nexus->SUPER::hasCDP(); | ||||
| } | ||||
|  | ||||
| sub c_ip { | ||||
|     my $nexus   = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $cdp  = $nexus->SUPER::c_ip($partial) || {}; | ||||
|     my $lldp = $nexus->lldp_ip($partial)     || {}; | ||||
|  | ||||
|     my %c_ip; | ||||
|     foreach my $iid ( keys %$cdp ) { | ||||
|         my $ip = $cdp->{$iid}; | ||||
|         next unless defined $ip; | ||||
|  | ||||
|         $c_ip{$iid} = $ip; | ||||
|     } | ||||
|  | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
|         my $ip = $lldp->{$iid}; | ||||
|         next unless defined $ip; | ||||
|  | ||||
|         $c_ip{$iid} = $ip; | ||||
|     } | ||||
|     return \%c_ip; | ||||
| } | ||||
|  | ||||
| sub c_if { | ||||
|     my $nexus   = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $lldp = $nexus->lldp_if($partial)     || {}; | ||||
|     my $cdp  = $nexus->SUPER::c_if($partial) || {}; | ||||
|  | ||||
|     my %c_if; | ||||
|     foreach my $iid ( keys %$cdp ) { | ||||
|         my $if = $cdp->{$iid}; | ||||
|         next unless defined $if; | ||||
|  | ||||
|         $c_if{$iid} = $if; | ||||
|     } | ||||
|  | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
|         my $if = $lldp->{$iid}; | ||||
|         next unless defined $if; | ||||
|  | ||||
|         $c_if{$iid} = $if; | ||||
|     } | ||||
|     return \%c_if; | ||||
| } | ||||
|  | ||||
| sub c_port { | ||||
|     my $nexus   = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $lldp = $nexus->lldp_port($partial)     || {}; | ||||
|     my $cdp  = $nexus->SUPER::c_port($partial) || {}; | ||||
|  | ||||
|     my %c_port; | ||||
|     foreach my $iid ( keys %$cdp ) { | ||||
|         my $port = $cdp->{$iid}; | ||||
|         next unless defined $port; | ||||
|  | ||||
|         $c_port{$iid} = $port; | ||||
|     } | ||||
|  | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
|         my $port = $lldp->{$iid}; | ||||
|         next unless defined $port; | ||||
|         $c_port{$iid} = $port; | ||||
|     } | ||||
|     return \%c_port; | ||||
| } | ||||
|  | ||||
| sub c_id { | ||||
|     my $nexus   = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $lldp = $nexus->lldp_id($partial)     || {}; | ||||
|     my $cdp  = $nexus->SUPER::c_id($partial) || {}; | ||||
|  | ||||
|     my %c_id; | ||||
|     foreach my $iid ( keys %$cdp ) { | ||||
|         my $id = $cdp->{$iid}; | ||||
|         next unless defined $id; | ||||
| 	 | ||||
|         $c_id{$iid} = $id; | ||||
|     } | ||||
|      | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
| 	my $id = $lldp->{$iid}; | ||||
| 	next unless defined $id; | ||||
| 	 | ||||
| 	$c_id{$iid} = $id; | ||||
|     } | ||||
|     return \%c_id; | ||||
| } | ||||
|  | ||||
| sub c_platform { | ||||
|     my $nexus   = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $lldp = $nexus->lldp_rem_sysdesc($partial)  || {}; | ||||
|     my $cdp  = $nexus->SUPER::c_platform($partial) || {}; | ||||
|  | ||||
|     my %c_platform; | ||||
|     foreach my $iid ( keys %$cdp ) { | ||||
|         my $platform = $cdp->{$iid}; | ||||
|         next unless defined $platform; | ||||
|  | ||||
|         $c_platform{$iid} = $platform; | ||||
|     } | ||||
|  | ||||
|     foreach my $iid ( keys %$lldp ) { | ||||
|         my $platform = $lldp->{$iid}; | ||||
|         next unless defined $platform; | ||||
|  | ||||
|         $c_platform{$iid} = $platform; | ||||
|     } | ||||
|     return \%c_platform; | ||||
| } | ||||
|  | ||||
| 1; | ||||
| __END__ | ||||
|  | ||||
| @@ -473,53 +347,6 @@ See documentation in L<SNMP::Info::LLDP/"GLOBALS"> for details. | ||||
| These are methods that return tables of information in the form of a reference | ||||
| to a hash. | ||||
|  | ||||
| =head2 Topology information | ||||
|  | ||||
| Based upon the firmware version Cisco devices may support Link Layer Discover | ||||
| Protocol (LLDP) in addition to the Cisco-proprietary CDP.  These methods | ||||
| will query both and return the combination of all information.  As a result, | ||||
| there may be identical topology information returned from the two protocols | ||||
| causing duplicate entries.  It is the calling program's responsibility to | ||||
| identify any duplicate entries and remove duplicates if necessary. | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item $nexus->hasCDP() | ||||
|  | ||||
| Returns true if the device is running either CDP or LLDP. | ||||
|  | ||||
| =item $nexus->c_if() | ||||
|  | ||||
| Returns reference to hash.  Key: iid Value: local device port (interfaces) | ||||
|  | ||||
| =item $nexus->c_ip() | ||||
|  | ||||
| Returns reference to hash.  Key: iid Value: remote IPv4 address | ||||
|  | ||||
| If multiple entries exist with the same local port, c_if(), with the same IPv4 | ||||
| address, c_ip(), it may be a duplicate entry. | ||||
|  | ||||
| If multiple entries exist with the same local port, c_if(), with different | ||||
| IPv4 addresses, c_ip(), there is either a non-CDP/LLDP device in between two | ||||
| or more devices or multiple devices which are not directly connected.   | ||||
|  | ||||
| Use the data from the Layer2 Topology Table below to dig deeper. | ||||
|  | ||||
| =item $nexus->c_port() | ||||
|  | ||||
| Returns reference to hash. Key: iid Value: remote port (interfaces) | ||||
|  | ||||
| =item $nexus->c_id() | ||||
|  | ||||
| Returns reference to hash. Key: iid Value: string value used to identify the | ||||
| chassis component associated with the remote system. | ||||
|  | ||||
| =item $nexus->c_platform() | ||||
|  | ||||
| Returns reference to hash.  Key: iid Value: Remote Device Type | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Table Methods imported from SNMP::Info::Layer3 | ||||
|  | ||||
| See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details. | ||||
|   | ||||
| @@ -1,7 +1,6 @@ | ||||
| # SNMP::Info::Layer3::Passport | ||||
| # $Id$ | ||||
| # | ||||
| # Copyright (c) 2008 Eric Miller | ||||
| # Copyright (c) 2012 Eric Miller | ||||
| # All rights reserved. | ||||
| # | ||||
| # Redistribution and use in source and binary forms, with or without | ||||
| @@ -30,6 +29,7 @@ | ||||
|  | ||||
| package SNMP::Info::Layer3::Passport; | ||||
|  | ||||
| use warnings; | ||||
| use strict; | ||||
| use Exporter; | ||||
| use SNMP::Info::SONMP; | ||||
| @@ -80,7 +80,7 @@ sub model { | ||||
|  | ||||
|     return $id unless defined $model; | ||||
|  | ||||
|     $model =~ s/^rcA//i; | ||||
|     $model =~ s/^rc(A)?//i; | ||||
|     return $model; | ||||
| } | ||||
|  | ||||
| @@ -126,9 +126,9 @@ sub i_index { | ||||
|  | ||||
|     # Get VLAN Virtual Router Interfaces | ||||
|     if (!defined $partial | ||||
|         or (defined $model | ||||
|             and (  ( $partial > 2000 and $model =~ /(86|83|81|16)/ ) | ||||
|                 or ( $partial > 256 and $model =~ /(105|11[05]0|12[05])/ ) ) | ||||
|         || (defined $model | ||||
|             && (  ( $partial > 2000 && $model =~ /(86|83|81|16|VSP)/ ) | ||||
|                 || ( $partial > 256 && $model =~ /(105|11[05]0|12[05])/ ) ) | ||||
|         ) | ||||
|         ) | ||||
|     { | ||||
| @@ -182,9 +182,9 @@ sub interfaces { | ||||
|     my $vlan_id = {}; | ||||
|  | ||||
|     if (!defined $partial | ||||
|         or (defined $model | ||||
|             and (  ( $partial > 2000 and $model =~ /(86|83|81|16)/ ) | ||||
|                 or ( $partial > 256 and $model =~ /(105|11[05]0|12[05])/ ) ) | ||||
|         || (defined $model | ||||
|             && (  ( $partial > 2000 && $model =~ /(86|83|81|16|VSP)/ ) | ||||
|                 || ( $partial > 256 && $model =~ /(105|11[05]0|12[05])/ ) ) | ||||
|         ) | ||||
|         ) | ||||
|     { | ||||
| @@ -214,7 +214,7 @@ sub interfaces { | ||||
|             $if{$index} = 'Cpu.6'; | ||||
|         } | ||||
|  | ||||
|         elsif (( $index > 2000 and $model =~ /(86|83|81|16)/ ) | ||||
|         elsif (( $index > 2000 and $model =~ /(86|83|81|16|VSP)/ ) | ||||
|             or ( $index > 256 and $model =~ /(105|11[05]0|12[05])/ ) ) | ||||
|         { | ||||
|  | ||||
| @@ -255,9 +255,9 @@ sub i_mac { | ||||
|  | ||||
|     # Get VLAN Virtual Router Interfaces | ||||
|     if (!defined $partial | ||||
|         or (defined $model | ||||
|             and (  ( $partial > 2000 and $model =~ /(86|83|81|16)/ ) | ||||
|                 or ( $partial > 256 and $model =~ /(105|11[05]0|12[05])/ ) ) | ||||
|         || (defined $model | ||||
|             && (  ( $partial > 2000 && $model =~ /(86|83|81|16|VSP)/ ) | ||||
|                 || ( $partial > 256 && $model =~ /(105|11[05]0|12[05])/ ) ) | ||||
|         ) | ||||
|         ) | ||||
|     { | ||||
| @@ -329,9 +329,9 @@ sub i_description { | ||||
|  | ||||
|     # Get VLAN Virtual Router Interfaces | ||||
|     if (!defined $partial | ||||
|         or (defined $model | ||||
|             and (  ( $partial > 2000 and $model =~ /(86|83|81|16)/ ) | ||||
|                 or ( $partial > 256 and $model =~ /(105|11[05]0|12[05])/ ) ) | ||||
|         || (defined $model | ||||
|             && (  ( $partial > 2000 && $model =~ /(86|83|81|16|VSP)/ ) | ||||
|                 || ( $partial > 256 && $model =~ /(105|11[05]0|12[05])/ ) ) | ||||
|         ) | ||||
|         ) | ||||
|     { | ||||
| @@ -365,9 +365,9 @@ sub i_name { | ||||
|     my %reverse_vlan; | ||||
|  | ||||
|     if (!defined $partial | ||||
|         or (defined $model | ||||
|             and (  ( $partial > 2000 and $model =~ /(86|83|81|16)/ ) | ||||
|                 or ( $partial > 256 and $model =~ /(105|11[05]0|12[05])/ ) ) | ||||
|         || (defined $model | ||||
|             && (  ( $partial > 2000 && $model =~ /(86|83|81|16|VSP)/ ) | ||||
|                 || ( $partial > 256 && $model =~ /(105|11[05]0|12[05])/ ) ) | ||||
|         ) | ||||
|         ) | ||||
|     { | ||||
| @@ -402,8 +402,8 @@ sub i_name { | ||||
|                 and $model =~ /(105|11[05]0|12[05])/ ) | ||||
|             ) | ||||
|         { | ||||
|             my $vlan_index = $reverse_vlan{$iid}; | ||||
|             my $vlan_name  = $v_name->{$vlan_index}; | ||||
|             my $vlan_idx = $reverse_vlan{$iid}; | ||||
|             my $vlan_name  = $v_name->{$vlan_idx}; | ||||
|             next unless defined $vlan_name; | ||||
|  | ||||
|             $i_name{$iid} = $vlan_name; | ||||
| @@ -510,7 +510,7 @@ sub root_ip { | ||||
|     my $sonmp_topo_ip   = $passport->sonmp_topo_ip(); | ||||
|  | ||||
|     # Only 8600 and 1600 have CLIP or Management Virtual IP | ||||
|     if ( defined $model and $model =~ /(86|16)/ ) { | ||||
|     if ( defined $model and $model =~ /(86|16|VSP)/ ) { | ||||
|  | ||||
|         # Return CLIP (CircuitLess IP) | ||||
|         foreach my $iid ( keys %$rc_ip_type ) { | ||||
| @@ -683,7 +683,7 @@ sub e_descr { | ||||
|  | ||||
|     my $model = $passport->model(); | ||||
|     my $rc_ps = $passport->rc_ps_detail() || {}; | ||||
|     my $rc_ch = $passport->rcChasType(); | ||||
|     my $rc_ch = $passport->chassis(); | ||||
|     $rc_ch =~ s/a//; | ||||
|  | ||||
|     my %rc_e_descr; | ||||
| @@ -752,7 +752,7 @@ sub e_type { | ||||
|  | ||||
|     my $model = $passport->model(); | ||||
|     my $rc_ps = $passport->rc_ps_type() || {}; | ||||
|     my $rc_ch = $passport->rcChasType(); | ||||
|     my $rc_ch = $passport->chassis(); | ||||
|  | ||||
|     my %rc_e_type; | ||||
|  | ||||
|   | ||||
| @@ -118,42 +118,6 @@ sub os_ver { | ||||
|     return $os_ver; | ||||
| } | ||||
|  | ||||
| # Use LLDP | ||||
| sub hasCDP { | ||||
|     my $pf = shift; | ||||
|     return $pf->hasLLDP(); | ||||
| } | ||||
|  | ||||
| sub c_ip { | ||||
|     my $pf  = shift; | ||||
|     my $partial = shift; | ||||
|     return $pf->lldp_ip($partial); | ||||
| } | ||||
|  | ||||
| sub c_if { | ||||
|     my $pf  = shift; | ||||
|     my $partial = shift; | ||||
|     return $pf->lldp_if($partial); | ||||
| } | ||||
|  | ||||
| sub c_port { | ||||
|     my $pf  = shift; | ||||
|     my $partial = shift; | ||||
|     return $pf->lldp_port($partial); | ||||
| } | ||||
|  | ||||
| sub c_id { | ||||
|     my $pf  = shift; | ||||
|     my $partial = shift; | ||||
|     return $pf->lldp_id($partial); | ||||
| } | ||||
|  | ||||
| sub c_platform { | ||||
|     my $pf  = shift; | ||||
|     my $partial = shift; | ||||
|     return $pf->lldp_rem_sysdesc($partial); | ||||
| } | ||||
|  | ||||
| 1; | ||||
| __END__ | ||||
|  | ||||
| @@ -230,10 +194,6 @@ These are methods that return scalar values from SNMP | ||||
|  | ||||
|     Returns 'FreeBSD' | ||||
|  | ||||
| =item $pf->hasCDP() | ||||
|  | ||||
|     Returns whether LLDP is enabled. | ||||
|  | ||||
| =item $pf->model() | ||||
|  | ||||
| Grabs the os version from C<sysDescr> | ||||
| @@ -259,30 +219,6 @@ See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details. | ||||
| These are methods that return tables of information in the form of a reference | ||||
| to a hash. | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item $pf->c_id() | ||||
|  | ||||
| Returns LLDP information. | ||||
|  | ||||
| =item $pf->c_if() | ||||
|  | ||||
| Returns LLDP information. | ||||
|  | ||||
| =item $pf->c_ip() | ||||
|  | ||||
| Returns LLDP information. | ||||
|  | ||||
| =item $pf->c_platform() | ||||
|  | ||||
| Returns LLDP information. | ||||
|  | ||||
| =item $pf->c_port() | ||||
|  | ||||
| Returns LLDP information. | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Table Methods imported from SNMP::Info::Layer3 | ||||
|  | ||||
| See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details. | ||||
|   | ||||
| @@ -55,10 +55,14 @@ $VERSION = '2.09'; | ||||
| %GLOBALS = ( | ||||
|     %SNMP::Info::Layer3::GLOBALS, | ||||
|     %SNMP::Info::MAU::GLOBALS, | ||||
|     'ps1_type'   => 'nnenvPwrsupType.1', | ||||
|     'ps1_status' => 'nnenvPwrsupStatus.1', | ||||
|     'ps2_type'   => 'nnenvPwrsupType.2', | ||||
|     'ps2_status' => 'nnenvPwrsupStatus.2', | ||||
|     'ps1_type'      => 'nnenvPwrsupType.1', | ||||
|     'ps1_status'    => 'nnenvPwrsupStatus.1', | ||||
|     'ps2_type'      => 'nnenvPwrsupType.2', | ||||
|     'ps2_status'    => 'nnenvPwrsupStatus.2', | ||||
|     'nn_sys_ver'    => 'nnsysVersion', | ||||
|     'nn_ch_model'   => 'nnchassisModel', | ||||
|     'nn_ch_op_stat' => 'nnchassisOperStatus', | ||||
|     'nn_ch_serial'  => 'nnchassisSerialNumber', | ||||
| ); | ||||
|  | ||||
| %FUNCS = ( | ||||
| @@ -87,7 +91,7 @@ sub os { | ||||
|  | ||||
| sub os_ver { | ||||
|     my $tasman  = shift; | ||||
|     my $version = $tasman->nnsysVersion() || ""; | ||||
|     my $version = $tasman->nn_sys_ver() || ""; | ||||
|     my $descr   = $tasman->description()  || ""; | ||||
|  | ||||
|     # Newer versions | ||||
| @@ -102,7 +106,7 @@ sub model { | ||||
|     my $tasman = shift; | ||||
|  | ||||
|     my $id        = $tasman->id(); | ||||
|     my $ch_model = $tasman->nnchassisModel(); | ||||
|     my $ch_model = $tasman->nn_ch_model(); | ||||
|      | ||||
|     return $ch_model if $ch_model; | ||||
|  | ||||
| @@ -118,12 +122,12 @@ sub serial { | ||||
|  | ||||
|     # Newer versions of the software redefined the MIB in a non-backwards | ||||
|     # compatible manner.  Try the old OID first. | ||||
|     my $serial = $tasman->nnchassisOperStatus(); | ||||
|     my $serial = $tasman->nn_ch_op_stat(); | ||||
|     # Newer versions populate status, serial should contain some numbers | ||||
|     return $serial if ($serial !~ /^\D+$/); | ||||
|  | ||||
|     # Unfortunately newer versions don't seem to populate the newer OID. | ||||
|     return $tasman->nnchassisSerialNumber(); | ||||
|     return $tasman->nn_ch_serial(); | ||||
| } | ||||
|  | ||||
| 1; | ||||
| @@ -225,9 +229,25 @@ Grabs the os version from C<nnsysVersion> | ||||
| (C<nnenvPwrsupType.2>) | ||||
|  | ||||
| =item $tasman->ps2_status() | ||||
|  | ||||
|   | ||||
| (C<nnenvPwrsupStatus.2>) | ||||
|  | ||||
| =item $tasman->nn_sys_ver() | ||||
|  | ||||
| (C<nnsysVersion.0>) | ||||
|  | ||||
| =item $tasman->nn_ch_model() | ||||
|  | ||||
| (C<nnchassisModel.0>) | ||||
|  | ||||
| =item $tasman->nn_ch_op_stat() | ||||
|  | ||||
| (C<nnchassisOperStatus.0>) | ||||
|  | ||||
| =item $tasman->nn_ch_serial() | ||||
|  | ||||
| (C<nnchassisSerialNumber.0>) | ||||
|  | ||||
| =item $tasman->serial() | ||||
|  | ||||
| Tries both (C<nnchassisOperStatus>) and (C<nnchassisSerialNumber>) as OID's | ||||
|   | ||||
		Reference in New Issue
	
	Block a user