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

Register fixed lengths for octet strings #9

Merged
merged 1 commit into from
Nov 2, 2024

Conversation

dcvmoole
Copy link

@dcvmoole dcvmoole commented Nov 2, 2024

This PR restores pysmi's fixedLength field generation. As such, it is the fix for point (2) of my (first) comment in lextudio/pysnmp#141. That should allow fixes for pysnmp for the other two points from that comment to restore proper generation and parsing of OIDs with fixed-length string indices.

This PR does not change the mibs.pysnmp.com statistics (i.e., no regressions), but there are now 9969 fixedLength assignments across 2085 MIBs from that collection that were missing before, and those numbers are very close to the pre-Jinja2 numbers from there (9954 assignments across 2088 MIBs). Note that the collection itself has been slightly altered since then, so an exact match is not expected there. In any case, I think this is looking good.

In addition, the pysmi test set is extended to 510 tests.

For the purpose of generating and parsing formatted OIDs, pysnmp needs
to know whether an OCTET STRING typed object has a fixed length, and if
so, which length. Before the switch to Jinja2 templates, pysmi assigned
such fixed lengths as "fixedLength" attributes to types. With the
switch, that functionality got lost, thereby also breaking pysnmp's
proper handling of formatted OIDs.

This commit restores the assignment of "fixedLength" attributes. Note
that as of writing, this change is necessary but not sufficient to fix
the corresponding funtionality in pysnmp.

The test set is extended with extra tests for this functionality, and
some previously missing general tests on constraints. As part of that, a
bug is fixed in an existing test wherein naming conflicts caused
various bulk-generated test methods to overwrite each other.
@lextm lextm merged commit 97ada75 into lextudio:main Nov 2, 2024
17 checks passed
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

Successfully merging this pull request may close these issues.

2 participants