Remove c_* methods from device classes as top level methods now handle.
This commit is contained in:
		| @@ -413,108 +413,6 @@ sub _sensor { | ||||
|     return $result; | ||||
| } | ||||
|  | ||||
| #  Use CDP and/or LLDP | ||||
| sub hasCDP { | ||||
|     my $hp = shift; | ||||
|  | ||||
|     return $hp->hasLLDP() || $hp->SUPER::hasCDP(); | ||||
| } | ||||
|  | ||||
| sub c_ip { | ||||
|     my $hp      = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $cdp  = $hp->SUPER::c_ip($partial) || {}; | ||||
|     my $lldp = $hp->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 $hp      = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $lldp = $hp->lldp_if($partial)     || {}; | ||||
|     my $cdp  = $hp->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 $hp      = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $lldp = $hp->lldp_port($partial)     || {}; | ||||
|     my $cdp  = $hp->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 $hp      = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $lldp = $hp->lldp_id($partial)     || {}; | ||||
|     my $cdp  = $hp->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 munge_hp_c_id { | ||||
|     my ($v) = @_; | ||||
|     if ( length(unpack('H*', $v)) == 12 ){ | ||||
| @@ -528,30 +426,6 @@ sub munge_hp_c_id { | ||||
|     } | ||||
| } | ||||
|  | ||||
| sub c_platform { | ||||
|     my $hp      = shift; | ||||
|     my $partial = shift; | ||||
|  | ||||
|     my $lldp = $hp->lldp_rem_sysdesc($partial)  || {}; | ||||
|     my $cdp  = $hp->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; | ||||
| } | ||||
|  | ||||
| # POWER-ETHERNET-MIB doesn't define a mapping of its | ||||
| # "module"/"port" index to ifIndex.  Different vendors | ||||
| # do this in different ways. | ||||
| @@ -959,53 +833,6 @@ interface index (c<ifIndex>) | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Topology information | ||||
|  | ||||
| Based upon the firmware version HP devices may support Cisco Discovery | ||||
| Protocol (CDP), 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. | ||||
|  | ||||
| =over | ||||
|  | ||||
| =item $hp->hasCDP() | ||||
|  | ||||
| Returns true if the device is running either CDP or LLDP. | ||||
|  | ||||
| =item $hp->c_if() | ||||
|  | ||||
| Returns reference to hash.  Key: iid Value: local device port (interfaces) | ||||
|  | ||||
| =item $hp->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 $hp->c_port() | ||||
|  | ||||
| Returns reference to hash. Key: iid Value: remote port (interfaces) | ||||
|  | ||||
| =item $hp->c_id() | ||||
|  | ||||
| Returns reference to hash. Key: iid Value: string value used to identify the | ||||
| chassis component associated with the remote system. | ||||
|  | ||||
| =item $hp->c_platform() | ||||
|  | ||||
| Returns reference to hash.  Key: iid Value: Remote Device Type | ||||
|  | ||||
| =back | ||||
|  | ||||
| =head2 Table Methods imported from SNMP::Info::Layer2 | ||||
|  | ||||
| See documentation in L<SNMP::Info::Layer2/"TABLE METHODS"> for details. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user