3 @PRIMARY_DESC: Verify that local nid can be prioritized for sending via UDSP
7 - configure one lnet and more than one nid
8 - turn on LNet discovery
10 - verify that udsp list is empty
11 - add udsp rule that gives one of the local nids higher priority
12 - get lnet stats (lnetctl net show -v 4)
13 - generate traffic by running lnetctl ping multiple times
14 - get lnet stats again
15 - verify that all sends were done using the prioritized nid
21 from lutf import agents, me
22 from lutf_basetest import *
23 from lnet import TheLNet
24 from lutf_exception import LUTFError
25 from lnet_helpers import LNetHelpers
26 from lustre_node import SimpleLustreNode
35 class TestLustreTraffic:
36 def __init__(self, target=None):
37 self.lh = LNetHelpers(os.path.abspath(__file__), target=target)
38 self.sln = SimpleLustreNode(os.path.abspath(__file__), target=target)
42 if len(la) < MIN_NODES:
43 return lutfrc(LUTF_TEST_SKIP, "Not enough agents to run the test")
46 for i in range(0, MIN_NODES):
47 node = TestLustreTraffic(la[i])
49 intfs = t.get_available_devs()
50 if len(intfs) < MIN_IFS_PER_NODE:
51 return lutfrc(LUTF_TEST_SKIP, "Not enough interfaces")
52 if not t.check_udsp_present():
53 return lutfrc(LUTF_TEST_SKIP, "UDSP feature is missing")
55 t.configure_net(LOCAL_NET, intfs)
61 main_nids = main.lh.list_nids()
63 agent_nids = agent.lh.list_nids()
65 rc = main.lh.check_udsp_empty()
67 print("UDSP list not empty")
68 return lutfrc(LUTF_TEST_FAIL)
69 rc = main.lh.exec_udsp_cmd(" add --src "+main_nids[USE_NID_NUM])
70 #rc = main.lh.exec_udsp_cmd("
72 before_stats_main = main.sln.get_lnet().get_net_stats()
73 print(before_stats_main)
75 for i in range(0, PING_TIMES):
76 rc = main.lh.exec_ping(agent_nids[PING_NID_NUM])
79 return lutfrc(LUTF_TEST_FAIL)
81 after_stats_main = main.sln.get_lnet().get_net_stats()
82 print(after_stats_main)
84 send_count_before = -1
86 for x in before_stats_main:
87 if (x['net type'] == LOCAL_NET):
88 for y in x['local NI(s)']:
89 if y['nid'] == main_nids[USE_NID_NUM]:
90 send_count_before = y['statistics']['send_count']
91 for x in after_stats_main:
92 if (x['net type'] == LOCAL_NET):
93 for y in x['local NI(s)']:
94 if y['nid'] == main_nids[USE_NID_NUM]:
95 send_count_after = y['statistics']['send_count']
96 if send_count_before < 0 or send_count_after < 0:
97 print("failed to parse net stats")
98 return lutfrc(LUTF_TEST_FAIL)
100 if send_count_after - send_count_before < PING_TIMES:
101 print("Unexpected number of sends: ", send_count_after - send_count_before)
102 return lutfrc(LUTF_TEST_FAIL)
105 n.lh.unconfigure_lnet()
107 return lutfrc(LUTF_TEST_PASS)
108 except Exception as e: