New function set_parameter and set_parameter_json on Systems Class
- set_parameter(parameter_name, value): change parameter_name to value. Restart is required to apply the changes. - set_parameter_json(json): update System with the json. Restart is required to apply the changes. New tests were added to simple-proliat file to update boot value.
This commit is contained in:
parent
69122fa26d
commit
6bc483a465
@ -50,19 +50,23 @@ print("Get bios parameters : {}\n".format(remote_mgmt.Systems.systems_list[0].bi
|
||||
print("Get boot parameters : {}\n".format(remote_mgmt.Systems.systems_list[0].bios.boot.get_parameters()))
|
||||
|
||||
|
||||
print("Get bios parameter 'AdminPhone' : {}\n".format(remote_mgmt.Systems.systems_list[0].bios.get_parameter("AdminPhone")))
|
||||
print("Set bios parameter 'AdminPhone' to '' : {}\n".format(remote_mgmt.Systems.systems_list[0].bios.set_parameter("AdminPhone","")))
|
||||
#print("Get bios parameter 'AdminPhone' : {}\n".format(remote_mgmt.Systems.systems_list[0].bios.get_parameter("AdminPhone")))
|
||||
#print("Set bios parameter 'AdminPhone' to '' : {}\n".format(remote_mgmt.Systems.systems_list[0].bios.set_parameter("AdminPhone","")))
|
||||
|
||||
|
||||
#Boot server with script
|
||||
#remote_mgmt.Systems.systems_list[0].bios.set_parameter("PreBootNetwork","Auto")
|
||||
#remote_mgmt.Systems.systems_list[0].bios.set_parameter("Dhcpv4","Enabled")
|
||||
|
||||
#remote_mgmt.Systems.systems_list[0].bios.set_parameter("UefiShellStartup","Enabled")
|
||||
#remote_mgmt.Systems.systems_list[0].bios.set_parameter("UefiShellStartupLocation","NetworkLocation")
|
||||
#remote_mgmt.Systems.systems_list[0].bios.set_parameter("UefiShellStartupUrl","http://192.168.1.1/deploy/startup.nsh")
|
||||
remote_mgmt.Systems.systems_list[0].bios.set_parameter("PreBootNetwork", "Auto")
|
||||
remote_mgmt.Systems.systems_list[0].bios.set_parameter("UefiShellStartup", "Enabled")
|
||||
remote_mgmt.Systems.systems_list[0].bios.set_parameter("UefiShellStartupLocation", "NetworkLocation")
|
||||
remote_mgmt.Systems.systems_list[0].bios.set_parameter("UefiShellStartupUrl", "http://10.3.222.88/deploy/startup.nsh")
|
||||
|
||||
|
||||
remote_mgmt.Systems.systems_list[0].set_parameter_json('{"Boot": {"BootSourceOverrideTarget": "UefiShell"}}')
|
||||
remote_mgmt.Systems.systems_list[0].set_parameter_json('{"Boot": {"BootSourceOverrideEnabled" : "Once"}}')
|
||||
|
||||
#Reset of the system is required to apply the changes
|
||||
#remote_mgmt.Systems.systems_list[0].reset_system()
|
||||
|
||||
remote_mgmt.logout()
|
||||
|
@ -209,6 +209,29 @@ class Systems(Base):
|
||||
except:
|
||||
return "Parameter does not exist"
|
||||
|
||||
def set_parameter(self, parameter_name, value):
|
||||
# Craft the request
|
||||
action = dict()
|
||||
action[parameter_name] = value
|
||||
print(action)
|
||||
|
||||
# perform the POST action
|
||||
print self.api_url
|
||||
response = self.api_url.patch(verify=self.connection_parameters.verify_cert,
|
||||
headers={'x-auth-token': self.connection_parameters.auth_token},
|
||||
data=action
|
||||
)
|
||||
|
||||
def set_parameter_json(self, value):
|
||||
# perform the POST action
|
||||
print self.api_url.url()
|
||||
|
||||
response = requests.patch(self.api_url.url(),
|
||||
verify=self.connection_parameters.verify_cert,
|
||||
headers={'x-auth-token': self.connection_parameters.auth_token, 'Content-type': 'application/json'},
|
||||
data=value)
|
||||
print(response.reason)
|
||||
|
||||
class SystemsCollection(BaseCollection):
|
||||
"""Class to manage redfish ManagersCollection data."""
|
||||
def __init__(self, url, connection_parameters):
|
||||
|
Loading…
x
Reference in New Issue
Block a user