Skip to content
Open
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
32 changes: 23 additions & 9 deletions tests/common/snappi_tests/snappi_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
from tests.common.snappi_tests.snappi_helpers import SnappiFanoutManager, get_snappi_port_location
from tests.common.snappi_tests.port import SnappiPortConfig, SnappiPortType
from tests.common.helpers.assertions import pytest_assert
from tests.snappi_tests.variables import dut_ip_start, snappi_ip_start, prefix_length
from tests.snappi_tests.variables import dut_ip_start, snappi_ip_start, prefix_length, pfcQueueGroupSize, \
pfcQueueValueDict
logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -403,14 +404,27 @@ def snappi_testbed_config(conn_graph_facts, fanout_graph_facts, # noqa F811

pfc = l1_config.flow_control.ieee_802_1qbb
pfc.pfc_delay = 0
pfc.pfc_class_0 = 0
pfc.pfc_class_1 = 1
pfc.pfc_class_2 = 2
pfc.pfc_class_3 = 3
pfc.pfc_class_4 = 4
pfc.pfc_class_5 = 5
pfc.pfc_class_6 = 6
pfc.pfc_class_7 = 7
if pfcQueueGroupSize == 8:
pfc.pfc_class_0 = 0
pfc.pfc_class_1 = 1
pfc.pfc_class_2 = 2
pfc.pfc_class_3 = 3
pfc.pfc_class_4 = 4
pfc.pfc_class_5 = 5
pfc.pfc_class_6 = 6
pfc.pfc_class_7 = 7
elif pfcQueueGroupSize == 4:
pfc.pfc_class_0 = pfcQueueValueDict[0]
pfc.pfc_class_1 = pfcQueueValueDict[1]
pfc.pfc_class_2 = pfcQueueValueDict[2]
pfc.pfc_class_3 = pfcQueueValueDict[3]
pfc.pfc_class_4 = pfcQueueValueDict[4]
pfc.pfc_class_5 = pfcQueueValueDict[5]
pfc.pfc_class_6 = pfcQueueValueDict[6]
pfc.pfc_class_7 = pfcQueueValueDict[7]

else:
pytest_assert(False, 'pfcQueueGroupSize value is not 4 or 8')

port_config_list = []

Expand Down
11 changes: 9 additions & 2 deletions tests/common/snappi_tests/traffic_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
traffic_flow_mode
from tests.common.snappi_tests.port import select_ports, select_tx_port
from tests.common.snappi_tests.snappi_helpers import wait_for_arp, fetch_snappi_flow_metrics
from tests.snappi_tests.variables import pfcQueueGroupSize, pfcQueueValueDict

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -119,7 +120,10 @@ def generate_test_flows(testbed_config,
eth, ipv4 = test_flow.packet.ethernet().ipv4()
eth.src.value = base_flow_config["tx_mac"]
eth.dst.value = base_flow_config["rx_mac"]
eth.pfc_queue.value = prio
if pfcQueueGroupSize == 8:
eth.pfc_queue.value = prio
else:
eth.pfc_queue.value = pfcQueueValueDict[prio]

ipv4.src.value = base_flow_config["tx_port_config"].ip
ipv4.dst.value = base_flow_config["rx_port_config"].ip
Expand Down Expand Up @@ -184,7 +188,10 @@ def generate_background_flows(testbed_config,
eth, ipv4 = bg_flow.packet.ethernet().ipv4()
eth.src.value = base_flow_config["tx_mac"]
eth.dst.value = base_flow_config["rx_mac"]
eth.pfc_queue.value = prio
if pfcQueueGroupSize == 8:
eth.pfc_queue.value = prio
else:
eth.pfc_queue.value = pfcQueueValueDict[prio]

ipv4.src.value = base_flow_config["tx_port_config"].ip
ipv4.dst.value = base_flow_config["rx_port_config"].ip
Expand Down
11 changes: 11 additions & 0 deletions tests/snappi_tests/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,14 @@
dut_ip_start = '20.0.1.1'
snappi_ip_start = '20.0.1.2'
prefix_length = 24


pfcQueueGroupSize = 8 # can have values 4 or 8
pfcQueueValueDict = {0: 0,
1: 1,
2: 0,
3: 3,
4: 2,
5: 0,
6: 1,
7: 0}