Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python extension: SNMP Get returns empty string when the index (IID) does not exist. Expected: None #414

Closed
alinstroe opened this issue Mar 28, 2022 · 2 comments

Comments

@alinstroe
Copy link

alinstroe commented Mar 28, 2022

Running net-snmp/python/netsnmp/tests

Step 1. Run unmodified BasicTests.test_v1_get (perform SNMP Get on sysDescr.0)
BasicTests.test_v1_get

---v1 GET tests -------------------------------------

v1 snmpget result: ('My Router',)

v1 get var: sysDescr 0 = My Router ( OCTETSTR )


Ran 1 test in 0.217s

OK

Step 2. Modify the test to perform SNMP Get on sysDescr.123 (non-existent IID)

---v1 GET tests -------------------------------------

v1 snmpget result: ('',) #empty string

v1 get var: sysDescr 123 = ( OCTETSTR )

At step 2 the expected result is an error or None obj. Instead I receive an empty string for an OID that doesn't exist.
This behavior is not dependent on the SNMP version (it's the same for v1, v2c, v3)

The same result (empty string) can also be obtained when we perform SNMP GET on an OID which is supposed to return an empty string.
So, we can't decide if it's an error or valid result.

Thanks.

@bvanassche
Copy link
Contributor

Please reopen this bug report if the commit mentioned above would not be sufficient.

@alinstroe
Copy link
Author

alinstroe commented Apr 6, 2022

---v1 GET tests -------------------------------------

v1 snmpget result: ('My Router',)

v1 get var: sysDescr 0 = My Router ( OCTETSTR )
.

---v1 GET test of nonexistent OID -------------------

v1 snmpget result: (None,)

v1 get var: .1.3.6.1.2.1.1.1.123 0 = None ( None )


Ran 3 tests in 0.270s

OK

Seems to be working.
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants