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

Ensure AgentProxy.snmpVersion is prefixed by v #2780

Merged
merged 3 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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