White Papers

36 Implementation of the DMTF Redfish API on Dell EMC PowerEdge Servers
response = requests.post(url, files=files, auth = (idrac_username,
idrac_password), verify=False, headers=headers)
d = response.__dict__
if response.status_code == 201:
print "\n- PASS: Command passed, 201 status code returned\n"
z=re.search("\"Message\":.+?,",d['_content']).group().rstrip(",")
z=re.sub('"',"",z)
print "- %s" % z
else:
print "\n- FAIL: Post command failed to download, error is %s" %
response
print "\nMore details on status code error: %s " % d['_content']
sys.exit()
d = response.__dict__
z=re.search("Available.+?,",d['_content']).group()
z = re.sub('[",]',"",z)
new_FW_version = re.sub('Available','Installed',z)
zz=z.find("-")
zz=z.find("-",zz+1)
dup_version = z[zz+1:]
entry = "- FW file version is: %s" % dup_version; print entry
Location = response.headers['Location']
# Install the downloaded image payload and loop checking job status
def install_image_payload():
global job_id
print "\n- WARNING, installing downloaded firmware payload to device\n"
url =
'https://%s/redfish/v1/UpdateService/Actions/Oem/DellUpdateService.Install' %
(idrac_ip)
InstallOption = install_option
payload = "{\"SoftwareIdentityURIs\":[\"" + Location +
"\"],\"InstallUpon\":\""+ InstallOption +"\"}"
headers = {'content-type': 'application/json'}
response = requests.post(url, data=payload, auth = (idrac_username,
idrac_password), verify=False, headers=headers)
d=str(response.__dict__)
job_id_location = response.headers['Location']
job_id = re.search("JID_.+",job_id_location).group()
print "\n- PASS, %s job ID successfully created\n" % job_id
#time.sleep(20)
# Check the new firmware version installed
def check_new_FW_version():