Skip to content

Commit

Permalink
Merge 2ab3693 into 246c4e8
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilioPeJu committed Jun 12, 2024
2 parents 246c4e8 + 2ab3693 commit d5ff7b9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
13 changes: 13 additions & 0 deletions pyipmi/bmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ class Bmc(object):
def get_device_id(self):
return DeviceId(self.send_message_with_name('GetDeviceId'))

def get_device_guid(self):
return DeviceGuid(self.send_message_with_name('GetDeviceGuid'))

def cold_reset(self):
self.send_message_with_name('ColdReset')

Expand Down Expand Up @@ -121,6 +124,7 @@ def __str__(self):
string += ' ipmi: %s' % self.ipmi_version
string += ' manufacturer: %d' % self.manufacturer_id
string += ' product: %d' % self.product_id
string += ' functions: %s' % ','.join(self.supported_functions)
return string

def supports_function(self, name):
Expand Down Expand Up @@ -164,3 +168,12 @@ def _from_response(self, rsp):
self.aux = None
if rsp.auxiliary is not None:
self.aux = list(rsp.auxiliary)


class DeviceGuid(State):
def __str__(self):
return 'Device GUID: %02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-' \
'%02x%02x%02x%02x%02x%02x' % tuple(reversed(self.device_guid))

def _from_response(self, rsp):
self.device_guid = rsp.device_guid
9 changes: 6 additions & 3 deletions pyipmi/msgs/bmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,17 +174,20 @@ class GetAcpiPowerStateRsp(Message):


@register_message_class
class GetDeviceGuideReq(Message):
class GetDeviceGuidReq(Message):
__cmdid__ = constants.CMDID_GET_DEVICE_GUID
__netfn__ = constants.NETFN_APP
__not_implemented__ = True


@register_message_class
class GetDeviceGuideRsp(Message):
class GetDeviceGuidRsp(Message):
__cmdid__ = constants.CMDID_GET_DEVICE_GUID
__netfn__ = constants.NETFN_APP | 1
__not_implemented__ = True
__fields__ = (
CompletionCode(),
ByteArray('device_guid', 16),
)


@register_message_class
Expand Down
2 changes: 1 addition & 1 deletion pyipmi/msgs/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def create(self):
if self.default is not None:
return array('B', self.default)
else:
return array('B', self.length * '\x00')
return array('B', self.length * b'\x00')


class VariableByteArray(ByteArray):
Expand Down

0 comments on commit d5ff7b9

Please sign in to comment.