- PBP compliance via Perl::Critic

- Use bare return to return failure
- No code before strictures are enabled
This commit is contained in:
Eric Miller
2008-07-09 00:32:47 +00:00
parent 1b85820314
commit 2c5301b676
68 changed files with 464 additions and 415 deletions

View File

@@ -2,6 +2,7 @@
# $Id$
#
# Copyright (c) 2008 Eric Miller
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -28,9 +29,8 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Airespace;
$VERSION = '1.09';
use strict;
use strict;
use Exporter;
use SNMP::Info;
@@ -39,6 +39,8 @@ use SNMP::Info;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::MIBS,
'AIRESPACE-WIRELESS-MIB' => 'bsnAPName',
@@ -151,7 +153,7 @@ sub layers {
sub serial {
my $airespace = shift;
my $sn = $airespace->airespace_serial();
return undef unless defined $sn;
return unless defined $sn;
return $sn;
}

View File

@@ -32,17 +32,18 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Bridge;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info;
use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
@SNMP::Info::Bridge::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::Bridge::EXPORT_OK = qw//;
use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
$VERSION = '1.09';
%MIBS = ('BRIDGE-MIB' => 'dot1dBaseBridgeAddress',
'Q-BRIDGE-MIB' => 'dot1qPvid',
);
@@ -355,7 +356,7 @@ sub set_remove_i_vlan_tagged {
sub _check_forbidden_ports {
my $bridge = shift;
my ($vlan_id, $index) = @_;
return undef 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);
@@ -363,7 +364,7 @@ sub _check_forbidden_ports {
print "Forbidden ports: @$forbidden_ports\n" if $bridge->debug();
if ( defined(@$forbidden_ports[$index-1]) and (@$forbidden_ports[$index-1] eq "1")) {
print "Error: Index: $index in forbidden list for VLAN: $vlan_id unable to add.\n" if $bridge->debug();
return undef;
return;
}
return 1;
}
@@ -376,7 +377,7 @@ sub _validate_vlan_param {
unless ( defined $vlan_id and defined $ifindex and
$vlan_id =~ /^\d+$/ and $ifindex =~ /^\d+$/ ) {
$bridge->error_throw("Invalid parameter.");
return undef;
return;
}
# Check that ifIndex exists on device
@@ -384,7 +385,7 @@ sub _validate_vlan_param {
unless ( exists $index->{$ifindex} ) {
$bridge->error_throw("ifIndex $ifindex does not exist.");
return undef;
return;
}
#Check that VLAN exists on device
@@ -403,7 +404,7 @@ sub _validate_vlan_param {
}
unless ( $vlan_exists ) {
$bridge->error_throw("VLAN $vlan_id does not exist or is not operational.");
return undef;
return;
}
return 1;

View File

@@ -32,10 +32,8 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::CDP;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info;
@@ -44,6 +42,8 @@ use SNMP::Info;
use vars qw/$VERSION $DEBUG %FUNCS %GLOBALS %MIBS %MUNGE $INIT/;
$VERSION = '1.09';
# Five data structures required by SNMP::Info
%MIBS = ( 'CISCO-CDP-MIB' => 'cdpGlobalRun' );
@@ -93,7 +93,7 @@ sub munge_null {
sub munge_caps {
my $caps = shift;
return undef unless defined $caps;
return unless defined $caps;
my $bits = substr(unpack("B*",$caps),-7);
return $bits;
@@ -117,7 +117,7 @@ sub hasCDP {
my $c_ip = $cdp->c_ip();
# See if anything in cdp cache, if so we have cdp
return 1 if (defined $c_ip and scalar(keys %$c_ip)) ;
return undef;
return;
}
return $cdp->cdp_run();
@@ -134,7 +134,7 @@ sub c_if {
my $c_ip = $cdp->c_ip();
unless (defined $c_ip){
$cdp->error_throw("SNMP::Info::CDP:c_if() - Device doesn't have cdp_ip() data. Can't fake cdp_index()");
return undef;
return;
}
my %c_if;

View File

@@ -1,6 +1,9 @@
# SNMP::Info::CiscoConfig
# $Id$
#
# Copyright (c) 2008 Eric Miller
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
@@ -26,10 +29,8 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::CiscoConfig;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info;
@@ -38,6 +39,8 @@ use SNMP::Info;
use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
'CISCO-CONFIG-COPY-MIB' => 'ccCopyTable',
'CISCO-FLASH-MIB' => 'ciscoFlashCopyTable',
@@ -95,35 +98,35 @@ sub copy_run_tftp {
unless ( $ciscoconfig->set_config_row_status( 6, $rand ) ) {
$ciscoconfig->error_throw("Setting source type failed and failed to delete row $rand");
}
return undef;
return;
}
unless ( $ciscoconfig->set_config_dest_type( 1, $rand ) ) {
$ciscoconfig->error_throw("Setting destination type failed");
unless ( $ciscoconfig->set_config_row_status( 6, $rand ) ) {
$ciscoconfig->error_throw("Setting dest type failed and failed to delete row $rand");
}
return undef;
return;
}
unless ( $ciscoconfig->set_config_server_addr( $tftphost, $rand ) ) {
$ciscoconfig->error_throw("Setting tftp server failed");
unless ( $ciscoconfig->set_config_row_status( 6, $rand ) ) {
$ciscoconfig->error_throw("Setting tftp server failed and failed to delete row $rand");
}
return undef;
return;
}
unless ( $ciscoconfig->set_config_filename( $tftpfile, $rand ) ) {
$ciscoconfig->error_throw("Setting file name failed");
unless ( $ciscoconfig->set_config_row_status( 6, $rand ) ) {
$ciscoconfig->error_throw("Setting file name failed and failed to delete row $rand");
}
return undef;
return;
}
unless ( $ciscoconfig->set_config_row_status( 1, $rand ) ) {
$ciscoconfig->error_throw("Initiating transfer failed");
unless ( $ciscoconfig->set_config_row_status( 6, $rand ) ) {
$ciscoconfig->error_throw("Initiating transfer failed and failed to delete row $rand");
}
return undef;
return;
}
my $status = 0;
my $timer = 0;
@@ -152,7 +155,7 @@ sub copy_run_tftp {
}
if ( $status eq 'failed' ) {
$ciscoconfig->error_throw("Save operation failed");
return undef;
return;
}
}
@@ -160,7 +163,7 @@ sub copy_run_tftp {
print "Using old method\n" if $ciscoconfig->debug();
unless ( $ciscoconfig->set_old_write_net( $tftpfile, $tftphost ) ) {
$ciscoconfig->error_throw("Save operation failed");
return undef;
return;
}
return 1;
@@ -182,14 +185,14 @@ sub copy_run_start {
unless ( $ciscoconfig->set_config_row_status( 6, $rand ) ) {
$ciscoconfig->error_throw("Setting dest type failed and failed to delete row $rand");
}
return undef;
return;
}
unless ( $ciscoconfig->set_config_row_status( 1, $rand ) ) {
$ciscoconfig->error_throw("Initiating save failed");
unless ( $ciscoconfig->set_config_row_status( 6, $rand ) ) {
$ciscoconfig->error_throw("Initiating save failed and failed to delete row $rand");
}
return undef;
return;
}
my $status = 0;
my $timer = 0;
@@ -218,7 +221,7 @@ sub copy_run_start {
}
if ( $status eq 'failed' ) {
$ciscoconfig->error_throw("Save operation failed");
return undef;
return;
}
}
@@ -226,7 +229,7 @@ sub copy_run_start {
print "Using old method\n" if $ciscoconfig->debug();
unless ( $ciscoconfig->set_old_write_mem( 1 ) ) {
$ciscoconfig->error_throw("Save operation failed");
return undef;
return;
}
return 1;

View File

@@ -1,7 +1,8 @@
package SNMP::Info::CiscoImage;
# $Id$
#
# Copyright (c) 2005 Matt Tuttle
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -28,16 +29,16 @@ package SNMP::Info::CiscoImage;
# POSSIBILITY OF SUCH DAMAGE.
use strict;
use Exporter;
use SNMP::Info;
use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/;
$VERSION = '1.09';
@SNMP::Info::CiscoImage::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::CiscoImage::EXPORT_OK = qw//;
use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
'CISCO-IMAGE-MIB' => 'ciscoImageString',
);

View File

@@ -2,6 +2,7 @@
# $Id$
#
# Copyright (c) 2008 Eric Miller
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -28,16 +29,17 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::CiscoPortSecurity;
$VERSION = '1.09';
use strict;
use Exporter;
use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE %PAECAPABILITIES/;
@SNMP::Info::CiscoPortSecurity::ISA = qw/Exporter/;
@SNMP::Info::CiscoPortSecurity::EXPORT_OK = qw//;
use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE %PAECAPABILITIES/;
$VERSION = '1.09';
%MIBS = (
'CISCO-PORT-SECURITY-MIB' => 'ciscoPortSecurityMIB',
'CISCO-PAE-MIB' => 'ciscoPaeMIB',
@@ -107,7 +109,7 @@ use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE %PAECAPABILITIES/;
sub munge_pae_capabilities {
my $bits = shift;
return undef unless defined $bits;
return unless defined $bits;
my @vals = map($PAECAPABILITIES{$_},sprintf("%x",unpack('b*',$bits)));
return join(' ',@vals);
}

View File

@@ -2,6 +2,7 @@
# $Id$
#
# Copyright (c) 2008 Bill Fenner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -28,17 +29,18 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::CiscoPower;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info;
use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
@SNMP::Info::CiscoPower::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::CiscoPower::EXPORT_OK = qw//;
use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/;
$VERSION = '1.09';
%MIBS = ('CISCO-POWER-ETHERNET-EXT-MIB' => 'cpeExtPsePortEntPhyIndex');
%GLOBALS = (

View File

@@ -2,7 +2,6 @@
# $Id$
#
# Copyright (c) 2005 Alexander Hartmaier
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -30,10 +29,8 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::CiscoQOS;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info;
@@ -42,6 +39,8 @@ use SNMP::Info;
use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
'CISCO-CLASS-BASED-QOS-MIB' => 'cbQosIfIndex',
);

View File

@@ -2,7 +2,6 @@
# $Id$
#
# Copyright (c) 2005 Alexander Hartmaier
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -30,10 +29,8 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::CiscoRTT;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info;
@@ -42,6 +39,8 @@ use SNMP::Info;
use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
'CISCO-RTTMON-MIB' => 'rttMonCtrlAdminOwner',
);

View File

@@ -29,17 +29,18 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::CiscoStack;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info;
use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE %PORTSTAT $INIT/;
@SNMP::Info::CiscoStack::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::CiscoStack::EXPORT_OK = qw//;
use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE %PORTSTAT/;
$VERSION = '1.09';
%MIBS = (
'CISCO-STACK-MIB' => 'ciscoStackMIB',
);
@@ -119,7 +120,7 @@ sub serial {
return $serial1 if defined $serial1;
return $serial2 if defined $serial2;
return undef;
return;
}
# Rules for older CatOS devices using CiscoStack

View File

@@ -32,17 +32,18 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::CiscoStats;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info;
use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
@SNMP::Info::CiscoStats::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::CiscoStats::EXPORT_OK = qw//;
use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
'SNMPv2-MIB' => 'sysDescr',
'CISCO-PROCESS-MIB' => 'cpmCPUTotal5sec',
@@ -89,7 +90,7 @@ sub os {
# order here matters - there are Catalysts that run IOS and have catalyst in their description field.
return 'ios' if ($descr =~ /IOS/);
return 'catalyst' if ($descr =~ /catalyst/i);
return undef;
return;
}
sub os_ver {
@@ -106,7 +107,7 @@ sub os_ver {
if (defined $descr and $descr =~ m/Version (\d+\.\d+\([^)]+\)[^,\s]*)(,|\s)+/ ){
return $1;
}
return undef;
return;
}
sub cpu {

View File

@@ -31,17 +31,18 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::CiscoVTP;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info;
use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/;
@SNMP::Info::CiscoVTP::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::CiscoVTP::EXPORT_OK = qw//;
use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
'CISCO-VTP-MIB' => 'vtpVlanName',
'CISCO-VLAN-MEMBERSHIP-MIB' => 'vmMembershipEntry',
@@ -249,7 +250,7 @@ sub set_i_pvid {
my $vtp = shift;
my ($vlan_id, $ifindex) = @_;
return undef unless ( $vtp->validate_vlan_param ($vlan_id, $ifindex) );
return unless ( $vtp->validate_vlan_param ($vlan_id, $ifindex) );
my $native_vlan = $vtp->vtp_trunk_native($ifindex);
if (defined $native_vlan) {
@@ -259,19 +260,19 @@ sub set_i_pvid {
my $rv = $vtp->set_vtp_trunk_native($vlan_id, $ifindex);
unless ($rv) {
$vtp->error_throw("Unable to change native VLAN to $vlan_id on IfIndex: $ifindex");
return undef;
return;
}
return $rv;
}
$vtp->error_throw("Can't find ifIndex: $ifindex - Is it a trunk port?");
return undef;
return;
}
sub set_i_vlan {
my $vtp = shift;
my ($vlan_id, $ifindex) = @_;
return undef unless ( $vtp->validate_vlan_param ($vlan_id, $ifindex) );
return unless ( $vtp->validate_vlan_param ($vlan_id, $ifindex) );
my $i_vlan = $vtp->i_vlan2($ifindex);
if (defined $i_vlan) {
@@ -281,19 +282,19 @@ sub set_i_vlan {
my $rv = $vtp->set_i_vlan2($vlan_id, $ifindex);
unless ($rv) {
$vtp->error_throw("Unable to change VLAN to $vlan_id on IfIndex: $ifindex");
return undef;
return;
}
return $rv;
}
$vtp->error_throw("Can't find ifIndex: $ifindex - Is it an access port?");
return undef;
return;
}
sub set_add_i_vlan_tagged {
my $vtp = shift;
my ($vlan_id, $ifindex) = @_;
return undef 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();
@@ -302,7 +303,7 @@ sub set_add_i_vlan_tagged {
unless (defined $trunk_members) {
$vtp->error_throw("Can't find ifIndex: $ifindex - Is it a trunk port?");
return undef;
return;
}
my @member_list = split(//, unpack("B*", $trunk_members->{$ifindex}));
@@ -315,13 +316,13 @@ sub set_add_i_vlan_tagged {
my $list_rv = $vtp->set_vtp_trunk_vlans($new_list, $ifindex);
unless ($list_rv) {
$vtp->error_throw("Unable to add VLAN: $vlan_id to ifIndex: $ifindex member list");
return undef;
return;
}
#Make sure no other SNMP manager was making modifications at the same time.
my $serial_rv = $vtp->set_vtp_trunk_set_serial($trunk_serial);
unless ($serial_rv) {
$vtp->error_throw("Unable to increment trunk set serial number - check configuration!");
return undef;
return;
}
return 1;
}
@@ -330,7 +331,7 @@ sub set_remove_i_vlan_tagged {
my $vtp = shift;
my ($vlan_id, $ifindex) = @_;
return undef 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();
@@ -339,7 +340,7 @@ sub set_remove_i_vlan_tagged {
unless (defined $trunk_members) {
$vtp->error_throw("Can't find ifIndex: $ifindex - Is it a trunk port?");
return undef;
return;
}
my @member_list = split(//, unpack("B*", $trunk_members->{$ifindex}));
@@ -352,13 +353,13 @@ sub set_remove_i_vlan_tagged {
my $list_rv = $vtp->set_vtp_trunk_vlans($new_list, $ifindex);
unless ($list_rv) {
$vtp->error_throw("Error: Unable to remove VLAN: $vlan_id from ifIndex: $ifindex member list");
return undef;
return;
}
#Make sure no other manager was making modifications at the same time.
my $serial_rv = $vtp->set_vtp_trunk_set_serial($trunk_serial);
unless ($serial_rv) {
$vtp->error_throw("Error: Unable to increment trunk set serial number - check configuration!");
return undef;
return;
}
return 1;
}
@@ -373,7 +374,7 @@ sub validate_vlan_param {
# VID and ifIndex should both be numeric
unless ( defined $vlan_id and defined $ifindex and $vlan_id =~ /^\d+$/ and $ifindex =~ /^\d+$/ ) {
$vtp->error_throw("Invalid parameter");
return undef;
return;
}
# Check that ifIndex exists on device
@@ -381,7 +382,7 @@ sub validate_vlan_param {
unless ( exists $index->{$ifindex} ) {
$vtp->error_throw("ifIndex $ifindex does not exist");
return undef;
return;
}
#Check that VLAN exists on device
@@ -403,7 +404,7 @@ sub validate_vlan_param {
}
unless ( $vlan_exists ) {
$vtp->error_throw("VLAN $vlan_id does not exist or is not operational");
return undef;
return;
}
return 1;

View File

@@ -31,17 +31,18 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Entity;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info;
use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
@SNMP::Info::Entity::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::Entity::EXPORT_OK = qw//;
use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/;
$VERSION = '1.09';
%MIBS = ('ENTITY-MIB' => 'entPhysicalSerialNum');
%GLOBALS = (
@@ -80,7 +81,7 @@ sub e_index {
# Force use of MIB leaf to avoid inheritance issues in psuedo classes
my $e_descr = $entity->entPhysicalDescr($partial);
return undef unless ($e_descr);
return unless ($e_descr);
my %e_index;

View File

@@ -31,17 +31,18 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::EtherLike;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info;
use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
@SNMP::Info::EtherLike::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::EtherLike::EXPORT_OK = qw//;
use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
'ETHERLIKE-MIB' => 'etherMIB'
);

View File

@@ -34,14 +34,14 @@
package SNMP::Info::FDP;
use strict;
use Exporter;
use SNMP::Info;
@SNMP::Info::FDP::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::FDP::EXPORT_OK = qw//;
use vars qw/$VERSION $DEBUG %FUNCS %GLOBALS %MIBS %MUNGE $INIT/;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
@@ -82,7 +82,7 @@ $VERSION = '1.09';
sub munge_caps {
my $caps = shift;
return undef unless defined $caps;
return unless defined $caps;
my $bits = substr(unpack("B*",$caps),-7);
return $bits;
@@ -108,7 +108,7 @@ sub hasFDP {
my $fdp_ip = $fdp->fdp_ip();
# See if anything in fdp cache, if so we have fdp
return 1 if (defined $fdp_ip and scalar(keys %$fdp_ip)) ;
return undef;
return;
}
return $fdp->fdp_run();
@@ -125,7 +125,7 @@ sub c_if {
my $fdp_ip = $fdp->c_ip();
unless (defined $fdp_ip){
$fdp->error_throw("SNMP::Info::FDP:fdp_if() - Device doesn't have fdp_ip() data. Can't fake fdp_index()");
return undef;
return;
}
my %fdp_if;

View File

@@ -2,6 +2,7 @@
# $Id$
#
# Copyright (c) 2008 Eric Miller
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -28,9 +29,8 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::IEEE802dot11;
$VERSION = '1.09';
use strict;
use strict;
use Exporter;
@SNMP::Info::IEEE802dot11::ISA = qw/Exporter/;
@@ -38,6 +38,8 @@ use Exporter;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
'IEEE802dot11-MIB' => 'dot11DesiredSSID',
);
@@ -94,7 +96,7 @@ sub vendor {
}
}
return undef;
return;
}
sub model {
@@ -107,7 +109,7 @@ sub model {
next unless defined $prod;
return lc($prod);
}
return undef;
return;
}
sub os_ver {
@@ -123,7 +125,7 @@ sub os_ver {
}
}
return undef;
return;
}
sub i_80211channel {

View File

@@ -29,17 +29,17 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::LLDP;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info;
@SNMP::Info::LLDP::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::LLDP::EXPORT_OK = qw//;
use vars qw/$VERSION $DEBUG %FUNCS %GLOBALS %MIBS %MUNGE $INIT/;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
'LLDP-MIB' => 'lldpLocSysCapEnabled',
@@ -89,7 +89,7 @@ sub munge_null {
sub munge_caps {
my $caps = shift;
return undef unless defined $caps;
return unless defined $caps;
my $bits = unpack("b*",$caps);
return $bits;
@@ -103,7 +103,7 @@ sub hasLLDP {
my $lldp_cap = $lldp->lldp_sys_cap();
return 1 if defined $lldp_cap;
return undef;
return;
}
sub lldp_if {
@@ -222,7 +222,7 @@ sub lldp_id {
# return $addr if (defined $addr and $lldp->snmp_connect_ip($addr));
# }
# }
# return undef;
# return;
#}
# Break up the lldpRemManAddrTable INDEX into common index, protocol,
@@ -243,7 +243,7 @@ sub _lldp_addr_index {
}
# TODO - Need to handle other protocols, i.e. IPv6
else {
return undef;
return;
}
}
@@ -401,7 +401,7 @@ Returns the mapping to the SNMP Interface Table.
=item $lldp->lldp_ip()
Returns remote IPv4 address. Returns undef for all other address types, use
Returns remote IPv4 address. Returns for all other address types, use
lldp_addr if you want any return address type.
=item $lldp->lldp_addr()

View File

@@ -31,18 +31,18 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer1;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info;
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %PORTSTAT %MUNGE/;
@SNMP::Info::Layer1::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::Layer1::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %PORTSTAT %MUNGE/;
$VERSION = '1.09';
%MIBS = ( %SNMP::Info::MIBS,
'SNMP-REPEATER-MIB' => 'rptrPortGroupIndex'
);

View File

@@ -31,17 +31,17 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer1::Allied;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info::Layer1;
@SNMP::Info::Layer1::Allied::ISA = qw/SNMP::Info::Layer1 Exporter/;
@SNMP::Info::Layer1::Allied::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
# Set for No CDP
%GLOBALS = (
@@ -87,7 +87,7 @@ sub model {
if ($desc =~ /(AT-\d{4}\S{1}?)/){
return $1;
}
return undef;
return;
}
sub i_name{

View File

@@ -31,17 +31,17 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer1::Asante;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info::Layer1;
@SNMP::Info::Layer1::Asante::ISA = qw/SNMP::Info::Layer1 Exporter/;
@SNMP::Info::Layer1::Asante::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
# Set for No CDP
%GLOBALS = (
@@ -148,7 +148,7 @@ sub i_mac {
}
sub i_description {
return undef;
return;
}
sub i_name {

View File

@@ -2,6 +2,7 @@
# $Id$
#
# Copyright (c) 2008 Eric Miller, Max Baker
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -28,9 +29,8 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer1::Bayhub;
$VERSION = '1.09';
use strict;
use strict;
use Exporter;
use SNMP::Info::SONMP;
use SNMP::Info::NortelStack;
@@ -39,7 +39,9 @@ use SNMP::Info::Layer2;
@SNMP::Info::Layer1::Bayhub::ISA = qw/SNMP::Info::SONMP SNMP::Info::NortelStack SNMP::Info::Layer2 Exporter/;
@SNMP::Info::Layer1::Bayhub::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer2::MIBS,
@@ -95,7 +97,7 @@ sub vendor {
sub model {
my $bayhub = shift;
my $id = $bayhub->id();
return undef unless defined $id;
return unless defined $id;
my $model = &SNMP::translateObj($id);
return $id unless defined $model;
$model =~ s/^sreg-//i;

View File

@@ -2,6 +2,7 @@
# $Id$
#
# Copyright (c) 2008 Eric Miller
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -28,9 +29,8 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer1::Cyclades;
$VERSION = '1.09';
use strict;
use strict;
use Exporter;
use SNMP::Info::Layer1;
@@ -39,6 +39,8 @@ use SNMP::Info::Layer1;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer1::MIBS,
'CYCLADES-ACS-SYS-MIB' => 'cyACSversion',
@@ -91,7 +93,7 @@ sub model {
my $model = $cyclades->cy_model();
return undef unless defined $model;
return unless defined $model;
return lc($model);
}

View File

@@ -2,6 +2,7 @@
# $Id$
#
# Copyright (c) 2008 Eric Miller
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -28,16 +29,17 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer1::S3000;
$VERSION = '1.09';
use strict;
use strict;
use Exporter;
use SNMP::Info::Layer2;
@SNMP::Info::Layer1::S3000::ISA = qw/SNMP::Info::Layer2 Exporter/;
@SNMP::Info::Layer1::S3000::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer2::MIBS,
@@ -90,7 +92,7 @@ sub vendor {
sub model {
my $s3000 = shift;
my $id = $s3000->id();
return undef unless defined $id;
return unless defined $id;
my $model = &SNMP::translateObj($id);
return $id unless defined $model;
$model =~ s/^s3reg-//i;
@@ -121,7 +123,7 @@ sub mac {
return $mac;
}
# Topology turned off, not supported.
return undef;
return;
}
# Hubs do not support ifMIB requirements for get MAC

View File

@@ -31,21 +31,21 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info;
use SNMP::Info::Bridge;
use SNMP::Info::Entity;
use SNMP::Info::PowerEthernet;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %PORTSTAT %MUNGE $INIT/;
@SNMP::Info::Layer2::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::Entity SNMP::Info::PowerEthernet Exporter/;
@SNMP::Info::Layer2::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %PORTSTAT %MUNGE/;
$VERSION = '1.09';
%MIBS = ( %SNMP::Info::MIBS,
%SNMP::Info::Bridge::MIBS,
%SNMP::Info::Entity::MIBS,
@@ -126,7 +126,7 @@ sub serial {
return $1 if (defined $chassis and $chassis =~ /serial#?:\s*([a-z0-9]+)/i);
return $serial1 if (defined $serial1 and $serial1 !~ /^\s*$/);
return undef;
return;
}
sub i_ignore {

View File

@@ -28,9 +28,8 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::Airespace;
$VERSION = '1.09';
use strict;
use strict;
use Exporter;
use SNMP::Info::Bridge;
use SNMP::Info::CDP;
@@ -41,6 +40,8 @@ use SNMP::Info::Airespace;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::MIBS,
%SNMP::Info::Bridge::MIBS,
@@ -80,7 +81,7 @@ sub vendor {
sub model {
my $airespace = shift;
my $model = $airespace->airespace_model();
return undef unless defined $model;
return unless defined $model;
return $model;
}

View File

@@ -31,10 +31,8 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::Aironet;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info::Layer2;
use SNMP::Info::Entity;
@@ -47,7 +45,9 @@ use SNMP::Info::IEEE802dot11;
SNMP::Info::CiscoStats SNMP::Info::CDP Exporter/;
@SNMP::Info::Layer2::Aironet::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
%GLOBALS = (
%SNMP::Info::IEEE802dot11::GLOBALS,

View File

@@ -1,7 +1,7 @@
# SNMP::Info::Layer2::Allied
# $Id$
#
# Copyright (c) 2004 Max Baker
# Copyright (c) 2008 Max Baker
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -29,10 +29,8 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::Allied;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info::Layer2;
use SNMP::Info::Layer1;
@@ -40,7 +38,9 @@ use SNMP::Info::Layer1;
@SNMP::Info::Layer2::Allied::ISA = qw/SNMP::Info::Layer2 Exporter/;
@SNMP::Info::Layer2::Allied::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
%GLOBALS = (
%SNMP::Info::Layer2::GLOBALS
@@ -87,7 +87,7 @@ sub model {
if ($desc =~ /(AT-80\d{2}\S*)/){
return $1;
}
return undef;
return;
}
sub root_ip {

View File

@@ -2,6 +2,7 @@
# $Id$
#
# Copyright (c) 2008 Eric Miller
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -28,16 +29,17 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::Aruba;
$VERSION = '1.09';
use strict;
use strict;
use Exporter;
use SNMP::Info::Layer2;
@SNMP::Info::Layer2::Aruba::ISA = qw/SNMP::Info::Layer2 Exporter/;
@SNMP::Info::Layer2::Aruba::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer2::MIBS,
@@ -90,19 +92,19 @@ sub vendor {
sub os_ver {
my $aruba = shift;
my $descr = $aruba->description();
return undef unless defined $descr;
return unless defined $descr;
if ($descr =~ m/Version\s+(\d+\.\d+\.\d+\.\d+)/){
return $1;
}
return undef;
return;
}
sub model {
my $aruba = shift;
my $id = $aruba->id();
return undef unless defined $id;
return unless defined $id;
my $model = &SNMP::translateObj($id);
return $id unless defined $model;

View File

@@ -32,17 +32,17 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::Bay;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info::Layer2;
@SNMP::Info::Layer2::Bay::ISA = qw/SNMP::Info::Layer2 Exporter/;
@SNMP::Info::Layer2::Bay::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
# Set for No CDP
%GLOBALS = ( %SNMP::Info::Layer2::GLOBALS,
@@ -84,7 +84,7 @@ sub os {
sub os_ver {
my $bay = shift;
my $descr = $bay->description();
return undef unless defined $descr;
return unless defined $descr;
# 303 / 304
if ($descr =~ m/Rev: \d+\.\d+\.\d+\.\d+-(\d+\.\d+\.\d+\.\d+)/){
@@ -95,13 +95,13 @@ sub os_ver {
if ($descr =~ m/SW:v(\d+\.\d+\.\d+\.\d+)/){
return $1;
}
return undef;
return;
}
sub os_bin {
my $bay = shift;
my $descr = $bay->description();
return undef unless defined $descr;
return unless defined $descr;
# 303 / 304
if ($descr =~ m/Rev: \d+\.(\d+\.\d+\.\d+)-\d+\.\d+\.\d+\.\d+/){
@@ -112,7 +112,7 @@ sub os_bin {
if ($descr =~ m/FW:v(\d+\.\d+\.\d+\.\d+)/){
return $1;
}
return undef;
return;
}
sub vendor {
@@ -158,7 +158,7 @@ sub i_mac {
sub model {
my $bay = shift;
my $id = $bay->id();
return undef unless defined $id;
return unless defined $id;
my $model = &SNMP::translateObj($id);
return $id unless defined $model;
$model =~ s/^sreg-//i;

View File

@@ -29,10 +29,8 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::Baystack;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info::SONMP;
use SNMP::Info::NortelStack;
@@ -45,7 +43,9 @@ use SNMP::Info::Layer3;
SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer2::Baystack::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer3::MIBS,
@@ -101,7 +101,7 @@ sub os {
sub os_bin {
my $baystack = shift;
my $descr = $baystack->description();
return undef unless defined $descr;
return unless defined $descr;
# 303 / 304
if ($descr =~ m/Rev: \d+\.(\d+\.\d+\.\d+)-\d+\.\d+\.\d+\.\d+/){
@@ -116,7 +116,7 @@ sub os_bin {
if ($descr =~ m/FW:(\d+\.\d+\.\d+\.\d+)/i){
return $1;
}
return undef;
return;
}
sub vendor {
@@ -126,7 +126,7 @@ sub vendor {
sub model {
my $baystack = shift;
my $id = $baystack->id();
return undef unless defined $id;
return unless defined $id;
my $model = &SNMP::translateObj($id);
return $id unless defined $model;

View File

@@ -31,10 +31,8 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::C1900;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info::CDP;
use SNMP::Info::CiscoStats;
@@ -46,7 +44,9 @@ use SNMP::Info::Layer2;
Exporter/;
@SNMP::Info::Layer2::C1900::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
%GLOBALS = (
%SNMP::Info::Layer2::GLOBALS,
@@ -107,12 +107,12 @@ sub os_ver {
return $os_ver if defined $os_ver;
my $c1900_flash_status = $c1900->c1900_flash_status();
return undef unless defined $c1900_flash_status;
return unless defined $c1900_flash_status;
if ( $c1900_flash_status =~ m/V(\d+\.\d+(\.\d+)?)/ ) {
return $1;
}
return undef;
return;
}
sub interfaces {
@@ -207,7 +207,7 @@ sub i_vlan {
$c1900->vlanAllowMembershipOverlap() || 'disabled';
if ($overlap eq 'enabled') {
return undef;
return;
}
my $member_of = $c1900->bridgeGroupMemberPortOfBridgeGroup() ||

View File

@@ -31,10 +31,8 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::C2900;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info::CiscoVTP;
use SNMP::Info::CDP;
@@ -47,7 +45,9 @@ use SNMP::Info::Layer2;
SNMP::Info::Layer2 Exporter/;
@SNMP::Info::Layer2::C2900::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
%GLOBALS = (
%SNMP::Info::Layer2::GLOBALS,
@@ -157,7 +157,7 @@ sub set_i_speed_admin {
$speed = lc($speed);
return undef unless defined $speeds{$speed};
return unless defined $speeds{$speed};
# account for weirdness of c2900 mib
$iid = $reverse_2900{$iid};
@@ -177,7 +177,7 @@ sub set_i_duplex_admin {
$duplex = lc($duplex);
return undef unless defined $duplexes{$duplex};
return unless defined $duplexes{$duplex};
# account for weirdness of c2900 mib
$iid = $reverse_2900{$iid};

View File

@@ -30,10 +30,8 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::Catalyst;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info::CiscoStack;
use SNMP::Info::CiscoVTP;
@@ -42,13 +40,16 @@ use SNMP::Info::CiscoStats;
use SNMP::Info::CiscoPortSecurity;
use SNMP::Info::Layer2;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
@SNMP::Info::Layer2::Catalyst::ISA = qw/SNMP::Info::CiscoStack SNMP::Info::CiscoVTP
SNMP::Info::CDP SNMP::Info::CiscoStats
SNMP::Info::CiscoPortSecurity
SNMP::Info::Layer2 Exporter/;
@SNMP::Info::Layer2::Catalyst::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/ ;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer2::MIBS,
%SNMP::Info::CiscoPortSecurity::MIBS,
@@ -115,11 +116,11 @@ sub os_ver {
return $os_ver if defined $os_ver;
my $m_swver = $cat->m_swver();
return undef unless defined $m_swver;
return unless defined $m_swver;
# assume .1 entry is the chassis and the sw version we want.
return $m_swver->{1} if defined $m_swver->{1};
return undef;
return;
}
# Workaround for incomplete bp_index

View File

@@ -2,6 +2,7 @@
# $Id$
#
# Copyright (c) 2008 Eric Miller
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -28,10 +29,8 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::Centillion;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info;
use SNMP::Info::Bridge;
@@ -41,7 +40,9 @@ 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::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::MIBS,
@@ -201,7 +202,7 @@ sub i_vlan {
sub model {
my $centillion = shift;
my $id = $centillion->id();
return undef unless defined $id;
return unless defined $id;
my $model = &SNMP::translateObj($id);
return $id unless defined $model;
$model =~ s/^sreg-//i;

View File

@@ -2,6 +2,7 @@
# $Id$
#
# Copyright (c) 2008 Max Baker
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -30,7 +31,6 @@
package SNMP::Info::Layer2::Cisco;
use strict;
use Exporter;
use SNMP::Info::CiscoVTP;
use SNMP::Info::CDP;
@@ -41,8 +41,6 @@ use SNMP::Info::CiscoQOS;
use SNMP::Info::CiscoConfig;
use SNMP::Info::Layer2;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
$VERSION = '1.09';
@SNMP::Info::Layer2::Cisco::ISA = qw/SNMP::Info::CiscoVTP SNMP::Info::CDP
SNMP::Info::CiscoStats SNMP::Info::CiscoImage
SNMP::Info::CiscoRTT SNMP::Info::CiscoQOS
@@ -50,6 +48,10 @@ $VERSION = '1.09';
Exporter/;
@SNMP::Info::Layer2::Cisco::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/ ;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer2::MIBS,
%SNMP::Info::CiscoConfig::MIBS,

View File

@@ -2,6 +2,7 @@
# $Id$
#
# Copyright (c) 2008 Max Baker
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -28,22 +29,22 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::Foundry;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info::Layer2;
use SNMP::Info::FDP;
use SNMP::Info::EtherLike;
use SNMP::Info::MAU;
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
@SNMP::Info::Layer2::Foundry::ISA = qw/SNMP::Info::Layer2 SNMP::Info::FDP SNMP::Info::EtherLike
SNMP::Info::MAU Exporter/;
@SNMP::Info::Layer2::Foundry::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = ( %SNMP::Info::Layer2::MIBS,
%SNMP::Info::FDP::MIBS,
%SNMP::Info::EtherLike::MIBS,
@@ -150,7 +151,7 @@ sub serial {
my $name = $e_name->{$e} || '';
$unit_iid = $e if $name eq 'unit.1';
}
return undef unless defined $unit_iid;
return unless defined $unit_iid;
# Look up serial of found entry.
my $e_serial = $foundry->e_serial();

View File

@@ -31,22 +31,22 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::HP;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info::Layer3;
use SNMP::Info::MAU;
use SNMP::Info::LLDP;
use SNMP::Info::CDP;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %PORTSTAT %MODEL_MAP %MUNGE $INIT/ ;
@SNMP::Info::Layer2::HP::ISA = qw/SNMP::Info::Layer3 SNMP::Info::MAU SNMP::Info::LLDP
SNMP::Info::CDP Exporter/;
@SNMP::Info::Layer2::HP::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %PORTSTAT %MODEL_MAP %MUNGE/ ;
$VERSION = '1.09';
%MIBS = ( %SNMP::Info::Layer3::MIBS,
%SNMP::Info::MAU::MIBS,
%SNMP::Info::LLDP::MIBS,
@@ -198,14 +198,14 @@ sub os_ver {
if ($descr =~ m/revision ([A-Z]{1}\.\d{2}\.\d{2})/) {
return $1;
}
return undef;
return;
}
# Lookup model number, and translate the part number to the common number
sub model {
my $hp = shift;
my $id = $hp->id();
return undef unless defined $id;
return unless defined $id;
my $model = &SNMP::translateObj($id);
return $id unless defined $model;
@@ -316,7 +316,7 @@ sub slots {
my $e_name = $hp->e_name();
return undef unless defined $e_name;
return unless defined $e_name;
my $slots;
foreach my $slot (keys %$e_name) {

View File

@@ -2,6 +2,7 @@
# $Id$
#
# Copyright (c) 2008 Eric Miller
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -28,9 +29,8 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::N2270;
$VERSION = '1.09';
use strict;
use strict;
use Exporter;
use SNMP::Info;
use SNMP::Info::Bridge;
@@ -42,6 +42,8 @@ use SNMP::Info::Airespace;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::MIBS,
%SNMP::Info::Bridge::MIBS,
@@ -81,7 +83,7 @@ sub vendor {
sub model {
my $n2270 = shift;
my $id = $n2270->id();
return undef unless defined $id;
return unless defined $id;
my $model = &SNMP::translateObj($id);
return $id unless defined $model;
$model =~ s/^sreg-WLANSecuritySwitch//i;

View File

@@ -2,6 +2,7 @@
# $Id$
#
# Copyright (c) 2008 Eric Miller
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -28,9 +29,8 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::NAP222x;
$VERSION = '1.09';
use strict;
use strict;
use Exporter;
use SNMP::Info::SONMP;
use SNMP::Info::IEEE802dot11;
@@ -41,6 +41,8 @@ use SNMP::Info::Layer2;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer2::MIBS,
%SNMP::Info::IEEE802dot11::MIBS,
@@ -95,22 +97,22 @@ sub os {
sub os_bin {
my $nap222x = shift;
my $bin = $nap222x->nt_fw_ver();
return undef unless defined $bin;
return unless defined $bin;
if ($bin =~ m/(\d+\.\d+\.\d+)/){
return $1;
}
return undef;
return;
}
sub model {
my $nap222x = shift;
my $descr = $nap222x->description();
return undef unless defined $descr;
return unless defined $descr;
return 'AP-2220' if ($descr =~ /2220/);
return 'AP-2221' if ($descr =~ /2221/);
return undef;
return;
}
sub mac {
@@ -123,7 +125,7 @@ sub mac {
next unless $sn;
return $sn;
}
return undef;
return;
}
sub serial {
@@ -136,7 +138,7 @@ sub serial {
next unless $sn;
return $sn;
}
return undef;
return;
}
sub interfaces {

View File

@@ -2,6 +2,7 @@
# $Id$
#
# Copyright (c) 2008 Bill Fenner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -30,17 +31,16 @@
package SNMP::Info::Layer2::Netgear;
use strict;
use Exporter;
use SNMP::Info::Layer2;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/;
$VERSION = '1.09';
@SNMP::Info::Layer2::Netgear::ISA = qw/SNMP::Info::Layer2 Exporter/;
@SNMP::Info::Layer2::Netgear::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer2::MIBS,
);

View File

@@ -2,6 +2,7 @@
# $Id$
#
# Copyright (c) 2008 Eric Miller
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -28,9 +29,8 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::Orinoco;
$VERSION = '1.09';
use strict;
use strict;
use Exporter;
use SNMP::Info::IEEE802dot11;
use SNMP::Info::Layer2;
@@ -40,6 +40,8 @@ use SNMP::Info::Layer2;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer2::MIBS,
%SNMP::Info::IEEE802dot11::MIBS,
@@ -74,7 +76,7 @@ sub os_ver {
my $orinoco = shift;
my $descr = $orinoco->description();
return undef unless defined $descr;
return unless defined $descr;
if ($descr =~ m/V(\d+\.\d+)/){
return $1;
@@ -83,14 +85,14 @@ sub os_ver {
return $1;
}
return undef;
return;
}
sub os_bin {
my $orinoco = shift;
my $descr = $orinoco->description();
return undef unless defined $descr;
return unless defined $descr;
if ($descr =~ m/V(\d+\.\d+)$/){
return $1;
@@ -99,7 +101,7 @@ sub os_bin {
return $1;
}
return undef;
return;
}
sub vendor {
@@ -110,18 +112,18 @@ sub model {
my $orinoco = shift;
my $descr = $orinoco->description();
return undef unless defined $descr;
return unless defined $descr;
return $1 if ($descr =~ /(AP-\d+)/);
return 'WavePOINT-II' if ($descr =~ /WavePOINT-II/);
return undef;
return;
}
sub serial {
my $orinoco = shift;
my $descr = $orinoco->description();
return undef unless defined $descr;
return unless defined $descr;
$descr = $1 if $descr =~ /SN-(\S+)/;
return $descr;

View File

@@ -29,17 +29,17 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::ZyXEL_DSLAM;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info::Layer2;
@SNMP::Info::Layer2::ZyXEL_DSLAM::ISA = qw/SNMP::Info::Layer2 Exporter/;
@SNMP::Info::Layer2::ZyXEL_DSLAM::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
# Set for No CDP
%GLOBALS = (
@@ -85,7 +85,7 @@ sub os_ver {
if ($descr =~ m/version (\S+) /){
return $1;
}
return undef;
return;
}
sub model {
@@ -98,7 +98,7 @@ sub model {
} elsif ($desc =~ /8-port ADSL Module\(Annex B\)/){
return "AAM1008-63";
}
return undef;
return;
}
sub ip{

View File

@@ -31,10 +31,8 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer3;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info;
use SNMP::Info::Bridge;
@@ -42,13 +40,15 @@ use SNMP::Info::EtherLike;
use SNMP::Info::Entity;
use SNMP::Info::PowerEthernet;
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
@SNMP::Info::Layer3::ISA = qw/SNMP::Info::PowerEthernet
SNMP::Info::Entity SNMP::Info::EtherLike
SNMP::Info::Bridge SNMP::Info Exporter/;
@SNMP::Info::Layer3::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = ( %SNMP::Info::MIBS,
%SNMP::Info::Bridge::MIBS,
%SNMP::Info::EtherLike::MIBS,
@@ -146,7 +146,7 @@ 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 undef;
return;
}
sub i_ignore {
@@ -181,7 +181,7 @@ sub serial {
return $1 if (defined $chassis and $chassis =~ /serial#?:\s*([a-z0-9]+)/i);
return $serial1 if (defined $serial1 and $serial1 !~ /^\s*$/);
return undef;
return;
}
# $l3->model() - the sysObjectID returns an IID to an entry in
@@ -192,7 +192,7 @@ sub model {
unless (defined $id){
print " SNMP::Info::Layer3::model() - Device does not support sysObjectID\n" if $l3->debug();
return undef;
return;
}
my $model = &SNMP::translateObj($id);

View File

@@ -31,17 +31,18 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer3::Aironet;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info::Layer3;
use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
@SNMP::Info::Layer3::Aironet::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::Aironet::EXPORT_OK = qw//;
use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer3::MIBS,
'AWCVX-MIB' => 'awcIfTable',
@@ -97,7 +98,7 @@ sub os_ver {
return $1;
}
return undef;
return;
}
# Override wireless port with static info

View File

@@ -29,18 +29,18 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer3::AlteonAD;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info::Layer3;
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE /;
@SNMP::Info::Layer3::AlteonAD::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::AlteonAD::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer3::MIBS,
'ALTEON-ROOT-MIB' => 'aceswitch184',
@@ -115,7 +115,7 @@ sub model {
unless (defined $id){
print " SNMP::Info::Layer3::AlteonAD::model() - Device does not support sysObjectID\n" if $alteon->debug();
return undef;
return;
}
my $model = &SNMP::translateObj($id);
@@ -140,7 +140,7 @@ sub os {
sub os_ver {
my $alteon = shift;
my $version = $alteon->new_sw_ver() || $alteon->old_sw_ver();
return undef unless defined $version;
return unless defined $version;
return $version;
}

View File

@@ -29,22 +29,22 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer3::BayRS;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info;
use SNMP::Info::Layer3;
use SNMP::Info::Bridge;
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE %MODEL_MAP
%MODID_MAP %PROCID_MAP/;
@SNMP::Info::Layer3::BayRS::ISA = qw/SNMP::Info SNMP::Info::Layer3
SNMP::Info::Bridge Exporter/;
@SNMP::Info::Layer3::BayRS::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE %MODEL_MAP
%MODID_MAP %PROCID_MAP/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::MIBS,
%SNMP::Info::Layer3::MIBS,
@@ -548,12 +548,12 @@ sub os {
sub os_ver {
my $bayrs = shift;
my $descr = $bayrs->description();
return undef unless defined $descr;
return unless defined $descr;
if ($descr =~ m/^\s*Image:\s+re[lv]\/((\d+\.){1,3}\d+)/){
return $1;
}
return undef;
return;
}
sub serial {
@@ -562,7 +562,7 @@ sub serial {
$serialnum = hex(join('','0x',map{sprintf "%02X", $_}unpack("C*",$serialnum)));
return $serialnum if defined $serialnum ;
return undef;
return;
}
sub interfaces {
@@ -740,7 +740,7 @@ sub root_ip {
return $ospf_ip;
}
return undef;
return;
}
# Pseudo ENTITY-MIB methods
@@ -1287,7 +1287,7 @@ sub munge_hw_rev {
my $rev = "$major.$minor";
return $rev if defined($rev);
return undef;
return;
}
sub munge_wf_serial {
@@ -1296,7 +1296,7 @@ sub munge_wf_serial {
my $serial = hex(join('','0x',map{sprintf "%02X", $_}unpack("C*",$wf_serial)));
return $serial if defined($serial);
return undef;
return;
}
1;

View File

@@ -30,10 +30,8 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer3::C3550;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info::CiscoVTP;
use SNMP::Info::CiscoStack;
@@ -44,7 +42,6 @@ use SNMP::Info::CiscoPortSecurity;
use SNMP::Info::CiscoPower;
use SNMP::Info::Layer3;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
@SNMP::Info::Layer3::C3550::ISA = qw/SNMP::Info::CiscoVTP SNMP::Info::CiscoStack
SNMP::Info::CDP SNMP::Info::CiscoStats
SNMP::Info::CiscoPortSecurity
@@ -53,6 +50,10 @@ use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
Exporter/;
@SNMP::Info::Layer3::C3550::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/ ;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::CiscoPower::MIBS,

View File

@@ -31,9 +31,7 @@
package SNMP::Info::Layer3::C4000;
use strict;
use Exporter;
use SNMP::Info::CiscoVTP;
use SNMP::Info::CDP;
use SNMP::Info::CiscoStats;
@@ -43,8 +41,6 @@ use SNMP::Info::CiscoConfig;
use SNMP::Info::MAU;
use SNMP::Info::Layer3;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
$VERSION = '1.09';
@SNMP::Info::Layer3::C4000::ISA = qw/SNMP::Info::CiscoVTP SNMP::Info::CDP
SNMP::Info::CiscoStats SNMP::Info::CiscoImage
SNMP::Info::CiscoPortSecurity
@@ -52,6 +48,10 @@ $VERSION = '1.09';
SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::C4000::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/ ;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::MAU::MIBS,
@@ -118,7 +118,7 @@ sub fan {
$ret .= $s . $fan_descr->{$i} . ": " . $fan_state->{$i};
$s = ", ";
}
return undef if ($s eq "");
return if ($s eq "");
$ret;
}

View File

@@ -31,7 +31,6 @@
package SNMP::Info::Layer3::C6500;
use strict;
use Exporter;
use SNMP::Info::CiscoVTP;
use SNMP::Info::CiscoStack;
@@ -43,8 +42,6 @@ use SNMP::Info::CiscoConfig;
use SNMP::Info::CiscoPower;
use SNMP::Info::Layer3;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
$VERSION = '1.09';
@SNMP::Info::Layer3::C6500::ISA = qw/SNMP::Info::CiscoVTP SNMP::Info::CiscoStack
SNMP::Info::CDP SNMP::Info::CiscoStats
SNMP::Info::CiscoImage
@@ -55,6 +52,10 @@ $VERSION = '1.09';
Exporter/;
@SNMP::Info::Layer3::C6500::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/ ;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::CiscoPower::MIBS,

View File

@@ -2,6 +2,7 @@
# $Id$
#
# Copyright (c) 2008 Max Baker
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -30,7 +31,6 @@
package SNMP::Info::Layer3::Cisco;
use strict;
use Exporter;
use SNMP::Info::CiscoVTP;
use SNMP::Info::CDP;
@@ -42,8 +42,6 @@ use SNMP::Info::CiscoConfig;
use SNMP::Info::CiscoPower;
use SNMP::Info::Layer3;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
$VERSION = '1.09';
@SNMP::Info::Layer3::Cisco::ISA = qw/SNMP::Info::CiscoVTP SNMP::Info::CDP
SNMP::Info::CiscoStats SNMP::Info::CiscoImage
SNMP::Info::CiscoRTT SNMP::Info::CiscoQOS
@@ -52,6 +50,10 @@ $VERSION = '1.09';
Exporter/;
@SNMP::Info::Layer3::Cisco::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::CiscoPower::MIBS,

View File

@@ -29,20 +29,20 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer3::Contivity;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info;
use SNMP::Info::Layer3;
use SNMP::Info::Entity;
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
@SNMP::Info::Layer3::Contivity::ISA = qw/SNMP::Info SNMP::Info::Layer3 SNMP::Info::Entity Exporter/;
@SNMP::Info::Layer3::Contivity::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::MIBS,
%SNMP::Info::Layer3::MIBS,
@@ -82,7 +82,7 @@ sub model {
my $model = $e_model->{1} || undef;
return $1 if (defined $model and $model =~ /(CES\d+)/i);
return undef;
return;
}
sub os {
@@ -92,12 +92,12 @@ sub os {
sub os_ver {
my $contivity = shift;
my $descr = $contivity->description();
return undef unless defined $descr;
return unless defined $descr;
if ($descr =~ m/V(\d+_\d+\.\d+)/i){
return $1;
}
return undef;
return;
}
sub mac {
@@ -110,7 +110,7 @@ sub mac {
next unless $sn;
return $sn;
}
return undef;
return;
}
sub serial {
@@ -120,7 +120,7 @@ sub serial {
my $serial = $e_serial->{1} || undef;
return $1 if (defined $serial and $serial =~ /(\d+)/);
return undef;
return;
}

View File

@@ -31,17 +31,16 @@
package SNMP::Info::Layer3::Dell;
use strict;
use Exporter;
use SNMP::Info::Layer3;
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
$VERSION = '1.09';
@SNMP::Info::Layer3::Dell::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::Dell::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = ( %SNMP::Info::Layer3::MIBS,
'RADLAN-Physicaldescription-MIB' => 'rlPhdStackReorder',
'RADLAN-rlInterfaces' => 'rlIfNumOfLoopbackPorts',

View File

@@ -31,22 +31,21 @@
package SNMP::Info::Layer3::Enterasys;
use strict;
use Exporter;
use SNMP::Info::MAU;
use SNMP::Info::LLDP;
use SNMP::Info::CDP;
use SNMP::Info::Layer3;
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
$VERSION = '1.09';
@SNMP::Info::Layer3::Enterasys::ISA = qw/SNMP::Info::MAU SNMP::Info::LLDP
SNMP::Info::CDP SNMP::Info::Layer3
Exporter/;
@SNMP::Info::Layer3::Enterasys::EXPORT_OK = qw//;
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::CDP::MIBS,
@@ -83,7 +82,7 @@ sub model {
unless (defined $id){
print " SNMP::Info::Layer3::Enterasys::model() - Device does not support sysObjectID\n" if $enterasys->debug();
return undef;
return;
}
my $model = &SNMP::translateObj($id);
@@ -106,13 +105,13 @@ sub os {
sub os_ver {
my $enterasys = shift;
my $descr = $enterasys->description();
return undef unless defined $descr;
return unless defined $descr;
if ($descr =~ m/\bRev ([\d.]*)/){
return $1;
}
return undef;
return;
}
# Use ifName as it is used for CDP and LLDP.

View File

@@ -33,18 +33,17 @@
package SNMP::Info::Layer3::Extreme;
use strict;
use Exporter;
use SNMP::Info::Layer3;
use SNMP::Info::MAU;
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
$VERSION = '1.09';
@SNMP::Info::Layer3::Extreme::ISA = qw/SNMP::Info::Layer3 SNMP::Info::MAU Exporter/;
@SNMP::Info::Layer3::Extreme::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = ( %SNMP::Info::Layer3::MIBS,
%SNMP::Info::MAU::MIBS,
'EXTREME-BASE-MIB' => 'extremeAgent',
@@ -103,7 +102,7 @@ sub model {
unless (defined $id){
print " SNMP::Info::Layer3::Extreme::model() - Device does not support sysObjectID\n" if $extreme->debug();
return undef;
return;
}
my $model = &SNMP::translateObj($id);
@@ -124,13 +123,13 @@ sub os {
sub os_ver {
my $extreme = shift;
my $descr = $extreme->description();
return undef unless defined $descr;
return unless defined $descr;
if ($descr =~ m/Version ([\d.]*)/){
return $1;
}
return undef;
return;
}
#
@@ -188,7 +187,7 @@ sub bp_index {
sub munge_true_ok {
my $val = shift;
return undef unless defined($val);
return unless defined($val);
return "OK" if ($val eq 'true');
return "Not OK" if ($val eq 'false');
return $val;
@@ -196,7 +195,7 @@ sub munge_true_ok {
sub munge_power_stat {
my $val = shift;
return undef unless defined($val);
return unless defined($val);
$val =~ s/^present//;
$val =~ s/^not/Not /i;
return $val;
@@ -223,7 +222,7 @@ sub fan {
$ret .= $s . $i . ": " . $fan_state->{$i};
$s = ", ";
}
return undef if ($s eq "");
return if ($s eq "");
$ret;
}
@@ -404,13 +403,13 @@ sub _extreme_set_i_vlan {
my $encapidx = $encapif{$vlan_id};
if (!defined($encapidx)) {
$extreme->error_throw("can't map $vlan_id to encapsulation interface");
return undef;
return;
}
# now find vlan interface stacked above encap
my @abovevlan = keys %{$invstack->{$encapidx}};
if (@abovevlan != 1) {
$extreme->error_throw("can't map encap interface $encapidx for $vlan_id to encapsulation interface");
return undef;
return;
}
my $vlanidx = $abovevlan[0];
my $rv;
@@ -422,14 +421,14 @@ sub _extreme_set_i_vlan {
$rv = $extreme->set_ifStackStatus("destroy", $oldidx . "." . $ifindex);
unless ($rv) {
$extreme->error_throw("Unable to remove $ifindex from old VLAN index $oldidx");
return undef;
return;
}
}
# Add new VLAN mapping
$rv = $extreme->set_ifStackStatus("createAndGo", $vlanidx . "." . $ifindex);
unless ($rv) {
$extreme->error_throw("Unable to add new VLAN index $vlanidx to ifIndex $ifindex");
return undef;
return;
}
# XXX invalidate cache of ifstack?
# XXX Info.pm library function for this?
@@ -449,12 +448,12 @@ sub set_remove_i_vlan_tagged {
my $encapidx = $encapif{$vlan_id};
if (!defined($encapidx)) {
$extreme->error_throw("can't map $vlan_id to encapsulation interface");
return undef;
return;
}
my $rv = $extreme->set_ifStackStatus("destroy", $encapidx . "." . $ifindex);
unless ($rv) {
$extreme->error_throw("Unable to delete VLAN encap ifIndex $encapidx for VLAN $vlan_id from ifIndex $ifindex");
return undef;
return;
}
# invalidate cache of ifstack?
return $rv;
@@ -470,12 +469,12 @@ sub set_add_i_vlan_tagged {
my $encapidx = $encapif{$vlan_id};
if (!defined($encapidx)) {
$extreme->error_throw("can't map $vlan_id to encapsulation interface");
return undef;
return;
}
my $rv = $extreme->set_ifStackStatus("createAndGo", $encapidx . "." . $ifindex);
unless ($rv) {
$extreme->error_throw("Unable to add VLAN encap ifIndex $encapidx for VLAN $vlan_id to ifIndex $ifindex");
return undef;
return;
}
# invalidate cache of ifstack?
return $rv;

View File

@@ -33,20 +33,19 @@
package SNMP::Info::Layer3::Foundry;
use strict;
use Exporter;
use SNMP::Info::Layer3;
use SNMP::Info::FDP;
use SNMP::Info::LLDP;
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
$VERSION = '1.09';
@SNMP::Info::Layer3::Foundry::ISA = qw/SNMP::Info::FDP SNMP::Info::LLDP
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,
@@ -257,7 +256,7 @@ sub stp_p_state {
my $descr = $foundry->description();
if ($descr =~ m/\bEdgeIron 24G\b/) {
return undef;
return;
}
return $foundry->SUPER::stp_p_state($partial) || {};

View File

@@ -31,20 +31,19 @@
package SNMP::Info::Layer3::HP9300;
use strict;
use Exporter;
use SNMP::Info::Layer3;
use SNMP::Info::FDP;
use SNMP::Info::LLDP;
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
$VERSION = '1.09';
@SNMP::Info::Layer3::HP9300::ISA = qw/SNMP::Info::FDP SNMP::Info::LLDP
SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::HP9300::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = ( %SNMP::Info::Layer3::MIBS,
%SNMP::Info::LLDP::MIBS,
%SNMP::Info::FDP::MIBS,

View File

@@ -30,14 +30,17 @@
package SNMP::Info::Layer3::Juniper;
use strict;
use Exporter;
use SNMP::Info::Layer3;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
$VERSION = '1.09';
@SNMP::Info::Layer3::Juniper::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::Juniper::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/ ;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer3::MIBS,
'JUNIPER-CHASSIS-DEFINES-MIB' => 'jnxChassisDefines',
@@ -68,12 +71,12 @@ sub os {
sub os_ver {
my $juniper = shift;
my $descr = $juniper->description();
return undef unless defined $descr;
return unless defined $descr;
if ($descr =~ m/kernel JUNOS (\S+)/) {
return $1;
}
return undef;
return;
}
sub model {
@@ -82,7 +85,7 @@ sub model {
unless (defined $id){
print " SNMP::Info::Layer3::Juniper::model() - Device does not support sysObjectID\n" if $l3->debug();
return undef;
return;
}
my $model = &SNMP::translateObj($id);

View File

@@ -29,15 +29,18 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer3::Microsoft;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info::Layer3;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
@SNMP::Info::Layer3::Microsoft::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::Microsoft::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/ ;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer3::MIBS,
);

View File

@@ -31,18 +31,17 @@
package SNMP::Info::Layer3::N1600;
use strict;
use Exporter;
use SNMP::Info::Layer3;
use SNMP::Info::SONMP;
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
$VERSION = '1.09';
@SNMP::Info::Layer3::N1600::ISA = qw/SNMP::Info::Layer3 SNMP::Info::SONMP Exporter/;
@SNMP::Info::Layer3::N1600::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = ( %SNMP::Info::Layer3::MIBS,
%SNMP::Info::SONMP::MIBS,
'SWL2MGMT-MIB' => 'swL2MgmtMIB',
@@ -80,7 +79,7 @@ sub model {
unless (defined $id){
print " SNMP::Info::Layer3::N1600::model() - Device does not support sysObjectID\n" if $n1600->debug();
return undef;
return;
}
my $model = &SNMP::translateObj($id);
@@ -102,13 +101,13 @@ sub os {
sub os_ver {
my $n1600 = shift;
my $descr = $n1600->description();
return undef unless defined $descr;
return unless defined $descr;
if ($descr =~ m/(\d+\.\d+\.\d+\.\d+)/){
return $1;
}
return undef;
return;
}
sub interfaces {

View File

@@ -30,14 +30,17 @@
package SNMP::Info::Layer3::NetSNMP;
use strict;
use Exporter;
use SNMP::Info::Layer3;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
$VERSION = '1.09';
@SNMP::Info::Layer3::NetSNMP::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::NetSNMP::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/ ;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer3::MIBS,
'UCD-SNMP-MIB' => 'versionTag',
@@ -68,7 +71,7 @@ sub os {
my $descr = $netsnmp->description();
return $1 if ($descr =~ /^(\S+)\s+/);
return undef;
return;
}
sub os_ver {

View File

@@ -29,16 +29,17 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer3::Netscreen;
$VERSION = '1.09';
use strict;
use strict;
use Exporter;
use SNMP::Info::Layer3;
@SNMP::Info::Layer3::Netscreen::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::Netscreen::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer3::MIBS,
@@ -80,7 +81,7 @@ sub os_ver {
if ( $descr =~ m/version (\d\S*) \(SN: /) {
return $1;
}
return undef;
return;
}
sub serial {
@@ -95,7 +96,7 @@ sub serial {
if ( $descr =~ m/version .*\(SN: (\d\S*),/) {
return $1;
}
return undef;
return;
}
1;

View File

@@ -29,21 +29,21 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer3::Passport;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info::SONMP;
use SNMP::Info::RapidCity;
use SNMP::Info::Layer3;
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
@SNMP::Info::Layer3::Passport::ISA = qw/SNMP::Info::SONMP SNMP::Info::RapidCity
SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::Passport::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::RapidCity::MIBS,
@@ -74,7 +74,7 @@ sub model {
unless (defined $id){
print " SNMP::Info::Layer3::Passport::model() - Device does not support sysObjectID\n" if $passport->debug();
return undef;
return;
}
my $model = &SNMP::translateObj($id);
@@ -96,7 +96,7 @@ sub os {
sub os_ver {
my $passport = shift;
my $descr = $passport->description();
return undef unless defined $descr;
return unless defined $descr;
#ERS / Passport
if ($descr =~ m/(\d+\.\d+\.\d+\.\d+)/){
@@ -106,7 +106,7 @@ sub os_ver {
if ($descr =~ m/(\d+\.\d+\.\d+)/){
return $1;
}
return undef;
return;
}
sub i_index {
@@ -512,7 +512,7 @@ sub root_ip {
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 undef;
return;
}
# Required for SNMP::Info::SONMP

View File

@@ -29,17 +29,18 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer3::Sun;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info::Layer3;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
@SNMP::Info::Layer3::Sun::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::Sun::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/ ;
$VERSION = '1.09';
%MIBS = (
%SNMP::Info::Layer3::MIBS,
);
@@ -69,12 +70,12 @@ sub os {
sub os_ver {
my $sun = shift;
my $descr = $sun->motd();
return undef unless defined $descr;
return unless defined $descr;
if ($descr =~ m/SunOS (\S+)/) {
return $1;
}
return undef;
return;
}
sub model {

View File

@@ -31,17 +31,18 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::MAU;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info;
use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
@SNMP::Info::MAU::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::MAU::EXPORT_OK = qw//;
use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/;
$VERSION = '1.09';
%MIBS = ('MAU-MIB' => 'mauMod');
%GLOBALS = (
@@ -74,7 +75,7 @@ use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
sub munge_int2bin {
my $int = shift;
return undef unless defined $int;
return unless defined $int;
return unpack("B32", pack("N", $int));
}
@@ -174,7 +175,7 @@ sub mau_i_duplex_admin {
if (defined($mau_index)) {
return mau_i_duplex_admin_old($mau,$mau_index,$mau_autostat);
} else {
return undef;
return;
}
}

View File

@@ -29,17 +29,17 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::NortelStack;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info;
@SNMP::Info::NortelStack::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::NortelStack::EXPORT_OK = qw//;
use vars qw/$VERSION $DEBUG %FUNCS %GLOBALS %MIBS %MUNGE $INIT/;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
# S5-ROOT-MIB and S5-TCS-MIB required by the MIBs below
@@ -100,7 +100,7 @@ sub os_ver {
my $stack = shift;
my $ver = $stack->ns_ag_ver();
return undef unless defined $ver;
return unless defined $ver;
if ($ver =~ m/(\d+\.\d+\.\d+\.\d+)/){
return $1;
@@ -108,14 +108,14 @@ sub os_ver {
if ($ver =~ m/V(\d+\.\d+\.\d+)/i){
return $1;
}
return undef;
return;
}
sub os_bin {
my $stack = shift;
my $ver = $stack->ns_ag_ver();
return undef unless defined $ver;
return unless defined $ver;
if ($ver =~ m/(\d+\.\d+\.\d+\.\d+)/i){
return $1;
@@ -123,7 +123,7 @@ sub os_bin {
if ($ver =~ m/V(\d+\.\d+.\d+)/i){
return $1;
}
return undef;
return;
}
# Need to override here since overridden in Layer2 and Layer3 classes
@@ -133,7 +133,7 @@ sub serial {
my $ver = $stack->ns_serial();
return $ver unless !defined $ver;
return undef;
return;
}
# Pseudo ENTITY-MIB methods for older switches with don't support ENTITY-MIB

View File

@@ -29,17 +29,18 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::PowerEthernet;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info;
use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
@SNMP::Info::PowerEthernet::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::PowerEthernet::EXPORT_OK = qw//;
use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/;
$VERSION = '1.09';
%MIBS = ('POWER-ETHERNET-MIB' => 'pethPsePortDetectionStatus');
%GLOBALS = (
@@ -80,7 +81,7 @@ sub peth_port_ifindex {
# This heuristic won't work, so say that we got nothing.
# If you have this case, you have to write a device-specific
# version of this function.
return undef;
return;
}
$peth_port_ifindex->{$i} = $port;
}

View File

@@ -29,9 +29,8 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::RapidCity;
$VERSION = '1.09';
use strict;
use strict;
use Exporter;
use SNMP::Info;
@@ -40,6 +39,8 @@ use SNMP::Info;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
'RAPID-CITY' => 'rapidCity',
);
@@ -155,7 +156,7 @@ sub serial {
my $ver = $rapidcity->rc_serial();
return $ver unless !defined $ver;
return undef;
return;
}
sub i_duplex {
@@ -231,7 +232,7 @@ sub set_i_duplex_admin {
my ($duplex, $iid) = @_;
$duplex = lc($duplex);
return undef unless ($duplex =~ /(half|full|auto)/ and $iid =~ /\d+/);
return unless ($duplex =~ /(half|full|auto)/ and $iid =~ /\d+/);
# map a textual duplex to an integer one the switch understands
my %duplexes = qw/full 2 half 1/;
@@ -241,20 +242,20 @@ sub set_i_duplex_admin {
return $rapidcity->set_rc_auto('1', $iid);
}
elsif (($duplex ne "auto") and ($i_auto->{$iid} eq "1")) {
return undef unless ($rapidcity->set_rc_auto('2', $iid));
return unless ($rapidcity->set_rc_auto('2', $iid));
return $rapidcity->set_rc_duplex_admin($duplexes{$duplex}, $iid);
}
else {
return $rapidcity->set_rc_duplex_admin($duplexes{$duplex}, $iid);
}
return undef;
return;
}
sub set_i_speed_admin {
my $rapidcity = shift;
my ($speed, $iid) = @_;
return undef unless ($speed =~ /(10|100|1000|auto)/i and $iid =~ /\d+/);
return unless ($speed =~ /(10|100|1000|auto)/i and $iid =~ /\d+/);
# map a textual duplex to an integer one the switch understands
my %speeds = qw/10 1 100 2 1000 3/;
@@ -264,13 +265,13 @@ sub set_i_speed_admin {
return $rapidcity->set_rc_auto('1', $iid);
}
elsif (($speed ne "auto") and ($i_auto->{$iid} eq "1")) {
return undef unless ($rapidcity->set_rc_auto('2', $iid));
return unless ($rapidcity->set_rc_auto('2', $iid));
return $rapidcity->set_rc_speed_admin($speeds{$speed}, $iid);
}
else {
return $rapidcity->set_rc_speed_admin($speeds{$speed}, $iid);
}
return undef;
return;
}
sub v_index {
@@ -316,11 +317,11 @@ sub set_i_pvid {
my $rapidcity = shift;
my ($vlan_id, $ifindex) = @_;
return undef unless ( $rapidcity->validate_vlan_param ($vlan_id, $ifindex) );
return unless ( $rapidcity->validate_vlan_param ($vlan_id, $ifindex) );
unless ( $rapidcity->set_rc_i_vlan_pvid($vlan_id, $ifindex) ) {
$rapidcity->error_throw("Unable to change PVID to $vlan_id on IfIndex: $ifindex");
return undef;
return;
}
return 1;
}
@@ -329,12 +330,12 @@ sub set_i_vlan {
my $rapidcity = shift;
my ($new_vlan_id, $ifindex) = @_;
return undef unless ( $rapidcity->validate_vlan_param ($new_vlan_id, $ifindex) );
return unless ( $rapidcity->validate_vlan_param ($new_vlan_id, $ifindex) );
my $vlan_p_type = $rapidcity->rc_i_vlan_type($ifindex);
unless ( $vlan_p_type->{$ifindex} =~ /access/ ) {
$rapidcity->error_throw("Not an access port");
return undef;
return;
}
my $i_pvid = $rapidcity->rc_i_vlan_pvid($ifindex);
@@ -344,7 +345,7 @@ sub set_i_vlan {
# Check that haven't been given the same VLAN we are currently using
if ($old_vlan_id eq $new_vlan_id) {
$rapidcity->error_throw("Current PVID: $old_vlan_id and New VLAN: $new_vlan_id the same, no change.");
return undef;
return;
}
print "Changing VLAN: $old_vlan_id to $new_vlan_id on IfIndex: $ifindex\n"
@@ -352,7 +353,7 @@ sub set_i_vlan {
# Check if port in forbidden list for the VLAN, haven't seen this used,
# but we'll check anyway
return undef unless
return unless
($rapidcity->check_forbidden_ports($new_vlan_id, $ifindex));
my $old_vlan_members = $rapidcity->rc_vlan_members($old_vlan_id);
@@ -369,14 +370,14 @@ sub set_i_vlan {
# ['rc_vlan_members',"$old_vlan_id","$old_egress"],
];
return undef unless
return unless
($rapidcity->set_multi($vlan_set));
my $vlan_set2 = [
['rc_vlan_members',"$old_vlan_id","$old_egress"],
];
return undef unless
return unless
($rapidcity->set_multi($vlan_set2));
# Set new untagged / native VLAN
@@ -386,7 +387,7 @@ sub set_i_vlan {
my $cur_i_pvid = $i_pvid->{$ifindex};
print "Current PVID: $cur_i_pvid\n" if $rapidcity->debug();
unless ($cur_i_pvid eq $new_vlan_id) {
return undef 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();
@@ -397,12 +398,12 @@ sub set_add_i_vlan_tagged {
my $rapidcity = shift;
my ($vlan_id, $ifindex) = @_;
return undef 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();
# Check if port in forbidden list for the VLAN, haven't seen this used, but we'll check anyway
return undef 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);
@@ -411,7 +412,7 @@ sub set_add_i_vlan_tagged {
unless ( $rapidcity->set_qb_v_egress($new_egress, $vlan_id) ) {
print "Error: Unable to add VLAN: $vlan_id to Index: $ifindex egress list.\n" if $rapidcity->debug();
return undef;
return;
}
print "Successfully added IfIndex: $ifindex to VLAN: $vlan_id egress list\n" if $rapidcity->debug();
@@ -422,7 +423,7 @@ sub set_remove_i_vlan_tagged {
my $rapidcity = shift;
my ($vlan_id, $ifindex) = @_;
return undef 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();
@@ -433,7 +434,7 @@ sub set_remove_i_vlan_tagged {
unless ( $rapidcity->set_qb_v_egress($new_egress, $vlan_id) ) {
print "Error: Unable to add VLAN: $vlan_id to Index: $ifindex egress list.\n" if $rapidcity->debug();
return undef;
return;
}
print "Successfully removed IfIndex: $ifindex from VLAN: $vlan_id egress list\n" if $rapidcity->debug();
@@ -444,7 +445,7 @@ sub set_remove_i_vlan_tagged {
sub set_create_vlan {
my $rapidcity = shift;
my ($name, $vlan_id) = @_;
return undef unless ($vlan_id =~ /\d+/);
return unless ($vlan_id =~ /\d+/);
my $vlan_set = [
['v_name',"$vlan_id","$name"],
@@ -453,7 +454,7 @@ sub set_create_vlan {
unless ($rapidcity->set_multi($vlan_set)){
print "Error: Unable to create VLAN: $vlan_id\n" if $rapidcity->debug();
return undef;
return;
}
return 1;
@@ -462,11 +463,11 @@ sub set_create_vlan {
sub set_delete_vlan {
my $rapidcity = shift;
my ($vlan_id) = shift;
return undef unless ($vlan_id =~ /^\d+$/);
return unless ($vlan_id =~ /^\d+$/);
unless ( $rapidcity->set_rc_vlan_rstatus('6', $vlan_id) ) {
$rapidcity->error_throw("Unable to delete VLAN: $vlan_id");
return undef;
return;
}
return 1;
}
@@ -484,7 +485,7 @@ sub check_forbidden_ports {
print "Forbidden ports: @forbidden_ports\n" if $rapidcity->debug();
if ( defined($forbidden_ports[$ifindex]) and ($forbidden_ports[$ifindex] eq "1")) {
$rapidcity->error_throw("IfIndex: $ifindex in forbidden list for VLAN: $vlan_id unable to add");
return undef;
return;
}
return 1;
}
@@ -496,7 +497,7 @@ sub validate_vlan_param {
# VID and ifIndex should both be numeric
unless ( defined $vlan_id and defined $ifindex and $vlan_id =~ /^\d+$/ and $ifindex =~ /^\d+$/ ) {
$rapidcity->error_throw("Invalid parameter");
return undef;
return;
}
# Check that ifIndex exists on device
@@ -504,13 +505,13 @@ sub validate_vlan_param {
unless ( exists $index->{$ifindex} ) {
$rapidcity->error_throw("ifIndex $ifindex does not exist");
return undef;
return;
}
#Check that VLAN exists on device
unless ( $rapidcity->rc_vlan_id($vlan_id) ) {
$rapidcity->error_throw("VLAN $vlan_id does not exist or is not operational");
return undef;
return;
}
return 1;

View File

@@ -29,17 +29,17 @@
# POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::SONMP;
$VERSION = '1.09';
use strict;
use Exporter;
use SNMP::Info;
@SNMP::Info::SONMP::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::SONMP::EXPORT_OK = qw//;
use vars qw/$VERSION $DEBUG %FUNCS %GLOBALS %MIBS %MUNGE $INIT/;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
$VERSION = '1.09';
%MIBS = (
'SYNOPTICS-ROOT-MIB' => 'synoptics',
@@ -208,7 +208,7 @@ sub mac {
return $mac;
}
# Topology turned off, not supported.
return undef;
return;
}
1;