Skip to content
Closed
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
13 changes: 3 additions & 10 deletions cterasdk/edge/snmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion docs/source/UserGuides/Miscellaneous/Changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion tests/ut/edge/test_snmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down