01-12-2018 11:07 AM - edited 03-01-2019 08:42 AM
I have 2 UCS C240 M4SX servers. They are each running a different CIMC version. Although they both have XML API enabled, I'm unable to login into the server with the later CIMC version v3.0(3a). Below is a simple script showing what happens. I have tried later versions of python too. Any idea whats happening and how to solve?
1) sdot-c240-0041 v2.0(10b)
2) sdot-c240-0061 v3.0(3a)
################
## Python script
################
#!/usr/software/bin/python2.7.5
import requests
requests.packages.urllib3.disable_warnings()
for server in ["sdot-c240-0041-cimc", "sdot-c240-0061-cimc"]:
print(server + ":")
url_api = "https://" + server + "/nuova"
data = "<aaaLogin inName='admin' inPassword='password'></aaaLogin>"
r = requests.post(url_api,data=data,verify=False)
print("STATUS: " + str(r.status_code))
print(r.headers)
print(r.text)
################
## RESULTS
################
> ./p1.py
sdot-c240-0041-cimc:
STATUS: 200
{'Content-length': '187', 'Keep-Alive': 'timeout=60, max=2000', 'Server': 'Mbedthis-Appweb/2.4.2', 'Connection': 'keep-alive', 'Date': 'Fri, 12 Jan 2018 18:52:35 GMT', 'X-Frame-Options': 'SAMEORIGIN', 'Content-type': 'application/soap+xml;charset=UTF-8'}
<aaaLogin cookie="" response="yes" outCookie="1515783155/723d0d81-6299-1299-801a-720c6fc63d84" outRefreshPeriod="600" outPriv="admin" outSessionId="45" outVersion="2.0(10b)"> </aaaLogin>
sdot-c240-0061-cimc:
STATUS: 400
{'Date': 'Fri, 12 Jan 2018 11:53:12 GMT', 'Content-Length': '0', 'Server': 'Monkey'}
Solved! Go to Solution.
03-13-2018 08:06 AM
Hi Gary,
The 3.0 firmware version http process that is listening for XML API requests requires that 'Content-Type' be specified in the header of the http request
This code should work for you on the 3.0 firmware, it may work on the 2.x as well. Hope this helps.
Regards,
John
################
## Python script
################
#!/usr/software/bin/python2.7.5
import requests
requests.packages.urllib3.disable_warnings()
for server in ["sdot-c240-0041-cimc", "sdot-c240-0061-cimc"]:
print(server + ":")
url_api = "https://" + server + "/nuova"
data = "<aaaLogin inName='admin' inPassword='password'></aaaLogin>"
headers = {'Content-Type':'application/xml'}
r = requests.post(url_api,data=data,verify=False,headers=headers)
print("STATUS: " + str(r.status_code))
print(r.headers)
print(r.text)
03-13-2018 08:06 AM
Hi Gary,
The 3.0 firmware version http process that is listening for XML API requests requires that 'Content-Type' be specified in the header of the http request
This code should work for you on the 3.0 firmware, it may work on the 2.x as well. Hope this helps.
Regards,
John
################
## Python script
################
#!/usr/software/bin/python2.7.5
import requests
requests.packages.urllib3.disable_warnings()
for server in ["sdot-c240-0041-cimc", "sdot-c240-0061-cimc"]:
print(server + ":")
url_api = "https://" + server + "/nuova"
data = "<aaaLogin inName='admin' inPassword='password'></aaaLogin>"
headers = {'Content-Type':'application/xml'}
r = requests.post(url_api,data=data,verify=False,headers=headers)
print("STATUS: " + str(r.status_code))
print(r.headers)
print(r.text)
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide