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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -50,46 +50,52 @@ $VERSION = '1.09';
'CISCO-MEMORY-POOL-MIB' => 'ciscoMemoryPoolUsed', 'CISCO-MEMORY-POOL-MIB' => 'ciscoMemoryPoolUsed',
'OLD-CISCO-SYSTEM-MIB' => 'writeMem', 'OLD-CISCO-SYSTEM-MIB' => 'writeMem',
'CISCO-PRODUCTS-MIB' => 'sysName', 'CISCO-PRODUCTS-MIB' => 'sysName',
# some older catalysts live here # some older catalysts live here
'CISCO-STACK-MIB' => 'wsc1900sysID', 'CISCO-STACK-MIB' => 'wsc1900sysID',
'CISCO-ENTITY-VENDORTYPE-OID-MIB' => 'cevChassis', 'CISCO-ENTITY-VENDORTYPE-OID-MIB' => 'cevChassis',
'CISCO-FLASH-MIB' => 'ciscoFlashDeviceSize', 'CISCO-FLASH-MIB' => 'ciscoFlashDeviceSize',
); );
%GLOBALS = ( %GLOBALS = (
'description' => 'sysDescr', 'description' => 'sysDescr',
# We will use the numeric OID's so that we don't require people # We will use the numeric OID's so that we don't require people
# to install v1 MIBs, which can conflict. # to install v1 MIBs, which can conflict.
# OLD-CISCO-CPU-MIB:avgBusyPer # OLD-CISCO-CPU-MIB:avgBusyPer
'ios_cpu' => '1.3.6.1.4.1.9.2.1.56.0', '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_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', 'ios_cpu_5min' => '1.3.6.1.4.1.9.2.1.58.0',
# CISCO-PROCESS-MIB # CISCO-PROCESS-MIB
'cat_cpu' => 'cpmCPUTotal5sec.9', 'cat_cpu' => 'cpmCPUTotal5sec.9',
'cat_cpu_1min' => 'cpmCPUTotal1min.9', 'cat_cpu_1min' => 'cpmCPUTotal1min.9',
'cat_cpu_5min' => 'cpmCPUTotal5min.9', 'cat_cpu_5min' => 'cpmCPUTotal5min.9',
# OLD-CISCO-SYSTEM-MIB # OLD-CISCO-SYSTEM-MIB
'write_mem' => 'writeMem', 'write_mem' => 'writeMem',
); );
%FUNCS = ( %FUNCS = (
# CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolTable # CISCO-MEMORY-POOL-MIB::ciscoMemoryPoolTable
'cisco_mem_free' => 'ciscoMemoryPoolFree', 'cisco_mem_free' => 'ciscoMemoryPoolFree',
'cisco_mem_used' => 'ciscoMemoryPoolUsed', 'cisco_mem_used' => 'ciscoMemoryPoolUsed',
# CISCO-FLASH-MIB::ciscoFlashDeviceTable # CISCO-FLASH-MIB::ciscoFlashDeviceTable
'cisco_flash_size' => 'ciscoFlashDeviceSize', 'cisco_flash_size' => 'ciscoFlashDeviceSize',
); );
%MUNGE = ( %MUNGE = ();
);
sub os { sub os {
my $l2 = shift; my $l2 = shift;
my $descr = $l2->description() || ''; my $descr = $l2->description() || '';
# order here matters - there are Catalysts that run IOS and have catalyst in their description field. # order here matters - there are Catalysts that run IOS and have catalyst
return 'ios' if ($descr =~ /IOS/); # in their description field.
return 'catalyst' if ($descr =~ /catalyst/i); return 'ios' if ( $descr =~ /IOS/ );
return 'catalyst' if ( $descr =~ /catalyst/i );
return; return;
} }
@@ -99,12 +105,18 @@ sub os_ver {
my $descr = $l2->description(); my $descr = $l2->description();
# Older Catalysts # 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; return $1;
} }
# Newer Catalysts and IOS devices # 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 $1;
} }
return; return;
@@ -141,7 +153,7 @@ sub mem_free {
my $cisco_mem_free = $self->cisco_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; $mem_free += $mem_free_val;
} }
@@ -155,7 +167,7 @@ sub mem_used {
my $cisco_mem_used = $self->cisco_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; $mem_used += $mem_used_val;
} }
@@ -170,10 +182,10 @@ sub mem_total {
my $cisco_mem_free = $self->cisco_mem_free() || {}; my $cisco_mem_free = $self->cisco_mem_free() || {};
my $cisco_mem_used = $self->cisco_mem_used() || {}; 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_free = $cisco_mem_free->{$mem_entry} || 0;
my $mem_used = $cisco_mem_used->{$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; return $mem_total;
} }
@@ -185,7 +197,7 @@ sub flashmem_total {
my $flash_sizes = $self->cisco_flash_size; 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}; $flashmem_total += $flash_sizes->{$flash_index};
} }
@@ -197,7 +209,8 @@ __END__
=head1 NAME =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 =head1 AUTHOR
@@ -221,8 +234,8 @@ Max Baker
=head1 DESCRIPTION =head1 DESCRIPTION
SNMP::Info::CiscoStats is a subclass of SNMP::Info that provides cpu, memory, os and SNMP::Info::CiscoStats is a subclass of SNMP::Info that provides cpu, memory,
version information about Cisco Devices. os and version information about Cisco Devices.
Use or create in a subclass of SNMP::Info. Do not use directly. 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-VTP-MIB' => 'vtpVlanName',
'CISCO-VLAN-MEMBERSHIP-MIB' => 'vmMembershipEntry', 'CISCO-VLAN-MEMBERSHIP-MIB' => 'vmMembershipEntry',
'CISCO-VLAN-IFTABLE-RELATIONSHIP-MIB' => 'cviRoutedVlanIfIndex', 'CISCO-VLAN-IFTABLE-RELATIONSHIP-MIB' => 'cviRoutedVlanIfIndex',
); );
%GLOBALS = ( %GLOBALS = (
'vtp_version' => 'vtpVersion', 'vtp_version' => 'vtpVersion',
@@ -56,9 +56,10 @@ $VERSION = '1.09';
'vtp_notify_create' => 'vtpVlanCreatedNotifEnabled', 'vtp_notify_create' => 'vtpVlanCreatedNotifEnabled',
'vtp_notify_delete' => 'vtpVlanDeletedNotifEnabled', 'vtp_notify_delete' => 'vtpVlanDeletedNotifEnabled',
'vtp_trunk_set_serial' => 'vlanTrunkPortSetSerialNo', 'vtp_trunk_set_serial' => 'vlanTrunkPortSetSerialNo',
); );
%FUNCS = ( %FUNCS = (
# CISCO-VTP-MIB::managementDomainTable # CISCO-VTP-MIB::managementDomainTable
'vtp_d_index' => 'managementDomainIndex', 'vtp_d_index' => 'managementDomainIndex',
'vtp_d_name' => 'managementDomainName', 'vtp_d_name' => 'managementDomainName',
@@ -71,6 +72,7 @@ $VERSION = '1.09';
'vtp_d_tftp_path' => 'managementDomainTftpPathname', 'vtp_d_tftp_path' => 'managementDomainTftpPathname',
'vtp_d_pruning' => 'managementDomainPruningState', 'vtp_d_pruning' => 'managementDomainPruningState',
'vtp_d_ver' => 'managementDomainVersionInUse', 'vtp_d_ver' => 'managementDomainVersionInUse',
# CISCO-VTP-MIB::vtpVlanTable # CISCO-VTP-MIB::vtpVlanTable
'v_state' => 'vtpVlanState', 'v_state' => 'vtpVlanState',
'v_type' => 'vtpVlanType', 'v_type' => 'vtpVlanType',
@@ -89,6 +91,7 @@ $VERSION = '1.09';
'v_crf' => 'vtpVlanIsCRFBackup', 'v_crf' => 'vtpVlanIsCRFBackup',
'v_type_ext' => 'vtpVlanTypeExt', 'v_type_ext' => 'vtpVlanTypeExt',
'v_if' => 'vtpVlanIfIndex', 'v_if' => 'vtpVlanIfIndex',
# CISCO-VLAN-MEMBERSHIP-MIB::vmMembershipTable # CISCO-VLAN-MEMBERSHIP-MIB::vmMembershipTable
'i_vlan_type' => 'vmVlanType', 'i_vlan_type' => 'vmVlanType',
'i_vlan2' => 'vmVlan', 'i_vlan2' => 'vmVlan',
@@ -97,10 +100,13 @@ $VERSION = '1.09';
'i_vlan_2' => 'vmVlans2k', 'i_vlan_2' => 'vmVlans2k',
'i_vlan_3' => 'vmVlans3k', 'i_vlan_3' => 'vmVlans3k',
'i_vlan_4' => 'vmVlans4k', 'i_vlan_4' => 'vmVlans4k',
# CISCO-VLAN-MEMBERSHIP-MIB::vmVoiceVlanTable # CISCO-VLAN-MEMBERSHIP-MIB::vmVoiceVlanTable
'i_voice_vlan' => 'vmVoiceVlanId', 'i_voice_vlan' => 'vmVoiceVlanId',
# CISCO-VLAN-IFTABLE-RELATIONSHIP-MIB # CISCO-VLAN-IFTABLE-RELATIONSHIP-MIB
'v_cvi_if' => 'cviRoutedVlanIfIndex', 'v_cvi_if' => 'cviRoutedVlanIfIndex',
# CISCO-VTP-MIB::vlanTrunkPortTable # CISCO-VTP-MIB::vlanTrunkPortTable
'vtp_trunk_mgmt_dom' => 'vlanTrunkPortManagementDomain', 'vtp_trunk_mgmt_dom' => 'vlanTrunkPortManagementDomain',
'vtp_trunk_encaps_t' => 'vlanTrunkPortEncapsulationType', 'vtp_trunk_encaps_t' => 'vlanTrunkPortEncapsulationType',
@@ -115,14 +121,14 @@ $VERSION = '1.09';
'vtp_trunk_dyn_stat' => 'vlanTrunkPortDynamicStatus', 'vtp_trunk_dyn_stat' => 'vlanTrunkPortDynamicStatus',
'vtp_trunk_vtp' => 'vlanTrunkPortVtpEnabled', 'vtp_trunk_vtp' => 'vlanTrunkPortVtpEnabled',
'vtp_trunk_encaps' => 'vlanTrunkPortEncapsulationOperType', 'vtp_trunk_encaps' => 'vlanTrunkPortEncapsulationOperType',
# TODO Add these tables if someone wants them.. # TODO Add these tables if someone wants them..
# vtpEditControlTable # vtpEditControlTable
# vtpVlanEditTable # vtpVlanEditTable
# vtpStatsTable # vtpStatsTable
); );
%MUNGE = ( %MUNGE = ();
);
sub v_index { sub v_index {
my $vtp = shift; my $vtp = shift;
@@ -130,8 +136,8 @@ sub v_index {
my $v_name = $vtp->v_name($partial); my $v_name = $vtp->v_name($partial);
my %v_index; my %v_index;
foreach my $idx (keys %$v_name) { foreach my $idx ( keys %$v_name ) {
my ($mgmtdomain, $vlan) = split(/\./, $idx); my ( $mgmtdomain, $vlan ) = split( /\./, $idx );
$v_index{$idx} = $vlan; $v_index{$idx} = $vlan;
} }
return \%v_index; return \%v_index;
@@ -146,8 +152,9 @@ sub i_vlan {
my $trunk_dyn_stat = $vtp->vtp_trunk_dyn_stat($partial) || {}; my $trunk_dyn_stat = $vtp->vtp_trunk_dyn_stat($partial) || {};
my %i_vlans; my %i_vlans;
# Get access ports # Get access ports
foreach my $port (keys %$i_vlan) { foreach my $port ( keys %$i_vlan ) {
my $vlan = $i_vlan->{$port}; my $vlan = $i_vlan->{$port};
next unless defined $vlan; next unless defined $vlan;
@@ -155,7 +162,7 @@ sub i_vlan {
} }
# Get trunk ports # Get trunk ports
foreach my $port (keys %$port_vlan) { foreach my $port ( keys %$port_vlan ) {
my $vlan = $port_vlan->{$port}; my $vlan = $port_vlan->{$port};
next unless defined $vlan; next unless defined $vlan;
my $stat = $trunk_dyn_stat->{$port}; my $stat = $trunk_dyn_stat->{$port};
@@ -173,8 +180,8 @@ sub i_vlan {
# Translate vlan.physical_interface -> iid # Translate vlan.physical_interface -> iid
# to iid -> vlan # to iid -> vlan
foreach my $i (keys %$v_cvi_if){ foreach my $i ( keys %$v_cvi_if ) {
my ($vlan,$phys) = split(/\./,$i); my ( $vlan, $phys ) = split( /\./, $i );
my $iid = $v_cvi_if->{$i}; my $iid = $v_cvi_if->{$i};
$i_vlans{$iid} = $vlan; $i_vlans{$iid} = $vlan;
@@ -199,32 +206,32 @@ sub i_vlan_membership {
my $i_vlan_membership = {}; my $i_vlan_membership = {};
# Get access ports # Get access ports
foreach my $port (keys %$i_vlan) { foreach my $port ( keys %$i_vlan ) {
my $vlan = $i_vlan->{$port}; my $vlan = $i_vlan->{$port};
next unless defined $vlan; next unless defined $vlan;
my $stat = $trunk_dyn_stat->{$port}; my $stat = $trunk_dyn_stat->{$port};
if ( defined $stat and $stat =~ /notTrunking/ ) { if ( defined $stat and $stat =~ /notTrunking/ ) {
push(@{$i_vlan_membership->{$port}}, $vlan); push( @{ $i_vlan_membership->{$port} }, $vlan );
} }
} }
# Get trunk ports # Get trunk ports
my %oper_vlans; my %oper_vlans;
foreach my $iid (keys %$vtp_vlans) { foreach my $iid ( keys %$vtp_vlans ) {
my $vlan = 0; my $vlan = 0;
my $vtp_dom =0; my $vtp_dom = 0;
my $state = $vtp_vlans->{$iid}; my $state = $vtp_vlans->{$iid};
next unless defined $state; next unless defined $state;
next if $state !~ /operational/; next if $state !~ /operational/;
if ($iid =~ /(\d+)\.(\d+)/ ) { if ( $iid =~ /(\d+)\.(\d+)/ ) {
$vtp_dom = $1; $vtp_dom = $1;
$vlan = $2; $vlan = $2;
} }
$oper_vlans{$vlan}++; $oper_vlans{$vlan}++;
} }
foreach my $port (keys %$ports_vlans) { foreach my $port ( keys %$ports_vlans ) {
my $stat = $trunk_dyn_stat->{$port}; my $stat = $trunk_dyn_stat->{$port};
if ( defined $stat and $stat =~ /^trunking/ ) { if ( defined $stat and $stat =~ /^trunking/ ) {
my $k = 0; my $k = 0;
@@ -232,12 +239,13 @@ sub i_vlan_membership {
my $list2 = $ports_vlans_2k->{$port} || '0'; my $list2 = $ports_vlans_2k->{$port} || '0';
my $list3 = $ports_vlans_3k->{$port} || '0'; my $list3 = $ports_vlans_3k->{$port} || '0';
my $list4 = $ports_vlans_4k->{$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++; my $offset = 1024 * $k++;
next unless $list; next unless $list;
my $vlanlist = [split(//, unpack("B*", $list))]; my $vlanlist = [ split( //, unpack( "B*", $list ) ) ];
foreach my $vlan (keys %oper_vlans) { foreach my $vlan ( keys %oper_vlans ) {
push(@{$i_vlan_membership->{$port}}, $vlan) if (@$vlanlist[$vlan-$offset]); push( @{ $i_vlan_membership->{$port} }, $vlan )
if ( @$vlanlist[ $vlan - $offset ] );
} }
} }
} }
@@ -248,18 +256,22 @@ sub i_vlan_membership {
sub set_i_pvid { sub set_i_pvid {
my $vtp = shift; 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); 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) { 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;
} }
return $rv; return $rv;
@@ -270,18 +282,21 @@ sub set_i_pvid {
sub set_i_vlan { sub set_i_vlan {
my $vtp = shift; 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); 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) { 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;
} }
return $rv; return $rv;
@@ -292,36 +307,44 @@ sub set_i_vlan {
sub set_add_i_vlan_tagged { sub set_add_i_vlan_tagged {
my $vtp = shift; 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(); print "Adding VLAN: $vlan_id to ifIndex: $ifindex\n" if $vtp->debug();
my $trunk_serial = $vtp->load_vtp_trunk_set_serial(); my $trunk_serial = $vtp->load_vtp_trunk_set_serial();
my $trunk_members = $vtp->vtp_trunk_vlans($ifindex); my $trunk_members = $vtp->vtp_trunk_vlans($ifindex);
unless (defined $trunk_members) { unless ( defined $trunk_members ) {
$vtp->error_throw("Can't find ifIndex: $ifindex - Is it a trunk port?"); $vtp->error_throw(
"Can't find ifIndex: $ifindex - Is it a trunk port?");
return; 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'; $member_list[$vlan_id] = '1';
print "Modified vlan list for ifIndex: $ifindex: @member_list \n" if $vtp->debug(); print "Modified vlan list for ifIndex: $ifindex: @member_list \n"
my $new_list = pack("B*", join('', @member_list)); if $vtp->debug();
my $new_list = pack( "B*", join( '', @member_list ) );
#Add VLAN to 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) { 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; return;
} }
#Make sure no other SNMP manager was making modifications at the same time. #Make sure no other SNMP manager was making modifications at the same time.
my $serial_rv = $vtp->set_vtp_trunk_set_serial($trunk_serial); my $serial_rv = $vtp->set_vtp_trunk_set_serial($trunk_serial);
unless ($serial_rv) { 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;
} }
return 1; return 1;
@@ -329,36 +352,45 @@ sub set_add_i_vlan_tagged {
sub set_remove_i_vlan_tagged { sub set_remove_i_vlan_tagged {
my $vtp = shift; 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(); print "Removing VLAN: $vlan_id from ifIndex: $ifindex\n" if $vtp->debug();
my $trunk_serial = $vtp->load_vtp_trunk_set_serial(); my $trunk_serial = $vtp->load_vtp_trunk_set_serial();
my $trunk_members = $vtp->vtp_trunk_vlans($ifindex); my $trunk_members = $vtp->vtp_trunk_vlans($ifindex);
unless (defined $trunk_members) { unless ( defined $trunk_members ) {
$vtp->error_throw("Can't find ifIndex: $ifindex - Is it a trunk port?"); $vtp->error_throw(
"Can't find ifIndex: $ifindex - Is it a trunk port?");
return; 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'; $member_list[$vlan_id] = '0';
print "Modified vlan list for ifIndex: $ifindex: @member_list \n" if $vtp->debug(); print "Modified vlan list for ifIndex: $ifindex: @member_list \n"
my $new_list = pack("B*", join('', @member_list)); if $vtp->debug();
my $new_list = pack( "B*", join( '', @member_list ) );
#Remove VLAN to 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) { 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; return;
} }
#Make sure no other manager was making modifications at the same time. #Make sure no other manager was making modifications at the same time.
my $serial_rv = $vtp->set_vtp_trunk_set_serial($trunk_serial); my $serial_rv = $vtp->set_vtp_trunk_set_serial($trunk_serial);
unless ($serial_rv) { 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;
} }
return 1; return 1;
@@ -369,10 +401,14 @@ sub set_remove_i_vlan_tagged {
# #
sub _validate_vlan_param { sub _validate_vlan_param {
my $vtp = shift; my $vtp = shift;
my ($vlan_id, $ifindex) = @_; my ( $vlan_id, $ifindex ) = @_;
# VID and ifIndex should both be numeric # 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"); $vtp->error_throw("Invalid parameter");
return; return;
} }
@@ -389,21 +425,22 @@ sub _validate_vlan_param {
my $vtp_vlans = $vtp->v_state(); my $vtp_vlans = $vtp->v_state();
my $vlan_exists = 0; my $vlan_exists = 0;
foreach my $iid (keys %$vtp_vlans) { foreach my $iid ( keys %$vtp_vlans ) {
my $vlan = 0; my $vlan = 0;
my $vtp_dom =0; my $vtp_dom = 0;
my $state = $vtp_vlans->{$iid}; my $state = $vtp_vlans->{$iid};
next unless defined $state; next unless defined $state;
next if $state !~ /operational/; next if $state !~ /operational/;
if ($iid =~ /(\d+)\.(\d+)/ ) { if ( $iid =~ /(\d+)\.(\d+)/ ) {
$vtp_dom = $1; $vtp_dom = $1;
$vlan = $2; $vlan = $2;
} }
$vlan_exists = 1 if ( $vlan_id eq $vlan ); $vlan_exists = 1 if ( $vlan_id eq $vlan );
} }
unless ( $vlan_exists ) { unless ($vlan_exists) {
$vtp->error_throw("VLAN $vlan_id does not exist or is not operational"); $vtp->error_throw(
"VLAN $vlan_id does not exist or is not operational");
return; return;
} }
@@ -769,9 +806,10 @@ Each bit represents a VLAN. This is 3072 through 4095
=head1 SET METHODS =head1 SET METHODS
These are methods that provide SNMP set functionality for overridden methods or These are methods that provide SNMP set functionality for overridden methods
provide a simpler interface to complex set operations. See or provide a simpler interface to complex set operations. See
L<SNMP::Info/"SETTING DATA VIA SNMP"> for general information on set operations. L<SNMP::Info/"SETTING DATA VIA SNMP"> for general information on set
operations.
=over =over

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -44,23 +44,17 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09'; $VERSION = '1.09';
# Set for No CDP # Set for No CDP
%GLOBALS = ( %GLOBALS = ( %SNMP::Info::Layer1::GLOBALS, 'root_ip' => 'actualIPAddr', );
%SNMP::Info::Layer1::GLOBALS,
'root_ip' => 'actualIPAddr',
);
%FUNCS = (%SNMP::Info::Layer1::FUNCS, %FUNCS = (
%SNMP::Info::Layer1::FUNCS,
'ati_p_name' => 'portName', 'ati_p_name' => 'portName',
'ati_up' => 'linkTestLED', 'ati_up' => 'linkTestLED',
); );
%MIBS = ( %MIBS = ( %SNMP::Info::Layer1::MIBS, 'ATI-MIB' => 'atiPortGroupIndex' );
%SNMP::Info::Layer1::MIBS,
'ATI-MIB' => 'atiPortGroupIndex'
);
%MUNGE = (%SNMP::Info::Layer1::MUNGE, %MUNGE = ( %SNMP::Info::Layer1::MUNGE, );
);
sub vendor { sub vendor {
return 'allied'; return 'allied';
@@ -74,7 +68,7 @@ sub os_ver {
my $allied = shift; my $allied = shift;
my $descr = $allied->description(); my $descr = $allied->description();
if ($descr =~ m/version (\d+\.\d+)/){ if ( $descr =~ m/version (\d+\.\d+)/ ) {
return $1; return $1;
} }
} }
@@ -84,22 +78,22 @@ sub model {
my $desc = $allied->description(); my $desc = $allied->description();
if ($desc =~ /(AT-\d{4}\S{1}?)/){ if ( $desc =~ /(AT-\d{4}\S{1}?)/ ) {
return $1; return $1;
} }
return; return;
} }
sub i_name{ sub i_name {
my $allied = shift; my $allied = shift;
my $partial = shift; my $partial = shift;
my $i_name = $allied->orig_i_name($partial) || {}; my $i_name = $allied->orig_i_name($partial) || {};
my $ati_p_name = $allied->ati_p_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}; 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; return $i_name;
@@ -109,10 +103,10 @@ sub i_up {
my $allied = shift; my $allied = shift;
my $partial = 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) || {}; my $ati_up = $allied->ati_up($partial) || {};
foreach my $port (keys %$ati_up){ foreach my $port ( keys %$ati_up ) {
my $up = $ati_up->{$port}; my $up = $ati_up->{$port};
$i_up->{$port} = 'down' if $up eq 'linktesterror'; $i_up->{$port} = 'down' if $up eq 'linktesterror';
$i_up->{$port} = 'up' if $up eq 'nolinktesterror'; $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'; $VERSION = '1.09';
# Set for No CDP # Set for No CDP
%GLOBALS = ( %GLOBALS = ( %SNMP::Info::Layer1::GLOBALS, );
%SNMP::Info::Layer1::GLOBALS,
);
%FUNCS = (%SNMP::Info::Layer1::FUNCS, %FUNCS = (
%SNMP::Info::Layer1::FUNCS,
'asante_port' => 'ePortIndex', 'asante_port' => 'ePortIndex',
'asante_group' => 'ePortGrpIndex', 'asante_group' => 'ePortGrpIndex',
'i_type' => 'ePortStateType', 'i_type' => 'ePortStateType',
'asante_up' => 'ePortStateLinkStatus', 'asante_up' => 'ePortStateLinkStatus',
); );
%MIBS = ( %MIBS = ( %SNMP::Info::Layer1::MIBS, 'ASANTE-HUB1012-MIB' => 'asante' );
%SNMP::Info::Layer1::MIBS,
'ASANTE-HUB1012-MIB' => 'asante'
);
%MUNGE = ( %MUNGE = ( %SNMP::Info::Layer1::MUNGE, );
%SNMP::Info::Layer1::MUNGE,
);
sub interfaces { sub interfaces {
my $asante = shift; my $asante = shift;
@@ -72,7 +66,7 @@ sub interfaces {
my %interfaces; my %interfaces;
foreach my $port (keys %$rptr_port){ foreach my $port ( keys %$rptr_port ) {
$interfaces{$port} = $port; $interfaces{$port} = $port;
} }
@@ -87,7 +81,7 @@ sub os_ver {
my $asante = shift; my $asante = shift;
my $descr = $asante->description(); my $descr = $asante->description();
if ($descr =~ /software v(\d+\.\d+)/){ if ( $descr =~ /software v(\d+\.\d+)/ ) {
return $1; return $1;
} }
} }
@@ -112,7 +106,7 @@ sub i_up {
my $asante_up = $asante->asante_up($partial) || {}; my $asante_up = $asante->asante_up($partial) || {};
my $i_up = {}; my $i_up = {};
foreach my $port (keys %$asante_up){ foreach my $port ( keys %$asante_up ) {
my $up = $asante_up->{$port}; my $up = $asante_up->{$port};
$i_up->{$port} = 'down' if $up =~ /on/; $i_up->{$port} = 'down' if $up =~ /on/;
$i_up->{$port} = 'up' if $up =~ /off/; $i_up->{$port} = 'up' if $up =~ /off/;

View File

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

View File

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

View File

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

View File

@@ -39,41 +39,41 @@ use SNMP::Info::Bridge;
use SNMP::Info::Entity; use SNMP::Info::Entity;
use SNMP::Info::PowerEthernet; 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//; @SNMP::Info::Layer2::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %PORTSTAT %MUNGE/; use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %PORTSTAT %MUNGE/;
$VERSION = '1.09'; $VERSION = '1.09';
%MIBS = ( %SNMP::Info::MIBS, %MIBS = (
%SNMP::Info::Bridge::MIBS, %SNMP::Info::MIBS, %SNMP::Info::Bridge::MIBS,
%SNMP::Info::Entity::MIBS, %SNMP::Info::Entity::MIBS, %SNMP::Info::PowerEthernet::MIBS,
%SNMP::Info::PowerEthernet::MIBS, );
);
%GLOBALS = ( %GLOBALS = (
%SNMP::Info::GLOBALS, %SNMP::Info::GLOBALS,
%SNMP::Info::Bridge::GLOBALS, %SNMP::Info::Bridge::GLOBALS,
%SNMP::Info::Entity::GLOBALS, %SNMP::Info::Entity::GLOBALS,
%SNMP::Info::PowerEthernet::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 = ( %FUNCS = (
%SNMP::Info::FUNCS, %SNMP::Info::FUNCS, %SNMP::Info::Bridge::FUNCS,
%SNMP::Info::Bridge::FUNCS, %SNMP::Info::Entity::FUNCS, %SNMP::Info::PowerEthernet::FUNCS,
%SNMP::Info::Entity::FUNCS, );
%SNMP::Info::PowerEthernet::FUNCS,
);
%MUNGE = ( %MUNGE = (
# Inherit all the built in munging # Inherit all the built in munging
%SNMP::Info::MUNGE, %SNMP::Info::MUNGE,
%SNMP::Info::Bridge::MUNGE, %SNMP::Info::Bridge::MUNGE,
%SNMP::Info::Entity::MUNGE, %SNMP::Info::Entity::MUNGE,
%SNMP::Info::PowerEthernet::MUNGE, %SNMP::Info::PowerEthernet::MUNGE,
); );
# Method OverRides # Method OverRides
@@ -100,11 +100,11 @@ sub vendor {
my $model = $l2->model(); my $model = $l2->model();
my $descr = $l2->description(); my $descr = $l2->description();
if ($model =~ /hp/i or $descr =~ /\bhp\b/i) { if ( $model =~ /hp/i or $descr =~ /\bhp\b/i ) {
return 'hp'; return 'hp';
} }
if ($model =~ /catalyst/i or $descr =~ /(catalyst|cisco)/i) { if ( $model =~ /catalyst/i or $descr =~ /(catalyst|cisco)/i ) {
return 'cisco'; return 'cisco';
} }
@@ -122,9 +122,10 @@ sub serial {
# precedence # precedence
# serial2,chassis parse,serial1 # serial2,chassis parse,serial1
return $serial2 if (defined $serial2 and $serial2 !~ /^\s*$/); return $serial2 if ( defined $serial2 and $serial2 !~ /^\s*$/ );
return $1 if (defined $chassis and $chassis =~ /serial#?:\s*([a-z0-9]+)/i); return $1
return $serial1 if (defined $serial1 and $serial1 !~ /^\s*$/); if ( defined $chassis and $chassis =~ /serial#?:\s*([a-z0-9]+)/i );
return $serial1 if ( defined $serial1 and $serial1 !~ /^\s*$/ );
return; return;
} }
@@ -137,7 +138,7 @@ sub i_ignore {
my %i_ignore = (); my %i_ignore = ();
foreach my $if (keys %$i_type){ foreach my $if ( keys %$i_type ) {
my $type = $i_type->{$if}; my $type = $i_type->{$if};
$i_ignore{$if}++ $i_ignore{$if}++
if $type =~ /(loopback|other|cpu)/i; if $type =~ /(loopback|other|cpu)/i;
@@ -154,7 +155,7 @@ sub interfaces {
my $i_descr = $l2->i_description($partial) || {}; my $i_descr = $l2->i_description($partial) || {};
# Replace the Index with the ifDescr field. # Replace the Index with the ifDescr field.
foreach my $iid (keys %$i_descr){ foreach my $iid ( keys %$i_descr ) {
my $port = $i_descr->{$iid}; my $port = $i_descr->{$iid};
next unless defined $port; next unless defined $port;
$interfaces->{$iid} = $port; $interfaces->{$iid} = $port;
@@ -287,7 +288,8 @@ to a hash.
=item $l2->interfaces() =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> 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::CDP;
use SNMP::Info::Airespace; 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//; @SNMP::Info::Layer2::Airespace::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/; use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
@@ -43,32 +44,24 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09'; $VERSION = '1.09';
%MIBS = ( %MIBS = (
%SNMP::Info::MIBS, %SNMP::Info::MIBS, %SNMP::Info::Bridge::MIBS,
%SNMP::Info::Bridge::MIBS, %SNMP::Info::CDP::MIBS, %SNMP::Info::Airespace::MIBS,
%SNMP::Info::CDP::MIBS, );
%SNMP::Info::Airespace::MIBS,
);
%GLOBALS = ( %GLOBALS = (
%SNMP::Info::GLOBALS, %SNMP::Info::GLOBALS, %SNMP::Info::Bridge::GLOBALS,
%SNMP::Info::Bridge::GLOBALS, %SNMP::Info::CDP::GLOBALS, %SNMP::Info::Airespace::GLOBALS,
%SNMP::Info::CDP::GLOBALS, );
%SNMP::Info::Airespace::GLOBALS,
);
%FUNCS = ( %FUNCS = (
%SNMP::Info::FUNCS, %SNMP::Info::FUNCS, %SNMP::Info::Bridge::FUNCS,
%SNMP::Info::Bridge::FUNCS, %SNMP::Info::CDP::FUNCS, %SNMP::Info::Airespace::FUNCS,
%SNMP::Info::CDP::FUNCS, );
%SNMP::Info::Airespace::FUNCS,
);
%MUNGE = ( %MUNGE = (
%SNMP::Info::MUNGE, %SNMP::Info::MUNGE, %SNMP::Info::Bridge::MUNGE,
%SNMP::Info::Bridge::MUNGE, %SNMP::Info::CDP::MUNGE, %SNMP::Info::Airespace::MUNGE,
%SNMP::Info::CDP::MUNGE, );
%SNMP::Info::Airespace::MUNGE,
);
sub os { sub os {
return 'cisco'; return 'cisco';

View File

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

View File

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

View File

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

View File

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

View File

@@ -38,7 +38,8 @@ use SNMP::Info::RapidCity;
use SNMP::Info::LLDP; use SNMP::Info::LLDP;
use SNMP::Info::Layer3; 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::RapidCity SNMP::Info::LLDP
SNMP::Info::Layer3 Exporter/; SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer2::Baystack::EXPORT_OK = qw//; @SNMP::Info::Layer2::Baystack::EXPORT_OK = qw//;
@@ -48,28 +49,22 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09'; $VERSION = '1.09';
%MIBS = ( %MIBS = (
%SNMP::Info::Layer3::MIBS, %SNMP::Info::Layer3::MIBS, %SNMP::Info::LLDP::MIBS,
%SNMP::Info::LLDP::MIBS, %SNMP::Info::RapidCity::MIBS, %SNMP::Info::NortelStack::MIBS,
%SNMP::Info::RapidCity::MIBS,
%SNMP::Info::NortelStack::MIBS,
%SNMP::Info::SONMP::MIBS, %SNMP::Info::SONMP::MIBS,
); );
%GLOBALS = ( %GLOBALS = (
%SNMP::Info::Layer3::GLOBALS, %SNMP::Info::Layer3::GLOBALS, %SNMP::Info::LLDP::GLOBALS,
%SNMP::Info::LLDP::GLOBALS, %SNMP::Info::RapidCity::GLOBALS, %SNMP::Info::NortelStack::GLOBALS,
%SNMP::Info::RapidCity::GLOBALS,
%SNMP::Info::NortelStack::GLOBALS,
%SNMP::Info::SONMP::GLOBALS, %SNMP::Info::SONMP::GLOBALS,
); );
%FUNCS = ( %FUNCS = (
%SNMP::Info::Layer3::FUNCS, %SNMP::Info::Layer3::FUNCS, %SNMP::Info::LLDP::FUNCS,
%SNMP::Info::LLDP::FUNCS, %SNMP::Info::RapidCity::FUNCS, %SNMP::Info::NortelStack::FUNCS,
%SNMP::Info::RapidCity::FUNCS,
%SNMP::Info::NortelStack::FUNCS,
%SNMP::Info::SONMP::FUNCS, %SNMP::Info::SONMP::FUNCS,
); );
# 450's report full duplex as speed = 20mbps?! # 450's report full duplex as speed = 20mbps?!
$SNMP::Info::SPEED_MAP{20_000_000} = '10 Mbps'; $SNMP::Info::SPEED_MAP{20_000_000} = '10 Mbps';
@@ -77,22 +72,27 @@ $SNMP::Info::SPEED_MAP{200_000_000} = '100 Mbps';
$SNMP::Info::SPEED_MAP{2_000_000_000} = '1.0 Gbps'; $SNMP::Info::SPEED_MAP{2_000_000_000} = '1.0 Gbps';
%MUNGE = ( %MUNGE = (
%SNMP::Info::Layer3::MUNGE, %SNMP::Info::Layer3::MUNGE, %SNMP::Info::LLDP::MUNGE,
%SNMP::Info::LLDP::MUNGE, %SNMP::Info::RapidCity::MUNGE, %SNMP::Info::NortelStack::MUNGE,
%SNMP::Info::RapidCity::MUNGE,
%SNMP::Info::NortelStack::MUNGE,
%SNMP::Info::SONMP::MUNGE, %SNMP::Info::SONMP::MUNGE,
); );
sub os { sub os {
my $baystack = shift; my $baystack = shift;
my $descr = $baystack->description(); my $descr = $baystack->description();
my $model = $baystack->model(); 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'; 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 'bes';
} }
return 'baystack'; return 'baystack';
@@ -104,16 +104,16 @@ sub os_bin {
return unless defined $descr; return unless defined $descr;
# 303 / 304 # 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; return $1;
} }
# 450 # 450
if ($descr =~ m/FW:V(\d+\.\d+)/){ if ( $descr =~ m/FW:V(\d+\.\d+)/ ) {
return $1; return $1;
} }
if ($descr =~ m/FW:(\d+\.\d+\.\d+\.\d+)/i){ if ( $descr =~ m/FW:(\d+\.\d+\.\d+\.\d+)/i ) {
return $1; return $1;
} }
return; return;
@@ -132,10 +132,12 @@ sub model {
my $descr = $baystack->description(); my $descr = $baystack->description();
return '303' if (defined $descr and $descr =~ /\D303\D/); return '303' if ( defined $descr and $descr =~ /\D303\D/ );
return '304' if (defined $descr and $descr =~ /\D304\D/); return '304' if ( defined $descr and $descr =~ /\D304\D/ );
return 'BPS' if ($model =~ /BPS2000/i); return 'BPS' if ( $model =~ /BPS2000/i );
return $2 if ($model =~ /(ES|ERS|BayStack|EthernetRoutingSwitch|EthernetSwitch)-?(\d+)/); return $2
if ( $model
=~ /(ES|ERS|BayStack|EthernetRoutingSwitch|EthernetSwitch)-?(\d+)/ );
return $model; return $model;
} }
@@ -149,14 +151,15 @@ sub interfaces {
my $slot_offset = $baystack->slot_offset(); my $slot_offset = $baystack->slot_offset();
my %if; my %if;
foreach my $iid (keys %$i_index){ foreach my $iid ( keys %$i_index ) {
my $index = $i_index->{$iid}; my $index = $i_index->{$iid};
next unless defined $index; next unless defined $index;
# Ignore cascade ports # Ignore cascade ports
next if $index > 513; next if $index > 513;
my $port = ($index % $index_factor); my $port = ( $index % $index_factor );
my $slot = (int($index / $index_factor)) + $slot_offset; my $slot = ( int( $index / $index_factor ) ) + $slot_offset;
my $slotport = "$slot.$port"; my $slotport = "$slot.$port";
$if{$iid} = $slotport; $if{$iid} = $slotport;
@@ -171,12 +174,13 @@ sub i_mac {
my $i_mac = $baystack->orig_i_mac($partial) || {}; my $i_mac = $baystack->orig_i_mac($partial) || {};
my %i_mac; my %i_mac;
# Baystack 303's with a hw rev < 2.11.4.5 report the mac as all zeros # 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}; my $mac = $i_mac->{$iid};
next unless defined $mac; next unless defined $mac;
next if $mac eq '00:00:00:00:00:00'; next if $mac eq '00:00:00:00:00:00';
$i_mac{$iid}=$mac; $i_mac{$iid} = $mac;
} }
return \%i_mac; return \%i_mac;
} }
@@ -190,12 +194,13 @@ sub i_name {
my $i_name2 = $baystack->orig_i_name($partial) || {}; my $i_name2 = $baystack->orig_i_name($partial) || {};
my %i_name; my %i_name;
foreach my $iid (keys %$i_name2){ foreach my $iid ( keys %$i_name2 ) {
my $name = $i_name2->{$iid}; my $name = $i_name2->{$iid};
my $alias = $i_alias->{$iid}; my $alias = $i_alias->{$iid};
$i_name{$iid} = (defined $alias and $alias !~ /^\s*$/) ? $i_name{$iid}
$alias : = ( defined $alias and $alias !~ /^\s*$/ )
$name; ? $alias
: $name;
} }
return \%i_name; return \%i_name;
@@ -210,7 +215,9 @@ sub index_factor {
$op_mode = 'pure' unless defined $op_mode; $op_mode = 'pure' unless defined $op_mode;
my $index_factor = 32; 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; return $index_factor;
} }
@@ -231,14 +238,14 @@ sub c_ip {
my $lldp = $baystack->lldp_ip($partial) || {}; my $lldp = $baystack->lldp_ip($partial) || {};
my %c_ip; my %c_ip;
foreach my $iid (keys %$cdp){ foreach my $iid ( keys %$cdp ) {
my $ip = $cdp->{$iid}; my $ip = $cdp->{$iid};
next unless defined $ip; next unless defined $ip;
$c_ip{$iid} = $ip; $c_ip{$iid} = $ip;
} }
foreach my $iid (keys %$lldp){ foreach my $iid ( keys %$lldp ) {
my $ip = $lldp->{$iid}; my $ip = $lldp->{$iid};
next unless defined $ip; next unless defined $ip;
@@ -251,18 +258,18 @@ sub c_if {
my $baystack = shift; my $baystack = shift;
my $partial = shift; my $partial = shift;
my $lldp = $baystack->lldp_if($partial) || {};; my $lldp = $baystack->lldp_if($partial) || {};
my $cdp = $baystack->SUPER::c_if($partial) || {}; my $cdp = $baystack->SUPER::c_if($partial) || {};
my %c_if; my %c_if;
foreach my $iid (keys %$cdp){ foreach my $iid ( keys %$cdp ) {
my $if = $cdp->{$iid}; my $if = $cdp->{$iid};
next unless defined $if; next unless defined $if;
$c_if{$iid} = $if; $c_if{$iid} = $if;
} }
foreach my $iid (keys %$lldp){ foreach my $iid ( keys %$lldp ) {
my $if = $lldp->{$iid}; my $if = $lldp->{$iid};
next unless defined $if; next unless defined $if;
@@ -279,14 +286,14 @@ sub c_port {
my $cdp = $baystack->SUPER::c_port($partial) || {}; my $cdp = $baystack->SUPER::c_port($partial) || {};
my %c_port; my %c_port;
foreach my $iid (keys %$cdp){ foreach my $iid ( keys %$cdp ) {
my $port = $cdp->{$iid}; my $port = $cdp->{$iid};
next unless defined $port; next unless defined $port;
$c_port{$iid} = $port; $c_port{$iid} = $port;
} }
foreach my $iid (keys %$lldp){ foreach my $iid ( keys %$lldp ) {
my $port = $lldp->{$iid}; my $port = $lldp->{$iid};
next unless defined $port; next unless defined $port;
@@ -303,14 +310,14 @@ sub c_id {
my $cdp = $baystack->SUPER::c_id($partial) || {}; my $cdp = $baystack->SUPER::c_id($partial) || {};
my %c_id; my %c_id;
foreach my $iid (keys %$cdp){ foreach my $iid ( keys %$cdp ) {
my $id = $cdp->{$iid}; my $id = $cdp->{$iid};
next unless defined $id; next unless defined $id;
$c_id{$iid} = $id; $c_id{$iid} = $id;
} }
foreach my $iid (keys %$lldp){ foreach my $iid ( keys %$lldp ) {
my $id = $lldp->{$iid}; my $id = $lldp->{$iid};
next unless defined $id; next unless defined $id;
@@ -327,14 +334,14 @@ sub c_platform {
my $cdp = $baystack->SUPER::c_platform($partial) || {}; my $cdp = $baystack->SUPER::c_platform($partial) || {};
my %c_platform; my %c_platform;
foreach my $iid (keys %$cdp){ foreach my $iid ( keys %$cdp ) {
my $platform = $cdp->{$iid}; my $platform = $cdp->{$iid};
next unless defined $platform; next unless defined $platform;
$c_platform{$iid} = $platform; $c_platform{$iid} = $platform;
} }
foreach my $iid (keys %$lldp){ foreach my $iid ( keys %$lldp ) {
my $platform = $lldp->{$iid}; my $platform = $lldp->{$iid};
next unless defined $platform; next unless defined $platform;
@@ -582,7 +589,8 @@ to a hash.
Returns reference to the map between IID and physical Port. 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) port = (Interface index % Index factor)
slot = (int(Interface index / Index factor)) + Slot offset 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() =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 =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 If multiple entries exist with the same local port, c_if(), with the same IPv4
address, c_ip(), it may be a duplicate entry. address, c_ip(), it may be a duplicate entry.
If multiple entries exist with the same local port, c_if(), with different IPv4 If multiple entries exist with the same local port, c_if(), with different
addresses, c_ip(), there is either a non-SONMP/LLDP device in between two or 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. more devices or multiple devices which are not directly connected.
Use the data from the Layer2 Topology Table below to dig deeper. 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::CiscoStats::GLOBALS,
%SNMP::Info::CDP::GLOBALS, %SNMP::Info::CDP::GLOBALS,
'c1900_flash_status' => 'upgradeFlashBankStatus', 'c1900_flash_status' => 'upgradeFlashBankStatus',
); );
%FUNCS = ( %FUNCS = (
%SNMP::Info::Layer2::FUNCS, %SNMP::Info::Layer2::FUNCS,
%SNMP::Info::CiscoConfig::FUNCS, %SNMP::Info::CiscoConfig::FUNCS,
%SNMP::Info::CiscoStats::FUNCS, %SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::CDP::FUNCS, %SNMP::Info::CDP::FUNCS,
# ESSWITCH-MIB # ESSWITCH-MIB
'c1900_p_index' => 'swPortIndex', 'c1900_p_index' => 'swPortIndex',
'c1900_p_ifindex' => 'swPortIfIndex', 'c1900_p_ifindex' => 'swPortIfIndex',
@@ -70,23 +71,22 @@ $VERSION = '1.09';
'c1900_p_up_admin' => 'swPortAdminStatus', 'c1900_p_up_admin' => 'swPortAdminStatus',
'c1900_p_type' => 'swPortMediaCapability', 'c1900_p_type' => 'swPortMediaCapability',
'c1900_p_media' => 'swPortConnectorType', 'c1900_p_media' => 'swPortConnectorType',
); );
%MIBS = ( %MIBS = (
%SNMP::Info::Layer2::MIBS, %SNMP::Info::Layer2::MIBS,
%SNMP::Info::CiscoConfig::MIBS, %SNMP::Info::CiscoConfig::MIBS,
%SNMP::Info::CiscoStats::MIBS, %SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::CDP::MIBS, %SNMP::Info::CDP::MIBS,
# Also known as the ESSWITCH-MIB # Also known as the ESSWITCH-MIB
'STAND-ALONE-ETHERNET-SWITCH-MIB' => 'series2000' 'STAND-ALONE-ETHERNET-SWITCH-MIB' => 'series2000'
); );
%MUNGE = ( %MUNGE = (
%SNMP::Info::Layer2::MUNGE, %SNMP::Info::Layer2::MUNGE, %SNMP::Info::CiscoConfig::MUNGE,
%SNMP::Info::CiscoConfig::MUNGE, %SNMP::Info::CiscoStats::MUNGE, %SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoStats::MUNGE, );
%SNMP::Info::CDP::MUNGE,
);
sub bulkwalk_no { return 1; } sub bulkwalk_no { return 1; }
sub cisco_comm_indexing { return 1; } sub cisco_comm_indexing { return 1; }
@@ -203,25 +203,26 @@ sub i_vlan {
my $partial = shift; my $partial = shift;
# Overlap allows more than one VLAN per port. Unable to determine default # Overlap allows more than one VLAN per port. Unable to determine default
my $overlap = $c1900->bridgeGroupAllowMembershipOverlap() || my $overlap = $c1900->bridgeGroupAllowMembershipOverlap()
$c1900->vlanAllowMembershipOverlap() || 'disabled'; || $c1900->vlanAllowMembershipOverlap()
|| 'disabled';
if ($overlap eq 'enabled') { if ( $overlap eq 'enabled' ) {
return; return;
} }
my $member_of = $c1900->bridgeGroupMemberPortOfBridgeGroup() || my $member_of = $c1900->bridgeGroupMemberPortOfBridgeGroup()
$c1900->vlanMemberPortOfVlan(); || $c1900->vlanMemberPortOfVlan();
my $i_pvid = {}; my $i_pvid = {};
foreach my $idx (keys %$member_of) { foreach my $idx ( keys %$member_of ) {
my @values = split(/\./, $idx); my @values = split( /\./, $idx );
my ($vlan, $port) = @values; my ( $vlan, $port ) = @values;
next unless $vlan; next unless $vlan;
next unless $port; next unless $port;
next if (defined $partial and $port !~ /^$partial$/); next if ( defined $partial and $port !~ /^$partial$/ );
my $value = $member_of->{$idx}; my $value = $member_of->{$idx};
next if ($value eq 'false'); next if ( $value eq 'false' );
$i_pvid->{$port} = $vlan; $i_pvid->{$port} = $vlan;
} }
@@ -232,20 +233,20 @@ sub i_vlan_membership {
my $c1900 = shift; my $c1900 = shift;
my $partial = shift; my $partial = shift;
my $member_of = $c1900->bridgeGroupMemberPortOfBridgeGroup() || my $member_of = $c1900->bridgeGroupMemberPortOfBridgeGroup()
$c1900->vlanMemberPortOfVlan(); || $c1900->vlanMemberPortOfVlan();
my $i_vlan_membership = {}; my $i_vlan_membership = {};
foreach my $idx (keys %$member_of) { foreach my $idx ( keys %$member_of ) {
my @values = split(/\./, $idx); my @values = split( /\./, $idx );
my ($vlan, $port) = @values; my ( $vlan, $port ) = @values;
next unless $vlan; next unless $vlan;
next unless $port; next unless $port;
next if (defined $partial and $port !~ /^$partial$/); next if ( defined $partial and $port !~ /^$partial$/ );
my $value = $member_of->{$idx}; 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; return $i_vlan_membership;
} }
@@ -499,9 +500,10 @@ See L<SNMP::Info::Layer2/"TABLE METHODS"> for details.
=head1 SET METHODS =head1 SET METHODS
These are methods that provide SNMP set functionality for overridden methods or These are methods that provide SNMP set functionality for overridden methods
provide a simpler interface to complex set operations. See or provide a simpler interface to complex set operations. See
L<SNMP::Info/"SETTING DATA VIA SNMP"> for general information on set operations. L<SNMP::Info/"SETTING DATA VIA SNMP"> for general information on set
operations.
=over =over

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -35,7 +35,8 @@ use Exporter;
use SNMP::Info::IEEE802dot11; use SNMP::Info::IEEE802dot11;
use SNMP::Info::Layer2; 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//; @SNMP::Info::Layer2::Orinoco::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/; use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
@@ -45,28 +46,25 @@ $VERSION = '1.09';
%MIBS = ( %MIBS = (
%SNMP::Info::Layer2::MIBS, %SNMP::Info::Layer2::MIBS,
%SNMP::Info::IEEE802dot11::MIBS, %SNMP::Info::IEEE802dot11::MIBS,
#'ORiNOCO-MIB' => 'orinoco',
);
%GLOBALS = ( #'ORiNOCO-MIB' => 'orinoco',
%SNMP::Info::Layer2::GLOBALS, );
%SNMP::Info::IEEE802dot11::GLOBALS,
); %GLOBALS
= ( %SNMP::Info::Layer2::GLOBALS, %SNMP::Info::IEEE802dot11::GLOBALS, );
%FUNCS = ( %FUNCS = (
%SNMP::Info::Layer2::FUNCS, %SNMP::Info::Layer2::FUNCS,
%SNMP::Info::IEEE802dot11::FUNCS, %SNMP::Info::IEEE802dot11::FUNCS,
# ORiNOCO-MIB:oriWirelessIfPropertiesTable # ORiNOCO-MIB:oriWirelessIfPropertiesTable
#'ori_ssid' => 'oriWirelessIfNetworkName', #'ori_ssid' => 'oriWirelessIfNetworkName',
#'ori_channel' => 'oriWirelessIfChannel', #'ori_channel' => 'oriWirelessIfChannel',
#'ori_closed_sys' => 'oriWirelessIfClosedSystem', #'ori_closed_sys' => 'oriWirelessIfClosedSystem',
# ORiNOCO-MIB:oriSystemInvMgmtComponentTable # ORiNOCO-MIB:oriSystemInvMgmtComponentTable
); );
%MUNGE = ( %MUNGE = ( %SNMP::Info::Layer2::MUNGE, %SNMP::Info::IEEE802dot11::MUNGE, );
%SNMP::Info::Layer2::MUNGE,
%SNMP::Info::IEEE802dot11::MUNGE,
);
sub os { sub os {
return 'orinoco'; return 'orinoco';
@@ -78,10 +76,10 @@ sub os_ver {
my $descr = $orinoco->description(); my $descr = $orinoco->description();
return unless defined $descr; return unless defined $descr;
if ($descr =~ m/V(\d+\.\d+)/){ if ( $descr =~ m/V(\d+\.\d+)/ ) {
return $1; return $1;
} }
if ($descr =~ m/v(\d+\.\d+\.\d+)/){ if ( $descr =~ m/v(\d+\.\d+\.\d+)/ ) {
return $1; return $1;
} }
@@ -94,10 +92,10 @@ sub os_bin {
my $descr = $orinoco->description(); my $descr = $orinoco->description();
return unless defined $descr; return unless defined $descr;
if ($descr =~ m/V(\d+\.\d+)$/){ if ( $descr =~ m/V(\d+\.\d+)$/ ) {
return $1; return $1;
} }
if ($descr =~ m/v(\d+\.\d+\.\d+)$/){ if ( $descr =~ m/v(\d+\.\d+\.\d+)$/ ) {
return $1; return $1;
} }
@@ -114,8 +112,8 @@ sub model {
my $descr = $orinoco->description(); my $descr = $orinoco->description();
return unless defined $descr; return unless defined $descr;
return $1 if ($descr =~ /(AP-\d+)/); return $1 if ( $descr =~ /(AP-\d+)/ );
return 'WavePOINT-II' if ($descr =~ /WavePOINT-II/); return 'WavePOINT-II' if ( $descr =~ /WavePOINT-II/ );
return; return;
} }
@@ -136,8 +134,9 @@ sub i_ignore {
my $descr = $orinoco->i_description($partial) || {}; my $descr = $orinoco->i_description($partial) || {};
my %i_ignore; my %i_ignore;
foreach my $if (keys %$descr){ foreach my $if ( keys %$descr ) {
my $type = $descr->{$if}; my $type = $descr->{$if};
# Skip virtual interfaces # Skip virtual interfaces
$i_ignore{$if}++ if $type =~ /(lo|empty|PCMCIA)/i; $i_ignore{$if}++ if $type =~ /(lo|empty|PCMCIA)/i;
} }
@@ -152,7 +151,7 @@ sub interfaces {
my $descriptions = $orinoco->i_description($partial) || {}; my $descriptions = $orinoco->i_description($partial) || {};
my %interfaces = (); my %interfaces = ();
foreach my $iid (keys %$interfaces){ foreach my $iid ( keys %$interfaces ) {
my $desc = $descriptions->{$iid}; my $desc = $descriptions->{$iid};
next unless defined $desc; next unless defined $desc;
next if $desc =~ /(lo|empty|PCMCIA)/i; next if $desc =~ /(lo|empty|PCMCIA)/i;
@@ -208,9 +207,9 @@ Eric Miller
=head1 DESCRIPTION =head1 DESCRIPTION
Provides abstraction to the configuration information obtainable from a Orinoco Provides abstraction to the configuration information obtainable from
Access Point through SNMP. Orinoco devices have been manufactured by Proxim, Orinoco Access Point through SNMP. Orinoco devices have been manufactured
Agere, and Lucent. by Proxim, Agere, and Lucent.
For speed or debugging purposes you can call the subclass directly, but not For speed or debugging purposes you can call the subclass directly, but not
after determining a more specific class using the method above. 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'; $VERSION = '1.09';
# Set for No CDP # Set for No CDP
%GLOBALS = ( %GLOBALS = ( %SNMP::Info::Layer2::GLOBALS );
%SNMP::Info::Layer2::GLOBALS
);
%FUNCS = (%SNMP::Info::Layer2::FUNCS, %FUNCS = (
%SNMP::Info::Layer2::FUNCS,
'ip_adresses' => 'ipAdEntAddr', 'ip_adresses' => 'ipAdEntAddr',
'i_name' => 'ifDescr', 'i_name' => 'ifDescr',
'i_description' => 'adslLineConfProfile', 'i_description' => 'adslLineConfProfile',
); );
%MIBS = ( %MIBS
%SNMP::Info::Layer2::MIBS, = ( %SNMP::Info::Layer2::MIBS, 'ADSL-LINE-MIB' => 'adslLineConfProfile' );
'ADSL-LINE-MIB' => 'adslLineConfProfile'
);
%MUNGE = (%SNMP::Info::Layer2::MUNGE
);
%MUNGE = ( %SNMP::Info::Layer2::MUNGE );
sub layers { sub layers {
my $zyxel = shift; my $zyxel = shift;
@@ -82,7 +77,7 @@ sub os_ver {
my $zyxel = shift; my $zyxel = shift;
my $descr = $zyxel->description(); my $descr = $zyxel->description();
if ($descr =~ m/version (\S+) /){ if ( $descr =~ m/version (\S+) / ) {
return $1; return $1;
} }
return; return;
@@ -93,21 +88,24 @@ sub model {
my $desc = $zyxel->description(); my $desc = $zyxel->description();
if ($desc =~ /8-port ADSL Module\(Annex A\)/){ if ( $desc =~ /8-port ADSL Module\(Annex A\)/ ) {
return "AAM1008-61"; return "AAM1008-61";
} elsif ($desc =~ /8-port ADSL Module\(Annex B\)/){ }
elsif ( $desc =~ /8-port ADSL Module\(Annex B\)/ ) {
return "AAM1008-63"; return "AAM1008-63";
} }
return; return;
} }
sub ip{ sub ip {
my $zyxel = shift; my $zyxel = shift;
my $ip_hash = $zyxel->ip_addresses(); my $ip_hash = $zyxel->ip_addresses();
my $found_ip; my $found_ip;
foreach my $ip (keys %{$ip_hash}) { 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}$/); $found_ip = $ip
if ( defined $ip
and $ip =~ /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/ );
} }
return $found_ip; return $found_ip;
} }

View File

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

View File

@@ -47,39 +47,43 @@ $VERSION = '1.09';
%SNMP::Info::Layer3::MIBS, %SNMP::Info::Layer3::MIBS,
'AWCVX-MIB' => 'awcIfTable', 'AWCVX-MIB' => 'awcIfTable',
'IEEE802dot11-MIB' => 'dot11StationID', 'IEEE802dot11-MIB' => 'dot11StationID',
); );
%GLOBALS = ( %GLOBALS = (
%SNMP::Info::Layer3::GLOBALS, %SNMP::Info::Layer3::GLOBALS,
'mac' => 'dot11StationID.2', 'mac' => 'dot11StationID.2',
# AWC Ethernet Table # AWC Ethernet Table
'awc_duplex' => 'awcEtherDuplex.0', 'awc_duplex' => 'awcEtherDuplex.0',
); );
%FUNCS = ( %FUNCS = (
%SNMP::Info::Layer3::FUNCS, %SNMP::Info::Layer3::FUNCS,
'i_mac2' => 'ifPhysAddress', 'i_mac2' => 'ifPhysAddress',
'i_mtu2' => 'ifMtu', 'i_mtu2' => 'ifMtu',
'i_ssid' => 'dot11DesiredSSID', 'i_ssid' => 'dot11DesiredSSID',
# Bridge-mib overrides # Bridge-mib overrides
'fw_mac2' => 'dot1dTpFdbAddress', 'fw_mac2' => 'dot1dTpFdbAddress',
'fw_port2' => 'dot1dTpFdbPort', 'fw_port2' => 'dot1dTpFdbPort',
'bp_index2' => 'dot1dBasePortIfIndex', 'bp_index2' => 'dot1dBasePortIfIndex',
# AWC Interface Table (awcIfTable) # AWC Interface Table (awcIfTable)
'awc_default_mac' => 'awcIfDefaultPhyAddress', 'awc_default_mac' => 'awcIfDefaultPhyAddress',
'awc_mac' => 'awcIfPhyAddress', 'awc_mac' => 'awcIfPhyAddress',
'awc_ip' => 'awcIfIpAddress', 'awc_ip' => 'awcIfIpAddress',
'awc_netmask' => 'awcIfIpNetMask', 'awc_netmask' => 'awcIfIpNetMask',
'awc_msdu' => 'awcIfMSDUMaxLength', 'awc_msdu' => 'awcIfMSDUMaxLength',
); );
%MUNGE = ( %MUNGE = (
# Inherit all the built in munging # Inherit all the built in munging
%SNMP::Info::Layer3::MUNGE, %SNMP::Info::Layer3::MUNGE,
'i_mac2' => \&SNMP::Info::munge_mac, 'i_mac2' => \&SNMP::Info::munge_mac,
'awc_mac' => \&SNMP::Info::munge_mac, 'awc_mac' => \&SNMP::Info::munge_mac,
'fw_mac2' => \&SNMP::Info::munge_mac, 'fw_mac2' => \&SNMP::Info::munge_mac,
); );
sub os { sub os {
return 'aironet'; return 'aironet';
@@ -90,11 +94,11 @@ sub os_ver {
my $descr = $aironet->description() || ''; my $descr = $aironet->description() || '';
# CAP340 11.21, AP4800-E 11.21 # 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; return $2;
} }
if ($descr =~ /Series\s*AP\s+(\d{2}\.\d{2})/){ if ( $descr =~ /Series\s*AP\s+(\d{2}\.\d{2})/ ) {
return $1; return $1;
} }
@@ -107,12 +111,12 @@ sub bp_index {
my $interfaces = $aironet->interfaces(); my $interfaces = $aironet->interfaces();
my $bp_index = $aironet->bp_index2(); my $bp_index = $aironet->bp_index2();
foreach my $iid (keys %$interfaces){ foreach my $iid ( keys %$interfaces ) {
my $port = $interfaces->{$iid}; my $port = $interfaces->{$iid};
# Hardwire the wireless port to the transparent bridge port # Hardwire the wireless port to the transparent bridge port
if ($port =~ /awc/){ if ( $port =~ /awc/ ) {
$bp_index->{0}=$iid; $bp_index->{0} = $iid;
} }
} }
@@ -127,13 +131,13 @@ sub fw_mac {
my $bs_mac = $aironet->bs_mac(); my $bs_mac = $aironet->bs_mac();
# remove port 0 forwarding table entries, only port 0 static entries # 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}; my $port = $fw_port->{$fw};
next unless defined $port; next unless defined $port;
delete $fw_mac->{$fw} if $port == 0; delete $fw_mac->{$fw} if $port == 0;
} }
foreach my $bs (keys %$bs_mac){ foreach my $bs ( keys %$bs_mac ) {
my $entry = $bs; my $entry = $bs;
$entry =~ s/\.0$//; $entry =~ s/\.0$//;
$fw_mac->{$entry} = $bs_mac->{$bs}; $fw_mac->{$entry} = $bs_mac->{$bs};
@@ -148,8 +152,7 @@ sub fw_port {
my $fw_port = $aironet->fw_port2(); my $fw_port = $aironet->fw_port2();
my $bs_port = $aironet->bs_port(); my $bs_port = $aironet->bs_port();
foreach my $bs ( keys %$bs_port ) {
foreach my $bs (keys %$bs_port){
my $entry = $bs; my $entry = $bs;
$entry =~ s/\.0$//; $entry =~ s/\.0$//;
$fw_port->{$entry} = $bs_port->{$bs}; $fw_port->{$entry} = $bs_port->{$bs};
@@ -158,7 +161,6 @@ sub fw_port {
return $fw_port; return $fw_port;
} }
sub i_duplex { sub i_duplex {
my $aironet = shift; my $aironet = shift;
my $interfaces = $aironet->interfaces(); my $interfaces = $aironet->interfaces();
@@ -166,10 +168,10 @@ sub i_duplex {
my %i_duplex; my %i_duplex;
foreach my $iid (keys %$interfaces){ foreach my $iid ( keys %$interfaces ) {
my $name = $interfaces->{$iid}; my $name = $interfaces->{$iid};
if ($name =~ /fec/){ if ( $name =~ /fec/ ) {
$i_duplex{$iid} = $awc_duplex; $i_duplex{$iid} = $awc_duplex;
} }
} }
@@ -183,7 +185,7 @@ sub i_mac {
my $i_mac = $aironet->i_mac2(); my $i_mac = $aironet->i_mac2();
my $awc_mac = $aironet->awc_mac(); my $awc_mac = $aironet->awc_mac();
foreach my $iid (keys %$awc_mac){ foreach my $iid ( keys %$awc_mac ) {
next unless defined $i_mac->{$iid}; next unless defined $i_mac->{$iid};
$i_mac->{$iid} = $awc_mac->{$iid}; $i_mac->{$iid} = $awc_mac->{$iid};
} }
@@ -196,8 +198,8 @@ sub i_ignore {
my $interfaces = $aironet->interfaces(); my $interfaces = $aironet->interfaces();
my %i_ignore; my %i_ignore;
foreach my $if (keys %$interfaces){ foreach my $if ( keys %$interfaces ) {
$i_ignore{$if}++ if ($interfaces->{$if} =~ /(rptr|lo)/); $i_ignore{$if}++ if ( $interfaces->{$if} =~ /(rptr|lo)/ );
} }
return \%i_ignore; return \%i_ignore;
@@ -213,8 +215,8 @@ __END__
=head1 NAME =head1 NAME
SNMP::Info::Layer3::Aironet - Perl5 Interface to Cisco Aironet Wireless Devices SNMP::Info::Layer3::Aironet - Perl5 Interface to Cisco Aironet Wireless
running Aironet software, not IOS Devices running Aironet software, not IOS
=head1 AUTHOR =head1 AUTHOR

View File

@@ -50,7 +50,7 @@ $VERSION = '1.09';
'ALTEON-CS-PHYSICAL-MIB' => 'vlanCurCfgLearn', 'ALTEON-CS-PHYSICAL-MIB' => 'vlanCurCfgLearn',
'ALTEON-TS-NETWORK-MIB' => 'ripCurCfgSupply', 'ALTEON-TS-NETWORK-MIB' => 'ripCurCfgSupply',
'ALTEON-CHEETAH-NETWORK-MIB' => 'ripCurCfgIntfSupply', 'ALTEON-CHEETAH-NETWORK-MIB' => 'ripCurCfgIntfSupply',
); );
%GLOBALS = ( %GLOBALS = (
%SNMP::Info::Layer3::GLOBALS, %SNMP::Info::Layer3::GLOBALS,
@@ -66,10 +66,11 @@ $VERSION = '1.09';
'new_tftp_result' => 'ALTEON_CHEETAH_SWITCH_MIB__agTftpLastActionStatus', 'new_tftp_result' => 'ALTEON_CHEETAH_SWITCH_MIB__agTftpLastActionStatus',
'old_ip_max' => 'ALTEON_TS_NETWORK_MIB__ipInterfaceTableMax', 'old_ip_max' => 'ALTEON_TS_NETWORK_MIB__ipInterfaceTableMax',
'new_ip_max' => 'ALTEON_CHEETAH_NETWORK_MIB__ipInterfaceTableMax', 'new_ip_max' => 'ALTEON_CHEETAH_NETWORK_MIB__ipInterfaceTableMax',
); );
%FUNCS = ( %FUNCS = (
%SNMP::Info::Layer3::FUNCS, %SNMP::Info::Layer3::FUNCS,
# From agPortCurCfgTable # From agPortCurCfgTable
'old_ag_p_cfg_idx' => 'ALTEON_TS_PHYSICAL_MIB__agPortCurCfgIndx', 'old_ag_p_cfg_idx' => 'ALTEON_TS_PHYSICAL_MIB__agPortCurCfgIndx',
'new_ag_p_cfg_idx' => 'ALTEON_CHEETAH_SWITCH_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', 'new_ag_p_cfg_pref' => 'agPortCurCfgPreferred',
'old_ag_p_cfg_pvid' => 'ALTEON_TS_PHYSICAL_MIB__agPortCurCfgPVID', 'old_ag_p_cfg_pvid' => 'ALTEON_TS_PHYSICAL_MIB__agPortCurCfgPVID',
'new_ag_p_cfg_pvid' => 'ALTEON_CHEETAH_SWITCH_MIB__agPortCurCfgPVID', 'new_ag_p_cfg_pvid' => 'ALTEON_CHEETAH_SWITCH_MIB__agPortCurCfgPVID',
'old_ag_p_cfg_fe_auto' => 'ALTEON_TS_PHYSICAL_MIB__agPortCurCfgFastEthAutoNeg', 'old_ag_p_cfg_fe_auto' =>
'new_ag_p_cfg_fe_auto' => 'ALTEON_CHEETAH_SWITCH_MIB__agPortCurCfgFastEthAutoNeg', 'ALTEON_TS_PHYSICAL_MIB__agPortCurCfgFastEthAutoNeg',
'old_ag_p_cfg_fe_mode' => 'ALTEON_TS_PHYSICAL_MIB__agPortCurCfgFastEthMode', 'new_ag_p_cfg_fe_auto' =>
'new_ag_p_cfg_fe_mode' => 'ALTEON_CHEETAH_SWITCH_MIB__agPortCurCfgFastEthMode', 'ALTEON_CHEETAH_SWITCH_MIB__agPortCurCfgFastEthAutoNeg',
'old_ag_p_cfg_ge_auto' => 'ALTEON_TS_PHYSICAL_MIB__agPortCurCfgGigEthAutoNeg', 'old_ag_p_cfg_fe_mode' =>
'new_ag_p_cfg_ge_auto' => 'ALTEON_CHEETAH_SWITCH_MIB__agPortCurCfgGigEthAutoNeg', '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', 'old_ag_p_cfg_name' => 'ALTEON_TS_PHYSICAL_MIB__agPortCurCfgPortName',
'new_ag_p_cfg_name' => 'ALTEON_CHEETAH_SWITCH_MIB__agPortCurCfgPortName', 'new_ag_p_cfg_name' => 'ALTEON_CHEETAH_SWITCH_MIB__agPortCurCfgPortName',
# From portInfoTable # From portInfoTable
'old_p_info_idx' => 'ALTEON_TS_PHYSICAL_MIB__portInfoIndx', 'old_p_info_idx' => 'ALTEON_TS_PHYSICAL_MIB__portInfoIndx',
'new_p_info_idx' => 'ALTEON_CHEETAH_SWITCH_MIB__portInfoIndx', 'new_p_info_idx' => 'ALTEON_CHEETAH_SWITCH_MIB__portInfoIndx',
'old_p_info_mode' => 'ALTEON_TS_PHYSICAL_MIB__portInfoMode', 'old_p_info_mode' => 'ALTEON_TS_PHYSICAL_MIB__portInfoMode',
'new_p_info_mode' => 'ALTEON_CHEETAH_SWITCH_MIB__portInfoMode', 'new_p_info_mode' => 'ALTEON_CHEETAH_SWITCH_MIB__portInfoMode',
# From ipCurCfgIntfTable # From ipCurCfgIntfTable
'old_ip_cfg_vlan' => 'ALTEON_TS_NETWORK_MIB__ipCurCfgIntfVlan', 'old_ip_cfg_vlan' => 'ALTEON_TS_NETWORK_MIB__ipCurCfgIntfVlan',
'new_ip_cfg_vlan' => 'ALTEON_CHEETAH_NETWORK_MIB__ipCurCfgIntfVlan', 'new_ip_cfg_vlan' => 'ALTEON_CHEETAH_NETWORK_MIB__ipCurCfgIntfVlan',
# From vlanCurCfgTable # From vlanCurCfgTable
'old_vlan_id' => 'ALTEON_TS_PHYSICAL_MIB__vlanCurCfgVlanId', 'old_vlan_id' => 'ALTEON_TS_PHYSICAL_MIB__vlanCurCfgVlanId',
'new_vlan_id' => 'ALTEON_CS_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', 'new_vlan_name' => 'ALTEON_CS_PHYSICAL_MIB__vlanCurCfgVlanName',
'old_vlan_ports' => 'ALTEON_TS_PHYSICAL_MIB__vlanCurCfgPorts', 'old_vlan_ports' => 'ALTEON_TS_PHYSICAL_MIB__vlanCurCfgPorts',
'new_vlan_ports' => 'ALTEON_CS_PHYSICAL_MIB__vlanCurCfgPorts', 'new_vlan_ports' => 'ALTEON_CS_PHYSICAL_MIB__vlanCurCfgPorts',
); );
%MUNGE = ( %MUNGE = ( %SNMP::Info::Layer3::MUNGE, );
%SNMP::Info::Layer3::MUNGE,
);
sub model { sub model {
my $alteon = shift; my $alteon = shift;
my $id = $alteon->id(); my $id = $alteon->id();
unless (defined $id){ unless ( defined $id ) {
print " SNMP::Info::Layer3::AlteonAD::model() - Device does not support sysObjectID\n" if $alteon->debug(); print
" SNMP::Info::Layer3::AlteonAD::model() - Device does not support sysObjectID\n"
if $alteon->debug();
return; return;
} }
@@ -152,17 +162,18 @@ sub interfaces {
my $ip_max = $alteon->new_ip_max() || $alteon->old_ip_max(); my $ip_max = $alteon->new_ip_max() || $alteon->old_ip_max();
my %interfaces = (); my %interfaces = ();
foreach my $iid (keys %$interfaces){ foreach my $iid ( keys %$interfaces ) {
my $desc = $descriptions->{$iid}; my $desc = $descriptions->{$iid};
next unless defined $desc; next unless defined $desc;
if ($desc =~ /(^net\d+)/) { if ( $desc =~ /(^net\d+)/ ) {
$desc = $1; $desc = $1;
} }
# IP interfaces are first followed by physical, number possible # IP interfaces are first followed by physical, number possible
# varies by switch model # varies by switch model
elsif (defined $ip_max and $iid > $ip_max ) { elsif ( defined $ip_max and $iid > $ip_max ) {
$desc = ($iid % $ip_max); $desc = ( $iid % $ip_max );
} }
$interfaces{$iid} = $desc; $interfaces{$iid} = $desc;
} }
@@ -172,11 +183,13 @@ sub interfaces {
sub i_duplex { sub i_duplex {
my $alteon = shift; 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 $ip_max = $alteon->new_ip_max() || $alteon->old_ip_max();
my %i_duplex; my %i_duplex;
foreach my $if (keys %$p_mode){ foreach my $if ( keys %$p_mode ) {
my $duplex = $p_mode->{$if}; my $duplex = $p_mode->{$if};
next unless defined $duplex; next unless defined $duplex;
@@ -184,9 +197,9 @@ sub i_duplex {
$duplex = 'full' if $duplex =~ /full/i; $duplex = 'full' if $duplex =~ /full/i;
my $idx; 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; return \%i_duplex;
} }
@@ -194,35 +207,45 @@ sub i_duplex {
sub i_duplex_admin { sub i_duplex_admin {
my $alteon = shift; my $alteon = shift;
my $ag_pref = $alteon->new_ag_p_cfg_pref() || $alteon->old_ag_p_cfg_pref() || {}; my $ag_pref = $alteon->new_ag_p_cfg_pref()
my $ag_fe_auto = $alteon->new_ag_p_cfg_fe_auto() || $alteon->old_ag_p_cfg_fe_auto() || {}; || $alteon->old_ag_p_cfg_pref()
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_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 $ip_max = $alteon->new_ip_max() || $alteon->old_ip_max();
my %i_duplex_admin; my %i_duplex_admin;
foreach my $if (keys %$ag_pref){ foreach my $if ( keys %$ag_pref ) {
my $pref = $ag_pref->{$if}; my $pref = $ag_pref->{$if};
next unless defined $pref; next unless defined $pref;
my $string = 'other'; my $string = 'other';
if ($pref =~ /gigabit/i) { if ( $pref =~ /gigabit/i ) {
my $ge_auto = $ag_ge_auto->{$if}; my $ge_auto = $ag_ge_auto->{$if};
$string = 'full' if ($ge_auto =~ /off/i); $string = 'full' if ( $ge_auto =~ /off/i );
$string = 'auto' if ($ge_auto =~ /on/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_auto = $ag_fe_auto->{$if};
my $fe_mode = $ag_fe_mode->{$if}; my $fe_mode = $ag_fe_mode->{$if};
$string = 'half' if ($fe_mode =~ /half/i and $fe_auto =~ /off/i); $string = 'half'
$string = 'full' if ($fe_mode =~ /full/i and $fe_auto =~ /off/i); 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; $string = 'auto' if $fe_auto =~ /on/i;
} }
my $idx; 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; return \%i_duplex_admin;
} }
@@ -230,15 +253,17 @@ sub i_duplex_admin {
sub i_name { sub i_name {
my $alteon = shift; 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 $ip_max = $alteon->new_ip_max() || $alteon->old_ip_max();
my %i_name; my %i_name;
foreach my $iid (keys %$p_name){ foreach my $iid ( keys %$p_name ) {
my $name = $p_name->{$iid}; my $name = $p_name->{$iid};
next unless defined $name; next unless defined $name;
my $idx; my $idx;
$idx = $iid + $ip_max if (defined $ip_max); $idx = $iid + $ip_max if ( defined $ip_max );
$i_name{$idx} = $name; $i_name{$idx} = $name;
} }
return \%i_name; return \%i_name;
@@ -255,30 +280,35 @@ sub v_name {
my $alteon = shift; my $alteon = shift;
my $partial = 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 { sub i_vlan {
my $alteon = shift; my $alteon = shift;
my $ag_vlans = $alteon->new_ag_p_cfg_pvid() || $alteon->old_ag_p_cfg_pvid() || {}; my $ag_vlans = $alteon->new_ag_p_cfg_pvid()
my $ip_vlans = $alteon->new_ip_cfg_vlan() || $alteon->old_ip_cfg_vlan() || {}; || $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 $ip_max = $alteon->new_ip_max() || $alteon->old_ip_max();
my %i_vlan; my %i_vlan;
foreach my $if (keys %$ip_vlans){ foreach my $if ( keys %$ip_vlans ) {
my $ip_vlanid = $ip_vlans->{$if}; my $ip_vlanid = $ip_vlans->{$if};
next unless defined $ip_vlanid; 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}; my $ag_vlanid = $ag_vlans->{$if};
next unless defined $ag_vlanid; next unless defined $ag_vlanid;
my $idx; my $idx;
$idx = $if + $ip_max if (defined $ip_max); $idx = $if + $ip_max if ( defined $ip_max );
$i_vlan{$idx}=$ag_vlanid; $i_vlan{$idx} = $ag_vlanid;
} }
return \%i_vlan; return \%i_vlan;
} }
@@ -286,24 +316,26 @@ sub i_vlan {
sub i_vlan_membership { sub i_vlan_membership {
my $alteon = shift; 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 $ip_max = $alteon->new_ip_max() || $alteon->old_ip_max();
my $i_vlan_membership = {}; my $i_vlan_membership = {};
foreach my $vlan (keys %$v_ports) { foreach my $vlan ( keys %$v_ports ) {
my $portlist = [split(//, unpack("B*", $v_ports->{$vlan}))]; my $portlist = [ split( //, unpack( "B*", $v_ports->{$vlan} ) ) ];
my $ret = []; my $ret = [];
# Convert portlist bit array to ifIndex array # 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; my $idx;
$idx = $i + $ip_max if (defined $ip_max); $idx = $i + $ip_max if ( defined $ip_max );
push(@{$ret}, $idx) if (@$portlist[$i]); push( @{$ret}, $idx ) if ( @$portlist[$i] );
} }
#Create HoA ifIndex -> VLAN array #Create HoA ifIndex -> VLAN array
foreach my $port (@{$ret}) { foreach my $port ( @{$ret} ) {
push(@{$i_vlan_membership->{$port}}, $vlan); push( @{ $i_vlan_membership->{$port} }, $vlan );
} }
} }
return $i_vlan_membership; return $i_vlan_membership;
@@ -318,10 +350,10 @@ sub bp_index {
my $ip_max = $alteon->new_ip_max() || $alteon->old_ip_max(); my $ip_max = $alteon->new_ip_max() || $alteon->old_ip_max();
my %bp_index; my %bp_index;
foreach my $iid (keys %$b_index){ foreach my $iid ( keys %$b_index ) {
my $port = $b_index->{$iid}; my $port = $b_index->{$iid};
next unless defined $port; 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; $bp_index{$iid} = $port;
} }
@@ -357,8 +389,8 @@ Eric Miller
=head1 DESCRIPTION =head1 DESCRIPTION
Abstraction subclass for Nortel Alteon Series Layer 2-7 load balancing switches Abstraction subclass for Nortel Alteon Series Layer 2-7 load balancing
and Nortel BladeCenter Layer2-3 GbE Switch Modules. switches and Nortel BladeCenter Layer2-3 GbE Switch Modules.
For speed or debugging purposes you can call the subclass directly, but not For speed or debugging purposes you can call the subclass directly, but not
after determining a more specific class using the method above. 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::CiscoPower;
use SNMP::Info::Layer3; 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::CDP SNMP::Info::CiscoStats
SNMP::Info::CiscoPortSecurity SNMP::Info::CiscoPortSecurity
SNMP::Info::CiscoImage SNMP::Info::CiscoPower SNMP::Info::CiscoImage SNMP::Info::CiscoPower
@@ -50,20 +51,16 @@ use SNMP::Info::Layer3;
Exporter/; Exporter/;
@SNMP::Info::Layer3::C3550::EXPORT_OK = qw//; @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'; $VERSION = '1.09';
%MIBS = ( %MIBS = (
%SNMP::Info::Layer3::MIBS, %SNMP::Info::Layer3::MIBS, %SNMP::Info::CiscoPower::MIBS,
%SNMP::Info::CiscoPower::MIBS, %SNMP::Info::CiscoPortSecurity::MIBS, %SNMP::Info::CiscoImage::MIBS,
%SNMP::Info::CiscoPortSecurity::MIBS, %SNMP::Info::CiscoStats::MIBS, %SNMP::Info::CDP::MIBS,
%SNMP::Info::CiscoImage::MIBS, %SNMP::Info::CiscoStack::MIBS, %SNMP::Info::CiscoVTP::MIBS,
%SNMP::Info::CiscoStats::MIBS, );
%SNMP::Info::CDP::MIBS,
%SNMP::Info::CiscoStack::MIBS,
%SNMP::Info::CiscoVTP::MIBS,
);
%GLOBALS = ( %GLOBALS = (
%SNMP::Info::Layer3::GLOBALS, %SNMP::Info::Layer3::GLOBALS,
@@ -75,20 +72,17 @@ $VERSION = '1.09';
%SNMP::Info::CiscoStack::GLOBALS, %SNMP::Info::CiscoStack::GLOBALS,
%SNMP::Info::CiscoVTP::GLOBALS, %SNMP::Info::CiscoVTP::GLOBALS,
'ports2' => 'ifNumber', 'ports2' => 'ifNumber',
); );
%FUNCS = ( %FUNCS = (
%SNMP::Info::Layer3::FUNCS, %SNMP::Info::Layer3::FUNCS, %SNMP::Info::CiscoPower::FUNCS,
%SNMP::Info::CiscoPower::FUNCS, %SNMP::Info::CiscoPortSecurity::FUNCS, %SNMP::Info::CiscoImage::FUNCS,
%SNMP::Info::CiscoPortSecurity::FUNCS, %SNMP::Info::CiscoStats::FUNCS, %SNMP::Info::CDP::FUNCS,
%SNMP::Info::CiscoImage::FUNCS, %SNMP::Info::CiscoStack::FUNCS, %SNMP::Info::CiscoVTP::FUNCS,
%SNMP::Info::CiscoStats::FUNCS, );
%SNMP::Info::CDP::FUNCS,
%SNMP::Info::CiscoStack::FUNCS,
%SNMP::Info::CiscoVTP::FUNCS,
);
%MUNGE = ( %MUNGE = (
# Inherit all the built in munging # Inherit all the built in munging
%SNMP::Info::Layer3::MUNGE, %SNMP::Info::Layer3::MUNGE,
%SNMP::Info::CiscoPower::MUNGE, %SNMP::Info::CiscoPower::MUNGE,
@@ -98,7 +92,7 @@ $VERSION = '1.09';
%SNMP::Info::CDP::MUNGE, %SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoStack::MUNGE, %SNMP::Info::CiscoStack::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE, %SNMP::Info::CiscoVTP::MUNGE,
); );
sub vendor { sub vendor {
return 'cisco'; return 'cisco';
@@ -111,7 +105,7 @@ sub model {
$model =~ s/^catalyst//; $model =~ s/^catalyst//;
# turn 355048 into 3550-48 # 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"; $model = "$1-$2";
} }
return $model; return $model;
@@ -125,7 +119,7 @@ sub ports {
my $id = $c3550->id(); my $id = $c3550->id();
my $model = &SNMP::translateObj($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 $1;
} }
return $ports2; return $ports2;
@@ -142,9 +136,9 @@ sub i_duplex {
my $el_duplex = $c3550->el_duplex($partial); my $el_duplex = $c3550->el_duplex($partial);
# Newer software # Newer software
if (defined $el_duplex and scalar(keys %$el_duplex)){ if ( defined $el_duplex and scalar( keys %$el_duplex ) ) {
my %i_duplex; my %i_duplex;
foreach my $el_port (keys %$el_duplex){ foreach my $el_port ( keys %$el_duplex ) {
my $duplex = $el_duplex->{$el_port}; my $duplex = $el_duplex->{$el_port};
next unless defined $duplex; next unless defined $duplex;
@@ -153,6 +147,7 @@ sub i_duplex {
} }
return \%i_duplex; return \%i_duplex;
} }
# Fall back to CiscoStack method # Fall back to CiscoStack method
else { else {
return $c3550->SUPER::i_duplex($partial); return $c3550->SUPER::i_duplex($partial);
@@ -168,20 +163,21 @@ sub i_duplex_admin {
my $el_duplex = $c3550->el_duplex($partial); my $el_duplex = $c3550->el_duplex($partial);
# Newer software # 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_port = $c3550->p_port() || {};
my $p_duplex = $c3550->p_duplex() || {}; my $p_duplex = $c3550->p_duplex() || {};
my $i_duplex_admin = {}; my $i_duplex_admin = {};
foreach my $port (keys %$p_duplex) { foreach my $port ( keys %$p_duplex ) {
my $iid = $p_port->{$port}; my $iid = $p_port->{$port};
next unless defined $iid; 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}; $i_duplex_admin->{$iid} = $p_duplex->{$port};
} }
return $i_duplex_admin; return $i_duplex_admin;
} }
# Fall back to CiscoStack method # Fall back to CiscoStack method
else { else {
return $c3550->SUPER::i_duplex_admin($partial); return $c3550->SUPER::i_duplex_admin($partial);
@@ -189,16 +185,17 @@ sub i_duplex_admin {
} }
sub set_i_duplex_admin { sub set_i_duplex_admin {
# map a textual duplex to an integer one the switch understands # map a textual duplex to an integer one the switch understands
my %duplexes = qw/half 1 full 2 auto 4/; my %duplexes = qw/half 1 full 2 auto 4/;
my $c3550 = shift; my $c3550 = shift;
my ($duplex, $iid) = @_; my ( $duplex, $iid ) = @_;
my $el_duplex = $c3550->el_duplex($iid); my $el_duplex = $c3550->el_duplex($iid);
# Auto duplex only supported on newer software # 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 $p_port = $c3550->p_port() || {};
my %reverse_p_port = reverse %$p_port; my %reverse_p_port = reverse %$p_port;
@@ -208,7 +205,7 @@ sub set_i_duplex_admin {
$iid = $reverse_p_port{$iid}; $iid = $reverse_p_port{$iid};
return $c3550->set_p_duplex($duplexes{$duplex}, $iid); return $c3550->set_p_duplex( $duplexes{$duplex}, $iid );
} }
else { else {
return $c3550->SUPER::set_i_duplex_admin; return $c3550->SUPER::set_i_duplex_admin;
@@ -315,7 +312,7 @@ These are methods that return scalar value from SNMP
=item $c3550->vendor() =item $c3550->vendor()
Returns 'cisco' Returns 'cisco'
=item $c3550->model() =item $c3550->model()

View File

@@ -48,7 +48,7 @@ use SNMP::Info::Layer3;
SNMP::Info::Layer3 Exporter/; SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::C4000::EXPORT_OK = qw//; @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'; $VERSION = '1.09';
@@ -62,7 +62,7 @@ $VERSION = '1.09';
%SNMP::Info::CDP::MIBS, %SNMP::Info::CDP::MIBS,
%SNMP::Info::CiscoVTP::MIBS, %SNMP::Info::CiscoVTP::MIBS,
'CISCO-ENVMON-MIB' => 'ciscoEnvMonMIB', 'CISCO-ENVMON-MIB' => 'ciscoEnvMonMIB',
); );
%GLOBALS = ( %GLOBALS = (
%SNMP::Info::Layer3::GLOBALS, %SNMP::Info::Layer3::GLOBALS,
@@ -77,7 +77,7 @@ $VERSION = '1.09';
'ps1_status' => 'ciscoEnvMonSupplyState.1', 'ps1_status' => 'ciscoEnvMonSupplyState.1',
'ps2_type' => 'ciscoEnvMonSupplyStatusDescr.2', 'ps2_type' => 'ciscoEnvMonSupplyStatusDescr.2',
'ps2_status' => 'ciscoEnvMonSupplyState.2', 'ps2_status' => 'ciscoEnvMonSupplyState.2',
); );
%FUNCS = ( %FUNCS = (
%SNMP::Info::Layer3::FUNCS, %SNMP::Info::Layer3::FUNCS,
@@ -90,23 +90,21 @@ $VERSION = '1.09';
%SNMP::Info::CiscoVTP::FUNCS, %SNMP::Info::CiscoVTP::FUNCS,
'fan_state' => 'ciscoEnvMonFanState', 'fan_state' => 'ciscoEnvMonFanState',
'fan_descr' => 'ciscoEnvMonFanStatusDescr', 'fan_descr' => 'ciscoEnvMonFanStatusDescr',
); );
%MUNGE = ( %MUNGE = (
%SNMP::Info::Layer3::MUNGE, %SNMP::Info::Layer3::MUNGE, %SNMP::Info::MAU::MUNGE,
%SNMP::Info::MAU::MUNGE, %SNMP::Info::CiscoConfig::MUNGE, %SNMP::Info::CiscoPortSecurity::MUNGE,
%SNMP::Info::CiscoConfig::MUNGE, %SNMP::Info::CiscoImage::MUNGE, %SNMP::Info::CiscoStats::MUNGE,
%SNMP::Info::CiscoPortSecurity::MUNGE, %SNMP::Info::CDP::MUNGE, %SNMP::Info::CiscoVTP::MUNGE,
%SNMP::Info::CiscoImage::MUNGE, );
%SNMP::Info::CiscoStats::MUNGE,
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE,
);
# Override Inheritance for these specific methods # Override Inheritance for these specific methods
# use MAU-MIB for admin. duplex and admin. speed # 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_duplex_admin
*SNMP::Info::Layer3::C4000::i_speed_admin = \&SNMP::Info::MAU::mau_i_speed_admin; = \&SNMP::Info::MAU::mau_i_duplex_admin;
*SNMP::Info::Layer3::C4000::i_speed_admin
= \&SNMP::Info::MAU::mau_i_speed_admin;
sub fan { sub fan {
my $c4000 = shift; my $c4000 = shift;
@@ -114,11 +112,11 @@ sub fan {
my $fan_descr = $c4000->fan_descr(); my $fan_descr = $c4000->fan_descr();
my $ret = ""; my $ret = "";
my $s = ""; 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}; $ret .= $s . $fan_descr->{$i} . ": " . $fan_state->{$i};
$s = ", "; $s = ", ";
} }
return if ($s eq ""); return if ( $s eq "" );
return $ret; return $ret;
} }

View File

@@ -42,7 +42,8 @@ use SNMP::Info::CiscoConfig;
use SNMP::Info::CiscoPower; use SNMP::Info::CiscoPower;
use SNMP::Info::Layer3; 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::CDP SNMP::Info::CiscoStats
SNMP::Info::CiscoImage SNMP::Info::CiscoImage
SNMP::Info::CiscoPortSecurity SNMP::Info::CiscoPortSecurity
@@ -52,21 +53,17 @@ use SNMP::Info::Layer3;
Exporter/; Exporter/;
@SNMP::Info::Layer3::C6500::EXPORT_OK = qw//; @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'; $VERSION = '1.09';
%MIBS = ( %MIBS = (
%SNMP::Info::Layer3::MIBS, %SNMP::Info::Layer3::MIBS, %SNMP::Info::CiscoPower::MIBS,
%SNMP::Info::CiscoPower::MIBS, %SNMP::Info::CiscoConfig::MIBS, %SNMP::Info::CiscoPortSecurity::MIBS,
%SNMP::Info::CiscoConfig::MIBS, %SNMP::Info::CiscoImage::MIBS, %SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::CiscoPortSecurity::MIBS, %SNMP::Info::CDP::MIBS, %SNMP::Info::CiscoStack::MIBS,
%SNMP::Info::CiscoImage::MIBS,
%SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::CDP::MIBS,
%SNMP::Info::CiscoStack::MIBS,
%SNMP::Info::CiscoVTP::MIBS, %SNMP::Info::CiscoVTP::MIBS,
); );
%GLOBALS = ( %GLOBALS = (
%SNMP::Info::Layer3::GLOBALS, %SNMP::Info::Layer3::GLOBALS,
@@ -78,31 +75,23 @@ $VERSION = '1.09';
%SNMP::Info::CDP::GLOBALS, %SNMP::Info::CDP::GLOBALS,
%SNMP::Info::CiscoStack::GLOBALS, %SNMP::Info::CiscoStack::GLOBALS,
%SNMP::Info::CiscoVTP::GLOBALS, %SNMP::Info::CiscoVTP::GLOBALS,
); );
%FUNCS = ( %FUNCS = (
%SNMP::Info::Layer3::FUNCS, %SNMP::Info::Layer3::FUNCS, %SNMP::Info::CiscoPower::FUNCS,
%SNMP::Info::CiscoPower::FUNCS, %SNMP::Info::CiscoConfig::FUNCS, %SNMP::Info::CiscoPortSecurity::FUNCS,
%SNMP::Info::CiscoConfig::FUNCS, %SNMP::Info::CiscoImage::FUNCS, %SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::CiscoPortSecurity::FUNCS, %SNMP::Info::CDP::FUNCS, %SNMP::Info::CiscoStack::FUNCS,
%SNMP::Info::CiscoImage::FUNCS,
%SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::CDP::FUNCS,
%SNMP::Info::CiscoStack::FUNCS,
%SNMP::Info::CiscoVTP::FUNCS, %SNMP::Info::CiscoVTP::FUNCS,
); );
%MUNGE = ( %MUNGE = (
%SNMP::Info::Layer3::MUNGE, %SNMP::Info::Layer3::MUNGE, %SNMP::Info::CiscoPower::MUNGE,
%SNMP::Info::CiscoPower::MUNGE, %SNMP::Info::CiscoConfig::MUNGE, %SNMP::Info::CiscoPortSecurity::MUNGE,
%SNMP::Info::CiscoConfig::MUNGE, %SNMP::Info::CiscoImage::MUNGE, %SNMP::Info::CiscoStats::MUNGE,
%SNMP::Info::CiscoPortSecurity::MUNGE, %SNMP::Info::CDP::MUNGE, %SNMP::Info::CiscoStack::MUNGE,
%SNMP::Info::CiscoImage::MUNGE,
%SNMP::Info::CiscoStats::MUNGE,
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoStack::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE, %SNMP::Info::CiscoVTP::MUNGE,
); );
sub vendor { sub vendor {
return 'cisco'; return 'cisco';
@@ -119,9 +108,9 @@ sub i_duplex {
my $el_duplex = $c6500->el_duplex($partial); my $el_duplex = $c6500->el_duplex($partial);
# Newer software # Newer software
if (defined $el_duplex and scalar(keys %$el_duplex)){ if ( defined $el_duplex and scalar( keys %$el_duplex ) ) {
my %i_duplex; my %i_duplex;
foreach my $el_port (keys %$el_duplex){ foreach my $el_port ( keys %$el_duplex ) {
my $duplex = $el_duplex->{$el_port}; my $duplex = $el_duplex->{$el_port};
next unless defined $duplex; next unless defined $duplex;
@@ -130,6 +119,7 @@ sub i_duplex {
} }
return \%i_duplex; return \%i_duplex;
} }
# Fall back to CiscoStack method # Fall back to CiscoStack method
else { else {
return $c6500->SUPER::i_duplex($partial); return $c6500->SUPER::i_duplex($partial);
@@ -145,20 +135,21 @@ sub i_duplex_admin {
my $el_duplex = $c6500->el_duplex($partial); my $el_duplex = $c6500->el_duplex($partial);
# Newer software # 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_port = $c6500->p_port() || {};
my $p_duplex = $c6500->p_duplex() || {}; my $p_duplex = $c6500->p_duplex() || {};
my $i_duplex_admin = {}; my $i_duplex_admin = {};
foreach my $port (keys %$p_duplex) { foreach my $port ( keys %$p_duplex ) {
my $iid = $p_port->{$port}; my $iid = $p_port->{$port};
next unless defined $iid; 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}; $i_duplex_admin->{$iid} = $p_duplex->{$port};
} }
return $i_duplex_admin; return $i_duplex_admin;
} }
# Fall back to CiscoStack method # Fall back to CiscoStack method
else { else {
return $c6500->SUPER::i_duplex_admin($partial); return $c6500->SUPER::i_duplex_admin($partial);
@@ -166,16 +157,17 @@ sub i_duplex_admin {
} }
sub set_i_duplex_admin { sub set_i_duplex_admin {
# map a textual duplex to an integer one the switch understands # map a textual duplex to an integer one the switch understands
my %duplexes = qw/half 1 full 2 auto 4/; my %duplexes = qw/half 1 full 2 auto 4/;
my $c6500 = shift; my $c6500 = shift;
my ($duplex, $iid) = @_; my ( $duplex, $iid ) = @_;
my $el_duplex = $c6500->el_duplex($iid); my $el_duplex = $c6500->el_duplex($iid);
# Auto duplex only supported on newer software # 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 $p_port = $c6500->p_port() || {};
my %reverse_p_port = reverse %$p_port; my %reverse_p_port = reverse %$p_port;
@@ -185,7 +177,7 @@ sub set_i_duplex_admin {
$iid = $reverse_p_port{$iid}; $iid = $reverse_p_port{$iid};
return $c6500->set_p_duplex($duplexes{$duplex}, $iid); return $c6500->set_p_duplex( $duplexes{$duplex}, $iid );
} }
else { else {
return $c6500->SUPER::set_i_duplex_admin; return $c6500->SUPER::set_i_duplex_admin;
@@ -224,9 +216,9 @@ Max Baker
Abstraction subclass for Cisco Catalyst 6500 Layer 2/3 Switches. Abstraction subclass for Cisco Catalyst 6500 Layer 2/3 Switches.
These devices run IOS but have some of the same characteristics as the Catalyst These devices run IOS but have some of the same characteristics as the
WS-C family (5xxx). For example, forwarding tables are held in VLANs, and Catalyst WS-C family (5xxx). For example, forwarding tables are held in
extended interface information is gleaned from F<CISCO-SWITCH-MIB>. 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 For speed or debugging purposes you can call the subclass directly, but not
after determining a more specific class using the method above. 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::CDP::MIBS,
%SNMP::Info::CiscoVTP::MIBS, %SNMP::Info::CiscoVTP::MIBS,
'CISCO-EIGRP-MIB' => 'cEigrpAsRouterId', 'CISCO-EIGRP-MIB' => 'cEigrpAsRouterId',
); );
%GLOBALS = ( %GLOBALS = (
%SNMP::Info::Layer3::GLOBALS, %SNMP::Info::Layer3::GLOBALS, %SNMP::Info::CiscoPower::GLOBALS,
%SNMP::Info::CiscoPower::GLOBALS, %SNMP::Info::CiscoConfig::GLOBALS, %SNMP::Info::CiscoQOS::GLOBALS,
%SNMP::Info::CiscoConfig::GLOBALS, %SNMP::Info::CiscoRTT::GLOBALS, %SNMP::Info::CiscoImage::GLOBALS,
%SNMP::Info::CiscoQOS::GLOBALS, %SNMP::Info::CiscoStats::GLOBALS, %SNMP::Info::CDP::GLOBALS,
%SNMP::Info::CiscoRTT::GLOBALS, %SNMP::Info::CiscoVTP::GLOBALS, 'eigrp_id' => 'cEigrpAsRouterId',
%SNMP::Info::CiscoImage::GLOBALS, );
%SNMP::Info::CiscoStats::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
%SNMP::Info::CiscoVTP::GLOBALS,
'eigrp_id' => 'cEigrpAsRouterId',
);
%FUNCS = ( %FUNCS = (
%SNMP::Info::Layer3::FUNCS, %SNMP::Info::Layer3::FUNCS,
@@ -90,9 +85,10 @@ $VERSION = '1.09';
%SNMP::Info::CiscoStats::FUNCS, %SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::CDP::FUNCS, %SNMP::Info::CDP::FUNCS,
%SNMP::Info::CiscoVTP::FUNCS, %SNMP::Info::CiscoVTP::FUNCS,
# EIGRP # EIGRP
'eigrp_peers' => 'cEigrpPeerAddr', 'eigrp_peers' => 'cEigrpPeerAddr',
); );
%MUNGE = ( %MUNGE = (
%SNMP::Info::Layer3::MUNGE, %SNMP::Info::Layer3::MUNGE,
@@ -105,7 +101,7 @@ $VERSION = '1.09';
%SNMP::Info::CDP::MUNGE, %SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE, %SNMP::Info::CiscoVTP::MUNGE,
'eigrp_peers' => \&SNMP::Info::munge_ip, 'eigrp_peers' => \&SNMP::Info::munge_ip,
); );
sub i_vlan { sub i_vlan {
my ($cisco) = shift; my ($cisco) = shift;
@@ -115,9 +111,9 @@ sub i_vlan {
my ($i_descr) = $cisco->i_description($partial); my ($i_descr) = $cisco->i_description($partial);
my %i_vlan; my %i_vlan;
foreach my $idx (keys %$i_descr) { foreach my $idx ( keys %$i_descr ) {
if ($i_type->{$idx} eq 'l2vlan' || $i_type->{$idx} eq 135) { if ( $i_type->{$idx} eq 'l2vlan' || $i_type->{$idx} eq 135 ) {
if ($i_descr->{$idx} =~ /\.(\d+)$/) { if ( $i_descr->{$idx} =~ /\.(\d+)$/ ) {
$i_vlan{$idx} = $1; $i_vlan{$idx} = $1;
} }
} }

View File

@@ -36,7 +36,8 @@ use SNMP::Info;
use SNMP::Info::Layer3; use SNMP::Info::Layer3;
use SNMP::Info::Entity; 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//; @SNMP::Info::Layer3::Contivity::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/; use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
@@ -44,28 +45,23 @@ use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
$VERSION = '1.09'; $VERSION = '1.09';
%MIBS = ( %MIBS = (
%SNMP::Info::MIBS, %SNMP::Info::MIBS, %SNMP::Info::Layer3::MIBS, %SNMP::Info::Entity::MIBS,
%SNMP::Info::Layer3::MIBS, );
%SNMP::Info::Entity::MIBS,
);
%GLOBALS = ( %GLOBALS = (
%SNMP::Info::GLOBALS, %SNMP::Info::GLOBALS, %SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::Entity::GLOBALS, %SNMP::Info::Entity::GLOBALS,
); );
%FUNCS = ( %FUNCS = (
%SNMP::Info::FUNCS, %SNMP::Info::FUNCS, %SNMP::Info::Layer3::FUNCS,
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::Entity::FUNCS, %SNMP::Info::Entity::FUNCS,
); );
%MUNGE = ( %MUNGE = (
%SNMP::Info::MUNGE, %SNMP::Info::MUNGE, %SNMP::Info::Layer3::MUNGE,
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::Entity::MUNGE, %SNMP::Info::Entity::MUNGE,
); );
sub layers { sub layers {
return '00000100'; return '00000100';
@@ -81,7 +77,7 @@ sub model {
my $model = $e_model->{1} || undef; 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; return;
} }
@@ -94,7 +90,7 @@ sub os_ver {
my $descr = $contivity->description(); my $descr = $contivity->description();
return unless defined $descr; return unless defined $descr;
if ($descr =~ m/V(\d+_\d+\.\d+)/i){ if ( $descr =~ m/V(\d+_\d+\.\d+)/i ) {
return $1; return $1;
} }
return; return;
@@ -104,8 +100,8 @@ sub mac {
my $contivity = shift; my $contivity = shift;
my $i_mac = $contivity->i_mac(); my $i_mac = $contivity->i_mac();
# Return Interface MAC # Return Interface MAC
foreach my $entry (keys %$i_mac){ foreach my $entry ( keys %$i_mac ) {
my $sn = $i_mac->{$entry}; my $sn = $i_mac->{$entry};
next unless $sn; next unless $sn;
return $sn; return $sn;
@@ -119,11 +115,10 @@ sub serial {
my $serial = $e_serial->{1} || undef; my $serial = $e_serial->{1} || undef;
return $1 if (defined $serial and $serial =~ /(\d+)/); return $1 if ( defined $serial and $serial =~ /(\d+)/ );
return; return;
} }
sub interfaces { sub interfaces {
my $contivity = shift; my $contivity = shift;
my $partial = shift; my $partial = shift;
@@ -131,10 +126,11 @@ sub interfaces {
my $description = $contivity->i_description($partial) || {}; my $description = $contivity->i_description($partial) || {};
my %interfaces = (); my %interfaces = ();
foreach my $iid (keys %$description){ foreach my $iid ( keys %$description ) {
my $desc = $description->{$iid}; my $desc = $description->{$iid};
# Skip everything except Ethernet interfaces # Skip everything except Ethernet interfaces
next unless (defined $desc and $desc =~ /fe/i); next unless ( defined $desc and $desc =~ /fe/i );
$interfaces{$iid} = $desc; $interfaces{$iid} = $desc;
} }
@@ -148,10 +144,11 @@ sub i_name {
my $i_name2 = $contivity->orig_i_name($partial) || {}; my $i_name2 = $contivity->orig_i_name($partial) || {};
my %i_name; my %i_name;
foreach my $iid (keys %$i_name2){ foreach my $iid ( keys %$i_name2 ) {
my $name = $i_name2->{$iid}; my $name = $i_name2->{$iid};
#Skip everything except Ethernet interfaces #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+)/; $name = $1 if $name =~ /(fei\.\d+\.\d+)/;
@@ -165,8 +162,8 @@ __END__
=head1 NAME =head1 NAME
SNMP::Info::Layer3::Contivity - SNMP Interface to Nortel VPN Routers (Contivity SNMP::Info::Layer3::Contivity - SNMP Interface to Nortel VPN Routers
Extranet Switches). (Contivity Extranet Switches).
=head1 AUTHOR =head1 AUTHOR

View File

@@ -41,21 +41,23 @@ use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
$VERSION = '1.09'; $VERSION = '1.09';
%MIBS = ( %SNMP::Info::Layer3::MIBS, %MIBS = (
%SNMP::Info::Layer3::MIBS,
'RADLAN-Physicaldescription-MIB' => 'rlPhdStackReorder', 'RADLAN-Physicaldescription-MIB' => 'rlPhdStackReorder',
'RADLAN-rlInterfaces' => 'rlIfNumOfLoopbackPorts', 'RADLAN-rlInterfaces' => 'rlIfNumOfLoopbackPorts',
'RADLAN-HWENVIROMENT' => 'rlEnvPhysicalDescription', 'RADLAN-HWENVIROMENT' => 'rlEnvPhysicalDescription',
'Dell-Vendor-MIB' => 'productIdentificationVersion', 'Dell-Vendor-MIB' => 'productIdentificationVersion',
); );
%GLOBALS = ( %GLOBALS = (
%SNMP::Info::Layer3::GLOBALS, %SNMP::Info::Layer3::GLOBALS,
'os_ver' => 'productIdentificationVersion', 'os_ver' => 'productIdentificationVersion',
'dell_id_name' => 'productIdentificationDisplayName', 'dell_id_name' => 'productIdentificationDisplayName',
); );
%FUNCS = ( %FUNCS = (
%SNMP::Info::Layer3::FUNCS, %SNMP::Info::Layer3::FUNCS,
# RADLAN-rlInterfaces:swIfTable # RADLAN-rlInterfaces:swIfTable
'dell_duplex_admin' => 'swIfDuplexAdminMode', 'dell_duplex_admin' => 'swIfDuplexAdminMode',
'dell_duplex' => 'swIfDuplexOperMode', 'dell_duplex' => 'swIfDuplexOperMode',
@@ -65,6 +67,7 @@ $VERSION = '1.09';
'dell_speed_admin' => 'swIfSpeedAdminMode', 'dell_speed_admin' => 'swIfSpeedAdminMode',
'dell_auto' => 'swIfSpeedDuplexAutoNegotiation', 'dell_auto' => 'swIfSpeedDuplexAutoNegotiation',
'dell_fc' => 'swIfOperFlowControlMode', 'dell_fc' => 'swIfOperFlowControlMode',
# RADLAN-Physicaldescription-MIB:rlPhdUnitGenParamTable # RADLAN-Physicaldescription-MIB:rlPhdUnitGenParamTable
'dell_unit' => 'rlPhdUnitGenParamStackUnit', 'dell_unit' => 'rlPhdUnitGenParamStackUnit',
'dell_sw_ver' => 'rlPhdUnitGenParamSoftwareVersion', 'dell_sw_ver' => 'rlPhdUnitGenParamSoftwareVersion',
@@ -72,6 +75,7 @@ $VERSION = '1.09';
'dell_hw_ver' => 'rlPhdUnitGenParamHardwareVersion', 'dell_hw_ver' => 'rlPhdUnitGenParamHardwareVersion',
'dell_serial_no' => 'rlPhdUnitGenParamSerialNum', 'dell_serial_no' => 'rlPhdUnitGenParamSerialNum',
'dell_asset_no' => 'rlPhdUnitGenParamAssetTag', 'dell_asset_no' => 'rlPhdUnitGenParamAssetTag',
# RADLAN-COPY-MIB:rlCopyTable # RADLAN-COPY-MIB:rlCopyTable
'dell_cp_idx' => 'rlCopyIndex', 'dell_cp_idx' => 'rlCopyIndex',
'dell_cp_sloc' => 'rlCopySourceLocation', 'dell_cp_sloc' => 'rlCopySourceLocation',
@@ -87,19 +91,18 @@ $VERSION = '1.09';
'dell_cp_state' => 'rlCopyOperationState', 'dell_cp_state' => 'rlCopyOperationState',
'dell_cp_bkgnd' => 'rlCopyInBackground', 'dell_cp_bkgnd' => 'rlCopyInBackground',
'dell_cp_rstatus' => 'rlCopyRowStatus', 'dell_cp_rstatus' => 'rlCopyRowStatus',
# RADLAN-HWENVIROMENT:rlEnvMonSupplyStatusTable # RADLAN-HWENVIROMENT:rlEnvMonSupplyStatusTable
'dell_pwr_src' => 'rlEnvMonSupplySource', 'dell_pwr_src' => 'rlEnvMonSupplySource',
'dell_pwr_state' => 'rlEnvMonSupplyState', 'dell_pwr_state' => 'rlEnvMonSupplyState',
'dell_pwr_desc' => 'rlEnvMonSupplyStatusDescr', 'dell_pwr_desc' => 'rlEnvMonSupplyStatusDescr',
# RADLAN-HWENVIROMENT:rlEnvMonFanStatusTable # RADLAN-HWENVIROMENT:rlEnvMonFanStatusTable
'dell_fan_state' => 'rlEnvMonFanState', 'dell_fan_state' => 'rlEnvMonFanState',
'dell_fan_desc' => 'rlEnvMonFanStatusDescr', 'dell_fan_desc' => 'rlEnvMonFanStatusDescr',
); );
%MUNGE = ( %SNMP::Info::Layer3::MUNGE, );
%MUNGE = (
%SNMP::Info::Layer3::MUNGE,
);
# Method OverRides # Method OverRides
@@ -109,9 +112,10 @@ sub model {
my $name = $dell->dell_id_name(); my $name = $dell->dell_id_name();
my $descr = $dell->description(); my $descr = $dell->description();
if (defined $name and $name =~ m/(\d+)/){ if ( defined $name and $name =~ m/(\d+)/ ) {
return $1; return $1;
} }
# Don't have a vendor MIB for D-Link # Don't have a vendor MIB for D-Link
else { else {
return $descr; return $descr;
@@ -135,9 +139,9 @@ sub serial {
my $numbers = $dell->dell_serial_no(); my $numbers = $dell->dell_serial_no();
foreach my $key (keys %$numbers){ foreach my $key ( keys %$numbers ) {
my $serial = $numbers->{$key}; my $serial = $numbers->{$key};
return $serial if (defined $serial and $serial !~ /^\s*$/); return $serial if ( defined $serial and $serial !~ /^\s*$/ );
next; next;
} }
@@ -154,7 +158,7 @@ sub interfaces {
# Descriptions are all the same on some Dells, so use name instead if # Descriptions are all the same on some Dells, so use name instead if
# available # available
foreach my $iid (keys %$i_name){ foreach my $iid ( keys %$i_name ) {
my $name = $i_name->{$iid}; my $name = $i_name->{$iid};
next unless defined $name; next unless defined $name;
$i_descr->{$iid} = $name; $i_descr->{$iid} = $name;
@@ -172,15 +176,15 @@ sub i_duplex_admin {
my $dell_auto = $dell->dell_auto($partial) || {}; my $dell_auto = $dell->dell_auto($partial) || {};
my %i_duplex_admin; my %i_duplex_admin;
foreach my $if (keys %$interfaces){ foreach my $if ( keys %$interfaces ) {
my $duplex = $dell_duplex->{$if}; my $duplex = $dell_duplex->{$if};
next unless defined $duplex; 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 = 'half' if ( $duplex =~ /half/i and $auto =~ /false/i );
$duplex = 'full' if ($duplex =~ /half/i and $auto =~ /false/i); $duplex = 'full' if ( $duplex =~ /half/i and $auto =~ /false/i );
$duplex = 'auto' if $auto =~ /true/i; $duplex = 'auto' if $auto =~ /true/i;
$i_duplex_admin{$if}=$duplex; $i_duplex_admin{$if} = $duplex;
} }
return \%i_duplex_admin; return \%i_duplex_admin;
} }
@@ -193,14 +197,14 @@ sub i_duplex_admin {
sub fw_mac { sub fw_mac {
my $dell = shift; my $dell = shift;
my $ret = $dell->qb_fw_mac(); my $ret = $dell->qb_fw_mac();
$ret = $dell->orig_fw_mac() if (!defined($ret)); $ret = $dell->orig_fw_mac() if ( !defined($ret) );
return $ret; return $ret;
} }
sub fw_port { sub fw_port {
my $dell = shift; my $dell = shift;
my $ret = $dell->qb_fw_port(); my $ret = $dell->qb_fw_port();
$ret = $dell->orig_fw_port() if (!defined($ret)); $ret = $dell->orig_fw_port() if ( !defined($ret) );
return $ret; return $ret;
} }
@@ -214,9 +218,9 @@ sub _vendor {
674 => 'dell', 674 => 'dell',
3955 => 'linksys', 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}; return $oidmap{$id};
} }
else { else {
@@ -229,7 +233,8 @@ __END__
=head1 NAME =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 =head1 AUTHOR
@@ -304,8 +309,9 @@ These are methods that return scalar value from SNMP
=item $dell->model() =item $dell->model()
Returns model type. Returns numeric from (C<productIdentificationDisplayName>) Returns model type. Returns numeric from
if available, otherwise if returns description(). (C<productIdentificationDisplayName>) if available, otherwise if returns
description().
=item $dell->vendor() =item $dell->vendor()
@@ -383,13 +389,14 @@ to a hash.
=item $dell->interfaces() =item $dell->interfaces()
Returns the map between SNMP Interface Identifier (iid) and physical port name. Returns the map between SNMP Interface Identifier (iid) and physical port
Uses name if available instead of description since descriptions are name. Uses name if available instead of description since descriptions are
sometimes not unique. sometimes not unique.
=item $dell->i_duplex_admin() =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() =item $dell->fw_mac()

View File

@@ -47,41 +47,35 @@ use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
$VERSION = '1.09'; $VERSION = '1.09';
%MIBS = ( %MIBS = (
%SNMP::Info::Layer3::MIBS, %SNMP::Info::Layer3::MIBS, %SNMP::Info::CDP::MIBS,
%SNMP::Info::CDP::MIBS, %SNMP::Info::LLDP::MIBS, %SNMP::Info::MAU::MIBS,
%SNMP::Info::LLDP::MIBS,
%SNMP::Info::MAU::MIBS,
'ENTERASYS-OIDS-MIB' => 'etsysOidDevice', 'ENTERASYS-OIDS-MIB' => 'etsysOidDevice',
); );
%GLOBALS = ( %GLOBALS = (
%SNMP::Info::Layer3::GLOBALS, %SNMP::Info::Layer3::GLOBALS, %SNMP::Info::CDP::GLOBALS,
%SNMP::Info::CDP::GLOBALS, %SNMP::Info::LLDP::GLOBALS, %SNMP::Info::MAU::GLOBALS,
%SNMP::Info::LLDP::GLOBALS,
%SNMP::Info::MAU::GLOBALS,
'mac' => 'dot1dBaseBridgeAddress', 'mac' => 'dot1dBaseBridgeAddress',
); );
%FUNCS = ( %FUNCS = (
%SNMP::Info::Layer3::FUNCS, %SNMP::Info::Layer3::FUNCS, %SNMP::Info::CDP::FUNCS,
%SNMP::Info::CDP::FUNCS, %SNMP::Info::LLDP::FUNCS, %SNMP::Info::MAU::FUNCS,
%SNMP::Info::LLDP::FUNCS, );
%SNMP::Info::MAU::FUNCS,
);
%MUNGE = ( %MUNGE = (
%SNMP::Info::Layer3::MUNGE, %SNMP::Info::Layer3::MUNGE, %SNMP::Info::CDP::MUNGE,
%SNMP::Info::CDP::MUNGE, %SNMP::Info::LLDP::MUNGE, %SNMP::Info::MAU::MUNGE,
%SNMP::Info::LLDP::MUNGE, );
%SNMP::Info::MAU::MUNGE,
);
sub model { sub model {
my $enterasys = shift; my $enterasys = shift;
my $id = $enterasys->id(); my $id = $enterasys->id();
unless (defined $id){ unless ( defined $id ) {
print " SNMP::Info::Layer3::Enterasys::model() - Device does not support sysObjectID\n" if $enterasys->debug(); print
" SNMP::Info::Layer3::Enterasys::model() - Device does not support sysObjectID\n"
if $enterasys->debug();
return; return;
} }
@@ -107,7 +101,7 @@ sub os_ver {
my $descr = $enterasys->description(); my $descr = $enterasys->description();
return unless defined $descr; return unless defined $descr;
if ($descr =~ m/\bRev ([\d.]*)/){ if ( $descr =~ m/\bRev ([\d.]*)/ ) {
return $1; return $1;
} }
@@ -122,7 +116,8 @@ sub interfaces {
# We need the original ifName, SUPER:: would give us a method definition # 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 # in a higher class, we could use orig_ but just call the MIB leaf since
# that's what we really want anyway. # 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 { sub i_ignore {
@@ -132,8 +127,8 @@ sub i_ignore {
my $interfaces = $enterasys->i_type($partial) || {}; my $interfaces = $enterasys->i_type($partial) || {};
my %i_ignore; my %i_ignore;
foreach my $if (keys %$interfaces) { foreach my $if ( keys %$interfaces ) {
if ($interfaces->{$if} =~ /(rs232|tunnel|loopback|\blo\b|null)/i){ if ( $interfaces->{$if} =~ /(rs232|tunnel|loopback|\blo\b|null)/i ) {
$i_ignore{$if}++; $i_ignore{$if}++;
} }
} }
@@ -172,10 +167,11 @@ sub fw_port {
# Use CDP and/or LLDP # Use CDP and/or LLDP
# #
# LLDP table timefilter implementation continuously increments when walked and # LLDP table timefilter implementation continuously increments when walked
# we may never reach the end of the table. This behavior can be modified with # and we may never reach the end of the table. This behavior can be
# the "set snmp timefilter break disable" command, unfortunately it is not # modified with the "set snmp timefilter break disable" command,
# the default. Query with a partial value of zero which means no time filter. # unfortunately it is not the default. Query with a partial value of zero
# which means no time filter.
sub hasCDP { sub hasCDP {
my $enterasys = shift; my $enterasys = shift;
@@ -191,14 +187,14 @@ sub c_ip {
my $lldp = $enterasys->lldp_ip(0) || {}; my $lldp = $enterasys->lldp_ip(0) || {};
my %c_ip; my %c_ip;
foreach my $iid (keys %$cdp){ foreach my $iid ( keys %$cdp ) {
my $ip = $cdp->{$iid}; my $ip = $cdp->{$iid};
next unless defined $ip; next unless defined $ip;
$c_ip{$iid} = $ip; $c_ip{$iid} = $ip;
} }
foreach my $iid (keys %$lldp){ foreach my $iid ( keys %$lldp ) {
my $ip = $lldp->{$iid}; my $ip = $lldp->{$iid};
next unless defined $ip; next unless defined $ip;
@@ -211,18 +207,18 @@ sub c_if {
my $enterasys = shift; my $enterasys = shift;
my $partial = shift; my $partial = shift;
my $lldp = $enterasys->lldp_if(0) || {};; my $lldp = $enterasys->lldp_if(0) || {};
my $cdp = $enterasys->SUPER::c_if($partial) || {}; my $cdp = $enterasys->SUPER::c_if($partial) || {};
my %c_if; my %c_if;
foreach my $iid (keys %$cdp){ foreach my $iid ( keys %$cdp ) {
my $if = $cdp->{$iid}; my $if = $cdp->{$iid};
next unless defined $if; next unless defined $if;
$c_if{$iid} = $if; $c_if{$iid} = $if;
} }
foreach my $iid (keys %$lldp){ foreach my $iid ( keys %$lldp ) {
my $if = $lldp->{$iid}; my $if = $lldp->{$iid};
next unless defined $if; next unless defined $if;
@@ -239,14 +235,14 @@ sub c_port {
my $cdp = $enterasys->SUPER::c_port($partial) || {}; my $cdp = $enterasys->SUPER::c_port($partial) || {};
my %c_port; my %c_port;
foreach my $iid (keys %$cdp){ foreach my $iid ( keys %$cdp ) {
my $port = $cdp->{$iid}; my $port = $cdp->{$iid};
next unless defined $port; next unless defined $port;
$c_port{$iid} = $port; $c_port{$iid} = $port;
} }
foreach my $iid (keys %$lldp){ foreach my $iid ( keys %$lldp ) {
my $port = $lldp->{$iid}; my $port = $lldp->{$iid};
next unless defined $port; next unless defined $port;
@@ -263,14 +259,14 @@ sub c_id {
my $cdp = $enterasys->SUPER::c_id($partial) || {}; my $cdp = $enterasys->SUPER::c_id($partial) || {};
my %c_id; my %c_id;
foreach my $iid (keys %$cdp){ foreach my $iid ( keys %$cdp ) {
my $id = $cdp->{$iid}; my $id = $cdp->{$iid};
next unless defined $id; next unless defined $id;
$c_id{$iid} = $id; $c_id{$iid} = $id;
} }
foreach my $iid (keys %$lldp){ foreach my $iid ( keys %$lldp ) {
my $id = $lldp->{$iid}; my $id = $lldp->{$iid};
next unless defined $id; next unless defined $id;
@@ -287,14 +283,14 @@ sub c_platform {
my $cdp = $enterasys->SUPER::c_platform($partial) || {}; my $cdp = $enterasys->SUPER::c_platform($partial) || {};
my %c_platform; my %c_platform;
foreach my $iid (keys %$cdp){ foreach my $iid ( keys %$cdp ) {
my $platform = $cdp->{$iid}; my $platform = $cdp->{$iid};
next unless defined $platform; next unless defined $platform;
$c_platform{$iid} = $platform; $c_platform{$iid} = $platform;
} }
foreach my $iid (keys %$lldp){ foreach my $iid ( keys %$lldp ) {
my $platform = $lldp->{$iid}; my $platform = $lldp->{$iid};
next unless defined $platform; next unless defined $platform;
@@ -380,7 +376,8 @@ These are methods that return scalar value from SNMP
=item $enterasys->model() =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() =item $enterasys->vendor()

View File

@@ -37,20 +37,22 @@ use Exporter;
use SNMP::Info::Layer3; use SNMP::Info::Layer3;
use SNMP::Info::MAU; 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//; @SNMP::Info::Layer3::Extreme::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/; use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
$VERSION = '1.09'; $VERSION = '1.09';
%MIBS = ( %SNMP::Info::Layer3::MIBS, %MIBS = (
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::MAU::MIBS, %SNMP::Info::MAU::MIBS,
'EXTREME-BASE-MIB' => 'extremeAgent', 'EXTREME-BASE-MIB' => 'extremeAgent',
'EXTREME-SYSTEM-MIB' => 'extremeSystem', 'EXTREME-SYSTEM-MIB' => 'extremeSystem',
'EXTREME-FDB-MIB' => 'extremeSystem', 'EXTREME-FDB-MIB' => 'extremeSystem',
'EXTREME-VLAN-MIB' => 'extremeVlan', 'EXTREME-VLAN-MIB' => 'extremeVlan',
); );
%GLOBALS = ( %GLOBALS = (
%SNMP::Info::Layer3::GLOBALS, %SNMP::Info::Layer3::GLOBALS,
@@ -62,24 +64,28 @@ $VERSION = '1.09';
'ps2_status_old' => 'extremeRedundantPowerStatus.0', 'ps2_status_old' => 'extremeRedundantPowerStatus.0',
'ps2_status_new' => 'extremePowerSupplyStatus.2', 'ps2_status_new' => 'extremePowerSupplyStatus.2',
'mac' => 'dot1dBaseBridgeAddress', 'mac' => 'dot1dBaseBridgeAddress',
); );
%FUNCS = ( %FUNCS = (
%SNMP::Info::Layer3::FUNCS, %SNMP::Info::Layer3::FUNCS,
%SNMP::Info::MAU::FUNCS, %SNMP::Info::MAU::FUNCS,
'fan_state' => 'extremeFanOperational', 'fan_state' => 'extremeFanOperational',
# EXTREME-FDB-MIB:extremeFdbMacFdbTable # EXTREME-FDB-MIB:extremeFdbMacFdbTable
'ex_fw_mac' => 'extremeFdbMacFdbMacAddress', 'ex_fw_mac' => 'extremeFdbMacFdbMacAddress',
'ex_fw_port' => 'extremeFdbMacFdbPortIfIndex', 'ex_fw_port' => 'extremeFdbMacFdbPortIfIndex',
'ex_fw_status' => 'extremeFdbMacFdbStatus', 'ex_fw_status' => 'extremeFdbMacFdbStatus',
# EXTREME-VLAN-MIB:extremeVlanIfTable # EXTREME-VLAN-MIB:extremeVlanIfTable
'ex_vlan_descr' => 'extremeVlanIfDescr', 'ex_vlan_descr' => 'extremeVlanIfDescr',
'ex_vlan_global_id' => 'extremeVlanIfGlobalIdentifier', 'ex_vlan_global_id' => 'extremeVlanIfGlobalIdentifier',
# EXTREME-VLAN-MIB:extremeVlanEncapsIfTable # EXTREME-VLAN-MIB:extremeVlanEncapsIfTable
'ex_vlan_encap_tag' => 'extremeVlanEncapsIfTag', 'ex_vlan_encap_tag' => 'extremeVlanEncapsIfTag',
); );
%MUNGE = ( %MUNGE = (
# Inherit all the built in munging # Inherit all the built in munging
%SNMP::Info::Layer3::MUNGE, %SNMP::Info::Layer3::MUNGE,
%SNMP::Info::MAU::MUNGE, %SNMP::Info::MAU::MUNGE,
@@ -89,19 +95,22 @@ $VERSION = '1.09';
'ps2_status_old' => \&munge_power_stat, 'ps2_status_old' => \&munge_power_stat,
'ps2_status_new' => \&munge_power_stat, 'ps2_status_new' => \&munge_power_stat,
'fan_state' => \&munge_true_ok, 'fan_state' => \&munge_true_ok,
); );
# Method OverRides # Method OverRides
*SNMP::Info::Layer3::Extreme::i_duplex = \&SNMP::Info::MAU::mau_i_duplex; *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 { sub model {
my $extreme = shift; my $extreme = shift;
my $id = $extreme->id(); my $id = $extreme->id();
unless (defined $id){ unless ( defined $id ) {
print " SNMP::Info::Layer3::Extreme::model() - Device does not support sysObjectID\n" if $extreme->debug(); print
" SNMP::Info::Layer3::Extreme::model() - Device does not support sysObjectID\n"
if $extreme->debug();
return; return;
} }
@@ -125,7 +134,7 @@ sub os_ver {
my $descr = $extreme->description(); my $descr = $extreme->description();
return unless defined $descr; return unless defined $descr;
if ($descr =~ m/Version ([\d.]*)/){ if ( $descr =~ m/Version ([\d.]*)/ ) {
return $1; return $1;
} }
@@ -144,10 +153,11 @@ sub interfaces {
my $i_name = $extreme->orig_i_name($partial); my $i_name = $extreme->orig_i_name($partial);
my $i_description = $extreme->orig_i_description($partial); my $i_description = $extreme->orig_i_description($partial);
my $interfaces = {}; my $interfaces = {};
foreach my $idx (keys %$i_name) { foreach my $idx ( keys %$i_name ) {
if ($i_name->{$idx} =~ /\([0-9.]+\)/) { if ( $i_name->{$idx} =~ /\([0-9.]+\)/ ) {
$interfaces->{$idx} = $i_description->{$idx}; $interfaces->{$idx} = $i_description->{$idx};
} else { }
else {
$interfaces->{$idx} = $i_name->{$idx}; $interfaces->{$idx} = $i_name->{$idx};
} }
} }
@@ -163,8 +173,10 @@ sub i_ignore {
my $i_description = $extreme->i_description($partial) || {}; my $i_description = $extreme->i_description($partial) || {};
my %i_ignore; my %i_ignore;
foreach my $if (keys %$i_description) { foreach my $if ( keys %$i_description ) {
if ($i_description->{$if} =~ /^(802.1Q Encapsulation Tag \d+|VLAN \d+|lo\d+)/i){ if ( $i_description->{$if}
=~ /^(802.1Q Encapsulation Tag \d+|VLAN \d+|lo\d+)/i )
{
$i_ignore{$if}++; $i_ignore{$if}++;
} }
} }
@@ -179,7 +191,7 @@ sub bp_index {
my $if_index = $extreme->i_index(); my $if_index = $extreme->i_index();
my %bp_index; my %bp_index;
foreach my $iid (keys %$if_index){ foreach my $iid ( keys %$if_index ) {
$bp_index{$iid} = $iid; $bp_index{$iid} = $iid;
} }
return \%bp_index; return \%bp_index;
@@ -188,8 +200,8 @@ sub bp_index {
sub munge_true_ok { sub munge_true_ok {
my $val = shift; my $val = shift;
return unless defined($val); return unless defined($val);
return "OK" if ($val eq 'true'); return "OK" if ( $val eq 'true' );
return "Not OK" if ($val eq 'false'); return "Not OK" if ( $val eq 'false' );
return $val; return $val;
} }
@@ -218,11 +230,11 @@ sub fan {
my $fan_state = $extreme->fan_state(); my $fan_state = $extreme->fan_state();
my $ret = ""; my $ret = "";
my $s = ""; 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}; $ret .= $s . $i . ": " . $fan_state->{$i};
$s = ", "; $s = ", ";
} }
return if ($s eq ""); return if ( $s eq "" );
return $ret; return $ret;
} }
@@ -267,28 +279,31 @@ sub _if2tag {
my $vlan_descr = $extreme->ex_vlan_descr(); my $vlan_descr = $extreme->ex_vlan_descr();
my $stackmap = {}; my $stackmap = {};
foreach my $idx (keys %$stack) { foreach my $idx ( keys %$stack ) {
my ($higher, $lower) = split(/\./, $idx); my ( $higher, $lower ) = split( /\./, $idx );
$stackmap->{$higher}->{$lower} = $stack->{$idx}; $stackmap->{$higher}->{$lower} = $stack->{$idx};
} }
my %if2tag = (); my %if2tag = ();
my $missed = 0; my $missed = 0;
foreach my $if (keys %$vlan_descr) { foreach my $if ( keys %$vlan_descr ) {
$if2tag{$if} = -1; $if2tag{$if} = -1;
foreach my $tagif (keys %$encap_tag) { foreach my $tagif ( keys %$encap_tag ) {
if (defined($stackmap->{$if}->{$tagif}) && $stackmap->{$if}->{$tagif} eq 'active') { if ( defined( $stackmap->{$if}->{$tagif} )
&& $stackmap->{$if}->{$tagif} eq 'active' )
{
$if2tag{$if} = $encap_tag->{$tagif}; $if2tag{$if} = $encap_tag->{$tagif};
} }
} }
if ($if2tag{$if} == -1) { if ( $if2tag{$if} == -1 ) {
$missed++; $missed++;
} }
} }
if ($missed) { if ($missed) {
my $global_id = $extreme->ex_vlan_global_id(); my $global_id = $extreme->ex_vlan_global_id();
foreach my $if (keys %if2tag) { foreach my $if ( keys %if2tag ) {
$if2tag{$if} = -$global_id->{$if} if ($if2tag{$if} == -1 && defined($global_id->{$if})); $if2tag{$if} = -$global_id->{$if}
if ( $if2tag{$if} == -1 && defined( $global_id->{$if} ) );
} }
} }
return \%if2tag; return \%if2tag;
@@ -314,17 +329,18 @@ sub i_vlan {
my $encap_tag = $extreme->ex_vlan_encap_tag(); my $encap_tag = $extreme->ex_vlan_encap_tag();
my $vlan_descr = $extreme->ex_vlan_descr(); my $vlan_descr = $extreme->ex_vlan_descr();
my $stackmap = {}; my $stackmap = {};
foreach my $idx (keys %$stack) { foreach my $idx ( keys %$stack ) {
my ($higher, $lower) = split(/\./, $idx); my ( $higher, $lower ) = split( /\./, $idx );
$stackmap->{$higher}->{$lower} = $stack->{$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 # Now that we've done all that mapping work, we can map the
# ifStack indexes. # ifStack indexes.
my %i_vlan = (); my %i_vlan = ();
foreach my $if (keys %$if2tag) { foreach my $if ( keys %$if2tag ) {
foreach my $lowif (keys %{$stackmap->{$if}}) { foreach my $lowif ( keys %{ $stackmap->{$if} } ) {
$i_vlan{$lowif} = $if2tag->{$if}; $i_vlan{$lowif} = $if2tag->{$if};
} }
} }
@@ -338,25 +354,27 @@ sub i_vlan_membership {
my $encap_tag = $extreme->ex_vlan_encap_tag(); my $encap_tag = $extreme->ex_vlan_encap_tag();
my $vlan_descr = $extreme->ex_vlan_descr(); my $vlan_descr = $extreme->ex_vlan_descr();
my $stackmap = {}; my $stackmap = {};
foreach my $idx (keys %$stack) { foreach my $idx ( keys %$stack ) {
my ($higher, $lower) = split(/\./, $idx); my ( $higher, $lower ) = split( /\./, $idx );
$stackmap->{$higher}->{$lower} = $stack->{$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 # Now that we've done all that mapping work, we can map the
# ifStack indexes. # ifStack indexes.
my %i_vlan_membership = (); my %i_vlan_membership = ();
foreach my $if (keys %$if2tag) { foreach my $if ( keys %$if2tag ) {
foreach my $lowif (keys %{$stackmap->{$if}}) { foreach my $lowif ( keys %{ $stackmap->{$if} } ) {
push(@{$i_vlan_membership{$lowif}}, $if2tag->{$if}); push( @{ $i_vlan_membership{$lowif} }, $if2tag->{$if} );
} }
} }
# #
# Now add all the tagged ports. # Now add all the tagged ports.
foreach my $if (keys %$encap_tag) { foreach my $if ( keys %$encap_tag ) {
foreach my $lowif (keys %{$stackmap->{$if}}) { foreach my $lowif ( keys %{ $stackmap->{$if} } ) {
push(@{$i_vlan_membership{$lowif}}, $encap_tag->{$if}); push( @{ $i_vlan_membership{$lowif} }, $encap_tag->{$if} );
} }
} }
return \%i_vlan_membership; return \%i_vlan_membership;
@@ -368,12 +386,12 @@ sub i_vlan_membership {
sub set_i_vlan { sub set_i_vlan {
my $extreme = shift; my $extreme = shift;
return $extreme->_extreme_set_i_vlan(0, @_); return $extreme->_extreme_set_i_vlan( 0, @_ );
} }
sub set_i_pvid { sub set_i_pvid {
my $extreme = shift; 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 # set_i_vlan implicitly turns off any encapsulation
@@ -384,98 +402,127 @@ sub set_i_pvid {
# off any encapsulation. # off any encapsulation.
sub _extreme_set_i_vlan { sub _extreme_set_i_vlan {
my $extreme = shift; my $extreme = shift;
my ($is_pvid, $vlan_id, $ifindex) = @_; my ( $is_pvid, $vlan_id, $ifindex ) = @_;
my $encap_tag = $extreme->ex_vlan_encap_tag(); my $encap_tag = $extreme->ex_vlan_encap_tag();
# The inverted stack MIB would make this easier, since # The inverted stack MIB would make this easier, since
# we need to find the vlan interface # we need to find the vlan interface
# that's stacked above $ifindex. # that's stacked above $ifindex.
my $cur_stack = $extreme->ifStackStatus(); my $cur_stack = $extreme->ifStackStatus();
# #
# create inverted stack # create inverted stack
my $invstack; my $invstack;
foreach my $idx (keys %$cur_stack) { foreach my $idx ( keys %$cur_stack ) {
my ($higher, $lower) = split(/\./, $idx); my ( $higher, $lower ) = split( /\./, $idx );
$invstack->{$lower}->{$higher} = $cur_stack->{$idx}; $invstack->{$lower}->{$higher} = $cur_stack->{$idx};
} }
# create vlan tag -> encap interface map # create vlan tag -> encap interface map
my %encapif = reverse %$encap_tag; my %encapif = reverse %$encap_tag;
# now find encap interface from tag # now find encap interface from tag
my $encapidx = $encapif{$vlan_id}; my $encapidx = $encapif{$vlan_id};
if (!defined($encapidx)) { if ( !defined($encapidx) ) {
$extreme->error_throw("can't map $vlan_id to encapsulation interface"); $extreme->error_throw(
"can't map $vlan_id to encapsulation interface");
return; return;
} }
# now find vlan interface stacked above encap # now find vlan interface stacked above encap
my @abovevlan = keys %{$invstack->{$encapidx}}; my @abovevlan = keys %{ $invstack->{$encapidx} };
if (@abovevlan != 1) { if ( @abovevlan != 1 ) {
$extreme->error_throw("can't map encap interface $encapidx for $vlan_id to encapsulation interface"); $extreme->error_throw(
"can't map encap interface $encapidx for $vlan_id to encapsulation interface"
);
return; return;
} }
my $vlanidx = $abovevlan[0]; my $vlanidx = $abovevlan[0];
my $rv; my $rv;
# Delete old VLAN mapping # Delete old VLAN mapping
foreach my $oldidx (keys %{$invstack->{$ifindex}}) { foreach my $oldidx ( keys %{ $invstack->{$ifindex} } ) {
if ($is_pvid && defined($encap_tag->{$oldidx})) { if ( $is_pvid && defined( $encap_tag->{$oldidx} ) ) {
next; # Don't delete tagged mappings next; # Don't delete tagged mappings
} }
$rv = $extreme->set_ifStackStatus("destroy", $oldidx . "." . $ifindex); $rv = $extreme->set_ifStackStatus( "destroy",
$oldidx . "." . $ifindex );
unless ($rv) { 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; return;
} }
} }
# Add new VLAN mapping # Add new VLAN mapping
$rv = $extreme->set_ifStackStatus("createAndGo", $vlanidx . "." . $ifindex); $rv = $extreme->set_ifStackStatus( "createAndGo",
$vlanidx . "." . $ifindex );
unless ($rv) { 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; return;
} }
# XXX invalidate cache of ifstack?
# XXX Info.pm library function for this? # XXX invalidate cache of ifstack?
# XXX set_ should do invalidation? # XXX Info.pm library function for this?
# $store = $extreme->store(); delete $store->{ifStackStatus}; $extreme->store($store); # XXX set_ should do invalidation?
# $extreme->{_ifStackStatus} = 0; # $store = $extreme->store(); delete $store->{ifStackStatus}; $extreme->store($store);
# $extreme->{_ifStackStatus} = 0;
return $rv; return $rv;
} }
sub set_remove_i_vlan_tagged { sub set_remove_i_vlan_tagged {
my $extreme = shift; my $extreme = shift;
my ($vlan_id, $ifindex) = @_; my ( $vlan_id, $ifindex ) = @_;
my $encap_tag = $extreme->ex_vlan_encap_tag(); my $encap_tag = $extreme->ex_vlan_encap_tag();
# create vlan tag -> encap interface map # create vlan tag -> encap interface map
my %encapif = reverse %$encap_tag; my %encapif = reverse %$encap_tag;
# now find encap interface from tag # now find encap interface from tag
my $encapidx = $encapif{$vlan_id}; my $encapidx = $encapif{$vlan_id};
if (!defined($encapidx)) { if ( !defined($encapidx) ) {
$extreme->error_throw("can't map $vlan_id to encapsulation interface"); $extreme->error_throw(
"can't map $vlan_id to encapsulation interface");
return; return;
} }
my $rv = $extreme->set_ifStackStatus("destroy", $encapidx . "." . $ifindex); my $rv = $extreme->set_ifStackStatus( "destroy",
$encapidx . "." . $ifindex );
unless ($rv) { 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; return;
} }
# invalidate cache of ifstack? # invalidate cache of ifstack?
return $rv; return $rv;
} }
sub set_add_i_vlan_tagged { sub set_add_i_vlan_tagged {
my $extreme = shift; my $extreme = shift;
my ($vlan_id, $ifindex) = @_; my ( $vlan_id, $ifindex ) = @_;
my $encap_tag = $extreme->ex_vlan_encap_tag(); my $encap_tag = $extreme->ex_vlan_encap_tag();
# create vlan tag -> encap interface map # create vlan tag -> encap interface map
my %encapif = reverse %$encap_tag; my %encapif = reverse %$encap_tag;
# now find encap interface from tag # now find encap interface from tag
my $encapidx = $encapif{$vlan_id}; my $encapidx = $encapif{$vlan_id};
if (!defined($encapidx)) { if ( !defined($encapidx) ) {
$extreme->error_throw("can't map $vlan_id to encapsulation interface"); $extreme->error_throw(
"can't map $vlan_id to encapsulation interface");
return; return;
} }
my $rv = $extreme->set_ifStackStatus("createAndGo", $encapidx . "." . $ifindex); my $rv = $extreme->set_ifStackStatus( "createAndGo",
$encapidx . "." . $ifindex );
unless ($rv) { 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; return;
} }
# invalidate cache of ifstack? # invalidate cache of ifstack?
return $rv; return $rv;
} }
@@ -698,8 +745,8 @@ Returns VLAN names
Returns reference to hash of bridge port table entries map back to interface Returns reference to hash of bridge port table entries map back to interface
identifier (iid) identifier (iid)
Returns (C<ifIndex>) for both key and value since we're using F<EXTREME-FDB-MIB> Returns (C<ifIndex>) for both key and value since we're using
rather than F<BRIDGE-MIB>. F<EXTREME-FDB-MIB> rather than F<BRIDGE-MIB>.
=back =back

View File

@@ -46,13 +46,14 @@ use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
$VERSION = '1.09'; $VERSION = '1.09';
%MIBS = ( %SNMP::Info::Layer3::MIBS, %MIBS = (
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::LLDP::MIBS, %SNMP::Info::LLDP::MIBS,
%SNMP::Info::FDP::MIBS, %SNMP::Info::FDP::MIBS,
'FOUNDRY-SN-ROOT-MIB' => 'foundry', 'FOUNDRY-SN-ROOT-MIB' => 'foundry',
'FOUNDRY-SN-AGENT-MIB' => 'snChasPwrSupplyDescription', 'FOUNDRY-SN-AGENT-MIB' => 'snChasPwrSupplyDescription',
'FOUNDRY-SN-SWITCH-GROUP-MIB' => 'snSwGroupOperMode', 'FOUNDRY-SN-SWITCH-GROUP-MIB' => 'snSwGroupOperMode',
); );
%GLOBALS = ( %GLOBALS = (
%SNMP::Info::Layer3::GLOBALS, %SNMP::Info::Layer3::GLOBALS,
@@ -65,25 +66,25 @@ $VERSION = '1.09';
'ps1_status' => 'snChasPwrSupplyOperStatus.1', 'ps1_status' => 'snChasPwrSupplyOperStatus.1',
'fan' => 'snChasFanOperStatus.1', 'fan' => 'snChasFanOperStatus.1',
); );
%FUNCS = ( %FUNCS = (
%SNMP::Info::Layer3::FUNCS, %SNMP::Info::Layer3::FUNCS,
%SNMP::Info::LLDP::FUNCS, %SNMP::Info::LLDP::FUNCS,
%SNMP::Info::FDP::FUNCS, %SNMP::Info::FDP::FUNCS,
# FOUNDRY-SN-SWITCH-GROUP-MIB # FOUNDRY-SN-SWITCH-GROUP-MIB
# snSwPortInfoTable - Switch Port Information Group # snSwPortInfoTable - Switch Port Information Group
'sw_index' => 'snSwPortIfIndex', 'sw_index' => 'snSwPortIfIndex',
'sw_duplex' => 'snSwPortInfoChnMode', 'sw_duplex' => 'snSwPortInfoChnMode',
'sw_type' => 'snSwPortInfoMediaType', 'sw_type' => 'snSwPortInfoMediaType',
'sw_speed' => 'snSwPortInfoSpeed', 'sw_speed' => 'snSwPortInfoSpeed',
); );
%MUNGE = ( %MUNGE = (
%SNMP::Info::Layer3::MUNGE, %SNMP::Info::Layer3::MUNGE, %SNMP::Info::LLDP::MUNGE,
%SNMP::Info::LLDP::MUNGE,
%SNMP::Info::FDP::MUNGE, %SNMP::Info::FDP::MUNGE,
); );
sub i_ignore { sub i_ignore {
my $foundry = shift; my $foundry = shift;
@@ -92,8 +93,8 @@ sub i_ignore {
my $interfaces = $foundry->interfaces($partial) || {}; my $interfaces = $foundry->interfaces($partial) || {};
my %i_ignore; my %i_ignore;
foreach my $if (keys %$interfaces) { foreach my $if ( keys %$interfaces ) {
if ($interfaces->{$if} =~ /(tunnel|loopback|\blo\b|lb|null)/i){ if ( $interfaces->{$if} =~ /(tunnel|loopback|\blo\b|lb|null)/i ) {
$i_ignore{$if}++; $i_ignore{$if}++;
} }
} }
@@ -105,14 +106,14 @@ sub i_duplex {
my $partial = shift; my $partial = shift;
my $sw_index = $foundry->sw_index($partial); 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(); return $foundry->SUPER::i_duplex();
} }
my %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 $iid = $sw_index->{$sw_port};
my $duplex = $sw_duplex->{$sw_port}; my $duplex = $sw_duplex->{$sw_port};
next if $duplex =~ /none/i; next if $duplex =~ /none/i;
@@ -128,20 +129,20 @@ sub model {
my $model = &SNMP::translateObj($id); my $model = &SNMP::translateObj($id);
# EdgeIron # EdgeIron
if ($id =~ /\.1991\.1\.[45]\./) { if ( $id =~ /\.1991\.1\.[45]\./ ) {
my $e_name = $foundry->e_name(); my $e_name = $foundry->e_name();
# Find entity table entry for "unit.1" # Find entity table entry for "unit.1"
my $unit_iid = undef; my $unit_iid = undef;
foreach my $e (keys %$e_name){ foreach my $e ( keys %$e_name ) {
my $name = $e_name->{$e} || ''; my $name = $e_name->{$e} || '';
$unit_iid = $e if $name eq 'unit.1'; $unit_iid = $e if $name eq 'unit.1';
} }
# Find Model Name # Find Model Name
my $e_model = $foundry->e_model(); my $e_model = $foundry->e_model();
if (defined $e_model->{$unit_iid}){ if ( defined $e_model->{$unit_iid} ) {
return $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 # Some older ones don't have this value,so we cull it from the description
my $descr = $foundry->description(); my $descr = $foundry->description();
if ($descr =~ m/Version (\d\S*)/) { if ( $descr =~ m/Version (\d\S*)/ ) {
return $1; return $1;
} }
@@ -177,16 +178,16 @@ sub os_ver {
# find entity table entry for "stackmanaget.1" # find entity table entry for "stackmanaget.1"
my $unit_iid = undef; my $unit_iid = undef;
foreach my $e (keys %$e_name){ foreach my $e ( keys %$e_name ) {
my $name = $e_name->{$e} || ''; my $name = $e_name->{$e} || '';
$unit_iid = $e if $name eq 'stackmanaget.1'; $unit_iid = $e if $name eq 'stackmanaget.1';
} }
if (defined $unit_iid){ if ( defined $unit_iid ) {
# Find Model Name # Find Model Name
my $e_fwver = $foundry->e_fwver(); my $e_fwver = $foundry->e_fwver();
if (defined $e_fwver->{$unit_iid}){ if ( defined $e_fwver->{$unit_iid} ) {
return $e_fwver->{$unit_iid}; return $e_fwver->{$unit_iid};
} }
} }
@@ -205,7 +206,7 @@ sub serial {
# If no chassis serial use first module serial # If no chassis serial use first module serial
my $mod_serials = $foundry->snAgentConfigModuleSerialNumber(); my $mod_serials = $foundry->snAgentConfigModuleSerialNumber();
foreach my $mod (sort keys %$mod_serials){ foreach my $mod ( sort keys %$mod_serials ) {
my $serial = $mod_serials->{$mod} || ''; my $serial = $mod_serials->{$mod} || '';
next unless defined $serial; next unless defined $serial;
return $serial; return $serial;
@@ -216,12 +217,13 @@ sub serial {
# find entity table entry for "unit.1" # find entity table entry for "unit.1"
my $unit_iid = undef; my $unit_iid = undef;
foreach my $e (keys %$e_name){ foreach my $e ( keys %$e_name ) {
my $name = $e_name->{$e} || ''; my $name = $e_name->{$e} || '';
$unit_iid = $e if $name eq 'unit.1'; $unit_iid = $e if $name eq 'unit.1';
} }
if (defined $unit_iid) { if ( defined $unit_iid ) {
# Look up serial of found entry. # Look up serial of found entry.
my $e_serial = $foundry->e_serial(); my $e_serial = $foundry->e_serial();
return $e_serial->{$unit_iid} if defined $e_serial->{$unit_iid}; return $e_serial->{$unit_iid} if defined $e_serial->{$unit_iid};
@@ -239,7 +241,7 @@ sub interfaces {
my $i_name = $foundry->i_name($partial) || {}; my $i_name = $foundry->i_name($partial) || {};
# Use ifName for EdgeIrons else use ifDescr # Use ifName for EdgeIrons else use ifDescr
foreach my $iid (keys %$i_name){ foreach my $iid ( keys %$i_name ) {
my $name = $i_name->{$iid}; my $name = $i_name->{$iid};
next unless defined $name; next unless defined $name;
$i_descr->{$iid} = $name $i_descr->{$iid} = $name
@@ -255,7 +257,7 @@ sub stp_p_state {
my $partial = shift; my $partial = shift;
my $descr = $foundry->description(); my $descr = $foundry->description();
if ($descr =~ m/\bEdgeIron 24G\b/) { if ( $descr =~ m/\bEdgeIron 24G\b/ ) {
return; return;
} }
@@ -279,14 +281,14 @@ sub c_ip {
my $lldp = $foundry->lldp_ip($partial) || {}; my $lldp = $foundry->lldp_ip($partial) || {};
my %c_ip; my %c_ip;
foreach my $iid (keys %$cdp){ foreach my $iid ( keys %$cdp ) {
my $ip = $cdp->{$iid}; my $ip = $cdp->{$iid};
next unless defined $ip; next unless defined $ip;
$c_ip{$iid} = $ip; $c_ip{$iid} = $ip;
} }
foreach my $iid (keys %$lldp){ foreach my $iid ( keys %$lldp ) {
my $ip = $lldp->{$iid}; my $ip = $lldp->{$iid};
next unless defined $ip; next unless defined $ip;
@@ -299,18 +301,18 @@ sub c_if {
my $foundry = shift; my $foundry = shift;
my $partial = shift; my $partial = shift;
my $lldp = $foundry->lldp_if($partial) || {};; my $lldp = $foundry->lldp_if($partial) || {};
my $cdp = $foundry->SUPER::c_if($partial) || {}; my $cdp = $foundry->SUPER::c_if($partial) || {};
my %c_if; my %c_if;
foreach my $iid (keys %$cdp){ foreach my $iid ( keys %$cdp ) {
my $if = $cdp->{$iid}; my $if = $cdp->{$iid};
next unless defined $if; next unless defined $if;
$c_if{$iid} = $if; $c_if{$iid} = $if;
} }
foreach my $iid (keys %$lldp){ foreach my $iid ( keys %$lldp ) {
my $if = $lldp->{$iid}; my $if = $lldp->{$iid};
next unless defined $if; next unless defined $if;
@@ -327,14 +329,14 @@ sub c_port {
my $cdp = $foundry->SUPER::c_port($partial) || {}; my $cdp = $foundry->SUPER::c_port($partial) || {};
my %c_port; my %c_port;
foreach my $iid (keys %$cdp){ foreach my $iid ( keys %$cdp ) {
my $port = $cdp->{$iid}; my $port = $cdp->{$iid};
next unless defined $port; next unless defined $port;
$c_port{$iid} = $port; $c_port{$iid} = $port;
} }
foreach my $iid (keys %$lldp){ foreach my $iid ( keys %$lldp ) {
my $port = $lldp->{$iid}; my $port = $lldp->{$iid};
next unless defined $port; next unless defined $port;
@@ -351,14 +353,14 @@ sub c_id {
my $cdp = $foundry->SUPER::c_id($partial) || {}; my $cdp = $foundry->SUPER::c_id($partial) || {};
my %c_id; my %c_id;
foreach my $iid (keys %$cdp){ foreach my $iid ( keys %$cdp ) {
my $id = $cdp->{$iid}; my $id = $cdp->{$iid};
next unless defined $id; next unless defined $id;
$c_id{$iid} = $id; $c_id{$iid} = $id;
} }
foreach my $iid (keys %$lldp){ foreach my $iid ( keys %$lldp ) {
my $id = $lldp->{$iid}; my $id = $lldp->{$iid};
next unless defined $id; next unless defined $id;
@@ -375,14 +377,14 @@ sub c_platform {
my $cdp = $foundry->SUPER::c_platform($partial) || {}; my $cdp = $foundry->SUPER::c_platform($partial) || {};
my %c_platform; my %c_platform;
foreach my $iid (keys %$cdp){ foreach my $iid ( keys %$cdp ) {
my $platform = $cdp->{$iid}; my $platform = $cdp->{$iid};
next unless defined $platform; next unless defined $platform;
$c_platform{$iid} = $platform; $c_platform{$iid} = $platform;
} }
foreach my $iid (keys %$lldp){ foreach my $iid ( keys %$lldp ) {
my $platform = $lldp->{$iid}; my $platform = $lldp->{$iid};
next unless defined $platform; 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 If multiple entries exist with the same local port, c_if(), with the same IPv4
address, c_ip(), it may be a duplicate entry. address, c_ip(), it may be a duplicate entry.
If multiple entries exist with the same local port, c_if(), with different IPv4 If multiple entries exist with the same local port, c_if(), with different
addresses, c_ip(), there is either a non-FDP/LLDP device in between two or IPv4 addresses, c_ip(), there is either a non-FDP/LLDP device in between two
more devices or multiple devices which are not directly connected. or more devices or multiple devices which are not directly connected.
Use the data from the Layer2 Topology Table below to dig deeper. 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'; $VERSION = '1.09';
%MIBS = ( %SNMP::Info::Layer3::MIBS, %MIBS = (
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::LLDP::MIBS, %SNMP::Info::LLDP::MIBS,
%SNMP::Info::FDP::MIBS, %SNMP::Info::FDP::MIBS,
'HP-SN-ROOT-MIB' => 'hp', 'HP-SN-ROOT-MIB' => 'hp',
'HP-SN-AGENT-MIB' => 'snChasPwrSupplyDescription', 'HP-SN-AGENT-MIB' => 'snChasPwrSupplyDescription',
'HP-SN-SWITCH-GROUP-MIB' => 'snSwGroupOperMode', 'HP-SN-SWITCH-GROUP-MIB' => 'snSwGroupOperMode',
); );
%GLOBALS = ( %GLOBALS = (
%SNMP::Info::Layer3::GLOBALS, %SNMP::Info::Layer3::GLOBALS,
@@ -63,12 +64,13 @@ $VERSION = '1.09';
'ps1_status' => 'snChasPwrSupplyOperStatus.1', 'ps1_status' => 'snChasPwrSupplyOperStatus.1',
'fan' => 'snChasFanOperStatus.1', 'fan' => 'snChasFanOperStatus.1',
); );
%FUNCS = ( %FUNCS = (
%SNMP::Info::Layer3::FUNCS, %SNMP::Info::Layer3::FUNCS,
%SNMP::Info::LLDP::FUNCS, %SNMP::Info::LLDP::FUNCS,
%SNMP::Info::FDP::FUNCS, %SNMP::Info::FDP::FUNCS,
# HP-SN-SWITCH-GROUP-MIB # HP-SN-SWITCH-GROUP-MIB
# snSwPortInfoTable - Switch Port Information Group # snSwPortInfoTable - Switch Port Information Group
# Fully qualify these since FDP class will load # Fully qualify these since FDP class will load
@@ -77,13 +79,12 @@ $VERSION = '1.09';
'sw_duplex' => 'HP_SN_SWITCH_GROUP_MIB__snSwPortInfoChnMode', 'sw_duplex' => 'HP_SN_SWITCH_GROUP_MIB__snSwPortInfoChnMode',
'sw_type' => 'HP_SN_SWITCH_GROUP_MIB__snSwPortInfoMediaType', 'sw_type' => 'HP_SN_SWITCH_GROUP_MIB__snSwPortInfoMediaType',
'sw_speed' => 'HP_SN_SWITCH_GROUP_MIB__snSwPortInfoSpeed', 'sw_speed' => 'HP_SN_SWITCH_GROUP_MIB__snSwPortInfoSpeed',
); );
%MUNGE = ( %MUNGE = (
%SNMP::Info::Layer3::MUNGE, %SNMP::Info::Layer3::MUNGE, %SNMP::Info::LLDP::MUNGE,
%SNMP::Info::LLDP::MUNGE,
%SNMP::Info::FDP::MUNGE, %SNMP::Info::FDP::MUNGE,
); );
sub i_ignore { sub i_ignore {
my $hp9300 = shift; my $hp9300 = shift;
@@ -92,8 +93,8 @@ sub i_ignore {
my $interfaces = $hp9300->interfaces($partial) || {}; my $interfaces = $hp9300->interfaces($partial) || {};
my %i_ignore; my %i_ignore;
foreach my $if (keys %$interfaces) { foreach my $if ( keys %$interfaces ) {
if ($interfaces->{$if} =~ /(tunnel|loopback|\blo\b|lb|null)/i){ if ( $interfaces->{$if} =~ /(tunnel|loopback|\blo\b|lb|null)/i ) {
$i_ignore{$if}++; $i_ignore{$if}++;
} }
} }
@@ -105,14 +106,14 @@ sub i_duplex {
my $partial = shift; my $partial = shift;
my $sw_index = $hp9300->sw_index($partial); 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(); return $hp9300->SUPER::i_duplex();
} }
my %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 $iid = $sw_index->{$sw_port};
my $duplex = $sw_duplex->{$sw_port}; my $duplex = $sw_duplex->{$sw_port};
next if $duplex =~ /none/i; 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 # Some older ones don't have this value,so we cull it from the description
my $descr = $hp9300->description(); my $descr = $hp9300->description();
if ($descr =~ m/Version (\d\S*)/) { if ( $descr =~ m/Version (\d\S*)/ ) {
return $1; return $1;
} }
@@ -167,7 +168,7 @@ sub serial {
# If no chassis serial use first module serial # If no chassis serial use first module serial
my $mod_serials = $hp9300->snAgentConfigModuleSerialNumber(); my $mod_serials = $hp9300->snAgentConfigModuleSerialNumber();
foreach my $mod (sort keys %$mod_serials){ foreach my $mod ( sort keys %$mod_serials ) {
my $serial = $mod_serials->{$mod} || ''; my $serial = $mod_serials->{$mod} || '';
next unless defined $serial; next unless defined $serial;
return $serial; return $serial;
@@ -185,7 +186,7 @@ sub interfaces {
my $i_name = $hp9300->i_name($partial) || {}; my $i_name = $hp9300->i_name($partial) || {};
# Use ifName for EdgeIrons else use ifDescr # Use ifName for EdgeIrons else use ifDescr
foreach my $iid (keys %$i_name){ foreach my $iid ( keys %$i_name ) {
my $name = $i_name->{$iid}; my $name = $i_name->{$iid};
next unless defined $name; next unless defined $name;
$i_descr->{$iid} = $name $i_descr->{$iid} = $name
@@ -211,14 +212,14 @@ sub c_ip {
my $lldp = $hp9300->lldp_ip($partial) || {}; my $lldp = $hp9300->lldp_ip($partial) || {};
my %c_ip; my %c_ip;
foreach my $iid (keys %$cdp){ foreach my $iid ( keys %$cdp ) {
my $ip = $cdp->{$iid}; my $ip = $cdp->{$iid};
next unless defined $ip; next unless defined $ip;
$c_ip{$iid} = $ip; $c_ip{$iid} = $ip;
} }
foreach my $iid (keys %$lldp){ foreach my $iid ( keys %$lldp ) {
my $ip = $lldp->{$iid}; my $ip = $lldp->{$iid};
next unless defined $ip; next unless defined $ip;
@@ -231,18 +232,18 @@ sub c_if {
my $hp9300 = shift; my $hp9300 = shift;
my $partial = shift; my $partial = shift;
my $lldp = $hp9300->lldp_if($partial) || {};; my $lldp = $hp9300->lldp_if($partial) || {};
my $cdp = $hp9300->SUPER::c_if($partial) || {}; my $cdp = $hp9300->SUPER::c_if($partial) || {};
my %c_if; my %c_if;
foreach my $iid (keys %$cdp){ foreach my $iid ( keys %$cdp ) {
my $if = $cdp->{$iid}; my $if = $cdp->{$iid};
next unless defined $if; next unless defined $if;
$c_if{$iid} = $if; $c_if{$iid} = $if;
} }
foreach my $iid (keys %$lldp){ foreach my $iid ( keys %$lldp ) {
my $if = $lldp->{$iid}; my $if = $lldp->{$iid};
next unless defined $if; next unless defined $if;
@@ -259,14 +260,14 @@ sub c_port {
my $cdp = $hp9300->SUPER::c_port($partial) || {}; my $cdp = $hp9300->SUPER::c_port($partial) || {};
my %c_port; my %c_port;
foreach my $iid (keys %$cdp){ foreach my $iid ( keys %$cdp ) {
my $port = $cdp->{$iid}; my $port = $cdp->{$iid};
next unless defined $port; next unless defined $port;
$c_port{$iid} = $port; $c_port{$iid} = $port;
} }
foreach my $iid (keys %$lldp){ foreach my $iid ( keys %$lldp ) {
my $port = $lldp->{$iid}; my $port = $lldp->{$iid};
next unless defined $port; next unless defined $port;
@@ -283,14 +284,14 @@ sub c_id {
my $cdp = $hp9300->SUPER::c_id($partial) || {}; my $cdp = $hp9300->SUPER::c_id($partial) || {};
my %c_id; my %c_id;
foreach my $iid (keys %$cdp){ foreach my $iid ( keys %$cdp ) {
my $id = $cdp->{$iid}; my $id = $cdp->{$iid};
next unless defined $id; next unless defined $id;
$c_id{$iid} = $id; $c_id{$iid} = $id;
} }
foreach my $iid (keys %$lldp){ foreach my $iid ( keys %$lldp ) {
my $id = $lldp->{$iid}; my $id = $lldp->{$iid};
next unless defined $id; next unless defined $id;
@@ -307,14 +308,14 @@ sub c_platform {
my $cdp = $hp9300->SUPER::c_platform($partial) || {}; my $cdp = $hp9300->SUPER::c_platform($partial) || {};
my %c_platform; my %c_platform;
foreach my $iid (keys %$cdp){ foreach my $iid ( keys %$cdp ) {
my $platform = $cdp->{$iid}; my $platform = $cdp->{$iid};
next unless defined $platform; next unless defined $platform;
$c_platform{$iid} = $platform; $c_platform{$iid} = $platform;
} }
foreach my $iid (keys %$lldp){ foreach my $iid ( keys %$lldp ) {
my $platform = $lldp->{$iid}; my $platform = $lldp->{$iid};
next unless defined $platform; 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 If multiple entries exist with the same local port, c_if(), with the same IPv4
address, c_ip(), it may be a duplicate entry. address, c_ip(), it may be a duplicate entry.
If multiple entries exist with the same local port, c_if(), with different IPv4 If multiple entries exist with the same local port, c_if(), with different
addresses, c_ip(), there is either a non-FDP/LLDP device in between two or IPv4 addresses, c_ip(), there is either a non-FDP/LLDP device in between two
more devices or multiple devices which are not directly connected. or more devices or multiple devices which are not directly connected.
Use the data from the Layer2 Topology Table below to dig deeper. 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::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::Juniper::EXPORT_OK = qw//; @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'; $VERSION = '1.09';
@@ -45,20 +45,13 @@ $VERSION = '1.09';
%SNMP::Info::Layer3::MIBS, %SNMP::Info::Layer3::MIBS,
'JUNIPER-CHASSIS-DEFINES-MIB' => 'jnxChassisDefines', 'JUNIPER-CHASSIS-DEFINES-MIB' => 'jnxChassisDefines',
'JUNIPER-MIB' => 'jnxBoxAnatomy', 'JUNIPER-MIB' => 'jnxBoxAnatomy',
); );
%GLOBALS = ( %GLOBALS = ( %SNMP::Info::Layer3::GLOBALS, 'serial' => 'jnxBoxSerialNo.0', );
%SNMP::Info::Layer3::GLOBALS,
'serial' => 'jnxBoxSerialNo.0',
);
%FUNCS = ( %FUNCS = ( %SNMP::Info::Layer3::FUNCS, );
%SNMP::Info::Layer3::FUNCS,
);
%MUNGE = ( %MUNGE = ( %SNMP::Info::Layer3::MUNGE, );
%SNMP::Info::Layer3::MUNGE,
);
sub vendor { sub vendor {
return 'juniper'; return 'juniper';
@@ -73,7 +66,7 @@ sub os_ver {
my $descr = $juniper->description(); my $descr = $juniper->description();
return unless defined $descr; return unless defined $descr;
if ($descr =~ m/kernel JUNOS (\S+)/) { if ( $descr =~ m/kernel JUNOS (\S+)/ ) {
return $1; return $1;
} }
return; return;
@@ -83,8 +76,10 @@ sub model {
my $l3 = shift; my $l3 = shift;
my $id = $l3->id(); my $id = $l3->id();
unless (defined $id){ unless ( defined $id ) {
print " SNMP::Info::Layer3::Juniper::model() - Device does not support sysObjectID\n" if $l3->debug(); print
" SNMP::Info::Layer3::Juniper::model() - Device does not support sysObjectID\n"
if $l3->debug();
return; return;
} }
@@ -110,9 +105,9 @@ sub i_vlan {
my ($i_descr) = $juniper->i_description($partial); my ($i_descr) = $juniper->i_description($partial);
my %i_vlan; my %i_vlan;
foreach my $idx (keys %$i_descr) { foreach my $idx ( keys %$i_descr ) {
if ($i_type->{$idx} eq 'l2vlan' || $i_type->{$idx} eq 135) { if ( $i_type->{$idx} eq 'l2vlan' || $i_type->{$idx} eq 135 ) {
if ($i_descr->{$idx} =~ /\.(\d+)$/) { if ( $i_descr->{$idx} =~ /\.(\d+)$/ ) {
$i_vlan{$idx} = $1; $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::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::Microsoft::EXPORT_OK = qw//; @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'; $VERSION = '1.09';
%MIBS = ( %MIBS = ( %SNMP::Info::Layer3::MIBS, );
%SNMP::Info::Layer3::MIBS,
);
%GLOBALS = ( %GLOBALS = ( %SNMP::Info::Layer3::GLOBALS, );
%SNMP::Info::Layer3::GLOBALS,
);
%FUNCS = ( %FUNCS = ( %SNMP::Info::Layer3::FUNCS, );
%SNMP::Info::Layer3::FUNCS,
);
%MUNGE = ( %MUNGE = ( %SNMP::Info::Layer3::MUNGE, );
%SNMP::Info::Layer3::MUNGE,
);
sub vendor { sub vendor {
return 'microsoft'; return 'microsoft';
@@ -70,11 +62,13 @@ sub os_ver {
} }
sub model { sub model {
return 'Windows Router' return 'Windows Router';
} }
sub serial { sub serial {
return ''; return '';
} }
# $l3->interfaces() - Map the Interfaces to their physical names # $l3->interfaces() - Map the Interfaces to their physical names
# Add interface number to interface name because if MS Win # Add interface number to interface name because if MS Win
# have identical interface cards ("HP NC7782 Gigabit Server Adapter" # have identical interface cards ("HP NC7782 Gigabit Server Adapter"
@@ -87,11 +81,11 @@ sub interfaces {
my $descriptions = $l3->i_description($partial); my $descriptions = $l3->i_description($partial);
my %interfaces = (); my %interfaces = ();
foreach my $iid (keys %$interfaces){ foreach my $iid ( keys %$interfaces ) {
my $desc = $descriptions->{$iid}; my $desc = $descriptions->{$iid};
next unless defined $desc; next unless defined $desc;
$interfaces{$iid} = sprintf("(%U) %s", $iid, $desc); $interfaces{$iid} = sprintf( "(%U) %s", $iid, $desc );
} }
return \%interfaces; return \%interfaces;

View File

@@ -35,39 +35,41 @@ use Exporter;
use SNMP::Info::Layer3; use SNMP::Info::Layer3;
use SNMP::Info::SONMP; 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//; @SNMP::Info::Layer3::N1600::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/; use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
$VERSION = '1.09'; $VERSION = '1.09';
%MIBS = ( %SNMP::Info::Layer3::MIBS, %MIBS = (
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::SONMP::MIBS, %SNMP::Info::SONMP::MIBS,
'SWL2MGMT-MIB' => 'swL2MgmtMIB', 'SWL2MGMT-MIB' => 'swL2MgmtMIB',
'RAPID-CITY' => 'rapidCity', 'RAPID-CITY' => 'rapidCity',
); );
%GLOBALS = ( %GLOBALS = ( %SNMP::Info::Layer3::GLOBALS, %SNMP::Info::SONMP::GLOBALS, );
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::SONMP::GLOBALS,
);
%FUNCS = ( %FUNCS = (
%SNMP::Info::Layer3::FUNCS, %SNMP::Info::Layer3::FUNCS,
%SNMP::Info::SONMP::FUNCS, %SNMP::Info::SONMP::FUNCS,
# SWL2MGMT-MIB # SWL2MGMT-MIB
# swL2PortInfoTable # swL2PortInfoTable
'n1600_nway_status' => 'swL2PortInfoNwayStatus', 'n1600_nway_status' => 'swL2PortInfoNwayStatus',
# swL2PortCtrlTable # swL2PortCtrlTable
'n1600_nway_state' => 'swL2PortCtrlNwayState', 'n1600_nway_state' => 'swL2PortCtrlNwayState',
); );
%MUNGE = ( %MUNGE = (
# Inherit all the built in munging # Inherit all the built in munging
%SNMP::Info::Layer3::MUNGE, %SNMP::Info::Layer3::MUNGE,
%SNMP::Info::SONMP::MUNGE, %SNMP::Info::SONMP::MUNGE,
); );
# Method OverRides # Method OverRides
@@ -75,8 +77,10 @@ sub model {
my $n1600 = shift; my $n1600 = shift;
my $id = $n1600->id(); my $id = $n1600->id();
unless (defined $id){ unless ( defined $id ) {
print " SNMP::Info::Layer3::N1600::model() - Device does not support sysObjectID\n" if $n1600->debug(); print
" SNMP::Info::Layer3::N1600::model() - Device does not support sysObjectID\n"
if $n1600->debug();
return; return;
} }
@@ -101,7 +105,7 @@ sub os_ver {
my $descr = $n1600->description(); my $descr = $n1600->description();
return unless defined $descr; return unless defined $descr;
if ($descr =~ m/(\d+\.\d+\.\d+\.\d+)/){ if ( $descr =~ m/(\d+\.\d+\.\d+\.\d+)/ ) {
return $1; return $1;
} }
@@ -115,7 +119,7 @@ sub interfaces {
my $i_index = $n1600->i_index($partial) || {}; my $i_index = $n1600->i_index($partial) || {};
my %if; my %if;
foreach my $iid (keys %$i_index){ foreach my $iid ( keys %$i_index ) {
my $index = $i_index->{$iid}; my $index = $i_index->{$iid};
next unless defined $index; next unless defined $index;
@@ -132,7 +136,7 @@ sub i_duplex {
my $nway_status = $n1600->n1600_nway_status($partial) || {}; my $nway_status = $n1600->n1600_nway_status($partial) || {};
my %i_duplex; my %i_duplex;
foreach my $iid (keys %$nway_status){ foreach my $iid ( keys %$nway_status ) {
my $duplex = $nway_status->{$iid}; my $duplex = $nway_status->{$iid};
next unless defined $duplex; next unless defined $duplex;
next if $duplex =~ /other/i; next if $duplex =~ /other/i;
@@ -149,7 +153,7 @@ sub i_duplex_admin {
my $nway_state = $n1600->n1600_nway_state($partial) || {}; my $nway_state = $n1600->n1600_nway_state($partial) || {};
my %i_duplex; my %i_duplex;
foreach my $iid (keys %$nway_state){ foreach my $iid ( keys %$nway_state ) {
my $duplex = $nway_state->{$iid}; my $duplex = $nway_state->{$iid};
next unless defined $duplex; next unless defined $duplex;
next if $duplex =~ /other/i; 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::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::NetSNMP::EXPORT_OK = qw//; @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'; $VERSION = '1.09';
@@ -46,21 +46,17 @@ $VERSION = '1.09';
'UCD-SNMP-MIB' => 'versionTag', 'UCD-SNMP-MIB' => 'versionTag',
'NET-SNMP-TC' => 'netSnmpAgentOIDs', 'NET-SNMP-TC' => 'netSnmpAgentOIDs',
'HOST-RESOURCES-MIB' => 'hrSystem', 'HOST-RESOURCES-MIB' => 'hrSystem',
); );
%GLOBALS = ( %GLOBALS = (
%SNMP::Info::Layer3::GLOBALS, %SNMP::Info::Layer3::GLOBALS,
'netsnmp_vers' => 'versionTag', 'netsnmp_vers' => 'versionTag',
'hrSystemUptime' => 'hrSystemUptime', 'hrSystemUptime' => 'hrSystemUptime',
); );
%FUNCS = ( %FUNCS = ( %SNMP::Info::Layer3::FUNCS, );
%SNMP::Info::Layer3::FUNCS,
);
%MUNGE = ( %MUNGE = ( %SNMP::Info::Layer3::MUNGE, );
%SNMP::Info::Layer3::MUNGE,
);
sub vendor { sub vendor {
return 'Net-SNMP'; return 'Net-SNMP';
@@ -70,7 +66,7 @@ sub os {
my $netsnmp = shift; my $netsnmp = shift;
my $descr = $netsnmp->description(); my $descr = $netsnmp->description();
return $1 if ($descr =~ /^(\S+)\s+/); return $1 if ( $descr =~ /^(\S+)\s+/ );
return; return;
} }
@@ -80,7 +76,7 @@ sub os_ver {
my $vers = $netsnmp->netsnmp_vers(); my $vers = $netsnmp->netsnmp_vers();
my $os_ver = undef; 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) { if ($vers) {
$os_ver = "???" unless defined($os_ver); $os_ver = "???" unless defined($os_ver);
$os_ver .= " / Net-SNMP " . $vers; $os_ver .= " / Net-SNMP " . $vers;
@@ -115,9 +111,10 @@ sub i_ignore {
my $interfaces = $l3->interfaces($partial) || {}; my $interfaces = $l3->interfaces($partial) || {};
my %i_ignore; my %i_ignore;
foreach my $if (keys %$interfaces) { foreach my $if ( keys %$interfaces ) {
# lo0 etc # lo0 etc
if ($interfaces->{$if} =~ /\blo\d*\b/i){ if ( $interfaces->{$if} =~ /\blo\d*\b/i ) {
$i_ignore{$if}++; $i_ignore{$if}++;
} }
} }

View File

@@ -47,20 +47,13 @@ $VERSION = '1.09';
'NETSCREEN-PRODUCTS-MIB' => 'netscreenGeneric', 'NETSCREEN-PRODUCTS-MIB' => 'netscreenGeneric',
'NETSCREEN-INTERFACE-MIB' => 'nsIfIndex', 'NETSCREEN-INTERFACE-MIB' => 'nsIfIndex',
'NETSCREEN-SET-GEN-MIB' => 'nsSetGenSwVer', 'NETSCREEN-SET-GEN-MIB' => 'nsSetGenSwVer',
); );
%GLOBALS = ( %GLOBALS = ( %SNMP::Info::Layer3::GLOBALS, 'os_version' => 'nsSetGenSwVer', );
%SNMP::Info::Layer3::GLOBALS,
'os_version' => 'nsSetGenSwVer',
);
%FUNCS = ( %FUNCS = ( %SNMP::Info::Layer3::FUNCS, );
%SNMP::Info::Layer3::FUNCS,
);
%MUNGE = ( %MUNGE = ( %SNMP::Info::Layer3::MUNGE, );
%SNMP::Info::Layer3::MUNGE,
);
sub layers { sub layers {
return '01001100'; return '01001100';
@@ -78,7 +71,7 @@ sub os_ver {
my $netscreen = shift; my $netscreen = shift;
my $descr = $netscreen->description(); my $descr = $netscreen->description();
if ( $descr =~ m/version (\d\S*) \(SN: /) { if ( $descr =~ m/version (\d\S*) \(SN: / ) {
return $1; return $1;
} }
return; return;
@@ -91,9 +84,9 @@ sub serial {
my $serial = $e_serial->{1} || undef; 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(); my $descr = $netscreen->description();
if ( $descr =~ m/version .*\(SN: (\d\S*),/) { if ( $descr =~ m/version .*\(SN: (\d\S*),/ ) {
return $1; return $1;
} }
return; return;

View File

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

View File

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

View File

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

View File

@@ -41,25 +41,25 @@ use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/;
$VERSION = '1.09'; $VERSION = '1.09';
%MIBS = ('POWER-ETHERNET-MIB' => 'pethPsePortDetectionStatus'); %MIBS = ( 'POWER-ETHERNET-MIB' => 'pethPsePortDetectionStatus' );
%GLOBALS = ( %GLOBALS = ();
);
%FUNCS = ( %FUNCS = (
# parts of pethPsePortTable # parts of pethPsePortTable
'peth_port_admin' => 'pethPsePortAdminEnable', 'peth_port_admin' => 'pethPsePortAdminEnable',
'peth_port_status' => 'pethPsePortDetectionStatus', 'peth_port_status' => 'pethPsePortDetectionStatus',
'peth_port_class' => 'pethPsePortPowerClassifications', 'peth_port_class' => 'pethPsePortPowerClassifications',
# pethMainPseTable # pethMainPseTable
'peth_power_watts' => 'pethMainPsePower', 'peth_power_watts' => 'pethMainPsePower',
'peth_power_status' => 'pethMainPseOperStatus', 'peth_power_status' => 'pethMainPseOperStatus',
'peth_power_consumption' => 'pethMainPseConsumptionPower', 'peth_power_consumption' => 'pethMainPseConsumptionPower',
'peth_power_threshold' => 'pethMainPseUsageThreshold', 'peth_power_threshold' => 'pethMainPseUsageThreshold',
); );
%MUNGE = ( %MUNGE = ();
);
# POWER-ETHERNET-MIB doesn't define a mapping of its # POWER-ETHERNET-MIB doesn't define a mapping of its
# "module"/"port" index to ifIndex. Different vendors # "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_status = $peth->peth_port_status($partial);
my $peth_port_ifindex; my $peth_port_ifindex;
foreach my $i (keys %$peth_port_status) { foreach my $i ( keys %$peth_port_status ) {
my ($module, $port) = split(/\./, $i); my ( $module, $port ) = split( /\./, $i );
if ($module != 1) { if ( $module != 1 ) {
# This heuristic won't work, so say that we got nothing. # This heuristic won't work, so say that we got nothing.
# If you have this case, you have to write a device-specific # If you have this case, you have to write a device-specific
# version of this function. # 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. 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 (...); my $poe = new SNMP::Info::PowerEthernet (...);

View File

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

View File

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