Open wyllys66 opened 3 years ago
Specifically, these lines in pysnmp_mibs/P-BRIDGE-MIB.py are causing the problem:
dot1dDeviceCapabilities = MibScalar((1, 3, 6, 1, 2, 1, 17, 6, 1, 1, 1), Bits().subtype(namedValues=NamedValues(("dot1dExtendedFilteringServices", 0), ("dot1dTrafficClasses", 1), ("dot1qStaticEntryIndividualPort", 2), ("dot1qIVLCapable", 3), ("dot1qSVLCapable", 4), ("dot1qHybridCapable", 5), ("dot1qConfigurablePvidTagging", 6), ("dot1dLocalVlanCapable", 7), ))).setMaxAccess("readonly")
dot1dPortCapabilities = MibTableColumn((1, 3, 6, 1, 2, 1, 17, 6, 1, 1, 4, 1, 1), Bits().subtype(namedValues=NamedValues(("dot1qDot1qTagging", 0), ("dot1qConfigurableAcceptableFrameTypes", 1), ("dot1qIngressFiltering", 2), ))).setMaxAccess("readonly")
https://github.com/etingof/pyasn1/blob/db8f1a7930c6b5826357646746337dafc983f953/pyasn1/type/base.py#L441
pyasn1 is used in parsing SNMP MIBS used by the pysnmp package. Some of the MIBS (from python3-pysnmp4-mibs package - P-BRIDGE-MIB.py, for example) trigger a "KeyError" exception when they use a subtype with "namedValues" as the key. The code above assumes that the object already has all of the kwargs present. It could be more forgiving by checking for the existence of the key and creating a new k/v pair if it doesn't exist instead of automatically assuming it is present and trying to append to it.