示例#1
0
def main():
    with MockSCSI(MockDevice(spc)) as s:
        # cdb for standard page request
        i = s.inquiry(alloclen=128)
        cdb = i.cdb
        assert cdb[0] == s.device.opcodes.INQUIRY.value
        assert cdb[1:3] == bytearray(2)
        assert scsi_ba_to_int(cdb[3:5]) == 128
        assert cdb[5] == 0
        cdb = i.unmarshall_cdb(cdb)
        assert cdb['opcode'] == s.device.opcodes.INQUIRY.value
        assert cdb['evpd'] == 0
        assert cdb['page_code'] == 0
        assert cdb['alloc_len'] == 128

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

        # supported vpd pages
        i = s.inquiry(evpd=1, page_code=0x88, alloclen=300)
        cdb = i.cdb
        assert cdb[0] == s.device.opcodes.INQUIRY.value
        assert cdb[1] == 0x01
        assert cdb[2] == 0x88
        assert scsi_ba_to_int(cdb[3:5]) == 300
        assert cdb[5] == 0
        cdb = i.unmarshall_cdb(cdb)
        assert cdb['opcode'] == s.device.opcodes.INQUIRY.value
        assert cdb['evpd'] == 1
        assert cdb['page_code'] == 0x88
        assert cdb['alloc_len'] == 300

        d = Inquiry.unmarshall_cdb(Inquiry.marshall_cdb(cdb))
        assert d == cdb
def main():

    with MockSCSI(MockDevice(smc)) as s:
        # cdb for SMC: ReadElementStatus
        r = s.readelementstatus(
            300,
            700,
            element_type=READELEMENTSTATUS.ELEMENT_TYPE.STORAGE,
            voltag=1,
            curdata=1,
            dvcid=1)
        cdb = r.cdb
        assert cdb[0] == s.device.opcodes.READ_ELEMENT_STATUS.value
        assert cdb[1] == 0x10 | READELEMENTSTATUS.ELEMENT_TYPE.STORAGE
        assert scsi_ba_to_int(cdb[2:4]) == 300
        assert scsi_ba_to_int(cdb[4:6]) == 700
        assert cdb[6] == 0x03
        assert scsi_ba_to_int(cdb[7:10]) == 16384
        cdb = r.unmarshall_cdb(cdb)
        assert cdb['opcode'] == s.device.opcodes.READ_ELEMENT_STATUS.value
        assert cdb['voltag'] == 1
        assert cdb['element_type'] == READELEMENTSTATUS.ELEMENT_TYPE.STORAGE
        assert cdb['starting_element_address'] == 300
        assert cdb['num_elements'] == 700
        assert cdb['curdata'] == 1
        assert cdb['dvcid'] == 1
        assert cdb['alloc_len'] == 16384

        d = ReadElementStatus.unmarshall_cdb(
            ReadElementStatus.marshall_cdb(cdb))
        assert d == cdb
def main():
    with MockSCSI(MockDevice(smc)) as s:
        r = s.initializeelementstatus()
        cdb = r.cdb
        assert cdb[0] == s.device.opcodes.INITIALIZE_ELEMENT_STATUS.value
        cdb = r.unmarshall_cdb(cdb)
        assert cdb['opcode'] == s.device.opcodes.INITIALIZE_ELEMENT_STATUS.value

        d = InitializeElementStatus.unmarshall_cdb(InitializeElementStatus.marshall_cdb(cdb))
        assert d == cdb
def main():

    with MockSCSI(MockDevice(sbc)) as s:
        r = s.readcapacity10()
        cdb = r.cdb
        assert cdb[0] == s.device.opcodes.READ_CAPACITY_10.value
        assert cdb[1:10] == bytearray(9)
        cdb = r.unmarshall_cdb(cdb)
        assert cdb['opcode'] == s.device.opcodes.READ_CAPACITY_10.value

        d = ReadCapacity10.unmarshall_cdb(ReadCapacity10.marshall_cdb(cdb))
        assert d == cdb
