def test_encode_bridged_message(): payload = array('B', b'\xaa\xbb') t = Target(0) t.set_routing([(0x81, 0x20, 7), (0x20, 0x72, None)]) header = IpmbHeaderReq() header.netfn = 6 header.rs_lun = 0 header.rq_seq = 0x11 header.rq_lun = 0 header.cmd_id = 0xaa data = encode_bridged_message(t.routing, header, payload, seq=0x22) eq_( data, b'\x20\x18\xc8\x81\x88\x34\x47\x72\x18\x76\x20\x44\xaa\xaa\xbb\x8d\x7c' )
def test_target_set_routing_from_string(): target = Target() target.set_routing('[(0x11, 0x12, 0x13)]') eq_(len(target.routing), 1) eq_(target.routing[0].rq_sa, 0x11) eq_(target.routing[0].rs_sa, 0x12) eq_(target.routing[0].channel, 0x13) target.set_routing('[(0x11, 0x12, 0x13), (0x21, 0x22, 0x23)]') eq_(len(target.routing), 2) eq_(target.routing[0].rq_sa, 0x11) eq_(target.routing[0].rs_sa, 0x12) eq_(target.routing[0].channel, 0x13) eq_(target.routing[1].rq_sa, 0x21) eq_(target.routing[1].rs_sa, 0x22) eq_(target.routing[1].channel, 0x23)