Spdk/test/sma/plugins/plugin2/__init__.py
Michal Berger 588dfe314b Add SPDX header to various files
They were missed by the initial set of patches which introduced this
header as a mandatory one across different types of files.

Signed-off-by: Michal Berger <michal.berger@intel.com>
Change-Id: I3f9b37d41298c843e1648e72fe8593768ccd37e0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15423
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2022-11-29 08:27:51 +00:00

47 lines
1.3 KiB
Python

# SPDX-License-Identifier: BSD-3-Clause
# Copyright (C) 2022 Intel Corporation.
# All rights reserved.
from spdk.sma import DeviceManager
from spdk.sma import CryptoEngine, get_crypto_engine
from spdk.sma.proto import sma_pb2
class TestCryptoEngine(CryptoEngine):
def __init__(self):
super().__init__('crypto-plugin2')
def setup(self, volume_id, key, cipher, key2=None):
pass
def cleanup(self, volume_id):
pass
def verify(self, volume_id, key, cipher, key2=None):
pass
def get_crypto_bdev(self, volume_id):
return volume_id
class TestDeviceManager1(DeviceManager):
def __init__(self, client):
super().__init__('plugin2-device1', 'nvme', client)
def create_device(self, request):
crypto = get_crypto_engine().name
return sma_pb2.CreateDeviceResponse(handle=f'{self.protocol}:{self.name}:{crypto}')
class TestDeviceManager2(DeviceManager):
def __init__(self, client):
super().__init__('plugin2-device2', 'nvmf_tcp', client)
def create_device(self, request):
crypto = get_crypto_engine().name
return sma_pb2.CreateDeviceResponse(handle=f'{self.protocol}:{self.name}:{crypto}')
devices = [TestDeviceManager1, TestDeviceManager2]
crypto_engines = [TestCryptoEngine]