Skip to content

[action] [PR:685] [BMC] Align get_presence for the new infra#114

Merged
mssonicbld merged 1 commit into
Azure:202608from
mssonicbld:cherry/msft-202608/685
Jul 1, 2026
Merged

[action] [PR:685] [BMC] Align get_presence for the new infra#114
mssonicbld merged 1 commit into
Azure:202608from
mssonicbld:cherry/msft-202608/685

Conversation

@mssonicbld

Copy link
Copy Markdown
Collaborator

Description

  • Updated sonic_platform_base/bmc_base.py to check:
    • device_info.is_switch_host()
    • device_info.get_bmc_data()
  • Removed the older bmc_addr-only presence condition.
  • Updated tests/bmc_base_test.py to match the new behavior:
    • present on Switch-Host with bmc data
    • not present when bmc data is missing
    • not present on non-host even if bmc data exists

Motivation and Context

BMCBase.get_presence() was aligned with the new host/BMC split (sonic-net/sonic-buildimage#26544)
so BMC presence is reported only for Switch-Host platforms with runtime BMC data.
This avoids treating Switch-BMC side execution as BMC-present for host-only logic.

How Has This Been Tested?

  • Run unit tests:
    • pytest tests/bmc_base_test.py
  • Validate platform API behavior manually:
    • bmc.get_presence() returns True only on Switch-Host with valid /etc/sonic/bmc.json
    • returns False on Switch-BMC side or when BMC data is unavailable

Signed-off-by: Sonic Build Admin sonicbld@microsoft.com

Additional Information (Optional)

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

#### Description
<!--
     Describe your changes in detail
-->
- Updated `sonic_platform_base/bmc_base.py` to check:
  - `device_info.is_switch_host()`
  - `device_info.get_bmc_data()`
- Removed the older `bmc_addr`-only presence condition.
- Updated `tests/bmc_base_test.py` to match the new behavior:
  - present on Switch-Host with bmc data
  - not present when bmc data is missing
  - not present on non-host even if bmc data exists

#### 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
-->
`BMCBase.get_presence()` was aligned with the new host/BMC split (sonic-net/sonic-buildimage#26544)
so BMC presence is reported only for Switch-Host platforms with runtime BMC data.
This avoids treating Switch-BMC side execution as BMC-present for host-only logic.

#### 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.
-->
- Run unit tests:
  - `pytest tests/bmc_base_test.py`
- Validate platform API behavior manually:
  - `bmc.get_presence()` returns `True` only on Switch-Host with valid `/etc/sonic/bmc.json`
  - returns `False` on Switch-BMC side or when BMC data is unavailable

Signed-off-by: Sonic Build Admin <sonicbld@microsoft.com>

#### Additional Information (Optional)
@mssonicbld

Copy link
Copy Markdown
Collaborator Author

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

@mssonicbld

Copy link
Copy Markdown
Collaborator Author

/azp run

@mssonicbld mssonicbld merged commit 334244f into Azure:202608 Jul 1, 2026
2 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.

1 participant