示例#5
0
def main():
    with MockSCSI(MockDevice(smc)) as s:
        m = s.preventallowmediumremoval(prevent=3)
        cdb = m.cdb
        assert cdb[0] == s.device.opcodes.PREVENT_ALLOW_MEDIUM_REMOVAL.value
        assert cdb[4] == 0x03
        cdb = m.unmarshall_cdb(cdb)
        assert cdb['opcode'] == s.device.opcodes.PREVENT_ALLOW_MEDIUM_REMOVAL.value
        assert cdb['prevent'] == 3

        d = PreventAllowMediumRemoval.unmarshall_cdb(PreventAllowMediumRemoval.marshall_cdb(cdb))
        assert d == cdb
示例#6
0
def mock_pynxos_device_xml(request):
    """Create a mock pynxos test device."""
    device = {
        "host": "nxos1.fake.com",
        "username": "******",
        "password": "******",
        "transport": "https",
        "api_format": "xml",
        "port": 8443,
        "timeout": 60,
        "verify": False,
    }
    conn = MockDevice(**device)
    return conn
示例#7
0
def main():
    with MockSCSI(MockDevice(smc)) as s:
        # cdb for SMC: ElementAddressAssignment
        m = s.modesense10(
            page_code=MODESENSE10.PAGE_CODE.ELEMENT_ADDRESS_ASSIGNMENT)
        cdb = m.cdb
        assert cdb[0] == s.device.opcodes.MODE_SENSE_10.value
        assert cdb[1] == 0
        assert cdb[2] == MODESENSE10.PAGE_CODE.ELEMENT_ADDRESS_ASSIGNMENT
        assert cdb[3] == 0
        assert cdb[4:6] == bytearray(2)
        assert scsi_ba_to_int(cdb[7:9]) == 96
        assert cdb[9] == 0
        cdb = m.unmarshall_cdb(cdb)
        assert cdb['opcode'] == s.device.opcodes.MODE_SENSE_10.value
        assert cdb['dbd'] == 0
        assert cdb['llbaa'] == 0
        assert cdb[
            'page_code'] == MODESENSE10.PAGE_CODE.ELEMENT_ADDRESS_ASSIGNMENT
        assert cdb['pc'] == 0
        assert cdb['sub_page_code'] == 0
        assert cdb['alloc_len'] == 96

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

        m = s.modesense10(page_code=0,
                          sub_page_code=3,
                          llbaa=1,
                          dbd=1,
                          pc=MODESENSE10.PC.DEFAULT,
                          alloclen=90)
        cdb = m.cdb
        assert cdb[0] == s.device.opcodes.MODE_SENSE_10.value
        assert cdb[1] == 0x18
        assert cdb[2] == MODESENSE10.PC.DEFAULT << 6
        assert cdb[3] == 3
        assert scsi_ba_to_int(cdb[7:9]) == 90
        cdb = m.unmarshall_cdb(cdb)
        assert cdb['opcode'] == s.device.opcodes.MODE_SENSE_10.value
        assert cdb['dbd'] == 1
        assert cdb['pc'] == MODESENSE10.PC.DEFAULT
        assert cdb['page_code'] == 0
        assert cdb['sub_page_code'] == 3
        assert cdb['alloc_len'] == 90
        assert cdb['llbaa'] == 1

        d = ModeSense10.unmarshall_cdb(ModeSense10.marshall_cdb(cdb))
        assert d == cdb
示例#8
0
def mock_pynxos_device_xml(request):
    """Create a mock pynxos test device."""
    response_status_code = getattr(request, "param", 200)
    device = {
        "host": "nxos1.fake.com",
        "username": "******",
        "password": "******",
        "transport": "https",
        "api_format": "xml",
        "port": 8443,
        "timeout": 60,
        "verify": False,
    }
    conn = MockDevice(response_status_code=response_status_code, **device)
    return conn
