From dbd87e3ab89b7839e41df76c2fa7712855853fd3 Mon Sep 17 00:00:00 2001 From: Gaige B Paulsen Date: Mon, 30 Dec 2024 06:51:56 -0500 Subject: T6982: update SNMP module for 1.3+ (#369) * fix: get SNMP integration tests running * fix: remove no_log from docs because it fails sanity * tests: fix unit tests and no_log args * tests: fix error in hostname integration test --- .../vyos/argspec/snmp_server/snmp_server.py | 9 -------- .../network/vyos/rm_templates/snmp_server.py | 24 +++++++++++----------- 2 files changed, 12 insertions(+), 21 deletions(-) (limited to 'plugins/module_utils') diff --git a/plugins/module_utils/network/vyos/argspec/snmp_server/snmp_server.py b/plugins/module_utils/network/vyos/argspec/snmp_server/snmp_server.py index 7d0fefec..b94c2639 100644 --- a/plugins/module_utils/network/vyos/argspec/snmp_server/snmp_server.py +++ b/plugins/module_utils/network/vyos/argspec/snmp_server/snmp_server.py @@ -108,7 +108,6 @@ class Snmp_serverArgs(object): # pylint: disable=R0903 }, }, }, - "engine_id": {"type": "str"}, "port": {"type": "int"}, "privacy": { "type": "dict", @@ -137,13 +136,6 @@ class Snmp_serverArgs(object): # pylint: disable=R0903 }, }, }, - "tsm": { - "type": "dict", - "options": { - "local_key": {"type": "str", "no_log": True}, - "port": {"type": "int"}, - }, - }, "users": { "type": "list", "elements": "dict", @@ -166,7 +158,6 @@ class Snmp_serverArgs(object): # pylint: disable=R0903 }, }, }, - "engine_id": {"type": "str"}, "group": {"type": "str"}, "mode": {"type": "str", "choices": ["ro", "rw"]}, "privacy": { diff --git a/plugins/module_utils/network/vyos/rm_templates/snmp_server.py b/plugins/module_utils/network/vyos/rm_templates/snmp_server.py index 724be228..71753083 100644 --- a/plugins/module_utils/network/vyos/rm_templates/snmp_server.py +++ b/plugins/module_utils/network/vyos/rm_templates/snmp_server.py @@ -82,9 +82,9 @@ def _tmplt_snmp_server_v3_trap_target(config_data): if "type" in config_data: command += " type {mode}".format(**config_data) if "encrypted_key" in config_data: - command += " encrypted-key {encrypted_key}".format(**config_data) + command += " encrypted-password {encrypted_key}".format(**config_data) if "plaintext_key" in config_data: - command += " plaintext-key {plaintext_key}".format(**config_data) + command += " plaintext-password {plaintext_key}".format(**config_data) return command @@ -103,10 +103,10 @@ def _tmplt_snmp_server_v3_user(config_data): type_cmd = cmd + val + " type {type}".format(**config) command.append(type_cmd) if "encrypted_key" in config: - enc_cmd = cmd + val + " encrypted-key {encrypted_key}".format(**config) + enc_cmd = cmd + val + " encrypted-password {encrypted_key}".format(**config) command.append(enc_cmd) if "plaintext_key" in config: - plain_cmd = cmd + val + " plaintext-key {plaintext_key}".format(**config) + plain_cmd = cmd + val + " plaintext-password {plaintext_key}".format(**config) command.append(plain_cmd) return command @@ -329,8 +329,8 @@ class Snmp_serverTemplate(NetworkTemplate): ^set\sservice\ssnmp\sv3\strap-target \s+(?P\S+) \s+auth - \s*(?Pencrypted-key\s\S+)* - \s*(?Pplaintext-key\s\S+)* + \s*(?Pencrypted-password\s\S+)* + \s*(?Pplaintext-password\s\S+)* \s*(?Ptype\s\S+)* $""", re.VERBOSE, @@ -451,8 +451,8 @@ class Snmp_serverTemplate(NetworkTemplate): ^set\sservice\ssnmp\sv3\strap-target \s+(?P\S+) \s+privacy - \s*(?Pencrypted-key\s\S+)* - \s*(?Pplaintext-key\s\S+)* + \s*(?Pencrypted-password\s\S+)* + \s*(?Pplaintext-password\s\S+)* \s*(?Ptype\s\S+)* $""", re.VERBOSE, @@ -481,8 +481,8 @@ class Snmp_serverTemplate(NetworkTemplate): ^set\sservice\ssnmp\sv3\suser \s+(?P\S+) \s+auth - \s*(?Pencrypted-key\s\S+)* - \s*(?Pplaintext-key\s\S+)* + \s*(?Pencrypted-password\s\S+)* + \s*(?Pplaintext-password\s\S+)* \s*(?Ptype\s\S+)* $""", re.VERBOSE, @@ -511,8 +511,8 @@ class Snmp_serverTemplate(NetworkTemplate): ^set\sservice\ssnmp\sv3\suser \s+(?P\S+) \s+privacy - \s*(?Pencrypted-key\s\S+)* - \s*(?Pplaintext-key\s\S+)* + \s*(?Pencrypted-password\s\S+)* + \s*(?Pplaintext-password\s\S+)* \s*(?Ptype\s\S+)* $""", re.VERBOSE, -- cgit v1.2.3