Hi

I`m having problems with the SNMP.pm Perl module for Net-SNMP. I`m 
trying to use the gettable() function to retrieve a table using the 
following perl code:

#!/usr/bin/perl

use SNMP;
use strict;

use Data::Dumper;

SNMP::initMib();
SNMP::addMibDirs("/mnt/mibs/vendor/siemens/gpon");
SNMP::addMibDirs("/mnt/mibs/vendor/siemens");
SNMP::addMibDirs("/mnt/mibs/ietf");
SNMP::loadModules("ALL");

sub gpon_siemens_snmp($)
{
        (my $ip) = @_;

        my $session = new SNMP::Session(
                DestHost => $ip,
                Community => "public",
                Version => "2c",
                UseEnums => 1,
                UseSprintValue => 1
        );

        die "Cannot create SNMP::Session (",
$SNMP::Session::ErrorStr,")\n" if ( ! defined($session));

        return $session;
}

my $ip = shift;

my $session = gpon_siemens_snmp($ip);

my $vname = shift;

print "Getting value $vname from $ip\n";

my $ent = $session->gettable($vname);

print Dumper($ent);


When trying to get the gponGponOnuPmTable (from the attached 
GPON-GPON-MIB SMI file) using this code I get the following records:

          '2.1.66' => {
                        'gponGponOnuRecordNumber' => '66',
                        'gponGponOnuBipErrors' => '0',
                        'gponGponOnuIntervalEndTime' => '29730 sec',
                        'gponGponPmObjectIndex' => '2',
                        'gponGponOnuPmDiscardedFrames' => '0',
                        'gponGponOnuRemBipErrors' => '0',
                        'gponGponOnuIntervalType' => '1',
                        'gponGponOnuSuspectFlag' => 'reliable',
                        'gponGponOnuPmPloamError' => '0'

They look OK, but closer inspection shows, that the 
gponGponOnuIntervalType field hasn`t been converted to an enum. On the 
other hand the  'gponGponOnuSuspectFlag' field was successfuly 
converted. The incorrect field is described in the MIB as follows:

                gponGponOnuIntervalType OBJECT-TYPE
                        SYNTAX GponGponPmIntervalType
                        MAX-ACCESS read-only
                        STATUS current
                        DESCRIPTION
                                "This attribute is used to select 
between the
                                15 min  or the day accumulation types. "
                        ::= { gponGponOnuPmEntry 1 }

Together with the syntax:

                GponGponPmIntervalType ::= TEXTUAL-CONVENTION
                        STATUS current
                        DESCRIPTION
                                "Description."
                        SYNTAX INTEGER
                                {
                                min15(1),
                                day(2)
                                }

This description seems ok to me, maybe this situation has something to 
do with the fact, that the gponGponOnuIntervalType is also an index in 
the table:

                gponGponOnuPmTable OBJECT-TYPE
                        SYNTAX SEQUENCE OF GponGponOnuPmEntry
                        MAX-ACCESS not-accessible
                        STATUS current
                        DESCRIPTION
                                "This table contains the performance 
monitoring history
                                data records collected per ONU at the 
OLT PonPptp. Table entries
                                are created / deleted on user request. 
Indices of
                                the table are the PM object, the 
interval type and the
                                record number."
                        ::= { gponGponOnuObjects 4 }


                gponGponOnuPmEntry OBJECT-TYPE
                        SYNTAX GponGponOnuPmEntry
                        MAX-ACCESS not-accessible
                        STATUS current
                        DESCRIPTION
                                "This table contains the performance 
monitoring history
                                data records collected per ONU at the 
OLT PonPptp. Table entries
                                are created / deleted on user request. 
Indices of
                                the table are the PM object, the 
interval type and the
                                record number."
                        INDEX { gponGponPmObjectIndex, 
gponGponOnuIntervalType, gponGponOnuRecordNumber }
                        ::= { gponGponOnuPmTable 1 }

I think, it`s a SNMP.pm specific issue, because plain snmpwalk works 
fine in this case:

GPON-GPON-MIB::gponGponOnuIntervalType.2.min15.1 min15
GPON-GPON-MIB::gponGponOnuIntervalType.2.min15.2 min15
GPON-GPON-MIB::gponGponOnuIntervalType.2.min15.3 min15
GPON-GPON-MIB::gponGponOnuIntervalType.2.min15.4 min15
GPON-GPON-MIB::gponGponOnuIntervalType.2.min15.5 min15
GPON-GPON-MIB::gponGponOnuIntervalType.2.min15.6 min15
GPON-GPON-MIB::gponGponOnuIntervalType.2.min15.7 min15
GPON-GPON-MIB::gponGponOnuIntervalType.2.min15.8 min15
GPON-GPON-MIB::gponGponOnuIntervalType.2.min15.9 min15
GPON-GPON-MIB::gponGponOnuIntervalType.2.min15.10 min15
GPON-GPON-MIB::gponGponOnuIntervalType.2.min15.11 min15
GPON-GPON-MIB::gponGponOnuIntervalType.2.min15.12 min15
GPON-GPON-MIB::gponGponOnuIntervalType.2.min15.13 min15
GPON-GPON-MIB::gponGponOnuIntervalType.2.min15.14 min15
GPON-GPON-MIB::gponGponOnuIntervalType.2.min15.15 min15
GPON-GPON-MIB::gponGponOnuIntervalType.2.min15.16 min15
GPON-GPON-MIB::gponGponOnuIntervalType.2.min15.17 min15
GPON-GPON-MIB::gponGponOnuIntervalType.2.min15.18 min15
GPON-GPON-MIB::gponGponOnuIntervalType.2.min15.19 min15
GPON-GPON-MIB::gponGponOnuIntervalType.2.min15.20 min15
GPON-GPON-MIB::gponGponOnuIntervalType.2.min15.21 min15
GPON-GPON-MIB::gponGponOnuIntervalType.2.min15.22 min15
GPON-GPON-MIB::gponGponOnuIntervalType.2.min15.23 min15
GPON-GPON-MIB::gponGponOnuIntervalType.2.min15.24 min15
GPON-GPON-MIB::gponGponOnuIntervalType.2.min15.25 min15
GPON-GPON-MIB::gponGponOnuIntervalType.2.min15.26 min15
GPON-GPON-MIB::gponGponOnuIntervalType.2.min15.27 min15
GPON-GPON-MIB::gponGponOnuIntervalType.2.min15.28 min15
GPON-GPON-MIB::gponGponOnuIntervalType.2.min15.29 min15
GPON-GPON-MIB::gponGponOnuIntervalType.2.min15.30 min15

This output suggests, that SNMP.pm should be able to translate 
the '2.1.66' index to something more readable - '2.min15.66'. This also 
doesn`t happen when using gettable from SNMP.pm.

I`ve attached the MIB file used in my requests for refernce. Hope this 
helps. How I can force SNMP.pm to behave correctly ? Or is it a bug ?


Best regards,

-- 
Maciej Grela

Attachment: gpon-gpon-mib.mib.gz
Description: GNU Zip compressed data

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to