示例#9
0
def main():

    with MockSCSI(MockDevice(sbc)) as s:
        w = s.testunitready()
        cdb = w.cdb
        assert cdb[0] == s.device.opcodes.TEST_UNIT_READY.value
        assert cdb[1] == 0
        assert cdb[2] == 0
        assert cdb[3] == 0
        assert cdb[4] == 0
        assert cdb[5] == 0
        cdb = w.unmarshall_cdb(cdb)
        assert cdb['opcode'] == s.device.opcodes.TEST_UNIT_READY.value

        d = TestUnitReady.unmarshall_cdb(TestUnitReady.marshall_cdb(cdb))
        assert d == cdb
def main():

    with MockSCSI(MockDevice(sbc)) as s:
        s.blocksize = 512

        data = bytearray(27 * 512)

        w = s.write12(1024, 27, data)
        cdb = w.cdb
        assert cdb[0] == s.device.opcodes.WRITE_12.value
        assert cdb[1] == 0
        assert scsi_ba_to_int(cdb[2:6]) == 1024
        assert scsi_ba_to_int(cdb[6:10]) == 27
        assert cdb[10] == 0
        assert cdb[11] == 0
        cdb = w.unmarshall_cdb(cdb)
        assert cdb['opcode'] == s.device.opcodes.WRITE_12.value
        assert cdb['wrprotect'] == 0
        assert cdb['dpo'] == 0
        assert cdb['fua'] == 0
        assert cdb['lba'] == 1024
        assert cdb['group'] == 0
        assert cdb['tl'] == 27

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

        w = s.write12(65536, 27, data, wrprotect=2, dpo=1, fua=1, group=19)
        cdb = w.cdb
        assert cdb[0] == s.device.opcodes.WRITE_12.value
        assert cdb[1] == 0x58
        assert scsi_ba_to_int(cdb[2:6]) == 65536
        assert scsi_ba_to_int(cdb[6:10]) == 27
        assert cdb[10] == 0x13
        assert cdb[11] == 0
        cdb = w.unmarshall_cdb(cdb)
        assert cdb['opcode'] == s.device.opcodes.WRITE_12.value
        assert cdb['wrprotect'] == 2
        assert cdb['dpo'] == 1
        assert cdb['fua'] == 1
        assert cdb['lba'] == 65536
        assert cdb['group'] == 19
        assert cdb['tl'] == 27

        d = Write12.unmarshall_cdb(Write12.marshall_cdb(cdb))
        assert d == cdb
def main():
    with MockSCSI(MockDevice(spc)) as s:
        # cdb for SMC: ElementAddressAssignment
        m = s.modesense6(
            page_code=MODESENSE6.PAGE_CODE.ELEMENT_ADDRESS_ASSIGNMENT)
        cdb = m.cdb
        assert cdb[0] == s.device.opcodes.MODE_SENSE_6.value
        assert cdb[1] == 0
        assert cdb[2] == MODESENSE6.PAGE_CODE.ELEMENT_ADDRESS_ASSIGNMENT
        assert cdb[3] == 0
        assert cdb[4] == 96
        assert cdb[5] == 0
        cdb = m.unmarshall_cdb(cdb)
        assert cdb['opcode'] == s.device.opcodes.MODE_SENSE_6.value
        assert cdb['dbd'] == 0
        assert cdb['pc'] == 0
        assert cdb[
            'page_code'] == MODESENSE6.PAGE_CODE.ELEMENT_ADDRESS_ASSIGNMENT
        assert cdb['sub_page_code'] == 0
        assert cdb['alloc_len'] == 96

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

        m = s.modesense6(page_code=0,
                         sub_page_code=3,
                         dbd=1,
                         pc=MODESENSE6.PC.DEFAULT,
                         alloclen=90)
        cdb = m.cdb
        assert cdb[0] == s.device.opcodes.MODE_SENSE_6.value
        assert cdb[1] == 0x08
        assert cdb[2] == MODESENSE6.PC.DEFAULT << 6
        assert cdb[3] == 3
        assert cdb[4] == 90
        assert cdb[5] == 0
        cdb = m.unmarshall_cdb(cdb)
        assert cdb['opcode'] == s.device.opcodes.MODE_SENSE_6.value
        assert cdb['dbd'] == 1
        assert cdb['pc'] == MODESENSE6.PC.DEFAULT
        assert cdb['page_code'] == 0
        assert cdb['sub_page_code'] == 3
        assert cdb['alloc_len'] == 90

        d = ModeSense6.unmarshall_cdb(ModeSense6.marshall_cdb(cdb))
        assert d == cdb
