Skip to content

Commit

Permalink
[Fix] Adding dut counter verification for PFC Oversubscription cases (#…
Browse files Browse the repository at this point in the history
…14416)

Description of PR
Summary: Adding dut counter verification for PFC Oversubscription cases
Fixes # (issue)
#13596

Approach
Dependency
#13848

What is the motivation for this PR?
Verifies the packet drops from the dut interface counters

How did you do it?
How did you verify/test it?
Any platform specific information?
Supported testbed topology if it's a new test case?
Documentation
Output
18:43:03 test_m2o_oversubscribe_lossless.test_m2o L0077 INFO | Running test for testbed subtype: single-dut-single-asic
18:43:03 snappi_fixtures.__intf_config_multidut L0796 INFO | Configuring Dut: sonic-s6100-dut1 with port Ethernet0 with IP 20.1.1.1/24
18:43:05 snappi_fixtures.__intf_config_multidut L0796 INFO | Configuring Dut: sonic-s6100-dut1 with port Ethernet4 with IP 20.1.2.1/24
18:43:07 snappi_fixtures.__intf_config_multidut L0796 INFO | Configuring Dut: sonic-s6100-dut1 with port Ethernet8 with IP 20.1.3.1/24
18:43:10 connection._warn L0246 WARNING| Verification of certificates is disabled
18:43:10 connection._info L0243 INFO | Determining the platform and rest_port using the 10.36.78.59 address...
18:43:10 connection._warn L0246 WARNING| Unable to connect to http://10.36.78.59:443.
18:43:10 connection._info L0243 INFO | Connection established to https://10.36.78.59:443 on linux
18:43:24 connection._info L0243 INFO | Using IxNetwork api server version 10.20.2403.2
18:43:24 connection._info L0243 INFO | User info IxNetwork/ixnetworkweb/admin-68-20480
18:43:25 snappi_api.info L1132 INFO | snappi-0.9.1
18:43:25 snappi_api.info L1132 INFO | snappi_ixnetwork-0.8.2
18:43:25 snappi_api.info L1132 INFO | ixnetwork_restpy-1.0.64
18:43:25 snappi_api.info L1132 INFO | Config validation 0.020s
18:43:27 snappi_api.info L1132 INFO | Ports configuration 1.544s
18:43:27 snappi_api.info L1132 INFO | Captures configuration 0.161s
18:43:30 snappi_api.info L1132 INFO | Add location hosts [10.36.78.53] 2.285s
18:43:34 snappi_api.info L1132 INFO | Location hosts ready [10.36.78.53] 4.212s
18:43:35 snappi_api.info L1132 INFO | Speed conversion is not require for (port.name, speed) : [('Port 0', 'novusHundredGigNonFanOut'), ('Port 1', 'novusHundredGigNonFanOut'), ('Port 2', 'novusHundredGigNonFanOut')]
18:43:35 snappi_api.info L1132 INFO | Aggregation mode speed change 0.479s
18:43:42 snappi_api.info L1132 INFO | Location preemption [10.36.78.53;6;1, 10.36.78.53;6;2, 10.36.78.53;6;3] 0.111s
18:44:07 snappi_api.info L1132 INFO | Location connect [Port 0, Port 1, Port 2] 25.066s
18:44:07 snappi_api.warning L1138 WARNING| Port 0 connectedLinkDown
18:44:07 snappi_api.warning L1138 WARNING| Port 1 connectedLinkDown
18:44:07 snappi_api.warning L1138 WARNING| Port 2 connectedLinkDown
18:44:07 snappi_api.info L1132 INFO | Location state check [Port 0, Port 1, Port 2] 0.245s
18:44:07 snappi_api.info L1132 INFO | Location configuration 39.389s
18:44:19 snappi_api.info L1132 INFO | Layer1 configuration 12.161s
18:44:19 snappi_api.info L1132 INFO | Lag Configuration 0.082s
18:44:19 snappi_api.info L1132 INFO | Convert device config : 0.224s
18:44:19 snappi_api.info L1132 INFO | Create IxNetwork device config : 0.000s
18:44:20 snappi_api.info L1132 INFO | Push IxNetwork device config : 0.641s
18:44:20 snappi_api.info L1132 INFO | Devices configuration 0.940s
18:44:25 snappi_api.info L1132 INFO | Flows configuration 5.128s
18:45:25 snappi_api.info L1132 INFO | Start interfaces 59.556s
18:45:25 snappi_api.info L1132 INFO | IxNet - The Traffic Item was modified. Please perform a Traffic Generate to update the associated traffic Flow Groups
18:45:30 traffic_generation.run_traffic L0322 INFO | Wait for Arp to Resolve ...
18:45:36 traffic_generation.run_traffic L0322 INFO | Starting transmit on all flows ...
18:48:41 snappi_api.info L1132 INFO | Flows generate/apply 184.474s
18:48:54 snappi_api.info L1132 INFO | Flows clear statistics 12.396s
18:48:54 snappi_api.info L1132 INFO | Captures start 0.000s
18:49:17 snappi_api.info L1132 INFO | Flows start 22.926s
18:49:17 traffic_generation.run_traffic L0322 INFO | Polling DUT for traffic statistics for 15 seconds ...
18:49:23 traffic_generation.run_traffic L0322 INFO | Polling TGEN for in-flight traffic statistics...
18:49:25 traffic_generation.run_traffic L0322 INFO | In-flight traffic statistics for flows: ['Test Flow 1 -> 0', 'Test Flow 2 -> 0', 'Background Flow 1 -> 0', 'Background Flow 2 -> 0']
18:49:25 traffic_generation.run_traffic L0322 INFO | In-flight TX frames: [6312174, 6312175, 6310775, 6310775]
18:49:25 traffic_generation.run_traffic L0322 INFO | In-flight RX frames: [6311444, 6311444, 6310765, 6310766]
18:49:29 traffic_generation.run_traffic L0322 INFO | DUT polling complete
18:49:29 traffic_generation.run_traffic L0322 INFO | Checking if all flows have stopped. Attempt #1
18:49:30 traffic_generation.run_traffic L0322 INFO | ['started', 'started', 'started', 'started']
18:49:31 traffic_generation.run_traffic L0322 INFO | Checking if all flows have stopped. Attempt #2
18:49:32 traffic_generation.run_traffic L0322 INFO | ['started', 'started', 'started', 'started']
18:49:33 traffic_generation.run_traffic L0322 INFO | Checking if all flows have stopped. Attempt #3
18:49:35 traffic_generation.run_traffic L0322 INFO | ['started', 'started', 'stopped', 'stopped']
18:49:36 traffic_generation.run_traffic L0322 INFO | Checking if all flows have stopped. Attempt #4
18:49:37 traffic_generation.run_traffic L0322 INFO | ['stopped', 'stopped', 'stopped', 'stopped']
18:49:37 traffic_generation.run_traffic L0322 INFO | All test and background traffic flows stopped
18:49:39 traffic_generation.run_traffic L0322 INFO | Dumping per-flow statistics
18:49:40 traffic_generation.run_traffic L0322 INFO | Stopping transmit on all remaining flows
18:49:41 snappi_fixtures.cleanup_config L0952 INFO | Removing Configuration on Dut: sonic-s6100-dut1 with port Ethernet0 with ip :20.1.1.1/24
18:49:43 snappi_fixtures.cleanup_config L0952 INFO | Removing Configuration on Dut: sonic-s6100-dut1 with port Ethernet4 with ip :20.1.2.1/24
18:49:45 snappi_fixtures.cleanup_config L0952 INFO | Removing Configuration on Dut: sonic-s6100-dut1 with port Ethernet8 with ip :20.1.3.1/24
PASSED [100%]
------------------------------------------------------------ live log teardown -------------------------------------------------------------
18:49:47 init.pytest_runtest_teardown L0049 INFO | collect memory after test test_m2o_oversubscribe_lossless[multidut_port_info0]
18:49:48 init.pytest_runtest_teardown L0072 INFO | After test: collected memory_values {'before_test': {'sonic-s6100-dut1': {'monit': {'memory_usage': 13.9}}}, 'after_test': {'sonic-s6100-dut1': {'monit': {'memory_usage': 31.3}}}}
18:49:48 init._fixture_generator_decorator L0093 INFO | -------------------- fixture snappi_api teardown starts --------------------
18:50:03 init._fixture_generator_decorator L0102 INFO | -------------------- fixture snappi_api teardown ends --------------------
18:50:03 init._fixture_generator_decorator L0093 INFO | -------------------- fixture start_pfcwd_after_test teardown starts --------------------
18:50:05 init._fixture_generator_decorator L0102 INFO | -------------------- fixture start_pfcwd_after_test teardown ends --------------------
18:50:05 init._fixture_generator_decorator L0093 INFO | -------------------- fixture rand_lossy_prio teardown starts --------------------
18:50:05 init._fixture_generator_decorator L0102 INFO | -------------------- fixture rand_lossy_prio teardown ends --------------------
18:50:05 init._fixture_generator_decorator L0093 INFO | -------------------- fixture rand_lossless_prio teardown starts --------------------
18:50:05 init._fixture_generator_decorator L0102 INFO | -------------------- fixture rand_lossless_prio teardown ends --------------------
18:50:05 init._fixture_generator_decorator L0093 INFO | -------------------- fixture enable_packet_aging_after_test teardown starts --------------------
18:50:05 init._fixture_generator_decorator L0102 INFO | -------------------- fixture enable_packet_aging_after_test teardown ends --------------------
18:50:05 conftest.core_dump_and_config_check L2203 INFO | Dumping Disk and Memory Space informataion after test on sonic-s6100-dut1
18:50:06 conftest.core_dump_and_config_check L2207 INFO | Collecting core dumps after test on sonic-s6100-dut1
18:50:07 conftest.core_dump_and_config_check L2224 INFO | Collecting running config after test on sonic-s6100-dut1
18:50:08 conftest.core_dump_and_config_check L2352 WARNING| Core dump or config check failed for test_m2o_oversubscribe_lossless.py, results: {"core_dump_check": {"pass": true, "new_core_dumps": {"sonic-s6100-dut1": []}}, "config_db_check": {"pass": false, "pre_only_config": {"sonic-s6100-dut1": {"null": {"INTERFACE": {"Ethernet0": {}, "Ethernet12": {}, "Ethernet4": {}, "Ethernet8": {}, "Ethernet0|21.1.1.1/24": {}, "Ethernet12|24.1.1.1/24": {}, "Ethernet4|22.1.1.1/24": {}, "Ethernet8|23.1.1.1/24": {}}}}}, "cur_only_config": {"sonic-s6100-dut1": {"null": {}}}, "inconsistent_config": {"sonic-s6100-dut1": {"null": {"PFC_WD": {"pre_value": {"GLOBAL": {"POLL_INTERVAL": "200"}}, "cur_value": {"Ethernet0": {"action": "drop", "detection_time": "200", "restoration_time": "200"}, "Ethernet12": {"action": "drop", "detection_time": "200", "restoration_time": "200"}, "Ethernet4": {"action": "drop", "detection_time": "200", "restoration_time": "200"}, "Ethernet8": {"action": "drop", "detection_time": "200", "restoration_time": "200"}, "GLOBAL": {"POLL_INTERVAL": "200"}}}}}}}}
18:50:08 conftest.__dut_reload L2091 INFO | dut reload called on sonic-s6100-dut1
18:50:10 parallel.on_terminate L0085 INFO | process __dut_reload-- terminated with exit code None
18:50:10 parallel.parallel_run L0221 INFO | Completed running processes for target "__dut_reload" in 0:00:01.443244 seconds
18:50:10 conftest.core_dump_and_config_check L2362 INFO | -----$$$$$$$$$$--------------- Executing config reload of config_db_bgp.json -------------$$$$$$$$$$$$$$

============================================================= warnings summary =============================================================
../../../../usr/local/lib/python3.8/dist-packages/_pytest/config/init.py:755
/usr/local/lib/python3.8/dist-packages/_pytest/config/init.py:755: PytestAssertRewriteWarning: Module already imported so cannot be rewritten: tests.common.plugins.loganalyzer
self.import_plugin(import_spec)

../../../../usr/local/lib/python3.8/dist-packages/_pytest/config/init.py:755
/usr/local/lib/python3.8/dist-packages/_pytest/config/init.py:755: PytestAssertRewriteWarning: Module already imported so cannot be rewritten: tests.common.plugins.sanity_check
self.import_plugin(import_spec)

../../../../usr/local/lib/python3.8/dist-packages/_pytest/config/init.py:755
/usr/local/lib/python3.8/dist-packages/_pytest/config/init.py:755: PytestAssertRewriteWarning: Module already imported so cannot be rewritten: tests.common.plugins.test_completeness
self.import_plugin(import_spec)

../../../../usr/local/lib/python3.8/dist-packages/_pytest/config/init.py:755
/usr/local/lib/python3.8/dist-packages/_pytest/config/init.py:755: PytestAssertRewriteWarning: Module already imported so cannot be rewritten: tests.common.dualtor
self.import_plugin(import_spec)

