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

Update WRR test to support qos remapping #6737

Merged
merged 3 commits into from
Nov 11, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 8 additions & 0 deletions tests/qos/files/qos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1470,6 +1470,7 @@ qos_params:
q4_num_of_pkts: 150
q5_num_of_pkts: 140
q6_num_of_pkts: 140
q7_num_of_pkts: 140
limit: 80
wrr_chg:
ecn: 1
Expand All @@ -1480,6 +1481,7 @@ qos_params:
q4_num_of_pkts: 300
q5_num_of_pkts: 80
q6_num_of_pkts: 80
q7_num_of_pkts: 80
limit: 80
lossy_weight: 8
lossless_weight: 30
Expand Down Expand Up @@ -1668,6 +1670,7 @@ qos_params:
q4_num_of_pkts: 150
q5_num_of_pkts: 140
q6_num_of_pkts: 140
q7_num_of_pkts: 140
limit: 80
wrr_chg:
ecn: 1
Expand All @@ -1678,6 +1681,7 @@ qos_params:
q4_num_of_pkts: 300
q5_num_of_pkts: 80
q6_num_of_pkts: 80
q7_num_of_pkts: 80
limit: 80
lossy_weight: 8
lossless_weight: 30
Expand Down Expand Up @@ -1860,6 +1864,7 @@ qos_params:
q4_num_of_pkts: 150
q5_num_of_pkts: 140
q6_num_of_pkts: 140
q7_num_of_pkts: 140
limit: 80
wrr_chg:
ecn: 1
Expand All @@ -1870,6 +1875,7 @@ qos_params:
q4_num_of_pkts: 300
q5_num_of_pkts: 80
q6_num_of_pkts: 80
q7_num_of_pkts: 80
limit: 80
lossy_weight: 8
lossless_weight: 30
Expand Down Expand Up @@ -2017,6 +2023,7 @@ qos_params:
q4_num_of_pkts: 150
q5_num_of_pkts: 140
q6_num_of_pkts: 140
q7_num_of_pkts: 140
limit: 80
wrr_chg:
ecn: 1
Expand All @@ -2027,6 +2034,7 @@ qos_params:
q4_num_of_pkts: 300
q5_num_of_pkts: 80
q6_num_of_pkts: 80
q7_num_of_pkts: 80
limit: 80
lossy_weight: 8
lossless_weight: 30
Expand Down
2 changes: 2 additions & 0 deletions tests/qos/qos_sai_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ def runPtfTest(self, ptfhost, testCase='', testParams={}):
"remote",
"-t",
";".join(["{}={}".format(k, repr(v)) for k, v in testParams.items()]),
"--qlen",
"10000",
"--disable-ipv6",
"--disable-vxlan",
"--disable-geneve",
Expand Down
12 changes: 9 additions & 3 deletions tests/qos/test_qos_sai.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from tests.common.fixtures.ptfhost_utils import copy_saitests_directory # lgtm[py/unused-import]
from tests.common.fixtures.ptfhost_utils import change_mac_addresses # lgtm[py/unused-import]
from tests.common.fixtures.ptfhost_utils import ptf_portmap_file # lgtm[py/unused-import]
from tests.common.dualtor.dual_tor_utils import dualtor_ports # lgtm[py/unused-import]
from tests.common.dualtor.dual_tor_utils import dualtor_ports, is_tunnel_qos_remap_enabled # lgtm[py/unused-import]
from tests.common.helpers.pfc_storm import PFCStorm
from tests.pfcwd.files.pfcwd_helper import set_pfc_timers, start_wd_on_ports
from qos_sai_base import QosSaiBase
Expand Down Expand Up @@ -843,13 +843,14 @@ def testQosSaiDot1pPgMapping(
)

def testQosSaiDwrr(
self, ptfhost, dutTestParams, dutConfig, dutQosConfig,
self, ptfhost, duthost, dutTestParams, dutConfig, dutQosConfig,
):
"""
Test QoS SAI DWRR

Args:
ptfhost (AnsibleHost): Packet Test Framework (PTF)
duthost (AnsibleHost): The DUT for testing
dutTestParams (Fixture, dict): DUT host test params
dutConfig (Fixture, dict): Map of DUT config containing dut interfaces, test port IDs, test port IPs,
and test ports
Expand All @@ -863,7 +864,7 @@ def testQosSaiDwrr(
"""
portSpeedCableLength = dutQosConfig["portSpeedCableLength"]
qosConfig = dutQosConfig["param"]

qos_remap_enable = is_tunnel_qos_remap_enabled(duthost)
testParams = dict()
testParams.update(dutTestParams["basicParams"])
testParams.update({
Expand All @@ -884,6 +885,11 @@ def testQosSaiDwrr(
"hwsku":dutTestParams['hwsku'],
"topo": dutTestParams["topo"]
})
if qos_remap_enable:
neethajohn marked this conversation as resolved.
Show resolved Hide resolved
testParams.update({
"qos_remap_enable": qos_remap_enable,
"q7_num_of_pkts": qosConfig["wrr"].get("q7_num_of_pkts", 0)
})

if "lossy_queue_1" in dutQosConfig["param"][portSpeedCableLength].keys():
testParams["ecn"] = qosConfig[portSpeedCableLength]["lossy_queue_1"]["ecn"]
Expand Down
55 changes: 38 additions & 17 deletions tests/saitests/py3/sai_qos_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2133,31 +2133,54 @@ def runTest(self):
src_port_ip = self.test_params['src_port_ip']
src_port_vlan = self.test_params['src_port_vlan']
src_port_mac = self.dataplane.get_mac(0, src_port_id)
print("dst_port_id: %d, src_port_id: %d" %
(dst_port_id, src_port_id), file=sys.stderr)
qos_remap_enable = bool(self.test_params.get('qos_remap_enable', False))
print("dst_port_id: %d, src_port_id: %d qos_remap_enable: %d" %
bingwang-ms marked this conversation as resolved.
Show resolved Hide resolved
(dst_port_id, src_port_id, qos_remap_enable), file=sys.stderr)
print("dst_port_mac: %s, src_port_mac: %s, src_port_ip: %s, dst_port_ip: %s" % (
dst_port_mac, src_port_mac, src_port_ip, dst_port_ip), file=sys.stderr)
asic_type = self.test_params['sonic_asic_type']
default_packet_length = 1500
exp_ip_id = 110
queue_0_num_of_pkts = int(self.test_params['q0_num_of_pkts'])
queue_1_num_of_pkts = int(self.test_params['q1_num_of_pkts'])
queue_2_num_of_pkts = int(self.test_params['q2_num_of_pkts'])
queue_3_num_of_pkts = int(self.test_params['q3_num_of_pkts'])
queue_4_num_of_pkts = int(self.test_params['q4_num_of_pkts'])
queue_5_num_of_pkts = int(self.test_params['q5_num_of_pkts'])
queue_6_num_of_pkts = int(self.test_params['q6_num_of_pkts'])
queue_0_num_of_pkts = int(self.test_params.get('q0_num_of_pkts', 0))
queue_1_num_of_pkts = int(self.test_params.get('q1_num_of_pkts', 0))
queue_2_num_of_pkts = int(self.test_params.get('q2_num_of_pkts', 0))
queue_3_num_of_pkts = int(self.test_params.get('q3_num_of_pkts', 0))
queue_4_num_of_pkts = int(self.test_params.get('q4_num_of_pkts', 0))
queue_5_num_of_pkts = int(self.test_params.get('q5_num_of_pkts', 0))
queue_6_num_of_pkts = int(self.test_params.get('q6_num_of_pkts', 0))
queue_7_num_of_pkts = int(self.test_params.get('q7_num_of_pkts', 0))
limit = int(self.test_params['limit'])
pkts_num_leak_out = int(self.test_params['pkts_num_leak_out'])
topo = self.test_params['topo']

if 'backend' not in topo:
prio_list = [3, 4, 8, 0, 5, 46, 48]
if not qos_remap_enable:
# When qos_remap is disabled, the map is as below
# DSCP TC QUEUE
# 3 3 3
# 4 4 4
# 8 0 0
# 0 1 1
# 5 2 2
# 46 5 5
# 48 6 6
prio_list = [3, 4, 8, 0, 5, 46, 48]
q_pkt_cnt = [queue_3_num_of_pkts, queue_4_num_of_pkts, queue_0_num_of_pkts, queue_1_num_of_pkts, queue_2_num_of_pkts, queue_5_num_of_pkts, queue_6_num_of_pkts]
else:
# When qos_remap is enabled, the map is as below
# DSCP TC QUEUE
# 3 3 3
# 4 4 4
# 8 0 0
# 0 1 1
# 46 5 5
# 48 7 7
prio_list = [3, 4, 8, 0, 46, 48]
q_pkt_cnt = [queue_3_num_of_pkts, queue_4_num_of_pkts, queue_0_num_of_pkts, queue_1_num_of_pkts, queue_5_num_of_pkts, queue_7_num_of_pkts]
else:
prio_list = [3, 4, 1, 0, 2, 5, 6]
q_pkt_cnt = [queue_3_num_of_pkts, queue_4_num_of_pkts, queue_1_num_of_pkts,
queue_0_num_of_pkts, queue_2_num_of_pkts, queue_5_num_of_pkts, queue_6_num_of_pkts]

q_pkt_cnt = [queue_3_num_of_pkts, queue_4_num_of_pkts, queue_1_num_of_pkts, queue_0_num_of_pkts, queue_2_num_of_pkts, queue_5_num_of_pkts, queue_6_num_of_pkts]
q_cnt_sum = sum(q_pkt_cnt)
# Send packets to leak out
pkt_dst_mac = router_mac if router_mac != '' else dst_port_mac
pkt = construct_ip_pkt(64,
Expand Down Expand Up @@ -2249,8 +2272,7 @@ def runTest(self):

queue_pkt_counters[dscp_of_pkt] += 1
if queue_pkt_counters[dscp_of_pkt] == queue_num_of_pkts[dscp_of_pkt]:
diff_list.append((dscp_of_pkt, (queue_0_num_of_pkts + queue_1_num_of_pkts + queue_2_num_of_pkts +
queue_3_num_of_pkts + queue_4_num_of_pkts + queue_5_num_of_pkts + queue_6_num_of_pkts) - total_pkts))
diff_list.append((dscp_of_pkt, q_cnt_sum - total_pkts))

print(queue_pkt_counters, file=sys.stderr)

Expand All @@ -2269,8 +2291,7 @@ def runTest(self):
queue_counters_base)), file=sys.stderr)

# All packets sent should be received intact
assert(queue_0_num_of_pkts + queue_1_num_of_pkts + queue_2_num_of_pkts + queue_3_num_of_pkts +
queue_4_num_of_pkts + queue_5_num_of_pkts + queue_6_num_of_pkts == total_pkts)
assert(q_cnt_sum == total_pkts)


class LossyQueueTest(sai_base_test.ThriftInterfaceDataPlane):
Expand Down