示例#12
0
def main():

    with MockSCSI(MockDevice(sbc)) as s:
        s.blocksize = 512

        r = s.read12(1024, 27)
        cdb = r.cdb
        assert cdb[0] == s.device.opcodes.READ_12.value
        assert cdb[1] == 0
        assert scsi_ba_to_int(cdb[2:6]) == 1024
        assert scsi_ba_to_int(cdb[6:10]) == 27
        assert cdb[10] == 0
        assert cdb[11] == 0
        cdb = r.unmarshall_cdb(cdb)
        assert cdb['opcode'] == s.device.opcodes.READ_12.value
        assert cdb['rdprotect'] == 0
        assert cdb['dpo'] == 0
        assert cdb['fua'] == 0
        assert cdb['rarc'] == 0
        assert cdb['lba'] == 1024
        assert cdb['group'] == 0
        assert cdb['tl'] == 27

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

        r = s.read12(1024, 27, rdprotect=2, dpo=1, fua=1, rarc=1, group=19)
        cdb = r.cdb
        assert cdb[0] == s.device.opcodes.READ_12.value
        assert cdb[1] == 0x5c
        assert scsi_ba_to_int(cdb[2:6]) == 1024
        assert scsi_ba_to_int(cdb[6:10]) == 27
        assert cdb[10] == 0x13
        assert cdb[11] == 0
        cdb = r.unmarshall_cdb(cdb)
        assert cdb['opcode'] == s.device.opcodes.READ_12.value
        assert cdb['rdprotect'] == 2
        assert cdb['dpo'] == 1
        assert cdb['fua'] == 1
        assert cdb['rarc'] == 1
        assert cdb['lba'] == 1024
        assert cdb['group'] == 19
        assert cdb['tl'] == 27

        d = Read12.unmarshall_cdb(Read12.marshall_cdb(cdb))
        assert d == cdb
def main():

    with MockSCSI(MockDevice(sbc)) as s:
        r = s.readcapacity16(alloclen=37)
        cdb = r.cdb
        assert cdb[0] == s.device.opcodes.SBC_OPCODE_9E.value
        assert cdb[1] == s.device.opcodes.SBC_OPCODE_9E.serviceaction.READ_CAPACITY_16
        assert cdb[2:10] == bytearray(8)
        assert scsi_ba_to_int(cdb[10:14]) == 37
        assert cdb[14:16] == bytearray(2)
        cdb = r.unmarshall_cdb(cdb)
        assert cdb['opcode'] == s.device.opcodes.SBC_OPCODE_9E.value
        assert cdb['service_action'] == s.device.opcodes.SBC_OPCODE_9E.serviceaction.READ_CAPACITY_16
        assert cdb['alloc_len'] == 37

        d = ReadCapacity16.unmarshall_cdb(ReadCapacity16.marshall_cdb(cdb))
        assert d == cdb
def main():

    with MockSCSI(MockDevice(spc)) as s:
        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
def main():
    with MockSCSI(MockDevice(smc)) as s:
        m = s.positiontoelement(15, 32, invert=1)
        cdb = m.cdb
        assert cdb[0] == s.device.opcodes.POSITION_TO_ELEMENT.value
        assert cdb[1] == 0
        assert scsi_ba_to_int(cdb[2:4]) == 15
        assert scsi_ba_to_int(cdb[4:6]) == 32
        assert cdb[8] == 0x01
        cdb = m.unmarshall_cdb(cdb)
        assert cdb['opcode'] == s.device.opcodes.POSITION_TO_ELEMENT.value
        assert cdb['medium_transport_address'] == 15
        assert cdb['destination_address'] == 32
        assert cdb['invert'] == 1

        d = PositionToElement.unmarshall_cdb(
            PositionToElement.marshall_cdb(cdb))
        assert d == cdb
