From c48f23979261fd5a7291249c591a84c8cb6999ab Mon Sep 17 00:00:00 2001 From: vmisson Date: Thu, 24 Sep 2015 16:00:50 +0200 Subject: [PATCH] Create new function: get_serialnumber. Tested with Simulator (v1) + Proliant v0.9.5 + Proliant v1.0 --- examples/simple-proliant.py | 2 ++ redfish/types.py | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/examples/simple-proliant.py b/examples/simple-proliant.py index 9645b34..ca481c3 100644 --- a/examples/simple-proliant.py +++ b/examples/simple-proliant.py @@ -42,4 +42,6 @@ print ("Redfish API version : %s \n" % remote_mgmt.get_api_version()) 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_serialnumber())) + remote_mgmt.logout() diff --git a/redfish/types.py b/redfish/types.py index d462731..80185dd 100644 --- a/redfish/types.py +++ b/redfish/types.py @@ -186,6 +186,15 @@ class Systems(Base): # Hopefully this kind of discrepencies will be fixed with Redfish 1.0 (August) return self.data.BiosVersion + def get_serialnumber(self): + try: + # Returned by proliant + return self.data.SerialNumber + except: + # Returned by mockup. + # Hopefully this kind of discrepencies will be fixed with Redfish 1.0 (August) + return "" + class SystemsCollection(BaseCollection): """Class to manage redfish ManagersCollection data."""