Whamcloud - gitweb
LU-10973 lnet: LUTF DLC test suite and sample test suite 08/40108/40
authorSerguei Smirnov <ssmirnov@whamcloud.com>
Wed, 30 Sep 2020 22:52:39 +0000 (18:52 -0400)
committerOleg Drokin <green@whamcloud.com>
Tue, 4 Oct 2022 19:33:30 +0000 (19:33 +0000)
Add the DLC test suite and sample test suite to LUTF test cases.

Test-Parameters: @lnet
Signed-off-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Signed-off-by: Amir Shehata <ashehata@whamcloud.com>
Change-Id: Ic7579023cfaf796fd40d6e12434137fb3ec5b0e4
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/40108
Reviewed-by: jsimmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
37 files changed:
lustre/tests/lutf/Makefile.am
lustre/tests/lutf/python/tests/suite_dlc/callbacks.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_dlc/skip.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_00.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_01.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_02.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_03.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_04.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_05.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_06.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_07.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_08.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_09.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_10.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_11.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_12.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_13.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_14.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_15.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_16.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_17.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_18.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_18a.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_19.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_20.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_21.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_22.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_23.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_24.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_samples/callbacks.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_samples/test_sample_01.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_samples/test_sample_01_1.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_samples/test_sample_02.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_samples/test_sample_03.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_samples/test_sample_04.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_samples/test_sample_04_1.py [new file with mode: 0644]
lustre/tests/lutf/python/tests/suite_samples/test_sample_05.py [new file with mode: 0644]

