Skip to content
Merged
Show file tree
Hide file tree
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
11 changes: 6 additions & 5 deletions tests/snappi_tests/ecn/files/bpfabric_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,16 @@ def adjust_shaper_and_verify(dut, egress_intfs, test_prio_list, api):
queue_counters[intf] = init_ctr

# Start traffic again
ts = api.transmit_state()
ts.state = ts.START
api.set_transmit_state(ts)
cs = api.control_state()
cs.traffic.flow_transmit.state = cs.traffic.flow_transmit.START
api.set_control_state(cs)

time.sleep(DATA_FLOW_DURATION_SEC + DATA_FLOW_DELAY_SEC)

# Stop traffic
ts.state = ts.STOP
api.set_transmit_state(ts)
cs = api.control_state()
cs.traffic.flow_transmit.state = cs.traffic.flow_transmit.STOP
api.set_control_state(cs)

for intf in egress_intfs:
post_ctr = get_npu_voq_queue_counters(dut, intf, test_prio_list[0])
Expand Down
16 changes: 9 additions & 7 deletions tests/snappi_tests/ecn/files/ecnhelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,18 +197,20 @@ def run_ecn_test_cisco8000(api,
config = api.get_config()
# Collect all port names
port_names = [port.name for port in config.ports]
# Create a link state object for all ports
link_state = api.link_state()
# Create a control state object for all ports
cs = api.control_state()
cs.choice = cs.PORT
cs.port.choice = cs.port.LINK
# Apply the state to all ports
link_state.port_names = port_names
cs.port.link.port_names = port_names
# Set all ports down (shut)
link_state.state = link_state.DOWN
api.set_link_state(link_state)
cs.port.link.state = cs.port.link.DOWN
api.set_control_state(cs)
logger.info("All Snappi ports are set to DOWN")
time.sleep(0.2)
# Unshut all ports
link_state.state = link_state.UP
api.set_link_state(link_state)
cs.port.link.state = cs.port.link.UP
api.set_control_state(cs)
logger.info("All Snappi ports are set to UP")

init_ctr_3 = get_npu_voq_queue_counters(duthost, dut_port, test_prio_list[0])
Expand Down
16 changes: 9 additions & 7 deletions tests/snappi_tests/ecn/files/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,18 +465,20 @@ def toggle_dut_port_state(api):
config = api.get_config()
# Collect all port names
port_names = [port.name for port in config.ports]
# Create a link state object for all ports
link_state = api.link_state()
# Create a control state object for all ports
cs = api.control_state()
cs.choice = cs.PORT
cs.port.choice = cs.port.LINK
# Apply the state to all ports
link_state.port_names = port_names
cs.port.link.port_names = port_names
# Set all ports down (shut)
link_state.state = link_state.DOWN
api.set_link_state(link_state)
cs.port.link.state = cs.port.link.DOWN
api.set_control_state(cs)
logger.info("All Snappi ports are set to DOWN")
time.sleep(0.2)
# Unshut all ports
link_state.state = link_state.UP
api.set_link_state(link_state)
cs.port.link.state = cs.port.link.UP
api.set_control_state(cs)
logger.info("All Snappi ports are set to UP")


Expand Down
16 changes: 9 additions & 7 deletions tests/snappi_tests/pfc/files/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,13 +412,15 @@ def run_tx_drop_counter(

# Set port name of the Ixia port connected to dut_port
port_names = snappi_extra_params.base_flow_config["rx_port_name"]
# Create a link state object for ports
link_state = api.link_state()
# Create a control state object for ports
cs = api.control_state()
cs.choice = cs.PORT
cs.port.choice = cs.port.LINK
# Apply the state to port
link_state.port_names = [port_names]
cs.port.link.port_names = [port_names]
# Set port down (shut)
link_state.state = link_state.DOWN
api.set_link_state(link_state)
cs.port.link.state = cs.port.link.DOWN
api.set_control_state(cs)
logger.info("Snappi port {} is set to DOWN".format(port_names))
time.sleep(1)
# Collect metrics from DUT again
Expand All @@ -434,7 +436,7 @@ def run_tx_drop_counter(
finally:
if link_state:
# Bring the link back up
link_state.state = link_state.UP
api.set_link_state(link_state)
cs.port.link.state = cs.port.link.UP
api.set_control_state(cs)
logger.info("Snappi port {} is set to UP".format(port_names))
return
Loading