forked from DMTF/python-redfish-library
-
Notifications
You must be signed in to change notification settings - Fork 92
Get encryption settings
Jack Garcia edited this page May 25, 2017
·
1 revision
If not created already, create an instance of Rest or Redfish Object using the RestObject or RedfishObject class respectively. The class constructor takes iLO hostname/ ip address, iLO login username and password as arguments. The class also initializes a login session, gets systems resources and message registries.
Rest Object creation:
REST_OBJ = RestObject(iLO_host, login_account, login_password)
Redfish Object creation:
REDFISH_OBJ = RedfishObject(iLO_host, login_account, login_password)
The method ex43_get_EncryptionSettings takes an instance of rest object ( or redfish object if using Redfish API ) as argument.
ex44_get_EncryptionSettings(restobj):
Find and get the system resource for HpSmartStorageArrayController.
instances = restobj.search_for_type("HpSmartStorageArrayController.")
Place the list of Encryption settings into a list.
types = ["Name","Model","SerialNumber","EncryptionBootPasswordSet",\
"EncryptionCryptoOfficerPasswordSet",\
"EncryptionLocalKeyCacheEnabled","EncryptionMixedVolumesEnabled",\
"EncryptionPhysicalDriveCount","EncryptionRecoveryParamsSet",\
"EncryptionStandaloneModeEnabled","EncryptionUserPasswordSet"]
Send HTTP GET request to the system URI(s).
for instance in instances:
response = restobj.rest_get(instance["href"])
For each system print encryption settings from the response body.
for item in types:
sys.stdout.write("\tID: " +
str(response.dict["@odata.id"]) + "\n")
if item in response.dict:
sys.stdout.write("\t" + item +
str(response.dict[item]) + "\n")
else:
sys.stderr.write("\t" + item + "is not " \
"available on HpSmartStorageArrayController resource\n")