From 08e131f8802f44eb850f89ab012611ef888c3041 Mon Sep 17 00:00:00 2001 From: aalamsi22 Date: Tue, 3 Dec 2024 18:38:15 -0800 Subject: [PATCH] DARWIN48V: platform definition & led_manager (#293) Summary: # Description Combines https://github.com/facebook/fboss/issues/257, https://github.com/facebook/fboss/issues/258 and https://github.com/facebook/fboss/issues/263. https://github.com/facebook/fboss/issues/263 fails builds due to a dependencies found in https://github.com/facebook/fboss/issues/257 and https://github.com/facebook/fboss/issues/258. Pull Request resolved: https://github.com/facebook/fboss/pull/293 Reviewed By: somasun, mikechoifb Differential Revision: D65801211 Pulled By: joancaneus fbshipit-source-id: 2724e1073e2369fe802c4d144555ce93e95e6c6f --- .../agent/hw/bcm/tests/BcmSwitchEnsemble.cpp | 3 +- fboss/agent/hw/sai/diag/DiagShell.cpp | 3 + fboss/agent/hw/test/ProdConfigFactory.cpp | 1 + .../platforms/common/PlatformMappingUtils.cpp | 1 + fboss/agent/platforms/sai/SaiPlatform.cpp | 4 +- fboss/agent/platforms/sai/SaiPlatformInit.cpp | 4 +- .../tests/utils/CreateTestPlatform.cpp | 4 +- .../AgentRouteOverflowTests.cpp | 1 + fboss/led_service/LedManagerInit.cpp | 4 +- fboss/lib/if/fboss_common.thrift | 1 + fboss/lib/platforms/PlatformMode.h | 2 + fboss/lib/platforms/PlatformProductInfo.cpp | 2 + .../configs/darwin48v/led_manager.json | 94 +++++++++++++++++++ .../test/hw_test/HwXphyFirmwareTest.cpp | 1 + 14 files changed, 120 insertions(+), 5 deletions(-) create mode 100644 fboss/platform/configs/darwin48v/led_manager.json diff --git a/fboss/agent/hw/bcm/tests/BcmSwitchEnsemble.cpp b/fboss/agent/hw/bcm/tests/BcmSwitchEnsemble.cpp index aff3a6f735ee4..edc262b75b839 100644 --- a/fboss/agent/hw/bcm/tests/BcmSwitchEnsemble.cpp +++ b/fboss/agent/hw/bcm/tests/BcmSwitchEnsemble.cpp @@ -257,7 +257,8 @@ void BcmSwitchEnsemble::init( PlatformType::PLATFORM_MINIPACK, PlatformType::PLATFORM_YAMP, PlatformType::PLATFORM_WEDGE400, - PlatformType::PLATFORM_DARWIN}; + PlatformType::PLATFORM_DARWIN, + PlatformType::PLATFORM_DARWIN48V}; std::unordered_set th4BcmPlatforms = { PlatformType::PLATFORM_FUJI, PlatformType::PLATFORM_ELBERT}; bool th3Platform = false; diff --git a/fboss/agent/hw/sai/diag/DiagShell.cpp b/fboss/agent/hw/sai/diag/DiagShell.cpp index 89146d3852288..2df4427f4bc13 100644 --- a/fboss/agent/hw/sai/diag/DiagShell.cpp +++ b/fboss/agent/hw/sai/diag/DiagShell.cpp @@ -160,6 +160,7 @@ std::unique_ptr DiagShell::makeRepl() const { case PlatformType::PLATFORM_FUJI: case PlatformType::PLATFORM_ELBERT: case PlatformType::PLATFORM_DARWIN: + case PlatformType::PLATFORM_DARWIN48V: case PlatformType::PLATFORM_MERU400BIU: case PlatformType::PLATFORM_MERU800BIA: case PlatformType::PLATFORM_MERU800BIAB: @@ -395,6 +396,7 @@ std::string DiagCmdServer::getDelimiterDiagCmd(const std::string& UUID) const { case PlatformType::PLATFORM_FUJI: case PlatformType::PLATFORM_ELBERT: case PlatformType::PLATFORM_DARWIN: + case PlatformType::PLATFORM_DARWIN48V: case PlatformType::PLATFORM_MERU400BIU: case PlatformType::PLATFORM_MERU800BIA: case PlatformType::PLATFORM_MERU800BIAB: @@ -445,6 +447,7 @@ std::string& DiagCmdServer::cleanUpOutput( case PlatformType::PLATFORM_FUJI: case PlatformType::PLATFORM_ELBERT: case PlatformType::PLATFORM_DARWIN: + case PlatformType::PLATFORM_DARWIN48V: case PlatformType::PLATFORM_MERU400BIU: case PlatformType::PLATFORM_MERU800BIA: case PlatformType::PLATFORM_MERU800BIAB: diff --git a/fboss/agent/hw/test/ProdConfigFactory.cpp b/fboss/agent/hw/test/ProdConfigFactory.cpp index b01605a0c4f3b..5769c95e2aa03 100644 --- a/fboss/agent/hw/test/ProdConfigFactory.cpp +++ b/fboss/agent/hw/test/ProdConfigFactory.cpp @@ -107,6 +107,7 @@ uint16_t uplinksCountFromSwitch(PlatformType mode) { case PM::PLATFORM_GALAXY_LC: case PM::PLATFORM_GALAXY_FC: case PM::PLATFORM_DARWIN: + case PM::PLATFORM_DARWIN48V: case PM::PLATFORM_MONTBLANC: return 4; default: diff --git a/fboss/agent/platforms/common/PlatformMappingUtils.cpp b/fboss/agent/platforms/common/PlatformMappingUtils.cpp index 33cf32576407b..780077cbf0e5f 100644 --- a/fboss/agent/platforms/common/PlatformMappingUtils.cpp +++ b/fboss/agent/platforms/common/PlatformMappingUtils.cpp @@ -120,6 +120,7 @@ std::unique_ptr initPlatformMapping(PlatformType type) { ? std::make_unique() : std::make_unique(platformMappingStr); case PlatformType::PLATFORM_DARWIN: + case PlatformType::PLATFORM_DARWIN48V: return platformMappingStr.empty() ? std::make_unique() : std::make_unique(platformMappingStr); diff --git a/fboss/agent/platforms/sai/SaiPlatform.cpp b/fboss/agent/platforms/sai/SaiPlatform.cpp index bbf929ad51cf1..40316a71b15cb 100644 --- a/fboss/agent/platforms/sai/SaiPlatform.cpp +++ b/fboss/agent/platforms/sai/SaiPlatform.cpp @@ -346,7 +346,9 @@ void SaiPlatform::initPorts() { platformMode == PlatformType::PLATFORM_WEDGE400 || platformMode == PlatformType::PLATFORM_WEDGE400_GRANDTETON) { saiPort = std::make_unique(portId, this); - } else if (platformMode == PlatformType::PLATFORM_DARWIN) { + } else if ( + platformMode == PlatformType::PLATFORM_DARWIN || + platformMode == PlatformType::PLATFORM_DARWIN48V) { saiPort = std::make_unique(portId, this); } else if (platformMode == PlatformType::PLATFORM_MINIPACK) { saiPort = std::make_unique(portId, this); diff --git a/fboss/agent/platforms/sai/SaiPlatformInit.cpp b/fboss/agent/platforms/sai/SaiPlatformInit.cpp index 821cfb4e2379b..e34a2cc921642 100644 --- a/fboss/agent/platforms/sai/SaiPlatformInit.cpp +++ b/fboss/agent/platforms/sai/SaiPlatformInit.cpp @@ -51,7 +51,9 @@ std::unique_ptr chooseSaiPlatform( auto type = productInfo->getType(); return std::make_unique( std::move(productInfo), type, localMac, platformMappingStr); - } else if (productInfo->getType() == PlatformType::PLATFORM_DARWIN) { + } else if ( + productInfo->getType() == PlatformType::PLATFORM_DARWIN || + productInfo->getType() == PlatformType::PLATFORM_DARWIN48V) { return std::make_unique( std::move(productInfo), localMac, platformMappingStr); } else if (productInfo->getType() == PlatformType::PLATFORM_MINIPACK) { diff --git a/fboss/agent/platforms/tests/utils/CreateTestPlatform.cpp b/fboss/agent/platforms/tests/utils/CreateTestPlatform.cpp index d228fdb453b5d..86d624c7849ef 100644 --- a/fboss/agent/platforms/tests/utils/CreateTestPlatform.cpp +++ b/fboss/agent/platforms/tests/utils/CreateTestPlatform.cpp @@ -47,7 +47,9 @@ std::unique_ptr createTestPlatform() { return std::make_unique(std::move(productInfo)); } else if (mode == PlatformType::PLATFORM_WEDGE400) { return std::make_unique(std::move(productInfo)); - } else if (mode == PlatformType::PLATFORM_DARWIN) { + } else if ( + mode == PlatformType::PLATFORM_DARWIN || + mode == PlatformType::PLATFORM_DARWIN48V) { return std::make_unique(std::move(productInfo)); } else if (mode == PlatformType::PLATFORM_FUJI) { return std::make_unique(std::move(productInfo)); diff --git a/fboss/agent/test/agent_hw_tests/AgentRouteOverflowTests.cpp b/fboss/agent/test/agent_hw_tests/AgentRouteOverflowTests.cpp index 54dfc9c2c54ce..1c30da35a7646 100644 --- a/fboss/agent/test/agent_hw_tests/AgentRouteOverflowTests.cpp +++ b/fboss/agent/test/agent_hw_tests/AgentRouteOverflowTests.cpp @@ -50,6 +50,7 @@ TEST_F(AgentRouteOverflowTest, overflowRoutes) { case PlatformType::PLATFORM_MINIPACK: case PlatformType::PLATFORM_YAMP: case PlatformType::PLATFORM_DARWIN: + case PlatformType::PLATFORM_DARWIN48V: /* * A route distribution 200,000 /128 does overflow the ASIC tables * but it takes 15min to generate, program and clean up such a diff --git a/fboss/led_service/LedManagerInit.cpp b/fboss/led_service/LedManagerInit.cpp index aa0abde7b7baa..13343e8acb445 100644 --- a/fboss/led_service/LedManagerInit.cpp +++ b/fboss/led_service/LedManagerInit.cpp @@ -36,7 +36,9 @@ std::unique_ptr createLedManager() { return std::make_unique(); } else if (mode == PlatformType::PLATFORM_ELBERT) { return std::make_unique(); - } else if (mode == PlatformType::PLATFORM_DARWIN) { + } else if ( + mode == PlatformType::PLATFORM_DARWIN || + mode == PlatformType::PLATFORM_DARWIN48V) { return std::make_unique(); } else if (mode == PlatformType::PLATFORM_WEDGE400) { return std::make_unique(); diff --git a/fboss/lib/if/fboss_common.thrift b/fboss/lib/if/fboss_common.thrift index b26fb48dd46dd..88d57f7b0971d 100644 --- a/fboss/lib/if/fboss_common.thrift +++ b/fboss/lib/if/fboss_common.thrift @@ -42,4 +42,5 @@ enum PlatformType { PLATFORM_MERU800BFA_P1 = 34, PLATFORM_MERU800BIAB = 35, PLATFORM_YANGRA = 36, + PLATFORM_DARWIN48V = 37, } diff --git a/fboss/lib/platforms/PlatformMode.h b/fboss/lib/platforms/PlatformMode.h index 04923d10f44ab..86e55e47ccdf0 100644 --- a/fboss/lib/platforms/PlatformMode.h +++ b/fboss/lib/platforms/PlatformMode.h @@ -52,6 +52,8 @@ inline std::string toString(PlatformType mode) { return "CLOUDRIPPER"; case PlatformType::PLATFORM_DARWIN: return "DARWIN"; + case PlatformType::PLATFORM_DARWIN48V: + return "DARWIN48V"; case PlatformType::PLATFORM_LASSEN_DEPRECATED: return "LASSEN"; case PlatformType::PLATFORM_SANDIA: diff --git a/fboss/lib/platforms/PlatformProductInfo.cpp b/fboss/lib/platforms/PlatformProductInfo.cpp index 5a6c45a5b5bbe..d12679d51f711 100644 --- a/fboss/lib/platforms/PlatformProductInfo.cpp +++ b/fboss/lib/platforms/PlatformProductInfo.cpp @@ -79,6 +79,8 @@ void PlatformProductInfo::initMode() { } else if ( modelName.find("Wedge400") == 0 || modelName.find("WEDGE400") == 0) { type_ = PlatformType::PLATFORM_WEDGE400; + } else if (modelName.find("DARWIN48V") == 0) { + type_ = PlatformType::PLATFORM_DARWIN48V; } else if ( modelName.find("Darwin") == 0 || modelName.find("DARWIN") == 0 || modelName.find("DCS-7060") == 0 || modelName.find("Rackhawk") == 0) { diff --git a/fboss/platform/configs/darwin48v/led_manager.json b/fboss/platform/configs/darwin48v/led_manager.json new file mode 100644 index 0000000000000..354dac31fae0f --- /dev/null +++ b/fboss/platform/configs/darwin48v/led_manager.json @@ -0,0 +1,94 @@ +{ + "systemLedConfig": { + "presentLedColor": 1, + "presentLedSysfsPath": "/sys/class/leds/sys_led:green:status/brightness", + "absentLedColor": 2, + "absentLedSysfsPath": "/sys/class/leds/sys_led:red:status/brightness" + }, + "fruTypeLedConfigs": { + "FAN": { + "presentLedColor": 1, + "presentLedSysfsPath": "/sys/class/leds/fan_led:green:status/brightness", + "absentLedColor": 2, + "absentLedSysfsPath": "/sys/class/leds/fan_led:red:status/brightness" + }, + "PSU": { + "presentLedColor": 1, + "presentLedSysfsPath": "/sys/class/leds/psu_led:green:status/brightness", + "absentLedColor": 2, + "absentLedSysfsPath": "/sys/class/leds/psu_led:red:status/brightness" + } + }, + "fruConfigs": [ + { + "fruName": "FAN1", + "fruType": "FAN", + "presenceDetection": { + "sysfsFileHandle": { + "presenceFilePath": "/run/devmap/sensors/FAN_CPLD/fan1_present", + "desiredValue": 1 + } + } + }, + { + "fruName": "FAN2", + "fruType": "FAN", + "presenceDetection": { + "sysfsFileHandle": { + "presenceFilePath": "/run/devmap/sensors/FAN_CPLD/fan2_present", + "desiredValue": 1 + } + } + }, + { + "fruName": "FAN3", + "fruType": "FAN", + "presenceDetection": { + "sysfsFileHandle": { + "presenceFilePath": "/run/devmap/sensors/FAN_CPLD/fan3_present", + "desiredValue": 1 + } + } + }, + { + "fruName": "FAN4", + "fruType": "FAN", + "presenceDetection": { + "sysfsFileHandle": { + "presenceFilePath": "/run/devmap/sensors/FAN_CPLD/fan4_present", + "desiredValue": 1 + } + } + }, + { + "fruName": "FAN5", + "fruType": "FAN", + "presenceDetection": { + "sysfsFileHandle": { + "presenceFilePath": "/run/devmap/sensors/FAN_CPLD/fan5_present", + "desiredValue": 1 + } + } + }, + { + "fruName": "FAN6", + "fruType": "FAN", + "presenceDetection": { + "sysfsFileHandle": { + "presenceFilePath": "/run/devmap/fpgas/SCD_FPGA/rackmon_present", + "desiredValue": 1 + } + } + }, + { + "fruName": "PSU1", + "fruType": "PSU", + "presenceDetection": { + "sysfsFileHandle": { + "presenceFilePath": "/run/devmap/fpgas/SCD_FPGA/pem_present", + "desiredValue": 1 + } + } + } + ] + } diff --git a/fboss/qsfp_service/test/hw_test/HwXphyFirmwareTest.cpp b/fboss/qsfp_service/test/hw_test/HwXphyFirmwareTest.cpp index 5e2ca69dec9af..122bcc3fb602a 100644 --- a/fboss/qsfp_service/test/hw_test/HwXphyFirmwareTest.cpp +++ b/fboss/qsfp_service/test/hw_test/HwXphyFirmwareTest.cpp @@ -45,6 +45,7 @@ TEST_F(HwXphyFirmwareTest, CheckDefaultXphyFirmwareVersion) { case PlatformType::PLATFORM_WEDGE400: case PlatformType::PLATFORM_WEDGE400_GRANDTETON: case PlatformType::PLATFORM_DARWIN: + case PlatformType::PLATFORM_DARWIN48V: case PlatformType::PLATFORM_LASSEN_DEPRECATED: case PlatformType::PLATFORM_MERU400BIU: case PlatformType::PLATFORM_MERU800BIA: