-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
[Bug]: Enumerated DEFVAL with TEXTUAL-CONVENTION errors with Jinja template rendering error #83
Comments
Also SIP-COMMON-MIB fails for the same reason, however there SYNTAX is BITS which is definitely by the spec (https://www.rfc-editor.org/rfc/rfc2578.txt -> 7.9. Mapping of the DEFVAL clause) SIP-COMMON-MIB:
reproduce: mkdir snmp-test && cd snmp-test
pyenv local 3.12.4
pyenv virtualenv snmp-test
pyenv local snmp-test
pip install pysmi-lextudio
mkdir -p ./mibs && mkdir -p ./mib_cache
# get mibs from lextudio
mibs=(
"SIP-COMMON-MIB"
"SNMPv2-SMI"
"SNMPv2-TC"
"SNMPv2-CONF"
"SNMP-FRAMEWORK-MIB"
"SIP-TC-MIB"
"NETWORK-SERVICES-MIB"
"INET-ADDRESS-MIB"
)
url_prefix="https://raw.githubusercontent.com/lextudio/mibs.pysnmp.com/master/asn1/"
output_dir="./mibs"
for mib in "${mibs[@]}"; do
wget "${url_prefix}${mib}" -O "${output_dir}/${mib}.mib"
done
# compile mibs
mibdump --mib-source ./mibs --destination-directory ./mib_cache SIP-COMMON-MIB |
The parser does understand the DEFVAL definition properly (so JSON output is correct), but the template is incorrect so it cannot output proper Python. |
Should have been fixed in PySMI release 1.5.0. |
Expected behavior
mibdump compiles successfully (e.g. DOCS-IF3-MIB)
Actual behavior
Failed MIBs: DOCS-IF3-MIB (Jinja template rendering error: 'collections.OrderedDict object' has no attribute 'default' at MIB DOCS-IF3-MIB)
Detailed steps
This is a follow up from etingof/pysmi#72
Using only MIBs from https://github.com/lextudio/mibs.pysnmp.com/tree/master/asn1 I could successfully compile DOCS-IF3-MIB. However taking the latest DOCS-IF3-MIB from http://mibs.cablelabs.com/MIBs/DOCSIS/DOCS-IF3-MIB-2024-07-05.txt
I noticed a difference in DOCS-IF3-MIB, see specifically line 3242
DEFVAL { { bonding } }
:changing this line back (as it was in the version from mibs.pysnmp.com) to:
it compiles successfully again. Hope this helps to track the issue down. Of course I'm not 100% confident that Enumerated DEFVAL with TEXTUAL-CONVENTION is actually something which is by the spec.
Python package information
pysmi-lextudio = "1.4.3"
Operating system information
macOS
Python information
3.12.4
(Optional) Contents of your test script
Relevant log output
The text was updated successfully, but these errors were encountered: