Closed greenpau closed 7 years ago
Once I did :%s/840, 802, 10006/840, 10006/g
the resolution works.
This is interesting, but I can't reproduce this problem. Here is what I do:
$ pip install pysmi
Collecting pysmi
Using cached pysmi-0.1.3-py2.py3-none-any.whl
Requirement already satisfied: ply in ./pysmi/venv34/lib/python3.4/site-packages (from pysmi)
Installing collected packages: pysmi
Successfully installed pysmi-0.1.3
$
$ mibdump.py --generate-mib-texts --destination-format=pysnmp --rebuild IEEE8023-LAG-MIB
Source MIB repositories: file:///usr/share/snmp/mibs, http://mibs.snmplabs.com/asn1/@mib@
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/user/.pysnmp/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: IEEE8023-LAG-MIB
Destination format: pysnmp
Parser grammar cache directory: not used
Also compile all relevant MIBs: yes
Rebuild MIBs regardless of age: yes
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: yes
Keep original texts layout: no
Try various file names while searching for MIB module: yes
Created/updated MIBs: IEEE8023-LAG-MIB
Pre-compiled MIBs borrowed:
Up to date MIBs: SNMPv2-CONF, SNMPv2-SMI, SNMPv2-TC
Missing source MIBs:
Ignored MIBs:
Failed MIBs:
$
$ grep 'dot3adAggPortTable = ' ~/.pysnmp/mibs/IEEE8023-LAG-MIB.py
dot3adAggPortTable = MibTable((1, 2, 840, 10006, 300, 43, 1, 2, 1), )
$
What pysmi version are you using?
Can you make sure that IEEE8023-LAG-MIB.my
that gets compiled has the correct OID in the first place? You can see the ASN.1 MIBs being loaded by enabling pysmi debugging:
from pysmi import debug
debug.setLogger(debug.Debug('all'))
Can you make sure that IEEE8023-LAG-MIB.my that gets compiled has the correct OID in the first place?
@etingof, will do that.
Here are some details about the system. It is a regular RHEL 7.3 build. Based on the output you provided, you are using Python 3.4.
# hostnamectl
...
Operating System: Red Hat Enterprise Linux Server 7.3 (Maipo)
CPE OS Name: cpe:/o:redhat:enterprise_linux:7.3:GA:server
Kernel: Linux 3.10.0-514.21.1.el7.x86_64
Architecture: x86-64
# pip list | grep pysnmp
pysnmp (4.3.10)
# python -V
Python 2.7.5
@greenpau
Just in case, make sure you are running reasonably fresh pysmi
package:
$ python -c 'import pysmi; print(pysmi.__version__)'
0.1.3
I just re-run the same test with Python 2.7 - it still works:
$ pip install pysmi
You are using pip version 6.0.8, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting pysmi
Using cached pysmi-0.1.3-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): ply in ./pysmi/venv27/lib/python2.7/site-packages (from pysmi)
Installing collected packages: pysmi
Successfully installed pysmi-0.1.3
(venv27)$ mibdump.py --generate-mib-texts --destination-format=pysnmp --rebuild IEEE8023-LAG-MIB
Source MIB repositories: file:///usr/share/snmp/mibs, http://mibs.snmplabs.com/asn1/@mib@
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/user/.pysnmp/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: IEEE8023-LAG-MIB
Destination format: pysnmp
Parser grammar cache directory: not used
Also compile all relevant MIBs: yes
Rebuild MIBs regardless of age: yes
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: yes
Keep original texts layout: no
Try various file names while searching for MIB module: yes
Created/updated MIBs: IEEE8023-LAG-MIB
Pre-compiled MIBs borrowed:
Up to date MIBs: SNMPv2-CONF, SNMPv2-SMI, SNMPv2-TC
Missing source MIBs:
Ignored MIBs:
Failed MIBs:
(venv27)$ grep 'dot3adAggPortTable = ' ~/.pysnmp/mibs/IEEE8023-LAG-MIB.py
dot3adAggPortTable = MibTable((1, 2, 840, 10006, 300, 43, 1, 2, 1), )
Based on the reporting coming from the mibdump.py --debug reader ...
invocation, I'm getting the IEEE8023-LAG-MIB from http://mibs.snmplabs.com/asn1/IEEE8023-LAG-MIB:
2017-10-12 16:34:28,894 pysmi: looking for MIB IEEE8023-LAG-MIB
2017-10-12 16:34:28,894 pysmi: trying to fetch MIB from http://mibs.snmplabs.com:80/asn1/IEEE8023-LAG-MIB
2017-10-12 16:34:29,636 pysmi: HTTP response 200
2017-10-12 16:34:29,647 pysmi: fetching source MIB /asn1/IEEE8023-LAG-MIB, mtime Tue, 05 May 2015 18:22:29 GMT
Just in case, make sure you are running reasonably fresh pysmi package:
@etingof , here is mine.
# python -c 'import pysmi; print(pysmi.__version__)'
0.1.3
Compiled per your suggestion, I deleted the py*
files from .pysnmp
dir and rebuilt:
# python mibdump.py --generate-mib-texts --destination-format=pysnmp --rebuild IEEE8023-LAG-MIB
Source MIB repositories: file:///usr/share/snmp/mibs, http://mibs.snmplabs.com/asn1/@mib@
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: /root/.pysnmp/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: IEEE8023-LAG-MIB
Destination format: pysnmp
Parser grammar cache directory: not used
Also compile all relevant MIBs: yes
Rebuild MIBs regardless of age: yes
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: yes
Keep original texts layout: no
Try various file names while searching for MIB module: yes
Created/updated MIBs: BRIDGE-MIB, IANAifType-MIB, IEEE8023-LAG-MIB, IF-MIB, P-BRIDGE-MIB, Q-BRIDGE-MIB, RFC1271-MIB, RMON-MIB, RMON2-MIB, SNMPv2-MIB, TOKEN-RING-RMON-MIB
Pre-compiled MIBs borrowed:
Up to date MIBs: RFC-1212, RFC-1215, RFC1155-SMI, RFC1213-MIB, SNMP-FRAMEWORK-MIB, SNMPv2-CONF, SNMPv2-SMI, SNMPv2-TC
Missing source MIBs:
Ignored MIBs:
Failed MIBs:
Once compiled, I still see the 802
:
dot3adAggPort = MibIdentifier((1, 2, 840, 802, 10006, 300, 43, 1, 2))
The thing is that when I do snmpwalk
everything works and resolves. In your output you fetch the MIB from mibs.snmplabs.com
. Perhaps, the issue is in the difference between MIBs.
I am using MIBs from https://github.com/robison/snmp-config
You are right - that looks like a bug in pysmi parser. It shows up with the latest MIB version.
I will look into the code and report back here.
OK, commit 2e6b9e8a0b8b379c1faed034ad1300441f0b0341 should fix this.
I can make a release if current pysmi master works for you.
OK, commit 2e6b9e8a0b8b379c1faed034ad1300441f0b0341 should fix this.
@etingof , kudos for the fix! 👍 For now, I manually fixed it. Will wait for the next release in pypi 😄
Thank you very much! Спасибо что посмотрел! Удач!
Released pysmi 0.1.4 on PyPI and updated MIBs at http://mibs.snmplabs.com/asn1/
I have
IEEE8023-LAG-MIB.my
in/usr/share/snmp/mibs/ieee
. The MIB gets loaded:However, the resolution failed for OID
1.2.840.10006.300.43.1.2.1
dot3adAggPortTable.I checked in
/root/.pysnmp/mibs/IEEE8023-LAG-MIB.my
and see the following lines forThe MIB speaks about
840.10006
. In theIEEE8023-LAG-MIB.my
, there is840, 802, 10006
.Any ideas how
802
got there?