Reference Guide
37 RESTful Server Configuration with iDRAC RESTful API
were displayed when verifying them using the browser session. Using the wrong order may cause the export
to fail or the option to be ignored.
Script: redfish_SCP_export_clone.py
# Python script using Redfish API to perform iDRAC feature
# Server Configuration Profile (SCP) for export only with clone enabled
import requests, json, sys, re, time
from datetime import datetime
try:
idrac_ip = sys.argv[1]
idrac_username = sys.argv[2]
idrac_password = sys.argv[3]
file = sys.argv[4]
except:
print "\n- FAIL, you must pass in script name along with iDRAC IP/iDRAC username/iDRAC paasswo
rd/file name"
sys.exit()
url = 'https://%s/redfish/v1/Managers/iDRAC.Embedded.1/Actions/Oem/EID_674_Manager.ExportSystemCon
figuration' % idrac_ip
# For payload dictionary supported parameters, refer to schema
# "https://'iDRAC IP'/redfish/v1/Managers/iDRAC.Embedded.1/"
payload = {"ExportFormat":"XML","ExportUse":"Clone","ShareParameters":{"Target":"All","IPAddress":
"192.168.0.130","ShareName":"cifs_share","ShareType":"CIFS","FileName":file,"UserName":"cifs_user"
,"Password":"cifs_password"}}
headers = {'content-type': 'application/json'}
response = requests.post(url, data=json.dumps(payload), headers=headers, verify=False, auth=(idrac
_username,idrac_password))
d=str(response.__dict__)
try:
z=re.search("JID_.+?,",d).group()
except:
print "\n- FAIL: detailed error message: {0}".format(response.__dict__['_content'])
sys.exit()
job_id=re.sub("[,']","",z)
if response.status_code != 202:
print "\n##### Command Failed, status code not 202\n, code is: %s" % response.status_code
sys.exit()
else:
print "\n- %s successfully created for ExportSystemConfiguration method\n" % (job_id)
response_output=response.__dict__
job_id=response_output["headers"]["Location"]
job_id=re.search("JID_.+",job_id).group()
start_time=datetime.now()
while True: