sonic-net / sonic-mgmt

Configuration management examples for SONiC
Other
173 stars 689 forks source link

multi-asic qos-sai: conftest.py needs to be updated for multi-asic platforms #8279

Open rraghav-cisco opened 1 year ago

rraghav-cisco commented 1 year ago

We see this code in qos/conftest.py, this fails in multi-asic platforms, since redis-cli needs the asic info as well:

@pytest.fixture(scope="function")
 67 def nearbySourcePorts(duthost, mg_facts, singleMemberPort):
 68     # Find 2 appropriate source ports, starting from the lowest IDs for testing
 69     # consistency, and avoiding the singleMemberPort
 70     ports_and_ids = mg_facts["minigraph_port_indices"].items()
 71     ports_and_ids.sort(key=lambda tup: tup[1])
 72     all_ports = [tup[0] for tup in ports_and_ids]
 73     # Remove extra ports that are in same lag
 74     for lag_dict in mg_facts["minigraph_portchannels"].values():
 75         for extra_lag_member in lag_dict["members"][1:]:
 76             all_ports.remove(extra_lag_member)
 77     all_ports.remove(singleMemberPort)
 78     # Find nearby ports
 79     nearby_ports = []
 80     single_slc = None
 81     for intf in all_ports:
 82         lanes = duthost.shell('redis-cli -n 4 hget "PORT|{}" lanes'.format(intf))['stdout'].split(',')
 83         assert len(lanes) > 0, "Lanes not found for port {}".format(port)
 84         slc = int(lanes[0]) >> 9
 85         if single_slc == None:
 86             single_slc = slc
 87             nearby_ports.append(intf)
 88         elif slc == single_slc:
 89             nearby_ports.append(intf)
 90             break
 91     assert len(nearby_ports) >= 2, "Failed to find 2 nearby ports, found {}".format(str(nearby_ports))
 92     nearby_port_id_1 = mg_facts["minigraph_port_indices"][nearby_ports[0]]
 93     nearby_port_id_2 = mg_facts["minigraph_port_indices"][nearby_ports[1]]
 94     yield (nearby_port_id_1, nearby_port_id_2)
rraghav-cisco commented 1 year ago

@vmittal-msft , @rbpittman : FYI

rraghav-cisco commented 1 year ago

This causes the LossyQueueVoq tests to ERROR out.

sonic@sonic-ucs-m5-4:~/test_logs/rraghav$ egrep "ERROR.*teardown ==" qos-masic.log 
ERRORINFO:SectionStartLogger:==================== qos/test_qos_sai.py::TestQosSai::testQosSaiLosslessVoq[single_asic-lossless_voq_1] teardown ====================
ERRORINFO:SectionStartLogger:==================== qos/test_qos_sai.py::TestQosSai::testQosSaiLosslessVoq[single_asic-lossless_voq_2] teardown ====================
ERRORINFO:SectionStartLogger:==================== qos/test_qos_sai.py::TestQosSai::testQosSaiLosslessVoq[single_asic-lossless_voq_3] teardown ====================
ERRORINFO:SectionStartLogger:==================== qos/test_qos_sai.py::TestQosSai::testQosSaiLosslessVoq[single_asic-lossless_voq_4] teardown ====================
sonic@sonic-ucs-m5-4:~/test_logs/rraghav$