From aba31d64787a6031db47ad11560309b014db56f4 Mon Sep 17 00:00:00 2001 From: Ron Erez Date: Mon, 15 Sep 2025 15:01:17 +0300 Subject: [PATCH] Revert "Fix SNMPv3 configuration on Edge Filers (#319)" This reverts commit ddd7c5d523b8ee474a099bed208aeb7495450c3e. --- cterasdk/edge/snmp.py | 13 +++---------- docs/source/UserGuides/Miscellaneous/Changelog.rst | 1 - tests/ut/edge/test_snmp.py | 1 - 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/cterasdk/edge/snmp.py b/cterasdk/edge/snmp.py index ada409b4..efdec5fb 100644 --- a/cterasdk/edge/snmp.py +++ b/cterasdk/edge/snmp.py @@ -37,7 +37,6 @@ def enable(self, port=161, community_str=None, username=None, auth_password=None param.readCommunity = community_str if username is not None and auth_password is not None and privacy_password is not None: param.snmpV3 = Object() - param.snmpV3._classname = 'SnmpV3Config' # pylint: disable=protected-access param.snmpV3.mode = enum.Mode.Enabled param.snmpV3.username = username param.snmpV3.authenticationPassword = auth_password @@ -54,15 +53,9 @@ def disable(self): logger.info("Disabled SNMP.") def get_configuration(self): - """ - Get current SNMP configuration - - :return: Current SNMP configuration - :rtype: cterasdk.common.object.Object - """ return self._edge.api.get('/config/snmp') - def modify(self, port=161, community_str=None, username=None, auth_password=None, privacy_password=None): + def modify(self, port=None, community_str=None, username=None, auth_password=None, privacy_password=None): """ Modify current SNMP configuration. Only configurations that are not `None` will be changed. SNMP must be enabled @@ -75,12 +68,12 @@ def modify(self, port=161, community_str=None, username=None, auth_password=None current_config = self.get_configuration() if current_config.mode == enum.Mode.Disabled: raise CTERAException("SNMP configuration cannot be modified when disabled") - current_config.port = port + if port: + current_config.port = port if community_str: current_config.readCommunity = community_str if username is not None and auth_password is not None and privacy_password is not None: current_config.snmpV3 = Object() - current_config.snmpV3._classname = 'SnmpV3Config' # pylint: disable=protected-access current_config.snmpV3.mode = enum.Mode.Enabled current_config.snmpV3.username = username current_config.snmpV3.authenticationPassword = auth_password diff --git a/docs/source/UserGuides/Miscellaneous/Changelog.rst b/docs/source/UserGuides/Miscellaneous/Changelog.rst index 86e5afc6..da0ed0c8 100644 --- a/docs/source/UserGuides/Miscellaneous/Changelog.rst +++ b/docs/source/UserGuides/Miscellaneous/Changelog.rst @@ -26,7 +26,6 @@ Improvements Bug Fixes ^^^^^^^^^ -* Fixed SNMPv3 configuration on Edge Filers - added missing XML class name for proper serialization * Corrected Direct I/O object class references in the documentation .. code:: python diff --git a/tests/ut/edge/test_snmp.py b/tests/ut/edge/test_snmp.py index 9f8fd3fa..6a4d5fc0 100644 --- a/tests/ut/edge/test_snmp.py +++ b/tests/ut/edge/test_snmp.py @@ -76,7 +76,6 @@ def _get_snmp_object(self, port=None, community_str=None, username=None, auth_pa param.readCommunity = community_str if username is not None and auth_password is not None and privacy_password is not None: param.snmpV3 = Object() - param.snmpV3._classname = 'SnmpV3Config' # pylint: disable=protected-access param.snmpV3.mode = Mode.Enabled param.snmpV3.username = username param.snmpV3.authenticationPassword = auth_password