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

SNMPVariable.oid_index set incorrectly for multi-index variables #69

Open
DanielDisisto opened this issue Aug 8, 2017 · 1 comment
Open

Comments

@DanielDisisto
Copy link

DanielDisisto commented Aug 8, 2017

When doing an SNMP get/walk/etc and either the use_numeric flag is True, or if the MIB is not loaded, the .oid_index incorrectly steals the last component of the .oid instead of being left blank as expected.

oid_index_example.py -

from easysnmp.easy import Session

session = Session(hostname='localhost', version=2)

for use_numeric in (False, True):
    session.use_numeric = use_numeric
    var = session.get('.1.3.6.1.2.1.25.3.7.1.1.60.1')
    print(repr(var)))

output -

<SNMPVariable value='1' (oid='hrPartitionIndex', oid_index='60.1', snmp_type='INTEGER')>
<SNMPVariable value='1' (oid='.1.3.6.1.2.1.25.3.7.1.1.60', oid_index='1', snmp_type='INTEGER')>

expected output -

<SNMPVariable value='1' (oid='hrPartitionIndex', oid_index='60.1', snmp_type='INTEGER')>
<SNMPVariable value='1' (oid='.1.3.6.1.2.1.25.3.7.1.1.60.1', oid_index='', snmp_type='INTEGER')>

It appears that easysnmp.helpers.normalize_oid() does the right thing with numeric OIDs, but maybe interface.c is doing something odd?

@kamakazikamikaze
Copy link
Collaborator

I haven't used/pulled multi-index variables before. I'll take a look into this when I have time over the next two weeks.

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