From 46c670198e3238afc1007cb2de2880cee1a2f67b Mon Sep 17 00:00:00 2001 From: selldinesh Date: Fri, 21 Jun 2024 18:27:39 +0000 Subject: [PATCH] Adding support for RDMA cases for pfcQueueGroupSize of 4 --- tests/common/snappi_tests/snappi_fixtures.py | 31 +++++++++++++------ .../common/snappi_tests/traffic_generation.py | 11 +++++-- tests/snappi_tests/variables.py | 10 ++++++ 3 files changed, 41 insertions(+), 11 deletions(-) diff --git a/tests/common/snappi_tests/snappi_fixtures.py b/tests/common/snappi_tests/snappi_fixtures.py index fe7f0b5f815..44327a7ae00 100644 --- a/tests/common/snappi_tests/snappi_fixtures.py +++ b/tests/common/snappi_tests/snappi_fixtures.py @@ -15,7 +15,8 @@ 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, \ - dut_ipv6_start, snappi_ipv6_start, v6_prefix_length + dut_ipv6_start, snappi_ipv6_start, v6_prefix_length, pfcQueueGroupSize, \ + pfcQueueValueDict logger = logging.getLogger(__name__) @@ -406,14 +407,26 @@ 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 = [] diff --git a/tests/common/snappi_tests/traffic_generation.py b/tests/common/snappi_tests/traffic_generation.py index 3f5c78f59b1..464b64a8382 100644 --- a/tests/common/snappi_tests/traffic_generation.py +++ b/tests/common/snappi_tests/traffic_generation.py @@ -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__) @@ -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 @@ -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 diff --git a/tests/snappi_tests/variables.py b/tests/snappi_tests/variables.py index 7ee8c8aabbf..5886b5be1ab 100644 --- a/tests/snappi_tests/variables.py +++ b/tests/snappi_tests/variables.py @@ -56,3 +56,13 @@ dut_ipv6_start = '2000:1::1' snappi_ipv6_start = '2000:1::2' v6_prefix_length = 16 + +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}