# sonic-net/sonic-platform-common architecture

> Architecture diagram of the GitHub repository sonic-net/sonic-platform-common, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sonic-net/sonic-platform-common
- Repository: https://github.com/sonic-net/sonic-platform-common

## Overview

SONiC platform-common is a set of Python interfaces and reusable implementations for platform-specific switch hardware. The principal workflow is that SONiC platform code uses these interfaces to discover or access peripherals, interpret their data, and—in supported subsystems—control or update them. The graph preserves distinct transceiver, EEPROM, thermal, storage, BMC, and Y-cable capabilities. Source excerpts are partial, so links between unsampled subsystems and a common runtime orchestrator are omitted rather than inferred.

Main entry points: [`sonic_platform_base/sonic_thermal_control/thermal_manager_base.py`](https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/sonic_thermal_control/thermal_manager_base.py) (Thermal policy manager), [`sonic_y_cable/microsoft/y_cable_simulated.py`](https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_y_cable/microsoft/y_cable_simulated.py) (Cable simulator), [`sonic_platform_base/platform_base.py`](https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/platform_base.py) (Platform device APIs), [`sonic_platform_base/sonic_sfp/sfputilbase.py`](https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/sonic_sfp/sfputilbase.py) (SFP port access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_platform["Platform interfaces"]
  node_platform_api["Platform device APIs<br/>[platform_base.py]"]
  node_chassis["Chassis components<br/>[chassis_base.py]"]
  node_fan_led_psu["Fan, LED, PSU<br/>[fan_base.py]"]
end

subgraph group_transceiver["Optics and EEPROM"]
  node_sfp_util["SFP port access<br/>[sfputilbase.py]"]
  node_xcvr_api["Transceiver APIs<br/>[cmis.py]"]
  node_xcvr_eeprom["Transceiver EEPROM<br/>[xcvr_eeprom.py]"]
  node_eeprom_tlv["TLV EEPROM data<br/>[eeprom_tlvinfo.py]"]
end

subgraph group_thermal["Thermal control"]
  node_thermal_manager["Thermal policy manager"]
  node_thermal_policy["Thermal policies<br/>[thermal_policy.py]"]
  node_thermal_actions["Thermal actions"]
end

subgraph group_storage["Storage health"]
  node_storage_devices["Storage discovery<br/>[storage_devices.py]"]
  node_storage_common["Storage metrics<br/>[storage_common.py]"]
  node_storage_types["SSD, eMMC, USB<br/>[ssd.py]"]
end

subgraph group_integrations["BMC and Y-cable"]
  node_bmc_api["BMC interfaces<br/>[bmc_base.py]"]
  node_redfish["Redfish client<br/>[redfish_client.py]"]
  node_bmc_update["BMC firmware update<br/>[bmc_fw_update.py]"]
  node_y_cable_api["Y-cable API<br/>[y_cable.py]"]
  node_y_cable_base["Y-cable drivers<br/>[y_cable_base.py]"]
  node_y_cable_sim["Cable simulator"]
end

node_sonic(("SONiC platform code"))
node_hardware(("Switch peripherals"))
node_mux_service(("Mux simulator service"))

node_sonic -->|"uses interfaces"| node_platform_api
node_platform_api -->|"accesses peripherals"| node_hardware
node_sonic -->|"uses port access"| node_sfp_util
node_sfp_util -->|"reads transceivers"| node_hardware
node_xcvr_api -->|"reads fields"| node_xcvr_eeprom
node_sonic -->|"reads or writes EEPROM"| node_eeprom_tlv
node_sonic -->|"loads thermal control"| node_thermal_manager
node_thermal_manager -->|"loads policies"| node_thermal_policy
node_thermal_manager -->|"runs actions"| node_thermal_actions
node_thermal_manager -->|"sets fan speeds"| node_chassis
node_storage_devices -->|"creates device utilities"| node_storage_types
node_storage_common -->|"reads disk counters"| node_hardware
node_sonic -->|"discovers storage"| node_storage_devices
node_sonic -->|"uses BMC interface"| node_bmc_api
node_bmc_api -.->|"uses Redfish client"| node_redfish
node_sonic -->|"requests firmware update"| node_bmc_update
node_sonic -->|"uses cable controls"| node_y_cable_api
node_y_cable_api -->|"reads port EEPROM"| node_hardware
node_y_cable_sim -->|"implements API"| node_y_cable_base
node_y_cable_sim -.->|"sends simulator requests"| node_mux_service

click node_platform_api "https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/platform_base.py"
click node_chassis "https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/chassis_base.py"
click node_fan_led_psu "https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/fan_base.py"
click node_sfp_util "https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/sonic_sfp/sfputilbase.py"
click node_xcvr_api "https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/sonic_xcvr/api/public/cmis.py"
click node_xcvr_eeprom "https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/sonic_xcvr/xcvr_eeprom.py"
click node_eeprom_tlv "https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/sonic_eeprom/eeprom_tlvinfo.py"
click node_thermal_manager "https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/sonic_thermal_control/thermal_manager_base.py"
click node_thermal_policy "https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/sonic_thermal_control/thermal_policy.py"
click node_thermal_actions "https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/sonic_thermal_control/thermal_action_base.py"
click node_storage_devices "https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/sonic_storage/storage_devices.py"
click node_storage_common "https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/sonic_storage/storage_common.py"
click node_storage_types "https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/sonic_storage/ssd.py"
click node_bmc_api "https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/bmc_base.py"
click node_redfish "https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/redfish_client.py"
click node_bmc_update "https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/bmc_fw_update.py"
click node_y_cable_api "https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_y_cable/y_cable.py"
click node_y_cable_base "https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_y_cable/y_cable_base.py"
click node_y_cable_sim "https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_y_cable/microsoft/y_cable_simulated.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_platform_api,node_chassis,node_fan_led_psu toneBlue
class node_sfp_util,node_xcvr_api,node_xcvr_eeprom,node_eeprom_tlv toneAmber
class node_thermal_manager,node_thermal_policy,node_thermal_actions toneMint
class node_storage_devices,node_storage_common,node_storage_types toneRose
class node_bmc_api,node_redfish,node_bmc_update,node_y_cable_api,node_y_cable_base,node_y_cable_sim,node_sonic,node_hardware,node_mux_service toneIndigo
```

## Components

### Platform interfaces

- [Platform device APIs](https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/platform_base.py): `sonic_platform_base/platform_base.py`
- [Chassis components](https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/chassis_base.py): `sonic_platform_base/chassis_base.py`
- [Fan, LED, PSU](https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/fan_base.py): `sonic_platform_base/fan_base.py`

### Optics and EEPROM

- [SFP port access](https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/sonic_sfp/sfputilbase.py): `sonic_platform_base/sonic_sfp/sfputilbase.py`
- [Transceiver APIs](https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/sonic_xcvr/api/public/cmis.py): `sonic_platform_base/sonic_xcvr/api/public/cmis.py`
- [Transceiver EEPROM](https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/sonic_xcvr/xcvr_eeprom.py): `sonic_platform_base/sonic_xcvr/xcvr_eeprom.py`
- [TLV EEPROM data](https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/sonic_eeprom/eeprom_tlvinfo.py): `sonic_platform_base/sonic_eeprom/eeprom_tlvinfo.py`

### Thermal control

- [Thermal policy manager](https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/sonic_thermal_control/thermal_manager_base.py): `sonic_platform_base/sonic_thermal_control/thermal_manager_base.py`
- [Thermal policies](https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/sonic_thermal_control/thermal_policy.py): `sonic_platform_base/sonic_thermal_control/thermal_policy.py`
- [Thermal actions](https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/sonic_thermal_control/thermal_action_base.py): `sonic_platform_base/sonic_thermal_control/thermal_action_base.py`

### Storage health

- [Storage discovery](https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/sonic_storage/storage_devices.py): `sonic_platform_base/sonic_storage/storage_devices.py`
- [Storage metrics](https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/sonic_storage/storage_common.py): `sonic_platform_base/sonic_storage/storage_common.py`
- [SSD, eMMC, USB](https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/sonic_storage/ssd.py): `sonic_platform_base/sonic_storage/ssd.py`

### BMC and Y-cable

- [BMC interfaces](https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/bmc_base.py): `sonic_platform_base/bmc_base.py`
- [Redfish client](https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/redfish_client.py): `sonic_platform_base/redfish_client.py`
- [BMC firmware update](https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_platform_base/bmc_fw_update.py): `sonic_platform_base/bmc_fw_update.py`
- [Y-cable API](https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_y_cable/y_cable.py): `sonic_y_cable/y_cable.py`
- [Y-cable drivers](https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_y_cable/y_cable_base.py): `sonic_y_cable/y_cable_base.py`
- [Cable simulator](https://github.com/sonic-net/sonic-platform-common/blob/master/sonic_y_cable/microsoft/y_cable_simulated.py): `sonic_y_cable/microsoft/y_cable_simulated.py`

### Other components

- **SONiC platform code**
- **Switch peripherals**
- **Mux simulator service**

## Connections

- SONiC platform code → Platform device APIs: uses interfaces
- Platform device APIs → Switch peripherals: accesses peripherals
- SONiC platform code → SFP port access: uses port access
- SFP port access → Switch peripherals: reads transceivers
- Transceiver APIs → Transceiver EEPROM: reads fields
- SONiC platform code → TLV EEPROM data: reads or writes EEPROM
- SONiC platform code → Thermal policy manager: loads thermal control
- Thermal policy manager → Thermal policies: loads policies
- Thermal policy manager → Thermal actions: runs actions
- Thermal policy manager → Chassis components: sets fan speeds
- Storage discovery → SSD, eMMC, USB: creates device utilities
- Storage metrics → Switch peripherals: reads disk counters
- SONiC platform code → Storage discovery: discovers storage
- SONiC platform code → BMC interfaces: uses BMC interface
- BMC interfaces → Redfish client: uses Redfish client
- SONiC platform code → BMC firmware update: requests firmware update
- SONiC platform code → Y-cable API: uses cable controls
- Y-cable API → Switch peripherals: reads port EEPROM
- Cable simulator → Y-cable drivers: implements API
- Cable simulator → Mux simulator service: sends simulator requests
