Skip to content

Commit

Permalink
update skip conditions for watermark cases (#16056)
Browse files Browse the repository at this point in the history
Description of PR
Summary:
Fixes # (issue)
Double commit #15352

Type of change
 Bug fix
 Testbed and Framework(new/improvement)
 Test case(new/improvement)

Signed-off-by: Zhixin Zhu <[email protected]>
  • Loading branch information
zhixzhu authored Dec 13, 2024
1 parent 87094cd commit ae8c797
Showing 1 changed file with 38 additions and 9 deletions.
47 changes: 38 additions & 9 deletions tests/qos/test_qos_sai.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,22 @@ def check_skip_shared_res_test(
" Pls see qos.yaml for the port idx's that are needed.")


def get_portspeed_cablelen(asic_instance):
config_facts = asic_instance.config_facts(source="running")["ansible_facts"]
buffer_pg = config_facts["BUFFER_PG"]
for intf, value_of_intf in buffer_pg.items():
if "Ethernet-BP" in intf:
continue
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 port speed cable length")
return m.group(1)
return ""


class TestQosSai(QosSaiBase):
"""TestQosSai derives from QosSaiBase and contains collection of QoS SAI test cases.
Expand Down Expand Up @@ -1062,7 +1078,8 @@ def testQosSaiHeadroomPoolWatermark(
@pytest.mark.parametrize("bufPool", ["wm_buf_pool_lossless", "wm_buf_pool_lossy"])
def testQosSaiBufferPoolWatermark(
self, request, get_src_dst_asic_and_duts, bufPool, ptfhost, dutTestParams, dutConfig, dutQosConfig,
ingressLosslessProfile, egressLossyProfile, resetWatermark, _skip_watermark_multi_DUT
ingressLosslessProfile, egressLossyProfile, resetWatermark,
skip_src_dst_different_asic
):
"""
Test QoS SAI Queue buffer pool watermark for lossless/lossy traffic
Expand Down Expand Up @@ -1093,6 +1110,12 @@ def testQosSaiBufferPoolWatermark(

portSpeedCableLength = dutQosConfig["portSpeedCableLength"]
if "wm_buf_pool_lossless" in bufPool:
if dutTestParams["basicParams"]["sonic_asic_type"] == 'cisco-8000':
dstPortSpeedCableLength = get_portspeed_cablelen(
get_src_dst_asic_and_duts['dst_asic'])
if dstPortSpeedCableLength != portSpeedCableLength:
pytest.skip("Skip buffer pool watermark lossless test since port speed "
"cable length is different between src and dst asic")
qosConfig = dutQosConfig["param"][portSpeedCableLength]
triggerDrop = qosConfig[bufPool]["pkts_num_trig_pfc"]
fillMin = qosConfig[bufPool]["pkts_num_fill_ingr_min"]
Expand Down Expand Up @@ -1591,7 +1614,7 @@ def testQosSaiDwrr(
@pytest.mark.parametrize("pgProfile", ["wm_pg_shared_lossless", "wm_pg_shared_lossy"])
def testQosSaiPgSharedWatermark(
self, pgProfile, ptfhost, get_src_dst_asic_and_duts, dutTestParams, dutConfig, dutQosConfig,
resetWatermark, _skip_watermark_multi_DUT, skip_src_dst_different_asic
resetWatermark, skip_src_dst_different_asic
):
"""
Test QoS SAI PG shared watermark test for lossless/lossy traffic
Expand Down Expand Up @@ -1635,6 +1658,12 @@ def testQosSaiPgSharedWatermark(
pytest.skip(
"PGSharedWatermark: Lossy test is not applicable in "
"cisco-8000 Q100 platform.")
if not get_src_dst_asic_and_duts['single_asic_test'] and \
dutTestParams["basicParams"].get("platform_asic", None) \
== "cisco-8000":
pytest.skip(
"PGSharedWatermark: Lossy test is not applicable in "
"cisco-8000 multi_asic scenarios.")
pktsNumFillShared = int(
qosConfig[pgProfile]["pkts_num_trig_egr_drp"]) - 1

Expand Down Expand Up @@ -1793,7 +1822,7 @@ def testQosSaiPGDrop(
@pytest.mark.parametrize("queueProfile", ["wm_q_shared_lossless", "wm_q_shared_lossy"])
def testQosSaiQSharedWatermark(
self, get_src_dst_asic_and_duts, queueProfile, ptfhost, dutTestParams, dutConfig, dutQosConfig,
resetWatermark, _skip_watermark_multi_DUT, skip_pacific_dst_asic
resetWatermark, skip_src_dst_different_asic, skip_pacific_dst_asic
):
"""
Test QoS SAI Queue shared watermark test for lossless/lossy traffic
Expand All @@ -1816,18 +1845,18 @@ def testQosSaiQSharedWatermark(
portSpeedCableLength = dutQosConfig["portSpeedCableLength"]

if queueProfile == "wm_q_shared_lossless":
if dutTestParams["basicParams"]["sonic_asic_type"] == 'cisco-8000':
dstPortSpeedCableLength = get_portspeed_cablelen(
get_src_dst_asic_and_duts['dst_asic'])
if dstPortSpeedCableLength != portSpeedCableLength:
pytest.skip("Skip queue watermark lossless test since port speed "
"cable length is different between src and dst asic")
if dutTestParams['hwsku'] in self.BREAKOUT_SKUS and 'backend' not in dutTestParams['topo']:
qosConfig = dutQosConfig["param"][portSpeedCableLength]["breakout"]
else:
qosConfig = dutQosConfig["param"][portSpeedCableLength]
triggerDrop = qosConfig[queueProfile]["pkts_num_trig_ingr_drp"]
else:
if not get_src_dst_asic_and_duts['single_asic_test'] and \
dutTestParams["basicParams"].get("platform_asic", None) \
== "cisco-8000":
pytest.skip(
"Lossy test is not applicable in multiple ASIC case"
" in cisco-8000 platform.")
if queueProfile in list(dutQosConfig["param"][portSpeedCableLength].keys()):
qosConfig = dutQosConfig["param"][portSpeedCableLength]
else:
Expand Down

0 comments on commit ae8c797

Please sign in to comment.