Notes |
|
(0003079)
|
fgaudreault
|
2012-09-19 11:34
(edited on: 2012-09-19 12:12) |
|
Did that for Cisco using the Capabilities Flag. Need some rework:
sub getPhonesLLDPAtIfIndex {
my ( $this, $ifIndex ) = @_;
my $logger = Log::Log4perl::get_logger( ref($this) );
my @phones;
if ( !$this->isVoIPEnabled() ) {
$logger->debug( "VoIP not enabled on switch "
. $this->{_ip}
. ". getPhonesLLDPAtIfIndex will return empty list." );
return @phones;
}
my $oid_lldpRemPortId = '1.0.8802.1.1.2.1.4.1.1.7';
my $oid_lldpRemSysDesc = '1.0.8802.1.1.2.1.4.1.1.10';
my $oid_lldpRemSysCapEnabled = '1.0.8802.1.1.2.1.4.1.1.12';
if ( !$this->connectRead() ) {
return @phones;
}
#Transfer ifIndex to LLDP index
my $lldpIndex = ($ifIndex-10000)+2;
$logger->trace(
"SNMP get_next_request for lldpRemSysCapEnabled: $oid_lldpRemSysCapEnabled");
my $result = $this->{_sessionRead}
->get_table( -baseoid => $oid_lldpRemSysCapEnabled );
foreach my $oid ( keys %{$result} ) {
if ( $oid =~ /^$oid_lldpRemSysCapEnabled\.([0-9]+)\.([0-9]+)\.([0-9]+)$/ ) {
if ( $lldpIndex eq $2 ) {
my $cache_lldpRemTimeMark = $1;
my $cache_lldpRemLocalPortNum = $2;
my $cache_lldpRemIndex = $3;
if ( $this->getBitAtPosition($result->{$oid},5) ) {
$logger->trace(
"SNMP get_request for lldpRemPortId: $oid_lldpRemPortId.$cache_lldpRemTimeMark.$cache_lldpRemLocalPortNum.$cache_lldpRemIndex"
);
my $MACresult = $this->{_sessionRead}->get_request(
-varbindlist => [
"$oid_lldpRemPortId.$cache_lldpRemTimeMark.$cache_lldpRemLocalPortNum.$cache_lldpRemIndex"
]
);
if ($MACresult
&& ($MACresult->{
"$oid_lldpRemPortId.$cache_lldpRemTimeMark.$cache_lldpRemLocalPortNum.$cache_lldpRemIndex"
}
=~ /^0x([0-9A-Z]{2})([0-9A-Z]{2})([0-9A-Z]{2})([0-9A-Z]{2})([0-9A-Z]{2})([0-9A-Z]{2})$/i
)
)
{
push @phones, lc("$1:$2:$3:$4:$5:$6");
last;
}
}
}
}
}
return @phones;
}
|
|
|
(0003080)
|
fgaudreault
|
2012-09-19 14:14
|
|
Also need rework:
sub getPhonesDPAtIfIndex {
my ( $this, $ifIndex ) = @_;
my $logger = Log::Log4perl::get_logger( ref($this) );
my @phones;
if ( !$this->isVoIPEnabled() ) {
$logger->debug( "VoIP not enabled on switch "
. $this->{_ip}
. ". getPhonesDPAtIfIndex will return empty list." );
return @phones;
}
# Check CDP First, then Check LLDP
@phones = $this->getPhonesCDPAtIfIndex($ifIndex);
if (!@phones) {
@phones = $this->getPhonesLLDPAtIfIndex($ifIndex);
}
return @phones;
}
|
|
|
|
Implementation in good shape. Missing a few things to fully complete it. Will most likely be completed tomorrow.
Branch: feature/lldp-enhancements |
|