Skip to content
Closed
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
32 changes: 16 additions & 16 deletions tests/ip/test_ip_packet.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ def test_forward_ip_packet_with_0x0000_chksum(self, duthosts, enum_rand_one_per_
tx_drp = sum_ifaces_counts(portstat_out, out_ifaces, "tx_drp")
tx_err = sum_ifaces_counts(rif_counter_out, out_rif_ifaces, "tx_err") if rif_support else 0

if asic_type == "vs":
logger.info("Skipping packet count check on VS platform")
if asic_type in ["vs", "vpp"]:
logger.info("Skipping packet count check on VS/VPP platform")
return
Comment on lines +179 to 181
Copy link

Copilot AI Mar 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The skip guard is duplicated across multiple tests with the same inline list literal ["vs", "vpp"]. Consider defining a single module/class-level constant (e.g., VIRTUAL_ASIC_TYPES) and using if asic_type in VIRTUAL_ASIC_TYPES: to avoid future drift if the list changes again.

Copilot uses AI. Check for mistakes.
pytest_assert(rx_ok >= self.PKT_NUM_MIN,
"Received {} packets in rx, not in expected range".format(rx_ok))
Expand Down Expand Up @@ -251,8 +251,8 @@ def test_forward_ip_packet_with_0xffff_chksum_tolerant(self, duthosts, enum_rand
tx_drp = sum_ifaces_counts(portstat_out, out_ifaces, "tx_drp")
tx_err = sum_ifaces_counts(rif_counter_out, out_rif_ifaces, "tx_err") if rif_support else 0

if asic_type == "vs":
logger.info("Skipping packet count check on VS platform")
if asic_type in ["vs", "vpp"]:
logger.info("Skipping packet count check on VS/VPP platform")
return
pytest_assert(rx_ok >= self.PKT_NUM_MIN,
"Received {} packets in rx, not in expected range".format(rx_ok))
Expand Down Expand Up @@ -337,8 +337,8 @@ def test_forward_ip_packet_with_0xffff_chksum_drop(self, duthosts, localhost,
logger.info("Setting PKT_NUM_ZERO for t2 max topology with 0.2 tolerance")
self.PKT_NUM_ZERO = self.PKT_NUM * 0.4

if asic_type == "vs":
logger.info("Skipping packet count check on VS platform")
if asic_type in ["vs", "vpp"]:
logger.info("Skipping packet count check on VS/VPP platform")
return
pytest_assert(rx_ok >= self.PKT_NUM_MIN,
"Received {} packets in rx, not in expected range".format(rx_ok))
Expand Down Expand Up @@ -414,8 +414,8 @@ def test_forward_ip_packet_recomputed_0xffff_chksum(self, duthosts, enum_rand_on
tx_drp = sum_ifaces_counts(portstat_out, out_ifaces, "tx_drp")
tx_err = sum_ifaces_counts(rif_counter_out, out_rif_ifaces, "tx_err") if rif_support else 0

if asic_type == "vs":
logger.info("Skipping packet count check on VS platform")
if asic_type in ["vs", "vpp"]:
logger.info("Skipping packet count check on VS/VPP platform")
return
pytest_assert(rx_ok >= self.PKT_NUM_MIN,
"Received {} packets in rx, not in expected range".format(rx_ok))
Expand Down Expand Up @@ -488,8 +488,8 @@ def test_forward_ip_packet_recomputed_0x0000_chksum(self, duthosts, enum_rand_on
tx_drp = sum_ifaces_counts(portstat_out, out_ifaces, "tx_drp")
tx_err = sum_ifaces_counts(rif_counter_out, out_rif_ifaces, "tx_err") if rif_support else 0

if asic_type == "vs":
logger.info("Skipping packet count check on VS platform")
if asic_type in ["vs", "vpp"]:
logger.info("Skipping packet count check on VS/VPP platform")
return
pytest_assert(rx_ok >= self.PKT_NUM_MIN,
"Received {} packets in rx, not in expected range".format(rx_ok))
Expand Down Expand Up @@ -555,8 +555,8 @@ def test_forward_normal_ip_packet(self, duthosts, enum_rand_one_per_hwsku_fronte
tx_drp = sum_ifaces_counts(portstat_out, out_ifaces, "tx_drp")
tx_err = sum_ifaces_counts(rif_counter_out, out_rif_ifaces, "tx_err") if rif_support else 0

if asic_type == "vs":
logger.info("Skipping packet count check on VS platform")
if asic_type in ["vs", "vpp"]:
logger.info("Skipping packet count check on VS/VPP platform")
return
pytest_assert(rx_ok >= self.PKT_NUM_MIN,
"Received {} packets in rx, not in expected range".format(rx_ok))
Expand Down Expand Up @@ -614,8 +614,8 @@ def test_drop_ip_packet_with_wrong_0xffff_chksum(self, duthosts, enum_rand_one_p
tx_drp = sum_ifaces_counts(portstat_out, out_ifaces, "tx_drp")
tx_err = sum_ifaces_counts(rif_counter_out, out_rif_ifaces, "tx_err") if rif_support else 0

if asic_type == "vs":
logger.info("Skipping packet count check on VS platform")
if asic_type in ["vs", "vpp"]:
logger.info("Skipping packet count check on VS/VPP platform")
return
pytest_assert(rx_ok >= self.PKT_NUM_MIN,
"Received {} packets in rx, not in expected range".format(rx_ok))
Expand Down Expand Up @@ -674,8 +674,8 @@ def test_drop_l3_ip_packet_non_dut_mac(self, duthosts, enum_rand_one_per_hwsku_f
tx_drp = sum_ifaces_counts(portstat_out, out_ifaces, "tx_drp")
tx_rif_err = sum_ifaces_counts(rif_counter_out, out_rif_ifaces, "tx_err") if rif_support else 0

if asic_type == "vs":
logger.info("Skipping packet count check on VS platform")
if asic_type in ["vs", "vpp"]:
logger.info("Skipping packet count check on VS/VPP platform")
return
pytest_assert(rx_ok >= self.PKT_NUM_MIN,
"Received {} packets in rx, not in expected range".format(rx_ok))
Expand Down
Loading