Skip to content

[action] [PR:604] [Smartswitch] Host container differentiation for sensor commands#111

Merged
prabhataravind merged 1 commit intoAzure:202506from
mssonicbld:cherry/msft-202506/604
Nov 4, 2025
Merged

[action] [PR:604] [Smartswitch] Host container differentiation for sensor commands#111
prabhataravind merged 1 commit intoAzure:202506from
mssonicbld:cherry/msft-202506/604

Conversation

@mssonicbld
Copy link
Collaborator

Description

Differentiate commands being executed in host and container seperately for some smartswitch specific functions,
sensord commands can only be executed inside hte pmon docker container, so these commands need to differentiate between host and container execution

Motivation and Context

This is done because these functions are called from inside the pmon docker during chassis command execution and from the host directly during reboot command execution

How Has This Been Tested?

tests/module_base_test.py::TestModuleBase::test_module_base PASSED       [  2%]
tests/module_base_test.py::TestModuleBase::test_is_container_detection PASSED [  2%]
tests/module_base_test.py::TestModuleBase::test_sensors PASSED           [  2%]
tests/module_base_test.py::TestModuleBase::test_pci_entry_state_db PASSED [  2%]
tests/module_base_test.py::TestModuleBase::test_file_operation_lock PASSED [  2%]
tests/module_base_test.py::TestModuleBase::test_pci_operation_lock PASSED [  2%]
tests/module_base_test.py::TestModuleBase::test_sensord_operation_lock PASSED [  3%]
tests/module_base_test.py::TestModuleBase::test_handle_pci_removal PASSED [  3%]
tests/module_base_test.py::TestModuleBase::test_handle_pci_rescan PASSED [  3%]
tests/module_base_test.py::TestModuleBase::test_handle_sensor_removal PASSED [  3%]
tests/module_base_test.py::TestModuleBase::test_handle_sensor_addition PASSED [  3%]
tests/module_base_test.py::TestModuleBase::test_module_pre_shutdown PASSED [  3%]
tests/module_base_test.py::TestModuleBase::test_module_post_startup PASSED [  3%]

Manual test with:
reboot -d DPU0
and config chassis modules startup DPU0

Additional Information (Optional)

<!-- Provide a general summary of your changes in the Title above -->

#### Description
<!--
     Describe your changes in detail
-->
Differentiate commands being executed in host and container seperately for some smartswitch specific functions,
sensord commands can only be executed inside hte pmon docker container, so these commands need to differentiate between host and container execution

#### Motivation and Context
<!--
     Why is this change required? What problem does it solve?
     If this pull request closes/resolves an open Issue, make sure you
     include the text "fixes #xxxx", "closes #xxxx" or "resolves #xxxx" here
-->
This is done because these functions are called from inside the pmon docker during chassis command execution and from the host directly during reboot command execution

#### How Has This Been Tested?
<!--
     Please describe in detail how you tested your changes.
     Include details of your testing environment, and the tests you ran to
     see how your change affects other areas of the code, etc.
-->
```
tests/module_base_test.py::TestModuleBase::test_module_base PASSED       [  2%]
tests/module_base_test.py::TestModuleBase::test_is_container_detection PASSED [  2%]
tests/module_base_test.py::TestModuleBase::test_sensors PASSED           [  2%]
tests/module_base_test.py::TestModuleBase::test_pci_entry_state_db PASSED [  2%]
tests/module_base_test.py::TestModuleBase::test_file_operation_lock PASSED [  2%]
tests/module_base_test.py::TestModuleBase::test_pci_operation_lock PASSED [  2%]
tests/module_base_test.py::TestModuleBase::test_sensord_operation_lock PASSED [  3%]
tests/module_base_test.py::TestModuleBase::test_handle_pci_removal PASSED [  3%]
tests/module_base_test.py::TestModuleBase::test_handle_pci_rescan PASSED [  3%]
tests/module_base_test.py::TestModuleBase::test_handle_sensor_removal PASSED [  3%]
tests/module_base_test.py::TestModuleBase::test_handle_sensor_addition PASSED [  3%]
tests/module_base_test.py::TestModuleBase::test_module_pre_shutdown PASSED [  3%]
tests/module_base_test.py::TestModuleBase::test_module_post_startup PASSED [  3%]
```
Manual test with:
`reboot -d DPU0`
and `config chassis modules startup DPU0`
#### Additional Information (Optional)
@mssonicbld
Copy link
Collaborator Author

Original PR: sonic-net/sonic-platform-common#604

@mssonicbld
Copy link
Collaborator Author

/azp run

@prabhataravind prabhataravind merged commit 68aedfd into Azure:202506 Nov 4, 2025
3 checks passed
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.

2 participants