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

806
Info.pm

File diff suppressed because it is too large Load Diff

View File

@@ -45,7 +45,7 @@ $VERSION = '1.09';
%SNMP::Info::MIBS,
'AIRESPACE-WIRELESS-MIB' => 'bsnAPName',
'AIRESPACE-SWITCHING-MIB' => 'agentInventorySerialNumber',
);
);
%GLOBALS = (
%SNMP::Info::GLOBALS,
@@ -68,10 +68,11 @@ $VERSION = '1.09';
'airespace_ul_type' => 'agentTransferUploadDataType',
'airespace_ul_start' => 'agentTransferUploadStart',
'airespace_ul_status' => 'agentTransferUploadStatus',
);
);
%FUNCS = (
%SNMP::Info::FUNCS,
# AIRESPACE-WIRELESS-MIB::bsnDot11EssTable
'airespace_ess_idx' => 'bsnDot11EssIndex',
'airespace_ess_ssid' => 'bsnDot11EssSsid',
@@ -82,6 +83,7 @@ $VERSION = '1.09';
'airespace_ess_qos' => 'bsnDot11EssQualityOfService',
'airespace_ess_ifname' => 'bsnDot11EssInterfaceName',
'airespace_ess_aclname' => 'bsnDot11EssAclName',
# AIRESPACE-WIRELESS-MIB::bsnAPTable
'airespace_ap_mac' => 'bsnAPDot3MacAddress',
'airespace_ap_name' => 'bsnAPName',
@@ -93,6 +95,7 @@ $VERSION = '1.09';
'airespace_ap_serial' => 'bsnAPSerialNumber',
'airespace_ap_type' => 'bsnAPType',
'airespace_ap_status' => 'bsnAPAdminStatus',
# AIRESPACE-WIRELESS-MIB::bsnAPIfTable
'airespace_apif_slot' => 'bsnAPIfSlotId',
'airespace_apif_type' => 'bsnAPIfType',
@@ -101,6 +104,7 @@ $VERSION = '1.09';
'airespace_apif' => 'bsnAPIfOperStatus',
'airespace_apif_oride' => 'bsnAPIfWlanOverride',
'airespace_apif_admin' => 'bsnAPIfAdminStatus',
# AIRESPACE-WIRELESS-MIB::bsnMobileStationTable
'airespace_sta_mac' => 'bsnMobileStationAPMacAddr',
'fw_mac' => 'bsnMobileStationMacAddress',
@@ -108,6 +112,7 @@ $VERSION = '1.09';
'airespace_sta_ess_idx' => 'bsnMobileStationEssIndex',
'airespace_sta_ssid' => 'bsnMobileStationSsid',
'airespace_sta_delete' => 'bsnMobileStationDeleteAction',
# AIRESPACE-WIRELESS-MIB::bsnUsersTable
'airespace_user_name' => 'bsnUserName',
'airespace_user_pw' => 'bsnUserPassword',
@@ -116,13 +121,16 @@ $VERSION = '1.09';
'airespace_user_type' => 'bsnUserType',
'airespace_user_ifname' => 'bsnUserInterfaceName',
'airespace_user_rstat' => 'bsnUserRowStatus',
# AIRESPACE-WIRELESS-MIB::bsnBlackListClientTable
'airespace_bl_mac' => 'bsnBlackListClientMacAddress',
'airespace_bl_descr' => 'bsnBlackListClientDescription',
'airespace_bl_rstat' => 'bsnBlackListClientRowStatus',
# AIRESPACE-WIRELESS-MIB::bsnAPIfWlanOverrideTable
'airespace_oride_id' => 'bsnAPIfWlanOverrideId',
'airespace_oride_ssid' => 'bsnAPIfWlanOverrideSsid',
# AIRESPACE-SWITCHING-MIB::agentInterfaceConfigTable
'airespace_if_name' => 'agentInterfaceName',
'airespace_if_vlan' => 'agentInterfaceVlanId',
@@ -132,10 +140,11 @@ $VERSION = '1.09';
'airespace_if_mask' => 'agentInterfaceIPNetmask',
'airespace_if_acl' => 'agentInterfaceAclName',
'airespace_if_rstat' => 'agentInterfaceRowStatus',
# AIRESPACE-SWITCHING-MIB::agentPortConfigTable
'airespace_duplex_admin' => 'agentPortPhysicalMode',
'airespace_duplex' => 'agentPortPhysicalStatus',
);
);
%MUNGE = (
%SNMP::Info::MUNGE,
@@ -144,7 +153,7 @@ $VERSION = '1.09';
'airespace_bl_mac' => \&SNMP::Info::munge_mac,
'airespace_if_mac' => \&SNMP::Info::munge_mac,
'airespace_sta_mac' => \&SNMP::Info::munge_mac,
);
);
sub layers {
return '00000011';
@@ -170,7 +179,7 @@ sub i_index {
my $if_index = $airespace->airespace_if_name($partial) || {};
my %if_index;
foreach my $iid (keys %$i_index){
foreach my $iid ( keys %$i_index ) {
my $index = $i_index->{$iid};
next unless defined $index;
@@ -178,19 +187,20 @@ sub i_index {
}
# Get Attached APs as Interfaces
foreach my $ap_id (keys %$ap_index){
foreach my $ap_id ( keys %$ap_index ) {
if ($ap_id =~ /(\d+\.\d+\.\d+\.\d+\.\d+\.\d+)\.(\d+)/) {
my $mac = join(':',map {sprintf("%02x",$_)} split(/\./,$1));
if ( $ap_id =~ /(\d+\.\d+\.\d+\.\d+\.\d+\.\d+)\.(\d+)/ ) {
my $mac = join( ':',
map { sprintf( "%02x", $_ ) } split( /\./, $1 ) );
my $slot = $2;
next unless ( (defined $mac) and (defined $slot) );
next unless ( ( defined $mac ) and ( defined $slot ) );
$if_index{$ap_id} = "$mac.$slot";
}
}
# Get Switch Interfaces from Interface Config Table
foreach my $if_id (keys %$if_index){
foreach my $if_id ( keys %$if_index ) {
my $name = $if_index->{$if_id};
next unless defined $name;
@@ -207,11 +217,11 @@ sub interfaces {
my $i_index = $airespace->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;
if ($index =~ /^\d+$/ ) {
if ( $index =~ /^\d+$/ ) {
$if{$iid} = "1.$index";
}
@@ -231,17 +241,17 @@ sub i_name {
my $ap_name = $airespace->airespace_ap_name($partial) || {};
my %i_name;
foreach my $iid (keys %$i_index){
foreach my $iid ( keys %$i_index ) {
my $index = $i_index->{$iid};
next unless defined $index;
if ($index =~ /^\d+$/ ) {
if ( $index =~ /^\d+$/ ) {
my $name = $i_name->{$iid};
next unless defined $name;
$i_name{$iid} = $name;
}
elsif ($index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/) {
elsif ( $index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/ ) {
my $idx = $iid;
$idx =~ s/\.\d+$//;
my $name = $ap_name->{$idx};
@@ -265,17 +275,17 @@ sub i_description {
my $ap_loc = $airespace->airespace_ap_loc($partial) || {};
my %descr;
foreach my $iid (keys %$i_index){
foreach my $iid ( keys %$i_index ) {
my $index = $i_index->{$iid};
next unless defined $index;
if ($index =~ /^\d+$/ ) {
if ( $index =~ /^\d+$/ ) {
my $descr = $i_descr->{$iid};
next unless defined $descr;
$descr{$iid} = $descr;
}
elsif ($index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/) {
elsif ( $index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/ ) {
my $idx = $iid;
$idx =~ s/\.\d+$//;
my $name = $ap_loc->{$idx};
@@ -300,17 +310,17 @@ sub i_type {
my $if_type = $airespace->airespace_if_type($partial) || {};
my %i_type;
foreach my $iid (keys %$i_index){
foreach my $iid ( keys %$i_index ) {
my $index = $i_index->{$iid};
next unless defined $index;
if ($index =~ /^\d+$/ ) {
if ( $index =~ /^\d+$/ ) {
my $descr = $i_descr->{$iid};
next unless defined $descr;
$i_type{$iid} = $descr;
}
elsif ($index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/) {
elsif ( $index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/ ) {
my $type = $apif_type->{$iid};
next unless defined $type;
$i_type{$iid} = $type;
@@ -333,17 +343,17 @@ sub i_up {
my $apif_up = $airespace->airespace_apif($partial) || {};
my %i_up;
foreach my $iid (keys %$i_index){
foreach my $iid ( keys %$i_index ) {
my $index = $i_index->{$iid};
next unless defined $index;
if ($index =~ /^\d+$/ ) {
if ( $index =~ /^\d+$/ ) {
my $stat = $i_up->{$iid};
next unless defined $stat;
$i_up{$iid} = $stat;
}
elsif ($index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/) {
elsif ( $index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/ ) {
my $stat = $apif_up->{$iid};
next unless defined $stat;
$i_up{$iid} = $stat;
@@ -365,17 +375,17 @@ sub i_up_admin {
my $apif_up = $airespace->airespace_apif_admin($partial) || {};
my %i_up_admin;
foreach my $iid (keys %$i_index){
foreach my $iid ( keys %$i_index ) {
my $index = $i_index->{$iid};
next unless defined $index;
if ($index =~ /^\d+$/ ) {
if ( $index =~ /^\d+$/ ) {
my $stat = $i_up->{$iid};
next unless defined $stat;
$i_up_admin{$iid} = $stat;
}
elsif ($index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/) {
elsif ( $index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/ ) {
my $stat = $apif_up->{$iid};
next unless defined $stat;
$i_up_admin{$iid} = $stat;
@@ -397,11 +407,11 @@ sub i_mac {
my $if_mac = $airespace->airespace_if_mac($partial) || {};
my %i_mac;
foreach my $iid (keys %$i_index){
foreach my $iid ( keys %$i_index ) {
my $index = $i_index->{$iid};
next unless defined $index;
if ($index =~ /^\d+$/ ) {
if ( $index =~ /^\d+$/ ) {
my $mac = $i_mac->{$iid};
next unless defined $mac;
$i_mac{$iid} = $mac;
@@ -428,7 +438,7 @@ sub i_vlan {
my $if_vlan = $airespace->airespace_if_vlan($partial) || {};
my %i_vlan;
foreach my $iid (keys %$if_vlan){
foreach my $iid ( keys %$if_vlan ) {
my $vlan = $if_vlan->{$iid};
next unless defined $vlan;
@@ -445,14 +455,14 @@ sub i_duplex {
my $ap_duplex = $airespace->airespace_duplex($partial) || {};
my %i_duplex;
foreach my $if (keys %$ap_duplex){
foreach my $if ( keys %$ap_duplex ) {
my $duplex = $ap_duplex->{$if};
next unless defined $duplex;
$duplex = 'half' if $duplex =~ /half/i;
$duplex = 'full' if $duplex =~ /full/i;
$duplex = 'auto' if $duplex =~ /auto/i;
$i_duplex{$if}=$duplex;
$i_duplex{$if} = $duplex;
}
return \%i_duplex;
}
@@ -464,14 +474,14 @@ sub i_duplex_admin {
my $ap_duplex_admin = $airespace->airespace_duplex_admin($partial) || {};
my %i_duplex_admin;
foreach my $if (keys %$ap_duplex_admin){
foreach my $if ( keys %$ap_duplex_admin ) {
my $duplex = $ap_duplex_admin->{$if};
next unless defined $duplex;
$duplex = 'half' if $duplex =~ /half/i;
$duplex = 'full' if $duplex =~ /full/i;
$duplex = 'auto' if $duplex =~ /auto/i;
$i_duplex_admin{$if}=$duplex;
$i_duplex_admin{$if} = $duplex;
}
return \%i_duplex_admin;
}
@@ -484,17 +494,17 @@ sub ip_index {
my $if_ip = $airespace->airespace_if_ip() || {};
my %ip_index;
foreach my $ip (keys %$ip_index){
foreach my $ip ( keys %$ip_index ) {
my $iid = $ip_index->{$ip};
next unless defined $iid;
$ip_index{$ip} = $iid;
}
foreach my $iid (keys %$if_ip){
foreach my $iid ( keys %$if_ip ) {
my $ip = $if_ip->{$iid};
next unless defined $ip;
next if (defined $partial and $partial !~ /$ip/);
next if ( defined $partial and $partial !~ /$ip/ );
$ip_index{$ip} = $iid;
}
@@ -511,17 +521,17 @@ sub ip_netmask {
my $if_mask = $airespace->airespace_if_mask() || {};
my %ip_netmask;
foreach my $ip (keys %$ip_mask){
foreach my $ip ( keys %$ip_mask ) {
my $mask = $ip_mask->{$ip};
next unless defined $mask;
$ip_netmask{$ip} = $mask;
}
foreach my $iid (keys %$if_mask){
foreach my $iid ( keys %$if_mask ) {
my $ip = $if_ip->{$iid};
next unless defined $ip;
next if (defined $partial and $partial !~ /$ip/);
next if ( defined $partial and $partial !~ /$ip/ );
my $mask = $if_mask->{$iid};
next unless defined $mask;
@@ -539,7 +549,7 @@ sub bp_index {
my $i_index = $airespace->i_index($partial) || {};
my %bp_index;
foreach my $iid (keys %$i_index){
foreach my $iid ( keys %$i_index ) {
my $index = $i_index->{$iid};
next unless defined $index;
@@ -557,7 +567,7 @@ sub fw_port {
my $sta_slot = $airespace->airespace_sta_slot($partial) || {};
my %fw_port;
foreach my $iid (keys %$sta_mac){
foreach my $iid ( keys %$sta_mac ) {
my $mac = $sta_mac->{$iid};
next unless defined $mac;
my $slot = $sta_slot->{$iid};
@@ -581,16 +591,16 @@ sub i_ssidlist {
my $ovride_ssids = $airespace->airespace_oride_ssid($partial) || {};
my %i_ssidlist;
foreach my $iid (keys %$apif_override){
foreach my $iid ( keys %$apif_override ) {
my $override = $apif_override->{$iid};
next unless defined $override;
next unless $override =~ /disable/i ;
next unless $override =~ /disable/i;
my $ap_type = $apif_type->{$iid};
next unless defined $ap_type;
$ap_type =~ s/dot11//;
foreach my $idx (keys %$ssids){
foreach my $idx ( keys %$ssids ) {
my $ssid = $ssids->{$idx};
next unless defined $ssid;
my $status = $ssid_status->{$idx};
@@ -604,7 +614,7 @@ sub i_ssidlist {
next;
}
foreach my $iid (keys %$ovride_ssids){
foreach my $iid ( keys %$ovride_ssids ) {
my $ssid = $ovride_ssids->{$iid};
next unless $ssid;
@@ -625,7 +635,7 @@ sub i_ssidbcast {
my $broadcast = $bcmap{$bc_mode};
my %i_ssidbcast;
foreach my $iid (keys %$ssidlist){
foreach my $iid ( keys %$ssidlist ) {
$i_ssidbcast{$iid} = $broadcast;
}
@@ -639,7 +649,7 @@ sub i_80211channel {
my $ch_list = $airespace->airespace_apif_ch_num($partial) || {};
my %i_80211channel;
foreach my $iid (keys %$ch_list){
foreach my $iid ( keys %$ch_list ) {
my $ch = $ch_list->{$iid};
$ch =~ s/ch//;
$i_80211channel{$iid} = $ch;
@@ -648,7 +658,6 @@ sub i_80211channel {
return \%i_80211channel;
}
# Pseudo ENTITY-MIB methods
sub e_index {
@@ -657,17 +666,20 @@ sub e_index {
my $ap_model = $airespace->airespace_ap_model() || {};
my %e_index;
# Chassis
$e_index{1} = 1;
# We're going to hack an index to capture APs
foreach my $idx (keys %$ap_model){
foreach my $idx ( keys %$ap_model ) {
# Create the integer index by joining the last three octets of the MAC.
# Hopefully, this will be unique since the manufacturer should be
# limited to Airespace and Cisco. We can't use the entire MAC since
# we would exceed the intger size limit.
if ($idx =~ /(\d+\.\d+\.\d+)$/) {
my $index = int (join('',map { sprintf "%03d",$_ } split /\./, $1));
if ( $idx =~ /(\d+\.\d+\.\d+)$/ ) {
my $index = int(
join( '', map { sprintf "%03d", $_ } split /\./, $1 ) );
$e_index{$idx} = $index;
}
}
@@ -680,10 +692,11 @@ sub e_class {
my $e_idx = $airespace->e_index() || {};
my %e_class;
foreach my $iid (keys %$e_idx){
if ($iid eq 1) {
foreach my $iid ( keys %$e_idx ) {
if ( $iid eq 1 ) {
$e_class{$iid} = 'chassis';
}
# This isn't a valid PhysicalClass, but we're hacking this anyway
else {
$e_class{$iid} = 'ap';
@@ -698,11 +711,12 @@ sub e_name {
my $ap_name = $airespace->airespace_ap_name() || {};
my %e_name;
# Chassis
$e_name{1} = 'WLAN Controller';
# APs
foreach my $iid (keys %$ap_name){
foreach my $iid ( keys %$ap_name ) {
$e_name{$iid} = 'AP';
}
return \%e_name;
@@ -716,11 +730,12 @@ sub e_descr {
my $ap_loc = $airespace->airespace_ap_loc() || {};
my %e_descr;
# Chassis
$e_descr{1} = $airespace->airespace_prod_name();
# APs
foreach my $iid (keys %$ap_name){
foreach my $iid ( keys %$ap_name ) {
my $name = $ap_name->{$iid};
next unless defined $name;
my $model = $ap_model->{$iid} || 'AP';
@@ -737,11 +752,12 @@ sub e_model {
my $ap_model = $airespace->airespace_ap_model() || {};
my %e_model;
# Chassis
$e_model{1} = $airespace->airespace_model();
# APs
foreach my $iid (keys %$ap_model){
foreach my $iid ( keys %$ap_model ) {
my $model = $ap_model->{$iid};
next unless defined $model;
@@ -756,11 +772,12 @@ sub e_type {
my $ap_type = $airespace->airespace_ap_type() || {};
my %e_type;
# Chassis
$e_type{1} = $airespace->airespace_type();
# APs
foreach my $iid (keys %$ap_type){
foreach my $iid ( keys %$ap_type ) {
my $type = $ap_type->{$iid};
next unless defined $type;
@@ -775,11 +792,12 @@ sub e_fwver {
my $ap_fw = $airespace->airespace_ap_fw() || {};
my %e_fwver;
# Chassis
$e_fwver{1} = $airespace->airespace_maint_ver();
# APs
foreach my $iid (keys %$ap_fw){
foreach my $iid ( keys %$ap_fw ) {
my $fw = $ap_fw->{$iid};
next unless defined $fw;
@@ -794,7 +812,7 @@ sub e_vendor {
my $e_idx = $airespace->e_index() || {};
my %e_vendor;
foreach my $iid (keys %$e_idx){
foreach my $iid ( keys %$e_idx ) {
$e_vendor{$iid} = 'cisco';
}
return \%e_vendor;
@@ -806,11 +824,12 @@ sub e_serial {
my $ap_serial = $airespace->airespace_ap_serial() || {};
my %e_serial;
# Chassis
$e_serial{1} = $airespace->airespace_serial();
# APs
foreach my $iid (keys %$ap_serial){
foreach my $iid ( keys %$ap_serial ) {
my $serial = $ap_serial->{$iid};
next unless defined $serial;
@@ -826,8 +845,8 @@ sub e_pos {
my %e_pos;
my $pos = 0;
foreach my $iid (sort keys %$e_idx){
if ($iid eq 1) {
foreach my $iid ( sort keys %$e_idx ) {
if ( $iid eq 1 ) {
$e_pos{$iid} = -1;
next;
}
@@ -845,11 +864,12 @@ sub e_swver {
my $ap_sw = $airespace->airespace_ap_sw() || {};
my %e_swver;
# Chassis
$e_swver{1} = $airespace->airespace_os();
# APs
foreach my $iid (keys %$ap_sw){
foreach my $iid ( keys %$ap_sw ) {
my $sw = $ap_sw->{$iid};
next unless defined $sw;
@@ -864,8 +884,8 @@ sub e_parent {
my $e_idx = $airespace->e_index() || {};
my %e_parent;
foreach my $iid (sort keys %$e_idx){
if ($iid eq 1) {
foreach my $iid ( sort keys %$e_idx ) {
if ( $iid eq 1 ) {
$e_parent{$iid} = 0;
next;
}
@@ -998,8 +1018,8 @@ Layer3 mode.
=item $airespace->airespace_ul_mode()
Transfer upload mode configures the mode to use when uploading from the switch.
Normal usage tftp.
Transfer upload mode configures the mode to use when uploading from the
switch. Normal usage tftp.
(C<agentTransferUploadMode>)
@@ -1012,8 +1032,8 @@ valid only when the Transfer Mode is tftp.
=item $airespace->airespace_ul_path()
Transfer upload tftp path configures the directory path where the file is to be
uploaded to. The switch remembers the last file path used.
Transfer upload tftp path configures the directory path where the file is to
be uploaded to. The switch remembers the last file path used.
(C<agentTransferUploadPath>)
@@ -1023,7 +1043,8 @@ uploaded to. The switch remembers the last file path used.
=item $airespace->airespace_ul_type()
Transfer upload datatype configures the type of file to upload from the switch.
Transfer upload datatype configures the type of file to upload from the
switch.
The types for upload are:
config(2)
@@ -1518,8 +1539,8 @@ only.
=item $airespace->i_duplex_admin()
Returns reference to hash of IIDs to admin duplex setting. Ethernet interfaces
only.
Returns reference to hash of IIDs to admin duplex setting. Ethernet
interfaces only.
=item $airespace->ip_index()
@@ -1548,8 +1569,8 @@ airespace_sta_slot() combined to match the interface iid.
=head2 Pseudo F<ENTITY-MIB> information
These methods emulate F<ENTITY-MIB> Physical Table methods using
F<AIRESPACE-SWITCHING-MIB> and F<AIRESPACE-WIRELESS-MIB>. Thin APs are included
as subcomponents of the wireless controller.
F<AIRESPACE-SWITCHING-MIB> and F<AIRESPACE-WIRELESS-MIB>. Thin APs are
included as subcomponents of the wireless controller.
=over

View File

@@ -44,37 +44,44 @@ use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
$VERSION = '1.09';
%MIBS = ('BRIDGE-MIB' => 'dot1dBaseBridgeAddress',
%MIBS = (
'BRIDGE-MIB' => 'dot1dBaseBridgeAddress',
'Q-BRIDGE-MIB' => 'dot1qPvid',
);
);
%GLOBALS = (
'b_mac' => 'dot1dBaseBridgeAddress',
'b_ports' => 'dot1dBaseNumPorts',
'b_type' => 'dot1dBaseType',
# Spanning Tree Protocol
'stp_ver' => 'dot1dStpProtocolSpecification',
'stp_time' => 'dot1dStpTimeSinceTopologyChange',
'stp_root' => 'dot1dStpDesignatedRoot',
# Q-BRIDGE-MIB
'qb_vlans_max' => 'dot1qMaxSupportedVlans',
'qb_vlans' => 'dot1qNumVlans',
'qb_next_vlan_index' => 'dot1qNextFreeLocalVlanIndex',
);
);
%FUNCS = (
# Forwarding Table: Dot1dTpFdbEntry
'fw_mac' => 'dot1dTpFdbAddress',
'fw_port' => 'dot1dTpFdbPort',
'fw_status' => 'dot1dTpFdbStatus',
# Bridge Port Table: Dot1dBasePortEntry
'bp_index' => 'dot1dBasePortIfIndex',
'bp_port' => 'dot1dBasePortCircuit',
# Bridge Static (Destination-Address Filtering) Database
'bs_mac' => 'dot1dStaticAddress',
'bs_port' => 'dot1dStaticReceivePort',
'bs_to' => 'dot1dStaticAllowedToGoTo',
'bs_status' => 'dot1dStaticStatus',
# Spanning Tree Protocol Table : dot1dStpPortTable
'stp_p_id' => 'dot1dStpPort',
'stp_p_priority' => 'dot1dStpPortPriority',
@@ -83,28 +90,34 @@ $VERSION = '1.09';
'stp_p_root' => 'dot1dStpPortDesignatedRoot',
'stp_p_bridge' => 'dot1dStpPortDesignatedBridge',
'stp_p_port' => 'dot1dStpPortDesignatedPort',
# Q-BRIDGE-MIB : dot1qPortVlanTable
'qb_i_vlan' => 'dot1qPvid',
'qb_i_vlan_type' => 'dot1qPortAcceptableFrameTypes',
'qb_i_vlan_in_flt' => 'dot1qPortIngressFiltering',
# Q-BRIDGE-MIB : dot1qVlanCurrentTable
'qb_cv_egress' => 'dot1qVlanCurrentEgressPorts',
'qb_cv_untagged' => 'dot1qVlanCurrentUntaggedPorts',
'qb_cv_stat' => 'dot1qVlanStatus',
# Q-BRIDGE-MIB : dot1qVlanStaticTable
'v_name' => 'dot1qVlanStaticName',
'qb_v_egress' => 'dot1qVlanStaticEgressPorts',
'qb_v_fbdn_egress' => 'dot1qVlanForbiddenEgressPorts',
'qb_v_untagged' => 'dot1qVlanStaticUntaggedPorts',
'qb_v_stat' => 'dot1qVlanStaticRowStatus',
# VLAN Forwarding Table: Dot1qTpFdbEntry
'qb_fw_port' => 'dot1qTpFdbPort',
'qb_fw_status' => 'dot1qTpFdbStatus',
);
);
%MUNGE = (
# Inherit all the built in munging
%SNMP::Info::MUNGE,
# Add ones for our class
'b_mac' => \&SNMP::Info::munge_mac,
'fw_mac' => \&SNMP::Info::munge_mac,
@@ -119,14 +132,14 @@ $VERSION = '1.09';
'qb_v_fbdn_egress' => \&SNMP::Info::munge_port_list,
'qb_v_untagged' => \&SNMP::Info::munge_port_list,
);
);
# break up the Dot1qTpFdbEntry INDEX into FDB ID and MAC Address.
sub _qb_fdbtable_index {
my $idx = shift;
my @values = split(/\./, $idx);
my @values = split( /\./, $idx );
my $fdb_id = shift(@values);
return ($fdb_id, join(':',map { sprintf "%02x",$_ } @values));
return ( $fdb_id, join( ':', map { sprintf "%02x", $_ } @values ) );
}
sub qb_fw_mac {
@@ -135,8 +148,8 @@ sub qb_fw_mac {
my $qb_fw_port = $bridge->qb_fw_port($partial);
my $qb_fw_mac = {};
foreach my $idx (keys %$qb_fw_port) {
my($fdb_id, $mac) = _qb_fdbtable_index($idx);
foreach my $idx ( keys %$qb_fw_port ) {
my ( $fdb_id, $mac ) = _qb_fdbtable_index($idx);
$qb_fw_mac->{$idx} = $mac;
}
return $qb_fw_mac;
@@ -151,7 +164,7 @@ sub qb_i_vlan_t {
my $i_vlan = {};
foreach my $if (keys %$qb_i_vlan){
foreach my $if ( keys %$qb_i_vlan ) {
my $vlan = $qb_i_vlan->{$if};
my $tagged = $qb_i_vlan_type->{$if} || '';
next unless defined $vlan;
@@ -169,12 +182,12 @@ sub i_stp_state {
my %i_stp_state;
foreach my $index (keys %$stp_p_state){
foreach my $index ( keys %$stp_p_state ) {
my $state = $stp_p_state->{$index};
my $iid = $bp_index->{$index};
next unless defined $iid;
next unless defined $state;
$i_stp_state{$iid}=$state;
$i_stp_state{$iid} = $state;
}
return \%i_stp_state;
@@ -189,12 +202,12 @@ sub i_stp_port {
my %i_stp_port;
foreach my $index (keys %$stp_p_port){
foreach my $index ( keys %$stp_p_port ) {
my $bridge = $stp_p_port->{$index};
my $iid = $bp_index->{$index};
next unless defined $iid;
next unless defined $bridge;
$i_stp_port{$iid}=$bridge;
$i_stp_port{$iid} = $bridge;
}
return \%i_stp_port;
}
@@ -208,12 +221,12 @@ sub i_stp_id {
my %i_stp_id;
foreach my $index (keys %$stp_p_id){
foreach my $index ( keys %$stp_p_id ) {
my $bridge = $stp_p_id->{$index};
my $iid = $bp_index->{$index};
next unless defined $iid;
next unless defined $bridge;
$i_stp_id{$iid}=$bridge;
$i_stp_id{$iid} = $bridge;
}
return \%i_stp_id;
}
@@ -227,12 +240,12 @@ sub i_stp_bridge {
my %i_stp_bridge;
foreach my $index (keys %$stp_p_bridge){
foreach my $index ( keys %$stp_p_bridge ) {
my $bridge = $stp_p_bridge->{$index};
my $iid = $bp_index->{$index};
next unless defined $iid;
next unless defined $bridge;
$i_stp_bridge{$iid}=$bridge;
$i_stp_bridge{$iid} = $bridge;
}
return \%i_stp_bridge;
}
@@ -244,7 +257,7 @@ sub v_index {
my $v_name = $bridge->v_name($partial);
my %v_index;
foreach my $idx (keys %$v_name) {
foreach my $idx ( keys %$v_name ) {
$v_index{$idx} = $idx;
}
return \%v_index;
@@ -265,10 +278,10 @@ sub i_vlan {
my $i_pvid = $bridge->qb_i_vlan($partial) || {};
my $i_vlan = {};
foreach my $bport (keys %$i_pvid) {
foreach my $bport ( keys %$i_pvid ) {
my $vlan = $i_pvid->{$bport};
my $ifindex = $index->{$bport};
unless (defined $ifindex) {
unless ( defined $ifindex ) {
print " Port $bport has no bp_index mapping. Skipping.\n"
if $DEBUG;
next;
@@ -294,29 +307,29 @@ sub i_vlan_membership {
# zero partial for no time filter.
# my $v_ports = $bridge->qb_cv_egress() || $bridge->qb_v_egress();
my $v_ports = $bridge->qb_v_egress() || {};
my $i_vlan_membership = {};
foreach my $idx (keys %$v_ports) {
next unless (defined $v_ports->{$idx});
foreach my $idx ( keys %$v_ports ) {
next unless ( defined $v_ports->{$idx} );
my $portlist = $v_ports->{$idx};
my $ret = [];
my $vlan;
# Strip TimeFilter if we're using VlanCurrentTable
($vlan = $idx) =~ s/^\d+\.//;
( $vlan = $idx ) =~ s/^\d+\.//;
# Convert portlist bit array to bp_index array
for (my $i = 0; $i <= $#$portlist; $i++) {
push(@{$ret}, $i+1) if (@$portlist[$i]);
for ( my $i = 0; $i <= $#$portlist; $i++ ) {
push( @{$ret}, $i + 1 ) if ( @$portlist[$i] );
}
#Create HoA ifIndex -> VLAN array
foreach my $port (@{$ret}) {
foreach my $port ( @{$ret} ) {
my $ifindex = $index->{$port};
next unless (defined($ifindex)); # shouldn't happen
next if (defined $partial and $ifindex !~ /^$partial$/);
push(@{$i_vlan_membership->{$ifindex}}, $vlan);
next unless ( defined($ifindex) ); # shouldn't happen
next if ( defined $partial and $ifindex !~ /^$partial$/ );
push( @{ $i_vlan_membership->{$ifindex} }, $vlan );
}
}
return $i_vlan_membership;
@@ -355,15 +368,19 @@ sub set_remove_i_vlan_tagged {
#
sub _check_forbidden_ports {
my $bridge = shift;
my ($vlan_id, $index) = @_;
return unless ($vlan_id =~ /\d+/ and $index =~ /\d+/);
my ( $vlan_id, $index ) = @_;
return unless ( $vlan_id =~ /\d+/ and $index =~ /\d+/ );
my $iv_forbidden = $bridge->qb_v_fbdn_egress($vlan_id);
my $forbidden_ports = $iv_forbidden->{$vlan_id};
print "Forbidden ports: @$forbidden_ports\n" if $bridge->debug();
if ( defined(@$forbidden_ports[$index-1]) and (@$forbidden_ports[$index-1] eq "1")) {
print "Error: Index: $index in forbidden list for VLAN: $vlan_id unable to add.\n" if $bridge->debug();
if ( defined( @$forbidden_ports[ $index - 1 ] )
and ( @$forbidden_ports[ $index - 1 ] eq "1" ) )
{
print
"Error: Index: $index in forbidden list for VLAN: $vlan_id unable to add.\n"
if $bridge->debug();
return;
}
return 1;
@@ -371,11 +388,14 @@ sub _check_forbidden_ports {
sub _validate_vlan_param {
my $bridge = shift;
my ($vlan_id, $ifindex) = @_;
my ( $vlan_id, $ifindex ) = @_;
# VID and ifIndex should both be numeric
unless ( defined $vlan_id and defined $ifindex and
$vlan_id =~ /^\d+$/ and $ifindex =~ /^\d+$/ ) {
unless (defined $vlan_id
and defined $ifindex
and $vlan_id =~ /^\d+$/
and $ifindex =~ /^\d+$/ )
{
$bridge->error_throw("Invalid parameter.");
return;
}
@@ -392,18 +412,19 @@ sub _validate_vlan_param {
my $vtp_vlans = $bridge->load_qb_cv_stat() || $bridge->load_qb_v_stat();
my $vlan_exists = 0;
foreach my $iid (keys %$vtp_vlans) {
foreach my $iid ( keys %$vtp_vlans ) {
my $vlan = 0;
my $state = $vtp_vlans->{$iid};
next unless defined $state;
if ($iid =~ /(\d+)$/ ) {
if ( $iid =~ /(\d+)$/ ) {
$vlan = $1;
}
$vlan_exists = 1 if ( $vlan_id eq $vlan );
}
unless ( $vlan_exists ) {
$bridge->error_throw("VLAN $vlan_id does not exist or is not operational.");
unless ($vlan_exists) {
$bridge->error_throw(
"VLAN $vlan_id does not exist or is not operational.");
return;
}
@@ -457,8 +478,8 @@ Max Baker
F<BRIDGE-MIB> is used by most Layer 2 devices, and holds information like the
MAC Forwarding Table and Spanning Tree Protocol info.
F<Q-BRIDGE-MIB> holds 802.1q information -- VLANs and Trunking. Cisco tends not
to use this MIB, but some proprietary ones. HP and some nicer vendors use
F<Q-BRIDGE-MIB> holds 802.1q information -- VLANs and Trunking. Cisco tends
not to use this MIB, but some proprietary ones. HP and some nicer vendors use
this. This is from C<RFC2674_q>.
Create or use a subclass of SNMP::Info that inherits this class. Do not use

View File

@@ -54,7 +54,7 @@ $VERSION = '1.09';
'cdp_interval' => 'cdpGlobalMessageInterval',
'cdp_holdtime' => 'cdpGlobalHoldTime',
'cdp_id' => 'cdpGlobalDeviceId',
);
);
%FUNCS = (
'c_index' => 'cdpCacheIfIndex',
@@ -69,7 +69,7 @@ $VERSION = '1.09';
'c_vlan' => 'cdpCacheNativeVLAN',
'c_duplex' => 'cdpCacheDuplex',
'c_power' => 'cdpCachePowerConsumption',
);
);
%MUNGE = (
'c_capabilities' => \&SNMP::Info::munge_caps,
@@ -81,11 +81,11 @@ $VERSION = '1.09';
'c_ip' => \&SNMP::Info::munge_ip,
'c_power' => \&munge_power,
);
);
sub munge_power {
my $power = shift;
my $decimal = substr($power, -3);
my $decimal = substr( $power, -3 );
$power =~ s/$decimal$/\.$decimal/;
return $power;
}
@@ -95,12 +95,12 @@ sub hasCDP {
my $ver = $cdp->{_version};
# SNMP v1 clients dont have the globals
if (defined $ver and $ver == 1){
if ( defined $ver and $ver == 1 ) {
my $c_ip = $cdp->c_ip();
# See if anything in cdp cache, if so we have cdp
return 1 if (defined $c_ip and scalar(keys %$c_ip)) ;
return 1 if ( defined $c_ip and scalar( keys %$c_ip ) );
return;
}
@@ -116,15 +116,18 @@ sub c_if {
# Nope, didn't think so. Now we fake it.
my $c_ip = $cdp->c_ip();
unless (defined $c_ip){
$cdp->error_throw("SNMP::Info::CDP:c_if() - Device doesn't have cdp_ip() data. Can't fake cdp_index()");
unless ( defined $c_ip ) {
$cdp->error_throw(
"SNMP::Info::CDP:c_if() - Device doesn't have cdp_ip() data. Can't fake cdp_index()"
);
return;
}
my %c_if;
foreach my $key (keys %$c_ip){
foreach my $key ( keys %$c_ip ) {
next unless defined $key;
my $iid = $key;
# Truncate .1 from cdp cache entry
$iid =~ s/\.\d+$//;
$c_if{$key} = $iid;
@@ -141,13 +144,13 @@ sub c_ip {
my $c_proto = $cdp->c_proto($partial) || {};
my %c_ip;
foreach my $key (keys %$c_addr) {
foreach my $key ( keys %$c_addr ) {
my $addr = $c_addr->{$key};
my $proto = $c_proto->{$key};
next unless defined $addr;
next if (defined $proto and $proto ne 'ip');
next if ( defined $proto and $proto ne 'ip' );
my $ip = join('.',unpack('C4',$addr));
my $ip = join( '.', unpack( 'C4', $addr ) );
$c_ip{$key} = $ip;
}
return \%c_ip;

View File

@@ -45,15 +45,17 @@ $VERSION = '1.09';
'CISCO-CONFIG-COPY-MIB' => 'ccCopyTable',
'CISCO-FLASH-MIB' => 'ciscoFlashCopyTable',
'OLD-CISCO-SYS-MIB' => 'writeMem',
);
);
%GLOBALS = (
# OLD-CISCO-SYS-MIB
'old_write_mem' => 'writeMem',
'old_write_net' => 'writeNet',
);
);
%FUNCS = (
# CISCO-COPY-CONFIG-MIB::ccCopyTable
'config_protocol' => 'ccCopyProtocol',
'config_source_type' => 'ccCopySourceFileType',
@@ -68,6 +70,7 @@ $VERSION = '1.09';
'config_copy_complete_time' => 'ccCopyTimeCompleted',
'config_fail_cause' => 'ccCopyFailCause',
'config_row_status' => 'ccCopyEntryRowStatus',
# CISCO-FLASH-MIB::ciscoFlashCopyTable
'flash_copy_cmd' => 'ciscoFlashCopyCommand',
'flash_copy_protocol' => 'ciscoFlashCopyProtocol',
@@ -75,10 +78,9 @@ $VERSION = '1.09';
'flash_copy_source' => 'ciscoFlashCopySourceName',
'flash_copy_dest' => 'ciscoFlashCopyDestinationName',
'flash_copy_row_status' => 'ciscoFlashCopyEntryStatus',
);
);
%MUNGE = (
);
%MUNGE = ();
sub copy_run_tftp {
my $ciscoconfig = shift;
@@ -87,49 +89,62 @@ sub copy_run_tftp {
srand( time() ^ ( $$ + ( $$ << 15 ) ) );
my $rand = int( rand( 1 << 24 ) );
print "Saving running config to $tftphost as $tftpfile\n" if $ciscoconfig->debug();
print "Saving running config to $tftphost as $tftpfile\n"
if $ciscoconfig->debug();
#Try new method first fall back to old method
if ( $ciscoconfig->set_config_protocol( 1, $rand ) ) {
print "Using new method, row iid: $rand\n" if $ciscoconfig->debug();
#Check each set, delete created row if any fail
unless ( $ciscoconfig->set_config_source_type( 4, $rand ) ) {
$ciscoconfig->error_throw("Setting source type failed");
unless ( $ciscoconfig->set_config_row_status( 6, $rand ) ) {
$ciscoconfig->error_throw("Setting source type failed and failed to delete row $rand");
$ciscoconfig->error_throw(
"Setting source type failed and failed to delete row $rand"
);
}
return;
}
unless ( $ciscoconfig->set_config_dest_type( 1, $rand ) ) {
$ciscoconfig->error_throw("Setting destination type failed");
unless ( $ciscoconfig->set_config_row_status( 6, $rand ) ) {
$ciscoconfig->error_throw("Setting dest type failed and failed to delete row $rand");
$ciscoconfig->error_throw(
"Setting dest type failed and failed to delete row $rand"
);
}
return;
}
unless ( $ciscoconfig->set_config_server_addr( $tftphost, $rand ) ) {
$ciscoconfig->error_throw("Setting tftp server failed");
unless ( $ciscoconfig->set_config_row_status( 6, $rand ) ) {
$ciscoconfig->error_throw("Setting tftp server failed and failed to delete row $rand");
$ciscoconfig->error_throw(
"Setting tftp server failed and failed to delete row $rand"
);
}
return;
}
unless ( $ciscoconfig->set_config_filename( $tftpfile, $rand ) ) {
$ciscoconfig->error_throw("Setting file name failed");
unless ( $ciscoconfig->set_config_row_status( 6, $rand ) ) {
$ciscoconfig->error_throw("Setting file name failed and failed to delete row $rand");
$ciscoconfig->error_throw(
"Setting file name failed and failed to delete row $rand"
);
}
return;
}
unless ( $ciscoconfig->set_config_row_status( 1, $rand ) ) {
$ciscoconfig->error_throw("Initiating transfer failed");
unless ( $ciscoconfig->set_config_row_status( 6, $rand ) ) {
$ciscoconfig->error_throw("Initiating transfer failed and failed to delete row $rand");
$ciscoconfig->error_throw(
"Initiating transfer failed and failed to delete row $rand"
);
}
return;
}
my $status = 0;
my $timer = 0;
# Hard-coded timeout of approximately 5 minutes, we can wrap this in an
# option later if needed
my $timeout = 300;
@@ -138,7 +153,7 @@ sub copy_run_tftp {
$status = $t->{$rand};
last if $status =~ /successful|failed/;
$timer += 1;
if ($timer >= $timeout) {
if ( $timer >= $timeout ) {
$status = 'failed';
last;
}
@@ -179,23 +194,28 @@ sub copy_run_start {
if ( $ciscoconfig->set_config_source_type( 4, $rand ) ) {
print "Using new method, row iid: $rand\n" if $ciscoconfig->debug();
#Check each set, delete created row if any fail
unless ( $ciscoconfig->set_config_dest_type( 3, $rand ) ) {
$ciscoconfig->error_throw("Setting dest type failed");
unless ( $ciscoconfig->set_config_row_status( 6, $rand ) ) {
$ciscoconfig->error_throw("Setting dest type failed and failed to delete row $rand");
$ciscoconfig->error_throw(
"Setting dest type failed and failed to delete row $rand"
);
}
return;
}
unless ( $ciscoconfig->set_config_row_status( 1, $rand ) ) {
$ciscoconfig->error_throw("Initiating save failed");
unless ( $ciscoconfig->set_config_row_status( 6, $rand ) ) {
$ciscoconfig->error_throw("Initiating save failed and failed to delete row $rand");
$ciscoconfig->error_throw(
"Initiating save failed and failed to delete row $rand");
}
return;
}
my $status = 0;
my $timer = 0;
# Hard-coded timeout of approximately 5 minutes, we can wrap this in an
# option later if needed
my $timeout = 300;
@@ -204,7 +224,7 @@ sub copy_run_start {
$status = $t->{$rand};
last if $status =~ /successful|failed/;
$timer += 1;
if ($timer >= $timeout) {
if ( $timer >= $timeout ) {
$status = 'failed';
last;
}
@@ -227,7 +247,7 @@ sub copy_run_start {
}
print "Using old method\n" if $ciscoconfig->debug();
unless ( $ciscoconfig->set_old_write_mem( 1 ) ) {
unless ( $ciscoconfig->set_old_write_mem(1) ) {
$ciscoconfig->error_throw("Save operation failed");
return;
}
@@ -408,9 +428,10 @@ Table of Flash copy operation entries.
=head1 SET METHODS
These are methods that provide SNMP set functionality for overridden methods or
provide a simpler interface to complex set operations. See
L<SNMP::Info/"SETTING DATA VIA SNMP"> for general information on set operations.
These are methods that provide SNMP set functionality for overridden methods
or provide a simpler interface to complex set operations. See
L<SNMP::Info/"SETTING DATA VIA SNMP"> for general information on set
operations.
=over
@@ -420,9 +441,9 @@ Store the running configuration on a TFTP server. Equivalent to the CLI
commands "copy running-config tftp" or "write net".
This method attempts to use newer "copy running-config tftp" procedure first
and then the older "write net" procedure if that fails. The newer procedure is
supported Cisco devices with the F<CISCO-CONFIG-COPY-MIB> available, Cisco IOS
software release 12.0 or on some devices as early as release 11.2P. The
and then the older "write net" procedure if that fails. The newer procedure
is supported Cisco devices with the F<CISCO-CONFIG-COPY-MIB> available, Cisco
IOS software release 12.0 or on some devices as early as release 11.2P. The
older procedure has been depreciated by Cisco and is utilized only to support
devices running older code revisions.
@@ -436,11 +457,12 @@ Copy the running configuration to the start up configuration. Equivalent to
the CLI command C<"copy running-config startup-config"> or C<"write mem">.
This method attempts to use newer C<"copy running-config startup-config">
procedure first and then the older C<"write mem"> procedure if that fails. The
newer procedure is supported Cisco devices with the F<CISCO-CONFIG-COPY-MIB>
available, Cisco IOS software release 12.0 or on some devices as early as
release 11.2P. The older procedure has been depreciated by Cisco and is
utilized only to support devices running older code revisions.
procedure first and then the older C<"write mem"> procedure if that fails.
The newer procedure is supported Cisco devices with the
F<CISCO-CONFIG-COPY-MIB> available, Cisco IOS software release 12.0 or on
some devices as early as release 11.2P. The older procedure has been
depreciated by Cisco and is utilized only to support devices running older
code revisions.
Example:
$ciscoconfig->copy_run_start()

View File

@@ -1,4 +1,3 @@
package SNMP::Info::CiscoImage;
# $Id$
#
# Copyright (c) 2005 Matt Tuttle
@@ -28,6 +27,8 @@ package SNMP::Info::CiscoImage;
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::CiscoImage;
use strict;
use Exporter;
use SNMP::Info;
@@ -39,19 +40,13 @@ use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
'CISCO-IMAGE-MIB' => 'ciscoImageString',
);
%MIBS = ( 'CISCO-IMAGE-MIB' => 'ciscoImageString', );
%GLOBALS = (
);
%GLOBALS = ();
%FUNCS = (
'ci_images' => 'ciscoImageString',
);
%FUNCS = ( 'ci_images' => 'ciscoImageString', );
%MUNGE = (
);
%MUNGE = ();
1;
__END__

View File

@@ -44,9 +44,10 @@ $VERSION = '1.09';
'CISCO-PORT-SECURITY-MIB' => 'ciscoPortSecurityMIB',
'CISCO-PAE-MIB' => 'ciscoPaeMIB',
'IEEE8021-PAE-MIB' => 'dot1xAuthLastEapolFrameSource',
);
);
%GLOBALS = (
# CISCO-PORT-SECURITY-MIB
'cps_clear' => 'cpsGlobalClearSecureMacAddresses',
'cps_notify' => 'cpsGlobalSNMPNotifControl',
@@ -54,9 +55,10 @@ $VERSION = '1.09';
'cps_enable' => 'cpsGlobalPortSecurityEnable',
'cps_mac_count' => 'cpsGlobalTotalSecureAddress',
'cps_mac_max' => 'cpsGlobalMaxSecureAddress',
);
);
%FUNCS = (
# CISCO-PORT-SECURITY-MIB::cpsIfConfigTable
'cps_i_limit_val' => 'cpsIfInvalidSrcRateLimitValue',
'cps_i_limit' => 'cpsIfInvalidSrcRateLimitEnable',
@@ -75,25 +77,29 @@ $VERSION = '1.09';
'cps_i_mac_max' => 'cpsIfMaxSecureMacAddr',
'cps_i_status' => 'cpsIfPortSecurityStatus',
'cps_i_enable' => 'cpsIfPortSecurityEnable',
# CISCO-PORT-SECURITY-MIB::cpsIfVlanTable
'cps_i_v_mac_count' => 'cpsIfVlanCurSecureMacAddrCount',
'cps_i_v_mac_max' => 'cpsIfVlanMaxSecureMacAddr',
'cps_i_v' => 'cpsIfVlanIndex',
# CISCO-PORT-SECURITY-MIB::cpsIfVlanSecureMacAddrTable
'cps_i_v_mac_status' => 'cpsIfVlanSecureMacAddrRowStatus',
'cps_i_v_mac_age' => 'cpsIfVlanSecureMacAddrRemainAge',
'cps_i_v_mac_type' => 'cpsIfVlanSecureMacAddrType',
'cps_i_v_vlan' => 'cpsIfVlanSecureVlanIndex',
'cps_i_v_mac' => 'cpsIfVlanSecureMacAddress',
# CISCO-PORT-SECURITY-MIB::cpsSecureMacAddressTable
'cps_m_status' => 'cpsSecureMacAddrRowStatus',
'cps_m_age' => 'cpsSecureMacAddrRemainingAge',
'cps_m_type' => 'cpsSecureMacAddrType',
'cps_m_mac' => 'cpsSecureMacAddress',
# IEEE8021-PAE-MIB::dot1xPaePortEntry
'pae_i_capabilities' => 'dot1xPaePortCapabilities',
'pae_i_last_eapol_frame_source' => 'dot1xAuthLastEapolFrameSource',
);
);
%MUNGE = (
'cps_i_mac' => \&SNMP::Info::munge_mac,
@@ -101,17 +107,20 @@ $VERSION = '1.09';
'cps_i_v_mac' => \&SNMP::Info::munge_mac,
'pae_i_last_eapol_frame_source' => \&SNMP::Info::munge_mac,
'pae_i_capabilities' => \&munge_pae_capabilities,
);
);
%PAECAPABILITIES = (0 => 'dot1xPaePortAuthCapable',
1 => 'dot1xPaePortSuppCapable');
%PAECAPABILITIES = (
0 => 'dot1xPaePortAuthCapable',
1 => 'dot1xPaePortSuppCapable'
);
sub munge_pae_capabilities {
my $bits = shift;
return unless defined $bits;
my @vals = map($PAECAPABILITIES{$_},sprintf("%x",unpack('b*',$bits)));
return join(' ',@vals);
my @vals
= map( $PAECAPABILITIES{$_}, sprintf( "%x", unpack( 'b*', $bits ) ) );
return join( ' ', @vals );
}
1;

View File

@@ -41,17 +41,13 @@ use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/;
$VERSION = '1.09';
%MIBS = ('CISCO-POWER-ETHERNET-EXT-MIB' => 'cpeExtPsePortEntPhyIndex');
%MIBS = ( 'CISCO-POWER-ETHERNET-EXT-MIB' => 'cpeExtPsePortEntPhyIndex' );
%GLOBALS = (
);
%GLOBALS = ();
%FUNCS = (
'cpeth_ent_phy' => 'cpeExtPsePortEntPhyIndex',
);
%FUNCS = ( 'cpeth_ent_phy' => 'cpeExtPsePortEntPhyIndex', );
%MUNGE = (
);
%MUNGE = ();
# Cisco overcame the limitation of the module.port index of the
# pethPsePortTable by adding another mapping table, which maps
@@ -65,9 +61,9 @@ sub peth_port_ifindex {
my $e_port = $cpeth->e_port();
my $peth_port_ifindex = {};
foreach my $i (keys %$ent_phy) {
if ($e_port->{$ent_phy->{$i}}) {
$peth_port_ifindex->{$i} = $e_port->{$ent_phy->{$i}};
foreach my $i ( keys %$ent_phy ) {
if ( $e_port->{ $ent_phy->{$i} } ) {
$peth_port_ifindex->{$i} = $e_port->{ $ent_phy->{$i} };
}
}
return $peth_port_ifindex;
@@ -111,7 +107,8 @@ contains.
Create or use a device subclass that inherit this class. Do not use directly.
For debugging purposes you can call this class directly as you would SNMP::Info
For debugging purposes you can call this class directly as you would
SNMP::Info
my $poe = new SNMP::Info::CiscoPower (...);

View File

@@ -41,36 +41,37 @@ use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
'CISCO-CLASS-BASED-QOS-MIB' => 'cbQosIfIndex',
);
%MIBS = ( 'CISCO-CLASS-BASED-QOS-MIB' => 'cbQosIfIndex', );
%GLOBALS = (
);
%GLOBALS = ();
%FUNCS = (
# CISCO-CLASS-BASED-QOS-MIB::cbQosServicePolicyTable
'qos_i_index' => 'cbQosIfIndex',
'qos_i_type' => 'cbQosIfType',
'qos_pol_direction' => 'cbQosPolicyDirection',
# CISCO-CLASS-BASED-QOS-MIB::cbQosObjectsTable
'qos_obj_conf_index' => 'cbQosConfigIndex',
'qos_obj_type' => 'cbQosObjectsType',
'qos_obj_parent' => 'cbQosParentObjectsIndex',
# CISCO-CLASS-BASED-QOS-MIB::cbQosCMCfgTable
'qos_cm_name' => 'cbQosCMName',
'qos_cm_desc' => 'cbQosCMDesc',
'qos_cm_info' => 'cbQosCMInfo',
# CISCO-CLASS-BASED-QOS-MIB::cbQosCMStatsTable
'qos_octet_pre' => 'cbQosCMPrePolicyByte',
'qos_octet_post' => 'cbQosCMPostPolicyByte',
# CISCO-CLASS-BASED-QOS-MIB::cbQosQueueingCfgTable
'qos_queueingcfg_bw' => 'cbQosQueueingCfgBandwidth',
'qos_queueingcfg_bw_units' => 'cbQosQueueingCfgBandwidthUnits',
);
);
%MUNGE = (
);
%MUNGE = ();
1;
__END__

View File

@@ -41,21 +41,18 @@ use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
'CISCO-RTTMON-MIB' => 'rttMonCtrlAdminOwner',
);
%MIBS = ( 'CISCO-RTTMON-MIB' => 'rttMonCtrlAdminOwner', );
%GLOBALS = (
);
%GLOBALS = ();
%FUNCS = (
# CISCO-RTTMON-MIB
'rtt_desc' => 'rttMonCtrlAdminOwner',
'rtt_last' => 'rttMonLatestRttOperCompletionTime',
);
);
%MUNGE = (
);
%MUNGE = ();
1;
__END__

View File

@@ -41,9 +41,7 @@ use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE %PORTSTAT/;
$VERSION = '1.09';
%MIBS = (
'CISCO-STACK-MIB' => 'ciscoStackMIB',
);
%MIBS = ( 'CISCO-STACK-MIB' => 'ciscoStackMIB', );
%GLOBALS = (
'sysip' => 'sysIpAddr',
@@ -58,9 +56,10 @@ $VERSION = '1.09';
'ps2_status' => 'chassisPs2Status',
'slots' => 'chassisNumSlots',
'fan' => 'chassisFanStatus',
);
);
%FUNCS = (
# CISCO-STACK-MIB::moduleEntry
# These are blades in a catalyst device
'm_type' => 'moduleType',
@@ -73,10 +72,12 @@ $VERSION = '1.09';
'm_hwver' => 'moduleHwVersion',
'm_fwver' => 'moduleFwVersion',
'm_swver' => 'moduleSwVersion',
# Router Blades :
'm_ip' => 'moduleIPAddress',
'm_sub1' => 'moduleSubType',
'm_sub2' => 'moduleSubType2',
# CISCO-STACK-MIB::portEntry
'p_name' => 'portName',
'p_type' => 'portType',
@@ -90,27 +91,30 @@ $VERSION = '1.09';
'p_rx_flow_control_admin' => 'portAdminRxFlowControl',
'p_tx_flow_control_admin' => 'portAdminTxFlowControl',
'p_oidx' => 'portCrossIndex',
# CISCO-STACK-MIB::PortCpbEntry
'p_speed_admin' => 'portCpbSpeed',
'p_duplex_admin' => 'portCpbDuplex',
);
);
%MUNGE = (
'm_ports_status' => \&munge_port_status,
'p_duplex_admin' => \&SNMP::Info::munge_bits,
);
);
%PORTSTAT = (1 => 'other',
%PORTSTAT = (
1 => 'other',
2 => 'ok',
3 => 'minorFault',
4 => 'majorFault');
4 => 'majorFault'
);
# Changes binary byte describing each port into ascii, and returns
# an ascii list separated by spaces.
sub munge_port_status {
my $status = shift;
my @vals = map($PORTSTAT{$_},unpack('C*',$status));
return join(' ',@vals);
my @vals = map( $PORTSTAT{$_}, unpack( 'C*', $status ) );
return join( ' ', @vals );
}
sub serial {
@@ -149,16 +153,18 @@ sub i_duplex {
my $p_duplex_cap = $stack->p_duplex_admin() || {};
my $i_duplex = {};
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$/ );
# Test for gigabit
if ($p_duplex_cap->{$port} == 0) {
if ( $p_duplex_cap->{$port} == 0 ) {
$i_duplex->{$iid} = 'full';
}
# Auto is not a valid operational state
elsif ($p_duplex->{$port} eq 'auto') {
elsif ( $p_duplex->{$port} eq 'auto' ) {
next;
}
else {
@@ -182,16 +188,18 @@ sub i_duplex_admin {
my $p_speed = $stack->p_speed() || {};
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$/ );
# Test for gigabit
if ($p_duplex_cap->{$port} == 0) {
if ( $p_duplex_cap->{$port} == 0 ) {
$i_duplex_admin->{$iid} = 'full';
}
# Check admin speed for auto
elsif ($p_speed->{$port} =~ /auto/) {
elsif ( $p_speed->{$port} =~ /auto/ ) {
$i_duplex_admin->{$iid} = 'auto';
}
else {
@@ -208,9 +216,10 @@ sub i_speed_admin {
my %i_speed_admin;
my $p_port = $stack->p_port();
my %mapping = reverse %$p_port;
my $p_speed = $stack->p_speed($mapping{$partial});
my $p_speed = $stack->p_speed( $mapping{$partial} );
my %speeds = ('autoDetect' => 'auto',
my %speeds = (
'autoDetect' => 'auto',
'autoDetect10100' => 'auto',
's10000000' => '10 Mbps',
's100000000' => '100 Mbps',
@@ -218,17 +227,19 @@ sub i_speed_admin {
's10G' => '10 Gbps',
);
%i_speed_admin = map { $p_port->{$_} => $speeds{$p_speed->{$_}} } keys %$p_port;
%i_speed_admin
= map { $p_port->{$_} => $speeds{ $p_speed->{$_} } } keys %$p_port;
return \%i_speed_admin;
}
sub set_i_speed_admin {
# map speeds to those the switch will understand
my %speeds = qw/auto 1 10 10000000 100 100000000 1000 1000000000/;
my $stack = shift;
my ($speed, $iid) = @_;
my ( $speed, $iid ) = @_;
my $p_port = $stack->p_port() || {};
my %reverse_p_port = reverse %$p_port;
@@ -238,20 +249,23 @@ sub set_i_speed_admin {
$iid = $reverse_p_port{$iid};
return $stack->set_p_speed ($speeds{$speed}, $iid);
return $stack->set_p_speed( $speeds{$speed}, $iid );
}
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 $stack = shift;
my ($duplex, $iid) = @_;
if ($duplex eq 'auto') {
$stack->error_throw("Software doesn't support setting auto duplex with
my ( $duplex, $iid ) = @_;
if ( $duplex eq 'auto' ) {
$stack->error_throw(
"Software doesn't support setting auto duplex with
set_i_duplex_admin() you must use
set_i_speed_admin() and set both speed and duplex
to auto");
to auto"
);
return 0;
}
@@ -264,7 +278,7 @@ sub set_i_duplex_admin {
$iid = $reverse_p_port{$iid};
return $stack->set_p_duplex($duplexes{$duplex}, $iid);
return $stack->set_p_duplex( $duplexes{$duplex}, $iid );
}
1;
@@ -553,9 +567,9 @@ To see the status of port 4 :
Can be either C<on> C<off> or C<disagree>
"Indicates the receive flow control operational status of the port. If the port
could not agree with the far end on a link protocol, its operational status
will be disagree(3)."
"Indicates the receive flow control operational status of the port. If the
port could not agree with the far end on a link protocol, its operational
status will be disagree(3)."
C<portOperRxFlowControl>
@@ -576,8 +590,8 @@ Can be either C<on> C<off> or C<desired>
"Indicates the receive flow control administrative status set on the port. If
the status is set to on(1), the port will require the far end to send flow
control. If the status is set to off(2), the port will not allow far end to
send flow control. If the status is set to desired(3), the port will allow the
far end to send the flow control."
send flow control. If the status is set to desired(3), the port will allow
the far end to send the flow control."
C<portAdminRxFlowControl>
@@ -585,11 +599,11 @@ C<portAdminRxFlowControl>
Can be either C<on> C<off> or C<desired>
"Indicates the transmit flow control administrative status set on the port. If
the status is set to on(1), the port will send flow control to the far end. If
"Indicates the transmit flow control administrative status set on the port.
If the status is set to on(1), the port will send flow control to the far end. If
the status is set to off(2), the port will not send flow control to the far
end. If the status is set to desired(3), the port will send flow control to the
far end if the far end supports it."
end. If the status is set to desired(3), the port will send flow control to
the far end if the far end supports it."
C<portAdminTxFlowControl>

View File

@@ -50,46 +50,52 @@ $VERSION = '1.09';
'CISCO-MEMORY-POOL-MIB' => 'ciscoMemoryPoolUsed',
'OLD-CISCO-SYSTEM-MIB' => 'writeMem',
'CISCO-PRODUCTS-MIB' => 'sysName',
# some older catalysts live here
'CISCO-STACK-MIB' => 'wsc1900sysID',
'CISCO-ENTITY-VENDORTYPE-OID-MIB' => 'cevChassis',
'CISCO-FLASH-MIB' => 'ciscoFlashDeviceSize',
);
);
%GLOBALS = (
'description' => 'sysDescr',
# We will use the numeric OID's so that we don't require people
# to install v1 MIBs, which can conflict.
# OLD-CISCO-CPU-MIB:avgBusyPer
'ios_cpu' => '1.3.6.1.4.1.9.2.1.56.0',
'ios_cpu_1min' => '1.3.6.1.4.1.9.2.1.57.0',
'ios_cpu_5min' => '1.3.6.1.4.1.9.2.1.58.0',
# CISCO-PROCESS-MIB
'cat_cpu' => 'cpmCPUTotal5sec.9',
'cat_cpu_1min' => 'cpmCPUTotal1min.9',
'cat_cpu_5min' => 'cpmCPUTotal5min.9',
# OLD-CISCO-SYSTEM-MIB
'write_mem' => 'writeMem',
);
);
%FUNCS = (
# CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolTable
'cisco_mem_free' => 'ciscoMemoryPoolFree',
'cisco_mem_used' => 'ciscoMemoryPoolUsed',
# CISCO-FLASH-MIB::ciscoFlashDeviceTable
'cisco_flash_size' => 'ciscoFlashDeviceSize',
);
);
%MUNGE = (
);
%MUNGE = ();
sub os {
my $l2 = shift;
my $descr = $l2->description() || '';
# order here matters - there are Catalysts that run IOS and have catalyst in their description field.
return 'ios' if ($descr =~ /IOS/);
return 'catalyst' if ($descr =~ /catalyst/i);
# order here matters - there are Catalysts that run IOS and have catalyst
# in their description field.
return 'ios' if ( $descr =~ /IOS/ );
return 'catalyst' if ( $descr =~ /catalyst/i );
return;
}
@@ -99,12 +105,18 @@ sub os_ver {
my $descr = $l2->description();
# Older Catalysts
if (defined $os and $os eq 'catalyst' and defined $descr and $descr =~ m/V(\d{1}\.\d{2}\.\d{2})/){
if ( defined $os
and $os eq 'catalyst'
and defined $descr
and $descr =~ m/V(\d{1}\.\d{2}\.\d{2})/ )
{
return $1;
}
# Newer Catalysts and IOS devices
if (defined $descr and $descr =~ m/Version (\d+\.\d+\([^)]+\)[^,\s]*)(,|\s)+/ ){
if ( defined $descr
and $descr =~ m/Version (\d+\.\d+\([^)]+\)[^,\s]*)(,|\s)+/ )
{
return $1;
}
return;
@@ -141,7 +153,7 @@ sub mem_free {
my $cisco_mem_free = $self->cisco_mem_free() || {};
foreach my $mem_free_val (values %$cisco_mem_free) {
foreach my $mem_free_val ( values %$cisco_mem_free ) {
$mem_free += $mem_free_val;
}
@@ -155,7 +167,7 @@ sub mem_used {
my $cisco_mem_used = $self->cisco_mem_used() || {};
foreach my $mem_used_val (values %$cisco_mem_used) {
foreach my $mem_used_val ( values %$cisco_mem_used ) {
$mem_used += $mem_used_val;
}
@@ -170,10 +182,10 @@ sub mem_total {
my $cisco_mem_free = $self->cisco_mem_free() || {};
my $cisco_mem_used = $self->cisco_mem_used() || {};
foreach my $mem_entry (keys %$cisco_mem_free){
foreach my $mem_entry ( keys %$cisco_mem_free ) {
my $mem_free = $cisco_mem_free->{$mem_entry} || 0;
my $mem_used = $cisco_mem_used->{$mem_entry} || 0;
$mem_total += ($mem_free + $mem_used);
$mem_total += ( $mem_free + $mem_used );
}
return $mem_total;
}
@@ -185,7 +197,7 @@ sub flashmem_total {
my $flash_sizes = $self->cisco_flash_size;
foreach my $flash_index (keys %$flash_sizes) {
foreach my $flash_index ( keys %$flash_sizes ) {
$flashmem_total += $flash_sizes->{$flash_index};
}
@@ -197,7 +209,8 @@ __END__
=head1 NAME
SNMP::Info::CiscoStats - Perl5 Interface to CPU and Memory stats for Cisco Devices
SNMP::Info::CiscoStats - Perl5 Interface to CPU and Memory stats for Cisco
Devices
=head1 AUTHOR
@@ -221,8 +234,8 @@ Max Baker
=head1 DESCRIPTION
SNMP::Info::CiscoStats is a subclass of SNMP::Info that provides cpu, memory, os and
version information about Cisco Devices.
SNMP::Info::CiscoStats is a subclass of SNMP::Info that provides cpu, memory,
os and version information about Cisco Devices.
Use or create in a subclass of SNMP::Info. Do not use directly.

View File

@@ -47,7 +47,7 @@ $VERSION = '1.09';
'CISCO-VTP-MIB' => 'vtpVlanName',
'CISCO-VLAN-MEMBERSHIP-MIB' => 'vmMembershipEntry',
'CISCO-VLAN-IFTABLE-RELATIONSHIP-MIB' => 'cviRoutedVlanIfIndex',
);
);
%GLOBALS = (
'vtp_version' => 'vtpVersion',
@@ -56,9 +56,10 @@ $VERSION = '1.09';
'vtp_notify_create' => 'vtpVlanCreatedNotifEnabled',
'vtp_notify_delete' => 'vtpVlanDeletedNotifEnabled',
'vtp_trunk_set_serial' => 'vlanTrunkPortSetSerialNo',
);
);
%FUNCS = (
# CISCO-VTP-MIB::managementDomainTable
'vtp_d_index' => 'managementDomainIndex',
'vtp_d_name' => 'managementDomainName',
@@ -71,6 +72,7 @@ $VERSION = '1.09';
'vtp_d_tftp_path' => 'managementDomainTftpPathname',
'vtp_d_pruning' => 'managementDomainPruningState',
'vtp_d_ver' => 'managementDomainVersionInUse',
# CISCO-VTP-MIB::vtpVlanTable
'v_state' => 'vtpVlanState',
'v_type' => 'vtpVlanType',
@@ -89,6 +91,7 @@ $VERSION = '1.09';
'v_crf' => 'vtpVlanIsCRFBackup',
'v_type_ext' => 'vtpVlanTypeExt',
'v_if' => 'vtpVlanIfIndex',
# CISCO-VLAN-MEMBERSHIP-MIB::vmMembershipTable
'i_vlan_type' => 'vmVlanType',
'i_vlan2' => 'vmVlan',
@@ -97,10 +100,13 @@ $VERSION = '1.09';
'i_vlan_2' => 'vmVlans2k',
'i_vlan_3' => 'vmVlans3k',
'i_vlan_4' => 'vmVlans4k',
# CISCO-VLAN-MEMBERSHIP-MIB::vmVoiceVlanTable
'i_voice_vlan' => 'vmVoiceVlanId',
# CISCO-VLAN-IFTABLE-RELATIONSHIP-MIB
'v_cvi_if' => 'cviRoutedVlanIfIndex',
# CISCO-VTP-MIB::vlanTrunkPortTable
'vtp_trunk_mgmt_dom' => 'vlanTrunkPortManagementDomain',
'vtp_trunk_encaps_t' => 'vlanTrunkPortEncapsulationType',
@@ -115,14 +121,14 @@ $VERSION = '1.09';
'vtp_trunk_dyn_stat' => 'vlanTrunkPortDynamicStatus',
'vtp_trunk_vtp' => 'vlanTrunkPortVtpEnabled',
'vtp_trunk_encaps' => 'vlanTrunkPortEncapsulationOperType',
# TODO Add these tables if someone wants them..
# vtpEditControlTable
# vtpVlanEditTable
# vtpStatsTable
);
);
%MUNGE = (
);
%MUNGE = ();
sub v_index {
my $vtp = shift;
@@ -130,8 +136,8 @@ sub v_index {
my $v_name = $vtp->v_name($partial);
my %v_index;
foreach my $idx (keys %$v_name) {
my ($mgmtdomain, $vlan) = split(/\./, $idx);
foreach my $idx ( keys %$v_name ) {
my ( $mgmtdomain, $vlan ) = split( /\./, $idx );
$v_index{$idx} = $vlan;
}
return \%v_index;
@@ -146,8 +152,9 @@ sub i_vlan {
my $trunk_dyn_stat = $vtp->vtp_trunk_dyn_stat($partial) || {};
my %i_vlans;
# Get access ports
foreach my $port (keys %$i_vlan) {
foreach my $port ( keys %$i_vlan ) {
my $vlan = $i_vlan->{$port};
next unless defined $vlan;
@@ -155,7 +162,7 @@ sub i_vlan {
}
# Get trunk ports
foreach my $port (keys %$port_vlan) {
foreach my $port ( keys %$port_vlan ) {
my $vlan = $port_vlan->{$port};
next unless defined $vlan;
my $stat = $trunk_dyn_stat->{$port};
@@ -173,8 +180,8 @@ sub i_vlan {
# Translate vlan.physical_interface -> iid
# to iid -> vlan
foreach my $i (keys %$v_cvi_if){
my ($vlan,$phys) = split(/\./,$i);
foreach my $i ( keys %$v_cvi_if ) {
my ( $vlan, $phys ) = split( /\./, $i );
my $iid = $v_cvi_if->{$i};
$i_vlans{$iid} = $vlan;
@@ -199,32 +206,32 @@ sub i_vlan_membership {
my $i_vlan_membership = {};
# Get access ports
foreach my $port (keys %$i_vlan) {
foreach my $port ( keys %$i_vlan ) {
my $vlan = $i_vlan->{$port};
next unless defined $vlan;
my $stat = $trunk_dyn_stat->{$port};
if ( defined $stat and $stat =~ /notTrunking/ ) {
push(@{$i_vlan_membership->{$port}}, $vlan);
push( @{ $i_vlan_membership->{$port} }, $vlan );
}
}
# Get trunk ports
my %oper_vlans;
foreach my $iid (keys %$vtp_vlans) {
foreach my $iid ( keys %$vtp_vlans ) {
my $vlan = 0;
my $vtp_dom =0;
my $vtp_dom = 0;
my $state = $vtp_vlans->{$iid};
next unless defined $state;
next if $state !~ /operational/;
if ($iid =~ /(\d+)\.(\d+)/ ) {
if ( $iid =~ /(\d+)\.(\d+)/ ) {
$vtp_dom = $1;
$vlan = $2;
}
$oper_vlans{$vlan}++;
}
foreach my $port (keys %$ports_vlans) {
foreach my $port ( keys %$ports_vlans ) {
my $stat = $trunk_dyn_stat->{$port};
if ( defined $stat and $stat =~ /^trunking/ ) {
my $k = 0;
@@ -232,12 +239,13 @@ sub i_vlan_membership {
my $list2 = $ports_vlans_2k->{$port} || '0';
my $list3 = $ports_vlans_3k->{$port} || '0';
my $list4 = $ports_vlans_4k->{$port} || '0';
foreach my $list ("$list1", "$list2", "$list3", "$list4") {
foreach my $list ( "$list1", "$list2", "$list3", "$list4" ) {
my $offset = 1024 * $k++;
next unless $list;
my $vlanlist = [split(//, unpack("B*", $list))];
foreach my $vlan (keys %oper_vlans) {
push(@{$i_vlan_membership->{$port}}, $vlan) if (@$vlanlist[$vlan-$offset]);
my $vlanlist = [ split( //, unpack( "B*", $list ) ) ];
foreach my $vlan ( keys %oper_vlans ) {
push( @{ $i_vlan_membership->{$port} }, $vlan )
if ( @$vlanlist[ $vlan - $offset ] );
}
}
}
@@ -248,18 +256,22 @@ sub i_vlan_membership {
sub set_i_pvid {
my $vtp = shift;
my ($vlan_id, $ifindex) = @_;
my ( $vlan_id, $ifindex ) = @_;
return unless ( $vtp->_validate_vlan_param ($vlan_id, $ifindex) );
return unless ( $vtp->_validate_vlan_param( $vlan_id, $ifindex ) );
my $native_vlan = $vtp->vtp_trunk_native($ifindex);
if (defined $native_vlan) {
if ( defined $native_vlan ) {
print "Changing native VLAN from $native_vlan->{$ifindex} to $vlan_id on IfIndex: $ifindex\n" if $vtp->debug();
print
"Changing native VLAN from $native_vlan->{$ifindex} to $vlan_id on IfIndex: $ifindex\n"
if $vtp->debug();
my $rv = $vtp->set_vtp_trunk_native($vlan_id, $ifindex);
my $rv = $vtp->set_vtp_trunk_native( $vlan_id, $ifindex );
unless ($rv) {
$vtp->error_throw("Unable to change native VLAN to $vlan_id on IfIndex: $ifindex");
$vtp->error_throw(
"Unable to change native VLAN to $vlan_id on IfIndex: $ifindex"
);
return;
}
return $rv;
@@ -270,18 +282,21 @@ sub set_i_pvid {
sub set_i_vlan {
my $vtp = shift;
my ($vlan_id, $ifindex) = @_;
my ( $vlan_id, $ifindex ) = @_;
return unless ( $vtp->_validate_vlan_param ($vlan_id, $ifindex) );
return unless ( $vtp->_validate_vlan_param( $vlan_id, $ifindex ) );
my $i_vlan = $vtp->i_vlan2($ifindex);
if (defined $i_vlan) {
if ( defined $i_vlan ) {
print "Changing VLAN from $i_vlan->{$ifindex} to $vlan_id on IfIndex: $ifindex\n" if $vtp->debug();
print
"Changing VLAN from $i_vlan->{$ifindex} to $vlan_id on IfIndex: $ifindex\n"
if $vtp->debug();
my $rv = $vtp->set_i_vlan2($vlan_id, $ifindex);
my $rv = $vtp->set_i_vlan2( $vlan_id, $ifindex );
unless ($rv) {
$vtp->error_throw("Unable to change VLAN to $vlan_id on IfIndex: $ifindex");
$vtp->error_throw(
"Unable to change VLAN to $vlan_id on IfIndex: $ifindex");
return;
}
return $rv;
@@ -292,36 +307,44 @@ sub set_i_vlan {
sub set_add_i_vlan_tagged {
my $vtp = shift;
my ($vlan_id, $ifindex) = @_;
my ( $vlan_id, $ifindex ) = @_;
return unless ( $vtp->_validate_vlan_param ($vlan_id, $ifindex) );
return unless ( $vtp->_validate_vlan_param( $vlan_id, $ifindex ) );
print "Adding VLAN: $vlan_id to ifIndex: $ifindex\n" if $vtp->debug();
my $trunk_serial = $vtp->load_vtp_trunk_set_serial();
my $trunk_members = $vtp->vtp_trunk_vlans($ifindex);
unless (defined $trunk_members) {
$vtp->error_throw("Can't find ifIndex: $ifindex - Is it a trunk port?");
unless ( defined $trunk_members ) {
$vtp->error_throw(
"Can't find ifIndex: $ifindex - Is it a trunk port?");
return;
}
my @member_list = split(//, unpack("B*", $trunk_members->{$ifindex}));
my @member_list = split( //, unpack( "B*", $trunk_members->{$ifindex} ) );
print "Original vlan list for ifIndex: $ifindex: @member_list \n" if $vtp->debug();
print "Original vlan list for ifIndex: $ifindex: @member_list \n"
if $vtp->debug();
$member_list[$vlan_id] = '1';
print "Modified vlan list for ifIndex: $ifindex: @member_list \n" if $vtp->debug();
my $new_list = pack("B*", join('', @member_list));
print "Modified vlan list for ifIndex: $ifindex: @member_list \n"
if $vtp->debug();
my $new_list = pack( "B*", join( '', @member_list ) );
#Add VLAN to member list
my $list_rv = $vtp->set_vtp_trunk_vlans($new_list, $ifindex);
my $list_rv = $vtp->set_vtp_trunk_vlans( $new_list, $ifindex );
unless ($list_rv) {
$vtp->error_throw("Unable to add VLAN: $vlan_id to ifIndex: $ifindex member list");
$vtp->error_throw(
"Unable to add VLAN: $vlan_id to ifIndex: $ifindex member list");
return;
}
#Make sure no other SNMP manager was making modifications at the same time.
my $serial_rv = $vtp->set_vtp_trunk_set_serial($trunk_serial);
unless ($serial_rv) {
$vtp->error_throw("Unable to increment trunk set serial number - check configuration!");
$vtp->error_throw(
"Unable to increment trunk set serial number - check configuration!"
);
return;
}
return 1;
@@ -329,36 +352,45 @@ sub set_add_i_vlan_tagged {
sub set_remove_i_vlan_tagged {
my $vtp = shift;
my ($vlan_id, $ifindex) = @_;
my ( $vlan_id, $ifindex ) = @_;
return unless ( $vtp->_validate_vlan_param ($vlan_id, $ifindex) );
return unless ( $vtp->_validate_vlan_param( $vlan_id, $ifindex ) );
print "Removing VLAN: $vlan_id from ifIndex: $ifindex\n" if $vtp->debug();
my $trunk_serial = $vtp->load_vtp_trunk_set_serial();
my $trunk_members = $vtp->vtp_trunk_vlans($ifindex);
unless (defined $trunk_members) {
$vtp->error_throw("Can't find ifIndex: $ifindex - Is it a trunk port?");
unless ( defined $trunk_members ) {
$vtp->error_throw(
"Can't find ifIndex: $ifindex - Is it a trunk port?");
return;
}
my @member_list = split(//, unpack("B*", $trunk_members->{$ifindex}));
my @member_list = split( //, unpack( "B*", $trunk_members->{$ifindex} ) );
print "Original vlan list for ifIndex: $ifindex: @member_list \n" if $vtp->debug();
print "Original vlan list for ifIndex: $ifindex: @member_list \n"
if $vtp->debug();
$member_list[$vlan_id] = '0';
print "Modified vlan list for ifIndex: $ifindex: @member_list \n" if $vtp->debug();
my $new_list = pack("B*", join('', @member_list));
print "Modified vlan list for ifIndex: $ifindex: @member_list \n"
if $vtp->debug();
my $new_list = pack( "B*", join( '', @member_list ) );
#Remove VLAN to member list
my $list_rv = $vtp->set_vtp_trunk_vlans($new_list, $ifindex);
my $list_rv = $vtp->set_vtp_trunk_vlans( $new_list, $ifindex );
unless ($list_rv) {
$vtp->error_throw("Error: Unable to remove VLAN: $vlan_id from ifIndex: $ifindex member list");
$vtp->error_throw(
"Error: Unable to remove VLAN: $vlan_id from ifIndex: $ifindex member list"
);
return;
}
#Make sure no other manager was making modifications at the same time.
my $serial_rv = $vtp->set_vtp_trunk_set_serial($trunk_serial);
unless ($serial_rv) {
$vtp->error_throw("Error: Unable to increment trunk set serial number - check configuration!");
$vtp->error_throw(
"Error: Unable to increment trunk set serial number - check configuration!"
);
return;
}
return 1;
@@ -369,10 +401,14 @@ sub set_remove_i_vlan_tagged {
#
sub _validate_vlan_param {
my $vtp = shift;
my ($vlan_id, $ifindex) = @_;
my ( $vlan_id, $ifindex ) = @_;
# VID and ifIndex should both be numeric
unless ( defined $vlan_id and defined $ifindex and $vlan_id =~ /^\d+$/ and $ifindex =~ /^\d+$/ ) {
unless (defined $vlan_id
and defined $ifindex
and $vlan_id =~ /^\d+$/
and $ifindex =~ /^\d+$/ )
{
$vtp->error_throw("Invalid parameter");
return;
}
@@ -389,21 +425,22 @@ sub _validate_vlan_param {
my $vtp_vlans = $vtp->v_state();
my $vlan_exists = 0;
foreach my $iid (keys %$vtp_vlans) {
foreach my $iid ( keys %$vtp_vlans ) {
my $vlan = 0;
my $vtp_dom =0;
my $vtp_dom = 0;
my $state = $vtp_vlans->{$iid};
next unless defined $state;
next if $state !~ /operational/;
if ($iid =~ /(\d+)\.(\d+)/ ) {
if ( $iid =~ /(\d+)\.(\d+)/ ) {
$vtp_dom = $1;
$vlan = $2;
}
$vlan_exists = 1 if ( $vlan_id eq $vlan );
}
unless ( $vlan_exists ) {
$vtp->error_throw("VLAN $vlan_id does not exist or is not operational");
unless ($vlan_exists) {
$vtp->error_throw(
"VLAN $vlan_id does not exist or is not operational");
return;
}
@@ -769,9 +806,10 @@ Each bit represents a VLAN. This is 3072 through 4095
=head1 SET METHODS
These are methods that provide SNMP set functionality for overridden methods or
provide a simpler interface to complex set operations. See
L<SNMP::Info/"SETTING DATA VIA SNMP"> for general information on set operations.
These are methods that provide SNMP set functionality for overridden methods
or provide a simpler interface to complex set operations. See
L<SNMP::Info/"SETTING DATA VIA SNMP"> for general information on set
operations.
=over

View File

@@ -43,10 +43,9 @@ use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/;
$VERSION = '1.09';
%MIBS = ('ENTITY-MIB' => 'entPhysicalSerialNum');
%MIBS = ( 'ENTITY-MIB' => 'entPhysicalSerialNum' );
%GLOBALS = (
);
%GLOBALS = ();
%FUNCS = (
'e_alias' => 'entPhysicalAlias',
@@ -65,11 +64,9 @@ $VERSION = '1.09';
'e_swver' => 'entPhysicalSoftwareRev',
'e_type' => 'entPhysicalVendorType',
'e_vendor' => 'entPhysicalMfgName',
);
);
%MUNGE = (
'e_type' => \&SNMP::Info::munge_e_type,
);
%MUNGE = ( 'e_type' => \&SNMP::Info::munge_e_type, );
# entPhysicalIndex is not-accessible. Create to facilitate emulation methods
# in other classes
@@ -85,7 +82,7 @@ sub e_index {
my %e_index;
foreach my $iid (keys %$e_descr) {
foreach my $iid ( keys %$e_descr ) {
$e_index{$iid} = $iid;
}
return \%e_index;
@@ -99,7 +96,7 @@ sub e_port {
my %e_port;
foreach my $e_id (keys %$e_map) {
foreach my $e_id ( keys %$e_map ) {
my $id = $e_id;
$id =~ s/\.0$//;

View File

@@ -43,13 +43,12 @@ use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
'ETHERLIKE-MIB' => 'etherMIB'
);
%MIBS = ( 'ETHERLIKE-MIB' => 'etherMIB' );
%GLOBALS = ();
%FUNCS = (
# EtherLike StatsTable
'el_chipset' => 'dot3StatsEtherChipSet',
'el_coll_excess' => 'dot3StatsExcessiveCollisions',
@@ -67,15 +66,13 @@ $VERSION = '1.09';
'el_error_symbol' => 'dot3StatsSymbolErrors',
'el_index' => 'dot3StatsIndex',
'el_xmit_defer' => 'dot3StatsDeferredTransmissions',
# Ethernet-like Collision Statistics Group
'el_coll_count' => 'dot3CollCount',
'el_coll_freq' => 'dot3CollFrequencies'
);
);
%MUNGE = (
%SNMP::Info::MUNGE,
'el_duplex' => \&munge_el_duplex,
);
%MUNGE = ( %SNMP::Info::MUNGE, 'el_duplex' => \&munge_el_duplex, );
sub munge_el_duplex {
my $duplex = shift;
@@ -85,7 +82,6 @@ sub munge_el_duplex {
return $duplex;
}
1;
__END__
@@ -111,7 +107,8 @@ Max Baker
my $class = $cdp->class();
print " Using device sub class : $class\n";
# Find the duplex setting for a port on a device that implements ETHERLIKE-MIB
# Find the duplex setting for a port on a device that implements
# ETHERLIKE-MIB
my $interfaces = $el->interfaces();
my $el_index = $el->el_index();
my $el_duplex = $el->el_duplex();

View File

@@ -44,21 +44,21 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
'FOUNDRY-SN-SWITCH-GROUP-MIB' => 'snFdpGlobalRun'
);
%MIBS = ( 'FOUNDRY-SN-SWITCH-GROUP-MIB' => 'snFdpGlobalRun' );
%GLOBALS = (
# CDP-Compatibility
'cdp_interval' => 'snFdpGlobalMessageInterval',
'cdp_holdtime' => 'snFdpGlobalHoldTime',
'cdp_id' => 'snFdpGlobalDeviceId',
#
'fdp_run' => 'snFdpGlobalRun',
'fdp_interval' => 'snFdpGlobalMessageInterval',
'fdp_holdtime' => 'snFdpGlobalHoldTime',
'fdp_id' => 'snFdpGlobalDeviceId',
);
);
%FUNCS = (
'c_index' => 'snFdpCacheIfIndex',
@@ -72,13 +72,12 @@ $VERSION = '1.09';
'c_domain' => 'snFdpCacheVTPMgmtDomain',
'c_vlan' => 'snFdpCacheNativeVLAN',
'c_duplex' => 'snFdpCacheDuplex',
);
);
%MUNGE = (
'c_capabilities' => \&SNMP::Info::munge_caps,
'c_ip' => \&SNMP::Info::munge_ip
);
);
sub cdp_run {
my $fdp = shift;
@@ -93,13 +92,15 @@ sub hasFDP {
my $fdp = shift;
my $ver = $fdp->{_version};
#my $ver = $fdp->fdp_ver;
# SNMP v1 clients dont have the globals
if (defined $ver and $ver == 1){
if ( defined $ver and $ver == 1 ) {
my $fdp_ip = $fdp->fdp_ip();
# See if anything in fdp cache, if so we have fdp
return 1 if (defined $fdp_ip and scalar(keys %$fdp_ip)) ;
return 1 if ( defined $fdp_ip and scalar( keys %$fdp_ip ) );
return;
}
@@ -115,15 +116,18 @@ sub c_if {
# Nope, didn't think so. Now we fake it.
my $fdp_ip = $fdp->c_ip();
unless (defined $fdp_ip){
$fdp->error_throw("SNMP::Info::FDP:fdp_if() - Device doesn't have fdp_ip() data. Can't fake fdp_index()");
unless ( defined $fdp_ip ) {
$fdp->error_throw(
"SNMP::Info::FDP:fdp_if() - Device doesn't have fdp_ip() data. Can't fake fdp_index()"
);
return;
}
my %fdp_if;
foreach my $key (keys %$fdp_ip){
foreach my $key ( keys %$fdp_ip ) {
next unless defined $key;
my $iid = $key;
# Truncate .1 from fdp cache entry
$iid =~ s/\.\d+$//;
$fdp_if{$key} = $iid;

View File

@@ -40,32 +40,36 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
'IEEE802dot11-MIB' => 'dot11DesiredSSID',
);
%MIBS = ( 'IEEE802dot11-MIB' => 'dot11DesiredSSID', );
%GLOBALS = (
);
%GLOBALS = ();
%FUNCS = (
# dot11PhyOFDMTable
'dot11_cur_freq' => 'dot11CurrentFrequency',
# dot11PhyDSSSTable
'dot11_cur_ch' => 'dot11CurrentChannel',
# dot11PhyOperationTable
'dot11_phy_type' => 'dot11PHYType',
'dot11_reg_dom' => 'dot11CurrentRegDomain',
# dot11ResourceInfoTable
'dot11_prod_ver' => 'dot11manufacturerProductVersion',
'dot11_prod_name' => 'dot11manufacturerProductName',
'dot11_man_name' => 'dot11manufacturerName',
# dot11OperationTable
'dot11_mac' => 'dot11MACAddress',
# dot11StationConfigTable
'dot11_bss_type' => 'dot11DesiredBSSType',
'i_ssidlist' => 'dot11DesiredSSID',
'dot11_pwr_mode' => 'dot11PowerManagementMode',
'dot11_sta_id' => 'dot11StationID',
# dot11PhyTxPowerTable
'dot11_cur_tx_pwr' => 'dot11CurrentTxPowerLevel',
'dot11_tx_pwr_level_1' => 'dot11TxPowerLevel1',
@@ -76,19 +80,19 @@ $VERSION = '1.09';
'dot11_tx_pwr_level_6' => 'dot11TxPowerLevel6',
'dot11_tx_pwr_level_7' => 'dot11TxPowerLevel7',
'dot11_tx_pwr_level_8' => 'dot11TxPowerLevel8',
);
);
%MUNGE = (
'dot11_mac' => \&SNMP::Info::munge_mac,
'dot11_sta_id' => \&SNMP::Info::munge_mac,
);
);
sub vendor {
my $dot11 = shift;
my $names = $dot11->dot11_man_name();
foreach my $iid (keys %$names){
foreach my $iid ( keys %$names ) {
my $vendor = $names->{$iid};
next unless defined $vendor;
if ( $vendor =~ /^(\S+)/ ) {
@@ -104,7 +108,7 @@ sub model {
my $names = $dot11->dot11_prod_name();
foreach my $iid (keys %$names){
foreach my $iid ( keys %$names ) {
my $prod = $names->{$iid};
next unless defined $prod;
return lc($prod);
@@ -117,7 +121,7 @@ sub os_ver {
my $versions = $dot11->dot11_prod_ver();
foreach my $iid (keys %$versions){
foreach my $iid ( keys %$versions ) {
my $ver = $versions->{$iid};
next unless defined $ver;
if ( $ver =~ /([\d\.]+)/ ) {
@@ -136,15 +140,15 @@ sub i_80211channel {
my $cur_ch = $dot11->dot11_cur_ch() || {};
my %i_80211channel;
foreach my $iid (keys %$phy_type){
foreach my $iid ( keys %$phy_type ) {
my $type = $phy_type->{$iid};
next unless defined $type;
if ($type =~ /dsss/) {
if ( $type =~ /dsss/ ) {
my $ch = $cur_ch->{$iid};
next unless defined $ch;
$i_80211channel{$iid} = $ch;
}
elsif ($type =~ /ofdm/) {
elsif ( $type =~ /ofdm/ ) {
my $ch = $cur_freq->{$iid};
next unless defined $ch;
$i_80211channel{$iid} = $ch;
@@ -162,13 +166,16 @@ sub dot11_cur_tx_pwr_mw {
my $partial = shift;
my $cur = $dot11->dot11_cur_tx_pwr($partial);
my $dot11_cur_tx_pwr_mw = {};
foreach my $idx (keys %$cur) {
foreach my $idx ( keys %$cur ) {
my $pwr = $cur->{$idx};
if ($pwr >= 1 && $pwr <= 8) {
if ( $pwr >= 1 && $pwr <= 8 ) {
# ToDo - Look at string eval
my $mw = eval "\$dot11->dot11_tx_pwr_level_$pwr(\$idx)"; ## no critic
my $mw
= eval "\$dot11->dot11_tx_pwr_level_$pwr(\$idx)"; ## no critic
$dot11_cur_tx_pwr_mw->{$idx} = $mw->{$idx};
} else {
}
else {
next;
}
}
@@ -204,9 +211,9 @@ Eric Miller
=head1 DESCRIPTION
SNMP::Info::IEEE802dot11 is a subclass of SNMP::Info that provides an interface
to F<IEEE802dot11-MIB>. This MIB is used in standards based 802.11 wireless
devices.
SNMP::Info::IEEE802dot11 is a subclass of SNMP::Info that provides an
interface to F<IEEE802dot11-MIB>. This MIB is used in standards based
802.11 wireless devices.
Use or create a subclass of SNMP::Info that inherits this one.
Do not use directly.
@@ -270,8 +277,8 @@ interface.
=item $dot11->dot11_cur_tx_pwr_mw()
Returns reference to hash. Current transmit power, in milliwatts, of the radio
interface.
Returns reference to hash. Current transmit power, in milliwatts, of the
radio interface.
=back

View File

@@ -45,17 +45,19 @@ $VERSION = '1.09';
'LLDP-MIB' => 'lldpLocSysCapEnabled',
'LLDP-EXT-DOT1-MIB' => 'lldpXdot1MIB',
'LLDP-EXT-DOT3-MIB' => 'lldpXdot3MIB',
);
);
%GLOBALS = (
'lldp_sysname' => 'lldpLocSysName',
'lldp_sysdesc' => 'lldpLocSysDesc',
'lldp_sys_cap' => 'lldpLocSysCapEnabled',
);
);
%FUNCS = (
# LLDP-MIB::lldpLocManAddrTable
'lldp_lman_addr' => 'lldpLocManAddrIfId',
# LLDP-MIB::lldpRemTable
'lldp_rem_id_type' => 'lldpRemChassisIdSubtype',
'lldp_rem_id' => 'lldpRemChassisId',
@@ -65,10 +67,10 @@ $VERSION = '1.09';
'lldp_rem_sysname' => 'lldpRemSysName',
'lldp_rem_sysdesc' => 'lldpRemSysDesc',
'lldp_rem_sys_cap' => 'lldpRemSysCapEnabled',
# LLDP-MIB::lldpRemManAddrTable
'lldp_rman_addr' => 'lldpRemManAddrIfSubtype',
);
);
%MUNGE = (
'lldp_sysdesc' => \&SNMP::Info::munge_null,
@@ -78,7 +80,7 @@ $VERSION = '1.09';
'lldp_rem_port_desc' => \&SNMP::Info::munge_null,
'lldp_sys_cap' => \&SNMP::Info::munge_bits,
'lldp_rem_sys_cap' => \&SNMP::Info::munge_bits,
);
);
sub hasLLDP {
my $lldp = shift;
@@ -98,8 +100,8 @@ sub lldp_if {
my $addr = $lldp->lldp_rem_pid($partial) || {};
my %lldp_if;
foreach my $key (keys %$addr) {
my @aOID = split ('\.',$key);
foreach my $key ( keys %$addr ) {
my @aOID = split( '\.', $key );
my $port = $aOID[1];
$lldp_if{$key} = $port;
}
@@ -113,8 +115,8 @@ sub lldp_ip {
my $rman_addr = $lldp->lldp_rman_addr($partial) || {};
my %lldp_ip;
foreach my $key (keys %$rman_addr) {
my($index, $proto, $addr) = _lldp_addr_index($key);
foreach my $key ( keys %$rman_addr ) {
my ( $index, $proto, $addr ) = _lldp_addr_index($key);
next unless defined $index;
next unless $proto == 1;
$lldp_ip{$index} = $addr;
@@ -129,8 +131,8 @@ sub lldp_addr {
my $rman_addr = $lldp->lldp_rman_addr($partial) || {};
my %lldp_ip;
foreach my $key (keys %$rman_addr) {
my($index, $proto, $addr) = _lldp_addr_index($key);
foreach my $key ( keys %$rman_addr ) {
my ( $index, $proto, $addr ) = _lldp_addr_index($key);
next unless defined $index;
$lldp_ip{$index} = $addr;
}
@@ -146,16 +148,18 @@ sub lldp_port {
my $ptype = $lldp->lldp_rem_pid_type($partial) || {};
my %lldp_port;
foreach my $key (sort keys %$pid) {
foreach my $key ( sort keys %$pid ) {
my $port = $pdesc->{$key};
unless ($port) {
$port = $pid->{$key};
next unless $port;
my $type = $ptype->{$key};
next unless $type;
# May need to format other types in the future, i.e. Network address
if ($type =~ /mac/) {
$port = join(':',map { sprintf "%02x",$_ } unpack('C*',$port));
if ( $type =~ /mac/ ) {
$port = join( ':',
map { sprintf "%02x", $_ } unpack( 'C*', $port ) );
}
}
@@ -178,14 +182,15 @@ sub lldp_id {
my $ch = $lldp->lldp_rem_id($partial) || {};
my %lldp_id;
foreach my $key (keys %$ch) {
foreach my $key ( keys %$ch ) {
my $id = $ch->{$key};
next unless $id;
my $type = $ch_type->{$key};
next unless $type;
# May need to format other types in the future
if ($type =~ /mac/) {
$id = join(':',map { sprintf "%02x",$_ } unpack('C*',$id));
if ( $type =~ /mac/ ) {
$id = join( ':', map { sprintf "%02x", $_ } unpack( 'C*', $id ) );
}
$lldp_id{$key} = $id;
}
@@ -214,18 +219,22 @@ sub lldp_id {
# and address.
sub _lldp_addr_index {
my $idx = shift;
my @oids = split(/\./, $idx);
my $index = join('.', splice(@oids, 0, 3));
my @oids = split( /\./, $idx );
my $index = join( '.', splice( @oids, 0, 3 ) );
my $proto = shift(@oids);
my $length = shift(@oids);
# IPv4
if ($proto == 1) {
return ($index, $proto, join('.',@oids));
if ( $proto == 1 ) {
return ( $index, $proto, join( '.', @oids ) );
}
# MAC
elsif ($proto == 6) {
return ($index, $proto, join(':',map { sprintf "%02x",$_ } @oids));
elsif ( $proto == 6 ) {
return ( $index, $proto,
join( ':', map { sprintf "%02x", $_ } @oids ) );
}
# TODO - Need to handle other protocols, i.e. IPv6
else {
return;

View File

@@ -43,16 +43,14 @@ use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %PORTSTAT %MUNGE/;
$VERSION = '1.09';
%MIBS = ( %SNMP::Info::MIBS,
'SNMP-REPEATER-MIB' => 'rptrPortGroupIndex'
);
%MIBS = ( %SNMP::Info::MIBS, 'SNMP-REPEATER-MIB' => 'rptrPortGroupIndex' );
%GLOBALS = (
%SNMP::Info::GLOBALS,
'ports_managed' => 'ifNumber',
'rptr_slots' => 'rptrGroupCapacity',
'slots' => 'rptrGroupCapacity'
);
);
%FUNCS = (
%SNMP::Info::FUNCS,
@@ -62,13 +60,14 @@ $VERSION = '1.09';
'rptr_up_admin' => 'rptrPortAdminStatus',
'rptr_up' => 'rptrPortOperStatus',
'rptr_last_src' => 'rptrAddrTrackNewLastSrcAddress',
);
);
%MUNGE = (
# Inherit all the built in munging
%SNMP::Info::MUNGE,
'rptr_last_src'=> \&SNMP::Info::munge_mac,
);
'rptr_last_src' => \&SNMP::Info::munge_mac,
);
# Method OverRides
@@ -79,7 +78,7 @@ sub ports {
my $ports = $l1->ports_managed();
my $rptr_ports = $l1->rptr_ports();
foreach my $group (keys %$rptr_ports){
foreach my $group ( keys %$rptr_ports ) {
$ports += $rptr_ports->{$group};
}
@@ -106,10 +105,10 @@ sub vendor {
my $l1 = shift;
my $descr = $l1->description();
return 'hp' if ($descr =~ /hp/i);
return 'cisco' if ($descr =~ /(catalyst|cisco|ios)/i);
return 'allied' if ($descr =~ /allied/i);
return 'asante' if ($descr =~ /asante/i);
return 'hp' if ( $descr =~ /hp/i );
return 'cisco' if ( $descr =~ /(catalyst|cisco|ios)/i );
return 'allied' if ( $descr =~ /allied/i );
return 'asante' if ( $descr =~ /asante/i );
return 'unknown';
@@ -123,7 +122,7 @@ sub interfaces {
my $interfaces = $l1->i_index($partial) || {};
my $rptr_port = $l1->rptr_port($partial) || {};
foreach my $port (keys %$rptr_port){
foreach my $port ( keys %$rptr_port ) {
$interfaces->{$port} = $port;
}
return $interfaces;
@@ -136,7 +135,7 @@ sub i_up_admin {
my $i_up_admin = $l1->SUPER::i_up_admin($partial) || {};
my $rptr_up_admin = $l1->rptr_up_admin($partial) || {};
foreach my $key (keys %$rptr_up_admin){
foreach my $key ( keys %$rptr_up_admin ) {
my $up = $rptr_up_admin->{$key};
$i_up_admin->{$key} = 'up' if $up =~ /enabled/;
$i_up_admin->{$key} = 'down' if $up =~ /disabled/;
@@ -152,7 +151,7 @@ sub i_up {
my $i_up = $l1->SUPER::i_up($partial) || {};
my $rptr_up = $l1->rptr_up($partial) || {};
foreach my $key (keys %$rptr_up){
foreach my $key ( keys %$rptr_up ) {
my $up = $rptr_up->{$key};
$i_up->{$key} = 'up' if $up =~ /operational/;
}

View File

@@ -44,23 +44,17 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
# Set for No CDP
%GLOBALS = (
%SNMP::Info::Layer1::GLOBALS,
'root_ip' => 'actualIPAddr',
);
%GLOBALS = ( %SNMP::Info::Layer1::GLOBALS, 'root_ip' => 'actualIPAddr', );
%FUNCS = (%SNMP::Info::Layer1::FUNCS,
%FUNCS = (
%SNMP::Info::Layer1::FUNCS,
'ati_p_name' => 'portName',
'ati_up' => 'linkTestLED',
);
);
%MIBS = (
%SNMP::Info::Layer1::MIBS,
'ATI-MIB' => 'atiPortGroupIndex'
);
%MIBS = ( %SNMP::Info::Layer1::MIBS, 'ATI-MIB' => 'atiPortGroupIndex' );
%MUNGE = (%SNMP::Info::Layer1::MUNGE,
);
%MUNGE = ( %SNMP::Info::Layer1::MUNGE, );
sub vendor {
return 'allied';
@@ -74,7 +68,7 @@ sub os_ver {
my $allied = shift;
my $descr = $allied->description();
if ($descr =~ m/version (\d+\.\d+)/){
if ( $descr =~ m/version (\d+\.\d+)/ ) {
return $1;
}
}
@@ -84,22 +78,22 @@ sub model {
my $desc = $allied->description();
if ($desc =~ /(AT-\d{4}\S{1}?)/){
if ( $desc =~ /(AT-\d{4}\S{1}?)/ ) {
return $1;
}
return;
}
sub i_name{
sub i_name {
my $allied = shift;
my $partial = shift;
my $i_name = $allied->orig_i_name($partial) || {};
my $ati_p_name = $allied->ati_p_name($partial) || {};
foreach my $port (keys %$ati_p_name){
foreach my $port ( keys %$ati_p_name ) {
my $name = $ati_p_name->{$port};
$i_name->{$port} = $name if (defined $name and $name !~ /^\s*$/);
$i_name->{$port} = $name if ( defined $name and $name !~ /^\s*$/ );
}
return $i_name;
@@ -109,10 +103,10 @@ sub i_up {
my $allied = shift;
my $partial = shift;
my $i_up = SNMP::Info::Layer1::i_up($allied, $partial);
my $i_up = SNMP::Info::Layer1::i_up( $allied, $partial );
my $ati_up = $allied->ati_up($partial) || {};
foreach my $port (keys %$ati_up){
foreach my $port ( keys %$ati_up ) {
my $up = $ati_up->{$port};
$i_up->{$port} = 'down' if $up eq 'linktesterror';
$i_up->{$port} = 'up' if $up eq 'nolinktesterror';

View File

@@ -44,25 +44,19 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
# Set for No CDP
%GLOBALS = (
%SNMP::Info::Layer1::GLOBALS,
);
%GLOBALS = ( %SNMP::Info::Layer1::GLOBALS, );
%FUNCS = (%SNMP::Info::Layer1::FUNCS,
%FUNCS = (
%SNMP::Info::Layer1::FUNCS,
'asante_port' => 'ePortIndex',
'asante_group' => 'ePortGrpIndex',
'i_type' => 'ePortStateType',
'asante_up' => 'ePortStateLinkStatus',
);
);
%MIBS = (
%SNMP::Info::Layer1::MIBS,
'ASANTE-HUB1012-MIB' => 'asante'
);
%MIBS = ( %SNMP::Info::Layer1::MIBS, 'ASANTE-HUB1012-MIB' => 'asante' );
%MUNGE = (
%SNMP::Info::Layer1::MUNGE,
);
%MUNGE = ( %SNMP::Info::Layer1::MUNGE, );
sub interfaces {
my $asante = shift;
@@ -72,7 +66,7 @@ sub interfaces {
my %interfaces;
foreach my $port (keys %$rptr_port){
foreach my $port ( keys %$rptr_port ) {
$interfaces{$port} = $port;
}
@@ -87,7 +81,7 @@ sub os_ver {
my $asante = shift;
my $descr = $asante->description();
if ($descr =~ /software v(\d+\.\d+)/){
if ( $descr =~ /software v(\d+\.\d+)/ ) {
return $1;
}
}
@@ -112,7 +106,7 @@ sub i_up {
my $asante_up = $asante->asante_up($partial) || {};
my $i_up = {};
foreach my $port (keys %$asante_up){
foreach my $port ( keys %$asante_up ) {
my $up = $asante_up->{$port};
$i_up->{$port} = 'down' if $up =~ /on/;
$i_up->{$port} = 'up' if $up =~ /off/;

View File

@@ -36,7 +36,8 @@ use SNMP::Info::SONMP;
use SNMP::Info::NortelStack;
use SNMP::Info::Layer2;
@SNMP::Info::Layer1::Bayhub::ISA = qw/SNMP::Info::SONMP SNMP::Info::NortelStack SNMP::Info::Layer2 Exporter/;
@SNMP::Info::Layer1::Bayhub::ISA
= qw/SNMP::Info::SONMP SNMP::Info::NortelStack SNMP::Info::Layer2 Exporter/;
@SNMP::Info::Layer1::Bayhub::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
@@ -49,38 +50,39 @@ $VERSION = '1.09';
%SNMP::Info::SONMP::MIBS,
'S5-ETHERNET-COMMON-MIB' => 's5EnPortTable',
'S5-COMMON-STATS-MIB' => 's5CmStat',
);
);
%GLOBALS = (
%SNMP::Info::Layer2::GLOBALS,
%SNMP::Info::NortelStack::GLOBALS,
%SNMP::Info::Layer2::GLOBALS, %SNMP::Info::NortelStack::GLOBALS,
%SNMP::Info::SONMP::GLOBALS,
);
);
%FUNCS = (
%SNMP::Info::Layer2::FUNCS,
%SNMP::Info::NortelStack::FUNCS,
%SNMP::Info::SONMP::FUNCS,
# S5-ETHERNET-COMMON-MIB::s5EnPortTable
'bayhub_pb_index' => 's5EnPortBrdIndx',
'bayhub_pp_index' => 's5EnPortIndx',
'bayhub_up_admin' => 's5EnPortPartStatus',
'bayhub_up' => 's5EnPortLinkStatus',
# S5-ETHERNET-COMMON-MIB::s5EnPortExtTable
'bayhub_p_speed' => 's5EnPortExtActiveSpeed',
'bayhub_p_cap' => 's5EnPortExtHwCapability',
'bayhub_p_adv' => 's5EnPortExtAutoNegAdv',
# S5-COMMON-STATS-MIB::s5CmSNodeTable
'bayhub_nb_index' => 's5CmSNodeBrdIndx',
'bayhub_np_index' => 's5CmSNodePortIndx',
'fw_mac' => 's5CmSNodeMacAddr',
);
);
%MUNGE = (
%SNMP::Info::Layer2::MUNGE,
%SNMP::Info::NortelStack::MUNGE,
%SNMP::Info::Layer2::MUNGE, %SNMP::Info::NortelStack::MUNGE,
%SNMP::Info::SONMP::MUNGE,
);
);
sub layers {
return '00000011';
@@ -102,9 +104,9 @@ sub model {
return $id unless defined $model;
$model =~ s/^sreg-//i;
return 'Baystack Hub' if ($model =~ /BayStack/);
return '5000' if ($model =~ /5000/);
return '5005' if ($model =~ /5005/);
return 'Baystack Hub' if ( $model =~ /BayStack/ );
return '5000' if ( $model =~ /5000/ );
return '5005' if ( $model =~ /5005/ );
return $model;
}
@@ -120,25 +122,27 @@ sub i_index {
my $model = $bayhub->model() || 'Baystack Hub';
my %i_index;
foreach my $iid (keys %$b_index){
foreach my $iid ( keys %$b_index ) {
my $board = $b_index->{$iid};
next unless defined $board;
my $port = $p_index->{$iid}||0;
my $port = $p_index->{$iid} || 0;
if ($model eq 'Baystack Hub') {
if ( $model eq 'Baystack Hub' ) {
my $comidx = $board;
if (! ($comidx % 5)) {
$board = ($board / 5);
} elsif ($comidx =~ /[16]$/) {
$board = int($board/5);
if ( !( $comidx % 5 ) ) {
$board = ( $board / 5 );
}
elsif ( $comidx =~ /[16]$/ ) {
$board = int( $board / 5 );
$port = 25;
} elsif ($comidx =~ /[27]$/) {
$board = int($board/5);
}
elsif ( $comidx =~ /[27]$/ ) {
$board = int( $board / 5 );
$port = 26;
}
}
my $index = ($board*256)+$port;
my $index = ( $board * 256 ) + $port;
$i_index{$iid} = $index;
}
@@ -155,14 +159,14 @@ sub interfaces {
my $i_index = $bayhub->i_index() || {};
my %if;
foreach my $iid (keys %$i_index){
foreach my $iid ( keys %$i_index ) {
my $index = $i_index->{$iid};
next unless defined $index;
next if (defined $partial and $index !~ /^$partial$/);
next if ( defined $partial and $index !~ /^$partial$/ );
# Index numbers are deterministic slot * 256 + port
my $port = $index % 256;
my $slot = int($index / 256);
my $slot = int( $index / 256 );
my $slotport = "$slot.$port";
@@ -179,13 +183,13 @@ sub i_duplex {
my $port_index = $bayhub->i_index() || {};
my %i_duplex;
foreach my $iid (keys %$port_index){
foreach my $iid ( keys %$port_index ) {
my $index = $port_index->{$iid};
next unless defined $index;
next if (defined $partial and $index !~ /^$partial$/);
next if ( defined $partial and $index !~ /^$partial$/ );
my $duplex = 'half';
$i_duplex{$index}=$duplex;
$i_duplex{$index} = $duplex;
}
return \%i_duplex;
}
@@ -197,13 +201,13 @@ sub i_duplex_admin {
my $port_index = $bayhub->i_index() || {};
my %i_duplex_admin;
foreach my $iid (keys %$port_index){
foreach my $iid ( keys %$port_index ) {
my $index = $port_index->{$iid};
next unless defined $index;
next if (defined $partial and $index !~ /^$partial$/);
next if ( defined $partial and $index !~ /^$partial$/ );
my $duplex = 'half';
$i_duplex_admin{$index}=$duplex;
$i_duplex_admin{$index} = $duplex;
}
return \%i_duplex_admin;
}
@@ -216,15 +220,15 @@ sub i_speed {
my $port_speed = $bayhub->bayhub_p_speed() || {};
my %i_speed;
foreach my $iid (keys %$port_index){
foreach my $iid ( keys %$port_index ) {
my $index = $port_index->{$iid};
next unless defined $index;
next if (defined $partial and $index !~ /^$partial$/);
next if ( defined $partial and $index !~ /^$partial$/ );
my $speed = $port_speed->{$iid} || '10 Mbps';
$speed = '10 Mbps' if $speed =~ /bps10M/i;
$speed = '100 Mbps' if $speed =~ /bps100M/i;
$i_speed{$index}=$speed;
$i_speed{$index} = $speed;
}
return \%i_speed;
}
@@ -237,17 +241,17 @@ sub i_up {
my $link_stat = $bayhub->bayhub_up() || {};
my %i_up;
foreach my $iid (keys %$port_index){
foreach my $iid ( keys %$port_index ) {
my $index = $port_index->{$iid};
next unless defined $index;
next if (defined $partial and $index !~ /^$partial$/);
next if ( defined $partial and $index !~ /^$partial$/ );
my $link_stat = $link_stat->{$iid};
next unless defined $link_stat;
$link_stat = 'up' if $link_stat =~ /on/i;
$link_stat = 'down' if $link_stat =~ /off/i;
$i_up{$index}=$link_stat;
$i_up{$index} = $link_stat;
}
return \%i_up;
}
@@ -260,24 +264,25 @@ sub i_up_admin {
my $link_stat = $bayhub->bayhub_up_admin() || {};
my %i_up_admin;
foreach my $iid (keys %$i_index){
foreach my $iid ( keys %$i_index ) {
my $index = $i_index->{$iid};
next unless defined $index;
next if (defined $partial and $index !~ /^$partial$/);
next if ( defined $partial and $index !~ /^$partial$/ );
my $link_stat = $link_stat->{$iid};
next unless defined $link_stat;
$i_up_admin{$index}=$link_stat;
$i_up_admin{$index} = $link_stat;
}
return \%i_up_admin;
}
sub set_i_up_admin {
# map setting to those the hub will understand
my %setting = qw/up 2 down 3/;
my $bayhub = shift;
my ($setting, $iid) = @_;
my ( $setting, $iid ) = @_;
my $i_index = $bayhub->i_index();
my %reverse_i_index = reverse %$i_index;
@@ -288,7 +293,7 @@ sub set_i_up_admin {
$iid = $reverse_i_index{$iid};
return $bayhub->set_bayhub_up_admin($setting{$setting}, $iid);
return $bayhub->set_bayhub_up_admin( $setting{$setting}, $iid );
}
# Hubs do not support the standard Bridge MIB
@@ -301,26 +306,28 @@ sub bp_index {
my $model = $bayhub->model() || 'Baystack Hub';
my %bp_index;
foreach my $iid (keys %$b_index){
foreach my $iid ( keys %$b_index ) {
my $board = $b_index->{$iid};
next unless defined $board;
my $port = $p_index->{$iid}||0;
my $port = $p_index->{$iid} || 0;
if ($model eq 'Baystack Hub') {
if ( $model eq 'Baystack Hub' ) {
my $comidx = $board;
if (! ($comidx % 5)) {
$board = ($board / 5);
} elsif ($comidx =~ /[16]$/) {
$board = int($board/5);
if ( !( $comidx % 5 ) ) {
$board = ( $board / 5 );
}
elsif ( $comidx =~ /[16]$/ ) {
$board = int( $board / 5 );
$port = 25;
} elsif ($comidx =~ /[27]$/) {
$board = int($board/5);
}
elsif ( $comidx =~ /[27]$/ ) {
$board = int( $board / 5 );
$port = 26;
}
}
my $index = ($board*256)+$port;
next if (defined $partial and $index !~ /^$partial$/);
my $index = ( $board * 256 ) + $port;
next if ( defined $partial and $index !~ /^$partial$/ );
$bp_index{$index} = $index;
}
@@ -336,25 +343,27 @@ sub fw_port {
my $model = $bayhub->model() || 'Baystack Hub';
my %fw_port;
foreach my $iid (keys %$b_index){
foreach my $iid ( keys %$b_index ) {
my $board = $b_index->{$iid};
next unless defined $board;
my $port = $p_index->{$iid}||0;
my $port = $p_index->{$iid} || 0;
if ($model eq 'Baystack Hub') {
if ( $model eq 'Baystack Hub' ) {
my $comidx = $board;
if (! ($comidx % 5)) {
$board = ($board / 5);
} elsif ($comidx =~ /[16]$/) {
$board = int($board/5);
if ( !( $comidx % 5 ) ) {
$board = ( $board / 5 );
}
elsif ( $comidx =~ /[16]$/ ) {
$board = int( $board / 5 );
$port = 25;
} elsif ($comidx =~ /[27]$/) {
$board = int($board/5);
}
elsif ( $comidx =~ /[27]$/ ) {
$board = int( $board / 5 );
$port = 26;
}
}
my $index = ($board*256)+$port;
my $index = ( $board * 256 ) + $port;
$fw_port{$iid} = $index;
}
@@ -369,7 +378,6 @@ sub slot_offset {
return 0;
}
# Devices do not support ENTITY-MIB use proprietary methods.
sub e_index {

View File

@@ -46,9 +46,10 @@ $VERSION = '1.09';
'CYCLADES-ACS-SYS-MIB' => 'cyACSversion',
'CYCLADES-ACS-CONF-MIB' => 'cyEthIPaddr',
'CYCLADES-ACS-INFO-MIB' => 'cyISPortTty',
);
);
%GLOBALS = (
# CYCLADES-ACS-SYS-MIB
%SNMP::Info::Layer1::GLOBALS,
'os_ver' => 'cyACSversion',
@@ -57,22 +58,22 @@ $VERSION = '1.09';
'root_ip' => 'cyEthIPaddr',
'ps1_status' => 'cyACSPw1',
'ps2_status' => 'cyACSPw2',
);
);
%FUNCS = (
%SNMP::Info::Layer1::FUNCS,
# CYCLADES-ACS-INFO-MIB::cyInfoSerialTable
'cy_port_tty' => 'cyISPortTty',
'cy_port_name' => 'cyISPortName',
'cy_port_speed' => 'cyISPortSpeed',
'cy_port_cd' => 'cyISPortSigCD',
# CYCLADES-ACS-CONF-MIB::cySerialPortTable
'cy_port_socket' => 'cySPortSocketPort',
);
);
%MUNGE = (
%SNMP::Info::Layer1::MUNGE,
);
%MUNGE = ( %SNMP::Info::Layer1::MUNGE, );
# These devices don't have a FDB and we probably don't want to poll for ARP
# cache so turn off reported L2/L3.
@@ -111,7 +112,7 @@ sub i_index {
my $cy_index = $cyclades->cy_port_socket() || {};
my %i_index;
foreach my $iid (keys %$orig_index){
foreach my $iid ( keys %$orig_index ) {
my $index = $orig_index->{$iid};
next unless defined $index;
@@ -120,10 +121,10 @@ sub i_index {
# Use alternative labeling system for the serial port, listening socket
# to avoid conflicts with ifIndex.
foreach my $iid (keys %$cy_index){
foreach my $iid ( keys %$cy_index ) {
my $index = $cy_index->{$iid};
next unless defined $index;
next if (defined $partial and $index !~ /^$partial$/);
next if ( defined $partial and $index !~ /^$partial$/ );
$i_index{$index} = $index;
}
@@ -140,17 +141,17 @@ sub interfaces {
my $cy_p_tty = $cyclades->cy_port_tty() || {};
my %if;
foreach my $iid (keys %$i_descr){
foreach my $iid ( keys %$i_descr ) {
my $descr = $i_descr->{$iid};
next unless defined $descr;
$if{$iid} = $descr;
}
foreach my $iid (keys %$cy_p_tty){
foreach my $iid ( keys %$cy_p_tty ) {
my $index = $cy_index->{$iid};
next unless defined $index;
next if (defined $partial and $index !~ /^$partial$/);
next if ( defined $partial and $index !~ /^$partial$/ );
my $name = $cy_p_tty->{$iid};
next unless defined $name;
@@ -169,17 +170,17 @@ sub i_speed {
my $cy_p_speed = $cyclades->cy_port_speed() || {};
my %i_speed;
foreach my $iid (keys %$i_speed){
foreach my $iid ( keys %$i_speed ) {
my $speed = $i_speed->{$iid};
next unless defined $speed;
$i_speed{$iid} = $speed;
}
foreach my $iid (keys %$cy_p_speed){
foreach my $iid ( keys %$cy_p_speed ) {
my $index = $cy_index->{$iid};
next unless defined $index;
next if (defined $partial and $index !~ /^$partial$/);
next if ( defined $partial and $index !~ /^$partial$/ );
my $speed = $cy_p_speed->{$iid};
next unless defined $speed;
@@ -198,17 +199,17 @@ sub i_up {
my $cy_p_up = $cyclades->cy_port_cd() || {};
my %i_up;
foreach my $iid (keys %$i_up){
foreach my $iid ( keys %$i_up ) {
my $up = $i_up->{$iid};
next unless defined $up;
$i_up{$iid} = $up;
}
foreach my $iid (keys %$cy_p_up){
foreach my $iid ( keys %$cy_p_up ) {
my $index = $cy_index->{$iid};
next unless defined $index;
next if (defined $partial and $index !~ /^$partial$/);
next if ( defined $partial and $index !~ /^$partial$/ );
my $up = $cy_p_up->{$iid};
next unless defined $up;
@@ -227,17 +228,17 @@ sub i_description {
my $cy_p_desc = $cyclades->cy_port_name() || {};
my %descr;
foreach my $iid (keys %$i_desc){
foreach my $iid ( keys %$i_desc ) {
my $desc = $i_desc->{$iid};
next unless defined $desc;
$descr{$iid} = $desc;
}
foreach my $iid (keys %$cy_p_desc){
foreach my $iid ( keys %$cy_p_desc ) {
my $index = $cy_index->{$iid};
next unless defined $index;
next if (defined $partial and $index !~ /^$partial$/);
next if ( defined $partial and $index !~ /^$partial$/ );
my $desc = $cy_p_desc->{$iid};
next unless defined $desc;
@@ -256,17 +257,17 @@ sub i_name {
my $cy_p_desc = $cyclades->cy_port_name() || {};
my %i_name;
foreach my $iid (keys %$i_name){
foreach my $iid ( keys %$i_name ) {
my $name = $i_name->{$iid};
next unless defined $name;
$i_name{$iid} = $name;
}
foreach my $iid (keys %$cy_p_desc){
foreach my $iid ( keys %$cy_p_desc ) {
my $index = $cy_index->{$iid};
next unless defined $index;
next if (defined $partial and $index !~ /^$partial$/);
next if ( defined $partial and $index !~ /^$partial$/ );
my $name = $cy_p_desc->{$iid};
next unless defined $name;
@@ -373,8 +374,8 @@ These are methods that return scalar value from SNMP
=item $cyclades->layers()
Returns 01000001. These devices don't have a FDB and we probably don't want to
poll for an ARP cache so turn off reported Layer 2 and Layer 3.
Returns 01000001. These devices don't have a FDB and we probably don't want
to poll for an ARP cache so turn off reported Layer 2 and Layer 3.
=item $cyclades->vendor()

View File

@@ -45,37 +45,40 @@ $VERSION = '1.09';
%SNMP::Info::Layer2::MIBS,
'SYNOPTICS-ETHERNET-MIB' => 's3EnetPortTable',
'SYNOPTICS-COMMON-MIB' => 's3AgentType',
);
);
%GLOBALS = (
%SNMP::Info::Layer2::GLOBALS,
# From SYNOPTICS-COMMON-MIB
'os_bin' => 's3AgentFwVer',
's3000_major_ver' => 's3AgentSwMajorVer',
's3000_minor_ver' => 's3AgentSwMinorVer',
's3000_maint_ver' => 's3AgentSwMaintVer',
);
);
%FUNCS = (
%SNMP::Info::Layer2::FUNCS,
# SYNOPTICS-ETHERNET-MIB::s3EnetPortTable
's3000_pb_index' => 's3EnetPortBoardIndex',
's3000_pp_index' => 's3EnetPortIndex',
's3000_up_admin' => 's3EnetPortPartStatus',
's3000_up' => 's3EnetPortLinkStatus',
# SYNOPTICS-ETHERNET-MIB::s3EnetShowNodesTable
's3000_nb_index' => 's3EnetShowNodesSlotIndex',
's3000_np_index' => 's3EnetShowNodesPortIndex',
'fw_mac' => 's3EnetShowNodesMacAddress',
# SYNOPTICS-ETHERNET-MIB::s3EnetTopNmmTable
's3000_topo_port' => 's3EnetTopNmmPort',
's3000_topo_mac' => 's3EnetTopNmmMacAddr',
);
);
%MUNGE = (
%SNMP::Info::Layer2::MUNGE,
's3000_topo_mac' => \&SNMP::Info::munge_mac
);
%SNMP::Info::Layer2::MUNGE, 's3000_topo_mac' => \&SNMP::Info::munge_mac
);
sub layers {
return '00000011';
@@ -97,7 +100,7 @@ sub model {
return $id unless defined $model;
$model =~ s/^s3reg-//i;
return $1 if ($model =~ /((\d+){3}[\dX])/);
return $1 if ( $model =~ /((\d+){3}[\dX])/ );
return $model;
}
@@ -116,12 +119,13 @@ sub mac {
my $topo_port = $s3000->s3000_topo_port();
my $topo_mac = $s3000->s3000_topo_mac();
foreach my $entry (keys %$topo_port){
foreach my $entry ( keys %$topo_port ) {
my $port = $topo_port->{$entry};
next unless $port == 0;
my $mac = $topo_mac->{$entry};
return $mac;
}
# Topology turned off, not supported.
return;
}
@@ -137,13 +141,13 @@ sub i_index {
my $p_index = $s3000->s3000_pp_index($partial) || {};
my %i_index;
foreach my $iid (keys %$b_index){
foreach my $iid ( keys %$b_index ) {
my $board = $b_index->{$iid};
next unless defined $board;
my $port = $p_index->{$iid}||0;
my $port = $p_index->{$iid} || 0;
# We need to make up an index for multiple board instances.
my $index = ($board*256)+$port;
my $index = ( $board * 256 ) + $port;
$i_index{$iid} = $index;
}
@@ -160,14 +164,14 @@ sub interfaces {
my $i_index = $s3000->i_index() || {};
my %if;
foreach my $iid (keys %$i_index){
foreach my $iid ( keys %$i_index ) {
my $index = $i_index->{$iid};
next unless defined $index;
next if (defined $partial and $index !~ /^$partial$/);
next if ( defined $partial and $index !~ /^$partial$/ );
# Index numbers are deterministic slot * 256 + port - see i_index()
my $port = $index % 256;
my $slot = int($index / 256);
my $slot = int( $index / 256 );
my $slotport = "$slot.$port";
@@ -184,14 +188,14 @@ sub i_duplex {
my $port_index = $s3000->i_index() || {};
my %i_duplex;
foreach my $iid (keys %$port_index){
foreach my $iid ( keys %$port_index ) {
my $index = $port_index->{$iid};
next unless defined $index;
next if (defined $partial and $index !~ /^$partial$/);
next if ( defined $partial and $index !~ /^$partial$/ );
# Hubs only function half duplex
my $duplex = 'half';
$i_duplex{$index}=$duplex;
$i_duplex{$index} = $duplex;
}
return \%i_duplex;
}
@@ -203,14 +207,14 @@ sub i_duplex_admin {
my $port_index = $s3000->i_index() || {};
my %i_duplex_admin;
foreach my $iid (keys %$port_index){
foreach my $iid ( keys %$port_index ) {
my $index = $port_index->{$iid};
next unless defined $index;
next if (defined $partial and $index !~ /^$partial$/);
next if ( defined $partial and $index !~ /^$partial$/ );
# Hubs only function half duplex
my $duplex = 'half';
$i_duplex_admin{$index}=$duplex;
$i_duplex_admin{$index} = $duplex;
}
return \%i_duplex_admin;
}
@@ -222,14 +226,14 @@ sub i_speed {
my $port_index = $s3000->i_index() || {};
my %i_speed;
foreach my $iid (keys %$port_index){
foreach my $iid ( keys %$port_index ) {
my $index = $port_index->{$iid};
next unless defined $index;
next if (defined $partial and $index !~ /^$partial$/);
next if ( defined $partial and $index !~ /^$partial$/ );
# These hubs only support 10 Mbs
my $speed = '10000000';
$i_speed{$index}=$speed;
$i_speed{$index} = $speed;
}
return \%i_speed;
}
@@ -242,17 +246,17 @@ sub i_up {
my $link_stat = $s3000->s3000_up() || {};
my %i_up;
foreach my $iid (keys %$port_index){
foreach my $iid ( keys %$port_index ) {
my $index = $port_index->{$iid};
next unless defined $index;
next if (defined $partial and $index !~ /^$partial$/);
next if ( defined $partial and $index !~ /^$partial$/ );
my $link_stat = $link_stat->{$iid};
next unless defined $link_stat;
$link_stat = 'up' if $link_stat =~ /on/i;
$link_stat = 'down' if $link_stat =~ /off/i;
$i_up{$index}=$link_stat;
$i_up{$index} = $link_stat;
}
return \%i_up;
}
@@ -265,24 +269,25 @@ sub i_up_admin {
my $link_stat = $s3000->s3000_up_admin() || {};
my %i_up_admin;
foreach my $iid (keys %$i_index){
foreach my $iid ( keys %$i_index ) {
my $index = $i_index->{$iid};
next unless defined $index;
next if (defined $partial and $index !~ /^$partial$/);
next if ( defined $partial and $index !~ /^$partial$/ );
my $link_stat = $link_stat->{$iid};
next unless defined $link_stat;
$i_up_admin{$index}=$link_stat;
$i_up_admin{$index} = $link_stat;
}
return \%i_up_admin;
}
sub set_i_up_admin {
# map setting to those the hub will understand
my %setting = qw/up 2 down 3/;
my $s3000 = shift;
my ($setting, $iid) = @_;
my ( $setting, $iid ) = @_;
my $i_index = $s3000->i_index() || {};
my %reverse_i_index = reverse %$i_index;
@@ -293,7 +298,7 @@ sub set_i_up_admin {
$iid = $reverse_i_index{$iid};
return $s3000->set_s3000_up_admin($setting{$setting}, $iid);
return $s3000->set_s3000_up_admin( $setting{$setting}, $iid );
}
# Hubs do not support the standard Bridge MIB
@@ -306,13 +311,13 @@ sub bp_index {
my $model = $s3000->model();
my %bp_index;
foreach my $iid (keys %$b_index){
foreach my $iid ( keys %$b_index ) {
my $board = $b_index->{$iid};
next unless defined $board;
my $port = $p_index->{$iid}||0;
my $port = $p_index->{$iid} || 0;
my $index = ($board*256)+$port;
next if (defined $partial and $index !~ /^$partial$/);
my $index = ( $board * 256 ) + $port;
next if ( defined $partial and $index !~ /^$partial$/ );
$bp_index{$index} = $index;
}
@@ -328,12 +333,12 @@ sub fw_port {
my $model = $s3000->model();
my %fw_port;
foreach my $iid (keys %$b_index){
foreach my $iid ( keys %$b_index ) {
my $board = $b_index->{$iid};
next unless defined $board;
my $port = $p_index->{$iid}||0;
my $port = $p_index->{$iid} || 0;
my $index = ($board*256)+$port;
my $index = ( $board * 256 ) + $port;
$fw_port{$iid} = $index;
}
@@ -489,7 +494,8 @@ Returns 10000000. The hubs only support 10 Mbs Ethernet.
=item $s3000->i_up()
Returns (C<s3EnetPortLinkStatus>) for each port. Translates on/off to up/down.
Returns (C<s3EnetPortLinkStatus>) for each port. Translates on/off to
up/down.
=item $s3000->i_up_admin()
@@ -522,7 +528,8 @@ C<SYNOPTICS-ETHERNET-MIB::s3EnetShowNodesTable> to the Interface index.
=item $s3000->s3000_topo_port()
Returns reference to hash. Key: Table entry, Value:Port Number (interface iid)
Returns reference to hash. Key: Table entry, Value:Port Number
(interface iid)
(C<s3EnetTopNmmPort>)

View File

@@ -39,41 +39,41 @@ use SNMP::Info::Bridge;
use SNMP::Info::Entity;
use SNMP::Info::PowerEthernet;
@SNMP::Info::Layer2::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::Entity SNMP::Info::PowerEthernet Exporter/;
@SNMP::Info::Layer2::ISA
= qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::Entity SNMP::Info::PowerEthernet Exporter/;
@SNMP::Info::Layer2::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %PORTSTAT %MUNGE/;
$VERSION = '1.09';
%MIBS = ( %SNMP::Info::MIBS,
%SNMP::Info::Bridge::MIBS,
%SNMP::Info::Entity::MIBS,
%SNMP::Info::PowerEthernet::MIBS,
);
%MIBS = (
%SNMP::Info::MIBS, %SNMP::Info::Bridge::MIBS,
%SNMP::Info::Entity::MIBS, %SNMP::Info::PowerEthernet::MIBS,
);
%GLOBALS = (
%SNMP::Info::GLOBALS,
%SNMP::Info::Bridge::GLOBALS,
%SNMP::Info::Entity::GLOBALS,
%SNMP::Info::PowerEthernet::GLOBALS,
'serial1' => '.1.3.6.1.4.1.9.3.6.3.0', # OLD-CISCO-CHASSIS-MIB::chassisId.0
);
'serial1' =>
'.1.3.6.1.4.1.9.3.6.3.0', # OLD-CISCO-CHASSIS-MIB::chassisId.0
);
%FUNCS = (
%SNMP::Info::FUNCS,
%SNMP::Info::Bridge::FUNCS,
%SNMP::Info::Entity::FUNCS,
%SNMP::Info::PowerEthernet::FUNCS,
);
%SNMP::Info::FUNCS, %SNMP::Info::Bridge::FUNCS,
%SNMP::Info::Entity::FUNCS, %SNMP::Info::PowerEthernet::FUNCS,
);
%MUNGE = (
# Inherit all the built in munging
%SNMP::Info::MUNGE,
%SNMP::Info::Bridge::MUNGE,
%SNMP::Info::Entity::MUNGE,
%SNMP::Info::PowerEthernet::MUNGE,
);
);
# Method OverRides
@@ -100,11 +100,11 @@ sub vendor {
my $model = $l2->model();
my $descr = $l2->description();
if ($model =~ /hp/i or $descr =~ /\bhp\b/i) {
if ( $model =~ /hp/i or $descr =~ /\bhp\b/i ) {
return 'hp';
}
if ($model =~ /catalyst/i or $descr =~ /(catalyst|cisco)/i) {
if ( $model =~ /catalyst/i or $descr =~ /(catalyst|cisco)/i ) {
return 'cisco';
}
@@ -122,9 +122,10 @@ sub serial {
# precedence
# serial2,chassis parse,serial1
return $serial2 if (defined $serial2 and $serial2 !~ /^\s*$/);
return $1 if (defined $chassis and $chassis =~ /serial#?:\s*([a-z0-9]+)/i);
return $serial1 if (defined $serial1 and $serial1 !~ /^\s*$/);
return $serial2 if ( defined $serial2 and $serial2 !~ /^\s*$/ );
return $1
if ( defined $chassis and $chassis =~ /serial#?:\s*([a-z0-9]+)/i );
return $serial1 if ( defined $serial1 and $serial1 !~ /^\s*$/ );
return;
}
@@ -137,7 +138,7 @@ sub i_ignore {
my %i_ignore = ();
foreach my $if (keys %$i_type){
foreach my $if ( keys %$i_type ) {
my $type = $i_type->{$if};
$i_ignore{$if}++
if $type =~ /(loopback|other|cpu)/i;
@@ -154,7 +155,7 @@ sub interfaces {
my $i_descr = $l2->i_description($partial) || {};
# Replace the Index with the ifDescr field.
foreach my $iid (keys %$i_descr){
foreach my $iid ( keys %$i_descr ) {
my $port = $i_descr->{$iid};
next unless defined $port;
$interfaces->{$iid} = $port;
@@ -287,7 +288,8 @@ to a hash.
=item $l2->interfaces()
Creates a map between the interface identifier (iid) and the physical port name.
Creates a map between the interface identifier (iid) and the physical port
name.
Defaults to C<ifDescr> but checks and overrides with C<ifName>

View File

@@ -35,7 +35,8 @@ use SNMP::Info::Bridge;
use SNMP::Info::CDP;
use SNMP::Info::Airespace;
@SNMP::Info::Layer2::Airespace::ISA = qw/SNMP::Info::Airespace SNMP::Info::CDP SNMP::Info::Bridge Exporter/;
@SNMP::Info::Layer2::Airespace::ISA
= qw/SNMP::Info::Airespace SNMP::Info::CDP SNMP::Info::Bridge Exporter/;
@SNMP::Info::Layer2::Airespace::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
@@ -43,32 +44,24 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::MIBS,
%SNMP::Info::Bridge::MIBS,
%SNMP::Info::CDP::MIBS,
%SNMP::Info::Airespace::MIBS,
);
%SNMP::Info::MIBS, %SNMP::Info::Bridge::MIBS,
%SNMP::Info::CDP::MIBS, %SNMP::Info::Airespace::MIBS,
);
%GLOBALS = (
%SNMP::Info::GLOBALS,
%SNMP::Info::Bridge::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
%SNMP::Info::Airespace::GLOBALS,
);
%SNMP::Info::GLOBALS, %SNMP::Info::Bridge::GLOBALS,
%SNMP::Info::CDP::GLOBALS, %SNMP::Info::Airespace::GLOBALS,
);
%FUNCS = (
%SNMP::Info::FUNCS,
%SNMP::Info::Bridge::FUNCS,
%SNMP::Info::CDP::FUNCS,
%SNMP::Info::Airespace::FUNCS,
);
%SNMP::Info::FUNCS, %SNMP::Info::Bridge::FUNCS,
%SNMP::Info::CDP::FUNCS, %SNMP::Info::Airespace::FUNCS,
);
%MUNGE = (
%SNMP::Info::MUNGE,
%SNMP::Info::Bridge::MUNGE,
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::Airespace::MUNGE,
);
%SNMP::Info::MUNGE, %SNMP::Info::Bridge::MUNGE,
%SNMP::Info::CDP::MUNGE, %SNMP::Info::Airespace::MUNGE,
);
sub os {
return 'cisco';

View File

@@ -41,7 +41,8 @@ use SNMP::Info::CiscoStats;
use SNMP::Info::CDP;
use SNMP::Info::IEEE802dot11;
@SNMP::Info::Layer2::Aironet::ISA = qw/SNMP::Info::Layer2 SNMP::Info::Entity SNMP::Info::EtherLike
@SNMP::Info::Layer2::Aironet::ISA
= qw/SNMP::Info::Layer2 SNMP::Info::Entity SNMP::Info::EtherLike
SNMP::Info::CiscoStats SNMP::Info::CDP Exporter/;
@SNMP::Info::Layer2::Aironet::EXPORT_OK = qw//;
@@ -58,7 +59,7 @@ $VERSION = '1.09';
%SNMP::Info::CDP::GLOBALS,
'serial' => 'entPhysicalSerialNum.1',
'descr' => 'sysDescr'
);
);
%FUNCS = (
%SNMP::Info::IEEE802dot11::FUNCS,
@@ -80,7 +81,7 @@ $VERSION = '1.09';
'cd11_rxbyte' => 'cDot11ClientBytesReceived',
'cd11_txbyte' => 'cDot11ClientBytesSent',
'mbss_mac_addr' => 'cdot11MbssidIfMacAddress',
);
);
%MIBS = (
%SNMP::Info::IEEE802dot11::MIBS,
@@ -94,7 +95,7 @@ $VERSION = '1.09';
'CISCO-DOT11-ASSOCIATION-MIB' => 'cDot11ClientSubIfIndex',
'CISCO-DOT11-SSID-SECURITY-MIB' => 'cdot11SecVlanNameId',
'CISCO-VLAN-IFTABLE-RELATIONSHIP-MIB' => 'cviRoutedVlanIfIndex',
);
);
%MUNGE = (
%SNMP::Info::IEEE802dot11::MUNGE,
@@ -105,13 +106,14 @@ $VERSION = '1.09';
%SNMP::Info::CDP::MUNGE,
'cd11_txrate' => \&munge_cd11_txrate,
'mbss_mac_addr' => \&SNMP::Info::munge_mac,
);
);
# Use 802.11 power level without putting IEEE802dot11 in @ISA
*SNMP::Info::Layer2::Aironet::dot11_cur_tx_pwr_mw =
\&SNMP::Info::IEEE802dot11::dot11_cur_tx_pwr_mw;
*SNMP::Info::Layer2::Aironet::dot11_cur_tx_pwr_mw
= \&SNMP::Info::IEEE802dot11::dot11_cur_tx_pwr_mw;
sub vendor {
# Sorry, but it's true.
return 'cisco';
}
@@ -144,7 +146,7 @@ sub i_duplex {
my $el_duplex = $aironet->el_duplex($partial);
my %i_duplex;
foreach my $d (keys %$el_duplex){
foreach my $d ( keys %$el_duplex ) {
my $val = $el_duplex->{$d};
next unless defined $val;
$i_duplex{$d} = 'full' if $val =~ /full/i;
@@ -163,7 +165,10 @@ sub i_duplex {
sub _aironet_special {
my $aironet = shift;
my $os_ver = $aironet->os_ver();
if (defined($os_ver) && $os_ver =~ /^(\d+)\.(\d+)(\D|$)/ && (($1 == 12 && $2 >= 3) || $1 > 12)) {
if ( defined($os_ver)
&& $os_ver =~ /^(\d+)\.(\d+)(\D|$)/
&& ( ( $1 == 12 && $2 >= 3 ) || $1 > 12 ) )
{
return 1;
}
}
@@ -173,12 +178,12 @@ sub _aironet_special {
sub _aironet_breakout_dot11idx {
my $oid = shift;
my @parts = split(/\./, $oid);
my @parts = split( /\./, $oid );
my $ifindex = shift(@parts);
my $ssidlen = shift(@parts);
my $ssid = pack("C*", splice(@parts, 0, $ssidlen));
my $mac = join(":", map {sprintf "%02x", $_} @parts);
return ($ifindex, $ssid, $mac);
my $ssid = pack( "C*", splice( @parts, 0, $ssidlen ) );
my $mac = join( ":", map { sprintf "%02x", $_ } @parts );
return ( $ifindex, $ssid, $mac );
}
sub fw_mac {
@@ -188,8 +193,8 @@ sub fw_mac {
my $c_dot11subif = $aironet->c_dot11subif();
my $fw_mac = {};
foreach my $i (keys %$c_dot11subif) {
my ($ifindex, $ssid, $mac) = _aironet_breakout_dot11idx($i);
foreach my $i ( keys %$c_dot11subif ) {
my ( $ifindex, $ssid, $mac ) = _aironet_breakout_dot11idx($i);
$fw_mac->{$i} = $mac;
}
return $fw_mac;
@@ -202,8 +207,8 @@ sub fw_port {
my $c_dot11subif = $aironet->c_dot11subif();
my $fw_port = {};
foreach my $i (keys %$c_dot11subif) {
my ($ifindex, $ssid, $mac) = _aironet_breakout_dot11idx($i);
foreach my $i ( keys %$c_dot11subif ) {
my ( $ifindex, $ssid, $mac ) = _aironet_breakout_dot11idx($i);
$fw_port->{$i} = $c_dot11subif->{$i} || $ifindex;
}
return $fw_port;
@@ -216,8 +221,8 @@ sub bp_index {
my $c_dot11subif = $aironet->c_dot11subif();
my $bp_index = {};
foreach my $i (keys %$c_dot11subif) {
my ($ifindex, $ssid, $mac) = _aironet_breakout_dot11idx($i);
foreach my $i ( keys %$c_dot11subif ) {
my ( $ifindex, $ssid, $mac ) = _aironet_breakout_dot11idx($i);
my ($i) = $c_dot11subif->{$i} || $ifindex;
$bp_index->{$i} = $i;
}
@@ -233,11 +238,11 @@ sub v_name {
my $v_name = {};
my $vlan_nameid = $aironet->cdot11SecVlanNameId();
foreach my $i (keys %$vlan_nameid) {
my @parts = split(/\./, $i);
foreach my $i ( keys %$vlan_nameid ) {
my @parts = split( /\./, $i );
my $namelen = shift(@parts);
my $name = pack("C*", @parts);
my $name = pack( "C*", @parts );
$v_name->{$i} = $name;
}
return $v_name;
@@ -254,9 +259,9 @@ sub i_vlan {
my $i_vlan = {};
my $idxmap = $aironet->cviRoutedVlanIfIndex();
foreach my $i (keys %$idxmap) {
my @parts = split(/\./, $i);
$i_vlan->{$idxmap->{$i}} = $parts[0];
foreach my $i ( keys %$idxmap ) {
my @parts = split( /\./, $i );
$i_vlan->{ $idxmap->{$i} } = $parts[0];
}
return $i_vlan;
}
@@ -265,7 +270,7 @@ sub i_vlan {
# 5.5Mbps is reported as 11.
sub munge_cd11_txrate {
my $txrates = shift;
my @units = unpack("C*", $txrates);
my @units = unpack( "C*", $txrates );
my @rates = map {
my $unit = $_;
$unit *= 0.5;
@@ -280,8 +285,8 @@ sub cd11_port {
my $cd11_sigstrength = $aironet->cd11_sigstrength();
my $interfaces = $aironet->interfaces();
my %ret;
foreach (keys %$cd11_sigstrength) {
my ($ifindex, $ssid, $mac) = _aironet_breakout_dot11idx($_);
foreach ( keys %$cd11_sigstrength ) {
my ( $ifindex, $ssid, $mac ) = _aironet_breakout_dot11idx($_);
$ret{$_} = $interfaces->{$ifindex};
}
return \%ret;
@@ -291,8 +296,8 @@ sub cd11_ssid {
my $aironet = shift;
my $cd11_sigstrength = $aironet->cd11_sigstrength();
my %ret;
foreach (keys %$cd11_sigstrength) {
my ($ifindex, $ssid, $mac) = _aironet_breakout_dot11idx($_);
foreach ( keys %$cd11_sigstrength ) {
my ( $ifindex, $ssid, $mac ) = _aironet_breakout_dot11idx($_);
$ret{$_} = $ssid;
}
return \%ret;
@@ -302,8 +307,8 @@ sub cd11_mac {
my $aironet = shift;
my $cd11_sigstrength = $aironet->cd11_sigstrength();
my %ret;
foreach (keys %$cd11_sigstrength) {
my ($ifindex, $ssid, $mac) = _aironet_breakout_dot11idx($_);
foreach ( keys %$cd11_sigstrength ) {
my ( $ifindex, $ssid, $mac ) = _aironet_breakout_dot11idx($_);
$ret{$_} = $mac;
}
return \%ret;
@@ -316,6 +321,7 @@ sub cd11_mac {
# to get the right overrides.
sub i_mac {
my $aironet = shift;
# no partial is possible due to the levels
# of indirection.
@@ -328,14 +334,14 @@ sub i_mac {
my $ifstack = $aironet->ifStackStatus();
my $vlan_list = {};
foreach my $idx (keys %$vlan_map) {
my ($vlan, $num) = split(/\./, $idx);
push(@{$vlan_list->{$vlan}}, $vlan_map->{$idx});
foreach my $idx ( keys %$vlan_map ) {
my ( $vlan, $num ) = split( /\./, $idx );
push( @{ $vlan_list->{$vlan} }, $vlan_map->{$idx} );
}
my $stack = {};
foreach my $idx (keys %$ifstack) {
my ($upper, $lower) = split(/\./, $idx);
foreach my $idx ( keys %$ifstack ) {
my ( $upper, $lower ) = split( /\./, $idx );
$stack->{$upper}->{$lower} = $ifstack->{$idx};
}
@@ -343,12 +349,12 @@ sub i_mac {
# ssid_vlan maps ssid->vlan.
# vlan_map maps vlan->[list of interfaces]
# ifstack allows us to pick the right interface
foreach my $idx (keys %$mbss_mac_addr) {
my ($interface, @ssid) = split(/\./, $idx);
my $vlan = $ssid_vlan->{join(".", scalar(@ssid), @ssid)};
foreach my $idx ( keys %$mbss_mac_addr ) {
my ( $interface, @ssid ) = split( /\./, $idx );
my $vlan = $ssid_vlan->{ join( ".", scalar(@ssid), @ssid ) };
next unless defined($vlan);
foreach my $vlanif (@{$vlan_list->{$vlan}}) {
if (defined($stack->{$vlanif}->{$interface})) {
foreach my $vlanif ( @{ $vlan_list->{$vlan} } ) {
if ( defined( $stack->{$vlanif}->{$interface} ) ) {
$mbss_mac->{$vlanif} = $mbss_mac_addr->{$idx};
}
}
@@ -357,7 +363,6 @@ sub i_mac {
return $mbss_mac;
}
1;
__END__

View File

@@ -42,25 +42,21 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
%GLOBALS = (
%SNMP::Info::Layer2::GLOBALS
);
%GLOBALS = ( %SNMP::Info::Layer2::GLOBALS );
%FUNCS = (
%SNMP::Info::Layer2::FUNCS,
'ip_adresses'=> 'atNetAddress',
'ip_adresses' => 'atNetAddress',
'ip_mac' => 'atPhysAddress',
);
);
%MIBS = (
%SNMP::Info::Layer2::MIBS,
'AtiSwitch-MIB' => 'atiswitchProductType',
'AtiStackInfo-MIB' => 'atiswitchEnhancedStacking',
);
);
%MUNGE = (
%SNMP::Info::Layer2::MUNGE,
);
%MUNGE = ( %SNMP::Info::Layer2::MUNGE, );
sub vendor {
return 'allied';
@@ -74,7 +70,7 @@ sub os_ver {
my $allied = shift;
my $descr = $allied->description();
if ($descr =~ m/version (\d+\.\d+)/){
if ( $descr =~ m/version (\d+\.\d+)/ ) {
return $1;
}
}
@@ -84,7 +80,7 @@ sub model {
my $desc = $allied->description();
if ($desc =~ /(AT-80\d{2}\S*)/){
if ( $desc =~ /(AT-80\d{2}\S*)/ ) {
return $1;
}
return;
@@ -95,19 +91,19 @@ sub root_ip {
my $ip_hash = $allied->ip_addresses();
my $found_ip;
foreach my $ip (values %{$ip_hash}) {
$found_ip = SNMP::Info::munge_ip($ip) if (defined $ip);
foreach my $ip ( values %{$ip_hash} ) {
$found_ip = SNMP::Info::munge_ip($ip) if ( defined $ip );
last; # this is only one IP address
}
return $found_ip;
}
sub mac{
sub mac {
my $allied = shift;
my $mac_hash = $allied->ip_mac();
my $found_mac;
foreach my $mac (values %{$mac_hash}) {
foreach my $mac ( values %{$mac_hash} ) {
$found_mac = SNMP::Info::munge_mac($mac);
last; # this is only one MAC address
}
@@ -118,9 +114,9 @@ sub i_up {
my $allied = shift;
my $partial = shift;
my $i_up = SNMP::Info::Layer1::i_up($allied, $partial);
my $i_up = SNMP::Info::Layer1::i_up( $allied, $partial );
foreach my $port (keys %$i_up){
foreach my $port ( keys %$i_up ) {
my $up = $i_up->{$port};
$i_up->{$port} = 'down' if $up eq 'linktesterror';
$i_up->{$port} = 'up' if $up eq 'nolinktesterror';

View File

@@ -45,14 +45,13 @@ $VERSION = '1.09';
%SNMP::Info::Layer2::MIBS,
'WLSX-SWITCH-MIB' => 'wlsxHostname',
'WLSR-AP-MIB' => 'wlsrHideSSID',
);
);
%GLOBALS = (
%SNMP::Info::Layer2::GLOBALS,
);
%GLOBALS = ( %SNMP::Info::Layer2::GLOBALS, );
%FUNCS = (
%SNMP::Info::Layer2::FUNCS,
# WLSX-SWITCH-MIB::wlsxSwitchAccessPointTable
# Table index leafs do not return information
# therefore unable to use apBSSID. We extract
@@ -61,8 +60,10 @@ $VERSION = '1.09';
'aruba_ap_ip' => 'apIpAddress',
'aruba_ap_essid' => 'apESSID',
'aruba_ap_ssidbcast' => 'wlsrHideSSID',
# WLSR-AP-MIB::wlsrConfigTable
'aruba_ap_channel' => 'apCurrentChannel',
# WLSX-SWITCH-MIB::wlsxSwitchStationMgmtTable
# Table index leafs do not return information
# therefore unable to use staAccessPointBSSID
@@ -71,11 +72,9 @@ $VERSION = '1.09';
#'fw_port' => 'staAccessPointBSSID',
#'fw_mac' => 'staPhyAddress',
'fw_user' => 'staUserName',
);
);
%MUNGE = (
%SNMP::Info::Layer2::MUNGE,
);
%MUNGE = ( %SNMP::Info::Layer2::MUNGE, );
sub layers {
return '00000011';
@@ -94,7 +93,7 @@ sub os_ver {
my $descr = $aruba->description();
return unless defined $descr;
if ($descr =~ m/Version\s+(\d+\.\d+\.\d+\.\d+)/){
if ( $descr =~ m/Version\s+(\d+\.\d+\.\d+\.\d+)/ ) {
return $1;
}
@@ -121,7 +120,7 @@ sub i_index {
my $ap_index = $aruba->aruba_ap_name($partial) || {};
my %if_index;
foreach my $iid (keys %$i_index){
foreach my $iid ( keys %$i_index ) {
my $index = $i_index->{$iid};
next unless defined $index;
@@ -129,9 +128,11 @@ sub i_index {
}
# Get Attached APs as Interfaces
foreach my $ap_id (keys %$ap_index){
foreach my $ap_id ( keys %$ap_index ) {
# Convert the 0.254.123.456 index entry to a MAC address.
my $mac = join(':',map {sprintf("%02x",$_)} split(/\./,$ap_id));
my $mac = join( ':',
map { sprintf( "%02x", $_ ) } split( /\./, $ap_id ) );
$if_index{$ap_id} = $mac;
}
@@ -146,18 +147,19 @@ sub interfaces {
my $i_descr = $aruba->i_description($partial) || {};
my %if;
foreach my $iid (keys %$i_index){
foreach my $iid ( keys %$i_index ) {
my $index = $i_index->{$iid};
next unless defined $index;
if ($index =~ /^\d+$/ ) {
if ( $index =~ /^\d+$/ ) {
# Replace the Index with the ifDescr field.
my $port = $i_descr->{$iid};
next unless defined $port;
$if{$iid} = $port;
}
elsif ($index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/) {
elsif ( $index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/ ) {
$if{$index} = $index;
}
@@ -177,17 +179,17 @@ sub i_name {
my $ap_name = $aruba->aruba_ap_name($partial) || {};
my %i_name;
foreach my $iid (keys %$i_index){
foreach my $iid ( keys %$i_index ) {
my $index = $i_index->{$iid};
next unless defined $index;
if ($index =~ /^\d+$/ ) {
if ( $index =~ /^\d+$/ ) {
my $name = $i_name2->{$iid};
next unless defined $name;
$i_name{$index} = $name;
}
elsif ($index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/) {
elsif ( $index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/ ) {
my $name = $ap_name->{$iid};
next unless defined $name;
$i_name{$index} = $name;
@@ -207,11 +209,11 @@ sub i_ssidlist {
my $ap_ssid = $aruba->aruba_ap_essid($partial) || {};
my %i_ssid;
foreach my $iid (keys %$i_index){
foreach my $iid ( keys %$i_index ) {
my $index = $i_index->{$iid};
next unless defined $index;
if ($index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/) {
if ( $index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/ ) {
my $ssid = $ap_ssid->{$iid};
next unless defined $ssid;
$i_ssid{$index} = $ssid;
@@ -231,11 +233,11 @@ sub i_80211channel {
my $ap_ch = $aruba->aruba_ap_channel($partial) || {};
my %i_ch;
foreach my $iid (keys %$i_index){
foreach my $iid ( keys %$i_index ) {
my $index = $i_index->{$iid};
next unless defined $index;
if ($index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/) {
if ( $index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/ ) {
my $ch = $ap_ch->{$iid};
next unless defined $ch;
$i_ch{$index} = $ch;
@@ -255,14 +257,14 @@ sub i_ssidbcast {
my $ap_bc = $aruba->aruba_ap_ssidbcast($partial) || {};
my %i_bc;
foreach my $iid (keys %$i_index){
foreach my $iid ( keys %$i_index ) {
my $index = $i_index->{$iid};
next unless defined $index;
if ($index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/) {
if ( $index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/ ) {
my $bc = $ap_bc->{$iid};
next unless defined $bc;
$bc = ($bc ? 0 : 1);
$bc = ( $bc ? 0 : 1 );
$i_bc{$index} = $bc;
}
else {
@@ -272,7 +274,6 @@ sub i_ssidbcast {
return \%i_bc;
}
# Wireless switches do not support the standard Bridge MIB
sub bp_index {
my $aruba = shift;
@@ -282,7 +283,7 @@ sub bp_index {
my $ap_index = $aruba->aruba_ap_name($partial) || {};
my %bp_index;
foreach my $iid (keys %$i_index){
foreach my $iid ( keys %$i_index ) {
my $index = $i_index->{$iid};
next unless defined $index;
@@ -290,9 +291,11 @@ sub bp_index {
}
# Get Attached APs as Interfaces
foreach my $ap_id (keys %$ap_index){
foreach my $ap_id ( keys %$ap_index ) {
# Convert the 0.254.123.456 index entry to a MAC address.
my $mac = join(':',map {sprintf("%02x",$_)} split(/\./,$ap_id));
my $mac = join( ':',
map { sprintf( "%02x", $_ ) } split( /\./, $ap_id ) );
$bp_index{$mac} = $mac;
}
@@ -306,9 +309,13 @@ sub fw_port {
my $fw_idx = $aruba->fw_user($partial) || {};
my %fw_port;
foreach my $iid (keys %$fw_idx){
if ($iid =~ /(\d+\.\d+\.\d+\.\d+\.\d+\.\d+).(\d+\.\d+\.\d+\.\d+\.\d+\.\d+)/) {
my $port = join(':',map {sprintf("%02x",$_)} split(/\./,$2));
foreach my $iid ( keys %$fw_idx ) {
if ( $iid
=~ /(\d+\.\d+\.\d+\.\d+\.\d+\.\d+).(\d+\.\d+\.\d+\.\d+\.\d+\.\d+)/
)
{
my $port = join( ':',
map { sprintf( "%02x", $_ ) } split( /\./, $2 ) );
$fw_port{$iid} = $port;
}
else {
@@ -325,9 +332,13 @@ sub fw_mac {
my $fw_idx = $aruba->fw_user($partial) || {};
my %fw_mac;
foreach my $iid (keys %$fw_idx){
if ($iid =~ /(\d+\.\d+\.\d+\.\d+\.\d+\.\d+).(\d+\.\d+\.\d+\.\d+\.\d+\.\d+)/) {
my $mac = join(':',map {sprintf("%02x",$_)} split(/\./,$1));
foreach my $iid ( keys %$fw_idx ) {
if ( $iid
=~ /(\d+\.\d+\.\d+\.\d+\.\d+\.\d+).(\d+\.\d+\.\d+\.\d+\.\d+\.\d+)/
)
{
my $mac = join( ':',
map { sprintf( "%02x", $_ ) } split( /\./, $1 ) );
$fw_mac{$iid} = $mac;
}
else {
@@ -366,10 +377,10 @@ Eric Miller
=head1 DESCRIPTION
SNMP::Info::Layer2::Aruba is a subclass of SNMP::Info that provides an interface
to Aruba wireless switches. The Aruba platform utilizes intelligent wireless
switches which control thin access points. The thin access points themselves
are unable to be polled for end station information.
SNMP::Info::Layer2::Aruba is a subclass of SNMP::Info that provides an
interface to Aruba wireless switches. The Aruba platform utilizes
intelligent wireless switches which control thin access points. The thin
access points themselves are unable to be polled for end station information.
This class emulates bridge functionality for the wireless switch. This enables
end station MAC addresses collection and correlation to the thin access point
@@ -464,8 +475,8 @@ interfaces. The thin AP MAC address is used as the port identifier.
=item $aruba->i_name()
Interface name. Returns (C<ifName>) for Ethernet interfaces and (C<apLocation>)
for thin AP interfaces.
Interface name. Returns (C<ifName>) for Ethernet interfaces and
(C<apLocation>) for thin AP interfaces.
=item $aruba->bp_index()

View File

@@ -45,13 +45,16 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
# Set for No CDP
%GLOBALS = ( %SNMP::Info::Layer2::GLOBALS,
%GLOBALS = (
%SNMP::Info::Layer2::GLOBALS,
'cdp_id' => 's5EnMsTopIpAddr',
'cdp_run' => 's5EnMsTopStatus',
);
);
%FUNCS = (%SNMP::Info::Layer2::FUNCS,
%FUNCS = (
%SNMP::Info::Layer2::FUNCS,
'imac2' => 'ifPhysAddress',
# S5-ETH-MULTISEG-TOPOLOGY-MIB::s5EnMsTopNmmTable
'bay_topo_slot' => 's5EnMsTopNmmSlot',
'bay_topo_port' => 's5EnMsTopNmmPort',
@@ -60,22 +63,21 @@ $VERSION = '1.09';
'bay_topo_mac' => 's5EnMsTopNmmMacAddr',
'bay_topo_platform' => 's5EnMsTopNmmChassisType',
'bay_topo_localseg' => 's5EnMsTopNmmLocalSeg',
);
);
%MIBS = (
%SNMP::Info::Layer2::MIBS,
'SYNOPTICS-ROOT-MIB' => 'synoptics',
'S5-ETH-MULTISEG-TOPOLOGY-MIB' => 's5EnMsTop'
);
);
delete $MIBS{'CISCO-CDP-MIB'};
# 450's report full duplex as speed = 20mbps?!
$SNMP::Info::SPEED_MAP{20_000_000} = '10 Mbps';
$SNMP::Info::SPEED_MAP{200_000_000} = '100 Mbps';
%MUNGE = (%SNMP::Info::Layer2::MUNGE,
'i_mac2' => \&SNMP::Info::munge_mac ,
);
%MUNGE = ( %SNMP::Info::Layer2::MUNGE, 'i_mac2' => \&SNMP::Info::munge_mac, );
sub os {
return 'bay';
@@ -87,12 +89,12 @@ sub os_ver {
return unless defined $descr;
# 303 / 304
if ($descr =~ m/Rev: \d+\.\d+\.\d+\.\d+-(\d+\.\d+\.\d+\.\d+)/){
if ( $descr =~ m/Rev: \d+\.\d+\.\d+\.\d+-(\d+\.\d+\.\d+\.\d+)/ ) {
return $1;
}
# 450
if ($descr =~ m/SW:v(\d+\.\d+\.\d+\.\d+)/){
if ( $descr =~ m/SW:v(\d+\.\d+\.\d+\.\d+)/ ) {
return $1;
}
return;
@@ -104,18 +106,19 @@ sub os_bin {
return unless defined $descr;
# 303 / 304
if ($descr =~ m/Rev: \d+\.(\d+\.\d+\.\d+)-\d+\.\d+\.\d+\.\d+/){
if ( $descr =~ m/Rev: \d+\.(\d+\.\d+\.\d+)-\d+\.\d+\.\d+\.\d+/ ) {
return $1;
}
# 450
if ($descr =~ m/FW:v(\d+\.\d+\.\d+\.\d+)/){
if ( $descr =~ m/FW:v(\d+\.\d+\.\d+\.\d+)/ ) {
return $1;
}
return;
}
sub vendor {
# or nortel, or synopsis?
return 'bay';
}
@@ -127,7 +130,7 @@ sub i_ignore {
my $i_type = $bay->i_type();
my %i_ignore;
foreach my $if (keys %$i_type){
foreach my $if ( keys %$i_type ) {
my $type = $i_type->{$if};
$i_ignore{$if}++ if $type =~ /(loopback|propvirtual|cpu)/i;
}
@@ -147,14 +150,13 @@ sub i_mac {
my $i_mac = $bay->i_mac2();
# Bay 303's with a hw rev < 2.11.4.5 report the mac as all zeros
foreach my $iid (keys %$i_mac){
foreach my $iid ( keys %$i_mac ) {
my $mac = $i_mac->{$iid};
delete $i_mac->{$iid} if $mac eq '00:00:00:00:00:00';
}
return $i_mac;
}
sub model {
my $bay = shift;
my $id = $bay->id();
@@ -165,9 +167,9 @@ sub model {
my $descr = $bay->description();
return '303' if ($descr =~ /\D303\D/);
return '304' if ($descr =~ /\D304\D/);
return '450' if ($model =~ /BayStack450/);
return '303' if ( $descr =~ /\D303\D/ );
return '304' if ( $descr =~ /\D304\D/ );
return '450' if ( $model =~ /BayStack450/ );
return $model;
}
@@ -178,7 +180,7 @@ sub c_if {
my $bay_topo_port = $bay->bay_topo_port();
my %c_if;
foreach my $entry (keys %$bay_topo_port){
foreach my $entry ( keys %$bay_topo_port ) {
my $port = $bay_topo_port->{$entry};
next unless defined $port;
next if $port == 0;
@@ -197,20 +199,21 @@ sub c_ip {
# more than one device seen means connected to a non-bay
# device, but other bay devices are squawking further away.
my %ip_port;
foreach my $entry (keys %$bay_topo_ip){
foreach my $entry ( keys %$bay_topo_ip ) {
my $port = $bay_topo_port->{$entry};
next unless defined $port;
next if ($port =~ /^[\d\.]+$/ and $port == 0);
next if ( $port =~ /^[\d\.]+$/ and $port == 0 );
my $ip = $bay_topo_ip->{$entry};
push(@{$ip_port{$port}},$ip);
push( @{ $ip_port{$port} }, $ip );
}
my %c_ip;
foreach my $port (keys %ip_port){
foreach my $port ( keys %ip_port ) {
my $ips = $ip_port{$port};
if (scalar @$ips == 1) {
if ( scalar @$ips == 1 ) {
$c_ip{"$port.1"} = $ips->[0];
} else {
}
else {
$c_ip{"$port.1"} = $ips;
}
}
@@ -224,7 +227,7 @@ sub c_port {
my $bay_topo_seg = $bay->bay_topo_seg();
my %c_port;
foreach my $entry (keys %$bay_topo_seg){
foreach my $entry ( keys %$bay_topo_seg ) {
my $port = $bay_topo_port->{$entry};
next unless defined $port;
next if $port == 0;
@@ -248,9 +251,8 @@ sub c_platform {
my $bay_topo_port = $bay->bay_topo_port();
my $bay_topo_platform = $bay->bay_topo_platform();
my %c_platform;
foreach my $entry (keys %$bay_topo_platform){
foreach my $entry ( keys %$bay_topo_platform ) {
my $port = $bay_topo_port->{$entry} || 0;
next if $port == 0;
@@ -446,7 +448,8 @@ Returns reference to hash. Key: Table entry, Value:slot number
=item $bay->bay_topo_port()
Returns reference to hash. Key: Table entry, Value:Port Number (interface iid)
Returns reference to hash. Key: Table entry, Value:Port Number
(interface iid)
(C<s5EnMsTopNmmPort>)

View File

@@ -38,7 +38,8 @@ use SNMP::Info::RapidCity;
use SNMP::Info::LLDP;
use SNMP::Info::Layer3;
@SNMP::Info::Layer2::Baystack::ISA = qw/SNMP::Info::SONMP SNMP::Info::NortelStack
@SNMP::Info::Layer2::Baystack::ISA
= qw/SNMP::Info::SONMP SNMP::Info::NortelStack
SNMP::Info::RapidCity SNMP::Info::LLDP
SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer2::Baystack::EXPORT_OK = qw//;
@@ -48,28 +49,22 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::LLDP::MIBS,
%SNMP::Info::RapidCity::MIBS,
%SNMP::Info::NortelStack::MIBS,
%SNMP::Info::Layer3::MIBS, %SNMP::Info::LLDP::MIBS,
%SNMP::Info::RapidCity::MIBS, %SNMP::Info::NortelStack::MIBS,
%SNMP::Info::SONMP::MIBS,
);
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::LLDP::GLOBALS,
%SNMP::Info::RapidCity::GLOBALS,
%SNMP::Info::NortelStack::GLOBALS,
%SNMP::Info::Layer3::GLOBALS, %SNMP::Info::LLDP::GLOBALS,
%SNMP::Info::RapidCity::GLOBALS, %SNMP::Info::NortelStack::GLOBALS,
%SNMP::Info::SONMP::GLOBALS,
);
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::LLDP::FUNCS,
%SNMP::Info::RapidCity::FUNCS,
%SNMP::Info::NortelStack::FUNCS,
%SNMP::Info::Layer3::FUNCS, %SNMP::Info::LLDP::FUNCS,
%SNMP::Info::RapidCity::FUNCS, %SNMP::Info::NortelStack::FUNCS,
%SNMP::Info::SONMP::FUNCS,
);
);
# 450's report full duplex as speed = 20mbps?!
$SNMP::Info::SPEED_MAP{20_000_000} = '10 Mbps';
@@ -77,22 +72,27 @@ $SNMP::Info::SPEED_MAP{200_000_000} = '100 Mbps';
$SNMP::Info::SPEED_MAP{2_000_000_000} = '1.0 Gbps';
%MUNGE = (
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::LLDP::MUNGE,
%SNMP::Info::RapidCity::MUNGE,
%SNMP::Info::NortelStack::MUNGE,
%SNMP::Info::Layer3::MUNGE, %SNMP::Info::LLDP::MUNGE,
%SNMP::Info::RapidCity::MUNGE, %SNMP::Info::NortelStack::MUNGE,
%SNMP::Info::SONMP::MUNGE,
);
);
sub os {
my $baystack = shift;
my $descr = $baystack->description();
my $model = $baystack->model();
if ((defined $model and $model =~ /(325|420|425|470|460|BPS|2500|3510|4524|4526|4548|4550|5510|5520|5530)/) and (defined $descr and $descr =~ m/SW:v[3-5]/i)) {
if (( defined $model
and $model
=~ /(325|420|425|470|460|BPS|2500|3510|4524|4526|4548|4550|5510|5520|5530)/
)
and ( defined $descr and $descr =~ m/SW:v[3-5]/i )
)
{
return 'boss';
}
if ((defined $descr and $descr =~ /Business Ethernet Switch.*SW:v/i)) {
if ( ( defined $descr and $descr =~ /Business Ethernet Switch.*SW:v/i ) )
{
return 'bes';
}
return 'baystack';
@@ -104,16 +104,16 @@ sub os_bin {
return unless defined $descr;
# 303 / 304
if ($descr =~ m/Rev: \d+\.(\d+\.\d+\.\d+)-\d+\.\d+\.\d+\.\d+/){
if ( $descr =~ m/Rev: \d+\.(\d+\.\d+\.\d+)-\d+\.\d+\.\d+\.\d+/ ) {
return $1;
}
# 450
if ($descr =~ m/FW:V(\d+\.\d+)/){
if ( $descr =~ m/FW:V(\d+\.\d+)/ ) {
return $1;
}
if ($descr =~ m/FW:(\d+\.\d+\.\d+\.\d+)/i){
if ( $descr =~ m/FW:(\d+\.\d+\.\d+\.\d+)/i ) {
return $1;
}
return;
@@ -132,10 +132,12 @@ sub model {
my $descr = $baystack->description();
return '303' if (defined $descr and $descr =~ /\D303\D/);
return '304' if (defined $descr and $descr =~ /\D304\D/);
return 'BPS' if ($model =~ /BPS2000/i);
return $2 if ($model =~ /(ES|ERS|BayStack|EthernetRoutingSwitch|EthernetSwitch)-?(\d+)/);
return '303' if ( defined $descr and $descr =~ /\D303\D/ );
return '304' if ( defined $descr and $descr =~ /\D304\D/ );
return 'BPS' if ( $model =~ /BPS2000/i );
return $2
if ( $model
=~ /(ES|ERS|BayStack|EthernetRoutingSwitch|EthernetSwitch)-?(\d+)/ );
return $model;
}
@@ -149,14 +151,15 @@ sub interfaces {
my $slot_offset = $baystack->slot_offset();
my %if;
foreach my $iid (keys %$i_index){
foreach my $iid ( keys %$i_index ) {
my $index = $i_index->{$iid};
next unless defined $index;
# Ignore cascade ports
next if $index > 513;
my $port = ($index % $index_factor);
my $slot = (int($index / $index_factor)) + $slot_offset;
my $port = ( $index % $index_factor );
my $slot = ( int( $index / $index_factor ) ) + $slot_offset;
my $slotport = "$slot.$port";
$if{$iid} = $slotport;
@@ -171,12 +174,13 @@ sub i_mac {
my $i_mac = $baystack->orig_i_mac($partial) || {};
my %i_mac;
# Baystack 303's with a hw rev < 2.11.4.5 report the mac as all zeros
foreach my $iid (keys %$i_mac){
foreach my $iid ( keys %$i_mac ) {
my $mac = $i_mac->{$iid};
next unless defined $mac;
next if $mac eq '00:00:00:00:00:00';
$i_mac{$iid}=$mac;
$i_mac{$iid} = $mac;
}
return \%i_mac;
}
@@ -190,12 +194,13 @@ sub i_name {
my $i_name2 = $baystack->orig_i_name($partial) || {};
my %i_name;
foreach my $iid (keys %$i_name2){
foreach my $iid ( keys %$i_name2 ) {
my $name = $i_name2->{$iid};
my $alias = $i_alias->{$iid};
$i_name{$iid} = (defined $alias and $alias !~ /^\s*$/) ?
$alias :
$name;
$i_name{$iid}
= ( defined $alias and $alias !~ /^\s*$/ )
? $alias
: $name;
}
return \%i_name;
@@ -210,7 +215,9 @@ sub index_factor {
$op_mode = 'pure' unless defined $op_mode;
my $index_factor = 32;
$index_factor = 64 if ((defined $model and $model =~ /(470)/) or ($os =~ m/(boss|bes)/) and ($op_mode eq 'pure'));
$index_factor = 64
if ( ( defined $model and $model =~ /(470)/ )
or ( $os =~ m/(boss|bes)/ ) and ( $op_mode eq 'pure' ) );
return $index_factor;
}
@@ -231,14 +238,14 @@ sub c_ip {
my $lldp = $baystack->lldp_ip($partial) || {};
my %c_ip;
foreach my $iid (keys %$cdp){
foreach my $iid ( keys %$cdp ) {
my $ip = $cdp->{$iid};
next unless defined $ip;
$c_ip{$iid} = $ip;
}
foreach my $iid (keys %$lldp){
foreach my $iid ( keys %$lldp ) {
my $ip = $lldp->{$iid};
next unless defined $ip;
@@ -251,18 +258,18 @@ sub c_if {
my $baystack = shift;
my $partial = shift;
my $lldp = $baystack->lldp_if($partial) || {};;
my $lldp = $baystack->lldp_if($partial) || {};
my $cdp = $baystack->SUPER::c_if($partial) || {};
my %c_if;
foreach my $iid (keys %$cdp){
foreach my $iid ( keys %$cdp ) {
my $if = $cdp->{$iid};
next unless defined $if;
$c_if{$iid} = $if;
}
foreach my $iid (keys %$lldp){
foreach my $iid ( keys %$lldp ) {
my $if = $lldp->{$iid};
next unless defined $if;
@@ -279,14 +286,14 @@ sub c_port {
my $cdp = $baystack->SUPER::c_port($partial) || {};
my %c_port;
foreach my $iid (keys %$cdp){
foreach my $iid ( keys %$cdp ) {
my $port = $cdp->{$iid};
next unless defined $port;
$c_port{$iid} = $port;
}
foreach my $iid (keys %$lldp){
foreach my $iid ( keys %$lldp ) {
my $port = $lldp->{$iid};
next unless defined $port;
@@ -303,14 +310,14 @@ sub c_id {
my $cdp = $baystack->SUPER::c_id($partial) || {};
my %c_id;
foreach my $iid (keys %$cdp){
foreach my $iid ( keys %$cdp ) {
my $id = $cdp->{$iid};
next unless defined $id;
$c_id{$iid} = $id;
}
foreach my $iid (keys %$lldp){
foreach my $iid ( keys %$lldp ) {
my $id = $lldp->{$iid};
next unless defined $id;
@@ -327,14 +334,14 @@ sub c_platform {
my $cdp = $baystack->SUPER::c_platform($partial) || {};
my %c_platform;
foreach my $iid (keys %$cdp){
foreach my $iid ( keys %$cdp ) {
my $platform = $cdp->{$iid};
next unless defined $platform;
$c_platform{$iid} = $platform;
}
foreach my $iid (keys %$lldp){
foreach my $iid ( keys %$lldp ) {
my $platform = $lldp->{$iid};
next unless defined $platform;
@@ -582,7 +589,8 @@ to a hash.
Returns reference to the map between IID and physical Port.
Slot and port numbers on the Baystack switches are determined by the formula:
Slot and port numbers on the Baystack switches are determined by the
formula:
port = (Interface index % Index factor)
slot = (int(Interface index / Index factor)) + Slot offset
@@ -602,7 +610,8 @@ revisions of Baystack firmware report all zeros for each port mac.
=item $baystack->i_name()
Crosses C<ifName> with C<ifAlias> and returns the human set port name if exists.
Crosses C<ifName> with C<ifAlias> and returns the human set port name if
exists.
=back
@@ -701,8 +710,8 @@ Returns reference to hash. Key: iid Value: remote IPv4 address
If multiple entries exist with the same local port, c_if(), with the same IPv4
address, c_ip(), it may be a duplicate entry.
If multiple entries exist with the same local port, c_if(), with different IPv4
addresses, c_ip(), there is either a non-SONMP/LLDP device in between two or
If multiple entries exist with the same local port, c_if(), with different
IPv4 addresses, c_ip(), there is either a non-SONMP/LLDP device in between two or
more devices or multiple devices which are not directly connected.
Use the data from the Layer2 Topology Table below to dig deeper.

View File

@@ -54,13 +54,14 @@ $VERSION = '1.09';
%SNMP::Info::CiscoStats::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
'c1900_flash_status' => 'upgradeFlashBankStatus',
);
);
%FUNCS = (
%SNMP::Info::Layer2::FUNCS,
%SNMP::Info::CiscoConfig::FUNCS,
%SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::CDP::FUNCS,
# ESSWITCH-MIB
'c1900_p_index' => 'swPortIndex',
'c1900_p_ifindex' => 'swPortIfIndex',
@@ -70,23 +71,22 @@ $VERSION = '1.09';
'c1900_p_up_admin' => 'swPortAdminStatus',
'c1900_p_type' => 'swPortMediaCapability',
'c1900_p_media' => 'swPortConnectorType',
);
);
%MIBS = (
%SNMP::Info::Layer2::MIBS,
%SNMP::Info::CiscoConfig::MIBS,
%SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::CDP::MIBS,
# Also known as the ESSWITCH-MIB
'STAND-ALONE-ETHERNET-SWITCH-MIB' => 'series2000'
);
);
%MUNGE = (
%SNMP::Info::Layer2::MUNGE,
%SNMP::Info::CiscoConfig::MUNGE,
%SNMP::Info::CiscoStats::MUNGE,
%SNMP::Info::CDP::MUNGE,
);
%SNMP::Info::Layer2::MUNGE, %SNMP::Info::CiscoConfig::MUNGE,
%SNMP::Info::CiscoStats::MUNGE, %SNMP::Info::CDP::MUNGE,
);
sub bulkwalk_no { return 1; }
sub cisco_comm_indexing { return 1; }
@@ -203,25 +203,26 @@ sub i_vlan {
my $partial = shift;
# Overlap allows more than one VLAN per port. Unable to determine default
my $overlap = $c1900->bridgeGroupAllowMembershipOverlap() ||
$c1900->vlanAllowMembershipOverlap() || 'disabled';
my $overlap = $c1900->bridgeGroupAllowMembershipOverlap()
|| $c1900->vlanAllowMembershipOverlap()
|| 'disabled';
if ($overlap eq 'enabled') {
if ( $overlap eq 'enabled' ) {
return;
}
my $member_of = $c1900->bridgeGroupMemberPortOfBridgeGroup() ||
$c1900->vlanMemberPortOfVlan();
my $member_of = $c1900->bridgeGroupMemberPortOfBridgeGroup()
|| $c1900->vlanMemberPortOfVlan();
my $i_pvid = {};
foreach my $idx (keys %$member_of) {
my @values = split(/\./, $idx);
my ($vlan, $port) = @values;
foreach my $idx ( keys %$member_of ) {
my @values = split( /\./, $idx );
my ( $vlan, $port ) = @values;
next unless $vlan;
next unless $port;
next if (defined $partial and $port !~ /^$partial$/);
next if ( defined $partial and $port !~ /^$partial$/ );
my $value = $member_of->{$idx};
next if ($value eq 'false');
next if ( $value eq 'false' );
$i_pvid->{$port} = $vlan;
}
@@ -232,20 +233,20 @@ sub i_vlan_membership {
my $c1900 = shift;
my $partial = shift;
my $member_of = $c1900->bridgeGroupMemberPortOfBridgeGroup() ||
$c1900->vlanMemberPortOfVlan();
my $member_of = $c1900->bridgeGroupMemberPortOfBridgeGroup()
|| $c1900->vlanMemberPortOfVlan();
my $i_vlan_membership = {};
foreach my $idx (keys %$member_of) {
my @values = split(/\./, $idx);
my ($vlan, $port) = @values;
foreach my $idx ( keys %$member_of ) {
my @values = split( /\./, $idx );
my ( $vlan, $port ) = @values;
next unless $vlan;
next unless $port;
next if (defined $partial and $port !~ /^$partial$/);
next if ( defined $partial and $port !~ /^$partial$/ );
my $value = $member_of->{$idx};
next if ($value eq 'false');
next if ( $value eq 'false' );
push(@{$i_vlan_membership->{$port}}, $vlan);
push( @{ $i_vlan_membership->{$port} }, $vlan );
}
return $i_vlan_membership;
}
@@ -499,9 +500,10 @@ See L<SNMP::Info::Layer2/"TABLE METHODS"> for details.
=head1 SET METHODS
These are methods that provide SNMP set functionality for overridden methods or
provide a simpler interface to complex set operations. See
L<SNMP::Info/"SETTING DATA VIA SNMP"> for general information on set operations.
These are methods that provide SNMP set functionality for overridden methods
or provide a simpler interface to complex set operations. See
L<SNMP::Info/"SETTING DATA VIA SNMP"> for general information on set
operations.
=over

View File

@@ -50,12 +50,10 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
%GLOBALS = (
%SNMP::Info::Layer2::GLOBALS,
%SNMP::Info::CiscoConfig::GLOBALS,
%SNMP::Info::CiscoStats::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
%SNMP::Info::Layer2::GLOBALS, %SNMP::Info::CiscoConfig::GLOBALS,
%SNMP::Info::CiscoStats::GLOBALS, %SNMP::Info::CDP::GLOBALS,
%SNMP::Info::CiscoVTP::GLOBALS,
);
);
%FUNCS = (
%SNMP::Info::Layer2::FUNCS,
@@ -64,29 +62,25 @@ $VERSION = '1.09';
%SNMP::Info::CDP::FUNCS,
%SNMP::Info::CiscoVTP::FUNCS,
'i_name' => 'ifAlias',
# C2900PortEntry
'c2900_p_index' => 'c2900PortIfIndex',
'c2900_p_duplex' => 'c2900PortDuplexStatus',
'c2900_p_duplex_admin' => 'c2900PortDuplexState',
'c2900_p_speed_admin' => 'c2900PortAdminSpeed',
);
);
%MIBS = (
%SNMP::Info::Layer2::MIBS,
%SNMP::Info::CiscoConfig::MIBS,
%SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::CDP::MIBS,
%SNMP::Info::CiscoVTP::MIBS,
'CISCO-C2900-MIB' => 'ciscoC2900MIB',
);
%SNMP::Info::Layer2::MIBS, %SNMP::Info::CiscoConfig::MIBS,
%SNMP::Info::CiscoStats::MIBS, %SNMP::Info::CDP::MIBS,
%SNMP::Info::CiscoVTP::MIBS, 'CISCO-C2900-MIB' => 'ciscoC2900MIB',
);
%MUNGE = (
%SNMP::Info::Layer2::MUNGE,
%SNMP::Info::CiscoConfig::MUNGE,
%SNMP::Info::CiscoStats::MUNGE,
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::Layer2::MUNGE, %SNMP::Info::CiscoConfig::MUNGE,
%SNMP::Info::CiscoStats::MUNGE, %SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE,
);
);
sub vendor {
return 'cisco';
@@ -107,7 +101,7 @@ sub i_duplex {
my %reverse_2900 = reverse %$c2900_p_index;
my %i_duplex;
foreach my $if (keys %$interfaces){
foreach my $if ( keys %$interfaces ) {
my $port_2900 = $reverse_2900{$if};
next unless defined $port_2900;
my $duplex = $c2900_p_duplex->{$port_2900};
@@ -115,7 +109,7 @@ sub i_duplex {
$duplex = 'half' if $duplex =~ /half/i;
$duplex = 'full' if $duplex =~ /full/i;
$i_duplex{$if}=$duplex;
$i_duplex{$if} = $duplex;
}
return \%i_duplex;
}
@@ -131,7 +125,7 @@ sub i_duplex_admin {
my %reverse_2900 = reverse %$c2900_p_index;
my %i_duplex_admin;
foreach my $if (keys %$interfaces){
foreach my $if ( keys %$interfaces ) {
my $port_2900 = $reverse_2900{$if};
next unless defined $port_2900;
my $duplex = $c2900_p_admin->{$port_2900};
@@ -140,14 +134,14 @@ sub i_duplex_admin {
$duplex = 'half' if $duplex =~ /half/i;
$duplex = 'full' if $duplex =~ /full/i;
$duplex = 'auto' if $duplex =~ /auto/i;
$i_duplex_admin{$if}=$duplex;
$i_duplex_admin{$if} = $duplex;
}
return \%i_duplex_admin;
}
sub set_i_speed_admin {
my $c2900 = shift;
my ($speed, $iid) = @_;
my ( $speed, $iid ) = @_;
# map speeds to those the switch will understand
my %speeds = qw/auto 1 10 10000000 100 100000000/;
@@ -162,12 +156,12 @@ sub set_i_speed_admin {
# account for weirdness of c2900 mib
$iid = $reverse_2900{$iid};
return $c2900->set_c2900_p_speed_admin($speeds{$speed}, $iid);
return $c2900->set_c2900_p_speed_admin( $speeds{$speed}, $iid );
}
sub set_i_duplex_admin {
my $c2900 = shift;
my ($duplex, $iid) = @_;
my ( $duplex, $iid ) = @_;
# map a textual duplex to an integer one the switch understands
my %duplexes = qw/full 1 half 2 auto 3/;
@@ -182,7 +176,7 @@ sub set_i_duplex_admin {
# account for weirdness of c2900 mib
$iid = $reverse_2900{$iid};
return $c2900->set_c2900_p_duplex_admin($duplexes{$duplex}, $iid);
return $c2900->set_c2900_p_duplex_admin( $duplexes{$duplex}, $iid );
}
# Use i_descritption for port key, cuz i_name can be manually entered.
@@ -194,17 +188,17 @@ sub interfaces {
my $i_descr = $c2900->i_description($partial) || {};
my %if;
foreach my $iid (keys %$interfaces){
foreach my $iid ( keys %$interfaces ) {
my $port = $i_descr->{$iid};
next unless defined $port;
$port =~ s/\./\//g if( $port =~ /\d+\.\d+$/);
$port =~ s/\./\//g if ( $port =~ /\d+\.\d+$/ );
$port =~ s/[^\d\/,()\w]+//gi;
$if{$iid} = $port;
}
return \%if
return \%if;
}
1;
@@ -409,9 +403,10 @@ See L<SNMP::Info::Layer2/"TABLE METHODS"> for details.
=head1 SET METHODS
These are methods that provide SNMP set functionality for overridden methods or
provide a simpler interface to complex set operations. See
L<SNMP::Info/"SETTING DATA VIA SNMP"> for general information on set operations.
These are methods that provide SNMP set functionality for overridden methods
or provide a simpler interface to complex set operations. See
L<SNMP::Info/"SETTING DATA VIA SNMP"> for general information on set
operations.
=over

View File

@@ -40,24 +40,22 @@ use SNMP::Info::CiscoStats;
use SNMP::Info::CiscoPortSecurity;
use SNMP::Info::Layer2;
@SNMP::Info::Layer2::Catalyst::ISA = qw/SNMP::Info::CiscoStack SNMP::Info::CiscoVTP
@SNMP::Info::Layer2::Catalyst::ISA
= qw/SNMP::Info::CiscoStack SNMP::Info::CiscoVTP
SNMP::Info::CDP SNMP::Info::CiscoStats
SNMP::Info::CiscoPortSecurity
SNMP::Info::Layer2 Exporter/;
@SNMP::Info::Layer2::Catalyst::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/ ;
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer2::MIBS,
%SNMP::Info::CiscoPortSecurity::MIBS,
%SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::CDP::MIBS,
%SNMP::Info::CiscoVTP::MIBS,
%SNMP::Info::CiscoStack::MIBS,
);
%SNMP::Info::Layer2::MIBS, %SNMP::Info::CiscoPortSecurity::MIBS,
%SNMP::Info::CiscoStats::MIBS, %SNMP::Info::CDP::MIBS,
%SNMP::Info::CiscoVTP::MIBS, %SNMP::Info::CiscoStack::MIBS,
);
%GLOBALS = (
%SNMP::Info::Layer2::GLOBALS,
@@ -66,25 +64,19 @@ $VERSION = '1.09';
%SNMP::Info::CDP::GLOBALS,
%SNMP::Info::CiscoVTP::GLOBALS,
%SNMP::Info::CiscoStack::GLOBALS,
);
);
%FUNCS = (
%SNMP::Info::Layer2::FUNCS,
%SNMP::Info::CiscoPortSecurity::FUNCS,
%SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::CDP::FUNCS,
%SNMP::Info::CiscoVTP::FUNCS,
%SNMP::Info::CiscoStack::FUNCS,
);
%SNMP::Info::Layer2::FUNCS, %SNMP::Info::CiscoPortSecurity::FUNCS,
%SNMP::Info::CiscoStats::FUNCS, %SNMP::Info::CDP::FUNCS,
%SNMP::Info::CiscoVTP::FUNCS, %SNMP::Info::CiscoStack::FUNCS,
);
%MUNGE = (
%SNMP::Info::Layer2::MUNGE,
%SNMP::Info::CiscoPortSecurity::MUNGE,
%SNMP::Info::CiscoStats::MUNGE,
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE,
%SNMP::Info::CiscoStack::MUNGE,
);
%SNMP::Info::Layer2::MUNGE, %SNMP::Info::CiscoPortSecurity::MUNGE,
%SNMP::Info::CiscoStats::MUNGE, %SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE, %SNMP::Info::CiscoStack::MUNGE,
);
# Overidden Methods
@@ -95,7 +87,7 @@ sub i_physical {
my $p_port = $cat->p_port();
my %i_physical;
foreach my $port (keys %$p_port) {
foreach my $port ( keys %$p_port ) {
my $iid = $p_port->{$port};
$i_physical{$iid} = 1;
}
@@ -130,10 +122,10 @@ sub bp_index {
my $b_index = $cat->p_oidx();
my %bp_index;
foreach my $iid (keys %$p_index){
foreach my $iid ( keys %$p_index ) {
my $ifidx = $p_index->{$iid};
next unless defined $ifidx;
my $bpidx = $b_index->{$iid}||0;
my $bpidx = $b_index->{$iid} || 0;
$bp_index{$bpidx} = $ifidx;
}
@@ -153,7 +145,7 @@ sub interfaces {
my %portmap = reverse %$portnames;
my %interfaces = ();
foreach my $iid (keys %$i_index) {
foreach my $iid ( keys %$i_index ) {
next unless defined $iid;
my $if = $i_index->{$iid};
my $port = $portmap{$iid};
@@ -170,10 +162,10 @@ sub i_name {
my $p_name = $cat->p_name() || {};
my %i_name;
foreach my $port (keys %$p_name) {
foreach my $port ( keys %$p_name ) {
my $iid = $p_port->{$port};
next unless defined $iid;
next if (defined $partial and $iid !~ /^$partial$/);
next if ( defined $partial and $iid !~ /^$partial$/ );
$i_name{$iid} = $p_name->{$port};
}
return \%i_name;
@@ -211,7 +203,8 @@ Max Baker
SNMP::Info subclass to provide information for Cisco Catalyst series switches
running CatOS.
This class includes the Catalyst 2920, 4000, 5000, 6000 (hybrid mode) families.
This class includes the Catalyst 2920, 4000, 5000, 6000 (hybrid mode)
families.
This subclass is not for all devices that have the name Catalyst. Note that
some Catalyst switches run IOS, like the 2900 and 3550 families. Cisco
@@ -330,7 +323,8 @@ to a hash.
=item $cat->interfaces()
Returns the map between SNMP Interface Identifier (iid) and physical port name.
Returns the map between SNMP Interface Identifier (iid) and physical port
name.
=item $cat->i_name()
@@ -347,8 +341,8 @@ Returns a map to IID for ports that are physical ports, not vlans, etc.
Returns reference to hash of bridge port table entries map back to interface
identifier (iid)
Crosses (C<portCrossIndex>) to (C<portIfIndex>) since some devices seem to have
problems with F<BRIDGE-MIB>
Crosses (C<portCrossIndex>) to (C<portIfIndex>) since some devices seem to
have problems with F<BRIDGE-MIB>
=back

View File

@@ -37,7 +37,8 @@ use SNMP::Info::Bridge;
use SNMP::Info::NortelStack;
use SNMP::Info::SONMP;
@SNMP::Info::Layer2::Centillion::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::NortelStack SNMP::Info::SONMP Exporter/;
@SNMP::Info::Layer2::Centillion::ISA
= qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::NortelStack SNMP::Info::SONMP Exporter/;
@SNMP::Info::Layer2::Centillion::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
@@ -53,7 +54,7 @@ $VERSION = '1.09';
'S5-COMMON-STATS-MIB' => 's5CmStat',
'CENTILLION-VLAN-MIB' => 'cnVlanENETMgt',
'CENTILLION-CONFIG-MIB' => 'sysTFTPStart',
);
);
%GLOBALS = (
%SNMP::Info::GLOBALS,
@@ -65,33 +66,37 @@ $VERSION = '1.09';
'tftp_file' => 'sysTFTPFileName',
'tftp_type' => 'sysTFTPFileType',
'tftp_result' => 'sysTFTPResult',
);
);
%FUNCS = (
%SNMP::Info::FUNCS,
%SNMP::Info::Bridge::FUNCS,
%SNMP::Info::NortelStack::FUNCS,
%SNMP::Info::SONMP::FUNCS,
# CENTILLION-DOT3-EXTENSIONS-MIB::cnDot3ExtnTable
'centillion_p_index' => 'cnDot3ExtnIfIndex',
'centillion_p_duplex' => 'cnDot3ExtnIfOperConnectionType',
'centillion_p_duplex_admin' => 'cnDot3ExtnIfAdminConnectionType',
# S5-COMMON-STATS-MIB::s5CmSNodeTable
'fw_mac' => 's5CmSNodeMacAddr',
'fw_port' => 's5CmSNodeIfIndx',
# CENTILLION-VLAN-MIB::cnVlanPortMemberTable
'centillion_i_vlan_index' => 'cnVlanPortMemberIfIndex',
'centillion_i_vlan' => 'cnVlanPortMemberVID',
'centillion_i_vlan_type' => 'cnVlanPortMemberIngressType',
);
);
%MUNGE = (
# Inherit all the built in munging
%SNMP::Info::MUNGE,
%SNMP::Info::Bridge::MUNGE,
%SNMP::Info::NortelStack::MUNGE,
%SNMP::Info::SONMP::MUNGE,
);
);
sub os {
return 'centillion';
@@ -106,8 +111,9 @@ sub i_ignore {
my $descr = $centillion->i_description();
my %i_ignore;
foreach my $if (keys %$descr){
foreach my $if ( keys %$descr ) {
my $type = $descr->{$if};
# Skip virtual interfaces
$i_ignore{$if}++ if $type =~ /(VE|VID|vc|lp)/i;
}
@@ -120,16 +126,17 @@ sub interfaces {
my $i_descr = $centillion->i_description();
my %if;
foreach my $iid (keys %$i_index){
foreach my $iid ( keys %$i_index ) {
my $index = $i_index->{$iid};
next unless defined $index;
my $descr = $i_descr->{$iid};
# Skip ATM and virtual interfaces
next if $descr =~ /(VE|VID|vc|lp)/i;
# Index numbers are deterministic slot * 256 + port
my $port = $index % 256;
my $slot = int($index / 256);
my $slot = int( $index / 256 );
my $slotport = "$slot.$port";
$slotport = "$descr" if $descr =~ /(mcp)/i;
@@ -147,7 +154,7 @@ sub i_duplex {
my $port_duplex = $centillion->centillion_p_duplex();
my %i_duplex;
foreach my $iid (keys %$port_index){
foreach my $iid ( keys %$port_index ) {
my $index = $port_index->{$iid};
next unless defined $index;
my $duplex = $port_duplex->{$iid};
@@ -155,7 +162,7 @@ sub i_duplex {
$duplex = 'half' if $duplex =~ /half/i;
$duplex = 'full' if $duplex =~ /full/i;
$i_duplex{$index}=$duplex;
$i_duplex{$index} = $duplex;
}
return \%i_duplex;
}
@@ -167,7 +174,7 @@ sub i_duplex_admin {
my $port_admin = $centillion->centillion_p_duplex_admin();
my %i_duplex_admin;
foreach my $iid (keys %$port_index){
foreach my $iid ( keys %$port_index ) {
my $index = $port_index->{$iid};
next unless defined $index;
my $duplex = $port_admin->{$iid};
@@ -176,7 +183,7 @@ sub i_duplex_admin {
$duplex = 'half' if $duplex =~ /half/i;
$duplex = 'full' if $duplex =~ /full/i;
$duplex = 'auto' if $duplex =~ /auto/i;
$i_duplex_admin{$index}=$duplex;
$i_duplex_admin{$index} = $duplex;
}
return \%i_duplex_admin;
}
@@ -188,13 +195,13 @@ sub i_vlan {
my $cn_vlan = $centillion->centillion_i_vlan();
my %i_vlan;
foreach my $iid (keys %$cn_vlan_index){
foreach my $iid ( keys %$cn_vlan_index ) {
my $index = $cn_vlan_index->{$iid};
next unless defined $index;
my $vlan = $cn_vlan->{$iid};
next unless defined $vlan;
$i_vlan{$index}=$vlan;
$i_vlan{$index} = $vlan;
}
return \%i_vlan;
}
@@ -207,11 +214,11 @@ sub model {
return $id unless defined $model;
$model =~ s/^sreg-//i;
return '5000BH' if ($model =~ /5000BH/);
return '5005BH' if ($model =~ /5005BH/);
return 'C100' if ($model =~ /Centillion100/);
return 'C50N' if ($model =~ /Centillion50N/);
return 'C50T' if ($model =~ /Centillion50T/);
return '5000BH' if ( $model =~ /5000BH/ );
return '5005BH' if ( $model =~ /5005BH/ );
return 'C100' if ( $model =~ /Centillion100/ );
return 'C50N' if ( $model =~ /Centillion50N/ );
return 'C50T' if ( $model =~ /Centillion50T/ );
return $model;
}
@@ -220,7 +227,7 @@ sub bp_index {
my $index = $centillion->fw_port();
my %bp_index;
foreach my $iid (keys %$index){
foreach my $iid ( keys %$index ) {
my $b_index = $index->{$iid};
next unless defined $b_index;
@@ -239,7 +246,6 @@ sub slot_offset {
return 0;
}
1;
__END__
@@ -411,7 +417,8 @@ to a hash.
Returns reference to the map between IID and physical Port.
Slot and port numbers on the Passport switches are determined by the formula:
Slot and port numbers on the Passport switches are determined by the
formula:
port = index % 256
slot = int(index / 256)

View File

@@ -48,53 +48,37 @@ use SNMP::Info::Layer2;
Exporter/;
@SNMP::Info::Layer2::Cisco::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/ ;
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer2::MIBS,
%SNMP::Info::CiscoConfig::MIBS,
%SNMP::Info::CiscoQOS::MIBS,
%SNMP::Info::CiscoRTT::MIBS,
%SNMP::Info::CiscoImage::MIBS,
%SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::CDP::MIBS,
%SNMP::Info::CiscoVTP::MIBS,
);
%SNMP::Info::Layer2::MIBS, %SNMP::Info::CiscoConfig::MIBS,
%SNMP::Info::CiscoQOS::MIBS, %SNMP::Info::CiscoRTT::MIBS,
%SNMP::Info::CiscoImage::MIBS, %SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::CDP::MIBS, %SNMP::Info::CiscoVTP::MIBS,
);
%GLOBALS = (
%SNMP::Info::Layer2::GLOBALS,
%SNMP::Info::CiscoConfig::GLOBALS,
%SNMP::Info::CiscoQOS::GLOBALS,
%SNMP::Info::CiscoRTT::GLOBALS,
%SNMP::Info::CiscoImage::GLOBALS,
%SNMP::Info::CiscoStats::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
%SNMP::Info::CiscoVTP::GLOBALS,
);
%SNMP::Info::Layer2::GLOBALS, %SNMP::Info::CiscoConfig::GLOBALS,
%SNMP::Info::CiscoQOS::GLOBALS, %SNMP::Info::CiscoRTT::GLOBALS,
%SNMP::Info::CiscoImage::GLOBALS, %SNMP::Info::CiscoStats::GLOBALS,
%SNMP::Info::CDP::GLOBALS, %SNMP::Info::CiscoVTP::GLOBALS,
);
%FUNCS = (
%SNMP::Info::Layer2::FUNCS,
%SNMP::Info::CiscoConfig::FUNCS,
%SNMP::Info::CiscoQOS::FUNCS,
%SNMP::Info::CiscoRTT::FUNCS,
%SNMP::Info::CiscoImage::FUNCS,
%SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::CDP::FUNCS,
%SNMP::Info::CiscoVTP::FUNCS,
);
%SNMP::Info::Layer2::FUNCS, %SNMP::Info::CiscoConfig::FUNCS,
%SNMP::Info::CiscoQOS::FUNCS, %SNMP::Info::CiscoRTT::FUNCS,
%SNMP::Info::CiscoImage::FUNCS, %SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::CDP::FUNCS, %SNMP::Info::CiscoVTP::FUNCS,
);
%MUNGE = (
%SNMP::Info::Layer2::MUNGE,
%SNMP::Info::CiscoConfig::MUNGE,
%SNMP::Info::CiscoQOS::MUNGE,
%SNMP::Info::CiscoRTT::MUNGE,
%SNMP::Info::CiscoImage::MUNGE,
%SNMP::Info::CiscoStats::MUNGE,
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE,
);
%SNMP::Info::Layer2::MUNGE, %SNMP::Info::CiscoConfig::MUNGE,
%SNMP::Info::CiscoQOS::MUNGE, %SNMP::Info::CiscoRTT::MUNGE,
%SNMP::Info::CiscoImage::MUNGE, %SNMP::Info::CiscoStats::MUNGE,
%SNMP::Info::CDP::MUNGE, %SNMP::Info::CiscoVTP::MUNGE,
);
1;
__END__

View File

@@ -37,7 +37,8 @@ use SNMP::Info::FDP;
use SNMP::Info::EtherLike;
use SNMP::Info::MAU;
@SNMP::Info::Layer2::Foundry::ISA = qw/SNMP::Info::Layer2 SNMP::Info::FDP SNMP::Info::EtherLike
@SNMP::Info::Layer2::Foundry::ISA
= qw/SNMP::Info::Layer2 SNMP::Info::FDP SNMP::Info::EtherLike
SNMP::Info::MAU Exporter/;
@SNMP::Info::Layer2::Foundry::EXPORT_OK = qw//;
@@ -45,42 +46,35 @@ use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = ( %SNMP::Info::Layer2::MIBS,
%SNMP::Info::FDP::MIBS,
%SNMP::Info::EtherLike::MIBS,
%SNMP::Info::MAU::MIBS,
%MIBS = (
%SNMP::Info::Layer2::MIBS, %SNMP::Info::FDP::MIBS,
%SNMP::Info::EtherLike::MIBS, %SNMP::Info::MAU::MIBS,
'FOUNDRY-SN-ROOT-MIB' => 'foundry',
);
);
%GLOBALS = (
%SNMP::Info::Layer2::GLOBALS,
%SNMP::Info::FDP::GLOBALS,
%SNMP::Info::EtherLike::GLOBALS,
%SNMP::Info::MAU::GLOBALS,
);
%SNMP::Info::Layer2::GLOBALS, %SNMP::Info::FDP::GLOBALS,
%SNMP::Info::EtherLike::GLOBALS, %SNMP::Info::MAU::GLOBALS,
);
%FUNCS = (
%SNMP::Info::Layer2::FUNCS,
%SNMP::Info::FDP::FUNCS,
%SNMP::Info::EtherLike::FUNCS,
%SNMP::Info::MAU::FUNCS,
%SNMP::Info::Layer2::FUNCS, %SNMP::Info::FDP::FUNCS,
%SNMP::Info::EtherLike::FUNCS, %SNMP::Info::MAU::FUNCS,
'test' => 'dot1dStpPortState',
);
);
%MUNGE = (
%SNMP::Info::Layer2::MUNGE,
%SNMP::Info::FDP::MUNGE,
%SNMP::Info::EtherLike::MUNGE,
%SNMP::Info::MAU::MUNGE,
);
%SNMP::Info::Layer2::MUNGE, %SNMP::Info::FDP::MUNGE,
%SNMP::Info::EtherLike::MUNGE, %SNMP::Info::MAU::MUNGE,
);
# Method OverRides
#sub bulkwalk_no { 1;}
*SNMP::Info::Layer2::Foundry::i_duplex = \&SNMP::Info::MAU::mau_i_duplex;
*SNMP::Info::Layer2::Foundry::i_duplex_admin = \&SNMP::Info::MAU::mau_i_duplex_admin;
*SNMP::Info::Layer2::Foundry::i_duplex_admin
= \&SNMP::Info::MAU::mau_i_duplex_admin;
*SNMP::Info::Layer2::Foundry::i_vlan = \&SNMP::Info::Bridge::qb_i_vlan_t;
# todo doc these
@@ -92,19 +86,19 @@ sub os_ver {
# find entity table entry for "stackmanaget.1"
my $unit_iid = undef;
foreach my $e (keys %$e_name){
foreach my $e ( keys %$e_name ) {
my $name = $e_name->{$e} || '';
$unit_iid = $e if $name eq 'stackmanaget.1';
}
# Default to OID method if no dice.
unless (defined $unit_iid){
unless ( defined $unit_iid ) {
return $foundry->SUPER::model();
}
# Find Model Name
my $e_fwver = $foundry->e_fwver();
if (defined $e_fwver->{$unit_iid}){
if ( defined $e_fwver->{$unit_iid} ) {
return $e_fwver->{$unit_iid};
}
@@ -119,19 +113,19 @@ sub model {
# find entity table entry for "unit.1"
my $unit_iid = undef;
foreach my $e (keys %$e_name){
foreach my $e ( keys %$e_name ) {
my $name = $e_name->{$e} || '';
$unit_iid = $e if $name eq 'unit.1';
}
# Default to OID method if no dice.
unless (defined $unit_iid){
unless ( defined $unit_iid ) {
return $foundry->SUPER::model();
}
# Find Model Name
my $e_model = $foundry->e_model();
if (defined $e_model->{$unit_iid}){
if ( defined $e_model->{$unit_iid} ) {
return $e_model->{$unit_iid};
}
@@ -147,7 +141,7 @@ sub serial {
# find entity table entry for "unit.1"
my $unit_iid = undef;
foreach my $e (keys %$e_name){
foreach my $e ( keys %$e_name ) {
my $name = $e_name->{$e} || '';
$unit_iid = $e if $name eq 'unit.1';
}
@@ -168,7 +162,7 @@ sub interfaces {
# use ifName only if it is in portn
# format. For EdgeIrons
# else use ifDescr
foreach my $iid (keys %$i_name){
foreach my $iid ( keys %$i_name ) {
my $name = $i_name->{$iid};
next unless defined $name;
$i_descr->{$iid} = $name
@@ -184,16 +178,16 @@ sub i_ignore {
my %i_ignore = ();
foreach my $iid (keys %$i_type){
foreach my $iid ( keys %$i_type ) {
my $type = $i_type->{$iid} || '';
$i_ignore{$iid}++
# 33 is the console port
if $type =~ /(loopback|propvirtual|other|cpu|33)/i;
}
return \%i_ignore;
}
sub os {
return 'foundry';
}
@@ -211,7 +205,8 @@ __END__
=head1 NAME
SNMP::Info::Layer2::Foundry - SNMP Interface to Foundry FastIron Network Devices
SNMP::Info::Layer2::Foundry - SNMP Interface to Foundry FastIron Network
Devices
=head1 AUTHOR

View File

@@ -39,15 +39,17 @@ use SNMP::Info::MAU;
use SNMP::Info::LLDP;
use SNMP::Info::CDP;
@SNMP::Info::Layer2::HP::ISA = qw/SNMP::Info::Layer3 SNMP::Info::MAU SNMP::Info::LLDP
@SNMP::Info::Layer2::HP::ISA
= qw/SNMP::Info::Layer3 SNMP::Info::MAU SNMP::Info::LLDP
SNMP::Info::CDP Exporter/;
@SNMP::Info::Layer2::HP::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %PORTSTAT %MODEL_MAP %MUNGE/ ;
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %PORTSTAT %MODEL_MAP %MUNGE/;
$VERSION = '1.09';
%MIBS = ( %SNMP::Info::Layer3::MIBS,
%MIBS = (
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::MAU::MIBS,
%SNMP::Info::LLDP::MIBS,
%SNMP::Info::CDP::MIBS,
@@ -59,7 +61,7 @@ $VERSION = '1.09';
'CONFIG-MIB' => 'hpSwitchConfig',
'SEMI-MIB' => 'hpHttpMgSerialNumber',
'HP-ICF-CHASSIS' => 'hpicfSensorObjectId',
);
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
@@ -76,7 +78,7 @@ $VERSION = '1.09';
'os_bin' => 'hpSwitchRomVersion.0',
'mac' => 'hpSwitchBaseMACAddress.0',
'hp_vlans' => 'hpVlanNumber',
);
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
@@ -85,8 +87,10 @@ $VERSION = '1.09';
%SNMP::Info::CDP::FUNCS,
'bp_index2' => 'dot1dBasePortIfIndex',
'i_type2' => 'ifType',
# RFC1271
'l_descr' => 'logDescription',
# HP-VLAN-MIB
'hp_v_index' => 'hpVlanDot1QID',
'hp_v_name' => 'hpVlanIdentName',
@@ -94,24 +98,27 @@ $VERSION = '1.09';
'hp_v_type' => 'hpVlanIdentType',
'hp_v_status' => 'hpVlanIdentStatus',
'hp_v_mac' => 'hpVlanAddrPhysAddress',
'hp_v_if_index'=> 'hpVlanMemberIndex',
'hp_v_if_index' => 'hpVlanMemberIndex',
'hp_v_if_tag' => 'hpVlanMemberTagged2',
# CONFIG-MIB::hpSwitchPortTable
'hp_duplex' => 'hpSwitchPortEtherMode',
'hp_duplex_admin' => 'hpSwitchPortFastEtherMode',
# HP-ICF-CHASSIS
'hp_s_oid' => 'hpicfSensorObjectId',
'hp_s_name' => 'hpicfSensorDescr',
'hp_s_status' => 'hpicfSensorStatus',
);
);
%MUNGE = (
# Inherit all the built in munging
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::MAU::MUNGE,
%SNMP::Info::LLDP::MUNGE,
%SNMP::Info::CDP::MUNGE
);
);
%MODEL_MAP = (
'J4093A' => '2424M',
@@ -172,7 +179,7 @@ $VERSION = '1.09';
'J9049A' => '2900-24G',
'J9032A' => '4202vl-68G',
'J9091A' => '8212zl',
);
);
# Method Overrides
@@ -189,13 +196,15 @@ sub mem_total {
sub os {
return 'hp';
}
sub os_ver {
my $hp = shift;
my $os_version = $hp->os_version();
return $os_version if defined $os_version;
# Some older ones don't have this value,so we cull it from the description
my $descr = $hp->description();
if ($descr =~ m/revision ([A-Z]{1}\.\d{2}\.\d{2})/) {
if ( $descr =~ m/revision ([A-Z]{1}\.\d{2}\.\d{2})/ ) {
return $1;
}
return;
@@ -229,10 +238,10 @@ sub interfaces {
my $i_descr = $hp->i_description();
my %if;
foreach my $iid (keys %$interfaces){
foreach my $iid ( keys %$interfaces ) {
my $descr = $i_descr->{$iid};
next unless defined $descr;
$if{$iid} = $descr if (defined $descr and length $descr);
$if{$iid} = $descr if ( defined $descr and length $descr );
}
return \%if
@@ -247,7 +256,7 @@ sub i_name {
my %i_name;
foreach my $port (keys %$e_name){
foreach my $port ( keys %$e_name ) {
my $iid = $e_port->{$port};
next unless defined $iid;
my $alias = $i_alias->{$iid};
@@ -255,7 +264,7 @@ sub i_name {
$i_name{$iid} = $e_name->{$port};
# Check for alias
$i_name{$iid} = $alias if (defined $alias and length($alias));
$i_name{$iid} = $alias if ( defined $alias and length($alias) );
}
return \%i_name;
@@ -273,17 +282,17 @@ sub i_duplex_admin {
# Try HP MIB first
my $hp_duplex = $hp->hp_duplex_admin($partial);
if (defined $hp_duplex and scalar(keys %$hp_duplex)){
if ( defined $hp_duplex and scalar( keys %$hp_duplex ) ) {
my %i_duplex;
foreach my $if (keys %$hp_duplex){
foreach my $if ( keys %$hp_duplex ) {
my $duplex = $hp_duplex->{$if};
next unless defined $duplex;
$duplex = 'half' if $duplex =~ /half/i;
$duplex = 'full' if $duplex =~ /full/i;
$duplex = 'auto' if $duplex =~ /auto/i;
$i_duplex{$if}=$duplex;
$i_duplex{$if} = $duplex;
}
return \%i_duplex;
}
@@ -297,13 +306,13 @@ sub vendor {
}
sub log {
my $hp=shift;
my $hp = shift;
my $log = $hp->l_descr();
my $logstring = undef;
foreach my $val (values %$log){
foreach my $val ( values %$log ) {
next if $val =~ /^Link\s+(Up|Down)/;
$logstring .= "$val\n";
}
@@ -312,14 +321,14 @@ sub log {
}
sub slots {
my $hp=shift;
my $hp = shift;
my $e_name = $hp->e_name();
return unless defined $e_name;
my $slots;
foreach my $slot (keys %$e_name) {
foreach my $slot ( keys %$e_name ) {
$slots++ if $e_name->{$slot} =~ /slot/i;
}
@@ -328,17 +337,19 @@ sub slots {
sub fan {
my $hp = shift;
return &_sensor($hp, 'fan');
return &_sensor( $hp, 'fan' );
}
sub ps1_status {
my $hp = shift;
return &_sensor($hp, 'power', '^power supply 1') || &_sensor($hp, 'power', '^power supply sensor');
return &_sensor( $hp, 'power', '^power supply 1' )
|| &_sensor( $hp, 'power', '^power supply sensor' );
}
sub ps2_status {
my $hp = shift;
return &_sensor($hp, 'power', '^power supply 2') || &_sensor($hp, 'power', '^redundant');
return &_sensor( $hp, 'power', '^power supply 2' )
|| &_sensor( $hp, 'power', '^redundant' );
}
sub _sensor {
@@ -347,12 +358,12 @@ sub _sensor {
my $search_name = shift || '';
my $hp_s_oid = $hp->hp_s_oid();
my $result;
foreach my $sensor (keys %$hp_s_oid) {
my $sensortype = &SNMP::translateObj($hp_s_oid->{$sensor});
if ($sensortype =~ /$search_type/i) {
foreach my $sensor ( keys %$hp_s_oid ) {
my $sensortype = &SNMP::translateObj( $hp_s_oid->{$sensor} );
if ( $sensortype =~ /$search_type/i ) {
my $sensorname = $hp->hp_s_name()->{$sensor};
my $sensorstatus = $hp->hp_s_status()->{$sensor};
if ($sensorname =~ /$search_name/i) {
if ( $sensorname =~ /$search_name/i ) {
$result = $sensorstatus;
}
}
@@ -369,12 +380,12 @@ sub bp_index {
my $model = $hp->model();
my $bp_index = $hp->bp_index2($partial);
unless (defined $model and $model =~ /(1600|2424|4000|8000)/) {
unless ( defined $model and $model =~ /(1600|2424|4000|8000)/ ) {
return $bp_index;
}
my %mod_bp_index;
foreach my $iid (keys %$if_index){
foreach my $iid ( keys %$if_index ) {
$mod_bp_index{$iid} = $iid;
}
return \%mod_bp_index;
@@ -389,7 +400,7 @@ sub v_index {
# Newer devices
my $q_index = $hp->SUPER::v_index($partial);
if (defined $q_index and scalar(keys %$q_index)){
if ( defined $q_index and scalar( keys %$q_index ) ) {
return $q_index;
}
@@ -403,7 +414,7 @@ sub v_name {
# Newer devices
my $q_name = $hp->SUPER::v_name($partial);
if (defined $q_name and scalar(keys %$q_name)){
if ( defined $q_name and scalar( keys %$q_name ) ) {
return $q_name;
}
@@ -416,7 +427,7 @@ sub i_vlan {
# Newer devices use Q-BRIDGE-MIB
my $qb_i_vlan = $hp->SUPER::i_vlan();
if (defined $qb_i_vlan and scalar(keys %$qb_i_vlan)){
if ( defined $qb_i_vlan and scalar( keys %$qb_i_vlan ) ) {
return $qb_i_vlan;
}
@@ -426,13 +437,13 @@ sub i_vlan {
my $i_vlan = {};
my $hp_v_index = $hp->hp_v_index();
my $hp_v_if_tag = $hp->hp_v_if_tag();
foreach my $row (keys %$hp_v_if_tag){
my ($index,$if) = split(/\./,$row);
foreach my $row ( keys %$hp_v_if_tag ) {
my ( $index, $if ) = split( /\./, $row );
my $tag = $hp_v_if_tag->{$row};
my $vlan = $hp_v_index->{$index};
next unless (defined $tag and $tag =~ /untagged/);
next unless ( defined $tag and $tag =~ /untagged/ );
$i_vlan->{$if} = $vlan if defined $vlan;
}
@@ -445,7 +456,7 @@ sub i_vlan_membership {
# Newer devices use Q-BRIDGE-MIB
my $qb_i_vlan = $hp->SUPER::i_vlan_membership();
if (defined $qb_i_vlan and scalar(keys %$qb_i_vlan)){
if ( defined $qb_i_vlan and scalar( keys %$qb_i_vlan ) ) {
return $qb_i_vlan;
}
@@ -453,16 +464,16 @@ sub i_vlan_membership {
my $i_vlan_membership = {};
my $hp_v_index = $hp->hp_v_index();
my $hp_v_if_tag = $hp->hp_v_if_tag();
foreach my $row (keys %$hp_v_if_tag){
my ($index,$if) = split(/\./,$row);
foreach my $row ( keys %$hp_v_if_tag ) {
my ( $index, $if ) = split( /\./, $row );
my $tag = $hp_v_if_tag->{$row};
my $vlan = $hp_v_index->{$index};
next unless (defined $tag);
next if ($tag eq 'no');
next unless ( defined $tag );
next if ( $tag eq 'no' );
push(@{$i_vlan_membership->{$if}}, $vlan);
push( @{ $i_vlan_membership->{$if} }, $vlan );
}
return $i_vlan_membership;
@@ -484,14 +495,14 @@ sub c_ip {
my $lldp = $hp->lldp_ip($partial) || {};
my %c_ip;
foreach my $iid (keys %$cdp){
foreach my $iid ( keys %$cdp ) {
my $ip = $cdp->{$iid};
next unless defined $ip;
$c_ip{$iid} = $ip;
}
foreach my $iid (keys %$lldp){
foreach my $iid ( keys %$lldp ) {
my $ip = $lldp->{$iid};
next unless defined $ip;
@@ -504,18 +515,18 @@ sub c_if {
my $hp = shift;
my $partial = shift;
my $lldp = $hp->lldp_if($partial) || {};;
my $lldp = $hp->lldp_if($partial) || {};
my $cdp = $hp->SUPER::c_if($partial) || {};
my %c_if;
foreach my $iid (keys %$cdp){
foreach my $iid ( keys %$cdp ) {
my $if = $cdp->{$iid};
next unless defined $if;
$c_if{$iid} = $if;
}
foreach my $iid (keys %$lldp){
foreach my $iid ( keys %$lldp ) {
my $if = $lldp->{$iid};
next unless defined $if;
@@ -532,14 +543,14 @@ sub c_port {
my $cdp = $hp->SUPER::c_port($partial) || {};
my %c_port;
foreach my $iid (keys %$cdp){
foreach my $iid ( keys %$cdp ) {
my $port = $cdp->{$iid};
next unless defined $port;
$c_port{$iid} = $port;
}
foreach my $iid (keys %$lldp){
foreach my $iid ( keys %$lldp ) {
my $port = $lldp->{$iid};
next unless defined $port;
@@ -556,14 +567,14 @@ sub c_id {
my $cdp = $hp->SUPER::c_id($partial) || {};
my %c_id;
foreach my $iid (keys %$cdp){
foreach my $iid ( keys %$cdp ) {
my $id = $cdp->{$iid};
next unless defined $id;
$c_id{$iid} = $id;
}
foreach my $iid (keys %$lldp){
foreach my $iid ( keys %$lldp ) {
my $id = $lldp->{$iid};
next unless defined $id;
@@ -580,14 +591,14 @@ sub c_platform {
my $cdp = $hp->SUPER::c_platform($partial) || {};
my %c_platform;
foreach my $iid (keys %$cdp){
foreach my $iid ( keys %$cdp ) {
my $platform = $cdp->{$iid};
next unless defined $platform;
$c_platform{$iid} = $platform;
}
foreach my $iid (keys %$lldp){
foreach my $iid ( keys %$lldp ) {
my $platform = $lldp->{$iid};
next unless defined $platform;
@@ -923,9 +934,9 @@ Returns reference to hash. Key: iid Value: remote IPv4 address
If multiple entries exist with the same local port, c_if(), with the same IPv4
address, c_ip(), it may be a duplicate entry.
If multiple entries exist with the same local port, c_if(), with different IPv4
addresses, c_ip(), there is either a non-CDP/LLDP device in between two or
more devices or multiple devices which are not directly connected.
If multiple entries exist with the same local port, c_if(), with different
IPv4 addresses, c_ip(), there is either a non-CDP/LLDP device in between two
or more devices or multiple devices which are not directly connected.
Use the data from the Layer2 Topology Table below to dig deeper.

View File

@@ -37,7 +37,8 @@ use SNMP::Info::Bridge;
use SNMP::Info::SONMP;
use SNMP::Info::Airespace;
@SNMP::Info::Layer2::N2270::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::SONMP SNMP::Info::Airespace Exporter/;
@SNMP::Info::Layer2::N2270::ISA
= qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::SONMP SNMP::Info::Airespace Exporter/;
@SNMP::Info::Layer2::N2270::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
@@ -45,32 +46,24 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::MIBS,
%SNMP::Info::Bridge::MIBS,
%SNMP::Info::SONMP::MIBS,
%SNMP::Info::Airespace::MIBS,
);
%SNMP::Info::MIBS, %SNMP::Info::Bridge::MIBS,
%SNMP::Info::SONMP::MIBS, %SNMP::Info::Airespace::MIBS,
);
%GLOBALS = (
%SNMP::Info::GLOBALS,
%SNMP::Info::Bridge::GLOBALS,
%SNMP::Info::SONMP::GLOBALS,
%SNMP::Info::Airespace::GLOBALS,
);
%SNMP::Info::GLOBALS, %SNMP::Info::Bridge::GLOBALS,
%SNMP::Info::SONMP::GLOBALS, %SNMP::Info::Airespace::GLOBALS,
);
%FUNCS = (
%SNMP::Info::FUNCS,
%SNMP::Info::Bridge::FUNCS,
%SNMP::Info::SONMP::FUNCS,
%SNMP::Info::Airespace::FUNCS,
);
%SNMP::Info::FUNCS, %SNMP::Info::Bridge::FUNCS,
%SNMP::Info::SONMP::FUNCS, %SNMP::Info::Airespace::FUNCS,
);
%MUNGE = (
%SNMP::Info::MUNGE,
%SNMP::Info::Bridge::MUNGE,
%SNMP::Info::SONMP::MUNGE,
%SNMP::Info::Airespace::MUNGE,
);
%SNMP::Info::MUNGE, %SNMP::Info::Bridge::MUNGE,
%SNMP::Info::SONMP::MUNGE, %SNMP::Info::Airespace::MUNGE,
);
sub os {
return 'nortel';
@@ -104,7 +97,8 @@ __END__
=head1 NAME
SNMP::Info::Layer2::N2270 - SNMP Interface to Nortel 2270 Series Wireless Switch
SNMP::Info::Layer2::N2270 - SNMP Interface to Nortel 2270 Series Wireless
Switch
=head1 AUTHOR

View File

@@ -36,7 +36,8 @@ use SNMP::Info::SONMP;
use SNMP::Info::IEEE802dot11;
use SNMP::Info::Layer2;
@SNMP::Info::Layer2::NAP222x::ISA = qw/SNMP::Info::SONMP SNMP::Info::IEEE802dot11 SNMP::Info::Layer2 Exporter/;
@SNMP::Info::Layer2::NAP222x::ISA
= qw/SNMP::Info::SONMP SNMP::Info::IEEE802dot11 SNMP::Info::Layer2 Exporter/;
@SNMP::Info::Layer2::NAP222x::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
@@ -44,11 +45,9 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer2::MIBS,
%SNMP::Info::IEEE802dot11::MIBS,
%SNMP::Info::SONMP::MIBS,
'NORTEL-WLAN-AP-MIB' => 'ntWlanSwHardwareVer',
);
%SNMP::Info::Layer2::MIBS, %SNMP::Info::IEEE802dot11::MIBS,
%SNMP::Info::SONMP::MIBS, 'NORTEL-WLAN-AP-MIB' => 'ntWlanSwHardwareVer',
);
%GLOBALS = (
%SNMP::Info::Layer2::GLOBALS,
@@ -67,28 +66,30 @@ $VERSION = '1.09';
'tftp_src_file' => 'ntWlanSrcFile',
'ftp_user' => 'ntWlanUserName',
'ftp_pass' => 'ntWlanPassword',
);
);
%FUNCS = (
%SNMP::Info::Layer2::FUNCS,
%SNMP::Info::IEEE802dot11::FUNCS,
%SNMP::Info::SONMP::FUNCS,
# From ntWlanPortTable
'nt_prt_name' => 'ntWlanPortName',
'nt_dpx_admin' => 'ntWlanPortCapabilities',
'nt_auto' => 'ntWlanPortAutonegotiation',
'nt_dpx' => 'ntWlanPortSpeedDpxStatus',
# From ntWlanDot11PhyOperationTable
'nt_i_broadcast' => 'ntWlanDot11ClosedSystem',
# From ntWlanApVlanTable
'nt_i_vlan' => 'ntWlanApVlanDefaultVid',
);
);
%MUNGE = (
%SNMP::Info::Layer2::MUNGE,
%SNMP::Info::IEEE802dot11::MUNGE,
%SNMP::Info::Layer2::MUNGE, %SNMP::Info::IEEE802dot11::MUNGE,
%SNMP::Info::SONMP::MUNGE,
);
);
sub os {
return 'nortel';
@@ -99,7 +100,7 @@ sub os_bin {
my $bin = $nap222x->nt_fw_ver();
return unless defined $bin;
if ($bin =~ m/(\d+\.\d+\.\d+)/){
if ( $bin =~ m/(\d+\.\d+\.\d+)/ ) {
return $1;
}
return;
@@ -110,8 +111,8 @@ sub model {
my $descr = $nap222x->description();
return unless defined $descr;
return 'AP-2220' if ($descr =~ /2220/);
return 'AP-2221' if ($descr =~ /2221/);
return 'AP-2220' if ( $descr =~ /2220/ );
return 'AP-2221' if ( $descr =~ /2221/ );
return;
}
@@ -119,8 +120,8 @@ sub mac {
my $nap222x = shift;
my $i_mac = $nap222x->i_mac();
# Return Interface MAC
foreach my $entry (keys %$i_mac){
# Return Interface MAC
foreach my $entry ( keys %$i_mac ) {
my $sn = $i_mac->{$entry};
next unless $sn;
return $sn;
@@ -132,8 +133,8 @@ sub serial {
my $nap222x = shift;
my $i_mac = $nap222x->i_mac();
# Return Interface MAC
foreach my $entry (keys %$i_mac){
# Return Interface MAC
foreach my $entry ( keys %$i_mac ) {
my $sn = $i_mac->{$entry};
next unless $sn;
return $sn;
@@ -149,7 +150,7 @@ sub interfaces {
my $description = $nap222x->i_description($partial) || {};
my %interfaces = ();
foreach my $iid (keys %$interfaces){
foreach my $iid ( keys %$interfaces ) {
my $desc = $description->{$iid};
next unless defined $desc;
next if $desc =~ /lo/i;
@@ -168,11 +169,11 @@ sub i_duplex {
my $interfaces = $nap222x->interfaces($partial) || {};
my %i_duplex;
foreach my $if (keys %$interfaces){
foreach my $if ( keys %$interfaces ) {
my $port = $interfaces->{$if};
next unless $port =~ /dp/i;
foreach my $idx (keys %$mode) {
my $name = $port_name->{$idx}||'unknown';
foreach my $idx ( keys %$mode ) {
my $name = $port_name->{$idx} || 'unknown';
next unless $name eq $port;
my $duplex = $mode->{$idx};
@@ -180,7 +181,7 @@ sub i_duplex {
$duplex = 'half' if $duplex =~ /half/i;
$duplex = 'full' if $duplex =~ /full/i;
$i_duplex{$if}=$duplex;
$i_duplex{$if} = $duplex;
}
}
return \%i_duplex;
@@ -196,21 +197,23 @@ sub i_duplex_admin {
my $port_name = $nap222x->nt_prt_name($partial) || {};
my %i_duplex_admin;
foreach my $if (keys %$interfaces){
foreach my $if ( keys %$interfaces ) {
my $port = $interfaces->{$if};
next unless $port =~ /dp/i;
foreach my $idx (keys %$dpx_admin) {
my $name = $port_name->{$idx}||'unknown';
foreach my $idx ( keys %$dpx_admin ) {
my $name = $port_name->{$idx} || 'unknown';
next unless $name eq $port;
my $duplex = $dpx_admin->{$idx};
my $auto = $nt_auto->{$idx};
$duplex = 'other' unless defined $duplex;
$duplex = 'half' if ($duplex =~ /half/i and $auto =~ /disabled/i);
$duplex = 'full' if ($duplex =~ /full/i and $auto =~ /disabled/i);
$duplex = 'half'
if ( $duplex =~ /half/i and $auto =~ /disabled/i );
$duplex = 'full'
if ( $duplex =~ /full/i and $auto =~ /disabled/i );
$duplex = 'auto' if $auto =~ /enabled/i;
$i_duplex_admin{$if}=$duplex;
$i_duplex_admin{$if} = $duplex;
}
}
return \%i_duplex_admin;
@@ -223,7 +226,7 @@ sub i_name {
my $interfaces = $nap222x->interfaces($partial) || {};
my %i_name;
foreach my $if (keys %$interfaces){
foreach my $if ( keys %$interfaces ) {
my $desc = $interfaces->{$if};
next unless defined $desc;
@@ -245,7 +248,7 @@ sub bp_index {
my $interfaces = $nap222x->interfaces($partial) || {};
my %bp_index;
foreach my $iid (keys %$interfaces){
foreach my $iid ( keys %$interfaces ) {
my $desc = $interfaces->{$iid};
next unless defined $desc;
next unless $desc =~ /(ndc|ar)/i;
@@ -265,13 +268,13 @@ sub i_ssidlist {
my $partial = shift;
# modify partial to match index
if (defined $partial) {
if ( defined $partial ) {
$partial = $partial - 2;
}
my $ssids = $nap222x->orig_i_ssidlist($partial) || {};
my %i_ssidlist;
foreach my $iid (keys %$ssids){
foreach my $iid ( keys %$ssids ) {
my $port = $iid + 2;
my $ssid = $ssids->{$iid};
next unless defined $ssid;
@@ -286,13 +289,13 @@ sub i_ssidbcast {
my $partial = shift;
# modify partial to match index
if (defined $partial) {
if ( defined $partial ) {
$partial = $partial - 2;
}
my $bcast = $nap222x->nt_i_broadcast($partial) || {};
my %i_ssidbcast;
foreach my $iid (keys %$bcast){
foreach my $iid ( keys %$bcast ) {
my $port = $iid + 2;
my $bc = $bcast->{$iid};
next unless defined $bc;
@@ -307,7 +310,7 @@ sub i_80211channel {
my $partial = shift;
# modify partial to match index
if (defined $partial) {
if ( defined $partial ) {
$partial = $partial - 2;
}
my $phy_type = $nap222x->dot11_phy_type($partial) || {};
@@ -315,16 +318,16 @@ sub i_80211channel {
my $cur_ch = $nap222x->dot11_cur_ch() || {};
my %i_80211channel;
foreach my $iid (keys %$phy_type){
foreach my $iid ( keys %$phy_type ) {
my $port = $iid + 2;
my $type = $phy_type->{$iid};
next unless defined $type;
if ($type =~ /dsss/) {
if ( $type =~ /dsss/ ) {
my $ch = $cur_ch->{1};
next unless defined $ch;
$i_80211channel{$port} = $ch;
}
elsif ($type =~ /ofdm/) {
elsif ( $type =~ /ofdm/ ) {
my $ch = $cur_freq->{0};
next unless defined $ch;
$i_80211channel{$port} = $ch;
@@ -342,13 +345,13 @@ sub i_vlan {
my $partial = shift;
# modify partial to match index
if (defined $partial) {
if ( defined $partial ) {
$partial = $partial - 2;
}
my $vlans = $nap222x->nt_i_vlan($partial) || {};
my %i_vlan;
foreach my $iid (keys %$vlans){
foreach my $iid ( keys %$vlans ) {
my $port = $iid + 2;
my $vlan = $vlans->{$iid};
next unless defined $vlan;
@@ -363,7 +366,8 @@ __END__
=head1 NAME
SNMP::Info::Layer2::NAP222x - SNMP Interface to Nortel 2220 Series Access Points
SNMP::Info::Layer2::NAP222x - SNMP Interface to Nortel 2220 Series Access
Points
=head1 AUTHOR

View File

@@ -41,21 +41,13 @@ use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer2::MIBS,
);
%MIBS = ( %SNMP::Info::Layer2::MIBS, );
%GLOBALS = (
%SNMP::Info::Layer2::GLOBALS,
);
%GLOBALS = ( %SNMP::Info::Layer2::GLOBALS, );
%FUNCS = (
%SNMP::Info::Layer2::FUNCS,
);
%FUNCS = ( %SNMP::Info::Layer2::FUNCS, );
%MUNGE = (
%SNMP::Info::Layer2::MUNGE,
);
%MUNGE = ( %SNMP::Info::Layer2::MUNGE, );
sub vendor {
return 'netgear';
@@ -83,14 +75,14 @@ sub model {
sub fw_mac {
my $netgear = shift;
my $ret = $netgear->qb_fw_mac();
$ret = $netgear->orig_fw_mac() if (!defined($ret));
$ret = $netgear->orig_fw_mac() if ( !defined($ret) );
return $ret;
}
sub fw_port {
my $netgear = shift;
my $ret = $netgear->qb_fw_port();
$ret = $netgear->orig_fw_port() if (!defined($ret));
$ret = $netgear->orig_fw_port() if ( !defined($ret) );
return $ret;
}
@@ -141,7 +133,8 @@ inherited methods.
=item Inherited Classes' MIBs
MIBs listed in L<SNMP::Info::Layer2/"Required MIBs"> and its inherited classes.
MIBs listed in L<SNMP::Info::Layer2/"Required MIBs"> and its inherited
classes.
=back

View File

@@ -35,7 +35,8 @@ use Exporter;
use SNMP::Info::IEEE802dot11;
use SNMP::Info::Layer2;
@SNMP::Info::Layer2::Orinoco::ISA = qw/SNMP::Info::IEEE802dot11 SNMP::Info::Layer2 Exporter/;
@SNMP::Info::Layer2::Orinoco::ISA
= qw/SNMP::Info::IEEE802dot11 SNMP::Info::Layer2 Exporter/;
@SNMP::Info::Layer2::Orinoco::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
@@ -45,28 +46,25 @@ $VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer2::MIBS,
%SNMP::Info::IEEE802dot11::MIBS,
#'ORiNOCO-MIB' => 'orinoco',
);
%GLOBALS = (
%SNMP::Info::Layer2::GLOBALS,
%SNMP::Info::IEEE802dot11::GLOBALS,
);
#'ORiNOCO-MIB' => 'orinoco',
);
%GLOBALS
= ( %SNMP::Info::Layer2::GLOBALS, %SNMP::Info::IEEE802dot11::GLOBALS, );
%FUNCS = (
%SNMP::Info::Layer2::FUNCS,
%SNMP::Info::IEEE802dot11::FUNCS,
# ORiNOCO-MIB:oriWirelessIfPropertiesTable
#'ori_ssid' => 'oriWirelessIfNetworkName',
#'ori_channel' => 'oriWirelessIfChannel',
#'ori_closed_sys' => 'oriWirelessIfClosedSystem',
# ORiNOCO-MIB:oriSystemInvMgmtComponentTable
);
);
%MUNGE = (
%SNMP::Info::Layer2::MUNGE,
%SNMP::Info::IEEE802dot11::MUNGE,
);
%MUNGE = ( %SNMP::Info::Layer2::MUNGE, %SNMP::Info::IEEE802dot11::MUNGE, );
sub os {
return 'orinoco';
@@ -78,10 +76,10 @@ sub os_ver {
my $descr = $orinoco->description();
return unless defined $descr;
if ($descr =~ m/V(\d+\.\d+)/){
if ( $descr =~ m/V(\d+\.\d+)/ ) {
return $1;
}
if ($descr =~ m/v(\d+\.\d+\.\d+)/){
if ( $descr =~ m/v(\d+\.\d+\.\d+)/ ) {
return $1;
}
@@ -94,10 +92,10 @@ sub os_bin {
my $descr = $orinoco->description();
return unless defined $descr;
if ($descr =~ m/V(\d+\.\d+)$/){
if ( $descr =~ m/V(\d+\.\d+)$/ ) {
return $1;
}
if ($descr =~ m/v(\d+\.\d+\.\d+)$/){
if ( $descr =~ m/v(\d+\.\d+\.\d+)$/ ) {
return $1;
}
@@ -114,8 +112,8 @@ sub model {
my $descr = $orinoco->description();
return unless defined $descr;
return $1 if ($descr =~ /(AP-\d+)/);
return 'WavePOINT-II' if ($descr =~ /WavePOINT-II/);
return $1 if ( $descr =~ /(AP-\d+)/ );
return 'WavePOINT-II' if ( $descr =~ /WavePOINT-II/ );
return;
}
@@ -136,8 +134,9 @@ sub i_ignore {
my $descr = $orinoco->i_description($partial) || {};
my %i_ignore;
foreach my $if (keys %$descr){
foreach my $if ( keys %$descr ) {
my $type = $descr->{$if};
# Skip virtual interfaces
$i_ignore{$if}++ if $type =~ /(lo|empty|PCMCIA)/i;
}
@@ -152,7 +151,7 @@ sub interfaces {
my $descriptions = $orinoco->i_description($partial) || {};
my %interfaces = ();
foreach my $iid (keys %$interfaces){
foreach my $iid ( keys %$interfaces ) {
my $desc = $descriptions->{$iid};
next unless defined $desc;
next if $desc =~ /(lo|empty|PCMCIA)/i;
@@ -208,9 +207,9 @@ Eric Miller
=head1 DESCRIPTION
Provides abstraction to the configuration information obtainable from a Orinoco
Access Point through SNMP. Orinoco devices have been manufactured by Proxim,
Agere, and Lucent.
Provides abstraction to the configuration information obtainable from
Orinoco Access Point through SNMP. Orinoco devices have been manufactured
by Proxim, Agere, and Lucent.
For speed or debugging purposes you can call the subclass directly, but not
after determining a more specific class using the method above.

View File

@@ -42,24 +42,19 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
# Set for No CDP
%GLOBALS = (
%SNMP::Info::Layer2::GLOBALS
);
%GLOBALS = ( %SNMP::Info::Layer2::GLOBALS );
%FUNCS = (%SNMP::Info::Layer2::FUNCS,
%FUNCS = (
%SNMP::Info::Layer2::FUNCS,
'ip_adresses' => 'ipAdEntAddr',
'i_name' => 'ifDescr',
'i_description' => 'adslLineConfProfile',
);
);
%MIBS = (
%SNMP::Info::Layer2::MIBS,
'ADSL-LINE-MIB' => 'adslLineConfProfile'
);
%MUNGE = (%SNMP::Info::Layer2::MUNGE
);
%MIBS
= ( %SNMP::Info::Layer2::MIBS, 'ADSL-LINE-MIB' => 'adslLineConfProfile' );
%MUNGE = ( %SNMP::Info::Layer2::MUNGE );
sub layers {
my $zyxel = shift;
@@ -82,7 +77,7 @@ sub os_ver {
my $zyxel = shift;
my $descr = $zyxel->description();
if ($descr =~ m/version (\S+) /){
if ( $descr =~ m/version (\S+) / ) {
return $1;
}
return;
@@ -93,21 +88,24 @@ sub model {
my $desc = $zyxel->description();
if ($desc =~ /8-port ADSL Module\(Annex A\)/){
if ( $desc =~ /8-port ADSL Module\(Annex A\)/ ) {
return "AAM1008-61";
} elsif ($desc =~ /8-port ADSL Module\(Annex B\)/){
}
elsif ( $desc =~ /8-port ADSL Module\(Annex B\)/ ) {
return "AAM1008-63";
}
return;
}
sub ip{
sub ip {
my $zyxel = shift;
my $ip_hash = $zyxel->ip_addresses();
my $found_ip;
foreach my $ip (keys %{$ip_hash}) {
$found_ip = $ip if (defined $ip and $ip =~ /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/);
foreach my $ip ( keys %{$ip_hash} ) {
$found_ip = $ip
if ( defined $ip
and $ip =~ /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/ );
}
return $found_ip;
}

View File

@@ -49,7 +49,8 @@ use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = ( %SNMP::Info::MIBS,
%MIBS = (
%SNMP::Info::MIBS,
%SNMP::Info::Bridge::MIBS,
%SNMP::Info::EtherLike::MIBS,
%SNMP::Info::Entity::MIBS,
@@ -57,9 +58,10 @@ $VERSION = '1.09';
'IP-MIB' => 'ipNetToMediaIfIndex',
'OSPF-MIB' => 'ospfRouterId',
'BGP4-MIB' => 'bgpIdentifier',
);
);
%GLOBALS = (
# Inherit the super class ones
%SNMP::Info::GLOBALS,
%SNMP::Info::Bridge::GLOBALS,
@@ -67,11 +69,12 @@ $VERSION = '1.09';
%SNMP::Info::Entity::GLOBALS,
%SNMP::Info::PowerEthernet::GLOBALS,
'mac' => 'ifPhysAddress.1',
'serial1' => '.1.3.6.1.4.1.9.3.6.3.0', # OLD-CISCO-CHASSIS-MIB::chassisId.0
'serial1' =>
'.1.3.6.1.4.1.9.3.6.3.0', # OLD-CISCO-CHASSIS-MIB::chassisId.0
'router_ip' => 'ospfRouterId.0',
'bgp_id' => 'bgpIdentifier.0',
'bgp_local_as' => 'bgpLocalAs.0',
);
);
%FUNCS = (
%SNMP::Info::FUNCS,
@@ -79,14 +82,17 @@ $VERSION = '1.09';
%SNMP::Info::EtherLike::FUNCS,
%SNMP::Info::Entity::FUNCS,
%SNMP::Info::PowerEthernet::FUNCS,
# Obsolete Address Translation Table (ARP Cache)
'old_at_index' => 'atIfIndex',
'old_at_paddr' => 'atPhysAddress',
'old_at_netaddr' => 'atNetAddress',
# IP-MIB IP Net to Media Table (ARP Cache)
'at_index' => 'ipNetToMediaIfIndex',
'at_paddr' => 'ipNetToMediaPhysAddress',
'at_netaddr' => 'ipNetToMediaNetAddress',
# OSPF-MIB::ospfIfTable
'ospf_if_ip' => 'ospfIfIpAddress',
'ospf_if_area' => 'ospfIfAreaId',
@@ -95,11 +101,13 @@ $VERSION = '1.09';
'ospf_if_dead' => 'ospfIfRtrDeadInterval',
'ospf_if_admin' => 'ospfIfAdminStat',
'ospf_if_state' => 'ospfIfState',
# OSPF-MIB::ospfNbrTable
'ospf_ip' => 'ospfHostIpAddress',
'ospf_peers' => 'ospfNbrIpAddr',
'ospf_peer_id' => 'ospfNbrRtrId',
'ospf_peer_state' => 'ospfNbrState',
# BGP4-MIB::bgpPeerTable
'bgp_peers' => 'bgpPeerLocalAddr',
'bgp_peer_id' => 'bgpPeerIdentifier',
@@ -112,9 +120,10 @@ $VERSION = '1.09';
'bgp_peer_in_upd' => 'bgpPeerInUpdates',
'bgp_peer_out_tot_msgs' => 'bgpPeerOutTotalMessages',
'bgp_peer_out_upd' => 'bgpPeerOutUpdates',
);
);
%MUNGE = (
# Inherit all the built in munging
%SNMP::Info::MUNGE,
%SNMP::Info::Bridge::MUNGE,
@@ -123,8 +132,7 @@ $VERSION = '1.09';
%SNMP::Info::PowerEthernet::MUNGE,
'old_at_paddr' => \&SNMP::Info::munge_mac,
'at_paddr' => \&SNMP::Info::munge_mac,
);
);
# Method OverRides
@@ -135,8 +143,8 @@ sub root_ip {
my $ospf_ip = $l3->ospf_ip();
# return the first one found here (should be only one)
if (defined $ospf_ip and scalar(keys %$ospf_ip)){
foreach my $key (keys %$ospf_ip){
if ( defined $ospf_ip and scalar( keys %$ospf_ip ) ) {
foreach my $key ( keys %$ospf_ip ) {
my $ip = $ospf_ip->{$key};
next if $ip eq '0.0.0.0';
next unless $l3->snmp_connect_ip($ip);
@@ -145,7 +153,10 @@ sub root_ip {
}
}
return $router_ip if ( (defined $router_ip) and ($router_ip ne '0.0.0.0') and ($l3->snmp_connect_ip($router_ip)) );
return $router_ip
if (( defined $router_ip )
and ( $router_ip ne '0.0.0.0' )
and ( $l3->snmp_connect_ip($router_ip) ) );
return;
}
@@ -156,9 +167,10 @@ sub i_ignore {
my $interfaces = $l3->interfaces($partial) || {};
my %i_ignore;
foreach my $if (keys %$interfaces) {
foreach my $if ( keys %$interfaces ) {
# lo -> cisco aironet 350 loopback
if ($interfaces->{$if} =~ /(tunnel|loopback|\blo\b|null)/i){
if ( $interfaces->{$if} =~ /(tunnel|loopback|\blo\b|null)/i ) {
$i_ignore{$if}++;
}
}
@@ -177,9 +189,10 @@ sub serial {
# precedence
# serial2,chassis parse,serial1
return $serial2 if (defined $serial2 and $serial2 !~ /^\s*$/);
return $1 if (defined $chassis and $chassis =~ /serial#?:\s*([a-z0-9]+)/i);
return $serial1 if (defined $serial1 and $serial1 !~ /^\s*$/);
return $serial2 if ( defined $serial2 and $serial2 !~ /^\s*$/ );
return $1
if ( defined $chassis and $chassis =~ /serial#?:\s*([a-z0-9]+)/i );
return $serial1 if ( defined $serial1 and $serial1 !~ /^\s*$/ );
return;
}
@@ -190,8 +203,10 @@ sub model {
my $l3 = shift;
my $id = $l3->id();
unless (defined $id){
print " SNMP::Info::Layer3::model() - Device does not support sysObjectID\n" if $l3->debug();
unless ( defined $id ) {
print
" SNMP::Info::Layer3::model() - Device does not support sysObjectID\n"
if $l3->debug();
return;
}
@@ -214,12 +229,13 @@ sub i_name {
my $i_name2 = $l3->orig_i_name($partial);
my %i_name;
foreach my $iid (keys %$i_name2){
foreach my $iid ( keys %$i_name2 ) {
my $name = $i_name2->{$iid};
my $alias = $i_alias->{$iid};
$i_name{$iid} = (defined $alias and $alias !~ /^\s*$/) ?
$alias :
$name;
$i_name{$iid}
= ( defined $alias and $alias !~ /^\s*$/ )
? $alias
: $name;
}
return \%i_name;
@@ -233,7 +249,7 @@ sub i_duplex {
my $el_duplex = $l3->el_duplex($partial);
my %i_index;
foreach my $el_port (keys %$el_duplex){
foreach my $el_port ( keys %$el_duplex ) {
my $iid = $el_index->{$el_port};
next unless defined $iid;
my $duplex = $el_duplex->{$el_port};
@@ -256,7 +272,7 @@ sub interfaces {
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;
@@ -271,8 +287,8 @@ sub vendor {
my $descr = $l3->description();
return 'cisco' if ($descr =~ /(cisco|\bios\b)/i);
return 'foundry' if ($descr =~ /foundry/i);
return 'cisco' if ( $descr =~ /(cisco|\bios\b)/i );
return 'foundry' if ( $descr =~ /foundry/i );
return 'unknown';
@@ -472,7 +488,8 @@ to a hash.
=item $l3->interfaces()
Returns the map between SNMP Interface Identifier (iid) and physical port name.
Returns the map between SNMP Interface Identifier (iid) and physical port
name.
Only returns those iids that have a description listed in $l3->i_description()
@@ -623,8 +640,8 @@ received on this connection
=item $l3->bgp_peer_out_tot_msgs()
Returns reference to hash of BGP peer to the total number of messages transmitted
to the remote peer on this connection
Returns reference to hash of BGP peer to the total number of messages
transmitted to the remote peer on this connection
(C<bgpPeerOutTotalMessages>)

View File

@@ -47,39 +47,43 @@ $VERSION = '1.09';
%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',
);
);
%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,
);
);
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;
}
@@ -107,12 +111,12 @@ sub bp_index {
my $interfaces = $aironet->interfaces();
my $bp_index = $aironet->bp_index2();
foreach my $iid (keys %$interfaces){
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;
}
}
@@ -127,13 +131,13 @@ sub fw_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};
@@ -148,8 +152,7 @@ sub fw_port {
my $fw_port = $aironet->fw_port2();
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,7 +161,6 @@ sub fw_port {
return $fw_port;
}
sub i_duplex {
my $aironet = shift;
my $interfaces = $aironet->interfaces();
@@ -166,10 +168,10 @@ sub i_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};
}
@@ -196,8 +198,8 @@ sub i_ignore {
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

@@ -50,7 +50,7 @@ $VERSION = '1.09';
'ALTEON-CS-PHYSICAL-MIB' => 'vlanCurCfgLearn',
'ALTEON-TS-NETWORK-MIB' => 'ripCurCfgSupply',
'ALTEON-CHEETAH-NETWORK-MIB' => 'ripCurCfgIntfSupply',
);
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
@@ -66,10 +66,11 @@ $VERSION = '1.09';
'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',
@@ -77,22 +78,31 @@ $VERSION = '1.09';
'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_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',
@@ -102,19 +112,19 @@ $VERSION = '1.09';
'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,
);
%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;
}
@@ -152,17 +162,18 @@ sub interfaces {
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+)/) {
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,11 +183,13 @@ 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;
@@ -184,9 +197,9 @@ sub i_duplex {
$duplex = 'full' if $duplex =~ /full/i;
my $idx;
$idx = $if + $ip_max if (defined $ip_max);
$idx = $if + $ip_max if ( defined $ip_max );
$i_duplex{$idx}=$duplex;
$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) {
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);
$idx = $if + $ip_max if ( defined $ip_max );
$i_duplex_admin{$idx}=$string;
$i_duplex_admin{$idx} = $string;
}
return \%i_duplex_admin;
}
@@ -230,15 +253,17 @@ 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;
@@ -255,30 +280,35 @@ sub v_name {
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 $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 $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;
@@ -318,10 +350,10 @@ sub bp_index {
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

@@ -42,7 +42,8 @@ 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::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
@@ -50,20 +51,16 @@ use 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,
);
%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,
@@ -75,20 +72,17 @@ $VERSION = '1.09';
%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,
@@ -98,7 +92,7 @@ $VERSION = '1.09';
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoStack::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE,
);
);
sub vendor {
return 'cisco';
@@ -111,7 +105,7 @@ sub model {
$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;
@@ -125,7 +119,7 @@ sub ports {
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;
@@ -142,9 +136,9 @@ sub i_duplex {
my $el_duplex = $c3550->el_duplex($partial);
# Newer software
if (defined $el_duplex and scalar(keys %$el_duplex)){
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);
@@ -168,20 +163,21 @@ sub i_duplex_admin {
my $el_duplex = $c3550->el_duplex($partial);
# Newer software
if (defined $el_duplex and scalar(keys %$el_duplex)){
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);
@@ -189,16 +185,17 @@ sub i_duplex_admin {
}
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)){
if ( defined $el_duplex and scalar( keys %$el_duplex ) ) {
my $p_port = $c3550->p_port() || {};
my %reverse_p_port = reverse %$p_port;
@@ -208,7 +205,7 @@ sub set_i_duplex_admin {
$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

@@ -48,7 +48,7 @@ use SNMP::Info::Layer3;
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';
@@ -62,7 +62,7 @@ $VERSION = '1.09';
%SNMP::Info::CDP::MIBS,
%SNMP::Info::CiscoVTP::MIBS,
'CISCO-ENVMON-MIB' => 'ciscoEnvMonMIB',
);
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
@@ -77,7 +77,7 @@ $VERSION = '1.09';
'ps1_status' => 'ciscoEnvMonSupplyState.1',
'ps2_type' => 'ciscoEnvMonSupplyStatusDescr.2',
'ps2_status' => 'ciscoEnvMonSupplyState.2',
);
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
@@ -90,23 +90,21 @@ $VERSION = '1.09';
%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;
@@ -114,11 +112,11 @@ sub fan {
my $fan_descr = $c4000->fan_descr();
my $ret = "";
my $s = "";
foreach my $i (sort {$a <=> $b} keys %$fan_state) {
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

@@ -42,7 +42,8 @@ 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::Layer3::C6500::ISA
= qw/SNMP::Info::CiscoVTP SNMP::Info::CiscoStack
SNMP::Info::CDP SNMP::Info::CiscoStats
SNMP::Info::CiscoImage
SNMP::Info::CiscoPortSecurity
@@ -52,21 +53,17 @@ use 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::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,
@@ -78,31 +75,23 @@ $VERSION = '1.09';
%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::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::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';
@@ -119,9 +108,9 @@ sub i_duplex {
my $el_duplex = $c6500->el_duplex($partial);
# Newer software
if (defined $el_duplex and scalar(keys %$el_duplex)){
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);
@@ -145,20 +135,21 @@ sub i_duplex_admin {
my $el_duplex = $c6500->el_duplex($partial);
# Newer software
if (defined $el_duplex and scalar(keys %$el_duplex)){
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);
@@ -166,16 +157,17 @@ sub i_duplex_admin {
}
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)){
if ( defined $el_duplex and scalar( keys %$el_duplex ) ) {
my $p_port = $c6500->p_port() || {};
my %reverse_p_port = reverse %$p_port;
@@ -185,7 +177,7 @@ sub set_i_duplex_admin {
$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

@@ -65,20 +65,15 @@ $VERSION = '1.09';
%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,
@@ -90,9 +85,10 @@ $VERSION = '1.09';
%SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::CDP::FUNCS,
%SNMP::Info::CiscoVTP::FUNCS,
# EIGRP
'eigrp_peers' => 'cEigrpPeerAddr',
);
);
%MUNGE = (
%SNMP::Info::Layer3::MUNGE,
@@ -105,7 +101,7 @@ $VERSION = '1.09';
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE,
'eigrp_peers' => \&SNMP::Info::munge_ip,
);
);
sub i_vlan {
my ($cisco) = shift;
@@ -115,9 +111,9 @@ sub i_vlan {
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+)$/) {
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;
}
}

View File

@@ -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::GLOBALS, %SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::Entity::GLOBALS,
);
);
%FUNCS = (
%SNMP::Info::FUNCS,
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::FUNCS, %SNMP::Info::Layer3::FUNCS,
%SNMP::Info::Entity::FUNCS,
);
);
%MUNGE = (
%SNMP::Info::MUNGE,
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::MUNGE, %SNMP::Info::Layer3::MUNGE,
%SNMP::Info::Entity::MUNGE,
);
);
sub layers {
return '00000100';
@@ -81,7 +77,7 @@ sub 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;
}
@@ -94,7 +90,7 @@ sub os_ver {
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;
@@ -104,8 +100,8 @@ sub mac {
my $contivity = shift;
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;
@@ -119,11 +115,10 @@ sub 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;
@@ -131,10 +126,11 @@ sub interfaces {
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;
}
@@ -148,10 +144,11 @@ sub i_name {
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+)/;
@@ -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

@@ -41,21 +41,23 @@ use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = ( %SNMP::Info::Layer3::MIBS,
%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',
);
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
# RADLAN-rlInterfaces:swIfTable
'dell_duplex_admin' => 'swIfDuplexAdminMode',
'dell_duplex' => 'swIfDuplexOperMode',
@@ -65,6 +67,7 @@ $VERSION = '1.09';
'dell_speed_admin' => 'swIfSpeedAdminMode',
'dell_auto' => 'swIfSpeedDuplexAutoNegotiation',
'dell_fc' => 'swIfOperFlowControlMode',
# RADLAN-Physicaldescription-MIB:rlPhdUnitGenParamTable
'dell_unit' => 'rlPhdUnitGenParamStackUnit',
'dell_sw_ver' => 'rlPhdUnitGenParamSoftwareVersion',
@@ -72,6 +75,7 @@ $VERSION = '1.09';
'dell_hw_ver' => 'rlPhdUnitGenParamHardwareVersion',
'dell_serial_no' => 'rlPhdUnitGenParamSerialNum',
'dell_asset_no' => 'rlPhdUnitGenParamAssetTag',
# RADLAN-COPY-MIB:rlCopyTable
'dell_cp_idx' => 'rlCopyIndex',
'dell_cp_sloc' => 'rlCopySourceLocation',
@@ -87,19 +91,18 @@ $VERSION = '1.09';
'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,
);
%MUNGE = ( %SNMP::Info::Layer3::MUNGE, );
# Method OverRides
@@ -109,9 +112,10 @@ sub model {
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;
@@ -135,9 +139,9 @@ sub serial {
my $numbers = $dell->dell_serial_no();
foreach my $key (keys %$numbers){
foreach my $key ( keys %$numbers ) {
my $serial = $numbers->{$key};
return $serial if (defined $serial and $serial !~ /^\s*$/);
return $serial if ( defined $serial and $serial !~ /^\s*$/ );
next;
}
@@ -154,7 +158,7 @@ sub interfaces {
# 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;
@@ -172,15 +176,15 @@ sub i_duplex_admin {
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';
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 = '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;
}
@@ -193,14 +197,14 @@ sub i_duplex_admin {
sub fw_mac {
my $dell = shift;
my $ret = $dell->qb_fw_mac();
$ret = $dell->orig_fw_mac() if (!defined($ret));
$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));
$ret = $dell->orig_fw_port() if ( !defined($ret) );
return $ret;
}
@@ -214,9 +218,9 @@ sub _vendor {
674 => 'dell',
3955 => 'linksys',
);
$id = $1 if (defined($id) && $id =~ /^\.1\.3\.6\.1\.4\.1\.(\d+)/);
$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

@@ -47,41 +47,35 @@ 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,
%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,
%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,
);
%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();
unless ( defined $id ) {
print
" SNMP::Info::Layer3::Enterasys::model() - Device does not support sysObjectID\n"
if $enterasys->debug();
return;
}
@@ -107,7 +101,7 @@ sub os_ver {
my $descr = $enterasys->description();
return unless defined $descr;
if ($descr =~ m/\bRev ([\d.]*)/){
if ( $descr =~ m/\bRev ([\d.]*)/ ) {
return $1;
}
@@ -122,7 +116,8 @@ sub interfaces {
# 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 {
@@ -132,8 +127,8 @@ sub i_ignore {
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}++;
}
}
@@ -172,10 +167,11 @@ sub fw_port {
# 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;
@@ -191,14 +187,14 @@ sub c_ip {
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;
@@ -211,18 +207,18 @@ sub c_if {
my $enterasys = 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;
@@ -239,14 +235,14 @@ sub c_port {
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;
@@ -263,14 +259,14 @@ sub c_id {
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;
@@ -287,14 +283,14 @@ sub c_platform {
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

@@ -37,20 +37,22 @@ 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,
%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,
@@ -62,24 +64,28 @@ $VERSION = '1.09';
'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',
);
);
%MUNGE = (
# Inherit all the built in munging
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::MAU::MUNGE,
@@ -89,19 +95,22 @@ $VERSION = '1.09';
'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_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();
unless ( defined $id ) {
print
" SNMP::Info::Layer3::Extreme::model() - Device does not support sysObjectID\n"
if $extreme->debug();
return;
}
@@ -125,7 +134,7 @@ sub os_ver {
my $descr = $extreme->description();
return unless defined $descr;
if ($descr =~ m/Version ([\d.]*)/){
if ( $descr =~ m/Version ([\d.]*)/ ) {
return $1;
}
@@ -144,10 +153,11 @@ sub interfaces {
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.]+\)/) {
foreach my $idx ( keys %$i_name ) {
if ( $i_name->{$idx} =~ /\([0-9.]+\)/ ) {
$interfaces->{$idx} = $i_description->{$idx};
} else {
}
else {
$interfaces->{$idx} = $i_name->{$idx};
}
}
@@ -163,8 +173,10 @@ sub i_ignore {
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}++;
}
}
@@ -179,7 +191,7 @@ sub bp_index {
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;
}
@@ -218,11 +230,11 @@ sub fan {
my $fan_state = $extreme->fan_state();
my $ret = "";
my $s = "";
foreach my $i (sort {$a <=> $b} keys %$fan_state) {
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;
}
@@ -267,28 +279,31 @@ sub _if2tag {
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;
@@ -314,17 +329,18 @@ sub i_vlan {
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 = $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};
}
}
@@ -338,25 +354,27 @@ sub i_vlan_membership {
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 = $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})) {
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

@@ -46,13 +46,14 @@ use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = ( %SNMP::Info::Layer3::MIBS,
%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,
@@ -65,25 +66,25 @@ $VERSION = '1.09';
'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',
);
);
%MUNGE = (
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::LLDP::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}++;
}
}
@@ -105,14 +106,14 @@ sub i_duplex {
my $partial = shift;
my $sw_index = $foundry->sw_index($partial);
my $sw_duplex= $foundry->sw_duplex($partial);
my $sw_duplex = $foundry->sw_duplex($partial);
unless (defined $sw_index and defined $sw_duplex){
unless ( defined $sw_index and defined $sw_duplex ) {
return $foundry->SUPER::i_duplex();
}
my %i_duplex;
foreach my $sw_port (keys %$sw_duplex){
foreach my $sw_port ( keys %$sw_duplex ) {
my $iid = $sw_index->{$sw_port};
my $duplex = $sw_duplex->{$sw_port};
next if $duplex =~ /none/i;
@@ -128,20 +129,20 @@ sub model {
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};
}
}
@@ -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};
@@ -239,7 +241,7 @@ sub interfaces {
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
@@ -255,7 +257,7 @@ sub stp_p_state {
my $partial = shift;
my $descr = $foundry->description();
if ($descr =~ m/\bEdgeIron 24G\b/) {
if ( $descr =~ m/\bEdgeIron 24G\b/ ) {
return;
}
@@ -279,14 +281,14 @@ sub c_ip {
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;
@@ -327,14 +329,14 @@ sub c_port {
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;
@@ -351,14 +353,14 @@ sub c_id {
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;
@@ -375,14 +377,14 @@ sub c_platform {
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

@@ -44,13 +44,14 @@ use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = ( %SNMP::Info::Layer3::MIBS,
%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,
@@ -63,12 +64,13 @@ $VERSION = '1.09';
'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
@@ -77,13 +79,12 @@ $VERSION = '1.09';
'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::Layer3::MUNGE, %SNMP::Info::LLDP::MUNGE,
%SNMP::Info::FDP::MUNGE,
);
);
sub i_ignore {
my $hp9300 = shift;
@@ -92,8 +93,8 @@ sub i_ignore {
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}++;
}
}
@@ -105,14 +106,14 @@ sub i_duplex {
my $partial = shift;
my $sw_index = $hp9300->sw_index($partial);
my $sw_duplex= $hp9300->sw_duplex($partial);
my $sw_duplex = $hp9300->sw_duplex($partial);
unless (defined $sw_index and defined $sw_duplex){
unless ( defined $sw_index and defined $sw_duplex ) {
return $hp9300->SUPER::i_duplex();
}
my %i_duplex;
foreach my $sw_port (keys %$sw_duplex){
foreach my $sw_port ( keys %$sw_duplex ) {
my $iid = $sw_index->{$sw_port};
my $duplex = $sw_duplex->{$sw_port};
next if $duplex =~ /none/i;
@@ -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;
@@ -185,7 +186,7 @@ sub interfaces {
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
@@ -211,14 +212,14 @@ sub c_ip {
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;
@@ -231,18 +232,18 @@ sub c_if {
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;
@@ -259,14 +260,14 @@ sub c_port {
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;
@@ -283,14 +284,14 @@ sub c_id {
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;
@@ -307,14 +308,14 @@ sub c_platform {
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

@@ -37,7 +37,7 @@ use SNMP::Info::Layer3;
@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';
@@ -45,20 +45,13 @@ $VERSION = '1.09';
%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';
@@ -73,7 +66,7 @@ sub os_ver {
my $descr = $juniper->description();
return unless defined $descr;
if ($descr =~ m/kernel JUNOS (\S+)/) {
if ( $descr =~ m/kernel JUNOS (\S+)/ ) {
return $1;
}
return;
@@ -83,8 +76,10 @@ 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;
}
@@ -110,9 +105,9 @@ sub i_vlan {
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+)$/) {
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;
}
}

View File

@@ -37,25 +37,17 @@ use SNMP::Info::Layer3;
@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';
@@ -70,11 +62,13 @@ sub os_ver {
}
sub model {
return 'Windows Router'
return 'Windows Router';
}
sub serial {
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"
@@ -87,11 +81,11 @@ sub interfaces {
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

@@ -35,39 +35,41 @@ 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,
%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',
);
);
%MUNGE = (
# Inherit all the built in munging
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::SONMP::MUNGE,
);
);
# Method OverRides
@@ -75,8 +77,10 @@ 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();
unless ( defined $id ) {
print
" SNMP::Info::Layer3::N1600::model() - Device does not support sysObjectID\n"
if $n1600->debug();
return;
}
@@ -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;
}
@@ -115,7 +119,7 @@ sub interfaces {
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;
@@ -132,7 +136,7 @@ sub i_duplex {
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;
@@ -149,7 +153,7 @@ sub i_duplex_admin {
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

@@ -37,7 +37,7 @@ use SNMP::Info::Layer3;
@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';
@@ -46,21 +46,17 @@ $VERSION = '1.09';
'UCD-SNMP-MIB' => 'versionTag',
'NET-SNMP-TC' => 'netSnmpAgentOIDs',
'HOST-RESOURCES-MIB' => 'hrSystem',
);
);
%GLOBALS = (
%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';
@@ -70,7 +66,7 @@ sub os {
my $netsnmp = shift;
my $descr = $netsnmp->description();
return $1 if ($descr =~ /^(\S+)\s+/);
return $1 if ( $descr =~ /^(\S+)\s+/ );
return;
}
@@ -80,7 +76,7 @@ sub os_ver {
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;
@@ -115,9 +111,10 @@ sub i_ignore {
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

@@ -47,20 +47,13 @@ $VERSION = '1.09';
'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';
@@ -78,7 +71,7 @@ sub os_ver {
my $netscreen = shift;
my $descr = $netscreen->description();
if ( $descr =~ m/version (\d\S*) \(SN: /) {
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;

View File

@@ -36,7 +36,8 @@ use SNMP::Info::SONMP;
use SNMP::Info::RapidCity;
use SNMP::Info::Layer3;
@SNMP::Info::Layer3::Passport::ISA = qw/SNMP::Info::SONMP SNMP::Info::RapidCity
@SNMP::Info::Layer3::Passport::ISA
= qw/SNMP::Info::SONMP SNMP::Info::RapidCity
SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::Passport::EXPORT_OK = qw//;
@@ -45,35 +46,33 @@ use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::RapidCity::MIBS,
%SNMP::Info::Layer3::MIBS, %SNMP::Info::RapidCity::MIBS,
%SNMP::Info::SONMP::MIBS,
);
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::RapidCity::GLOBALS,
%SNMP::Info::Layer3::GLOBALS, %SNMP::Info::RapidCity::GLOBALS,
%SNMP::Info::SONMP::GLOBALS,
);
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::RapidCity::FUNCS,
%SNMP::Info::Layer3::FUNCS, %SNMP::Info::RapidCity::FUNCS,
%SNMP::Info::SONMP::FUNCS,
);
);
%MUNGE = (
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::RapidCity::MUNGE,
%SNMP::Info::Layer3::MUNGE, %SNMP::Info::RapidCity::MUNGE,
%SNMP::Info::SONMP::MUNGE,
);
);
sub model {
my $passport = shift;
my $id = $passport->id();
unless (defined $id){
print " SNMP::Info::Layer3::Passport::model() - Device does not support sysObjectID\n" if $passport->debug();
unless ( defined $id ) {
print
" SNMP::Info::Layer3::Passport::model() - Device does not support sysObjectID\n"
if $passport->debug();
return;
}
@@ -99,11 +98,12 @@ sub os_ver {
return unless defined $descr;
#ERS / Passport
if ($descr =~ m/(\d+\.\d+\.\d+\.\d+)/){
if ( $descr =~ m/(\d+\.\d+\.\d+\.\d+)/ ) {
return $1;
}
#Accelar
if ($descr =~ m/(\d+\.\d+\.\d+)/){
if ( $descr =~ m/(\d+\.\d+\.\d+)/ ) {
return $1;
}
return;
@@ -117,7 +117,7 @@ sub i_index {
my $model = $passport->model();
my %if_index;
foreach my $iid (keys %$i_index){
foreach my $iid ( keys %$i_index ) {
my $index = $i_index->{$iid};
next unless defined $index;
@@ -125,29 +125,33 @@ sub i_index {
}
# Get VLAN Virtual Router Interfaces
if (!defined $partial or (defined $model and
(($partial > 2000 and $model =~ /(86|83|81|16)/) or
($partial > 256 and $model =~ /(105|11[05]0|12[05])/)))) {
if (!defined $partial
or (defined $model
and ( ( $partial > 2000 and $model =~ /(86|83|81|16)/ )
or ( $partial > 256 and $model =~ /(105|11[05]0|12[05])/ ) )
)
)
{
my $vlan_index = $passport->rc_vlan_if() || {};
foreach my $vid (keys %$vlan_index){
foreach my $vid ( keys %$vlan_index ) {
my $v_index = $vlan_index->{$vid};
next unless defined $v_index;
next if $v_index == 0;
next if (defined $partial and $v_index !~ /^$partial$/);
next if ( defined $partial and $v_index !~ /^$partial$/ );
$if_index{$v_index} = $v_index;
}
}
if (defined $model and $model =~ /(86)/) {
if ( defined $model and $model =~ /(86)/ ) {
my $cpu_index = $passport->rc_cpu_ifindex($partial) || {};
my $virt_ip = $passport->rc_virt_ip();
# Get CPU Ethernet Interfaces
foreach my $cid (keys %$cpu_index){
foreach my $cid ( keys %$cpu_index ) {
my $c_index = $cpu_index->{$cid};
next unless defined $c_index;
next if $c_index == 0;
@@ -156,7 +160,8 @@ sub i_index {
}
# Check for Virtual Mgmt Interface
unless ($virt_ip eq '0.0.0.0') {
unless ( $virt_ip eq '0.0.0.0' ) {
# Make up an index number, 1 is not reserved AFAIK
$if_index{1} = 1;
}
@@ -176,48 +181,53 @@ sub interfaces {
my %reverse_vlan;
my $vlan_id = {};
if (!defined $partial or (defined $model and
(($partial > 2000 and $model =~ /(86|83|81|16)/) or
($partial > 256 and $model =~ /(105|11[05]0|12[05])/)))) {
if (!defined $partial
or (defined $model
and ( ( $partial > 2000 and $model =~ /(86|83|81|16)/ )
or ( $partial > 256 and $model =~ /(105|11[05]0|12[05])/ ) )
)
)
{
$vlan_index = $passport->rc_vlan_if();
%reverse_vlan = reverse %$vlan_index;
$vlan_id = $passport->rc_vlan_id();
}
my %if;
foreach my $iid (keys %$i_index){
foreach my $iid ( keys %$i_index ) {
my $index = $i_index->{$iid};
next unless defined $index;
if (($index == 1) and ($model =~ /(86)/)) {
if ( ( $index == 1 ) and ( $model =~ /(86)/ ) ) {
$if{$index} = 'Cpu.Virtual';
}
elsif (($index == 192) and ($model eq '8603')) {
elsif ( ( $index == 192 ) and ( $model eq '8603' ) ) {
$if{$index} = 'Cpu.3';
}
elsif (($index == 320) and ($model =~ /(8606|8610|8610co)/)) {
elsif ( ( $index == 320 ) and ( $model =~ /(8606|8610|8610co)/ ) ) {
$if{$index} = 'Cpu.5';
}
elsif (($index == 384) and ($model =~ /(8606|8610|8610co)/)) {
elsif ( ( $index == 384 ) and ( $model =~ /(8606|8610|8610co)/ ) ) {
$if{$index} = 'Cpu.6';
}
elsif (($index > 2000 and $model =~ /(86|83|81|16)/) or
($index > 256 and $model =~ /(105|11[05]0|12[05])/)) {
elsif (( $index > 2000 and $model =~ /(86|83|81|16)/ )
or ( $index > 256 and $model =~ /(105|11[05]0|12[05])/ ) )
{
my $v_index = $reverse_vlan{$iid};
my $v_id = $vlan_id->{$v_index};
next unless defined $v_id;
my $v_port = 'Vlan'."$v_id";
my $v_port = 'Vlan' . "$v_id";
$if{$index} = $v_port;
}
else {
my $port = ($index % $index_factor) + $port_offset;
my $slot = int($index / $index_factor);
my $port = ( $index % $index_factor ) + $port_offset;
my $slot = int( $index / $index_factor );
my $slotport = "$slot.$port";
$if{$iid} = $slotport;
@@ -236,7 +246,7 @@ sub i_mac {
my $model = $passport->model();
my %if_mac;
foreach my $iid (keys %$i_mac){
foreach my $iid ( keys %$i_mac ) {
my $mac = $i_mac->{$iid};
next unless defined $mac;
@@ -244,31 +254,35 @@ sub i_mac {
}
# Get VLAN Virtual Router Interfaces
if (!defined $partial or (defined $model and
(($partial > 2000 and $model =~ /(86|83|81|16)/) or
($partial > 256 and $model =~ /(105|11[05]0|12[05])/)))) {
if (!defined $partial
or (defined $model
and ( ( $partial > 2000 and $model =~ /(86|83|81|16)/ )
or ( $partial > 256 and $model =~ /(105|11[05]0|12[05])/ ) )
)
)
{
my $vlan_index = $passport->rc_vlan_if() || {};
my $vlan_mac = $passport->rc_vlan_mac() || {};
foreach my $iid (keys %$vlan_mac){
foreach my $iid ( keys %$vlan_mac ) {
my $v_mac = $vlan_mac->{$iid};
next unless defined $v_mac;
my $v_id = $vlan_index->{$iid};
next unless defined $v_id;
next if (defined $partial and $v_id !~ /^$partial$/);
next if ( defined $partial and $v_id !~ /^$partial$/ );
$if_mac{$v_id} = $v_mac;
}
}
if (defined $model and $model =~ /(86)/) {
if ( defined $model and $model =~ /(86)/ ) {
my $cpu_mac = $passport->rc_cpu_mac($partial) || {};
my $virt_ip = $passport->rc_virt_ip() || '0.0.0.0';
# Get CPU Ethernet Interfaces
foreach my $iid (keys %$cpu_mac){
foreach my $iid ( keys %$cpu_mac ) {
my $mac = $cpu_mac->{$iid};
next unless defined $mac;
@@ -276,18 +290,20 @@ sub i_mac {
}
# Check for Virtual Mgmt Interface
unless (($virt_ip eq '0.0.0.0') or (defined $partial and $partial ne "1")) {
unless ( ( $virt_ip eq '0.0.0.0' )
or ( defined $partial and $partial ne "1" ) )
{
my $chassis_base_mac = $passport->rc_base_mac();
if (defined $chassis_base_mac) {
if ( defined $chassis_base_mac ) {
my @virt_mac = split /:/, $chassis_base_mac;
$virt_mac[0] = hex($virt_mac[0]);
$virt_mac[1] = hex($virt_mac[1]);
$virt_mac[2] = hex($virt_mac[2]);
$virt_mac[3] = hex($virt_mac[3]);
$virt_mac[4] = hex($virt_mac[4]) + 0x03;
$virt_mac[5] = hex($virt_mac[5]) + 0xF8;
$virt_mac[0] = hex( $virt_mac[0] );
$virt_mac[1] = hex( $virt_mac[1] );
$virt_mac[2] = hex( $virt_mac[2] );
$virt_mac[3] = hex( $virt_mac[3] );
$virt_mac[4] = hex( $virt_mac[4] ) + 0x03;
$virt_mac[5] = hex( $virt_mac[5] ) + 0xF8;
my $mac = join(':',map { sprintf "%02x",$_ } @virt_mac);
my $mac = join( ':', map { sprintf "%02x", $_ } @virt_mac );
$if_mac{1} = $mac;
}
@@ -304,7 +320,7 @@ sub i_description {
my $model = $passport->model();
my %descr;
foreach my $iid (keys %$i_descr){
foreach my $iid ( keys %$i_descr ) {
my $if_descr = $i_descr->{$iid};
next unless defined $if_descr;
@@ -312,19 +328,23 @@ sub i_description {
}
# Get VLAN Virtual Router Interfaces
if (!defined $partial or (defined $model and
(($partial > 2000 and $model =~ /(86|83|81|16)/) or
($partial > 256 and $model =~ /(105|11[05]0|12[05])/)))) {
if (!defined $partial
or (defined $model
and ( ( $partial > 2000 and $model =~ /(86|83|81|16)/ )
or ( $partial > 256 and $model =~ /(105|11[05]0|12[05])/ ) )
)
)
{
my $v_descr = $passport->v_name();
my $vlan_index = $passport->rc_vlan_if();
foreach my $vid (keys %$v_descr){
foreach my $vid ( keys %$v_descr ) {
my $vl_descr = $v_descr->{$vid};
next unless defined $vl_descr;
my $v_id = $vlan_index->{$vid};
next unless defined $v_id;
next if (defined $partial and $v_id !~ /^$partial$/);
next if ( defined $partial and $v_id !~ /^$partial$/ );
$descr{$v_id} = $vl_descr;
}
@@ -344,35 +364,44 @@ sub i_name {
my $vlan_index = {};
my %reverse_vlan;
if (!defined $partial or (defined $model and
(($partial > 2000 and $model =~ /(86|83|81|16)/) or
($partial > 256 and $model =~ /(105|11[05]0|12[05])/)))) {
if (!defined $partial
or (defined $model
and ( ( $partial > 2000 and $model =~ /(86|83|81|16)/ )
or ( $partial > 256 and $model =~ /(105|11[05]0|12[05])/ ) )
)
)
{
$v_name = $passport->v_name() || {};
$vlan_index = $passport->rc_vlan_if() || {};
%reverse_vlan = reverse %$vlan_index;
}
my %i_name;
foreach my $iid (keys %$i_index){
foreach my $iid ( keys %$i_index ) {
if (($iid == 1) and ($model =~ /(86)/)) {
if ( ( $iid == 1 ) and ( $model =~ /(86)/ ) ) {
$i_name{$iid} = 'CPU Virtual Management IP';
}
elsif (($iid == 192) and ($model eq '8603')) {
elsif ( ( $iid == 192 ) and ( $model eq '8603' ) ) {
$i_name{$iid} = 'CPU 3 Ethernet Port';
}
elsif (($iid == 320) and ($model =~ /(8606|8610|8610co)/)) {
elsif ( ( $iid == 320 ) and ( $model =~ /(8606|8610|8610co)/ ) ) {
$i_name{$iid} = 'CPU 5 Ethernet Port';
}
elsif (($iid == 384) and ($model =~ /(8606|8610|8610co)/)) {
elsif ( ( $iid == 384 ) and ( $model =~ /(8606|8610|8610co)/ ) ) {
$i_name{$iid} = 'CPU 6 Ethernet Port';
}
elsif (($iid > 2000 and defined $model and $model =~ /(86|83|81|16)/) or
($iid > 256 and defined $model and $model =~ /(105|11[05]0|12[05])/)) {
elsif (
( $iid > 2000 and defined $model and $model =~ /(86|83|81|16)/ )
or ( $iid > 256
and defined $model
and $model =~ /(105|11[05]0|12[05])/ )
)
{
my $vlan_index = $reverse_vlan{$iid};
my $vlan_name = $v_name->{$vlan_index};
next unless defined $vlan_name;
@@ -383,9 +412,10 @@ sub i_name {
else {
my $name = $i_name2->{$iid};
my $alias = $rc_alias->{$iid};
$i_name{$iid} = (defined $alias and $alias !~ /^\s*$/) ?
$alias :
$name;
$i_name{$iid}
= ( defined $alias and $alias !~ /^\s*$/ )
? $alias
: $name;
}
}
@@ -400,7 +430,7 @@ sub ip_index {
my $ip_index = $passport->orig_ip_index($partial) || {};
my %ip_index;
foreach my $ip (keys %$ip_index){
foreach my $ip ( keys %$ip_index ) {
my $iid = $ip_index->{$ip};
next unless defined $iid;
@@ -408,13 +438,13 @@ sub ip_index {
}
# Only 8600 has CPU and Virtual Management IP
if (defined $model and $model =~ /(86)/) {
if ( defined $model and $model =~ /(86)/ ) {
my $cpu_ip = $passport->rc_cpu_ip($partial) || {};
my $virt_ip = $passport->rc_virt_ip($partial);
# Get CPU Ethernet IP
foreach my $cid (keys %$cpu_ip){
foreach my $cid ( keys %$cpu_ip ) {
my $c_ip = $cpu_ip->{$cid};
next unless defined $c_ip;
@@ -422,7 +452,7 @@ sub ip_index {
}
# Get Virtual Mgmt IP
$ip_index{$virt_ip} = 1 if (defined $virt_ip);
$ip_index{$virt_ip} = 1 if ( defined $virt_ip );
}
return \%ip_index;
@@ -436,7 +466,7 @@ sub ip_netmask {
my $ip_mask = $passport->orig_ip_netmask($partial) || {};
my %ip_index;
foreach my $iid (keys %$ip_mask){
foreach my $iid ( keys %$ip_mask ) {
my $mask = $ip_mask->{$iid};
next unless defined $mask;
@@ -444,7 +474,7 @@ sub ip_netmask {
}
# Only 8600 has CPU and Virtual Management IP
if (defined $model and $model =~ /(86)/) {
if ( defined $model and $model =~ /(86)/ ) {
my $cpu_ip = $passport->rc_cpu_ip($partial) || {};
my $cpu_mask = $passport->rc_cpu_mask($partial) || {};
@@ -452,7 +482,7 @@ sub ip_netmask {
my $virt_mask = $passport->rc_virt_mask($partial) || {};
# Get CPU Ethernet IP
foreach my $iid (keys %$cpu_mask){
foreach my $iid ( keys %$cpu_mask ) {
my $c_ip = $cpu_ip->{$iid};
next unless defined $c_ip;
my $c_mask = $cpu_mask->{$iid};
@@ -462,7 +492,8 @@ sub ip_netmask {
}
# Get Virtual Mgmt IP
$ip_index{$virt_ip} = $virt_mask if (defined $virt_mask and defined $virt_ip);
$ip_index{$virt_ip} = $virt_mask
if ( defined $virt_mask and defined $virt_ip );
}
return \%ip_index;
@@ -479,11 +510,14 @@ sub root_ip {
my $sonmp_topo_ip = $passport->sonmp_topo_ip();
# Only 8600 and 1600 have CLIP or Management Virtual IP
if (defined $model and $model =~ /(86|16)/) {
if ( defined $model and $model =~ /(86|16)/ ) {
# Return CLIP (CircuitLess IP)
foreach my $iid (keys %$rc_ip_type){
foreach my $iid ( keys %$rc_ip_type ) {
my $ip_type = $rc_ip_type->{$iid};
next unless ((defined $ip_type) and ($ip_type =~ /circuitLess/i));
next
unless ( ( defined $ip_type )
and ( $ip_type =~ /circuitLess/i ) );
my $ip = $rc_ip_addr->{$iid};
next unless defined $ip;
@@ -491,14 +525,14 @@ sub root_ip {
}
# Return Management Virtual IP address
if ( (defined $virt_ip) and ($virt_ip ne '0.0.0.0') ) {
if ( ( defined $virt_ip ) and ( $virt_ip ne '0.0.0.0' ) ) {
return $virt_ip if $passport->snmp_connect_ip($virt_ip);
}
}
# Return OSPF Router ID
if ((defined $router_ip) and ($router_ip ne '0.0.0.0')) {
foreach my $iid (keys %$rc_ip_addr){
if ( ( defined $router_ip ) and ( $router_ip ne '0.0.0.0' ) ) {
foreach my $iid ( keys %$rc_ip_addr ) {
my $ip = $rc_ip_addr->{$iid};
next unless $router_ip eq $ip;
return $router_ip if $passport->snmp_connect_ip($router_ip);
@@ -506,11 +540,14 @@ sub root_ip {
}
# Otherwise Return SONMP Advertised IP Address
foreach my $entry (keys %$sonmp_topo_port){
foreach my $entry ( keys %$sonmp_topo_port ) {
my $port = $sonmp_topo_port->{$entry};
next unless $port == 0;
my $ip = $sonmp_topo_ip->{$entry};
return $ip if ( (defined $ip) and ($ip ne '0.0.0.0') and ($passport->snmp_connect_ip($ip)) );
return $ip
if (( defined $ip )
and ( $ip ne '0.0.0.0' )
and ( $passport->snmp_connect_ip($ip) ) );
}
return;
}
@@ -520,8 +557,10 @@ sub index_factor {
my $passport = shift;
my $model = $passport->model();
my $index_factor = 64;
# Older Accelar models use base 16 instead of 64
$index_factor = 16 if (defined $model and $model =~ /(105|11[05]0|12[05])/);
$index_factor = 16
if ( defined $model and $model =~ /(105|11[05]0|12[05])/ );
return $index_factor;
}
@@ -541,7 +580,7 @@ sub bp_index {
my $if_index = $passport->i_index($partial) || {};
my %bp_index;
foreach my $iid (keys %$if_index){
foreach my $iid ( keys %$if_index ) {
$bp_index{$iid} = $iid;
}
return \%bp_index;
@@ -564,47 +603,50 @@ sub e_index {
$rc_e_index{1} = 1;
# Power supplies are common, handle them first
foreach my $idx (keys %$rc_ps_t){
next unless $idx;
# We should never have 90 slots, they will also
# sort numerically at the bottom
my $index = $idx + 90 ."0000";
$rc_e_index{$index} = $index;
}
# Older Accelars use RAPID-CITY::rcCardTable
if (defined $model and $model =~ /(105|11[05]0|12[05])/) {
my $rc_c_t = $passport->rc_c_type() || {};
foreach my $idx (keys %$rc_c_t){
foreach my $idx ( keys %$rc_ps_t ) {
next unless $idx;
my $index = "$idx"."0000";
# We should never have 90 slots, they will also
# sort numerically at the bottom
my $index = $idx + 90 . "0000";
$rc_e_index{$index} = $index;
}
# Older Accelars use RAPID-CITY::rcCardTable
if ( defined $model and $model =~ /(105|11[05]0|12[05])/ ) {
my $rc_c_t = $passport->rc_c_type() || {};
foreach my $idx ( keys %$rc_c_t ) {
next unless $idx;
my $index = "$idx" . "0000";
$rc_e_index{$index} = $index;
$index++;
$rc_e_index{$index} = $index;
}
}
# All newer models use RAPID-CITY::rc2kCardTable
else {
my $rc2_c_t = $passport->rc2k_c_ftype() || {};
my $rc2_m_t = $passport->rc2k_mda_type() || {};
foreach my $idx (keys %$rc2_c_t){
foreach my $idx ( keys %$rc2_c_t ) {
next unless $idx;
my $index = "$idx"."0000";
for ( 0 .. 2) {
my $index = "$idx" . "0000";
for ( 0 .. 2 ) {
$rc_e_index{$index} = $index;
$index ++;
$index++;
}
}
foreach my $idx (keys %$rc2_m_t){
foreach my $idx ( keys %$rc2_m_t ) {
next unless $idx;
next if $idx == 0;
my ($slot, $mda) = split /\./,$idx;
$mda = sprintf ("%02d", $mda);
my ( $slot, $mda ) = split /\./, $idx;
$mda = sprintf( "%02d", $mda );
my $index = "$idx"."$mda"."00";
my $index = "$idx" . "$mda" . "00";
$rc_e_index{$index} = $index;
$index++;
$rc_e_index{$index} = $index;
@@ -619,14 +661,14 @@ sub e_class {
my $rc_e_idx = $passport->e_index() || {};
my %rc_e_class;
foreach my $iid (keys %$rc_e_idx){
if ($iid == 1) {
foreach my $iid ( keys %$rc_e_idx ) {
if ( $iid == 1 ) {
$rc_e_class{$iid} = 'chassis';
}
elsif ($iid =~/^9(\d)/ and length $iid > 5) {
elsif ( $iid =~ /^9(\d)/ and length $iid > 5 ) {
$rc_e_class{$iid} = 'powerSupply';
}
elsif ($iid =~/0000$/) {
elsif ( $iid =~ /0000$/ ) {
$rc_e_class{$iid} = 'container';
}
else {
@@ -650,53 +692,55 @@ sub e_descr {
$rc_e_descr{1} = $rc_ch;
# Power supplies are common, handle them first
foreach my $idx (keys %$rc_ps){
foreach my $idx ( keys %$rc_ps ) {
next unless $idx;
my $ps = $rc_ps->{$idx};
next unless $ps;
my $index = $idx + 90 . "0000";
$rc_e_descr{$index} = $ps;
}
# Older Accelars use RAPID-CITY::rcCardTable
if (defined $model and $model =~ /(105|11[05]0|12[05])/) {
if ( defined $model and $model =~ /(105|11[05]0|12[05])/ ) {
my $rc_c_t = $passport->rc_c_type() || {};
foreach my $idx (keys %$rc_c_t){
foreach my $idx ( keys %$rc_c_t ) {
next unless $idx;
my $type = $rc_c_t->{$idx};
next unless $type;
my $index = "$idx"."0000";
$rc_e_descr{$index} = "Slot "."$idx";
my $index = "$idx" . "0000";
$rc_e_descr{$index} = "Slot " . "$idx";
$index++;
$rc_e_descr{$index} = $type;
}
}
# All newer models use RAPID-CITY::rc2kCardTable
else {
my $rc2_cf = $passport->rc2k_c_fdesc() || {};
my $rc2_cb = $passport->rc2k_c_bdesc() || {};
my $rc2_m = $passport->rc2k_mda_desc() || {};
foreach my $idx (keys %$rc2_cf){
foreach my $idx ( keys %$rc2_cf ) {
next unless $idx;
my $cf = $rc2_cf->{$idx};
next unless $idx;
my $cb = $rc2_cb->{$idx};
my $index = "$idx"."0000";
$rc_e_descr{$index} = "Slot "."$idx";
my $index = "$idx" . "0000";
$rc_e_descr{$index} = "Slot " . "$idx";
$index++;
$rc_e_descr{$index} = $cf;
$index++;
$rc_e_descr{$index} = $cb;
}
foreach my $idx (keys %$rc2_m){
foreach my $idx ( keys %$rc2_m ) {
next unless $idx;
my $cm = $rc2_m->{$idx};
next unless $cm;
my ($slot, $mda) = split /\./,$idx;
$mda = sprintf ("%02d", $mda);
my ( $slot, $mda ) = split /\./, $idx;
$mda = sprintf( "%02d", $mda );
my $index = "$idx"."$mda"."00";
my $index = "$idx" . "$mda" . "00";
$rc_e_descr{$index} = $cm;
}
}
@@ -716,53 +760,55 @@ sub e_type {
$rc_e_type{1} = $rc_ch;
# Power supplies are common, handle them first
foreach my $idx (keys %$rc_ps){
foreach my $idx ( keys %$rc_ps ) {
next unless $idx;
my $ps = $rc_ps->{$idx};
next unless $ps;
my $index = $idx + 90 . "0000";
$rc_e_type{$index} = $ps;
}
# Older Accelars use RAPID-CITY::rcCardTable
if (defined $model and $model =~ /(105|11[05]0|12[05])/) {
if ( defined $model and $model =~ /(105|11[05]0|12[05])/ ) {
my $rc_c_t = $passport->rc_c_type() || {};
foreach my $idx (keys %$rc_c_t){
foreach my $idx ( keys %$rc_c_t ) {
next unless $idx;
my $type = $rc_c_t->{$idx};
next unless $type;
my $index = "$idx"."0000";
my $index = "$idx" . "0000";
$rc_e_type{$index} = "zeroDotZero";
$index++;
$rc_e_type{$index} = $type;
}
}
# All newer models use RAPID-CITY::rc2kCardTable
else {
my $rc2_cf = $passport->rc2k_c_ftype() || {};
my $rc2_cb = $passport->rc2k_c_btype() || {};
my $rc2_m = $passport->rc2k_mda_type() || {};
foreach my $idx (keys %$rc2_cf){
foreach my $idx ( keys %$rc2_cf ) {
next unless $idx;
my $cf = $rc2_cf->{$idx};
next unless $idx;
my $cb = $rc2_cb->{$idx};
my $index = "$idx"."0000";
my $index = "$idx" . "0000";
$rc_e_type{$index} = "zeroDotZero";
$index++;
$rc_e_type{$index} = $cf;
$index++;
$rc_e_type{$index} = $cb;
}
foreach my $idx (keys %$rc2_m){
foreach my $idx ( keys %$rc2_m ) {
next unless $idx;
my $cm = $rc2_m->{$idx};
next unless $cm;
my ($slot, $mda) = split /\./,$idx;
$mda = sprintf ("%02d", $mda);
my ( $slot, $mda ) = split /\./, $idx;
$mda = sprintf( "%02d", $mda );
my $index = "$idx"."$mda"."00";
my $index = "$idx" . "$mda" . "00";
$rc_e_type{$index} = $cm;
}
}
@@ -776,32 +822,35 @@ sub e_name {
my $rc_e_idx = $passport->e_index() || {};
my %rc_e_name;
foreach my $iid (keys %$rc_e_idx){
foreach my $iid ( keys %$rc_e_idx ) {
if ($iid == 1) {
if ( $iid == 1 ) {
$rc_e_name{$iid} = 'Chassis';
next;
}
my $mod = int (substr($iid, -4, 2));
my $slot = substr($iid, -6, 2);
my $mod = int( substr( $iid, -4, 2 ) );
my $slot = substr( $iid, -6, 2 );
if ($iid =~/^9(\d)/ and length $iid > 5) {
if ( $iid =~ /^9(\d)/ and length $iid > 5 ) {
$rc_e_name{$iid} = "Power Supply $1";
}
elsif ($iid =~/(00){2}$/) {
elsif ( $iid =~ /(00){2}$/ ) {
$rc_e_name{$iid} = "Slot $slot";
}
elsif ($iid =~/(00){1}$/) {
elsif ( $iid =~ /(00){1}$/ ) {
$rc_e_name{$iid} = "Card $slot, MDA $mod";
}
elsif (defined $model and $model =~ /(105|11[05]0|12[05])/ and $iid =~ /1$/) {
elsif ( defined $model
and $model =~ /(105|11[05]0|12[05])/
and $iid =~ /1$/ )
{
$rc_e_name{$iid} = "Card $slot";
}
elsif ($iid =~ /1$/) {
elsif ( $iid =~ /1$/ ) {
$rc_e_name{$iid} = "Card $slot (front)";
}
elsif ($iid =~ /2$/) {
elsif ( $iid =~ /2$/ ) {
$rc_e_name{$iid} = "Card $slot (back)";
}
}
@@ -820,49 +869,51 @@ sub e_hwver {
$rc_e_hwver{1} = $passport->rc_ch_rev();
# Power supplies are common, handle them first
foreach my $idx (keys %$rc_ps){
foreach my $idx ( keys %$rc_ps ) {
next unless $idx;
my $ps = $rc_ps->{$idx};
next unless $ps;
my $index = $idx + 90 . "0000";
$rc_e_hwver{$index} = $ps;
}
# Older Accelars use RAPID-CITY::rcCardTable
if (defined $model and $model =~ /(105|11[05]0|12[05])/) {
if ( defined $model and $model =~ /(105|11[05]0|12[05])/ ) {
my $rc_c_t = $passport->rc_c_rev() || {};
foreach my $idx (keys %$rc_c_t){
foreach my $idx ( keys %$rc_c_t ) {
next unless $idx;
my $type = $rc_c_t->{$idx};
next unless $type;
my $index = "$idx"."0001";
my $index = "$idx" . "0001";
$rc_e_hwver{$index} = $type;
}
}
# All newer models use RAPID-CITY::rc2kCardTable
else {
my $rc2_cf = $passport->rc2k_c_frev() || {};
my $rc2_cb = $passport->rc2k_c_brev() || {};
my $rc2_m = $passport->rc2k_mda_rev() || {};
foreach my $idx (keys %$rc2_cf){
foreach my $idx ( keys %$rc2_cf ) {
next unless $idx;
my $cf = $rc2_cf->{$idx};
next unless $idx;
my $cb = $rc2_cb->{$idx};
my $index = "$idx"."0001";
my $index = "$idx" . "0001";
$rc_e_hwver{$index} = $cf;
$index++;
$rc_e_hwver{$index} = $cb;
}
foreach my $idx (keys %$rc2_m){
foreach my $idx ( keys %$rc2_m ) {
next unless $idx;
my $cm = $rc2_m->{$idx};
next unless $cm;
my ($slot, $mda) = split /\./,$idx;
$mda = sprintf ("%02d", $mda);
my ( $slot, $mda ) = split /\./, $idx;
$mda = sprintf( "%02d", $mda );
my $index = "$idx"."$mda"."00";
my $index = "$idx" . "$mda" . "00";
$rc_e_hwver{$index} = $cm;
}
}
@@ -875,7 +926,7 @@ sub e_vendor {
my $rc_e_idx = $passport->e_index() || {};
my %rc_e_vendor;
foreach my $iid (keys %$rc_e_idx){
foreach my $iid ( keys %$rc_e_idx ) {
$rc_e_vendor{$iid} = 'nortel';
}
return \%rc_e_vendor;
@@ -893,49 +944,51 @@ sub e_serial {
$rc_e_serial{1} = $passport->rc_serial();
# Power supplies are common, handle them first
foreach my $idx (keys %$rc_ps){
foreach my $idx ( keys %$rc_ps ) {
next unless $idx;
my $ps = $rc_ps->{$idx};
next unless $ps;
my $index = $idx + 90 . "0000";
$rc_e_serial{$index} = $ps;
}
# Older Accelars use RAPID-CITY::rcCardTable
if (defined $model and $model =~ /(105|11[05]0|12[05])/) {
if ( defined $model and $model =~ /(105|11[05]0|12[05])/ ) {
my $rc_c_t = $passport->rc_c_serial() || {};
foreach my $idx (keys %$rc_c_t){
foreach my $idx ( keys %$rc_c_t ) {
next unless $idx;
my $type = $rc_c_t->{$idx};
next unless $type;
my $index = "$idx"."0001";
my $index = "$idx" . "0001";
$rc_e_serial{$index} = $type;
}
}
# All newer models use RAPID-CITY::rc2kCardTable
else {
my $rc2_cf = $passport->rc2k_c_fserial() || {};
my $rc2_cb = $passport->rc2k_c_bserial() || {};
my $rc2_m = $passport->rc2k_mda_serial() || {};
foreach my $idx (keys %$rc2_cf){
foreach my $idx ( keys %$rc2_cf ) {
next unless $idx;
my $cf = $rc2_cf->{$idx};
next unless $idx;
my $cb = $rc2_cb->{$idx};
my $index = "$idx"."0001";
my $index = "$idx" . "0001";
$rc_e_serial{$index} = $cf;
$index++;
$rc_e_serial{$index} = $cb;
}
foreach my $idx (keys %$rc2_m){
foreach my $idx ( keys %$rc2_m ) {
next unless $idx;
my $cm = $rc2_m->{$idx};
next unless $cm;
my ($slot, $mda) = split /\./,$idx;
$mda = sprintf ("%02d", $mda);
my ( $slot, $mda ) = split /\./, $idx;
$mda = sprintf( "%02d", $mda );
my $index = "$idx"."$mda"."00";
my $index = "$idx" . "$mda" . "00";
$rc_e_serial{$index} = $cm;
}
}
@@ -948,19 +1001,19 @@ sub e_pos {
my $rc_e_idx = $passport->e_index() || {};
my %rc_e_pos;
foreach my $iid (keys %$rc_e_idx){
foreach my $iid ( keys %$rc_e_idx ) {
next unless $iid;
if ($iid == 1) {
if ( $iid == 1 ) {
$rc_e_pos{$iid} = -1;
next;
}
my $sub = int (substr($iid, -2, 2));
my $mod = int (substr($iid, -4, 2));
my $slot = substr($iid, -6, 2);
if ($iid =~/(00){2}$/) {
my $sub = int( substr( $iid, -2, 2 ) );
my $mod = int( substr( $iid, -4, 2 ) );
my $slot = substr( $iid, -6, 2 );
if ( $iid =~ /(00){2}$/ ) {
$rc_e_pos{$iid} = $slot;
}
elsif ($iid =~/(00){1}$/) {
elsif ( $iid =~ /(00){1}$/ ) {
$rc_e_pos{$iid} = $mod * 100;
}
else {
@@ -976,18 +1029,18 @@ sub e_parent {
my $rc_e_idx = $passport->e_index() || {};
my %rc_e_parent;
foreach my $iid (keys %$rc_e_idx){
foreach my $iid ( keys %$rc_e_idx ) {
next unless $iid;
if ($iid == 1) {
if ( $iid == 1 ) {
$rc_e_parent{$iid} = 0;
next;
}
my $slot = substr($iid, -6, 2);
if ($iid =~/(00){1,2}$/) {
my $slot = substr( $iid, -6, 2 );
if ( $iid =~ /(00){1,2}$/ ) {
$rc_e_parent{$iid} = 1;
}
else {
$rc_e_parent{$iid} = "$slot"."0000";
$rc_e_parent{$iid} = "$slot" . "0000";
}
}
return \%rc_e_parent;
@@ -1148,13 +1201,14 @@ Slot and port numbers on the Passport switches are determined by the formula:
port = (C<ifIndex % index_factor>) + port_offset,
slot = int(C<ifIndex / index_factor>).
The physical port name is returned as slot.port. CPU Ethernet ports are prefixed
with CPU and VLAN interfaces are returned as the VLAN ID prefixed with Vlan.
The physical port name is returned as slot.port. CPU Ethernet ports are
prefixed with CPU and VLAN interfaces are returned as the VLAN ID prefixed
with Vlan.
=item $passport->i_mac()
MAC address of the interface. Note this is just the MAC of the port, not anything
connected to it.
MAC address of the interface. Note this is just the MAC of the port, not
anything connected to it.
=item $passport->i_description()
@@ -1163,8 +1217,8 @@ human and machine friendly. Not always.
=item $passport->i_name()
Crosses rc_alias() (C<rcPortName>) with ifAlias() and returns the human set port
name if exists.
Crosses rc_alias() (C<rcPortName>) with ifAlias() and returns the human set
port name if exists.
=item $passport->ip_index()

View File

@@ -37,27 +37,21 @@ use SNMP::Info::Layer3;
@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',
);
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
);
%FUNCS = ( %SNMP::Info::Layer3::FUNCS, );
%MUNGE = (
%SNMP::Info::Layer3::MUNGE,
);
%MUNGE = ( %SNMP::Info::Layer3::MUNGE, );
sub vendor {
return 'sun';
@@ -72,18 +66,19 @@ sub os_ver {
my $descr = $sun->motd();
return unless defined $descr;
if ($descr =~ m/SunOS (\S+)/) {
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());
my $serial = unpack( "H*", $sun->sun_hostid() );
return $serial;
}
@@ -94,9 +89,10 @@ sub i_ignore {
my $interfaces = $l3->interfaces($partial) || {};
my %i_ignore;
foreach my $if (keys %$interfaces) {
foreach my $if ( keys %$interfaces ) {
# lo0
if ($interfaces->{$if} =~ /\blo0\b/i){
if ( $interfaces->{$if} =~ /\blo0\b/i ) {
$i_ignore{$if}++;
}
}

View File

@@ -43,12 +43,12 @@ use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/;
$VERSION = '1.09';
%MIBS = ('MAU-MIB' => 'mauMod');
%MIBS = ( 'MAU-MIB' => 'mauMod' );
%GLOBALS = (
);
%GLOBALS = ();
%FUNCS = (
# Interface MAU Table
'mau_index' => 'ifMauIfIndex',
'mau_link' => 'ifMauType',
@@ -56,47 +56,49 @@ $VERSION = '1.09';
'mau_up' => 'ifMauMediaAvailable',
'mau_type' => 'ifMauTypeList',
'mau_type_admin' => 'ifMauDefaultType',
# Interface Auto-Negotiation Table
'mau_auto' => 'ifMauAutoNegSupported',
'mau_autostat' => 'ifMauAutoNegAdminStatus',
'mau_autosent' => 'ifMauAutoNegCapAdvertised',
'mau_autorec' => 'ifMauAutoNegCapReceived',
);
);
%MUNGE = (
# Inherit all the built in munging
%SNMP::Info::MUNGE,
# Add ones for our class
'mau_type' => \&munge_int2bin,
'mau_autosent' => \&munge_int2bin,
'mau_autorec' => \&munge_int2bin,
);
);
sub munge_int2bin {
my $int = shift;
return unless defined $int;
return unpack("B32", pack("N", $int));
return unpack( "B32", pack( "N", $int ) );
}
sub _isfullduplex{
sub _isfullduplex {
my $mau = shift;
my $mautype = shift;
my @full_types = qw/11 13 16 18 20/;
foreach my $type ( @full_types ) {
return 1 if (substr($mautype,32-$type,1) eq '1')
foreach my $type (@full_types) {
return 1 if ( substr( $mautype, 32 - $type, 1 ) eq '1' );
}
return 0;
}
sub _ishalfduplex{
sub _ishalfduplex {
my $mau = shift;
my $mautype = shift;
my @half_types = qw/10 12 15 17 19/;
foreach my $type ( @half_types ) {
return 1 if (substr($mautype,32-$type,1) eq '1')
foreach my $type (@half_types) {
return 1 if ( substr( $mautype, 32 - $type, 1 ) eq '1' );
}
return 0;
}
@@ -115,7 +117,7 @@ sub mau_i_speed_admin {
my $mau_type_admin = $mau->mau_type_admin();
my %i_speed_admin;
foreach my $mau_port (keys %$mau_type_admin){
foreach my $mau_port ( keys %$mau_type_admin ) {
my $iid = $mau_index->{$mau_port};
next unless defined $iid;
@@ -123,9 +125,12 @@ sub mau_i_speed_admin {
my $type_admin = &SNMP::translateObj($type_adminoid);
next unless defined $type_admin;
if ($type_adminoid eq '.0.0') {
if ( $type_adminoid eq '.0.0' ) {
$i_speed_admin{$iid} = 'auto';
} elsif ($type_admin =~ /^dot3MauType(.*)Base/ && $_mau_i_speed_map{$1}) {
}
elsif ($type_admin =~ /^dot3MauType(.*)Base/
&& $_mau_i_speed_map{$1} )
{
$i_speed_admin{$iid} = $_mau_i_speed_map{$1};
}
}
@@ -139,7 +144,7 @@ sub mau_i_duplex {
my $mau_link = $mau->mau_link();
my %i_duplex;
foreach my $mau_port (keys %$mau_link){
foreach my $mau_port ( keys %$mau_link ) {
my $iid = $mau_index->{$mau_port};
next unless defined $iid;
@@ -149,9 +154,10 @@ sub mau_i_duplex {
my $duplex = undef;
if ($link =~ /fd$/i) {
if ( $link =~ /fd$/i ) {
$duplex = 'full';
} elsif ($link =~ /hd$/i){
}
elsif ( $link =~ /hd$/i ) {
$duplex = 'half';
}
@@ -166,26 +172,33 @@ sub mau_i_duplex_admin {
my $mau_index = $mau->mau_index();
my %rev_mau_index = reverse %$mau_index;
my $mau_autostat = defined $partial ? $mau->mau_autostat($rev_mau_index{$partial}) : $mau->mau_autostat();
my $mau_type_admin = defined $partial ? $mau->mau_type_admin($rev_mau_index{$partial}) : $mau->mau_type_admin();
my $mau_autostat
= defined $partial
? $mau->mau_autostat( $rev_mau_index{$partial} )
: $mau->mau_autostat();
my $mau_type_admin
= defined $partial
? $mau->mau_type_admin( $rev_mau_index{$partial} )
: $mau->mau_type_admin();
# Older HP4000's don't implement ifMauDefaultType, but we can
# figure out from ifMauAutoNegCapAdvertised what we'd like.
if (!defined($mau_type_admin)) {
if (defined($mau_index)) {
return mau_i_duplex_admin_old($mau,$mau_index,$mau_autostat);
} else {
if ( !defined($mau_type_admin) ) {
if ( defined($mau_index) ) {
return mau_i_duplex_admin_old( $mau, $mau_index, $mau_autostat );
}
else {
return;
}
}
my %i_duplex_admin;
foreach my $mau_port (keys %$mau_type_admin){
foreach my $mau_port ( keys %$mau_type_admin ) {
my $iid = $mau_index->{$mau_port};
next unless defined $iid;
my $autostat = $mau_autostat->{$mau_port};
if (defined $autostat and $autostat =~ /enabled/i){
if ( defined $autostat and $autostat =~ /enabled/i ) {
$i_duplex_admin{$iid} = 'auto';
next;
}
@@ -196,11 +209,13 @@ sub mau_i_duplex_admin {
my $duplex = undef;
if ($type_admin =~ /fd$/i) {
if ( $type_admin =~ /fd$/i ) {
$duplex = 'full';
} elsif ($type_admin =~ /hd$/i){
}
elsif ( $type_admin =~ /hd$/i ) {
$duplex = 'half';
} elsif ($type_admin eq 'zeroDotZero') {
}
elsif ( $type_admin eq 'zeroDotZero' ) {
$duplex = 'auto';
}
@@ -220,14 +235,14 @@ sub mau_i_duplex_admin_old {
my %mau_reverse = reverse %$mau_index;
my %i_duplex_admin;
foreach my $iid (keys %$interfaces){
foreach my $iid ( keys %$interfaces ) {
my $mau_index = $mau_reverse{$iid};
next unless defined $mau_index;
my $autostat = $mau_autostat->{$mau_index};
# HP25xx has this value
if (defined $autostat and $autostat =~ /enabled/i){
if ( defined $autostat and $autostat =~ /enabled/i ) {
$i_duplex_admin{$iid} = 'auto';
next;
}
@@ -236,7 +251,7 @@ sub mau_i_duplex_admin_old {
next unless defined $type;
if ($type == 0) {
if ( $type == 0 ) {
$i_duplex_admin{$iid} = 'none';
next;
}
@@ -244,9 +259,10 @@ sub mau_i_duplex_admin_old {
my $full = $mau->_isfullduplex($type);
my $half = $mau->_ishalfduplex($type);
if ($full and !$half){
if ( $full and !$half ) {
$i_duplex_admin{$iid} = 'full';
} elsif ($half) {
}
elsif ($half) {
$i_duplex_admin{$iid} = 'half';
}
}
@@ -289,8 +305,8 @@ devices like HP Switches. MAU = Media Access Unit.
The MAU table contains link and duplex info for the port itself and the device
connected to that port.
Normally you use or create a subclass of SNMP::Info that inherits this one. Do
not use directly.
Normally you use or create a subclass of SNMP::Info that inherits this one.
Do not use directly.
For debugging purposes call the class directly as you would SNMP::Info
@@ -450,13 +466,13 @@ capabilities of the device on the other end.
=item $mau->_isfullduplex(bitstring)
Boolean. Checks to see if any of the full_duplex types from mau_type() are
high. Currently bits 11,13,16,18,20.
Boolean. Checks to see if any of the full_duplex types from mau_type()
are high. Currently bits 11,13,16,18,20.
=item $mau->_ishalfduplex(bitstring)
Boolean. Checks to see if any of the half_duplex types from mau_type() are
high. Currently bits 10,12,15,17,19.
Boolean. Checks to see if any of the half_duplex types from mau_type()
are high. Currently bits 10,12,15,17,19.
=back

View File

@@ -42,13 +42,15 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
# S5-ROOT-MIB and S5-TCS-MIB required by the MIBs below
'S5-AGENT-MIB' => 's5AgMyGrpIndx',
'S5-CHASSIS-MIB' => 's5ChasType',
'S5-REG-MIB' => 's5ChasTypeVal',
);
);
%GLOBALS = (
# From S5-AGENT-MIB
'ns_ag_ver' => 's5AgInfoVer',
'ns_op_mode' => 's5AgSysCurrentOperationalMode',
@@ -58,19 +60,23 @@ $VERSION = '1.09';
'tftp_action' => 's5AgInfoFileAction',
'tftp_result' => 's5AgInfoFileStatus',
'vlan' => 's5AgSysManagementVlanId',
# From S5-CHASSIS-MIB
'ns_serial' => 's5ChasSerNum',
'ns_ch_type' => 's5ChasType',
'ns_cfg_chg' => 's5ChasGblConfChngs',
'ns_cfg_time' => 's5ChasGblConfLstChng',
);
);
%FUNCS = (
# From S5-AGENT-MIB::s5AgMyIfTable
'i_cfg_file' => 's5AgMyIfCfgFname',
'i_cfg_host' => 's5AgMyIfLdSvrAddr',
# From S5-CHASSIS-MIB::s5ChasGrpTable
'ns_grp_type' => 's5ChasGrpType',
# From S5-CHASSIS-MIB::s5ChasComTable
'ns_com_grp_idx' => 's5ChasComGrpIndx',
'ns_com_idx' => 's5ChasComIndx',
@@ -79,6 +85,7 @@ $VERSION = '1.09';
'ns_com_descr' => 's5ChasComDescr',
'ns_com_ver' => 's5ChasComVer',
'ns_com_serial' => 's5ChasComSerNum',
# From S5-CHASSIS-MIB::s5ChasStoreTable
'ns_store_grp_idx' => 's5ChasStoreGrpIndx',
'ns_store_com_idx' => 's5ChasStoreComIndx',
@@ -87,14 +94,14 @@ $VERSION = '1.09';
'ns_store_type' => 's5ChasStoreType',
'ns_store_size' => 's5ChasStoreCurSize',
'ns_store_ver' => 's5ChasStoreCntntVer',
);
);
%MUNGE = (
'ns_ch_type' => \&SNMP::Info::munge_e_type,
'ns_grp_type' => \&munge_ns_grp_type,
'ns_com_type' => \&SNMP::Info::munge_e_type,
'ns_store_type' => \&SNMP::Info::munge_e_type,
);
);
sub os_ver {
my $stack = shift;
@@ -102,10 +109,10 @@ sub os_ver {
my $ver = $stack->ns_ag_ver();
return unless defined $ver;
if ($ver =~ m/(\d+\.\d+\.\d+\.\d+)/){
if ( $ver =~ m/(\d+\.\d+\.\d+\.\d+)/ ) {
return $1;
}
if ($ver =~ m/V(\d+\.\d+\.\d+)/i){
if ( $ver =~ m/V(\d+\.\d+\.\d+)/i ) {
return $1;
}
return;
@@ -117,10 +124,10 @@ sub os_bin {
my $ver = $stack->ns_ag_ver();
return unless defined $ver;
if ($ver =~ m/(\d+\.\d+\.\d+\.\d+)/i){
if ( $ver =~ m/(\d+\.\d+\.\d+\.\d+)/i ) {
return $1;
}
if ($ver =~ m/V(\d+\.\d+.\d+)/i){
if ( $ver =~ m/V(\d+\.\d+.\d+)/i ) {
return $1;
}
return;
@@ -143,8 +150,8 @@ sub serial {
sub _ns_e_is_virtual {
my $stack = shift;
# We really only need one value, but we want this cached since most methods
# call it at least via ns_e_index()
# We really only need one value, but we want this cached since most
# methods call it at least via ns_e_index()
my $v_test = $stack->s5ChasComRelPos() || {};
return $v_test->{'8.1.0'};
}
@@ -155,10 +162,10 @@ sub _ns_e_is_stack {
my $s_test = $stack->ns_e_class() || {};
foreach my $iid (keys %$s_test){
foreach my $iid ( keys %$s_test ) {
my $class = $s_test->{$iid};
next unless defined $class;
return 1 if ($class eq 'stack');
return 1 if ( $class eq 'stack' );
}
return 0;
}
@@ -171,13 +178,15 @@ sub ns_e_index {
my $is_virtual = $stack->_ns_e_is_virtual();
my %ns_e_index;
foreach my $iid (keys %$ns_e_idx){
foreach my $iid ( keys %$ns_e_idx ) {
# Skip backplane, power, sensor, fan, clock - these aren't in the
# newer devices ENTITY-MIB we're emulating
next if ($iid =~ /^[24567]/);
next if (($is_virtual) and ($iid =~ /^8/ or $iid eq '1.0.0'));
next if ( $iid =~ /^[24567]/ );
next if ( ($is_virtual) and ( $iid =~ /^8/ or $iid eq '1.0.0' ) );
# Format into consistent integer format so that numeric sorting works
my $index = join('',map { sprintf "%02d",$_ } split /\./, $iid);
my $index = join( '', map { sprintf "%02d", $_ } split /\./, $iid );
$ns_e_index{$iid} = $index;
}
return \%ns_e_index;
@@ -193,18 +202,18 @@ sub ns_e_class {
my $is_virtual = $stack->_ns_e_is_virtual();
my %ns_e_class;
foreach my $iid (keys %$ns_e_idx){
my ($grp, $idx, $sub) = split (/\./,$iid);
foreach my $iid ( keys %$ns_e_idx ) {
my ( $grp, $idx, $sub ) = split( /\./, $iid );
next unless defined $grp;
my $class = $classes->{$grp};
next unless defined $class;
my $enc = $ns_grp_enc->{$grp};
# Handle quirks of dealing with both stacks and chassis
if ((!$is_virtual) and ($grp == 1)) {
if ( ( !$is_virtual ) and ( $grp == 1 ) ) {
$class = 'module';
}
if (($is_virtual) and ($grp == 3) and !($idx % $enc)) {
if ( ($is_virtual) and ( $grp == 3 ) and !( $idx % $enc ) ) {
$class = 'chassis';
}
@@ -221,7 +230,7 @@ sub ns_e_descr {
my $ns_e_descr = $stack->ns_com_descr($partial) || {};
my %ns_e_descr;
foreach my $iid (keys %$ns_e_idx){
foreach my $iid ( keys %$ns_e_idx ) {
my $descr = $ns_e_descr->{$iid};
next unless defined $descr;
@@ -240,20 +249,20 @@ sub ns_e_name {
my $is_virtual = $stack->_ns_e_is_virtual();
my %ns_e_name;
foreach my $iid (keys %$ns_e_idx){
foreach my $iid ( keys %$ns_e_idx ) {
my ($grp, $idx, $sub) = split (/\./,$iid);
my ( $grp, $idx, $sub ) = split( /\./, $iid );
my $class = $ns_class->{$iid};
next unless defined $class;
my $enc = $ns_grp_enc->{$grp};
if ((!$is_virtual) and ($grp == 1)) {
if ( ( !$is_virtual ) and ( $grp == 1 ) ) {
$ns_e_name{$iid} = 'Supervisory Module';
}
elsif ($class eq 'stack') {
elsif ( $class eq 'stack' ) {
$ns_e_name{$iid} = 'Stack Master Unit';
}
elsif ($class eq 'chassis') {
elsif ( $class eq 'chassis' ) {
if ($is_virtual) {
my $unit = $idx / $enc;
$ns_e_name{$iid} = "Switch Unit $unit";
@@ -262,13 +271,13 @@ sub ns_e_name {
$ns_e_name{$iid} = "Chassis";
}
}
elsif ($class eq 'module') {
elsif ( $class eq 'module' ) {
if ($is_virtual) {
my $unit = int ($idx / $enc);
my $unit = int( $idx / $enc );
my $mda = $idx % $enc;
$ns_e_name{$iid} = "Switch Unit $unit, MDA $mda";
}
elsif ($sub != 0) {
elsif ( $sub != 0 ) {
$ns_e_name{$iid} = "Module Slot $idx, Subcomponent $sub";
}
else {
@@ -287,7 +296,7 @@ sub ns_e_hwver {
my $ns_e_ver = $stack->ns_com_ver($partial) || {};
my %ns_e_hwver;
foreach my $iid (keys %$ns_e_idx){
foreach my $iid ( keys %$ns_e_idx ) {
my $ver = $ns_e_ver->{$iid};
next unless defined $ver;
@@ -303,7 +312,7 @@ sub ns_e_vendor {
my $ns_e_idx = $stack->ns_e_index($partial) || {};
my %ns_e_vendor;
foreach my $iid (keys %$ns_e_idx){
foreach my $iid ( keys %$ns_e_idx ) {
my $vendor = 'nortel';
$ns_e_vendor{$iid} = $vendor;
@@ -319,7 +328,7 @@ sub ns_e_serial {
my $ns_e_serial = $stack->ns_com_serial($partial) || {};
my %ns_e_serial;
foreach my $iid (keys %$ns_e_idx){
foreach my $iid ( keys %$ns_e_idx ) {
my $serial = $ns_e_serial->{$iid};
next unless defined $serial;
@@ -338,11 +347,11 @@ sub ns_e_type {
my $ch_type = $stack->ns_ch_type();
my %ns_e_type;
foreach my $iid (keys %$ns_e_idx){
foreach my $iid ( keys %$ns_e_idx ) {
my $type = $ns_e_type->{$iid};
next unless defined $type;
if ($is_stack and $iid =~ /^1/) {
if ( $is_stack and $iid =~ /^1/ ) {
$type = $ch_type;
}
$ns_e_type{$iid} = $type;
@@ -360,12 +369,12 @@ sub ns_e_pos {
my $is_virtual = $stack->_ns_e_is_virtual();
my %ns_e_pos;
foreach my $iid (keys %$ns_e_idx){
my ($grp, $pos, $idx) = split (/\./,$iid);
foreach my $iid ( keys %$ns_e_idx ) {
my ( $grp, $pos, $idx ) = split( /\./, $iid );
next unless defined $grp;
next unless defined $pos;
if ($grp == 1) {
if ( $grp == 1 ) {
if ($is_stack) {
$pos = -1;
}
@@ -373,22 +382,22 @@ sub ns_e_pos {
$pos = 99;
}
}
elsif ($grp == 3 and $idx == 0 ) {
elsif ( $grp == 3 and $idx == 0 ) {
my $enc = $ns_grp_enc->{$grp};
if ($is_virtual and ($pos % $enc)) {
$pos = int ($pos % $enc);
if ( $is_virtual and ( $pos % $enc ) ) {
$pos = int( $pos % $enc );
}
elsif ($is_virtual and !$is_stack and !($pos % $enc)) {
elsif ( $is_virtual and !$is_stack and !( $pos % $enc ) ) {
$pos = -1;
}
elsif ($is_virtual and !($pos % $enc)) {
$pos = ($pos / $enc);
elsif ( $is_virtual and !( $pos % $enc ) ) {
$pos = ( $pos / $enc );
}
}
elsif (!$is_stack and $grp == 3) {
elsif ( !$is_stack and $grp == 3 ) {
$pos = $idx;
}
elsif ($grp == 8) {
elsif ( $grp == 8 ) {
$pos = -1;
}
$ns_e_pos{$iid} = $pos;
@@ -407,7 +416,7 @@ sub ns_e_fwver {
my $is_virt = $stack->_ns_e_is_virtual();
my %ns_e_fwver;
foreach my $iid (keys %$ns_e_type){
foreach my $iid ( keys %$ns_e_type ) {
my $type = $ns_e_type->{$iid};
next unless defined $type;
next unless $type =~ /(rom|boot|fw)/i;
@@ -416,7 +425,7 @@ sub ns_e_fwver {
$iid =~ s/\.\d+$//;
if ($is_virt) {
my ($grp, $idx, $pos) = split (/\./,$iid);
my ( $grp, $idx, $pos ) = split( /\./, $iid );
my $enc = $ns_grp_enc->{$grp};
$idx = $idx * $enc;
$iid = "3.$idx.$pos";
@@ -437,7 +446,7 @@ sub ns_e_swver {
my $is_virt = $stack->_ns_e_is_virtual();
my %ns_e_swver;
foreach my $iid (keys %$ns_e_type){
foreach my $iid ( keys %$ns_e_type ) {
my $type = $ns_e_type->{$iid};
next unless defined $type;
next unless $type =~ /(flash)/i;
@@ -446,7 +455,7 @@ sub ns_e_swver {
$iid =~ s/\.\d+$//;
if ($is_virt) {
my ($grp, $idx, $pos) = split (/\./,$iid);
my ( $grp, $idx, $pos ) = split( /\./, $iid );
my $enc = $ns_grp_enc->{$grp};
$idx = $idx * $enc;
$iid = "3.$idx.$pos";
@@ -466,14 +475,14 @@ sub ns_e_parent {
my $is_virtual = $stack->_ns_e_is_virtual();
my %ns_e_parent;
foreach my $iid (keys %$ns_e_idx){
foreach my $iid ( keys %$ns_e_idx ) {
my $index = $ns_e_idx->{$iid};
my ($grp, $idx, $pos) = split (/\./,$iid);
my ( $grp, $idx, $pos ) = split( /\./, $iid );
next unless defined $grp;
if ($grp == 8) {
if ( $grp == 8 ) {
$ns_e_parent{$iid} = '0';
}
if ($grp == 1) {
if ( $grp == 1 ) {
if ($is_stack) {
$ns_e_parent{$iid} = '0';
}
@@ -481,27 +490,28 @@ sub ns_e_parent {
$ns_e_parent{$iid} = '080100';
}
}
if ($grp == 3) {
if ( $grp == 3 ) {
my $enc = $ns_grp_enc->{$grp};
if ($idx % $enc) {
my $npos = ($idx % $enc) * $enc;
my @parent = ($grp, $npos, $pos);
my $parent = join('',map { sprintf "%02d",$_ } @parent);
if ( $idx % $enc ) {
my $npos = ( $idx % $enc ) * $enc;
my @parent = ( $grp, $npos, $pos );
my $parent = join( '', map { sprintf "%02d", $_ } @parent );
$ns_e_parent{$iid} = $parent;
}
elsif ($is_stack) {
$ns_e_parent{$iid} = '010100';
}
elsif ($is_virtual and !$is_stack) {
elsif ( $is_virtual and !$is_stack ) {
$ns_e_parent{$iid} = 0;
}
elsif ($pos == 0) {
elsif ( $pos == 0 ) {
$ns_e_parent{$iid} = '080100';
}
else {
my $parent = $iid;
$parent =~ s/\.\d+$/\.00/;
$parent = join('',map { sprintf "%02d",$_ } split /\./, $parent);
$parent = join( '', map { sprintf "%02d", $_ } split /\./,
$parent );
$ns_e_parent{$iid} = $parent;
}
}
@@ -526,7 +536,7 @@ sub munge_ns_grp_type {
my $name = &SNMP::translateObj($oid);
$name =~ s/s5ChasGrp//;
if ((defined($name)) and (exists($e_class{$name}))) {
if ( ( defined($name) ) and ( exists( $e_class{$name} ) ) ) {
$name = $e_class{$name};
}
return $name if defined($name);
@@ -712,8 +722,8 @@ server
=item $stack->ns_com_grp_idx()
Returns reference to hash. Key: Table entry, Value: Index of the chassis level
group which contains this component.
Returns reference to hash. Key: Table entry, Value: Index of the chassis
level group which contains this component.
(C<s5ChasComGrpIndx>)

View File

@@ -41,25 +41,25 @@ use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/;
$VERSION = '1.09';
%MIBS = ('POWER-ETHERNET-MIB' => 'pethPsePortDetectionStatus');
%MIBS = ( 'POWER-ETHERNET-MIB' => 'pethPsePortDetectionStatus' );
%GLOBALS = (
);
%GLOBALS = ();
%FUNCS = (
# parts of pethPsePortTable
'peth_port_admin' => 'pethPsePortAdminEnable',
'peth_port_status' => 'pethPsePortDetectionStatus',
'peth_port_class' => 'pethPsePortPowerClassifications',
# pethMainPseTable
'peth_power_watts' => 'pethMainPsePower',
'peth_power_status' => 'pethMainPseOperStatus',
'peth_power_consumption' => 'pethMainPseConsumptionPower',
'peth_power_threshold' => 'pethMainPseUsageThreshold',
);
);
%MUNGE = (
);
%MUNGE = ();
# POWER-ETHERNET-MIB doesn't define a mapping of its
# "module"/"port" index to ifIndex. Different vendors
@@ -75,9 +75,10 @@ sub peth_port_ifindex {
my $peth_port_status = $peth->peth_port_status($partial);
my $peth_port_ifindex;
foreach my $i (keys %$peth_port_status) {
my ($module, $port) = split(/\./, $i);
if ($module != 1) {
foreach my $i ( keys %$peth_port_status ) {
my ( $module, $port ) = split( /\./, $i );
if ( $module != 1 ) {
# This heuristic won't work, so say that we got nothing.
# If you have this case, you have to write a device-specific
# version of this function.
@@ -122,7 +123,8 @@ F<POWER-ETHERNET-MIB> is used to describe PoE (IEEE 802.3af)
Create or use a device subclass that inherit this class. Do not use directly.
For debugging purposes you can call this class directly as you would SNMP::Info
For debugging purposes you can call this class directly as you would
SNMP::Info
my $poe = new SNMP::Info::PowerEthernet (...);

View File

@@ -41,9 +41,7 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
'RAPID-CITY' => 'rapidCity',
);
%MIBS = ( 'RAPID-CITY' => 'rapidCity', );
%GLOBALS = (
'rc_serial' => 'rcChasSerialNumber',
@@ -57,9 +55,10 @@ $VERSION = '1.09';
'rc_base_mac' => 'rc2kChassisBaseMacAddr',
'rc_virt_ip' => 'rcSysVirtualIpAddr',
'rc_virt_mask' => 'rcSysVirtualNetMask',
);
);
%FUNCS = (
# From RAPID-CITY::rcPortTable
'rc_index' => 'rcPortIndex',
'rc_duplex' => 'rcPortOperDuplex',
@@ -67,6 +66,7 @@ $VERSION = '1.09';
'rc_speed_admin' => 'rcPortAdminSpeed',
'rc_auto' => 'rcPortAutoNegotiate',
'rc_alias' => 'rcPortName',
# From RAPID-CITY::rc2kCpuEthernetPortTable
'rc_cpu_ifindex' => 'rc2kCpuEthernetPortIfIndex',
'rc_cpu_admin' => 'rc2kCpuEthernetPortAdminStatus',
@@ -79,6 +79,7 @@ $VERSION = '1.09';
'rc_cpu_speed_admin' => 'rc2kCpuEthernetPortAdminSpeed',
'rc_cpu_speed_oper' => 'rc2kCpuEthernetPortOperSpeed',
'rc_cpu_mac' => 'rc2kCpuEthernetPortMgmtMacAddr',
# From RAPID-CITY::rcVlanPortTable
'rc_i_vlan_if' => 'rcVlanPortIndex',
'rc_i_vlan_num' => 'rcVlanPortNumVlanIds',
@@ -86,6 +87,7 @@ $VERSION = '1.09';
'rc_i_vlan_type' => 'rcVlanPortType',
'rc_i_vlan_pvid' => 'rcVlanPortDefaultVlanId',
'rc_i_vlan_tag' => 'rcVlanPortPerformTagging',
# From RAPID-CITY::rcVlanTable
'rc_vlan_id' => 'rcVlanId',
'v_name' => 'rcVlanName',
@@ -97,25 +99,31 @@ $VERSION = '1.09';
'rc_vlan_no_join' => 'rcVlanNotAllowToJoin',
'rc_vlan_mac' => 'rcVlanMacAddress',
'rc_vlan_rstatus' => 'rcVlanRowStatus',
# From RAPID-CITY::rcIpAddrTable
'rc_ip_index' => 'rcIpAdEntIfIndex',
'rc_ip_addr' => 'rcIpAdEntAddr',
'rc_ip_type' => 'rcIpAdEntIfType',
# From RAPID-CITY::rcChasFanTable
'rc_fan_op' => 'rcChasFanOperStatus',
# From RAPID-CITY::rcChasPowerSupplyTable
'rc_ps_op' => 'rcChasPowerSupplyOperStatus',
# From RAPID-CITY::rcChasPowerSupplyDetailTable
'rc_ps_type' => 'rcChasPowerSupplyDetailType',
'rc_ps_serial' => 'rcChasPowerSupplyDetailSerialNumber',
'rc_ps_rev' => 'rcChasPowerSupplyDetailHardwareRevision',
'rc_ps_part' => 'rcChasPowerSupplyDetailPartNumber',
'rc_ps_detail' => 'rcChasPowerSupplyDetailDescription',
# From RAPID-CITY::rcCardTable
'rc_c_type' => 'rcCardType',
'rc_c_serial' => 'rcCardSerialNumber',
'rc_c_rev' => 'rcCardHardwareRevision',
'rc_c_part' => 'rcCardPartNumber',
# From RAPID-CITY::rc2kCardTable
'rc2k_c_ftype' => 'rc2kCardFrontType',
'rc2k_c_fdesc' => 'rc2kCardFrontDescription',
@@ -131,6 +139,7 @@ $VERSION = '1.09';
'rc2k_c_bpart' => 'rc2kCardBackPartNumber',
'rc2k_c_bdate' => 'rc2kCardBackDateCode',
'rc2k_c_bdev' => 'rc2kCardBackDeviations',
# From RAPID-CITY::rc2kMdaCardTable
'rc2k_mda_type' => 'rc2kMdaCardType',
'rc2k_mda_desc' => 'rc2kMdaCardDescription',
@@ -139,7 +148,7 @@ $VERSION = '1.09';
'rc2k_mda_part' => 'rc2kMdaCardPartNumber',
'rc2k_mda_date' => 'rc2kMdaCardDateCode',
'rc2k_mda_dev' => 'rc2kMdaCardDeviations',
);
);
%MUNGE = (
'rc_base_mac' => \&SNMP::Info::munge_mac,
@@ -147,7 +156,7 @@ $VERSION = '1.09';
'rc_cpu_mac' => \&SNMP::Info::munge_mac,
'rc_vlan_members' => \&SNMP::Info::munge_port_list,
'rc_vlan_no_join' => \&SNMP::Info::munge_port_list,
);
);
# Need to override here since overridden in Layer2 and Layer3 classes
sub serial {
@@ -167,17 +176,17 @@ sub i_duplex {
my $rc_cpu_duplex = $rapidcity->rc_cpu_duplex($partial) || {};
my %i_duplex;
foreach my $if (keys %$rc_duplex){
foreach my $if ( keys %$rc_duplex ) {
my $duplex = $rc_duplex->{$if};
next unless defined $duplex;
$duplex = 'half' if $duplex =~ /half/i;
$duplex = 'full' if $duplex =~ /full/i;
$i_duplex{$if}=$duplex;
$i_duplex{$if} = $duplex;
}
# Get CPU Ethernet Interfaces for 8600 Series
foreach my $iid (keys %$rc_cpu_duplex){
foreach my $iid ( keys %$rc_cpu_duplex ) {
my $c_duplex = $rc_cpu_duplex->{$iid};
next unless defined $c_duplex;
@@ -197,28 +206,28 @@ sub i_duplex_admin {
my $rc_cpu_duplex_admin = $rapidcity->rc_cpu_duplex_admin($partial) || {};
my %i_duplex_admin;
foreach my $if (keys %$rc_duplex_admin){
foreach my $if ( keys %$rc_duplex_admin ) {
my $duplex = $rc_duplex_admin->{$if};
next unless defined $duplex;
my $auto = $rc_auto->{$if}||'false';
my $auto = $rc_auto->{$if} || 'false';
my $string = 'other';
$string = 'half' if ($duplex =~ /half/i and $auto =~ /false/i);
$string = 'full' if ($duplex =~ /full/i and $auto =~ /false/i);
$string = 'half' if ( $duplex =~ /half/i and $auto =~ /false/i );
$string = 'full' if ( $duplex =~ /full/i and $auto =~ /false/i );
$string = 'auto' if $auto =~ /true/i;
$i_duplex_admin{$if}=$string;
$i_duplex_admin{$if} = $string;
}
# Get CPU Ethernet Interfaces for 8600 Series
foreach my $iid (keys %$rc_cpu_duplex_admin){
foreach my $iid ( keys %$rc_cpu_duplex_admin ) {
my $c_duplex = $rc_cpu_duplex_admin->{$iid};
next unless defined $c_duplex;
my $c_auto = $rc_cpu_auto->{$iid};
my $string = 'other';
$string = 'half' if ($c_duplex =~ /half/i and $c_auto =~ /false/i);
$string = 'full' if ($c_duplex =~ /full/i and $c_auto =~ /false/i);
$string = 'half' if ( $c_duplex =~ /half/i and $c_auto =~ /false/i );
$string = 'full' if ( $c_duplex =~ /full/i and $c_auto =~ /false/i );
$string = 'auto' if $c_auto =~ /true/i;
$i_duplex_admin{$iid} = $string;
@@ -229,47 +238,47 @@ sub i_duplex_admin {
sub set_i_duplex_admin {
my $rapidcity = shift;
my ($duplex, $iid) = @_;
my ( $duplex, $iid ) = @_;
$duplex = lc($duplex);
return unless ($duplex =~ /(half|full|auto)/ and $iid =~ /\d+/);
return unless ( $duplex =~ /(half|full|auto)/ and $iid =~ /\d+/ );
# map a textual duplex to an integer one the switch understands
my %duplexes = qw/full 2 half 1/;
my $i_auto = $rapidcity->rc_auto($iid);
if ($duplex eq "auto") {
return $rapidcity->set_rc_auto('1', $iid);
if ( $duplex eq "auto" ) {
return $rapidcity->set_rc_auto( '1', $iid );
}
elsif (($duplex ne "auto") and ($i_auto->{$iid} eq "1")) {
return unless ($rapidcity->set_rc_auto('2', $iid));
return $rapidcity->set_rc_duplex_admin($duplexes{$duplex}, $iid);
elsif ( ( $duplex ne "auto" ) and ( $i_auto->{$iid} eq "1" ) ) {
return unless ( $rapidcity->set_rc_auto( '2', $iid ) );
return $rapidcity->set_rc_duplex_admin( $duplexes{$duplex}, $iid );
}
else {
return $rapidcity->set_rc_duplex_admin($duplexes{$duplex}, $iid);
return $rapidcity->set_rc_duplex_admin( $duplexes{$duplex}, $iid );
}
return;
}
sub set_i_speed_admin {
my $rapidcity = shift;
my ($speed, $iid) = @_;
my ( $speed, $iid ) = @_;
return unless ($speed =~ /(10|100|1000|auto)/i and $iid =~ /\d+/);
return unless ( $speed =~ /(10|100|1000|auto)/i and $iid =~ /\d+/ );
# map a textual duplex to an integer one the switch understands
my %speeds = qw/10 1 100 2 1000 3/;
my $i_auto = $rapidcity->rc_auto($iid);
if ($speed eq "auto") {
return $rapidcity->set_rc_auto('1', $iid);
if ( $speed eq "auto" ) {
return $rapidcity->set_rc_auto( '1', $iid );
}
elsif (($speed ne "auto") and ($i_auto->{$iid} eq "1")) {
return unless ($rapidcity->set_rc_auto('2', $iid));
return $rapidcity->set_rc_speed_admin($speeds{$speed}, $iid);
elsif ( ( $speed ne "auto" ) and ( $i_auto->{$iid} eq "1" ) ) {
return unless ( $rapidcity->set_rc_auto( '2', $iid ) );
return $rapidcity->set_rc_speed_admin( $speeds{$speed}, $iid );
}
else {
return $rapidcity->set_rc_speed_admin($speeds{$speed}, $iid);
return $rapidcity->set_rc_speed_admin( $speeds{$speed}, $iid );
}
return;
}
@@ -296,18 +305,18 @@ sub i_vlan_membership {
my $rc_v_ports = $rapidcity->rc_vlan_members();
my $i_vlan_membership = {};
foreach my $vlan (keys %$rc_v_ports) {
foreach my $vlan ( keys %$rc_v_ports ) {
my $portlist = $rc_v_ports->{$vlan};
my $ret = [];
# Convert portlist bit array to ifIndex array
for (my $i = 0; $i <= scalar(@$portlist); $i++) {
push(@{$ret}, $i) if (@$portlist[$i]);
for ( my $i = 0; $i <= scalar(@$portlist); $i++ ) {
push( @{$ret}, $i ) 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,12 +324,13 @@ sub i_vlan_membership {
sub set_i_pvid {
my $rapidcity = shift;
my ($vlan_id, $ifindex) = @_;
my ( $vlan_id, $ifindex ) = @_;
return unless ( $rapidcity->_validate_vlan_param ($vlan_id, $ifindex) );
return unless ( $rapidcity->_validate_vlan_param( $vlan_id, $ifindex ) );
unless ( $rapidcity->set_rc_i_vlan_pvid($vlan_id, $ifindex) ) {
$rapidcity->error_throw("Unable to change PVID to $vlan_id on IfIndex: $ifindex");
unless ( $rapidcity->set_rc_i_vlan_pvid( $vlan_id, $ifindex ) ) {
$rapidcity->error_throw(
"Unable to change PVID to $vlan_id on IfIndex: $ifindex");
return;
}
return 1;
@@ -328,9 +338,10 @@ sub set_i_pvid {
sub set_i_vlan {
my $rapidcity = shift;
my ($new_vlan_id, $ifindex) = @_;
my ( $new_vlan_id, $ifindex ) = @_;
return unless ( $rapidcity->_validate_vlan_param ($new_vlan_id, $ifindex) );
return
unless ( $rapidcity->_validate_vlan_param( $new_vlan_id, $ifindex ) );
my $vlan_p_type = $rapidcity->rc_i_vlan_type($ifindex);
unless ( $vlan_p_type->{$ifindex} =~ /access/ ) {
@@ -342,9 +353,12 @@ sub set_i_vlan {
# Store current untagged VLAN to remove it from the port list later
my $old_vlan_id = $i_pvid->{$ifindex};
# Check that haven't been given the same VLAN we are currently using
if ($old_vlan_id eq $new_vlan_id) {
$rapidcity->error_throw("Current PVID: $old_vlan_id and New VLAN: $new_vlan_id the same, no change.");
if ( $old_vlan_id eq $new_vlan_id ) {
$rapidcity->error_throw(
"Current PVID: $old_vlan_id and New VLAN: $new_vlan_id the same, no change."
);
return;
}
@@ -353,32 +367,38 @@ sub set_i_vlan {
# Check if port in forbidden list for the VLAN, haven't seen this used,
# but we'll check anyway
return unless
($rapidcity->_check_forbidden_ports($new_vlan_id, $ifindex));
return
unless (
$rapidcity->_check_forbidden_ports( $new_vlan_id, $ifindex ) );
my $old_vlan_members = $rapidcity->rc_vlan_members($old_vlan_id);
my $new_vlan_members = $rapidcity->rc_vlan_members($new_vlan_id);
print "Modifying egress list for VLAN: $new_vlan_id \n" if $rapidcity->debug();
my $new_egress = $rapidcity->modify_port_list($new_vlan_members->{$new_vlan_id},$ifindex,'1');
print "Modifying egress list for VLAN: $new_vlan_id \n"
if $rapidcity->debug();
my $new_egress
= $rapidcity->modify_port_list( $new_vlan_members->{$new_vlan_id},
$ifindex, '1' );
print "Modifying egress list for VLAN: $old_vlan_id \n" if $rapidcity->debug();
my $old_egress = $rapidcity->modify_port_list($old_vlan_members->{$old_vlan_id},$ifindex,'0');
print "Modifying egress list for VLAN: $old_vlan_id \n"
if $rapidcity->debug();
my $old_egress
= $rapidcity->modify_port_list( $old_vlan_members->{$old_vlan_id},
$ifindex, '0' );
my $vlan_set = [
['rc_vlan_members',"$new_vlan_id","$new_egress"],
# ['rc_vlan_members',"$old_vlan_id","$old_egress"],
[ 'rc_vlan_members', "$new_vlan_id", "$new_egress" ],
# ['rc_vlan_members',"$old_vlan_id","$old_egress"],
];
return unless
($rapidcity->set_multi($vlan_set));
return
unless ( $rapidcity->set_multi($vlan_set) );
my $vlan_set2 = [
['rc_vlan_members',"$old_vlan_id","$old_egress"],
];
my $vlan_set2 = [ [ 'rc_vlan_members', "$old_vlan_id", "$old_egress" ], ];
return unless
($rapidcity->set_multi($vlan_set2));
return
unless ( $rapidcity->set_multi($vlan_set2) );
# Set new untagged / native VLAN
# Some models/versions do this for us also, so check to see if we need to set
@@ -386,74 +406,93 @@ sub set_i_vlan {
my $cur_i_pvid = $i_pvid->{$ifindex};
print "Current PVID: $cur_i_pvid\n" if $rapidcity->debug();
unless ($cur_i_pvid eq $new_vlan_id) {
return unless ($rapidcity->set_i_pvid($new_vlan_id, $ifindex));
unless ( $cur_i_pvid eq $new_vlan_id ) {
return unless ( $rapidcity->set_i_pvid( $new_vlan_id, $ifindex ) );
}
print "Successfully changed VLAN: $old_vlan_id to $new_vlan_id on IfIndex: $ifindex\n" if $rapidcity->debug();
print
"Successfully changed VLAN: $old_vlan_id to $new_vlan_id on IfIndex: $ifindex\n"
if $rapidcity->debug();
return 1;
}
sub set_add_i_vlan_tagged {
my $rapidcity = shift;
my ($vlan_id, $ifindex) = @_;
my ( $vlan_id, $ifindex ) = @_;
return unless ( $rapidcity->_validate_vlan_param ($vlan_id, $ifindex) );
return unless ( $rapidcity->_validate_vlan_param( $vlan_id, $ifindex ) );
print "Adding VLAN: $vlan_id to IfIndex: $ifindex\n" if $rapidcity->debug();
print "Adding VLAN: $vlan_id to IfIndex: $ifindex\n"
if $rapidcity->debug();
# Check if port in forbidden list for the VLAN, haven't seen this used, but we'll check anyway
return unless ($rapidcity->_check_forbidden_ports($vlan_id, $ifindex));
# Check if port in forbidden list for the VLAN, haven't seen this used, but we'll check anyway
return
unless ( $rapidcity->_check_forbidden_ports( $vlan_id, $ifindex ) );
my $iv_members = $rapidcity->rc_vlan_members($vlan_id);
print "Modifying egress list for VLAN: $vlan_id \n" if $rapidcity->debug();
my $new_egress = $rapidcity->modify_port_list($iv_members->{$vlan_id},$ifindex,'1');
print "Modifying egress list for VLAN: $vlan_id \n"
if $rapidcity->debug();
my $new_egress
= $rapidcity->modify_port_list( $iv_members->{$vlan_id}, $ifindex,
'1' );
unless ( $rapidcity->set_qb_v_egress($new_egress, $vlan_id) ) {
print "Error: Unable to add VLAN: $vlan_id to Index: $ifindex egress list.\n" if $rapidcity->debug();
unless ( $rapidcity->set_qb_v_egress( $new_egress, $vlan_id ) ) {
print
"Error: Unable to add VLAN: $vlan_id to Index: $ifindex egress list.\n"
if $rapidcity->debug();
return;
}
print "Successfully added IfIndex: $ifindex to VLAN: $vlan_id egress list\n" if $rapidcity->debug();
print
"Successfully added IfIndex: $ifindex to VLAN: $vlan_id egress list\n"
if $rapidcity->debug();
return 1;
}
sub set_remove_i_vlan_tagged {
my $rapidcity = shift;
my ($vlan_id, $ifindex) = @_;
my ( $vlan_id, $ifindex ) = @_;
return unless ( $rapidcity->_validate_vlan_param ($vlan_id, $ifindex) );
return unless ( $rapidcity->_validate_vlan_param( $vlan_id, $ifindex ) );
print "Removing VLAN: $vlan_id from IfIndex: $ifindex\n" if $rapidcity->debug();
print "Removing VLAN: $vlan_id from IfIndex: $ifindex\n"
if $rapidcity->debug();
my $iv_members = $rapidcity->rc_vlan_members($vlan_id);
print "Modifying egress list for VLAN: $vlan_id \n" if $rapidcity->debug();
my $new_egress = $rapidcity->modify_port_list($iv_members->{$vlan_id},$ifindex,'0');
print "Modifying egress list for VLAN: $vlan_id \n"
if $rapidcity->debug();
my $new_egress
= $rapidcity->modify_port_list( $iv_members->{$vlan_id}, $ifindex,
'0' );
unless ( $rapidcity->set_qb_v_egress($new_egress, $vlan_id) ) {
print "Error: Unable to add VLAN: $vlan_id to Index: $ifindex egress list.\n" if $rapidcity->debug();
unless ( $rapidcity->set_qb_v_egress( $new_egress, $vlan_id ) ) {
print
"Error: Unable to add VLAN: $vlan_id to Index: $ifindex egress list.\n"
if $rapidcity->debug();
return;
}
print "Successfully removed IfIndex: $ifindex from VLAN: $vlan_id egress list\n" if $rapidcity->debug();
print
"Successfully removed IfIndex: $ifindex from VLAN: $vlan_id egress list\n"
if $rapidcity->debug();
return 1;
}
sub set_create_vlan {
my $rapidcity = shift;
my ($name, $vlan_id) = @_;
return unless ($vlan_id =~ /\d+/);
my ( $name, $vlan_id ) = @_;
return unless ( $vlan_id =~ /\d+/ );
my $vlan_set = [
['v_name',"$vlan_id","$name"],
['rc_vlan_rstatus',"$vlan_id",4],
[ 'v_name', "$vlan_id", "$name" ],
[ 'rc_vlan_rstatus', "$vlan_id", 4 ],
];
unless ($rapidcity->set_multi($vlan_set)){
print "Error: Unable to create VLAN: $vlan_id\n" if $rapidcity->debug();
unless ( $rapidcity->set_multi($vlan_set) ) {
print "Error: Unable to create VLAN: $vlan_id\n"
if $rapidcity->debug();
return;
}
@@ -463,9 +502,9 @@ sub set_create_vlan {
sub set_delete_vlan {
my $rapidcity = shift;
my ($vlan_id) = shift;
return unless ($vlan_id =~ /^\d+$/);
return unless ( $vlan_id =~ /^\d+$/ );
unless ( $rapidcity->set_rc_vlan_rstatus('6', $vlan_id) ) {
unless ( $rapidcity->set_rc_vlan_rstatus( '6', $vlan_id ) ) {
$rapidcity->error_throw("Unable to delete VLAN: $vlan_id");
return;
}
@@ -477,14 +516,19 @@ sub set_delete_vlan {
#
sub _check_forbidden_ports {
my $rapidcity = shift;
my ($vlan_id, $ifindex) = @_;
my ( $vlan_id, $ifindex ) = @_;
my $iv_forbidden = $rapidcity->rc_vlan_no_join($vlan_id);
my @forbidden_ports = split(//, unpack("B*", $iv_forbidden->{$vlan_id}));
my @forbidden_ports
= split( //, unpack( "B*", $iv_forbidden->{$vlan_id} ) );
print "Forbidden ports: @forbidden_ports\n" if $rapidcity->debug();
if ( defined($forbidden_ports[$ifindex]) and ($forbidden_ports[$ifindex] eq "1")) {
$rapidcity->error_throw("IfIndex: $ifindex in forbidden list for VLAN: $vlan_id unable to add");
if ( defined( $forbidden_ports[$ifindex] )
and ( $forbidden_ports[$ifindex] eq "1" ) )
{
$rapidcity->error_throw(
"IfIndex: $ifindex in forbidden list for VLAN: $vlan_id unable to add"
);
return;
}
return 1;
@@ -492,10 +536,14 @@ sub _check_forbidden_ports {
sub _validate_vlan_param {
my $rapidcity = shift;
my ($vlan_id, $ifindex) = @_;
my ( $vlan_id, $ifindex ) = @_;
# VID and ifIndex should both be numeric
unless ( defined $vlan_id and defined $ifindex and $vlan_id =~ /^\d+$/ and $ifindex =~ /^\d+$/ ) {
unless (defined $vlan_id
and defined $ifindex
and $vlan_id =~ /^\d+$/
and $ifindex =~ /^\d+$/ )
{
$rapidcity->error_throw("Invalid parameter");
return;
}
@@ -510,7 +558,8 @@ sub _validate_vlan_param {
#Check that VLAN exists on device
unless ( $rapidcity->rc_vlan_id($vlan_id) ) {
$rapidcity->error_throw("VLAN $vlan_id does not exist or is not operational");
$rapidcity->error_throw(
"VLAN $vlan_id does not exist or is not operational");
return;
}
@@ -1002,16 +1051,17 @@ Returns VLAN IDs
=head1 SET METHODS
These are methods that provide SNMP set functionality for overridden methods or
provide a simpler interface to complex set operations. See
L<SNMP::Info/"SETTING DATA VIA SNMP"> for general information on set operations.
These are methods that provide SNMP set functionality for overridden methods
or provide a simpler interface to complex set operations. See
L<SNMP::Info/"SETTING DATA VIA SNMP"> for general information on set
operations.
=over
=item $rapidcity->set_i_speed_admin(speed, ifIndex)
Sets port speed, must be supplied with speed and port C<ifIndex>. Speed choices
are 'auto', '10', '100', '1000'.
Sets port speed, must be supplied with speed and port C<ifIndex>. Speed
choices are 'auto', '10', '100', '1000'.
Example:
my %if_map = reverse %{$rapidcity->interfaces()};
@@ -1031,9 +1081,9 @@ choices are 'auto', 'half', 'full'.
=item $rapidcity->set_i_vlan(vlan, ifIndex)
Changes an access (untagged) port VLAN, must be supplied with the numeric
VLAN ID and port C<ifIndex>. This method will modify the port's VLAN membership
and PVID (default VLAN). This method should only be used on end station
(non-trunk) ports.
VLAN ID and port C<ifIndex>. This method will modify the port's VLAN
membership and PVID (default VLAN). This method should only be used on end
station (non-trunk) ports.
Example:
my %if_map = reverse %{$rapidcity->interfaces()};
@@ -1053,8 +1103,8 @@ port C<ifIndex>. This method only changes the PVID, to modify an access
=item $rapidcity->set_add_i_vlan_tagged(vlan, ifIndex)
Adds the port to the egress list of the VLAN, must be supplied with the numeric
VLAN ID and port C<ifIndex>.
Adds the port to the egress list of the VLAN, must be supplied with the
numeric VLAN ID and port C<ifIndex>.
Example:
my %if_map = reverse %{$rapidcity->interfaces()};

View File

@@ -44,14 +44,15 @@ $VERSION = '1.09';
%MIBS = (
'SYNOPTICS-ROOT-MIB' => 'synoptics',
'S5-ETH-MULTISEG-TOPOLOGY-MIB' => 's5EnMsTop',
);
);
%GLOBALS = (
'cdp_id' => 's5EnMsTopIpAddr',
'cdp_run' => 's5EnMsTopStatus',
);
);
%FUNCS = (
# From S5-ETH-MULTISEG-TOPOLOGY-MIB::TopNmmTable
'sonmp_topo_slot' => 's5EnMsTopNmmSlot',
'sonmp_topo_port' => 's5EnMsTopNmmPort',
@@ -60,11 +61,9 @@ $VERSION = '1.09';
'sonmp_topo_mac' => 's5EnMsTopNmmMacAddr',
'sonmp_topo_platform' => 's5EnMsTopNmmChassisType',
'sonmp_topo_localseg' => 's5EnMsTopNmmLocalSeg',
);
);
%MUNGE = (
'sonmp_topo_mac' => \&SNMP::Info::munge_mac
);
%MUNGE = ( 'sonmp_topo_mac' => \&SNMP::Info::munge_mac );
sub index_factor {
return 32;
@@ -95,26 +94,29 @@ sub c_if {
my $model = $sonmp->model();
my %c_if;
foreach my $entry (keys %$sonmp_topo_port){
foreach my $entry ( keys %$sonmp_topo_port ) {
my $port = $sonmp_topo_port->{$entry};
next unless defined $port;
next if $port == 0;
my $slot = $sonmp_topo_slot->{$entry} || 0;
if ($model eq 'Baystack Hub') {
if ( $model eq 'Baystack Hub' ) {
my $comidx = $slot;
if (! ($comidx % 5)) {
$slot = ($slot / 5);
} elsif ($comidx =~ /[16]$/) {
$slot = int($slot/5);
if ( !( $comidx % 5 ) ) {
$slot = ( $slot / 5 );
}
elsif ( $comidx =~ /[16]$/ ) {
$slot = int( $slot / 5 );
$port = 25;
} elsif ($comidx =~ /[27]$/) {
$slot = int($slot/5);
}
elsif ( $comidx =~ /[27]$/ ) {
$slot = int( $slot / 5 );
$port = 26;
}
}
my $index = (($slot-$slot_offset)*$index_factor) + ($port-$port_offset);
my $index = ( ( $slot - $slot_offset ) * $index_factor )
+ ( $port - $port_offset );
$c_if{$entry} = $index;
}
@@ -129,7 +131,7 @@ sub c_ip {
my $sonmp_topo_ip = $sonmp->sonmp_topo_ip($partial) || {};
my %c_ip;
foreach my $entry (keys %$sonmp_topo_ip){
foreach my $entry ( keys %$sonmp_topo_ip ) {
my $port = $sonmp_topo_port->{$entry};
next unless defined $port;
next if $port == 0;
@@ -149,25 +151,28 @@ sub c_port {
my $sonmp_topo_platform = $sonmp->sonmp_topo_platform($partial) || {};
my %c_port;
foreach my $entry (keys %$sonmp_topo_seg){
foreach my $entry ( keys %$sonmp_topo_seg ) {
my $port = $sonmp_topo_port->{$entry};
next unless defined $port;
next if $port == 0;
my $seg = $sonmp_topo_seg->{$entry};
my $platform = $sonmp_topo_platform->{$entry};
# AP-222x Series does not adhere to port numbering
if ($platform =~ /AccessPoint/i) {
if ( $platform =~ /AccessPoint/i ) {
$c_port{$entry} = 'dp0';
}
# BayHubs send the lower three bytes of the MAC not the slot/port
elsif ($seg > 4000) {
elsif ( $seg > 4000 ) {
$c_port{$entry} = 'unknown';
}
else {
# Segment id is (256 * remote slot_num) + (remote_port)
my $remote_port = $seg % 256;
my $remote_slot = int($seg / 256);
my $remote_slot = int( $seg / 256 );
$c_port{$entry} = "$remote_slot.$remote_port";
}
@@ -183,7 +188,7 @@ sub c_platform {
my $sonmp_topo_platform = $sonmp->sonmp_topo_platform($partial) || {};
my %c_platform;
foreach my $entry (keys %$sonmp_topo_platform){
foreach my $entry ( keys %$sonmp_topo_platform ) {
my $port = $sonmp_topo_port->{$entry};
next unless defined $port;
next if $port == 0;
@@ -201,12 +206,13 @@ sub mac {
my $sonmp_topo_port = $sonmp->sonmp_topo_port();
my $sonmp_topo_mac = $sonmp->sonmp_topo_mac();
foreach my $entry (keys %$sonmp_topo_port){
foreach my $entry ( keys %$sonmp_topo_port ) {
my $port = $sonmp_topo_port->{$entry};
next unless $port == 0;
my $mac = $sonmp_topo_mac->{$entry};
return $mac;
}
# Topology turned off, not supported.
return;
}
@@ -259,11 +265,13 @@ interface to the SynOptics Network Management Protocol (SONMP) information
through SNMP.
SONMP is a Layer 2 protocol that supplies topology information of devices that
also speak SONMP, mostly switches and hubs. SONMP is implemented in SynOptics,
Bay, and Nortel devices. SONMP has been rebranded by Bay then Nortel and is
know by several different names, most recently Nortel Discovery Protocol (NDP).
also speak SONMP, mostly switches and hubs. SONMP is implemented in
SynOptics, Bay, and Nortel devices. SONMP has been rebranded by Bay then
Nortel and is know by several different names, most recently Nortel
Discovery Protocol (NDP).
Create or use a device subclass that inherits this class. Do not use directly.
Create or use a device subclass that inherits this class. Do not use
directly.
Each device implements a subset of the global and cache entries.
Check the return value to see if that data is held by the device.
@@ -340,7 +348,8 @@ Returns reference to hash. Key: Table entry, Value:slot number
=item $sonmp->sonmp_topo_port()
Returns reference to hash. Key: Table entry, Value:Port Number (interface iid)
Returns reference to hash. Key: Table entry, Value:Port Number
(interface iid)
(C<s5EnMsTopNmmPort>)
@@ -370,8 +379,8 @@ Returns reference to hash. Key: Table entry, Value:Remote Device Type
=item $sonmp->sonmp_topo_localseg
Returns reference to hash. Key: Table entry, Value: Boolean, if bay_topo_seg()
is local.
Returns reference to hash. Key: Table entry, Value: Boolean, if
bay_topo_seg() is local.
(C<s5EnMsTopNmmLocalSeg>)
@@ -391,8 +400,8 @@ Returns reference to hash. Key: IID, Value: Local port (interfaces)
Returns reference to hash. Key: IID, Value: Remote IP address
If multiple entries exist with the same local port, c_if(), with different IPv4
addresses, c_ip(), there is either a non SONMP device in between two or
If multiple entries exist with the same local port, c_if(), with different
IPv4 addresses, c_ip(), there is either a non SONMP 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.