Skip to content

changes in sonic-mgmt to support dhcpv4_relay#1

Merged
vrajeshe merged 2 commits intocisco/dhcp_v4_devfrom
palcdev/migrate_mgmt
Jul 22, 2025
Merged

changes in sonic-mgmt to support dhcpv4_relay#1
vrajeshe merged 2 commits intocisco/dhcp_v4_devfrom
palcdev/migrate_mgmt

Conversation

@Subhasri-Ramasamy
Copy link
Copy Markdown
Collaborator

No description provided.

@Subhasri-Ramasamy Subhasri-Ramasamy marked this pull request as draft July 10, 2025 15:09
@Subhasri-Ramasamy Subhasri-Ramasamy changed the base branch from cisco/dhcp_v4_dev to palc/dhcp_v4_dev July 14, 2025 06:48
@Subhasri-Ramasamy Subhasri-Ramasamy marked this pull request as ready for review July 22, 2025 04:59
@Subhasri-Ramasamy
Copy link
Copy Markdown
Collaborator Author

Subhasri-Ramasamy commented Jul 22, 2025

logs.zip

pre-commit run flake8 --file tests/dhcp_relay/test_dhcp_relay.py
flake8...................................................................Passed
flake8...............................................(no files to check)Skipped
cisco@cisco-Standard-PC-Q35-ICH9-2009:~/sonic-mgmt$

@Subhasri-Ramasamy Subhasri-Ramasamy changed the base branch from palc/dhcp_v4_dev to cisco/dhcp_v4_dev July 22, 2025 06:56
@vrajeshe vrajeshe merged commit 6d3d180 into cisco/dhcp_v4_dev Jul 22, 2025
@Subhasri-Ramasamy Subhasri-Ramasamy deleted the palcdev/migrate_mgmt branch July 22, 2025 13:35
vrajeshe pushed a commit that referenced this pull request Feb 13, 2026
What is the motivation for this PR?
The current telemetry framework has many serious problems:

Hard to import, because it is outside of the tests folder
No implementation, hard to try out
Hard to use and extend, because the interface is too primitive
No tests and can break easily
How did you do it?
This PR add a few things to improve the current telemetry framework:

Add new design doc with example code provided in the doc.
Implement both TS (timeseries) and DB (database) reporter, so we can try the feature easily.
How did you verify/test it?
Run all tests locally and passed.

Any platform specific information?
N/A.

Fix TS reporters.

Fix TSRepoter.

Fix TS reporter.

minor fix.

Fix example.

Reverse relationship of metrics and reporter to support more types of metrics in future.

Remove bydesign not working test.

Fix example.

Update tests.

Update TS reporter and DB repoter.

Update minor things.

Remove no required code.

Revert unexpected change.

Rename and update doc.

