Skip to content
New issue

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

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

Already on GitHub? # to your account

[t0 t1 test merge] migrate ECN multidiut #16866

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
13 changes: 13 additions & 0 deletions tests/common/plugins/conditional_mark/tests_mark_conditions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2074,6 +2074,18 @@ snappi_tests:
conditions:
- "asic_type in ['vs']"

snappi_tests/ecn/test_ecn_marking_with_pfc_quanta_variance_with_snappi.py:
skip:
reason: "Current test case only work with cisco platform"
conditions:
- "asic_type not in ['cisco-8000']"

snappi_tests/ecn/test_ecn_marking_with_snappi.py:
skip:
reason: "Current test case only work with cisco platform"
conditions:
- "asic_type not in ['cisco-8000']"

snappi_tests/ecn/test_red_accuracy_with_snappi:
skip:
reason: "Test should not be run as part of nightly. / Snappi test only support on physical tgen testbed"
Expand All @@ -2082,6 +2094,7 @@ snappi_tests/ecn/test_red_accuracy_with_snappi:
- "topo_type in ['tgen']"
- "asic_type in ['vs']"


snappi_tests/multidut/pfc/test_multidut_global_pause_with_snappi.py:
skip:
reason: "Global pause is not supported in cisco-8000. / Snappi test only support on physical tgen testbed"
Expand Down
743 changes: 717 additions & 26 deletions tests/snappi_tests/ecn/files/helper.py

Large diffs are not rendered by default.

104 changes: 64 additions & 40 deletions tests/snappi_tests/ecn/test_dequeue_ecn_with_snappi.py
Original file line number Diff line number Diff line change
@@ -1,68 +1,96 @@
import pytest
import random
import logging

from tests.common.helpers.assertions import pytest_require, pytest_assert
from tests.common.fixtures.conn_graph_facts import conn_graph_facts,\
fanout_graph_facts # noqa F401
from tests.common.snappi_tests.snappi_fixtures import snappi_api_serv_ip, snappi_api_serv_port,\
snappi_api, snappi_testbed_config # noqa F401
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, \
fanout_graph_facts_multidut # noqa: F401
from tests.common.snappi_tests.snappi_fixtures import snappi_api_serv_ip, snappi_api_serv_port, \
get_snappi_ports_single_dut, snappi_testbed_config, \
get_snappi_ports_multi_dut, is_snappi_multidut, \
snappi_api, snappi_dut_base_config, get_snappi_ports, get_snappi_ports_for_rdma, cleanup_config # noqa: F401
from tests.common.snappi_tests.qos_fixtures import prio_dscp_map, lossless_prio_list # noqa F401

from tests.snappi_tests.variables import MULTIDUT_PORT_INFO, MULTIDUT_TESTBED
from tests.snappi_tests.ecn.files.helper import run_ecn_test
from tests.common.snappi_tests.read_pcap import is_ecn_marked
from tests.common.snappi_tests.snappi_test_params import SnappiTestParams
from tests.common.snappi_tests.common_helpers import packet_capture
from tests.snappi_tests.files.helper import skip_ecn_tests
from tests.common.config_reload import config_reload

from tests.common.snappi_tests.common_helpers import packet_capture
from tests.common.snappi_tests.snappi_test_params import SnappiTestParams
logger = logging.getLogger(__name__)

pytestmark = [pytest.mark.topology('tgen')]
pytestmark = [pytest.mark.topology('multidut-tgen', 'tgen')]


@pytest.mark.parametrize("multidut_port_info", MULTIDUT_PORT_INFO[MULTIDUT_TESTBED])
def test_dequeue_ecn(request,
snappi_api, # noqa F811
snappi_testbed_config, # noqa F811
conn_graph_facts, # noqa F811
fanout_graph_facts, # noqa F811
snappi_api, # noqa: F811
conn_graph_facts, # noqa: F811
fanout_graph_facts_multidut, # noqa: F811
duthosts,
rand_one_dut_hostname,
rand_one_dut_portname_oper_up,
rand_one_dut_lossless_prio,
prio_dscp_map): # noqa F811
lossless_prio_list, # noqa: F811
get_snappi_ports, # noqa: F811
tbinfo, # noqa: F811
multidut_port_info, # noqa: F811
prio_dscp_map): # noqa: F811
"""
Test if the device under test (DUT) performs ECN marking at the egress

Args:
request (pytest fixture): pytest request object
snappi_api (pytest fixture): SNAPPI session
snappi_testbed_config (pytest fixture): testbed configuration information
conn_graph_facts (pytest fixture): connection graph
fanout_graph_facts (pytest fixture): fanout graph
fanout_graph_facts_multidut (pytest fixture): fanout graph
duthosts (pytest fixture): list of DUTs
rand_one_dut_hostname (str): hostname of DUT
rand_one_dut_portname_oper_up (str): name of port to test, e.g., 's6100-1|Ethernet0'
lossless_prio_list (pytest fixture): list of all the lossless priorities
rand_one_dut_lossless_prio (str): name of lossless priority to test, e.g., 's6100-1|3'
line_card_choice: Line card choice to be mentioned in the variable.py file
linecard_configuration_set : Line card classification, (min 1 or max 2 hostnames and asics to be given)
prio_dscp_map (pytest fixture): priority vs. DSCP map (key = priority).

tbinfo (pytest fixture): fixture provides information about testbed
get_snappi_ports (pytest fixture): gets snappi ports and connected DUT port info and returns as a list
Returns:
N/A
"""
dut_hostname, dut_port = rand_one_dut_portname_oper_up.split('|')
dut_hostname2, lossless_prio = rand_one_dut_lossless_prio.split('|')
pytest_require(rand_one_dut_hostname == dut_hostname == dut_hostname2,
"Priority and port are not mapped to the expected DUT")

