From 6e4aaf586f7d39cfabbc6e5de522cfb25657eb73 Mon Sep 17 00:00:00 2001 From: Wei Bai Date: Thu, 18 Feb 2021 06:51:41 +0000 Subject: [PATCH] Minor fixes --- tests/ixia/ecn/files/helper.py | 3 +++ tests/ixia/pfc/files/helper.py | 3 +++ tests/ixia/pfcwd/files/pfcwd_basic_helper.py | 3 +++ tests/ixia/pfcwd/files/pfcwd_runtime_traffic_helper.py | 3 +++ tests/ixia/pfcwd/test_pfcwd_basic.py | 2 +- 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/ixia/ecn/files/helper.py b/tests/ixia/ecn/files/helper.py index a252d77f02..a57823899c 100644 --- a/tests/ixia/ecn/files/helper.py +++ b/tests/ixia/ecn/files/helper.py @@ -308,6 +308,9 @@ def __run_traffic(api, time.sleep(1) attempts += 1 + pytest_assert(attempts < max_attempts, + "Flows do not stop in {} seconds".format(max_attempts)) + """ Dump captured packets """ pcap_bytes = api.get_capture_results(CaptureRequest(port_name=capture_port_name)) with open(pcap_file_name, 'wb') as fid: diff --git a/tests/ixia/pfc/files/helper.py b/tests/ixia/pfc/files/helper.py index 5e4d49321f..5d000ada58 100644 --- a/tests/ixia/pfc/files/helper.py +++ b/tests/ixia/pfc/files/helper.py @@ -326,6 +326,9 @@ def __run_traffic(api, time.sleep(1) attempts += 1 + pytest_assert(attempts < max_attempts, + "Flows do not stop in {} seconds".format(max_attempts)) + """ Dump per-flow statistics """ rows = api.get_flow_results(FlowRequest(flow_names=all_flow_names)) api.set_state(State(FlowTransmitState(state='stop'))) diff --git a/tests/ixia/pfcwd/files/pfcwd_basic_helper.py b/tests/ixia/pfcwd/files/pfcwd_basic_helper.py index 161ba4deba..fb9d309d3b 100644 --- a/tests/ixia/pfcwd/files/pfcwd_basic_helper.py +++ b/tests/ixia/pfcwd/files/pfcwd_basic_helper.py @@ -275,6 +275,9 @@ def __run_traffic(api, config, all_flow_names, exp_dur_sec): time.sleep(1) attempts += 1 + pytest_assert(attempts < max_attempts, + "Flows do not stop in {} seconds".format(max_attempts)) + """ Dump per-flow statistics """ rows = api.get_flow_results(FlowRequest(flow_names=all_flow_names)) api.set_state(State(FlowTransmitState(state='stop'))) diff --git a/tests/ixia/pfcwd/files/pfcwd_runtime_traffic_helper.py b/tests/ixia/pfcwd/files/pfcwd_runtime_traffic_helper.py index 65302d1922..a3c1260624 100644 --- a/tests/ixia/pfcwd/files/pfcwd_runtime_traffic_helper.py +++ b/tests/ixia/pfcwd/files/pfcwd_runtime_traffic_helper.py @@ -184,6 +184,9 @@ def __run_traffic(api, config, duthost, all_flow_names, pfcwd_start_delay_sec, e time.sleep(1) attempts += 1 + pytest_assert(attempts < max_attempts, + "Flows do not stop in {} seconds".format(max_attempts)) + """ Dump per-flow statistics """ rows = api.get_flow_results(FlowRequest(flow_names=all_flow_names)) api.set_state(State(FlowTransmitState(state='stop'))) diff --git a/tests/ixia/pfcwd/test_pfcwd_basic.py b/tests/ixia/pfcwd/test_pfcwd_basic.py index 6716f0017a..0c4123f90e 100644 --- a/tests/ixia/pfcwd/test_pfcwd_basic.py +++ b/tests/ixia/pfcwd/test_pfcwd_basic.py @@ -92,7 +92,7 @@ def test_pfcwd_basic_multi_lossless_prio(ixia_api, 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")