Open baid86 opened 6 years ago
Oh, that seems to be a bug in pysnmp
. Try the HEAD of this branch.
...on the second thought, may be it's actually not so much a bug - may be it's just that you use incompatible version of pyasn1. Could you please try to run original pysnmp with the pyasn1 version matching its requirements.txt
?
Using pyasn1 0.2.3 did not helped. Using 4.4.5 solved that issue but then its starts failing at different point. Basically mibs like these are not getting handled properly
hm2PoeMgmtPortAllowedClassBits OBJECT-TYPE
SYNTAX BITS {
class0(0),
class1(1),
class2(2),
class3(3),
class4(4)
}
MAX-ACCESS read-write
STATUS current
DESCRIPTION
"Bit mask which defines allowed classes per interface."
DEFVAL { { class0, class1, class2, class3, class4 } }
::= { hm2PoeMgmtPortEntry 7 }
Where the DEFVAL contains the list. I am not MIB expert so not sure if its a valid entry or not. but this gets compiled as
hm2PoeMgmtPortAllowedClassBits = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 12, 1, 1, 3, 1, 7), Bits().clone(namedValues=NamedValues(("class0", 0), ("class1", 1), ("class2", 2), ("class3", 3), ("class4", 4))).clone(namedValues=NamedValues(("class0", 0), ("class1", 1), ("class2", 2), ("class3", 3), ("class4", 4)))).setMaxAccess("readwrite")
And we get error
File "C:\\Python27\\lib\\site-packages\\pyasn1\\type\\namedval.py", line 74, in __init__\n raise error.PyAsn1Error(\'Duplicate name %s\' % (name,))\n', 'PyAsn1Error: Duplicate name class4\n']
There is another issue I observed while parsing where syntax like this SYNTAX SnmpAdminString (SIZE(0|4..8))
are not getting parsed properly. Let me know if you want me raise separate issue for that
With latest pysmi issue does not exists (with 4.4.4) so most probaly updating requirement.txt to mention latest pysmi should work.
Though There is still and issue wrt to SYNTAX SnmpAdminString (SIZE(0|4..8))
I will raise separate issue to track that.
I run the same issue, for me it looks like there is dependency to the python version ... I have three systems, for testing: MAC OS - Python 3.6.6, pysmi==0.3.2;pysnmp==4.4.6 - result: OK Ubuntu 18.4 - Python 3.6.6, pysmi==0.3.2;pysnmp==4.4.6 - result: OK Ubuntu 16.4 - Python 3.5.2, pysmi==0.3.2;pysnmp==4.4.6 -result NOK:
sudo python3 TA/testExecutor/tools/tdcnSnmpWikiTrapReceiver.py /tmp/tdcnSnmpWikiTrapReceiver.log
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/pysnmp/smi/builder.py", line 331, in loadModule
exec (modData, g)
File "
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "TA/testExecutor/tools/tdcnSnmpWikiTrapReceiver.py", line 35, in
We will upgrade from 16.4(Python 3.5) to 18.4(Python3.6) in the near future. I will share the results ...
upgrading pyasn1 from 0.2.3 to 0.4.4 solved the issue on my side :-)
This is the MIB entry where I am getting error
hm2DHCPServerPoolFlags = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 5), Bits().clone(namedValues=NamedValues(("interface", 0), ("mac", 1), ("gateway", 2), ("clientid", 3), ("remoteid", 4), ("circuitid", 5), ("dynamic", 6), ("vlanid", 7)))).setMaxAccess("readcreate")
The error which I am getting is
On some debugging I found that in rfc 1902.py for Bits class the init is like
So its calling octet string constructer which would be basically init of univ.OctetString which does not have namedValue as keyword args, hence the error