[Pysnmp-dev] libsmi2pysnmp textual-convention processing broken by 'default' enumeration
Brought to you by:
elie
|
From: markeva <ma...@ci...> - 2009-03-26 00:26:25
|
I¹ve run into what I think is a bug in libsmi2pysnmp¹s handling of
textual-conventions that are enumerated maps that include the string
default¹. Specifically, If processing a MIB with a TEXTUAL-CONVENTION
like:
SomeConvention ::= TEXTUAL-CONVENTION
STATUS current
DESCRIPTION
"An example to crash libsmi2pysnmp²
SYNTAX INTEGER {
default(1),
whatever(2)
}
then when libsmi2pysnmp processes smidump f python¹s output it will
traceback thusly:
Traceback (most recent call last):
File "./libsmi2pysnmp", line 343, in <module>
out.write('%s' % __genTypeDef((symName, symDef), 1))
File "./libsmi2pysnmp", line 281, in __genTypeDef
defVal = __genDefVal(baseType, symDef)
File "./libsmi2pysnmp", line 132, in __genDefVal
if symDef['syntax']['type'].has_key(symDef['default']):
KeyError: 'syntax'
I have worked around this by changing line 281 of __genTypeDef from:
if symDef.has_key('default'):
to:
if symDef.has_key('default') and symDef.has_key('syntax'):
Which works, but I have no idea if it¹s really appropriate.
Regards,
Mark
|