Skip to content

[smartswitch]: Add is_smartswitch and is_dpu facts to simplify platform-specific test handling#19313

Merged
qiluo-msft merged 9 commits intosonic-net:masterfrom
vvolam:add-ss-vars
Jul 9, 2025
Merged

[smartswitch]: Add is_smartswitch and is_dpu facts to simplify platform-specific test handling#19313
qiluo-msft merged 9 commits intosonic-net:masterfrom
vvolam:add-ss-vars

Conversation

@vvolam
Copy link
Copy Markdown
Contributor

@vvolam vvolam commented Jul 1, 2025

Description of PR

Summary:
This PR adds is_smartswitch and is_dpu device facts to the dut_basic_facts module, enabling easier conditional test logic based on platform type. It removes redundant implementations of the same logic from the SonicHost class and updates existing test logic to consume these new variables through the Ansible facts system. This change also introduces a new tests_mark_conditions_smartswitch.yaml marker configuration file to skip SmartSwitch-incompatible tests declaratively.

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

Approach

What is the motivation for this PR?

Some tests such as fast_reboot and warm_reboot are not applicable on SmartSwitch platforms or require different handling on DPU nodes. This PR simplifies the detection of such platform roles using shared Ansible facts instead of scattered implementations. This approach makes test conditions easier to read, reuse, and maintain.

How did you do it?

  • Added is_smartswitch and is_dpu flags to the dut_basic_facts module.
  • Removed is_smartswitch() and is_dpu() methods from the SonicHost class.
  • Replaced all direct method calls with duthost.facts['is_smartswitch'] and duthost.facts['is_dpu'].
  • Updated tests_mark_conditions_platform_tests.yaml to skip reboot tests on SmartSwitches.
  • Introduced a new marker file tests_mark_conditions_smartswitch.yaml to manage SmartSwitch-specific test conditions.
  • Cleaned up redundant code and made logic consistent across reboot and techsupport tests.

How did you verify/test it?

  • Ran platform tests and verified that SmartSwitch-incompatible cases are skipped automatically.
  • Validated dut_basic_facts returns correct values for is_smartswitch and is_dpu across multiple platforms.
  • Confirmed test_reboot.py and test_techsupport.py logic correctly reflects the updated fact-based checks.

Any platform specific information?

Applies to SmartSwitch and DPU platforms only.

Supported testbed topology if it's a new test case?

Not applicable. No new test case introduced.

Documentation

N/A

@vvolam vvolam requested review from prgeor and yxieca as code owners July 1, 2025 23:02
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Contributor

@congh-nvidia congh-nvidia Jul 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @vvolam , as what I understand, there will be conflicts if we have same tests in here and in the other yaml files. We can only split the mark conditions based on tests but not platforms.
Even if you only want to add tests in smartswitch/ here, it is confusing and there could be mistakes in the future.
Looks like the file is to skip the smartswitch tests on other platforms, can add a fixture to do this for the tests under smartsiwtch/ ?

Other changes look good to me.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@congh-nvidia I have added the new fixture. Thank you!

@vvolam vvolam requested a review from StormLiangMS as a code owner July 3, 2025 04:58
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

