Esempio n. 1
0
def main(device):
    try:
        sd = SCSIDevice(device)
        s = SCSI(sd)
        s.testunitready()
    except Exception as e:
        print(e)
    else:
        print('ReportPriority')
        print('==========================================\n')
        try:
            r = s.reportpriority().result
            for k, v in r.iteritems():
                print('%s - %s' % (k, v))
        except Exception as e:
            print(e)
Esempio n. 2
0
def main(device):
    try:
        sd = SCSIDevice(device)
        s = SCSI(sd)
        s.testunitready()
    except Exception as e:
        print (e)
    else:
        print ('ReportPriority')
        print ('==========================================\n')
        try:
            r = s.reportpriority().result
            for k, v in r.iteritems():
                print('%s - %s' % (k, v))
        except Exception as e:
                print (e)
def main():
    dev = MockReportPriority()
    dev.opcodes = spc
    s = SCSI(dev)
    s.device.opcodes = spc
    r = s.reportpriority(priority=0x00, alloclen=1112527)
    cdb = r.cdb
    assert cdb[0] == s.device.opcodes.SPC_OPCODE_A3.value
    assert cdb[1] == s.device.opcodes.SPC_OPCODE_A3.serviceaction.REPORT_PRIORITY
    assert cdb[2] == 0
    assert scsi_ba_to_int(cdb[6:10]) == 1112527
    assert cdb[10:12] == bytearray(2)
    cdb = r.unmarshall_cdb(cdb)
    assert cdb['opcode'] == s.device.opcodes.SPC_OPCODE_A3.value
    assert cdb['service_action'] == s.device.opcodes.SPC_OPCODE_A3.serviceaction.REPORT_PRIORITY
    assert cdb['priority_reported'] == 0
    assert cdb['alloc_len'] == 1112527

    d = ReportPriority.unmarshall_cdb(ReportPriority.marshall_cdb(cdb))
    assert d == cdb
Esempio n. 4
0
def main():
    dev = MockReportPriority()
    dev.opcodes = spc
    s = SCSI(dev)
    s.device.opcodes = spc
    r = s.reportpriority(priority=0x00, alloclen=1112527)
    cdb = r.cdb
    assert cdb[0] == s.device.opcodes.SPC_OPCODE_A3.value
    assert cdb[
        1] == s.device.opcodes.SPC_OPCODE_A3.serviceaction.REPORT_PRIORITY
    assert cdb[2] == 0
    assert scsi_ba_to_int(cdb[6:10]) == 1112527
    assert cdb[10:12] == bytearray(2)
    cdb = r.unmarshall_cdb(cdb)
    assert cdb['opcode'] == s.device.opcodes.SPC_OPCODE_A3.value
    assert cdb[
        'service_action'] == s.device.opcodes.SPC_OPCODE_A3.serviceaction.REPORT_PRIORITY
    assert cdb['priority_reported'] == 0
    assert cdb['alloc_len'] == 1112527

    d = ReportPriority.unmarshall_cdb(ReportPriority.marshall_cdb(cdb))
    assert d == cdb