Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This branch improves DEFVAL support across the board. The first commit properly defines what is to be supported and implements that, making numerous small improvements to DEFVAL processing as a result. It also restructures the code, thereby paving the way for the second commit. That commit discards DEFVAL values that do not match the object syntax's range/size constraints, which allows many more compiled MIBs to be loaded by pysnmp. It also resolves lextudio/pysnmp#147. Overall, this branch should leave DEFVAL processing in proper shape.
The before-and-after statistics against the mibs.pysnmp.com collection (as before, with the script from PR #3) are as follows:
Note that in the "before" case, the number of successes already improved from 10034 (as from PR #8) to 10075 MIBs. That is due to the merge of regenerated base MIBs in pysnmp, which in particular enabled about 40 MIBs to import ObjectName from SNMPv2-SMI. That type was previously (mistakenly) not exported from there.
In any case, this branch adds 297 successes, bringing the total from the collection to a hair short of 87%. In addition, another ~180 MIBs from this collection end up with improvements with respect to their default values. I still don't know if anybody actually ever uses those, but it certainly can't hurt.
The test set is extended accordingly, and is now up to 653 tests in total. The resulting code coverage of the most important modules in
pysmi/codegen/
is starting to look pretty decent, too.Zooming out a bit: this branch resolves the first point from the "Looking further ahead" section of PR #3. I do still plan on addressing the second point (broken imports) as well, but that is going to take a while longer. In addition to that, I think the best long-term plan is basically to get the "failed to load" numbers down to zero, in large part by turning various load-time errors into compile-time errors. As we have seen, debugging load-time errors is difficult for users, as well as confusing ("it compiled, so why doesn't it load?"). I think that if pysmi can at all determine that the compiled file won't load, it should refuse to compile it. That too will require some extra work; I will see what I can contribute.