yejianquan pushed a commit that referenced this pull request Jul 25, 2025
…rtswitch (#19617) (#19733)

Description of PR
Use duthost.dut_basic_facts()['ansible_facts']['dut_basic_facts'].get("is_smartswitch") instead of 'duthost.get_facts().get("is_smartswitch")' , because is_smartswitch is defined in dut_basic_facts not in facts
Skip warm-reboot and fast-reboot check test for test_check_reset_status on smartswitch
skip test_bgp_session_interface_down on smartswitch when reboot type is warm-reboot
Summary:
Fixes # (issue)

Type of change
 Bug fix
 Testbed and Framework(new/improvement)
 New Test case
 Skipped for non-supported platforms
 Test case improvement

Approach
What is the motivation for this PR?
Fix issue introduced by PR: [smartswitch]: Add is_smartswitch and is_dpu facts to simplify platform-specific test handling #19313
Skip some tests on smartswitch, because smartswitch does not support warm-reboot and fast-reboot
How did you do it?
Use duthost.dut_basic_facts()['ansible_facts']['dut_basic_facts'].get("is_smartswitch") instead of 'duthost.get_facts().get("is_smartswitch")' , because is_smartswitch is defined in dut_basic_facts
Skip warm-reboot and fast-reboot for test_check_reset_status on smartswitch
skip warm-reboot for test_bgp_session_interface_down on smartswitch
How did you verify/test it?
Run the tests on smartswitch

Any platform specific information?
smartswitch

Supported testbed topology if it's a new test case?
xixuej added a commit to xixuej/sonic-mgmt that referenced this pull request Jul 28, 2025
This changes is because is_dpu method was removed
by below PR
[smartswitch]: Add is_smartswitch and is_dpu facts to simplify platform-specific test handling (sonic-net#19313)
roy-sror pushed a commit that referenced this pull request Jul 29, 2025
* Refactor DPU check in device_utils and test_watchdog

This changes is because is_dpu method was removed
by below PR
[smartswitch]: Add is_smartswitch and is_dpu facts to simplify platform-specific test handling (#19313)

* Fix the condition for dpu in techsupport test

* Fix skip dpu logic in techsupport test

---------

Co-authored-by: Cong Hou <congh@nvidia.com>
@xixuej xixuej mentioned this pull request Jul 30, 2025
11 tasks
yejianquan pushed a commit that referenced this pull request Jul 30, 2025
cherry-pick #19574
Description of PR
Summary:
This changes is because is_dpu method was removed
by below PR
[smartswitch]: Add is_smartswitch and is_dpu facts to simplify platform-specific test handling (#19313)

The way to check if is dpu should use duthost.dut_basic_facts()['ansible_facts']['dut_basic_facts'].get("is_dpu") instead of duthost.get_facts().get('is_dpu') becasue PR #19313 added the facts into dut_basic_facts

Resolve merge conflicts for branch 202505
Co-authored-by: Cong Hou <congh@nvidia.com>
nissampa pushed a commit to nissampa/sonic-mgmt_dpu_test that referenced this pull request Aug 7, 2025
…rm-specific test handling (sonic-net#19313)

Description of PR
Summary:
This PR adds is_smartswitch and is_dpu device facts to the dut_basic_facts module, enabling easier conditional test logic based on platform type. It removes redundant implementations of the same logic from the SonicHost class and updates existing test logic to consume these new variables through the Ansible facts system. This change also introduces a new tests_mark_conditions_smartswitch.yaml marker configuration file to skip SmartSwitch-incompatible tests declaratively.

Approach
What is the motivation for this PR?
Some tests such as fast_reboot and warm_reboot are not applicable on SmartSwitch platforms or require different handling on DPU nodes. This PR simplifies the detection of such platform roles using shared Ansible facts instead of scattered implementations. This approach makes test conditions easier to read, reuse, and maintain.

How did you do it?
Added is_smartswitch and is_dpu flags to the dut_basic_facts module.
Removed is_smartswitch() and is_dpu() methods from the SonicHost class.
Replaced all direct method calls with duthost.facts['is_smartswitch'] and duthost.facts['is_dpu'].
Updated tests_mark_conditions_platform_tests.yaml to skip reboot tests on SmartSwitches.
Introduced a new marker file tests_mark_conditions_smartswitch.yaml to manage SmartSwitch-specific test conditions.
Cleaned up redundant code and made logic consistent across reboot and techsupport tests.
How did you verify/test it?
Ran platform tests and verified that SmartSwitch-incompatible cases are skipped automatically.
Validated dut_basic_facts returns correct values for is_smartswitch and is_dpu across multiple platforms.
Confirmed test_reboot.py and test_techsupport.py logic correctly reflects the updated fact-based checks.
Any platform specific information?
Applies to SmartSwitch and DPU platforms only.

Supported testbed topology if it's a new test case?
Not applicable. No new test case introduced.
nissampa pushed a commit to nissampa/sonic-mgmt_dpu_test that referenced this pull request Aug 7, 2025
* Refactor DPU check in device_utils and test_watchdog

This changes is because is_dpu method was removed
by below PR
[smartswitch]: Add is_smartswitch and is_dpu facts to simplify platform-specific test handling (sonic-net#19313)

* Fix the condition for dpu in techsupport test

* Fix skip dpu logic in techsupport test

---------

Co-authored-by: Cong Hou <congh@nvidia.com>
ashutosh-agrawal pushed a commit to ashutosh-agrawal/sonic-mgmt that referenced this pull request Aug 14, 2025
…rm-specific test handling (sonic-net#19313)

Description of PR
Summary:
This PR adds is_smartswitch and is_dpu device facts to the dut_basic_facts module, enabling easier conditional test logic based on platform type. It removes redundant implementations of the same logic from the SonicHost class and updates existing test logic to consume these new variables through the Ansible facts system. This change also introduces a new tests_mark_conditions_smartswitch.yaml marker configuration file to skip SmartSwitch-incompatible tests declaratively.

Approach
What is the motivation for this PR?
Some tests such as fast_reboot and warm_reboot are not applicable on SmartSwitch platforms or require different handling on DPU nodes. This PR simplifies the detection of such platform roles using shared Ansible facts instead of scattered implementations. This approach makes test conditions easier to read, reuse, and maintain.

How did you do it?
Added is_smartswitch and is_dpu flags to the dut_basic_facts module.
Removed is_smartswitch() and is_dpu() methods from the SonicHost class.
Replaced all direct method calls with duthost.facts['is_smartswitch'] and duthost.facts['is_dpu'].
Updated tests_mark_conditions_platform_tests.yaml to skip reboot tests on SmartSwitches.
Introduced a new marker file tests_mark_conditions_smartswitch.yaml to manage SmartSwitch-specific test conditions.
Cleaned up redundant code and made logic consistent across reboot and techsupport tests.
How did you verify/test it?
Ran platform tests and verified that SmartSwitch-incompatible cases are skipped automatically.
Validated dut_basic_facts returns correct values for is_smartswitch and is_dpu across multiple platforms.
Confirmed test_reboot.py and test_techsupport.py logic correctly reflects the updated fact-based checks.
Any platform specific information?
Applies to SmartSwitch and DPU platforms only.

Supported testbed topology if it's a new test case?
Not applicable. No new test case introduced.
ashutosh-agrawal pushed a commit to ashutosh-agrawal/sonic-mgmt that referenced this pull request Aug 14, 2025
* Refactor DPU check in device_utils and test_watchdog

This changes is because is_dpu method was removed
by below PR
[smartswitch]: Add is_smartswitch and is_dpu facts to simplify platform-specific test handling (sonic-net#19313)

* Fix the condition for dpu in techsupport test

* Fix skip dpu logic in techsupport test

---------

Co-authored-by: Cong Hou <congh@nvidia.com>
vidyac86 pushed a commit to vidyac86/sonic-mgmt that referenced this pull request Oct 23, 2025
…rm-specific test handling (sonic-net#19313)

Description of PR
Summary:
This PR adds is_smartswitch and is_dpu device facts to the dut_basic_facts module, enabling easier conditional test logic based on platform type. It removes redundant implementations of the same logic from the SonicHost class and updates existing test logic to consume these new variables through the Ansible facts system. This change also introduces a new tests_mark_conditions_smartswitch.yaml marker configuration file to skip SmartSwitch-incompatible tests declaratively.

Approach
What is the motivation for this PR?
Some tests such as fast_reboot and warm_reboot are not applicable on SmartSwitch platforms or require different handling on DPU nodes. This PR simplifies the detection of such platform roles using shared Ansible facts instead of scattered implementations. This approach makes test conditions easier to read, reuse, and maintain.

How did you do it?
Added is_smartswitch and is_dpu flags to the dut_basic_facts module.
Removed is_smartswitch() and is_dpu() methods from the SonicHost class.
Replaced all direct method calls with duthost.facts['is_smartswitch'] and duthost.facts['is_dpu'].
Updated tests_mark_conditions_platform_tests.yaml to skip reboot tests on SmartSwitches.
Introduced a new marker file tests_mark_conditions_smartswitch.yaml to manage SmartSwitch-specific test conditions.
Cleaned up redundant code and made logic consistent across reboot and techsupport tests.
How did you verify/test it?
Ran platform tests and verified that SmartSwitch-incompatible cases are skipped automatically.
Validated dut_basic_facts returns correct values for is_smartswitch and is_dpu across multiple platforms.
Confirmed test_reboot.py and test_techsupport.py logic correctly reflects the updated fact-based checks.
Any platform specific information?
Applies to SmartSwitch and DPU platforms only.

Supported testbed topology if it's a new test case?
Not applicable. No new test case introduced.
vidyac86 pushed a commit to vidyac86/sonic-mgmt that referenced this pull request Oct 23, 2025
* Refactor DPU check in device_utils and test_watchdog

This changes is because is_dpu method was removed
by below PR
[smartswitch]: Add is_smartswitch and is_dpu facts to simplify platform-specific test handling (sonic-net#19313)

* Fix the condition for dpu in techsupport test

* Fix skip dpu logic in techsupport test

---------

Co-authored-by: Cong Hou <congh@nvidia.com>
opcoder0 pushed a commit to opcoder0/sonic-mgmt that referenced this pull request Dec 8, 2025
…rm-specific test handling (sonic-net#19313)

Description of PR
Summary:
This PR adds is_smartswitch and is_dpu device facts to the dut_basic_facts module, enabling easier conditional test logic based on platform type. It removes redundant implementations of the same logic from the SonicHost class and updates existing test logic to consume these new variables through the Ansible facts system. This change also introduces a new tests_mark_conditions_smartswitch.yaml marker configuration file to skip SmartSwitch-incompatible tests declaratively.

Approach
What is the motivation for this PR?
Some tests such as fast_reboot and warm_reboot are not applicable on SmartSwitch platforms or require different handling on DPU nodes. This PR simplifies the detection of such platform roles using shared Ansible facts instead of scattered implementations. This approach makes test conditions easier to read, reuse, and maintain.

How did you do it?
Added is_smartswitch and is_dpu flags to the dut_basic_facts module.
Removed is_smartswitch() and is_dpu() methods from the SonicHost class.
Replaced all direct method calls with duthost.facts['is_smartswitch'] and duthost.facts['is_dpu'].
Updated tests_mark_conditions_platform_tests.yaml to skip reboot tests on SmartSwitches.
Introduced a new marker file tests_mark_conditions_smartswitch.yaml to manage SmartSwitch-specific test conditions.
Cleaned up redundant code and made logic consistent across reboot and techsupport tests.
How did you verify/test it?
Ran platform tests and verified that SmartSwitch-incompatible cases are skipped automatically.
Validated dut_basic_facts returns correct values for is_smartswitch and is_dpu across multiple platforms.
Confirmed test_reboot.py and test_techsupport.py logic correctly reflects the updated fact-based checks.
Any platform specific information?
Applies to SmartSwitch and DPU platforms only.

Supported testbed topology if it's a new test case?
Not applicable. No new test case introduced.

Signed-off-by: opcoder0 <110003254+opcoder0@users.noreply.github.com>
opcoder0 pushed a commit to opcoder0/sonic-mgmt that referenced this pull request Dec 8, 2025
* Refactor DPU check in device_utils and test_watchdog

This changes is because is_dpu method was removed
by below PR
[smartswitch]: Add is_smartswitch and is_dpu facts to simplify platform-specific test handling (sonic-net#19313)

* Fix the condition for dpu in techsupport test

* Fix skip dpu logic in techsupport test

---------

Co-authored-by: Cong Hou <congh@nvidia.com>

Signed-off-by: opcoder0 <110003254+opcoder0@users.noreply.github.com>
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Dec 16, 2025
…rm-specific test handling (sonic-net#19313)

Description of PR
Summary:
This PR adds is_smartswitch and is_dpu device facts to the dut_basic_facts module, enabling easier conditional test logic based on platform type. It removes redundant implementations of the same logic from the SonicHost class and updates existing test logic to consume these new variables through the Ansible facts system. This change also introduces a new tests_mark_conditions_smartswitch.yaml marker configuration file to skip SmartSwitch-incompatible tests declaratively.

Approach
What is the motivation for this PR?
Some tests such as fast_reboot and warm_reboot are not applicable on SmartSwitch platforms or require different handling on DPU nodes. This PR simplifies the detection of such platform roles using shared Ansible facts instead of scattered implementations. This approach makes test conditions easier to read, reuse, and maintain.

How did you do it?
Added is_smartswitch and is_dpu flags to the dut_basic_facts module.
Removed is_smartswitch() and is_dpu() methods from the SonicHost class.
Replaced all direct method calls with duthost.facts['is_smartswitch'] and duthost.facts['is_dpu'].
Updated tests_mark_conditions_platform_tests.yaml to skip reboot tests on SmartSwitches.
Introduced a new marker file tests_mark_conditions_smartswitch.yaml to manage SmartSwitch-specific test conditions.
Cleaned up redundant code and made logic consistent across reboot and techsupport tests.
How did you verify/test it?
Ran platform tests and verified that SmartSwitch-incompatible cases are skipped automatically.
Validated dut_basic_facts returns correct values for is_smartswitch and is_dpu across multiple platforms.
Confirmed test_reboot.py and test_techsupport.py logic correctly reflects the updated fact-based checks.
Any platform specific information?
Applies to SmartSwitch and DPU platforms only.

Supported testbed topology if it's a new test case?
Not applicable. No new test case introduced.

Signed-off-by: Guy Shemesh <gshemesh@nvidia.com>
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Dec 16, 2025
* Refactor DPU check in device_utils and test_watchdog

This changes is because is_dpu method was removed
by below PR
[smartswitch]: Add is_smartswitch and is_dpu facts to simplify platform-specific test handling (sonic-net#19313)

* Fix the condition for dpu in techsupport test

* Fix skip dpu logic in techsupport test

---------

Co-authored-by: Cong Hou <congh@nvidia.com>
Signed-off-by: Guy Shemesh <gshemesh@nvidia.com>
AharonMalkin pushed a commit to AharonMalkin/sonic-mgmt that referenced this pull request Dec 16, 2025
…rm-specific test handling (sonic-net#19313)

Description of PR
Summary:
This PR adds is_smartswitch and is_dpu device facts to the dut_basic_facts module, enabling easier conditional test logic based on platform type. It removes redundant implementations of the same logic from the SonicHost class and updates existing test logic to consume these new variables through the Ansible facts system. This change also introduces a new tests_mark_conditions_smartswitch.yaml marker configuration file to skip SmartSwitch-incompatible tests declaratively.

Approach
What is the motivation for this PR?
Some tests such as fast_reboot and warm_reboot are not applicable on SmartSwitch platforms or require different handling on DPU nodes. This PR simplifies the detection of such platform roles using shared Ansible facts instead of scattered implementations. This approach makes test conditions easier to read, reuse, and maintain.

How did you do it?
Added is_smartswitch and is_dpu flags to the dut_basic_facts module.
Removed is_smartswitch() and is_dpu() methods from the SonicHost class.
Replaced all direct method calls with duthost.facts['is_smartswitch'] and duthost.facts['is_dpu'].
Updated tests_mark_conditions_platform_tests.yaml to skip reboot tests on SmartSwitches.
Introduced a new marker file tests_mark_conditions_smartswitch.yaml to manage SmartSwitch-specific test conditions.
Cleaned up redundant code and made logic consistent across reboot and techsupport tests.
How did you verify/test it?
Ran platform tests and verified that SmartSwitch-incompatible cases are skipped automatically.
Validated dut_basic_facts returns correct values for is_smartswitch and is_dpu across multiple platforms.
Confirmed test_reboot.py and test_techsupport.py logic correctly reflects the updated fact-based checks.
Any platform specific information?
Applies to SmartSwitch and DPU platforms only.

Supported testbed topology if it's a new test case?
Not applicable. No new test case introduced.

Signed-off-by: Aharon Malkin <amalkin@nvidia.com>
AharonMalkin pushed a commit to AharonMalkin/sonic-mgmt that referenced this pull request Dec 16, 2025
* Refactor DPU check in device_utils and test_watchdog

This changes is because is_dpu method was removed
by below PR
[smartswitch]: Add is_smartswitch and is_dpu facts to simplify platform-specific test handling (sonic-net#19313)

* Fix the condition for dpu in techsupport test

* Fix skip dpu logic in techsupport test

---------

Co-authored-by: Cong Hou <congh@nvidia.com>
Signed-off-by: Aharon Malkin <amalkin@nvidia.com>
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Dec 21, 2025
…rm-specific test handling (sonic-net#19313)

Description of PR
Summary:
This PR adds is_smartswitch and is_dpu device facts to the dut_basic_facts module, enabling easier conditional test logic based on platform type. It removes redundant implementations of the same logic from the SonicHost class and updates existing test logic to consume these new variables through the Ansible facts system. This change also introduces a new tests_mark_conditions_smartswitch.yaml marker configuration file to skip SmartSwitch-incompatible tests declaratively.

Approach
What is the motivation for this PR?
Some tests such as fast_reboot and warm_reboot are not applicable on SmartSwitch platforms or require different handling on DPU nodes. This PR simplifies the detection of such platform roles using shared Ansible facts instead of scattered implementations. This approach makes test conditions easier to read, reuse, and maintain.

How did you do it?
Added is_smartswitch and is_dpu flags to the dut_basic_facts module.
Removed is_smartswitch() and is_dpu() methods from the SonicHost class.
Replaced all direct method calls with duthost.facts['is_smartswitch'] and duthost.facts['is_dpu'].
Updated tests_mark_conditions_platform_tests.yaml to skip reboot tests on SmartSwitches.
Introduced a new marker file tests_mark_conditions_smartswitch.yaml to manage SmartSwitch-specific test conditions.
Cleaned up redundant code and made logic consistent across reboot and techsupport tests.
How did you verify/test it?
Ran platform tests and verified that SmartSwitch-incompatible cases are skipped automatically.
Validated dut_basic_facts returns correct values for is_smartswitch and is_dpu across multiple platforms.
Confirmed test_reboot.py and test_techsupport.py logic correctly reflects the updated fact-based checks.
Any platform specific information?
Applies to SmartSwitch and DPU platforms only.

Supported testbed topology if it's a new test case?
Not applicable. No new test case introduced.

Signed-off-by: Guy Shemesh <gshemesh@nvidia.com>
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Dec 21, 2025
* Refactor DPU check in device_utils and test_watchdog

This changes is because is_dpu method was removed
by below PR
[smartswitch]: Add is_smartswitch and is_dpu facts to simplify platform-specific test handling (sonic-net#19313)

* Fix the condition for dpu in techsupport test

* Fix skip dpu logic in techsupport test

---------

Co-authored-by: Cong Hou <congh@nvidia.com>
Signed-off-by: Guy Shemesh <gshemesh@nvidia.com>
venu-nexthop pushed a commit to venu-nexthop/sonic-mgmt that referenced this pull request Jan 13, 2026
…rm-specific test handling (sonic-net#19313)

Description of PR
Summary:
This PR adds is_smartswitch and is_dpu device facts to the dut_basic_facts module, enabling easier conditional test logic based on platform type. It removes redundant implementations of the same logic from the SonicHost class and updates existing test logic to consume these new variables through the Ansible facts system. This change also introduces a new tests_mark_conditions_smartswitch.yaml marker configuration file to skip SmartSwitch-incompatible tests declaratively.

Approach
What is the motivation for this PR?
Some tests such as fast_reboot and warm_reboot are not applicable on SmartSwitch platforms or require different handling on DPU nodes. This PR simplifies the detection of such platform roles using shared Ansible facts instead of scattered implementations. This approach makes test conditions easier to read, reuse, and maintain.

How did you do it?
Added is_smartswitch and is_dpu flags to the dut_basic_facts module.
Removed is_smartswitch() and is_dpu() methods from the SonicHost class.
Replaced all direct method calls with duthost.facts['is_smartswitch'] and duthost.facts['is_dpu'].
Updated tests_mark_conditions_platform_tests.yaml to skip reboot tests on SmartSwitches.
Introduced a new marker file tests_mark_conditions_smartswitch.yaml to manage SmartSwitch-specific test conditions.
Cleaned up redundant code and made logic consistent across reboot and techsupport tests.
How did you verify/test it?
Ran platform tests and verified that SmartSwitch-incompatible cases are skipped automatically.
Validated dut_basic_facts returns correct values for is_smartswitch and is_dpu across multiple platforms.
Confirmed test_reboot.py and test_techsupport.py logic correctly reflects the updated fact-based checks.
Any platform specific information?
Applies to SmartSwitch and DPU platforms only.

Supported testbed topology if it's a new test case?
Not applicable. No new test case introduced.
venu-nexthop pushed a commit to venu-nexthop/sonic-mgmt that referenced this pull request Jan 13, 2026
* Refactor DPU check in device_utils and test_watchdog

This changes is because is_dpu method was removed
by below PR
[smartswitch]: Add is_smartswitch and is_dpu facts to simplify platform-specific test handling (sonic-net#19313)

* Fix the condition for dpu in techsupport test

* Fix skip dpu logic in techsupport test

---------

Co-authored-by: Cong Hou <congh@nvidia.com>
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Jan 26, 2026
…rm-specific test handling (sonic-net#19313)

Description of PR
Summary:
This PR adds is_smartswitch and is_dpu device facts to the dut_basic_facts module, enabling easier conditional test logic based on platform type. It removes redundant implementations of the same logic from the SonicHost class and updates existing test logic to consume these new variables through the Ansible facts system. This change also introduces a new tests_mark_conditions_smartswitch.yaml marker configuration file to skip SmartSwitch-incompatible tests declaratively.

Approach
What is the motivation for this PR?
Some tests such as fast_reboot and warm_reboot are not applicable on SmartSwitch platforms or require different handling on DPU nodes. This PR simplifies the detection of such platform roles using shared Ansible facts instead of scattered implementations. This approach makes test conditions easier to read, reuse, and maintain.

How did you do it?
Added is_smartswitch and is_dpu flags to the dut_basic_facts module.
Removed is_smartswitch() and is_dpu() methods from the SonicHost class.
Replaced all direct method calls with duthost.facts['is_smartswitch'] and duthost.facts['is_dpu'].
Updated tests_mark_conditions_platform_tests.yaml to skip reboot tests on SmartSwitches.
Introduced a new marker file tests_mark_conditions_smartswitch.yaml to manage SmartSwitch-specific test conditions.
Cleaned up redundant code and made logic consistent across reboot and techsupport tests.
How did you verify/test it?
Ran platform tests and verified that SmartSwitch-incompatible cases are skipped automatically.
Validated dut_basic_facts returns correct values for is_smartswitch and is_dpu across multiple platforms.
Confirmed test_reboot.py and test_techsupport.py logic correctly reflects the updated fact-based checks.
Any platform specific information?
Applies to SmartSwitch and DPU platforms only.

Supported testbed topology if it's a new test case?
Not applicable. No new test case introduced.

Signed-off-by: Guy Shemesh <gshemesh@nvidia.com>
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Jan 26, 2026
* Refactor DPU check in device_utils and test_watchdog

This changes is because is_dpu method was removed
by below PR
[smartswitch]: Add is_smartswitch and is_dpu facts to simplify platform-specific test handling (sonic-net#19313)

* Fix the condition for dpu in techsupport test

* Fix skip dpu logic in techsupport test

---------

Co-authored-by: Cong Hou <congh@nvidia.com>
Signed-off-by: Guy Shemesh <gshemesh@nvidia.com>
ytzur1 pushed a commit to ytzur1/sonic-mgmt that referenced this pull request Feb 2, 2026
…rm-specific test handling (sonic-net#19313)

Description of PR
Summary:
This PR adds is_smartswitch and is_dpu device facts to the dut_basic_facts module, enabling easier conditional test logic based on platform type. It removes redundant implementations of the same logic from the SonicHost class and updates existing test logic to consume these new variables through the Ansible facts system. This change also introduces a new tests_mark_conditions_smartswitch.yaml marker configuration file to skip SmartSwitch-incompatible tests declaratively.

Approach
What is the motivation for this PR?
Some tests such as fast_reboot and warm_reboot are not applicable on SmartSwitch platforms or require different handling on DPU nodes. This PR simplifies the detection of such platform roles using shared Ansible facts instead of scattered implementations. This approach makes test conditions easier to read, reuse, and maintain.

How did you do it?
Added is_smartswitch and is_dpu flags to the dut_basic_facts module.
Removed is_smartswitch() and is_dpu() methods from the SonicHost class.
Replaced all direct method calls with duthost.facts['is_smartswitch'] and duthost.facts['is_dpu'].
Updated tests_mark_conditions_platform_tests.yaml to skip reboot tests on SmartSwitches.
Introduced a new marker file tests_mark_conditions_smartswitch.yaml to manage SmartSwitch-specific test conditions.
Cleaned up redundant code and made logic consistent across reboot and techsupport tests.
How did you verify/test it?
Ran platform tests and verified that SmartSwitch-incompatible cases are skipped automatically.
Validated dut_basic_facts returns correct values for is_smartswitch and is_dpu across multiple platforms.
Confirmed test_reboot.py and test_techsupport.py logic correctly reflects the updated fact-based checks.
Any platform specific information?
Applies to SmartSwitch and DPU platforms only.

Supported testbed topology if it's a new test case?
Not applicable. No new test case introduced.

Signed-off-by: Yael Tzur <ytzur@nvidia.com>
ytzur1 pushed a commit to ytzur1/sonic-mgmt that referenced this pull request Feb 2, 2026
* Refactor DPU check in device_utils and test_watchdog

This changes is because is_dpu method was removed
by below PR
[smartswitch]: Add is_smartswitch and is_dpu facts to simplify platform-specific test handling (sonic-net#19313)

* Fix the condition for dpu in techsupport test

* Fix skip dpu logic in techsupport test

---------

Co-authored-by: Cong Hou <congh@nvidia.com>
Signed-off-by: Yael Tzur <ytzur@nvidia.com>
venu-nexthop pushed a commit to venu-nexthop/sonic-mgmt that referenced this pull request Mar 27, 2026
…rm-specific test handling (sonic-net#19313)

Description of PR
Summary:
This PR adds is_smartswitch and is_dpu device facts to the dut_basic_facts module, enabling easier conditional test logic based on platform type. It removes redundant implementations of the same logic from the SonicHost class and updates existing test logic to consume these new variables through the Ansible facts system. This change also introduces a new tests_mark_conditions_smartswitch.yaml marker configuration file to skip SmartSwitch-incompatible tests declaratively.

Approach
What is the motivation for this PR?
Some tests such as fast_reboot and warm_reboot are not applicable on SmartSwitch platforms or require different handling on DPU nodes. This PR simplifies the detection of such platform roles using shared Ansible facts instead of scattered implementations. This approach makes test conditions easier to read, reuse, and maintain.

How did you do it?
Added is_smartswitch and is_dpu flags to the dut_basic_facts module.
Removed is_smartswitch() and is_dpu() methods from the SonicHost class.
Replaced all direct method calls with duthost.facts['is_smartswitch'] and duthost.facts['is_dpu'].
Updated tests_mark_conditions_platform_tests.yaml to skip reboot tests on SmartSwitches.
Introduced a new marker file tests_mark_conditions_smartswitch.yaml to manage SmartSwitch-specific test conditions.
Cleaned up redundant code and made logic consistent across reboot and techsupport tests.
How did you verify/test it?
Ran platform tests and verified that SmartSwitch-incompatible cases are skipped automatically.
Validated dut_basic_facts returns correct values for is_smartswitch and is_dpu across multiple platforms.
Confirmed test_reboot.py and test_techsupport.py logic correctly reflects the updated fact-based checks.
Any platform specific information?
Applies to SmartSwitch and DPU platforms only.

Supported testbed topology if it's a new test case?
Not applicable. No new test case introduced.
venu-nexthop pushed a commit to venu-nexthop/sonic-mgmt that referenced this pull request Mar 27, 2026
* Refactor DPU check in device_utils and test_watchdog

This changes is because is_dpu method was removed
by below PR
[smartswitch]: Add is_smartswitch and is_dpu facts to simplify platform-specific test handling (sonic-net#19313)

* Fix the condition for dpu in techsupport test

* Fix skip dpu logic in techsupport test

---------

Co-authored-by: Cong Hou <congh@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.