def main():
    with MockSCSI(MockDevice(sbc)) as s:
        r = s.getlbastatus(19938722, alloclen=1112527)
        cdb = r.cdb
        assert cdb[0] == s.device.opcodes.SBC_OPCODE_9E.value
        assert cdb[
            1] == s.device.opcodes.SBC_OPCODE_9E.serviceaction.GET_LBA_STATUS
        assert scsi_ba_to_int(cdb[2:10]) == 19938722
        assert scsi_ba_to_int(cdb[10:14]) == 1112527
        assert cdb[14:16] == bytearray(2)
        cdb = r.unmarshall_cdb(cdb)
        assert cdb['opcode'] == s.device.opcodes.SBC_OPCODE_9E.value
        assert cdb[
            'service_action'] == s.device.opcodes.SBC_OPCODE_9E.serviceaction.GET_LBA_STATUS
        assert cdb['lba'] == 19938722
        assert cdb['alloc_len'] == 1112527

        d = GetLBAStatus.unmarshall_cdb(GetLBAStatus.marshall_cdb(cdb))
        assert d == cdb
def main():
    with MockSCSI(MockDevice(smc)) as s:
        m = s.opencloseimportexportelement(
            32, s.device.opcodes.OPEN_CLOSE_IMPORT_EXPORT_ELEMENT.
            serviceaction.CLOSE_IMPORTEXPORT_ELEMENT)
        cdb = m.cdb
        assert cdb[
            0] == s.device.opcodes.OPEN_CLOSE_IMPORT_EXPORT_ELEMENT.value
        assert scsi_ba_to_int(cdb[2:4]) == 32
        assert cdb[4] == 0x01
        cdb = m.unmarshall_cdb(cdb)
        assert cdb[
            'opcode'] == s.device.opcodes.OPEN_CLOSE_IMPORT_EXPORT_ELEMENT.value
        assert cdb['element_address'] == 32
        assert cdb[
            'action_code'] == s.device.opcodes.OPEN_CLOSE_IMPORT_EXPORT_ELEMENT.serviceaction.CLOSE_IMPORTEXPORT_ELEMENT

        d = OpenCloseImportExportElement.unmarshall_cdb(
            OpenCloseImportExportElement.marshall_cdb(cdb))
        assert d == cdb
示例#18
0
def main():
    with MockSCSI(MockDevice(smc)) as s:
        m = s.movemedium(15, 32, 64, invert=1)
        cdb = m.cdb
        assert cdb[0] == s.device.opcodes.MOVE_MEDIUM.value
        assert cdb[1] == 0
        assert scsi_ba_to_int(cdb[2:4]) == 15
        assert scsi_ba_to_int(cdb[4:6]) == 32
        assert scsi_ba_to_int(cdb[6:8]) == 64
        assert cdb[8] == 0
        assert cdb[9] == 0
        assert cdb[10] == 0x01
        cdb = m.unmarshall_cdb(cdb)
        assert cdb['opcode'] == s.device.opcodes.MOVE_MEDIUM.value
        assert cdb['medium_transport_address'] == 15
        assert cdb['source_address'] == 32
        assert cdb['destination_address'] == 64
        assert cdb['invert'] == 1

        d = MoveMedium.unmarshall_cdb(MoveMedium.marshall_cdb(cdb))
        assert d == cdb
def main():
    with MockSCSI(MockDevice(smc)) as s:
        r = s.initializeelementstatuswithrange(15, 3, rng=1, fast=1)
        cdb = r.cdb
        assert cdb[
            0] == s.device.opcodes.INITIALIZE_ELEMENT_STATUS_WITH_RANGE.value
        assert cdb[1] == 0x03
        assert scsi_ba_to_int(cdb[2:4]) == 15
        assert scsi_ba_to_int(cdb[6:8]) == 3

        cdb = r.unmarshall_cdb(cdb)
        assert cdb[
            'opcode'] == s.device.opcodes.INITIALIZE_ELEMENT_STATUS_WITH_RANGE.value
        assert cdb['starting_element_address'] == 15
        assert cdb['number_of_elements'] == 3
        assert cdb['fast'] == 1
        assert cdb['range'] == 1

        d = InitializeElementStatusWithRange.unmarshall_cdb(
            InitializeElementStatusWithRange.marshall_cdb(cdb))
        assert d == cdb
