etingof / pysmi

SNMP MIB parser
http://snmplabs.com/pysmi/
BSD 2-Clause "Simplified" License
132 stars 51 forks source link

Attempting to run compiled MIB results in error while loading #50

Open rustyscottweber opened 5 years ago

rustyscottweber commented 5 years ago
Traceback (most recent call last):
  File "C:\Program Files\Python37\lib\site-packages\pysnmp\smi\builder.py", line 344, in loadModule
    exec(codeObj, g)
  File "C:\Projects\test_mibs\USHA-MIB.py", line 211, in <module>
    upsDevicesTable = MibTable((1, 3, 6, 1, 4, 1, 2468, 1, 2, 1, 1, 9, 2), ).setIndexNames((0, "USHA-MIB", "indexOfDevice"))
AttributeError: 'MibTable' object has no attribute 'setIndexNames'

Mibs were compiled as such:

~/Downloads/mibs$ mibdump.py --destination-format=pysnmp --destination-directory=./../test_mibs ./RFC1628.MIB
Source MIB repositories: /mnt/c/Users/RWeber.OSS/Downloads/mibs, file:///usr/share/snmp/mibs, http://mibs.snmplabs.com/asn1/@mib@
Borrow missing/failed MIBs from: http://mibs.snmplabs.com/pysnmp/notexts/@mib@
Existing/compiled MIB locations: pysnmp.smi.mibs, pysnmp_mibs
Compiled MIBs destination directory: ./../test_mibs
MIBs excluded from code generation: INET-ADDRESS-MIB, PYSNMP-USM-MIB, RFC-1212, RFC-1215, RFC1065-SMI, RFC1155-SMI, RFC1158-MIB, RFC1213-MIB, SNMP-FRAMEWORK-MIB, SNMP-TARGET-MIB, SNMPv2-CONF, SNMPv2-SMI, SNMPv2-TC, SNMPv2-TM, TRANSPORT-ADDRESS-MIB
MIBs to compile: RFC1628
Destination format: pysnmp
Parser grammar cache directory: not used
Also compile all relevant MIBs: yes
Rebuild MIBs regardless of age: no
Dry run mode: no
Create/update MIBs: yes
Byte-compile Python modules: yes (optimization level no)
Ignore compilation errors: no
Generate OID->MIB index: no
Generate texts in MIBs: no
Keep original texts layout: no
Try various file names while searching for MIB module: yes
Created/updated MIBs:
Pre-compiled MIBs borrowed:
Up to date MIBs: RFC-1212, RFC-1215, RFC1155-SMI, RFC1213-MIB, SNMPv2-CONF, SNMPv2-SMI, SNMPv2-TC, UPS-MIB
Missing source MIBs:
Ignored MIBs:
Failed MIBs:
~/Downloads/mibs$ mibdump.py --destination-format=pysnmp --destination-directory=./../test_mibs ./USHAP-v6.MIB
Source MIB repositories: /mnt/c/Users/RWeber.OSS/Downloads/mibs, file:///usr/share/snmp/mibs, http://mibs.snmplabs.com/asn1/@mib@
Borrow missing/failed MIBs from: http://mibs.snmplabs.com/pysnmp/notexts/@mib@
Existing/compiled MIB locations: pysnmp.smi.mibs, pysnmp_mibs
Compiled MIBs destination directory: ./../test_mibs
MIBs excluded from code generation: INET-ADDRESS-MIB, PYSNMP-USM-MIB, RFC-1212, RFC-1215, RFC1065-SMI, RFC1155-SMI, RFC1158-MIB, RFC1213-MIB, SNMP-FRAMEWORK-MIB, SNMP-TARGET-MIB, SNMPv2-CONF, SNMPv2-SMI, SNMPv2-TC, SNMPv2-TM, TRANSPORT-ADDRESS-MIB
MIBs to compile: USHAP-v6
Destination format: pysnmp
Parser grammar cache directory: not used
Also compile all relevant MIBs: yes
Rebuild MIBs regardless of age: no
Dry run mode: no
Create/update MIBs: yes
Byte-compile Python modules: yes (optimization level no)
Ignore compilation errors: no
Generate OID->MIB index: no
Generate texts in MIBs: no
Keep original texts layout: no
Try various file names while searching for MIB module: yes
Created/updated MIBs:
Pre-compiled MIBs borrowed:
Up to date MIBs: RFC-1212, RFC-1215, RFC1155-SMI, RFC1213-MIB, SNMPv2-CONF, SNMPv2-SMI, SNMPv2-TC, UPS-MIB, USHA-MIB
Missing source MIBs:
Ignored MIBs:
Failed MIBs:
rustyscottweber commented 5 years ago

Added files for debugging. test_mibs.zip

lextm commented 6 months ago

This should have been fixed in a specific commit in the past. Cannot reproduce it any more with pysmi-lextudio release 1.3.1.