pysnmp icon indicating copy to clipboard operation
pysnmp copied to clipboard

AttributeError: 'ObjectGroup' object has no attribute 'setReference'

Open mofikus opened this issue 1 year ago • 2 comments

I've compiled a bunch of mibs, and have them stored in a folder. When running something like the following to get OIDs and descriptions from compiled MIBs, with the CISCO-ENHANCED-IPSEC-FLOW-MIB I get an error.

The code I'm running:

from pysnmp.smi import builder, view, error
mibBuilder = builder.MibBuilder()
mibBuilder.loadTexts = True
mibBuilder.addMibSources(builder.DirMibSource("C:\\Users\\mmiller\\Documents\\tools_etc\\python_projects\\testingMIBS\\temp\\"))
mibBuilder.loadModules(*['CISCO-ENHANCED-IPSEC-FLOW-MIB'])
mibView = view.MibViewController(mibBuilder)
oid, oid_name, _ = mibView.getFirstNodeName()
while True:
    try:
        mib_name, oid_name, suffix = mibView.getNodeLocation(oid)
        oid_info, = mibBuilder.importSymbols(mib_name, oid_name)
        print(oid, oid_name, getattr(oid_info,'description',""))
        oid, oid_name, suffix = mibView.getNextNodeName(oid)
    except error.NoSuchObjectError:
        break

The exception I get:

Traceback (most recent call last):
  File "C:\testing\python_projects\testingMIBS\venv\lib\site-packages\pysnmp\smi\builder.py", line 357, in loadModule
    exec(codeObj, g)
  File ".pysnmp-mibs\CISCO-ENHANCED-IPSEC-FLOW-MIB.py", line 806, in <module>
    if mibBuilder.loadTexts: ciscoEnhIPsecFlowActivityGroup.setReference('rfc2408, rfc2407; rfc2409 section 5.5')
AttributeError: 'ObjectGroup' object has no attribute 'setReference'

I've attached a zip with the original MIB file and the compiled .py mib file.

Thanks

issue.zip

mofikus avatar Apr 04 '23 17:04 mofikus