示例#20
0
def main():
    with MockSCSI(MockDevice(smc)) as s:
        m = s.exchangemedium(15, 32, 64, 32, inv1=1)
        cdb = m.cdb
        assert cdb[0] == s.device.opcodes.EXCHANGE_MEDIUM.value
        assert cdb[1] == 0
        assert scsi_ba_to_int(cdb[2:4]) == 15
        assert scsi_ba_to_int(cdb[4:6]) == 32
        assert scsi_ba_to_int(cdb[6:8]) == 64
        assert scsi_ba_to_int(cdb[8:10]) == 32
        assert cdb[10] == 0x02
        cdb = m.unmarshall_cdb(cdb)
        assert cdb['opcode'] == s.device.opcodes.EXCHANGE_MEDIUM.value
        assert cdb['medium_transport_address'] == 15
        assert cdb['source_address'] == 32
        assert cdb['first_destination_address'] == 64
        assert cdb['second_destination_address'] == 32
        assert cdb['inv1'] == 1
        assert cdb['inv2'] == 0

        d = ExchangeMedium.unmarshall_cdb(ExchangeMedium.marshall_cdb(cdb))
        assert d == cdb
示例#21
0
def main():

    with MockSCSI(MockDevice(sbc)) as s:
        s.blocksize = 512
        data = bytearray(512)

        w = s.writesame16(1024, 27, data)
        cdb = w.cdb
        assert cdb[0] == s.device.opcodes.WRITE_SAME_16.value
        assert cdb[1] == 0
        assert scsi_ba_to_int(cdb[2:10]) == 1024
        assert scsi_ba_to_int(cdb[10:14]) == 27
        assert cdb[14] == 0
        assert cdb[15] == 0
        cdb = w.unmarshall_cdb(cdb)
        assert cdb['opcode'] == s.device.opcodes.WRITE_SAME_16.value
        assert cdb['wrprotect'] == 0
        assert cdb['anchor'] == 0
        assert cdb['unmap'] == 0
        assert cdb['ndob'] == 0
        assert cdb['lba'] == 1024
        assert cdb['group'] == 0
        assert cdb['nb'] == 27

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

        w = s.writesame16(65536, 27, data, wrprotect=4, anchor=1, group=19)
        cdb = w.cdb
        assert cdb[0] == s.device.opcodes.WRITE_SAME_16.value
        assert cdb[1] == 0x90
        assert scsi_ba_to_int(cdb[2:10]) == 65536
        assert scsi_ba_to_int(cdb[10:14]) == 27
        assert cdb[14] == 0x13
        assert cdb[15] == 0
        cdb = w.unmarshall_cdb(cdb)
        assert cdb['opcode'] == s.device.opcodes.WRITE_SAME_16.value
        assert cdb['wrprotect'] == 4
        assert cdb['anchor'] == 1
        assert cdb['unmap'] == 0
        assert cdb['ndob'] == 0
        assert cdb['lba'] == 65536
        assert cdb['group'] == 19
        assert cdb['nb'] == 27

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

        w = s.writesame16(65536, 27, data, wrprotect=4, unmap=1, ndob=1)
        cdb = w.cdb
        assert cdb[0] == s.device.opcodes.WRITE_SAME_16.value
        assert cdb[1] == 0x89
        assert scsi_ba_to_int(cdb[2:10]) == 65536
        assert scsi_ba_to_int(cdb[10:14]) == 27
        assert cdb[14] == 0
        assert cdb[15] == 0
        cdb = w.unmarshall_cdb(cdb)
        assert cdb['opcode'] == s.device.opcodes.WRITE_SAME_16.value
        assert cdb['wrprotect'] == 4
        assert cdb['anchor'] == 0
        assert cdb['unmap'] == 1
        assert cdb['ndob'] == 1
        assert cdb['lba'] == 65536
        assert cdb['group'] == 0
        assert cdb['nb'] == 27

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