2
0
mirror of https://opendev.org/x/pyghmi synced 2025-12-10 10:59:57 +00:00

Change API for extended BMC configuration

Keep extended configuration utterly separate to ease confusion
by calling code as to what belongs to which category.

Change-Id: Ic97ad79fa796f63b8825db48059450a4c78f75c9
This commit is contained in:
Jarrod Johnson
2020-01-29 10:51:45 -05:00
parent 27e8e36d23
commit 3799dd3f9b
4 changed files with 31 additions and 16 deletions

View File

@@ -776,9 +776,13 @@ class Command(object):
else:
raise Exception("Unrecognized data format " + repr(fetchdata))
def get_bmc_configuration(self, extended=False):
def get_extended_bmc_configuration(self):
self.oem_init()
return self._oem.get_bmc_configuration(extended)
return self._oem.get_extended_bmc_configuration()
def get_bmc_configuration(self):
self.oem_init()
return self._oem.get_bmc_configuration()
def set_bmc_configuration(self, changeset):
self.oem_init()

View File

@@ -331,15 +331,19 @@ class OEMHandler(object):
"""
return False
def get_extended_bmc_configuration(self):
"""Get extended bmc configuration
In the case of potentially redundant/slow
attributes, retrieve unpopular options that may be
redundant or confusing and slow.
"""
return {}
def get_bmc_configuration(self, extended):
"""Get additional BMC parameters
This allows a bmc to return arbitrary key-value pairs.
:param extended: In the case of potentially redundant/slow
attributes, this allows the caller to opt
into retrieving unpopular options that may be
redundant or confusing.
"""
return {}

View File

@@ -969,12 +969,17 @@ class OEMHandler(generic.OEMHandler):
return {'height': self._fpc_variant, 'slot': 0}
return super(OEMHandler, self).get_description()
def get_bmc_configuration(self, extended):
def get_extended_bmc_configuration(self):
if self.has_xcc:
return self.immhandler.get_bmc_configuration(extended)
return self.immhandler.get_extended_bmc_configuration()
return super(OEMHandler, self).get_extended_bmc_configuration()
def get_bmc_configuration(self):
if self.has_xcc:
return self.immhandler.get_bmc_configuration()
if self.is_fpc:
return self.smmhandler.get_bmc_configuration()
return super(OEMHandler, self).get_bmc_configuration(extended)
return super(OEMHandler, self).get_bmc_configuration()
def set_bmc_configuration(self, changeset):
if self.has_xcc:

View File

@@ -842,7 +842,14 @@ class XCCClient(IMMClient):
return {}
return {'height': int(dsc['u-height']), 'slot': int(dsc['slot'])}
def get_bmc_configuration(self, extended):
def get_extended_bmc_configuration(self):
immsettings = self.get_system_configuration(fetchimm=True)
for setting in immsettings:
if not setting.startswith('IMM.'):
del immsettings[setting]
return immsettings
def get_bmc_configuration(self):
settings = {}
passrules = self.wc.grab_json_response('/api/dataset/imm_users_global')
passrules = passrules.get('items', [{}])[0]
@@ -876,11 +883,6 @@ class XCCClient(IMMClient):
settings['smm']['value'] = 'Enable'
else:
settings['smm']['value'] = None
if extended:
immsettings = self.get_system_configuration(fetchimm=True)
for setting in immsettings:
if setting.startswith('IMM.'):
settings[setting] = immsettings[setting]
return settings
rulemap = {