../../../../usr/local/lib/python3.8/dist-packages/paramiko/transport.py:236
/usr/local/lib/python3.8/dist-packages/paramiko/transport.py:236: CryptographyDeprecationWarning: Blowfish has been deprecated
"class": algorithms.Blowfish,

snappi_tests/multidut/pfc/test_m2o_oversubscribe_lossless.py::test_m2o_oversubscribe_lossless[multidut_port_info0]
snappi_tests/multidut/pfc/test_m2o_oversubscribe_lossless.py::test_m2o_oversubscribe_lossless[multidut_port_info0]
snappi_tests/multidut/pfc/test_m2o_oversubscribe_lossless.py::test_m2o_oversubscribe_lossless[multidut_port_info0]
snappi_tests/multidut/pfc/test_m2o_oversubscribe_lossless.py::test_m2o_oversubscribe_lossless[multidut_port_info0]
snappi_tests/multidut/pfc/test_m2o_oversubscribe_lossless.py::test_m2o_oversubscribe_lossless[multidut_port_info0]
/usr/local/lib/python3.8/dist-packages/pytest_ansible/module_dispatcher/v213.py:100: UserWarning: provided hosts list is empty, only localhost is available
warnings.warn("provided hosts list is empty, only localhost is available")

snappi_tests/multidut/pfc/test_m2o_oversubscribe_lossless.py::test_m2o_oversubscribe_lossless[multidut_port_info0]
/var/AzDevOps/.local/lib/python3.8/site-packages/snappi_ixnetwork/device/utils.py:2: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working
from collections import namedtuple, Mapping

