Skip to content

Commit

Permalink
feat: add support for clearing counter for ingress (#15469)
Browse files Browse the repository at this point in the history
Description of PR
Summary:
Fixes # (issue) Az 30112879

Approach
What is the motivation for this PR?
Ingress port does not get cleared before running the test. This change will make sure both ingress and egress are cleared

Signed-off-by: Austin Pham <austinpham@microsoft.com>
  • Loading branch information
auspham authored Nov 11, 2024
1 parent 151b07c commit 0a4e40b
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 3 deletions.
2 changes: 2 additions & 0 deletions tests/common/snappi_tests/multi_dut_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ def __init__(self):
self.duthost1 = None
self.duthost2 = None
self.multi_dut_ports = None
self.ingress_duthosts = []
self.egress_duthosts = []
7 changes: 4 additions & 3 deletions tests/common/snappi_tests/traffic_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,10 @@ def run_traffic(duthost,
cs.state = cs.START
api.set_capture_state(cs)

clear_dut_interface_counters(duthost)

clear_dut_que_counters(duthost)
for host in set([*snappi_extra_params.multi_dut_params.ingress_duthosts,
*snappi_extra_params.multi_dut_params.egress_duthosts, duthost]):
clear_dut_interface_counters(host)
clear_dut_que_counters(host)

logger.info("Starting transmit on all flows ...")
ts = api.transmit_state()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,19 @@ def run_lossless_response_to_external_pause_storms_test(api,
rx_port = snappi_extra_params.multi_dut_params.multi_dut_ports[0]
rx_port_id_list = [rx_port["port_id"]]
egress_duthost = rx_port['duthost']

# Append the egress here for run_traffic to clear its counters
snappi_extra_params.multi_dut_params.egress_duthosts.append(egress_duthost)

dut_asics_to_be_configured.add((egress_duthost, rx_port['asic_value']))

tx_port = [snappi_extra_params.multi_dut_params.multi_dut_ports[1],
snappi_extra_params.multi_dut_params.multi_dut_ports[2]]
ingress_duthost = tx_port[0]['duthost']

# Append the ingress here for run_traffic to clear its counters
snappi_extra_params.multi_dut_params.ingress_duthosts.append(ingress_duthost)

tx_port_id_list = [tx_port[0]["port_id"], tx_port[1]["port_id"]]
# add ingress DUT into the set
dut_asics_to_be_configured.add((tx_port[0]['duthost'], tx_port[0]['asic_value']))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,19 @@ def run_lossless_response_to_throttling_pause_storms_test(api,
rx_port = snappi_extra_params.multi_dut_params.multi_dut_ports[0]
rx_port_id_list = [rx_port["port_id"]]
egress_duthost = rx_port['duthost']

# Append the egress here for run_traffic to clear its counters
snappi_extra_params.multi_dut_params.egress_duthosts.append(egress_duthost)

dut_asics_to_be_configured.add((egress_duthost, rx_port['asic_value']))

tx_port = [snappi_extra_params.multi_dut_params.multi_dut_ports[1],
snappi_extra_params.multi_dut_params.multi_dut_ports[2]]
ingress_duthost = tx_port[0]['duthost']

# Append the ingress here for run_traffic to clear its counters
snappi_extra_params.multi_dut_params.ingress_duthosts.append(ingress_duthost)

tx_port_id_list = [tx_port[0]["port_id"], tx_port[1]["port_id"]]
# add ingress DUT into the set
dut_asics_to_be_configured.add((tx_port[0]['duthost'], tx_port[0]['asic_value']))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,19 @@ def run_m2o_fluctuating_lossless_test(api,
rx_port = snappi_extra_params.multi_dut_params.multi_dut_ports[0]
rx_port_id_list = [rx_port["port_id"]]
egress_duthost = rx_port['duthost']

# Append the egress here for run_traffic to clear its counters
snappi_extra_params.multi_dut_params.egress_duthosts.append(egress_duthost)

dut_asics_to_be_configured.add((egress_duthost, rx_port['asic_value']))

tx_port = [snappi_extra_params.multi_dut_params.multi_dut_ports[1],
snappi_extra_params.multi_dut_params.multi_dut_ports[2]]
ingress_duthost = tx_port[0]['duthost']

# Append the ingress here for run_traffic to clear its counters
snappi_extra_params.multi_dut_params.ingress_duthosts.append(ingress_duthost)

tx_port_id_list = [tx_port[0]["port_id"], tx_port[1]["port_id"]]
# add ingress DUT into the set
dut_asics_to_be_configured.add((tx_port[0]['duthost'], tx_port[0]['asic_value']))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,16 @@ def run_m2o_oversubscribe_lossless_test(api,
egress_duthost = rx_port['duthost']
dut_asics_to_be_configured.add((egress_duthost, rx_port['asic_value']))

# Append the egress here for run_traffic to clear its counters
snappi_extra_params.multi_dut_params.egress_duthosts.append(egress_duthost)

tx_port = [snappi_extra_params.multi_dut_params.multi_dut_ports[1],
snappi_extra_params.multi_dut_params.multi_dut_ports[2]]
ingress_duthost = tx_port[0]['duthost']

# Append the ingress here for run_traffic to clear its counters
snappi_extra_params.multi_dut_params.ingress_duthosts.append(ingress_duthost)

tx_port_id_list = [tx_port[0]["port_id"], tx_port[1]["port_id"]]
# add ingress DUT into the set
dut_asics_to_be_configured.add((tx_port[0]['duthost'], tx_port[0]['asic_value']))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,19 @@ def run_pfc_m2o_oversubscribe_lossless_lossy_test(api,
rx_port = snappi_extra_params.multi_dut_params.multi_dut_ports[0]
rx_port_id_list = [rx_port["port_id"]]
egress_duthost = rx_port['duthost']

# Append the egress here for run_traffic to clear its counters
snappi_extra_params.multi_dut_params.egress_duthosts.append(egress_duthost)

dut_asics_to_be_configured.add((egress_duthost, rx_port['asic_value']))

tx_port = [snappi_extra_params.multi_dut_params.multi_dut_ports[1],
snappi_extra_params.multi_dut_params.multi_dut_ports[2]]
ingress_duthost = tx_port[0]['duthost']

# Append the ingress here for run_traffic to clear its counters
snappi_extra_params.multi_dut_params.ingress_duthosts.append(ingress_duthost)

tx_port_id_list = [tx_port[0]["port_id"], tx_port[1]["port_id"]]
# add ingress DUT into the set
dut_asics_to_be_configured.add((tx_port[0]['duthost'], tx_port[0]['asic_value']))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,19 @@ def run_pfc_m2o_oversubscribe_lossy_test(api,
rx_port = snappi_extra_params.multi_dut_params.multi_dut_ports[0]
rx_port_id_list = [rx_port["port_id"]]
egress_duthost = rx_port['duthost']

# Append the egress here for run_traffic to clear its counters
snappi_extra_params.multi_dut_params.egress_duthosts.append(egress_duthost)

dut_asics_to_be_configured.add((egress_duthost, rx_port['asic_value']))

tx_port = [snappi_extra_params.multi_dut_params.multi_dut_ports[1],
snappi_extra_params.multi_dut_params.multi_dut_ports[2]]
ingress_duthost = tx_port[0]['duthost']

# Append the ingress here for run_traffic to clear its counters
snappi_extra_params.multi_dut_params.ingress_duthosts.append(ingress_duthost)

tx_port_id_list = [tx_port[0]["port_id"], tx_port[1]["port_id"]]
# add ingress DUT into the set
dut_asics_to_be_configured.add((tx_port[0]['duthost'], tx_port[0]['asic_value']))
Expand Down

0 comments on commit 0a4e40b

Please sign in to comment.