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
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# 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 @@ -316,7 +317,12 @@ def __gen_data_flow(testbed_config,
flow = testbed_config.flows.flow(name='{} {} -> {}'.format(flow_name_prefix, src_port_id, dst_port_id))[-1]
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 = flow.packet.ethernet().ipv4()
eth, ipv4, udp = flow.packet.ethernet().ipv4().udp()
src_port = random.randint(5000, 6000)
udp.src_port.increment.start = src_port
udp.src_port.increment.step = 1
udp.src_port.increment.count = 1
Copy link
Copy Markdown
Contributor

@sdszhang sdszhang Aug 13, 2024

Choose a reason for hiding this comment

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

if the total count is 1, one flow will use only one UDP port. When test case has two test flows, there is still 50% chance that two flows may be sent on the same physical link.
maybe we should increase the total count to 2 or higher? better to define it as a common variable in case it needs to be changed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we can leave this as it is for now. and monitor it for further improvements when needed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If traffic on each queue <= 200G, we can remove random and set fixed udp port for each queue.
Something like src_port = 5000 + queue_id


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,6 +5,7 @@
# 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 @@ -322,7 +323,12 @@ def __gen_data_flow(testbed_config,
flow = testbed_config.flows.flow(name='{} {} -> {}'.format(flow_name_prefix, src_port_id, dst_port_id))[-1]
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 = flow.packet.ethernet().ipv4()
eth, ipv4, udp = flow.packet.ethernet().ipv4().udp()
src_port = random.randint(5000, 6000)
udp.src_port.increment.start = src_port
udp.src_port.increment.step = 1
udp.src_port.increment.count = 1

eth.src.value = tx_mac
eth.dst.value = rx_mac

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
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 @@ -302,7 +303,12 @@ def __gen_data_flow(testbed_config,
src_port_id, dst_port_id, flow_rate_percent))[-1]
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 = flow.packet.ethernet().ipv4()
eth, ipv4, udp = flow.packet.ethernet().ipv4().udp()
src_port = random.randint(5000, 6000)
udp.src_port.increment.start = src_port
udp.src_port.increment.step = 1
udp.src_port.increment.count = 1

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,6 +5,7 @@
# 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 @@ -280,7 +281,12 @@ def __gen_data_flow(testbed_config,
flow = testbed_config.flows.flow(name='{} {} -> {}'.format(flow_name_prefix, src_port_id, dst_port_id))[-1]
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 = flow.packet.ethernet().ipv4()
eth, ipv4, udp = flow.packet.ethernet().ipv4().udp()
src_port = random.randint(5000, 6000)
udp.src_port.increment.start = src_port
udp.src_port.increment.step = 1
udp.src_port.increment.count = 1

eth.src.value = tx_mac
eth.dst.value = rx_mac
flow.duration.fixed_seconds.delay.nanoseconds = int(sec_to_nanosec(DATA_FLOW_DELAY_SEC))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# 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 @@ -290,7 +291,12 @@ def __gen_data_flow(testbed_config,
dst_port_id, flow_rate_percent))[-1]
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 = flow.packet.ethernet().ipv4()
eth, ipv4, udp = flow.packet.ethernet().ipv4().udp()
src_port = random.randint(5000, 6000)
udp.src_port.increment.start = src_port
udp.src_port.increment.step = 1
udp.src_port.increment.count = 1

eth.src.value = tx_mac
eth.dst.value = rx_mac
flow.duration.fixed_seconds.delay.nanoseconds = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# 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 @@ -301,7 +302,12 @@ def __gen_data_flow(testbed_config,
flow = testbed_config.flows.flow(name='{} {} -> {}'.format(flow_name_prefix, src_port_id, dst_port_id))[-1]
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 = flow.packet.ethernet().ipv4()
eth, ipv4, udp = flow.packet.ethernet().ipv4().udp()
src_port = random.randint(5000, 6000)
udp.src_port.increment.start = src_port
udp.src_port.increment.step = 1
udp.src_port.increment.count = 1

