Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
12 changes: 6 additions & 6 deletions tests/snappi_tests/ecn/files/bpfabric_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,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
17 changes: 10 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,21 @@ 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()
# Create a control state object for all ports
cs.choice = cs.PORT
cs.port.choice = cs.port.LINK
# Apply the state to all ports
link_state.port_names = port_names
cs.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
18 changes: 10 additions & 8 deletions tests/snappi_tests/ecn/files/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,21 +465,23 @@ 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()
# Create a control state object for all ports
cs.choice = cs.PORT
cs.port.choice = cs.port.LINK
# Apply the state to all ports
link_state.port_names = port_names
cs.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")


def _generate_traffic_config(testbed_config,
snappi_extra_params,
port_config_list,
Expand Down
13 changes: 8 additions & 5 deletions tests/snappi_tests/pfc/files/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,13 +412,16 @@ 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 all ports
cs = api.control_state()
# Create a control state object for all ports
cs.choice = cs.PORT
cs.port.choice = cs.port.LINK
# Apply the state to port
link_state.port_names = [port_names]
cs.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 Down
Loading