New Platform Support
Overview
This document describes all of the locations in the code where you need to add code to onboard a new platform in qsfp_service / agent code. Please follow this GitHub Commit as an example if the code pointers are not sufficient.
Common Code Changes
- Add a new entry to the PlatformType enum in fboss/lib/if/fboss_common.thrift.
- Add a new entry to the
toString(PlatformType mode)function in fboss/lib/platforms/PlatformMode.h. - Add a new entry to
initMode()in fboss/lib/platforms/PlatformProductInfo.cpp. - Add a new switch case for your platform to
initPlatformMapping()in fboss/agent/platforms/common/PlatformMappingUtils.cpp. - Based on your files created in Platform Mapping Config Generation, create a new folder and add all platform mapping CSV files to fboss/lib/platform_mapping_v2/platforms/{PLATFORM}/.
- Similarly, create a new folder and add a source file and header for your platform mapping. This requires copying the generated platform mapping JSON into
kJsonPlatformMappingStrwithin the.cppfile.fboss/agent/platforms/common/{PLATFORM}/{PLATFORM}PlatformMapping.hHeader examplefboss/agent/platforms/common/{PLATFORM}/{PLATFORM}PlatformMapping.cppSource example
Agent Code Changes
Add a
SaiBcm{PLATFORM}PlatformPortheader and source file for your platform:fboss/agent/platforms/sai/SaiBcm{PLATFORM}PlatformPort.hHeader examplefboss/agent/platforms/sai/SaiBcm{PLATFORM}PlatformPort.cppSource example
Add a
SaiBcm{PLATFORM}Platformheader and source file for your platform:fboss/agent/platforms/sai/SaiBcm{PLATFORM}Platform.hHeader examplefboss/agent/platforms/sai/SaiBcm{PLATFORM}Platform.cppSource example
Add a new entry to
initPorts()in fboss/agent/platforms/sai/SaiPlatform.cpp.Add a new entry to
chooseSaiPlatform()in fboss/agent/platforms/sai/SaiPlatformInit.cpp.Make changes to CMake files to support building in open source:
- Add
cmake/AgentPlatformsCommon{PLATFORM}.cmakefor your platform (Example) - Then add this library name to
sai_platformlink libraries in cmake/AgentPlatformsSai.cmake
- Add
Qsfp Service Code Changes
Create BspPlatformMapping header and source files under
fboss/lib/bsp/{PLATFORM}/fboss/lib/bsp/{PLATFORM}/{PLATFORM}BspPlatformMapping.hHeader examplefboss/lib/bsp/{PLATFORM}/{PLATFORM}BspPlatformMapping.cppSource example
Add an LED Manager class for your platform:
fboss/led_service/{PLATFORM}LedManager.hHeader examplefboss/led_service/{PLATFORM}LedManager.cppSource example- Add to fboss/led_service/LedManagerInit.cpp.
In
fboss/qsfp_service/platforms/wedge/WedgeManagerInit.cpp, add a function calledcreate{PLATFORM}WedgeManagerthat instantiates aWedgeManagerobject with the platform mapping JSON file.fboss/qsfp_service/platforms/wedge/WedgeManagerInit.hHeader examplefboss/qsfp_service/platforms/wedge/WedgeManagerInit.cppSource example