etingof / pysmi

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

mibdump gives error no symbol "Unsigned32" in module "SNMPv2-SMI" while converting the in pysnmp format #34

Closed baid86 closed 6 years ago

baid86 commented 6 years ago

I am trying to compile attached MIB(renamed extension to .txt) and its failing with following error Failed MIBs: HM2-CAM-MGMT-MIB (no symbol "Unsigned32" in module "SNMPv2-SMI" at MIB HM2-CAM-MGMT-MIB)

On some debugging I found that issue is with following entry

hm2CamClientServerPort OBJECT-TYPE
      SYNTAX              InetPortNumber
      MAX-ACCESS      read-create
      STATUS          current
      DESCRIPTION
                            "The port number of the CAM authentication server."
      DEFVAL          { 389 }
 ::= { hm2CamClientServerAddrEntry 4 }

InetPortNumber is part of INET-ADDRESS-MIB which is standard mib I believe.

HM2-CAM-MGMT-MIB.txt

etingof commented 6 years ago

I can't reproduce this issue with the latest released pysmi (0.3.1) and HM2-CAM-MGMT-MIB taken from mibs.snmplabs.com.

$ mibdump.py --destination-format json HM2-CAM-MGMT-MIB
Source MIB repositories: file:///usr/share/snmp/mibs, http://mibs.snmplabs.com/asn1/@mib@
Borrow missing/failed MIBs from: http://mibs.snmplabs.com/json/notexts/@mib@
Existing/compiled MIB locations: 
Compiled MIBs destination directory: .
MIBs excluded from code generation: RFC-1212, RFC-1215, RFC1065-SMI, RFC1155-SMI, RFC1158-MIB, RFC1213-MIB, SNMPv2-CONF, SNMPv2-SMI, SNMPv2-TC, SNMPv2-TM
MIBs to compile: HM2-CAM-MGMT-MIB
Destination format: json
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: no (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: HM2-CAM-MGMT-MIB, HM2-TC-MIB, SNMP-FRAMEWORK-MIB
Pre-compiled MIBs borrowed: 
Up to date MIBs: INET-ADDRESS-MIB, SNMPv2-CONF, SNMPv2-SMI, SNMPv2-TC
Missing source MIBs: 
Ignored MIBs: 
Failed MIBs: 
baid86 commented 6 years ago

The mib which is on SNMP labs is an old version of MIB. Could you try reproducing this with the MIB which I attached

etingof commented 6 years ago

Well, formally these MIBs seem to be the same, no?

hm2CamMgmtMib MODULE-IDENTITY
    LAST-UPDATED "201307010000Z" -- July 1, 2013
    ORGANIZATION "Hirschmann Automation and Control GmbH"
    CONTACT-INFO
        "Postal:     Stuttgarter Str. 45-51
                     72654 Neckartenzlingen
                     Germany
         Phone:      +49 7127 140
         E-mail:     hac.support@belden.com"
    DESCRIPTION
        "Hirschmann dummy for Central Authentication Management MIB for ABB.
         Copyright (C) 2013. All Rights Reserved."
    REVISION     "201307010000Z" -- July 1, 2013
    DESCRIPTION
         "Initial version."
    ::= { hm2ConfigurationMibs 200 }

Anyway, your MIB compiles for me as well.

May be you can enable some --debug to see where the MIB ultimately comes from?

baid86 commented 6 years ago

there was SNMPv2-SMI.mib file in my mib source it was creating problem. I am not sure why but when I deleted that file everything started working fine

etingof commented 6 years ago

Awesome! I suspect outdated/corrupted SNMPv2-SMI.mib file in your search path. If you are interested in figuring out the cause, you may want to diff your file with the one from http://mibs.snmplabs.com/asn1/.