eth.src.value = tx_mac
eth.dst.value = rx_mac

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import time
from math import ceil
import logging
import random

from tests.common.helpers.assertions import pytest_assert
from tests.common.fixtures.conn_graph_facts import conn_graph_facts, fanout_graph_facts # noqa: F401
Expand Down Expand Up @@ -125,6 +126,7 @@ def run_pfcwd_basic_test(api,
flow1_min_loss_rate = 0

exp_dur_sec = flow2_delay_sec + flow2_dur_sec + 1
cisco_platform = "Cisco" in egress_duthost.facts['hwsku']

""" Generate traffic config """
__gen_traffic(testbed_config=testbed_config,
Expand All @@ -140,7 +142,9 @@ def run_pfcwd_basic_test(api,
warm_up_traffic_dur_sec, flow1_dur_sec, flow2_dur_sec],
data_pkt_size=DATA_PKT_SIZE,
prio_list=prio_list,
prio_dscp_map=prio_dscp_map)
prio_dscp_map=prio_dscp_map,
traffic_rate=99.98 if cisco_platform else 100.0,
number_of_streams=2 if cisco_platform else 1)

flows = testbed_config.flows

Expand Down Expand Up @@ -204,7 +208,9 @@ def __gen_traffic(testbed_config,
data_flow_dur_sec_list,
data_pkt_size,
prio_list,
prio_dscp_map):
prio_dscp_map,
traffic_rate,
number_of_streams):
"""
Generate configurations of flows, including data flows and pause storm.

Expand All @@ -220,6 +226,8 @@ def __gen_traffic(testbed_config,
data_pkt_size (int): size of data packets in byte
prio_list (list): priorities of data flows and pause storm
prio_dscp_map (dict): Priority vs. DSCP map (key = priority).
traffic_rate: Total rate of traffic for all streams together.
number_of_streams: The number of UDP streams needed.

Returns:
N/A
Expand Down Expand Up @@ -292,7 +300,7 @@ def __gen_traffic(testbed_config,

tx_port_name = testbed_config.ports[tx_port_id].name
rx_port_name = testbed_config.ports[rx_port_id].name
data_flow_rate_percent = int(100 / len(prio_list))
data_flow_rate_percent = int(traffic_rate / len(prio_list))

""" For each data flow """
for i in range(len(data_flow_name_list)):
Expand All @@ -304,7 +312,12 @@ def __gen_traffic(testbed_config,
data_flow.tx_rx.port.tx_name = tx_port_name
data_flow.tx_rx.port.rx_name = rx_port_name

eth, ipv4 = data_flow.packet.ethernet().ipv4()
eth, ipv4, udp = data_flow.packet.ethernet().ipv4().udp()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seems only packet-chassis will be affected by the backplane issue. Should we use an if..else.. to show it's platform specific behavior?

src_port = random.randint(5000, 6000)
udp.src_port.increment.start = src_port
udp.src_port.increment.step = 1
udp.src_port.increment.count = number_of_streams

eth.src.value = tx_mac
eth.dst.value = rx_mac
if pfcQueueGroupSize == 8:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import time
from math import ceil
import logging
import random
from tests.common.helpers.assertions import pytest_assert
from tests.common.snappi_tests.snappi_helpers import get_dut_port_id # noqa: F401
from tests.common.snappi_tests.common_helpers import pfc_class_enable_vector, \
Expand Down Expand Up @@ -180,7 +181,12 @@ def __gen_traffic(testbed_config,
data_flow.tx_rx.port.tx_name = tx_port_name
data_flow.tx_rx.port.rx_name = rx_port_name

eth, ipv4 = data_flow.packet.ethernet().ipv4()
eth, ipv4, udp = data_flow.packet.ethernet().ipv4().udp()
src_port = random.randint(5000, 6000)
udp.src_port.increment.start = src_port
udp.src_port.increment.step = 1
udp.src_port.increment.count = 1

eth.src.value = tx_mac
eth.dst.value = rx_mac
if pfcQueueGroupSize == 8:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import time
from math import ceil
import logging
import random

from tests.common.helpers.assertions import pytest_assert, pytest_require
from tests.common.fixtures.conn_graph_facts import conn_graph_facts, fanout_graph_facts # noqa: F401
Expand Down Expand Up @@ -107,6 +108,16 @@ def run_pfcwd_multi_node_test(api,
pfc_storm_dur_sec = 0.5 * detect_time_sec

exp_dur_sec = ceil(pfc_storm_dur_sec + 1)
cisco_platform = "Cisco" in egress_duthost.facts['hwsku']

speed_str = testbed_config.layer1[0].speed
speed_gbps = int(speed_str.split('_')[1])
# Backplane is 200G in Cisco platforms.
if speed_gbps > 200 and cisco_platform:
global TEST_FLOW_AGGR_RATE_PERCENT
global BG_FLOW_AGGR_RATE_PERCENT
TEST_FLOW_AGGR_RATE_PERCENT = TEST_FLOW_AGGR_RATE_PERCENT * 200 / speed_gbps
BG_FLOW_AGGR_RATE_PERCENT = BG_FLOW_AGGR_RATE_PERCENT * 200 / speed_gbps

""" Generate traffic config """
test_flow_rate_percent = int(TEST_FLOW_AGGR_RATE_PERCENT /
Expand Down Expand Up @@ -144,9 +155,6 @@ def run_pfcwd_multi_node_test(api,
all_flow_names=all_flow_names,
exp_dur_sec=exp_dur_sec)

speed_str = testbed_config.layer1[0].speed
speed_gbps = int(speed_str.split('_')[1])

__verify_results(rows=flow_stats,
speed_gbps=speed_gbps,
pause_flow_name=PAUSE_FLOW_NAME,
Expand Down Expand Up @@ -409,7 +417,12 @@ 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 = flow.packet.ethernet().ipv4()
eth, ipv4, udp = flow.packet.ethernet().ipv4().udp()
src_port = random.randint(5000, 6000)
udp.src_port.increment.start = src_port
udp.src_port.increment.step = 1
udp.src_port.increment.count = 1

eth.src.value = tx_mac
eth.dst.value = rx_mac
if pfcQueueGroupSize == 8:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import time
import logging
import random

from tests.common.helpers.assertions import pytest_assert
from tests.common.snappi_tests.snappi_helpers import get_dut_port_id # noqa: F401
Expand Down Expand Up @@ -144,7 +145,12 @@ def __gen_traffic(testbed_config,
data_flow.tx_rx.port.tx_name = tx_port_name
data_flow.tx_rx.port.rx_name = rx_port_name

eth, ipv4 = data_flow.packet.ethernet().ipv4()
eth, ipv4, udp = data_flow.packet.ethernet().ipv4().udp()
src_port = random.randint(5000, 6000)
udp.src_port.increment.start = src_port
udp.src_port.increment.step = 1
udp.src_port.increment.count = 1

eth.src.value = tx_mac
eth.dst.value = rx_mac
if pfcQueueGroupSize == 8:
Expand Down
7 changes: 6 additions & 1 deletion tests/snappi_tests/test_multidut_snappi.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ def __gen_all_to_all_traffic(testbed_config,
flow.tx_rx.port.tx_name = tx_port_name
flow.tx_rx.port.rx_name = rx_port_name

eth, ipv4 = flow.packet.ethernet().ipv4()
eth, ipv4, udp = flow.packet.ethernet().ipv4().udp()
src_port = random.randint(5000, 6000)
udp.src_port.increment.start = src_port
udp.src_port.increment.step = 1
udp.src_port.increment.count = 1

eth.src.value = tx_mac
eth.dst.value = rx_mac
eth.pfc_queue.value = priority
Expand Down