Whamcloud - gitweb
LU-10973 lnet: LUTF UDSP test suite and routing test suite
[fs/lustre-release.git] / lustre / tests / lutf / python / tests / suite_udsp / test_udsp_basic_05.py
1 """
2 @PRIMARY: N/A
3 @PRIMARY_DESC: Verify that UDSP rule designating src-dst nid pair can be added
4 @SECONDARY: N/A
5 @DESIGN: N/A
6 @TESTCASE:
7 - configure LNet
8 - add udsp rule designating a source-destination nid pair
9 - verify that the rule has been added
10 """
11
12 import os
13 import yaml
14 import lnetconfig
15 from lutf import agents, me
16 from lutf_basetest import *
17 from lnet import TheLNet
18 from lutf_exception import LUTFError
19 from lnet_helpers import LNetHelpers
20 from lutf_cmd import lutf_exec_local_cmd
21
22
23 test_action_list = [{'udsp_cmd': "add --src 192.168.122.1@tcp1 --dst 192.168.122.101@tcp1",
24                      'show_res': {'udsp': [{'idx': 0, 'src': '192.168.122.1@tcp1', 'dst': '192.168.122.101@tcp1', 'rte': 'NA'}]}}]
25
26 def run():
27         la = agents.keys()
28         if len(la) < 1:
29                 return lutfrc(LUTF_TEST_SKIP, "No agents to run test")
30         try:
31                 t = LNetHelpers(target=la[0])
32                 t.configure_lnet()
33                 if not t.check_udsp_present():
34                         return lutfrc(LUTF_TEST_SKIP, "UDSP feature is missing")
35                 rc = t.check_udsp_empty()
36                 if not rc:
37                         return lutfrc(LUTF_TEST_FAIL)
38                 rc = t.exec_udsp_cmd(test_action_list[0]['udsp_cmd'])
39                 rc = t.check_udsp_expected(test_action_list[0]['show_res'])
40                 if not rc:
41                         return lutfrc(LUTF_TEST_FAIL)
42                 rc = t.cleanup_udsp()
43                 return lutfrc(LUTF_TEST_PASS)
44         except Exception as e:
45                 t.uninit()
46                 raise e
47
48