Skip to content

Commit

Permalink
Merge pull request #2780 from lunkwill42/bugfix/snmpv1-agentproxy-fixup
Browse files Browse the repository at this point in the history
Ensure `AgentProxy.snmpVersion` is prefixed by `v`
  • Loading branch information
lunkwill42 authored Dec 1, 2023
2 parents ce3e2d0 + c679e56 commit cec8ad9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
This changelog format was introduced in NAV 5.4.0. Older changelogs can be
found in the [HISTORY](HISTORY) file.

## [Unreleased]

### Fixed

- Fix non-working SNMPv1 communication ([#2772](https://github.com/Uninett/nav/issues/2772), [#2779](https://github.com/Uninett/nav/issues/2779), [#2780](https://github.com/Uninett/nav/pull/2780))

## [5.8.2] - 2023-11-30

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion python/nav/ipdevpoll/snmp/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def as_agentproxy_args(self) -> Dict[str, Any]:
"""Returns the SNMP session parameters in a dict format compatible with
pynetsnmp.twistedsnmp.AgentProxy() keyword arguments.
"""
kwargs = {"snmpVersion": self.version_string}
kwargs = {"snmpVersion": f"v{self.version_string}"}
if self.version in (1, 2):
kwargs["community"] = self.community
if self.timeout:
Expand Down
2 changes: 1 addition & 1 deletion tests/unittests/ipdevpoll/snmp/common_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_should_contain_cmdline_args(self, snmpv3_params):

def test_should_contain_version_argument(self, snmpv3_params):
kwargs = snmpv3_params.as_agentproxy_args()
assert kwargs.get("snmpVersion") == "3"
assert kwargs.get("snmpVersion") == "v3"

def test_should_contain_sec_level_cmdline_argument(self, snmpv3_params):
kwargs = snmpv3_params.as_agentproxy_args()
Expand Down

0 comments on commit cec8ad9

Please sign in to comment.