etingof / pysmi

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

build-pysnmp-mib versus mibdump.py #21

Closed truthadjustr closed 6 years ago

truthadjustr commented 6 years ago

What I thought as the older obsolete tool, was able to convert my MIB file to its .py equivalent:

build-pysnmp-mib -o MYMIB.py MYMIB.mib

Whereas, the newer mibdump.py gave an error:

mibdump.py --destination-format=pysnmp --destination-directory=`pwd` ./MYMIB.mib                                                                                                                                           
...
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: MYMIB
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: 
Missing source MIBs: 
Ignored MIBs: 
Failed MIBs: MYMIB (Bad grammar near token type LOWERCASE_IDENTIFIER, value rfnSiemRogueApDetectorTableEntry at MIB MYMIB, line 75)

Is there something wrong in the MIB or in mibdump.py?

etingof commented 6 years ago

I believe rfnSiemRogueApDetectorTableEntry should start with a capital letter to be compliant with the SMI language. Is it your own MIB you are designing or is it a bug in some vendor MIB?

I would not use build-pysnmp-mib because libsmi-generated Python code used to be flawed in many ways. :(