This commit is contained in:
Eric Miller
2008-07-20 03:30:56 +00:00
parent 6c7df418af
commit 158596cede
69 changed files with 7547 additions and 6963 deletions

View File

@@ -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
@@ -36,50 +36,54 @@ use strict;
use Exporter;
use SNMP::Info::Layer3;
@SNMP::Info::Layer3::Aironet::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::Aironet::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::Aironet::EXPORT_OK = qw//;
use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer3::MIBS,
'AWCVX-MIB' => 'awcIfTable',
'IEEE802dot11-MIB' => 'dot11StationID',
);
%MIBS = (
%SNMP::Info::Layer3::MIBS,
'AWCVX-MIB' => 'awcIfTable',
'IEEE802dot11-MIB' => 'dot11StationID',
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
'mac' => 'dot11StationID.2',
# AWC Ethernet Table
'awc_duplex' => 'awcEtherDuplex.0',
);
%SNMP::Info::Layer3::GLOBALS,
'mac' => 'dot11StationID.2',
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
'i_mac2' => 'ifPhysAddress',
'i_mtu2' => 'ifMtu',
'i_ssid' => 'dot11DesiredSSID',
# Bridge-mib overrides
'fw_mac2' => 'dot1dTpFdbAddress',
'fw_port2' => 'dot1dTpFdbPort',
'bp_index2' => 'dot1dBasePortIfIndex',
# AWC Interface Table (awcIfTable)
'awc_default_mac' => 'awcIfDefaultPhyAddress',
'awc_mac' => 'awcIfPhyAddress',
'awc_ip' => 'awcIfIpAddress',
'awc_netmask' => 'awcIfIpNetMask',
'awc_msdu' => 'awcIfMSDUMaxLength',
);
# AWC Ethernet Table
'awc_duplex' => 'awcEtherDuplex.0',
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
'i_mac2' => 'ifPhysAddress',
'i_mtu2' => 'ifMtu',
'i_ssid' => 'dot11DesiredSSID',
# Bridge-mib overrides
'fw_mac2' => 'dot1dTpFdbAddress',
'fw_port2' => 'dot1dTpFdbPort',
'bp_index2' => 'dot1dBasePortIfIndex',
# AWC Interface Table (awcIfTable)
'awc_default_mac' => 'awcIfDefaultPhyAddress',
'awc_mac' => 'awcIfPhyAddress',
'awc_ip' => 'awcIfIpAddress',
'awc_netmask' => 'awcIfIpNetMask',
'awc_msdu' => 'awcIfMSDUMaxLength',
);
%MUNGE = (
# Inherit all the built in munging
%SNMP::Info::Layer3::MUNGE,
'i_mac2' => \&SNMP::Info::munge_mac,
'awc_mac' => \&SNMP::Info::munge_mac,
'fw_mac2' => \&SNMP::Info::munge_mac,
);
# Inherit all the built in munging
%SNMP::Info::Layer3::MUNGE,
'i_mac2' => \&SNMP::Info::munge_mac,
'awc_mac' => \&SNMP::Info::munge_mac,
'fw_mac2' => \&SNMP::Info::munge_mac,
);
sub os {
return 'aironet';
@@ -90,11 +94,11 @@ sub os_ver {
my $descr = $aironet->description() || '';
# CAP340 11.21, AP4800-E 11.21
if ($descr =~ /AP\d{3,4}(-\D+)?\s+(\d{2}\.\d{2})/){
if ( $descr =~ /AP\d{3,4}(-\D+)?\s+(\d{2}\.\d{2})/ ) {
return $2;
}
if ($descr =~ /Series\s*AP\s+(\d{2}\.\d{2})/){
if ( $descr =~ /Series\s*AP\s+(\d{2}\.\d{2})/ ) {
return $1;
}
@@ -103,19 +107,19 @@ sub os_ver {
# Override wireless port with static info
sub bp_index {
my $aironet = shift;
my $aironet = shift;
my $interfaces = $aironet->interfaces();
my $bp_index = $aironet->bp_index2();
foreach my $iid (keys %$interfaces){
my $bp_index = $aironet->bp_index2();
foreach my $iid ( keys %$interfaces ) {
my $port = $interfaces->{$iid};
# Hardwire the wireless port to the transparent bridge port
if ($port =~ /awc/){
$bp_index->{0}=$iid;
if ( $port =~ /awc/ ) {
$bp_index->{0} = $iid;
}
}
return $bp_index;
}
@@ -124,16 +128,16 @@ sub fw_mac {
my $aironet = shift;
my $fw_mac = $aironet->fw_mac2();
my $fw_port = $aironet->fw_port2();
my $bs_mac = $aironet->bs_mac();
my $bs_mac = $aironet->bs_mac();
# remove port 0 forwarding table entries, only port 0 static entries
foreach my $fw (keys %$fw_mac){
foreach my $fw ( keys %$fw_mac ) {
my $port = $fw_port->{$fw};
next unless defined $port;
delete $fw_mac->{$fw} if $port == 0;
}
foreach my $bs (keys %$bs_mac){
foreach my $bs ( keys %$bs_mac ) {
my $entry = $bs;
$entry =~ s/\.0$//;
$fw_mac->{$entry} = $bs_mac->{$bs};
@@ -146,10 +150,9 @@ sub fw_mac {
sub fw_port {
my $aironet = shift;
my $fw_port = $aironet->fw_port2();
my $bs_port = $aironet->bs_port();
my $bs_port = $aironet->bs_port();
foreach my $bs (keys %$bs_port){
foreach my $bs ( keys %$bs_port ) {
my $entry = $bs;
$entry =~ s/\.0$//;
$fw_port->{$entry} = $bs_port->{$bs};
@@ -158,18 +161,17 @@ sub fw_port {
return $fw_port;
}
sub i_duplex {
my $aironet = shift;
my $aironet = shift;
my $interfaces = $aironet->interfaces();
my $awc_duplex = $aironet->awc_duplex();
my %i_duplex;
foreach my $iid (keys %$interfaces){
foreach my $iid ( keys %$interfaces ) {
my $name = $interfaces->{$iid};
if ($name =~ /fec/){
if ( $name =~ /fec/ ) {
$i_duplex{$iid} = $awc_duplex;
}
}
@@ -183,7 +185,7 @@ sub i_mac {
my $i_mac = $aironet->i_mac2();
my $awc_mac = $aironet->awc_mac();
foreach my $iid (keys %$awc_mac){
foreach my $iid ( keys %$awc_mac ) {
next unless defined $i_mac->{$iid};
$i_mac->{$iid} = $awc_mac->{$iid};
}
@@ -192,14 +194,14 @@ sub i_mac {
}
sub i_ignore {
my $aironet = shift;
my $aironet = shift;
my $interfaces = $aironet->interfaces();
my %i_ignore;
foreach my $if (keys %$interfaces){
$i_ignore{$if}++ if ($interfaces->{$if} =~ /(rptr|lo)/);
foreach my $if ( keys %$interfaces ) {
$i_ignore{$if}++ if ( $interfaces->{$if} =~ /(rptr|lo)/ );
}
return \%i_ignore;
}
@@ -213,8 +215,8 @@ __END__
=head1 NAME
SNMP::Info::Layer3::Aironet - Perl5 Interface to Cisco Aironet Wireless Devices
running Aironet software, not IOS
SNMP::Info::Layer3::Aironet - Perl5 Interface to Cisco Aironet Wireless
Devices running Aironet software, not IOS
=head1 AUTHOR

View File

@@ -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,7 +34,7 @@ use strict;
use Exporter;
use SNMP::Info::Layer3;
@SNMP::Info::Layer3::AlteonAD::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::AlteonAD::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::AlteonAD::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
@@ -42,82 +42,92 @@ use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer3::MIBS,
'ALTEON-ROOT-MIB' => 'aceswitch184',
'ALTEON-TIGON-SWITCH-MIB' => 'hwPowerSupplyStatus',
'ALTEON-CHEETAH-SWITCH-MIB' => 'hwFanStatus',
'ALTEON-TS-PHYSICAL-MIB' => 'agPortTableMaxEnt',
'ALTEON-CS-PHYSICAL-MIB' => 'vlanCurCfgLearn',
'ALTEON-TS-NETWORK-MIB' => 'ripCurCfgSupply',
'ALTEON-CHEETAH-NETWORK-MIB' => 'ripCurCfgIntfSupply',
);
%SNMP::Info::Layer3::MIBS,
'ALTEON-ROOT-MIB' => 'aceswitch184',
'ALTEON-TIGON-SWITCH-MIB' => 'hwPowerSupplyStatus',
'ALTEON-CHEETAH-SWITCH-MIB' => 'hwFanStatus',
'ALTEON-TS-PHYSICAL-MIB' => 'agPortTableMaxEnt',
'ALTEON-CS-PHYSICAL-MIB' => 'vlanCurCfgLearn',
'ALTEON-TS-NETWORK-MIB' => 'ripCurCfgSupply',
'ALTEON-CHEETAH-NETWORK-MIB' => 'ripCurCfgIntfSupply',
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
'old_sw_ver' => 'ALTEON_TIGON_SWITCH_MIB__agSoftwareVersion',
'new_sw_ver' => 'ALTEON_CHEETAH_SWITCH_MIB__agSoftwareVersion',
'old_tftp_action' => 'ALTEON_TIGON_SWITCH_MIB__agTftpAction',
'new_tftp_action' => 'ALTEON_CHEETAH_SWITCH_MIB__agTftpAction',
'old_tftp_host' => 'ALTEON_TIGON_SWITCH_MIB__agTftpServer',
'new_tftp_host' => 'ALTEON_CHEETAH_SWITCH_MIB__agTftpServer',
'old_tftp_file' => 'ALTEON_TIGON_SWITCH_MIB__agTftpCfgFileName',
'new_tftp_file' => 'ALTEON_CHEETAH_SWITCH_MIB__agTftpCfgFileName',
'old_tftp_result' => 'ALTEON_TIGON_SWITCH_MIB__agTftpLastActionStatus',
'new_tftp_result' => 'ALTEON_CHEETAH_SWITCH_MIB__agTftpLastActionStatus',
'old_ip_max' => 'ALTEON_TS_NETWORK_MIB__ipInterfaceTableMax',
'new_ip_max' => 'ALTEON_CHEETAH_NETWORK_MIB__ipInterfaceTableMax',
);
%SNMP::Info::Layer3::GLOBALS,
'old_sw_ver' => 'ALTEON_TIGON_SWITCH_MIB__agSoftwareVersion',
'new_sw_ver' => 'ALTEON_CHEETAH_SWITCH_MIB__agSoftwareVersion',
'old_tftp_action' => 'ALTEON_TIGON_SWITCH_MIB__agTftpAction',
'new_tftp_action' => 'ALTEON_CHEETAH_SWITCH_MIB__agTftpAction',
'old_tftp_host' => 'ALTEON_TIGON_SWITCH_MIB__agTftpServer',
'new_tftp_host' => 'ALTEON_CHEETAH_SWITCH_MIB__agTftpServer',
'old_tftp_file' => 'ALTEON_TIGON_SWITCH_MIB__agTftpCfgFileName',
'new_tftp_file' => 'ALTEON_CHEETAH_SWITCH_MIB__agTftpCfgFileName',
'old_tftp_result' => 'ALTEON_TIGON_SWITCH_MIB__agTftpLastActionStatus',
'new_tftp_result' => 'ALTEON_CHEETAH_SWITCH_MIB__agTftpLastActionStatus',
'old_ip_max' => 'ALTEON_TS_NETWORK_MIB__ipInterfaceTableMax',
'new_ip_max' => 'ALTEON_CHEETAH_NETWORK_MIB__ipInterfaceTableMax',
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
# From agPortCurCfgTable
'old_ag_p_cfg_idx' => 'ALTEON_TS_PHYSICAL_MIB__agPortCurCfgIndx',
'new_ag_p_cfg_idx' => 'ALTEON_CHEETAH_SWITCH_MIB__agPortCurCfgIndx',
'old_ag_p_cfg_pref' => 'agPortCurCfgPrefLink',
'new_ag_p_cfg_pref' => 'agPortCurCfgPreferred',
'old_ag_p_cfg_pvid' => 'ALTEON_TS_PHYSICAL_MIB__agPortCurCfgPVID',
'new_ag_p_cfg_pvid' => 'ALTEON_CHEETAH_SWITCH_MIB__agPortCurCfgPVID',
'old_ag_p_cfg_fe_auto' => 'ALTEON_TS_PHYSICAL_MIB__agPortCurCfgFastEthAutoNeg',
'new_ag_p_cfg_fe_auto' => 'ALTEON_CHEETAH_SWITCH_MIB__agPortCurCfgFastEthAutoNeg',
'old_ag_p_cfg_fe_mode' => 'ALTEON_TS_PHYSICAL_MIB__agPortCurCfgFastEthMode',
'new_ag_p_cfg_fe_mode' => 'ALTEON_CHEETAH_SWITCH_MIB__agPortCurCfgFastEthMode',
'old_ag_p_cfg_ge_auto' => 'ALTEON_TS_PHYSICAL_MIB__agPortCurCfgGigEthAutoNeg',
'new_ag_p_cfg_ge_auto' => 'ALTEON_CHEETAH_SWITCH_MIB__agPortCurCfgGigEthAutoNeg',
'old_ag_p_cfg_name' => 'ALTEON_TS_PHYSICAL_MIB__agPortCurCfgPortName',
'new_ag_p_cfg_name' => 'ALTEON_CHEETAH_SWITCH_MIB__agPortCurCfgPortName',
# From portInfoTable
'old_p_info_idx' => 'ALTEON_TS_PHYSICAL_MIB__portInfoIndx',
'new_p_info_idx' => 'ALTEON_CHEETAH_SWITCH_MIB__portInfoIndx',
'old_p_info_mode' => 'ALTEON_TS_PHYSICAL_MIB__portInfoMode',
'new_p_info_mode' => 'ALTEON_CHEETAH_SWITCH_MIB__portInfoMode',
# From ipCurCfgIntfTable
'old_ip_cfg_vlan' => 'ALTEON_TS_NETWORK_MIB__ipCurCfgIntfVlan',
'new_ip_cfg_vlan' => 'ALTEON_CHEETAH_NETWORK_MIB__ipCurCfgIntfVlan',
# From vlanCurCfgTable
'old_vlan_id' => 'ALTEON_TS_PHYSICAL_MIB__vlanCurCfgVlanId',
'new_vlan_id' => 'ALTEON_CS_PHYSICAL_MIB__vlanCurCfgVlanId',
'old_vlan_state' => 'ALTEON_TS_PHYSICAL_MIB__vlanCurCfgState',
'new_vlan_state' => 'ALTEON_CS_PHYSICAL_MIB__vlanCurCfgState',
'old_vlan_name' => 'ALTEON_TS_PHYSICAL_MIB__vlanCurCfgVlanName',
'new_vlan_name' => 'ALTEON_CS_PHYSICAL_MIB__vlanCurCfgVlanName',
'old_vlan_ports' => 'ALTEON_TS_PHYSICAL_MIB__vlanCurCfgPorts',
'new_vlan_ports' => 'ALTEON_CS_PHYSICAL_MIB__vlanCurCfgPorts',
);
%MUNGE = (
%SNMP::Info::Layer3::MUNGE,
);
%SNMP::Info::Layer3::FUNCS,
# From agPortCurCfgTable
'old_ag_p_cfg_idx' => 'ALTEON_TS_PHYSICAL_MIB__agPortCurCfgIndx',
'new_ag_p_cfg_idx' => 'ALTEON_CHEETAH_SWITCH_MIB__agPortCurCfgIndx',
'old_ag_p_cfg_pref' => 'agPortCurCfgPrefLink',
'new_ag_p_cfg_pref' => 'agPortCurCfgPreferred',
'old_ag_p_cfg_pvid' => 'ALTEON_TS_PHYSICAL_MIB__agPortCurCfgPVID',
'new_ag_p_cfg_pvid' => 'ALTEON_CHEETAH_SWITCH_MIB__agPortCurCfgPVID',
'old_ag_p_cfg_fe_auto' =>
'ALTEON_TS_PHYSICAL_MIB__agPortCurCfgFastEthAutoNeg',
'new_ag_p_cfg_fe_auto' =>
'ALTEON_CHEETAH_SWITCH_MIB__agPortCurCfgFastEthAutoNeg',
'old_ag_p_cfg_fe_mode' =>
'ALTEON_TS_PHYSICAL_MIB__agPortCurCfgFastEthMode',
'new_ag_p_cfg_fe_mode' =>
'ALTEON_CHEETAH_SWITCH_MIB__agPortCurCfgFastEthMode',
'old_ag_p_cfg_ge_auto' =>
'ALTEON_TS_PHYSICAL_MIB__agPortCurCfgGigEthAutoNeg',
'new_ag_p_cfg_ge_auto' =>
'ALTEON_CHEETAH_SWITCH_MIB__agPortCurCfgGigEthAutoNeg',
'old_ag_p_cfg_name' => 'ALTEON_TS_PHYSICAL_MIB__agPortCurCfgPortName',
'new_ag_p_cfg_name' => 'ALTEON_CHEETAH_SWITCH_MIB__agPortCurCfgPortName',
# From portInfoTable
'old_p_info_idx' => 'ALTEON_TS_PHYSICAL_MIB__portInfoIndx',
'new_p_info_idx' => 'ALTEON_CHEETAH_SWITCH_MIB__portInfoIndx',
'old_p_info_mode' => 'ALTEON_TS_PHYSICAL_MIB__portInfoMode',
'new_p_info_mode' => 'ALTEON_CHEETAH_SWITCH_MIB__portInfoMode',
# From ipCurCfgIntfTable
'old_ip_cfg_vlan' => 'ALTEON_TS_NETWORK_MIB__ipCurCfgIntfVlan',
'new_ip_cfg_vlan' => 'ALTEON_CHEETAH_NETWORK_MIB__ipCurCfgIntfVlan',
# From vlanCurCfgTable
'old_vlan_id' => 'ALTEON_TS_PHYSICAL_MIB__vlanCurCfgVlanId',
'new_vlan_id' => 'ALTEON_CS_PHYSICAL_MIB__vlanCurCfgVlanId',
'old_vlan_state' => 'ALTEON_TS_PHYSICAL_MIB__vlanCurCfgState',
'new_vlan_state' => 'ALTEON_CS_PHYSICAL_MIB__vlanCurCfgState',
'old_vlan_name' => 'ALTEON_TS_PHYSICAL_MIB__vlanCurCfgVlanName',
'new_vlan_name' => 'ALTEON_CS_PHYSICAL_MIB__vlanCurCfgVlanName',
'old_vlan_ports' => 'ALTEON_TS_PHYSICAL_MIB__vlanCurCfgPorts',
'new_vlan_ports' => 'ALTEON_CS_PHYSICAL_MIB__vlanCurCfgPorts',
);
%MUNGE = ( %SNMP::Info::Layer3::MUNGE, );
sub model {
my $alteon = shift;
my $id = $alteon->id();
unless (defined $id){
print " SNMP::Info::Layer3::AlteonAD::model() - Device does not support sysObjectID\n" if $alteon->debug();
unless ( defined $id ) {
print
" SNMP::Info::Layer3::AlteonAD::model() - Device does not support sysObjectID\n"
if $alteon->debug();
return;
}
my $model = &SNMP::translateObj($id);
return $id unless defined $model;
@@ -146,23 +156,24 @@ sub os_ver {
}
sub interfaces {
my $alteon = shift;
my $alteon = shift;
my $interfaces = $alteon->i_index();
my $descriptions = $alteon->i_description();
my $ip_max = $alteon->new_ip_max() || $alteon->old_ip_max();
my %interfaces = ();
foreach my $iid (keys %$interfaces){
foreach my $iid ( keys %$interfaces ) {
my $desc = $descriptions->{$iid};
next unless defined $desc;
if ($desc =~ /(^net\d+)/) {
$desc = $1;
if ( $desc =~ /(^net\d+)/ ) {
$desc = $1;
}
# IP interfaces are first followed by physical, number possible
# varies by switch model
elsif (defined $ip_max and $iid > $ip_max ) {
$desc = ($iid % $ip_max);
elsif ( defined $ip_max and $iid > $ip_max ) {
$desc = ( $iid % $ip_max );
}
$interfaces{$iid} = $desc;
}
@@ -172,21 +183,23 @@ sub interfaces {
sub i_duplex {
my $alteon = shift;
my $p_mode = $alteon->new_p_info_mode() || $alteon->old_p_info_mode() || {};
my $p_mode = $alteon->new_p_info_mode()
|| $alteon->old_p_info_mode()
|| {};
my $ip_max = $alteon->new_ip_max() || $alteon->old_ip_max();
my %i_duplex;
foreach my $if (keys %$p_mode){
foreach my $if ( keys %$p_mode ) {
my $duplex = $p_mode->{$if};
next unless defined $duplex;
next unless defined $duplex;
$duplex = 'half' if $duplex =~ /half/i;
$duplex = 'full' if $duplex =~ /full/i;
my $idx;
$idx = $if + $ip_max if (defined $ip_max);
$i_duplex{$idx}=$duplex;
$idx = $if + $ip_max if ( defined $ip_max );
$i_duplex{$idx} = $duplex;
}
return \%i_duplex;
}
@@ -194,35 +207,45 @@ sub i_duplex {
sub i_duplex_admin {
my $alteon = shift;
my $ag_pref = $alteon->new_ag_p_cfg_pref() || $alteon->old_ag_p_cfg_pref() || {};
my $ag_fe_auto = $alteon->new_ag_p_cfg_fe_auto() || $alteon->old_ag_p_cfg_fe_auto() || {};
my $ag_fe_mode = $alteon->new_ag_p_cfg_fe_mode() || $alteon->old_ag_p_cfg_fe_mode() || {};
my $ag_ge_auto = $alteon->new_ag_p_cfg_ge_auto() || $alteon->old_ag_p_cfg_ge_auto() || {};
my $ag_pref = $alteon->new_ag_p_cfg_pref()
|| $alteon->old_ag_p_cfg_pref()
|| {};
my $ag_fe_auto = $alteon->new_ag_p_cfg_fe_auto()
|| $alteon->old_ag_p_cfg_fe_auto()
|| {};
my $ag_fe_mode = $alteon->new_ag_p_cfg_fe_mode()
|| $alteon->old_ag_p_cfg_fe_mode()
|| {};
my $ag_ge_auto = $alteon->new_ag_p_cfg_ge_auto()
|| $alteon->old_ag_p_cfg_ge_auto()
|| {};
my $ip_max = $alteon->new_ip_max() || $alteon->old_ip_max();
my %i_duplex_admin;
foreach my $if (keys %$ag_pref){
foreach my $if ( keys %$ag_pref ) {
my $pref = $ag_pref->{$if};
next unless defined $pref;
my $string = 'other';
if ($pref =~ /gigabit/i) {
my $string = 'other';
if ( $pref =~ /gigabit/i ) {
my $ge_auto = $ag_ge_auto->{$if};
$string = 'full' if ($ge_auto =~ /off/i);
$string = 'auto' if ($ge_auto =~ /on/i);
$string = 'full' if ( $ge_auto =~ /off/i );
$string = 'auto' if ( $ge_auto =~ /on/i );
}
elsif ($pref =~ /fast/i) {
elsif ( $pref =~ /fast/i ) {
my $fe_auto = $ag_fe_auto->{$if};
my $fe_mode = $ag_fe_mode->{$if};
$string = 'half' if ($fe_mode =~ /half/i and $fe_auto =~ /off/i);
$string = 'full' if ($fe_mode =~ /full/i and $fe_auto =~ /off/i);
$string = 'half'
if ( $fe_mode =~ /half/i and $fe_auto =~ /off/i );
$string = 'full'
if ( $fe_mode =~ /full/i and $fe_auto =~ /off/i );
$string = 'auto' if $fe_auto =~ /on/i;
}
my $idx;
$idx = $if + $ip_max if (defined $ip_max);
$i_duplex_admin{$idx}=$string;
$idx = $if + $ip_max if ( defined $ip_max );
$i_duplex_admin{$idx} = $string;
}
return \%i_duplex_admin;
}
@@ -230,55 +253,62 @@ sub i_duplex_admin {
sub i_name {
my $alteon = shift;
my $p_name = $alteon->new_ag_p_cfg_name() || $alteon->old_ag_p_cfg_name() || {};
my $p_name = $alteon->new_ag_p_cfg_name()
|| $alteon->old_ag_p_cfg_name()
|| {};
my $ip_max = $alteon->new_ip_max() || $alteon->old_ip_max();
my %i_name;
foreach my $iid (keys %$p_name){
foreach my $iid ( keys %$p_name ) {
my $name = $p_name->{$iid};
next unless defined $name;
my $idx;
$idx = $iid + $ip_max if (defined $ip_max);
$idx = $iid + $ip_max if ( defined $ip_max );
$i_name{$idx} = $name;
}
return \%i_name;
}
sub v_index {
my $alteon = shift;
my $alteon = shift;
my $partial = shift;
return $alteon->new_vlan_id($partial) || $alteon->old_vlan_id($partial);
}
sub v_name {
my $alteon = shift;
my $alteon = shift;
my $partial = shift;
return $alteon->new_vlan_name($partial) || $alteon->old_vlan_name($partial);
return $alteon->new_vlan_name($partial)
|| $alteon->old_vlan_name($partial);
}
sub i_vlan {
my $alteon = shift;
my $ag_vlans = $alteon->new_ag_p_cfg_pvid() || $alteon->old_ag_p_cfg_pvid() || {};
my $ip_vlans = $alteon->new_ip_cfg_vlan() || $alteon->old_ip_cfg_vlan() || {};
my $ip_max = $alteon->new_ip_max() || $alteon->old_ip_max();
my $ag_vlans = $alteon->new_ag_p_cfg_pvid()
|| $alteon->old_ag_p_cfg_pvid()
|| {};
my $ip_vlans = $alteon->new_ip_cfg_vlan()
|| $alteon->old_ip_cfg_vlan()
|| {};
my $ip_max = $alteon->new_ip_max() || $alteon->old_ip_max();
my %i_vlan;
foreach my $if (keys %$ip_vlans){
foreach my $if ( keys %$ip_vlans ) {
my $ip_vlanid = $ip_vlans->{$if};
next unless defined $ip_vlanid;
$i_vlan{$if}=$ip_vlanid;
$i_vlan{$if} = $ip_vlanid;
}
foreach my $if (keys %$ag_vlans){
foreach my $if ( keys %$ag_vlans ) {
my $ag_vlanid = $ag_vlans->{$if};
next unless defined $ag_vlanid;
my $idx;
$idx = $if + $ip_max if (defined $ip_max);
$i_vlan{$idx}=$ag_vlanid;
$idx = $if + $ip_max if ( defined $ip_max );
$i_vlan{$idx} = $ag_vlanid;
}
return \%i_vlan;
}
@@ -286,24 +316,26 @@ sub i_vlan {
sub i_vlan_membership {
my $alteon = shift;
my $v_ports = $alteon->old_vlan_ports() || $alteon->new_vlan_ports() || {};
my $ip_max = $alteon->new_ip_max() || $alteon->old_ip_max();
my $v_ports = $alteon->old_vlan_ports()
|| $alteon->new_vlan_ports()
|| {};
my $ip_max = $alteon->new_ip_max() || $alteon->old_ip_max();
my $i_vlan_membership = {};
foreach my $vlan (keys %$v_ports) {
my $portlist = [split(//, unpack("B*", $v_ports->{$vlan}))];
foreach my $vlan ( keys %$v_ports ) {
my $portlist = [ split( //, unpack( "B*", $v_ports->{$vlan} ) ) ];
my $ret = [];
# Convert portlist bit array to ifIndex array
for (my $i = 0; $i <= scalar(@$portlist); $i++) {
for ( my $i = 0; $i <= scalar(@$portlist); $i++ ) {
my $idx;
$idx = $i + $ip_max if (defined $ip_max);
push(@{$ret}, $idx) if (@$portlist[$i]);
$idx = $i + $ip_max if ( defined $ip_max );
push( @{$ret}, $idx ) if ( @$portlist[$i] );
}
#Create HoA ifIndex -> VLAN array
foreach my $port (@{$ret}) {
push(@{$i_vlan_membership->{$port}}, $vlan);
foreach my $port ( @{$ret} ) {
push( @{ $i_vlan_membership->{$port} }, $vlan );
}
}
return $i_vlan_membership;
@@ -315,13 +347,13 @@ sub bp_index {
my $alteon = shift;
my $b_index = $alteon->orig_bp_index();
my $ip_max = $alteon->new_ip_max() || $alteon->old_ip_max();
my $ip_max = $alteon->new_ip_max() || $alteon->old_ip_max();
my %bp_index;
foreach my $iid (keys %$b_index){
foreach my $iid ( keys %$b_index ) {
my $port = $b_index->{$iid};
next unless defined $port;
$port = $port + $ip_max if (defined $ip_max and $iid == $ip_max);
$port = $port + $ip_max if ( defined $ip_max and $iid == $ip_max );
$bp_index{$iid} = $port;
}
@@ -357,8 +389,8 @@ Eric Miller
=head1 DESCRIPTION
Abstraction subclass for Nortel Alteon Series Layer 2-7 load balancing switches
and Nortel BladeCenter Layer2-3 GbE Switch Modules.
Abstraction subclass for Nortel Alteon Series Layer 2-7 load balancing
switches and Nortel BladeCenter Layer2-3 GbE Switch Modules.
For speed or debugging purposes you can call the subclass directly, but not
after determining a more specific class using the method above.

File diff suppressed because it is too large Load Diff

View File

@@ -4,21 +4,21 @@
# Copyright (c) 2008 Max Baker changes from version 0.8 and beyond.
# Copyright (c) 2004 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
@@ -42,63 +42,57 @@ use SNMP::Info::CiscoPortSecurity;
use SNMP::Info::CiscoPower;
use SNMP::Info::Layer3;
@SNMP::Info::Layer3::C3550::ISA = qw/SNMP::Info::CiscoVTP SNMP::Info::CiscoStack
SNMP::Info::CDP SNMP::Info::CiscoStats
SNMP::Info::CiscoPortSecurity
SNMP::Info::CiscoImage SNMP::Info::CiscoPower
SNMP::Info::Layer3
Exporter/;
@SNMP::Info::Layer3::C3550::ISA
= qw/SNMP::Info::CiscoVTP SNMP::Info::CiscoStack
SNMP::Info::CDP SNMP::Info::CiscoStats
SNMP::Info::CiscoPortSecurity
SNMP::Info::CiscoImage SNMP::Info::CiscoPower
SNMP::Info::Layer3
Exporter/;
@SNMP::Info::Layer3::C3550::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::Layer3::MIBS,
%SNMP::Info::CiscoPower::MIBS,
%SNMP::Info::CiscoPortSecurity::MIBS,
%SNMP::Info::CiscoImage::MIBS,
%SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::CDP::MIBS,
%SNMP::Info::CiscoStack::MIBS,
%SNMP::Info::CiscoVTP::MIBS,
);
%MIBS = (
%SNMP::Info::Layer3::MIBS, %SNMP::Info::CiscoPower::MIBS,
%SNMP::Info::CiscoPortSecurity::MIBS, %SNMP::Info::CiscoImage::MIBS,
%SNMP::Info::CiscoStats::MIBS, %SNMP::Info::CDP::MIBS,
%SNMP::Info::CiscoStack::MIBS, %SNMP::Info::CiscoVTP::MIBS,
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::CiscoPower::GLOBALS,
%SNMP::Info::CiscoPortSecurity::GLOBALS,
%SNMP::Info::CiscoImage::GLOBALS,
%SNMP::Info::CiscoStats::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
%SNMP::Info::CiscoStack::GLOBALS,
%SNMP::Info::CiscoVTP::GLOBALS,
'ports2' => 'ifNumber',
);
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::CiscoPower::GLOBALS,
%SNMP::Info::CiscoPortSecurity::GLOBALS,
%SNMP::Info::CiscoImage::GLOBALS,
%SNMP::Info::CiscoStats::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
%SNMP::Info::CiscoStack::GLOBALS,
%SNMP::Info::CiscoVTP::GLOBALS,
'ports2' => 'ifNumber',
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::CiscoPower::FUNCS,
%SNMP::Info::CiscoPortSecurity::FUNCS,
%SNMP::Info::CiscoImage::FUNCS,
%SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::CDP::FUNCS,
%SNMP::Info::CiscoStack::FUNCS,
%SNMP::Info::CiscoVTP::FUNCS,
);
%SNMP::Info::Layer3::FUNCS, %SNMP::Info::CiscoPower::FUNCS,
%SNMP::Info::CiscoPortSecurity::FUNCS, %SNMP::Info::CiscoImage::FUNCS,
%SNMP::Info::CiscoStats::FUNCS, %SNMP::Info::CDP::FUNCS,
%SNMP::Info::CiscoStack::FUNCS, %SNMP::Info::CiscoVTP::FUNCS,
);
%MUNGE = (
# Inherit all the built in munging
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::CiscoPower::MUNGE,
%SNMP::Info::CiscoPortSecurity::MUNGE,
%SNMP::Info::CiscoImage::MUNGE,
%SNMP::Info::CiscoStats::MUNGE,
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoStack::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE,
);
# Inherit all the built in munging
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::CiscoPower::MUNGE,
%SNMP::Info::CiscoPortSecurity::MUNGE,
%SNMP::Info::CiscoImage::MUNGE,
%SNMP::Info::CiscoStats::MUNGE,
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoStack::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE,
);
sub vendor {
return 'cisco';
@@ -106,12 +100,12 @@ sub vendor {
sub model {
my $c3550 = shift;
my $id = $c3550->id();
my $id = $c3550->id();
my $model = &SNMP::translateObj($id) || $id;
$model =~ s/^catalyst//;
# turn 355048 into 3550-48
if ($model =~ /^(35\d\d)(\d\d(T|G)?)$/) {
if ( $model =~ /^(35\d\d)(\d\d(T|G)?)$/ ) {
$model = "$1-$2";
}
return $model;
@@ -121,11 +115,11 @@ sub model {
sub ports {
my $c3550 = shift;
my $ports2 = $c3550->ports2();
my $ports2 = $c3550->ports2();
my $id = $c3550->id();
my $id = $c3550->id();
my $model = &SNMP::translateObj($id);
if ($model =~ /(12|24|48)(C|T|TS|G|TS-E|TS-S|T-E)?$/) {
if ( $model =~ /(12|24|48)(C|T|TS|G|TS-E|TS-S|T-E)?$/ ) {
return $1;
}
return $ports2;
@@ -136,15 +130,15 @@ sub ports {
# See http://www.ciscosystems.com/en/US/products/hw/switches/ps646/prod_release_note09186a00802a08ee.html
sub i_duplex {
my $c3550 = shift;
my $c3550 = shift;
my $partial = shift;
my $el_duplex = $c3550->el_duplex($partial);
# Newer software
if (defined $el_duplex and scalar(keys %$el_duplex)){
# Newer software
if ( defined $el_duplex and scalar( keys %$el_duplex ) ) {
my %i_duplex;
foreach my $el_port (keys %$el_duplex){
foreach my $el_port ( keys %$el_duplex ) {
my $duplex = $el_duplex->{$el_port};
next unless defined $duplex;
@@ -153,6 +147,7 @@ sub i_duplex {
}
return \%i_duplex;
}
# Fall back to CiscoStack method
else {
return $c3550->SUPER::i_duplex($partial);
@@ -162,53 +157,55 @@ sub i_duplex {
# Software >= 12.1(22)EA1a uses portDuplex as admin setting
sub i_duplex_admin {
my $c3550 = shift;
my $c3550 = shift;
my $partial = shift;
my $el_duplex = $c3550->el_duplex($partial);
# Newer software
if (defined $el_duplex and scalar(keys %$el_duplex)){
# Newer software
if ( defined $el_duplex and scalar( keys %$el_duplex ) ) {
my $p_port = $c3550->p_port() || {};
my $p_duplex = $c3550->p_duplex() || {};
my $i_duplex_admin = {};
foreach my $port (keys %$p_duplex) {
foreach my $port ( keys %$p_duplex ) {
my $iid = $p_port->{$port};
next unless defined $iid;
next if (defined $partial and $iid !~ /^$partial$/);
next if ( defined $partial and $iid !~ /^$partial$/ );
$i_duplex_admin->{$iid} = $p_duplex->{$port};
}
return $i_duplex_admin;
}
# Fall back to CiscoStack method
else {
return $c3550->SUPER::i_duplex_admin($partial);
}
}
}
sub set_i_duplex_admin {
# map a textual duplex to an integer one the switch understands
my %duplexes = qw/half 1 full 2 auto 4/;
my $c3550 = shift;
my ($duplex, $iid) = @_;
my ( $duplex, $iid ) = @_;
my $el_duplex = $c3550->el_duplex($iid);
# Auto duplex only supported on newer software
if (defined $el_duplex and scalar(keys %$el_duplex)){
my $p_port = $c3550->p_port() || {};
if ( defined $el_duplex and scalar( keys %$el_duplex ) ) {
my $p_port = $c3550->p_port() || {};
my %reverse_p_port = reverse %$p_port;
$duplex = lc($duplex);
$duplex = lc($duplex);
return 0 unless defined $duplexes{$duplex};
return 0 unless defined $duplexes{$duplex};
$iid = $reverse_p_port{$iid};
$iid = $reverse_p_port{$iid};
return $c3550->set_p_duplex($duplexes{$duplex}, $iid);
return $c3550->set_p_duplex( $duplexes{$duplex}, $iid );
}
else {
return $c3550->SUPER::set_i_duplex_admin;
@@ -315,7 +312,7 @@ These are methods that return scalar value from SNMP
=item $c3550->vendor()
Returns 'cisco'
Returns 'cisco'
=item $c3550->model()

View File

@@ -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
@@ -42,83 +42,81 @@ use SNMP::Info::MAU;
use SNMP::Info::Layer3;
@SNMP::Info::Layer3::C4000::ISA = qw/SNMP::Info::CiscoVTP SNMP::Info::CDP
SNMP::Info::CiscoStats SNMP::Info::CiscoImage
SNMP::Info::CiscoPortSecurity
SNMP::Info::CiscoConfig SNMP::Info::MAU
SNMP::Info::Layer3 Exporter/;
SNMP::Info::CiscoStats SNMP::Info::CiscoImage
SNMP::Info::CiscoPortSecurity
SNMP::Info::CiscoConfig SNMP::Info::MAU
SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::C4000::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::Layer3::MIBS,
%SNMP::Info::MAU::MIBS,
%SNMP::Info::CiscoConfig::MIBS,
%SNMP::Info::CiscoPortSecurity::MIBS,
%SNMP::Info::CiscoImage::MIBS,
%SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::CDP::MIBS,
%SNMP::Info::CiscoVTP::MIBS,
'CISCO-ENVMON-MIB' => 'ciscoEnvMonMIB',
);
%MIBS = (
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::MAU::MIBS,
%SNMP::Info::CiscoConfig::MIBS,
%SNMP::Info::CiscoPortSecurity::MIBS,
%SNMP::Info::CiscoImage::MIBS,
%SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::CDP::MIBS,
%SNMP::Info::CiscoVTP::MIBS,
'CISCO-ENVMON-MIB' => 'ciscoEnvMonMIB',
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::MAU::GLOBALS,
%SNMP::Info::CiscoConfig::GLOBALS,
%SNMP::Info::CiscoPortSecurity::GLOBALS,
%SNMP::Info::CiscoImage::GLOBALS,
%SNMP::Info::CiscoStats::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
%SNMP::Info::CiscoVTP::GLOBALS,
'ps1_type' => 'ciscoEnvMonSupplyStatusDescr.1',
'ps1_status' => 'ciscoEnvMonSupplyState.1',
'ps2_type' => 'ciscoEnvMonSupplyStatusDescr.2',
'ps2_status' => 'ciscoEnvMonSupplyState.2',
);
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::MAU::GLOBALS,
%SNMP::Info::CiscoConfig::GLOBALS,
%SNMP::Info::CiscoPortSecurity::GLOBALS,
%SNMP::Info::CiscoImage::GLOBALS,
%SNMP::Info::CiscoStats::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
%SNMP::Info::CiscoVTP::GLOBALS,
'ps1_type' => 'ciscoEnvMonSupplyStatusDescr.1',
'ps1_status' => 'ciscoEnvMonSupplyState.1',
'ps2_type' => 'ciscoEnvMonSupplyStatusDescr.2',
'ps2_status' => 'ciscoEnvMonSupplyState.2',
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::MAU::FUNCS,
%SNMP::Info::CiscoConfig::FUNCS,
%SNMP::Info::CiscoPortSecurity::FUNCS,
%SNMP::Info::CiscoImage::FUNCS,
%SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::CDP::FUNCS,
%SNMP::Info::CiscoVTP::FUNCS,
'fan_state' => 'ciscoEnvMonFanState',
'fan_descr' => 'ciscoEnvMonFanStatusDescr',
);
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::MAU::FUNCS,
%SNMP::Info::CiscoConfig::FUNCS,
%SNMP::Info::CiscoPortSecurity::FUNCS,
%SNMP::Info::CiscoImage::FUNCS,
%SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::CDP::FUNCS,
%SNMP::Info::CiscoVTP::FUNCS,
'fan_state' => 'ciscoEnvMonFanState',
'fan_descr' => 'ciscoEnvMonFanStatusDescr',
);
%MUNGE = (
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::MAU::MUNGE,
%SNMP::Info::CiscoConfig::MUNGE,
%SNMP::Info::CiscoPortSecurity::MUNGE,
%SNMP::Info::CiscoImage::MUNGE,
%SNMP::Info::CiscoStats::MUNGE,
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE,
);
%SNMP::Info::Layer3::MUNGE, %SNMP::Info::MAU::MUNGE,
%SNMP::Info::CiscoConfig::MUNGE, %SNMP::Info::CiscoPortSecurity::MUNGE,
%SNMP::Info::CiscoImage::MUNGE, %SNMP::Info::CiscoStats::MUNGE,
%SNMP::Info::CDP::MUNGE, %SNMP::Info::CiscoVTP::MUNGE,
);
# Override Inheritance for these specific methods
# use MAU-MIB for admin. duplex and admin. speed
*SNMP::Info::Layer3::C4000::i_duplex_admin = \&SNMP::Info::MAU::mau_i_duplex_admin;
*SNMP::Info::Layer3::C4000::i_speed_admin = \&SNMP::Info::MAU::mau_i_speed_admin;
*SNMP::Info::Layer3::C4000::i_duplex_admin
= \&SNMP::Info::MAU::mau_i_duplex_admin;
*SNMP::Info::Layer3::C4000::i_speed_admin
= \&SNMP::Info::MAU::mau_i_speed_admin;
sub fan {
my $c4000 = shift;
my $c4000 = shift;
my $fan_state = $c4000->fan_state();
my $fan_descr = $c4000->fan_descr();
my $ret = "";
my $s = "";
foreach my $i (sort {$a <=> $b} keys %$fan_state) {
$ret .= $s . $fan_descr->{$i} . ": " . $fan_state->{$i};
$s = ", ";
my $ret = "";
my $s = "";
foreach my $i ( sort { $a <=> $b } keys %$fan_state ) {
$ret .= $s . $fan_descr->{$i} . ": " . $fan_state->{$i};
$s = ", ";
}
return if ($s eq "");
return if ( $s eq "" );
return $ret;
}

View File

@@ -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
@@ -42,67 +42,56 @@ use SNMP::Info::CiscoConfig;
use SNMP::Info::CiscoPower;
use SNMP::Info::Layer3;
@SNMP::Info::Layer3::C6500::ISA = qw/SNMP::Info::CiscoVTP SNMP::Info::CiscoStack
SNMP::Info::CDP SNMP::Info::CiscoStats
SNMP::Info::CiscoImage
SNMP::Info::CiscoPortSecurity
SNMP::Info::CiscoConfig
SNMP::Info::CiscoPower
SNMP::Info::Layer3
Exporter/;
@SNMP::Info::Layer3::C6500::ISA
= qw/SNMP::Info::CiscoVTP SNMP::Info::CiscoStack
SNMP::Info::CDP SNMP::Info::CiscoStats
SNMP::Info::CiscoImage
SNMP::Info::CiscoPortSecurity
SNMP::Info::CiscoConfig
SNMP::Info::CiscoPower
SNMP::Info::Layer3
Exporter/;
@SNMP::Info::Layer3::C6500::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::Layer3::MIBS,
%SNMP::Info::CiscoPower::MIBS,
%SNMP::Info::CiscoConfig::MIBS,
%SNMP::Info::CiscoPortSecurity::MIBS,
%SNMP::Info::CiscoImage::MIBS,
%SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::CDP::MIBS,
%SNMP::Info::CiscoStack::MIBS,
%SNMP::Info::CiscoVTP::MIBS,
);
%MIBS = (
%SNMP::Info::Layer3::MIBS, %SNMP::Info::CiscoPower::MIBS,
%SNMP::Info::CiscoConfig::MIBS, %SNMP::Info::CiscoPortSecurity::MIBS,
%SNMP::Info::CiscoImage::MIBS, %SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::CDP::MIBS, %SNMP::Info::CiscoStack::MIBS,
%SNMP::Info::CiscoVTP::MIBS,
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::CiscoPower::GLOBALS,
%SNMP::Info::CiscoConfig::GLOBALS,
%SNMP::Info::CiscoPortSecurity::GLOBALS,
%SNMP::Info::CiscoImage::GLOBALS,
%SNMP::Info::CiscoStats::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
%SNMP::Info::CiscoStack::GLOBALS,
%SNMP::Info::CiscoVTP::GLOBALS,
);
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::CiscoPower::GLOBALS,
%SNMP::Info::CiscoConfig::GLOBALS,
%SNMP::Info::CiscoPortSecurity::GLOBALS,
%SNMP::Info::CiscoImage::GLOBALS,
%SNMP::Info::CiscoStats::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
%SNMP::Info::CiscoStack::GLOBALS,
%SNMP::Info::CiscoVTP::GLOBALS,
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::CiscoPower::FUNCS,
%SNMP::Info::CiscoConfig::FUNCS,
%SNMP::Info::CiscoPortSecurity::FUNCS,
%SNMP::Info::CiscoImage::FUNCS,
%SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::CDP::FUNCS,
%SNMP::Info::CiscoStack::FUNCS,
%SNMP::Info::CiscoVTP::FUNCS,
);
%SNMP::Info::Layer3::FUNCS, %SNMP::Info::CiscoPower::FUNCS,
%SNMP::Info::CiscoConfig::FUNCS, %SNMP::Info::CiscoPortSecurity::FUNCS,
%SNMP::Info::CiscoImage::FUNCS, %SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::CDP::FUNCS, %SNMP::Info::CiscoStack::FUNCS,
%SNMP::Info::CiscoVTP::FUNCS,
);
%MUNGE = (
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::CiscoPower::MUNGE,
%SNMP::Info::CiscoConfig::MUNGE,
%SNMP::Info::CiscoPortSecurity::MUNGE,
%SNMP::Info::CiscoImage::MUNGE,
%SNMP::Info::CiscoStats::MUNGE,
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoStack::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE,
);
%SNMP::Info::Layer3::MUNGE, %SNMP::Info::CiscoPower::MUNGE,
%SNMP::Info::CiscoConfig::MUNGE, %SNMP::Info::CiscoPortSecurity::MUNGE,
%SNMP::Info::CiscoImage::MUNGE, %SNMP::Info::CiscoStats::MUNGE,
%SNMP::Info::CDP::MUNGE, %SNMP::Info::CiscoStack::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE,
);
sub vendor {
return 'cisco';
@@ -113,15 +102,15 @@ sub cisco_comm_indexing { return 1; }
# Newer versions use the ETHERLIKE-MIB to report operational duplex.
sub i_duplex {
my $c6500 = shift;
my $c6500 = shift;
my $partial = shift;
my $el_duplex = $c6500->el_duplex($partial);
# Newer software
if (defined $el_duplex and scalar(keys %$el_duplex)){
# Newer software
if ( defined $el_duplex and scalar( keys %$el_duplex ) ) {
my %i_duplex;
foreach my $el_port (keys %$el_duplex){
foreach my $el_port ( keys %$el_duplex ) {
my $duplex = $el_duplex->{$el_port};
next unless defined $duplex;
@@ -130,6 +119,7 @@ sub i_duplex {
}
return \%i_duplex;
}
# Fall back to CiscoStack method
else {
return $c6500->SUPER::i_duplex($partial);
@@ -139,53 +129,55 @@ sub i_duplex {
# Newer software uses portDuplex as admin setting
sub i_duplex_admin {
my $c6500 = shift;
my $c6500 = shift;
my $partial = shift;
my $el_duplex = $c6500->el_duplex($partial);
# Newer software
if (defined $el_duplex and scalar(keys %$el_duplex)){
# Newer software
if ( defined $el_duplex and scalar( keys %$el_duplex ) ) {
my $p_port = $c6500->p_port() || {};
my $p_duplex = $c6500->p_duplex() || {};
my $i_duplex_admin = {};
foreach my $port (keys %$p_duplex) {
foreach my $port ( keys %$p_duplex ) {
my $iid = $p_port->{$port};
next unless defined $iid;
next if (defined $partial and $iid !~ /^$partial$/);
next if ( defined $partial and $iid !~ /^$partial$/ );
$i_duplex_admin->{$iid} = $p_duplex->{$port};
}
return $i_duplex_admin;
}
# Fall back to CiscoStack method
else {
return $c6500->SUPER::i_duplex_admin($partial);
}
}
}
sub set_i_duplex_admin {
# map a textual duplex to an integer one the switch understands
my %duplexes = qw/half 1 full 2 auto 4/;
my $c6500 = shift;
my ($duplex, $iid) = @_;
my ( $duplex, $iid ) = @_;
my $el_duplex = $c6500->el_duplex($iid);
# Auto duplex only supported on newer software
if (defined $el_duplex and scalar(keys %$el_duplex)){
my $p_port = $c6500->p_port() || {};
if ( defined $el_duplex and scalar( keys %$el_duplex ) ) {
my $p_port = $c6500->p_port() || {};
my %reverse_p_port = reverse %$p_port;
$duplex = lc($duplex);
$duplex = lc($duplex);
return 0 unless defined $duplexes{$duplex};
return 0 unless defined $duplexes{$duplex};
$iid = $reverse_p_port{$iid};
$iid = $reverse_p_port{$iid};
return $c6500->set_p_duplex($duplexes{$duplex}, $iid);
return $c6500->set_p_duplex( $duplexes{$duplex}, $iid );
}
else {
return $c6500->SUPER::set_i_duplex_admin;
@@ -224,9 +216,9 @@ Max Baker
Abstraction subclass for Cisco Catalyst 6500 Layer 2/3 Switches.
These devices run IOS but have some of the same characteristics as the Catalyst
WS-C family (5xxx). For example, forwarding tables are held in VLANs, and
extended interface information is gleaned from F<CISCO-SWITCH-MIB>.
These devices run IOS but have some of the same characteristics as the
Catalyst WS-C family (5xxx). For example, forwarding tables are held in
VLANs, and extended interface information is gleaned from F<CISCO-SWITCH-MIB>.
For speed or debugging purposes you can call the subclass directly, but not
after determining a more specific class using the method above.

View File

@@ -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
@@ -43,11 +43,11 @@ use SNMP::Info::CiscoPower;
use SNMP::Info::Layer3;
@SNMP::Info::Layer3::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::CiscoPower
SNMP::Info::Layer3
Exporter/;
SNMP::Info::CiscoStats SNMP::Info::CiscoImage
SNMP::Info::CiscoRTT SNMP::Info::CiscoQOS
SNMP::Info::CiscoConfig SNMP::Info::CiscoPower
SNMP::Info::Layer3
Exporter/;
@SNMP::Info::Layer3::Cisco::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
@@ -55,74 +55,70 @@ use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::CiscoPower::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,
'CISCO-EIGRP-MIB' => 'cEigrpAsRouterId',
);
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::CiscoPower::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,
'CISCO-EIGRP-MIB' => 'cEigrpAsRouterId',
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::CiscoPower::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,
'eigrp_id' => 'cEigrpAsRouterId',
);
%SNMP::Info::Layer3::GLOBALS, %SNMP::Info::CiscoPower::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, 'eigrp_id' => 'cEigrpAsRouterId',
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::CiscoPower::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,
# EIGRP
'eigrp_peers' => 'cEigrpPeerAddr',
);
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::CiscoPower::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,
# EIGRP
'eigrp_peers' => 'cEigrpPeerAddr',
);
%MUNGE = (
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::CiscoPower::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,
'eigrp_peers' => \&SNMP::Info::munge_ip,
);
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::CiscoPower::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,
'eigrp_peers' => \&SNMP::Info::munge_ip,
);
sub i_vlan {
my ($cisco) = shift;
my ($partial) = shift;
my ($cisco) = shift;
my ($partial) = shift;
my ($i_type) = $cisco->i_type($partial);
my ($i_descr) = $cisco->i_description($partial);
my %i_vlan;
my ($i_type) = $cisco->i_type($partial);
my ($i_descr) = $cisco->i_description($partial);
my %i_vlan;
foreach my $idx (keys %$i_descr) {
if ($i_type->{$idx} eq 'l2vlan' || $i_type->{$idx} eq 135) {
if ($i_descr->{$idx} =~ /\.(\d+)$/) {
$i_vlan{$idx} = $1;
}
}
}
return \%i_vlan;
foreach my $idx ( keys %$i_descr ) {
if ( $i_type->{$idx} eq 'l2vlan' || $i_type->{$idx} eq 135 ) {
if ( $i_descr->{$idx} =~ /\.(\d+)$/ ) {
$i_vlan{$idx} = $1;
}
}
}
return \%i_vlan;
}
1;

View File

@@ -3,21 +3,21 @@
#
# 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,7 +36,8 @@ use SNMP::Info;
use SNMP::Info::Layer3;
use SNMP::Info::Entity;
@SNMP::Info::Layer3::Contivity::ISA = qw/SNMP::Info SNMP::Info::Layer3 SNMP::Info::Entity Exporter/;
@SNMP::Info::Layer3::Contivity::ISA
= qw/SNMP::Info SNMP::Info::Layer3 SNMP::Info::Entity Exporter/;
@SNMP::Info::Layer3::Contivity::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
@@ -44,28 +45,23 @@ use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::MIBS,
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::Entity::MIBS,
);
%SNMP::Info::MIBS, %SNMP::Info::Layer3::MIBS, %SNMP::Info::Entity::MIBS,
);
%GLOBALS = (
%SNMP::Info::GLOBALS,
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::Entity::GLOBALS,
);
%SNMP::Info::GLOBALS, %SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::Entity::GLOBALS,
);
%FUNCS = (
%SNMP::Info::FUNCS,
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::Entity::FUNCS,
);
%SNMP::Info::FUNCS, %SNMP::Info::Layer3::FUNCS,
%SNMP::Info::Entity::FUNCS,
);
%MUNGE = (
%SNMP::Info::MUNGE,
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::Entity::MUNGE,
);
%SNMP::Info::MUNGE, %SNMP::Info::Layer3::MUNGE,
%SNMP::Info::Entity::MUNGE,
);
sub layers {
return '00000100';
@@ -80,8 +76,8 @@ sub model {
my $e_model = $contivity->e_model() || {};
my $model = $e_model->{1} || undef;
return $1 if (defined $model and $model =~ /(CES\d+)/i);
return $1 if ( defined $model and $model =~ /(CES\d+)/i );
return;
}
@@ -91,10 +87,10 @@ sub os {
sub os_ver {
my $contivity = shift;
my $descr = $contivity->description();
my $descr = $contivity->description();
return unless defined $descr;
if ($descr =~ m/V(\d+_\d+\.\d+)/i){
if ( $descr =~ m/V(\d+_\d+\.\d+)/i ) {
return $1;
}
return;
@@ -102,10 +98,10 @@ sub os_ver {
sub mac {
my $contivity = shift;
my $i_mac = $contivity->i_mac();
my $i_mac = $contivity->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;
@@ -118,23 +114,23 @@ sub serial {
my $e_serial = $contivity->e_serial() || {};
my $serial = $e_serial->{1} || undef;
return $1 if (defined $serial and $serial =~ /(\d+)/);
return $1 if ( defined $serial and $serial =~ /(\d+)/ );
return;
}
sub interfaces {
my $contivity = shift;
my $partial = shift;
my $partial = shift;
my $description = $contivity->i_description($partial) || {};
my %interfaces = ();
foreach my $iid (keys %$description){
foreach my $iid ( keys %$description ) {
my $desc = $description->{$iid};
# Skip everything except Ethernet interfaces
next unless (defined $desc and $desc =~ /fe/i);
next unless ( defined $desc and $desc =~ /fe/i );
$interfaces{$iid} = $desc;
}
@@ -143,21 +139,22 @@ sub interfaces {
sub i_name {
my $contivity = shift;
my $partial = shift;
my $partial = shift;
my $i_name2 = $contivity->orig_i_name($partial) || {};
my %i_name;
foreach my $iid (keys %$i_name2){
foreach my $iid ( keys %$i_name2 ) {
my $name = $i_name2->{$iid};
#Skip everything except Ethernet interfaces
next unless (defined $name and $name =~ /fe/i);
next unless ( defined $name and $name =~ /fe/i );
$name = $1 if $name =~ /(fei\.\d+\.\d+)/;
$i_name{$iid} = $name;
}
return \%i_name;
}
return \%i_name;
}
1;
@@ -165,8 +162,8 @@ __END__
=head1 NAME
SNMP::Info::Layer3::Contivity - SNMP Interface to Nortel VPN Routers (Contivity
Extranet Switches).
SNMP::Info::Layer3::Contivity - SNMP Interface to Nortel VPN Routers
(Contivity Extranet Switches).
=head1 AUTHOR

View File

@@ -3,21 +3,21 @@
#
# 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,84 +34,88 @@ use strict;
use Exporter;
use SNMP::Info::Layer3;
@SNMP::Info::Layer3::Dell::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::Dell::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::Dell::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = ( %SNMP::Info::Layer3::MIBS,
'RADLAN-Physicaldescription-MIB' => 'rlPhdStackReorder',
'RADLAN-rlInterfaces' => 'rlIfNumOfLoopbackPorts',
'RADLAN-HWENVIROMENT' => 'rlEnvPhysicalDescription',
'Dell-Vendor-MIB' => 'productIdentificationVersion',
);
%MIBS = (
%SNMP::Info::Layer3::MIBS,
'RADLAN-Physicaldescription-MIB' => 'rlPhdStackReorder',
'RADLAN-rlInterfaces' => 'rlIfNumOfLoopbackPorts',
'RADLAN-HWENVIROMENT' => 'rlEnvPhysicalDescription',
'Dell-Vendor-MIB' => 'productIdentificationVersion',
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
'os_ver' => 'productIdentificationVersion',
'dell_id_name' => 'productIdentificationDisplayName',
);
%SNMP::Info::Layer3::GLOBALS,
'os_ver' => 'productIdentificationVersion',
'dell_id_name' => 'productIdentificationDisplayName',
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
# RADLAN-rlInterfaces:swIfTable
'dell_duplex_admin' => 'swIfDuplexAdminMode',
'dell_duplex' => 'swIfDuplexOperMode',
'dell_tag_mode' => 'swIfTaggedMode',
'dell_i_type' => 'swIfType',
'dell_fc_admin' => 'swIfFlowControlMode',
'dell_speed_admin' => 'swIfSpeedAdminMode',
'dell_auto' => 'swIfSpeedDuplexAutoNegotiation',
'dell_fc' => 'swIfOperFlowControlMode',
# RADLAN-Physicaldescription-MIB:rlPhdUnitGenParamTable
'dell_unit' => 'rlPhdUnitGenParamStackUnit',
'dell_sw_ver' => 'rlPhdUnitGenParamSoftwareVersion',
'dell_fw_ver' => 'rlPhdUnitGenParamFirmwareVersion',
'dell_hw_ver' => 'rlPhdUnitGenParamHardwareVersion',
'dell_serial_no' => 'rlPhdUnitGenParamSerialNum',
'dell_asset_no' => 'rlPhdUnitGenParamAssetTag',
# RADLAN-COPY-MIB:rlCopyTable
'dell_cp_idx' => 'rlCopyIndex',
'dell_cp_sloc' => 'rlCopySourceLocation',
'dell_cp_sip' => 'rlCopySourceIpAddress',
'dell_cp_sunit' => 'rlCopySourceUnitNumber',
'dell_cp_sfile' => 'rlCopySourceFileName',
'dell_cp_stype' => 'rlCopySourceFileType',
'dell_cp_dloc' => 'rlCopyDestinationLocation',
'dell_cp_dip' => 'rlCopyDestinationIpAddress',
'dell_cp_dunit' => 'rlCopyDestinationUnitNumber',
'dell_cp_dfile' => 'rlCopyDestinationFileName',
'dell_cp_dtype' => 'rlCopyDestinationFileType',
'dell_cp_state' => 'rlCopyOperationState',
'dell_cp_bkgnd' => 'rlCopyInBackground',
'dell_cp_rstatus' => 'rlCopyRowStatus',
# RADLAN-HWENVIROMENT:rlEnvMonSupplyStatusTable
'dell_pwr_src' => 'rlEnvMonSupplySource',
'dell_pwr_state' => 'rlEnvMonSupplyState',
'dell_pwr_desc' => 'rlEnvMonSupplyStatusDescr',
# RADLAN-HWENVIROMENT:rlEnvMonFanStatusTable
'dell_fan_state' => 'rlEnvMonFanState',
'dell_fan_desc' => 'rlEnvMonFanStatusDescr',
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
# RADLAN-rlInterfaces:swIfTable
'dell_duplex_admin' => 'swIfDuplexAdminMode',
'dell_duplex' => 'swIfDuplexOperMode',
'dell_tag_mode' => 'swIfTaggedMode',
'dell_i_type' => 'swIfType',
'dell_fc_admin' => 'swIfFlowControlMode',
'dell_speed_admin' => 'swIfSpeedAdminMode',
'dell_auto' => 'swIfSpeedDuplexAutoNegotiation',
'dell_fc' => 'swIfOperFlowControlMode',
%MUNGE = (
%SNMP::Info::Layer3::MUNGE,
);
# RADLAN-Physicaldescription-MIB:rlPhdUnitGenParamTable
'dell_unit' => 'rlPhdUnitGenParamStackUnit',
'dell_sw_ver' => 'rlPhdUnitGenParamSoftwareVersion',
'dell_fw_ver' => 'rlPhdUnitGenParamFirmwareVersion',
'dell_hw_ver' => 'rlPhdUnitGenParamHardwareVersion',
'dell_serial_no' => 'rlPhdUnitGenParamSerialNum',
'dell_asset_no' => 'rlPhdUnitGenParamAssetTag',
# RADLAN-COPY-MIB:rlCopyTable
'dell_cp_idx' => 'rlCopyIndex',
'dell_cp_sloc' => 'rlCopySourceLocation',
'dell_cp_sip' => 'rlCopySourceIpAddress',
'dell_cp_sunit' => 'rlCopySourceUnitNumber',
'dell_cp_sfile' => 'rlCopySourceFileName',
'dell_cp_stype' => 'rlCopySourceFileType',
'dell_cp_dloc' => 'rlCopyDestinationLocation',
'dell_cp_dip' => 'rlCopyDestinationIpAddress',
'dell_cp_dunit' => 'rlCopyDestinationUnitNumber',
'dell_cp_dfile' => 'rlCopyDestinationFileName',
'dell_cp_dtype' => 'rlCopyDestinationFileType',
'dell_cp_state' => 'rlCopyOperationState',
'dell_cp_bkgnd' => 'rlCopyInBackground',
'dell_cp_rstatus' => 'rlCopyRowStatus',
# RADLAN-HWENVIROMENT:rlEnvMonSupplyStatusTable
'dell_pwr_src' => 'rlEnvMonSupplySource',
'dell_pwr_state' => 'rlEnvMonSupplyState',
'dell_pwr_desc' => 'rlEnvMonSupplyStatusDescr',
# RADLAN-HWENVIROMENT:rlEnvMonFanStatusTable
'dell_fan_state' => 'rlEnvMonFanState',
'dell_fan_desc' => 'rlEnvMonFanStatusDescr',
);
%MUNGE = ( %SNMP::Info::Layer3::MUNGE, );
# Method OverRides
sub model {
my $dell = shift;
my $name = $dell->dell_id_name();
my $name = $dell->dell_id_name();
my $descr = $dell->description();
if (defined $name and $name =~ m/(\d+)/){
if ( defined $name and $name =~ m/(\d+)/ ) {
return $1;
}
# Don't have a vendor MIB for D-Link
else {
return $descr;
@@ -120,24 +124,24 @@ sub model {
sub vendor {
my $dell = shift;
return $dell->_vendor();
}
sub os {
my $dell = shift;
return $dell->_vendor();
}
sub serial {
my $dell = shift;
my $dell = shift;
my $numbers = $dell->dell_serial_no();
foreach my $key (keys %$numbers){
my $serial = $numbers->{$key};
return $serial if (defined $serial and $serial !~ /^\s*$/);
foreach my $key ( keys %$numbers ) {
my $serial = $numbers->{$key};
return $serial if ( defined $serial and $serial !~ /^\s*$/ );
next;
}
@@ -146,41 +150,41 @@ sub serial {
}
sub interfaces {
my $dell = shift;
my $dell = shift;
my $partial = shift;
my $i_descr = $dell->i_description($partial) || {};
my $i_name = $dell->i_name($partial) || {};
my $i_name = $dell->i_name($partial) || {};
# Descriptions are all the same on some Dells, so use name instead if
# available
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;
}
return $i_descr;
}
sub i_duplex_admin {
my $dell = shift;
my $dell = shift;
my $partial = shift;
my $interfaces = $dell->interfaces($partial) || {};
my $interfaces = $dell->interfaces($partial) || {};
my $dell_duplex = $dell->dell_duplex_admin($partial) || {};
my $dell_auto = $dell->dell_auto($partial) || {};
my $dell_auto = $dell->dell_auto($partial) || {};
my %i_duplex_admin;
foreach my $if (keys %$interfaces){
foreach my $if ( keys %$interfaces ) {
my $duplex = $dell_duplex->{$if};
next unless defined $duplex;
my $auto = $dell_auto->{$if}||'false';
$duplex = 'half' if ($duplex =~ /half/i and $auto =~ /false/i);
$duplex = 'full' if ($duplex =~ /half/i and $auto =~ /false/i);
my $auto = $dell_auto->{$if} || 'false';
$duplex = 'half' if ( $duplex =~ /half/i and $auto =~ /false/i );
$duplex = 'full' if ( $duplex =~ /half/i and $auto =~ /false/i );
$duplex = 'auto' if $auto =~ /true/i;
$i_duplex_admin{$if}=$duplex;
$i_duplex_admin{$if} = $duplex;
}
return \%i_duplex_admin;
}
@@ -192,31 +196,31 @@ sub i_duplex_admin {
# return anything.
sub fw_mac {
my $dell = shift;
my $ret = $dell->qb_fw_mac();
$ret = $dell->orig_fw_mac() if (!defined($ret));
my $ret = $dell->qb_fw_mac();
$ret = $dell->orig_fw_mac() if ( !defined($ret) );
return $ret;
}
sub fw_port {
my $dell = shift;
my $ret = $dell->qb_fw_port();
$ret = $dell->orig_fw_port() if (!defined($ret));
my $ret = $dell->qb_fw_port();
$ret = $dell->orig_fw_port() if ( !defined($ret) );
return $ret;
}
sub _vendor {
my $dell = shift;
my $id = $dell->id() || 'undef';
my $id = $dell->id() || 'undef';
my %oidmap = (
2 => 'ibm',
171 => 'dlink',
674 => 'dell',
3955 => 'linksys',
);
$id = $1 if (defined($id) && $id =~ /^\.1\.3\.6\.1\.4\.1\.(\d+)/);
2 => 'ibm',
171 => 'dlink',
674 => 'dell',
3955 => 'linksys',
);
$id = $1 if ( defined($id) && $id =~ /^\.1\.3\.6\.1\.4\.1\.(\d+)/ );
if (defined($id) and exists($oidmap{$id})) {
if ( defined($id) and exists( $oidmap{$id} ) ) {
return $oidmap{$id};
}
else {
@@ -229,7 +233,8 @@ __END__
=head1 NAME
SNMP::Info::Layer3::Dell - SNMP Interface to Dell Power Connect Network Devices
SNMP::Info::Layer3::Dell - SNMP Interface to Dell Power Connect Network
Devices
=head1 AUTHOR
@@ -304,8 +309,9 @@ These are methods that return scalar value from SNMP
=item $dell->model()
Returns model type. Returns numeric from (C<productIdentificationDisplayName>)
if available, otherwise if returns description().
Returns model type. Returns numeric from
(C<productIdentificationDisplayName>) if available, otherwise if returns
description().
=item $dell->vendor()
@@ -383,13 +389,14 @@ to a hash.
=item $dell->interfaces()
Returns the map between SNMP Interface Identifier (iid) and physical port name.
Uses name if available instead of description since descriptions are
Returns the map between SNMP Interface Identifier (iid) and physical port
name. Uses name if available instead of description since descriptions are
sometimes not unique.
=item $dell->i_duplex_admin()
Returns reference to hash of iid to current link administrative duplex setting.
Returns reference to hash of iid to current link administrative duplex
setting.
=item $dell->fw_mac()

View File

@@ -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
@@ -38,8 +38,8 @@ use SNMP::Info::CDP;
use SNMP::Info::Layer3;
@SNMP::Info::Layer3::Enterasys::ISA = qw/SNMP::Info::MAU SNMP::Info::LLDP
SNMP::Info::CDP SNMP::Info::Layer3
Exporter/;
SNMP::Info::CDP SNMP::Info::Layer3
Exporter/;
@SNMP::Info::Layer3::Enterasys::EXPORT_OK = qw//;
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
@@ -47,44 +47,38 @@ use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::CDP::MIBS,
%SNMP::Info::LLDP::MIBS,
%SNMP::Info::MAU::MIBS,
'ENTERASYS-OIDS-MIB' => 'etsysOidDevice',
);
%SNMP::Info::Layer3::MIBS, %SNMP::Info::CDP::MIBS,
%SNMP::Info::LLDP::MIBS, %SNMP::Info::MAU::MIBS,
'ENTERASYS-OIDS-MIB' => 'etsysOidDevice',
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
%SNMP::Info::LLDP::GLOBALS,
%SNMP::Info::MAU::GLOBALS,
'mac' => 'dot1dBaseBridgeAddress',
);
%SNMP::Info::Layer3::GLOBALS, %SNMP::Info::CDP::GLOBALS,
%SNMP::Info::LLDP::GLOBALS, %SNMP::Info::MAU::GLOBALS,
'mac' => 'dot1dBaseBridgeAddress',
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::CDP::FUNCS,
%SNMP::Info::LLDP::FUNCS,
%SNMP::Info::MAU::FUNCS,
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS, %SNMP::Info::CDP::FUNCS,
%SNMP::Info::LLDP::FUNCS, %SNMP::Info::MAU::FUNCS,
);
%MUNGE = (
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::LLDP::MUNGE,
%SNMP::Info::MAU::MUNGE,
);
%SNMP::Info::Layer3::MUNGE, %SNMP::Info::CDP::MUNGE,
%SNMP::Info::LLDP::MUNGE, %SNMP::Info::MAU::MUNGE,
);
sub model {
my $enterasys = shift;
my $id = $enterasys->id();
unless (defined $id){
print " SNMP::Info::Layer3::Enterasys::model() - Device does not support sysObjectID\n" if $enterasys->debug();
my $id = $enterasys->id();
unless ( defined $id ) {
print
" SNMP::Info::Layer3::Enterasys::model() - Device does not support sysObjectID\n"
if $enterasys->debug();
return;
}
my $model = &SNMP::translateObj($id);
$model =~ s/^etsysOidDev//i;
@@ -104,10 +98,10 @@ sub os {
sub os_ver {
my $enterasys = shift;
my $descr = $enterasys->description();
my $descr = $enterasys->description();
return unless defined $descr;
if ($descr =~ m/\bRev ([\d.]*)/){
if ( $descr =~ m/\bRev ([\d.]*)/ ) {
return $1;
}
@@ -117,23 +111,24 @@ sub os_ver {
# Use ifName as it is used for CDP and LLDP.
sub interfaces {
my $enterasys = shift;
my $partial = shift;
my $partial = shift;
# We need the original ifName, SUPER:: would give us a method definition
# in a higher class, we could use orig_ but just call the MIB leaf since
# that's what we really want anyway.
return $enterasys->ifName($partial) || $enterasys->i_description($partial);
return $enterasys->ifName($partial)
|| $enterasys->i_description($partial);
}
sub i_ignore {
my $enterasys = shift;
my $partial = shift;
my $partial = shift;
my $interfaces = $enterasys->i_type($partial) || {};
my %i_ignore;
foreach my $if (keys %$interfaces) {
if ($interfaces->{$if} =~ /(rs232|tunnel|loopback|\blo\b|null)/i){
foreach my $if ( keys %$interfaces ) {
if ( $interfaces->{$if} =~ /(rs232|tunnel|loopback|\blo\b|null)/i ) {
$i_ignore{$if}++;
}
}
@@ -142,15 +137,15 @@ sub i_ignore {
sub i_duplex {
my $enterasys = shift;
my $partial = shift;
my $partial = shift;
return $enterasys->mau_i_duplex($partial);
}
sub i_duplex_admin {
my $enterasys = shift;
my $partial = shift;
my $partial = shift;
return $enterasys->mau_i_duplex_admin($partial);
}
@@ -158,24 +153,25 @@ sub i_duplex_admin {
# non-increasing oids, Use Q-BRIDGE-MIB for macsuck
sub fw_mac {
my $enterasys = shift;
my $partial = shift;
my $partial = shift;
return $enterasys->qb_fw_mac($partial);
}
sub fw_port {
my $enterasys = shift;
my $partial = shift;
my $partial = shift;
return $enterasys->qb_fw_port($partial);
}
# Use CDP and/or LLDP
#
# LLDP table timefilter implementation continuously increments when walked and
# we may never reach the end of the table. This behavior can be modified with
# the "set snmp timefilter break disable" command, unfortunately it is not
# the default. Query with a partial value of zero which means no time filter.
# LLDP table timefilter implementation continuously increments when walked
# and we may never reach the end of the table. This behavior can be
# modified with the "set snmp timefilter break disable" command,
# unfortunately it is not the default. Query with a partial value of zero
# which means no time filter.
sub hasCDP {
my $enterasys = shift;
@@ -185,20 +181,20 @@ sub hasCDP {
sub c_ip {
my $enterasys = shift;
my $partial = shift;
my $partial = shift;
my $cdp = $enterasys->SUPER::c_ip($partial) || {};
my $lldp = $enterasys->lldp_ip(0) || {};
my $lldp = $enterasys->lldp_ip(0) || {};
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;
@@ -209,20 +205,20 @@ sub c_ip {
sub c_if {
my $enterasys = shift;
my $partial = shift;
my $partial = shift;
my $lldp = $enterasys->lldp_if(0) || {};;
my $lldp = $enterasys->lldp_if(0) || {};
my $cdp = $enterasys->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;
@@ -233,20 +229,20 @@ sub c_if {
sub c_port {
my $enterasys = shift;
my $partial = shift;
my $partial = shift;
my $lldp = $enterasys->lldp_port(0) || {};
my $lldp = $enterasys->lldp_port(0) || {};
my $cdp = $enterasys->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;
@@ -257,20 +253,20 @@ sub c_port {
sub c_id {
my $enterasys = shift;
my $partial = shift;
my $partial = shift;
my $lldp = $enterasys->lldp_id(0) || {};
my $lldp = $enterasys->lldp_id(0) || {};
my $cdp = $enterasys->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;
@@ -281,20 +277,20 @@ sub c_id {
sub c_platform {
my $enterasys = shift;
my $partial = shift;
my $partial = shift;
my $lldp = $enterasys->lldp_rem_sysdesc(0) || {};
my $lldp = $enterasys->lldp_rem_sysdesc(0) || {};
my $cdp = $enterasys->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;
@@ -380,7 +376,8 @@ These are methods that return scalar value from SNMP
=item $enterasys->model()
Returns model type. Checks $enterasys->id() against the F<ENTERASYS-OIDS-MIB>.
Returns model type. Checks $enterasys->id() against the
F<ENTERASYS-OIDS-MIB>.
=item $enterasys->vendor()

View File

@@ -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
@@ -37,74 +37,83 @@ use Exporter;
use SNMP::Info::Layer3;
use SNMP::Info::MAU;
@SNMP::Info::Layer3::Extreme::ISA = qw/SNMP::Info::Layer3 SNMP::Info::MAU Exporter/;
@SNMP::Info::Layer3::Extreme::ISA
= qw/SNMP::Info::Layer3 SNMP::Info::MAU Exporter/;
@SNMP::Info::Layer3::Extreme::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = ( %SNMP::Info::Layer3::MIBS,
%SNMP::Info::MAU::MIBS,
'EXTREME-BASE-MIB' => 'extremeAgent',
'EXTREME-SYSTEM-MIB' => 'extremeSystem',
'EXTREME-FDB-MIB' => 'extremeSystem',
'EXTREME-VLAN-MIB' => 'extremeVlan',
);
%MIBS = (
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::MAU::MIBS,
'EXTREME-BASE-MIB' => 'extremeAgent',
'EXTREME-SYSTEM-MIB' => 'extremeSystem',
'EXTREME-FDB-MIB' => 'extremeSystem',
'EXTREME-VLAN-MIB' => 'extremeVlan',
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::MAU::GLOBALS,
'serial1' => 'extremeSystemID.0',
'temp' => 'extremeCurrentTemperature',
'ps1_status_old' => 'extremePrimaryPowerOperational.0',
'ps1_status_new' => 'extremePowerSupplyStatus.1',
'ps2_status_old' => 'extremeRedundantPowerStatus.0',
'ps2_status_new' => 'extremePowerSupplyStatus.2',
'mac' => 'dot1dBaseBridgeAddress',
);
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::MAU::GLOBALS,
'serial1' => 'extremeSystemID.0',
'temp' => 'extremeCurrentTemperature',
'ps1_status_old' => 'extremePrimaryPowerOperational.0',
'ps1_status_new' => 'extremePowerSupplyStatus.1',
'ps2_status_old' => 'extremeRedundantPowerStatus.0',
'ps2_status_new' => 'extremePowerSupplyStatus.2',
'mac' => 'dot1dBaseBridgeAddress',
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::MAU::FUNCS,
'fan_state' => 'extremeFanOperational',
# EXTREME-FDB-MIB:extremeFdbMacFdbTable
'ex_fw_mac' => 'extremeFdbMacFdbMacAddress',
'ex_fw_port' => 'extremeFdbMacFdbPortIfIndex',
'ex_fw_status' => 'extremeFdbMacFdbStatus',
# EXTREME-VLAN-MIB:extremeVlanIfTable
'ex_vlan_descr' => 'extremeVlanIfDescr',
'ex_vlan_global_id' => 'extremeVlanIfGlobalIdentifier',
# EXTREME-VLAN-MIB:extremeVlanEncapsIfTable
'ex_vlan_encap_tag' => 'extremeVlanEncapsIfTag',
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::MAU::FUNCS,
'fan_state' => 'extremeFanOperational',
# EXTREME-FDB-MIB:extremeFdbMacFdbTable
'ex_fw_mac' => 'extremeFdbMacFdbMacAddress',
'ex_fw_port' => 'extremeFdbMacFdbPortIfIndex',
'ex_fw_status' => 'extremeFdbMacFdbStatus',
# EXTREME-VLAN-MIB:extremeVlanIfTable
'ex_vlan_descr' => 'extremeVlanIfDescr',
'ex_vlan_global_id' => 'extremeVlanIfGlobalIdentifier',
# EXTREME-VLAN-MIB:extremeVlanEncapsIfTable
'ex_vlan_encap_tag' => 'extremeVlanEncapsIfTag',
);
%MUNGE = (
# Inherit all the built in munging
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::MAU::MUNGE,
'ex_fw_mac' => \&SNMP::Info::munge_mac,
'ps1_status_old' => \&munge_true_ok,
'ps1_status_new' => \&munge_power_stat,
'ps2_status_old' => \&munge_power_stat,
'ps2_status_new' => \&munge_power_stat,
'fan_state' => \&munge_true_ok,
);
# Inherit all the built in munging
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::MAU::MUNGE,
'ex_fw_mac' => \&SNMP::Info::munge_mac,
'ps1_status_old' => \&munge_true_ok,
'ps1_status_new' => \&munge_power_stat,
'ps2_status_old' => \&munge_power_stat,
'ps2_status_new' => \&munge_power_stat,
'fan_state' => \&munge_true_ok,
);
# Method OverRides
*SNMP::Info::Layer3::Extreme::i_duplex = \&SNMP::Info::MAU::mau_i_duplex;
*SNMP::Info::Layer3::Extreme::i_duplex_admin = \&SNMP::Info::MAU::mau_i_duplex_admin;
*SNMP::Info::Layer3::Extreme::i_duplex = \&SNMP::Info::MAU::mau_i_duplex;
*SNMP::Info::Layer3::Extreme::i_duplex_admin
= \&SNMP::Info::MAU::mau_i_duplex_admin;
sub model {
my $extreme = shift;
my $id = $extreme->id();
unless (defined $id){
print " SNMP::Info::Layer3::Extreme::model() - Device does not support sysObjectID\n" if $extreme->debug();
my $id = $extreme->id();
unless ( defined $id ) {
print
" SNMP::Info::Layer3::Extreme::model() - Device does not support sysObjectID\n"
if $extreme->debug();
return;
}
my $model = &SNMP::translateObj($id);
return $id unless defined $model;
@@ -122,10 +131,10 @@ sub os {
sub os_ver {
my $extreme = shift;
my $descr = $extreme->description();
my $descr = $extreme->description();
return unless defined $descr;
if ($descr =~ m/Version ([\d.]*)/){
if ( $descr =~ m/Version ([\d.]*)/ ) {
return $1;
}
@@ -139,15 +148,16 @@ sub os_ver {
# assigned for router interfaces, so we use ifDescr
# for those.
sub interfaces {
my $extreme = shift;
my $partial = shift;
my $i_name = $extreme->orig_i_name($partial);
my $extreme = shift;
my $partial = shift;
my $i_name = $extreme->orig_i_name($partial);
my $i_description = $extreme->orig_i_description($partial);
my $interfaces = {};
foreach my $idx (keys %$i_name) {
if ($i_name->{$idx} =~ /\([0-9.]+\)/) {
my $interfaces = {};
foreach my $idx ( keys %$i_name ) {
if ( $i_name->{$idx} =~ /\([0-9.]+\)/ ) {
$interfaces->{$idx} = $i_description->{$idx};
} else {
}
else {
$interfaces->{$idx} = $i_name->{$idx};
}
}
@@ -159,12 +169,14 @@ sub interfaces {
sub i_ignore {
my $extreme = shift;
my $partial = shift;
my $i_description = $extreme->i_description($partial) || {};
my %i_ignore;
foreach my $if (keys %$i_description) {
if ($i_description->{$if} =~ /^(802.1Q Encapsulation Tag \d+|VLAN \d+|lo\d+)/i){
foreach my $if ( keys %$i_description ) {
if ( $i_description->{$if}
=~ /^(802.1Q Encapsulation Tag \d+|VLAN \d+|lo\d+)/i )
{
$i_ignore{$if}++;
}
}
@@ -175,11 +187,11 @@ sub i_ignore {
# Either way, Extreme uses a 1:1 mapping of bridge interface ID to
# ifIndex.
sub bp_index {
my $extreme = shift;
my $extreme = shift;
my $if_index = $extreme->i_index();
my %bp_index;
foreach my $iid (keys %$if_index){
foreach my $iid ( keys %$if_index ) {
$bp_index{$iid} = $iid;
}
return \%bp_index;
@@ -188,8 +200,8 @@ sub bp_index {
sub munge_true_ok {
my $val = shift;
return unless defined($val);
return "OK" if ($val eq 'true');
return "Not OK" if ($val eq 'false');
return "OK" if ( $val eq 'true' );
return "Not OK" if ( $val eq 'false' );
return $val;
}
@@ -202,27 +214,27 @@ sub munge_power_stat {
}
sub ps1_status {
my $extreme = shift;
my $extreme = shift;
my $ps1_status = $extreme->ps1_status_new();
return $ps1_status || $extreme->ps1_status_old();
}
sub ps2_status {
my $extreme = shift;
my $extreme = shift;
my $ps2_status = $extreme->ps2_status_new();
return $ps2_status || $extreme->ps2_status_old();
}
sub fan {
my $extreme = shift;
my $extreme = shift;
my $fan_state = $extreme->fan_state();
my $ret = "";
my $s = "";
foreach my $i (sort {$a <=> $b} keys %$fan_state) {
my $ret = "";
my $s = "";
foreach my $i ( sort { $a <=> $b } keys %$fan_state ) {
$ret .= $s . $i . ": " . $fan_state->{$i};
$s = ", ";
}
return if ($s eq "");
return if ( $s eq "" );
return $ret;
}
@@ -231,7 +243,7 @@ sub fan {
# these tables, so we use the BRIDGE-MIB tables.
sub fw_mac {
my $extreme = shift;
my $fw_mac = $extreme->ex_fw_mac;
my $fw_mac = $extreme->ex_fw_mac;
return $fw_mac if defined($fw_mac);
return $extreme->orig_fw_mac();
}
@@ -244,7 +256,7 @@ sub fw_port {
}
sub fw_status {
my $extreme = shift;
my $extreme = shift;
my $fw_status = $extreme->ex_fw_status;
return $fw_status if defined($fw_status);
return $extreme->orig_fw_status();
@@ -260,35 +272,38 @@ sub fw_status {
# To represent this, we use a negative version of the
# internal VLAN ID (the deprecated extremeVlanIfGlobalIdentifier)
sub _if2tag {
my $extreme = shift;
my $partial = shift;
my $stack = shift || $extreme->ifStackStatus($partial);
my $encap_tag = $extreme->ex_vlan_encap_tag();
my $extreme = shift;
my $partial = shift;
my $stack = shift || $extreme->ifStackStatus($partial);
my $encap_tag = $extreme->ex_vlan_encap_tag();
my $vlan_descr = $extreme->ex_vlan_descr();
my $stackmap = {};
foreach my $idx (keys %$stack) {
my ($higher, $lower) = split(/\./, $idx);
foreach my $idx ( keys %$stack ) {
my ( $higher, $lower ) = split( /\./, $idx );
$stackmap->{$higher}->{$lower} = $stack->{$idx};
}
my %if2tag = ();
my $missed = 0;
foreach my $if (keys %$vlan_descr) {
foreach my $if ( keys %$vlan_descr ) {
$if2tag{$if} = -1;
foreach my $tagif (keys %$encap_tag) {
if (defined($stackmap->{$if}->{$tagif}) && $stackmap->{$if}->{$tagif} eq 'active') {
foreach my $tagif ( keys %$encap_tag ) {
if ( defined( $stackmap->{$if}->{$tagif} )
&& $stackmap->{$if}->{$tagif} eq 'active' )
{
$if2tag{$if} = $encap_tag->{$tagif};
}
}
if ($if2tag{$if} == -1) {
if ( $if2tag{$if} == -1 ) {
$missed++;
}
}
if ($missed) {
my $global_id = $extreme->ex_vlan_global_id();
foreach my $if (keys %if2tag) {
$if2tag{$if} = -$global_id->{$if} if ($if2tag{$if} == -1 && defined($global_id->{$if}));
foreach my $if ( keys %if2tag ) {
$if2tag{$if} = -$global_id->{$if}
if ( $if2tag{$if} == -1 && defined( $global_id->{$if} ) );
}
}
return \%if2tag;
@@ -308,23 +323,24 @@ sub v_index {
}
sub i_vlan {
my $extreme = shift;
my $partial = shift;
my $stack = $extreme->ifStackStatus($partial);
my $encap_tag = $extreme->ex_vlan_encap_tag();
my $extreme = shift;
my $partial = shift;
my $stack = $extreme->ifStackStatus($partial);
my $encap_tag = $extreme->ex_vlan_encap_tag();
my $vlan_descr = $extreme->ex_vlan_descr();
my $stackmap = {};
foreach my $idx (keys %$stack) {
my ($higher, $lower) = split(/\./, $idx);
my $stackmap = {};
foreach my $idx ( keys %$stack ) {
my ( $higher, $lower ) = split( /\./, $idx );
$stackmap->{$higher}->{$lower} = $stack->{$idx};
}
my $if2tag = $extreme->_if2tag($partial, $stack);
my $if2tag = $extreme->_if2tag( $partial, $stack );
#
# Now that we've done all that mapping work, we can map the
# ifStack indexes.
my %i_vlan = ();
foreach my $if (keys %$if2tag) {
foreach my $lowif (keys %{$stackmap->{$if}}) {
foreach my $if ( keys %$if2tag ) {
foreach my $lowif ( keys %{ $stackmap->{$if} } ) {
$i_vlan{$lowif} = $if2tag->{$if};
}
}
@@ -332,31 +348,33 @@ sub i_vlan {
}
sub i_vlan_membership {
my $extreme = shift;
my $partial = shift;
my $stack = $extreme->ifStackStatus($partial);
my $encap_tag = $extreme->ex_vlan_encap_tag();
my $extreme = shift;
my $partial = shift;
my $stack = $extreme->ifStackStatus($partial);
my $encap_tag = $extreme->ex_vlan_encap_tag();
my $vlan_descr = $extreme->ex_vlan_descr();
my $stackmap = {};
foreach my $idx (keys %$stack) {
my ($higher, $lower) = split(/\./, $idx);
my $stackmap = {};
foreach my $idx ( keys %$stack ) {
my ( $higher, $lower ) = split( /\./, $idx );
$stackmap->{$higher}->{$lower} = $stack->{$idx};
}
my $if2tag = $extreme->_if2tag($partial, $stack);
my $if2tag = $extreme->_if2tag( $partial, $stack );
#
# Now that we've done all that mapping work, we can map the
# ifStack indexes.
my %i_vlan_membership = ();
foreach my $if (keys %$if2tag) {
foreach my $lowif (keys %{$stackmap->{$if}}) {
push(@{$i_vlan_membership{$lowif}}, $if2tag->{$if});
foreach my $if ( keys %$if2tag ) {
foreach my $lowif ( keys %{ $stackmap->{$if} } ) {
push( @{ $i_vlan_membership{$lowif} }, $if2tag->{$if} );
}
}
#
# Now add all the tagged ports.
foreach my $if (keys %$encap_tag) {
foreach my $lowif (keys %{$stackmap->{$if}}) {
push(@{$i_vlan_membership{$lowif}}, $encap_tag->{$if});
foreach my $if ( keys %$encap_tag ) {
foreach my $lowif ( keys %{ $stackmap->{$if} } ) {
push( @{ $i_vlan_membership{$lowif} }, $encap_tag->{$if} );
}
}
return \%i_vlan_membership;
@@ -368,12 +386,12 @@ sub i_vlan_membership {
sub set_i_vlan {
my $extreme = shift;
return $extreme->_extreme_set_i_vlan(0, @_);
return $extreme->_extreme_set_i_vlan( 0, @_ );
}
sub set_i_pvid {
my $extreme = shift;
return $extreme->_extreme_set_i_vlan(1, @_);
return $extreme->_extreme_set_i_vlan( 1, @_ );
}
# set_i_vlan implicitly turns off any encapsulation
@@ -384,98 +402,127 @@ sub set_i_pvid {
# off any encapsulation.
sub _extreme_set_i_vlan {
my $extreme = shift;
my ($is_pvid, $vlan_id, $ifindex) = @_;
my ( $is_pvid, $vlan_id, $ifindex ) = @_;
my $encap_tag = $extreme->ex_vlan_encap_tag();
# The inverted stack MIB would make this easier, since
# we need to find the vlan interface
# that's stacked above $ifindex.
my $cur_stack = $extreme->ifStackStatus();
#
# create inverted stack
my $invstack;
foreach my $idx (keys %$cur_stack) {
my ($higher, $lower) = split(/\./, $idx);
foreach my $idx ( keys %$cur_stack ) {
my ( $higher, $lower ) = split( /\./, $idx );
$invstack->{$lower}->{$higher} = $cur_stack->{$idx};
}
# create vlan tag -> encap interface map
my %encapif = reverse %$encap_tag;
# now find encap interface from tag
my $encapidx = $encapif{$vlan_id};
if (!defined($encapidx)) {
$extreme->error_throw("can't map $vlan_id to encapsulation interface");
if ( !defined($encapidx) ) {
$extreme->error_throw(
"can't map $vlan_id to encapsulation interface");
return;
}
# now find vlan interface stacked above encap
my @abovevlan = keys %{$invstack->{$encapidx}};
if (@abovevlan != 1) {
$extreme->error_throw("can't map encap interface $encapidx for $vlan_id to encapsulation interface");
my @abovevlan = keys %{ $invstack->{$encapidx} };
if ( @abovevlan != 1 ) {
$extreme->error_throw(
"can't map encap interface $encapidx for $vlan_id to encapsulation interface"
);
return;
}
my $vlanidx = $abovevlan[0];
my $rv;
# Delete old VLAN mapping
foreach my $oldidx (keys %{$invstack->{$ifindex}}) {
if ($is_pvid && defined($encap_tag->{$oldidx})) {
next; # Don't delete tagged mappings
foreach my $oldidx ( keys %{ $invstack->{$ifindex} } ) {
if ( $is_pvid && defined( $encap_tag->{$oldidx} ) ) {
next; # Don't delete tagged mappings
}
$rv = $extreme->set_ifStackStatus("destroy", $oldidx . "." . $ifindex);
$rv = $extreme->set_ifStackStatus( "destroy",
$oldidx . "." . $ifindex );
unless ($rv) {
$extreme->error_throw("Unable to remove $ifindex from old VLAN index $oldidx");
$extreme->error_throw(
"Unable to remove $ifindex from old VLAN index $oldidx");
return;
}
}
# Add new VLAN mapping
$rv = $extreme->set_ifStackStatus("createAndGo", $vlanidx . "." . $ifindex);
$rv = $extreme->set_ifStackStatus( "createAndGo",
$vlanidx . "." . $ifindex );
unless ($rv) {
$extreme->error_throw("Unable to add new VLAN index $vlanidx to ifIndex $ifindex");
$extreme->error_throw(
"Unable to add new VLAN index $vlanidx to ifIndex $ifindex");
return;
}
# XXX invalidate cache of ifstack?
# XXX Info.pm library function for this?
# XXX set_ should do invalidation?
# $store = $extreme->store(); delete $store->{ifStackStatus}; $extreme->store($store);
# $extreme->{_ifStackStatus} = 0;
# XXX invalidate cache of ifstack?
# XXX Info.pm library function for this?
# XXX set_ should do invalidation?
# $store = $extreme->store(); delete $store->{ifStackStatus}; $extreme->store($store);
# $extreme->{_ifStackStatus} = 0;
return $rv;
}
sub set_remove_i_vlan_tagged {
my $extreme = shift;
my ($vlan_id, $ifindex) = @_;
my ( $vlan_id, $ifindex ) = @_;
my $encap_tag = $extreme->ex_vlan_encap_tag();
# create vlan tag -> encap interface map
my %encapif = reverse %$encap_tag;
# now find encap interface from tag
my $encapidx = $encapif{$vlan_id};
if (!defined($encapidx)) {
$extreme->error_throw("can't map $vlan_id to encapsulation interface");
if ( !defined($encapidx) ) {
$extreme->error_throw(
"can't map $vlan_id to encapsulation interface");
return;
}
my $rv = $extreme->set_ifStackStatus("destroy", $encapidx . "." . $ifindex);
my $rv = $extreme->set_ifStackStatus( "destroy",
$encapidx . "." . $ifindex );
unless ($rv) {
$extreme->error_throw("Unable to delete VLAN encap ifIndex $encapidx for VLAN $vlan_id from ifIndex $ifindex");
$extreme->error_throw(
"Unable to delete VLAN encap ifIndex $encapidx for VLAN $vlan_id from ifIndex $ifindex"
);
return;
}
# invalidate cache of ifstack?
return $rv;
}
sub set_add_i_vlan_tagged {
my $extreme = shift;
my ($vlan_id, $ifindex) = @_;
my ( $vlan_id, $ifindex ) = @_;
my $encap_tag = $extreme->ex_vlan_encap_tag();
# create vlan tag -> encap interface map
my %encapif = reverse %$encap_tag;
# now find encap interface from tag
my $encapidx = $encapif{$vlan_id};
if (!defined($encapidx)) {
$extreme->error_throw("can't map $vlan_id to encapsulation interface");
if ( !defined($encapidx) ) {
$extreme->error_throw(
"can't map $vlan_id to encapsulation interface");
return;
}
my $rv = $extreme->set_ifStackStatus("createAndGo", $encapidx . "." . $ifindex);
my $rv = $extreme->set_ifStackStatus( "createAndGo",
$encapidx . "." . $ifindex );
unless ($rv) {
$extreme->error_throw("Unable to add VLAN encap ifIndex $encapidx for VLAN $vlan_id to ifIndex $ifindex");
$extreme->error_throw(
"Unable to add VLAN encap ifIndex $encapidx for VLAN $vlan_id to ifIndex $ifindex"
);
return;
}
# invalidate cache of ifstack?
return $rv;
}
@@ -698,8 +745,8 @@ Returns VLAN names
Returns reference to hash of bridge port table entries map back to interface
identifier (iid)
Returns (C<ifIndex>) for both key and value since we're using F<EXTREME-FDB-MIB>
rather than F<BRIDGE-MIB>.
Returns (C<ifIndex>) for both key and value since we're using
F<EXTREME-FDB-MIB> rather than F<BRIDGE-MIB>.
=back

View File

@@ -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,51 +39,52 @@ use SNMP::Info::FDP;
use SNMP::Info::LLDP;
@SNMP::Info::Layer3::Foundry::ISA = qw/SNMP::Info::FDP SNMP::Info::LLDP
SNMP::Info::Layer3 Exporter/;
SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::Foundry::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = ( %SNMP::Info::Layer3::MIBS,
%SNMP::Info::LLDP::MIBS,
%SNMP::Info::FDP::MIBS,
'FOUNDRY-SN-ROOT-MIB' => 'foundry',
'FOUNDRY-SN-AGENT-MIB' => 'snChasPwrSupplyDescription',
'FOUNDRY-SN-SWITCH-GROUP-MIB' => 'snSwGroupOperMode',
);
%MIBS = (
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::LLDP::MIBS,
%SNMP::Info::FDP::MIBS,
'FOUNDRY-SN-ROOT-MIB' => 'foundry',
'FOUNDRY-SN-AGENT-MIB' => 'snChasPwrSupplyDescription',
'FOUNDRY-SN-SWITCH-GROUP-MIB' => 'snSwGroupOperMode',
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::LLDP::GLOBALS,
%SNMP::Info::FDP::GLOBALS,
'mac' => 'ifPhysAddress.1',
'chassis' => 'entPhysicalDescr.1',
'temp' => 'snChasActualTemperature',
'ps1_type' => 'snChasPwrSupplyDescription.1',
'ps1_status' => 'snChasPwrSupplyOperStatus.1',
'fan' => 'snChasFanOperStatus.1',
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::LLDP::GLOBALS,
%SNMP::Info::FDP::GLOBALS,
'mac' => 'ifPhysAddress.1',
'chassis' => 'entPhysicalDescr.1',
'temp' => 'snChasActualTemperature',
'ps1_type' => 'snChasPwrSupplyDescription.1',
'ps1_status' => 'snChasPwrSupplyOperStatus.1',
'fan' => 'snChasFanOperStatus.1',
);
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::LLDP::FUNCS,
%SNMP::Info::FDP::FUNCS,
# FOUNDRY-SN-SWITCH-GROUP-MIB
# snSwPortInfoTable - Switch Port Information Group
'sw_index' => 'snSwPortIfIndex',
'sw_duplex' => 'snSwPortInfoChnMode',
'sw_type' => 'snSwPortInfoMediaType',
'sw_speed' => 'snSwPortInfoSpeed',
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::LLDP::FUNCS,
%SNMP::Info::FDP::FUNCS,
# FOUNDRY-SN-SWITCH-GROUP-MIB
# snSwPortInfoTable - Switch Port Information Group
'sw_index' => 'snSwPortIfIndex',
'sw_duplex' => 'snSwPortInfoChnMode',
'sw_type' => 'snSwPortInfoMediaType',
'sw_speed' => 'snSwPortInfoSpeed',
);
%MUNGE = (
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::LLDP::MUNGE,
%SNMP::Info::FDP::MUNGE,
);
%SNMP::Info::Layer3::MUNGE, %SNMP::Info::LLDP::MUNGE,
%SNMP::Info::FDP::MUNGE,
);
sub i_ignore {
my $foundry = shift;
@@ -92,8 +93,8 @@ sub i_ignore {
my $interfaces = $foundry->interfaces($partial) || {};
my %i_ignore;
foreach my $if (keys %$interfaces) {
if ($interfaces->{$if} =~ /(tunnel|loopback|\blo\b|lb|null)/i){
foreach my $if ( keys %$interfaces ) {
if ( $interfaces->{$if} =~ /(tunnel|loopback|\blo\b|lb|null)/i ) {
$i_ignore{$if}++;
}
}
@@ -104,16 +105,16 @@ sub i_duplex {
my $foundry = shift;
my $partial = shift;
my $sw_index = $foundry->sw_index($partial);
my $sw_duplex= $foundry->sw_duplex($partial);
my $sw_index = $foundry->sw_index($partial);
my $sw_duplex = $foundry->sw_duplex($partial);
unless (defined $sw_index and defined $sw_duplex){
return $foundry->SUPER::i_duplex();
unless ( defined $sw_index and defined $sw_duplex ) {
return $foundry->SUPER::i_duplex();
}
my %i_duplex;
foreach my $sw_port (keys %$sw_duplex){
my $iid = $sw_index->{$sw_port};
foreach my $sw_port ( keys %$sw_duplex ) {
my $iid = $sw_index->{$sw_port};
my $duplex = $sw_duplex->{$sw_port};
next if $duplex =~ /none/i;
$i_duplex{$iid} = 'half' if $duplex =~ /half/i;
@@ -124,36 +125,36 @@ sub i_duplex {
sub model {
my $foundry = shift;
my $id = $foundry->id();
my $model = &SNMP::translateObj($id);
my $id = $foundry->id();
my $model = &SNMP::translateObj($id);
# EdgeIron
if ($id =~ /\.1991\.1\.[45]\./) {
if ( $id =~ /\.1991\.1\.[45]\./ ) {
my $e_name = $foundry->e_name();
# 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';
}
# 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};
}
}
return $id unless defined $model;
$model =~ s/^sn//;
return $model;
}
sub os {
sub os {
return 'foundry';
}
@@ -168,7 +169,7 @@ sub os_ver {
# Some older ones don't have this value,so we cull it from the description
my $descr = $foundry->description();
if ($descr =~ m/Version (\d\S*)/) {
if ( $descr =~ m/Version (\d\S*)/ ) {
return $1;
}
@@ -177,16 +178,16 @@ 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';
}
if (defined $unit_iid){
if ( defined $unit_iid ) {
# 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};
}
}
@@ -205,7 +206,7 @@ sub serial {
# If no chassis serial use first module serial
my $mod_serials = $foundry->snAgentConfigModuleSerialNumber();
foreach my $mod (sort keys %$mod_serials){
foreach my $mod ( sort keys %$mod_serials ) {
my $serial = $mod_serials->{$mod} || '';
next unless defined $serial;
return $serial;
@@ -216,12 +217,13 @@ 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';
}
if (defined $unit_iid) {
if ( defined $unit_iid ) {
# Look up serial of found entry.
my $e_serial = $foundry->e_serial();
return $e_serial->{$unit_iid} if defined $e_serial->{$unit_iid};
@@ -236,26 +238,26 @@ sub interfaces {
my $partial = shift;
my $i_descr = $foundry->i_description($partial) || {};
my $i_name = $foundry->i_name($partial) || {};
my $i_name = $foundry->i_name($partial) || {};
# Use ifName 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;
}
return $i_descr;
}
# Reported hangs on a EdgeIron 24G
sub stp_p_state {
my $foundry = shift;
my $foundry = shift;
my $partial = shift;
my $descr = $foundry->description();
if ($descr =~ m/\bEdgeIron 24G\b/) {
if ( $descr =~ m/\bEdgeIron 24G\b/ ) {
return;
}
@@ -276,17 +278,17 @@ sub c_ip {
my $partial = shift;
my $cdp = $foundry->SUPER::c_ip($partial) || {};
my $lldp = $foundry->lldp_ip($partial) || {};
my $lldp = $foundry->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;
@@ -299,18 +301,18 @@ sub c_if {
my $foundry = shift;
my $partial = shift;
my $lldp = $foundry->lldp_if($partial) || {};;
my $lldp = $foundry->lldp_if($partial) || {};
my $cdp = $foundry->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;
@@ -323,18 +325,18 @@ sub c_port {
my $foundry = shift;
my $partial = shift;
my $lldp = $foundry->lldp_port($partial) || {};
my $lldp = $foundry->lldp_port($partial) || {};
my $cdp = $foundry->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;
@@ -347,18 +349,18 @@ sub c_id {
my $foundry = shift;
my $partial = shift;
my $lldp = $foundry->lldp_id($partial) || {};
my $lldp = $foundry->lldp_id($partial) || {};
my $cdp = $foundry->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;
@@ -371,18 +373,18 @@ sub c_platform {
my $foundry = shift;
my $partial = shift;
my $lldp = $foundry->lldp_rem_sysdesc($partial) || {};
my $lldp = $foundry->lldp_rem_sysdesc($partial) || {};
my $cdp = $foundry->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;
@@ -629,9 +631,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-FDP/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-FDP/LLDP device in between two
or more devices or multiple devices which are not directly connected.
Use the data from the Layer2 Topology Table below to dig deeper.

View File

@@ -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,63 +37,64 @@ use SNMP::Info::FDP;
use SNMP::Info::LLDP;
@SNMP::Info::Layer3::HP9300::ISA = qw/SNMP::Info::FDP SNMP::Info::LLDP
SNMP::Info::Layer3 Exporter/;
SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::HP9300::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = ( %SNMP::Info::Layer3::MIBS,
%SNMP::Info::LLDP::MIBS,
%SNMP::Info::FDP::MIBS,
'HP-SN-ROOT-MIB' => 'hp',
'HP-SN-AGENT-MIB' => 'snChasPwrSupplyDescription',
'HP-SN-SWITCH-GROUP-MIB' => 'snSwGroupOperMode',
);
%MIBS = (
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::LLDP::MIBS,
%SNMP::Info::FDP::MIBS,
'HP-SN-ROOT-MIB' => 'hp',
'HP-SN-AGENT-MIB' => 'snChasPwrSupplyDescription',
'HP-SN-SWITCH-GROUP-MIB' => 'snSwGroupOperMode',
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::LLDP::GLOBALS,
%SNMP::Info::FDP::GLOBALS,
'mac' => 'ifPhysAddress.1',
'chassis' => 'entPhysicalDescr.1',
'temp' => 'snChasActualTemperature',
'ps1_type' => 'snChasPwrSupplyDescription.1',
'ps1_status' => 'snChasPwrSupplyOperStatus.1',
'fan' => 'snChasFanOperStatus.1',
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::LLDP::GLOBALS,
%SNMP::Info::FDP::GLOBALS,
'mac' => 'ifPhysAddress.1',
'chassis' => 'entPhysicalDescr.1',
'temp' => 'snChasActualTemperature',
'ps1_type' => 'snChasPwrSupplyDescription.1',
'ps1_status' => 'snChasPwrSupplyOperStatus.1',
'fan' => 'snChasFanOperStatus.1',
);
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::LLDP::FUNCS,
%SNMP::Info::FDP::FUNCS,
# HP-SN-SWITCH-GROUP-MIB
# snSwPortInfoTable - Switch Port Information Group
# Fully qualify these since FDP class will load
# FOUNDRY-SN-SWITCH-GROUP-MIB which contains the same leaf names
'sw_index' => 'HP_SN_SWITCH_GROUP_MIB__snSwPortIfIndex',
'sw_duplex' => 'HP_SN_SWITCH_GROUP_MIB__snSwPortInfoChnMode',
'sw_type' => 'HP_SN_SWITCH_GROUP_MIB__snSwPortInfoMediaType',
'sw_speed' => 'HP_SN_SWITCH_GROUP_MIB__snSwPortInfoSpeed',
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::LLDP::FUNCS,
%SNMP::Info::FDP::FUNCS,
# HP-SN-SWITCH-GROUP-MIB
# snSwPortInfoTable - Switch Port Information Group
# Fully qualify these since FDP class will load
# FOUNDRY-SN-SWITCH-GROUP-MIB which contains the same leaf names
'sw_index' => 'HP_SN_SWITCH_GROUP_MIB__snSwPortIfIndex',
'sw_duplex' => 'HP_SN_SWITCH_GROUP_MIB__snSwPortInfoChnMode',
'sw_type' => 'HP_SN_SWITCH_GROUP_MIB__snSwPortInfoMediaType',
'sw_speed' => 'HP_SN_SWITCH_GROUP_MIB__snSwPortInfoSpeed',
);
%MUNGE = (
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::LLDP::MUNGE,
%SNMP::Info::FDP::MUNGE,
);
%SNMP::Info::Layer3::MUNGE, %SNMP::Info::LLDP::MUNGE,
%SNMP::Info::FDP::MUNGE,
);
sub i_ignore {
my $hp9300 = shift;
my $hp9300 = shift;
my $partial = shift;
my $interfaces = $hp9300->interfaces($partial) || {};
my %i_ignore;
foreach my $if (keys %$interfaces) {
if ($interfaces->{$if} =~ /(tunnel|loopback|\blo\b|lb|null)/i){
foreach my $if ( keys %$interfaces ) {
if ( $interfaces->{$if} =~ /(tunnel|loopback|\blo\b|lb|null)/i ) {
$i_ignore{$if}++;
}
}
@@ -101,19 +102,19 @@ sub i_ignore {
}
sub i_duplex {
my $hp9300 = shift;
my $hp9300 = shift;
my $partial = shift;
my $sw_index = $hp9300->sw_index($partial);
my $sw_duplex= $hp9300->sw_duplex($partial);
my $sw_index = $hp9300->sw_index($partial);
my $sw_duplex = $hp9300->sw_duplex($partial);
unless (defined $sw_index and defined $sw_duplex){
return $hp9300->SUPER::i_duplex();
unless ( defined $sw_index and defined $sw_duplex ) {
return $hp9300->SUPER::i_duplex();
}
my %i_duplex;
foreach my $sw_port (keys %$sw_duplex){
my $iid = $sw_index->{$sw_port};
foreach my $sw_port ( keys %$sw_duplex ) {
my $iid = $sw_index->{$sw_port};
my $duplex = $sw_duplex->{$sw_port};
next if $duplex =~ /none/i;
$i_duplex{$iid} = 'half' if $duplex =~ /half/i;
@@ -124,17 +125,17 @@ sub i_duplex {
sub model {
my $hp9300 = shift;
my $id = $hp9300->id();
my $model = &SNMP::translateObj($id);
my $id = $hp9300->id();
my $model = &SNMP::translateObj($id);
return $id unless defined $model;
$model =~ s/^hpSwitch//;
return $model;
}
sub os {
sub os {
return 'hp';
}
@@ -149,7 +150,7 @@ sub os_ver {
# Some older ones don't have this value,so we cull it from the description
my $descr = $hp9300->description();
if ($descr =~ m/Version (\d\S*)/) {
if ( $descr =~ m/Version (\d\S*)/ ) {
return $1;
}
@@ -167,7 +168,7 @@ sub serial {
# If no chassis serial use first module serial
my $mod_serials = $hp9300->snAgentConfigModuleSerialNumber();
foreach my $mod (sort keys %$mod_serials){
foreach my $mod ( sort keys %$mod_serials ) {
my $serial = $mod_serials->{$mod} || '';
next unless defined $serial;
return $serial;
@@ -178,20 +179,20 @@ sub serial {
}
sub interfaces {
my $hp9300 = shift;
my $hp9300 = shift;
my $partial = shift;
my $i_descr = $hp9300->i_description($partial) || {};
my $i_name = $hp9300->i_name($partial) || {};
my $i_name = $hp9300->i_name($partial) || {};
# Use ifName 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;
}
return $i_descr;
}
@@ -204,21 +205,21 @@ sub hasCDP {
}
sub c_ip {
my $hp9300 = shift;
my $hp9300 = shift;
my $partial = shift;
my $cdp = $hp9300->SUPER::c_ip($partial) || {};
my $lldp = $hp9300->lldp_ip($partial) || {};
my $lldp = $hp9300->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;
@@ -228,21 +229,21 @@ sub c_ip {
}
sub c_if {
my $hp9300 = shift;
my $hp9300 = shift;
my $partial = shift;
my $lldp = $hp9300->lldp_if($partial) || {};;
my $lldp = $hp9300->lldp_if($partial) || {};
my $cdp = $hp9300->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;
@@ -252,21 +253,21 @@ sub c_if {
}
sub c_port {
my $hp9300 = shift;
my $hp9300 = shift;
my $partial = shift;
my $lldp = $hp9300->lldp_port($partial) || {};
my $lldp = $hp9300->lldp_port($partial) || {};
my $cdp = $hp9300->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;
@@ -276,21 +277,21 @@ sub c_port {
}
sub c_id {
my $hp9300 = shift;
my $hp9300 = shift;
my $partial = shift;
my $lldp = $hp9300->lldp_id($partial) || {};
my $lldp = $hp9300->lldp_id($partial) || {};
my $cdp = $hp9300->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;
@@ -300,21 +301,21 @@ sub c_id {
}
sub c_platform {
my $hp9300 = shift;
my $hp9300 = shift;
my $partial = shift;
my $lldp = $hp9300->lldp_rem_sysdesc($partial) || {};
my $lldp = $hp9300->lldp_rem_sysdesc($partial) || {};
my $cdp = $hp9300->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;
@@ -553,9 +554,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-FDP/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-FDP/LLDP device in between two
or more devices or multiple devices which are not directly connected.
Use the data from the Layer2 Topology Table below to dig deeper.

View File

@@ -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,47 +34,40 @@ use strict;
use Exporter;
use SNMP::Info::Layer3;
@SNMP::Info::Layer3::Juniper::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::Juniper::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::Juniper::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::Layer3::MIBS,
'JUNIPER-CHASSIS-DEFINES-MIB' => 'jnxChassisDefines',
'JUNIPER-MIB' => 'jnxBoxAnatomy',
);
%SNMP::Info::Layer3::MIBS,
'JUNIPER-CHASSIS-DEFINES-MIB' => 'jnxChassisDefines',
'JUNIPER-MIB' => 'jnxBoxAnatomy',
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
'serial' => 'jnxBoxSerialNo.0',
);
%GLOBALS = ( %SNMP::Info::Layer3::GLOBALS, 'serial' => 'jnxBoxSerialNo.0', );
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
);
%FUNCS = ( %SNMP::Info::Layer3::FUNCS, );
%MUNGE = (
%SNMP::Info::Layer3::MUNGE,
);
%MUNGE = ( %SNMP::Info::Layer3::MUNGE, );
sub vendor {
return 'juniper';
return 'juniper';
}
sub os {
return 'junos';
return 'junos';
}
sub os_ver {
my $juniper = shift;
my $descr = $juniper->description();
my $descr = $juniper->description();
return unless defined $descr;
if ($descr =~ m/kernel JUNOS (\S+)/) {
return $1;
if ( $descr =~ m/kernel JUNOS (\S+)/ ) {
return $1;
}
return;
}
@@ -82,12 +75,14 @@ sub os_ver {
sub model {
my $l3 = shift;
my $id = $l3->id();
unless (defined $id){
print " SNMP::Info::Layer3::Juniper::model() - Device does not support sysObjectID\n" if $l3->debug();
unless ( defined $id ) {
print
" SNMP::Info::Layer3::Juniper::model() - Device does not support sysObjectID\n"
if $l3->debug();
return;
}
my $model = &SNMP::translateObj($id);
return $id unless defined $model;
@@ -103,21 +98,21 @@ sub serial {
}
sub i_vlan {
my ($juniper) = shift;
my ($partial) = shift;
my ($juniper) = shift;
my ($partial) = shift;
my ($i_type) = $juniper->i_type($partial);
my ($i_descr) = $juniper->i_description($partial);
my %i_vlan;
my ($i_type) = $juniper->i_type($partial);
my ($i_descr) = $juniper->i_description($partial);
my %i_vlan;
foreach my $idx (keys %$i_descr) {
if ($i_type->{$idx} eq 'l2vlan' || $i_type->{$idx} eq 135) {
if ($i_descr->{$idx} =~ /\.(\d+)$/) {
$i_vlan{$idx} = $1;
}
}
}
return \%i_vlan;
foreach my $idx ( keys %$i_descr ) {
if ( $i_type->{$idx} eq 'l2vlan' || $i_type->{$idx} eq 135 ) {
if ( $i_descr->{$idx} =~ /\.(\d+)$/ ) {
$i_vlan{$idx} = $1;
}
}
}
return \%i_vlan;
}
1;

View File

@@ -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,35 +34,27 @@ use strict;
use Exporter;
use SNMP::Info::Layer3;
@SNMP::Info::Layer3::Microsoft::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::Microsoft::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::Microsoft::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::Layer3::MIBS,
);
%MIBS = ( %SNMP::Info::Layer3::MIBS, );
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
);
%GLOBALS = ( %SNMP::Info::Layer3::GLOBALS, );
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
);
%FUNCS = ( %SNMP::Info::Layer3::FUNCS, );
%MUNGE = (
%SNMP::Info::Layer3::MUNGE,
);
%MUNGE = ( %SNMP::Info::Layer3::MUNGE, );
sub vendor {
return 'microsoft';
return 'microsoft';
}
sub os {
return 'windows';
return 'windows';
}
sub os_ver {
@@ -70,28 +62,30 @@ sub os_ver {
}
sub model {
return 'Windows Router'
return 'Windows Router';
}
sub serial {
return '';
return '';
}
# $l3->interfaces() - Map the Interfaces to their physical names
# Add interface number to interface name because if MS Win
# have identical interface cards ("HP NC7782 Gigabit Server Adapter"
# for example), than MS Win return identical ifDescr
sub interfaces {
my $l3 = shift;
my $l3 = shift;
my $partial = shift;
my $interfaces = $l3->i_index($partial);
my $interfaces = $l3->i_index($partial);
my $descriptions = $l3->i_description($partial);
my %interfaces = ();
foreach my $iid (keys %$interfaces){
foreach my $iid ( keys %$interfaces ) {
my $desc = $descriptions->{$iid};
next unless defined $desc;
$interfaces{$iid} = sprintf("(%U) %s", $iid, $desc);
$interfaces{$iid} = sprintf( "(%U) %s", $iid, $desc );
}
return \%interfaces;

View File

@@ -3,21 +3,21 @@
#
# 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,51 +35,55 @@ use Exporter;
use SNMP::Info::Layer3;
use SNMP::Info::SONMP;
@SNMP::Info::Layer3::N1600::ISA = qw/SNMP::Info::Layer3 SNMP::Info::SONMP Exporter/;
@SNMP::Info::Layer3::N1600::ISA
= qw/SNMP::Info::Layer3 SNMP::Info::SONMP Exporter/;
@SNMP::Info::Layer3::N1600::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = ( %SNMP::Info::Layer3::MIBS,
%SNMP::Info::SONMP::MIBS,
'SWL2MGMT-MIB' => 'swL2MgmtMIB',
'RAPID-CITY' => 'rapidCity',
);
%MIBS = (
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::SONMP::MIBS,
'SWL2MGMT-MIB' => 'swL2MgmtMIB',
'RAPID-CITY' => 'rapidCity',
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::SONMP::GLOBALS,
);
%GLOBALS = ( %SNMP::Info::Layer3::GLOBALS, %SNMP::Info::SONMP::GLOBALS, );
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::SONMP::FUNCS,
# SWL2MGMT-MIB
# swL2PortInfoTable
'n1600_nway_status' => 'swL2PortInfoNwayStatus',
# swL2PortCtrlTable
'n1600_nway_state' => 'swL2PortCtrlNwayState',
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::SONMP::FUNCS,
# SWL2MGMT-MIB
# swL2PortInfoTable
'n1600_nway_status' => 'swL2PortInfoNwayStatus',
# swL2PortCtrlTable
'n1600_nway_state' => 'swL2PortCtrlNwayState',
);
%MUNGE = (
# Inherit all the built in munging
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::SONMP::MUNGE,
);
# Inherit all the built in munging
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::SONMP::MUNGE,
);
# Method OverRides
sub model {
my $n1600 = shift;
my $id = $n1600->id();
unless (defined $id){
print " SNMP::Info::Layer3::N1600::model() - Device does not support sysObjectID\n" if $n1600->debug();
my $id = $n1600->id();
unless ( defined $id ) {
print
" SNMP::Info::Layer3::N1600::model() - Device does not support sysObjectID\n"
if $n1600->debug();
return;
}
my $model = &SNMP::translateObj($id);
return $id unless defined $model;
@@ -101,7 +105,7 @@ sub os_ver {
my $descr = $n1600->description();
return unless defined $descr;
if ($descr =~ m/(\d+\.\d+\.\d+\.\d+)/){
if ( $descr =~ m/(\d+\.\d+\.\d+\.\d+)/ ) {
return $1;
}
@@ -109,13 +113,13 @@ sub os_ver {
}
sub interfaces {
my $n1600 = shift;
my $n1600 = shift;
my $partial = shift;
my $i_index = $n1600->i_index($partial) || {};
my %if;
foreach my $iid (keys %$i_index){
foreach my $iid ( keys %$i_index ) {
my $index = $i_index->{$iid};
next unless defined $index;
@@ -126,13 +130,13 @@ sub interfaces {
}
sub i_duplex {
my $n1600 = shift;
my $n1600 = shift;
my $partial = shift;
my $nway_status = $n1600->n1600_nway_status($partial) || {};
my %i_duplex;
foreach my $iid (keys %$nway_status){
foreach my $iid ( keys %$nway_status ) {
my $duplex = $nway_status->{$iid};
next unless defined $duplex;
next if $duplex =~ /other/i;
@@ -143,13 +147,13 @@ sub i_duplex {
}
sub i_duplex_admin {
my $n1600 = shift;
my $n1600 = shift;
my $partial = shift;
my $nway_state = $n1600->n1600_nway_state($partial) || {};
my %i_duplex;
foreach my $iid (keys %$nway_state){
foreach my $iid ( keys %$nway_state ) {
my $duplex = $nway_state->{$iid};
next unless defined $duplex;
next if $duplex =~ /other/i;

View File

@@ -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,33 +34,29 @@ use strict;
use Exporter;
use SNMP::Info::Layer3;
@SNMP::Info::Layer3::NetSNMP::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::NetSNMP::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::NetSNMP::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::Layer3::MIBS,
'UCD-SNMP-MIB' => 'versionTag',
'NET-SNMP-TC' => 'netSnmpAgentOIDs',
'HOST-RESOURCES-MIB' => 'hrSystem',
);
%SNMP::Info::Layer3::MIBS,
'UCD-SNMP-MIB' => 'versionTag',
'NET-SNMP-TC' => 'netSnmpAgentOIDs',
'HOST-RESOURCES-MIB' => 'hrSystem',
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
'netsnmp_vers' => 'versionTag',
'hrSystemUptime' => 'hrSystemUptime',
);
%SNMP::Info::Layer3::GLOBALS,
'netsnmp_vers' => 'versionTag',
'hrSystemUptime' => 'hrSystemUptime',
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
);
%FUNCS = ( %SNMP::Info::Layer3::FUNCS, );
%MUNGE = (
%SNMP::Info::Layer3::MUNGE,
);
%MUNGE = ( %SNMP::Info::Layer3::MUNGE, );
sub vendor {
return 'Net-SNMP';
@@ -68,19 +64,19 @@ sub vendor {
sub os {
my $netsnmp = shift;
my $descr = $netsnmp->description();
my $descr = $netsnmp->description();
return $1 if ($descr =~ /^(\S+)\s+/);
return $1 if ( $descr =~ /^(\S+)\s+/ );
return;
}
sub os_ver {
my $netsnmp = shift;
my $descr = $netsnmp->description();
my $vers = $netsnmp->netsnmp_vers();
my $os_ver = undef;
my $descr = $netsnmp->description();
my $vers = $netsnmp->netsnmp_vers();
my $os_ver = undef;
$os_ver = $1 if ($descr =~ /^\S+\s+\S+\s+(\S+)\s+/);
$os_ver = $1 if ( $descr =~ /^\S+\s+\S+\s+(\S+)\s+/ );
if ($vers) {
$os_ver = "???" unless defined($os_ver);
$os_ver .= " / Net-SNMP " . $vers;
@@ -109,15 +105,16 @@ sub uptime {
}
sub i_ignore {
my $l3 = shift;
my $l3 = shift;
my $partial = shift;
my $interfaces = $l3->interfaces($partial) || {};
my %i_ignore;
foreach my $if (keys %$interfaces) {
foreach my $if ( keys %$interfaces ) {
# lo0 etc
if ($interfaces->{$if} =~ /\blo\d*\b/i){
if ( $interfaces->{$if} =~ /\blo\d*\b/i ) {
$i_ignore{$if}++;
}
}

View File

@@ -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,36 +34,29 @@ use strict;
use Exporter;
use SNMP::Info::Layer3;
@SNMP::Info::Layer3::Netscreen::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::Netscreen::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::Netscreen::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer3::MIBS,
'NETSCREEN-SMI' => 'netscreenSetting',
'NETSCREEN-PRODUCTS-MIB' => 'netscreenGeneric',
'NETSCREEN-INTERFACE-MIB' => 'nsIfIndex',
'NETSCREEN-SET-GEN-MIB' => 'nsSetGenSwVer',
);
%MIBS = (
%SNMP::Info::Layer3::MIBS,
'NETSCREEN-SMI' => 'netscreenSetting',
'NETSCREEN-PRODUCTS-MIB' => 'netscreenGeneric',
'NETSCREEN-INTERFACE-MIB' => 'nsIfIndex',
'NETSCREEN-SET-GEN-MIB' => 'nsSetGenSwVer',
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
'os_version' => 'nsSetGenSwVer',
);
%GLOBALS = ( %SNMP::Info::Layer3::GLOBALS, 'os_version' => 'nsSetGenSwVer', );
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
);
%FUNCS = ( %SNMP::Info::Layer3::FUNCS, );
%MUNGE = (
%SNMP::Info::Layer3::MUNGE,
);
%MUNGE = ( %SNMP::Info::Layer3::MUNGE, );
sub layers {
return '01001100';
return '01001100';
}
sub vendor {
@@ -78,8 +71,8 @@ sub os_ver {
my $netscreen = shift;
my $descr = $netscreen->description();
if ( $descr =~ m/version (\d\S*) \(SN: /) {
return $1;
if ( $descr =~ m/version (\d\S*) \(SN: / ) {
return $1;
}
return;
}
@@ -91,9 +84,9 @@ sub serial {
my $serial = $e_serial->{1} || undef;
return $1 if (defined $serial and $serial =~ /(\d+)/);
return $1 if ( defined $serial and $serial =~ /(\d+)/ );
my $descr = $netscreen->description();
if ( $descr =~ m/version .*\(SN: (\d\S*),/) {
if ( $descr =~ m/version .*\(SN: (\d\S*),/ ) {
return $1;
}
return;

File diff suppressed because it is too large Load Diff

View File

@@ -3,21 +3,21 @@
#
# 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,69 +34,65 @@ use strict;
use Exporter;
use SNMP::Info::Layer3;
@SNMP::Info::Layer3::Sun::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::Sun::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::Sun::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::Layer3::MIBS,
);
%MIBS = ( %SNMP::Info::Layer3::MIBS, );
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
'sun_hostid' => '.1.3.6.1.4.1.42.3.1.2.0',
'motd' => '.1.3.6.1.4.1.42.3.1.3.0',
);
%SNMP::Info::Layer3::GLOBALS,
'sun_hostid' => '.1.3.6.1.4.1.42.3.1.2.0',
'motd' => '.1.3.6.1.4.1.42.3.1.3.0',
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
);
%FUNCS = ( %SNMP::Info::Layer3::FUNCS, );
%MUNGE = (
%SNMP::Info::Layer3::MUNGE,
);
%MUNGE = ( %SNMP::Info::Layer3::MUNGE, );
sub vendor {
return 'sun';
return 'sun';
}
sub os {
return 'sun';
return 'sun';
}
sub os_ver {
my $sun = shift;
my $sun = shift;
my $descr = $sun->motd();
return unless defined $descr;
if ($descr =~ m/SunOS (\S+)/) {
return $1;
if ( $descr =~ m/SunOS (\S+)/ ) {
return $1;
}
return;
}
sub model {
return 'Solaris Router'
return 'Solaris Router';
}
sub serial {
my $sun = shift;
my $serial = unpack("H*", $sun->sun_hostid());
return $serial;
my $sun = shift;
my $serial = unpack( "H*", $sun->sun_hostid() );
return $serial;
}
sub i_ignore {
my $l3 = shift;
my $l3 = shift;
my $partial = shift;
my $interfaces = $l3->interfaces($partial) || {};
my %i_ignore;
foreach my $if (keys %$interfaces) {
# lo0
if ($interfaces->{$if} =~ /\blo0\b/i){
foreach my $if ( keys %$interfaces ) {
# lo0
if ( $interfaces->{$if} =~ /\blo0\b/i ) {
$i_ignore{$if}++;
}
}