Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[action] [PR:16079] T2:snappi_tests: Increase the number of background flows for cisco-8000 to 10. #16327

Merged
merged 1 commit into from
Jan 4, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# Compiled at: 2023-02-10 09:15:26
from math import ceil # noqa: F401
import logging # noqa: F401
import random
from tests.common.helpers.assertions import pytest_assert, pytest_require # noqa: F401
from tests.common.fixtures.conn_graph_facts import conn_graph_facts, fanout_graph_facts # noqa: F401
from tests.common.snappi_tests.snappi_helpers import get_dut_port_id # noqa: F401
Expand All @@ -30,6 +29,7 @@
SNAPPI_POLL_DELAY_SEC = 2
PAUSE_FLOW_RATE = 15
PAUSE_FLOW_NAME = 'PFC Traffic'
UDP_PORT_START = 5000


def run_lossless_response_to_external_pause_storms_test(api,
Expand Down Expand Up @@ -100,6 +100,9 @@ def run_lossless_response_to_external_pause_storms_test(api,

test_flow_rate_percent = int(TEST_FLOW_AGGR_RATE_PERCENT)
bg_flow_rate_percent = int(BG_FLOW_AGGR_RATE_PERCENT)
no_of_bg_streams = 1
if duthost.facts['asic_type'] == "cisco-8000":
no_of_bg_streams = 10
port_id = 0

# Generate base traffic config
Expand All @@ -122,7 +125,8 @@ def run_lossless_response_to_external_pause_storms_test(api,
bg_flow_rate_percent=bg_flow_rate_percent,
data_flow_dur_sec=DATA_FLOW_DURATION_SEC,
data_pkt_size=DATA_PKT_SIZE,
prio_dscp_map=prio_dscp_map)
prio_dscp_map=prio_dscp_map,
no_of_bg_streams=no_of_bg_streams)

flows = testbed_config.flows
all_flow_names = [flow.name for flow in flows]
Expand Down Expand Up @@ -176,7 +180,8 @@ def __gen_traffic(testbed_config,
bg_flow_rate_percent,
data_flow_dur_sec,
data_pkt_size,
prio_dscp_map):
prio_dscp_map,
no_of_bg_streams):
"""
Generate configurations of flows under all to all traffic pattern, including
test flows, background flows and pause storm. Test flows and background flows
Expand Down Expand Up @@ -211,7 +216,8 @@ def __gen_traffic(testbed_config,
flow_rate_percent=test_flow_rate_percent,
flow_dur_sec=data_flow_dur_sec,
data_pkt_size=data_pkt_size,
prio_dscp_map=prio_dscp_map)
prio_dscp_map=prio_dscp_map,
no_of_streams=1)

__gen_data_flows(testbed_config=testbed_config,
port_config_list=port_config_list,
Expand All @@ -222,7 +228,8 @@ def __gen_traffic(testbed_config,
flow_rate_percent=bg_flow_rate_percent,
flow_dur_sec=data_flow_dur_sec,
data_pkt_size=data_pkt_size,
prio_dscp_map=prio_dscp_map)
prio_dscp_map=prio_dscp_map,
no_of_streams=no_of_bg_streams)

__gen_data_flows(testbed_config=testbed_config,
port_config_list=port_config_list,
Expand All @@ -245,7 +252,8 @@ def __gen_data_flows(testbed_config,
flow_rate_percent,
flow_dur_sec,
data_pkt_size,
prio_dscp_map):
prio_dscp_map,
no_of_streams=1):
"""
Generate the configuration for data flows
Expand Down Expand Up @@ -278,7 +286,8 @@ def __gen_data_flows(testbed_config,
flow_rate_percent=flow_rate_percent,
flow_dur_sec=flow_dur_sec,
data_pkt_size=data_pkt_size,
prio_dscp_map=prio_dscp_map)
prio_dscp_map=prio_dscp_map,
no_of_streams=no_of_streams)
else:
__gen_data_flow(testbed_config=testbed_config,
port_config_list=port_config_list,
Expand All @@ -301,7 +310,8 @@ def __gen_data_flow(testbed_config,
flow_rate_percent,
flow_dur_sec,
data_pkt_size,
prio_dscp_map):
prio_dscp_map,
no_of_streams=1):
"""
Generate the configuration for a data flow
Expand Down Expand Up @@ -333,10 +343,11 @@ def __gen_data_flow(testbed_config,
flow.tx_rx.port.tx_name = testbed_config.ports[src_port_id].name
flow.tx_rx.port.rx_name = testbed_config.ports[dst_port_id].name
eth, ipv4, udp = flow.packet.ethernet().ipv4().udp()
src_port = random.randint(5000, 6000)
global UDP_PORT_START
src_port = UDP_PORT_START + no_of_streams
udp.src_port.increment.start = src_port
udp.src_port.increment.step = 1
udp.src_port.increment.count = 1
udp.src_port.increment.count = no_of_streams

eth.src.value = tx_mac
eth.dst.value = rx_mac
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# Compiled at: 2023-02-10 09:15:26
from math import ceil # noqa: F401
import logging # noqa: F401
import random
from tests.common.helpers.assertions import pytest_assert, pytest_require # noqa: F401
from tests.common.fixtures.conn_graph_facts import conn_graph_facts, fanout_graph_facts # noqa: F401
from tests.common.snappi_tests.snappi_helpers import get_dut_port_id # noqa: F401
Expand Down Expand Up @@ -34,6 +33,7 @@
TOLERANCE_THRESHOLD = 0.05
PAUSE_FLOW_DURATION_SEC = 5
PAUSE_FLOW_DELAY_SEC = 5
UDP_PORT_START = 5000


def run_lossless_response_to_throttling_pause_storms_test(api,
Expand Down Expand Up @@ -107,6 +107,9 @@ def run_lossless_response_to_throttling_pause_storms_test(api,

test_flow_rate_percent = int(TEST_FLOW_AGGR_RATE_PERCENT)
bg_flow_rate_percent = int(BG_FLOW_AGGR_RATE_PERCENT)
no_of_bg_streams = 1
if duthost.facts['asic_type'] == "cisco-8000":
no_of_bg_streams = 10
port_id = 0

# Generate base traffic config
Expand All @@ -129,7 +132,8 @@ def run_lossless_response_to_throttling_pause_storms_test(api,
bg_flow_rate_percent=bg_flow_rate_percent,
data_flow_dur_sec=DATA_FLOW_DURATION_SEC,
data_pkt_size=DATA_PKT_SIZE,
prio_dscp_map=prio_dscp_map)
prio_dscp_map=prio_dscp_map,
no_of_bg_streams=no_of_bg_streams)

flows = testbed_config.flows
all_flow_names = [flow.name for flow in flows]
Expand Down Expand Up @@ -184,7 +188,8 @@ def __gen_traffic(testbed_config,
bg_flow_rate_percent,
data_flow_dur_sec,
data_pkt_size,
prio_dscp_map):
prio_dscp_map,
no_of_bg_streams):
"""
Generate configurations of flows under all to all traffic pattern, including
test flows, background flows and pause storm. Test flows and background flows
Expand Down Expand Up @@ -219,7 +224,8 @@ def __gen_traffic(testbed_config,
flow_rate_percent=test_flow_rate_percent,
flow_dur_sec=data_flow_dur_sec,
data_pkt_size=data_pkt_size,
prio_dscp_map=prio_dscp_map)
prio_dscp_map=prio_dscp_map,
no_of_streams=1)