testbed_config, port_config_list = snappi_testbed_config
duthost = duthosts[rand_one_dut_hostname]
skip_ecn_tests(duthost)
lossless_prio = int(lossless_prio)
for testbed_subtype, rdma_ports in multidut_port_info.items():
tx_port_count = 1
rx_port_count = 1
snappi_port_list = get_snappi_ports
pytest_assert(len(snappi_port_list) >= tx_port_count + rx_port_count,
"Need Minimum of 2 ports defined in ansible/files/*links.csv file")

pytest_assert(len(rdma_ports['tx_ports']) >= tx_port_count,
'MULTIDUT_PORT_INFO doesn\'t have the required Tx ports defined for \
testbed {}, subtype {} in variables.py'.
format(MULTIDUT_TESTBED, testbed_subtype))

pytest_assert(len(rdma_ports['rx_ports']) >= rx_port_count,
'MULTIDUT_PORT_INFO doesn\'t have the required Rx ports defined for \
testbed {}, subtype {} in variables.py'.
format(MULTIDUT_TESTBED, testbed_subtype))
logger.info('Running test for testbed subtype: {}'.format(testbed_subtype))
if is_snappi_multidut(duthosts):
snappi_ports = get_snappi_ports_for_rdma(snappi_port_list, rdma_ports,
tx_port_count, rx_port_count, MULTIDUT_TESTBED)
else:
snappi_ports = get_snappi_ports
testbed_config, port_config_list, snappi_ports = snappi_dut_base_config(duthosts,
snappi_ports,
snappi_api)

lossless_prio = random.sample(lossless_prio_list, 1)
skip_ecn_tests(snappi_ports[0]['duthost'])
skip_ecn_tests(snappi_ports[1]['duthost'])
lossless_prio = int(lossless_prio[0])
snappi_extra_params = SnappiTestParams()

snappi_extra_params.multi_dut_params.multi_dut_ports = snappi_ports
snappi_extra_params.packet_capture_type = packet_capture.IP_CAPTURE
snappi_extra_params.is_snappi_ingress_port_cap = True
snappi_extra_params.ecn_params = {'kmin': 50000, 'kmax': 51000, 'pmax': 100}
data_flow_pkt_size = 1024
data_flow_pkt_count = 101
num_iterations = 1
logger.info("Running ECN dequeue test with params: {}".format(snappi_extra_params.ecn_params))

snappi_extra_params.traffic_flow_config.data_flow_config = {
Expand All @@ -74,12 +102,11 @@ def test_dequeue_ecn(request,
testbed_config=testbed_config,
port_config_list=port_config_list,
conn_data=conn_graph_facts,
fanout_data=fanout_graph_facts,
duthost=duthost,
dut_port=dut_port,
fanout_data=fanout_graph_facts_multidut,
dut_port=snappi_ports[0]['peer_port'],
lossless_prio=lossless_prio,
prio_dscp_map=prio_dscp_map,
iters=1,
iters=num_iterations,
snappi_extra_params=snappi_extra_params)[0]

logger.info("Running verification for ECN dequeue test")
Expand All @@ -93,7 +120,4 @@ def test_dequeue_ecn(request,
# Check if the last packet is not ECN marked
pytest_assert(not is_ecn_marked(ip_pkts[-1]),
"The last packet should not be marked")

# Teardown ECN config through a reload
logger.info("Reloading config to teardown ECN config")
config_reload(sonic_host=duthost, config_source='config_db', safe_reload=True)
cleanup_config(duthosts, snappi_ports)
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from tests.common.snappi_tests.qos_fixtures import prio_dscp_map, \
lossless_prio_list, disable_pfcwd # noqa F401
from tests.snappi_tests.files.helper import multidut_port_info, setup_ports_and_dut, enable_debug_shell # noqa: F401
from tests.snappi_tests.multidut.ecn.files.multidut_helper import run_ecn_marking_with_pfc_quanta_variance
from tests.snappi_tests.ecn.files.helper import run_ecn_marking_with_pfc_quanta_variance
from tests.common.snappi_tests.snappi_test_params import SnappiTestParams
logger = logging.getLogger(__name__)
pytestmark = [pytest.mark.topology('multidut-tgen', 'tgen')]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from tests.common.snappi_tests.qos_fixtures import prio_dscp_map, \
lossless_prio_list, disable_pfcwd # noqa F401
from tests.snappi_tests.files.helper import multidut_port_info, setup_ports_and_dut, enable_debug_shell # noqa: F401
from tests.snappi_tests.multidut.ecn.files.multidut_helper import run_ecn_marking_test, \
from tests.snappi_tests.ecn.files.helper import run_ecn_marking_test, \
run_ecn_marking_port_toggle_test, run_ecn_marking_ect_marked_pkts
from tests.common.snappi_tests.snappi_test_params import SnappiTestParams
from tests.common.cisco_data import is_cisco_device
Expand Down
Loading
Loading