Skip to content
Merged
5 changes: 3 additions & 2 deletions tests/platform_tests/test_auto_negotiation.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ def recover_ports(duthosts, enum_dut_portname_module_fixture, fanouthosts):
logger.info('Collecting existing port configuration for DUT and fanout...')
for duthost in duthosts:
if dutname == 'unknown' or dutname == duthost.hostname:
all_ports = build_test_candidates(duthost, fanouthosts, portname)
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will get a list that contains only 1 port by this way.
If we want to enumerate all ports, we have to put "all_ports" in it parameter list.

all_ports = build_test_candidates(duthost, fanouthosts, 'all_ports')
all_ports_len = len(all_ports)
# Test all ports takes too much time (sometimes more than an hour),
# so we choose 3 ports randomly as the cadidates ports
cadidate_test_ports[duthost] = random.sample(all_ports, 3)
cadidate_test_ports[duthost] = random.sample(all_ports, 3 if all_ports_len > 3 else all_ports_len)
for _, fanout, fanout_port in cadidate_test_ports[duthost]:
auto_neg_mode = fanout.get_auto_negotiation_mode(fanout_port)
speed = fanout.get_speed(fanout_port)
Expand Down