CiscoUcs / imcsdk

Python SDK for Cisco IMC
Other
38 stars 50 forks source link

Adding snmp user with security_level='authnopriv' without param 'priv_pwd' throws error #86

Closed tanmayx closed 7 years ago

tanmayx commented 7 years ago

SDK version: Latest from git Python version: 2.7.12 IMC version: 3.0(1c)

Execute the following code snippet -

from imcsdk.apis.admin.snmp import *
from imcsdk.imchandle import ImcHandle
handle = ImcHandle(ip=ip, username=username, password=password)
handle.login()
snmp_user_add(handle=handle, name='klm', security_level='authnopriv', auth='MD5', auth_pwd='pass')
handle.logout()

Observation -

After executing the above code snippet, it throws following error -
_Traceback (most recent call last):_
  _File "c:\python27\lib\site-packages\nose\case.py", line 197, in runTest_
    _self.test(*self.arg)_
  _File "C:\Tanmay\PythonSDK\pysdkframework\TestSuite_ClassicImc\Nosetests\test_snmp.py", line 37, in_ _test_snmp_user_add_
    _snmp_user_add(handle=handle, name='klm', security_level='authnopriv', auth='MD5',_ _auth_pwd='Nbv12345')_
  _File "c:\python27\lib\site-packages\imcsdk-0.9.1.0-py2.7.egg\imcsdk\apis\admin\snmp.py", line 362, in_ _snmp_user_add_
    _free_user.privacy_pwd = priv_pwd_
  _File "c:\python27\lib\site-packages\imcsdk-0.9.1.0-py2.7.egg\imcsdk\imcmo.py", line 138, in __setattr___
    self.__set_prop(name, value)_
  _File "c:\python27\lib\site-packages\imcsdk-0.9.1.0-py2.7.egg\imcsdk\imcmo.py", line 192, in_ __set_prop value))_
_ValueError: Invalid Value Exception - [CommSnmpUser]: Prop <privacy_pwd>, Value<None>._

Expected - _When security_level='authnopriv', privpwd should not be mandatory.

vvb commented 7 years ago

@waghswapnil can you take a look at this one. I think we had discussed this exact use-case and implemented it as per the expectation here..

waghswapnil commented 7 years ago

@vvb: I have already discussed this with @tanmayx

waghswapnil commented 7 years ago

fixed by #98