diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml new file mode 100644 index 0000000000000..6502ac7f34d22 --- /dev/null +++ b/.github/workflows/clang-format.yml @@ -0,0 +1,43 @@ +name: ClangFormat Lint + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + clang-format-check: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Install clang-format + run: sudo apt-get install -y clang-format + + - name: Get changed files + id: changed-files + run: | + if [ ${{ github.event_name }} == 'pull_request' ]; then + # For pull requests, compare against the base branch + echo "FILES=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -E '\.(cpp|h)$' | xargs)" >> $GITHUB_OUTPUT + else + # For pushes, compare against the parent commit + echo "FILES=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.before }} ${{ github.sha }} | grep -E '\.(cpp|h)$' | xargs)" >> $GITHUB_OUTPUT + fi + + - name: Run clang-format + run: | + for file in ${{ steps.changed-files.outputs.FILES }}; do + clang-format -style=file -i "$file" + done + git diff --exit-code + + - name: Suggest changes if formatting is incorrect + if: failure() + run: | + echo "::error::Formatting issues found. Please run clang-format on your changes and commit the results." + git diff diff --git a/buck2 b/buck2 index 6232f04c10ea6..3c1af57c6d087 100755 --- a/buck2 +++ b/buck2 @@ -4,62 +4,62 @@ "name": "buck2", "platforms": { "macos-aarch64": { - "size": 23837292, + "size": 23905563, "hash": "blake3", - "digest": "45d97541497dab8c939f1650ea7282f88ce031dcb98a4412809600b36bf9d2ac", + "digest": "2716aabc7e2b68a0eba8d68908f604321dbe19673b9ed2c6f659cda2d263fa3a", "format": "zst", "path": "buck2-aarch64-apple-darwin", "providers": [ { - "url": "https://github.com/facebook/buck2/releases/download/2024-09-02/buck2-aarch64-apple-darwin.zst" + "url": "https://github.com/facebook/buck2/releases/download/2024-09-16/buck2-aarch64-apple-darwin.zst" } ] }, "linux-aarch64": { - "size": 26010757, + "size": 26041556, "hash": "blake3", - "digest": "05901b2db0e2fcaf4e5ff3b1cd2a7ce57aeeaf18e5c8b8c13f4743246cc51cfd", + "digest": "296ca8153596f29c73243a792bb235ed84bfd77a2d26c2f62eeecb1d272e3a90", "format": "zst", "path": "buck2-aarch64-unknown-linux-musl", "providers": [ { - "url": "https://github.com/facebook/buck2/releases/download/2024-09-02/buck2-aarch64-unknown-linux-musl.zst" + "url": "https://github.com/facebook/buck2/releases/download/2024-09-16/buck2-aarch64-unknown-linux-musl.zst" } ] }, "macos-x86_64": { - "size": 25454662, + "size": 25480555, "hash": "blake3", - "digest": "1a734c77fa6ee124b9e872e44d48917eb0e8388373930b3c8f5a53059c04c157", + "digest": "cf529f35b88a4a05e3a727aac7fad0e1549fac154d0b7effdaa481f942b6087e", "format": "zst", "path": "buck2-x86_64-apple-darwin", "providers": [ { - "url": "https://github.com/facebook/buck2/releases/download/2024-09-02/buck2-x86_64-apple-darwin.zst" + "url": "https://github.com/facebook/buck2/releases/download/2024-09-16/buck2-x86_64-apple-darwin.zst" } ] }, "windows-x86_64": { - "size": 20924720, + "size": 20968937, "hash": "blake3", - "digest": "903c00ce0095f5c423f141b9d1570f91edf2e6f045d41415409b5e4d5f973f05", + "digest": "7eab847191add144fdf9b979437a1d16bcf23659e7e70acbbf43ba02a901fa2e", "format": "zst", "path": "buck2-x86_64-pc-windows-msvc.exe", "providers": [ { - "url": "https://github.com/facebook/buck2/releases/download/2024-09-02/buck2-x86_64-pc-windows-msvc.exe.zst" + "url": "https://github.com/facebook/buck2/releases/download/2024-09-16/buck2-x86_64-pc-windows-msvc.exe.zst" } ] }, "linux-x86_64": { - "size": 26842328, + "size": 26879584, "hash": "blake3", - "digest": "b11fbc26e598874b0bdfde263c1c34d18ac547cd1a4fcb1f9693807cf9ba86e3", + "digest": "c50374aa898839e93a89a881bd92687cd431bb8961c24a18c0b40c30705327b2", "format": "zst", "path": "buck2-x86_64-unknown-linux-musl", "providers": [ { - "url": "https://github.com/facebook/buck2/releases/download/2024-09-02/buck2-x86_64-unknown-linux-musl.zst" + "url": "https://github.com/facebook/buck2/releases/download/2024-09-16/buck2-x86_64-unknown-linux-musl.zst" } ] } diff --git a/build/deps/github_hashes/facebook/fb303-rev.txt b/build/deps/github_hashes/facebook/fb303-rev.txt index 7958f9a1e78a9..3fcba606f7743 100644 --- a/build/deps/github_hashes/facebook/fb303-rev.txt +++ b/build/deps/github_hashes/facebook/fb303-rev.txt @@ -1 +1 @@ -Subproject commit 9445fd5d2ee32cdf39d3d94c2116af52a9c8c586 +Subproject commit dd6f8d09407455260cf0713db2e116cfa19acab4 diff --git a/build/deps/github_hashes/facebook/fbthrift-rev.txt b/build/deps/github_hashes/facebook/fbthrift-rev.txt index ba45224d11e8b..cb4d6e6b6cb68 100644 --- a/build/deps/github_hashes/facebook/fbthrift-rev.txt +++ b/build/deps/github_hashes/facebook/fbthrift-rev.txt @@ -1 +1 @@ -Subproject commit 498349f983f3d4ba8b514129e61afc6c8f479746 +Subproject commit e3d27fc1f7ddbfdd6fa9a9722b20fe75f53209bc diff --git a/build/deps/github_hashes/facebook/folly-rev.txt b/build/deps/github_hashes/facebook/folly-rev.txt index 736971dc9edf0..f6f0c37ed8080 100644 --- a/build/deps/github_hashes/facebook/folly-rev.txt +++ b/build/deps/github_hashes/facebook/folly-rev.txt @@ -1 +1 @@ -Subproject commit 8a5e31a1ce42d05133b9b2951f2bb0345cea93cc +Subproject commit f7189afafc220bf1fea3aa118158cf0b7ad6b9ed diff --git a/build/deps/github_hashes/facebook/wangle-rev.txt b/build/deps/github_hashes/facebook/wangle-rev.txt index b347b5b485b3b..97aab93396d9a 100644 --- a/build/deps/github_hashes/facebook/wangle-rev.txt +++ b/build/deps/github_hashes/facebook/wangle-rev.txt @@ -1 +1 @@ -Subproject commit 6ae7e1997b758a4877b70b447655c5c260155912 +Subproject commit 3e96366fb9a4366b0b191718d9cc1af992442b72 diff --git a/build/deps/github_hashes/facebookincubator/fizz-rev.txt b/build/deps/github_hashes/facebookincubator/fizz-rev.txt index cfa341a25671f..7650d38965e06 100644 --- a/build/deps/github_hashes/facebookincubator/fizz-rev.txt +++ b/build/deps/github_hashes/facebookincubator/fizz-rev.txt @@ -1 +1 @@ -Subproject commit e7642d8a878941d38ba9db1b04527db0d24294fe +Subproject commit 15356f47e089a115d859a000bd5f7c33581c6505 diff --git a/build/fbcode_builder/manifests/libcurl b/build/fbcode_builder/manifests/libcurl index 8c94e4679d98d..cc2ac39927334 100644 --- a/build/fbcode_builder/manifests/libcurl +++ b/build/fbcode_builder/manifests/libcurl @@ -3,7 +3,7 @@ name = libcurl [rpms] libcurl-devel -libcurl +libcurl-minimal [debs] libcurl4-openssl-dev diff --git a/cmake/PlatformFanService.cmake b/cmake/PlatformFanService.cmake index 859b3125f6972..9b7db3618b773 100644 --- a/cmake/PlatformFanService.cmake +++ b/cmake/PlatformFanService.cmake @@ -38,8 +38,10 @@ target_link_libraries(fan_service_lib product_info common_file_utils platform_config_lib + platform_name_lib platform_utils fan_service_config_types_cpp2 + gpiod_line sensor_service_cpp2 fan_service_cpp2 Folly::folly @@ -71,6 +73,8 @@ add_executable(fan_service_sw_test target_link_libraries(fan_service_sw_test fan_service_lib Folly::folly + ${LIBGPIOD} + gpiod_line ${GTEST} ${LIBGMOCK_LIBRARIES} ) diff --git a/cmake/PlatformFwUtil.cmake b/cmake/PlatformFwUtil.cmake index 185ad397e8f27..39911f3a39889 100644 --- a/cmake/PlatformFwUtil.cmake +++ b/cmake/PlatformFwUtil.cmake @@ -20,6 +20,7 @@ add_executable(fw_util target_link_libraries(fw_util Folly::folly platform_config_lib + platform_name_lib platform_utils FBThrift::thriftcpp2 fw_util_config-cpp2-types diff --git a/cmake/PlatformSensorService.cmake b/cmake/PlatformSensorService.cmake index 79cbe51eeeb8d..36f768cacc987 100644 --- a/cmake/PlatformSensorService.cmake +++ b/cmake/PlatformSensorService.cmake @@ -50,6 +50,7 @@ add_library(sensor_service_lib target_link_libraries(sensor_service_lib log_thrift_call platform_config_lib + platform_name_lib platform_utils sensor_service_utils sensor_service_cpp2 diff --git a/cmake/PlatformWeutil.cmake b/cmake/PlatformWeutil.cmake index ddfdbd757e8fe..d41a1dc6ec21a 100644 --- a/cmake/PlatformWeutil.cmake +++ b/cmake/PlatformWeutil.cmake @@ -49,6 +49,7 @@ target_link_libraries(weutil_lib weutil_config_cpp2 weutil_fboss_eeprom_parser platform_config_lib + platform_name_lib ioctl_smbus_eeprom_reader ) diff --git a/fboss/.clang-format b/fboss/.clang-format new file mode 100644 index 0000000000000..d23d76b750372 --- /dev/null +++ b/fboss/.clang-format @@ -0,0 +1,114 @@ +# The primary clang-format config file. +# TODO(afuller): Set these settings when they aren't broken: +# - AllowShortBlocksOnASingleLine: Empty +--- +AccessModifierOffset: -1 +AlignAfterOpenBracket: AlwaysBreak +AlignConsecutiveMacros: false +AlignConsecutiveAssignments: false +AlignConsecutiveBitFields: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: Left +AlignOperands: DontAlign +AlignTrailingComments: false +AllowAllArgumentsOnNextLine: true +AllowAllConstructorInitializersOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortEnumsOnASingleLine: true +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: Empty +AllowShortLambdasOnASingleLine: All +AllowShortIfStatementsOnASingleLine: Never +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: true +AlwaysBreakTemplateDeclarations: Yes +BinPackArguments: false +BinPackParameters: false +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Attach +BreakInheritanceList: BeforeColon +BreakBeforeTernaryOperators: true +BreakConstructorInitializers: BeforeColon +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: false +ColumnLimit: 80 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DeriveLineEnding: true +DerivePointerAlignment: false +DisableFormat: false +FixNamespaceComments: true +ForEachMacros: + - FOR_EACH + - FOR_EACH_R + - FOR_EACH_RANGE +IncludeBlocks: Preserve +IncludeCategories: + - Regex: '^<.*\.h(pp)?>' + Priority: 1 + - Regex: '^<.*' + Priority: 2 + - Regex: '.*' + Priority: 3 +IndentCaseLabels: true +IndentCaseBlocks: false +IndentGotoLabels: true +IndentPPDirectives: None +IndentExternBlock: AfterExternBlock +IndentWidth: 2 +IndentWrappedFunctionNames: false +InsertTrailingCommas: None +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: false +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBinPackProtocolList: Auto +ObjCBlockIndentWidth: 2 +ObjCBreakBeforeNestedBlockParam: true +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: false +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 1 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 200 +PointerAlignment: Left +ReflowComments: true +SortIncludes: true +SortUsingDeclarations: true +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyBlock: false +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInConditionalStatement: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +SpaceBeforeSquareBrackets: false +Standard: Latest +TabWidth: 8 +UseCRLF: false +UseTab: Never +... diff --git a/fboss/cli/fboss2/BUCK b/fboss/cli/fboss2/BUCK index fa5e2544bf1dd..97c5c54b51bfe 100644 --- a/fboss/cli/fboss2/BUCK +++ b/fboss/cli/fboss2/BUCK @@ -271,6 +271,7 @@ cpp_library( "commands/show/facebook/bgp/ribpolicy/CmdShowBgpRibPolicyUtils.cpp", "commands/show/facebook/config/CmdShowConfigUtils.cpp", "commands/show/facebook/environment/env_keys.cpp", + "commands/show/facebook/environment/sensor/CmdShowEnvironmentSensor.cpp", "commands/show/facebook/fsdb/CmdShowFsdbUtils.cpp", "commands/show/route/utils.cpp", "facebook/CmdHandlerImpl.cpp", @@ -460,227 +461,227 @@ cpp_library( "utils/clients/BmcClient.h", ], exported_deps = [ - "fbcode//common/base:build_info", - "fbcode//common/config:configerator", - "fbcode//common/http_client:http_client", - "fbcode//common/network:util", - "fbcode//common/smc/cpp:util", - "fbcode//common/smc/if:Smc2-cpp2-clients", - "fbcode//common/smc/if:Smc2-cpp2-services", - "fbcode//common/strings:string_util", - "fbcode//common/thrift/thrift:monitor-cpp2-clients", - "fbcode//common/time:time_core", - "fbcode//configerator/structs/neteng/ai/te_agent:te_agent_config-cpp2-types", - "fbcode//configerator/structs/neteng/bgp_policy/thrift:rib_policy-cpp2-types", - "fbcode//configerator/structs/neteng/fboss/bgp:bgp_config-cpp2-types", - "fbcode//configerator/structs/neteng/fboss/bgp/if:bgp_attr-cpp2-types", - "fbcode//configerator/structs/neteng/fboss/push/forwarding_stack:fbpkg_map-cpp2-types", - "fbcode//configerator/structs/neteng/netwhoami:netwhoami-cpp2-types", - "fbcode//employee/if:thrift-cpp2-services", - "fbcode//employee/if:thrift-cpp2-types", - "fbcode//fastcli:utils-cpp", - "fbcode//fboss/agent:address_utils", - "fbcode//fboss/agent/hw:hardware_stats-cpp2-types", - "fbcode//fboss/agent/if:common-cpp2-types", - "fbcode//fboss/agent/if:ctrl-cpp2-clients", - "fbcode//fboss/agent/if:ctrl-cpp2-services", - "fbcode//fboss/agent/if:ctrl-cpp2-types", - "fbcode//fboss/agent/if:fboss-cpp2-types", - "fbcode//fboss/agent/if:fboss-cpp2-visitation", - "fbcode//fboss/agent/if:hw_ctrl-cpp2-services", - "fbcode//fboss/agent/if:hw_ctrl-cpp2-types", - "fbcode//fboss/cli/fboss2:cli-cpp2-types", - "fbcode//fboss/cli/fboss2:cmd-common-utils", - "fbcode//fboss/cli/fboss2:cmd-global-options", - "fbcode//fboss/cli/fboss2:cmd-handler", - "fbcode//fboss/cli/fboss2:cmd-local-options", - "fbcode//fboss/cli/fboss2:cmd-subcommands", - "fbcode//fboss/cli/fboss2:commands-show-bgp", - "fbcode//fboss/cli/fboss2:table-utils", - "fbcode//fboss/cli/fboss2/commands/facebook/rage:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/facebook/rage:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/acl:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/acl:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/agent:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/agent:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/aggregateport:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/aggregateport:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/arp:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/arp:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/cpuport:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/dsf/subscription:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/dsf/subscription:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/dsfnodes:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/dsfnodes:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/fabric:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/fabric:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/fabric/reachability:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/fabric/reachability:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/fabric/topology:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/fabric/topology:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/facebook:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/facebook:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/facebook/bgp/summary:bgp_summary-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/facebook/bgp/summary:bgp_summary-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/facebook/bgp/techsupport:bgp_techsupport-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/facebook/bmc:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/facebook/bmc:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/facebook/debugdump:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/facebook/environment:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/facebook/environment:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/facebook/environment/fan:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/facebook/environment/fan:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/facebook/environment/power:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/facebook/environment/power:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/facebook/environment/sensor:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/facebook/environment/temperature:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/facebook/environment/temperature:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/facebook/example:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/facebook/example:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/facebook/openr:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/facebook/state:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/facebook/state:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/facebook/teagent/flowroutes:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/facebook/techsupport:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/facebook/vip/fib:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/facebook/vip/fib:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/facebook/vip/injectors:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/facebook/vip/injectors:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/facebook/vip/overview:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/facebook/vip/overview:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/facebook/vip/prefixes:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/facebook/vip/prefixes:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/flowlet:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/hardware:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/hardware:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/host:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/hwagent:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/interface:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/interface:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/interface/capabilities:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/interface/capabilities:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/interface/counters:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/interface/counters:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/interface/counters/fec/ber:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/interface/counters/fec/ber:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/interface/counters/fec/histogram:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/interface/counters/fec/histogram:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/interface/counters/fec/tail:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/interface/counters/fec/tail:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/interface/counters/fec/uncorrectable:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/interface/counters/fec/uncorrectable:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/interface/counters/mka:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/interface/counters/mka:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/interface/errors:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/interface/errors:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/interface/flaps:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/interface/flaps:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/interface/phy:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/interface/phy:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/interface/phymap:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/interface/phymap:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/interface/prbs/capabilities:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/interface/prbs/capabilities:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/interface/prbs/state:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/interface/prbs/state:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/interface/prbs/stats:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/interface/prbs/stats:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/interface/status:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/interface/status:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/interface/traffic:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/interface/traffic:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/lldp:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/lldp:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/mac:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/mac:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/mirror:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/mpls:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/ndp:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/ndp:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/port:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/port:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/product:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/rif:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/rif:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/route:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/route:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/systemport:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/systemport:model-cpp2-visitation", - "fbcode//fboss/cli/fboss2/commands/show/teflow:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/transceiver:model-cpp2-types", - "fbcode//fboss/cli/fboss2/commands/show/transceiver:model-cpp2-visitation", - "fbcode//fboss/fsdb/if:fsdb-cpp2-services", - "fbcode//fboss/fsdb/if:fsdb_common-cpp2-types", - "fbcode//fboss/fsdb/if:fsdb_model", - "fbcode//fboss/fsdb/if:fsdb_oper-cpp2-types", - "fbcode//fboss/fsdb/if:fsdb_oper-cpp2-visitation", - "fbcode//fboss/led_service/if:led_service-cpp2-services", - "fbcode//fboss/lib/phy:phy-cpp2-types", - "fbcode//fboss/lib/phy:phy-cpp2-visitation", - "fbcode//fboss/lib/phy:prbs-cpp2-types", - "fbcode//fboss/lib/phy:prbs-cpp2-visitation", - "fbcode//fboss/mka_service/if:mka_structs-cpp2-types", - "fbcode//fboss/mka_service/if/facebook:mka_service_thrift-cpp2-services", - "fbcode//fboss/platform/data_corral_service/if:data_corral_service-cpp2-services", - "fbcode//fboss/platform/fan_service/if:fan_service-cpp2-services", - "fbcode//fboss/platform/rackmon/if:rackmonsvc-cpp2-services", - "fbcode//fboss/platform/sensor_service/if:sensor_service-cpp2-services", - "fbcode//fboss/qsfp_service/if:qsfp-cpp2-services", - "fbcode//fboss/qsfp_service/if:transceiver-cpp2-types", - "fbcode//folly:conv", - "fbcode//folly:exception", - "fbcode//folly:format", - "fbcode//folly:network_address", - "fbcode//folly:range", - "fbcode//folly:stop_watch", - "fbcode//folly:string", - "fbcode//folly/container:access", - "fbcode//folly/executors:io_thread_pool_executor", - "fbcode//folly/experimental/coro:async_pipe", - "fbcode//folly/experimental/coro:blocking_wait", - "fbcode//folly/experimental/coro:task", - "fbcode//folly/gen:base", - "fbcode//folly/json:dynamic", - "fbcode//folly/logging:logging", - "fbcode//folly/testing:test_util", - "fbcode//neteng/ai/te_agent/if:TeAgent-cpp2-services", - "fbcode//neteng/fboss/bgp/if:bgp_stream-cpp2-services", - "fbcode//neteng/fboss/bgp/if:bgp_stream-cpp2-types", - "fbcode//neteng/fboss/bgp/if:bgp_thrift-cpp2-services", - "fbcode//neteng/fboss/bgp/if:bgp_thrift-cpp2-types", - "fbcode//neteng/fboss/coop/if:coop_thrift-cpp2-services", - "fbcode//neteng/fboss/coop/if:coop_thrift-cpp2-types", - "fbcode//neteng/fboss/drain/local_drainer/server:thrift-cpp2-clients", - "fbcode//neteng/netwhoami/lib/cpp:client", - "fbcode//neteng/netwhoami/lib/cpp:recover", - "fbcode//neteng/routing/policy/if:policy_thrift-cpp2-types", - "fbcode//nettools/bgplib:bgp_parser", - "fbcode//nettools/bgplib:bgplib", - "fbcode//nettools/bgplib/if:bgp-structs-cpp2-types", - "fbcode//nettools/skynet/if:query-cpp2-types", - "fbcode//nettools/skynet/if:skynet_structs-cpp2-types", - "fbcode//nettools/skynet/lib/cpp:skynet_thrift_client", - "fbcode//nettools/vipinjector/vip_service/if:vip_service-cpp2-services", - "fbcode//nettools/vipinjector/vip_service/if:vip_service-cpp2-types", - "fbcode//openr/common:network_util", - "fbcode//openr/if:if-cpp-cpp2-clients", - "fbcode//openr/if:if-cpp-cpp2-services", - "fbcode//openr/if:if-cpp2-types", - "fbcode//openr/if:kvstore-cpp2-types", - "fbcode//openr/if:network-cpp2-types", - "fbcode//openr/if:openr_config-cpp2-types", - "fbcode//openr/if:types-cpp2-types", - "fbcode//scribe/client:scribe_client_no_sr", - "fbcode//servicerouter/client/cpp2:cpp2", - "fbcode//task/if:if-cpp2-services", - "fbcode//thrift/lib/cpp/transport:transport-core", - "fbcode//thrift/lib/cpp/util:enum_utils", - "fbcode//thrift/lib/cpp2/async:client_buferred_stream", - "fbcode//thrift/lib/cpp2/async:header_client_channel", - "fbcode//thrift/lib/cpp2/folly_dynamic:folly_dynamic", - "fbcode//thrift/lib/cpp2/gen:module_types_h", - "fbcode//thrift/lib/cpp2/protocol:protocol", "fbsource//third-party/fmt:fmt", + ":cli-cpp2-types", + ":cmd-common-utils", + ":cmd-global-options", + ":cmd-handler", + ":cmd-local-options", + ":cmd-subcommands", + ":commands-show-bgp", + ":table-utils", + "//common/base:build_info", + "//common/config:configerator", + "//common/http_client:http_client", + "//common/network:util", + "//common/smc/cpp:util", + "//common/smc/if:Smc2-cpp2-clients", + "//common/smc/if:Smc2-cpp2-services", + "//common/strings:string_util", + "//common/thrift/thrift:monitor-cpp2-clients", + "//common/time:time_core", + "//configerator/structs/neteng/ai/te_agent:te_agent_config-cpp2-types", + "//configerator/structs/neteng/bgp_policy/thrift:rib_policy-cpp2-types", + "//configerator/structs/neteng/fboss/bgp:bgp_config-cpp2-types", + "//configerator/structs/neteng/fboss/bgp/if:bgp_attr-cpp2-types", + "//configerator/structs/neteng/fboss/push/forwarding_stack:fbpkg_map-cpp2-types", + "//configerator/structs/neteng/netwhoami:netwhoami-cpp2-types", + "//employee/if:thrift-cpp2-services", + "//employee/if:thrift-cpp2-types", + "//fastcli:utils-cpp", + "//fboss/agent:address_utils", + "//fboss/agent/hw:hardware_stats-cpp2-types", + "//fboss/agent/if:common-cpp2-types", + "//fboss/agent/if:ctrl-cpp2-clients", + "//fboss/agent/if:ctrl-cpp2-services", + "//fboss/agent/if:ctrl-cpp2-types", + "//fboss/agent/if:fboss-cpp2-types", + "//fboss/agent/if:fboss-cpp2-visitation", + "//fboss/agent/if:hw_ctrl-cpp2-services", + "//fboss/agent/if:hw_ctrl-cpp2-types", + "//fboss/cli/fboss2/commands/facebook/rage:model-cpp2-types", + "//fboss/cli/fboss2/commands/facebook/rage:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/acl:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/acl:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/agent:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/agent:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/aggregateport:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/aggregateport:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/arp:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/arp:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/cpuport:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/dsf/subscription:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/dsf/subscription:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/dsfnodes:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/dsfnodes:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/fabric:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/fabric:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/fabric/reachability:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/fabric/reachability:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/fabric/topology:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/fabric/topology:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/facebook:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/facebook:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/facebook/bgp/summary:bgp_summary-cpp2-types", + "//fboss/cli/fboss2/commands/show/facebook/bgp/summary:bgp_summary-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/facebook/bgp/techsupport:bgp_techsupport-cpp2-types", + "//fboss/cli/fboss2/commands/show/facebook/bmc:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/facebook/bmc:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/facebook/debugdump:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/facebook/environment:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/facebook/environment:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/facebook/environment/fan:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/facebook/environment/fan:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/facebook/environment/power:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/facebook/environment/power:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/facebook/environment/sensor:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/facebook/environment/temperature:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/facebook/environment/temperature:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/facebook/example:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/facebook/example:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/facebook/openr:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/facebook/state:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/facebook/state:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/facebook/teagent/flowroutes:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/facebook/techsupport:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/facebook/vip/fib:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/facebook/vip/fib:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/facebook/vip/injectors:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/facebook/vip/injectors:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/facebook/vip/overview:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/facebook/vip/overview:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/facebook/vip/prefixes:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/facebook/vip/prefixes:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/flowlet:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/hardware:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/hardware:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/host:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/hwagent:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/interface:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/interface:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/interface/capabilities:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/interface/capabilities:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/interface/counters:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/interface/counters:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/interface/counters/fec/ber:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/interface/counters/fec/ber:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/interface/counters/fec/histogram:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/interface/counters/fec/histogram:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/interface/counters/fec/tail:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/interface/counters/fec/tail:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/interface/counters/fec/uncorrectable:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/interface/counters/fec/uncorrectable:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/interface/counters/mka:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/interface/counters/mka:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/interface/errors:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/interface/errors:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/interface/flaps:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/interface/flaps:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/interface/phy:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/interface/phy:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/interface/phymap:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/interface/phymap:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/interface/prbs/capabilities:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/interface/prbs/capabilities:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/interface/prbs/state:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/interface/prbs/state:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/interface/prbs/stats:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/interface/prbs/stats:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/interface/status:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/interface/status:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/interface/traffic:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/interface/traffic:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/lldp:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/lldp:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/mac:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/mac:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/mirror:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/mpls:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/ndp:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/ndp:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/port:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/port:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/product:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/rif:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/rif:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/route:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/route:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/systemport:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/systemport:model-cpp2-visitation", + "//fboss/cli/fboss2/commands/show/teflow:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/transceiver:model-cpp2-types", + "//fboss/cli/fboss2/commands/show/transceiver:model-cpp2-visitation", + "//fboss/fsdb/if:fsdb-cpp2-services", + "//fboss/fsdb/if:fsdb_common-cpp2-types", + "//fboss/fsdb/if:fsdb_model", + "//fboss/fsdb/if:fsdb_oper-cpp2-types", + "//fboss/fsdb/if:fsdb_oper-cpp2-visitation", + "//fboss/led_service/if:led_service-cpp2-services", + "//fboss/lib/phy:phy-cpp2-types", + "//fboss/lib/phy:phy-cpp2-visitation", + "//fboss/lib/phy:prbs-cpp2-types", + "//fboss/lib/phy:prbs-cpp2-visitation", + "//fboss/mka_service/if:mka_structs-cpp2-types", + "//fboss/mka_service/if/facebook:mka_service_thrift-cpp2-services", + "//fboss/platform/data_corral_service/if:data_corral_service-cpp2-services", + "//fboss/platform/fan_service/if:fan_service-cpp2-services", + "//fboss/platform/rackmon/if:rackmonsvc-cpp2-services", + "//fboss/platform/sensor_service/if:sensor_service-cpp2-services", + "//fboss/qsfp_service/if:qsfp-cpp2-services", + "//fboss/qsfp_service/if:transceiver-cpp2-types", + "//folly:conv", + "//folly:exception", + "//folly:format", + "//folly:network_address", + "//folly:range", + "//folly:stop_watch", + "//folly:string", + "//folly/container:access", + "//folly/coro:async_pipe", + "//folly/coro:blocking_wait", + "//folly/coro:task", + "//folly/executors:io_thread_pool_executor", + "//folly/gen:base", + "//folly/json:dynamic", + "//folly/logging:logging", + "//folly/testing:test_util", + "//neteng/ai/te_agent/if:TeAgent-cpp2-services", + "//neteng/fboss/bgp/if:bgp_stream-cpp2-services", + "//neteng/fboss/bgp/if:bgp_stream-cpp2-types", + "//neteng/fboss/bgp/if:bgp_thrift-cpp2-services", + "//neteng/fboss/bgp/if:bgp_thrift-cpp2-types", + "//neteng/fboss/coop/if:coop_thrift-cpp2-services", + "//neteng/fboss/coop/if:coop_thrift-cpp2-types", + "//neteng/fboss/drain/local_drainer/server:thrift-cpp2-clients", + "//neteng/netwhoami/lib/cpp:client", + "//neteng/netwhoami/lib/cpp:recover", + "//neteng/routing/policy/if:policy_thrift-cpp2-types", + "//nettools/bgplib:bgp_parser", + "//nettools/bgplib:bgplib", + "//nettools/bgplib/if:bgp-structs-cpp2-types", + "//nettools/skynet/if:query-cpp2-types", + "//nettools/skynet/if:skynet_structs-cpp2-types", + "//nettools/skynet/lib/cpp:skynet_thrift_client", + "//nettools/vipinjector/vip_service/if:vip_service-cpp2-services", + "//nettools/vipinjector/vip_service/if:vip_service-cpp2-types", + "//openr/common:network_util", + "//openr/if:if-cpp-cpp2-clients", + "//openr/if:if-cpp-cpp2-services", + "//openr/if:if-cpp2-types", + "//openr/if:kvstore-cpp2-types", + "//openr/if:network-cpp2-types", + "//openr/if:openr_config-cpp2-types", + "//openr/if:types-cpp2-types", + "//scribe/client:scribe_client_no_sr", + "//servicerouter/client/cpp2:cpp2", + "//task/if:if-cpp2-services", + "//thrift/lib/cpp/transport:transport-core", + "//thrift/lib/cpp/util:enum_utils", + "//thrift/lib/cpp2/async:client_buferred_stream", + "//thrift/lib/cpp2/async:header_client_channel", + "//thrift/lib/cpp2/folly_dynamic:folly_dynamic", + "//thrift/lib/cpp2/gen:module_types_h", + "//thrift/lib/cpp2/protocol:protocol", ], exported_external_deps = [ "re2", diff --git a/fboss/cli/fboss2/commands/show/route/CmdShowRouteDetails.h b/fboss/cli/fboss2/commands/show/route/CmdShowRouteDetails.h index be3f1c3ab595c..eb3eca440cd51 100644 --- a/fboss/cli/fboss2/commands/show/route/CmdShowRouteDetails.h +++ b/fboss/cli/fboss2/commands/show/route/CmdShowRouteDetails.h @@ -15,6 +15,7 @@ #include #include #include "fboss/agent/if/gen-cpp2/common_types.h" +#include "fboss/agent/if/gen-cpp2/ctrl_types.h" #include "fboss/cli/fboss2/CmdHandler.h" #include "fboss/cli/fboss2/commands/show/route/CmdShowRoute.h" #include "fboss/cli/fboss2/commands/show/route/gen-cpp2/model_types.h" @@ -79,8 +80,9 @@ class CmdShowRouteDetails entry.get_isConnected() ? " (connected)" : ""); for (const auto& clAndNxthops : entry.get_nextHopMulti()) { - out << fmt::format( - " Nexthops from client {}\n", clAndNxthops.get_clientId()); + auto clientId = static_cast(*clAndNxthops.clientId()); + auto clientName = apache::thrift::util::enumNameSafe(clientId); + out << fmt::format(" Nexthops from client {}\n", clientName); for (const auto& nextHop : clAndNxthops.get_nextHops()) { out << fmt::format( " {}\n", show::route::utils::getNextHopInfoStr(nextHop)); diff --git a/fboss/cli/fboss2/test/CmdShowRouteDetailsTest.cpp b/fboss/cli/fboss2/test/CmdShowRouteDetailsTest.cpp index 9e164623c7c37..a655bd6586dff 100644 --- a/fboss/cli/fboss2/test/CmdShowRouteDetailsTest.cpp +++ b/fboss/cli/fboss2/test/CmdShowRouteDetailsTest.cpp @@ -237,7 +237,7 @@ TEST_F(CmdShowRouteDetailsTestFixture, printOutput) { std::string output = ss.str(); std::string expectOutput = R"( Network Address: 2401:db00::/32 - Nexthops from client 0 + Nexthops from client BGPD 2401:db00:e32f:8fc::2 weight 1 MPLS -> SWAP : 1 Action: Nexthops Forwarding via: @@ -247,7 +247,7 @@ Network Address: 2401:db00::/32 Class Id: DST_CLASS_L3_DPR(20) Network Address: 176.161.6.0/32 (connected) - Nexthops from client 1 + Nexthops from client STATIC_ROUTE 240.161.6.0 Action: Nexthops Forwarding via: diff --git a/fboss/oss/hw_known_bad_tests/sai_known_bad_tests.materialized_JSON b/fboss/oss/hw_known_bad_tests/sai_known_bad_tests.materialized_JSON index dad3930b7cb39..b13e70f6b1183 100644 --- a/fboss/oss/hw_known_bad_tests/sai_known_bad_tests.materialized_JSON +++ b/fboss/oss/hw_known_bad_tests/sai_known_bad_tests.materialized_JSON @@ -19,9 +19,6 @@ { "test_name_regex": "HwHashConsistencyTest.UdpEgressLinksOnEcmpExpand" }, - { - "test_name_regex": "HwPfcTest.PfcWatchdog*" - }, { "test_name_regex": "HwVerifyPfcConfigInHwTest.PfcWatchdog*" }, @@ -420,9 +417,6 @@ { "test_name_regex": "HwMacSwLearningModeTest.VerifyCallbacksOnMacEntryChange" }, - { - "test_name_regex": "HwPfcTest.PfcWatchdog.*" - }, { "test_name_regex": "HwVerifyPfcConfigInHwTest.PfcWatchdog.*" }, @@ -1031,9 +1025,6 @@ { "test_name_regex": "HwMacSwLearningModeTest.VerifyCallbacksOnMacEntryChange" }, - { - "test_name_regex": "HwPfcTest.PfcWatchdog.*" - }, { "test_name_regex": "HwVerifyPfcConfigInHwTest.PfcWatchdog.*" }, @@ -1588,9 +1579,6 @@ { "test_name_regex": "HwTrafficPfcTest.*" }, - { - "test_name_regex": "HwPfcTest.*" - }, { "test_name_regex": "HwVerifyPfcConfigInHwTest.*" }, @@ -2232,9 +2220,6 @@ { "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.warm_boot_for_warm_boot.0.HwEmptyTest.CheckInit.HwFlexPortTest.FlexPortFOURX25G" }, - { - "test_name_regex": "roundtrip.trunk_2_preprod_2_trunk.warm_boot_for_warm_boot.0.HwEmptyTest.CheckInit.HwPfcTest.*" - }, { "test_name_regex": "roundtrip.trunk_2_preprod_2_trunk.warm_boot_for_warm_boot.0.HwEmptyTest.CheckInit.HwVerifyPfcConfigInHwTest.*" }, @@ -2313,9 +2298,6 @@ { "test_name_regex": "HwLoadBalancerNegativeProtocolMatchTestV6RoCE.*" }, - { - "test_name_regex": "HwPfcTest.PfcWatchdog.*" - }, { "test_name_regex": "HwVerifyPfcConfigInHwTest.PfcWatchdog.*" }, @@ -2615,9 +2597,6 @@ { "test_name_regex": "HwMacSwLearningModeTest.VerifyCallbacksOnMacEntryChange" }, - { - "test_name_regex": "HwPfcTest.PfcWatchdog.*" - }, { "test_name_regex": "HwVerifyPfcConfigInHwTest.PfcWatchdog.*" }, @@ -3160,9 +3139,6 @@ { "test_name_regex": "HwMacSwLearningModeTest.VerifyCallbacksOnMacEntryChange" }, - { - "test_name_regex": "HwPfcTest.PfcWatchdog.*" - }, { "test_name_regex": "HwVerifyPfcConfigInHwTest.PfcWatchdog.*" }, @@ -3419,9 +3395,6 @@ { "test_name_regex": "HwHashConsistencyTest.UdpEgressLinksOnEcmpExpand" }, - { - "test_name_regex": "HwPfcTest.PfcWatchdog*" - }, { "test_name_regex": "HwVerifyPfcConfigInHwTest.PfcWatchdog*" }, @@ -3738,9 +3711,6 @@ { "test_name_regex": "HwRouteTest/[01].VerifyClassIdWithNhopResolutionFlap" }, - { - "test_name_regex": "HwPfcTest.PfcWatchdog*" - }, { "test_name_regex": "HwVerifyPfcConfigInHwTest.PfcWatchdog*" }, @@ -4083,9 +4053,6 @@ { "test_name_regex": "HwOlympicQosTests.*" }, - { - "test_name_regex": "HwPfcTest.*" - }, { "test_name_regex": "HwVerifyPfcConfigInHwTest.*" }, @@ -4562,9 +4529,6 @@ { "test_name_regex": "HwTrafficPfcTest.*" }, - { - "test_name_regex": "HwPfcTest.*" - }, { "test_name_regex": "HwVerifyPfcConfigInHwTest.*" }, @@ -5206,9 +5170,6 @@ { "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.warm_boot_for_warm_boot.0.HwEmptyTest.CheckInit.HwFlexPortTest.FlexPortFOURX25G" }, - { - "test_name_regex": "roundtrip.trunk_2_preprod_2_trunk.warm_boot_for_warm_boot.0.HwEmptyTest.CheckInit.HwPfcTest.*" - }, { "test_name_regex": "roundtrip.trunk_2_preprod_2_trunk.warm_boot_for_warm_boot.0.HwEmptyTest.CheckInit.HwVerifyPfcConfigInHwTest.*" }, @@ -5287,9 +5248,6 @@ { "test_name_regex": "HwLoadBalancerNegativeProtocolMatchTestV6RoCE.*" }, - { - "test_name_regex": "HwPfcTest.PfcWatchdog.*" - }, { "test_name_regex": "HwVerifyPfcConfigInHwTest.PfcWatchdog.*" }, @@ -5586,9 +5544,6 @@ { "test_name_regex": "HwMacSwLearningModeTest.VerifyCallbacksOnMacEntryChange" }, - { - "test_name_regex": "HwPfcTest.PfcWatchdog.*" - }, { "test_name_regex": "HwVerifyPfcConfigInHwTest.PfcWatchdog.*" }, @@ -6257,9 +6212,6 @@ { "test_name_regex": "HwTrafficPfcTest.*" }, - { - "test_name_regex": "HwPfcTest.*" - }, { "test_name_regex": "HwVerifyPfcConfigInHwTest.*" }, @@ -6401,9 +6353,6 @@ { "test_name_regex": "HwTrafficPfcTest.*" }, - { - "test_name_regex": "HwPfcTest.*" - }, { "test_name_regex": "HwVerifyPfcConfigInHwTest.*" }, @@ -6928,9 +6877,6 @@ { "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.warm_boot_for_warm_boot.0.HwEmptyTest.CheckInit.HwFlexPortTest.FlexPortFOURX25G" }, - { - "test_name_regex": "roundtrip.trunk_2_preprod_2_trunk.warm_boot_for_warm_boot.0.HwEmptyTest.CheckInit.HwPfcTest.*" - }, { "test_name_regex": "roundtrip.trunk_2_preprod_2_trunk.warm_boot_for_warm_boot.0.HwEmptyTest.CheckInit.HwVerifyPfcConfigInHwTest.*" }, @@ -7009,9 +6955,6 @@ { "test_name_regex": "HwLoadBalancerNegativeProtocolMatchTestV6RoCE.*" }, - { - "test_name_regex": "HwPfcTest.PfcWatchdog.*" - }, { "test_name_regex": "HwVerifyPfcConfigInHwTest.PfcWatchdog.*" }, @@ -7051,9 +6994,6 @@ { "test_name_regex": "HwTrafficPfcTest.*" }, - { - "test_name_regex": "HwPfcTest.*" - }, { "test_name_regex": "HwVerifyPfcConfigInHwTest.*" }, @@ -7335,9 +7275,6 @@ { "test_name_regex": "HwMacSwLearningModeTest.VerifyCallbacksOnMacEntryChange" }, - { - "test_name_regex": "HwPfcTest.PfcWatchdog.*" - }, { "test_name_regex": "HwVerifyPfcConfigInHwTest.PfcWatchdog.*" }, @@ -7623,9 +7560,6 @@ { "test_name_regex": "HwTrafficPfcTest.*" }, - { - "test_name_regex": "HwPfcTest.*" - }, { "test_name_regex": "HwVerifyPfcConfigInHwTest.*" }, @@ -7907,9 +7841,6 @@ { "test_name_regex": "HwMacSwLearningModeTest.VerifyCallbacksOnMacEntryChange" }, - { - "test_name_regex": "HwPfcTest.PfcWatchdog.*" - }, { "test_name_regex": "HwVerifyPfcConfigInHwTest.PfcWatchdog.*" }, @@ -8644,9 +8575,6 @@ { "test_name_regex": "HwTrafficPfcTest.*" }, - { - "test_name_regex": "HwPfcTest.*" - }, { "test_name_regex": "HwVerifyPfcConfigInHwTest.*" }, @@ -9288,9 +9216,6 @@ { "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.warm_boot_for_warm_boot.0.HwEmptyTest.CheckInit.HwFlexPortTest.FlexPortFOURX25G" }, - { - "test_name_regex": "roundtrip.trunk_2_preprod_2_trunk.warm_boot_for_warm_boot.0.HwEmptyTest.CheckInit.HwPfcTest.*" - }, { "test_name_regex": "roundtrip.trunk_2_preprod_2_trunk.warm_boot_for_warm_boot.0.HwEmptyTest.CheckInit.HwVerifyPfcConfigInHwTest.*" }, @@ -9369,9 +9294,6 @@ { "test_name_regex": "HwLoadBalancerNegativeProtocolMatchTestV6RoCE.*" }, - { - "test_name_regex": "HwPfcTest.PfcWatchdog.*" - }, { "test_name_regex": "HwVerifyPfcConfigInHwTest.PfcWatchdog.*" }, @@ -9671,9 +9593,6 @@ { "test_name_regex": "HwMacSwLearningModeTest.VerifyCallbacksOnMacEntryChange" }, - { - "test_name_regex": "HwPfcTest.PfcWatchdog.*" - }, { "test_name_regex": "HwVerifyPfcConfigInHwTest.PfcWatchdog.*" }, @@ -9961,9 +9880,6 @@ { "test_name_regex": "HwTrafficPfcTest.*" }, - { - "test_name_regex": "HwPfcTest.*" - }, { "test_name_regex": "HwVerifyPfcConfigInHwTest.*" }, @@ -10353,9 +10269,6 @@ { "test_name_regex": "HwTrafficPfcTest.*" }, - { - "test_name_regex": "HwPfcTest.*" - }, { "test_name_regex": "HwVerifyPfcConfigInHwTest.*" }, @@ -11051,9 +10964,6 @@ { "test_name_regex": "HwTrafficPfcTest.*" }, - { - "test_name_regex": "HwPfcTest.*" - }, { "test_name_regex": "HwVerifyPfcConfigInHwTest.*" }, @@ -11461,9 +11371,6 @@ { "test_name_regex": "HwTrafficPfcTest.*" }, - { - "test_name_regex": "HwPfcTest.*" - }, { "test_name_regex": "HwVerifyPfcConfigInHwTest.*" }, @@ -12162,9 +12069,6 @@ { "test_name_regex": "HwTrafficPfcTest.*" }, - { - "test_name_regex": "HwPfcTest.*" - }, { "test_name_regex": "HwVerifyPfcConfigInHwTest.*" }, diff --git a/fboss/oss/sai_hw_unsupported_tests/sai_hw_unsupported_tests.materialized_JSON b/fboss/oss/sai_hw_unsupported_tests/sai_hw_unsupported_tests.materialized_JSON index cfbbef6624642..c0c0fbc86f91b 100644 --- a/fboss/oss/sai_hw_unsupported_tests/sai_hw_unsupported_tests.materialized_JSON +++ b/fboss/oss/sai_hw_unsupported_tests/sai_hw_unsupported_tests.materialized_JSON @@ -265,13 +265,13 @@ "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*SaiQPHRollbackTest.rollback" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test.*" }, { "test_name_regex": "HwAqmTest.verifyPerQueueEcnMarkedStats$" @@ -324,9 +324,6 @@ { "test_name_regex": "HwPacketSendTest.PortTxEnableTest" }, - { - "test_name_regex": "HwPfcTest.*" - }, { "test_name_regex": "HwVerifyPfcConfigInHwTest.*" }, @@ -402,13 +399,13 @@ "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*SaiQPHRollbackTest.rollback" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test.*" }, { "test_name_regex": "HwAqmTest.verifyPerQueueEcnMarkedStats$" @@ -461,9 +458,6 @@ { "test_name_regex": "HwPacketSendTest.PortTxEnableTest" }, - { - "test_name_regex": "HwPfcTest.*" - }, { "test_name_regex": "HwVerifyPfcConfigInHwTest.*" }, @@ -539,13 +533,13 @@ "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*SaiQPHRollbackTest.rollback" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test.*" }, { "test_name_regex": "HwAqmTest.verifyPerQueueEcnMarkedStats$" @@ -604,13 +598,13 @@ "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*SaiQPHRollbackTest.rollback" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test.*" }, { "test_name_regex": "HwAqmTest.verifyPerQueueEcnMarkedStats$" @@ -654,13 +648,13 @@ "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*SaiQPHRollbackTest.rollback" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test.*" }, { "test_name_regex": "HwAqmTest.verifyPerQueueEcnMarkedStats$" @@ -704,13 +698,13 @@ "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*SaiQPHRollbackTest.rollback" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test.*" }, { "test_name_regex": "HwAqmTest.verifyPerQueueEcnMarkedStats$" @@ -1485,13 +1479,13 @@ "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*SaiQPHRollbackTest.rollback" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test.*" }, { "test_name_regex": "HwAqmTest.verifyPerQueueEcnMarkedStats$" @@ -1550,13 +1544,13 @@ "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*SaiQPHRollbackTest.rollback" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test.*" }, { "test_name_regex": "HwAqmTest.verifyPerQueueEcnMarkedStats$" @@ -1600,13 +1594,13 @@ "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*SaiQPHRollbackTest.rollback" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test.*" }, { "test_name_regex": "HwAqmTest.verifyPerQueueEcnMarkedStats$" @@ -1650,13 +1644,13 @@ "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*SaiQPHRollbackTest.rollback" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test.*" }, { "test_name_regex": "HwAqmTest.verifyPerQueueEcnMarkedStats$" @@ -1715,13 +1709,13 @@ "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*SaiQPHRollbackTest.rollback" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test.*" }, { "test_name_regex": "HwAqmTest.verifyPerQueueEcnMarkedStats$" @@ -1765,13 +1759,13 @@ "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*SaiQPHRollbackTest.rollback" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test.*" }, { "test_name_regex": "HwAqmTest.verifyPerQueueEcnMarkedStats$" @@ -1815,13 +1809,13 @@ "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*SaiQPHRollbackTest.rollback" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test.*" }, { "test_name_regex": "HwAqmTest.verifyPerQueueEcnMarkedStats$" @@ -1874,9 +1868,6 @@ { "test_name_regex": "HwPacketSendTest.PortTxEnableTest" }, - { - "test_name_regex": "HwPfcTest.*" - }, { "test_name_regex": "HwVerifyPfcConfigInHwTest.*" }, @@ -1952,13 +1943,13 @@ "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*SaiQPHRollbackTest.rollback" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test.*" }, { "test_name_regex": "HwAqmTest.verifyPerQueueEcnMarkedStats$" @@ -2017,13 +2008,13 @@ "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*SaiQPHRollbackTest.rollback" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test.*" }, { "test_name_regex": "HwAqmTest.verifyPerQueueEcnMarkedStats$" @@ -2067,13 +2058,13 @@ "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*SaiQPHRollbackTest.rollback" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test.*" }, { "test_name_regex": "HwAqmTest.verifyPerQueueEcnMarkedStats$" @@ -2200,13 +2191,13 @@ "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*SaiQPHRollbackTest.rollback" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test.*" }, { "test_name_regex": "HwAclCounterTest/[01].*$" @@ -2250,13 +2241,13 @@ "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*SaiQPHRollbackTest.rollback" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test.*" }, { "test_name_regex": "HwAclCounterTest/[01].*$" @@ -2300,13 +2291,13 @@ "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*SaiQPHRollbackTest.rollback" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test.*" }, { "test_name_regex": "HwAclCounterTest/[01].*$" @@ -2350,13 +2341,13 @@ "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*SaiQPHRollbackTest.rollback" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test.*" }, { "test_name_regex": "HwAclCounterTest/[01].*$" @@ -2400,13 +2391,13 @@ "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*SaiQPHRollbackTest.rollback" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test.*" }, { "test_name_regex": "HwAclCounterTest/[01].*$" @@ -2450,13 +2441,13 @@ "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*SaiQPHRollbackTest.rollback" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostRouteTest.*" }, { - "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test" + "test_name_regex": "roundtrip.preprod_2_trunk_2_preprod.*AgentQueuePerHostL2Test.*" }, { "test_name_regex": "HwAclCounterTest/[01].*$" diff --git a/fboss/platform/config_lib/BUCK b/fboss/platform/config_lib/BUCK index 23a3f28f187e7..1b1ef130e7fde 100644 --- a/fboss/platform/config_lib/BUCK +++ b/fboss/platform/config_lib/BUCK @@ -12,6 +12,7 @@ cpp_binary( ], deps = [ "//fboss/platform/data_corral_service/if:led_manager-cpp2-types", + "//fboss/platform/fan_service:utils", "//fboss/platform/fan_service/if:fan_service-cpp2-types", "//fboss/platform/fbdevd/if:fbdevd-cpp2-types", "//fboss/platform/fw_util/if:fw_util_config-cpp2-types", diff --git a/fboss/platform/data_corral_service/hw_test/DataCorralServiceHwTest.cpp b/fboss/platform/data_corral_service/hw_test/DataCorralServiceHwTest.cpp index 1751fff22a362..3f15fcff30c80 100644 --- a/fboss/platform/data_corral_service/hw_test/DataCorralServiceHwTest.cpp +++ b/fboss/platform/data_corral_service/hw_test/DataCorralServiceHwTest.cpp @@ -25,14 +25,40 @@ using namespace facebook::fboss::platform; using namespace facebook::fboss::platform::data_corral_service; -namespace { +// When running OSS, users must supply config_file unlike in fb environment. +// getUncachedFruid test, DataCorral talks to WeUtil to parse eeprom +// content. Sincne config_file flag only store a single file, WeUtil will +// end up deserializing led_manger.json... +// To avoid this different user expectations, we could: +// 1) Figure out how to avoid passing config files in OSS. +// 2) See whether this can be avoided when we merge DataCorral into PM. +DEFINE_string( + led_manager_config_file, + "", + "[OSS-Only] Path to led_manager.json file used for DataCorral service configuration during HwTest."); +DEFINE_string( + weutil_config_file, + "", + "[OSS-Only] Path to weutil.json file used for weutil configuration during HWTest. " + "This will overwrite FLAGS_config_file when weutil initializes the config."); + class DataCorralServiceHwTest : public ::testing::Test { public: void SetUp() override { thriftHandler_ = std::make_shared(); + std::string jsonLedManagerConfig; + if (FLAGS_led_manager_config_file.empty()) { + jsonLedManagerConfig = ConfigLib().getLedManagerConfig(); + } else { + folly::readFile( + FLAGS_led_manager_config_file.c_str(), jsonLedManagerConfig); + } + if (!FLAGS_weutil_config_file.empty()) { + FLAGS_config_file = FLAGS_weutil_config_file; + } apache::thrift::SimpleJSONSerializer::deserialize( - ConfigLib().getLedManagerConfig(), ledManagerConfig_); + jsonLedManagerConfig, ledManagerConfig_); auto ledManager = std::make_shared( *ledManagerConfig_.systemLedConfig(), @@ -55,7 +81,6 @@ class DataCorralServiceHwTest : public ::testing::Test { std::shared_ptr thriftHandler_; LedManagerConfig ledManagerConfig_; }; -} // namespace TEST_F(DataCorralServiceHwTest, FruLedProgrammingSysfsCheck) { fruPresenceExplorer_->detectFruPresence(); @@ -123,6 +148,21 @@ int main(int argc, char* argv[]) { // Parse command line flags testing::InitGoogleTest(&argc, argv); facebook::fboss::platform::helpers::init(&argc, &argv); + if (!FLAGS_config_file.empty()) { + XLOG(ERR) + << "Please use --led_manager_config_file and --weutil_config_file instead of --config_file. " + << "For more info on the flags, run with --helpon=DataCorralServiceHwTest"; + return -1; + } +#ifdef IS_OSS + if (FLAGS_led_manager_config_file.empty() || + FLAGS_weutil_config_file.empty()) { + XLOG(ERR) + << "Please specify --led_manager_config_file and --weutil_config_file. " + << "For more info on the flags, run with --helpon=DataCorralServiceHwTest"; + return -1; + } +#endif // Run the tests return RUN_ALL_TESTS(); } diff --git a/fboss/platform/fan_service/BUCK b/fboss/platform/fan_service/BUCK index 425fbba8fd267..e836676810549 100644 --- a/fboss/platform/fan_service/BUCK +++ b/fboss/platform/fan_service/BUCK @@ -18,6 +18,7 @@ cpp_binary( "//fb303:logging", "//fboss/platform/config_lib:config_lib", "//fboss/platform/helpers:init", + "//fboss/platform/helpers:platform_name_lib", "//fboss/platform/sensor_service/if:sensor_service-cpp2-types", "//fboss/qsfp_service/lib:qsfp-service-client", "//folly/executors:function_scheduler", @@ -84,6 +85,7 @@ cpp_library( "//fboss/fsdb/if:fsdb_model", "//fboss/fsdb/if:fsdb_oper-cpp2-types", "//fboss/lib:common_file_utils", + "//fboss/lib:gpiod_line", "//fboss/platform/fan_service/if:fan_service-cpp2-services", "//fboss/platform/fan_service/if:fan_service-cpp2-types", "//fboss/platform/helpers:platform_utils", @@ -103,6 +105,9 @@ cpp_library( "//security/ca/lib:cert_path_picker", "//thrift/lib/cpp2/protocol:protocol", ], + exported_external_deps = [ + ("libgpiod", None, "gpiod"), + ], ) custom_unittest( diff --git a/fboss/platform/fan_service/ControlLogic.cpp b/fboss/platform/fan_service/ControlLogic.cpp index d701b2cefb27e..9a511615e546f 100644 --- a/fboss/platform/fan_service/ControlLogic.cpp +++ b/fboss/platform/fan_service/ControlLogic.cpp @@ -6,8 +6,10 @@ #include "fboss/platform/fan_service/ControlLogic.h" #include +#include #include "common/time/Time.h" +#include "fboss/lib/GpiodLine.h" #include "fboss/platform/fan_service/SensorData.h" #include "fboss/platform/fan_service/if/gen-cpp2/fan_service_config_constants.h" #include "fboss/platform/fan_service/if/gen-cpp2/fan_service_config_types.h" @@ -349,15 +351,35 @@ void ControlLogic::getOpticsUpdate() { bool ControlLogic::isFanPresentInDevice(const Fan& fan) { unsigned int readVal; bool readSuccessful = false; - try { - readVal = static_cast(pBsp_->readSysfs(*fan.presenceSysfsPath())); - readSuccessful = true; - } catch (std::exception&) { - XLOG(ERR) << "Failed to read sysfs " << *fan.presenceSysfsPath(); - } - auto fanPresent = (readSuccessful && readVal == *fan.fanPresentVal()); - if (!fanPresent) { - XLOG(INFO) << fmt::format("{}: is absent in the host", *fan.fanName()); + bool fanPresent = false; + if (fan.presenceSysfsPath()) { + try { + readVal = + static_cast(pBsp_->readSysfs(*fan.presenceSysfsPath())); + readSuccessful = true; + } catch (std::exception&) { + XLOG(ERR) << "Failed to read sysfs " << *fan.presenceSysfsPath(); + } + fanPresent = (readSuccessful && readVal == *fan.fanPresentVal()); + if (fanPresent) { + XLOG(INFO) << fmt::format( + "{}: is present in the host (through sysfs)", *fan.fanName()); + } else { + XLOG(INFO) << fmt::format( + "{}: is absent in the host (through sysfs)", *fan.fanName()); + } + } else if (fan.presenceGpio()) { + struct gpiod_chip* chip = + gpiod_chip_open(fan.presenceGpio()->path()->c_str()); + GpiodLine line(chip, *fan.presenceGpio()->lineIndex(), "gpioline"); + int16_t value = line.getValue(); + gpiod_chip_close(chip); + if (value == *fan.presenceGpio()->desiredValue()) { + fanPresent = true; + } else { + XLOG(INFO) << fmt::format( + "{}: is absent in the host (through gpio)", *fan.fanName()); + } } fb303::fbData->setCounter( fmt::format(kFanAbsent, *fan.fanName()), !fanPresent); diff --git a/fboss/platform/fan_service/Main.cpp b/fboss/platform/fan_service/Main.cpp index 5fe807ccd12d3..6af4641060c15 100644 --- a/fboss/platform/fan_service/Main.cpp +++ b/fboss/platform/fan_service/Main.cpp @@ -17,6 +17,7 @@ #include "fboss/platform/fan_service/FanServiceHandler.h" #include "fboss/platform/fan_service/Utils.h" #include "fboss/platform/helpers/Init.h" +#include "fboss/platform/helpers/PlatformNameLib.h" using namespace facebook; using namespace facebook::fboss::platform; @@ -32,7 +33,9 @@ int main(int argc, char** argv) { fb303::registerFollyLoggingOptionHandlers(); helpers::init(&argc, &argv); - std::string fanServiceConfJson = ConfigLib().getFanServiceConfig(); + auto platformName = helpers::PlatformNameLib().getPlatformName(); + std::string fanServiceConfJson = + ConfigLib().getFanServiceConfig(platformName); auto config = apache::thrift::SimpleJSONSerializer::deserialize( fanServiceConfJson); diff --git a/fboss/platform/fan_service/Utils.cpp b/fboss/platform/fan_service/Utils.cpp index 2bc1888f92e56..932b8c44ff9ec 100644 --- a/fboss/platform/fan_service/Utils.cpp +++ b/fboss/platform/fan_service/Utils.cpp @@ -90,7 +90,7 @@ bool Utils::isValidConfig(const FanServiceConfig& config) { XLOG(ERR) << "ledSysfsPath cannot be empty"; return false; } - if ((!fan.presenceSysfsPath()) != (!fan.presenceGpio())) { + if ((!fan.presenceSysfsPath()) && (!fan.presenceGpio())) { XLOG(ERR) << "either presenceSysfsPath or presenceGpio must be set"; return false; } diff --git a/fboss/platform/fw_util/BUCK b/fboss/platform/fw_util/BUCK index fae1cd0073bff..9c22c8b6924ea 100644 --- a/fboss/platform/fw_util/BUCK +++ b/fboss/platform/fw_util/BUCK @@ -17,6 +17,7 @@ cpp_binary( "//fboss/platform/config_lib:config_lib", "//fboss/platform/fw_util/if:fw_util_config-cpp2-types", "//fboss/platform/helpers:init_cli", + "//fboss/platform/helpers:platform_name_lib", "//fboss/platform/helpers:platform_utils", "//folly:string", "//folly:subprocess", diff --git a/fboss/platform/fw_util/FwUtilImpl.cpp b/fboss/platform/fw_util/FwUtilImpl.cpp index 64ee12a16eae0..5bda304bf9ae5 100644 --- a/fboss/platform/fw_util/FwUtilImpl.cpp +++ b/fboss/platform/fw_util/FwUtilImpl.cpp @@ -19,13 +19,15 @@ #include "fboss/platform/config_lib/ConfigLib.h" #include "fboss/platform/fw_util/Flags.h" #include "fboss/platform/fw_util/FwUtilImpl.h" +#include "fboss/platform/helpers/PlatformNameLib.h" #include "fboss/platform/helpers/PlatformUtils.h" using namespace folly::literals::shell_literals; namespace facebook::fboss::platform::fw_util { void FwUtilImpl::init() { - std::string fwUtilConfJson = ConfigLib().getFwUtilConfig(); + auto platformName = helpers::PlatformNameLib().getPlatformName(); + std::string fwUtilConfJson = ConfigLib().getFwUtilConfig(platformName); apache::thrift::SimpleJSONSerializer::deserialize( fwUtilConfJson, fwUtilConfig_); diff --git a/fboss/platform/helpers/PlatformFsUtils.cpp b/fboss/platform/helpers/PlatformFsUtils.cpp index 299be487ab619..50ec5780688ef 100644 --- a/fboss/platform/helpers/PlatformFsUtils.cpp +++ b/fboss/platform/helpers/PlatformFsUtils.cpp @@ -93,8 +93,8 @@ bool PlatformFsUtils::writeStringToFile( } int errorCode = 0; if (atomic) { - auto& options = - folly::WriteFileAtomicOptions().setSyncType(folly::SyncType::WITH_SYNC); + auto options = folly::WriteFileAtomicOptions(); + options.setSyncType(folly::SyncType::WITH_SYNC); errorCode = folly::writeFileAtomicNoThrow( folly::StringPiece(prefixedPath.c_str()), content, options); // On successful write, fsync the directory to ensure durable write, which diff --git a/fboss/platform/helpers/PlatformNameLib.cpp b/fboss/platform/helpers/PlatformNameLib.cpp index a6477a892ad3d..2b559909a8034 100644 --- a/fboss/platform/helpers/PlatformNameLib.cpp +++ b/fboss/platform/helpers/PlatformNameLib.cpp @@ -59,7 +59,7 @@ std::string PlatformNameLib::getPlatformNameFromBios(bool writeToCache) const { auto result = sanitizePlatformName(standardOut); XLOG(INFO) << "Platform name mapped: " << result; if (writeToCache) { - platformFsUtils_->writeStringToFile(result, kCachePath); + platformFsUtils_->writeStringToFile(result, kCachePath, true); } return result; } diff --git a/fboss/platform/helpers/tests/PlatformFsUtilsTest.cpp b/fboss/platform/helpers/tests/PlatformFsUtilsTest.cpp index 5b84d4cdc7456..5ebe75dcf7abf 100644 --- a/fboss/platform/helpers/tests/PlatformFsUtilsTest.cpp +++ b/fboss/platform/helpers/tests/PlatformFsUtilsTest.cpp @@ -67,4 +67,18 @@ TEST(PlatformFsUtilsTest, TemporaryRoot) { utils.getStringFileContent(tmpFilePathRelative), readContent.value()); } +TEST(PlatformFsUtilsTest, BasicWriteReadTest) { + fs::path tmpDirPath = + fs::path(folly::test::TemporaryDirectory().path().string()); + PlatformFsUtils utils{tmpDirPath}; + EXPECT_TRUE(utils.writeStringToFile("test", "/a/b/c/d")); + EXPECT_EQ(utils.getStringFileContent("/a/b/c/d"), "test"); + EXPECT_TRUE(utils.writeStringToFile("overwrite", "/a/b/c/d")); + EXPECT_EQ(utils.getStringFileContent("/a/b/c/d"), "overwrite"); + // Testing atomic writes here as basically just a sanity check. We rely on + // folly and their testing to maintain their atomicity guarantees. + EXPECT_TRUE(utils.writeStringToFile("test2", "/e/f/g/h", true)); + EXPECT_EQ(utils.getStringFileContent("/e/f/g/h"), "test2"); +} + } // namespace facebook::fboss::platform diff --git a/fboss/platform/platform_manager/PlatformExplorer.cpp b/fboss/platform/platform_manager/PlatformExplorer.cpp index d3ff2b74d02f0..ead835997d92b 100644 --- a/fboss/platform/platform_manager/PlatformExplorer.cpp +++ b/fboss/platform/platform_manager/PlatformExplorer.cpp @@ -699,26 +699,26 @@ void PlatformExplorer::publishFirmwareVersions() { const auto deviceName = linkPathParts.back(); std::string versionString; int odsValue = 0; + std::string verDirPath = linkPath; + // Check for and handle hwmon case. e.g. + // /run/devmap/cplds/FAN0_CPLD/hwmon/hwmon20/ + auto hwmonSubdirPath = std::filesystem::path(linkPath) / "hwmon"; + if (platformFsUtils_->exists(hwmonSubdirPath)) { + for (const auto& entry : platformFsUtils_->ls(hwmonSubdirPath)) { + if (entry.is_directory() && + entry.path().filename().string().starts_with("hwmon")) { + verDirPath = hwmonSubdirPath / entry.path().filename(); + break; + } + } + } // New-style fw_ver - auto fwVerFilePath = std::filesystem::path(linkPath) / "fw_ver"; + auto fwVerFilePath = std::filesystem::path(verDirPath) / "fw_ver"; if (platformFsUtils_->exists(fwVerFilePath)) { auto version = readVersionString(fwVerFilePath, platformFsUtils_.get()); versionString = version.first; odsValue = version.second; } else { - std::string verDirPath = linkPath; - // Check for and handle hwmon case. e.g. - // /run/devmap/cplds/FAN0_CPLD/hwmon/hwmon20/ - auto hwmonSubdirPath = std::filesystem::path(linkPath) / "hwmon"; - if (platformFsUtils_->exists(hwmonSubdirPath)) { - for (const auto& entry : platformFsUtils_->ls(hwmonSubdirPath)) { - if (entry.is_directory() && - entry.path().filename().string().starts_with("hwmon")) { - verDirPath = hwmonSubdirPath / entry.path().filename(); - break; - } - } - } const auto version = readVersionNumber( fmt::format("{}/{}_ver", verDirPath, deviceType), platformFsUtils_.get()); diff --git a/fboss/platform/platform_manager/tests/PlatformExplorerTest.cpp b/fboss/platform/platform_manager/tests/PlatformExplorerTest.cpp index 7f75572dd652d..5acd0db0e35b7 100644 --- a/fboss/platform/platform_manager/tests/PlatformExplorerTest.cpp +++ b/fboss/platform/platform_manager/tests/PlatformExplorerTest.cpp @@ -72,6 +72,10 @@ TEST(PlatformExplorerTest, PublishFirmwareVersions) { std::string cpldBadFwVerPath = "/run/devmap/cplds/TEST_CPLD_BADFWVER"; EXPECT_TRUE(platformFsUtils->writeStringToFile( "123.456.789 // comment", fmt::format("{}/fw_ver", cpldBadFwVerPath))); + // Case with fw_ver under hwmon + std::string cpldHwmonFwVerPath = "/run/devmap/cplds/FAN0_CPLD_FWVER"; + EXPECT_TRUE(platformFsUtils->writeStringToFile( + "1.2.3", fmt::format("{}/hwmon/hwmon20/fw_ver", cpldHwmonFwVerPath))); PlatformConfig platformConfig; platformConfig.symbolicLinkToDevicePath()[fpgaPath] = ""; @@ -82,6 +86,7 @@ TEST(PlatformExplorerTest, PublishFirmwareVersions) { platformConfig.symbolicLinkToDevicePath()[fpgaFwVerPath] = ""; platformConfig.symbolicLinkToDevicePath()[cpldFwVerPath] = ""; platformConfig.symbolicLinkToDevicePath()[cpldBadFwVerPath] = ""; + platformConfig.symbolicLinkToDevicePath()[cpldHwmonFwVerPath] = ""; PlatformExplorer explorer(platformConfig, platformFsUtils); explorer.publishFirmwareVersions(); @@ -95,6 +100,7 @@ TEST(PlatformExplorerTest, PublishFirmwareVersions) { expectVersions("TEST_FPGA_FWVER", "1.2", 1'002'000); expectVersions("TEST_CPLD_FWVER", "123.456.789", 123456789); expectVersions("TEST_CPLD_BADFWVER", "ERROR_INVALID_STRING", 0); + expectVersions("FAN0_CPLD_FWVER", "1.2.3", 1'002'003); } } // namespace facebook::fboss::platform::platform_manager diff --git a/fboss/platform/sensor_service/BUCK b/fboss/platform/sensor_service/BUCK index b1178b07f0229..5ebe19e2a810b 100644 --- a/fboss/platform/sensor_service/BUCK +++ b/fboss/platform/sensor_service/BUCK @@ -26,6 +26,7 @@ cpp_library( "//fboss/fsdb/if:fsdb_model", "//fboss/fsdb/if:fsdb_oper-cpp2-types", "//fboss/platform/config_lib:config_lib", + "//fboss/platform/helpers:platform_name_lib", "//fboss/platform/sensor_service/if:sensor_config-cpp2-types", "//fboss/platform/sensor_service/if:sensor_service-cpp2-types", "//folly:file_util", diff --git a/fboss/platform/sensor_service/SensorServiceImpl.cpp b/fboss/platform/sensor_service/SensorServiceImpl.cpp index 2c4626f58dc21..892b4f326b25f 100644 --- a/fboss/platform/sensor_service/SensorServiceImpl.cpp +++ b/fboss/platform/sensor_service/SensorServiceImpl.cpp @@ -18,6 +18,7 @@ #include #include "fboss/platform/config_lib/ConfigLib.h" +#include "fboss/platform/helpers/PlatformNameLib.h" #include "fboss/platform/sensor_service/FsdbSyncer.h" #include "fboss/platform/sensor_service/SensorServiceImpl.h" #include "fboss/platform/sensor_service/Utils.h" @@ -31,7 +32,8 @@ DEFINE_int32( namespace facebook::fboss::platform::sensor_service { SensorServiceImpl::SensorServiceImpl() { - std::string sensorConfJson = ConfigLib().getSensorServiceConfig(); + auto platformName = helpers::PlatformNameLib().getPlatformName(); + std::string sensorConfJson = ConfigLib().getSensorServiceConfig(platformName); XLOG(DBG2) << "Read sensor config: " << sensorConfJson; apache::thrift::SimpleJSONSerializer::deserialize( sensorConfJson, sensorConfig_); diff --git a/fboss/platform/weutil/BUCK b/fboss/platform/weutil/BUCK index 04d5dce2d4d48..1cb248999f355 100644 --- a/fboss/platform/weutil/BUCK +++ b/fboss/platform/weutil/BUCK @@ -21,6 +21,7 @@ cpp_library( "//fboss/lib/platforms:platform_mode", "//fboss/lib/platforms:product-info", "//fboss/platform/config_lib:config_lib", + "//fboss/platform/helpers:platform_name_lib", "//fboss/platform/helpers:platform_utils", "//fboss/platform/weutil/if:weutil_config-cpp2-types", "//folly:conv", diff --git a/fboss/platform/weutil/Weutil.cpp b/fboss/platform/weutil/Weutil.cpp index d9b13a2d96666..649ffde173b62 100644 --- a/fboss/platform/weutil/Weutil.cpp +++ b/fboss/platform/weutil/Weutil.cpp @@ -8,6 +8,7 @@ #include "fboss/lib/platforms/PlatformMode.h" #include "fboss/lib/platforms/PlatformProductInfo.h" #include "fboss/platform/config_lib/ConfigLib.h" +#include "fboss/platform/helpers/PlatformNameLib.h" #include "fboss/platform/weutil/WeutilDarwin.h" #include "fboss/platform/weutil/WeutilImpl.h" #include "fboss/platform/weutil/if/gen-cpp2/weutil_config_types.h" @@ -18,7 +19,8 @@ namespace { weutil_config::WeutilConfig getWeUtilConfig() { weutil_config::WeutilConfig thriftConfig; - std::string weutilConfigJson = ConfigLib().getWeutilConfig(); + auto platformName = helpers::PlatformNameLib().getPlatformName(); + std::string weutilConfigJson = ConfigLib().getWeutilConfig(platformName); apache::thrift::SimpleJSONSerializer::deserialize< weutil_config::WeutilConfig>(weutilConfigJson, thriftConfig); XLOG(DBG1) << apache::thrift::SimpleJSONSerializer::serialize( diff --git a/shim/BUCK b/shim/BUCK index 56fe035920b66..e25618a0730b1 100644 --- a/shim/BUCK +++ b/shim/BUCK @@ -12,6 +12,12 @@ oncall("open_source") system_cxx_toolchain( name = "cxx", cxx_flags = ["-std=c++20"], + link_flags = select({ + "DEFAULT": [], + "prelude//os:linux": [ + "-latomic", + ], + }), visibility = ["PUBLIC"], ) diff --git a/shim/third-party/boost/boost.bzl b/shim/third-party/boost/boost.bzl index 8a6d1935940e2..30f880b3e45df 100644 --- a/shim/third-party/boost/boost.bzl +++ b/shim/third-party/boost/boost.bzl @@ -10,19 +10,30 @@ load("@shim//third-party:third_party.bzl", "third_party_library") def boost_libs(xs): third_party_library( name = "boost", - ubuntu_package_name = "libboost-all-dev", - homebrew_package_name = "boost", + repo_package_names = { + "fedora": "boost-devel", + "homebrew": "boost", + "ubuntu": "libboost-all-dev", + }, ) for x in xs: third_party_library( name = "boost_{}".format(x), - homebrew_package_name = "boost", - homebrew_linker_flags = ["-lboost_{}".format(x)], + repo_package_names = { + "fedora": "boost-devel", + "homebrew": "boost", + "ubuntu": "libboost-all-dev", + }, + linker_flags = ["-lboost_{}".format(x)], ) def boost_header_only(xs): for x in xs: third_party_library( name = "boost_{}".format(x), - homebrew_package_name = "boost", + repo_package_names = { + "fedora": "boost-devel", + "homebrew": "boost", + "ubuntu": "libboost-all-dev", + }, ) diff --git a/shim/third-party/brotli/BUCK b/shim/third-party/brotli/BUCK index 94da07c9d176a..5da2cc405a42d 100644 --- a/shim/third-party/brotli/BUCK +++ b/shim/third-party/brotli/BUCK @@ -11,12 +11,18 @@ oncall("open_source") third_party_library( name = "brotli_decode", - homebrew_package_name = "brotli", pkgconfig_name = "libbrotlidec", + repo_package_names = { + "fedora": "brotli-devel", + "homebrew": "brotli", + }, ) third_party_library( name = "brotli_encode", - homebrew_package_name = "brotli", pkgconfig_name = "libbrotlienc", + repo_package_names = { + "fedora": "brotli-devel", + "homebrew": "brotli", + }, ) diff --git a/shim/third-party/bzip2/BUCK b/shim/third-party/bzip2/BUCK index 8c97c210f1857..a85eae3aea717 100644 --- a/shim/third-party/bzip2/BUCK +++ b/shim/third-party/bzip2/BUCK @@ -11,5 +11,9 @@ oncall("open_source") third_party_library( name = "bz2", - homebrew_package_name = "bzip2", + pkgconfig_name = "bzip2", + repo_package_names = { + "fedora": "bzip2-devel", + "homebrew": "bzip2", + }, ) diff --git a/shim/third-party/double_conversion/BUCK b/shim/third-party/double_conversion/BUCK index 77f4ecdc3a433..cfcecbbb61f5f 100644 --- a/shim/third-party/double_conversion/BUCK +++ b/shim/third-party/double_conversion/BUCK @@ -11,6 +11,9 @@ oncall("open_source") third_party_library( name = "double_conversion", - homebrew_linker_flags = ["-ldouble-conversion"], - homebrew_package_name = "double-conversion", + linker_flags = ["-ldouble-conversion"], + repo_package_names = { + "fedora": "double-conversion-devel", + "homebrew": "double-conversion", + }, ) diff --git a/shim/third-party/fast_float/BUCK b/shim/third-party/fast_float/BUCK index 0bb14a161fc26..d906d658dc7d4 100644 --- a/shim/third-party/fast_float/BUCK +++ b/shim/third-party/fast_float/BUCK @@ -11,4 +11,8 @@ oncall("open_source") third_party_library( name = "fast_float", + repo_package_names = { + "fedora": "fast_float-devel", + "homebrew": "fast_float", + }, ) diff --git a/shim/third-party/fmt/BUCK b/shim/third-party/fmt/BUCK index 13e98e8832832..b484c0960ce3f 100644 --- a/shim/third-party/fmt/BUCK +++ b/shim/third-party/fmt/BUCK @@ -11,6 +11,9 @@ oncall("open_source") third_party_library( name = "fmt", - homebrew_package_name = "fmt", pkgconfig_name = "fmt", + repo_package_names = { + "fedora": "fmt-devel", + "homebrew": "fmt", + }, ) diff --git a/shim/third-party/gflags/BUCK b/shim/third-party/gflags/BUCK index 9251d18ee52c6..441d78c810477 100644 --- a/shim/third-party/gflags/BUCK +++ b/shim/third-party/gflags/BUCK @@ -11,6 +11,9 @@ oncall("open_source") third_party_library( name = "gflags", - homebrew_package_name = "gflags", pkgconfig_name = "gflags", + repo_package_names = { + "fedora": "gflags-devel", + "homebrew": "glags", + }, ) diff --git a/shim/third-party/glog/BUCK b/shim/third-party/glog/BUCK index adf3bce681963..ea0ba676ea773 100644 --- a/shim/third-party/glog/BUCK +++ b/shim/third-party/glog/BUCK @@ -11,8 +11,13 @@ oncall("open_source") third_party_library( name = "glog", - homebrew_package_name = "glog", pkgconfig_name = "libglog", - ubuntu_package_name = "libgoogle-glog-dev", - deps = ["shim//third-party/gflags:gflags"], + repo_package_names = { + "fedora": "glog-devel", + "homebrew": "glog", + "ubuntu": "libgoogle-glog-dev", + }, + deps = [ + "shim//third-party/gflags:gflags", + ], ) diff --git a/shim/third-party/googletest/BUCK b/shim/third-party/googletest/BUCK index a4dc8e951eda1..13c23b9add89f 100644 --- a/shim/third-party/googletest/BUCK +++ b/shim/third-party/googletest/BUCK @@ -11,14 +11,20 @@ oncall("open_source") third_party_library( name = "gtest", - homebrew_package_name = "googletest", pkgconfig_name = "gtest", + repo_package_names = { + "fedora": "gtest-devel", + "homebrew": "googletest", + }, ) third_party_library( name = "gmock", - homebrew_package_name = "googletest", pkgconfig_name = "gmock", + repo_package_names = { + "fedora": "gmock-devel", + "homebrew": "googletest", + }, ) cxx_library( diff --git a/shim/third-party/jemalloc/BUCK b/shim/third-party/jemalloc/BUCK index 16cb5b4ca329f..30b5817244d1e 100644 --- a/shim/third-party/jemalloc/BUCK +++ b/shim/third-party/jemalloc/BUCK @@ -11,6 +11,9 @@ oncall("open_source") third_party_library( name = "headers", - homebrew_package_name = "jemalloc", pkgconfig_name = "jemalloc", + repo_package_names = { + "fedora": "jemalloc-devel", + "homebrew": "jemalloc", + }, ) diff --git a/shim/third-party/jvm/BUCK b/shim/third-party/jvm/BUCK index 9de6e20cf2960..09c70401fd2ae 100644 --- a/shim/third-party/jvm/BUCK +++ b/shim/third-party/jvm/BUCK @@ -11,5 +11,7 @@ oncall("open_source") third_party_library( name = "jvm", - homebrew_package_name = "openjdk", + repo_package_names = { + "homebrew": "openjdk", + }, ) diff --git a/shim/third-party/libaio/BUCK b/shim/third-party/libaio/BUCK index 0378186541e0e..f768f172fb2bd 100644 --- a/shim/third-party/libaio/BUCK +++ b/shim/third-party/libaio/BUCK @@ -11,4 +11,9 @@ oncall("open_source") third_party_library( name = "aio", + linker_flags = ["-laio"], + repo_package_names = { + "fedora": "libaio-devel", + "homebrew": "libaio", + }, ) diff --git a/shim/third-party/libdwarf/BUCK b/shim/third-party/libdwarf/BUCK index 93c867f38bce8..68c13b504cf16 100644 --- a/shim/third-party/libdwarf/BUCK +++ b/shim/third-party/libdwarf/BUCK @@ -11,6 +11,9 @@ oncall("open_source") third_party_library( name = "dwarf", - homebrew_package_name = "libdwarf", pkgconfig_name = "libdwarf", + repo_package_names = { + "fedora": "libdwarf-devel", + "homebrew": "libdwarf", + }, ) diff --git a/shim/third-party/libevent/BUCK b/shim/third-party/libevent/BUCK index a196c6e2d096b..6d9b5a5db605a 100644 --- a/shim/third-party/libevent/BUCK +++ b/shim/third-party/libevent/BUCK @@ -12,5 +12,8 @@ oncall("open_source") third_party_library( name = "libevent", pkgconfig_name = "libevent", - ubuntu_package_name = "libevent-dev", + repo_package_names = { + "fedora": "libevent-devel", + "ubuntu": "libevent-dev", + }, ) diff --git a/shim/third-party/libgcc/BUCK b/shim/third-party/libgcc/BUCK index 66aa52840b924..b4ab81b6da531 100644 --- a/shim/third-party/libgcc/BUCK +++ b/shim/third-party/libgcc/BUCK @@ -11,5 +11,7 @@ oncall("open_source") third_party_library( name = "stdc++fs", - homebrew_package_name = "gcc", + repo_package_names = { + "homebrew": "gcc", + }, ) diff --git a/shim/third-party/liboqs/BUCK b/shim/third-party/liboqs/BUCK index c5a3d051ef3c4..e016f16b87a62 100644 --- a/shim/third-party/liboqs/BUCK +++ b/shim/third-party/liboqs/BUCK @@ -11,6 +11,9 @@ oncall("open_source") third_party_library( name = "oqs", - homebrew_package_name = "liboqs", pkgconfig_name = "liboqs", + repo_package_names = { + "fedora": "liboqs-devel", + "homebrew": "liboqs", + }, ) diff --git a/shim/third-party/libsodium/BUCK b/shim/third-party/libsodium/BUCK index 29c6deeab1d9f..91e6fa30ccc18 100644 --- a/shim/third-party/libsodium/BUCK +++ b/shim/third-party/libsodium/BUCK @@ -11,7 +11,10 @@ oncall("open_source") third_party_library( name = "sodium", - homebrew_package_name = "libsodium", pkgconfig_name = "libsodium", - ubuntu_package_name = "libsodium-dev", + repo_package_names = { + "fedora": "libsodium-devel", + "homebrew": "libsodium", + "ubuntu": "libsodium-dev", + }, ) diff --git a/shim/third-party/libunwind/BUCK b/shim/third-party/libunwind/BUCK index f7f8d20672314..100558f76b925 100644 --- a/shim/third-party/libunwind/BUCK +++ b/shim/third-party/libunwind/BUCK @@ -12,5 +12,9 @@ oncall("open_source") third_party_library( name = "unwind", pkgconfig_name = "libunwind", - ubuntu_package_name = "libunwind-dev", + repo_package_names = { + "fedora": "libunwind-devel", + "homebrew": "libunwind", + "ubuntu": "libunwind-dev", + }, ) diff --git a/shim/third-party/liburing/BUCK b/shim/third-party/liburing/BUCK new file mode 100644 index 0000000000000..779f6617e70e8 --- /dev/null +++ b/shim/third-party/liburing/BUCK @@ -0,0 +1,18 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under both the MIT license found in the +# LICENSE-MIT file in the root directory of this source tree and the Apache +# License, Version 2.0 found in the LICENSE-APACHE file in the root directory +# of this source tree. + +load("@shim//third-party:third_party.bzl", "third_party_library") + +oncall("open_source") + +third_party_library( + name = "uring", + pkgconfig_name = "liburing", + repo_package_names = { + "fedora": "liburing-devel", + }, +) diff --git a/shim/third-party/lz4/BUCK b/shim/third-party/lz4/BUCK index 8d321b0b18d2b..075e4242421eb 100644 --- a/shim/third-party/lz4/BUCK +++ b/shim/third-party/lz4/BUCK @@ -12,4 +12,8 @@ oncall("open_source") third_party_library( name = "lz4", pkgconfig_name = "liblz4", + repo_package_names = { + "fedora": "lz4-devel", + "homebrew": "lz4", + }, ) diff --git a/shim/third-party/openssl/BUCK b/shim/third-party/openssl/BUCK index 0bfbbf20c5e5c..a7da902aed040 100644 --- a/shim/third-party/openssl/BUCK +++ b/shim/third-party/openssl/BUCK @@ -11,8 +11,11 @@ oncall("open_source") third_party_library( name = "ssl", - homebrew_package_name = "openssl", pkgconfig_name = "openssl", + repo_package_names = { + "fedora": "openssl-devel", + "homebrew": "openssl", + }, ) alias( diff --git a/shim/third-party/python/BUCK b/shim/third-party/python/BUCK index dfa541bdaf0a4..970b049d69eed 100644 --- a/shim/third-party/python/BUCK +++ b/shim/third-party/python/BUCK @@ -12,6 +12,9 @@ oncall("open_source") third_party_library( name = "python", homebrew_header_path = "Frameworks/Python.framework/Headers", - homebrew_package_name = "python3", pkgconfig_name = "python3", + repo_package_names = { + "fedora": "python3-devel", + "homebrew": "python3", + }, ) diff --git a/shim/third-party/range-v3/BUCK b/shim/third-party/range-v3/BUCK index 62997c6014097..c14f14d2bb83d 100644 --- a/shim/third-party/range-v3/BUCK +++ b/shim/third-party/range-v3/BUCK @@ -9,4 +9,10 @@ load("@shim//third-party:third_party.bzl", "third_party_library") oncall("open_source") -third_party_library(name = "range-v3") +third_party_library( + name = "range-v3", + repo_package_names = { + "fedora": "range-v3-devel", + "homebrew": "range-v3", + }, +) diff --git a/shim/third-party/snappy/BUCK b/shim/third-party/snappy/BUCK index b5bc134c80a50..8273418ac6e15 100644 --- a/shim/third-party/snappy/BUCK +++ b/shim/third-party/snappy/BUCK @@ -9,4 +9,11 @@ load("@shim//third-party:third_party.bzl", "third_party_library") oncall("open_source") -third_party_library(name = "snappy") +third_party_library( + name = "snappy", + pkgconfig_name = "snappy", + repo_package_names = { + "fedora": "snappy-devel", + "homebrew": "snappy", + }, +) diff --git a/shim/third-party/third_party.bzl b/shim/third-party/third_party.bzl index fee56b64a298a..71a6d644eb0ec 100644 --- a/shim/third-party/third_party.bzl +++ b/shim/third-party/third_party.bzl @@ -8,63 +8,86 @@ load("@prelude//third-party:pkgconfig.bzl", "external_pkgconfig_library") load("@shim//build_defs:prebuilt_cpp_library.bzl", "prebuilt_cpp_library") -def homebrew_library( - package_name, - name = None, - default_target_platform = "prelude//platforms:default", +def third_party_library( + name, visibility = ["PUBLIC"], - deps = None, - header_path = None, + deps = [], + pkgconfig_name = None, + repo_package_names = {}, linker_flags = None, - labels = []): - brew_headers = package_name + "__brew_headers" - brew_libs = package_name + "__brew_libs" - if name != None: - brew_headers = name + "__" + brew_headers - brew_libs = name + "__" + brew_libs + homebrew_header_path = None): + # Labels defined here are used to extract third-party libs so they can be installed + labels = [] + for repo, package_name in repo_package_names.items(): + labels.append("third-party:{}:{}".format(repo, package_name)) + + # Prefer pkgconfig + if pkgconfig_name != None: + for repo in repo_package_names.keys(): + labels.append("third-party:{}:pkg-config".format(repo)) + + external_pkgconfig_library( + name = pkgconfig_name, + visibility = visibility if name == pkgconfig_name else [], + labels = labels, + deps = deps, + ) + if name != pkgconfig_name: + native.alias( + name = name, + actual = ":{}".format(pkgconfig_name), + visibility = visibility, + ) + else: + linker_flags = linker_flags or [] + exported_preprocessor_flags = [] + + os = host_info().os + if os.is_macos and "homebrew" in repo_package_names: + # Add brew lookup paths + homebrew_package_name = repo_package_names["homebrew"] + linker_flags += _homebrew_linker_flags( + name = name, + homebrew_package_name = homebrew_package_name, + ) + exported_preprocessor_flags += _homebrew_preprocessor_flags( + name = name, + homebrew_package_name = homebrew_package_name, + homebrew_header_path = homebrew_header_path, + ) + + prebuilt_cpp_library( + name = name, + visibility = visibility, + exported_deps = deps, + exported_preprocessor_flags = exported_preprocessor_flags, + linker_flags = linker_flags, + labels = labels, + ) + +def _homebrew_linker_flags(name, homebrew_package_name): + homebrew_libs = "{}__{}__homebrew_libs".format(name, homebrew_package_name) # @lint-ignore BUCKLINT native.genrule( - name = brew_headers, - default_target_platform = default_target_platform, + name = homebrew_libs, out = "out", - cmd = "echo \"-I`brew --prefix {}`/{}\" > $OUT".format(package_name, header_path or "include"), + cmd = "echo \"-L`brew --prefix {}`/lib\" > $OUT".format(homebrew_package_name), ) + return ["@$(location :{})".format(homebrew_libs)] + +def _homebrew_preprocessor_flags(name, homebrew_package_name, homebrew_header_path): + homebrew_headers = "{}__{}__homebrew_headers".format(name, homebrew_package_name) + # @lint-ignore BUCKLINT native.genrule( - name = brew_libs, - default_target_platform = default_target_platform, + name = homebrew_headers, out = "out", - cmd = "echo \"-L`brew --prefix {}`/lib\" > $OUT".format(package_name), - ) - - linker_flags = linker_flags or [] - linker_flags.append("@$(location :{})".format(brew_libs)) - - prebuilt_cpp_library( - name = name or package_name, - default_target_platform = default_target_platform, - visibility = visibility, - exported_deps = deps, - exported_preprocessor_flags = ["@$(location :{})".format(brew_headers)], - linker_flags = linker_flags, - labels = labels, + cmd = "echo \"-I`brew --prefix {}`/{}\" > $OUT".format( + homebrew_package_name, + homebrew_header_path or "include", + ), ) -def third_party_library(name, visibility = ["PUBLIC"], deps = [], homebrew_package_name = None, ubuntu_package_name = None, pkgconfig_name = None, homebrew_header_path = None, default_target_platform = "prelude//platforms:default", homebrew_linker_flags = None): - # Labels defined here are used to extract third-party libs so they can be installed: - labels = [] - if homebrew_package_name != None: - labels.append("third-party:homebrew:" + homebrew_package_name) - if ubuntu_package_name != None: - labels.append("third-party:ubuntu:" + ubuntu_package_name) - - if pkgconfig_name != None: - labels.append("third-party:homebrew:pkg-config") - labels.append("third-party:ubuntu:pkg-config") - external_pkgconfig_library(name = pkgconfig_name, visibility = visibility if name == pkgconfig_name else [], labels = labels, default_target_platform = default_target_platform, deps = deps) - if name != pkgconfig_name: - native.alias(name = name, actual = ":{}".format(pkgconfig_name), visibility = visibility) - return - homebrew_library(name = name, package_name = homebrew_package_name or name, visibility = visibility, deps = deps, header_path = homebrew_header_path, linker_flags = homebrew_linker_flags, default_target_platform = default_target_platform, labels = labels) + return ["@$(location :{})".format(homebrew_headers)] diff --git a/shim/third-party/xz/BUCK b/shim/third-party/xz/BUCK index 9d9c718426ea6..8f71f3dd36829 100644 --- a/shim/third-party/xz/BUCK +++ b/shim/third-party/xz/BUCK @@ -11,6 +11,9 @@ oncall("open_source") third_party_library( name = "lzma", - homebrew_package_name = "xz", pkgconfig_name = "liblzma", + repo_package_names = { + "fedora": "xz-devel", + "homebrew": "liblzma", + }, ) diff --git a/shim/third-party/zlib/BUCK b/shim/third-party/zlib/BUCK index 7d21a49b1e396..b6f0d9158f96f 100644 --- a/shim/third-party/zlib/BUCK +++ b/shim/third-party/zlib/BUCK @@ -11,6 +11,9 @@ oncall("open_source") third_party_library( name = "z", - homebrew_package_name = "zlib", pkgconfig_name = "zlib", + repo_package_names = { + "fedora": "zlib-devel", + "homebrew": "zlib", + }, ) diff --git a/shim/third-party/zstd/BUCK b/shim/third-party/zstd/BUCK index f92cf85a45daf..2ff3fe2b4d271 100644 --- a/shim/third-party/zstd/BUCK +++ b/shim/third-party/zstd/BUCK @@ -12,4 +12,8 @@ oncall("open_source") third_party_library( name = "zstd", pkgconfig_name = "libzstd", + repo_package_names = { + "fedora": "libzstd-devel", + "homebrew": "zstd", + }, )