mirror of
https://opendev.org/x/pyghmi
synced 2025-01-14 19:57:47 +00:00
Add UEFI/BIOS configuration to pyghmi redfish
Change-Id: Ie1a697eaf136f75007838d85bf877a262318fd5b
This commit is contained in:
parent
bd12cd646d
commit
c0d8e2a12c
@ -67,6 +67,8 @@ class Command(object):
|
||||
self.wc = webclient.SecureHTTPConnection(
|
||||
bmc, 443, verifycallback=verifycallback)
|
||||
self._varbmcurl = bmcurl
|
||||
self._varbiosurl = None
|
||||
self._varsetbiosurl = None
|
||||
self._varchassisurl = chassisurl
|
||||
self._varresetbmcurl = None
|
||||
self._storedsysinfvintage = 0
|
||||
@ -209,6 +211,28 @@ class Command(object):
|
||||
self._do_web_request(self.sysurl, payload, method='PATCH')
|
||||
return {'bootdev': reqbootdev}
|
||||
|
||||
@property
|
||||
def _biosurl(self):
|
||||
if not self._varbiosurl:
|
||||
self._varbmcurl = self.sysinfo.get('Bios', {}).get('@odata.id',
|
||||
None)
|
||||
if self._varbmcurl is None:
|
||||
raise exc.UnsupportedFunctionality(
|
||||
'Bios management not detected on this platform')
|
||||
return self._varbmcurl
|
||||
|
||||
@property
|
||||
def _setbiosurl(self):
|
||||
if self._varsetbiosurl is None:
|
||||
biosinfo = self._do_web_request(self._biosurl)
|
||||
self._varsetbiosurl = biosinfo.get(
|
||||
'@Redfish.Settings', {}).get('SettingsObject', {}).get(
|
||||
'@odata.id', None)
|
||||
if self._varsetbiosurl is None:
|
||||
raise exc.UnsupportedFunctionality('Ability to set BIOS settings '
|
||||
'not detected on this platform')
|
||||
return self._varsetbiosurl
|
||||
|
||||
@property
|
||||
def _bmcurl(self):
|
||||
if not self._varbmcurl:
|
||||
@ -284,6 +308,17 @@ class Command(object):
|
||||
summary['badcomponents'].append(funinfo['Name'])
|
||||
return summary
|
||||
|
||||
def get_system_configuration(self, hideadvanced=True):
|
||||
biosinfo = self._do_web_request(self._biosurl)
|
||||
currsettings = {}
|
||||
for setting in biosinfo.get('Attributes', {}):
|
||||
currsettings[setting] = {'value': biosinfo['Attributes'][setting]}
|
||||
return currsettings
|
||||
|
||||
def set_system_configuration(self, changeset):
|
||||
redfishsettings = {'Attributes': changeset}
|
||||
self._do_web_request(self._setbiosurl, redfishsettings, 'PATCH')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import os
|
||||
|
Loading…
x
Reference in New Issue
Block a user