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

KeyError when processing some PySNMP MIB modules #205

Open
wyllys66 opened this issue Jul 9, 2021 · 1 comment
Open

KeyError when processing some PySNMP MIB modules #205

wyllys66 opened this issue Jul 9, 2021 · 1 comment

Comments

@wyllys66
Copy link

wyllys66 commented Jul 9, 2021

initializers[arg] += option

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.

@wyllys66
Copy link
Author

wyllys66 commented Jul 9, 2021

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")

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

1 participant