White Papers

27 Implementation of the DMTF Redfish API on Dell EMC PowerEdge Servers
time.sleep(2)
url = 'https://%s/redfish/v1/Systems/System.Embedded.1/Bios/Settings' %
idrac_ip
payload = {"Attributes":{attribute_name:pending_value}}
headers = {'content-type': 'application/json'}
response = requests.patch(url, data=json.dumps(payload), headers=headers,
verify=False,auth=(idrac_username, idrac_password))
statusCode = response.status_code
if statusCode == 200:
print "\n- PASS: Command passed to set BIOS attribute %s pending value
to %s\n" % (attribute_name, pending_value)
else:
print "\n- FAIL, Command failed, errror code is %s" % statusCode
detail_message=str(response.__dict__)
print detail_message
sys.exit()
d=str(response.__dict__)
### Function to create BIOS target config job
def create_bios_config_job():
global job_id
url = 'https://%s/redfish/v1/Managers/iDRAC.Embedded.1/Jobs' % idrac_ip
#payload = {"Target":"BIOS.Setup.1-1","RebootJobType":"PowerCycle"}
payload =
{"TargetSettingsURI":"/redfish/v1/Systems/System.Embedded.1/Bios/Settings"}
headers = {'content-type': 'application/json'}
response = requests.post(url, data=json.dumps(payload), headers=headers,
verify=False,auth=(idrac_username, idrac_password))
statusCode = response.status_code
#print "Status Code: {0}".format(response.status_code)
#print "Extended Info Message: {0}".format(response.json())
if statusCode == 200:
print "\n- PASS: Command passed to create target config job, status code
200 returned.\n"
else:
print "\n- FAIL, Command failed, status code is %s\n" % statusCode
detail_message=str(response.__dict__)
print detail_message
sys.exit()
d=str(response.__dict__)
z=re.search("JID_.+?,",d).group()
job_id=re.sub("[,']","",z)
print "- WARNING: %s job ID successfully created\n" % job_id
### Function to verify job is marked as scheduled before rebooting the server