<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic UCS unable to login using imcsdk in Unified Computing System (UCS)</title>
    <link>https://community.cisco.com/t5/unified-computing-system-ucs/ucs-unable-to-login-using-imcsdk/m-p/4481456#M38</link>
    <description>&lt;P&gt;I am unable to login via imcsdk and getting the below error.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Model: -&amp;nbsp;ULTM-C240-M4SX-SA&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;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)
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN class="ansi-red-intense-fg ansi-bold"&gt;&lt;BR /&gt;ImcLoginError&lt;/SPAN&gt;: Not a supported server.
&lt;/PRE&gt;
&lt;P&gt;Also facing issues with redfish API&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;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"
}&amp;nbsp; &amp;nbsp;&lt;/PRE&gt;
&lt;PRE&gt;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"}'&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 06 Oct 2021 22:17:29 GMT</pubDate>
    <dc:creator>syeafzal</dc:creator>
    <dc:date>2021-10-06T22:17:29Z</dc:date>
    <item>
      <title>UCS unable to login using imcsdk</title>
      <link>https://community.cisco.com/t5/unified-computing-system-ucs/ucs-unable-to-login-using-imcsdk/m-p/4481456#M38</link>
      <description>&lt;P&gt;I am unable to login via imcsdk and getting the below error.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Model: -&amp;nbsp;ULTM-C240-M4SX-SA&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;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)
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN class="ansi-red-intense-fg ansi-bold"&gt;&lt;BR /&gt;ImcLoginError&lt;/SPAN&gt;: Not a supported server.
&lt;/PRE&gt;
&lt;P&gt;Also facing issues with redfish API&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;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"
}&amp;nbsp; &amp;nbsp;&lt;/PRE&gt;
&lt;PRE&gt;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"}'&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Oct 2021 22:17:29 GMT</pubDate>
      <guid>https://community.cisco.com/t5/unified-computing-system-ucs/ucs-unable-to-login-using-imcsdk/m-p/4481456#M38</guid>
      <dc:creator>syeafzal</dc:creator>
      <dc:date>2021-10-06T22:17:29Z</dc:date>
    </item>
    <item>
      <title>Re: UCS unable to login using imcsdk</title>
      <link>https://community.cisco.com/t5/unified-computing-system-ucs/ucs-unable-to-login-using-imcsdk/m-p/4481458#M39</link>
      <description>&lt;P&gt;Update: Addressing this in WebEx chat with user, then will post our findings after for other users to find.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Oct 2021 22:29:27 GMT</pubDate>
      <guid>https://community.cisco.com/t5/unified-computing-system-ucs/ucs-unable-to-login-using-imcsdk/m-p/4481458#M39</guid>
      <dc:creator>kkhlebop</dc:creator>
      <dc:date>2021-10-06T22:29:27Z</dc:date>
    </item>
    <item>
      <title>Re: UCS unable to login using imcsdk</title>
      <link>https://community.cisco.com/t5/unified-computing-system-ucs/ucs-unable-to-login-using-imcsdk/m-p/4481512#M40</link>
      <description>&lt;P&gt;I was able to get a test user added to the user database on my UCS-C with this code.&lt;BR /&gt;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.&lt;/P&gt;
&lt;PRE&gt;&amp;gt; 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&lt;/PRE&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;Here is my output. I confirmed with UI and user was there:&lt;/P&gt;
&lt;PRE&gt;&amp;gt; python test.py
handle: &amp;lt;imcsdk.imchandle.ImcHandle object at 0x105791a90&amp;gt;
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 &lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Oct 2021 00:42:17 GMT</pubDate>
      <guid>https://community.cisco.com/t5/unified-computing-system-ucs/ucs-unable-to-login-using-imcsdk/m-p/4481512#M40</guid>
      <dc:creator>kkhlebop</dc:creator>
      <dc:date>2021-10-07T00:42:17Z</dc:date>
    </item>
  </channel>
</rss>

