Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[action] [PR:14746] MIGSMSFT-647 improve qos/test_qos_sai.py to have different longlink/shortlink combinations #14821

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 42 additions & 3 deletions tests/qos/qos_sai_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,10 @@ def swapSyncd_on_selected_duts(self, request, duthosts, get_src_dst_asic_and_dut
docker.restore_default_syncd(duthost, new_creds)

@pytest.fixture(scope='class', name="select_src_dst_dut_and_asic",
params=("single_asic", "single_dut_multi_asic", "multi_dut"))
params=["single_asic", "single_dut_multi_asic",
"multi_dut_longlink_to_shortlink",
"multi_dut_shortlink_to_shortlink",
"multi_dut_shortlink_to_longlink"])
def select_src_dst_dut_and_asic(self, duthosts, request, tbinfo, lower_tor_host): # noqa F811
test_port_selection_criteria = request.param
logger.info("test_port_selection_criteria is {}".format(test_port_selection_criteria))
Expand Down Expand Up @@ -642,8 +645,29 @@ def select_src_dst_dut_and_asic(self, duthosts, request, tbinfo, lower_tor_host)
if (len(duthosts.frontend_nodes)) < 2:
pytest.skip("Don't have 2 frontend nodes - so can't run multi_dut tests")

src_dut_index = 0
dst_dut_index = 1
number_of_duts = len(duthosts.frontend_nodes)
is_longlink_list = [False] * number_of_duts
for i in range(number_of_duts):
if self.isLonglink(duthosts.frontend_nodes[i]):
is_longlink_list[i] = True

if test_port_selection_criteria == 'multi_dut_shortlink_to_shortlink':
if is_longlink_list.count(False) < 2:
pytest.skip("Don't have 2 shortlink frontend nodes - so can't run {}"
"tests".format(test_port_selection_criteria))
src_dut_index = is_longlink_list.index(False)
dst_dut_index = is_longlink_list.index(False, src_dut_index + 1)
else:
if is_longlink_list.count(False) == 0 or is_longlink_list.count(True) == 0:
pytest.skip("Don't have longlink or shortlink frontend nodes - so can't"
"run {} tests".format(test_port_selection_criteria))
if test_port_selection_criteria == 'multi_dut_longlink_to_shortlink':
src_dut_index = is_longlink_list.index(True)
dst_dut_index = is_longlink_list.index(False)
else:
src_dut_index = is_longlink_list.index(False)
dst_dut_index = is_longlink_list.index(True)

src_asic_index = 0
dst_asic_index = 0

Expand Down Expand Up @@ -2409,3 +2433,18 @@ def tc_to_dscp_count(self, get_src_dst_asic_and_duts):
for dscp, tc in dscp_to_tc_map.items():
tc_to_dscp_count_map[int(tc)] += 1
yield tc_to_dscp_count_map

def isLonglink(self, dut_host):
config_facts = dut_host.asics[0].config_facts(source="running")["ansible_facts"]
buffer_pg = config_facts["BUFFER_PG"]
for intf, value_of_intf in buffer_pg.items():
for _, v in value_of_intf.items():
if "pg_lossless" in v['profile']:
profileName = v['profile']
logger.info("Lossless Buffer profile is {}".format(profileName))
m = re.search("^pg_lossless_[0-9]+_([0-9]+)m_profile", profileName)
pytest_assert(m.group(1), "Cannot find cable length")
cable_length = int(m.group(1))
if cable_length >= 120000:
return True
return False
Loading