Merge branch 'em-autoload-topo'
Conflicts: ChangeLog
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user