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

Fix snmp host syntax #1073

Merged
merged 1 commit into from
May 14, 2024
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
3 changes: 3 additions & 0 deletions changelogs/fragments/snmp_server_host.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
bugfixes:
- snmp_server - Fix wrong syntax of snmp-server host command generation.
4 changes: 2 additions & 2 deletions plugins/module_utils/network/ios/rm_templates/snmp_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ def cmd_option_hosts(config_data): # contain sub list attr
cmd += " {host}".format(host=config_data.get("host"))
if config_data.get("informs"):
cmd += " informs"
if config_data.get("vrf"):
cmd += " vrf {vrf}".format(vrf=config_data.get("vrf"))
if config_data.get("version"):
cmd += " version {version}".format(version=config_data.get("version"))
if config_data.get("version_option"):
cmd += " {version}".format(version=config_data.get("version_option"))
if config_data.get("vrf"):
cmd += " vrf {vrf}".format(vrf=config_data.get("vrf"))
if config_data.get("community_string"):
cmd += " {community_string}".format(
community_string=config_data.get("community_string"),
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/modules/network/ios/test_ios_snmp_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -1928,7 +1928,7 @@ def test_ios_snmp_server_rendered(self):
"snmp-server enable traps ospf state-change",
"snmp-server enable traps ethernet cfm cc mep-up mep-down cross-connect loop config",
"snmp-server enable traps ethernet cfm crosscheck mep-missing mep-unknown service-up",
"snmp-server host 172.16.1.1 version 3 auth vrf mgmt group0 tty",
"snmp-server host 172.16.1.1 vrf mgmt version 3 auth group0 tty",
"snmp-server host 172.16.2.1 version 3 priv newtera rsrb",
"snmp-server host 172.16.2.1 version 3 noauth replaceUser slb",
"snmp-server host 172.16.2.1 version 2c trapsac tty",
Expand Down
Loading