2
0
mirror of https://opendev.org/x/pyghmi synced 2025-04-15 09:39:33 +00:00

Provide get_description for physical description

This function will enable GUI providers to have at least some
generic information.

Change-Id: Ic149ee23698c1c7c870b54b03355b8b8d87bd5f2
This commit is contained in:
Jarrod Johnson 2018-08-22 16:26:39 -04:00
parent 130de5483f
commit cf1016bf6a
4 changed files with 30 additions and 0 deletions

View File

@ -417,6 +417,16 @@ class Command(object):
rsp['data'] = buffer(rsp['data'])
return rsp
def get_description(self):
"""Get physical attributes for the system, e.g. for GUI use
:returns: dict -- dict containing attributes, 'height' is for
how many U tall, 'slot' for what slot in a blade enclosure
or 0 if not blade, for example.
"""
self.oem_init()
return self._oem.get_description()
def raw_command(self, netfn, command, bridge_request=(), data=(),
delay_xmit=None, retry=True, timeout=None):
"""Send raw ipmi command to BMC

View File

@ -32,6 +32,16 @@ class OEMHandler(object):
def get_video_launchdata(self):
return {}
def get_description(self):
"""Get a description of descriptive attributes of a node.
Height describes, in U how tall the system is, and slot is 0 if
not a blade type server, and slot if it is.
:return: dictionary with 'height' and 'slot' members
"""
return {}
def process_event(self, event, ipmicmd, seldata):
"""Modify an event according with OEM understanding.

View File

@ -914,6 +914,11 @@ class OEMHandler(generic.OEMHandler):
progress=progress,
bank=bank)
def get_description(self):
if self.has_xcc:
return self.immhandler.get_description()
return super(OEMHandler, self).get_description()
def get_system_configuration(self, hideadvanced):
if self.has_imm or self.has_xcc:
return self.immhandler.get_system_configuration(hideadvanced)

View File

@ -679,6 +679,11 @@ class XCCClient(IMMClient):
super(XCCClient, self).__init__(ipmicmd)
self.adp_referer = None
def get_description(self):
dsc = self.wc.grab_json_response('/DeviceDescription.json')
dsc = dsc[0]
return {'height': int(dsc['u-height']), 'slot': int(dsc['slot'])}
def get_webclient(self, login=True):
cv = self.ipmicmd.certverify
wc = webclient.SecureHTTPConnection(self.imm, 443, verifycallback=cv)