def setUp(self): """ Pre section of testcase """ self.loopdev = Loopback(self.mount_path, self.data_size, self.block_size, self.nr_dev) self.loopdev.init() self.build_target_config(self.loopdev.dev_list) super(TestNVMFMKFS, self).common_setup()
class TestNVMFTargetTemplate(NVMFTest): """ Represents target template testcase """ def __init__(self): NVMFTest.__init__(self) self.target_subsys = None self.setup_log_dir(self.__class__.__name__) def setUp(self): """ Pre section of testcase """ self.loopdev = Loopback(self.mount_path, self.data_size, self.block_size, self.nr_dev) self.loopdev.init() self.build_target_config(self.loopdev.dev_list) self.target_subsys = NVMFTarget(self.target_type) ret = self.target_subsys.config(self.target_config_file) assert_equal(ret, True, "ERROR : target config failed") def tearDown(self): """ Post section of testcase """ self.target_subsys.delete() self.loopdev.delete() def test_target(self): """ Testcase main """ print("Now Running " + self.__class__.__name__) assert_equal(0, 0, "")
class TestNVMFParallelIO(NVMFTest): """ Represents Parallel Subsystem IO testcase """ def __init__(self): NVMFTest.__init__(self) self.setup_log_dir(self.__class__.__name__) def setUp(self): """ Pre section of testcase """ self.loopdev = Loopback(self.mount_path, self.data_size, self.block_size, self.nr_dev) self.loopdev.init() self.build_target_config(self.loopdev.dev_list) super(TestNVMFParallelIO, self).common_setup() def tearDown(self): """ Post section of testcase """ super(TestNVMFParallelIO, self).common_tear_down() self.loopdev.delete() def test_parallel_io(self): """ Testcase main """ print("Now Running " + self.__class__.__name__) ret = self.host_subsys.run_ios_parallel(self.dd_read) assert_equal(ret, True, "ERROR : running IOs failed.") ret = self.host_subsys.run_ios_parallel(self.dd_write) assert_equal(ret, True, "ERROR : running IOs failed.")
class TestNVMFMKFS(NVMFTest): """ Represents mkfs testcase """ def __init__(self): NVMFTest.__init__(self) self.setup_log_dir(self.__class__.__name__) def setUp(self): """ Pre section of testcase """ self.loopdev = Loopback(self.mount_path, self.data_size, self.block_size, self.nr_dev) self.loopdev.init() self.build_target_config(self.loopdev.dev_list) super(TestNVMFMKFS, self).common_setup() def tearDown(self): """ Post section of testcase """ super(TestNVMFMKFS, self).common_tear_down() self.loopdev.delete() def test_mkfs(self): """ Testcase main """ print("Now Running " + self.__class__.__name__) ret = self.host_subsys.mkfs_seq("ext4") assert_equal(ret, True, "ERROR : mkfs failed.") ret = self.host_subsys.run_fs_ios(self.fio_fs_write) assert_equal(ret, True, "ERROR : fio failed.")
def setUp(self): """ Pre section of testcase """ self.loopdev = Loopback(self.mount_path, self.data_size, self.block_size, self.nr_dev) self.loopdev.init() self.build_target_config(self.loopdev.dev_list) self.target_subsys = NVMFTarget(self.target_type)
class TestNVMFSmartLog(NVMFTest): """ Represents Smart Log testcase """ def __init__(self): NVMFTest.__init__(self) self.setup_log_dir(self.__class__.__name__) def setUp(self): """ Pre section of testcase """ self.loopdev = Loopback(self.mount_path, self.data_size, self.block_size, self.nr_dev) self.loopdev.init() self.build_target_config(self.loopdev.dev_list) super(TestNVMFSmartLog, self).common_setup() def tearDown(self): """ Post section of testcase """ super(TestNVMFSmartLog, self).common_tear_down() self.loopdev.delete() def test_smart_log(self): """ Testcase main """ print("Now Running " + self.__class__.__name__) ret = self.host_subsys.smart_log() assert_equal(ret, True, "ERROR : running smart log failed.")
def setUp(self): """ Pre section of testcase """ self.loopdev = Loopback(self.mount_path, self.data_size, self.block_size, self.nr_dev) self.loopdev.init() self.build_target_config(self.loopdev.dev_list) self.target_subsys = NVMFTarget(self.target_type) ret = self.target_subsys.config(self.target_config_file) assert_equal(ret, True, "ERROR : target config failed")
class TestNVMFHostTraffic(NVMFTest): """ Represents disable target namespace(s) while host traffic is running testcase """ def __init__(self): NVMFTest.__init__(self) self.setup_log_dir(self.__class__.__name__) def setUp(self): """ Pre section of testcase """ self.loopdev = Loopback(self.mount_path, self.data_size, self.block_size, self.nr_dev) self.loopdev.init() self.build_target_config(self.loopdev.dev_list) self.dd_read_traffic = { "IO_TYPE": "dd", "IODIR": "read", "THREAD": __run_traffic__, "IF": None, "OF": "/dev/null", "BS": "4K", "COUNT": str(self.data_size / self.block_size), "RC": 0 } super(TestNVMFHostTraffic, self).common_setup() def tearDown(self): """ Post section of testcase """ super(TestNVMFHostTraffic, self).common_tear_down() self.loopdev.delete() def disable_target_ns(self): ret = True for target_subsys in iter(self.target_subsys): try: print("Target Subsystem NQN " + target_subsys.nqn) for target_ns in iter(target_subsys): try: ns_path = target_ns.ns_path print(" Target NS ID " + str(target_ns.ns_id)) print(" Disabling Target NS Path " + ns_path) if target_ns.disable() is False: print("ERROR : failed to disable ns " + ns_path) ret = False except StopIteration: break except StopIteration: break return ret def test_host_traffic(self): """ Testcase main """ print("Now Running " + self.__class__.__name__) self.host_subsys.run_traffic_parallel(self.dd_read_traffic) time.sleep(5) ret = self.disable_target_ns() assert_equal(ret, True, "ERROR : target ns disable failed") self.host_subsys.wait_traffic_parallel()
def setUp(self): """ Pre section of testcase """ self.loopdev = Loopback(self.mount_path, self.data_size, self.block_size, self.nr_dev) self.loopdev.init() self.build_target_config(self.loopdev.dev_list) self.dd_read_traffic = { "IO_TYPE": "dd", "IODIR": "read", "THREAD": __run_traffic__, "IF": None, "OF": "/dev/null", "BS": "4K", "COUNT": str(self.data_size / self.block_size), "RC": 0 } super(TestNVMFHostTraffic, self).common_setup()
class TestNVMFNSEnableDisable(NVMFTest): """ Represents enable disable target namespace testcase """ def __init__(self): NVMFTest.__init__(self) self.setup_log_dir(self.__class__.__name__) def setUp(self): """ Pre section of testcase """ self.loopdev = Loopback(self.mount_path, self.data_size, self.block_size, self.nr_dev) self.loopdev.init() self.build_target_config(self.loopdev.dev_list) super(TestNVMFNSEnableDisable, self).common_setup() def tearDown(self): """ Post section of testcase """ super(TestNVMFNSEnableDisable, self).common_tear_down() self.loopdev.delete() def target_ns_enable_disable(self, target_ns): target_ns_path_str = " Target NS Path " + target_ns.ns_path print(" Target NS ID " + str(target_ns.ns_id)) ret = target_ns.disable() assert_equal(ret, True, "ERROR : target ns enable failed ...") print(target_ns_path_str + " disabled successfully") ret = target_ns.enable() assert_equal(ret, True, "ERROR : target ns disable failed ...") print(target_ns_path_str + " enabled successfully") def test_ns_enable_disable(self): """ Testcase main """ print("Now Running " + self.__class__.__name__) for target_subsys in iter(self.target_subsys): try: print("Target Subsystem NQN " + target_subsys.nqn) for target_ns in iter(target_subsys): try: self.target_ns_enable_disable(target_ns) except StopIteration: break except StopIteration: break
class TestNVMFHostTemplate(NVMFTest): """ Represents host template testcase """ def __init__(self): NVMFTest.__init__(self) self.setup_log_dir(self.__class__.__name__) def setUp(self): """ Pre section of testcase """ self.loopdev = Loopback(self.mount_path, self.data_size, self.block_size, self.nr_dev) self.loopdev.init() self.build_target_config(self.loopdev.dev_list) super(TestNVMFHostTemplate, self).common_setup() def tearDown(self): """ Post section of testcase """ super(TestNVMFHostTemplate, self).common_tear_down() self.loopdev.delete() def test_host(self): """ Testcase main """ print("Now Running " + self.__class__.__name__) assert_equal(0, 0, "")
class TestNVMFScanHost(NVMFTest): """ Represents host controller scan testcase """ def __init__(self): NVMFTest.__init__(self) self.setup_log_dir(self.__class__.__name__) def setUp(self): """ Pre section of testcase """ self.loopdev = Loopback(self.mount_path, self.data_size, self.block_size, self.nr_dev) self.loopdev.init() self.build_target_config(self.loopdev.dev_list) super(TestNVMFScanHost, self).common_setup() def tearDown(self): """ Post section of testcase """ super(TestNVMFScanHost, self).common_tear_down() self.loopdev.delete() def test_scan_host(self): """ Testcase main """ print("Now Running " + self.__class__.__name__) success = True for host_subsys in iter(self.host_subsys): try: print("Host Controller " + host_subsys.ctrl_dev) for host_ns in iter(host_subsys): try: print(" Host NS " + host_ns.ns_dev) except StopIteration: success = False break except StopIteration: success = False break assert_equal(success, True, "ERROR : failed to scan host")