当前位置: 首页>>代码示例>>Python>>正文


Python msgs.encode_message函数代码示例

本文整理汇总了Python中pyipmi.msgs.encode_message函数的典型用法代码示例。如果您正苦于以下问题:Python encode_message函数的具体用法?Python encode_message怎么用?Python encode_message使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了encode_message函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_readfrudatareq_encode_valid_req

def test_readfrudatareq_encode_valid_req():
    m = pyipmi.msgs.fru.ReadFruDataReq()
    m.fru_id = 1
    m.offset = 0x302
    m.count = 4
    data = encode_message(m)
    eq_(data, '\x01\x02\x03\x04')
开发者ID:Teslafly,项目名称:python-ipmi,代码行数:7,代码来源:test_fru.py

示例2: test_writefrudatareq_encode_valid_req_wo_data

def test_writefrudatareq_encode_valid_req_wo_data():
    m = pyipmi.msgs.fru.WriteFruDataReq()
    m.fru_id = 1
    m.offset = 0x302
    m.data = array('B')
    data = encode_message(m)
    eq_(data, '\x01\x02\x03')
开发者ID:Teslafly,项目名称:python-ipmi,代码行数:7,代码来源:test_fru.py

示例3: test_readfrudatarsp_encode_valid_rsp

def test_readfrudatarsp_encode_valid_rsp():
    m = pyipmi.msgs.fru.ReadFruDataRsp()
    m.completion_code = 0
    m.count = 5
    m.data = array('B', b'\x01\x02\x03\x04\x05')
    data = encode_message(m)
    eq_(data, '\x00\x05\x01\x02\x03\x04\x05')
开发者ID:Teslafly,项目名称:python-ipmi,代码行数:7,代码来源:test_fru.py

示例4: test_setsensorthresholds_encode_req_set_unc

def test_setsensorthresholds_encode_req_set_unc():
    m = pyipmi.msgs.sensor.SetSensorThresholdsReq()
    m.sensor_number = 0x55
    m.set_mask.unc = 1
    m.threshold.unc = 0xaa
    data = encode_message(m)
    eq_(data, '\x55\x08\x00\x00\x00\xaa\x00\x00')
开发者ID:Teslafly,项目名称:python-ipmi,代码行数:7,代码来源:test_sensor.py

示例5: test_set_deactivation_lock_req

 def test_set_deactivation_lock_req(self):
     m = pyipmi.msgs.picmg.SetFruActivationPolicyReq()
     m.fru_id = 1
     m.mask.deactivation_locked = 1
     m.set.deactivation_locked = 1
     data = encode_message(m)
     self.assertEqual(data, '\x00\x01\x02\x02')
开发者ID:erik-smit,项目名称:python-ipmi,代码行数:7,代码来源:picmg.py

示例6: 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
开发者ID:sadig,项目名称:python-ipmi,代码行数:28,代码来源:aardvark.py

示例7: test_encode_req_set_ucr

 def test_encode_req_set_ucr(self):
     m = pyipmi.msgs.sensor.SetSensorThresholdsReq()
     m.sensor_number = 0x55
     m.set_mask.ucr = 1
     m.threshold.ucr = 0xaa
     data = encode_message(m)
     self.assertEqual(data, '\x55\x10\x00\x00\x00\x00\xaa\x00')
开发者ID:jjjesus,项目名称:python-ipmi,代码行数:7,代码来源:test_sensor.py

示例8: test_chassiscontrol_encode_valid_req

def test_chassiscontrol_encode_valid_req():
    m = pyipmi.msgs.chassis.ChassisControlReq()
    m.control.option = 1
    data = encode_message(m)
    eq_(m.__netfn__, 0)
    eq_(m.__cmdid__, 2)
    eq_(data, '\x01')
开发者ID:hthiery,项目名称:python-ipmi,代码行数:7,代码来源:test_chassis.py

示例9: test_setsensorhysteresis_encode_req

def test_setsensorhysteresis_encode_req():
    m = pyipmi.msgs.sensor.SetSensorHysteresisReq()
    m.sensor_number = 0xab
    m.positive_going_hysteresis = 0xaa
    m.negative_going_hysteresis = 0xbb
    data = encode_message(m)
    eq_(data, '\xab\xff\xaa\xbb')
开发者ID:Teslafly,项目名称:python-ipmi,代码行数:7,代码来源:test_sensor.py

示例10: test_getselentry_encode_valid_rsp

def test_getselentry_encode_valid_rsp():
    m = pyipmi.msgs.sel.GetSelEntryRsp()
    m.completion_code = 0
    m.next_record_id = 0x0102
    m.record_data = array('B', b'\x01\x02\x03\x04')
    data = encode_message(m)
    eq_(data, b'\x00\x02\x01\x01\x02\x03\x04')
开发者ID:kontron,项目名称:python-ipmi,代码行数:7,代码来源:test_sel.py

示例11: test_encode_valid_rsp

 def test_encode_valid_rsp(self):
     m = pyipmi.msgs.fru.ReadFruDataRsp()
     m.completion_code = 0
     m.count = 5
     m.data = array('B', '\x01\x02\x03\x04\x05')
     data = encode_message(m)
     self.assertEqual(data, '\x00\x05\x01\x02\x03\x04\x05')
开发者ID:erik-smit,项目名称:python-ipmi,代码行数:7,代码来源:fru.py

示例12: test_clear_activation_lock_req

 def test_clear_activation_lock_req(self):
     m = pyipmi.msgs.picmg.SetFruActivationPolicyReq()
     m.fru_id = 1
     m.mask.activation_locked = 1
     m.set.activation_locked = 0
     data = encode_message(m)
     self.assertEqual(data, "\x00\x01\x01\x00")
开发者ID:jjjesus,项目名称:python-ipmi,代码行数:7,代码来源:test_picmg.py

示例13: test_encode_valid_req_wo_data

 def test_encode_valid_req_wo_data(self):
     m = pyipmi.msgs.fru.WriteFruDataReq()
     m.fru_id = 1
     m.offset = 0x302
     m.data = array('B')
     data = encode_message(m)
     self.assertEqual(data, '\x01\x02\x03')
开发者ID:erik-smit,项目名称:python-ipmi,代码行数:7,代码来源:fru.py

示例14: test_encode_valid_req

 def test_encode_valid_req(self):
     m = pyipmi.msgs.fru.ReadFruDataReq()
     m.fru_id = 1
     m.offset = 0x302
     m.count = 4
     data = encode_message(m)
     self.assertEqual(data, '\x01\x02\x03\x04')
开发者ID:erik-smit,项目名称:python-ipmi,代码行数:7,代码来源:fru.py

示例15: test_clear_deactivation_lock_req

def test_clear_deactivation_lock_req():
    m = pyipmi.msgs.picmg.SetFruActivationPolicyReq()
    m.fru_id = 1
    m.mask.deactivation_locked = 1
    m.set.deactivation_locked = 0
    data = encode_message(m)
    eq_(data, b'\x00\x01\x02\x00')
开发者ID:kontron,项目名称:python-ipmi,代码行数:7,代码来源:test_picmg.py


注:本文中的pyipmi.msgs.encode_message函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。