New function get_power() and generic function get_parameter(parameter_name) for class Systems

get_power(): return power state of the system
get_parameter(parameter_name): return parameter value based on the parameter_name
This commit is contained in:
vmisson 2015-09-25 00:47:03 +02:00 committed by Uggla
parent c48f239792
commit 4cae02c3c9
2 changed files with 16 additions and 2 deletions

View File

@ -41,7 +41,9 @@ print ("Redfish API version : %s \n" % remote_mgmt.get_api_version())
# remote_mgmt.Systems.systems_list[0] = remote_mgmt.Systems.managed_system
print("Bios version : {}\n".format(remote_mgmt.Systems.systems_list[0].get_bios_version()))
print("Serial Number : {}\n".format(remote_mgmt.Systems.systems_list[0].get_serial_number()))
print("Power State : {}\n".format(remote_mgmt.Systems.systems_list[0].get_power()))
print("Parameter 'Model' : {}\n".format(remote_mgmt.Systems.systems_list[0].get_parameter("Model")))
print("Serial Number : {}\n".format(remote_mgmt.Systems.systems_list[0].get_serialnumber()))
remote_mgmt.logout()

View File

@ -186,7 +186,7 @@ class Systems(Base):
# Hopefully this kind of discrepencies will be fixed with Redfish 1.0 (August)
return self.data.BiosVersion
def get_serialnumber(self):
def get_serial_number(self):
try:
# Returned by proliant
return self.data.SerialNumber
@ -194,6 +194,18 @@ class Systems(Base):
# Returned by mockup.
# Hopefully this kind of discrepencies will be fixed with Redfish 1.0 (August)
return ""
def get_power(self):
try:
return self.data.Power
except:
return ""
def get_parameter(self, parameter_name):
try:
return self.data[parameter_name]
except:
return "Parameter does not exist"
class SystemsCollection(BaseCollection):