Open
Conversation
Update pysnmp from >=4.4.12, <6 to >=7.1.22 and pyasn1 from <0.6.1 to >=0.6.2 to support the latest upstream releases. This fixes compatibility with current Debian packages. Closes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1117416 Signed-off-by: Tim Orling <tim.orling@konsulko.com>
Port the SNMP driver to the pysnmp 7.1 v3arch asyncio API: - Import from pysnmp.hlapi.v3arch.asyncio instead of pysnmp.hlapi - setCmd -> set_cmd (PEP 8 naming convention) - UdpTransportTarget() -> await UdpTransportTarget.create() (async DNS) - next(setCmd(...)) -> await set_cmd(...) (coroutine instead of generator) - addAsn1MibSource -> add_asn1_mib_source (PEP 8 naming convention) - Update MIB source URL from defunct mibs.snmplabs.com to mibs.pysnmp.com - Add SnmpEngine.close_dispatcher() cleanup in a finally block - Run async code via asyncio.run() from the sync port_interaction method Signed-off-by: Tim Orling <tim.orling@konsulko.com>
Fix: LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy
"ENV key value" format
Signed-off-by: Tim Orling <tim.orling@konsulko.com>
Replace the deprecated pkg_resources.iter_entry_points() with importlib.metadata.entry_points(), which is available in the standard library since Python 3.9. This fixes ModuleNotFoundError on systems where setuptools is not installed. Signed-off-by: Tim Orling <tim.orling@konsulko.com>
Add 20 tests covering: - accepts() class method for driver selection - __init__() with SNMPv1 and SNMPv3 settings - port_interaction() command validation and async dispatch - _port_interaction_async() for both SNMPv1 and SNMPv3 paths - Error handling: missing username/community, unknown version, error indication, error status, and engine cleanup on failure - inside_number controlpoint substitution with and without static_ending - SNMPv3 auth/priv protocol configuration Signed-off-by: Tim Orling <tim.orling@konsulko.com>
Author
|
I have a proof of concept for a test suite: |
4e1e76a to
b5d0471
Compare
Fixes: PytestUnknownMarkWarning: Unknown pytest.mark.asyncio - is this a typo? Signed-off-by: Tim Orling <tim.orling@konsulko.com>
Python 3.8 and 3.9 are EOL [1] The bump in python3-pysnmp minimum requirement is python 3.10 [2] [1] https://devguide.python.org/versions/#status-of-python-versions [2] https://pypi.org/project/pysnmp/7.1.22/ Signed-off-by: Tim Orling <tim.orling@konsulko.com>
b5d0471 to
9240c6e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
ENVsyntax warnings in Dockerfileimport pkg_resources).test_snmptest suiteI don't have an SNMP PDU to test on, so we need to make sure to test the new snmp async code. But I did add a test suite that passes.