2
0
mirror of https://opendev.org/x/pyghmi synced 2025-09-19 16:28:08 +00:00

Hook redfish sys config to TSM IPMI OEM

Use redfish to do system config under ipmi plugin
when communicating with a TSM

Change-Id: I6f0ce7f8abe664f4ebe0d49e5162554075523b86
This commit is contained in:
Jarrod Johnson
2019-09-23 09:25:54 -04:00
parent 6d7231ff41
commit 33aee1ecdb
2 changed files with 14 additions and 2 deletions

View File

@@ -38,6 +38,7 @@ from pyghmi.ipmi.oem.lenovo import psu
from pyghmi.ipmi.oem.lenovo import raid_controller
from pyghmi.ipmi.oem.lenovo import raid_drive
from pyghmi.redfish.oem.lenovo import tsma
import pyghmi.redfish.command as redfishcmd
import pyghmi.util.webclient as wc
@@ -161,10 +162,11 @@ class OEMHandler(generic.OEMHandler):
conn = wc.SecureHTTPConnection(ipmicmd.bmc, 443,
verifycallback=self.ipmicmd.certverify)
#sysinfo, sysurl, webclient, cache=None):
self.tsmahandler = tsma.TsmHandler(None, None, conn)
self.tsmahandler = tsma.TsmHandler(None, None, conn, fish=redfishcmd)
self.tsmahandler.set_credentials(
ipmicmd.ipmi_session.userid.decode('utf-8'),
ipmicmd.ipmi_session.password.decode('utf-8'))
self.tsmahandler.init_redfish()
@property
def _megarac_eth_index(self):
@@ -976,6 +978,8 @@ class OEMHandler(generic.OEMHandler):
def get_system_configuration(self, hideadvanced):
if self.has_imm or self.has_xcc:
return self.immhandler.get_system_configuration(hideadvanced)
if self.has_tsma:
return self.tsmahandler.get_uefi_configuration(hideadvanced)
return super(OEMHandler, self).get_system_configuration(hideadvanced)
def set_system_configuration(self, changeset):

View File

@@ -67,7 +67,7 @@ def read_hpm(filename):
class TsmHandler(generic.OEMHandler):
def __init__(self, sysinfo, sysurl, webclient, cache=None):
def __init__(self, sysinfo, sysurl, webclient, cache=None, fish=None):
if cache is None:
cache = {}
self._wc = None
@@ -75,10 +75,18 @@ class TsmHandler(generic.OEMHandler):
self.password = None
self._wc = None
self.csrftok = None
self.fish = fish
super(TsmHandler, self).__init__(sysinfo, sysurl, webclient, cache)
self.tsm = webclient.thehost
self._certverify = webclient._certverify
def get_uefi_configuration(self, hideadvanced=True):
return self.fishclient.get_system_configuration(hideadvanced)
def init_redfish(self):
self.fishclient = self.fish.Command(self.tsm, self.username, self.password,
verifycallback=self._certverify)
def get_firmware_inventory(self, components, raisebypass=True):
wc = self.wc
fwinf = wc.grab_json_response('/api/DeviceVersion')