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

MIBs compile errors #62

Open
div08 opened this issue Oct 19, 2020 · 2 comments
Open

MIBs compile errors #62

div08 opened this issue Oct 19, 2020 · 2 comments

Comments

@div08
Copy link

div08 commented Oct 19, 2020

Hi,

Thanks for providing this tool.

I'm trying to use pysmi (version-0.3.4) to compile our project's MIBS (Its collection of customized and standard MIBS). While doing so I'm facing compilation errors for some of the customized as well as standard mibs. I just want to ignore those errors and proceed with compiled py file generation, for that I tried --ignore-errors flag with mibdump.py but it seems there is no impact of this flag (I might be using it wrongly..)

Following is what I am trying:

python mibdump.py --generate-mib-texts  --destination-format pysnmp --mib-source /corp/sta/projects/leos/mibs/04-18-00-0027/standard --destination-directory /home/dsaxena/.pysnmp/04-18-00-0027/mibs/standard --mib-stub "" --ignore-errors --debug compiler IEEE8021X-PAE-MIB
2020-10-09 03:49:03,629 pysmi: running pysmi version 0.3.3
2020-10-09 03:49:03,630 pysmi: debug category 'compiler' enabled
Source MIB repositories: /corp/sta/projects/leos/mibs/04-18-00-0027/standard
Borrow missing/failed MIBs from: http://mibs.snmplabs.com/pysnmp/fulltexts/@mib@
Existing/compiled MIB locations: pysnmp.smi.mibs, pysnmp_mibs
Compiled MIBs destination directory: /home/dsaxena/.pysnmp/04-18-00-0027/mibs/standard
MIBs excluded from code generation:
MIBs to compile: IEEE8021X-PAE-MIB
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: yes
Generate OID->MIB index: no
Generate texts in MIBs: yes
Keep original texts layout: no
Try various file names while searching for MIB module: yes
2020-10-09 03:49:03,821 pysmi: current MIB source(s): FileReader{"/corp/sta/projects/leos/mibs/04-18-00-0027/standard"}
2020-10-09 03:49:03,822 pysmi: current compiled MIBs location(s): PyFileSearcher{"/home/dsaxena/.pysnmp/04-18-00-0027/mibs/standard"}, PyPackageSearcher{"pysnmp.smi.mibs"}, PyPackageSearcher{"pysnmp_mibs"}, StubSearcher
2020-10-09 03:49:03,822 pysmi: current MIB borrower(s): PyFileBorrower{http://mibs.snmplabs.com:80/pysnmp/notexts/@mib@, genTexts=False, exts=['.py']}, PyFileBorrower{http://mibs.snmplabs.com:80/pysnmp/fulltexts/@mib@, genTexts=True, exts=['.py']}
2020-10-09 03:49:03,823 pysmi: trying source FileReader{"/corp/sta/projects/leos/mibs/04-18-00-0027/standard"}
2020-10-09 03:49:04,066 pysmi: IEEE8021X-PAE-MIB (IEEE8021X-PAE-MIB) read from file:///corp/sta/projects/leos/mibs/04-18-00-0027/standard/IEEE8021X-PAE-MIB.my, immediate dependencies: IEEE8021-SECY-MIB, IF-MIB, SNMP-FRAMEWORK-MIB, SNMPv2-CONF, SNMPv2-SMI, SNMPv2-TC
2020-10-09 03:49:04,066 pysmi: trying source FileReader{"/corp/sta/projects/leos/mibs/04-18-00-0027/standard"}
2020-10-09 03:49:04,183 pysmi: IEEE8021-SECY-MIB (IEEE8021-SECY-MIB) read from file:///corp/sta/projects/leos/mibs/04-18-00-0027/standard/IEEE8021-SECY-MIB.my, immediate dependencies: IF-MIB, SNMP-FRAMEWORK-MIB, SNMPv2-CONF, SNMPv2-SMI, SNMPv2-TC
2020-10-09 03:49:04,183 pysmi: trying source FileReader{"/corp/sta/projects/leos/mibs/04-18-00-0027/standard"}
2020-10-09 03:49:04,264 pysmi: IF-MIB (IF-MIB) read from file:///corp/sta/projects/leos/mibs/04-18-00-0027/standard/IF-MIB.my, immediate dependencies: IANAifType-MIB, SNMPv2-CONF, SNMPv2-MIB, SNMPv2-SMI, SNMPv2-TC
2020-10-09 03:49:04,264 pysmi: trying source FileReader{"/corp/sta/projects/leos/mibs/04-18-00-0027/standard"}
2020-10-09 03:49:04,283 pysmi: SNMP-FRAMEWORK-MIB (SNMP-FRAMEWORK-MIB) read from file:///corp/sta/projects/leos/mibs/04-18-00-0027/standard/SNMP-FRAMEWORK-MIB.my, immediate dependencies: SNMPv2-CONF, SNMPv2-SMI, SNMPv2-TC
2020-10-09 03:49:04,283 pysmi: trying source FileReader{"/corp/sta/projects/leos/mibs/04-18-00-0027/standard"}
2020-10-09 03:49:04,292 pysmi: SNMPv2-CONF (SNMPv2-CONF) read from file:///corp/sta/projects/leos/mibs/04-18-00-0027/standard/SNMPv2-CONF.my, immediate dependencies: SNMPv2-CONF, SNMPv2-SMI, SNMPv2-TC
2020-10-09 03:49:04,293 pysmi: trying source FileReader{"/corp/sta/projects/leos/mibs/04-18-00-0027/standard"}
2020-10-09 03:49:04,304 pysmi: SNMPv2-SMI (SNMPv2-SMI) read from file:///corp/sta/projects/leos/mibs/04-18-00-0027/standard/SNMPv2-SMI.my, immediate dependencies: SNMPv2-CONF, SNMPv2-SMI, SNMPv2-TC
2020-10-09 03:49:04,305 pysmi: trying source FileReader{"/corp/sta/projects/leos/mibs/04-18-00-0027/standard"}
2020-10-09 03:49:04,322 pysmi: SNMPv2-TC (SNMPv2-TC) read from file:///corp/sta/projects/leos/mibs/04-18-00-0027/standard/SNMPv2-TC.my, immediate dependencies: SNMPv2-CONF, SNMPv2-SMI, SNMPv2-TC
2020-10-09 03:49:04,322 pysmi: MIB IF-MIB already parsed
2020-10-09 03:49:04,323 pysmi: MIB SNMP-FRAMEWORK-MIB already parsed
2020-10-09 03:49:04,323 pysmi: MIB SNMPv2-CONF already parsed
2020-10-09 03:49:04,323 pysmi: MIB SNMPv2-SMI already parsed
2020-10-09 03:49:04,324 pysmi: MIB SNMPv2-TC already parsed
2020-10-09 03:49:04,324 pysmi: trying source FileReader{"/corp/sta/projects/leos/mibs/04-18-00-0027/standard"}
2020-10-09 03:49:04,346 pysmi: IANAifType-MIB (IANAifType-MIB) read from file:///corp/sta/projects/leos/mibs/04-18-00-0027/standard/IANAifType-MIB.my, immediate dependencies: SNMPv2-CONF, SNMPv2-SMI, SNMPv2-TC
2020-10-09 03:49:04,346 pysmi: MIB SNMPv2-CONF already parsed
2020-10-09 03:49:04,346 pysmi: trying source FileReader{"/corp/sta/projects/leos/mibs/04-18-00-0027/standard"}
2020-10-09 03:49:04,394 pysmi: SNMPv2-MIB (SNMPv2-MIB) read from file:///corp/sta/projects/leos/mibs/04-18-00-0027/standard/SNMPv2-MIB.my, immediate dependencies: SNMPv2-CONF, SNMPv2-SMI, SNMPv2-TC
2020-10-09 03:49:04,394 pysmi: MIB SNMPv2-SMI already parsed
2020-10-09 03:49:04,394 pysmi: MIB SNMPv2-TC already parsed
2020-10-09 03:49:04,395 pysmi: MIB SNMPv2-CONF already parsed
2020-10-09 03:49:04,395 pysmi: MIB SNMPv2-SMI already parsed
2020-10-09 03:49:04,396 pysmi: MIB SNMPv2-TC already parsed
2020-10-09 03:49:04,396 pysmi: MIB SNMPv2-CONF already parsed
2020-10-09 03:49:04,396 pysmi: MIB SNMPv2-SMI already parsed
2020-10-09 03:49:04,397 pysmi: MIB SNMPv2-TC already parsed
2020-10-09 03:49:04,397 pysmi: MIB SNMPv2-CONF already parsed
2020-10-09 03:49:04,397 pysmi: MIB SNMPv2-SMI already parsed
2020-10-09 03:49:04,397 pysmi: MIB SNMPv2-TC already parsed
2020-10-09 03:49:04,398 pysmi: MIB SNMPv2-CONF already parsed
2020-10-09 03:49:04,398 pysmi: MIB SNMPv2-SMI already parsed
2020-10-09 03:49:04,398 pysmi: MIB SNMPv2-TC already parsed
2020-10-09 03:49:04,399 pysmi: MIB SNMPv2-CONF already parsed
2020-10-09 03:49:04,399 pysmi: MIB SNMPv2-SMI already parsed
2020-10-09 03:49:04,399 pysmi: MIB SNMPv2-TC already parsed
2020-10-09 03:49:04,400 pysmi: MIB SNMPv2-CONF already parsed
2020-10-09 03:49:04,400 pysmi: MIB SNMPv2-SMI already parsed
2020-10-09 03:49:04,400 pysmi: MIB SNMPv2-TC already parsed
2020-10-09 03:49:04,401 pysmi: MIBs analyzed 9, MIBs failed 0
2020-10-09 03:49:04,401 pysmi: checking if SNMPv2-CONF requires updating
2020-10-09 03:49:04,405 pysmi: will be using existing compiled MIB SNMPv2-CONF found by PyFileSearcher{"/home/dsaxena/.pysnmp/04-18-00-0027/mibs/standard"}
2020-10-09 03:49:04,405 pysmi: checking if IF-MIB requires updating
2020-10-09 03:49:04,410 pysmi: will be using existing compiled MIB IF-MIB found by PyFileSearcher{"/home/dsaxena/.pysnmp/04-18-00-0027/mibs/standard"}
2020-10-09 03:49:04,411 pysmi: checking if SNMPv2-MIB requires updating
2020-10-09 03:49:04,412 pysmi: will be using existing compiled MIB SNMPv2-MIB found by PyFileSearcher{"/home/dsaxena/.pysnmp/04-18-00-0027/mibs/standard"}
2020-10-09 03:49:04,412 pysmi: checking if SNMP-FRAMEWORK-MIB requires updating
2020-10-09 03:49:04,414 pysmi: will be using existing compiled MIB SNMP-FRAMEWORK-MIB found by PyFileSearcher{"/home/dsaxena/.pysnmp/04-18-00-0027/mibs/standard"}
2020-10-09 03:49:04,414 pysmi: checking if SNMPv2-SMI requires updating
2020-10-09 03:49:04,416 pysmi: will be using existing compiled MIB SNMPv2-SMI found by PyFileSearcher{"/home/dsaxena/.pysnmp/04-18-00-0027/mibs/standard"}
2020-10-09 03:49:04,416 pysmi: checking if IANAifType-MIB requires updating
2020-10-09 03:49:04,417 pysmi: will be using existing compiled MIB IANAifType-MIB found by PyFileSearcher{"/home/dsaxena/.pysnmp/04-18-00-0027/mibs/standard"}
2020-10-09 03:49:04,417 pysmi: checking if IEEE8021X-PAE-MIB requires updating
2020-10-09 03:49:04,418 pysmi: no compiled MIB IEEE8021X-PAE-MIB available through PyFileSearcher{"/home/dsaxena/.pysnmp/04-18-00-0027/mibs/standard"}
2020-10-09 03:49:04,418 pysmi: no compiled MIB IEEE8021X-PAE-MIB available through PyPackageSearcher{"pysnmp.smi.mibs"}
2020-10-09 03:49:04,419 pysmi: no compiled MIB IEEE8021X-PAE-MIB available through PyPackageSearcher{"pysnmp_mibs"}
2020-10-09 03:49:04,419 pysmi: no compiled MIB IEEE8021X-PAE-MIB available through StubSearcher
2020-10-09 03:49:04,419 pysmi: no suitable compiled MIB IEEE8021X-PAE-MIB found anywhere
2020-10-09 03:49:04,419 pysmi: checking if SNMPv2-TC requires updating
2020-10-09 03:49:04,420 pysmi: will be using existing compiled MIB SNMPv2-TC found by PyFileSearcher{"/home/dsaxena/.pysnmp/04-18-00-0027/mibs/standard"}
2020-10-09 03:49:04,421 pysmi: checking if IEEE8021-SECY-MIB requires updating
2020-10-09 03:49:04,422 pysmi: will be using existing compiled MIB IEEE8021-SECY-MIB found by PyFileSearcher{"/home/dsaxena/.pysnmp/04-18-00-0027/mibs/standard"}
2020-10-09 03:49:04,422 pysmi: MIBs parsed 1, MIBs failed 0
2020-10-09 03:49:04,422 pysmi: compiling IEEE8021X-PAE-MIB read from file:///corp/sta/projects/leos/mibs/04-18-00-0027/standard/IEEE8021X-PAE-MIB.my
2020-10-09 03:49:04,451 pysmi: error from <pysmi.codegen.pysnmp.PySnmpCodeGen object at 0x7fab62a345d0>: no symbol "Unsigned32" in module "SNMPv2-SMI" at MIB IEEE8021X-PAE-MIB
2020-10-09 03:49:04,451 pysmi: MIBs built 0, MIBs failed 1
2020-10-09 03:49:04,451 pysmi: trying to borrow IEEE8021X-PAE-MIB from PyFileBorrower{http://mibs.snmplabs.com:80/pysnmp/notexts/@mib@, genTexts=False, exts=['.py']}
2020-10-09 03:49:04,451 pysmi: error from PyFileBorrower{http://mibs.snmplabs.com:80/pysnmp/notexts/@mib@, genTexts=False, exts=['.py']}:
2020-10-09 03:49:04,452 pysmi: trying to borrow IEEE8021X-PAE-MIB from PyFileBorrower{http://mibs.snmplabs.com:80/pysnmp/fulltexts/@mib@, genTexts=True, exts=['.py']}
2020-10-09 03:51:27,541 pysmi: error from PyFileBorrower{http://mibs.snmplabs.com:80/pysnmp/fulltexts/@mib@, genTexts=True, exts=['.py']}: source MIB IEEE8021X-PAE-MIB not found
2020-10-09 03:51:27,542 pysmi: MIBs available for borrowing 0, MIBs failed 1
2020-10-09 03:51:27,542 pysmi: MIBs built 0, MIBs failed 1
2020-10-09 03:51:27,542 pysmi: proceeding with built MIBs , failed MIBs IEEE8021X-PAE-MIB
2020-10-09 03:51:27,542 pysmi: MIBs modified:
Created/updated MIBs:
Pre-compiled MIBs borrowed:
Up to date MIBs: IANAifType-MIB, IEEE8021-SECY-MIB, IF-MIB, SNMP-FRAMEWORK-MIB, SNMPv2-CONF, SNMPv2-MIB, SNMPv2-SMI, SNMPv2-TC
Missing source MIBs:
Ignored MIBs:
Failed MIBs: IEEE8021X-PAE-MIB (no symbol "Unsigned32" in module "SNMPv2-SMI" at MIB IEEE8021X-PAE-MIB)

I'm planning to use pysnmp for snmp operations (which internally uses pysmi) but can't proceed if these errors exist. Please suggest how to resolve this. Earlier I was using netsnmp linux commands which ignores such errors but has performance issue as perform compilation at run time on each and every snmp operation call and stores in memory (what I could understood) so just want to opt better solution.

@DmitryZayats
Copy link

I just compiled IEEE8021X-PAE-MIB with no problems.
It's possible you have some old/corrupted MIBs in your project.

  • Download this IEEE8021X-PAE-MIB.tar.gz MIB set
  • Extract gunzip IEEE8021X-PAE-MIB.tar.gz; tar -xvf IEEE8021X-PAE-MIB.tar
  • Compile
cd IEEE8021X-PAE-MIB
mibdump.py --debug=all --mib-source . --destination-format pysnmp IEEE8021X-PAE-MIB | tail -6
Created/updated MIBs: IANAifType-MIB, IEEE8021-SECY-MIB, IEEE8021X-PAE-MIB, IF-MIB, SNMPv2-MIB
Pre-compiled MIBs borrowed: 
Up to date MIBs: SNMP-FRAMEWORK-MIB, SNMPv2-CONF, SNMPv2-SMI, SNMPv2-TC
Missing source MIBs: 
Ignored MIBs: 
Failed MIBs: 

And now I have compiled snmp modules under ~/.pysnmp/mibs

ls -lrt|grep "Dec 29"|awk '{print $NF}'
IEEE8021X-PAE-MIB.py
IEEE8021-SECY-MIB.py
IF-MIB.py
IANAifType-MIB.py
SNMPv2-MIB.py
__pycache__

@div08
Copy link
Author

div08 commented Jan 5, 2021

Thanks for looking into it.

Then I'll need to check MIBS I was using if they are corrupted or not compatible.

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