本文整理汇总了Python中pyipmi.msgs.decode_message函数的典型用法代码示例。如果您正苦于以下问题:Python decode_message函数的具体用法?Python decode_message怎么用?Python decode_message使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了decode_message函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_shelf_address_info_rsp
def test_get_shelf_address_info_rsp(self):
m = pyipmi.msgs.picmg.GetShelfAddressInfoRsp()
decode_message(m, "\x00\x00\x01\x02")
self.assertEqual(m.completion_code, 0x00)
self.assertEqual(m.picmg_identifier, 0x00)
self.assertEqual(m.shelf_address[0], 0x01)
self.assertEqual(m.shelf_address[1], 0x02)
示例2: send_and_receive
def send_and_receive(self, msg):
"""Sends an IPMI request message and waits for its response.
`msg` is a IPMI Message containing both the request and response.
"""
log().debug('IPMI Request [%s]', msg)
retries = 0
while retries < self.max_retries:
try:
rx_data = self._send_and_receive_raw(msg.target, msg.lun,
msg.netfn, chr(msg.cmdid) + encode_message(msg))
break
except TimeoutError:
pass
retries += 1
else:
raise TimeoutError()
msg = create_message(msg.cmdid, msg.netfn + 1)
decode_message(msg, rx_data[5:-1])
log().debug('IPMI Response [%s])', msg)
return msg
示例3: test_getsensoreventenable_decode_byte34_rsp
def test_getsensoreventenable_decode_byte34_rsp():
m = pyipmi.msgs.sensor.GetSensorEventEnableRsp()
decode_message(m, '\x00\xc0\xaa\xbb')
eq_(m.completion_code, 0x00)
eq_(m.enabled.event_message, 1)
eq_(m.byte3, 0xaa)
eq_(m.byte4, 0xbb)
示例4: test_decode_byte34_rsp
def test_decode_byte34_rsp(self):
m = pyipmi.msgs.sensor.GetSensorEventEnableRsp()
decode_message(m, '\x00\xc0\xaa\xbb')
self.assertEqual(m.completion_code, 0x00)
self.assertEqual(m.enabled.event_message, 1)
self.assertEqual(m.byte3, 0xaa)
self.assertEqual(m.byte4, 0xbb)
示例5: test_deviceid_object_with_aux
def test_deviceid_object_with_aux():
m = pyipmi.msgs.bmc.GetDeviceIdRsp()
decode_message(m,
'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x03\x04')
d = DeviceId(m)
eq_(d.aux, [1,2,3,4])
示例6: test_get_shelf_address_info_rsp
def test_get_shelf_address_info_rsp():
m = pyipmi.msgs.picmg.GetShelfAddressInfoRsp()
decode_message(m, b'\x00\x00\x01\x02')
eq_(m.completion_code, 0x00)
eq_(m.picmg_identifier, 0x00)
eq_(m.shelf_address[0], 0x01)
eq_(m.shelf_address[1], 0x02)
示例7: test_getmessage_decode_with_data_rsp
def test_getmessage_decode_with_data_rsp():
m = pyipmi.msgs.device_messaging.GetMessageRsp()
decode_message(m, b'\x00\x21\xaa\xff\xff\xee')
eq_(m.completion_code, 0x00)
eq_(m.channel.number, 1)
eq_(m.channel.privilege_level, 2)
eq_(m.data, array('B', [0xaa, 0xff, 0xff, 0xee]))
示例8: test_getmessage_decode_with_data_rsp
def test_getmessage_decode_with_data_rsp():
m = pyipmi.msgs.bmc.GetMessageRsp()
decode_message(m, '\x00\x21\xaa\xff\xff\xee')
eq_(m.completion_code, 0x00)
eq_(m.channel_number.channel_number, 1)
eq_(m.channel_number.privilege_level, 2)
eq_(m.data, array('B', b'\xaa\xff\xff\xee'))
示例9: test_readeventmessagebuffer_decode_rsp
def test_readeventmessagebuffer_decode_rsp():
m = pyipmi.msgs.device_messaging.ReadEventMessageBufferRsp()
decode_message(m, b'\x00\x00\x01\x02\x03\x04\x05\x06\x07'
b'\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f')
eq_(m.completion_code, 0x00)
eq_(m.event_data, array('B', b'\x00\x01\x02\x03\x04'
b'\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f'))
示例10: test_decode_rsp
def test_decode_rsp(self):
m = pyipmi.msgs.bmc.ReadEventMessageBufferRsp()
decode_message(m, '\x00\x00\x01\x02\x03\x04\x05\x06\x07'\
'\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f')
self.assertEqual(m.completion_code, 0x00)
self.assertEqual(m.event_data, array('B', '\x00\x01\x02\x03\x04'\
'\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f'))
示例11: test_decode_with_data_rsp
def test_decode_with_data_rsp(self):
m = pyipmi.msgs.bmc.GetMessageRsp()
decode_message(m, '\x00\x21\xaa\xff\xff\xee')
self.assertEqual(m.completion_code, 0x00)
self.assertEqual(m.channel_number.channel_number, 1)
self.assertEqual(m.channel_number.privilege_level, 2)
self.assertEqual(m.data, array('B', '\xaa\xff\xff\xee'))
示例12: test_decode_rsp_local_control_state
def test_decode_rsp_local_control_state(self):
m = pyipmi.msgs.picmg.GetFruLedStateRsp()
decode_message(m, '\x00\x00\x01\xff\x00\x02')
self.assertEqual(m.completion_code, 0x00)
self.assertEqual(m.led_states.local_avail, 1)
self.assertEqual(m.local_function, 0xff)
self.assertEqual(m.local_on_duration, 0)
self.assertEqual(m.local_color, 2)
示例13: test_decode_rsp
def test_decode_rsp(self):
m = pyipmi.msgs.sdr.GetSdrRepositoryAllocationInfoRsp()
decode_message(m,'\x00\x11\x22\x33\x44\x55\x66\x77\x88\xaa')
eq_(m.completion_code, 0x00)
eq_(m.number_of_units, 0x2211)
eq_(m.unit_size, 0x4433)
eq_(m.free_units, 0x6655)
eq_(m.largest_free_block, 0x8877)
eq_(m.maximum_record_size, 0xaa)
示例14: test_decode_event_message_full_set_rsp
def test_decode_event_message_full_set_rsp(self):
m = pyipmi.msgs.bmc.GetMessageFlagsRsp()
decode_message(m, '\x00\x02')
self.assertEqual(m.completion_code, 0x00)
self.assertEqual(m.flag.oem_2, 0)
self.assertEqual(m.flag.oem_1, 0)
self.assertEqual(m.flag.oem_0, 0)
self.assertEqual(m.flag.watchdog_pretimeout_interrupt_occurred, 0)
self.assertEqual(m.flag.event_message_buffer_full, 1)
self.assertEqual(m.flag.receive_message_available, 0)
示例15: test_encode_rsp
def test_encode_rsp(self):
m = pyipmi.msgs.sensor.GetDeviceSdrInfoRsp()
decode_message(m, '\x00\x03\x05')
self.assertEqual(m.completion_code, 0x00)
self.assertEqual(m.number_of_sensors, 3)
self.assertEqual(m.flags.lun0_has_sensors, 1)
self.assertEqual(m.flags.lun1_has_sensors, 0)
self.assertEqual(m.flags.lun2_has_sensors, 1)
self.assertEqual(m.flags.lun3_has_sensors, 0)
self.assertEqual(m.flags.dynamic_population, 0)