Pysnmp getCmd returning int 0 instead of Integer('noError',...)

34 views Asked by At

I have installed the following pip packages on Oracle Linux 9:

pysnmp           4.4.12
pysnmp-mibs      0.1.6

On Centos 7 I have installed:

pysnmp-4.2.5-2.el7.noarch

Using pysnmp cmdgen getCmd(),

from pysnmp.entity.rfc3413.oneliner import cmdgen

cmdGen = cmdgen.CommandGenerator()
errorIndication, errorStatus, errorIndex, varBinds = cmdGen.getCmd(...)

I am getting errorStatus of Python int 0 on Oracle 9 while the CentOS 7 box gives an object:

 Integer('noError', NamedValues(('noError', 0), ('tooBig', 1), ('noSuchName', 2), ('badValue', 3), ('readOnly', 4), ('genErr', 5), ('noAccess', 6), ('wrongType', 7), ('wrongLength', 8), ('wrongEncoding', 9), ('wrongValue', 10), ('noCreation', 11), ('inconsistentValue', 12), ('resourceUnavailable', 13), ('commitFailed', 14), ('undoFailed', 15), ('authorizationError', 16), ('notWritable', 17), ('inconsistentName', 18)))

Why is the Oracle Linux 9 box returning only int 0, not the object like the CentOS 7 box?

1

There are 1 answers

0
Lex Li On

That's simply because this is a Python library.

The relevant source code should be here that you either get a simple int of 0, or an Integer object from the PDU.

But the meaning is the same, no error is returned.