__gen_data_flows(testbed_config=testbed_config,
port_config_list=port_config_list,
Expand All @@ -230,7 +236,8 @@ def __gen_traffic(testbed_config,
flow_rate_percent=bg_flow_rate_percent,
flow_dur_sec=data_flow_dur_sec,
data_pkt_size=data_pkt_size,
prio_dscp_map=prio_dscp_map)
prio_dscp_map=prio_dscp_map,
no_of_streams=no_of_bg_streams)

__gen_data_flows(testbed_config=testbed_config,
port_config_list=port_config_list,
Expand All @@ -241,7 +248,8 @@ def __gen_traffic(testbed_config,
flow_rate_percent=pause_flow_rate,
flow_dur_sec=data_flow_dur_sec,
data_pkt_size=data_pkt_size,
prio_dscp_map=prio_dscp_map)
prio_dscp_map=prio_dscp_map,
no_of_streams=1)


def __gen_data_flows(testbed_config,
Expand All @@ -253,7 +261,8 @@ def __gen_data_flows(testbed_config,
flow_rate_percent,
flow_dur_sec,
data_pkt_size,
prio_dscp_map):
prio_dscp_map,
no_of_streams):
"""
Generate the configuration for data flows
Expand Down Expand Up @@ -286,7 +295,8 @@ def __gen_data_flows(testbed_config,
flow_rate_percent=flow_rate_percent,
flow_dur_sec=flow_dur_sec,
data_pkt_size=data_pkt_size,
prio_dscp_map=prio_dscp_map)
prio_dscp_map=prio_dscp_map,
no_of_streams=no_of_streams)
else:
__gen_data_flow(testbed_config=testbed_config,
port_config_list=port_config_list,
Expand All @@ -309,7 +319,8 @@ def __gen_data_flow(testbed_config,
flow_rate_percent,
flow_dur_sec,
data_pkt_size,
prio_dscp_map):
prio_dscp_map,
no_of_streams=1):
"""
Generate the configuration for a data flow
Expand Down Expand Up @@ -341,10 +352,11 @@ def __gen_data_flow(testbed_config,
flow.tx_rx.port.tx_name = testbed_config.ports[src_port_id].name
flow.tx_rx.port.rx_name = testbed_config.ports[dst_port_id].name
eth, ipv4, udp = flow.packet.ethernet().ipv4().udp()
src_port = random.randint(5000, 6000)
global UDP_PORT_START
src_port = UDP_PORT_START + no_of_streams
udp.src_port.increment.start = src_port
udp.src_port.increment.step = 1
udp.src_port.increment.count = 1
udp.src_port.increment.count = no_of_streams

eth.src.value = tx_mac
eth.dst.value = rx_mac
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ def run_m2o_fluctuating_lossless_test(api,
stop_pfcwd(duthost, asic)
disable_packet_aging(duthost)

no_of_bg_streams = 1
if duthost.facts['asic_type'] == "cisco-8000":
no_of_bg_streams = 10
port_id = 0
# Generate base traffic config
snappi_extra_params.base_flow_config = setup_base_traffic_config(testbed_config=testbed_config,
Expand All @@ -111,7 +114,8 @@ def run_m2o_fluctuating_lossless_test(api,
bg_flow_rate_percent=BG_FLOW_AGGR_RATE_PERCENT,
data_flow_dur_sec=DATA_FLOW_DURATION_SEC,
data_pkt_size=DATA_PKT_SIZE,
prio_dscp_map=prio_dscp_map)
prio_dscp_map=prio_dscp_map,
no_of_bg_streams=no_of_bg_streams)

flows = testbed_config.flows
all_flow_names = [flow.name for flow in flows]
Expand Down Expand Up @@ -161,7 +165,8 @@ def __gen_traffic(testbed_config,
bg_flow_rate_percent,
data_flow_dur_sec,
data_pkt_size,
prio_dscp_map):
prio_dscp_map,
no_of_bg_streams):
"""
Generate configurations of flows under all to all traffic pattern, including
test flows, background flows and pause storm. Test flows and background flows
Expand Down Expand Up @@ -207,7 +212,8 @@ def __gen_traffic(testbed_config,
flow_rate_percent=BG_FLOW_AGGR_RATE_PERCENT,
flow_dur_sec=data_flow_dur_sec,
data_pkt_size=data_pkt_size,
prio_dscp_map=prio_dscp_map)
prio_dscp_map=prio_dscp_map,
no_of_streams=no_of_bg_streams)


def __gen_data_flows(testbed_config,
Expand All @@ -219,7 +225,8 @@ def __gen_data_flows(testbed_config,
flow_rate_percent,
flow_dur_sec,
data_pkt_size,
prio_dscp_map):
prio_dscp_map,
no_of_streams=1):
"""
Generate the configuration for data flows
Expand Down Expand Up @@ -253,7 +260,9 @@ def __gen_data_flows(testbed_config,
flow_dur_sec=flow_dur_sec,
data_pkt_size=data_pkt_size,
prio_dscp_map=prio_dscp_map,
index=None)
index=None,
no_of_streams=1
)
else:
index = 1
for rate_percent in flow_rate_percent:
Expand All @@ -271,7 +280,8 @@ def __gen_data_flows(testbed_config,
flow_dur_sec=flow_dur_sec,
data_pkt_size=data_pkt_size,
prio_dscp_map=prio_dscp_map,
index=index)
index=index,
no_of_streams=no_of_streams)
index += 1


Expand All @@ -285,7 +295,8 @@ def __gen_data_flow(testbed_config,
flow_dur_sec,
data_pkt_size,
prio_dscp_map,
index):
index,
no_of_streams):
"""
Generate the configuration for a data flow
Expand Down Expand Up @@ -343,10 +354,10 @@ def __gen_data_flow(testbed_config,

global UDP_PORT_START
src_port = UDP_PORT_START
UDP_PORT_START += 1
UDP_PORT_START += no_of_streams
udp.src_port.increment.start = src_port
udp.src_port.increment.step = 1
udp.src_port.increment.count = 1
udp.src_port.increment.count = no_of_streams

ipv4.src.value = tx_port_config.ip
ipv4.dst.value = rx_port_config.ip
Expand Down Expand Up @@ -404,4 +415,4 @@ def verify_m2o_fluctuating_lossless_result(rows,
pytest_assert(int(row.loss) == 0, "FAIL: {} must have 0% loss".format(row.name))
elif 'Background Flow' in row.name:
background_loss += float(row.loss)
pytest_assert(int(background_loss/4) == 10, "Each Background Flow must have an avg of 10% loss ")
pytest_assert(round(background_loss/4) == 10, "Each Background Flow must have an avg of 10% loss ")
Loading
Loading