Merge remote-tracking branch 'upstream/master' into nexans_support

This commit is contained in:
Christoph Neuhaus
2018-03-26 17:31:21 +02:00
129 changed files with 2969 additions and 1512 deletions

View File

@@ -24,7 +24,7 @@ use vars
qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG %SPEED_MAP
$NOSUCH $BIGINT $REPEATERS/;
$VERSION = '3.51';
$VERSION = '3.53';
=head1 NAME
@@ -32,7 +32,7 @@ SNMP::Info - OO Interface to Network devices and MIBs through SNMP
=head1 VERSION
SNMP::Info - Version 3.51
SNMP::Info - Version 3.53
=head1 AUTHOR
@@ -1283,7 +1283,7 @@ sub new {
}
# Connects to device unless open session is provided.
$sess = new SNMP::Session(
$sess = SNMP::Session->new(
'UseEnums' => 1,
%sess_args, 'RetryNoSuch' => $new_obj->{nosuch}
) unless defined $sess;
@@ -1345,7 +1345,7 @@ sub update {
delete $sess_args{BigInt};
delete $sess_args{MibDirs};
my $sess = new SNMP::Session(
my $sess = SNMP::Session->new(
'UseEnums' => 1,
%sess_args, 'RetryNoSuch' => $obj->{nosuch}
);
@@ -2728,7 +2728,7 @@ sub _get_topo_data {
my $self = shift;
my $partial = shift;
my $topo_cap = shift;
my $method = shift;
my $method = shift || '';
return unless $method =~ /(ip|if|port|id|platform|cap)/;
@@ -3063,7 +3063,9 @@ the SNMP::Info methods.
'name' => 'sysName',
'location' => 'sysLocation',
'layers' => 'sysServices',
# IF-MIB
'ports' => 'ifNumber',
# IP-MIB
'ipforwarding' => 'ipForwarding',
);
@@ -3081,7 +3083,9 @@ ALTEON-TS-PHYSICAL-MIB::agPortCurCfgPortName.
=cut
%FUNCS = (
# IF-MIB::IfEntry
'interfaces' => 'ifIndex',
# IF-MIB::IfEntry
'i_name' => 'ifName',
# IF-MIB::IfEntry
@@ -3111,13 +3115,13 @@ ALTEON-TS-PHYSICAL-MIB::agPortCurCfgPortName.
# IF-MIB::IfStackTable
'i_stack_status' => 'ifStackStatus',
# IP Address Table
# IP::MIB::ipAddrTable (deprecated IPv4 address table)
'ip_index' => 'ipAdEntIfIndex',
'ip_table' => 'ipAdEntAddr',
'ip_netmask' => 'ipAdEntNetMask',
'ip_broadcast' => 'ipAdEntBcastAddr',
# ifXTable - Extension Table
# IF-MIB::ifXTable - Extension Table
'i_speed_high' => 'ifHighSpeed',
'i_pkts_multi_in' => 'ifInMulticastPkts',
'i_pkts_multi_out' => 'ifOutMulticastPkts',
@@ -3133,7 +3137,7 @@ ALTEON-TS-PHYSICAL-MIB::agPortCurCfgPortName.
'i_pkts_bcast_out64' => 'ifHCOutBroadcastPkts',
'i_alias' => 'ifAlias',
# IP Routing Table
# RFC-1213::ipRoute (deprecated Table IP Routing Table)
'ipr_route' => 'ipRouteDest',
'ipr_if' => 'ipRouteIfIndex',
'ipr_1' => 'ipRouteMetric1',
@@ -3164,7 +3168,13 @@ $info->init() will throw an exception if a MIB does not load.
%MIBS = (
# The "main" MIBs are automagically loaded in Net-SNMP now.
# Include these here for cases where the Net-SNMP default MIB list has
# been overridden during the compliation of the local Net-SNMP library.
# These cover the globals and funcs defined in this file.
'SNMPv2-MIB' => 'sysObjectID',
'RFC1213-MIB' => 'ipRouteIfIndex',
'IP-MIB' => 'ipAdEntAddr',
'IF-MIB' => 'ifIndex',
);
=item %MUNGE
@@ -4244,7 +4254,7 @@ sub _load_attr {
# partial fetch may strip the Module portion upon return. We need
# the match to make sure we didn't leave the table during getnext
# requests
my ($leaf) = $qual_leaf =~ /::(\w+)$/;
$self->debug()
@@ -4252,7 +4262,7 @@ sub _load_attr {
defined $partial ? "($partial)" : '', " : $oid" ,
defined $partial ? ".$partial" : '', "\n";
my $var = new SNMP::Varbind( [$qual_leaf, $partial] );
my $var = SNMP::Varbind->new( [$qual_leaf, $partial] );
# So devices speaking SNMP v.1 are not supposed to give out
# data from SNMP2, but most do. Net-SNMP, being very precise
@@ -4445,7 +4455,7 @@ sub snmp_connect_ip {
return if ( $ip eq '0.0.0.0' ) or ( $ip =~ /^127\./ );
# Create session object
my $snmp_test = new SNMP::Session(
my $snmp_test = SNMP::Session->new(
'DestHost' => $ip,
'Community' => $comm,
'Version' => $ver
@@ -4687,21 +4697,27 @@ sub can {
my $funcs = $self->funcs();
# We need to resolve funcs with a prefix or suffix
my $f_method = $method;
$f_method =~ s/^(load|orig)_//;
$f_method =~ s/_raw$//;
my $base_method = $method;
$base_method =~ s/^(load|orig)_//;
$base_method =~ s/_raw$//;
no strict 'refs'; ## no critic (ProhibitNoStrict )
# We could add load_/orig_/_raw alternatives to symbol table here on
# first call of any type for a global or func since they all use the same
# destination code, but they aren't used heavily in main code base so
# well just create if/when they are called rather than pollute the
# symbol table with entries that never get called.
# Check for set_ ing.
if ( $method =~ /^set_/ ) {
return *{$AUTOLOAD} = _make_setter( $method, $oid, @_ );
return *{$method} = _make_setter( $method, $oid, @_ );
}
elsif ( defined $funcs->{$f_method} || $table ) {
return *{$AUTOLOAD} = _load_attr( $method, $oid, @_ );
elsif ( defined $funcs->{$base_method} || $table ) {
return *{$method} = _load_attr( $method, $oid, @_ );
}
else {
return *{$AUTOLOAD} = _global( $method, $oid );
return *{$method} = _global( $method, $oid );
}
}
@@ -4741,12 +4757,12 @@ subclass.
=cut
our $AUTOLOAD;
sub AUTOLOAD {
my $self = shift;
my ($sub_name) = $AUTOLOAD =~ /::(\w+)$/;
return if $sub_name =~ /DESTROY$/;
# Typos in function calls in SNMP::Info subclasses turn into
# AUTOLOAD requests for non-methods. While this is deprecated,
# we'll still get called, so report a less confusing error.
@@ -4773,6 +4789,9 @@ sub AUTOLOAD {
}
# Skip AUTOLOAD()
sub DESTROY {}
1;
=head1 COPYRIGHT AND LICENSE