Skip to content

Commit a47a33d

Browse files
committed
Merge branch 'master' into saimon/improved-file-browsing-exception-handling
2 parents 19b14fe + 17e424a commit a47a33d

3 files changed

Lines changed: 22 additions & 3 deletions

File tree

cterasdk/edge/snmp.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def enable(self, port=161, community_str=None, username=None, auth_password=None
3737
param.readCommunity = community_str
3838
if username is not None and auth_password is not None and privacy_password is not None:
3939
param.snmpV3 = Object()
40+
param.snmpV3._classname = 'SnmpV3Config' # pylint: disable=protected-access
4041
param.snmpV3.mode = enum.Mode.Enabled
4142
param.snmpV3.username = username
4243
param.snmpV3.authenticationPassword = auth_password
@@ -53,9 +54,15 @@ def disable(self):
5354
logger.info("Disabled SNMP.")
5455

5556
def get_configuration(self):
57+
"""
58+
Get current SNMP configuration
59+
60+
:return: Current SNMP configuration
61+
:rtype: cterasdk.common.object.Object
62+
"""
5663
return self._edge.api.get('/config/snmp')
5764

58-
def modify(self, port=None, community_str=None, username=None, auth_password=None, privacy_password=None):
65+
def modify(self, port=161, community_str=None, username=None, auth_password=None, privacy_password=None):
5966
"""
6067
Modify current SNMP configuration. Only configurations that are not `None` will be changed. SNMP must be enabled
6168
@@ -68,12 +75,12 @@ def modify(self, port=None, community_str=None, username=None, auth_password=Non
6875
current_config = self.get_configuration()
6976
if current_config.mode == enum.Mode.Disabled:
7077
raise CTERAException("SNMP configuration cannot be modified when disabled")
71-
if port:
72-
current_config.port = port
78+
current_config.port = port
7379
if community_str:
7480
current_config.readCommunity = community_str
7581
if username is not None and auth_password is not None and privacy_password is not None:
7682
current_config.snmpV3 = Object()
83+
current_config.snmpV3._classname = 'SnmpV3Config' # pylint: disable=protected-access
7784
current_config.snmpV3.mode = enum.Mode.Enabled
7885
current_config.snmpV3.username = username
7986
current_config.snmpV3.authenticationPassword = auth_password

docs/source/UserGuides/Miscellaneous/Changelog.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
Changelog
22
=========
33

4+
2.20.21
5+
-------
6+
7+
Related issues and pull requests on GitHub: `#319 <https://github.com/ctera/ctera-python-sdk/pull/319>`_
8+
9+
Bug Fixes
10+
^^^^^^^^^
11+
12+
* Fixed SNMPv3 configuration on Edge Filers - added missing XML class name for proper serialization
13+
* Fixed whitespace in SNMP docstring to resolve flake8 W293 warning
14+
415
2.20.20
516
-------
617

tests/ut/edge/test_snmp.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ def _get_snmp_object(self, port=None, community_str=None, username=None, auth_pa
7676
param.readCommunity = community_str
7777
if username is not None and auth_password is not None and privacy_password is not None:
7878
param.snmpV3 = Object()
79+
param.snmpV3._classname = 'SnmpV3Config' # pylint: disable=protected-access
7980
param.snmpV3.mode = Mode.Enabled
8081
param.snmpV3.username = username
8182
param.snmpV3.authenticationPassword = auth_password

0 commit comments

Comments
 (0)