diff --git a/tests/common/ixia/common_helpers.py b/tests/common/ixia/common_helpers.py index 5553e2632cd..b38d4beb9cb 100644 --- a/tests/common/ixia/common_helpers.py +++ b/tests/common/ixia/common_helpers.py @@ -13,6 +13,7 @@ import ipaddr from netaddr import IPNetwork +from tests.common.mellanox_data import is_mellanox_device as isMellanoxDevice def increment_ip_address (ip, incr=1) : """ @@ -466,3 +467,59 @@ def get_pfcwd_restore_time(host_ans, intf): return int(val) return None + +def start_pfcwd(duthost): + """ + Start PFC watchdog with default setting + + Args: + duthost (AnsibleHost): Device Under Test (DUT) + + Returns: + N/A + """ + duthost.shell('sudo pfcwd start_default') + +def stop_pfcwd(duthost): + """ + Stop PFC watchdog + + Args: + duthost (AnsibleHost): Device Under Test (DUT) + + Returns: + N/A + """ + duthost.shell('sudo pfcwd stop') + +def disable_packet_aging(duthost): + """ + Disable packet aging feature (only on MLNX switches) + + Args: + duthost (AnsibleHost): Device Under Test (DUT) + + Returns: + N/A + """ + if isMellanoxDevice(duthost): + duthost.copy(src="qos/files/mellanox/packets_aging.py", dest="/tmp") + duthost.command("docker cp /tmp/packets_aging.py syncd:/") + duthost.command("docker exec syncd python /packets_aging.py disable") + duthost.command("docker exec syncd rm -rf /packets_aging.py") + +def enable_packet_aging(duthost): + """ + Enable packet aging feature (only on MLNX switches) + + Args: + duthost (AnsibleHost): Device Under Test (DUT) + + Returns: + N/A + """ + if isMellanoxDevice(duthost): + duthost.copy(src="qos/files/mellanox/packets_aging.py", dest="/tmp") + duthost.command("docker cp /tmp/packets_aging.py syncd:/") + duthost.command("docker exec syncd python /packets_aging.py enable") + duthost.command("docker exec syncd rm -rf /packets_aging.py") diff --git a/tests/common/ixia/qos_fixtures.py b/tests/common/ixia/qos_fixtures.py index aac7c1834aa..7f20e655ce9 100644 --- a/tests/common/ixia/qos_fixtures.py +++ b/tests/common/ixia/qos_fixtures.py @@ -1,4 +1,5 @@ import pytest + """ RDMA test cases may require variety of fixtures. This file currently holds the following fixture(s): @@ -6,7 +7,6 @@ 2. all_prio_list 3. lossless_prio_list 4. lossy_prio_list - 5. start_pfcwd_default """ @pytest.fixture(scope="module") @@ -102,19 +102,3 @@ def lossy_prio_list(all_prio_list, lossless_prio_list): """ result = [x for x in all_prio_list if x not in lossless_prio_list] return result - -@pytest.fixture(scope="function") -def start_pfcwd_default(duthosts, rand_one_dut_hostname): - """ - Start PFC watchdog with default setting - - Args: - duthosts (pytest fixture) : list of DUTs - rand_one_dut_hostname (pytest fixture): DUT hostname - """ - duthost = duthosts[rand_one_dut_hostname] - duthost.shell('sudo pfcwd start_default') - yield - - """ teardown code """ - duthost.shell('sudo pfcwd stop') diff --git a/tests/pfc/conftest.py b/tests/ixia/conftest.py similarity index 53% rename from tests/pfc/conftest.py rename to tests/ixia/conftest.py index 8e0445c02aa..d0db9397436 100644 --- a/tests/pfc/conftest.py +++ b/tests/ixia/conftest.py @@ -1,24 +1,7 @@ import pytest - -from tests.conftest import generate_port_lists, generate_priority_lists - -@pytest.fixture(autouse=True, scope="module") -def rand_one_oper_up_intf(request): - """ - Fixture that randomly selects one oper up interface - - Args: - request (object): pytest request object - - Yields: - interface (str): string containing 'hostname|selected intf' - - """ - oper_up_intfs = generate_port_lists(request, "oper_up_ports") - if oper_up_intfs: - yield random.sample(oper_up_intfs, 1)[0] - else: - yield 'unknown|unknown' +import random +from tests.common.ixia.common_helpers import enable_packet_aging, start_pfcwd +from tests.conftest import generate_priority_lists @pytest.fixture(autouse=True, scope="module") def rand_lossless_prio(request): @@ -55,3 +38,37 @@ def rand_lossy_prio(request): yield random.sample(lossy_prios, 1)[0] else: yield 'unknown|unknown' + +@pytest.fixture(autouse=True, scope="module") +def start_pfcwd_after_test(duthosts, rand_one_dut_hostname): + """ + Ensure that PFC watchdog is enabled with default setting after tests + + Args: + duthosts (pytest fixture) : list of DUTs + rand_one_dut_hostname (pytest fixture): DUT hostname + + Yields: + N/A + """ + yield + + duthost = duthosts[rand_one_dut_hostname] + start_pfcwd(duthost) + +@pytest.fixture(autouse=True, scope="module") +def enable_packet_aging_after_test(duthosts, rand_one_dut_hostname): + """ + Ensure that packet aging is enabled after tests + + Args: + duthosts (pytest fixture) : list of DUTs + rand_one_dut_hostname (pytest fixture): DUT hostname + + Yields: + N/A + """ + yield + + duthost = duthosts[rand_one_dut_hostname] + enable_packet_aging(duthost) diff --git a/tests/ecn/args/__init__.py b/tests/ixia/ecn/args/__init__.py similarity index 100% rename from tests/ecn/args/__init__.py rename to tests/ixia/ecn/args/__init__.py diff --git a/tests/ecn/args/ecn_args.py b/tests/ixia/ecn/args/ecn_args.py similarity index 100% rename from tests/ecn/args/ecn_args.py rename to tests/ixia/ecn/args/ecn_args.py diff --git a/tests/ecn/conftest.py b/tests/ixia/ecn/conftest.py similarity index 100% rename from tests/ecn/conftest.py rename to tests/ixia/ecn/conftest.py diff --git a/tests/ecn/files/__init__.py b/tests/ixia/ecn/files/__init__.py similarity index 100% rename from tests/ecn/files/__init__.py rename to tests/ixia/ecn/files/__init__.py diff --git a/tests/ecn/files/helper.py b/tests/ixia/ecn/files/helper.py similarity index 98% rename from tests/ecn/files/helper.py rename to tests/ixia/ecn/files/helper.py index 849feff6d0e..a252d77f02a 100644 --- a/tests/ecn/files/helper.py +++ b/tests/ixia/ecn/files/helper.py @@ -8,7 +8,7 @@ ixia_api_serv_user, ixia_api_serv_passwd, ixia_api from tests.common.ixia.ixia_helpers import get_dut_port_id from tests.common.ixia.common_helpers import pfc_class_enable_vector, config_wred,\ - enable_ecn, config_ingress_lossless_buffer_alpha + enable_ecn, config_ingress_lossless_buffer_alpha, stop_pfcwd, disable_packet_aging from abstract_open_traffic_generator.capture import CustomFilter, Capture,\ BasicFilter @@ -67,8 +67,8 @@ def run_ecn_test(api, pytest_assert(testbed_config is not None, 'Failed to get L2/3 testbed config') - """ Disable PFC watchdog """ - duthost.shell('sudo pfcwd stop') + stop_pfcwd(duthost) + disable_packet_aging(duthost) """ Configure WRED/ECN thresholds """ config_result = config_wred(host_ans=duthost, diff --git a/tests/ecn/test_dequeue_ecn.py b/tests/ixia/ecn/test_dequeue_ecn.py similarity index 87% rename from tests/ecn/test_dequeue_ecn.py rename to tests/ixia/ecn/test_dequeue_ecn.py index 5e4a9bf0b24..4031ffe3016 100644 --- a/tests/ecn/test_dequeue_ecn.py +++ b/tests/ixia/ecn/test_dequeue_ecn.py @@ -18,8 +18,8 @@ def test_dequeue_ecn(request, fanout_graph_facts, duthosts, rand_one_dut_hostname, - enum_dut_portname_oper_up, - enum_dut_lossless_prio, + rand_one_dut_portname_oper_up, + rand_one_dut_lossless_prio, prio_dscp_map): """ Test if the device under test (DUT) performs ECN marking at the egress @@ -32,8 +32,8 @@ def test_dequeue_ecn(request, fanout_graph_facts (pytest fixture): fanout graph duthosts (pytest fixture): list of DUTs rand_one_dut_hostname (str): hostname of DUT - enum_dut_portname_oper_up (str): name of port to test, e.g., 's6100-1|Ethernet0' - enum_dut_lossless_prio (str): name of lossless priority to test, e.g., 's6100-1|3' + rand_one_dut_portname_oper_up (str): name of port to test, e.g., 's6100-1|Ethernet0' + rand_one_dut_lossless_prio (str): name of lossless priority to test, e.g., 's6100-1|3' prio_dscp_map (pytest fixture): priority vs. DSCP map (key = priority). Returns: @@ -43,8 +43,8 @@ def test_dequeue_ecn(request, if disable_test: pytest.skip("test_dequeue_ecn is disabled") - dut_hostname, dut_port = enum_dut_portname_oper_up.split('|') - dut_hostname2, lossless_prio = enum_dut_lossless_prio.split('|') + 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") diff --git a/tests/ecn/test_red_accuracy.py b/tests/ixia/ecn/test_red_accuracy.py similarity index 100% rename from tests/ecn/test_red_accuracy.py rename to tests/ixia/ecn/test_red_accuracy.py diff --git a/tests/ixia/pfc/__init__.py b/tests/ixia/pfc/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/pfc/files/__init__.py b/tests/ixia/pfc/files/__init__.py similarity index 100% rename from tests/pfc/files/__init__.py rename to tests/ixia/pfc/files/__init__.py diff --git a/tests/pfc/files/helper.py b/tests/ixia/pfc/files/helper.py similarity index 98% rename from tests/pfc/files/helper.py rename to tests/ixia/pfc/files/helper.py index f168b39c9eb..5e4d49321f1 100644 --- a/tests/pfc/files/helper.py +++ b/tests/ixia/pfc/files/helper.py @@ -7,7 +7,7 @@ ixia_api_serv_user, ixia_api_serv_passwd, ixia_api from tests.common.ixia.ixia_helpers import get_dut_port_id from tests.common.ixia.common_helpers import pfc_class_enable_vector,\ - get_egress_lossless_buffer_size + get_egress_lossless_buffer_size, stop_pfcwd, disable_packet_aging from abstract_open_traffic_generator.flow import DeviceTxRx, TxRx, Flow, Header,\ Size, Rate,Duration, FixedSeconds, PortTxRx, PfcPause, EthernetPause, Continuous @@ -59,13 +59,13 @@ def run_pfc_test(api, test_traffic_pause (bool): if test flows are expected to be paused Returns: - None + N/A """ pytest_assert(testbed_config is not None, 'Fail to get L2/3 testbed config') - """ Disable PFC watchdog """ - duthost.shell('sudo pfcwd stop') + stop_pfcwd(duthost) + disable_packet_aging(duthost) """ Get the ID of the port to test """ port_id = get_dut_port_id(dut_hostname=duthost.hostname, @@ -310,7 +310,10 @@ def __run_traffic(api, api.set_state(State(FlowTransmitState(state='start'))) time.sleep(exp_dur_sec) - while True: + attempts = 0 + max_attempts = 20 + + while attempts < max_attempts: rows = api.get_flow_results(FlowRequest(flow_names=data_flow_names)) """ If all the data flows have stopped """ @@ -321,6 +324,7 @@ def __run_traffic(api, break else: time.sleep(1) + attempts += 1 """ Dump per-flow statistics """ rows = api.get_flow_results(FlowRequest(flow_names=all_flow_names)) @@ -357,7 +361,7 @@ def __verify_results(rows, tolerance (float): maximum allowable deviation Returns: - None + N/A """ """ All the pause frames should be dropped """ diff --git a/tests/pfc/test_global_pause.py b/tests/ixia/pfc/test_global_pause.py similarity index 90% rename from tests/pfc/test_global_pause.py rename to tests/ixia/pfc/test_global_pause.py index 825183df38a..503c1ba5d6b 100644 --- a/tests/pfc/test_global_pause.py +++ b/tests/ixia/pfc/test_global_pause.py @@ -18,7 +18,7 @@ def test_global_pause(ixia_api, fanout_graph_facts, duthosts, rand_one_dut_hostname, - enum_dut_portname_oper_up, + rand_one_dut_portname_oper_up, lossless_prio_list, lossy_prio_list, prio_dscp_map): @@ -32,16 +32,16 @@ def test_global_pause(ixia_api, fanout_graph_facts (pytest fixture): fanout graph duthosts (pytest fixture): list of DUTs rand_one_dut_hostname (str): hostname of DUT - enum_dut_portname_oper_up (str): name of port to test, e.g., 's6100-1|Ethernet0' + 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 lossy_prio_list (pytest fixture): list of all the lossy priorities prio_dscp_map (pytest fixture): priority vs. DSCP map (key = priority). Returns: - None + N/A """ - dut_hostname, dut_port = enum_dut_portname_oper_up.split('|') + dut_hostname, dut_port = rand_one_dut_portname_oper_up.split('|') pytest_require(rand_one_dut_hostname == dut_hostname, "Port is not mapped to the expected DUT") diff --git a/tests/pfc/test_pfc_pause_lossless.py b/tests/ixia/pfc/test_pfc_pause_lossless.py similarity index 90% rename from tests/pfc/test_pfc_pause_lossless.py rename to tests/ixia/pfc/test_pfc_pause_lossless.py index 085039f2b49..b9714f35746 100644 --- a/tests/pfc/test_pfc_pause_lossless.py +++ b/tests/ixia/pfc/test_pfc_pause_lossless.py @@ -22,7 +22,7 @@ def test_pfc_pause_single_lossless_prio(ixia_api, fanout_graph_facts, duthosts, rand_one_dut_hostname, - enum_dut_portname_oper_up, + rand_one_dut_portname_oper_up, enum_dut_lossless_prio, all_prio_list, prio_dscp_map): @@ -36,16 +36,16 @@ def test_pfc_pause_single_lossless_prio(ixia_api, fanout_graph_facts (pytest fixture): fanout graph duthosts (pytest fixture): list of DUTs rand_one_dut_hostname (str): hostname of DUT - enum_dut_portname_oper_up (str): name of port to test, e.g., 's6100-1|Ethernet0' - enum_dut_lossless_prio (str): name of lossless priority to test, e.g., 's6100-1|3' + rand_one_dut_portname_oper_up (str): port to test, e.g., 's6100-1|Ethernet0' + enum_dut_lossless_prio (str): lossless priority to test, e.g., 's6100-1|3' all_prio_list (pytest fixture): list of all the priorities prio_dscp_map (pytest fixture): priority vs. DSCP map (key = priority). Returns: - None + N/A """ - dut_hostname, dut_port = enum_dut_portname_oper_up.split('|') + dut_hostname, dut_port = rand_one_dut_portname_oper_up.split('|') dut_hostname2, lossless_prio = enum_dut_lossless_prio.split('|') pytest_require(rand_one_dut_hostname == dut_hostname == dut_hostname2, "Priority and port are not mapped to the expected DUT") @@ -77,7 +77,7 @@ def test_pfc_pause_multi_lossless_prio(ixia_api, fanout_graph_facts, duthosts, rand_one_dut_hostname, - enum_dut_portname_oper_up, + rand_one_dut_portname_oper_up, lossless_prio_list, lossy_prio_list, prio_dscp_map): @@ -91,16 +91,16 @@ def test_pfc_pause_multi_lossless_prio(ixia_api, fanout_graph_facts (pytest fixture): fanout graph duthosts (pytest fixture): list of DUTs rand_one_dut_hostname (str): hostname of DUT - enum_dut_portname_oper_up (str): name of port to test, e.g., 's6100-1|Ethernet0' + rand_one_dut_portname_oper_up (str): port to test, e.g., 's6100-1|Ethernet0' lossless_prio_list (pytest fixture): list of all the lossless priorities lossy_prio_list (pytest fixture): list of all the lossy priorities prio_dscp_map (pytest fixture): priority vs. DSCP map (key = priority). Returns: - None + N/A """ - dut_hostname, dut_port = enum_dut_portname_oper_up.split('|') + dut_hostname, dut_port = rand_one_dut_portname_oper_up.split('|') pytest_require(rand_one_dut_hostname == dut_hostname, "Port is not mapped to the expected DUT") @@ -130,7 +130,7 @@ def test_pfc_pause_single_lossless_prio_reboot(ixia_api, localhost, duthosts, rand_one_dut_hostname, - rand_one_oper_up_intf, + rand_one_dut_portname_oper_up, rand_lossless_prio, all_prio_list, prio_dscp_map, @@ -146,17 +146,17 @@ def test_pfc_pause_single_lossless_prio_reboot(ixia_api, localhost (pytest fixture): localhost handle duthosts (pytest fixture): list of DUTs rand_one_dut_hostname (str): hostname of DUT - rand_one_oper_up_intf (str): port to test, e.g., 's6100-1|Ethernet0' + rand_one_dut_portname_oper_up (str): port to test, e.g., 's6100-1|Ethernet0' rand_lossless_prio (str): lossless priority to test, e.g., 's6100-1|3' all_prio_list (pytest fixture): list of all the priorities prio_dscp_map (pytest fixture): priority vs. DSCP map (key = priority). reboot_type (str): reboot type to be issued on the DUT Returns: - None + N/A """ - dut_hostname, dut_port = rand_one_oper_up_intf.split('|') + dut_hostname, dut_port = rand_one_dut_portname_oper_up.split('|') dut_hostname2, lossless_prio = rand_lossless_prio.split('|') pytest_require(rand_one_dut_hostname == dut_hostname == dut_hostname2, "Priority and port are not mapped to the expected DUT") @@ -196,7 +196,7 @@ def test_pfc_pause_multi_lossless_prio_reboot(ixia_api, localhost, duthosts, rand_one_dut_hostname, - rand_one_oper_up_intf, + rand_one_dut_portname_oper_up, lossless_prio_list, lossy_prio_list, prio_dscp_map, @@ -212,17 +212,17 @@ def test_pfc_pause_multi_lossless_prio_reboot(ixia_api, localhost (pytest fixture): localhost handle duthosts (pytest fixture): list of DUTs rand_one_dut_hostname (str): hostname of DUT - rand_one_oper_up_intf (str): port to test, e.g., 's6100-1|Ethernet0' + rand_one_dut_portname_oper_up (str): port to test, e.g., 's6100-1|Ethernet0' lossless_prio_list (pytest fixture): list of all the lossless priorities lossy_prio_list (pytest fixture): list of all the lossy priorities prio_dscp_map (pytest fixture): priority vs. DSCP map (key = priority). reboot_type (str): reboot type to be issued on the DUT Returns: - None + N/A """ - dut_hostname, dut_port = rand_one_oper_up_intf.split('|') + dut_hostname, dut_port = rand_one_dut_portname_oper_up.split('|') pytest_require(rand_one_dut_hostname == dut_hostname, "Port is not mapped to the expected DUT") diff --git a/tests/pfc/test_pfc_pause_lossy.py b/tests/ixia/pfc/test_pfc_pause_lossy.py similarity index 91% rename from tests/pfc/test_pfc_pause_lossy.py rename to tests/ixia/pfc/test_pfc_pause_lossy.py index 1ba9383cff4..44e7ff87e3b 100644 --- a/tests/pfc/test_pfc_pause_lossy.py +++ b/tests/ixia/pfc/test_pfc_pause_lossy.py @@ -22,7 +22,7 @@ def test_pfc_pause_single_lossy_prio(ixia_api, fanout_graph_facts, duthosts, rand_one_dut_hostname, - enum_dut_portname_oper_up, + rand_one_dut_portname_oper_up, enum_dut_lossy_prio, all_prio_list, prio_dscp_map): @@ -36,16 +36,16 @@ def test_pfc_pause_single_lossy_prio(ixia_api, fanout_graph_facts (pytest fixture): fanout graph duthosts (pytest fixture): list of DUTs rand_one_dut_hostname (str): hostname of DUT - enum_dut_portname_oper_up (str): name of port to test, e.g., 's6100-1|Ethernet0' + rand_one_dut_portname_oper_up (str): port to test, e.g., 's6100-1|Ethernet0' enum_dut_lossy_prio (str): name of lossy priority to test, e.g., 's6100-1|2' all_prio_list (pytest fixture): list of all the priorities prio_dscp_map (pytest fixture): priority vs. DSCP map (key = priority). Returns: - None + N/A """ - dut_hostname, dut_port = enum_dut_portname_oper_up.split('|') + dut_hostname, dut_port = rand_one_dut_portname_oper_up.split('|') dut_hostname2, lossy_prio = enum_dut_lossy_prio.split('|') pytest_require(rand_one_dut_hostname == dut_hostname == dut_hostname2, "Priority and port are not mapped to the expected DUT") @@ -77,7 +77,7 @@ def test_pfc_pause_multi_lossy_prio(ixia_api, fanout_graph_facts, duthosts, rand_one_dut_hostname, - enum_dut_portname_oper_up, + rand_one_dut_portname_oper_up, lossless_prio_list, lossy_prio_list, prio_dscp_map): @@ -91,16 +91,16 @@ def test_pfc_pause_multi_lossy_prio(ixia_api, fanout_graph_facts (pytest fixture): fanout graph duthosts (pytest fixture): list of DUTs rand_one_dut_hostname (str): hostname of DUT - enum_dut_portname_oper_up (str): name of port to test, e.g., 's6100-1|Ethernet0' + rand_one_dut_portname_oper_up (str): port to test, e.g., 's6100-1|Ethernet0' lossless_prio_list (pytest fixture): list of all the lossless priorities lossy_prio_list (pytest fixture): list of all the lossy priorities prio_dscp_map (pytest fixture): priority vs. DSCP map (key = priority). Returns: - None + N/A """ - dut_hostname, dut_port = enum_dut_portname_oper_up.split('|') + dut_hostname, dut_port = rand_one_dut_portname_oper_up.split('|') pytest_require(rand_one_dut_hostname == dut_hostname, "Port is not mapped to the expected DUT") @@ -130,7 +130,7 @@ def test_pfc_pause_single_lossy_prio_reboot(ixia_api, localhost, duthosts, rand_one_dut_hostname, - rand_one_oper_up_intf, + rand_one_dut_portname_oper_up, rand_lossy_prio, all_prio_list, prio_dscp_map, @@ -146,17 +146,17 @@ def test_pfc_pause_single_lossy_prio_reboot(ixia_api, localhost (pytest fixture): localhost handle duthosts (pytest fixture): list of DUTs rand_one_dut_hostname (str): hostname of DUT - rand_one_oper_up_intf (str): port to test, e.g., 's6100-1|Ethernet0' + rand_one_dut_portname_oper_up (str): port to test, e.g., 's6100-1|Ethernet0' rand_lossy_prio (str): lossy priority to test, e.g., 's6100-1|2' all_prio_list (pytest fixture): list of all the priorities prio_dscp_map (pytest fixture): priority vs. DSCP map (key = priority). reboot_type (str): reboot type to be issued on the DUT Returns: - None + N/A """ - dut_hostname, dut_port = rand_one_oper_up_intf.split('|') + dut_hostname, dut_port = rand_one_dut_portname_oper_up.split('|') dut_hostname2, lossy_prio = rand_lossy_prio.split('|') pytest_require(rand_one_dut_hostname == dut_hostname == dut_hostname2, "Priority and port are not mapped to the expected DUT") @@ -196,7 +196,7 @@ def test_pfc_pause_multi_lossy_prio_reboot(ixia_api, localhost, duthosts, rand_one_dut_hostname, - rand_one_oper_up_intf, + rand_one_dut_portname_oper_up, lossless_prio_list, lossy_prio_list, prio_dscp_map, @@ -212,17 +212,17 @@ def test_pfc_pause_multi_lossy_prio_reboot(ixia_api, localhost (pytest fixture): localhost handle duthosts (pytest fixture): list of DUTs rand_one_dut_hostname (str): hostname of DUT - rand_one_oper_up_intf (str): port to test, e.g., 's6100-1|Ethernet0' + rand_one_dut_portname_oper_up (str): port to test, e.g., 's6100-1|Ethernet0' lossless_prio_list (pytest fixture): list of all the lossless priorities lossy_prio_list (pytest fixture): list of all the lossy priorities prio_dscp_map (pytest fixture): priority vs. DSCP map (key = priority). reboot_type (str): reboot type to be issued on the DUT Returns: - None + N/A """ - dut_hostname, dut_port = rand_one_oper_up_intf.split('|') + dut_hostname, dut_port = rand_one_dut_portname_oper_up.split('|') pytest_require(rand_one_dut_hostname == dut_hostname, "Port is not mapped to the expected DUT") diff --git a/tests/ixia/pfcwd/conftest.py b/tests/ixia/pfcwd/conftest.py deleted file mode 100644 index a0250315715..00000000000 --- a/tests/ixia/pfcwd/conftest.py +++ /dev/null @@ -1,15 +0,0 @@ -import pytest - -@pytest.fixture(scope="module", autouse=True) -def start_pfcwd_default_after_test(duthosts, rand_one_dut_hostname): - """ - Ensure that PFC watchdog is enabled with default setting after tests - - Args: - duthosts (pytest fixture) : list of DUTs - rand_one_dut_hostname (pytest fixture): DUT hostname - """ - yield - - duthost = duthosts[rand_one_dut_hostname] - duthost.shell('sudo pfcwd start_default') diff --git a/tests/ixia/pfcwd/files/pfcwd_basic_helper.py b/tests/ixia/pfcwd/files/pfcwd_basic_helper.py index 45c85fc7832..161ba4debae 100644 --- a/tests/ixia/pfcwd/files/pfcwd_basic_helper.py +++ b/tests/ixia/pfcwd/files/pfcwd_basic_helper.py @@ -8,7 +8,8 @@ ixia_api_serv_user, ixia_api_serv_passwd, ixia_api from tests.common.ixia.ixia_helpers import get_dut_port_id from tests.common.ixia.common_helpers import pfc_class_enable_vector,\ - get_pfcwd_poll_interval, get_pfcwd_detect_time, get_pfcwd_restore_time + get_pfcwd_poll_interval, get_pfcwd_detect_time, get_pfcwd_restore_time,\ + enable_packet_aging, start_pfcwd from abstract_open_traffic_generator.flow import DeviceTxRx, TxRx, Flow, Header,\ Size, Rate,Duration, FixedSeconds, FixedPackets, PortTxRx, PfcPause @@ -54,6 +55,11 @@ def run_pfcwd_basic_test(api, N/A """ + pytest_assert(testbed_config is not None, 'Fail to get L2/3 testbed config') + + start_pfcwd(duthost) + enable_packet_aging(duthost) + """ Get the ID of the port to test """ port_id = get_dut_port_id(dut_hostname=duthost.hostname, dut_port=dut_port, diff --git a/tests/ixia/pfcwd/test_pfcwd_basic.py b/tests/ixia/pfcwd/test_pfcwd_basic.py index b90fdaef27b..d60c6493e7c 100644 --- a/tests/ixia/pfcwd/test_pfcwd_basic.py +++ b/tests/ixia/pfcwd/test_pfcwd_basic.py @@ -5,8 +5,7 @@ fanout_graph_facts from tests.common.ixia.ixia_fixtures import ixia_api_serv_ip, ixia_api_serv_port,\ ixia_api_serv_user, ixia_api_serv_passwd, ixia_api, ixia_testbed -from tests.common.ixia.qos_fixtures import prio_dscp_map, lossless_prio_list,\ - start_pfcwd_default +from tests.common.ixia.qos_fixtures import prio_dscp_map, lossless_prio_list from files.pfcwd_basic_helper import run_pfcwd_basic_test @@ -19,11 +18,10 @@ def test_pfcwd_basic_single_lossless_prio(ixia_api, fanout_graph_facts, duthosts, rand_one_dut_hostname, - enum_dut_portname_oper_up, + rand_one_dut_portname_oper_up, enum_dut_lossless_prio, prio_dscp_map, - trigger_pfcwd, - start_pfcwd_default): + trigger_pfcwd): """ Run PFC watchdog basic test on a single lossless priority @@ -34,16 +32,15 @@ def test_pfcwd_basic_single_lossless_prio(ixia_api, fanout_graph_facts (pytest fixture): fanout graph duthosts (pytest fixture): list of DUTs rand_one_dut_hostname (str): hostname of DUT - enum_dut_portname_oper_up (str): name of port to test, e.g., 's6100-1|Ethernet0' + rand_one_dut_portname_oper_up (str): port to test, e.g., 's6100-1|Ethernet0' enum_dut_lossless_prio (str): name of lossless priority to test, e.g., 's6100-1|3' prio_dscp_map (pytest fixture): priority vs. DSCP map (key = priority) trigger_pfcwd (bool): if PFC watchdog is expected to be triggered - start_pfcwd_default (pytest fixture): start PFC watchdog with the default setting Returns: N/A """ - dut_hostname, dut_port = enum_dut_portname_oper_up.split('|') + dut_hostname, dut_port = rand_one_dut_portname_oper_up.split('|') dut_hostname2, lossless_prio = enum_dut_lossless_prio.split('|') pytest_require(rand_one_dut_hostname == dut_hostname == dut_hostname2, "Priority and port are not mapped to the expected DUT") @@ -69,11 +66,10 @@ def test_pfcwd_basic_multi_lossless_prio(ixia_api, fanout_graph_facts, duthosts, rand_one_dut_hostname, - enum_dut_portname_oper_up, + rand_one_dut_portname_oper_up, lossless_prio_list, prio_dscp_map, - trigger_pfcwd, - start_pfcwd_default): + trigger_pfcwd): """ Run PFC watchdog basic test on multiple lossless priorities @@ -84,16 +80,15 @@ def test_pfcwd_basic_multi_lossless_prio(ixia_api, fanout_graph_facts (pytest fixture): fanout graph duthosts (pytest fixture): list of DUTs rand_one_dut_hostname (str): hostname of DUT - enum_dut_portname_oper_up (str): name of port to test, e.g., 's6100-1|Ethernet0' + rand_one_dut_portname_oper_up (str): port to test, e.g., 's6100-1|Ethernet0' lossless_prio_list (pytest fixture): list of all the lossless priorities prio_dscp_map (pytest fixture): priority vs. DSCP map (key = priority) trigger_pfcwd (bool): if PFC watchdog is expected to be triggered - start_pfcwd_default (pytest fixture): start PFC watchdog with the default setting Returns: N/A """ - dut_hostname, dut_port = enum_dut_portname_oper_up.split('|') + dut_hostname, dut_port = rand_one_dut_portname_oper_up.split('|') pytest_require(rand_one_dut_hostname == dut_hostname, "Port is not mapped to the expected DUT")