6 @TESTCASE: - MR Node with more than two interface, P1..Pn
7 - MR Peers with more than one interface
8 - Ping all the peers from the node
9 - Verify that node sees different peers per NID
10 - Discover all the peers' first NID from the node
11 - Verify that node sees one MR peer with all its NIDS
17 from lutf import agents, me
18 from lutf_basetest import *
19 from lnet import TheLNet
20 from lutf_exception import LUTFError
21 from lnet_helpers import LNetHelpers
22 from lutf_file import LutfFile
27 return lutfrc(LUTF_TEST_SKIP, "Not enough agents to run the test")
30 # configure all the nodes
31 for i in range(0, len(la)):
32 t = LNetHelpers(target=la[i])
33 intfs = t.get_available_devs()
35 return lutfrc(LUTF_TEST_SKIP, "Not enough interfaces")
37 t.configure_net('tcp', intfs)
41 # ping all the nodes from main
43 main_prim_nid = main.list_nids()[0]
45 for i in range(1, len(helpers)):
46 actual_nids = helpers[i].list_nids()
47 total_nids += len(actual_nids)
48 for nid in actual_nids:
49 if len(main.ping(nid)) == 0:
50 return lutfrc(LUTF_TEST_FAIL, "unable to ping" ,
53 # check that the peers created
54 peers = main.get_peers()
55 if len(peers['peer']) != total_nids:
56 return lutfrc(LUTF_TEST_FAIL, "1. unexpected number of peers" ,
57 peers=peers, expected_num_peers=len(peers), actual_num_peers=total_nids)
59 for peer in peers['peer']:
60 prim_nids.append(peer['primary nid'])
61 for i in range(1, len(helpers)):
62 actual_nids = helpers[i].list_nids()
63 for nid in actual_nids:
64 if not nid in prim_nids:
65 return lutfrc(LUTF_TEST_FAIL, "unexpected peer set" ,
66 actual_nids=actual_nids, prim_nids=prim_nids)
68 # discover all the peers from main
69 for i in range(1, len(helpers)):
70 actual_nids = helpers[i].list_nids()
71 if len(main.discover(actual_nids[0])) == 0:
72 return lutfrc(LUTF_TEST_FAIL, "unable to discover" ,
73 target=actual_nids[0])
75 # make sure the peers is what we'd expect
76 peers = main.get_peers()
77 if len(peers['peer']) != len(helpers) - 1:
78 return lutfrc(LUTF_TEST_FAIL, "2. unexpected number of peers" ,
79 peers=peers, expected_num_peers=len(peers), actual_num_peers=len(helpers)-1)
80 for i in range(1, len(helpers)):
81 actual_nids = helpers[i].list_nids()
82 for peer in peers['peer']:
83 if peer['primary nid'] == actual_nids[0] and \
84 len(peer['peer ni']) != len(actual_nids):
85 return lutfrc(LUTF_TEST_FAIL, "3. unexpected number of peers",
86 peers=peers, peer_nids=actual_nids)
87 elif peer['primary nid'] == actual_nids[0]:
88 for ni in peer['peer ni']:
89 if not ni['nid'] in actual_nids:
90 return lutfrc(LUTF_TEST_FAIL, "unexpected peer nid",
91 unkown_nid=ni['nid'], actual_nids=actual_nids)
96 return lutfrc(LUTF_TEST_PASS)
97 except Exception as e: