示例#1
0
 def test_generate_command(self):
     """
     Operation code (0x5e)
     Service action: Read Reservation (0x01)
     Allocation length (0x20)
     """
     from infi.asi.cdb.persist.input import PersistentReserveInCommand, PERSISTENT_RESERVE_IN_SERVICE_ACTION_CODES
     obj = PersistentReserveInCommand(service_action=PERSISTENT_RESERVE_IN_SERVICE_ACTION_CODES.READ_RESERVATION,
                                      allocation_length=0x2000)
     self.assertEquals(obj.pack(), b"\x5e\x01\x00\x00\x00\x00\x00\x20\x00\x00")
def read_keys_example(device):
    with asi_context_linux(device) as asi:
        command = PersistentReserveInCommand(service_action=PERSISTENT_RESERVE_IN_SERVICE_ACTION_CODES.READ_KEYS)
        response = sync_wait(command.execute(asi))
        return response