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

View File

@@ -5,21 +5,21 @@
#
# Copyright (c) 2002,2003 Regents of the University of California
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the University of California, Santa Cruz nor the
# names of its contributors may be used to endorse or promote products
# * Neither the name of the University of California, Santa Cruz nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
@@ -39,51 +39,52 @@ use SNMP::Info::FDP;
use SNMP::Info::LLDP;
@SNMP::Info::Layer3::Foundry::ISA = qw/SNMP::Info::FDP SNMP::Info::LLDP
SNMP::Info::Layer3 Exporter/;
SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::Foundry::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = ( %SNMP::Info::Layer3::MIBS,
%SNMP::Info::LLDP::MIBS,
%SNMP::Info::FDP::MIBS,
'FOUNDRY-SN-ROOT-MIB' => 'foundry',
'FOUNDRY-SN-AGENT-MIB' => 'snChasPwrSupplyDescription',
'FOUNDRY-SN-SWITCH-GROUP-MIB' => 'snSwGroupOperMode',
);
%MIBS = (
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::LLDP::MIBS,
%SNMP::Info::FDP::MIBS,
'FOUNDRY-SN-ROOT-MIB' => 'foundry',
'FOUNDRY-SN-AGENT-MIB' => 'snChasPwrSupplyDescription',
'FOUNDRY-SN-SWITCH-GROUP-MIB' => 'snSwGroupOperMode',
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::LLDP::GLOBALS,
%SNMP::Info::FDP::GLOBALS,
'mac' => 'ifPhysAddress.1',
'chassis' => 'entPhysicalDescr.1',
'temp' => 'snChasActualTemperature',
'ps1_type' => 'snChasPwrSupplyDescription.1',
'ps1_status' => 'snChasPwrSupplyOperStatus.1',
'fan' => 'snChasFanOperStatus.1',
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::LLDP::GLOBALS,
%SNMP::Info::FDP::GLOBALS,
'mac' => 'ifPhysAddress.1',
'chassis' => 'entPhysicalDescr.1',
'temp' => 'snChasActualTemperature',
'ps1_type' => 'snChasPwrSupplyDescription.1',
'ps1_status' => 'snChasPwrSupplyOperStatus.1',
'fan' => 'snChasFanOperStatus.1',
);
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::LLDP::FUNCS,
%SNMP::Info::FDP::FUNCS,
# FOUNDRY-SN-SWITCH-GROUP-MIB
# snSwPortInfoTable - Switch Port Information Group
'sw_index' => 'snSwPortIfIndex',
'sw_duplex' => 'snSwPortInfoChnMode',
'sw_type' => 'snSwPortInfoMediaType',
'sw_speed' => 'snSwPortInfoSpeed',
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::LLDP::FUNCS,
%SNMP::Info::FDP::FUNCS,
# FOUNDRY-SN-SWITCH-GROUP-MIB
# snSwPortInfoTable - Switch Port Information Group
'sw_index' => 'snSwPortIfIndex',
'sw_duplex' => 'snSwPortInfoChnMode',
'sw_type' => 'snSwPortInfoMediaType',
'sw_speed' => 'snSwPortInfoSpeed',
);
%MUNGE = (
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::LLDP::MUNGE,
%SNMP::Info::FDP::MUNGE,
);
%SNMP::Info::Layer3::MUNGE, %SNMP::Info::LLDP::MUNGE,
%SNMP::Info::FDP::MUNGE,
);
sub i_ignore {
my $foundry = shift;
@@ -92,8 +93,8 @@ sub i_ignore {
my $interfaces = $foundry->interfaces($partial) || {};
my %i_ignore;
foreach my $if (keys %$interfaces) {
if ($interfaces->{$if} =~ /(tunnel|loopback|\blo\b|lb|null)/i){
foreach my $if ( keys %$interfaces ) {
if ( $interfaces->{$if} =~ /(tunnel|loopback|\blo\b|lb|null)/i ) {
$i_ignore{$if}++;
}
}
@@ -104,16 +105,16 @@ sub i_duplex {
my $foundry = shift;
my $partial = shift;
my $sw_index = $foundry->sw_index($partial);
my $sw_duplex= $foundry->sw_duplex($partial);
my $sw_index = $foundry->sw_index($partial);
my $sw_duplex = $foundry->sw_duplex($partial);
unless (defined $sw_index and defined $sw_duplex){
return $foundry->SUPER::i_duplex();
unless ( defined $sw_index and defined $sw_duplex ) {
return $foundry->SUPER::i_duplex();
}
my %i_duplex;
foreach my $sw_port (keys %$sw_duplex){
my $iid = $sw_index->{$sw_port};
foreach my $sw_port ( keys %$sw_duplex ) {
my $iid = $sw_index->{$sw_port};
my $duplex = $sw_duplex->{$sw_port};
next if $duplex =~ /none/i;
$i_duplex{$iid} = 'half' if $duplex =~ /half/i;
@@ -124,36 +125,36 @@ sub i_duplex {
sub model {
my $foundry = shift;
my $id = $foundry->id();
my $model = &SNMP::translateObj($id);
my $id = $foundry->id();
my $model = &SNMP::translateObj($id);
# EdgeIron
if ($id =~ /\.1991\.1\.[45]\./) {
if ( $id =~ /\.1991\.1\.[45]\./ ) {
my $e_name = $foundry->e_name();
# Find entity table entry for "unit.1"
my $unit_iid = undef;
foreach my $e (keys %$e_name){
foreach my $e ( keys %$e_name ) {
my $name = $e_name->{$e} || '';
$unit_iid = $e if $name eq 'unit.1';
}
# Find Model Name
my $e_model = $foundry->e_model();
if (defined $e_model->{$unit_iid}){
if ( defined $e_model->{$unit_iid} ) {
return $e_model->{$unit_iid};
}
}
return $id unless defined $model;
$model =~ s/^sn//;
return $model;
}
sub os {
sub os {
return 'foundry';
}
@@ -168,7 +169,7 @@ sub os_ver {
# Some older ones don't have this value,so we cull it from the description
my $descr = $foundry->description();
if ($descr =~ m/Version (\d\S*)/) {
if ( $descr =~ m/Version (\d\S*)/ ) {
return $1;
}
@@ -177,16 +178,16 @@ sub os_ver {
# find entity table entry for "stackmanaget.1"
my $unit_iid = undef;
foreach my $e (keys %$e_name){
foreach my $e ( keys %$e_name ) {
my $name = $e_name->{$e} || '';
$unit_iid = $e if $name eq 'stackmanaget.1';
}
if (defined $unit_iid){
if ( defined $unit_iid ) {
# Find Model Name
my $e_fwver = $foundry->e_fwver();
if (defined $e_fwver->{$unit_iid}){
if ( defined $e_fwver->{$unit_iid} ) {
return $e_fwver->{$unit_iid};
}
}
@@ -205,7 +206,7 @@ sub serial {
# If no chassis serial use first module serial
my $mod_serials = $foundry->snAgentConfigModuleSerialNumber();
foreach my $mod (sort keys %$mod_serials){
foreach my $mod ( sort keys %$mod_serials ) {
my $serial = $mod_serials->{$mod} || '';
next unless defined $serial;
return $serial;
@@ -216,12 +217,13 @@ sub serial {
# find entity table entry for "unit.1"
my $unit_iid = undef;
foreach my $e (keys %$e_name){
foreach my $e ( keys %$e_name ) {
my $name = $e_name->{$e} || '';
$unit_iid = $e if $name eq 'unit.1';
}
if (defined $unit_iid) {
if ( defined $unit_iid ) {
# Look up serial of found entry.
my $e_serial = $foundry->e_serial();
return $e_serial->{$unit_iid} if defined $e_serial->{$unit_iid};
@@ -236,26 +238,26 @@ sub interfaces {
my $partial = shift;
my $i_descr = $foundry->i_description($partial) || {};
my $i_name = $foundry->i_name($partial) || {};
my $i_name = $foundry->i_name($partial) || {};
# Use ifName for EdgeIrons else use ifDescr
foreach my $iid (keys %$i_name){
foreach my $iid ( keys %$i_name ) {
my $name = $i_name->{$iid};
next unless defined $name;
$i_descr->{$iid} = $name
$i_descr->{$iid} = $name
if $name =~ /^port\d+/i;
}
return $i_descr;
}
# Reported hangs on a EdgeIron 24G
sub stp_p_state {
my $foundry = shift;
my $foundry = shift;
my $partial = shift;
my $descr = $foundry->description();
if ($descr =~ m/\bEdgeIron 24G\b/) {
if ( $descr =~ m/\bEdgeIron 24G\b/ ) {
return;
}
@@ -276,17 +278,17 @@ sub c_ip {
my $partial = shift;
my $cdp = $foundry->SUPER::c_ip($partial) || {};
my $lldp = $foundry->lldp_ip($partial) || {};
my $lldp = $foundry->lldp_ip($partial) || {};
my %c_ip;
foreach my $iid (keys %$cdp){
foreach my $iid ( keys %$cdp ) {
my $ip = $cdp->{$iid};
next unless defined $ip;
$c_ip{$iid} = $ip;
}
foreach my $iid (keys %$lldp){
foreach my $iid ( keys %$lldp ) {
my $ip = $lldp->{$iid};
next unless defined $ip;
@@ -299,18 +301,18 @@ sub c_if {
my $foundry = shift;
my $partial = shift;
my $lldp = $foundry->lldp_if($partial) || {};;
my $lldp = $foundry->lldp_if($partial) || {};
my $cdp = $foundry->SUPER::c_if($partial) || {};
my %c_if;
foreach my $iid (keys %$cdp){
foreach my $iid ( keys %$cdp ) {
my $if = $cdp->{$iid};
next unless defined $if;
$c_if{$iid} = $if;
}
foreach my $iid (keys %$lldp){
foreach my $iid ( keys %$lldp ) {
my $if = $lldp->{$iid};
next unless defined $if;
@@ -323,18 +325,18 @@ sub c_port {
my $foundry = shift;
my $partial = shift;
my $lldp = $foundry->lldp_port($partial) || {};
my $lldp = $foundry->lldp_port($partial) || {};
my $cdp = $foundry->SUPER::c_port($partial) || {};
my %c_port;
foreach my $iid (keys %$cdp){
foreach my $iid ( keys %$cdp ) {
my $port = $cdp->{$iid};
next unless defined $port;
$c_port{$iid} = $port;
}
foreach my $iid (keys %$lldp){
foreach my $iid ( keys %$lldp ) {
my $port = $lldp->{$iid};
next unless defined $port;
@@ -347,18 +349,18 @@ sub c_id {
my $foundry = shift;
my $partial = shift;
my $lldp = $foundry->lldp_id($partial) || {};
my $lldp = $foundry->lldp_id($partial) || {};
my $cdp = $foundry->SUPER::c_id($partial) || {};
my %c_id;
foreach my $iid (keys %$cdp){
foreach my $iid ( keys %$cdp ) {
my $id = $cdp->{$iid};
next unless defined $id;
$c_id{$iid} = $id;
}
foreach my $iid (keys %$lldp){
foreach my $iid ( keys %$lldp ) {
my $id = $lldp->{$iid};
next unless defined $id;
@@ -371,18 +373,18 @@ sub c_platform {
my $foundry = shift;
my $partial = shift;
my $lldp = $foundry->lldp_rem_sysdesc($partial) || {};
my $lldp = $foundry->lldp_rem_sysdesc($partial) || {};
my $cdp = $foundry->SUPER::c_platform($partial) || {};
my %c_platform;
foreach my $iid (keys %$cdp){
foreach my $iid ( keys %$cdp ) {
my $platform = $cdp->{$iid};
next unless defined $platform;
$c_platform{$iid} = $platform;
}
foreach my $iid (keys %$lldp){
foreach my $iid ( keys %$lldp ) {
my $platform = $lldp->{$iid};
next unless defined $platform;
@@ -629,9 +631,9 @@ Returns reference to hash. Key: iid Value: remote IPv4 address
If multiple entries exist with the same local port, c_if(), with the same IPv4
address, c_ip(), it may be a duplicate entry.
If multiple entries exist with the same local port, c_if(), with different IPv4
addresses, c_ip(), there is either a non-FDP/LLDP device in between two or
more devices or multiple devices which are not directly connected.
If multiple entries exist with the same local port, c_if(), with different
IPv4 addresses, c_ip(), there is either a non-FDP/LLDP device in between two
or more devices or multiple devices which are not directly connected.
Use the data from the Layer2 Topology Table below to dig deeper.