* Get os version and job id (#1)

Get os version and elastictest job id from correct place.

* Revert OS version change.

* Remove duplicated mock reporter fixture.

---------

Co-authored-by: Yutong Zhang <90831468+yutongzhang-microsoft@users.noreply.github.com>
vrajeshe pushed a commit that referenced this pull request Mar 16, 2026
…nter and global_pause test-script (sonic-net#22490)

Description of PR
Added support for tgen_port_info in:
tests/snappi_tests/pfc/test_global_pause_with_snappi.py
tests/snappi_tests/pfc/test_tx_drop_counter_with_snappi.py

Summary:
Fixes # (issue)

Type of change
 Bug fix
 Testbed and Framework(new/improvement)
 New Test case
 Skipped for non-supported platforms
 Test case improvement
Back port request
 202205
 202305
 202311
 202405
 202411
 202505
 202511
Approach
What is the motivation for this PR?
The tgen_port_info was added as part of Snappi test infra improvement, which enabled users to select between static (from variables.override.yml) and dynamic (select 100 and 400Gbps ports) ports.

This was NOT included in test_tx_drop_counter and test_global_pause test-scripts under snappi_tests/pfc section.

How did you do it?
Imported the tgen_port_info from snappi_fixtures.py and removed any reference to old setup_dut_port function for both test-scripts.

How did you verify/test it?
Verification on 202511 is present in pull-request sonic-net#22380.

Verification steps for master:

azureuser@7e081020c2c7:/data/tests$ date;python3 -m pytest --inventory ../ansible/ixia-sonic --host-pattern ixre-egl-board73,ixre-egl-board74 --testbed ixre-chassis17-t2 --testbed_file ../ansible/testbed.csv --show-capture=stdout --log-cli-level info --showlocals -ra --allow_recover --junit-xml=/tmp/y.xml --skip_sanity --log-file=/tmp/y.log --topology multidut-tgen -cache-clear --disable_loganalyzer snappi_tests/pfc/test_global_pause_with_snappi.py --pdb
Fri Feb 20 00:07:16 UTC 2026
====================================================================================================================== test session starts =======================================================================================================================
platform linux -- Python 3.8.10, pytest-7.4.0, pluggy-1.5.0
---- curtailed output ----

INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Config validation 0.014s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Ports configuration 1.261s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Captures configuration 0.116s

---- curtailed output ----
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:837 DUT polling complete
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:850 Checking if all flows have stopped. Attempt #1
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:856 All test and background traffic flows stopped
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:894 Dumping per-flow statistics
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:899 Stopping transmit on all remaining flows
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Flows stop 5.353s
PASSED                                                                                                                                                                                                                                                     [ 50%]
---- curtailed output ----
INFO     tests.common.plugins.memory_utilization:__init__.py:64 Before test: collected memory_values {'before_test': {}, 'after_test': {}}
------------------------------------------------------------------------------------------------------------------------- live log call --------------------------------------------------------------------------------------------------------------------------
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Config validation 0.014s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Ports configuration 1.059s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Captures configuration 0.110s
---- curtailed output ----
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:837 DUT polling complete
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:850 Checking if all flows have stopped. Attempt #1
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:856 All test and background traffic flows stopped
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:894 Dumping per-flow statistics
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:899 Stopping transmit on all remaining flows
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Flows stop 5.514s
PASSED                                                                                                                                                                                                                                                     [100%]
---- curtailed output ----
----------------------------------------------------------------------------------------------------------------- generated xml file: /tmp/y.xml -----------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------- live log sessionfinish ---------------------------------------------------------------------------------------------------------------------
INFO     root:__init__.py:67 Can not get Allure report URL. Please check logs
=========================================================================================================== 2 passed, 9 warnings in 789.04s (0:13:09) ============================================================================================================
INFO:root:Can not get Allure report URL. Please check logs

azureuser@7e081020c2c7:/data/tests$ date;python3 -m pytest --inventory ../ansible/ixia-sonic --host-pattern ixre-egl-board73,ixre-egl-board74 --testbed ixre-chassis17-t2 --testbed_file ../ansible/testbed.csv --show-capture=stdout --log-cli-level info --showlocals -ra --allow_recover --junit-xml=/tmp/y.xml --skip_sanity --log-file=/tmp/y.log --topology multidut-tgen -cache-clear --disable_loganalyzer snappi_tests/pfc/test_tx_drop_counter_with_snappi.py --pdb
Fri Feb 20 00:21:03 UTC 2026
---- curtailed output ----
INFO     ixnetwork_restpy.connection:connection.py:329 User info IxNetwork/tgen-ixia-03/admin-112-3670867
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 snappi-1.27.1
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 snappi_ixnetwork-1.27.2
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 ixnetwork_restpy-1.6.1
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Config validation 0.000s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Ports configuration 0.213s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Captures configuration 0.122s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Aggregation mode speed change 0.000s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Location configuration 0.288s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Layer1 configuration 0.000s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Lag Configuration 0.061s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Convert device config : 0.155s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Create IxNetwork device config : 0.000s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Push IxNetwork device config : 0.093s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Devices configuration 0.299s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Flows configuration 0.120s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Start interfaces 0.155s
INFO     root:__init__.py:76 -------------------- fixture tgen_port_info setup ends --------------------
INFO     root:__init__.py:81 -------------------- fixture disable_pfcwd setup starts --------------------
INFO     root:__init__.py:85 -------------------- fixture disable_pfcwd setup ends --------------------
INFO     root:conftest.py:3818 skip setup dualtor mux cables on non-dualtor testbed
---- curtailed output ----
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Config validation 0.012s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Ports configuration 1.265s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Captures configuration 0.112s
---- curtailed output ----
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:837 DUT polling complete
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:850 Checking if all flows have stopped. Attempt #1
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:856 All test and background traffic flows stopped
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:894 Dumping per-flow statistics
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:899 Stopping transmit on all remaining flows
---- curtailed output ----
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:837 DUT polling complete
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:850 Checking if all flows have stopped. Attempt #1
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:856 All test and background traffic flows stopped
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:894 Dumping per-flow statistics
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:899 Stopping transmit on all remaining flows
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Link State operation 0.052s
INFO     tests.snappi_tests.pfc.files.helper:helper.py:452 Snappi port Port 0 is set to DOWN
INFO     tests.snappi_tests.pfc.files.helper:helper.py:457 Sleeping for 90 seconds
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Link State operation 0.058s
INFO     tests.snappi_tests.pfc.files.helper:helper.py:469 Snappi port Port 0 is set to UP
---- curtailed output ----
INFO     root:__init__.py:67 Can not get Allure report URL. Please check logs
=========================================================================================================== 2 passed, 9 warnings in 906.71s (0:15:06) ============================================================================================================
INFO:root:Can not get Allure report URL. Please check logs

Signed-off-by: amitpawa <amit.2.pawar@nokia.com>

* snappi: issue-22363 removed multidut-port-info import from pfc tx_drop_counter testcase

Signed-off-by: amitpawa <amit.2.pawar@nokia.com>

---------

Signed-off-by: amitpawa <amit.2.pawar@nokia.com>
vrajeshe pushed a commit that referenced this pull request Mar 16, 2026
…ion (sonic-net#22504)

Description of PR
The tgen_port_info infra function in common/snappi_tests/snappi_fixtures.py is used to select port (dynamically or statically) for the test. During static port selection, the variables.override.yml file is used to select Rx and Tx port for the test.

However, after the test, there was no explicit test clean_up code. This PR addresses it.

Summary:
Fixes sonic-net#20993

Type of change
 Bug fix
 Testbed and Framework(new/improvement)
 New Test case
 Skipped for non-supported platforms
 Test case improvement
Back port request
 202205
 202305
 202311
 202405
 202411
 202505
 202511
Approach
What is the motivation for this PR?
The tgen_port_info is used to select the Rx and Tx port for the test.

In case of static port selection, the function returned snappi_dut_base_config(duthosts, snappi_ports, snappi_api, setup=True), and there was no explicit cleanup after the test.

How did you do it?
If the 'is_override' flag is true, the static port selection code is used to select Rx and Tx ports from variables.override.yml file.
Instead of returning with function 'snappi_dut_base_config', 'yield' is called to ensure that clean-up is called at the end of the test.
Once yield returns back to the test, then 'setup_dut_ports' is called with setup=False to ensure that clean-up happens after the test.
How did you verify/test it?
For verification of this changes on 202511 branch, please refer to PR sonic-net#22441

Verification of the PR on master with multi-dut setup:

azureuser@7e081020c2c7:/data/tests$ date;python3 -m pytest --inventory ../ansible/ixia-sonic --host-pattern ixre-egl-board73,ixre-egl-board74 --testbed ixre-chassis17-t2 --testbed_file ../ansible/testbed.csv --show-capture=stdout --log-cli-level info --showlocals -ra --allow_recover --junit-xml=/tmp/y.xml --skip_sanity --log-file=/tmp/y.log --topology multidut-tgen -cache-clear --disable_loganalyzer snappi_tests/pfc/test_pfc_pause_lossless_with_snappi.py -k test_pfc_pause_multi_lossless_prio --pdb
Fri Feb 20 14:26:57 UTC 2026
================================================================================================= test session starts =================================================================================================
platform linux -- Python 3.8.10, pytest-7.4.0, pluggy-1.5.0
----------- curtailed output ----------
INFO     tests.conftest:conftest.py:691 Randomly select dut ixre-egl-board73 for testing
INFO     root:__init__.py:81 -------------------- fixture enable_packet_aging_after_test setup starts --------------------
INFO     root:__init__.py:85 -------------------- fixture enable_packet_aging_after_test setup ends --------------------
INFO     root:__init__.py:81 -------------------- fixture rand_lossless_prio setup starts --------------------
INFO     root:__init__.py:85 -------------------- fixture rand_lossless_prio setup ends --------------------
INFO     root:__init__.py:81 -------------------- fixture rand_lossy_prio setup starts --------------------
INFO     root:__init__.py:85 -------------------- fixture rand_lossy_prio setup ends --------------------
INFO     root:__init__.py:81 -------------------- fixture start_pfcwd_after_test setup starts --------------------
INFO     root:__init__.py:85 -------------------- fixture start_pfcwd_after_test setup ends --------------------
INFO     root:__init__.py:81 -------------------- fixture disable_voq_watchdog setup starts --------------------
INFO     root:__init__.py:85 -------------------- fixture disable_voq_watchdog setup ends --------------------
INFO     root:__init__.py:81 -------------------- fixture number_of_tx_rx_ports setup starts --------------------
INFO     root:__init__.py:85 -------------------- fixture number_of_tx_rx_ports setup ends --------------------
INFO     root:__init__.py:69 -------------------- fixture snappi_api_serv_ip setup starts --------------------
INFO     root:__init__.py:76 -------------------- fixture snappi_api_serv_ip setup ends --------------------
INFO     root:__init__.py:69 -------------------- fixture snappi_api_serv_port setup starts --------------------
INFO     root:__init__.py:76 -------------------- fixture snappi_api_serv_port setup ends --------------------
INFO     root:__init__.py:81 -------------------- fixture snappi_api setup starts --------------------
INFO     root:__init__.py:85 -------------------- fixture snappi_api setup ends --------------------
INFO     tests.conftest:conftest.py:727 Randomly select dut ixre-egl-board74 for testing
INFO     root:__init__.py:69 -------------------- fixture prio_dscp_map setup starts --------------------
INFO     root:__init__.py:76 -------------------- fixture prio_dscp_map setup ends --------------------
INFO     root:__init__.py:69 -------------------- fixture all_prio_list setup starts --------------------
INFO     root:__init__.py:76 -------------------- fixture all_prio_list setup ends --------------------
INFO     root:__init__.py:69 -------------------- fixture lossless_prio_list setup starts --------------------
INFO     root:__init__.py:76 -------------------- fixture lossless_prio_list setup ends --------------------
INFO     root:__init__.py:69 -------------------- fixture lossy_prio_list setup starts --------------------
INFO     root:__init__.py:76 -------------------- fixture lossy_prio_list setup ends --------------------
INFO     root:__init__.py:69 -------------------- fixture get_snappi_ports setup starts --------------------
INFO     root:__init__.py:69 -------------------- fixture get_snappi_ports_multi_dut setup starts --------------------
INFO     root:__init__.py:76 -------------------- fixture get_snappi_ports_multi_dut setup ends --------------------
INFO     root:__init__.py:76 -------------------- fixture get_snappi_ports setup ends --------------------
INFO     root:__init__.py:69 -------------------- fixture snappi_port_selection setup starts --------------------
INFO     root:__init__.py:76 -------------------- fixture snappi_port_selection setup ends --------------------
INFO     root:__init__.py:77 Log analyzer is disabled
INFO     root:__init__.py:81 -------------------- fixture disable_pfcwd setup starts --------------------
INFO     root:__init__.py:85 -------------------- fixture disable_pfcwd setup ends --------------------
INFO     root:__init__.py:81 -------------------- fixture tgen_port_info setup starts --------------------
----------- curtailed output ----------
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Start interfaces 0.164s
INFO     tests.common.snappi_tests.snappi_fixtures:snappi_fixtures.py:906 Found relevant portchannel interfaces
INFO     root:__init__.py:85 -------------------- fixture tgen_port_info setup ends --------------------
INFO     root:conftest.py:3819 skip setup dualtor mux cables on non-dualtor testbed
INFO     tests.common.plugins.memory_utilization:__init__.py:64 Before test: collected memory_values {'before_test': {}, 'after_test': {}}
----------- curtailed output ----------
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:784 Polling DUT for traffic statistics for 23 seconds ...
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:803 Polling TGEN for in-flight traffic statistics...
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:824 In-flight traffic statistics for flows: ['Test Flow Prio 3', 'Test Flow Prio 4', 'Background Flow Prio 1', 'Background Flow Prio 5', 'Background Flow Prio 6', 'Background Flow Prio 2', 'Background Flow Prio 0']
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:825 In-flight TX frames: [68216, 68215, 81896551, 81896551, 81896551, 81896551, 81896551]
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:826 In-flight RX frames: [0, 0, 81896551, 81896551, 81896551, 81896551, 81896551]
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:832 In-flight traffic statistics for flows:
----------- curtailed output ----------
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:837 DUT polling complete
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:850 Checking if all flows have stopped. Attempt #1
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:856 All test and background traffic flows stopped
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:894 Dumping per-flow statistics
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:899 Stopping transmit on all remaining flows
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Flows stop 6.608s
PASSED                                                                                                                                                                                                          [ 50%]
----------- curtailed output ----------
INFO     root:__init__.py:81 -------------------- fixture disable_pfcwd setup starts --------------------
INFO     root:__init__.py:85 -------------------- fixture disable_pfcwd setup ends --------------------
INFO     root:__init__.py:81 -------------------- fixture tgen_port_info setup starts --------------------
INFO     tests.common.snappi_tests.snappi_fixtures:snappi_fixtures.py:906 Found relevant portchannel interfaces
INFO     root:__init__.py:85 -------------------- fixture tgen_port_info setup ends --------------------
INFO     root:conftest.py:3819 skip setup dualtor mux cables on non-dualtor testbed
----------- curtailed output ----------
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:784 Polling DUT for traffic statistics for 27 seconds ...
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:803 Polling TGEN for in-flight traffic statistics...
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:824 In-flight traffic statistics for flows: ['Test Flow Prio 3', 'Test Flow Prio 4', 'Background Flow Prio 1', 'Background Flow Prio 5', 'Background Flow Prio 6', 'Background Flow Prio 2', 'Background Flow Prio 0']
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:825 In-flight TX frames: [68221, 68222, 99137931, 99137931, 99137931, 99137931, 99137931]
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:826 In-flight RX frames: [0, 0, 99137931, 99137931, 99137931, 99137931, 99137931]
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:832 In-flight traffic statistics for flows:
----------- curtailed output ----------
INFO     tests.conftest:conftest.py:3097 Dumping Disk and Memory Space information after test on ixre-egl-board73
INFO     tests.conftest:conftest.py:3097 Dumping Disk and Memory Space information after test on ixre-egl-board74
INFO     tests.conftest:conftest.py:3101 Collecting core dumps after test on ixre-egl-board74
INFO     tests.conftest:conftest.py:3101 Collecting core dumps after test on ixre-egl-board73
INFO     tests.conftest:conftest.py:3112 Collecting running config after test on ixre-egl-board74
INFO     tests.conftest:conftest.py:3112 Collecting running config after test on ixre-egl-board73
INFO     tests.conftest:conftest.py:3259 Core dump and config check passed for test_pfc_pause_lossless_with_snappi.py
----------- curtailed output ----------
----------------------------------------------------------------------------------------------- live log sessionfinish ------------------------------------------------------------------------------------------------
INFO     root:__init__.py:67 Can not get Allure report URL. Please check logs
============================================================================== 2 passed, 14 deselected, 10 warnings in 808.66s (0:13:28) ==============================================================================
INFO:root:Can not get Allure report URL. Please check logs


Signed-off-by: amitpawa <amit.2.pawar@nokia.com>
vrajeshe pushed a commit that referenced this pull request Mar 23, 2026
…nter and global_pause test-script (sonic-net#22490)

Description of PR
Added support for tgen_port_info in:
tests/snappi_tests/pfc/test_global_pause_with_snappi.py
tests/snappi_tests/pfc/test_tx_drop_counter_with_snappi.py

Summary:
Fixes # (issue)

Type of change
 Bug fix
 Testbed and Framework(new/improvement)
 New Test case
 Skipped for non-supported platforms
 Test case improvement
Back port request
 202205
 202305
 202311
 202405
 202411
 202505
 202511
Approach
What is the motivation for this PR?
The tgen_port_info was added as part of Snappi test infra improvement, which enabled users to select between static (from variables.override.yml) and dynamic (select 100 and 400Gbps ports) ports.

This was NOT included in test_tx_drop_counter and test_global_pause test-scripts under snappi_tests/pfc section.

How did you do it?
Imported the tgen_port_info from snappi_fixtures.py and removed any reference to old setup_dut_port function for both test-scripts.

How did you verify/test it?
Verification on 202511 is present in pull-request sonic-net#22380.

Verification steps for master:

azureuser@7e081020c2c7:/data/tests$ date;python3 -m pytest --inventory ../ansible/ixia-sonic --host-pattern ixre-egl-board73,ixre-egl-board74 --testbed ixre-chassis17-t2 --testbed_file ../ansible/testbed.csv --show-capture=stdout --log-cli-level info --showlocals -ra --allow_recover --junit-xml=/tmp/y.xml --skip_sanity --log-file=/tmp/y.log --topology multidut-tgen -cache-clear --disable_loganalyzer snappi_tests/pfc/test_global_pause_with_snappi.py --pdb
Fri Feb 20 00:07:16 UTC 2026
====================================================================================================================== test session starts =======================================================================================================================
platform linux -- Python 3.8.10, pytest-7.4.0, pluggy-1.5.0
---- curtailed output ----

INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Config validation 0.014s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Ports configuration 1.261s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Captures configuration 0.116s

---- curtailed output ----
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:837 DUT polling complete
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:850 Checking if all flows have stopped. Attempt #1
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:856 All test and background traffic flows stopped
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:894 Dumping per-flow statistics
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:899 Stopping transmit on all remaining flows
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Flows stop 5.353s
PASSED                                                                                                                                                                                                                                                     [ 50%]
---- curtailed output ----
INFO     tests.common.plugins.memory_utilization:__init__.py:64 Before test: collected memory_values {'before_test': {}, 'after_test': {}}
------------------------------------------------------------------------------------------------------------------------- live log call --------------------------------------------------------------------------------------------------------------------------
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Config validation 0.014s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Ports configuration 1.059s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Captures configuration 0.110s
---- curtailed output ----
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:837 DUT polling complete
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:850 Checking if all flows have stopped. Attempt #1
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:856 All test and background traffic flows stopped
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:894 Dumping per-flow statistics
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:899 Stopping transmit on all remaining flows
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Flows stop 5.514s
PASSED                                                                                                                                                                                                                                                     [100%]
---- curtailed output ----
----------------------------------------------------------------------------------------------------------------- generated xml file: /tmp/y.xml -----------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------- live log sessionfinish ---------------------------------------------------------------------------------------------------------------------
INFO     root:__init__.py:67 Can not get Allure report URL. Please check logs
=========================================================================================================== 2 passed, 9 warnings in 789.04s (0:13:09) ============================================================================================================
INFO:root:Can not get Allure report URL. Please check logs

azureuser@7e081020c2c7:/data/tests$ date;python3 -m pytest --inventory ../ansible/ixia-sonic --host-pattern ixre-egl-board73,ixre-egl-board74 --testbed ixre-chassis17-t2 --testbed_file ../ansible/testbed.csv --show-capture=stdout --log-cli-level info --showlocals -ra --allow_recover --junit-xml=/tmp/y.xml --skip_sanity --log-file=/tmp/y.log --topology multidut-tgen -cache-clear --disable_loganalyzer snappi_tests/pfc/test_tx_drop_counter_with_snappi.py --pdb
Fri Feb 20 00:21:03 UTC 2026
---- curtailed output ----
INFO     ixnetwork_restpy.connection:connection.py:329 User info IxNetwork/tgen-ixia-03/admin-112-3670867
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 snappi-1.27.1
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 snappi_ixnetwork-1.27.2
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 ixnetwork_restpy-1.6.1
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Config validation 0.000s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Ports configuration 0.213s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Captures configuration 0.122s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Aggregation mode speed change 0.000s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Location configuration 0.288s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Layer1 configuration 0.000s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Lag Configuration 0.061s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Convert device config : 0.155s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Create IxNetwork device config : 0.000s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Push IxNetwork device config : 0.093s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Devices configuration 0.299s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Flows configuration 0.120s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Start interfaces 0.155s
INFO     root:__init__.py:76 -------------------- fixture tgen_port_info setup ends --------------------
INFO     root:__init__.py:81 -------------------- fixture disable_pfcwd setup starts --------------------
INFO     root:__init__.py:85 -------------------- fixture disable_pfcwd setup ends --------------------
INFO     root:conftest.py:3818 skip setup dualtor mux cables on non-dualtor testbed
---- curtailed output ----
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Config validation 0.012s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Ports configuration 1.265s
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Captures configuration 0.112s
---- curtailed output ----
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:837 DUT polling complete
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:850 Checking if all flows have stopped. Attempt #1
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:856 All test and background traffic flows stopped
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:894 Dumping per-flow statistics
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:899 Stopping transmit on all remaining flows
---- curtailed output ----
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:837 DUT polling complete
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:850 Checking if all flows have stopped. Attempt #1
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:856 All test and background traffic flows stopped
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:894 Dumping per-flow statistics
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:899 Stopping transmit on all remaining flows
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Link State operation 0.052s
INFO     tests.snappi_tests.pfc.files.helper:helper.py:452 Snappi port Port 0 is set to DOWN
INFO     tests.snappi_tests.pfc.files.helper:helper.py:457 Sleeping for 90 seconds
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Link State operation 0.058s
INFO     tests.snappi_tests.pfc.files.helper:helper.py:469 Snappi port Port 0 is set to UP
---- curtailed output ----
INFO     root:__init__.py:67 Can not get Allure report URL. Please check logs
=========================================================================================================== 2 passed, 9 warnings in 906.71s (0:15:06) ============================================================================================================
INFO:root:Can not get Allure report URL. Please check logs

Signed-off-by: amitpawa <amit.2.pawar@nokia.com>

* snappi: issue-22363 removed multidut-port-info import from pfc tx_drop_counter testcase

Signed-off-by: amitpawa <amit.2.pawar@nokia.com>

---------

Signed-off-by: amitpawa <amit.2.pawar@nokia.com>
Signed-off-by: Venkata Gouri Rajesh Etla <vrajeshe@cisco.com>
vrajeshe pushed a commit that referenced this pull request Mar 23, 2026
…ion (sonic-net#22504)

Description of PR
The tgen_port_info infra function in common/snappi_tests/snappi_fixtures.py is used to select port (dynamically or statically) for the test. During static port selection, the variables.override.yml file is used to select Rx and Tx port for the test.

However, after the test, there was no explicit test clean_up code. This PR addresses it.

Summary:
Fixes sonic-net#20993

Type of change
 Bug fix
 Testbed and Framework(new/improvement)
 New Test case
 Skipped for non-supported platforms
 Test case improvement
Back port request
 202205
 202305
 202311
 202405
 202411
 202505
 202511
Approach
What is the motivation for this PR?
The tgen_port_info is used to select the Rx and Tx port for the test.

In case of static port selection, the function returned snappi_dut_base_config(duthosts, snappi_ports, snappi_api, setup=True), and there was no explicit cleanup after the test.

How did you do it?
If the 'is_override' flag is true, the static port selection code is used to select Rx and Tx ports from variables.override.yml file.
Instead of returning with function 'snappi_dut_base_config', 'yield' is called to ensure that clean-up is called at the end of the test.
Once yield returns back to the test, then 'setup_dut_ports' is called with setup=False to ensure that clean-up happens after the test.
How did you verify/test it?
For verification of this changes on 202511 branch, please refer to PR sonic-net#22441

Verification of the PR on master with multi-dut setup:

azureuser@7e081020c2c7:/data/tests$ date;python3 -m pytest --inventory ../ansible/ixia-sonic --host-pattern ixre-egl-board73,ixre-egl-board74 --testbed ixre-chassis17-t2 --testbed_file ../ansible/testbed.csv --show-capture=stdout --log-cli-level info --showlocals -ra --allow_recover --junit-xml=/tmp/y.xml --skip_sanity --log-file=/tmp/y.log --topology multidut-tgen -cache-clear --disable_loganalyzer snappi_tests/pfc/test_pfc_pause_lossless_with_snappi.py -k test_pfc_pause_multi_lossless_prio --pdb
Fri Feb 20 14:26:57 UTC 2026
================================================================================================= test session starts =================================================================================================
platform linux -- Python 3.8.10, pytest-7.4.0, pluggy-1.5.0
----------- curtailed output ----------
INFO     tests.conftest:conftest.py:691 Randomly select dut ixre-egl-board73 for testing
INFO     root:__init__.py:81 -------------------- fixture enable_packet_aging_after_test setup starts --------------------
INFO     root:__init__.py:85 -------------------- fixture enable_packet_aging_after_test setup ends --------------------
INFO     root:__init__.py:81 -------------------- fixture rand_lossless_prio setup starts --------------------
INFO     root:__init__.py:85 -------------------- fixture rand_lossless_prio setup ends --------------------
INFO     root:__init__.py:81 -------------------- fixture rand_lossy_prio setup starts --------------------
INFO     root:__init__.py:85 -------------------- fixture rand_lossy_prio setup ends --------------------
INFO     root:__init__.py:81 -------------------- fixture start_pfcwd_after_test setup starts --------------------
INFO     root:__init__.py:85 -------------------- fixture start_pfcwd_after_test setup ends --------------------
INFO     root:__init__.py:81 -------------------- fixture disable_voq_watchdog setup starts --------------------
INFO     root:__init__.py:85 -------------------- fixture disable_voq_watchdog setup ends --------------------
INFO     root:__init__.py:81 -------------------- fixture number_of_tx_rx_ports setup starts --------------------
INFO     root:__init__.py:85 -------------------- fixture number_of_tx_rx_ports setup ends --------------------
INFO     root:__init__.py:69 -------------------- fixture snappi_api_serv_ip setup starts --------------------
INFO     root:__init__.py:76 -------------------- fixture snappi_api_serv_ip setup ends --------------------
INFO     root:__init__.py:69 -------------------- fixture snappi_api_serv_port setup starts --------------------
INFO     root:__init__.py:76 -------------------- fixture snappi_api_serv_port setup ends --------------------
INFO     root:__init__.py:81 -------------------- fixture snappi_api setup starts --------------------
INFO     root:__init__.py:85 -------------------- fixture snappi_api setup ends --------------------
INFO     tests.conftest:conftest.py:727 Randomly select dut ixre-egl-board74 for testing
INFO     root:__init__.py:69 -------------------- fixture prio_dscp_map setup starts --------------------
INFO     root:__init__.py:76 -------------------- fixture prio_dscp_map setup ends --------------------
INFO     root:__init__.py:69 -------------------- fixture all_prio_list setup starts --------------------
INFO     root:__init__.py:76 -------------------- fixture all_prio_list setup ends --------------------
INFO     root:__init__.py:69 -------------------- fixture lossless_prio_list setup starts --------------------
INFO     root:__init__.py:76 -------------------- fixture lossless_prio_list setup ends --------------------
INFO     root:__init__.py:69 -------------------- fixture lossy_prio_list setup starts --------------------
INFO     root:__init__.py:76 -------------------- fixture lossy_prio_list setup ends --------------------
INFO     root:__init__.py:69 -------------------- fixture get_snappi_ports setup starts --------------------
INFO     root:__init__.py:69 -------------------- fixture get_snappi_ports_multi_dut setup starts --------------------
INFO     root:__init__.py:76 -------------------- fixture get_snappi_ports_multi_dut setup ends --------------------
INFO     root:__init__.py:76 -------------------- fixture get_snappi_ports setup ends --------------------
INFO     root:__init__.py:69 -------------------- fixture snappi_port_selection setup starts --------------------
INFO     root:__init__.py:76 -------------------- fixture snappi_port_selection setup ends --------------------
INFO     root:__init__.py:77 Log analyzer is disabled
INFO     root:__init__.py:81 -------------------- fixture disable_pfcwd setup starts --------------------
INFO     root:__init__.py:85 -------------------- fixture disable_pfcwd setup ends --------------------
INFO     root:__init__.py:81 -------------------- fixture tgen_port_info setup starts --------------------
----------- curtailed output ----------
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Start interfaces 0.164s
INFO     tests.common.snappi_tests.snappi_fixtures:snappi_fixtures.py:906 Found relevant portchannel interfaces
INFO     root:__init__.py:85 -------------------- fixture tgen_port_info setup ends --------------------
INFO     root:conftest.py:3819 skip setup dualtor mux cables on non-dualtor testbed
INFO     tests.common.plugins.memory_utilization:__init__.py:64 Before test: collected memory_values {'before_test': {}, 'after_test': {}}
----------- curtailed output ----------
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:784 Polling DUT for traffic statistics for 23 seconds ...
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:803 Polling TGEN for in-flight traffic statistics...
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:824 In-flight traffic statistics for flows: ['Test Flow Prio 3', 'Test Flow Prio 4', 'Background Flow Prio 1', 'Background Flow Prio 5', 'Background Flow Prio 6', 'Background Flow Prio 2', 'Background Flow Prio 0']
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:825 In-flight TX frames: [68216, 68215, 81896551, 81896551, 81896551, 81896551, 81896551]
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:826 In-flight RX frames: [0, 0, 81896551, 81896551, 81896551, 81896551, 81896551]
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:832 In-flight traffic statistics for flows:
----------- curtailed output ----------
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:837 DUT polling complete
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:850 Checking if all flows have stopped. Attempt #1
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:856 All test and background traffic flows stopped
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:894 Dumping per-flow statistics
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:899 Stopping transmit on all remaining flows
INFO     snappi_ixnetwork.snappi_api:snappi_api.py:1419 Flows stop 6.608s
PASSED                                                                                                                                                                                                          [ 50%]
----------- curtailed output ----------
INFO     root:__init__.py:81 -------------------- fixture disable_pfcwd setup starts --------------------
INFO     root:__init__.py:85 -------------------- fixture disable_pfcwd setup ends --------------------
INFO     root:__init__.py:81 -------------------- fixture tgen_port_info setup starts --------------------
INFO     tests.common.snappi_tests.snappi_fixtures:snappi_fixtures.py:906 Found relevant portchannel interfaces
INFO     root:__init__.py:85 -------------------- fixture tgen_port_info setup ends --------------------
INFO     root:conftest.py:3819 skip setup dualtor mux cables on non-dualtor testbed
----------- curtailed output ----------
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:784 Polling DUT for traffic statistics for 27 seconds ...
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:803 Polling TGEN for in-flight traffic statistics...
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:824 In-flight traffic statistics for flows: ['Test Flow Prio 3', 'Test Flow Prio 4', 'Background Flow Prio 1', 'Background Flow Prio 5', 'Background Flow Prio 6', 'Background Flow Prio 2', 'Background Flow Prio 0']
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:825 In-flight TX frames: [68221, 68222, 99137931, 99137931, 99137931, 99137931, 99137931]
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:826 In-flight RX frames: [0, 0, 99137931, 99137931, 99137931, 99137931, 99137931]
INFO     tests.common.snappi_tests.traffic_generation:traffic_generation.py:832 In-flight traffic statistics for flows:
----------- curtailed output ----------
INFO     tests.conftest:conftest.py:3097 Dumping Disk and Memory Space information after test on ixre-egl-board73
INFO     tests.conftest:conftest.py:3097 Dumping Disk and Memory Space information after test on ixre-egl-board74
INFO     tests.conftest:conftest.py:3101 Collecting core dumps after test on ixre-egl-board74
INFO     tests.conftest:conftest.py:3101 Collecting core dumps after test on ixre-egl-board73
INFO     tests.conftest:conftest.py:3112 Collecting running config after test on ixre-egl-board74
INFO     tests.conftest:conftest.py:3112 Collecting running config after test on ixre-egl-board73
INFO     tests.conftest:conftest.py:3259 Core dump and config check passed for test_pfc_pause_lossless_with_snappi.py
----------- curtailed output ----------
----------------------------------------------------------------------------------------------- live log sessionfinish ------------------------------------------------------------------------------------------------
INFO     root:__init__.py:67 Can not get Allure report URL. Please check logs
============================================================================== 2 passed, 14 deselected, 10 warnings in 808.66s (0:13:28) ==============================================================================
INFO:root:Can not get Allure report URL. Please check logs

Signed-off-by: amitpawa <amit.2.pawar@nokia.com>
Signed-off-by: Venkata Gouri Rajesh Etla <vrajeshe@cisco.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants