Skip to content

Commit a7be8e0

Browse files
authored
Adding COUNTER_MARGIN to Ingress drop counters for qos tests (#9896)
* Qos_LossyQueueTest fix_adding COUNTER MARGIN * Adding COUNTER_MARGIN to qos PFCXonTest * Adding COUNTER_MARGIN to qos PFCTest * Flake8 fixes * testQosSaiPFCXoffLimit updated with correct check * Conditional check corrected for LossyQueueTest * flake8 fix
1 parent 750579d commit a7be8e0

File tree

1 file changed

+63
-24
lines changed

1 file changed

+63
-24
lines changed

tests/saitests/py3/sai_qos_tests.py

Lines changed: 63 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,9 +1337,16 @@ def runTest(self):
13371337
assert(recv_counters[pg] == recv_counters_base[pg]), \
13381338
'unexpectedly PFC counter increase, {}'.format(test_stage)
13391339
# recv port no ingress drop
1340+
# For dnx few extra ipv6 NS/RA pkt received from VM, adding to counter value
1341+
# & may give inconsistent test results
1342+
# Adding COUNTER_MARGIN to provide room to 2 pkt incase, extra traffic received
13401343
for cntr in ingress_counters:
1341-
assert(recv_counters[cntr] == recv_counters_base[cntr]), \
1342-
'unexpectedly RX drop counter increase, {}'.format(test_stage)
1344+
if platform_asic and platform_asic == "broadcom-dnx":
1345+
assert (recv_counters[cntr] <= recv_counters_base[cntr] + COUNTER_MARGIN),\
1346+
'unexpectedly RX drop counter increase, {}'.format(test_stage)
1347+
else:
1348+
assert(recv_counters[cntr] == recv_counters_base[cntr]),\
1349+
'unexpectedly RX drop counter increase, {}'.format(test_stage)
13431350
# xmit port no egress drop
13441351
for cntr in egress_counters:
13451352
assert(xmit_counters[cntr] == xmit_counters_base[cntr]), \
@@ -1364,9 +1371,16 @@ def runTest(self):
13641371
assert(recv_counters[pg] > recv_counters_base[pg]), \
13651372
'unexpectedly PFC counter not increase, {}'.format(test_stage)
13661373
# recv port no ingress drop
1374+
# For dnx few extra ipv6 NS/RA pkt received from VM, adding to counter value
1375+
# & may give inconsistent test results
1376+
# Adding COUNTER_MARGIN to provide room to 2 pkt incase, extra traffic received
13671377
for cntr in ingress_counters:
1368-
assert(recv_counters[cntr] == recv_counters_base[cntr]), \
1369-
'unexpectedly RX drop counter increase, {}'.format(test_stage)
1378+
if platform_asic and platform_asic == "broadcom-dnx":
1379+
assert (recv_counters[cntr] <= recv_counters_base[cntr] + COUNTER_MARGIN),\
1380+
'unexpectedly RX drop counter increase, {}'.format(test_stage)
1381+
else:
1382+
assert(recv_counters[cntr] == recv_counters_base[cntr]),\
1383+
'unexpectedly RX drop counter increase, {}'.format(test_stage)
13701384
# xmit port no egress drop
13711385
for cntr in egress_counters:
13721386
assert(xmit_counters[cntr] == xmit_counters_base[cntr]), \
@@ -1392,9 +1406,16 @@ def runTest(self):
13921406
assert(recv_counters[pg] > recv_counters_base[pg]), \
13931407
'unexpectedly PFC counter not increase, {}'.format(test_stage)
13941408
# recv port no ingress drop
1409+
# For dnx few extra ipv6 NS/RA pkt received from VM, adding to counter value
1410+
# & may give inconsistent test results
1411+
# Adding COUNTER_MARGIN to provide room to 2 pkt incase, extra traffic received
13951412
for cntr in ingress_counters:
1396-
assert(recv_counters[cntr] == recv_counters_base[cntr]), \
1397-
'unexpectedly RX drop counter increase, {}'.format(test_stage)
1413+
if platform_asic and platform_asic == "broadcom-dnx":
1414+
assert (recv_counters[cntr] <= recv_counters_base[cntr] + COUNTER_MARGIN),\
1415+
'unexpectedly RX drop counter increase, {}'.format(test_stage)
1416+
else:
1417+
assert(recv_counters[cntr] == recv_counters_base[cntr]),\
1418+
'unexpectedly RX drop counter increase, {}'.format(test_stage)
13981419
# xmit port no egress drop
13991420
for cntr in egress_counters:
14001421
assert(xmit_counters[cntr] == xmit_counters_base[cntr]), \
@@ -1419,18 +1440,18 @@ def runTest(self):
14191440
assert(recv_counters[pg] > recv_counters_base[pg]), \
14201441
'unexpectedly PFC counter not increase, {}'.format(test_stage)
14211442
# recv port ingress drop
1422-
if platform_asic and platform_asic == "broadcom-dnx":
1423-
logging.info(
1424-
"On J2C+ don't support port level drop counters - so ignoring this step for now")
1425-
else:
1426-
# recv port ingress drop
1427-
for cntr in ingress_counters:
1428-
assert (recv_counters[cntr] > recv_counters_base[cntr]
1429-
), 'unexpectedly RX drop counter not increase, {}'.format(test_stage)
1430-
# xmit port no egress drop
1431-
for cntr in egress_counters:
1432-
assert (xmit_counters[cntr] == xmit_counters_base[cntr]
1433-
), 'unexpectedly TX drop counter increase, {}'.format(test_stage)
1443+
for cntr in ingress_counters:
1444+
if platform_asic and platform_asic == "broadcom-dnx":
1445+
if cntr == 1:
1446+
assert(recv_counters[cntr] > recv_counters_base[cntr]), 'unexpectedly RX drop counter ' \
1447+
'not increase, {}'.format(test_stage)
1448+
else:
1449+
assert(recv_counters[cntr] > recv_counters_base[cntr]), 'unexpectedly RX drop counter' \
1450+
' not increase, {}'.format(test_stage)
1451+
# xmit port no egress drop
1452+
for cntr in egress_counters:
1453+
assert(xmit_counters[cntr] == xmit_counters_base[cntr]),\
1454+
'unexpectedly TX drop counter increase, {}'.format(test_stage)
14341455

14351456
if '201811' not in sonic_version and 'mellanox' in asic_type:
14361457
pg_dropped_cntrs = sai_thrift_read_pg_drop_counters(
@@ -1865,6 +1886,7 @@ def runTest(self):
18651886
ecn = int(self.test_params['ecn'])
18661887
sonic_version = self.test_params['sonic_version']
18671888
router_mac = self.test_params['router_mac']
1889+
platform_asic = self.test_params['platform_asic']
18681890

18691891
# The pfc counter index starts from index 2 in sai_thrift_read_port_counters
18701892
pg = int(self.test_params['pg']) + 2
@@ -2139,10 +2161,18 @@ def runTest(self):
21392161
'unexpectedly not trigger PFC for PG {} (counter: {}), at step {} {}'.format(
21402162
pg, port_counter_fields[pg], step_id, step_desc)
21412163
# recv port no ingress drop
2164+
# For dnx few extra ipv6 NS/RA pkt received from VM, adding to counter value
2165+
# & may give inconsistent test results
2166+
# Adding COUNTER_MARGIN to provide room to 2 pkt incase, extra traffic received
21422167
for cntr in ingress_counters:
2143-
assert (recv_counters[cntr] == recv_counters_base[cntr]),\
2144-
'unexpectedly ingress drop on recv port (counter: {}), at step {} {}'.format(
2145-
port_counter_fields[cntr], step_id, step_desc)
2168+
if platform_asic and platform_asic == "broadcom-dnx":
2169+
assert (recv_counters[cntr] <= recv_counters_base[cntr] + COUNTER_MARGIN), \
2170+
'unexpectedly ingress drop on recv port (counter: {}), at step {} {}'.format(
2171+
port_counter_fields[cntr], step_id, step_desc)
2172+
else:
2173+
assert(recv_counters[cntr] == recv_counters_base[cntr]),\
2174+
'unexpectedly ingress drop on recv port (counter: {}), at step {} {}'.format(
2175+
port_counter_fields[cntr], step_id, step_desc)
21462176
# xmit port no egress drop
21472177
for cntr in egress_counters:
21482178
assert (xmit_counters[cntr] == xmit_counters_base[cntr]),\
@@ -3354,8 +3384,16 @@ def runTest(self):
33543384
# recv port no pfc
33553385
assert (recv_counters[pg] == recv_counters_base[pg])
33563386
# recv port no ingress drop
3387+
# For dnx few extra ipv6 NS/RA pkt received, adding to coutner value
3388+
# & may give inconsistent test results
3389+
# Adding COUNTER_MARGIN to provide room to 2 pkt incase, extra traffic received
33573390
for cntr in ingress_counters:
3358-
if platform_asic and platform_asic == "broadcom-dnx" and cntr == 1:
3391+
if platform_asic and platform_asic == "broadcom-dnx":
3392+
if cntr == 1:
3393+
print("recv_counters_base: %d, recv_counters: %d" % (recv_counters_base[cntr],
3394+
recv_counters[cntr]), file=sys.stderr)
3395+
assert(recv_counters[cntr] <= recv_counters_base[cntr] + COUNTER_MARGIN)
3396+
else:
33593397
assert(recv_counters[cntr] == recv_counters_base[cntr])
33603398
# xmit port no egress drop
33613399
for cntr in egress_counters:
@@ -3375,8 +3413,9 @@ def runTest(self):
33753413
assert (recv_counters[pg] == recv_counters_base[pg])
33763414
# recv port no ingress drop
33773415
for cntr in ingress_counters:
3378-
if platform_asic and platform_asic == "broadcom-dnx" and cntr == 1:
3379-
assert (recv_counters[cntr] > recv_counters_base[cntr])
3416+
if platform_asic and platform_asic == "broadcom-dnx":
3417+
if cntr == 1:
3418+
assert (recv_counters[cntr] > recv_counters_base[cntr])
33803419
else:
33813420
assert (recv_counters[cntr] == recv_counters_base[cntr])
33823421

0 commit comments

Comments
 (0)