@@ -37,7 +37,6 @@ 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
4140 param .snmpV3 .mode = enum .Mode .Enabled
4241 param .snmpV3 .username = username
4342 param .snmpV3 .authenticationPassword = auth_password
@@ -54,15 +53,9 @@ def disable(self):
5453 logger .info ("Disabled SNMP." )
5554
5655 def get_configuration (self ):
57- """
58- Get current SNMP configuration
59-
60- :return: Current SNMP configuration
61- :rtype: cterasdk.common.object.Object
62- """
6356 return self ._edge .api .get ('/config/snmp' )
6457
65- def modify (self , port = 161 , community_str = None , username = None , auth_password = None , privacy_password = None ):
58+ def modify (self , port = None , community_str = None , username = None , auth_password = None , privacy_password = None ):
6659 """
6760 Modify current SNMP configuration. Only configurations that are not `None` will be changed. SNMP must be enabled
6861
@@ -75,12 +68,12 @@ def modify(self, port=161, community_str=None, username=None, auth_password=None
7568 current_config = self .get_configuration ()
7669 if current_config .mode == enum .Mode .Disabled :
7770 raise CTERAException ("SNMP configuration cannot be modified when disabled" )
78- current_config .port = port
71+ if port :
72+ current_config .port = port
7973 if community_str :
8074 current_config .readCommunity = community_str
8175 if username is not None and auth_password is not None and privacy_password is not None :
8276 current_config .snmpV3 = Object ()
83- current_config .snmpV3 ._classname = 'SnmpV3Config' # pylint: disable=protected-access
8477 current_config .snmpV3 .mode = enum .Mode .Enabled
8578 current_config .snmpV3 .username = username
8679 current_config .snmpV3 .authenticationPassword = auth_password
0 commit comments