index dae3c88..0a68a30 100644 (file)
@@ -16,6 +16,8 @@ nobase_noinst_SCRIPTS += $(wildcard python/config/lutf_start.sh)
 nobase_noinst_SCRIPTS += $(wildcard python/infra/*.py)
 nobase_noinst_SCRIPTS += $(wildcard python/tests/*.py)
 nobase_noinst_SCRIPTS += $(wildcard python/tests-infra/*.py)
+nobase_noinst_SCRIPTS += $(wildcard python/tests/suite_dlc/*.py)
+nobase_noinst_SCRIPTS += $(wildcard python/tests/suite_samples/*.py)
 EXTRA_DIST=$(nobase_noinst_DATA) $(nobase_noinst_SCRIPTS)
 
 noinst_testdir = $(libdir)/lustre/tests/lutf
diff --git a/lustre/tests/lutf/python/tests/suite_dlc/callbacks.py b/lustre/tests/lutf/python/tests/suite_dlc/callbacks.py
new file mode 100644 (file)
index 0000000..1b965ae
--- /dev/null
@@ -0,0 +1,8 @@
+from lnet_cleanup import clean_lnet
+from lustre_cleanup import clean_lustre
+import logging
+
+def lutf_clean_setup():
+       logging.critical("calling lutf_clean_setup()")
+       clean_lustre()
+       clean_lnet()
diff --git a/lustre/tests/lutf/python/tests/suite_dlc/skip.py b/lustre/tests/lutf/python/tests/suite_dlc/skip.py
new file mode 100644 (file)
index 0000000..321bdda
--- /dev/null
@@ -0,0 +1,2 @@
+skip_list = ['dlc_libconfig_24']
+expected_failures = ['dlc_libconfig_19', 'dlc_libconfig_21']
diff --git a/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_00.py b/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_00.py
new file mode 100644 (file)
index 0000000..76a6602
--- /dev/null
@@ -0,0 +1,24 @@
+"""
+@PRIMARY: N/A
+@PRIMARY_DESC: N/A
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE: Test liblnetconfig LNet initialization API
+"""
+
+import lnetconfig
+from lutf_exception import *
+from lutf_basetest import *
+
+def run():
+       success = False
+       rc = lnetconfig.lustre_lnet_config_lib_init()
+       if (rc == lnetconfig.LUSTRE_CFG_RC_NO_ERR):
+               success = True
+       else:
+               success = False
+       lnetconfig.lustre_lnet_config_lib_uninit()
+       if not success:
+               LUTFError("Failed to initialize LNet")
+
+       return lutfrc(LUTF_TEST_PASS)
diff --git a/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_01.py b/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_01.py
new file mode 100644 (file)
index 0000000..64c6f62
--- /dev/null
@@ -0,0 +1,66 @@
+"""
+@PRIMARY: N/A
+@PRIMARY_DESC: N/A
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE: Test missing mandatory route parameter behavior
+"""
+
+import os
+import yaml
+import lnetconfig
+from lutf import agents, me
+from lutf_basetest import *
+from lnet import TheLNet
+from lutf_exception import LUTFError
+
+class TestMissingParam(BaseTest):
+       def __init__(self, target=None):
+               super().__init__(os.path.abspath(__file__),
+                                target=target)
+
+       def missing_net_param(self):
+               L = TheLNet()
+               success = False
+               rc, yaml_err = lnetconfig.lustre_lnet_config_route(None, '10.211.55.1@tcp1', -1, -1, -1, -1)
+               if (rc == lnetconfig.LUSTRE_CFG_RC_MISSING_PARAM):
+                       success = True
+               else:
+                       success = False
+               return success
+
+       def missing_gw_param(self):
+               L = TheLNet()
+               success = False
+               rc, yaml_err = lnetconfig.lustre_lnet_config_route('tcp', None, -1, -1, -1, -1)
+               if (rc == lnetconfig.LUSTRE_CFG_RC_MISSING_PARAM):
+                       success = True
+               else:
+                       success = False
+               return success
+
+       def missing_gw_net_param(self):
+               L = TheLNet()
+               success = False
+               rc, yaml_err = lnetconfig.lustre_lnet_config_route(None, None, -1, -1, -1, -1)
+               if (rc == lnetconfig.LUSTRE_CFG_RC_MISSING_PARAM):
+                       success = True
+               else:
+                       success = False
+               return success
+
+def run():
+       la = agents.keys()
+       if len(la) >= 1:
+               t = TestMissingParam(target=la[0])
+               rc1 = t.missing_net_param()
+               rc2 = t.missing_gw_param()
+               rc3 = t.missing_gw_net_param()
+               if not rc1 or not rc2 or not rc3:
+                       return lutfrc(-1, missing_net_param=rc1,
+                                     missing_gw_param=rc2,
+                                     missing_gw_net_param=rc3)
+               return lutfrc(LUTF_TEST_PASS)
+       else:
+               return lutfrc(LUTF_TEST_SKIP, "No agents to run test")
+
diff --git a/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_02.py b/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_02.py
new file mode 100644 (file)
index 0000000..2fa7cb0
--- /dev/null
@@ -0,0 +1,54 @@
+"""
+@PRIMARY: N/A
+@PRIMARY_DESC: N/A
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE: Test standard route add
+1. Configure LNet with a tcp network and one interface
+2. Add a route with no hop, prio or sensitivity specified
+3. Add a route with hop but no prio or sensitivity specified
+4. Add a route with prio but no hop or sensitivity specified
+5. Add a route with sensitivity but no op or prio specified
+3. Check configuration is successful after each route configure
+"""
+
+import os
+import yaml
+import lnetconfig
+from lutf import agents, me
+from lutf_basetest import *
+from lnet import TheLNet
+from lutf_exception import LUTFError
+from lnet_helpers import LNetHelpers
+
+def run():
+       la = agents.keys()
+       if len(la) < 2:
+               return lutfrc(LUTF_TEST_SKIP, "No agents to run test")
+
+       try:
+               t = LNetHelpers(script=os.path.abspath(__file__), target=la[0])
+               rtr = LNetHelpers(script=os.path.abspath(__file__), target=la[1])
+               t.configure_net('tcp')
+               rtr.configure_net('tcp')
+               rtr_nids = rtr.list_nids()
+               if len(rtr_nids) < 1:
+                       return lutfrc(LUTF_TEST_FAIL, "No NIDS available for rtr")
+               # test standard route config
+               t.api_configure_route(rnet='tcp2', gw=rtr_nids[0])
+               # test configuring hops
+               t.api_configure_route(rnet='tcp3', gw=rtr_nids[0], hop=4)
+               # test configuring priority
+               t.api_configure_route(rnet='tcp4', gw=rtr_nids[0], prio=2)
+               # test configuring sensitivity
+               t.api_configure_route(rnet='tcp5', gw=rtr_nids[0], sen=100)
+               t.api_del_route(rnet='tcp2', gw=rtr_nids[0])
+               t.api_del_route(rnet='tcp3', gw=rtr_nids[0])
+               t.api_del_route(rnet='tcp4', gw=rtr_nids[0])
+               t.api_del_route(rnet='tcp5', gw=rtr_nids[0])
+               return lutfrc(LUTF_TEST_PASS)
+       except Exception as e:
+               t.uninit()
+               rtr.uninit()
+               raise e
+
diff --git a/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_03.py b/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_03.py
new file mode 100644 (file)
index 0000000..e32e71a
--- /dev/null
@@ -0,0 +1,51 @@
+"""
+@PRIMARY: N/A
+@PRIMARY_DESC: N/A
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE: Test standard route add
+1. Configure LNet with a tcp network and one interface
+2. Add 9 routes with different remote nets, hops and prios
+3. Verify that correct number of routes are configured via the show liblnetconfig API
+"""
+
+import os
+import yaml
+import lnetconfig
+from lutf import agents, me
+from lutf_basetest import *
+from lnet import TheLNet
+from lutf_exception import LUTFError
+from lnet_helpers import LNetHelpers
+
+def run():
+       la = agents.keys()
+       if len(la) < 2:
+               return lutfrc(LUTF_TEST_SKIP, "No agents to run test")
+
+       try:
+               t = LNetHelpers(script=os.path.abspath(__file__), target=la[0])
+               rtr = LNetHelpers(script=os.path.abspath(__file__), target=la[1])
+               t.configure_net('tcp')
+               rtr.configure_net('tcp')
+               rtr_nids = rtr.list_nids()
+               if len(rtr_nids) < 1:
+                       return lutfrc(LUTF_TEST_FAIL, "No NIDS available for rtr")
+               for i in range(1, 10):
+                       t.api_configure_route('tcp'+str(i), rtr_nids[0], i, i-1)
+               # check that there are at least 5 routes configured
+               t.api_check_route(9)
+               # check that there is 1 route configured with tcp6
+               t.api_check_route(1, network='tcp6')
+               # check that there is 1 route configured with hop == 5
+               t.api_check_route(1, hop=5)
+               # check that there is 1 route configure with prio = 5
+               t.api_check_route(1, prio=5)
+               # check that there is 1 route with tcp6 and gw
+               t.api_check_route(1, network='tcp6', gateway=rtr_nids[0])
+               return lutfrc(LUTF_TEST_PASS)
+       except Exception as e:
+               t.uninit()
+               rtr.uninit()
+               raise e
+
diff --git a/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_04.py b/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_04.py
new file mode 100644 (file)
index 0000000..ba0dc93
--- /dev/null
@@ -0,0 +1,44 @@
+"""
+@PRIMARY: N/A
+@PRIMARY_DESC: N/A
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE: 1. Call the lustre_lnet_config_route() function to insert route.
+2. Delete that route but specify no net
+3. Expect an error
+"""
+
+import os
+import yaml
+import lnetconfig
+from lutf import agents, me
+from lutf_basetest import *
+from lnet import TheLNet
+from lutf_exception import LUTFError
+from lnet_helpers import LNetHelpers
+
+def run():
+       la = agents.keys()
+       if len(la) < 2:
+               return lutfrc(LUTF_TEST_SKIP, "No agents to run test")
+
+       try:
+               t = LNetHelpers(script=os.path.abspath(__file__), target=la[0])
+               rtr = LNetHelpers(script=os.path.abspath(__file__), target=la[1])
+               t.configure_net('tcp')
+               rtr.configure_net('tcp')
+               rtr_nids = rtr.list_nids()
+               if len(rtr_nids) < 1:
+                       return lutfrc(LUTF_TEST_FAIL, "No NIDS available for rtr")
+               t.api_configure_route('tcp3', rtr_nids[0], 4)
+               t.set_exception(False)
+               rc, info = t.api_del_route(gw=rtr_nids[0])
+               if rc:
+                       # expect failure
+                       return lutfrc(LUTF_TEST_FAIL, details=info)
+               return lutfrc(LUTF_TEST_PASS)
+       except Exception as e:
+               t.uninit()
+               rtr.uninit()
+               raise e
+
diff --git a/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_05.py b/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_05.py
new file mode 100644 (file)
index 0000000..c77bb63
--- /dev/null
@@ -0,0 +1,46 @@
+"""
+@PRIMARY: N/A
+@PRIMARY_DESC: N/A
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE: 1. Call the lustre_lnet_config_route() function to insert route.
+2. Delete that route but specify no gw
+3. Expect an error
+"""
+
+import os
+import yaml, logging
+import lnetconfig
+from lutf import agents, me
+from lutf_basetest import *
+from lnet import TheLNet
+from lutf_exception import LUTFError
+from lnet_helpers import LNetHelpers
+
+def run():
+       la = agents.keys()
+       if len(la) < 2:
+               return lutfrc(LUTF_TEST_SKIP, "No agents to run test")
+
+       try:
+               logging.debug('node is %s. rtr is %s' % (la[0], la[1]))
+               t = LNetHelpers(script=os.path.abspath(__file__), target=la[0])
+               rtr = LNetHelpers(script=os.path.abspath(__file__), target=la[1])
+               t.configure_net('tcp')
+               rtr.configure_net('tcp')
+               rtr_nids = rtr.list_nids()
+               logging.debug('rtr nids are: %s' % str(rtr_nids))
+               if len(rtr_nids) < 1:
+                       return lutfrc(LUTF_TEST_FAIL, "No NIDS available for rtr")
+               t.api_configure_route('tcp3', rtr_nids[0], 4)
+               t.set_exception(False)
+               rc, info = t.api_del_route(rnet='tcp3')
+               if rc:
+                       # expect failure
+                       return lutfrc(LUTF_TEST_FAIL, details=info)
+               return lutfrc(LUTF_TEST_PASS)
+       except Exception as e:
+               t.uninit()
+               rtr.uninit()
+               raise e
+
diff --git a/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_06.py b/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_06.py
new file mode 100644 (file)
index 0000000..23f4fd0
--- /dev/null
@@ -0,0 +1,46 @@
+"""
+@PRIMARY: N/A
+@PRIMARY_DESC: N/A
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE: 1. Call the lustre_lnet_config_route() function to insert route.
+2. Delete that route but specify no gw
+3. Expect an error
+"""
+
+import os
+import yaml
+import lnetconfig
+from lutf import agents, me
+from lutf_basetest import *
+from lnet import TheLNet
+from lutf_exception import LUTFError
+from lnet_helpers import LNetHelpers
+
+def run():
+       la = agents.keys()
+       if len(la) < 2:
+               return lutfrc(LUTF_TEST_SKIP, "No agents to run test")
+
+       try:
+               logging.debug('node is %s. rtr is %s' % (la[0], la[1]))
+               t = LNetHelpers(script=os.path.abspath(__file__), target=la[0])
+               rtr = LNetHelpers(script=os.path.abspath(__file__), target=la[1])
+               t.configure_net('tcp')
+               rtr.configure_net('tcp')
+               rtr_nids = rtr.list_nids()
+               logging.debug('rtr nids are: %s' % str(rtr_nids))
+               if len(rtr_nids) < 1:
+                       return lutfrc(LUTF_TEST_FAIL, "No NIDS available for rtr")
+               t.api_configure_route('tcp3', rtr_nids[0], 4)
+               t.set_exception(False)
+               rc, info = t.api_del_route(rnet='tcp4', gw='10.10.10.10@tcp')
+               if rc:
+                       # expect failure
+                       return lutfrc(LUTF_TEST_FAIL, details=info)
+               return lutfrc(LUTF_TEST_PASS)
+       except Exception as e:
+               t.uninit()
+               rtr.uninit()
+               raise e
+
diff --git a/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_07.py b/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_07.py
new file mode 100644 (file)
index 0000000..5bb4cd9
--- /dev/null
@@ -0,0 +1,36 @@
+"""
+@PRIMARY: N/A
+@PRIMARY_DESC: N/A
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE: 1. Call the lustre_lnet_config_net() function to add a net.
+2. missing net param
+3. expect MISSING Param return code
+"""
+
+import os
+import yaml
+import lnetconfig
+from lutf import agents, me
+from lutf_basetest import *
+from lnet import TheLNet
+from lutf_exception import LUTFError
+from lnet_helpers import LNetHelpers
+
+def run():
+       la = agents.keys()
+       if len(la) < 1:
+               return lutfrc(LUTF_TEST_SKIP, "No agents to run test")
+       try:
+               t = LNetHelpers(target=la[0])
+               t.configure_lnet()
+               intfs = t.get_available_devs()
+               t.set_exception(False)
+               rc, info = t.api_config_ni('', intfs)
+               if rc:
+                       #expecting failure
+                       return lutfrc(LUTF_TEST_FAIL, details=info)
+               return lutfrc(LUTF_TEST_PASS, details=info)
+       except Exception as e:
+               t.uninit()
+               raise e
diff --git a/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_08.py b/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_08.py
new file mode 100644 (file)
index 0000000..984c002
--- /dev/null
@@ -0,0 +1,37 @@
+"""
+@PRIMARY: N/A
+@PRIMARY_DESC: N/A
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE: 1. Call the lustre_lnet_config_net() function to add a net.
+2. missing device list param
+3. expect MISSING Param return code
+"""
+
+import os
+import yaml
+import lnetconfig
+from lutf import agents, me
+from lutf_basetest import *
+from lnet import TheLNet
+from lutf_exception import LUTFError
+from lnet_helpers import LNetHelpers
+
+def run():
+       la = agents.keys()
+       if len(la) < 1:
+               return lutfrc(LUTF_TEST_SKIP, "No agents to run test")
+       try:
+               t = LNetHelpers(target=la[0])
+               t.configure_lnet()
+               intfs = t.get_available_devs()
+               t.set_exception(False)
+               rc, info = t.api_config_ni('tcp4', [])
+               if rc:
+                       #expecting failure
+                       return lutfrc(LUTF_TEST_FAIL, details=info)
+               return lutfrc(LUTF_TEST_PASS, details=info)
+       except Exception as e:
+               t.uninit()
+               raise e
+
diff --git a/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_09.py b/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_09.py
new file mode 100644 (file)
index 0000000..d84681f
--- /dev/null
@@ -0,0 +1,36 @@
+"""
+@PRIMARY: N/A
+@PRIMARY_DESC: N/A
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE: 1. Call the lustre_lnet_config_net() function to add a net.
+2. missing net and device list param
+3. expect MISSING Param return code
+"""
+
+import os
+import yaml
+import lnetconfig
+from lutf import agents, me
+from lutf_basetest import *
+from lnet import TheLNet
+from lutf_exception import LUTFError
+from lnet_helpers import LNetHelpers
+
+def run():
+       la = agents.keys()
+       if len(la) < 1:
+               return lutfrc(LUTF_TEST_SKIP, "No agents to run test")
+       try:
+               t = LNetHelpers(target=la[0])
+               t.configure_lnet()
+               t.set_exception(False)
+               rc, info = t.api_config_ni('', [])
+               if rc:
+                       #expecting failure
+                       return lutfrc(LUTF_TEST_FAIL, details=info)
+               return lutfrc(LUTF_TEST_PASS, details=info)
+       except Exception as e:
+               t.uninit()
+               raise e
+
diff --git a/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_10.py b/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_10.py
new file mode 100644 (file)
index 0000000..64805d2
--- /dev/null
@@ -0,0 +1,37 @@
+"""
+@PRIMARY: N/A
+@PRIMARY_DESC: N/A
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE: 1. Call the lustre_lnet_config_net() function to add a net.
+2. bad net param
+3. expect failure
+"""
+
+import os
+import yaml
+import lnetconfig
+from lutf import agents, me
+from lutf_basetest import *
+from lnet import TheLNet
+from lutf_exception import LUTFError
+from lnet_helpers import LNetHelpers
+
+def run():
+       la = agents.keys()
+       if len(la) < 1:
+               return lutfrc(LUTF_TEST_SKIP, "No agents to run test")
+       try:
+               t = LNetHelpers(target=la[0])
+               t.configure_lnet()
+               intfs = t.get_available_devs()
+               t.set_exception(False)
+               rc, info = t.api_config_ni('amir', intfs)
+               if rc:
+                       #expecting failure
+                       return lutfrc(LUTF_TEST_FAIL, details=info)
+               return lutfrc(LUTF_TEST_PASS, details=info)
+       except Exception as e:
+               t.uninit()
+               raise e
+
diff --git a/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_11.py b/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_11.py
new file mode 100644 (file)
index 0000000..57f2b86
--- /dev/null
@@ -0,0 +1,36 @@
+"""
+@PRIMARY: N/A
+@PRIMARY_DESC: N/A
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE: 1. Call the lustre_lnet_config_net() function to add a net.
+2. bad intf param
+3. expect failure
+"""
+
+import os
+import yaml
+import lnetconfig
+from lutf import agents, me
+from lutf_basetest import *
+from lnet import TheLNet
+from lutf_exception import LUTFError
+from lnet_helpers import LNetHelpers
+
+def run():
+       la = agents.keys()
+       if len(la) < 1:
+               return lutfrc(LUTF_TEST_SKIP, "No agents to run test")
+       try:
+               t = LNetHelpers(target=la[0])
+               t.configure_lnet()
+               t.set_exception(False)
+               rc, info = t.api_config_ni('tcp4', ['amir'])
+               if rc:
+                       #expecting failure
+                       return lutfrc(LUTF_TEST_FAIL, details=info)
+               return lutfrc(LUTF_TEST_PASS, details=info)
+       except Exception as e:
+               t.uninit()
+               raise e
+
diff --git a/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_12.py b/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_12.py
new file mode 100644 (file)
index 0000000..063a3ed
--- /dev/null
@@ -0,0 +1,37 @@
+"""
+@PRIMARY: N/A
+@PRIMARY_DESC: N/A
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE: 1. Call the lustre_lnet_config_ni() function to add a net.
+2. use proper parameters
+3. expect net to be configured properly
+4. call the lustre_lnet_show_net() to verify the net was added proprely
+5. call the lustre_lnet_del_net() to remove all networks added.
+"""
+
+import os
+import yaml
+import lnetconfig
+from lutf import agents, me
+from lutf_basetest import *
+from lnet import TheLNet
+from lutf_exception import LUTFError
+from lnet_helpers import LNetHelpers
+
+def run():
+       la = agents.keys()
+       if len(la) < 1:
+               return lutfrc(LUTF_TEST_SKIP, "No agents to run test")
+       t = LNetHelpers(target=la[0])
+       try:
+               t.configure_lnet()
+               intfs = t.get_available_devs()
+               t.api_config_ni('tcp', intfs)
+               t.api_check_ni(net='tcp', num=len(intfs))
+               t.api_del_ni('tcp', intfs)
+               return lutfrc(LUTF_TEST_PASS)
+       except Exception as e:
+               t.uninit()
+               raise e
+
diff --git a/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_13.py b/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_13.py
new file mode 100644 (file)
index 0000000..7fea51a
--- /dev/null
@@ -0,0 +1,45 @@
+"""
+@PRIMARY: N/A
+@PRIMARY_DESC: N/A
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE: 1. Call the lustre_lnet_config_ni() function to add a net.
+2. define all optional parameters: peer_to, peer_credits, peer_buffer_credits, credits
+3. expect net to be configured with parameters specified
+4. call the lustre_lnet_show_net() to verify the net was added proprely
+5. call the lustre_lnet_del_net() to remove all networks added.success
+"""
+
+import os
+import yaml
+import lnetconfig
+from lutf import agents, me
+from lutf_basetest import *
+from lnet import TheLNet
+from lutf_exception import LUTFError
+from lnet_helpers import LNetHelpers
+
+def run():
+       la = agents.keys()
+       if len(la) < 1:
+               return lutfrc(LUTF_TEST_SKIP, "No agents to run test")
+       t = LNetHelpers(target=la[0])
+       try:
+               t.configure_lnet()
+               intfs = t.get_available_devs()
+               pc = 256
+               pto = 50
+               pbc = 16
+               cre = 128
+               t.api_config_ni('tcp', intfs, peer_credits=pc,
+                               peer_timeout=pto, peer_buffer_credits=pbc,
+                               credits=cre)
+               t.api_check_ni(net='tcp', num=len(intfs), peer_credits=pc,
+                               peer_timeout=pto, peer_buffer_credits=pbc,
+                               credits=cre)
+               t.api_del_ni('tcp', intfs)
+               return lutfrc(LUTF_TEST_PASS)
+       except Exception as e:
+               t.uninit()
+               raise e
+
diff --git a/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_14.py b/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_14.py
new file mode 100644 (file)
index 0000000..58ae899
--- /dev/null
@@ -0,0 +1,40 @@
+"""
+@PRIMARY: N/A
+@PRIMARY_DESC: N/A
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE: 1. Call the lustre_lnet_config_ni() function to add a net.
+2. define all optional parameters: cpts
+3. expect net to be configured with parameters specified
+4. call the lustre_lnet_show_net() to verify the net was added proprely
+5. call the lustre_lnet_del_net() to remove all networks added.success
+"""
+
+import os
+import yaml
+import lnetconfig
+from lutf import agents, me
+from lutf_basetest import *
+from lnet import TheLNet
+from lutf_exception import LUTFError
+from lnet_helpers import LNetHelpers
+
+def run():
+       la = agents.keys()
+       if len(la) < 1:
+               return lutfrc(LUTF_TEST_SKIP, "No agents to run test")
+       t = LNetHelpers(target=la[0])
+       try:
+               t.configure_lnet()
+               intfs = t.get_available_devs()
+               cpus = t.get_num_cpus()
+               if cpus <= 1:
+                       raise LUTFError("not enough cpus for this test: %d" % cpus)
+               t.api_config_ni('tcp', intfs, global_cpts=[1])
+               t.api_check_ni(net='tcp', num=len(intfs), global_cpts=[1])
+               t.api_del_ni('tcp', intfs)
+               return lutfrc(LUTF_TEST_PASS)
+       except Exception as e:
+               t.uninit()
+               raise e
+
diff --git a/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_15.py b/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_15.py
new file mode 100644 (file)
index 0000000..9513b7c
--- /dev/null
@@ -0,0 +1,38 @@
+"""
+@PRIMARY: N/A
+@PRIMARY_DESC: N/A
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE: 1. Test configuring the same network twice.
+2. Verify the second configure fails
+"""
+
+import os
+import yaml
+import lnetconfig
+from lutf import agents, me
+from lutf_basetest import *
+from lnet import TheLNet
+from lutf_exception import LUTFError
+from lnet_helpers import LNetHelpers
+
+def run():
+       la = agents.keys()
+       if len(la) < 1:
+               return lutfrc(LUTF_TEST_SKIP, "No agents to run test")
+       t = LNetHelpers(target=la[0])
+       try:
+               t.configure_lnet()
+               intfs = t.get_available_devs()
+               t.api_config_ni('tcp', intfs)
+               t.api_check_ni(net='tcp', num=len(intfs))
+               t.set_exception(False)
+               rc, info = t.api_config_ni('tcp', intfs)
+               if rc:
+                       return lutfrc(LUTF_TEST_FAIL, details=info)
+               t.api_del_ni('tcp', intfs)
+               return lutfrc(LUTF_TEST_PASS)
+       except Exception as e:
+               t.uninit()
+               raise e
+
diff --git a/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_16.py b/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_16.py
new file mode 100644 (file)
index 0000000..3a88c1e
--- /dev/null
@@ -0,0 +1,37 @@
+"""
+@PRIMARY: N/A
+@PRIMARY_DESC: N/A
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE: 1. Test configuring the same network twice.
+2. Verify the second configure fails
+"""
+
+import os
+import yaml
+import lnetconfig
+from lutf import agents, me
+from lutf_basetest import *
+from lnet import TheLNet
+from lutf_exception import LUTFError
+from lnet_helpers import LNetHelpers
+
+def run():
+       la = agents.keys()
+       if len(la) < 1:
+               return lutfrc(LUTF_TEST_SKIP, "No agents to run test")
+       t = LNetHelpers(target=la[0])
+       try:
+               t = LNetHelpers(target=la[0])
+               t.configure_lnet()
+               t.api_set_routing(True)
+               t.set_exception(False)
+               rc, info = t.api_config_rtr_buffers(tiny=-323)
+               if rc:
+                       # expect failure
+                       return lutfrc(LUTF_TEST_FAIL, details=info)
+               return lutfrc(LUTF_TEST_PASS)
+       except Exception as e:
+               t.uninit()
+               raise e
+
diff --git a/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_17.py b/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_17.py
new file mode 100644 (file)
index 0000000..a7b8f33
--- /dev/null
@@ -0,0 +1,49 @@
+"""
+@PRIMARY: N/A
+@PRIMARY_DESC: N/A
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE: 1. Enable routing
+2. Configure buffers to default
+3. Verify values configured
+4. Configure buffers to something other than default
+5. Verify values configured
+6. disable routing
+7. renable routing
+8. verify values are back to the defaults
+"""
+
+import os
+import yaml
+import lnetconfig
+from lutf import agents, me
+from lutf_basetest import *
+from lnet import TheLNet
+from lutf_exception import LUTFError
+from lnet_helpers import LNetHelpers
+
+def run():
+       la = agents.keys()
+       if len(la) < 1:
+               return lutfrc(LUTF_TEST_SKIP, "No agents to run test")
+       t = LNetHelpers(target=la[0])
+       try:
+               mem_available = t.get_mem_info().total / (1000 ** 3)
+               if mem_available < 3:
+                       msg = "MEM available %0.2fGB but need at least 3GB" % mem_available
+                       return lutfrc(LUTF_TEST_SKIP, msg=msg)
+               t.configure_lnet()
+               t.api_set_routing(True)
+               t.api_config_rtr_buffers()
+               t.api_check_rtr_buffers()
+               t.api_config_rtr_buffers(tiny=8192, small=32768, large=2048)
+               t.api_check_rtr_buffers(tiny=8192, small=32768, large=2048)
+               t.api_set_routing(False)
+               t.api_set_routing(True)
+               t.api_config_rtr_buffers()
+               t.api_check_rtr_buffers()
+               return lutfrc(LUTF_TEST_PASS)
+       except Exception as e:
+               t.uninit()
+               raise e
+
diff --git a/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_18.py b/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_18.py
new file mode 100644 (file)
index 0000000..7953026
--- /dev/null
@@ -0,0 +1,72 @@
+"""
+@PRIMARY: N/A
+@PRIMARY_DESC: N/A
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE: 1. Create a YAML file of multiple routes
+2. Call the lustre_yaml_config() - to configure
+3. Call the lustre_yaml_show() - to show and verify what has been configured
+4. Call the lustre_yaml_del() - to delete what has been configured.
+5. Call the lustre_yaml_show() -  to show and verify routes are no longer configured
+"""
+
+import os
+import yaml, random
+import lnetconfig
+from lutf import agents, me, lutf_tmp_dir
+from lutf_basetest import *
+from lnet import TheLNet
+from lutf_exception import LUTFError
+from lnet_helpers import LNetHelpers
+from lutf_file import LutfFile
+
+def run():
+       la = agents.keys()
+       if len(la) < 2:
+               msg = "need 2 agents to run test < 2 available"
+               return lutfrc(LUTF_TEST_SKIP, msg=msg)
+
+       t = LNetHelpers(target=la[0])
+       t1 = LNetHelpers(target=la[1])
+       try:
+               t.configure_lnet()
+               intfs = t.get_available_devs()
+               t.api_config_ni('tcp', intfs)
+
+               t1.configure_lnet()
+               intfs = t1.get_available_devs()
+               t1.api_config_ni('tcp', intfs)
+               rtr_nids = t1.list_nids()
+               if len(rtr_nids) <= 0:
+                       return lutfrc(LUTF_TEST_FAIL, msg="Failed to configure gateway")
+
+               tmpFile = 'rtr'+str(random.getrandbits(32)) + '.yaml'
+               tmpFile = os.path.join(lutf_tmp_dir, tmpFile)
+               tmp = LutfFile(tmpFile, full_path=True, target=la[0])
+               cfg =   'route:\n'+ \
+                       '   - net: tcp4\n'+ \
+                       '     gateway: '+rtr_nids[0]+'\n'+ \
+                       '     hop: 4\n'+ \
+                       '     detail: 1\n'+ \
+                       '     seq_no: 1\n'+ \
+                       '   - net: tcp5\n'+ \
+                       '     gateway: '+rtr_nids[0]+'\n'+ \
+                       '     hop: 9\n'+ \
+                       '     detail: 1\n'+ \
+                       '     seq_no: 2\n'+ \
+                       '   - net: tcp6\n'+ \
+                       '     gateway: '+rtr_nids[0]+'\n'+ \
+                       '     hop: 6\n'+ \
+                       '     detail: 1\n'+ \
+                       '     seq_no: 3\n'
+               tmp.open('w')
+               tmp.write(cfg)
+               tmp.close()
+
+               t.api_yaml_cfg(tmp.get_full_path(), 3)
+               tmp.remove()
+               return lutfrc(LUTF_TEST_PASS)
+       except Exception as e:
+               t.uninit()
+               t1.uninit()
+               raise e
diff --git a/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_18a.py b/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_18a.py
new file mode 100644 (file)
index 0000000..48e8d56
--- /dev/null
@@ -0,0 +1,75 @@
+"""
+@PRIMARY: N/A
+@PRIMARY_DESC: N/A
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE: 1. Create a YAML file of multiple routes
+2. Call the lustre_yaml_config() - to configure
+3. Call the lustre_yaml_show() - to show and verify what has been configured
+4. Call the lustre_yaml_del() - to delete what has been configured.
+5. Call the lustre_yaml_show() -  to show and verify routes are no longer configured
+"""
+
+import os, logging
+import yaml, random
+import lnetconfig
+from lutf import agents, me, lutf_tmp_dir
+from lutf_basetest import BaseTest, lutfrc
+from lnet import TheLNet
+from lutf_exception import LUTFError
+from lnet_helpers import LNetHelpers as lh
+from lutf_file import LutfFile
+
+def run():
+       la = agents.keys()
+       if len(la) < 2:
+               msg = "need 2 agents to run test < 2 available"
+               return lutfrc(-2, msg=msg)
+
+       t = lh(target=la[0])
+       t1 = lh(target=la[1])
+       try:
+               t.configure_lnet()
+               intfs = t.get_available_devs()
+               t.api_config_ni('tcp', intfs)
+
+               t1.configure_lnet()
+               intfs = t1.get_available_devs()
+               t1.api_config_ni('tcp', intfs)
+               logging.debug("----------> LIST_NIDS")
+               rtr_nids = t.list_nids()
+               if len(rtr_nids) <= 0:
+                       return lutfrc(-1, msg="Failed to configure gateway")
+               logging.debug(str(rtr_nids))
+
+               tmpFile = 'rtr'+str(random.getrandbits(32)) + '.yaml'
+               tmpFile = os.path.join(lutf_tmp_dir, tmpFile)
+               tmp = LutfFile(tmpFile, full_path=True, target=la[1])
+               cfg =   'route:\n'+ \
+                       '   - net: tcp4\n'+ \
+                       '     gateway: '+rtr_nids[0]+'\n'+ \
+                       '     hop: 4\n'+ \
+                       '     detail: 1\n'+ \
+                       '     seq_no: 1\n'+ \
+                       '   - net: tcp5\n'+ \
+                       '     gateway: '+rtr_nids[0]+'\n'+ \
+                       '     hop: 9\n'+ \
+                       '     detail: 1\n'+ \
+                       '     seq_no: 2\n'+ \
+                       '   - net: tcp6\n'+ \
+                       '     gateway: '+rtr_nids[0]+'\n'+ \
+                       '     hop: 6\n'+ \
+                       '     detail: 1\n'+ \
+                       '     seq_no: 3\n'
+               tmp.open('w')
+               tmp.write(cfg)
+               tmp.close()
+
+               logging.debug("----------> config YAML")
+               t1.api_yaml_cfg(tmp.get_full_path(), 3)
+               tmp.remove()
+               return lutfrc(0)
+       except Exception as e:
+               t.uninit()
+               t1.uninit()
+               raise e
diff --git a/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_19.py b/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_19.py
new file mode 100644 (file)
index 0000000..f790eed
--- /dev/null
@@ -0,0 +1,76 @@
+"""
+@PRIMARY: N/A
+@PRIMARY_DESC: N/A
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE: 1. Create a YAML file of multiple networks
+2. Call the lustre_yaml_config() - to configure
+3. Call the lustre_yaml_show() - to show and verify what has been configured
+4. Call the lustre_yaml_del() - to delete what has been configured.
+5. Call the lustre_yaml_show() -  to show and verify routes are no longer configured
+"""
+
+import os
+import yaml, random
+import lnetconfig
+from lutf import agents, me, lutf_tmp_dir
+from lutf_basetest import *
+from lnet import TheLNet
+from lutf_exception import LUTFError
+from lnet_helpers import LNetHelpers
+from lutf_file import LutfFile
+
+def run():
+       la = agents.keys()
+       if len(la) < 1:
+               return lutfrc(LUTF_TEST_SKIP, msg="No agents to run test")
+
+       t = LNetHelpers(target=la[0])
+       try:
+               t.configure_lnet()
+               intfs = t.get_available_devs()
+               t.api_config_ni('tcp', intfs)
+
+               tmpFile = 'net'+str(random.getrandbits(32)) + '.yaml'
+               tmpFile = os.path.join(lutf_tmp_dir, tmpFile)
+               tmp = LutfFile(tmpFile, target=la[0])
+               cfg =   'net:\n' + \
+                       '    - net type: tcp2\n' + \
+                       '      local NI(s):\n' + \
+                       '         - interfaces:\n' + \
+                       '              0: eth0\n' + \
+                       '           tunables:\n' + \
+                       '              peer_timeout: 180\n' + \
+                       '              peer_credits: 8\n' + \
+                       '              peer_buffer_credits: 0\n' + \
+                       '              credits: 256\n' + \
+                       '    - net type: tcp3\n' + \
+                       '      local NI(s):\n' + \
+                       '         - interfaces:\n' + \
+                       '              0: eth0\n' + \
+                       '           tunables:\n' + \
+                       '              peer_timeout: 140\n' + \
+                       '              peer_credits: 8\n' + \
+                       '              peer_buffer_credits: 0\n' + \
+                       '              credits: 1024\n' + \
+                       '    - net type: tcp4\n' + \
+                       '      local NI(s):\n' + \
+                       '         - interfaces:\n' + \
+                       '              0: eth0\n' + \
+                       '           tunables:\n' + \
+                       '              peer_timeout: 190\n' + \
+                       '              peer_credits: 16\n' + \
+                       '              peer_buffer_credits: 0\n' + \
+                       '              credits: 256\n'
+               tmp.open('w')
+               tmp.write(cfg)
+               tmp.close()
+
+               # configure lo (default), tcp, tcp2, tcp3, tcp4
+               t.api_yaml_cfg(tmp.get_full_path(), 5)
+               tmp.remove()
+               return lutfrc(LUTF_TEST_PASS)
+       except Exception as e:
+               t.uninit()
+               raise e
+
diff --git a/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_20.py b/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_20.py
new file mode 100644 (file)
index 0000000..068f0d4
--- /dev/null
@@ -0,0 +1,72 @@
+"""
+@PRIMARY: N/A
+@PRIMARY_DESC: N/A
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE: enable disable routes
+Enable routing with the specified tiny, small and large buffers.
+Check it was enabled properly
+Disalbe routing
+Check it was disabled properly
+"""
+
+import os, yaml, random
+import lnetconfig
+from lutf import agents, me, lutf_tmp_dir
+from lutf_basetest import *
+from lnet import TheLNet
+from lutf_exception import LUTFError
+from lnet_helpers import LNetHelpers
+from lutf_file import LutfFile
+
+def run():
+       la = agents.keys()
+       if len(la) < 1:
+               return lutfrc(LUTF_TEST_SKIP, "No agents to run test")
+       t = LNetHelpers(target=la[0])
+       try:
+               t.configure_lnet()
+               intfs = t.get_available_devs()
+               t.api_config_ni('tcp', intfs)
+
+               tmpFile = 'rtr'+str(random.getrandbits(32)) + '.yaml'
+               tmpFile = os.path.join(lutf_tmp_dir, tmpFile)
+               tmp = LutfFile(tmpFile, target=la[0])
+               cfg =   'routing:\n' + \
+                       '   - seq_no: 1\n' + \
+                       '     enable: 1\n' + \
+                       'buffers:\n' + \
+                       '   - seq_no: 2\n' + \
+                       '     tiny: 1024\n' + \
+                       '     small: 8192\n' + \
+                       '     large: 512\n'
+
+               tmp.open('w')
+               tmp.write(cfg)
+               tmp.close()
+               cptfn = os.path.join(os.path.sep, 'sys', 'kernel', 'debug', 'lnet', 'cpu_partition_table')
+               cptf = LutfFile(cptfn, full_path=True, target=la[0])
+               cptf.open('r')
+               data = cptf.readlines()
+               cptf.close()
+               t.api_yaml_cfg(tmp.get_full_path(), len(data)+4, delete=False)
+               tmp.remove()
+
+               tmpFile = 'rtr'+str(random.getrandbits(32)) + '.yaml'
+               tmpFile = os.path.join(lutf_tmp_dir, tmpFile)
+               tmp = LutfFile(tmpFile, target=la[0])
+               cfg =   'routing:\n' + \
+                       '   - seq_no: 1\n' + \
+                       '     enable: 1\n'
+               tmp.open('w')
+               tmp.write(cfg)
+               tmp.close()
+               # find out the number of CPTs
+               t.api_yaml_cfg(tmp.get_full_path(), len(data)+4, delete=False)
+               tmp.remove()
+
+               return lutfrc(LUTF_TEST_PASS)
+       except Exception as e:
+               t.uninit()
+               raise e
+
diff --git a/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_21.py b/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_21.py
new file mode 100644 (file)
index 0000000..fc71e26
--- /dev/null
@@ -0,0 +1,100 @@
+"""
+@PRIMARY: N/A
+@PRIMARY_DESC: N/A
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE:  test yaml configuration
+1. create a YAML file which configures networks and routes
+2. Check configuration is correct
+3. Delete the configuration
+This test needs at least 2 nodes, one to be the router and one
+where the routes are configured
+"""
+
+import os, yaml, random
+import lnetconfig
+from lutf import agents, me, lutf_tmp_dir
+from lutf_basetest import *
+from lnet import TheLNet
+from lutf_exception import LUTFError
+from lnet_helpers import LNetHelpers
+from lutf_file import LutfFile
+
+def run():
+       la = agents.keys()
+       if len(la) < 2:
+               msg = "need 2 agents to run test < 2 available"
+               return lutfrc(LUTF_TEST_SKIP, msg=msg)
+
+       t = LNetHelpers(target=la[0])
+       t1 = LNetHelpers(target=la[1])
+       try:
+               t.configure_lnet()
+               intfs = t.get_available_devs()
+               t.api_config_ni('tcp', intfs)
+
+               t1.configure_lnet()
+               intfs = t1.get_available_devs()
+               t1.api_config_ni('tcp', intfs)
+               rtr_nids = t1.list_nids()
+               if len(rtr_nids) <= 0:
+                       return lutfrc(LUTF_TEST_FAIL, msg="Failed to configure gateway")
+               tmpFile = 'rtr'+str(random.getrandbits(32)) + '.yaml'
+               tmpFile = os.path.join(lutf_tmp_dir, tmpFile)
+               tmp = LutfFile(tmpFile, target=la[0])
+               cfg =   'net:\n' + \
+                       '    - net type: tcp2\n' + \
+                       '      local NI(s):\n' + \
+                       '         - interfaces:\n' + \
+                       '              0: eth0\n' + \
+                       '           tunables:\n' + \
+                       '              peer_timeout: 180\n' + \
+                       '              peer_credits: 8\n' + \
+                       '              peer_buffer_credits: 0\n' + \
+                       '              credits: 256\n' + \
+                       '    - net type: tcp3\n' + \
+                       '      local NI(s):\n' + \
+                       '         - interfaces:\n' + \
+                       '              0: eth0\n' + \
+                       '           tunables:\n' + \
+                       '              peer_timeout: 140\n' + \
+                       '              peer_credits: 8\n' + \
+                       '              peer_buffer_credits: 0\n' + \
+                       '              credits: 1024\n' + \
+                       '    - net type: tcp4\n' + \
+                       '      local NI(s):\n' + \
+                       '         - interfaces:\n' + \
+                       '              0: eth0\n' + \
+                       '           tunables:\n' + \
+                       '              peer_timeout: 190\n' + \
+                       '              peer_credits: 16\n' + \
+                       '              peer_buffer_credits: 0\n' + \
+                       '              credits: 256\n' + \
+                       'route:\n'+ \
+                       '   - net: tcp5\n'+ \
+                       '     gateway: '+rtr_nids[0]+'\n'+ \
+                       '     hop: 4\n'+ \
+                       '     detail: 1\n'+ \
+                       '     seq_no: 1\n'+ \
+                       '   - net: tcp6\n'+ \
+                       '     gateway: '+rtr_nids[0]+'\n'+ \
+                       '     hop: 9\n'+ \
+                       '     detail: 1\n'+ \
+                       '     seq_no: 2\n'+ \
+                       '   - net: tcp7\n'+ \
+                       '     gateway: '+rtr_nids[0]+'\n'+ \
+                       '     hop: 6\n'+ \
+                       '     detail: 1\n'+ \
+                       '     seq_no: 3\n'
+               tmp.open('w')
+               tmp.write(cfg)
+               tmp.close()
+
+               t.api_yaml_cfg(tmp.get_full_path(), 8, del_count=2)
+               tmp.remove()
+               return lutfrc(LUTF_TEST_PASS)
+       except Exception as e:
+               t.uninit()
+               t1.uninit()
+               raise e
+
diff --git a/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_22.py b/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_22.py
new file mode 100644 (file)
index 0000000..6f6d5b0
--- /dev/null
@@ -0,0 +1,66 @@
+"""
+@PRIMARY: N/A
+@PRIMARY_DESC: N/A
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE: Test a simple routing setup
+"""
+
+import os, logging
+import yaml
+import lnetconfig
+from lutf import agents, me
+from lutf_basetest import *
+from lnet import TheLNet
+from lutf_exception import *
+from lnet_selftest import LNetSelfTest
+from lnet_helpers import LNetHelpers
+
+class TestTraffic:
+       def __init__(self, target=None):
+               self.st = LNetSelfTest(os.path.abspath(__file__), target=target)
+               self.lh = LNetHelpers(os.path.abspath(__file__), target=target)
+
+def run():
+       la = agents.keys()
+       if len(la) < 3:
+               return lutfrc(LUTF_TEST_SKIP, msg="Not enough agents to run routing test. 3 needed %d found" % len(la))
+
+       # setup peer A for lnet_self test
+       # setup peer B for lnet_self test
+       # setup router
+       # run lnet_selftest
+       #
+       peer1 = TestTraffic(target=la[0])
+       peer2 = TestTraffic(target=la[1])
+       rtr = TestTraffic(target=la[2])
+       try:
+               peer1.lh.configure_net('tcp')
+               peer2.lh.configure_net('tcp2')
+               peer1.st.load()
+               peer2.st.load()
+               rtr.lh.configure_net('tcp')
+               rtr.lh.configure_net('tcp2')
+               rtr.lh.api_set_routing(True)
+               rtr_nids = rtr.lh.list_nids()
+               p = '(.+?)@tcp$'
+               p1 = '(.+?)@tcp2$'
+               tcp_nids = [nid for nid in rtr_nids if re.match(p, nid)]
+               tcp2_nids = [nid for nid in rtr_nids if re.match(p1, nid)]
+               # setup the routing
+               peer1.lh.api_configure_route('tcp2', tcp_nids[0])
+               peer2.lh.api_configure_route('tcp', tcp2_nids[0])
+               peer1_nid = peer1.lh.list_nids()[0]
+               peer2_nid = peer2.lh.list_nids()[0]
+               peer1.st.start(peer1_nid, peer2_nid)
+               peer1.st.unload()
+               peer2.st.unload()
+               return lutfrc(LUTF_TEST_PASS)
+       except Exception as e:
+               peer1.st.unload()
+               peer2.st.unload()
+               peer1.lh.uninit()
+               peer2.lh.uninit()
+               rtr.lh.uninit()
+               raise e
+
diff --git a/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_23.py b/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_23.py
new file mode 100644 (file)
index 0000000..acdafcf
--- /dev/null
@@ -0,0 +1,245 @@
+"""
+@PRIMARY: N/A
+@PRIMARY_DESC: N/A
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE: Test dual router setup
+Failover to different routers and recovery when router is back up.
+"""
+
+import os, re, yaml, logging
+from time import sleep
+import lnetconfig
+from lutf import agents, me
+from lutf_basetest import *
+from lnet import TheLNet
+from lutf_exception import *
+from lnet_selftest import LNetSelfTest
+from lnet_helpers import LNetHelpers
+from lustre_node import SimpleLustreNode
+from lustre_roles import *
+import lutf_common_def as common
+
+class TestLustreTraffic:
+       def __init__(self, target=None):
+               self.lh = LNetHelpers(os.path.abspath(__file__), target=target)
+               self.sln = SimpleLustreNode(os.path.abspath(__file__), target=target)
+
+def sum_stats(stats, nid, sname):
+       fount = False
+       total = 0
+       for s in stats:
+               found = False
+               for lpni in s['peer ni']:
+                       if lpni['nid'] == nid:
+                               found = True
+                               break
+               if not found:
+                       continue
+               for lpni in s['peer ni']:
+                       total += lpni['statistics'][sname]
+                       logging.debug("summing up %s for stat %s value = %d total %d" % (lpni['nid'], sname, lpni['statistics'][sname], total))
+
+       return total
+
+def check_range(percent, cA1, cA2, cB1, cB2):
+       usageA = abs(cA2 - cA1)
+       usageB = abs(cB2 - cB1)
+       diff = abs(usageA - usageB)
+
+       if (diff / usageA) * 100 > percent:
+               if usageA > usageB:
+                       return False, 0
+               return False, 1
+
+       if (diff / usageB) * 100 > percent:
+               if usageA > usageB:
+                       return False, 0
+               return False, 1
+
+       return True, 0
+
+# return -1 if router is not being used
+# return -2 if the router is being used
+def check_routed_traffic(oss, rtr, rtr1):
+       stats = oss.sln.get_peer_stats()
+       rtr_recv_count = sum_stats(stats, rtr.sln.list_nids('tcp2')[0], 'recv_count')
+       rtr1_recv_count = sum_stats(stats, rtr1.sln.list_nids('tcp2')[0], 'recv_count')
+
+       sleep(30)
+       stats = oss.sln.get_peer_stats()
+       rtr_recv_count2 = sum_stats(stats, rtr.sln.list_nids('tcp2')[0], 'recv_count')
+       rtr1_recv_count2 = sum_stats(stats, rtr1.sln.list_nids('tcp2')[0], 'recv_count')
+
+       logging.debug('rtr_recv_count = %d rtr_recv_count2: = %d' % (rtr_recv_count, rtr_recv_count2))
+
+       if rtr_recv_count >= rtr_recv_count2:
+               return -1, rtr.sln.list_nids('tcp2')[0]
+
+       logging.debug('rtr1_recv_count = %d rtr1_recv_count2: = %d' % (rtr1_recv_count, rtr1_recv_count2))
+
+       if rtr1_recv_count >= rtr1_recv_count2:
+               return -1, rtr1.sln.list_nids('tcp2')[0]
+
+       # check that the average change in traffic are approximately
+       # equivalent
+       rc, rtr_num = check_range(20, rtr_recv_count, rtr_recv_count2, rtr1_recv_count, rtr1_recv_count2)
+       if not rc:
+               if rtr_num == 0:
+                       nid = rtr.sln.list_nids('tcp2')[0]
+               else:
+                       nid = rtr1.sln.list_nids('tcp2')[0]
+               return -2, nid
+
+       return 0, None
+
+def get_assign_roles(la):
+       client = oss = mgs = rtr = rtr1 = None
+       for a in la:
+               logging.debug('examining: ' + a)
+               if re.search('mds(.?)_HOST'.upper(), a.upper()) or re.search('mgs(.?)_HOST'.upper(), a.upper()):
+                       logging.debug('creating mds on ' + a)
+                       mgs = TestLustreTraffic(a)
+               elif re.search('ost(.?)_HOST'.upper(), a.upper()) or re.search('oss(.?)_HOST'.upper(), a.upper()):
+                       logging.debug('creating oss on ' + a)
+                       oss = TestLustreTraffic(a)
+               elif re.search('(.?)client(.?)'.upper(), a.upper()) :
+                       logging.debug('creating client on ' + a)
+                       client = TestLustreTraffic(a)
+               elif re.search('rtr(.?)_HOST'.upper(), a.upper()):
+                       if not rtr and not rtr1:
+                               logging.debug('both empty creating rtr on ' + a)
+                               rtr = TestLustreTraffic(a)
+                       elif rtr and not rtr1:
+                               logging.debug('creating rtr1 on ' + a)
+                               rtr1 = TestLustreTraffic(a)
+                       elif rtr1 and not rtr:
+                               logging.debug('creating rtr on ' + a)
+                               rtr = TestLustreTraffic(a)
+
+       return client, oss, mgs, rtr, rtr1
+
+def run():
+       la = agents.keys()
+       if len(la) < 5:
+               return lutfrc(LUTF_TEST_SKIP, msg="Not enough agents to run routing test. 5 needed %d found" % len(la))
+
+       # setup peer A for lnet_self test
+       # setup peer B for lnet_self test
+       # setup router
+       # run lnet_selftest
+       #
+
+       client, oss, mgs, rtr, rtr1 = get_assign_roles(la)
+
+       if not client or not mgs or not oss or not rtr or not rtr1:
+               return lutfrc(LUTF_TEST_SKIP, msg="Cluster provided doesn't meet the specification for this test case")
+
+       cur_to = common.get_rpc_timeout()
+
+       try:
+               common.set_rpc_timeout(500)
+               client.sln.check_down()
+               mgs.sln.check_down()
+               oss.sln.check_down()
+               rtr.sln.check_down()
+               rtr1.sln.check_down()
+
+               # setup the networks
+               client.sln.configure_net(net_map={'tcp': client.sln.list_intfs()})
+               oss.sln.configure_net(net_map={'tcp2': oss.sln.list_intfs()})
+               mgs.sln.configure_net(net_map={'tcp2': mgs.sln.list_intfs()})
+               tcp_intfs = tcp2_intfs = rtr_intfs = rtr.sln.list_intfs()
+               if len(rtr_intfs) > 1:
+                       tcp_intfs = rtr_intfs[int(len(rtr_intfs)/2):]
+                       tcp2_intfs = rtr_intfs[:int(len(rtr_intfs)/2)]
+               rtr.sln.configure_net(net_map={'tcp': tcp_intfs})
+               rtr.sln.configure_net(net_map={'tcp2': tcp2_intfs})
+
+               tcp_intfs = tcp2_intfs = rtr_intfs = rtr1.sln.list_intfs()
+               if len(rtr_intfs) > 1:
+                       tcp_intfs = rtr_intfs[int(len(rtr_intfs)/2):]
+                       tcp2_intfs = rtr_intfs[:int(len(rtr_intfs)/2)]
+               logging.debug(str(tcp_intfs))
+               logging.debug(str(tcp2_intfs))
+               logging.debug(str(rtr_intfs))
+               rtr1.sln.configure_net(net_map={'tcp': tcp_intfs})
+               rtr1.sln.configure_net(net_map={'tcp2': tcp2_intfs})
+
+               # setup the routing
+               L = TheLNet()
+               rt1 = L.make_route(rtr.sln.list_nids('tcp')[0])
+               rt2 = L.make_route(rtr1.sln.list_nids('tcp')[0])
+               logging.debug(str(rt1), str(rt2))
+               client.sln.configure_route({'tcp2': [rt1, rt2]})
+
+               rt1 = L.make_route(rtr.sln.list_nids('tcp2')[0])
+               rt2 = L.make_route(rtr1.sln.list_nids('tcp2')[0])
+               logging.debug(str(rt1), str(rt2))
+               mgs.sln.configure_route({'tcp': [rt1, rt2]})
+               oss.sln.configure_route({'tcp': [rt1, rt2]})
+
+               # commit configuration
+               rtr.sln.commit()
+               rtr.lh.api_set_routing(True)
+               rtr1.sln.commit()
+               rtr1.lh.api_set_routing(True)
+               oss.sln.commit()
+               mgs.sln.commit()
+               client.sln.commit()
+
+               # setup the cluster
+               mgs.sln.configure_lustre()
+               oss.sln.configure_lustre(mgs.sln.list_nids('tcp2')[0])
+               client.sln.configure_lustre(mgs.sln.list_nids('tcp2')[0])
+
+               # start the traffic
+               client.sln.start_traffic(runtime=300)
+
+               # let traffic run for 100 seconds
+               sleep(100)
+
+               rc, nid = check_routed_traffic(oss, rtr, rtr1)
+               if rc == -1:
+                       raise LUTFError("router %s is not being used" % (nid))
+               if rc == -2:
+                       raise LUTFError("asymmetric use of routers")
+
+               # turn off one of the routers:
+               rtr1.lh.api_set_routing(False)
+
+               # wait for a bit
+               sleep(100)
+               rc, nid = check_routed_traffic(oss, rtr, rtr1)
+               if rc == 0:
+                       raise LUTFError("1. router %s is still being used" % (str(rtr.sln.list_nids('tcp2'))))
+
+               if rc == -1 and nid != rtr1.sln.list_nids('tcp2'):
+                       raise LUTFError("2. router %s is still being used" % (str(rtr1.sln.list_nids('tcp2'))))
+
+               if rc == -2 and nid in rtr1.sln.list_nids('tcp2'):
+                       raise LUTFError("3. router %s:%s is still being used" % (str(nid), str(rtr1.sln.list_nids('tcp2'))))
+
+               client.sln.stop_traffic()
+               # unconfigure the file system
+               client.sln.unconfigure_lustre()
+               oss.sln.unconfigure_lustre()
+               mgs.sln.unconfigure_lustre()
+               common.set_rpc_timeout(cur_to)
+               return lutfrc(LUTF_TEST_PASS)
+       except Exception as e:
+               client.sln.stop_traffic()
+               logging.debug("Handling exception... unconfigure")
+               logging.debug("Handling exception... unconfiguring Lustre")
+               client.sln.unconfigure_lustre()
+               oss.sln.unconfigure_lustre()
+               mgs.sln.unconfigure_lustre()
+               logging.debug("Handling exception... uninitialize")
+               client.lh.uninit()
+               oss.lh.uninit()
+               mgs.lh.uninit()
+               rtr.lh.uninit()
+               rtr1.lh.uninit()
+               common.set_rpc_timeout(cur_to)
+               raise e
+
diff --git a/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_24.py b/lustre/tests/lutf/python/tests/suite_dlc/test_dlc_libconfig_24.py
new file mode 100644 (file)
index 0000000..ea56ad0
--- /dev/null
@@ -0,0 +1,37 @@
+"""
+@PRIMARY: N/A
+@PRIMARY_DESC: N/A
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE: test malconfigured yaml
+"""
+
+
+import os
+import yaml
+from lutf import agents, me
+from lutf_basetest import BaseTest
+import lnet
+
+class SampleTest(BaseTest):
+       def __init__(self, target=None):
+               super().__init__(os.path.abspath(__file__),
+                                target=target)
+
+       def simple_lnet_configure(self):
+               L = lnet.TheLNet()
+               L.nets['tcp'] = [{'interfaces': 'eth0', 'peer_credits': 128},
+                                {'interfaces': 'eth1', 'peer_credits': 128}]
+               L.configure()
+               L1 = lnet.TheLNet()
+               L1.update()
+               if not L1.nets == L.nets:
+                       return False
+               return True
+
+def run():
+       test = SampleTest()
+       rc = test.simple_lnet_configure()
+       return test.format(step1=rc)
+
+
diff --git a/lustre/tests/lutf/python/tests/suite_samples/callbacks.py b/lustre/tests/lutf/python/tests/suite_samples/callbacks.py
new file mode 100644 (file)
index 0000000..d02f7e2
--- /dev/null
@@ -0,0 +1,6 @@
+from lnet_cleanup import clean_lnet
+from lustre_cleanup import clean_lustre
+
+def lutf_clean_setup():
+       clean_lustre()
+       clean_lnet()
diff --git a/lustre/tests/lutf/python/tests/suite_samples/test_sample_01.py b/lustre/tests/lutf/python/tests/suite_samples/test_sample_01.py
new file mode 100644 (file)
index 0000000..70207ac
--- /dev/null
@@ -0,0 +1,13 @@
+"""
+@PRIMARY: s01
+@PRIMARY_DESC: Illustrate the run() function needed by the LUTF to execute the script.
+@SECONDARY: s02
+@DESIGN: N/A
+@TESTCASE: Print a message and return success
+"""
+
+from lutf_basetest import *
+
+def run():
+       print("Hello Lustre")
+       return lutfrc(LUTF_TEST_PASS)
diff --git a/lustre/tests/lutf/python/tests/suite_samples/test_sample_01_1.py b/lustre/tests/lutf/python/tests/suite_samples/test_sample_01_1.py
new file mode 100644 (file)
index 0000000..27bbe26
--- /dev/null
@@ -0,0 +1,15 @@
+"""
+@PRIMARY: s02
+@PRIMARY_DESC: Illustrate the lutfrc() function and how it's used to return values to be stored in the
+global results database.
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE: return success and 2 key/value pairs
+"""
+
+from lutf_basetest import lutfrc
+import datetime
+
+def run():
+       print("Hello Lustre")
+       return lutfrc(0, name='Lustre', date=datetime.datetime.now())
diff --git a/lustre/tests/lutf/python/tests/suite_samples/test_sample_02.py b/lustre/tests/lutf/python/tests/suite_samples/test_sample_02.py
new file mode 100644 (file)
index 0000000..cc16f08
--- /dev/null
@@ -0,0 +1,37 @@
+"""
+@PRIMARY: s03
+@PRIMARY_DESC: Illustrate remote execution of class methods
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE: Collect the interfaces of an available remote node and perform a sum.
+Return the interfaces and the sum to be stored on the master
+"""
+
+import yaml, logging, os
+from lutf import agents, me
+from lutf_basetest import *
+from lutf_exception import LUTFError
+
+class SampleTest(BaseTest):
+       def __init__(self, target=None):
+               super().__init__(os.path.abspath(__file__),
+                                target=target)
+
+       def get_intfs_and_add(self, a, b):
+               myintf = me.list_intfs()
+               sum = a + b
+               return sum, myintf
+
+def run():
+       la = agents.keys()
+       if len(la) >= 1:
+               logging.debug("Trying to execute on the agent")
+               t = SampleTest(target=la[0])
+               sum, intfs = t.get_intfs_and_add(3,6)
+               print(yaml.dump(intfs, sort_keys=False))
+       else:
+               raise LUTFError("No agents available to run test")
+
+       return lutfrc(LUTF_TEST_PASS, intfs=yaml.dump(intfs, sort_keys=False), sum=sum)
+
+
diff --git a/lustre/tests/lutf/python/tests/suite_samples/test_sample_03.py b/lustre/tests/lutf/python/tests/suite_samples/test_sample_03.py
new file mode 100644 (file)
index 0000000..3d127f7
--- /dev/null
@@ -0,0 +1,39 @@
+"""
+@PRIMARY: s04
+@PRIMARY_DESC: Illustrate the LNet wrapper class and how it can be used to configure networks
+and compare the requested configuration with the actual configuration
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE: Setup an LNet instance, L, with a tcp network and 2 interfaces eth0 and eth1
+Setup a second LNet instance, L1, to be updated with what has actually been configured
+Compare both instances. If they are the same then the test succeeded. Otherwise Failed
+"""
+
+import os
+import yaml
+from lutf import agents, me
+from lutf_basetest import *
+import lnet
+
+class SampleTest(BaseTest):
+       def __init__(self, target=None):
+               super().__init__(os.path.abspath(__file__),
+                                target=target)
+
+       def simple_lnet_configure(self):
+               L = lnet.TheLNet()
+               L.nets['tcp'] = [{'interfaces': 'eth0', 'peer_credits': 128, 'peer_timeout': 180, 'peer_buffer_credits': 0, 'credits': 256},
+                                {'interfaces': 'eth1', 'peer_credits': 128, 'peer_timeout': 180, 'peer_buffer_credits': 0, 'credits': 256}]
+               L.configure()
+               L1 = lnet.TheLNet()
+               L1.update()
+               if not L1.nets == L.nets:
+                       return False
+               return True
+
+def run():
+       test = SampleTest()
+       rc = test.simple_lnet_configure()
+       return lutfrc(LUTF_TEST_PASS, step1=rc)
+
+
diff --git a/lustre/tests/lutf/python/tests/suite_samples/test_sample_04.py b/lustre/tests/lutf/python/tests/suite_samples/test_sample_04.py
new file mode 100644 (file)
index 0000000..28c5135
--- /dev/null
@@ -0,0 +1,34 @@
+"""
+@PRIMARY: s04
+@PRIMARY_DESC: Illustrate how LUTFError, exceptions, can be propagated from the remote
+to the master. And how they are stored in the results data base.
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE: raise an LUTFError exception on the remote
+"""
+
+import os
+from lutf import agents, me
+from lutf_basetest import *
+from lutf_exception import LUTFError
+import logging
+
+class SampleTestRException(BaseTest):
+       def __init__(self, target=None):
+               super().__init__(os.path.abspath(__file__),
+                                target=target)
+
+       def raiseAnException(self):
+               LUTFError("raising Exception on %s" % (me.my_hostname()))
+
+def run():
+       la = agents.keys()
+       if len(la) >= 1:
+               logging.debug("Trying to execute on the agent")
+               t = SampleTestRException(target=la[0])
+               rc = t.raiseAnException()
+       else:
+               raise LUTFError("No agents available to run test")
+
+       return lutfrc(LUTF_TEST_FAIL)
+
diff --git a/lustre/tests/lutf/python/tests/suite_samples/test_sample_04_1.py b/lustre/tests/lutf/python/tests/suite_samples/test_sample_04_1.py
new file mode 100644 (file)
index 0000000..0a24a36
--- /dev/null
@@ -0,0 +1,34 @@
+"""
+@PRIMARY: s06
+@PRIMARY_DESC: Illustrate how python excepted are propagated from the remote
+to the master. And how they are stored in the results data base.
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE: access an undefined variable on the remote
+"""
+
+import os
+from lutf import agents
+from lutf_basetest import *
+from lutf_exception import LUTFError
+import logging
+
+class SampleTestRException(BaseTest):
+       def __init__(self, target=None):
+               super().__init__(os.path.abspath(__file__),
+                                target=target)
+
+       def raiseAnException(self):
+               print(a)
+
+def run():
+       la = agents.keys()
+       if len(la) >= 1:
+               logging.debug("Trying to execute on the agent")
+               t = SampleTestRException(target=la[0])
+               rc = t.raiseAnException()
+       else:
+               raise LUTFError("No agents available to run test")
+
+       return lutfrc(LUTF_TEST_FAIL, rc)
+
diff --git a/lustre/tests/lutf/python/tests/suite_samples/test_sample_05.py b/lustre/tests/lutf/python/tests/suite_samples/test_sample_05.py
new file mode 100644 (file)
index 0000000..ddf367a
--- /dev/null
@@ -0,0 +1,38 @@
+"""
+@PRIMARY: s07
+@PRIMARY_DESC: Illustrate how an instance of a class can be propagated from the remote
+to the master.
+@SECONDARY: N/A
+@DESIGN: N/A
+@TESTCASE: Instantiate a class on the remote and return it to the master
+"""
+import os
+from lutf import agents
+from lutf_basetest import *
+from lutf_exception import LUTFError
+import logging
+
+class SampleRCclass():
+       def __init__(self, num):
+               self.num = num
+
+class SampleTest(BaseTest):
+       def __init__(self, target=None):
+               super().__init__(os.path.abspath(__file__),
+                                target=target)
+
+       def instantiate(self):
+               obj = SampleRCclass(2020)
+               return obj
+
+def run():
+       la = agents.keys()
+       if len(la) >= 1:
+               logging.debug("Trying to execute on the agent")
+               t = SampleTest(target=la[0])
+               obj = t.instantiate()
+       else:
+               raise LUTFError("No agents available to run test")
+
+       return lutfrc(LUTF_TEST_PASS, num=obj.num)
+