perltidy
This commit is contained in:
@@ -3,20 +3,20 @@
|
||||
#
|
||||
# Copyright (c) 2008 Eric Miller
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# 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
|
||||
# * 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
|
||||
#
|
||||
# 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
|
||||
@@ -35,40 +35,33 @@ use SNMP::Info::Bridge;
|
||||
use SNMP::Info::CDP;
|
||||
use SNMP::Info::Airespace;
|
||||
|
||||
@SNMP::Info::Layer2::Airespace::ISA = qw/SNMP::Info::Airespace SNMP::Info::CDP SNMP::Info::Bridge Exporter/;
|
||||
@SNMP::Info::Layer2::Airespace::ISA
|
||||
= qw/SNMP::Info::Airespace SNMP::Info::CDP SNMP::Info::Bridge Exporter/;
|
||||
@SNMP::Info::Layer2::Airespace::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
|
||||
|
||||
$VERSION = '1.09';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::MIBS,
|
||||
%SNMP::Info::Bridge::MIBS,
|
||||
%SNMP::Info::CDP::MIBS,
|
||||
%SNMP::Info::Airespace::MIBS,
|
||||
);
|
||||
%MIBS = (
|
||||
%SNMP::Info::MIBS, %SNMP::Info::Bridge::MIBS,
|
||||
%SNMP::Info::CDP::MIBS, %SNMP::Info::Airespace::MIBS,
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::GLOBALS,
|
||||
%SNMP::Info::Bridge::GLOBALS,
|
||||
%SNMP::Info::CDP::GLOBALS,
|
||||
%SNMP::Info::Airespace::GLOBALS,
|
||||
);
|
||||
%SNMP::Info::GLOBALS, %SNMP::Info::Bridge::GLOBALS,
|
||||
%SNMP::Info::CDP::GLOBALS, %SNMP::Info::Airespace::GLOBALS,
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::FUNCS,
|
||||
%SNMP::Info::Bridge::FUNCS,
|
||||
%SNMP::Info::CDP::FUNCS,
|
||||
%SNMP::Info::Airespace::FUNCS,
|
||||
);
|
||||
%FUNCS = (
|
||||
%SNMP::Info::FUNCS, %SNMP::Info::Bridge::FUNCS,
|
||||
%SNMP::Info::CDP::FUNCS, %SNMP::Info::Airespace::FUNCS,
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::MUNGE,
|
||||
%SNMP::Info::Bridge::MUNGE,
|
||||
%SNMP::Info::CDP::MUNGE,
|
||||
%SNMP::Info::Airespace::MUNGE,
|
||||
);
|
||||
%MUNGE = (
|
||||
%SNMP::Info::MUNGE, %SNMP::Info::Bridge::MUNGE,
|
||||
%SNMP::Info::CDP::MUNGE, %SNMP::Info::Airespace::MUNGE,
|
||||
);
|
||||
|
||||
sub os {
|
||||
return 'cisco';
|
||||
@@ -80,7 +73,7 @@ sub vendor {
|
||||
|
||||
sub model {
|
||||
my $airespace = shift;
|
||||
my $model = $airespace->airespace_model();
|
||||
my $model = $airespace->airespace_model();
|
||||
return unless defined $model;
|
||||
|
||||
return $model;
|
||||
|
||||
@@ -5,21 +5,21 @@
|
||||
#
|
||||
# Copyright (c) 2003 Regents of the University of California
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
#
|
||||
# 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
|
||||
# * 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
|
||||
#
|
||||
# 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
|
||||
@@ -41,8 +41,9 @@ use SNMP::Info::CiscoStats;
|
||||
use SNMP::Info::CDP;
|
||||
use SNMP::Info::IEEE802dot11;
|
||||
|
||||
@SNMP::Info::Layer2::Aironet::ISA = qw/SNMP::Info::Layer2 SNMP::Info::Entity SNMP::Info::EtherLike
|
||||
SNMP::Info::CiscoStats SNMP::Info::CDP Exporter/;
|
||||
@SNMP::Info::Layer2::Aironet::ISA
|
||||
= qw/SNMP::Info::Layer2 SNMP::Info::Entity SNMP::Info::EtherLike
|
||||
SNMP::Info::CiscoStats SNMP::Info::CDP Exporter/;
|
||||
@SNMP::Info::Layer2::Aironet::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
|
||||
@@ -50,68 +51,69 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
|
||||
$VERSION = '1.09';
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::IEEE802dot11::GLOBALS,
|
||||
%SNMP::Info::Layer2::GLOBALS,
|
||||
%SNMP::Info::Entity::GLOBALS,
|
||||
%SNMP::Info::EtherLike::GLOBALS,
|
||||
%SNMP::Info::CiscoStats::GLOBALS,
|
||||
%SNMP::Info::CDP::GLOBALS,
|
||||
'serial' => 'entPhysicalSerialNum.1',
|
||||
'descr' => 'sysDescr'
|
||||
);
|
||||
%SNMP::Info::IEEE802dot11::GLOBALS,
|
||||
%SNMP::Info::Layer2::GLOBALS,
|
||||
%SNMP::Info::Entity::GLOBALS,
|
||||
%SNMP::Info::EtherLike::GLOBALS,
|
||||
%SNMP::Info::CiscoStats::GLOBALS,
|
||||
%SNMP::Info::CDP::GLOBALS,
|
||||
'serial' => 'entPhysicalSerialNum.1',
|
||||
'descr' => 'sysDescr'
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::IEEE802dot11::FUNCS,
|
||||
%SNMP::Info::Layer2::FUNCS,
|
||||
%SNMP::Info::Entity::FUNCS,
|
||||
%SNMP::Info::EtherLike::FUNCS,
|
||||
%SNMP::Info::CiscoStats::FUNCS,
|
||||
%SNMP::Info::CDP::FUNCS,
|
||||
'i_ssidlist' => 'cd11IfAuxSsid',
|
||||
'i_ssidbcast' => 'cd11IfAuxSsidBroadcastSsid',
|
||||
'i_80211channel' => 'cd11IfPhyDsssCurrentChannel',
|
||||
'c_dot11subif' => 'cDot11ClientSubIfIndex',
|
||||
'cd11_txrate' => 'cDot11ClientCurrentTxRateSet',
|
||||
'cd11_uptime' => 'cDot11ClientUpTime',
|
||||
'cd11_sigstrength' => 'cDot11ClientSignalStrength',
|
||||
'cd11_sigqual' => 'cDot11ClientSigQuality',
|
||||
'cd11_rxpkt' => 'cDot11ClientPacketsReceived',
|
||||
'cd11_txpkt' => 'cDot11ClientPacketsSent',
|
||||
'cd11_rxbyte' => 'cDot11ClientBytesReceived',
|
||||
'cd11_txbyte' => 'cDot11ClientBytesSent',
|
||||
'mbss_mac_addr' => 'cdot11MbssidIfMacAddress',
|
||||
);
|
||||
%FUNCS = (
|
||||
%SNMP::Info::IEEE802dot11::FUNCS,
|
||||
%SNMP::Info::Layer2::FUNCS,
|
||||
%SNMP::Info::Entity::FUNCS,
|
||||
%SNMP::Info::EtherLike::FUNCS,
|
||||
%SNMP::Info::CiscoStats::FUNCS,
|
||||
%SNMP::Info::CDP::FUNCS,
|
||||
'i_ssidlist' => 'cd11IfAuxSsid',
|
||||
'i_ssidbcast' => 'cd11IfAuxSsidBroadcastSsid',
|
||||
'i_80211channel' => 'cd11IfPhyDsssCurrentChannel',
|
||||
'c_dot11subif' => 'cDot11ClientSubIfIndex',
|
||||
'cd11_txrate' => 'cDot11ClientCurrentTxRateSet',
|
||||
'cd11_uptime' => 'cDot11ClientUpTime',
|
||||
'cd11_sigstrength' => 'cDot11ClientSignalStrength',
|
||||
'cd11_sigqual' => 'cDot11ClientSigQuality',
|
||||
'cd11_rxpkt' => 'cDot11ClientPacketsReceived',
|
||||
'cd11_txpkt' => 'cDot11ClientPacketsSent',
|
||||
'cd11_rxbyte' => 'cDot11ClientBytesReceived',
|
||||
'cd11_txbyte' => 'cDot11ClientBytesSent',
|
||||
'mbss_mac_addr' => 'cdot11MbssidIfMacAddress',
|
||||
);
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::IEEE802dot11::MIBS,
|
||||
%SNMP::Info::Layer2::MIBS,
|
||||
%SNMP::Info::Entity::MIBS,
|
||||
%SNMP::Info::EtherLike::MIBS,
|
||||
%SNMP::Info::CiscoStats::MIBS,
|
||||
%SNMP::Info::CiscoVTP::MIBS,
|
||||
%SNMP::Info::CDP::MIBS,
|
||||
'CISCO-DOT11-IF-MIB' => 'cd11IfAuxSsid',
|
||||
'CISCO-DOT11-ASSOCIATION-MIB' => 'cDot11ClientSubIfIndex',
|
||||
'CISCO-DOT11-SSID-SECURITY-MIB' => 'cdot11SecVlanNameId',
|
||||
'CISCO-VLAN-IFTABLE-RELATIONSHIP-MIB' => 'cviRoutedVlanIfIndex',
|
||||
);
|
||||
%MIBS = (
|
||||
%SNMP::Info::IEEE802dot11::MIBS,
|
||||
%SNMP::Info::Layer2::MIBS,
|
||||
%SNMP::Info::Entity::MIBS,
|
||||
%SNMP::Info::EtherLike::MIBS,
|
||||
%SNMP::Info::CiscoStats::MIBS,
|
||||
%SNMP::Info::CiscoVTP::MIBS,
|
||||
%SNMP::Info::CDP::MIBS,
|
||||
'CISCO-DOT11-IF-MIB' => 'cd11IfAuxSsid',
|
||||
'CISCO-DOT11-ASSOCIATION-MIB' => 'cDot11ClientSubIfIndex',
|
||||
'CISCO-DOT11-SSID-SECURITY-MIB' => 'cdot11SecVlanNameId',
|
||||
'CISCO-VLAN-IFTABLE-RELATIONSHIP-MIB' => 'cviRoutedVlanIfIndex',
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::IEEE802dot11::MUNGE,
|
||||
%SNMP::Info::Layer2::MUNGE,
|
||||
%SNMP::Info::Entity::MUNGE,
|
||||
%SNMP::Info::EtherLike::MUNGE,
|
||||
%SNMP::Info::CiscoStats::MUNGE,
|
||||
%SNMP::Info::CDP::MUNGE,
|
||||
'cd11_txrate' => \&munge_cd11_txrate,
|
||||
'mbss_mac_addr' => \&SNMP::Info::munge_mac,
|
||||
);
|
||||
%MUNGE = (
|
||||
%SNMP::Info::IEEE802dot11::MUNGE,
|
||||
%SNMP::Info::Layer2::MUNGE,
|
||||
%SNMP::Info::Entity::MUNGE,
|
||||
%SNMP::Info::EtherLike::MUNGE,
|
||||
%SNMP::Info::CiscoStats::MUNGE,
|
||||
%SNMP::Info::CDP::MUNGE,
|
||||
'cd11_txrate' => \&munge_cd11_txrate,
|
||||
'mbss_mac_addr' => \&SNMP::Info::munge_mac,
|
||||
);
|
||||
|
||||
# Use 802.11 power level without putting IEEE802dot11 in @ISA
|
||||
*SNMP::Info::Layer2::Aironet::dot11_cur_tx_pwr_mw =
|
||||
\&SNMP::Info::IEEE802dot11::dot11_cur_tx_pwr_mw;
|
||||
*SNMP::Info::Layer2::Aironet::dot11_cur_tx_pwr_mw
|
||||
= \&SNMP::Info::IEEE802dot11::dot11_cur_tx_pwr_mw;
|
||||
|
||||
sub vendor {
|
||||
|
||||
# Sorry, but it's true.
|
||||
return 'cisco';
|
||||
}
|
||||
@@ -128,7 +130,7 @@ sub interfaces {
|
||||
# Tag on e_descr.1
|
||||
sub description {
|
||||
my $aironet = shift;
|
||||
my $descr = $aironet->descr();
|
||||
my $descr = $aironet->descr();
|
||||
my $e_descr = $aironet->e_descr();
|
||||
|
||||
$descr = "$e_descr->{1} $descr" if defined $e_descr->{1};
|
||||
@@ -144,7 +146,7 @@ sub i_duplex {
|
||||
my $el_duplex = $aironet->el_duplex($partial);
|
||||
|
||||
my %i_duplex;
|
||||
foreach my $d (keys %$el_duplex){
|
||||
foreach my $d ( keys %$el_duplex ) {
|
||||
my $val = $el_duplex->{$d};
|
||||
next unless defined $val;
|
||||
$i_duplex{$d} = 'full' if $val =~ /full/i;
|
||||
@@ -162,9 +164,12 @@ sub i_duplex {
|
||||
# Q-BRIDGE-MIB dot1qTpFdbTable but that was removed in 12.3.
|
||||
sub _aironet_special {
|
||||
my $aironet = shift;
|
||||
my $os_ver = $aironet->os_ver();
|
||||
if (defined($os_ver) && $os_ver =~ /^(\d+)\.(\d+)(\D|$)/ && (($1 == 12 && $2 >= 3) || $1 > 12)) {
|
||||
return 1;
|
||||
my $os_ver = $aironet->os_ver();
|
||||
if ( defined($os_ver)
|
||||
&& $os_ver =~ /^(\d+)\.(\d+)(\D|$)/
|
||||
&& ( ( $1 == 12 && $2 >= 3 ) || $1 > 12 ) )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,12 +178,12 @@ sub _aironet_special {
|
||||
sub _aironet_breakout_dot11idx {
|
||||
my $oid = shift;
|
||||
|
||||
my @parts = split(/\./, $oid);
|
||||
my @parts = split( /\./, $oid );
|
||||
my $ifindex = shift(@parts);
|
||||
my $ssidlen = shift(@parts);
|
||||
my $ssid = pack("C*", splice(@parts, 0, $ssidlen));
|
||||
my $mac = join(":", map {sprintf "%02x", $_} @parts);
|
||||
return ($ifindex, $ssid, $mac);
|
||||
my $ssid = pack( "C*", splice( @parts, 0, $ssidlen ) );
|
||||
my $mac = join( ":", map { sprintf "%02x", $_ } @parts );
|
||||
return ( $ifindex, $ssid, $mac );
|
||||
}
|
||||
|
||||
sub fw_mac {
|
||||
@@ -186,11 +191,11 @@ sub fw_mac {
|
||||
|
||||
return qb_fw_mac($aironet) unless _aironet_special($aironet);
|
||||
my $c_dot11subif = $aironet->c_dot11subif();
|
||||
my $fw_mac = {};
|
||||
my $fw_mac = {};
|
||||
|
||||
foreach my $i (keys %$c_dot11subif) {
|
||||
my ($ifindex, $ssid, $mac) = _aironet_breakout_dot11idx($i);
|
||||
$fw_mac->{$i} = $mac;
|
||||
foreach my $i ( keys %$c_dot11subif ) {
|
||||
my ( $ifindex, $ssid, $mac ) = _aironet_breakout_dot11idx($i);
|
||||
$fw_mac->{$i} = $mac;
|
||||
}
|
||||
return $fw_mac;
|
||||
}
|
||||
@@ -200,11 +205,11 @@ sub fw_port {
|
||||
|
||||
return $aironet->qb_fw_port() unless _aironet_special($aironet);
|
||||
my $c_dot11subif = $aironet->c_dot11subif();
|
||||
my $fw_port = {};
|
||||
my $fw_port = {};
|
||||
|
||||
foreach my $i (keys %$c_dot11subif) {
|
||||
my ($ifindex, $ssid, $mac) = _aironet_breakout_dot11idx($i);
|
||||
$fw_port->{$i} = $c_dot11subif->{$i} || $ifindex;
|
||||
foreach my $i ( keys %$c_dot11subif ) {
|
||||
my ( $ifindex, $ssid, $mac ) = _aironet_breakout_dot11idx($i);
|
||||
$fw_port->{$i} = $c_dot11subif->{$i} || $ifindex;
|
||||
}
|
||||
return $fw_port;
|
||||
}
|
||||
@@ -214,12 +219,12 @@ sub bp_index {
|
||||
|
||||
return $aironet->orig_bp_index() unless _aironet_special($aironet);
|
||||
my $c_dot11subif = $aironet->c_dot11subif();
|
||||
my $bp_index = {};
|
||||
my $bp_index = {};
|
||||
|
||||
foreach my $i (keys %$c_dot11subif) {
|
||||
my ($ifindex, $ssid, $mac) = _aironet_breakout_dot11idx($i);
|
||||
my ($i) = $c_dot11subif->{$i} || $ifindex;
|
||||
$bp_index->{$i} = $i;
|
||||
foreach my $i ( keys %$c_dot11subif ) {
|
||||
my ( $ifindex, $ssid, $mac ) = _aironet_breakout_dot11idx($i);
|
||||
my ($i) = $c_dot11subif->{$i} || $ifindex;
|
||||
$bp_index->{$i} = $i;
|
||||
}
|
||||
return $bp_index;
|
||||
}
|
||||
@@ -231,14 +236,14 @@ sub bp_index {
|
||||
sub v_name {
|
||||
my $aironet = shift;
|
||||
|
||||
my $v_name = {};
|
||||
my $v_name = {};
|
||||
my $vlan_nameid = $aironet->cdot11SecVlanNameId();
|
||||
foreach my $i (keys %$vlan_nameid) {
|
||||
my @parts = split(/\./, $i);
|
||||
my $namelen = shift(@parts);
|
||||
foreach my $i ( keys %$vlan_nameid ) {
|
||||
my @parts = split( /\./, $i );
|
||||
my $namelen = shift(@parts);
|
||||
|
||||
my $name = pack("C*", @parts);
|
||||
$v_name->{$i} = $name;
|
||||
my $name = pack( "C*", @parts );
|
||||
$v_name->{$i} = $name;
|
||||
}
|
||||
return $v_name;
|
||||
}
|
||||
@@ -254,9 +259,9 @@ sub i_vlan {
|
||||
|
||||
my $i_vlan = {};
|
||||
my $idxmap = $aironet->cviRoutedVlanIfIndex();
|
||||
foreach my $i (keys %$idxmap) {
|
||||
my @parts = split(/\./, $i);
|
||||
$i_vlan->{$idxmap->{$i}} = $parts[0];
|
||||
foreach my $i ( keys %$idxmap ) {
|
||||
my @parts = split( /\./, $i );
|
||||
$i_vlan->{ $idxmap->{$i} } = $parts[0];
|
||||
}
|
||||
return $i_vlan;
|
||||
}
|
||||
@@ -265,46 +270,46 @@ sub i_vlan {
|
||||
# 5.5Mbps is reported as 11.
|
||||
sub munge_cd11_txrate {
|
||||
my $txrates = shift;
|
||||
my @units = unpack("C*", $txrates);
|
||||
my @rates = map {
|
||||
my $unit = $_;
|
||||
$unit *= 0.5;
|
||||
} @units;
|
||||
my @units = unpack( "C*", $txrates );
|
||||
my @rates = map {
|
||||
my $unit = $_;
|
||||
$unit *= 0.5;
|
||||
} @units;
|
||||
|
||||
return \@rates;
|
||||
}
|
||||
|
||||
# cd11 INDEX
|
||||
sub cd11_port {
|
||||
my $aironet = shift;
|
||||
my $aironet = shift;
|
||||
my $cd11_sigstrength = $aironet->cd11_sigstrength();
|
||||
my $interfaces = $aironet->interfaces();
|
||||
my $interfaces = $aironet->interfaces();
|
||||
my %ret;
|
||||
foreach (keys %$cd11_sigstrength) {
|
||||
my ($ifindex, $ssid, $mac) = _aironet_breakout_dot11idx($_);
|
||||
$ret{$_} = $interfaces->{$ifindex};
|
||||
foreach ( keys %$cd11_sigstrength ) {
|
||||
my ( $ifindex, $ssid, $mac ) = _aironet_breakout_dot11idx($_);
|
||||
$ret{$_} = $interfaces->{$ifindex};
|
||||
}
|
||||
return \%ret;
|
||||
}
|
||||
|
||||
sub cd11_ssid {
|
||||
my $aironet = shift;
|
||||
my $aironet = shift;
|
||||
my $cd11_sigstrength = $aironet->cd11_sigstrength();
|
||||
my %ret;
|
||||
foreach (keys %$cd11_sigstrength) {
|
||||
my ($ifindex, $ssid, $mac) = _aironet_breakout_dot11idx($_);
|
||||
$ret{$_} = $ssid;
|
||||
foreach ( keys %$cd11_sigstrength ) {
|
||||
my ( $ifindex, $ssid, $mac ) = _aironet_breakout_dot11idx($_);
|
||||
$ret{$_} = $ssid;
|
||||
}
|
||||
return \%ret;
|
||||
}
|
||||
|
||||
sub cd11_mac {
|
||||
my $aironet = shift;
|
||||
my $aironet = shift;
|
||||
my $cd11_sigstrength = $aironet->cd11_sigstrength();
|
||||
my %ret;
|
||||
foreach (keys %$cd11_sigstrength) {
|
||||
my ($ifindex, $ssid, $mac) = _aironet_breakout_dot11idx($_);
|
||||
$ret{$_} = $mac;
|
||||
foreach ( keys %$cd11_sigstrength ) {
|
||||
my ( $ifindex, $ssid, $mac ) = _aironet_breakout_dot11idx($_);
|
||||
$ret{$_} = $mac;
|
||||
}
|
||||
return \%ret;
|
||||
}
|
||||
@@ -316,6 +321,7 @@ sub cd11_mac {
|
||||
# to get the right overrides.
|
||||
sub i_mac {
|
||||
my $aironet = shift;
|
||||
|
||||
# no partial is possible due to the levels
|
||||
# of indirection.
|
||||
|
||||
@@ -323,41 +329,40 @@ sub i_mac {
|
||||
my $mbss_mac = $aironet->orig_i_mac();
|
||||
|
||||
my $mbss_mac_addr = $aironet->mbss_mac_addr();
|
||||
my $ssid_vlan = $aironet->cdot11SecAuxSsidVlan();
|
||||
my $vlan_map = $aironet->cviRoutedVlanIfIndex();
|
||||
my $ifstack = $aironet->ifStackStatus();
|
||||
my $ssid_vlan = $aironet->cdot11SecAuxSsidVlan();
|
||||
my $vlan_map = $aironet->cviRoutedVlanIfIndex();
|
||||
my $ifstack = $aironet->ifStackStatus();
|
||||
|
||||
my $vlan_list = {};
|
||||
foreach my $idx (keys %$vlan_map) {
|
||||
my ($vlan, $num) = split(/\./, $idx);
|
||||
push(@{$vlan_list->{$vlan}}, $vlan_map->{$idx});
|
||||
foreach my $idx ( keys %$vlan_map ) {
|
||||
my ( $vlan, $num ) = split( /\./, $idx );
|
||||
push( @{ $vlan_list->{$vlan} }, $vlan_map->{$idx} );
|
||||
}
|
||||
|
||||
my $stack = {};
|
||||
foreach my $idx (keys %$ifstack) {
|
||||
my ($upper, $lower) = split(/\./, $idx);
|
||||
$stack->{$upper}->{$lower} = $ifstack->{$idx};
|
||||
foreach my $idx ( keys %$ifstack ) {
|
||||
my ( $upper, $lower ) = split( /\./, $idx );
|
||||
$stack->{$upper}->{$lower} = $ifstack->{$idx};
|
||||
}
|
||||
|
||||
# mbss_mac_addr index is (radio, ssid).
|
||||
# ssid_vlan maps ssid->vlan.
|
||||
# vlan_map maps vlan->[list of interfaces]
|
||||
# ifstack allows us to pick the right interface
|
||||
foreach my $idx (keys %$mbss_mac_addr) {
|
||||
my ($interface, @ssid) = split(/\./, $idx);
|
||||
my $vlan = $ssid_vlan->{join(".", scalar(@ssid), @ssid)};
|
||||
next unless defined($vlan);
|
||||
foreach my $vlanif (@{$vlan_list->{$vlan}}) {
|
||||
if (defined($stack->{$vlanif}->{$interface})) {
|
||||
$mbss_mac->{$vlanif} = $mbss_mac_addr->{$idx};
|
||||
}
|
||||
}
|
||||
foreach my $idx ( keys %$mbss_mac_addr ) {
|
||||
my ( $interface, @ssid ) = split( /\./, $idx );
|
||||
my $vlan = $ssid_vlan->{ join( ".", scalar(@ssid), @ssid ) };
|
||||
next unless defined($vlan);
|
||||
foreach my $vlanif ( @{ $vlan_list->{$vlan} } ) {
|
||||
if ( defined( $stack->{$vlanif}->{$interface} ) ) {
|
||||
$mbss_mac->{$vlanif} = $mbss_mac_addr->{$idx};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $mbss_mac;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
|
||||
@@ -3,21 +3,21 @@
|
||||
#
|
||||
# Copyright (c) 2008 Max Baker
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
#
|
||||
# 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
|
||||
# * 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
|
||||
#
|
||||
# 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
|
||||
@@ -35,32 +35,28 @@ use Exporter;
|
||||
use SNMP::Info::Layer2;
|
||||
use SNMP::Info::Layer1;
|
||||
|
||||
@SNMP::Info::Layer2::Allied::ISA = qw/SNMP::Info::Layer2 Exporter/;
|
||||
@SNMP::Info::Layer2::Allied::ISA = qw/SNMP::Info::Layer2 Exporter/;
|
||||
@SNMP::Info::Layer2::Allied::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
|
||||
|
||||
$VERSION = '1.09';
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer2::GLOBALS
|
||||
);
|
||||
%GLOBALS = ( %SNMP::Info::Layer2::GLOBALS );
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer2::FUNCS,
|
||||
'ip_adresses'=> 'atNetAddress',
|
||||
'ip_mac' => 'atPhysAddress',
|
||||
);
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer2::FUNCS,
|
||||
'ip_adresses' => 'atNetAddress',
|
||||
'ip_mac' => 'atPhysAddress',
|
||||
);
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer2::MIBS,
|
||||
'AtiSwitch-MIB' => 'atiswitchProductType',
|
||||
'AtiStackInfo-MIB' => 'atiswitchEnhancedStacking',
|
||||
);
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer2::MIBS,
|
||||
'AtiSwitch-MIB' => 'atiswitchProductType',
|
||||
'AtiStackInfo-MIB' => 'atiswitchEnhancedStacking',
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer2::MUNGE,
|
||||
);
|
||||
%MUNGE = ( %SNMP::Info::Layer2::MUNGE, );
|
||||
|
||||
sub vendor {
|
||||
return 'allied';
|
||||
@@ -72,9 +68,9 @@ sub os {
|
||||
|
||||
sub os_ver {
|
||||
my $allied = shift;
|
||||
my $descr = $allied->description();
|
||||
|
||||
if ($descr =~ m/version (\d+\.\d+)/){
|
||||
my $descr = $allied->description();
|
||||
|
||||
if ( $descr =~ m/version (\d+\.\d+)/ ) {
|
||||
return $1;
|
||||
}
|
||||
}
|
||||
@@ -84,48 +80,48 @@ sub model {
|
||||
|
||||
my $desc = $allied->description();
|
||||
|
||||
if ($desc =~ /(AT-80\d{2}\S*)/){
|
||||
if ( $desc =~ /(AT-80\d{2}\S*)/ ) {
|
||||
return $1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sub root_ip {
|
||||
my $allied = shift;
|
||||
my $allied = shift;
|
||||
my $ip_hash = $allied->ip_addresses();
|
||||
my $found_ip;
|
||||
|
||||
foreach my $ip (values %{$ip_hash}) {
|
||||
$found_ip = SNMP::Info::munge_ip($ip) if (defined $ip);
|
||||
last; # this is only one IP address
|
||||
|
||||
foreach my $ip ( values %{$ip_hash} ) {
|
||||
$found_ip = SNMP::Info::munge_ip($ip) if ( defined $ip );
|
||||
last; # this is only one IP address
|
||||
}
|
||||
return $found_ip;
|
||||
}
|
||||
|
||||
sub mac{
|
||||
my $allied = shift;
|
||||
sub mac {
|
||||
my $allied = shift;
|
||||
my $mac_hash = $allied->ip_mac();
|
||||
my $found_mac;
|
||||
|
||||
foreach my $mac (values %{$mac_hash}) {
|
||||
|
||||
foreach my $mac ( values %{$mac_hash} ) {
|
||||
$found_mac = SNMP::Info::munge_mac($mac);
|
||||
last; # this is only one MAC address
|
||||
last; # this is only one MAC address
|
||||
}
|
||||
return $found_mac;
|
||||
}
|
||||
|
||||
sub i_up {
|
||||
my $allied = shift;
|
||||
my $allied = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $i_up = SNMP::Info::Layer1::i_up($allied, $partial);
|
||||
my $i_up = SNMP::Info::Layer1::i_up( $allied, $partial );
|
||||
|
||||
foreach my $port (keys %$i_up){
|
||||
foreach my $port ( keys %$i_up ) {
|
||||
my $up = $i_up->{$port};
|
||||
$i_up->{$port} = 'down' if $up eq 'linktesterror';
|
||||
$i_up->{$port} = 'up' if $up eq 'nolinktesterror';
|
||||
$i_up->{$port} = 'up' if $up eq 'nolinktesterror';
|
||||
}
|
||||
|
||||
|
||||
return $i_up;
|
||||
}
|
||||
1;
|
||||
|
||||
@@ -4,20 +4,20 @@
|
||||
# Copyright (c) 2008 Eric Miller
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# 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
|
||||
# * 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
|
||||
#
|
||||
# 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
|
||||
@@ -34,48 +34,47 @@ use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer2;
|
||||
|
||||
@SNMP::Info::Layer2::Aruba::ISA = qw/SNMP::Info::Layer2 Exporter/;
|
||||
@SNMP::Info::Layer2::Aruba::ISA = qw/SNMP::Info::Layer2 Exporter/;
|
||||
@SNMP::Info::Layer2::Aruba::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
|
||||
|
||||
$VERSION = '1.09';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer2::MIBS,
|
||||
'WLSX-SWITCH-MIB' => 'wlsxHostname',
|
||||
'WLSR-AP-MIB' => 'wlsrHideSSID',
|
||||
);
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer2::MIBS,
|
||||
'WLSX-SWITCH-MIB' => 'wlsxHostname',
|
||||
'WLSR-AP-MIB' => 'wlsrHideSSID',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer2::GLOBALS,
|
||||
);
|
||||
%GLOBALS = ( %SNMP::Info::Layer2::GLOBALS, );
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer2::FUNCS,
|
||||
# WLSX-SWITCH-MIB::wlsxSwitchAccessPointTable
|
||||
# Table index leafs do not return information
|
||||
# therefore unable to use apBSSID. We extract
|
||||
# the information from the IID instead.
|
||||
'aruba_ap_name' => 'apLocation',
|
||||
'aruba_ap_ip' => 'apIpAddress',
|
||||
'aruba_ap_essid' => 'apESSID',
|
||||
'aruba_ap_ssidbcast' => 'wlsrHideSSID',
|
||||
# WLSR-AP-MIB::wlsrConfigTable
|
||||
'aruba_ap_channel' => 'apCurrentChannel',
|
||||
# WLSX-SWITCH-MIB::wlsxSwitchStationMgmtTable
|
||||
# Table index leafs do not return information
|
||||
# therefore unable to use staAccessPointBSSID
|
||||
# or staPhyAddress. We extract the information from
|
||||
# the IID instead.
|
||||
#'fw_port' => 'staAccessPointBSSID',
|
||||
#'fw_mac' => 'staPhyAddress',
|
||||
'fw_user' => 'staUserName',
|
||||
);
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer2::FUNCS,
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer2::MUNGE,
|
||||
);
|
||||
# WLSX-SWITCH-MIB::wlsxSwitchAccessPointTable
|
||||
# Table index leafs do not return information
|
||||
# therefore unable to use apBSSID. We extract
|
||||
# the information from the IID instead.
|
||||
'aruba_ap_name' => 'apLocation',
|
||||
'aruba_ap_ip' => 'apIpAddress',
|
||||
'aruba_ap_essid' => 'apESSID',
|
||||
'aruba_ap_ssidbcast' => 'wlsrHideSSID',
|
||||
|
||||
# WLSR-AP-MIB::wlsrConfigTable
|
||||
'aruba_ap_channel' => 'apCurrentChannel',
|
||||
|
||||
# WLSX-SWITCH-MIB::wlsxSwitchStationMgmtTable
|
||||
# Table index leafs do not return information
|
||||
# therefore unable to use staAccessPointBSSID
|
||||
# or staPhyAddress. We extract the information from
|
||||
# the IID instead.
|
||||
#'fw_port' => 'staAccessPointBSSID',
|
||||
#'fw_mac' => 'staPhyAddress',
|
||||
'fw_user' => 'staUserName',
|
||||
);
|
||||
|
||||
%MUNGE = ( %SNMP::Info::Layer2::MUNGE, );
|
||||
|
||||
sub layers {
|
||||
return '00000011';
|
||||
@@ -94,7 +93,7 @@ sub os_ver {
|
||||
my $descr = $aruba->description();
|
||||
return unless defined $descr;
|
||||
|
||||
if ($descr =~ m/Version\s+(\d+\.\d+\.\d+\.\d+)/){
|
||||
if ( $descr =~ m/Version\s+(\d+\.\d+\.\d+\.\d+)/ ) {
|
||||
return $1;
|
||||
}
|
||||
|
||||
@@ -103,7 +102,7 @@ sub os_ver {
|
||||
|
||||
sub model {
|
||||
my $aruba = shift;
|
||||
my $id = $aruba->id();
|
||||
my $id = $aruba->id();
|
||||
return unless defined $id;
|
||||
my $model = &SNMP::translateObj($id);
|
||||
return $id unless defined $model;
|
||||
@@ -114,14 +113,14 @@ sub model {
|
||||
# Thin APs do not support ifMIB requirement
|
||||
|
||||
sub i_index {
|
||||
my $aruba = shift;
|
||||
my $aruba = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $i_index = $aruba->orig_i_index($partial) || {};
|
||||
my $ap_index = $aruba->aruba_ap_name($partial) || {};
|
||||
|
||||
my $i_index = $aruba->orig_i_index($partial) || {};
|
||||
my $ap_index = $aruba->aruba_ap_name($partial) || {};
|
||||
|
||||
my %if_index;
|
||||
foreach my $iid (keys %$i_index){
|
||||
foreach my $iid ( keys %$i_index ) {
|
||||
my $index = $i_index->{$iid};
|
||||
next unless defined $index;
|
||||
|
||||
@@ -129,9 +128,11 @@ sub i_index {
|
||||
}
|
||||
|
||||
# Get Attached APs as Interfaces
|
||||
foreach my $ap_id (keys %$ap_index){
|
||||
foreach my $ap_id ( keys %$ap_index ) {
|
||||
|
||||
# Convert the 0.254.123.456 index entry to a MAC address.
|
||||
my $mac = join(':',map {sprintf("%02x",$_)} split(/\./,$ap_id));
|
||||
my $mac = join( ':',
|
||||
map { sprintf( "%02x", $_ ) } split( /\./, $ap_id ) );
|
||||
|
||||
$if_index{$ap_id} = $mac;
|
||||
}
|
||||
@@ -139,27 +140,28 @@ sub i_index {
|
||||
}
|
||||
|
||||
sub interfaces {
|
||||
my $aruba = shift;
|
||||
my $aruba = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $i_index = $aruba->i_index($partial) || {};
|
||||
my $i_descr = $aruba->i_description($partial) || {};
|
||||
my $i_index = $aruba->i_index($partial) || {};
|
||||
my $i_descr = $aruba->i_description($partial) || {};
|
||||
|
||||
my %if;
|
||||
foreach my $iid (keys %$i_index){
|
||||
foreach my $iid ( keys %$i_index ) {
|
||||
my $index = $i_index->{$iid};
|
||||
next unless defined $index;
|
||||
|
||||
if ($index =~ /^\d+$/ ) {
|
||||
# Replace the Index with the ifDescr field.
|
||||
my $port = $i_descr->{$iid};
|
||||
next unless defined $port;
|
||||
$if{$iid} = $port;
|
||||
if ( $index =~ /^\d+$/ ) {
|
||||
|
||||
# Replace the Index with the ifDescr field.
|
||||
my $port = $i_descr->{$iid};
|
||||
next unless defined $port;
|
||||
$if{$iid} = $port;
|
||||
}
|
||||
|
||||
elsif ($index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/) {
|
||||
$if{$index} = $index;
|
||||
}
|
||||
elsif ( $index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/ ) {
|
||||
$if{$index} = $index;
|
||||
}
|
||||
|
||||
else {
|
||||
next;
|
||||
@@ -169,120 +171,119 @@ sub interfaces {
|
||||
}
|
||||
|
||||
sub i_name {
|
||||
my $aruba = shift;
|
||||
my $aruba = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $i_index = $aruba->i_index($partial) || {};
|
||||
my $i_name2 = $aruba->orig_i_name($partial) || {};
|
||||
my $ap_name = $aruba->aruba_ap_name($partial) || {};
|
||||
|
||||
my $i_index = $aruba->i_index($partial) || {};
|
||||
my $i_name2 = $aruba->orig_i_name($partial) || {};
|
||||
my $ap_name = $aruba->aruba_ap_name($partial) || {};
|
||||
|
||||
my %i_name;
|
||||
foreach my $iid (keys %$i_index){
|
||||
foreach my $iid ( keys %$i_index ) {
|
||||
my $index = $i_index->{$iid};
|
||||
next unless defined $index;
|
||||
|
||||
if ($index =~ /^\d+$/ ) {
|
||||
my $name = $i_name2->{$iid};
|
||||
next unless defined $name;
|
||||
$i_name{$index} = $name;
|
||||
if ( $index =~ /^\d+$/ ) {
|
||||
my $name = $i_name2->{$iid};
|
||||
next unless defined $name;
|
||||
$i_name{$index} = $name;
|
||||
}
|
||||
|
||||
elsif ($index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/) {
|
||||
my $name = $ap_name->{$iid};
|
||||
next unless defined $name;
|
||||
$i_name{$index} = $name;
|
||||
}
|
||||
elsif ( $index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/ ) {
|
||||
my $name = $ap_name->{$iid};
|
||||
next unless defined $name;
|
||||
$i_name{$index} = $name;
|
||||
}
|
||||
else {
|
||||
next;
|
||||
}
|
||||
}
|
||||
return \%i_name;
|
||||
return \%i_name;
|
||||
}
|
||||
|
||||
sub i_ssidlist {
|
||||
my $aruba = shift;
|
||||
my $aruba = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $i_index = $aruba->i_index($partial) || {};
|
||||
my $ap_ssid = $aruba->aruba_ap_essid($partial) || {};
|
||||
|
||||
my $i_index = $aruba->i_index($partial) || {};
|
||||
my $ap_ssid = $aruba->aruba_ap_essid($partial) || {};
|
||||
|
||||
my %i_ssid;
|
||||
foreach my $iid (keys %$i_index){
|
||||
foreach my $iid ( keys %$i_index ) {
|
||||
my $index = $i_index->{$iid};
|
||||
next unless defined $index;
|
||||
|
||||
if ($index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/) {
|
||||
my $ssid = $ap_ssid->{$iid};
|
||||
next unless defined $ssid;
|
||||
$i_ssid{$index} = $ssid;
|
||||
}
|
||||
if ( $index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/ ) {
|
||||
my $ssid = $ap_ssid->{$iid};
|
||||
next unless defined $ssid;
|
||||
$i_ssid{$index} = $ssid;
|
||||
}
|
||||
else {
|
||||
next;
|
||||
}
|
||||
}
|
||||
return \%i_ssid;
|
||||
return \%i_ssid;
|
||||
}
|
||||
|
||||
sub i_80211channel {
|
||||
my $aruba = shift;
|
||||
my $aruba = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $i_index = $aruba->i_index($partial) || {};
|
||||
my $ap_ch = $aruba->aruba_ap_channel($partial) || {};
|
||||
|
||||
my $i_index = $aruba->i_index($partial) || {};
|
||||
my $ap_ch = $aruba->aruba_ap_channel($partial) || {};
|
||||
|
||||
my %i_ch;
|
||||
foreach my $iid (keys %$i_index){
|
||||
foreach my $iid ( keys %$i_index ) {
|
||||
my $index = $i_index->{$iid};
|
||||
next unless defined $index;
|
||||
|
||||
if ($index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/) {
|
||||
my $ch = $ap_ch->{$iid};
|
||||
next unless defined $ch;
|
||||
$i_ch{$index} = $ch;
|
||||
}
|
||||
if ( $index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/ ) {
|
||||
my $ch = $ap_ch->{$iid};
|
||||
next unless defined $ch;
|
||||
$i_ch{$index} = $ch;
|
||||
}
|
||||
else {
|
||||
next;
|
||||
}
|
||||
}
|
||||
return \%i_ch;
|
||||
return \%i_ch;
|
||||
}
|
||||
|
||||
sub i_ssidbcast {
|
||||
my $aruba = shift;
|
||||
my $aruba = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $i_index = $aruba->i_index($partial) || {};
|
||||
my $ap_bc = $aruba->aruba_ap_ssidbcast($partial) || {};
|
||||
|
||||
my $i_index = $aruba->i_index($partial) || {};
|
||||
my $ap_bc = $aruba->aruba_ap_ssidbcast($partial) || {};
|
||||
|
||||
my %i_bc;
|
||||
foreach my $iid (keys %$i_index){
|
||||
foreach my $iid ( keys %$i_index ) {
|
||||
my $index = $i_index->{$iid};
|
||||
next unless defined $index;
|
||||
|
||||
if ($index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/) {
|
||||
my $bc = $ap_bc->{$iid};
|
||||
next unless defined $bc;
|
||||
$bc = ($bc ? 0 : 1);
|
||||
$i_bc{$index} = $bc;
|
||||
}
|
||||
if ( $index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/ ) {
|
||||
my $bc = $ap_bc->{$iid};
|
||||
next unless defined $bc;
|
||||
$bc = ( $bc ? 0 : 1 );
|
||||
$i_bc{$index} = $bc;
|
||||
}
|
||||
else {
|
||||
next;
|
||||
}
|
||||
}
|
||||
return \%i_bc;
|
||||
return \%i_bc;
|
||||
}
|
||||
|
||||
|
||||
# Wireless switches do not support the standard Bridge MIB
|
||||
sub bp_index {
|
||||
my $aruba = shift;
|
||||
my $aruba = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $i_index = $aruba->orig_i_index($partial) || {};
|
||||
my $ap_index = $aruba->aruba_ap_name($partial) || {};
|
||||
|
||||
my $i_index = $aruba->orig_i_index($partial) || {};
|
||||
my $ap_index = $aruba->aruba_ap_name($partial) || {};
|
||||
|
||||
my %bp_index;
|
||||
foreach my $iid (keys %$i_index){
|
||||
foreach my $iid ( keys %$i_index ) {
|
||||
my $index = $i_index->{$iid};
|
||||
next unless defined $index;
|
||||
|
||||
@@ -290,9 +291,11 @@ sub bp_index {
|
||||
}
|
||||
|
||||
# Get Attached APs as Interfaces
|
||||
foreach my $ap_id (keys %$ap_index){
|
||||
foreach my $ap_id ( keys %$ap_index ) {
|
||||
|
||||
# Convert the 0.254.123.456 index entry to a MAC address.
|
||||
my $mac = join(':',map {sprintf("%02x",$_)} split(/\./,$ap_id));
|
||||
my $mac = join( ':',
|
||||
map { sprintf( "%02x", $_ ) } split( /\./, $ap_id ) );
|
||||
|
||||
$bp_index{$mac} = $mac;
|
||||
}
|
||||
@@ -300,39 +303,47 @@ sub bp_index {
|
||||
}
|
||||
|
||||
sub fw_port {
|
||||
my $aruba = shift;
|
||||
my $aruba = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $fw_idx = $aruba->fw_user($partial) || {};
|
||||
|
||||
my %fw_port;
|
||||
foreach my $iid (keys %$fw_idx){
|
||||
if ($iid =~ /(\d+\.\d+\.\d+\.\d+\.\d+\.\d+).(\d+\.\d+\.\d+\.\d+\.\d+\.\d+)/) {
|
||||
my $port = join(':',map {sprintf("%02x",$_)} split(/\./,$2));
|
||||
$fw_port{$iid} = $port;
|
||||
}
|
||||
else {
|
||||
next;
|
||||
}
|
||||
foreach my $iid ( keys %$fw_idx ) {
|
||||
if ( $iid
|
||||
=~ /(\d+\.\d+\.\d+\.\d+\.\d+\.\d+).(\d+\.\d+\.\d+\.\d+\.\d+\.\d+)/
|
||||
)
|
||||
{
|
||||
my $port = join( ':',
|
||||
map { sprintf( "%02x", $_ ) } split( /\./, $2 ) );
|
||||
$fw_port{$iid} = $port;
|
||||
}
|
||||
else {
|
||||
next;
|
||||
}
|
||||
}
|
||||
return \%fw_port;
|
||||
}
|
||||
|
||||
sub fw_mac {
|
||||
my $aruba = shift;
|
||||
my $aruba = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $fw_idx = $aruba->fw_user($partial) || {};
|
||||
|
||||
my %fw_mac;
|
||||
foreach my $iid (keys %$fw_idx){
|
||||
if ($iid =~ /(\d+\.\d+\.\d+\.\d+\.\d+\.\d+).(\d+\.\d+\.\d+\.\d+\.\d+\.\d+)/) {
|
||||
my $mac = join(':',map {sprintf("%02x",$_)} split(/\./,$1));
|
||||
$fw_mac{$iid} = $mac;
|
||||
}
|
||||
else {
|
||||
next;
|
||||
}
|
||||
foreach my $iid ( keys %$fw_idx ) {
|
||||
if ( $iid
|
||||
=~ /(\d+\.\d+\.\d+\.\d+\.\d+\.\d+).(\d+\.\d+\.\d+\.\d+\.\d+\.\d+)/
|
||||
)
|
||||
{
|
||||
my $mac = join( ':',
|
||||
map { sprintf( "%02x", $_ ) } split( /\./, $1 ) );
|
||||
$fw_mac{$iid} = $mac;
|
||||
}
|
||||
else {
|
||||
next;
|
||||
}
|
||||
}
|
||||
return \%fw_mac;
|
||||
}
|
||||
@@ -366,10 +377,10 @@ Eric Miller
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
SNMP::Info::Layer2::Aruba is a subclass of SNMP::Info that provides an interface
|
||||
to Aruba wireless switches. The Aruba platform utilizes intelligent wireless
|
||||
switches which control thin access points. The thin access points themselves
|
||||
are unable to be polled for end station information.
|
||||
SNMP::Info::Layer2::Aruba is a subclass of SNMP::Info that provides an
|
||||
interface to Aruba wireless switches. The Aruba platform utilizes
|
||||
intelligent wireless switches which control thin access points. The thin
|
||||
access points themselves are unable to be polled for end station information.
|
||||
|
||||
This class emulates bridge functionality for the wireless switch. This enables
|
||||
end station MAC addresses collection and correlation to the thin access point
|
||||
@@ -464,8 +475,8 @@ interfaces. The thin AP MAC address is used as the port identifier.
|
||||
|
||||
=item $aruba->i_name()
|
||||
|
||||
Interface name. Returns (C<ifName>) for Ethernet interfaces and (C<apLocation>)
|
||||
for thin AP interfaces.
|
||||
Interface name. Returns (C<ifName>) for Ethernet interfaces and
|
||||
(C<apLocation>) for thin AP interfaces.
|
||||
|
||||
=item $aruba->bp_index()
|
||||
|
||||
|
||||
@@ -6,21 +6,21 @@
|
||||
#
|
||||
# Copyright (c) 2002,2003 Regents of the University of California
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
#
|
||||
# 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
|
||||
# * 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
|
||||
#
|
||||
# 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
|
||||
@@ -37,7 +37,7 @@ use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer2;
|
||||
|
||||
@SNMP::Info::Layer2::Bay::ISA = qw/SNMP::Info::Layer2 Exporter/;
|
||||
@SNMP::Info::Layer2::Bay::ISA = qw/SNMP::Info::Layer2 Exporter/;
|
||||
@SNMP::Info::Layer2::Bay::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
|
||||
@@ -45,90 +45,93 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
|
||||
$VERSION = '1.09';
|
||||
|
||||
# Set for No CDP
|
||||
%GLOBALS = ( %SNMP::Info::Layer2::GLOBALS,
|
||||
'cdp_id' => 's5EnMsTopIpAddr',
|
||||
'cdp_run' => 's5EnMsTopStatus',
|
||||
);
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer2::GLOBALS,
|
||||
'cdp_id' => 's5EnMsTopIpAddr',
|
||||
'cdp_run' => 's5EnMsTopStatus',
|
||||
);
|
||||
|
||||
%FUNCS = (%SNMP::Info::Layer2::FUNCS,
|
||||
'imac2' => 'ifPhysAddress',
|
||||
# S5-ETH-MULTISEG-TOPOLOGY-MIB::s5EnMsTopNmmTable
|
||||
'bay_topo_slot' => 's5EnMsTopNmmSlot',
|
||||
'bay_topo_port' => 's5EnMsTopNmmPort',
|
||||
'bay_topo_ip' => 's5EnMsTopNmmIpAddr',
|
||||
'bay_topo_seg' => 's5EnMsTopNmmSegId',
|
||||
'bay_topo_mac' => 's5EnMsTopNmmMacAddr',
|
||||
'bay_topo_platform' => 's5EnMsTopNmmChassisType',
|
||||
'bay_topo_localseg' => 's5EnMsTopNmmLocalSeg',
|
||||
);
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer2::FUNCS,
|
||||
'imac2' => 'ifPhysAddress',
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer2::MIBS,
|
||||
'SYNOPTICS-ROOT-MIB' => 'synoptics',
|
||||
'S5-ETH-MULTISEG-TOPOLOGY-MIB' => 's5EnMsTop'
|
||||
);
|
||||
# S5-ETH-MULTISEG-TOPOLOGY-MIB::s5EnMsTopNmmTable
|
||||
'bay_topo_slot' => 's5EnMsTopNmmSlot',
|
||||
'bay_topo_port' => 's5EnMsTopNmmPort',
|
||||
'bay_topo_ip' => 's5EnMsTopNmmIpAddr',
|
||||
'bay_topo_seg' => 's5EnMsTopNmmSegId',
|
||||
'bay_topo_mac' => 's5EnMsTopNmmMacAddr',
|
||||
'bay_topo_platform' => 's5EnMsTopNmmChassisType',
|
||||
'bay_topo_localseg' => 's5EnMsTopNmmLocalSeg',
|
||||
);
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer2::MIBS,
|
||||
'SYNOPTICS-ROOT-MIB' => 'synoptics',
|
||||
'S5-ETH-MULTISEG-TOPOLOGY-MIB' => 's5EnMsTop'
|
||||
);
|
||||
|
||||
delete $MIBS{'CISCO-CDP-MIB'};
|
||||
|
||||
# 450's report full duplex as speed = 20mbps?!
|
||||
$SNMP::Info::SPEED_MAP{20_000_000} = '10 Mbps';
|
||||
$SNMP::Info::SPEED_MAP{20_000_000} = '10 Mbps';
|
||||
$SNMP::Info::SPEED_MAP{200_000_000} = '100 Mbps';
|
||||
|
||||
%MUNGE = (%SNMP::Info::Layer2::MUNGE,
|
||||
'i_mac2' => \&SNMP::Info::munge_mac ,
|
||||
);
|
||||
%MUNGE = ( %SNMP::Info::Layer2::MUNGE, 'i_mac2' => \&SNMP::Info::munge_mac, );
|
||||
|
||||
sub os {
|
||||
return 'bay';
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $bay = shift;
|
||||
my $bay = shift;
|
||||
my $descr = $bay->description();
|
||||
return unless defined $descr;
|
||||
|
||||
# 303 / 304
|
||||
if ($descr =~ m/Rev: \d+\.\d+\.\d+\.\d+-(\d+\.\d+\.\d+\.\d+)/){
|
||||
if ( $descr =~ m/Rev: \d+\.\d+\.\d+\.\d+-(\d+\.\d+\.\d+\.\d+)/ ) {
|
||||
return $1;
|
||||
}
|
||||
|
||||
# 450
|
||||
if ($descr =~ m/SW:v(\d+\.\d+\.\d+\.\d+)/){
|
||||
if ( $descr =~ m/SW:v(\d+\.\d+\.\d+\.\d+)/ ) {
|
||||
return $1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sub os_bin {
|
||||
my $bay = shift;
|
||||
my $bay = shift;
|
||||
my $descr = $bay->description();
|
||||
return unless defined $descr;
|
||||
|
||||
# 303 / 304
|
||||
if ($descr =~ m/Rev: \d+\.(\d+\.\d+\.\d+)-\d+\.\d+\.\d+\.\d+/){
|
||||
if ( $descr =~ m/Rev: \d+\.(\d+\.\d+\.\d+)-\d+\.\d+\.\d+\.\d+/ ) {
|
||||
return $1;
|
||||
}
|
||||
|
||||
# 450
|
||||
if ($descr =~ m/FW:v(\d+\.\d+\.\d+\.\d+)/){
|
||||
if ( $descr =~ m/FW:v(\d+\.\d+\.\d+\.\d+)/ ) {
|
||||
return $1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sub vendor {
|
||||
|
||||
# or nortel, or synopsis?
|
||||
return 'bay';
|
||||
}
|
||||
|
||||
sub i_ignore {
|
||||
my $bay = shift;
|
||||
my $bay = shift;
|
||||
my $descr = $bay->description();
|
||||
|
||||
my $i_type = $bay->i_type();
|
||||
|
||||
my %i_ignore;
|
||||
foreach my $if (keys %$i_type){
|
||||
my $type = $i_type->{$if};
|
||||
foreach my $if ( keys %$i_type ) {
|
||||
my $type = $i_type->{$if};
|
||||
$i_ignore{$if}++ if $type =~ /(loopback|propvirtual|cpu)/i;
|
||||
}
|
||||
|
||||
@@ -136,28 +139,27 @@ sub i_ignore {
|
||||
}
|
||||
|
||||
sub interfaces {
|
||||
my $bay = shift;
|
||||
my $bay = shift;
|
||||
my $i_index = $bay->i_index();
|
||||
|
||||
return $i_index;
|
||||
}
|
||||
|
||||
sub i_mac {
|
||||
my $bay = shift;
|
||||
sub i_mac {
|
||||
my $bay = shift;
|
||||
my $i_mac = $bay->i_mac2();
|
||||
|
||||
# Bay 303's with a hw rev < 2.11.4.5 report the mac as all zeros
|
||||
foreach my $iid (keys %$i_mac){
|
||||
foreach my $iid ( keys %$i_mac ) {
|
||||
my $mac = $i_mac->{$iid};
|
||||
delete $i_mac->{$iid} if $mac eq '00:00:00:00:00:00';
|
||||
}
|
||||
return $i_mac;
|
||||
}
|
||||
|
||||
|
||||
sub model {
|
||||
my $bay = shift;
|
||||
my $id = $bay->id();
|
||||
my $id = $bay->id();
|
||||
return unless defined $id;
|
||||
my $model = &SNMP::translateObj($id);
|
||||
return $id unless defined $model;
|
||||
@@ -165,20 +167,20 @@ sub model {
|
||||
|
||||
my $descr = $bay->description();
|
||||
|
||||
return '303' if ($descr =~ /\D303\D/);
|
||||
return '304' if ($descr =~ /\D304\D/);
|
||||
return '450' if ($model =~ /BayStack450/);
|
||||
return '303' if ( $descr =~ /\D303\D/ );
|
||||
return '304' if ( $descr =~ /\D304\D/ );
|
||||
return '450' if ( $model =~ /BayStack450/ );
|
||||
return $model;
|
||||
}
|
||||
|
||||
# Hack in some CDP type stuff
|
||||
|
||||
sub c_if {
|
||||
my $bay = shift;
|
||||
my $bay = shift;
|
||||
my $bay_topo_port = $bay->bay_topo_port();
|
||||
|
||||
my %c_if;
|
||||
foreach my $entry (keys %$bay_topo_port){
|
||||
foreach my $entry ( keys %$bay_topo_port ) {
|
||||
my $port = $bay_topo_port->{$entry};
|
||||
next unless defined $port;
|
||||
next if $port == 0;
|
||||
@@ -188,29 +190,30 @@ sub c_if {
|
||||
}
|
||||
|
||||
sub c_ip {
|
||||
my $bay = shift;
|
||||
my $bay = shift;
|
||||
my $bay_topo_ip = $bay->bay_topo_ip();
|
||||
my $bay_topo_port = $bay->bay_topo_port();
|
||||
my $ip = $bay->cdp_ip();
|
||||
|
||||
my $ip = $bay->cdp_ip();
|
||||
|
||||
# Count the number of devices seen on each port.
|
||||
# more than one device seen means connected to a non-bay
|
||||
# device, but other bay devices are squawking further away.
|
||||
my %ip_port;
|
||||
foreach my $entry (keys %$bay_topo_ip){
|
||||
foreach my $entry ( keys %$bay_topo_ip ) {
|
||||
my $port = $bay_topo_port->{$entry};
|
||||
next unless defined $port;
|
||||
next if ($port =~ /^[\d\.]+$/ and $port == 0);
|
||||
my $ip = $bay_topo_ip->{$entry};
|
||||
push(@{$ip_port{$port}},$ip);
|
||||
next if ( $port =~ /^[\d\.]+$/ and $port == 0 );
|
||||
my $ip = $bay_topo_ip->{$entry};
|
||||
push( @{ $ip_port{$port} }, $ip );
|
||||
}
|
||||
|
||||
my %c_ip;
|
||||
foreach my $port (keys %ip_port){
|
||||
foreach my $port ( keys %ip_port ) {
|
||||
my $ips = $ip_port{$port};
|
||||
if (scalar @$ips == 1) {
|
||||
if ( scalar @$ips == 1 ) {
|
||||
$c_ip{"$port.1"} = $ips->[0];
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$c_ip{"$port.1"} = $ips;
|
||||
}
|
||||
}
|
||||
@@ -219,12 +222,12 @@ sub c_ip {
|
||||
}
|
||||
|
||||
sub c_port {
|
||||
my $bay = shift;
|
||||
my $bay = shift;
|
||||
my $bay_topo_port = $bay->bay_topo_port();
|
||||
my $bay_topo_seg = $bay->bay_topo_seg();
|
||||
my $bay_topo_seg = $bay->bay_topo_seg();
|
||||
|
||||
my %c_port;
|
||||
foreach my $entry (keys %$bay_topo_seg){
|
||||
foreach my $entry ( keys %$bay_topo_seg ) {
|
||||
my $port = $bay_topo_port->{$entry};
|
||||
next unless defined $port;
|
||||
next if $port == 0;
|
||||
@@ -232,11 +235,11 @@ sub c_port {
|
||||
# For fake remotes (multiple IPs for a c_ip), use first found
|
||||
next if defined $c_port{"$port.1"};
|
||||
|
||||
my $seg = $bay_topo_seg->{$entry};
|
||||
my $seg = $bay_topo_seg->{$entry};
|
||||
|
||||
# Segment id is (256 * remote slot_num) + (remote_port)
|
||||
my $remote_port = $seg % 256;
|
||||
|
||||
|
||||
$c_port{"$port.1"} = $remote_port;
|
||||
}
|
||||
|
||||
@@ -244,20 +247,19 @@ sub c_port {
|
||||
}
|
||||
|
||||
sub c_platform {
|
||||
my $bay = shift;
|
||||
my $bay = shift;
|
||||
my $bay_topo_port = $bay->bay_topo_port();
|
||||
my $bay_topo_platform = $bay->bay_topo_platform();
|
||||
|
||||
|
||||
my %c_platform;
|
||||
foreach my $entry (keys %$bay_topo_platform){
|
||||
foreach my $entry ( keys %$bay_topo_platform ) {
|
||||
my $port = $bay_topo_port->{$entry} || 0;
|
||||
next if $port == 0;
|
||||
|
||||
# For fake remotes (multiple IPs for a c_ip), use first found
|
||||
next if defined $c_platform{"$port.1"};
|
||||
|
||||
my $platform = $bay_topo_platform->{$entry};
|
||||
my $platform = $bay_topo_platform->{$entry};
|
||||
|
||||
$c_platform{"$port.1"} = $platform;
|
||||
}
|
||||
@@ -446,7 +448,8 @@ Returns reference to hash. Key: Table entry, Value:slot number
|
||||
|
||||
=item $bay->bay_topo_port()
|
||||
|
||||
Returns reference to hash. Key: Table entry, Value:Port Number (interface iid)
|
||||
Returns reference to hash. Key: Table entry, Value:Port Number
|
||||
(interface iid)
|
||||
|
||||
(C<s5EnMsTopNmmPort>)
|
||||
|
||||
|
||||
@@ -3,21 +3,21 @@
|
||||
#
|
||||
# Copyright (c) 2008 Max Baker changes from version 0.8 and beyond.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
#
|
||||
# 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
|
||||
# * 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
|
||||
#
|
||||
# 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
|
||||
@@ -38,82 +38,82 @@ use SNMP::Info::RapidCity;
|
||||
use SNMP::Info::LLDP;
|
||||
use SNMP::Info::Layer3;
|
||||
|
||||
@SNMP::Info::Layer2::Baystack::ISA = qw/SNMP::Info::SONMP SNMP::Info::NortelStack
|
||||
SNMP::Info::RapidCity SNMP::Info::LLDP
|
||||
SNMP::Info::Layer3 Exporter/;
|
||||
@SNMP::Info::Layer2::Baystack::ISA
|
||||
= qw/SNMP::Info::SONMP SNMP::Info::NortelStack
|
||||
SNMP::Info::RapidCity SNMP::Info::LLDP
|
||||
SNMP::Info::Layer3 Exporter/;
|
||||
@SNMP::Info::Layer2::Baystack::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
|
||||
|
||||
$VERSION = '1.09';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::MIBS,
|
||||
%SNMP::Info::LLDP::MIBS,
|
||||
%SNMP::Info::RapidCity::MIBS,
|
||||
%SNMP::Info::NortelStack::MIBS,
|
||||
%SNMP::Info::SONMP::MIBS,
|
||||
);
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::MIBS, %SNMP::Info::LLDP::MIBS,
|
||||
%SNMP::Info::RapidCity::MIBS, %SNMP::Info::NortelStack::MIBS,
|
||||
%SNMP::Info::SONMP::MIBS,
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::GLOBALS,
|
||||
%SNMP::Info::LLDP::GLOBALS,
|
||||
%SNMP::Info::RapidCity::GLOBALS,
|
||||
%SNMP::Info::NortelStack::GLOBALS,
|
||||
%SNMP::Info::SONMP::GLOBALS,
|
||||
);
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::GLOBALS, %SNMP::Info::LLDP::GLOBALS,
|
||||
%SNMP::Info::RapidCity::GLOBALS, %SNMP::Info::NortelStack::GLOBALS,
|
||||
%SNMP::Info::SONMP::GLOBALS,
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::FUNCS,
|
||||
%SNMP::Info::LLDP::FUNCS,
|
||||
%SNMP::Info::RapidCity::FUNCS,
|
||||
%SNMP::Info::NortelStack::FUNCS,
|
||||
%SNMP::Info::SONMP::FUNCS,
|
||||
);
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::FUNCS, %SNMP::Info::LLDP::FUNCS,
|
||||
%SNMP::Info::RapidCity::FUNCS, %SNMP::Info::NortelStack::FUNCS,
|
||||
%SNMP::Info::SONMP::FUNCS,
|
||||
);
|
||||
|
||||
# 450's report full duplex as speed = 20mbps?!
|
||||
$SNMP::Info::SPEED_MAP{20_000_000} = '10 Mbps';
|
||||
$SNMP::Info::SPEED_MAP{200_000_000} = '100 Mbps';
|
||||
$SNMP::Info::SPEED_MAP{20_000_000} = '10 Mbps';
|
||||
$SNMP::Info::SPEED_MAP{200_000_000} = '100 Mbps';
|
||||
$SNMP::Info::SPEED_MAP{2_000_000_000} = '1.0 Gbps';
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer3::MUNGE,
|
||||
%SNMP::Info::LLDP::MUNGE,
|
||||
%SNMP::Info::RapidCity::MUNGE,
|
||||
%SNMP::Info::NortelStack::MUNGE,
|
||||
%SNMP::Info::SONMP::MUNGE,
|
||||
);
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer3::MUNGE, %SNMP::Info::LLDP::MUNGE,
|
||||
%SNMP::Info::RapidCity::MUNGE, %SNMP::Info::NortelStack::MUNGE,
|
||||
%SNMP::Info::SONMP::MUNGE,
|
||||
);
|
||||
|
||||
sub os {
|
||||
my $baystack = shift;
|
||||
my $descr = $baystack->description();
|
||||
my $model = $baystack->model();
|
||||
my $descr = $baystack->description();
|
||||
my $model = $baystack->model();
|
||||
|
||||
if ((defined $model and $model =~ /(325|420|425|470|460|BPS|2500|3510|4524|4526|4548|4550|5510|5520|5530)/) and (defined $descr and $descr =~ m/SW:v[3-5]/i)) {
|
||||
return 'boss';
|
||||
if (( defined $model
|
||||
and $model
|
||||
=~ /(325|420|425|470|460|BPS|2500|3510|4524|4526|4548|4550|5510|5520|5530)/
|
||||
)
|
||||
and ( defined $descr and $descr =~ m/SW:v[3-5]/i )
|
||||
)
|
||||
{
|
||||
return 'boss';
|
||||
}
|
||||
if ((defined $descr and $descr =~ /Business Ethernet Switch.*SW:v/i)) {
|
||||
return 'bes';
|
||||
if ( ( defined $descr and $descr =~ /Business Ethernet Switch.*SW:v/i ) )
|
||||
{
|
||||
return 'bes';
|
||||
}
|
||||
return 'baystack';
|
||||
}
|
||||
|
||||
sub os_bin {
|
||||
my $baystack = shift;
|
||||
my $descr = $baystack->description();
|
||||
my $descr = $baystack->description();
|
||||
return unless defined $descr;
|
||||
|
||||
# 303 / 304
|
||||
if ($descr =~ m/Rev: \d+\.(\d+\.\d+\.\d+)-\d+\.\d+\.\d+\.\d+/){
|
||||
if ( $descr =~ m/Rev: \d+\.(\d+\.\d+\.\d+)-\d+\.\d+\.\d+\.\d+/ ) {
|
||||
return $1;
|
||||
}
|
||||
|
||||
# 450
|
||||
if ($descr =~ m/FW:V(\d+\.\d+)/){
|
||||
if ( $descr =~ m/FW:V(\d+\.\d+)/ ) {
|
||||
return $1;
|
||||
}
|
||||
|
||||
if ($descr =~ m/FW:(\d+\.\d+\.\d+\.\d+)/i){
|
||||
if ( $descr =~ m/FW:(\d+\.\d+\.\d+\.\d+)/i ) {
|
||||
return $1;
|
||||
}
|
||||
return;
|
||||
@@ -125,38 +125,41 @@ sub vendor {
|
||||
|
||||
sub model {
|
||||
my $baystack = shift;
|
||||
my $id = $baystack->id();
|
||||
my $id = $baystack->id();
|
||||
return unless defined $id;
|
||||
my $model = &SNMP::translateObj($id);
|
||||
return $id unless defined $model;
|
||||
|
||||
my $descr = $baystack->description();
|
||||
|
||||
return '303' if (defined $descr and $descr =~ /\D303\D/);
|
||||
return '304' if (defined $descr and $descr =~ /\D304\D/);
|
||||
return 'BPS' if ($model =~ /BPS2000/i);
|
||||
return $2 if ($model =~ /(ES|ERS|BayStack|EthernetRoutingSwitch|EthernetSwitch)-?(\d+)/);
|
||||
|
||||
return '303' if ( defined $descr and $descr =~ /\D303\D/ );
|
||||
return '304' if ( defined $descr and $descr =~ /\D304\D/ );
|
||||
return 'BPS' if ( $model =~ /BPS2000/i );
|
||||
return $2
|
||||
if ( $model
|
||||
=~ /(ES|ERS|BayStack|EthernetRoutingSwitch|EthernetSwitch)-?(\d+)/ );
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
sub interfaces {
|
||||
my $baystack = shift;
|
||||
my $partial = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $i_index = $baystack->i_index($partial) || {};
|
||||
my $i_index = $baystack->i_index($partial) || {};
|
||||
my $index_factor = $baystack->index_factor();
|
||||
my $slot_offset = $baystack->slot_offset();
|
||||
|
||||
my $slot_offset = $baystack->slot_offset();
|
||||
|
||||
my %if;
|
||||
foreach my $iid (keys %$i_index){
|
||||
foreach my $iid ( keys %$i_index ) {
|
||||
my $index = $i_index->{$iid};
|
||||
next unless defined $index;
|
||||
|
||||
# Ignore cascade ports
|
||||
next if $index > 513;
|
||||
|
||||
my $port = ($index % $index_factor);
|
||||
my $slot = (int($index / $index_factor)) + $slot_offset;
|
||||
my $port = ( $index % $index_factor );
|
||||
my $slot = ( int( $index / $index_factor ) ) + $slot_offset;
|
||||
|
||||
my $slotport = "$slot.$port";
|
||||
$if{$iid} = $slotport;
|
||||
@@ -164,54 +167,58 @@ sub interfaces {
|
||||
return \%if;
|
||||
}
|
||||
|
||||
sub i_mac {
|
||||
sub i_mac {
|
||||
my $baystack = shift;
|
||||
my $partial = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $i_mac = $baystack->orig_i_mac($partial) || {};
|
||||
|
||||
my %i_mac;
|
||||
|
||||
# Baystack 303's with a hw rev < 2.11.4.5 report the mac as all zeros
|
||||
foreach my $iid (keys %$i_mac){
|
||||
foreach my $iid ( keys %$i_mac ) {
|
||||
my $mac = $i_mac->{$iid};
|
||||
next unless defined $mac;
|
||||
next if $mac eq '00:00:00:00:00:00';
|
||||
$i_mac{$iid}=$mac;
|
||||
$i_mac{$iid} = $mac;
|
||||
}
|
||||
return \%i_mac;
|
||||
}
|
||||
|
||||
sub i_name {
|
||||
my $baystack = shift;
|
||||
my $partial = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $i_index = $baystack->i_index($partial) || {};
|
||||
my $i_alias = $baystack->i_alias($partial) || {};
|
||||
my $i_name2 = $baystack->orig_i_name($partial) || {};
|
||||
my $i_index = $baystack->i_index($partial) || {};
|
||||
my $i_alias = $baystack->i_alias($partial) || {};
|
||||
my $i_name2 = $baystack->orig_i_name($partial) || {};
|
||||
|
||||
my %i_name;
|
||||
foreach my $iid (keys %$i_name2){
|
||||
my $name = $i_name2->{$iid};
|
||||
foreach my $iid ( keys %$i_name2 ) {
|
||||
my $name = $i_name2->{$iid};
|
||||
my $alias = $i_alias->{$iid};
|
||||
$i_name{$iid} = (defined $alias and $alias !~ /^\s*$/) ?
|
||||
$alias :
|
||||
$name;
|
||||
$i_name{$iid}
|
||||
= ( defined $alias and $alias !~ /^\s*$/ )
|
||||
? $alias
|
||||
: $name;
|
||||
}
|
||||
|
||||
return \%i_name;
|
||||
}
|
||||
|
||||
sub index_factor {
|
||||
my $baystack = shift;
|
||||
my $model = $baystack->model();
|
||||
my $os = $baystack->os();
|
||||
my $op_mode = $baystack->ns_op_mode();
|
||||
|
||||
my $baystack = shift;
|
||||
my $model = $baystack->model();
|
||||
my $os = $baystack->os();
|
||||
my $op_mode = $baystack->ns_op_mode();
|
||||
|
||||
$op_mode = 'pure' unless defined $op_mode;
|
||||
|
||||
my $index_factor = 32;
|
||||
$index_factor = 64 if ((defined $model and $model =~ /(470)/) or ($os =~ m/(boss|bes)/) and ($op_mode eq 'pure'));
|
||||
|
||||
$index_factor = 64
|
||||
if ( ( defined $model and $model =~ /(470)/ )
|
||||
or ( $os =~ m/(boss|bes)/ ) and ( $op_mode eq 'pure' ) );
|
||||
|
||||
return $index_factor;
|
||||
}
|
||||
|
||||
@@ -225,20 +232,20 @@ sub hasCDP {
|
||||
|
||||
sub c_ip {
|
||||
my $baystack = shift;
|
||||
my $partial = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $cdp = $baystack->SUPER::c_ip($partial) || {};
|
||||
my $lldp = $baystack->lldp_ip($partial) || {};
|
||||
my $lldp = $baystack->lldp_ip($partial) || {};
|
||||
|
||||
my %c_ip;
|
||||
foreach my $iid (keys %$cdp){
|
||||
foreach my $iid ( keys %$cdp ) {
|
||||
my $ip = $cdp->{$iid};
|
||||
next unless defined $ip;
|
||||
|
||||
$c_ip{$iid} = $ip;
|
||||
}
|
||||
|
||||
foreach my $iid (keys %$lldp){
|
||||
foreach my $iid ( keys %$lldp ) {
|
||||
my $ip = $lldp->{$iid};
|
||||
next unless defined $ip;
|
||||
|
||||
@@ -249,20 +256,20 @@ sub c_ip {
|
||||
|
||||
sub c_if {
|
||||
my $baystack = shift;
|
||||
my $partial = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $lldp = $baystack->lldp_if($partial) || {};;
|
||||
my $lldp = $baystack->lldp_if($partial) || {};
|
||||
my $cdp = $baystack->SUPER::c_if($partial) || {};
|
||||
|
||||
|
||||
my %c_if;
|
||||
foreach my $iid (keys %$cdp){
|
||||
foreach my $iid ( keys %$cdp ) {
|
||||
my $if = $cdp->{$iid};
|
||||
next unless defined $if;
|
||||
|
||||
$c_if{$iid} = $if;
|
||||
}
|
||||
|
||||
foreach my $iid (keys %$lldp){
|
||||
foreach my $iid ( keys %$lldp ) {
|
||||
my $if = $lldp->{$iid};
|
||||
next unless defined $if;
|
||||
|
||||
@@ -273,20 +280,20 @@ sub c_if {
|
||||
|
||||
sub c_port {
|
||||
my $baystack = shift;
|
||||
my $partial = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $lldp = $baystack->lldp_port($partial) || {};
|
||||
my $lldp = $baystack->lldp_port($partial) || {};
|
||||
my $cdp = $baystack->SUPER::c_port($partial) || {};
|
||||
|
||||
|
||||
my %c_port;
|
||||
foreach my $iid (keys %$cdp){
|
||||
foreach my $iid ( keys %$cdp ) {
|
||||
my $port = $cdp->{$iid};
|
||||
next unless defined $port;
|
||||
|
||||
$c_port{$iid} = $port;
|
||||
}
|
||||
|
||||
foreach my $iid (keys %$lldp){
|
||||
foreach my $iid ( keys %$lldp ) {
|
||||
my $port = $lldp->{$iid};
|
||||
next unless defined $port;
|
||||
|
||||
@@ -297,20 +304,20 @@ sub c_port {
|
||||
|
||||
sub c_id {
|
||||
my $baystack = shift;
|
||||
my $partial = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $lldp = $baystack->lldp_id($partial) || {};
|
||||
my $lldp = $baystack->lldp_id($partial) || {};
|
||||
my $cdp = $baystack->SUPER::c_id($partial) || {};
|
||||
|
||||
my %c_id;
|
||||
foreach my $iid (keys %$cdp){
|
||||
foreach my $iid ( keys %$cdp ) {
|
||||
my $id = $cdp->{$iid};
|
||||
next unless defined $id;
|
||||
|
||||
$c_id{$iid} = $id;
|
||||
}
|
||||
|
||||
foreach my $iid (keys %$lldp){
|
||||
foreach my $iid ( keys %$lldp ) {
|
||||
my $id = $lldp->{$iid};
|
||||
next unless defined $id;
|
||||
|
||||
@@ -321,20 +328,20 @@ sub c_id {
|
||||
|
||||
sub c_platform {
|
||||
my $baystack = shift;
|
||||
my $partial = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $lldp = $baystack->lldp_rem_sysdesc($partial) || {};
|
||||
my $lldp = $baystack->lldp_rem_sysdesc($partial) || {};
|
||||
my $cdp = $baystack->SUPER::c_platform($partial) || {};
|
||||
|
||||
my %c_platform;
|
||||
foreach my $iid (keys %$cdp){
|
||||
foreach my $iid ( keys %$cdp ) {
|
||||
my $platform = $cdp->{$iid};
|
||||
next unless defined $platform;
|
||||
|
||||
$c_platform{$iid} = $platform;
|
||||
}
|
||||
|
||||
foreach my $iid (keys %$lldp){
|
||||
foreach my $iid ( keys %$lldp ) {
|
||||
my $platform = $lldp->{$iid};
|
||||
next unless defined $platform;
|
||||
|
||||
@@ -582,7 +589,8 @@ to a hash.
|
||||
|
||||
Returns reference to the map between IID and physical Port.
|
||||
|
||||
Slot and port numbers on the Baystack switches are determined by the formula:
|
||||
Slot and port numbers on the Baystack switches are determined by the
|
||||
formula:
|
||||
|
||||
port = (Interface index % Index factor)
|
||||
slot = (int(Interface index / Index factor)) + Slot offset
|
||||
@@ -602,7 +610,8 @@ revisions of Baystack firmware report all zeros for each port mac.
|
||||
|
||||
=item $baystack->i_name()
|
||||
|
||||
Crosses C<ifName> with C<ifAlias> and returns the human set port name if exists.
|
||||
Crosses C<ifName> with C<ifAlias> and returns the human set port name if
|
||||
exists.
|
||||
|
||||
=back
|
||||
|
||||
@@ -701,8 +710,8 @@ 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-SONMP/LLDP device in between two or
|
||||
If multiple entries exist with the same local port, c_if(), with different
|
||||
IPv4 addresses, c_ip(), there is either a non-SONMP/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.
|
||||
|
||||
@@ -6,20 +6,20 @@
|
||||
# Copyright (c) 2002,2003 Regents of the University of California
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# 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
|
||||
# * 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
|
||||
#
|
||||
# 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
|
||||
@@ -40,8 +40,8 @@ use SNMP::Info::CiscoConfig;
|
||||
use SNMP::Info::Layer2;
|
||||
|
||||
@SNMP::Info::Layer2::C1900::ISA = qw/SNMP::Info::CDP SNMP::Info::CiscoStats
|
||||
SNMP::Info::CiscoConfig SNMP::Info::Layer2
|
||||
Exporter/;
|
||||
SNMP::Info::CiscoConfig SNMP::Info::Layer2
|
||||
Exporter/;
|
||||
@SNMP::Info::Layer2::C1900::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
|
||||
@@ -49,44 +49,44 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
|
||||
$VERSION = '1.09';
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer2::GLOBALS,
|
||||
%SNMP::Info::CiscoConfig::GLOBALS,
|
||||
%SNMP::Info::CiscoStats::GLOBALS,
|
||||
%SNMP::Info::CDP::GLOBALS,
|
||||
'c1900_flash_status' => 'upgradeFlashBankStatus',
|
||||
);
|
||||
%SNMP::Info::Layer2::GLOBALS,
|
||||
%SNMP::Info::CiscoConfig::GLOBALS,
|
||||
%SNMP::Info::CiscoStats::GLOBALS,
|
||||
%SNMP::Info::CDP::GLOBALS,
|
||||
'c1900_flash_status' => 'upgradeFlashBankStatus',
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer2::FUNCS,
|
||||
%SNMP::Info::CiscoConfig::FUNCS,
|
||||
%SNMP::Info::CiscoStats::FUNCS,
|
||||
%SNMP::Info::CDP::FUNCS,
|
||||
# ESSWITCH-MIB
|
||||
'c1900_p_index' => 'swPortIndex',
|
||||
'c1900_p_ifindex' => 'swPortIfIndex',
|
||||
'c1900_p_duplex' => 'swPortDuplexStatus',
|
||||
'c1900_p_duplex_admin' => 'swPortFullDuplex',
|
||||
'c1900_p_name' => 'swPortName',
|
||||
'c1900_p_up_admin' => 'swPortAdminStatus',
|
||||
'c1900_p_type' => 'swPortMediaCapability',
|
||||
'c1900_p_media' => 'swPortConnectorType',
|
||||
);
|
||||
%SNMP::Info::Layer2::FUNCS,
|
||||
%SNMP::Info::CiscoConfig::FUNCS,
|
||||
%SNMP::Info::CiscoStats::FUNCS,
|
||||
%SNMP::Info::CDP::FUNCS,
|
||||
|
||||
# ESSWITCH-MIB
|
||||
'c1900_p_index' => 'swPortIndex',
|
||||
'c1900_p_ifindex' => 'swPortIfIndex',
|
||||
'c1900_p_duplex' => 'swPortDuplexStatus',
|
||||
'c1900_p_duplex_admin' => 'swPortFullDuplex',
|
||||
'c1900_p_name' => 'swPortName',
|
||||
'c1900_p_up_admin' => 'swPortAdminStatus',
|
||||
'c1900_p_type' => 'swPortMediaCapability',
|
||||
'c1900_p_media' => 'swPortConnectorType',
|
||||
);
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer2::MIBS,
|
||||
%SNMP::Info::CiscoConfig::MIBS,
|
||||
%SNMP::Info::CiscoStats::MIBS,
|
||||
%SNMP::Info::CDP::MIBS,
|
||||
# Also known as the ESSWITCH-MIB
|
||||
'STAND-ALONE-ETHERNET-SWITCH-MIB' => 'series2000'
|
||||
);
|
||||
%SNMP::Info::Layer2::MIBS,
|
||||
%SNMP::Info::CiscoConfig::MIBS,
|
||||
%SNMP::Info::CiscoStats::MIBS,
|
||||
%SNMP::Info::CDP::MIBS,
|
||||
|
||||
# Also known as the ESSWITCH-MIB
|
||||
'STAND-ALONE-ETHERNET-SWITCH-MIB' => 'series2000'
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer2::MUNGE,
|
||||
%SNMP::Info::CiscoConfig::MUNGE,
|
||||
%SNMP::Info::CiscoStats::MUNGE,
|
||||
%SNMP::Info::CDP::MUNGE,
|
||||
);
|
||||
%SNMP::Info::Layer2::MUNGE, %SNMP::Info::CiscoConfig::MUNGE,
|
||||
%SNMP::Info::CiscoStats::MUNGE, %SNMP::Info::CDP::MUNGE,
|
||||
);
|
||||
|
||||
sub bulkwalk_no { return 1; }
|
||||
sub cisco_comm_indexing { return 1; }
|
||||
@@ -199,53 +199,54 @@ sub set_i_duplex_admin {
|
||||
}
|
||||
|
||||
sub i_vlan {
|
||||
my $c1900 = shift;
|
||||
my $partial = shift;
|
||||
my $c1900 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
# Overlap allows more than one VLAN per port. Unable to determine default
|
||||
my $overlap = $c1900->bridgeGroupAllowMembershipOverlap() ||
|
||||
$c1900->vlanAllowMembershipOverlap() || 'disabled';
|
||||
|
||||
if ($overlap eq 'enabled') {
|
||||
# Overlap allows more than one VLAN per port. Unable to determine default
|
||||
my $overlap = $c1900->bridgeGroupAllowMembershipOverlap()
|
||||
|| $c1900->vlanAllowMembershipOverlap()
|
||||
|| 'disabled';
|
||||
|
||||
if ( $overlap eq 'enabled' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
my $member_of = $c1900->bridgeGroupMemberPortOfBridgeGroup() ||
|
||||
$c1900->vlanMemberPortOfVlan();
|
||||
my $member_of = $c1900->bridgeGroupMemberPortOfBridgeGroup()
|
||||
|| $c1900->vlanMemberPortOfVlan();
|
||||
|
||||
my $i_pvid = {};
|
||||
foreach my $idx (keys %$member_of) {
|
||||
my @values = split(/\./, $idx);
|
||||
my ($vlan, $port) = @values;
|
||||
foreach my $idx ( keys %$member_of ) {
|
||||
my @values = split( /\./, $idx );
|
||||
my ( $vlan, $port ) = @values;
|
||||
next unless $vlan;
|
||||
next unless $port;
|
||||
next if (defined $partial and $port !~ /^$partial$/);
|
||||
next if ( defined $partial and $port !~ /^$partial$/ );
|
||||
my $value = $member_of->{$idx};
|
||||
next if ($value eq 'false');
|
||||
|
||||
next if ( $value eq 'false' );
|
||||
|
||||
$i_pvid->{$port} = $vlan;
|
||||
}
|
||||
return $i_pvid;
|
||||
}
|
||||
|
||||
sub i_vlan_membership {
|
||||
my $c1900 = shift;
|
||||
my $c1900 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $member_of = $c1900->bridgeGroupMemberPortOfBridgeGroup() ||
|
||||
$c1900->vlanMemberPortOfVlan();
|
||||
my $member_of = $c1900->bridgeGroupMemberPortOfBridgeGroup()
|
||||
|| $c1900->vlanMemberPortOfVlan();
|
||||
|
||||
my $i_vlan_membership = {};
|
||||
foreach my $idx (keys %$member_of) {
|
||||
my @values = split(/\./, $idx);
|
||||
my ($vlan, $port) = @values;
|
||||
foreach my $idx ( keys %$member_of ) {
|
||||
my @values = split( /\./, $idx );
|
||||
my ( $vlan, $port ) = @values;
|
||||
next unless $vlan;
|
||||
next unless $port;
|
||||
next if (defined $partial and $port !~ /^$partial$/);
|
||||
next if ( defined $partial and $port !~ /^$partial$/ );
|
||||
my $value = $member_of->{$idx};
|
||||
next if ($value eq 'false');
|
||||
next if ( $value eq 'false' );
|
||||
|
||||
push(@{$i_vlan_membership->{$port}}, $vlan);
|
||||
push( @{ $i_vlan_membership->{$port} }, $vlan );
|
||||
}
|
||||
return $i_vlan_membership;
|
||||
}
|
||||
@@ -499,9 +500,10 @@ See L<SNMP::Info::Layer2/"TABLE METHODS"> for details.
|
||||
|
||||
=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.
|
||||
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
|
||||
|
||||
|
||||
@@ -5,21 +5,21 @@
|
||||
#
|
||||
# Copyright (c) 2002,2003 Regents of the University of California
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
#
|
||||
# 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
|
||||
# * 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
|
||||
#
|
||||
# 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
|
||||
@@ -41,8 +41,8 @@ use SNMP::Info::CiscoConfig;
|
||||
use SNMP::Info::Layer2;
|
||||
|
||||
@SNMP::Info::Layer2::C2900::ISA = qw/SNMP::Info::CiscoVTP SNMP::Info::CDP
|
||||
SNMP::Info::CiscoStats SNMP::Info::CiscoConfig
|
||||
SNMP::Info::Layer2 Exporter/;
|
||||
SNMP::Info::CiscoStats SNMP::Info::CiscoConfig
|
||||
SNMP::Info::Layer2 Exporter/;
|
||||
@SNMP::Info::Layer2::C2900::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
|
||||
@@ -50,43 +50,37 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
|
||||
$VERSION = '1.09';
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer2::GLOBALS,
|
||||
%SNMP::Info::CiscoConfig::GLOBALS,
|
||||
%SNMP::Info::CiscoStats::GLOBALS,
|
||||
%SNMP::Info::CDP::GLOBALS,
|
||||
%SNMP::Info::CiscoVTP::GLOBALS,
|
||||
);
|
||||
%SNMP::Info::Layer2::GLOBALS, %SNMP::Info::CiscoConfig::GLOBALS,
|
||||
%SNMP::Info::CiscoStats::GLOBALS, %SNMP::Info::CDP::GLOBALS,
|
||||
%SNMP::Info::CiscoVTP::GLOBALS,
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer2::FUNCS,
|
||||
%SNMP::Info::CiscoConfig::FUNCS,
|
||||
%SNMP::Info::CiscoStats::FUNCS,
|
||||
%SNMP::Info::CDP::FUNCS,
|
||||
%SNMP::Info::CiscoVTP::FUNCS,
|
||||
'i_name' => 'ifAlias',
|
||||
# C2900PortEntry
|
||||
'c2900_p_index' => 'c2900PortIfIndex',
|
||||
'c2900_p_duplex' => 'c2900PortDuplexStatus',
|
||||
'c2900_p_duplex_admin' => 'c2900PortDuplexState',
|
||||
'c2900_p_speed_admin' => 'c2900PortAdminSpeed',
|
||||
);
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer2::FUNCS,
|
||||
%SNMP::Info::CiscoConfig::FUNCS,
|
||||
%SNMP::Info::CiscoStats::FUNCS,
|
||||
%SNMP::Info::CDP::FUNCS,
|
||||
%SNMP::Info::CiscoVTP::FUNCS,
|
||||
'i_name' => 'ifAlias',
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer2::MIBS,
|
||||
%SNMP::Info::CiscoConfig::MIBS,
|
||||
%SNMP::Info::CiscoStats::MIBS,
|
||||
%SNMP::Info::CDP::MIBS,
|
||||
%SNMP::Info::CiscoVTP::MIBS,
|
||||
'CISCO-C2900-MIB' => 'ciscoC2900MIB',
|
||||
);
|
||||
# C2900PortEntry
|
||||
'c2900_p_index' => 'c2900PortIfIndex',
|
||||
'c2900_p_duplex' => 'c2900PortDuplexStatus',
|
||||
'c2900_p_duplex_admin' => 'c2900PortDuplexState',
|
||||
'c2900_p_speed_admin' => 'c2900PortAdminSpeed',
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer2::MUNGE,
|
||||
%SNMP::Info::CiscoConfig::MUNGE,
|
||||
%SNMP::Info::CiscoStats::MUNGE,
|
||||
%SNMP::Info::CDP::MUNGE,
|
||||
%SNMP::Info::CiscoVTP::MUNGE,
|
||||
);
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer2::MIBS, %SNMP::Info::CiscoConfig::MIBS,
|
||||
%SNMP::Info::CiscoStats::MIBS, %SNMP::Info::CDP::MIBS,
|
||||
%SNMP::Info::CiscoVTP::MIBS, 'CISCO-C2900-MIB' => 'ciscoC2900MIB',
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer2::MUNGE, %SNMP::Info::CiscoConfig::MUNGE,
|
||||
%SNMP::Info::CiscoStats::MUNGE, %SNMP::Info::CDP::MUNGE,
|
||||
%SNMP::Info::CiscoVTP::MUNGE,
|
||||
);
|
||||
|
||||
sub vendor {
|
||||
return 'cisco';
|
||||
@@ -97,9 +91,9 @@ sub cisco_comm_indexing {
|
||||
}
|
||||
|
||||
sub i_duplex {
|
||||
my $c2900 = shift;
|
||||
my $c2900 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
|
||||
my $interfaces = $c2900->interfaces($partial);
|
||||
my $c2900_p_index = $c2900->c2900_p_index();
|
||||
my $c2900_p_duplex = $c2900->c2900_p_duplex();
|
||||
@@ -107,53 +101,53 @@ sub i_duplex {
|
||||
my %reverse_2900 = reverse %$c2900_p_index;
|
||||
|
||||
my %i_duplex;
|
||||
foreach my $if (keys %$interfaces){
|
||||
foreach my $if ( keys %$interfaces ) {
|
||||
my $port_2900 = $reverse_2900{$if};
|
||||
next unless defined $port_2900;
|
||||
my $duplex = $c2900_p_duplex->{$port_2900};
|
||||
next unless defined $duplex;
|
||||
|
||||
next unless defined $duplex;
|
||||
|
||||
$duplex = 'half' if $duplex =~ /half/i;
|
||||
$duplex = 'full' if $duplex =~ /full/i;
|
||||
$i_duplex{$if}=$duplex;
|
||||
$i_duplex{$if} = $duplex;
|
||||
}
|
||||
return \%i_duplex;
|
||||
}
|
||||
|
||||
sub i_duplex_admin {
|
||||
my $c2900 = shift;
|
||||
my $c2900 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $interfaces = $c2900->interfaces($partial);
|
||||
my $c2900_p_index = $c2900->c2900_p_index();
|
||||
|
||||
my $interfaces = $c2900->interfaces($partial);
|
||||
my $c2900_p_index = $c2900->c2900_p_index();
|
||||
my $c2900_p_admin = $c2900->c2900_p_duplex_admin();
|
||||
|
||||
my %reverse_2900 = reverse %$c2900_p_index;
|
||||
|
||||
my %i_duplex_admin;
|
||||
foreach my $if (keys %$interfaces){
|
||||
foreach my $if ( keys %$interfaces ) {
|
||||
my $port_2900 = $reverse_2900{$if};
|
||||
next unless defined $port_2900;
|
||||
my $duplex = $c2900_p_admin->{$port_2900};
|
||||
next unless defined $duplex;
|
||||
|
||||
next unless defined $duplex;
|
||||
|
||||
$duplex = 'half' if $duplex =~ /half/i;
|
||||
$duplex = 'full' if $duplex =~ /full/i;
|
||||
$duplex = 'auto' if $duplex =~ /auto/i;
|
||||
$i_duplex_admin{$if}=$duplex;
|
||||
$i_duplex_admin{$if} = $duplex;
|
||||
}
|
||||
return \%i_duplex_admin;
|
||||
}
|
||||
|
||||
sub set_i_speed_admin {
|
||||
my $c2900 = shift;
|
||||
my ($speed, $iid) = @_;
|
||||
|
||||
my ( $speed, $iid ) = @_;
|
||||
|
||||
# map speeds to those the switch will understand
|
||||
my %speeds = qw/auto 1 10 10000000 100 100000000/;
|
||||
|
||||
my $c2900_p_index = $c2900->c2900_p_index();
|
||||
my %reverse_2900 = reverse %$c2900_p_index;
|
||||
my $c2900_p_index = $c2900->c2900_p_index();
|
||||
my %reverse_2900 = reverse %$c2900_p_index;
|
||||
|
||||
$speed = lc($speed);
|
||||
|
||||
@@ -162,18 +156,18 @@ sub set_i_speed_admin {
|
||||
# account for weirdness of c2900 mib
|
||||
$iid = $reverse_2900{$iid};
|
||||
|
||||
return $c2900->set_c2900_p_speed_admin($speeds{$speed}, $iid);
|
||||
return $c2900->set_c2900_p_speed_admin( $speeds{$speed}, $iid );
|
||||
}
|
||||
|
||||
sub set_i_duplex_admin {
|
||||
my $c2900 = shift;
|
||||
my ($duplex, $iid) = @_;
|
||||
my ( $duplex, $iid ) = @_;
|
||||
|
||||
# map a textual duplex to an integer one the switch understands
|
||||
my %duplexes = qw/full 1 half 2 auto 3/;
|
||||
|
||||
my $c2900_p_index = $c2900->c2900_p_index();
|
||||
my %reverse_2900 = reverse %$c2900_p_index;
|
||||
my $c2900_p_index = $c2900->c2900_p_index();
|
||||
my %reverse_2900 = reverse %$c2900_p_index;
|
||||
|
||||
$duplex = lc($duplex);
|
||||
|
||||
@@ -182,29 +176,29 @@ sub set_i_duplex_admin {
|
||||
# account for weirdness of c2900 mib
|
||||
$iid = $reverse_2900{$iid};
|
||||
|
||||
return $c2900->set_c2900_p_duplex_admin($duplexes{$duplex}, $iid);
|
||||
return $c2900->set_c2900_p_duplex_admin( $duplexes{$duplex}, $iid );
|
||||
}
|
||||
|
||||
# Use i_descritption for port key, cuz i_name can be manually entered.
|
||||
sub interfaces {
|
||||
my $c2900 = shift;
|
||||
my $c2900 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $interfaces = $c2900->i_index($partial) || {};
|
||||
my $i_descr = $c2900->i_description($partial) || {};
|
||||
my $interfaces = $c2900->i_index($partial) || {};
|
||||
my $i_descr = $c2900->i_description($partial) || {};
|
||||
|
||||
my %if;
|
||||
foreach my $iid (keys %$interfaces){
|
||||
foreach my $iid ( keys %$interfaces ) {
|
||||
my $port = $i_descr->{$iid};
|
||||
next unless defined $port;
|
||||
|
||||
$port =~ s/\./\//g if( $port =~ /\d+\.\d+$/);
|
||||
$port =~ s/\./\//g if ( $port =~ /\d+\.\d+$/ );
|
||||
$port =~ s/[^\d\/,()\w]+//gi;
|
||||
|
||||
|
||||
$if{$iid} = $port;
|
||||
}
|
||||
|
||||
return \%if
|
||||
return \%if;
|
||||
}
|
||||
|
||||
1;
|
||||
@@ -409,9 +403,10 @@ See L<SNMP::Info::Layer2/"TABLE METHODS"> for details.
|
||||
|
||||
=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.
|
||||
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
|
||||
|
||||
|
||||
@@ -4,21 +4,21 @@
|
||||
# Copyright (c) 2002,2003 Regents of the University of California
|
||||
# Copyright (c) 2008 Max Baker changes from version 0.8 and beyond
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
#
|
||||
# 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
|
||||
# * 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
|
||||
#
|
||||
# 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
|
||||
@@ -40,51 +40,43 @@ use SNMP::Info::CiscoStats;
|
||||
use SNMP::Info::CiscoPortSecurity;
|
||||
use SNMP::Info::Layer2;
|
||||
|
||||
@SNMP::Info::Layer2::Catalyst::ISA = qw/SNMP::Info::CiscoStack SNMP::Info::CiscoVTP
|
||||
SNMP::Info::CDP SNMP::Info::CiscoStats
|
||||
SNMP::Info::CiscoPortSecurity
|
||||
SNMP::Info::Layer2 Exporter/;
|
||||
@SNMP::Info::Layer2::Catalyst::ISA
|
||||
= qw/SNMP::Info::CiscoStack SNMP::Info::CiscoVTP
|
||||
SNMP::Info::CDP SNMP::Info::CiscoStats
|
||||
SNMP::Info::CiscoPortSecurity
|
||||
SNMP::Info::Layer2 Exporter/;
|
||||
@SNMP::Info::Layer2::Catalyst::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/ ;
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
$VERSION = '1.09';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer2::MIBS,
|
||||
%SNMP::Info::CiscoPortSecurity::MIBS,
|
||||
%SNMP::Info::CiscoStats::MIBS,
|
||||
%SNMP::Info::CDP::MIBS,
|
||||
%SNMP::Info::CiscoVTP::MIBS,
|
||||
%SNMP::Info::CiscoStack::MIBS,
|
||||
);
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer2::MIBS, %SNMP::Info::CiscoPortSecurity::MIBS,
|
||||
%SNMP::Info::CiscoStats::MIBS, %SNMP::Info::CDP::MIBS,
|
||||
%SNMP::Info::CiscoVTP::MIBS, %SNMP::Info::CiscoStack::MIBS,
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer2::GLOBALS,
|
||||
%SNMP::Info::CiscoPortSecurity::GLOBALS,
|
||||
%SNMP::Info::CiscoStats::GLOBALS,
|
||||
%SNMP::Info::CDP::GLOBALS,
|
||||
%SNMP::Info::CiscoVTP::GLOBALS,
|
||||
%SNMP::Info::CiscoStack::GLOBALS,
|
||||
);
|
||||
%SNMP::Info::Layer2::GLOBALS,
|
||||
%SNMP::Info::CiscoPortSecurity::GLOBALS,
|
||||
%SNMP::Info::CiscoStats::GLOBALS,
|
||||
%SNMP::Info::CDP::GLOBALS,
|
||||
%SNMP::Info::CiscoVTP::GLOBALS,
|
||||
%SNMP::Info::CiscoStack::GLOBALS,
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer2::FUNCS,
|
||||
%SNMP::Info::CiscoPortSecurity::FUNCS,
|
||||
%SNMP::Info::CiscoStats::FUNCS,
|
||||
%SNMP::Info::CDP::FUNCS,
|
||||
%SNMP::Info::CiscoVTP::FUNCS,
|
||||
%SNMP::Info::CiscoStack::FUNCS,
|
||||
);
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer2::FUNCS, %SNMP::Info::CiscoPortSecurity::FUNCS,
|
||||
%SNMP::Info::CiscoStats::FUNCS, %SNMP::Info::CDP::FUNCS,
|
||||
%SNMP::Info::CiscoVTP::FUNCS, %SNMP::Info::CiscoStack::FUNCS,
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer2::MUNGE,
|
||||
%SNMP::Info::CiscoPortSecurity::MUNGE,
|
||||
%SNMP::Info::CiscoStats::MUNGE,
|
||||
%SNMP::Info::CDP::MUNGE,
|
||||
%SNMP::Info::CiscoVTP::MUNGE,
|
||||
%SNMP::Info::CiscoStack::MUNGE,
|
||||
);
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer2::MUNGE, %SNMP::Info::CiscoPortSecurity::MUNGE,
|
||||
%SNMP::Info::CiscoStats::MUNGE, %SNMP::Info::CDP::MUNGE,
|
||||
%SNMP::Info::CiscoVTP::MUNGE, %SNMP::Info::CiscoStack::MUNGE,
|
||||
);
|
||||
|
||||
# Overidden Methods
|
||||
|
||||
@@ -95,9 +87,9 @@ sub i_physical {
|
||||
my $p_port = $cat->p_port();
|
||||
|
||||
my %i_physical;
|
||||
foreach my $port (keys %$p_port) {
|
||||
foreach my $port ( keys %$p_port ) {
|
||||
my $iid = $p_port->{$port};
|
||||
$i_physical{$iid} = 1;
|
||||
$i_physical{$iid} = 1;
|
||||
}
|
||||
return \%i_physical;
|
||||
}
|
||||
@@ -111,7 +103,7 @@ sub os {
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $cat = shift;
|
||||
my $cat = shift;
|
||||
my $os_ver = $cat->SUPER::os_ver();
|
||||
return $os_ver if defined $os_ver;
|
||||
|
||||
@@ -125,15 +117,15 @@ sub os_ver {
|
||||
|
||||
# Workaround for incomplete bp_index
|
||||
sub bp_index {
|
||||
my $cat = shift;
|
||||
my $cat = shift;
|
||||
my $p_index = $cat->p_port();
|
||||
my $b_index = $cat->p_oidx();
|
||||
|
||||
my %bp_index;
|
||||
foreach my $iid (keys %$p_index){
|
||||
foreach my $iid ( keys %$p_index ) {
|
||||
my $ifidx = $p_index->{$iid};
|
||||
next unless defined $ifidx;
|
||||
my $bpidx = $b_index->{$iid}||0;
|
||||
my $bpidx = $b_index->{$iid} || 0;
|
||||
|
||||
$bp_index{$bpidx} = $ifidx;
|
||||
}
|
||||
@@ -145,15 +137,15 @@ sub cisco_comm_indexing {
|
||||
}
|
||||
|
||||
sub interfaces {
|
||||
my $cat = shift;
|
||||
my $cat = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $i_index = $cat->i_index($partial);
|
||||
my $portnames = $cat->p_port() || {};
|
||||
my %portmap = reverse %$portnames;
|
||||
my $i_index = $cat->i_index($partial);
|
||||
my $portnames = $cat->p_port() || {};
|
||||
my %portmap = reverse %$portnames;
|
||||
|
||||
my %interfaces = ();
|
||||
foreach my $iid (keys %$i_index) {
|
||||
foreach my $iid ( keys %$i_index ) {
|
||||
next unless defined $iid;
|
||||
my $if = $i_index->{$iid};
|
||||
my $port = $portmap{$iid};
|
||||
@@ -163,20 +155,20 @@ sub interfaces {
|
||||
}
|
||||
|
||||
sub i_name {
|
||||
my $cat = shift;
|
||||
my $cat = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $p_port = $cat->p_port() || {};
|
||||
my $p_name = $cat->p_name() || {};
|
||||
|
||||
my %i_name;
|
||||
foreach my $port (keys %$p_name) {
|
||||
foreach my $port ( keys %$p_name ) {
|
||||
my $iid = $p_port->{$port};
|
||||
next unless defined $iid;
|
||||
next if (defined $partial and $iid !~ /^$partial$/);
|
||||
next if ( defined $partial and $iid !~ /^$partial$/ );
|
||||
$i_name{$iid} = $p_name->{$port};
|
||||
}
|
||||
return \%i_name;
|
||||
return \%i_name;
|
||||
}
|
||||
|
||||
1;
|
||||
@@ -211,7 +203,8 @@ Max Baker
|
||||
SNMP::Info subclass to provide information for Cisco Catalyst series switches
|
||||
running CatOS.
|
||||
|
||||
This class includes the Catalyst 2920, 4000, 5000, 6000 (hybrid mode) families.
|
||||
This class includes the Catalyst 2920, 4000, 5000, 6000 (hybrid mode)
|
||||
families.
|
||||
|
||||
This subclass is not for all devices that have the name Catalyst. Note that
|
||||
some Catalyst switches run IOS, like the 2900 and 3550 families. Cisco
|
||||
@@ -330,7 +323,8 @@ to a hash.
|
||||
|
||||
=item $cat->interfaces()
|
||||
|
||||
Returns the map between SNMP Interface Identifier (iid) and physical port name.
|
||||
Returns the map between SNMP Interface Identifier (iid) and physical port
|
||||
name.
|
||||
|
||||
=item $cat->i_name()
|
||||
|
||||
@@ -347,8 +341,8 @@ Returns a map to IID for ports that are physical ports, not vlans, etc.
|
||||
Returns reference to hash of bridge port table entries map back to interface
|
||||
identifier (iid)
|
||||
|
||||
Crosses (C<portCrossIndex>) to (C<portIfIndex>) since some devices seem to have
|
||||
problems with F<BRIDGE-MIB>
|
||||
Crosses (C<portCrossIndex>) to (C<portIfIndex>) since some devices seem to
|
||||
have problems with F<BRIDGE-MIB>
|
||||
|
||||
=back
|
||||
|
||||
|
||||
@@ -4,20 +4,20 @@
|
||||
# Copyright (c) 2008 Eric Miller
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# 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
|
||||
# * 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
|
||||
#
|
||||
# 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
|
||||
@@ -37,61 +37,66 @@ use SNMP::Info::Bridge;
|
||||
use SNMP::Info::NortelStack;
|
||||
use SNMP::Info::SONMP;
|
||||
|
||||
@SNMP::Info::Layer2::Centillion::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::NortelStack SNMP::Info::SONMP Exporter/;
|
||||
@SNMP::Info::Layer2::Centillion::ISA
|
||||
= qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::NortelStack SNMP::Info::SONMP Exporter/;
|
||||
@SNMP::Info::Layer2::Centillion::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
|
||||
|
||||
$VERSION = '1.09';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::MIBS,
|
||||
%SNMP::Info::Bridge::MIBS,
|
||||
%SNMP::Info::NortelStack::MIBS,
|
||||
%SNMP::Info::SONMP::MIBS,
|
||||
'CENTILLION-DOT3-EXTENSIONS-MIB' => 'cnDot3ExtnTable',
|
||||
'S5-COMMON-STATS-MIB' => 's5CmStat',
|
||||
'CENTILLION-VLAN-MIB' => 'cnVlanENETMgt',
|
||||
'CENTILLION-CONFIG-MIB' => 'sysTFTPStart',
|
||||
);
|
||||
%MIBS = (
|
||||
%SNMP::Info::MIBS,
|
||||
%SNMP::Info::Bridge::MIBS,
|
||||
%SNMP::Info::NortelStack::MIBS,
|
||||
%SNMP::Info::SONMP::MIBS,
|
||||
'CENTILLION-DOT3-EXTENSIONS-MIB' => 'cnDot3ExtnTable',
|
||||
'S5-COMMON-STATS-MIB' => 's5CmStat',
|
||||
'CENTILLION-VLAN-MIB' => 'cnVlanENETMgt',
|
||||
'CENTILLION-CONFIG-MIB' => 'sysTFTPStart',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::GLOBALS,
|
||||
%SNMP::Info::Bridge::GLOBALS,
|
||||
%SNMP::Info::NortelStack::GLOBALS,
|
||||
%SNMP::Info::SONMP::GLOBALS,
|
||||
'tftp_action' => 'sysTFTPStart',
|
||||
'tftp_host' => 'sysTFTPIpAddress',
|
||||
'tftp_file' => 'sysTFTPFileName',
|
||||
'tftp_type' => 'sysTFTPFileType',
|
||||
'tftp_result' => 'sysTFTPResult',
|
||||
);
|
||||
%SNMP::Info::GLOBALS,
|
||||
%SNMP::Info::Bridge::GLOBALS,
|
||||
%SNMP::Info::NortelStack::GLOBALS,
|
||||
%SNMP::Info::SONMP::GLOBALS,
|
||||
'tftp_action' => 'sysTFTPStart',
|
||||
'tftp_host' => 'sysTFTPIpAddress',
|
||||
'tftp_file' => 'sysTFTPFileName',
|
||||
'tftp_type' => 'sysTFTPFileType',
|
||||
'tftp_result' => 'sysTFTPResult',
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::FUNCS,
|
||||
%SNMP::Info::Bridge::FUNCS,
|
||||
%SNMP::Info::NortelStack::FUNCS,
|
||||
%SNMP::Info::SONMP::FUNCS,
|
||||
# CENTILLION-DOT3-EXTENSIONS-MIB::cnDot3ExtnTable
|
||||
'centillion_p_index' => 'cnDot3ExtnIfIndex',
|
||||
'centillion_p_duplex' => 'cnDot3ExtnIfOperConnectionType',
|
||||
'centillion_p_duplex_admin' => 'cnDot3ExtnIfAdminConnectionType',
|
||||
# S5-COMMON-STATS-MIB::s5CmSNodeTable
|
||||
'fw_mac' => 's5CmSNodeMacAddr',
|
||||
'fw_port' => 's5CmSNodeIfIndx',
|
||||
# CENTILLION-VLAN-MIB::cnVlanPortMemberTable
|
||||
'centillion_i_vlan_index' => 'cnVlanPortMemberIfIndex',
|
||||
'centillion_i_vlan' => 'cnVlanPortMemberVID',
|
||||
'centillion_i_vlan_type' => 'cnVlanPortMemberIngressType',
|
||||
);
|
||||
%FUNCS = (
|
||||
%SNMP::Info::FUNCS,
|
||||
%SNMP::Info::Bridge::FUNCS,
|
||||
%SNMP::Info::NortelStack::FUNCS,
|
||||
%SNMP::Info::SONMP::FUNCS,
|
||||
|
||||
%MUNGE = (
|
||||
# Inherit all the built in munging
|
||||
%SNMP::Info::MUNGE,
|
||||
%SNMP::Info::Bridge::MUNGE,
|
||||
%SNMP::Info::NortelStack::MUNGE,
|
||||
%SNMP::Info::SONMP::MUNGE,
|
||||
);
|
||||
# CENTILLION-DOT3-EXTENSIONS-MIB::cnDot3ExtnTable
|
||||
'centillion_p_index' => 'cnDot3ExtnIfIndex',
|
||||
'centillion_p_duplex' => 'cnDot3ExtnIfOperConnectionType',
|
||||
'centillion_p_duplex_admin' => 'cnDot3ExtnIfAdminConnectionType',
|
||||
|
||||
# S5-COMMON-STATS-MIB::s5CmSNodeTable
|
||||
'fw_mac' => 's5CmSNodeMacAddr',
|
||||
'fw_port' => 's5CmSNodeIfIndx',
|
||||
|
||||
# CENTILLION-VLAN-MIB::cnVlanPortMemberTable
|
||||
'centillion_i_vlan_index' => 'cnVlanPortMemberIfIndex',
|
||||
'centillion_i_vlan' => 'cnVlanPortMemberVID',
|
||||
'centillion_i_vlan_type' => 'cnVlanPortMemberIngressType',
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
|
||||
# Inherit all the built in munging
|
||||
%SNMP::Info::MUNGE,
|
||||
%SNMP::Info::Bridge::MUNGE,
|
||||
%SNMP::Info::NortelStack::MUNGE,
|
||||
%SNMP::Info::SONMP::MUNGE,
|
||||
);
|
||||
|
||||
sub os {
|
||||
return 'centillion';
|
||||
@@ -103,12 +108,13 @@ sub vendor {
|
||||
|
||||
sub i_ignore {
|
||||
my $centillion = shift;
|
||||
my $descr = $centillion->i_description();
|
||||
my $descr = $centillion->i_description();
|
||||
|
||||
my %i_ignore;
|
||||
foreach my $if (keys %$descr){
|
||||
foreach my $if ( keys %$descr ) {
|
||||
my $type = $descr->{$if};
|
||||
# Skip virtual interfaces
|
||||
|
||||
# Skip virtual interfaces
|
||||
$i_ignore{$if}++ if $type =~ /(VE|VID|vc|lp)/i;
|
||||
}
|
||||
return \%i_ignore;
|
||||
@@ -116,24 +122,25 @@ sub i_ignore {
|
||||
|
||||
sub interfaces {
|
||||
my $centillion = shift;
|
||||
my $i_index = $centillion->i_index();
|
||||
my $i_descr = $centillion->i_description();
|
||||
my $i_index = $centillion->i_index();
|
||||
my $i_descr = $centillion->i_description();
|
||||
|
||||
my %if;
|
||||
foreach my $iid (keys %$i_index){
|
||||
foreach my $iid ( keys %$i_index ) {
|
||||
my $index = $i_index->{$iid};
|
||||
next unless defined $index;
|
||||
my $descr = $i_descr->{$iid};
|
||||
# Skip ATM and virtual interfaces
|
||||
next if $descr =~ /(VE|VID|vc|lp)/i;
|
||||
my $descr = $i_descr->{$iid};
|
||||
|
||||
# Index numbers are deterministic slot * 256 + port
|
||||
my $port = $index % 256;
|
||||
my $slot = int($index / 256);
|
||||
# Skip ATM and virtual interfaces
|
||||
next if $descr =~ /(VE|VID|vc|lp)/i;
|
||||
|
||||
# Index numbers are deterministic slot * 256 + port
|
||||
my $port = $index % 256;
|
||||
my $slot = int( $index / 256 );
|
||||
my $slotport = "$slot.$port";
|
||||
|
||||
$slotport = "$descr" if $descr =~ /(mcp)/i;
|
||||
|
||||
$slotport = "$descr" if $descr =~ /(mcp)/i;
|
||||
|
||||
$if{$index} = $slotport;
|
||||
}
|
||||
|
||||
@@ -142,89 +149,89 @@ sub interfaces {
|
||||
|
||||
sub i_duplex {
|
||||
my $centillion = shift;
|
||||
|
||||
|
||||
my $port_index = $centillion->centillion_p_index();
|
||||
my $port_duplex = $centillion->centillion_p_duplex();
|
||||
|
||||
my %i_duplex;
|
||||
foreach my $iid (keys %$port_index){
|
||||
foreach my $iid ( keys %$port_index ) {
|
||||
my $index = $port_index->{$iid};
|
||||
next unless defined $index;
|
||||
my $duplex = $port_duplex->{$iid};
|
||||
next unless defined $duplex;
|
||||
|
||||
next unless defined $duplex;
|
||||
|
||||
$duplex = 'half' if $duplex =~ /half/i;
|
||||
$duplex = 'full' if $duplex =~ /full/i;
|
||||
$i_duplex{$index}=$duplex;
|
||||
$i_duplex{$index} = $duplex;
|
||||
}
|
||||
return \%i_duplex;
|
||||
}
|
||||
|
||||
sub i_duplex_admin {
|
||||
my $centillion = shift;
|
||||
|
||||
|
||||
my $port_index = $centillion->centillion_p_index();
|
||||
my $port_admin = $centillion->centillion_p_duplex_admin();
|
||||
|
||||
my %i_duplex_admin;
|
||||
foreach my $iid (keys %$port_index){
|
||||
foreach my $iid ( keys %$port_index ) {
|
||||
my $index = $port_index->{$iid};
|
||||
next unless defined $index;
|
||||
my $duplex = $port_admin->{$iid};
|
||||
next unless defined $duplex;
|
||||
|
||||
next unless defined $duplex;
|
||||
|
||||
$duplex = 'half' if $duplex =~ /half/i;
|
||||
$duplex = 'full' if $duplex =~ /full/i;
|
||||
$duplex = 'auto' if $duplex =~ /auto/i;
|
||||
$i_duplex_admin{$index}=$duplex;
|
||||
$i_duplex_admin{$index} = $duplex;
|
||||
}
|
||||
return \%i_duplex_admin;
|
||||
}
|
||||
|
||||
sub i_vlan {
|
||||
my $centillion = shift;
|
||||
|
||||
|
||||
my $cn_vlan_index = $centillion->centillion_i_vlan_index();
|
||||
my $cn_vlan = $centillion->centillion_i_vlan();
|
||||
my $cn_vlan = $centillion->centillion_i_vlan();
|
||||
|
||||
my %i_vlan;
|
||||
foreach my $iid (keys %$cn_vlan_index){
|
||||
foreach my $iid ( keys %$cn_vlan_index ) {
|
||||
my $index = $cn_vlan_index->{$iid};
|
||||
next unless defined $index;
|
||||
my $vlan = $cn_vlan->{$iid};
|
||||
next unless defined $vlan;
|
||||
|
||||
$i_vlan{$index}=$vlan;
|
||||
next unless defined $vlan;
|
||||
|
||||
$i_vlan{$index} = $vlan;
|
||||
}
|
||||
return \%i_vlan;
|
||||
}
|
||||
|
||||
sub model {
|
||||
my $centillion = shift;
|
||||
my $id = $centillion->id();
|
||||
my $id = $centillion->id();
|
||||
return unless defined $id;
|
||||
my $model = &SNMP::translateObj($id);
|
||||
return $id unless defined $model;
|
||||
$model =~ s/^sreg-//i;
|
||||
|
||||
return '5000BH' if ($model =~ /5000BH/);
|
||||
return '5005BH' if ($model =~ /5005BH/);
|
||||
return 'C100' if ($model =~ /Centillion100/);
|
||||
return 'C50N' if ($model =~ /Centillion50N/);
|
||||
return 'C50T' if ($model =~ /Centillion50T/);
|
||||
return '5000BH' if ( $model =~ /5000BH/ );
|
||||
return '5005BH' if ( $model =~ /5005BH/ );
|
||||
return 'C100' if ( $model =~ /Centillion100/ );
|
||||
return 'C50N' if ( $model =~ /Centillion50N/ );
|
||||
return 'C50T' if ( $model =~ /Centillion50T/ );
|
||||
return $model;
|
||||
}
|
||||
|
||||
sub bp_index {
|
||||
my $centillion = shift;
|
||||
my $index = $centillion->fw_port();
|
||||
my $index = $centillion->fw_port();
|
||||
|
||||
my %bp_index;
|
||||
foreach my $iid (keys %$index){
|
||||
foreach my $iid ( keys %$index ) {
|
||||
my $b_index = $index->{$iid};
|
||||
next unless defined $b_index;
|
||||
|
||||
#Index value is the same as ifIndex
|
||||
#Index value is the same as ifIndex
|
||||
$bp_index{$b_index} = $b_index;
|
||||
}
|
||||
|
||||
@@ -239,7 +246,6 @@ sub slot_offset {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
@@ -411,7 +417,8 @@ to a hash.
|
||||
|
||||
Returns reference to the map between IID and physical Port.
|
||||
|
||||
Slot and port numbers on the Passport switches are determined by the formula:
|
||||
Slot and port numbers on the Passport switches are determined by the
|
||||
formula:
|
||||
port = index % 256
|
||||
slot = int(index / 256)
|
||||
|
||||
|
||||
@@ -3,21 +3,21 @@
|
||||
#
|
||||
# Copyright (c) 2008 Max Baker
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
#
|
||||
# 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
|
||||
# * 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
|
||||
#
|
||||
# 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
|
||||
@@ -41,60 +41,44 @@ use SNMP::Info::CiscoQOS;
|
||||
use SNMP::Info::CiscoConfig;
|
||||
use SNMP::Info::Layer2;
|
||||
|
||||
@SNMP::Info::Layer2::Cisco::ISA = qw/SNMP::Info::CiscoVTP SNMP::Info::CDP
|
||||
SNMP::Info::CiscoStats SNMP::Info::CiscoImage
|
||||
SNMP::Info::CiscoRTT SNMP::Info::CiscoQOS
|
||||
SNMP::Info::CiscoConfig SNMP::Info::Layer2
|
||||
Exporter/;
|
||||
@SNMP::Info::Layer2::Cisco::ISA = qw/SNMP::Info::CiscoVTP SNMP::Info::CDP
|
||||
SNMP::Info::CiscoStats SNMP::Info::CiscoImage
|
||||
SNMP::Info::CiscoRTT SNMP::Info::CiscoQOS
|
||||
SNMP::Info::CiscoConfig SNMP::Info::Layer2
|
||||
Exporter/;
|
||||
@SNMP::Info::Layer2::Cisco::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/ ;
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
$VERSION = '1.09';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer2::MIBS,
|
||||
%SNMP::Info::CiscoConfig::MIBS,
|
||||
%SNMP::Info::CiscoQOS::MIBS,
|
||||
%SNMP::Info::CiscoRTT::MIBS,
|
||||
%SNMP::Info::CiscoImage::MIBS,
|
||||
%SNMP::Info::CiscoStats::MIBS,
|
||||
%SNMP::Info::CDP::MIBS,
|
||||
%SNMP::Info::CiscoVTP::MIBS,
|
||||
);
|
||||
%SNMP::Info::Layer2::MIBS, %SNMP::Info::CiscoConfig::MIBS,
|
||||
%SNMP::Info::CiscoQOS::MIBS, %SNMP::Info::CiscoRTT::MIBS,
|
||||
%SNMP::Info::CiscoImage::MIBS, %SNMP::Info::CiscoStats::MIBS,
|
||||
%SNMP::Info::CDP::MIBS, %SNMP::Info::CiscoVTP::MIBS,
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer2::GLOBALS,
|
||||
%SNMP::Info::CiscoConfig::GLOBALS,
|
||||
%SNMP::Info::CiscoQOS::GLOBALS,
|
||||
%SNMP::Info::CiscoRTT::GLOBALS,
|
||||
%SNMP::Info::CiscoImage::GLOBALS,
|
||||
%SNMP::Info::CiscoStats::GLOBALS,
|
||||
%SNMP::Info::CDP::GLOBALS,
|
||||
%SNMP::Info::CiscoVTP::GLOBALS,
|
||||
);
|
||||
%SNMP::Info::Layer2::GLOBALS, %SNMP::Info::CiscoConfig::GLOBALS,
|
||||
%SNMP::Info::CiscoQOS::GLOBALS, %SNMP::Info::CiscoRTT::GLOBALS,
|
||||
%SNMP::Info::CiscoImage::GLOBALS, %SNMP::Info::CiscoStats::GLOBALS,
|
||||
%SNMP::Info::CDP::GLOBALS, %SNMP::Info::CiscoVTP::GLOBALS,
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer2::FUNCS,
|
||||
%SNMP::Info::CiscoConfig::FUNCS,
|
||||
%SNMP::Info::CiscoQOS::FUNCS,
|
||||
%SNMP::Info::CiscoRTT::FUNCS,
|
||||
%SNMP::Info::CiscoImage::FUNCS,
|
||||
%SNMP::Info::CiscoStats::FUNCS,
|
||||
%SNMP::Info::CDP::FUNCS,
|
||||
%SNMP::Info::CiscoVTP::FUNCS,
|
||||
);
|
||||
%SNMP::Info::Layer2::FUNCS, %SNMP::Info::CiscoConfig::FUNCS,
|
||||
%SNMP::Info::CiscoQOS::FUNCS, %SNMP::Info::CiscoRTT::FUNCS,
|
||||
%SNMP::Info::CiscoImage::FUNCS, %SNMP::Info::CiscoStats::FUNCS,
|
||||
%SNMP::Info::CDP::FUNCS, %SNMP::Info::CiscoVTP::FUNCS,
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer2::MUNGE,
|
||||
%SNMP::Info::CiscoConfig::MUNGE,
|
||||
%SNMP::Info::CiscoQOS::MUNGE,
|
||||
%SNMP::Info::CiscoRTT::MUNGE,
|
||||
%SNMP::Info::CiscoImage::MUNGE,
|
||||
%SNMP::Info::CiscoStats::MUNGE,
|
||||
%SNMP::Info::CDP::MUNGE,
|
||||
%SNMP::Info::CiscoVTP::MUNGE,
|
||||
);
|
||||
%SNMP::Info::Layer2::MUNGE, %SNMP::Info::CiscoConfig::MUNGE,
|
||||
%SNMP::Info::CiscoQOS::MUNGE, %SNMP::Info::CiscoRTT::MUNGE,
|
||||
%SNMP::Info::CiscoImage::MUNGE, %SNMP::Info::CiscoStats::MUNGE,
|
||||
%SNMP::Info::CDP::MUNGE, %SNMP::Info::CiscoVTP::MUNGE,
|
||||
);
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
@@ -4,20 +4,20 @@
|
||||
# Copyright (c) 2008 Max Baker
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# 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
|
||||
# * 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
|
||||
#
|
||||
# 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
|
||||
@@ -37,51 +37,45 @@ use SNMP::Info::FDP;
|
||||
use SNMP::Info::EtherLike;
|
||||
use SNMP::Info::MAU;
|
||||
|
||||
@SNMP::Info::Layer2::Foundry::ISA = qw/SNMP::Info::Layer2 SNMP::Info::FDP SNMP::Info::EtherLike
|
||||
SNMP::Info::MAU Exporter/;
|
||||
@SNMP::Info::Layer2::Foundry::ISA
|
||||
= qw/SNMP::Info::Layer2 SNMP::Info::FDP SNMP::Info::EtherLike
|
||||
SNMP::Info::MAU Exporter/;
|
||||
@SNMP::Info::Layer2::Foundry::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
|
||||
|
||||
$VERSION = '1.09';
|
||||
|
||||
%MIBS = ( %SNMP::Info::Layer2::MIBS,
|
||||
%SNMP::Info::FDP::MIBS,
|
||||
%SNMP::Info::EtherLike::MIBS,
|
||||
%SNMP::Info::MAU::MIBS,
|
||||
'FOUNDRY-SN-ROOT-MIB' => 'foundry',
|
||||
);
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer2::MIBS, %SNMP::Info::FDP::MIBS,
|
||||
%SNMP::Info::EtherLike::MIBS, %SNMP::Info::MAU::MIBS,
|
||||
'FOUNDRY-SN-ROOT-MIB' => 'foundry',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer2::GLOBALS,
|
||||
%SNMP::Info::FDP::GLOBALS,
|
||||
%SNMP::Info::EtherLike::GLOBALS,
|
||||
%SNMP::Info::MAU::GLOBALS,
|
||||
);
|
||||
%SNMP::Info::Layer2::GLOBALS, %SNMP::Info::FDP::GLOBALS,
|
||||
%SNMP::Info::EtherLike::GLOBALS, %SNMP::Info::MAU::GLOBALS,
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer2::FUNCS,
|
||||
%SNMP::Info::FDP::FUNCS,
|
||||
%SNMP::Info::EtherLike::FUNCS,
|
||||
%SNMP::Info::MAU::FUNCS,
|
||||
'test' => 'dot1dStpPortState',
|
||||
);
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer2::FUNCS, %SNMP::Info::FDP::FUNCS,
|
||||
%SNMP::Info::EtherLike::FUNCS, %SNMP::Info::MAU::FUNCS,
|
||||
'test' => 'dot1dStpPortState',
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer2::MUNGE,
|
||||
%SNMP::Info::FDP::MUNGE,
|
||||
%SNMP::Info::EtherLike::MUNGE,
|
||||
%SNMP::Info::MAU::MUNGE,
|
||||
);
|
||||
|
||||
%SNMP::Info::Layer2::MUNGE, %SNMP::Info::FDP::MUNGE,
|
||||
%SNMP::Info::EtherLike::MUNGE, %SNMP::Info::MAU::MUNGE,
|
||||
);
|
||||
|
||||
# Method OverRides
|
||||
|
||||
#sub bulkwalk_no { 1;}
|
||||
|
||||
*SNMP::Info::Layer2::Foundry::i_duplex = \&SNMP::Info::MAU::mau_i_duplex;
|
||||
*SNMP::Info::Layer2::Foundry::i_duplex_admin = \&SNMP::Info::MAU::mau_i_duplex_admin;
|
||||
*SNMP::Info::Layer2::Foundry::i_vlan = \&SNMP::Info::Bridge::qb_i_vlan_t;
|
||||
*SNMP::Info::Layer2::Foundry::i_duplex = \&SNMP::Info::MAU::mau_i_duplex;
|
||||
*SNMP::Info::Layer2::Foundry::i_duplex_admin
|
||||
= \&SNMP::Info::MAU::mau_i_duplex_admin;
|
||||
*SNMP::Info::Layer2::Foundry::i_vlan = \&SNMP::Info::Bridge::qb_i_vlan_t;
|
||||
|
||||
# todo doc these
|
||||
|
||||
@@ -92,19 +86,19 @@ sub os_ver {
|
||||
|
||||
# find entity table entry for "stackmanaget.1"
|
||||
my $unit_iid = undef;
|
||||
foreach my $e (keys %$e_name){
|
||||
foreach my $e ( keys %$e_name ) {
|
||||
my $name = $e_name->{$e} || '';
|
||||
$unit_iid = $e if $name eq 'stackmanaget.1';
|
||||
}
|
||||
|
||||
|
||||
# Default to OID method if no dice.
|
||||
unless (defined $unit_iid){
|
||||
unless ( defined $unit_iid ) {
|
||||
return $foundry->SUPER::model();
|
||||
}
|
||||
|
||||
# Find Model Name
|
||||
my $e_fwver = $foundry->e_fwver();
|
||||
if (defined $e_fwver->{$unit_iid}){
|
||||
if ( defined $e_fwver->{$unit_iid} ) {
|
||||
return $e_fwver->{$unit_iid};
|
||||
}
|
||||
|
||||
@@ -119,25 +113,25 @@ sub model {
|
||||
|
||||
# find entity table entry for "unit.1"
|
||||
my $unit_iid = undef;
|
||||
foreach my $e (keys %$e_name){
|
||||
foreach my $e ( keys %$e_name ) {
|
||||
my $name = $e_name->{$e} || '';
|
||||
$unit_iid = $e if $name eq 'unit.1';
|
||||
}
|
||||
|
||||
|
||||
# Default to OID method if no dice.
|
||||
unless (defined $unit_iid){
|
||||
unless ( defined $unit_iid ) {
|
||||
return $foundry->SUPER::model();
|
||||
}
|
||||
|
||||
# Find Model Name
|
||||
my $e_model = $foundry->e_model();
|
||||
if (defined $e_model->{$unit_iid}){
|
||||
if ( defined $e_model->{$unit_iid} ) {
|
||||
return $e_model->{$unit_iid};
|
||||
}
|
||||
|
||||
# Not found in ENTITY-MIB, go up a level.
|
||||
return $foundry->SUPER::model();
|
||||
|
||||
|
||||
}
|
||||
|
||||
sub serial {
|
||||
@@ -147,7 +141,7 @@ sub serial {
|
||||
|
||||
# find entity table entry for "unit.1"
|
||||
my $unit_iid = undef;
|
||||
foreach my $e (keys %$e_name){
|
||||
foreach my $e ( keys %$e_name ) {
|
||||
my $name = $e_name->{$e} || '';
|
||||
$unit_iid = $e if $name eq 'unit.1';
|
||||
}
|
||||
@@ -165,13 +159,13 @@ sub interfaces {
|
||||
my $i_descr = $foundry->i_description;
|
||||
my $i_name = $foundry->i_name;
|
||||
|
||||
# use ifName only if it is in portn
|
||||
# use ifName only if it is in portn
|
||||
# format. For EdgeIrons
|
||||
# else use ifDescr
|
||||
foreach my $iid (keys %$i_name){
|
||||
foreach my $iid ( keys %$i_name ) {
|
||||
my $name = $i_name->{$iid};
|
||||
next unless defined $name;
|
||||
$i_descr->{$iid} = $name
|
||||
$i_descr->{$iid} = $name
|
||||
if $name =~ /^port\d+/i;
|
||||
}
|
||||
|
||||
@@ -180,21 +174,21 @@ sub interfaces {
|
||||
|
||||
sub i_ignore {
|
||||
my $foundry = shift;
|
||||
my $i_type = $foundry->i_type();
|
||||
my $i_type = $foundry->i_type();
|
||||
|
||||
my %i_ignore = ();
|
||||
|
||||
foreach my $iid (keys %$i_type){
|
||||
foreach my $iid ( keys %$i_type ) {
|
||||
my $type = $i_type->{$iid} || '';
|
||||
$i_ignore{$iid}++
|
||||
$i_ignore{$iid}++
|
||||
|
||||
# 33 is the console port
|
||||
if $type =~ /(loopback|propvirtual|other|cpu|33)/i;
|
||||
}
|
||||
return \%i_ignore;
|
||||
}
|
||||
|
||||
|
||||
sub os {
|
||||
sub os {
|
||||
return 'foundry';
|
||||
}
|
||||
|
||||
@@ -211,7 +205,8 @@ __END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer2::Foundry - SNMP Interface to Foundry FastIron Network Devices
|
||||
SNMP::Info::Layer2::Foundry - SNMP Interface to Foundry FastIron Network
|
||||
Devices
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
|
||||
@@ -5,21 +5,21 @@
|
||||
#
|
||||
# Copyright (c) 2002,2003 Regents of the University of California
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
#
|
||||
# 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
|
||||
# * 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
|
||||
#
|
||||
# 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
|
||||
@@ -39,140 +39,147 @@ use SNMP::Info::MAU;
|
||||
use SNMP::Info::LLDP;
|
||||
use SNMP::Info::CDP;
|
||||
|
||||
@SNMP::Info::Layer2::HP::ISA = qw/SNMP::Info::Layer3 SNMP::Info::MAU SNMP::Info::LLDP
|
||||
SNMP::Info::CDP Exporter/;
|
||||
@SNMP::Info::Layer2::HP::ISA
|
||||
= qw/SNMP::Info::Layer3 SNMP::Info::MAU SNMP::Info::LLDP
|
||||
SNMP::Info::CDP Exporter/;
|
||||
@SNMP::Info::Layer2::HP::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %PORTSTAT %MODEL_MAP %MUNGE/ ;
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %PORTSTAT %MODEL_MAP %MUNGE/;
|
||||
|
||||
$VERSION = '1.09';
|
||||
|
||||
%MIBS = ( %SNMP::Info::Layer3::MIBS,
|
||||
%SNMP::Info::MAU::MIBS,
|
||||
%SNMP::Info::LLDP::MIBS,
|
||||
%SNMP::Info::CDP::MIBS,
|
||||
'RFC1271-MIB' => 'logDescription',
|
||||
'HP-ICF-OID' => 'hpSwitch4000',
|
||||
'HP-VLAN' => 'hpVlanMemberIndex',
|
||||
'STATISTICS-MIB' => 'hpSwitchCpuStat',
|
||||
'NETSWITCH-MIB' => 'hpMsgBufFree',
|
||||
'CONFIG-MIB' => 'hpSwitchConfig',
|
||||
'SEMI-MIB' => 'hpHttpMgSerialNumber',
|
||||
'HP-ICF-CHASSIS' => 'hpicfSensorObjectId',
|
||||
);
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::MIBS,
|
||||
%SNMP::Info::MAU::MIBS,
|
||||
%SNMP::Info::LLDP::MIBS,
|
||||
%SNMP::Info::CDP::MIBS,
|
||||
'RFC1271-MIB' => 'logDescription',
|
||||
'HP-ICF-OID' => 'hpSwitch4000',
|
||||
'HP-VLAN' => 'hpVlanMemberIndex',
|
||||
'STATISTICS-MIB' => 'hpSwitchCpuStat',
|
||||
'NETSWITCH-MIB' => 'hpMsgBufFree',
|
||||
'CONFIG-MIB' => 'hpSwitchConfig',
|
||||
'SEMI-MIB' => 'hpHttpMgSerialNumber',
|
||||
'HP-ICF-CHASSIS' => 'hpicfSensorObjectId',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::GLOBALS,
|
||||
%SNMP::Info::MAU::GLOBALS,
|
||||
%SNMP::Info::LLDP::GLOBALS,
|
||||
%SNMP::Info::CDP::GLOBALS,
|
||||
'serial1' => 'entPhysicalSerialNum.1',
|
||||
'serial2' => 'hpHttpMgSerialNumber.0',
|
||||
'hp_cpu' => 'hpSwitchCpuStat.0',
|
||||
'hp_mem_total' => 'hpGlobalMemTotalBytes.1',
|
||||
'mem_free' => 'hpGlobalMemFreeBytes.1',
|
||||
'mem_used' => 'hpGlobalMemAllocBytes.1',
|
||||
'os_version' => 'hpSwitchOsVersion.0',
|
||||
'os_bin' => 'hpSwitchRomVersion.0',
|
||||
'mac' => 'hpSwitchBaseMACAddress.0',
|
||||
'hp_vlans' => 'hpVlanNumber',
|
||||
);
|
||||
%SNMP::Info::Layer3::GLOBALS,
|
||||
%SNMP::Info::MAU::GLOBALS,
|
||||
%SNMP::Info::LLDP::GLOBALS,
|
||||
%SNMP::Info::CDP::GLOBALS,
|
||||
'serial1' => 'entPhysicalSerialNum.1',
|
||||
'serial2' => 'hpHttpMgSerialNumber.0',
|
||||
'hp_cpu' => 'hpSwitchCpuStat.0',
|
||||
'hp_mem_total' => 'hpGlobalMemTotalBytes.1',
|
||||
'mem_free' => 'hpGlobalMemFreeBytes.1',
|
||||
'mem_used' => 'hpGlobalMemAllocBytes.1',
|
||||
'os_version' => 'hpSwitchOsVersion.0',
|
||||
'os_bin' => 'hpSwitchRomVersion.0',
|
||||
'mac' => 'hpSwitchBaseMACAddress.0',
|
||||
'hp_vlans' => 'hpVlanNumber',
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::FUNCS,
|
||||
%SNMP::Info::MAU::FUNCS,
|
||||
%SNMP::Info::LLDP::FUNCS,
|
||||
%SNMP::Info::CDP::FUNCS,
|
||||
'bp_index2' => 'dot1dBasePortIfIndex',
|
||||
'i_type2' => 'ifType',
|
||||
# RFC1271
|
||||
'l_descr' => 'logDescription',
|
||||
# HP-VLAN-MIB
|
||||
'hp_v_index' => 'hpVlanDot1QID',
|
||||
'hp_v_name' => 'hpVlanIdentName',
|
||||
'hp_v_state' => 'hpVlanIdentState',
|
||||
'hp_v_type' => 'hpVlanIdentType',
|
||||
'hp_v_status' => 'hpVlanIdentStatus',
|
||||
'hp_v_mac' => 'hpVlanAddrPhysAddress',
|
||||
'hp_v_if_index'=> 'hpVlanMemberIndex',
|
||||
'hp_v_if_tag' => 'hpVlanMemberTagged2',
|
||||
# CONFIG-MIB::hpSwitchPortTable
|
||||
'hp_duplex' => 'hpSwitchPortEtherMode',
|
||||
'hp_duplex_admin' => 'hpSwitchPortFastEtherMode',
|
||||
# HP-ICF-CHASSIS
|
||||
'hp_s_oid' => 'hpicfSensorObjectId',
|
||||
'hp_s_name' => 'hpicfSensorDescr',
|
||||
'hp_s_status' => 'hpicfSensorStatus',
|
||||
);
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::FUNCS,
|
||||
%SNMP::Info::MAU::FUNCS,
|
||||
%SNMP::Info::LLDP::FUNCS,
|
||||
%SNMP::Info::CDP::FUNCS,
|
||||
'bp_index2' => 'dot1dBasePortIfIndex',
|
||||
'i_type2' => 'ifType',
|
||||
|
||||
# RFC1271
|
||||
'l_descr' => 'logDescription',
|
||||
|
||||
# HP-VLAN-MIB
|
||||
'hp_v_index' => 'hpVlanDot1QID',
|
||||
'hp_v_name' => 'hpVlanIdentName',
|
||||
'hp_v_state' => 'hpVlanIdentState',
|
||||
'hp_v_type' => 'hpVlanIdentType',
|
||||
'hp_v_status' => 'hpVlanIdentStatus',
|
||||
'hp_v_mac' => 'hpVlanAddrPhysAddress',
|
||||
'hp_v_if_index' => 'hpVlanMemberIndex',
|
||||
'hp_v_if_tag' => 'hpVlanMemberTagged2',
|
||||
|
||||
# CONFIG-MIB::hpSwitchPortTable
|
||||
'hp_duplex' => 'hpSwitchPortEtherMode',
|
||||
'hp_duplex_admin' => 'hpSwitchPortFastEtherMode',
|
||||
|
||||
# HP-ICF-CHASSIS
|
||||
'hp_s_oid' => 'hpicfSensorObjectId',
|
||||
'hp_s_name' => 'hpicfSensorDescr',
|
||||
'hp_s_status' => 'hpicfSensorStatus',
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
# Inherit all the built in munging
|
||||
%SNMP::Info::Layer3::MUNGE,
|
||||
%SNMP::Info::MAU::MUNGE,
|
||||
%SNMP::Info::LLDP::MUNGE,
|
||||
%SNMP::Info::CDP::MUNGE
|
||||
);
|
||||
|
||||
%MODEL_MAP = (
|
||||
'J4093A' => '2424M',
|
||||
'J4110A' => '8000M',
|
||||
'J4120A' => '1600M',
|
||||
'J4121A' => '4000M',
|
||||
'J4122A' => '2400M',
|
||||
'J4122B' => '2424M',
|
||||
'J4138A' => '9308M',
|
||||
'J4139A' => '9304M',
|
||||
'J4812A' => '2512',
|
||||
'J4813A' => '2524',
|
||||
'J4815A' => '3324XL',
|
||||
'J4819A' => '5308XL',
|
||||
'J4840A' => '6308M-SX',
|
||||
'J4841A' => '6208M-SX',
|
||||
'J4850A' => '5304XL',
|
||||
'J4851A' => '3124',
|
||||
'J4865A' => '4108GL',
|
||||
'J4874A' => '9315M',
|
||||
'J4887A' => '4104GL',
|
||||
'J4899A' => '2650',
|
||||
'J4899B' => '2650-CR',
|
||||
'J4900A' => '2626',
|
||||
'J4900B' => '2626-CR',
|
||||
'J4902A' => '6108',
|
||||
'J4903A' => '2824',
|
||||
'J4904A' => '2848',
|
||||
'J4905A' => '3400cl-24G',
|
||||
'J4906A' => '3400cl-48G',
|
||||
'J8130A' => 'WAP-420-NA',
|
||||
'J8131A' => 'WAP-420-WW',
|
||||
'J8133A' => 'AP520WL',
|
||||
'J8164A' => '2626-PWR',
|
||||
'J8165A' => '2650-PWR',
|
||||
'J8433A' => 'CX4-6400cl-6XG',
|
||||
'J8474A' => 'MF-6400cl-6XG',
|
||||
'J8680A' => '9608sl',
|
||||
'J8692A' => '3500yl-24G-PWR',
|
||||
'J8693A' => '3500yl-48G-PWR',
|
||||
'J8697A' => '5406zl',
|
||||
'J8698A' => '5412zl',
|
||||
'J8718A' => '5404yl',
|
||||
'J8719A' => '5408yl',
|
||||
'J8770A' => '4204vl',
|
||||
'J8771A' => '4202vl-48G',
|
||||
'J8772A' => '4202vl-72',
|
||||
'J8773A' => '4208vl',
|
||||
'J8762A' => '2600-8-PWR',
|
||||
'J8992A' => '6200yl-24G',
|
||||
'J9019A' => '2510-24A',
|
||||
'J9020A' => '2510-48A',
|
||||
'J9021A' => '2810-24G',
|
||||
'J9022A' => '2810-48G',
|
||||
'J9028A' => '1800-24G',
|
||||
'J9029A' => '1800-8G',
|
||||
'J9050A' => '2900-48G',
|
||||
'J9049A' => '2900-24G',
|
||||
'J9032A' => '4202vl-68G',
|
||||
'J9091A' => '8212zl',
|
||||
);
|
||||
# Inherit all the built in munging
|
||||
%SNMP::Info::Layer3::MUNGE,
|
||||
%SNMP::Info::MAU::MUNGE,
|
||||
%SNMP::Info::LLDP::MUNGE,
|
||||
%SNMP::Info::CDP::MUNGE
|
||||
);
|
||||
|
||||
%MODEL_MAP = (
|
||||
'J4093A' => '2424M',
|
||||
'J4110A' => '8000M',
|
||||
'J4120A' => '1600M',
|
||||
'J4121A' => '4000M',
|
||||
'J4122A' => '2400M',
|
||||
'J4122B' => '2424M',
|
||||
'J4138A' => '9308M',
|
||||
'J4139A' => '9304M',
|
||||
'J4812A' => '2512',
|
||||
'J4813A' => '2524',
|
||||
'J4815A' => '3324XL',
|
||||
'J4819A' => '5308XL',
|
||||
'J4840A' => '6308M-SX',
|
||||
'J4841A' => '6208M-SX',
|
||||
'J4850A' => '5304XL',
|
||||
'J4851A' => '3124',
|
||||
'J4865A' => '4108GL',
|
||||
'J4874A' => '9315M',
|
||||
'J4887A' => '4104GL',
|
||||
'J4899A' => '2650',
|
||||
'J4899B' => '2650-CR',
|
||||
'J4900A' => '2626',
|
||||
'J4900B' => '2626-CR',
|
||||
'J4902A' => '6108',
|
||||
'J4903A' => '2824',
|
||||
'J4904A' => '2848',
|
||||
'J4905A' => '3400cl-24G',
|
||||
'J4906A' => '3400cl-48G',
|
||||
'J8130A' => 'WAP-420-NA',
|
||||
'J8131A' => 'WAP-420-WW',
|
||||
'J8133A' => 'AP520WL',
|
||||
'J8164A' => '2626-PWR',
|
||||
'J8165A' => '2650-PWR',
|
||||
'J8433A' => 'CX4-6400cl-6XG',
|
||||
'J8474A' => 'MF-6400cl-6XG',
|
||||
'J8680A' => '9608sl',
|
||||
'J8692A' => '3500yl-24G-PWR',
|
||||
'J8693A' => '3500yl-48G-PWR',
|
||||
'J8697A' => '5406zl',
|
||||
'J8698A' => '5412zl',
|
||||
'J8718A' => '5404yl',
|
||||
'J8719A' => '5408yl',
|
||||
'J8770A' => '4204vl',
|
||||
'J8771A' => '4202vl-48G',
|
||||
'J8772A' => '4202vl-72',
|
||||
'J8773A' => '4208vl',
|
||||
'J8762A' => '2600-8-PWR',
|
||||
'J8992A' => '6200yl-24G',
|
||||
'J9019A' => '2510-24A',
|
||||
'J9020A' => '2510-48A',
|
||||
'J9021A' => '2810-24G',
|
||||
'J9022A' => '2810-48G',
|
||||
'J9028A' => '1800-24G',
|
||||
'J9029A' => '1800-8G',
|
||||
'J9050A' => '2900-48G',
|
||||
'J9049A' => '2900-24G',
|
||||
'J9032A' => '4202vl-68G',
|
||||
'J9091A' => '8212zl',
|
||||
);
|
||||
|
||||
# Method Overrides
|
||||
|
||||
@@ -189,13 +196,15 @@ sub mem_total {
|
||||
sub os {
|
||||
return 'hp';
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $hp = shift;
|
||||
my $hp = shift;
|
||||
my $os_version = $hp->os_version();
|
||||
return $os_version if defined $os_version;
|
||||
|
||||
# Some older ones don't have this value,so we cull it from the description
|
||||
my $descr = $hp->description();
|
||||
if ($descr =~ m/revision ([A-Z]{1}\.\d{2}\.\d{2})/) {
|
||||
if ( $descr =~ m/revision ([A-Z]{1}\.\d{2}\.\d{2})/ ) {
|
||||
return $1;
|
||||
}
|
||||
return;
|
||||
@@ -208,7 +217,7 @@ sub model {
|
||||
return unless defined $id;
|
||||
my $model = &SNMP::translateObj($id);
|
||||
return $id unless defined $model;
|
||||
|
||||
|
||||
$model =~ s/^hpswitch//i;
|
||||
|
||||
return defined $MODEL_MAP{$model} ? $MODEL_MAP{$model} : $model;
|
||||
@@ -220,19 +229,19 @@ sub serial {
|
||||
|
||||
my $serial = $hp->serial1() || $hp->serial2() || undef;
|
||||
|
||||
return $serial;
|
||||
return $serial;
|
||||
}
|
||||
|
||||
sub interfaces {
|
||||
my $hp = shift;
|
||||
my $hp = shift;
|
||||
my $interfaces = $hp->i_index();
|
||||
my $i_descr = $hp->i_description();
|
||||
my $i_descr = $hp->i_description();
|
||||
|
||||
my %if;
|
||||
foreach my $iid (keys %$interfaces){
|
||||
foreach my $iid ( keys %$interfaces ) {
|
||||
my $descr = $i_descr->{$iid};
|
||||
next unless defined $descr;
|
||||
$if{$iid} = $descr if (defined $descr and length $descr);
|
||||
$if{$iid} = $descr if ( defined $descr and length $descr );
|
||||
}
|
||||
|
||||
return \%if
|
||||
@@ -240,14 +249,14 @@ sub interfaces {
|
||||
}
|
||||
|
||||
sub i_name {
|
||||
my $hp = shift;
|
||||
my $i_alias = $hp->i_alias();
|
||||
my $e_name = $hp->e_name();
|
||||
my $e_port = $hp->e_port();
|
||||
my $hp = shift;
|
||||
my $i_alias = $hp->i_alias();
|
||||
my $e_name = $hp->e_name();
|
||||
my $e_port = $hp->e_port();
|
||||
|
||||
my %i_name;
|
||||
|
||||
foreach my $port (keys %$e_name){
|
||||
foreach my $port ( keys %$e_name ) {
|
||||
my $iid = $e_port->{$port};
|
||||
next unless defined $iid;
|
||||
my $alias = $i_alias->{$iid};
|
||||
@@ -255,9 +264,9 @@ sub i_name {
|
||||
$i_name{$iid} = $e_name->{$port};
|
||||
|
||||
# Check for alias
|
||||
$i_name{$iid} = $alias if (defined $alias and length($alias));
|
||||
$i_name{$iid} = $alias if ( defined $alias and length($alias) );
|
||||
}
|
||||
|
||||
|
||||
return \%i_name;
|
||||
}
|
||||
|
||||
@@ -268,22 +277,22 @@ sub i_duplex {
|
||||
}
|
||||
|
||||
sub i_duplex_admin {
|
||||
my $hp = shift;
|
||||
my $hp = shift;
|
||||
my $partial = shift;
|
||||
|
||||
# Try HP MIB first
|
||||
my $hp_duplex = $hp->hp_duplex_admin($partial);
|
||||
if (defined $hp_duplex and scalar(keys %$hp_duplex)){
|
||||
if ( defined $hp_duplex and scalar( keys %$hp_duplex ) ) {
|
||||
|
||||
my %i_duplex;
|
||||
foreach my $if (keys %$hp_duplex){
|
||||
foreach my $if ( keys %$hp_duplex ) {
|
||||
my $duplex = $hp_duplex->{$if};
|
||||
next unless defined $duplex;
|
||||
|
||||
next unless defined $duplex;
|
||||
|
||||
$duplex = 'half' if $duplex =~ /half/i;
|
||||
$duplex = 'full' if $duplex =~ /full/i;
|
||||
$duplex = 'auto' if $duplex =~ /auto/i;
|
||||
$i_duplex{$if}=$duplex;
|
||||
$i_duplex{$if} = $duplex;
|
||||
}
|
||||
return \%i_duplex;
|
||||
}
|
||||
@@ -297,29 +306,29 @@ sub vendor {
|
||||
}
|
||||
|
||||
sub log {
|
||||
my $hp=shift;
|
||||
my $hp = shift;
|
||||
|
||||
my $log = $hp->l_descr();
|
||||
|
||||
my $logstring = undef;
|
||||
|
||||
foreach my $val (values %$log){
|
||||
foreach my $val ( values %$log ) {
|
||||
next if $val =~ /^Link\s+(Up|Down)/;
|
||||
$logstring .= "$val\n";
|
||||
$logstring .= "$val\n";
|
||||
}
|
||||
|
||||
return $logstring;
|
||||
return $logstring;
|
||||
}
|
||||
|
||||
sub slots {
|
||||
my $hp=shift;
|
||||
|
||||
my $hp = shift;
|
||||
|
||||
my $e_name = $hp->e_name();
|
||||
|
||||
return unless defined $e_name;
|
||||
|
||||
my $slots;
|
||||
foreach my $slot (keys %$e_name) {
|
||||
foreach my $slot ( keys %$e_name ) {
|
||||
$slots++ if $e_name->{$slot} =~ /slot/i;
|
||||
}
|
||||
|
||||
@@ -328,31 +337,33 @@ sub slots {
|
||||
|
||||
sub fan {
|
||||
my $hp = shift;
|
||||
return &_sensor($hp, 'fan');
|
||||
return &_sensor( $hp, 'fan' );
|
||||
}
|
||||
|
||||
sub ps1_status {
|
||||
my $hp = shift;
|
||||
return &_sensor($hp, 'power', '^power supply 1') || &_sensor($hp, 'power', '^power supply sensor');
|
||||
return &_sensor( $hp, 'power', '^power supply 1' )
|
||||
|| &_sensor( $hp, 'power', '^power supply sensor' );
|
||||
}
|
||||
|
||||
sub ps2_status {
|
||||
my $hp = shift;
|
||||
return &_sensor($hp, 'power', '^power supply 2') || &_sensor($hp, 'power', '^redundant');
|
||||
return &_sensor( $hp, 'power', '^power supply 2' )
|
||||
|| &_sensor( $hp, 'power', '^redundant' );
|
||||
}
|
||||
|
||||
sub _sensor {
|
||||
my $hp = shift;
|
||||
my $hp = shift;
|
||||
my $search_type = shift || 'fan';
|
||||
my $search_name = shift || '';
|
||||
my $hp_s_oid = $hp->hp_s_oid();
|
||||
my $hp_s_oid = $hp->hp_s_oid();
|
||||
my $result;
|
||||
foreach my $sensor (keys %$hp_s_oid) {
|
||||
my $sensortype = &SNMP::translateObj($hp_s_oid->{$sensor});
|
||||
if ($sensortype =~ /$search_type/i) {
|
||||
my $sensorname = $hp->hp_s_name()->{$sensor};
|
||||
foreach my $sensor ( keys %$hp_s_oid ) {
|
||||
my $sensortype = &SNMP::translateObj( $hp_s_oid->{$sensor} );
|
||||
if ( $sensortype =~ /$search_type/i ) {
|
||||
my $sensorname = $hp->hp_s_name()->{$sensor};
|
||||
my $sensorstatus = $hp->hp_s_status()->{$sensor};
|
||||
if ($sensorname =~ /$search_name/i) {
|
||||
if ( $sensorname =~ /$search_name/i ) {
|
||||
$result = $sensorstatus;
|
||||
}
|
||||
}
|
||||
@@ -362,19 +373,19 @@ sub _sensor {
|
||||
|
||||
# Bridge MIB does not map Bridge Port to ifIndex correctly on all models
|
||||
sub bp_index {
|
||||
my $hp = shift;
|
||||
my $hp = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $if_index = $hp->i_index($partial);
|
||||
my $model = $hp->model();
|
||||
my $model = $hp->model();
|
||||
my $bp_index = $hp->bp_index2($partial);
|
||||
|
||||
unless (defined $model and $model =~ /(1600|2424|4000|8000)/) {
|
||||
|
||||
unless ( defined $model and $model =~ /(1600|2424|4000|8000)/ ) {
|
||||
return $bp_index;
|
||||
}
|
||||
|
||||
my %mod_bp_index;
|
||||
foreach my $iid (keys %$if_index){
|
||||
foreach my $iid ( keys %$if_index ) {
|
||||
$mod_bp_index{$iid} = $iid;
|
||||
}
|
||||
return \%mod_bp_index;
|
||||
@@ -384,12 +395,12 @@ sub bp_index {
|
||||
# Q-BRIDGE if available.
|
||||
|
||||
sub v_index {
|
||||
my $hp = shift;
|
||||
my $hp = shift;
|
||||
my $partial = shift;
|
||||
|
||||
# Newer devices
|
||||
my $q_index = $hp->SUPER::v_index($partial);
|
||||
if (defined $q_index and scalar(keys %$q_index)){
|
||||
if ( defined $q_index and scalar( keys %$q_index ) ) {
|
||||
return $q_index;
|
||||
}
|
||||
|
||||
@@ -398,12 +409,12 @@ sub v_index {
|
||||
}
|
||||
|
||||
sub v_name {
|
||||
my $hp = shift;
|
||||
my $hp = shift;
|
||||
my $partial = shift;
|
||||
|
||||
# Newer devices
|
||||
my $q_name = $hp->SUPER::v_name($partial);
|
||||
if (defined $q_name and scalar(keys %$q_name)){
|
||||
if ( defined $q_name and scalar( keys %$q_name ) ) {
|
||||
return $q_name;
|
||||
}
|
||||
|
||||
@@ -416,23 +427,23 @@ sub i_vlan {
|
||||
|
||||
# Newer devices use Q-BRIDGE-MIB
|
||||
my $qb_i_vlan = $hp->SUPER::i_vlan();
|
||||
if (defined $qb_i_vlan and scalar(keys %$qb_i_vlan)){
|
||||
if ( defined $qb_i_vlan and scalar( keys %$qb_i_vlan ) ) {
|
||||
return $qb_i_vlan;
|
||||
}
|
||||
|
||||
# HP4000 ... get it from HP-VLAN
|
||||
# the hpvlanmembertagged2 table has an entry in the form of
|
||||
# the hpvlanmembertagged2 table has an entry in the form of
|
||||
# vlan.interface = /untagged/no/tagged/auto
|
||||
my $i_vlan = {};
|
||||
my $hp_v_index = $hp->hp_v_index();
|
||||
my $hp_v_if_tag = $hp->hp_v_if_tag();
|
||||
foreach my $row (keys %$hp_v_if_tag){
|
||||
my ($index,$if) = split(/\./,$row);
|
||||
foreach my $row ( keys %$hp_v_if_tag ) {
|
||||
my ( $index, $if ) = split( /\./, $row );
|
||||
|
||||
my $tag = $hp_v_if_tag->{$row};
|
||||
my $tag = $hp_v_if_tag->{$row};
|
||||
my $vlan = $hp_v_index->{$index};
|
||||
|
||||
next unless (defined $tag and $tag =~ /untagged/);
|
||||
|
||||
next unless ( defined $tag and $tag =~ /untagged/ );
|
||||
|
||||
$i_vlan->{$if} = $vlan if defined $vlan;
|
||||
}
|
||||
@@ -445,24 +456,24 @@ sub i_vlan_membership {
|
||||
|
||||
# Newer devices use Q-BRIDGE-MIB
|
||||
my $qb_i_vlan = $hp->SUPER::i_vlan_membership();
|
||||
if (defined $qb_i_vlan and scalar(keys %$qb_i_vlan)){
|
||||
if ( defined $qb_i_vlan and scalar( keys %$qb_i_vlan ) ) {
|
||||
return $qb_i_vlan;
|
||||
}
|
||||
|
||||
# Older get it from HP-VLAN
|
||||
my $i_vlan_membership = {};
|
||||
my $hp_v_index = $hp->hp_v_index();
|
||||
my $hp_v_if_tag = $hp->hp_v_if_tag();
|
||||
foreach my $row (keys %$hp_v_if_tag){
|
||||
my ($index,$if) = split(/\./,$row);
|
||||
my $hp_v_index = $hp->hp_v_index();
|
||||
my $hp_v_if_tag = $hp->hp_v_if_tag();
|
||||
foreach my $row ( keys %$hp_v_if_tag ) {
|
||||
my ( $index, $if ) = split( /\./, $row );
|
||||
|
||||
my $tag = $hp_v_if_tag->{$row};
|
||||
my $tag = $hp_v_if_tag->{$row};
|
||||
my $vlan = $hp_v_index->{$index};
|
||||
|
||||
next unless (defined $tag);
|
||||
next if ($tag eq 'no');
|
||||
|
||||
push(@{$i_vlan_membership->{$if}}, $vlan);
|
||||
next unless ( defined $tag );
|
||||
next if ( $tag eq 'no' );
|
||||
|
||||
push( @{ $i_vlan_membership->{$if} }, $vlan );
|
||||
}
|
||||
|
||||
return $i_vlan_membership;
|
||||
@@ -477,21 +488,21 @@ sub hasCDP {
|
||||
}
|
||||
|
||||
sub c_ip {
|
||||
my $hp = shift;
|
||||
my $hp = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $cdp = $hp->SUPER::c_ip($partial) || {};
|
||||
my $lldp = $hp->lldp_ip($partial) || {};
|
||||
my $lldp = $hp->lldp_ip($partial) || {};
|
||||
|
||||
my %c_ip;
|
||||
foreach my $iid (keys %$cdp){
|
||||
foreach my $iid ( keys %$cdp ) {
|
||||
my $ip = $cdp->{$iid};
|
||||
next unless defined $ip;
|
||||
|
||||
$c_ip{$iid} = $ip;
|
||||
}
|
||||
|
||||
foreach my $iid (keys %$lldp){
|
||||
foreach my $iid ( keys %$lldp ) {
|
||||
my $ip = $lldp->{$iid};
|
||||
next unless defined $ip;
|
||||
|
||||
@@ -501,21 +512,21 @@ sub c_ip {
|
||||
}
|
||||
|
||||
sub c_if {
|
||||
my $hp = shift;
|
||||
my $hp = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $lldp = $hp->lldp_if($partial) || {};;
|
||||
my $lldp = $hp->lldp_if($partial) || {};
|
||||
my $cdp = $hp->SUPER::c_if($partial) || {};
|
||||
|
||||
|
||||
my %c_if;
|
||||
foreach my $iid (keys %$cdp){
|
||||
foreach my $iid ( keys %$cdp ) {
|
||||
my $if = $cdp->{$iid};
|
||||
next unless defined $if;
|
||||
|
||||
$c_if{$iid} = $if;
|
||||
}
|
||||
|
||||
foreach my $iid (keys %$lldp){
|
||||
foreach my $iid ( keys %$lldp ) {
|
||||
my $if = $lldp->{$iid};
|
||||
next unless defined $if;
|
||||
|
||||
@@ -525,21 +536,21 @@ sub c_if {
|
||||
}
|
||||
|
||||
sub c_port {
|
||||
my $hp = shift;
|
||||
my $hp = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $lldp = $hp->lldp_port($partial) || {};
|
||||
my $lldp = $hp->lldp_port($partial) || {};
|
||||
my $cdp = $hp->SUPER::c_port($partial) || {};
|
||||
|
||||
|
||||
my %c_port;
|
||||
foreach my $iid (keys %$cdp){
|
||||
foreach my $iid ( keys %$cdp ) {
|
||||
my $port = $cdp->{$iid};
|
||||
next unless defined $port;
|
||||
|
||||
$c_port{$iid} = $port;
|
||||
}
|
||||
|
||||
foreach my $iid (keys %$lldp){
|
||||
foreach my $iid ( keys %$lldp ) {
|
||||
my $port = $lldp->{$iid};
|
||||
next unless defined $port;
|
||||
|
||||
@@ -549,21 +560,21 @@ sub c_port {
|
||||
}
|
||||
|
||||
sub c_id {
|
||||
my $hp = shift;
|
||||
my $hp = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $lldp = $hp->lldp_id($partial) || {};
|
||||
my $lldp = $hp->lldp_id($partial) || {};
|
||||
my $cdp = $hp->SUPER::c_id($partial) || {};
|
||||
|
||||
my %c_id;
|
||||
foreach my $iid (keys %$cdp){
|
||||
foreach my $iid ( keys %$cdp ) {
|
||||
my $id = $cdp->{$iid};
|
||||
next unless defined $id;
|
||||
|
||||
$c_id{$iid} = $id;
|
||||
}
|
||||
|
||||
foreach my $iid (keys %$lldp){
|
||||
foreach my $iid ( keys %$lldp ) {
|
||||
my $id = $lldp->{$iid};
|
||||
next unless defined $id;
|
||||
|
||||
@@ -573,21 +584,21 @@ sub c_id {
|
||||
}
|
||||
|
||||
sub c_platform {
|
||||
my $hp = shift;
|
||||
my $hp = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $lldp = $hp->lldp_rem_sysdesc($partial) || {};
|
||||
my $lldp = $hp->lldp_rem_sysdesc($partial) || {};
|
||||
my $cdp = $hp->SUPER::c_platform($partial) || {};
|
||||
|
||||
my %c_platform;
|
||||
foreach my $iid (keys %$cdp){
|
||||
foreach my $iid ( keys %$cdp ) {
|
||||
my $platform = $cdp->{$iid};
|
||||
next unless defined $platform;
|
||||
|
||||
$c_platform{$iid} = $platform;
|
||||
}
|
||||
|
||||
foreach my $iid (keys %$lldp){
|
||||
foreach my $iid ( keys %$lldp ) {
|
||||
my $platform = $lldp->{$iid};
|
||||
next unless defined $platform;
|
||||
|
||||
@@ -923,9 +934,9 @@ 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.
|
||||
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.
|
||||
|
||||
|
||||
@@ -4,20 +4,20 @@
|
||||
# Copyright (c) 2008 Eric Miller
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# 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
|
||||
# * 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
|
||||
#
|
||||
# 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
|
||||
@@ -37,40 +37,33 @@ use SNMP::Info::Bridge;
|
||||
use SNMP::Info::SONMP;
|
||||
use SNMP::Info::Airespace;
|
||||
|
||||
@SNMP::Info::Layer2::N2270::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::SONMP SNMP::Info::Airespace Exporter/;
|
||||
@SNMP::Info::Layer2::N2270::ISA
|
||||
= qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::SONMP SNMP::Info::Airespace Exporter/;
|
||||
@SNMP::Info::Layer2::N2270::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
|
||||
|
||||
$VERSION = '1.09';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::MIBS,
|
||||
%SNMP::Info::Bridge::MIBS,
|
||||
%SNMP::Info::SONMP::MIBS,
|
||||
%SNMP::Info::Airespace::MIBS,
|
||||
);
|
||||
%MIBS = (
|
||||
%SNMP::Info::MIBS, %SNMP::Info::Bridge::MIBS,
|
||||
%SNMP::Info::SONMP::MIBS, %SNMP::Info::Airespace::MIBS,
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::GLOBALS,
|
||||
%SNMP::Info::Bridge::GLOBALS,
|
||||
%SNMP::Info::SONMP::GLOBALS,
|
||||
%SNMP::Info::Airespace::GLOBALS,
|
||||
);
|
||||
%SNMP::Info::GLOBALS, %SNMP::Info::Bridge::GLOBALS,
|
||||
%SNMP::Info::SONMP::GLOBALS, %SNMP::Info::Airespace::GLOBALS,
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::FUNCS,
|
||||
%SNMP::Info::Bridge::FUNCS,
|
||||
%SNMP::Info::SONMP::FUNCS,
|
||||
%SNMP::Info::Airespace::FUNCS,
|
||||
);
|
||||
%FUNCS = (
|
||||
%SNMP::Info::FUNCS, %SNMP::Info::Bridge::FUNCS,
|
||||
%SNMP::Info::SONMP::FUNCS, %SNMP::Info::Airespace::FUNCS,
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::MUNGE,
|
||||
%SNMP::Info::Bridge::MUNGE,
|
||||
%SNMP::Info::SONMP::MUNGE,
|
||||
%SNMP::Info::Airespace::MUNGE,
|
||||
);
|
||||
%MUNGE = (
|
||||
%SNMP::Info::MUNGE, %SNMP::Info::Bridge::MUNGE,
|
||||
%SNMP::Info::SONMP::MUNGE, %SNMP::Info::Airespace::MUNGE,
|
||||
);
|
||||
|
||||
sub os {
|
||||
return 'nortel';
|
||||
@@ -82,7 +75,7 @@ sub vendor {
|
||||
|
||||
sub model {
|
||||
my $n2270 = shift;
|
||||
my $id = $n2270->id();
|
||||
my $id = $n2270->id();
|
||||
return unless defined $id;
|
||||
my $model = &SNMP::translateObj($id);
|
||||
return $id unless defined $model;
|
||||
@@ -104,7 +97,8 @@ __END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer2::N2270 - SNMP Interface to Nortel 2270 Series Wireless Switch
|
||||
SNMP::Info::Layer2::N2270 - SNMP Interface to Nortel 2270 Series Wireless
|
||||
Switch
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
|
||||
@@ -4,20 +4,20 @@
|
||||
# Copyright (c) 2008 Eric Miller
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# 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
|
||||
# * 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
|
||||
#
|
||||
# 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
|
||||
@@ -36,59 +36,60 @@ use SNMP::Info::SONMP;
|
||||
use SNMP::Info::IEEE802dot11;
|
||||
use SNMP::Info::Layer2;
|
||||
|
||||
@SNMP::Info::Layer2::NAP222x::ISA = qw/SNMP::Info::SONMP SNMP::Info::IEEE802dot11 SNMP::Info::Layer2 Exporter/;
|
||||
@SNMP::Info::Layer2::NAP222x::ISA
|
||||
= qw/SNMP::Info::SONMP SNMP::Info::IEEE802dot11 SNMP::Info::Layer2 Exporter/;
|
||||
@SNMP::Info::Layer2::NAP222x::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
|
||||
|
||||
$VERSION = '1.09';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer2::MIBS,
|
||||
%SNMP::Info::IEEE802dot11::MIBS,
|
||||
%SNMP::Info::SONMP::MIBS,
|
||||
'NORTEL-WLAN-AP-MIB' => 'ntWlanSwHardwareVer',
|
||||
);
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer2::MIBS, %SNMP::Info::IEEE802dot11::MIBS,
|
||||
%SNMP::Info::SONMP::MIBS, 'NORTEL-WLAN-AP-MIB' => 'ntWlanSwHardwareVer',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer2::GLOBALS,
|
||||
%SNMP::Info::IEEE802dot11::GLOBALS,
|
||||
%SNMP::Info::SONMP::GLOBALS,
|
||||
'nt_hw_ver' => 'ntWlanSwHardwareVer',
|
||||
'nt_fw_ver' => 'ntWlanSwBootRomVer',
|
||||
'nt_sw_ver' => 'ntWlanSwOpCodeVer',
|
||||
'nt_cc' => 'ntWlanSwCountryCode',
|
||||
'tftp_action' => 'ntWlanTransferStart',
|
||||
'tftp_host' => 'ntWlanFileServer',
|
||||
'tftp_file' => 'ntWlanDestFile',
|
||||
'tftp_type' => 'ntWlanFileType',
|
||||
'tftp_result' => 'ntWlanFileTransferStatus',
|
||||
'tftp_xtype' => 'ntWlanTransferType',
|
||||
'tftp_src_file' => 'ntWlanSrcFile',
|
||||
'ftp_user' => 'ntWlanUserName',
|
||||
'ftp_pass' => 'ntWlanPassword',
|
||||
);
|
||||
%SNMP::Info::Layer2::GLOBALS,
|
||||
%SNMP::Info::IEEE802dot11::GLOBALS,
|
||||
%SNMP::Info::SONMP::GLOBALS,
|
||||
'nt_hw_ver' => 'ntWlanSwHardwareVer',
|
||||
'nt_fw_ver' => 'ntWlanSwBootRomVer',
|
||||
'nt_sw_ver' => 'ntWlanSwOpCodeVer',
|
||||
'nt_cc' => 'ntWlanSwCountryCode',
|
||||
'tftp_action' => 'ntWlanTransferStart',
|
||||
'tftp_host' => 'ntWlanFileServer',
|
||||
'tftp_file' => 'ntWlanDestFile',
|
||||
'tftp_type' => 'ntWlanFileType',
|
||||
'tftp_result' => 'ntWlanFileTransferStatus',
|
||||
'tftp_xtype' => 'ntWlanTransferType',
|
||||
'tftp_src_file' => 'ntWlanSrcFile',
|
||||
'ftp_user' => 'ntWlanUserName',
|
||||
'ftp_pass' => 'ntWlanPassword',
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer2::FUNCS,
|
||||
%SNMP::Info::IEEE802dot11::FUNCS,
|
||||
%SNMP::Info::SONMP::FUNCS,
|
||||
# From ntWlanPortTable
|
||||
'nt_prt_name' => 'ntWlanPortName',
|
||||
'nt_dpx_admin' => 'ntWlanPortCapabilities',
|
||||
'nt_auto' => 'ntWlanPortAutonegotiation',
|
||||
'nt_dpx' => 'ntWlanPortSpeedDpxStatus',
|
||||
# From ntWlanDot11PhyOperationTable
|
||||
'nt_i_broadcast' => 'ntWlanDot11ClosedSystem',
|
||||
# From ntWlanApVlanTable
|
||||
'nt_i_vlan' => 'ntWlanApVlanDefaultVid',
|
||||
);
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer2::FUNCS,
|
||||
%SNMP::Info::IEEE802dot11::FUNCS,
|
||||
%SNMP::Info::SONMP::FUNCS,
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer2::MUNGE,
|
||||
%SNMP::Info::IEEE802dot11::MUNGE,
|
||||
%SNMP::Info::SONMP::MUNGE,
|
||||
);
|
||||
# From ntWlanPortTable
|
||||
'nt_prt_name' => 'ntWlanPortName',
|
||||
'nt_dpx_admin' => 'ntWlanPortCapabilities',
|
||||
'nt_auto' => 'ntWlanPortAutonegotiation',
|
||||
'nt_dpx' => 'ntWlanPortSpeedDpxStatus',
|
||||
|
||||
# From ntWlanDot11PhyOperationTable
|
||||
'nt_i_broadcast' => 'ntWlanDot11ClosedSystem',
|
||||
|
||||
# From ntWlanApVlanTable
|
||||
'nt_i_vlan' => 'ntWlanApVlanDefaultVid',
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer2::MUNGE, %SNMP::Info::IEEE802dot11::MUNGE,
|
||||
%SNMP::Info::SONMP::MUNGE,
|
||||
);
|
||||
|
||||
sub os {
|
||||
return 'nortel';
|
||||
@@ -96,31 +97,31 @@ sub os {
|
||||
|
||||
sub os_bin {
|
||||
my $nap222x = shift;
|
||||
my $bin = $nap222x->nt_fw_ver();
|
||||
my $bin = $nap222x->nt_fw_ver();
|
||||
return unless defined $bin;
|
||||
|
||||
if ($bin =~ m/(\d+\.\d+\.\d+)/){
|
||||
if ( $bin =~ m/(\d+\.\d+\.\d+)/ ) {
|
||||
return $1;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sub model {
|
||||
my $nap222x = shift;
|
||||
my $descr = $nap222x->description();
|
||||
my $descr = $nap222x->description();
|
||||
return unless defined $descr;
|
||||
|
||||
return 'AP-2220' if ($descr =~ /2220/);
|
||||
return 'AP-2221' if ($descr =~ /2221/);
|
||||
return 'AP-2220' if ( $descr =~ /2220/ );
|
||||
return 'AP-2221' if ( $descr =~ /2221/ );
|
||||
return;
|
||||
}
|
||||
|
||||
sub mac {
|
||||
my $nap222x = shift;
|
||||
my $i_mac = $nap222x->i_mac();
|
||||
my $i_mac = $nap222x->i_mac();
|
||||
|
||||
# Return Interface MAC
|
||||
foreach my $entry (keys %$i_mac){
|
||||
# Return Interface MAC
|
||||
foreach my $entry ( keys %$i_mac ) {
|
||||
my $sn = $i_mac->{$entry};
|
||||
next unless $sn;
|
||||
return $sn;
|
||||
@@ -130,10 +131,10 @@ sub mac {
|
||||
|
||||
sub serial {
|
||||
my $nap222x = shift;
|
||||
my $i_mac = $nap222x->i_mac();
|
||||
my $i_mac = $nap222x->i_mac();
|
||||
|
||||
# Return Interface MAC
|
||||
foreach my $entry (keys %$i_mac){
|
||||
# Return Interface MAC
|
||||
foreach my $entry ( keys %$i_mac ) {
|
||||
my $sn = $i_mac->{$entry};
|
||||
next unless $sn;
|
||||
return $sn;
|
||||
@@ -145,11 +146,11 @@ sub interfaces {
|
||||
my $nap222x = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $interfaces = $nap222x->i_index($partial) || {};
|
||||
my $interfaces = $nap222x->i_index($partial) || {};
|
||||
my $description = $nap222x->i_description($partial) || {};
|
||||
|
||||
my %interfaces = ();
|
||||
foreach my $iid (keys %$interfaces){
|
||||
foreach my $iid ( keys %$interfaces ) {
|
||||
my $desc = $description->{$iid};
|
||||
next unless defined $desc;
|
||||
next if $desc =~ /lo/i;
|
||||
@@ -162,25 +163,25 @@ sub interfaces {
|
||||
sub i_duplex {
|
||||
my $nap222x = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $mode = $nap222x->nt_dpx($partial) || {};
|
||||
my $port_name = $nap222x->nt_prt_name($partial) || {};
|
||||
my $interfaces = $nap222x->interfaces($partial) || {};
|
||||
|
||||
|
||||
my $mode = $nap222x->nt_dpx($partial) || {};
|
||||
my $port_name = $nap222x->nt_prt_name($partial) || {};
|
||||
my $interfaces = $nap222x->interfaces($partial) || {};
|
||||
|
||||
my %i_duplex;
|
||||
foreach my $if (keys %$interfaces){
|
||||
foreach my $if ( keys %$interfaces ) {
|
||||
my $port = $interfaces->{$if};
|
||||
next unless $port =~ /dp/i;
|
||||
foreach my $idx (keys %$mode) {
|
||||
my $name = $port_name->{$idx}||'unknown';
|
||||
foreach my $idx ( keys %$mode ) {
|
||||
my $name = $port_name->{$idx} || 'unknown';
|
||||
next unless $name eq $port;
|
||||
my $duplex = $mode->{$idx};
|
||||
|
||||
|
||||
$duplex = 'other' unless defined $duplex;
|
||||
$duplex = 'half' if $duplex =~ /half/i;
|
||||
$duplex = 'full' if $duplex =~ /full/i;
|
||||
|
||||
$i_duplex{$if}=$duplex;
|
||||
|
||||
$i_duplex{$if} = $duplex;
|
||||
}
|
||||
}
|
||||
return \%i_duplex;
|
||||
@@ -190,27 +191,29 @@ sub i_duplex_admin {
|
||||
my $nap222x = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $dpx_admin = $nap222x->nt_dpx_admin($partial) || {};
|
||||
my $nt_auto = $nap222x->nt_auto($partial) || {};
|
||||
my $interfaces = $nap222x->interfaces($partial) || {};
|
||||
my $port_name = $nap222x->nt_prt_name($partial) || {};
|
||||
|
||||
my $dpx_admin = $nap222x->nt_dpx_admin($partial) || {};
|
||||
my $nt_auto = $nap222x->nt_auto($partial) || {};
|
||||
my $interfaces = $nap222x->interfaces($partial) || {};
|
||||
my $port_name = $nap222x->nt_prt_name($partial) || {};
|
||||
|
||||
my %i_duplex_admin;
|
||||
foreach my $if (keys %$interfaces){
|
||||
foreach my $if ( keys %$interfaces ) {
|
||||
my $port = $interfaces->{$if};
|
||||
next unless $port =~ /dp/i;
|
||||
foreach my $idx (keys %$dpx_admin) {
|
||||
my $name = $port_name->{$idx}||'unknown';
|
||||
foreach my $idx ( keys %$dpx_admin ) {
|
||||
my $name = $port_name->{$idx} || 'unknown';
|
||||
next unless $name eq $port;
|
||||
my $duplex = $dpx_admin->{$idx};
|
||||
my $auto = $nt_auto->{$idx};
|
||||
|
||||
my $auto = $nt_auto->{$idx};
|
||||
|
||||
$duplex = 'other' unless defined $duplex;
|
||||
$duplex = 'half' if ($duplex =~ /half/i and $auto =~ /disabled/i);
|
||||
$duplex = 'full' if ($duplex =~ /full/i and $auto =~ /disabled/i);
|
||||
$duplex = 'half'
|
||||
if ( $duplex =~ /half/i and $auto =~ /disabled/i );
|
||||
$duplex = 'full'
|
||||
if ( $duplex =~ /full/i and $auto =~ /disabled/i );
|
||||
$duplex = 'auto' if $auto =~ /enabled/i;
|
||||
|
||||
$i_duplex_admin{$if}=$duplex;
|
||||
|
||||
$i_duplex_admin{$if} = $duplex;
|
||||
}
|
||||
}
|
||||
return \%i_duplex_admin;
|
||||
@@ -223,15 +226,15 @@ sub i_name {
|
||||
my $interfaces = $nap222x->interfaces($partial) || {};
|
||||
|
||||
my %i_name;
|
||||
foreach my $if (keys %$interfaces){
|
||||
foreach my $if ( keys %$interfaces ) {
|
||||
my $desc = $interfaces->{$if};
|
||||
next unless defined $desc;
|
||||
|
||||
|
||||
my $name = 'unknown';
|
||||
$name = 'Ethernet Interface' if $desc =~ /dp/i;
|
||||
$name = 'Ethernet Interface' if $desc =~ /dp/i;
|
||||
$name = 'Wireless Interface B' if $desc =~ /ndc/i;
|
||||
$name = 'Wireless Interface A' if $desc =~ /ar/i;
|
||||
|
||||
|
||||
$i_name{$if} = $name;
|
||||
}
|
||||
return \%i_name;
|
||||
@@ -245,15 +248,15 @@ sub bp_index {
|
||||
my $interfaces = $nap222x->interfaces($partial) || {};
|
||||
|
||||
my %bp_index;
|
||||
foreach my $iid (keys %$interfaces){
|
||||
foreach my $iid ( keys %$interfaces ) {
|
||||
my $desc = $interfaces->{$iid};
|
||||
next unless defined $desc;
|
||||
next unless $desc =~ /(ndc|ar)/i;
|
||||
|
||||
|
||||
my $port = 1;
|
||||
$port = 2 if $desc =~ /ndc/i;
|
||||
|
||||
$bp_index{$port} = $iid;
|
||||
$bp_index{$port} = $iid;
|
||||
}
|
||||
return \%bp_index;
|
||||
}
|
||||
@@ -265,20 +268,20 @@ sub i_ssidlist {
|
||||
my $partial = shift;
|
||||
|
||||
# modify partial to match index
|
||||
if (defined $partial) {
|
||||
if ( defined $partial ) {
|
||||
$partial = $partial - 2;
|
||||
}
|
||||
my $ssids = $nap222x->orig_i_ssidlist($partial) || {};
|
||||
|
||||
my %i_ssidlist;
|
||||
foreach my $iid (keys %$ssids){
|
||||
foreach my $iid ( keys %$ssids ) {
|
||||
my $port = $iid + 2;
|
||||
my $ssid = $ssids->{$iid};
|
||||
next unless defined $ssid;
|
||||
|
||||
|
||||
$i_ssidlist{$port} = $ssid;
|
||||
}
|
||||
return \%i_ssidlist;
|
||||
return \%i_ssidlist;
|
||||
}
|
||||
|
||||
sub i_ssidbcast {
|
||||
@@ -286,20 +289,20 @@ sub i_ssidbcast {
|
||||
my $partial = shift;
|
||||
|
||||
# modify partial to match index
|
||||
if (defined $partial) {
|
||||
if ( defined $partial ) {
|
||||
$partial = $partial - 2;
|
||||
}
|
||||
my $bcast = $nap222x->nt_i_broadcast($partial) || {};
|
||||
|
||||
my %i_ssidbcast;
|
||||
foreach my $iid (keys %$bcast){
|
||||
foreach my $iid ( keys %$bcast ) {
|
||||
my $port = $iid + 2;
|
||||
my $bc = $bcast->{$iid};
|
||||
next unless defined $bc;
|
||||
|
||||
|
||||
$i_ssidbcast{$port} = $bc;
|
||||
}
|
||||
return \%i_ssidbcast;
|
||||
return \%i_ssidbcast;
|
||||
}
|
||||
|
||||
sub i_80211channel {
|
||||
@@ -307,24 +310,24 @@ sub i_80211channel {
|
||||
my $partial = shift;
|
||||
|
||||
# modify partial to match index
|
||||
if (defined $partial) {
|
||||
if ( defined $partial ) {
|
||||
$partial = $partial - 2;
|
||||
}
|
||||
my $phy_type = $nap222x->dot11_phy_type($partial) || {};
|
||||
my $cur_freq = $nap222x->dot11_cur_freq() || {};
|
||||
my $cur_ch = $nap222x->dot11_cur_ch() || {};
|
||||
my $cur_freq = $nap222x->dot11_cur_freq() || {};
|
||||
my $cur_ch = $nap222x->dot11_cur_ch() || {};
|
||||
|
||||
my %i_80211channel;
|
||||
foreach my $iid (keys %$phy_type){
|
||||
foreach my $iid ( keys %$phy_type ) {
|
||||
my $port = $iid + 2;
|
||||
my $type = $phy_type->{$iid};
|
||||
next unless defined $type;
|
||||
if ($type =~ /dsss/) {
|
||||
if ( $type =~ /dsss/ ) {
|
||||
my $ch = $cur_ch->{1};
|
||||
next unless defined $ch;
|
||||
$i_80211channel{$port} = $ch;
|
||||
}
|
||||
elsif ($type =~ /ofdm/) {
|
||||
elsif ( $type =~ /ofdm/ ) {
|
||||
my $ch = $cur_freq->{0};
|
||||
next unless defined $ch;
|
||||
$i_80211channel{$port} = $ch;
|
||||
@@ -342,20 +345,20 @@ sub i_vlan {
|
||||
my $partial = shift;
|
||||
|
||||
# modify partial to match index
|
||||
if (defined $partial) {
|
||||
if ( defined $partial ) {
|
||||
$partial = $partial - 2;
|
||||
}
|
||||
my $vlans = $nap222x->nt_i_vlan($partial) || {};
|
||||
|
||||
my %i_vlan;
|
||||
foreach my $iid (keys %$vlans){
|
||||
foreach my $iid ( keys %$vlans ) {
|
||||
my $port = $iid + 2;
|
||||
my $vlan = $vlans->{$iid};
|
||||
next unless defined $vlan;
|
||||
|
||||
|
||||
$i_vlan{$port} = $vlan;
|
||||
}
|
||||
return \%i_vlan;
|
||||
return \%i_vlan;
|
||||
}
|
||||
|
||||
1;
|
||||
@@ -363,7 +366,8 @@ __END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer2::NAP222x - SNMP Interface to Nortel 2220 Series Access Points
|
||||
SNMP::Info::Layer2::NAP222x - SNMP Interface to Nortel 2220 Series Access
|
||||
Points
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
|
||||
@@ -3,21 +3,21 @@
|
||||
#
|
||||
# Copyright (c) 2008 Bill Fenner
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
#
|
||||
# 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
|
||||
# * 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
|
||||
#
|
||||
# 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
|
||||
@@ -34,28 +34,20 @@ use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer2;
|
||||
|
||||
@SNMP::Info::Layer2::Netgear::ISA = qw/SNMP::Info::Layer2 Exporter/;
|
||||
@SNMP::Info::Layer2::Netgear::ISA = qw/SNMP::Info::Layer2 Exporter/;
|
||||
@SNMP::Info::Layer2::Netgear::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
$VERSION = '1.09';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer2::MIBS,
|
||||
);
|
||||
%MIBS = ( %SNMP::Info::Layer2::MIBS, );
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer2::GLOBALS,
|
||||
);
|
||||
%GLOBALS = ( %SNMP::Info::Layer2::GLOBALS, );
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer2::FUNCS,
|
||||
);
|
||||
%FUNCS = ( %SNMP::Info::Layer2::FUNCS, );
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer2::MUNGE,
|
||||
);
|
||||
%MUNGE = ( %SNMP::Info::Layer2::MUNGE, );
|
||||
|
||||
sub vendor {
|
||||
return 'netgear';
|
||||
@@ -82,20 +74,20 @@ sub model {
|
||||
# return anything.
|
||||
sub fw_mac {
|
||||
my $netgear = shift;
|
||||
my $ret = $netgear->qb_fw_mac();
|
||||
$ret = $netgear->orig_fw_mac() if (!defined($ret));
|
||||
my $ret = $netgear->qb_fw_mac();
|
||||
$ret = $netgear->orig_fw_mac() if ( !defined($ret) );
|
||||
return $ret;
|
||||
}
|
||||
|
||||
sub fw_port {
|
||||
my $netgear = shift;
|
||||
my $ret = $netgear->qb_fw_port();
|
||||
$ret = $netgear->orig_fw_port() if (!defined($ret));
|
||||
my $ret = $netgear->qb_fw_port();
|
||||
$ret = $netgear->orig_fw_port() if ( !defined($ret) );
|
||||
return $ret;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
@@ -141,7 +133,8 @@ inherited methods.
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
MIBs listed in L<SNMP::Info::Layer2/"Required MIBs"> and its inherited classes.
|
||||
MIBs listed in L<SNMP::Info::Layer2/"Required MIBs"> and its inherited
|
||||
classes.
|
||||
|
||||
=back
|
||||
|
||||
|
||||
@@ -4,20 +4,20 @@
|
||||
# Copyright (c) 2008 Eric Miller
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# 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
|
||||
# * 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
|
||||
#
|
||||
# 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
|
||||
@@ -35,38 +35,36 @@ use Exporter;
|
||||
use SNMP::Info::IEEE802dot11;
|
||||
use SNMP::Info::Layer2;
|
||||
|
||||
@SNMP::Info::Layer2::Orinoco::ISA = qw/SNMP::Info::IEEE802dot11 SNMP::Info::Layer2 Exporter/;
|
||||
@SNMP::Info::Layer2::Orinoco::ISA
|
||||
= qw/SNMP::Info::IEEE802dot11 SNMP::Info::Layer2 Exporter/;
|
||||
@SNMP::Info::Layer2::Orinoco::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
|
||||
|
||||
$VERSION = '1.09';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer2::MIBS,
|
||||
%SNMP::Info::IEEE802dot11::MIBS,
|
||||
#'ORiNOCO-MIB' => 'orinoco',
|
||||
);
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer2::MIBS,
|
||||
%SNMP::Info::IEEE802dot11::MIBS,
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer2::GLOBALS,
|
||||
%SNMP::Info::IEEE802dot11::GLOBALS,
|
||||
);
|
||||
#'ORiNOCO-MIB' => 'orinoco',
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer2::FUNCS,
|
||||
%SNMP::Info::IEEE802dot11::FUNCS,
|
||||
# ORiNOCO-MIB:oriWirelessIfPropertiesTable
|
||||
#'ori_ssid' => 'oriWirelessIfNetworkName',
|
||||
#'ori_channel' => 'oriWirelessIfChannel',
|
||||
#'ori_closed_sys' => 'oriWirelessIfClosedSystem',
|
||||
# ORiNOCO-MIB:oriSystemInvMgmtComponentTable
|
||||
);
|
||||
%GLOBALS
|
||||
= ( %SNMP::Info::Layer2::GLOBALS, %SNMP::Info::IEEE802dot11::GLOBALS, );
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer2::MUNGE,
|
||||
%SNMP::Info::IEEE802dot11::MUNGE,
|
||||
);
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer2::FUNCS,
|
||||
%SNMP::Info::IEEE802dot11::FUNCS,
|
||||
|
||||
# ORiNOCO-MIB:oriWirelessIfPropertiesTable
|
||||
#'ori_ssid' => 'oriWirelessIfNetworkName',
|
||||
#'ori_channel' => 'oriWirelessIfChannel',
|
||||
#'ori_closed_sys' => 'oriWirelessIfClosedSystem',
|
||||
# ORiNOCO-MIB:oriSystemInvMgmtComponentTable
|
||||
);
|
||||
|
||||
%MUNGE = ( %SNMP::Info::Layer2::MUNGE, %SNMP::Info::IEEE802dot11::MUNGE, );
|
||||
|
||||
sub os {
|
||||
return 'orinoco';
|
||||
@@ -78,10 +76,10 @@ sub os_ver {
|
||||
my $descr = $orinoco->description();
|
||||
return unless defined $descr;
|
||||
|
||||
if ($descr =~ m/V(\d+\.\d+)/){
|
||||
if ( $descr =~ m/V(\d+\.\d+)/ ) {
|
||||
return $1;
|
||||
}
|
||||
if ($descr =~ m/v(\d+\.\d+\.\d+)/){
|
||||
if ( $descr =~ m/v(\d+\.\d+\.\d+)/ ) {
|
||||
return $1;
|
||||
}
|
||||
|
||||
@@ -94,10 +92,10 @@ sub os_bin {
|
||||
my $descr = $orinoco->description();
|
||||
return unless defined $descr;
|
||||
|
||||
if ($descr =~ m/V(\d+\.\d+)$/){
|
||||
if ( $descr =~ m/V(\d+\.\d+)$/ ) {
|
||||
return $1;
|
||||
}
|
||||
if ($descr =~ m/v(\d+\.\d+\.\d+)$/){
|
||||
if ( $descr =~ m/v(\d+\.\d+\.\d+)$/ ) {
|
||||
return $1;
|
||||
}
|
||||
|
||||
@@ -114,8 +112,8 @@ sub model {
|
||||
my $descr = $orinoco->description();
|
||||
return unless defined $descr;
|
||||
|
||||
return $1 if ($descr =~ /(AP-\d+)/);
|
||||
return 'WavePOINT-II' if ($descr =~ /WavePOINT-II/);
|
||||
return $1 if ( $descr =~ /(AP-\d+)/ );
|
||||
return 'WavePOINT-II' if ( $descr =~ /WavePOINT-II/ );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -125,7 +123,7 @@ sub serial {
|
||||
my $descr = $orinoco->description();
|
||||
return unless defined $descr;
|
||||
|
||||
$descr = $1 if $descr =~ /SN-(\S+)/;
|
||||
$descr = $1 if $descr =~ /SN-(\S+)/;
|
||||
return $descr;
|
||||
}
|
||||
|
||||
@@ -136,9 +134,10 @@ sub i_ignore {
|
||||
my $descr = $orinoco->i_description($partial) || {};
|
||||
|
||||
my %i_ignore;
|
||||
foreach my $if (keys %$descr){
|
||||
foreach my $if ( keys %$descr ) {
|
||||
my $type = $descr->{$if};
|
||||
# Skip virtual interfaces
|
||||
|
||||
# Skip virtual interfaces
|
||||
$i_ignore{$if}++ if $type =~ /(lo|empty|PCMCIA)/i;
|
||||
}
|
||||
return \%i_ignore;
|
||||
@@ -148,16 +147,16 @@ sub interfaces {
|
||||
my $orinoco = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $interfaces = $orinoco->i_index($partial) || {};
|
||||
my $interfaces = $orinoco->i_index($partial) || {};
|
||||
my $descriptions = $orinoco->i_description($partial) || {};
|
||||
|
||||
my %interfaces = ();
|
||||
foreach my $iid (keys %$interfaces){
|
||||
foreach my $iid ( keys %$interfaces ) {
|
||||
my $desc = $descriptions->{$iid};
|
||||
next unless defined $desc;
|
||||
next if $desc =~ /(lo|empty|PCMCIA)/i;
|
||||
|
||||
$desc = 'AMD' if $desc =~ /AMD/;
|
||||
$desc = 'AMD' if $desc =~ /AMD/;
|
||||
|
||||
$interfaces{$iid} = $desc;
|
||||
}
|
||||
@@ -177,7 +176,7 @@ sub interfaces {
|
||||
#
|
||||
# $i_ssidbcast{$iid} = $bc;
|
||||
# }
|
||||
# return \%i_ssidbcast;
|
||||
# return \%i_ssidbcast;
|
||||
#}
|
||||
|
||||
1;
|
||||
@@ -208,9 +207,9 @@ Eric Miller
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Provides abstraction to the configuration information obtainable from a Orinoco
|
||||
Access Point through SNMP. Orinoco devices have been manufactured by Proxim,
|
||||
Agere, and Lucent.
|
||||
Provides abstraction to the configuration information obtainable from
|
||||
Orinoco Access Point through SNMP. Orinoco devices have been manufactured
|
||||
by Proxim, Agere, and Lucent.
|
||||
|
||||
For speed or debugging purposes you can call the subclass directly, but not
|
||||
after determining a more specific class using the method above.
|
||||
|
||||
@@ -3,21 +3,21 @@
|
||||
#
|
||||
# Copyright (c) 2008 Max Baker
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
#
|
||||
# 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
|
||||
# * 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
|
||||
#
|
||||
# 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
|
||||
@@ -34,7 +34,7 @@ use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer2;
|
||||
|
||||
@SNMP::Info::Layer2::ZyXEL_DSLAM::ISA = qw/SNMP::Info::Layer2 Exporter/;
|
||||
@SNMP::Info::Layer2::ZyXEL_DSLAM::ISA = qw/SNMP::Info::Layer2 Exporter/;
|
||||
@SNMP::Info::Layer2::ZyXEL_DSLAM::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
|
||||
@@ -42,27 +42,22 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
|
||||
$VERSION = '1.09';
|
||||
|
||||
# Set for No CDP
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer2::GLOBALS
|
||||
);
|
||||
%GLOBALS = ( %SNMP::Info::Layer2::GLOBALS );
|
||||
|
||||
%FUNCS = (%SNMP::Info::Layer2::FUNCS,
|
||||
'ip_adresses' => 'ipAdEntAddr',
|
||||
'i_name' => 'ifDescr',
|
||||
'i_description' => 'adslLineConfProfile',
|
||||
);
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer2::FUNCS,
|
||||
'ip_adresses' => 'ipAdEntAddr',
|
||||
'i_name' => 'ifDescr',
|
||||
'i_description' => 'adslLineConfProfile',
|
||||
);
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer2::MIBS,
|
||||
'ADSL-LINE-MIB' => 'adslLineConfProfile'
|
||||
);
|
||||
|
||||
%MUNGE = (%SNMP::Info::Layer2::MUNGE
|
||||
);
|
||||
%MIBS
|
||||
= ( %SNMP::Info::Layer2::MIBS, 'ADSL-LINE-MIB' => 'adslLineConfProfile' );
|
||||
|
||||
%MUNGE = ( %SNMP::Info::Layer2::MUNGE );
|
||||
|
||||
sub layers {
|
||||
my $zyxel = shift;
|
||||
my $zyxel = shift;
|
||||
my $layers = $zyxel->layers();
|
||||
return $layers if defined $layers;
|
||||
|
||||
@@ -81,8 +76,8 @@ sub os {
|
||||
sub os_ver {
|
||||
my $zyxel = shift;
|
||||
my $descr = $zyxel->description();
|
||||
|
||||
if ($descr =~ m/version (\S+) /){
|
||||
|
||||
if ( $descr =~ m/version (\S+) / ) {
|
||||
return $1;
|
||||
}
|
||||
return;
|
||||
@@ -93,21 +88,24 @@ sub model {
|
||||
|
||||
my $desc = $zyxel->description();
|
||||
|
||||
if ($desc =~ /8-port ADSL Module\(Annex A\)/){
|
||||
if ( $desc =~ /8-port ADSL Module\(Annex A\)/ ) {
|
||||
return "AAM1008-61";
|
||||
} elsif ($desc =~ /8-port ADSL Module\(Annex B\)/){
|
||||
}
|
||||
elsif ( $desc =~ /8-port ADSL Module\(Annex B\)/ ) {
|
||||
return "AAM1008-63";
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sub ip{
|
||||
my $zyxel = shift;
|
||||
sub ip {
|
||||
my $zyxel = shift;
|
||||
my $ip_hash = $zyxel->ip_addresses();
|
||||
my $found_ip;
|
||||
|
||||
foreach my $ip (keys %{$ip_hash}) {
|
||||
$found_ip = $ip if (defined $ip and $ip =~ /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/);
|
||||
|
||||
foreach my $ip ( keys %{$ip_hash} ) {
|
||||
$found_ip = $ip
|
||||
if ( defined $ip
|
||||
and $ip =~ /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/ );
|
||||
}
|
||||
return $found_ip;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user