@@ -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
0 commit comments