summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGaige B Paulsen <gaige@cluetrust.com>2024-12-30 06:51:56 -0500
committerGitHub <noreply@github.com>2024-12-30 06:51:56 -0500
commitdbd87e3ab89b7839e41df76c2fa7712855853fd3 (patch)
tree4e4f6d04277efcfcb1b747e72bf53cdb2ac0dec6 /plugins
parentcae1c6cc42fa786095433692a6d685f029bbde2e (diff)
downloadvyos.vyos-dbd87e3ab89b7839e41df76c2fa7712855853fd3.tar.gz
vyos.vyos-dbd87e3ab89b7839e41df76c2fa7712855853fd3.zip
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
Diffstat (limited to 'plugins')
-rw-r--r--plugins/module_utils/network/vyos/argspec/snmp_server/snmp_server.py9
-rw-r--r--plugins/module_utils/network/vyos/rm_templates/snmp_server.py24
-rw-r--r--plugins/modules/vyos_snmp_server.py18
3 files changed, 13 insertions, 38 deletions
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 7d0fefe..b94c263 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 724be22..7175308 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<name>\S+)
\s+auth
- \s*(?P<enc>encrypted-key\s\S+)*
- \s*(?P<plain>plaintext-key\s\S+)*
+ \s*(?P<enc>encrypted-password\s\S+)*
+ \s*(?P<plain>plaintext-password\s\S+)*
\s*(?P<type>type\s\S+)*
$""",
re.VERBOSE,
@@ -451,8 +451,8 @@ class Snmp_serverTemplate(NetworkTemplate):
^set\sservice\ssnmp\sv3\strap-target
\s+(?P<name>\S+)
\s+privacy
- \s*(?P<enc>encrypted-key\s\S+)*
- \s*(?P<plain>plaintext-key\s\S+)*
+ \s*(?P<enc>encrypted-password\s\S+)*
+ \s*(?P<plain>plaintext-password\s\S+)*
\s*(?P<type>type\s\S+)*
$""",
re.VERBOSE,
@@ -481,8 +481,8 @@ class Snmp_serverTemplate(NetworkTemplate):
^set\sservice\ssnmp\sv3\suser
\s+(?P<name>\S+)
\s+auth
- \s*(?P<enc>encrypted-key\s\S+)*
- \s*(?P<plain>plaintext-key\s\S+)*
+ \s*(?P<enc>encrypted-password\s\S+)*
+ \s*(?P<plain>plaintext-password\s\S+)*
\s*(?P<type>type\s\S+)*
$""",
re.VERBOSE,
@@ -511,8 +511,8 @@ class Snmp_serverTemplate(NetworkTemplate):
^set\sservice\ssnmp\sv3\suser
\s+(?P<name>\S+)
\s+privacy
- \s*(?P<enc>encrypted-key\s\S+)*
- \s*(?P<plain>plaintext-key\s\S+)*
+ \s*(?P<enc>encrypted-password\s\S+)*
+ \s*(?P<plain>plaintext-password\s\S+)*
\s*(?P<type>type\s\S+)*
$""",
re.VERBOSE,
diff --git a/plugins/modules/vyos_snmp_server.py b/plugins/modules/vyos_snmp_server.py
index 87ddb79..f574919 100644
--- a/plugins/modules/vyos_snmp_server.py
+++ b/plugins/modules/vyos_snmp_server.py
@@ -20,7 +20,7 @@ short_description: Manages snmp_server resource module
description: This module manages the snmp server attributes of Vyos network devices
author: Gomathi Selvi Srinivasan (@GomathiselviS)
notes:
- - Tested against vyos 1.3.8
+ - Tested against vyos 1.3.8, 1.4.1
- This module works with connection C(network_cli).
- The Configuration defaults of the Vyos network devices
are supposed to hinder idempotent behavior of plays
@@ -136,9 +136,6 @@ options:
plaintext_key:
description: Defines the clear text password for authentication
type: str
- engine_id:
- description: Defines the engineID.
- type: str
port:
description: Specifies the TCP/UDP port of a destination for SNMP traps/informs.
type: int
@@ -164,16 +161,6 @@ options:
description: Specifies the type of notification between inform and trap
type: str
choices: ['inform', 'trap']
- tsm:
- description: Specifies that the snmpd uses encryption
- type: dict
- suboptions:
- local_key:
- description: Defines the server certificate fingerprint or key-file name.
- type: str
- port:
- description: Defines the port for tsm.
- type: int
users:
description: Defines username for authentication
type: list
@@ -196,9 +183,6 @@ options:
plaintext_key:
description: Defines the clear text password for authentication
type: str
- engine_id:
- description: Defines the engineID.
- type: str
group:
description: Specifies group for user name
type: str