snappi_tests/multidut/pfc/test_m2o_oversubscribe_lossless.py::test_m2o_oversubscribe_lossless[multidut_port_info0]
snappi_tests/multidut/pfc/test_m2o_oversubscribe_lossless.py::test_m2o_oversubscribe_lossless[multidut_port_info0]
/usr/local/lib/python3.8/dist-packages/ixnetwork_restpy/testplatform/sessions/sessions.py:59: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
elif LooseVersion(build_number) < LooseVersion('8.52'):

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
---------------------------------------------------------- live log sessionfinish ----------------------------------------------------------
18:50:41 init.pytest_terminal_summary L0067 INFO | Can not get Allure report URL. Please check logs
================================================ 1 passed, 13 warnings in 473.16s (0:07:53) ================================================

co-authorized by: jianquanye@microsoft.com
  • Loading branch information
selldinesh authored Oct 8, 2024
1 parent 69c933c commit 9883088
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from tests.common.fixtures.conn_graph_facts import conn_graph_facts, fanout_graph_facts # noqa: F401
from tests.common.snappi_tests.snappi_helpers import get_dut_port_id # noqa: F401
from tests.common.snappi_tests.common_helpers import pfc_class_enable_vector, stop_pfcwd, \
disable_packet_aging, sec_to_nanosec # noqa: F401
disable_packet_aging, sec_to_nanosec, get_interface_stats # noqa: F401
from tests.common.snappi_tests.port import select_ports # noqa: F401
from tests.common.snappi_tests.snappi_test_params import SnappiTestParams
from tests.common.snappi_tests.traffic_generation import run_traffic, verify_pause_flow, \
Expand All @@ -23,8 +23,8 @@
BG_FLOW_NAME = 'Background Flow'
BG_FLOW_AGGR_RATE_PERCENT = 25
DATA_PKT_SIZE = 1024
DATA_FLOW_DURATION_SEC = 20
PAUSE_FLOW_DURATION_SEC = 10
DATA_FLOW_DURATION_SEC = 10
PAUSE_FLOW_DURATION_SEC = 5
PAUSE_FLOW_DELAY_SEC = 5
DATA_FLOW_DELAY_SEC = 0
SNAPPI_POLL_DELAY_SEC = 2
Expand Down Expand Up @@ -78,6 +78,7 @@ def run_lossless_response_to_external_pause_storms_test(api,

tx_port = [snappi_extra_params.multi_dut_params.multi_dut_ports[1],
snappi_extra_params.multi_dut_params.multi_dut_ports[2]]
ingress_duthost = tx_port[0]['duthost']
tx_port_id_list = [tx_port[0]["port_id"], tx_port[1]["port_id"]]
# add ingress DUT into the set
dut_asics_to_be_configured.add((tx_port[0]['duthost'], tx_port[0]['asic_value']))
Expand Down Expand Up @@ -128,6 +129,21 @@ def run_lossless_response_to_external_pause_storms_test(api,
exp_dur_sec=DATA_FLOW_DURATION_SEC + DATA_FLOW_DELAY_SEC,
snappi_extra_params=snappi_extra_params)

tx_port1 = tx_port[0]['peer_port']
tx_port2 = tx_port[1]['peer_port']
# Fetch relevant statistics
pkt_drop1 = get_interface_stats(ingress_duthost, tx_port1)[ingress_duthost.hostname][tx_port1]['rx_fail']
pkt_drop2 = get_interface_stats(ingress_duthost, tx_port2)[ingress_duthost.hostname][tx_port2]['rx_fail']
rx_pkts_1 = get_interface_stats(ingress_duthost, tx_port1)[ingress_duthost.hostname][tx_port1]['rx_pkts']
rx_pkts_2 = get_interface_stats(ingress_duthost, tx_port2)[ingress_duthost.hostname][tx_port2]['rx_pkts']
# Calculate the total packet drop
pkt_drop = pkt_drop1 + pkt_drop2
# Calculate the total received packets
total_rx_pkts = rx_pkts_1 + rx_pkts_2
# Calculate the drop percentage
drop_percentage = 100 * pkt_drop / total_rx_pkts
pytest_assert(ceil(drop_percentage) == 0, 'FAIL: There should be no packet drops in ingress dut counters')

verify_external_pause_storm_result(flow_stats,
tx_port,
rx_port)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
from tests.common.fixtures.conn_graph_facts import conn_graph_facts, fanout_graph_facts # noqa: F401
from tests.common.snappi_tests.snappi_helpers import get_dut_port_id # noqa: F401
from tests.common.snappi_tests.common_helpers import pfc_class_enable_vector, stop_pfcwd, disable_packet_aging, \
get_pfcwd_poll_interval, get_pfcwd_detect_time, get_pfcwd_restore_time, sec_to_nanosec # noqa: F401
get_pfcwd_poll_interval, get_pfcwd_detect_time, get_pfcwd_restore_time, sec_to_nanosec, \
get_interface_stats # noqa: F401
from tests.common.snappi_tests.port import select_ports # noqa: F401
from tests.common.snappi_tests.snappi_test_params import SnappiTestParams
from tests.common.snappi_tests.traffic_generation import run_traffic, verify_pause_flow, \
Expand All @@ -27,11 +28,11 @@
BG_FLOW_AGGR_RATE_PERCENT = 25
PAUSE_FLOW_RATE = 15
DATA_PKT_SIZE = 1024
DATA_FLOW_DURATION_SEC = 20
DATA_FLOW_DURATION_SEC = 10
DATA_FLOW_DELAY_SEC = 0
SNAPPI_POLL_DELAY_SEC = 2
TOLERANCE_THRESHOLD = 0.05
PAUSE_FLOW_DURATION_SEC = 10
PAUSE_FLOW_DURATION_SEC = 5
PAUSE_FLOW_DELAY_SEC = 5


Expand Down Expand Up @@ -83,6 +84,7 @@ def run_lossless_response_to_throttling_pause_storms_test(api,

tx_port = [snappi_extra_params.multi_dut_params.multi_dut_ports[1],
snappi_extra_params.multi_dut_params.multi_dut_ports[2]]
ingress_duthost = tx_port[0]['duthost']
tx_port_id_list = [tx_port[0]["port_id"], tx_port[1]["port_id"]]
# add ingress DUT into the set
dut_asics_to_be_configured.add((tx_port[0]['duthost'], tx_port[0]['asic_value']))
Expand Down Expand Up @@ -134,6 +136,22 @@ def run_lossless_response_to_throttling_pause_storms_test(api,
exp_dur_sec=DATA_FLOW_DURATION_SEC + DATA_FLOW_DELAY_SEC,
snappi_extra_params=snappi_extra_params)

tx_port1 = tx_port[0]['peer_port']
tx_port2 = tx_port[1]['peer_port']
# Fetch relevant statistics
pkt_drop1 = get_interface_stats(ingress_duthost, tx_port1)[ingress_duthost.hostname][tx_port1]['rx_fail']
pkt_drop2 = get_interface_stats(ingress_duthost, tx_port2)[ingress_duthost.hostname][tx_port2]['rx_fail']
rx_pkts_1 = get_interface_stats(ingress_duthost, tx_port1)[ingress_duthost.hostname][tx_port1]['rx_pkts']
rx_pkts_2 = get_interface_stats(ingress_duthost, tx_port2)[ingress_duthost.hostname][tx_port2]['rx_pkts']
# Calculate the total packet drop
pkt_drop = pkt_drop1 + pkt_drop2
# Calculate the total received packets
total_rx_pkts = rx_pkts_1 + rx_pkts_2
# Calculate the drop percentage
drop_percentage = 100 * pkt_drop / total_rx_pkts
pytest_assert(ceil(drop_percentage) == 0, 'FAIL: There should be no packet drops in ingress dut counters')

""" Verify Results """
verify_throttling_pause_storm_result(flow_stats,
tx_port,
rx_port)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
from tests.common.fixtures.conn_graph_facts import conn_graph_facts, fanout_graph_facts # noqa: F401
from tests.common.snappi_tests.snappi_helpers import get_dut_port_id # noqa: F401
from tests.common.snappi_tests.common_helpers import pfc_class_enable_vector, stop_pfcwd, \
disable_packet_aging, sec_to_nanosec # noqa: F401
disable_packet_aging, sec_to_nanosec, get_interface_stats # noqa: F401
from tests.common.snappi_tests.port import select_ports # noqa: F401
from tests.common.snappi_tests.snappi_test_params import SnappiTestParams
from tests.common.snappi_tests.traffic_generation import run_traffic, \
setup_base_traffic_config # noqa: F401
from tests.snappi_tests.variables import pfcQueueGroupSize, pfcQueueValueDict
from math import ceil
logger = logging.getLogger(__name__)

PAUSE_FLOW_NAME = 'Pause Storm'
Expand All @@ -18,8 +19,8 @@
BG_FLOW_NAME = 'Background Flow'
BG_FLOW_AGGR_RATE_PERCENT = [20, 20]
DATA_PKT_SIZE = 1024
DATA_FLOW_DURATION_SEC = 20
DATA_FLOW_DELAY_SEC = 10
DATA_FLOW_DURATION_SEC = 10
DATA_FLOW_DELAY_SEC = 5
SNAPPI_POLL_DELAY_SEC = 2


Expand Down Expand Up @@ -70,6 +71,7 @@ def run_m2o_fluctuating_lossless_test(api,

tx_port = [snappi_extra_params.multi_dut_params.multi_dut_ports[1],
snappi_extra_params.multi_dut_params.multi_dut_ports[2]]
ingress_duthost = tx_port[0]['duthost']
tx_port_id_list = [tx_port[0]["port_id"], tx_port[1]["port_id"]]
# add ingress DUT into the set
dut_asics_to_be_configured.add((tx_port[0]['duthost'], tx_port[0]['asic_value']))
Expand Down Expand Up @@ -116,6 +118,22 @@ def run_m2o_fluctuating_lossless_test(api,
exp_dur_sec=DATA_FLOW_DURATION_SEC + DATA_FLOW_DELAY_SEC,
snappi_extra_params=snappi_extra_params)

tx_port1 = tx_port[0]['peer_port']
tx_port2 = tx_port[1]['peer_port']
# Fetch relevant statistics
pkt_drop1 = get_interface_stats(ingress_duthost, tx_port1)[ingress_duthost.hostname][tx_port1]['rx_fail']
pkt_drop2 = get_interface_stats(ingress_duthost, tx_port2)[ingress_duthost.hostname][tx_port2]['rx_fail']
rx_pkts_1 = get_interface_stats(ingress_duthost, tx_port1)[ingress_duthost.hostname][tx_port1]['rx_pkts']
rx_pkts_2 = get_interface_stats(ingress_duthost, tx_port2)[ingress_duthost.hostname][tx_port2]['rx_pkts']
# Calculate the total packet drop
pkt_drop = pkt_drop1 + pkt_drop2
# Calculate the total received packets
total_rx_pkts = rx_pkts_1 + rx_pkts_2
# Calculate the drop percentage
drop_percentage = 100 * pkt_drop / total_rx_pkts
pytest_assert(ceil(drop_percentage) == 8, 'FAIL: Drop packets must be around 8 percent')

""" Verify Results """
verify_m2o_fluctuating_lossless_result(flow_stats,
tx_port,
rx_port)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from tests.common.fixtures.conn_graph_facts import conn_graph_facts, fanout_graph_facts # noqa: F401
from tests.common.snappi_tests.snappi_helpers import get_dut_port_id # noqa: F401
from tests.common.snappi_tests.common_helpers import pfc_class_enable_vector, \
stop_pfcwd, disable_packet_aging, sec_to_nanosec # noqa: F401
stop_pfcwd, disable_packet_aging, sec_to_nanosec, get_interface_stats # noqa: F401
from tests.common.snappi_tests.port import select_ports # noqa: F401
from tests.common.snappi_tests.snappi_test_params import SnappiTestParams
from tests.common.snappi_tests.traffic_generation import setup_base_traffic_config, \
Expand All @@ -24,8 +24,8 @@
BG_FLOW_NAME = 'Background Flow'
BG_FLOW_AGGR_RATE_PERCENT = 25
DATA_PKT_SIZE = 1024
DATA_FLOW_DURATION_SEC = 20
DATA_FLOW_DELAY_SEC = 10
DATA_FLOW_DURATION_SEC = 10
DATA_FLOW_DELAY_SEC = 5
SNAPPI_POLL_DELAY_SEC = 2
TOLERANCE_THRESHOLD = 0.05

Expand Down Expand Up @@ -73,6 +73,7 @@ def run_m2o_oversubscribe_lossless_test(api,

tx_port = [snappi_extra_params.multi_dut_params.multi_dut_ports[1],
snappi_extra_params.multi_dut_params.multi_dut_ports[2]]
ingress_duthost = tx_port[0]['duthost']
tx_port_id_list = [tx_port[0]["port_id"], tx_port[1]["port_id"]]
# add ingress DUT into the set
dut_asics_to_be_configured.add((tx_port[0]['duthost'], tx_port[0]['asic_value']))
Expand Down Expand Up @@ -121,6 +122,22 @@ def run_m2o_oversubscribe_lossless_test(api,
exp_dur_sec=DATA_FLOW_DURATION_SEC + DATA_FLOW_DELAY_SEC,
snappi_extra_params=snappi_extra_params)

tx_port1 = tx_port[0]['peer_port']
tx_port2 = tx_port[1]['peer_port']
# Fetch relevant statistics
pkt_drop1 = get_interface_stats(ingress_duthost, tx_port1)[ingress_duthost.hostname][tx_port1]['rx_fail']
pkt_drop2 = get_interface_stats(ingress_duthost, tx_port2)[ingress_duthost.hostname][tx_port2]['rx_fail']
rx_pkts_1 = get_interface_stats(ingress_duthost, tx_port1)[ingress_duthost.hostname][tx_port1]['rx_pkts']
rx_pkts_2 = get_interface_stats(ingress_duthost, tx_port2)[ingress_duthost.hostname][tx_port2]['rx_pkts']
# Calculate the total packet drop
pkt_drop = pkt_drop1 + pkt_drop2
# Calculate the total received packets
total_rx_pkts = rx_pkts_1 + rx_pkts_2
# Calculate the drop percentage
drop_percentage = 100 * pkt_drop / total_rx_pkts
pytest_assert(ceil(drop_percentage) == 0, 'FAIL: There should be no packet drops in ingress dut counters')

""" Verify Results """
verify_m2o_oversubscribe_lossless_result(flow_stats,
tx_port,
rx_port)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from tests.common.fixtures.conn_graph_facts import conn_graph_facts, fanout_graph_facts # noqa: F401
from tests.common.snappi_tests.snappi_helpers import get_dut_port_id # noqa: F401
from tests.common.snappi_tests.common_helpers import pfc_class_enable_vector, \
stop_pfcwd, disable_packet_aging, sec_to_nanosec # noqa: F401
stop_pfcwd, disable_packet_aging, sec_to_nanosec, get_interface_stats # noqa: F401
from tests.common.snappi_tests.port import select_ports # noqa: F401
from tests.common.snappi_tests.snappi_test_params import SnappiTestParams
from tests.common.snappi_tests.traffic_generation import run_traffic, \
Expand All @@ -25,8 +25,8 @@
BG_FLOW_NAME = 'Background Flow'
BG_FLOW_AGGR_RATE_PERCENT = [20, 40]
DATA_PKT_SIZE = 1024
DATA_FLOW_DURATION_SEC = 20
DATA_FLOW_DELAY_SEC = 10
DATA_FLOW_DURATION_SEC = 10
DATA_FLOW_DELAY_SEC = 5
SNAPPI_POLL_DELAY_SEC = 2
TOLERANCE_THRESHOLD = 0.05

Expand Down Expand Up @@ -78,6 +78,7 @@ def run_pfc_m2o_oversubscribe_lossless_lossy_test(api,

tx_port = [snappi_extra_params.multi_dut_params.multi_dut_ports[1],
snappi_extra_params.multi_dut_params.multi_dut_ports[2]]
ingress_duthost = tx_port[0]['duthost']
tx_port_id_list = [tx_port[0]["port_id"], tx_port[1]["port_id"]]
# add ingress DUT into the set
dut_asics_to_be_configured.add((tx_port[0]['duthost'], tx_port[0]['asic_value']))
Expand Down Expand Up @@ -124,6 +125,22 @@ def run_pfc_m2o_oversubscribe_lossless_lossy_test(api,
exp_dur_sec=DATA_FLOW_DURATION_SEC + DATA_FLOW_DELAY_SEC,
snappi_extra_params=snappi_extra_params)

tx_port1 = tx_port[0]['peer_port']
tx_port2 = tx_port[1]['peer_port']
# Fetch relevant statistics
pkt_drop1 = get_interface_stats(ingress_duthost, tx_port1)[ingress_duthost.hostname][tx_port1]['rx_fail']
pkt_drop2 = get_interface_stats(ingress_duthost, tx_port2)[ingress_duthost.hostname][tx_port2]['rx_fail']
rx_pkts_1 = get_interface_stats(ingress_duthost, tx_port1)[ingress_duthost.hostname][tx_port1]['rx_pkts']
rx_pkts_2 = get_interface_stats(ingress_duthost, tx_port2)[ingress_duthost.hostname][tx_port2]['rx_pkts']
# Calculate the total packet drop
pkt_drop = pkt_drop1 + pkt_drop2
# Calculate the total received packets
total_rx_pkts = rx_pkts_1 + rx_pkts_2
# Calculate the drop percentage
drop_percentage = 100 * pkt_drop / total_rx_pkts
pytest_assert(ceil(drop_percentage) == 5, 'FAIL: Drop packets must be around 5 percent')

""" Verify Results """
verify_m2o_oversubscribe_lossless_lossy_result(flow_stats,
tx_port,
rx_port)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from tests.common.fixtures.conn_graph_facts import conn_graph_facts, fanout_graph_facts # noqa: F401
from tests.common.snappi_tests.snappi_helpers import get_dut_port_id # noqa: F401
from tests.common.snappi_tests.common_helpers import pfc_class_enable_vector, \
stop_pfcwd, disable_packet_aging # noqa: F401
stop_pfcwd, disable_packet_aging, get_interface_stats # noqa: F401
from tests.common.snappi_tests.port import select_ports # noqa: F401
from tests.common.snappi_tests.snappi_test_params import SnappiTestParams
from tests.common.snappi_tests.traffic_generation import setup_base_traffic_config, \
Expand All @@ -24,8 +24,8 @@
BG_FLOW_NAME = 'Background Flow'
BG_FLOW_AGGR_RATE_PERCENT = 25
DATA_PKT_SIZE = 1024
DATA_FLOW_DURATION_SEC = 5
DATA_FLOW_DELAY_SEC = 2
DATA_FLOW_DURATION_SEC = 10
DATA_FLOW_DELAY_SEC = 5
SNAPPI_POLL_DELAY_SEC = 2
TOLERANCE_THRESHOLD = 0.05

Expand Down Expand Up @@ -77,6 +77,7 @@ def run_pfc_m2o_oversubscribe_lossy_test(api,

tx_port = [snappi_extra_params.multi_dut_params.multi_dut_ports[1],
snappi_extra_params.multi_dut_params.multi_dut_ports[2]]
ingress_duthost = tx_port[0]['duthost']
tx_port_id_list = [tx_port[0]["port_id"], tx_port[1]["port_id"]]
# add ingress DUT into the set
dut_asics_to_be_configured.add((tx_port[0]['duthost'], tx_port[0]['asic_value']))
Expand Down Expand Up @@ -126,6 +127,20 @@ def run_pfc_m2o_oversubscribe_lossy_test(api,
exp_dur_sec=DATA_FLOW_DURATION_SEC + DATA_FLOW_DELAY_SEC,
snappi_extra_params=snappi_extra_params)

tx_port1 = tx_port[0]['peer_port']
tx_port2 = tx_port[1]['peer_port']
pkt_drop1 = get_interface_stats(ingress_duthost, tx_port1)[ingress_duthost.hostname][tx_port1]['rx_fail']
pkt_drop2 = get_interface_stats(ingress_duthost, tx_port2)[ingress_duthost.hostname][tx_port2]['rx_fail']
rx_pkts_1 = get_interface_stats(ingress_duthost, tx_port1)[ingress_duthost.hostname][tx_port1]['rx_pkts']
rx_pkts_2 = get_interface_stats(ingress_duthost, tx_port2)[ingress_duthost.hostname][tx_port2]['rx_pkts']
# Calculate the total packet drop
pkt_drop = pkt_drop1 + pkt_drop2
# Calculate the total received packets
total_rx_pkts = rx_pkts_1 + rx_pkts_2
# Calculate the drop percentage
drop_percentage = 100 * pkt_drop / total_rx_pkts
pytest_assert(ceil(drop_percentage) == 10, 'FAIL: Drop packets must be around 10 percent')

""" Verify Results """
verify_m2o_oversubscribe_lossy_result(flow_stats,
tx_port,
Expand Down

0 comments on commit 9883088

Please sign in to comment.