Reference Guide

26 RESTful Server Configuration with iDRAC RESTful API
Whether the server is powered on (default) or powered off after the SCP import is completed
Specify a timeout period when awaiting an OS graceful shutdown (default is 1800 seconds)
Indicate the type of server shutdown to be performed after the SCP is imported
- Graceful OS shutdown (default)
- Forced OS shutdown
- No reboot is to be performed, postponing application of the SCP import until a server shutdown is
later commanded
Note: Depending on the type of configuration object being modified by an SCP import, the new values could
be applied immediately without a reboot or could require staging and a reboot of the server to apply the new
values. Object groups that support immediate update include LifecycleController, System, iDRAC, and
EventFilters. For more details on immediate and staged updates, see the RACADM CLI Guide available at
dell.com/idracmanuals. The script parameters include iDRAC IP address, iDRAC admin username and
password and file name of SCP file; the script will import from a CIFS share.
Script: redfish_SCP_import_cifs.py
# Python script using Redfish API to perform iDRAC feature
# Server Configuration Profile (SCP) for import only
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.ImportSystemCon
figuration' % idrac_ip
# For payload dictionary supported parameters, refer to schema
# "https://'iDRAC IP'/redfish/v1/Managers/iDRAC.Embedded.1/"
payload = {"ShutdownType":"Forced","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'])