cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1139
Views
0
Helpful
2
Replies

UCS unable to login using imcsdk

syeafzal
Cisco Employee
Cisco Employee

I am unable to login via imcsdk and getting the below error. 

 

Model: - ULTM-C240-M4SX-SA

 

 

username = xxx
password = xxx
handle = ImcHandle(ip, username, password, port=443)
handle.login()
user = AaaUser(parent_mo_or_dn='sys/user-ext',id=str(i), priv='read-only',pwd='xxx',account_status='active',name=user)
handle.add_mo(user)

 

 


ImcLoginError
: Not a supported server.

Also facing issues with redfish API

 

 

curl -XPOST -u 'admin:xxxx' https://x.x.x.x:443/redfish/v1/AccountService/Accounts/5 -v --insecure -d '{"Id":"5","UserName":"abc","Password":"xxxx","RoleId":"read-only","Enabled":"true"}'

{
"error":{
"message":"Invalid argument count",
"code":"BadRequest"
}   
curl -XPOST -u 'admin:xxxx' https://x.x.x.x:443/redfish/v1/AccountService/Accounts -v --insecure -d '{"Id":"5","UserName":"abc","Password":"xxxx","RoleId":"read-only","Enabled":"true"}'

 

 

2 Replies 2

kkhlebop
Cisco Employee
Cisco Employee

Update: Addressing this in WebEx chat with user, then will post our findings after for other users to find.

I was able to get a test user added to the user database on my UCS-C with this code.
We were using UCS-C 4.1. OP is running 3.0(4d) and perhaps the issue is that it is outdated. Still finding out and will post final results here.

> cat test.py
from imcsdk.imchandle import ImcHandle
from imcsdk.mometa.aaa.AaaUser import AaaUser

try:
  username = "admin"
  password = "xxx"
  ip = "10.194.239.250"
  handle = ImcHandle(ip, username, password, port=443)
  print("handle:", handle)
  print("hlogin:", handle.login())
  user="testuser1"
  userpass="ExtremePassword123!"
  i=2 # note we hard coded the user id. user id 1 is admin and anything after is other users. if id exists, it overwrites - we tested it.
  user = AaaUser(parent_mo_or_dn='sys/user-ext',id=str(i), priv='read-only',pwd=userpass,account_status='active',name=user)
  print("user:")
  print(user)
  print("add_mo:", handle.add_mo(user))
finally:
  print("logout:", handle.logout()) # dont forget logout or else can get max log sessions

Sidenote: although documentation says imcsdk works with python 2.7+ and 3.2+, that it didn't work for me on 3.9 but it worked on 3.7.

Here is my output. I confirmed with UI and user was there:

> python test.py
handle: <imcsdk.imchandle.ImcHandle object at 0x105791a90>
hlogin: True
user:

Managed Object                  :       AaaUser
--------------
account_status                  :active
admin_action                    :None
child_action                    :None
dn                              :sys/user-ext/user-2
id                              :2
name                            :testuser1
priv                            :read-only
pwd                             :ExtremePassword123!
rn                              :user-2
status                          :None

add_mo: None
logout: True