$ show meta/fboss
This repository implements the Facebook Open Switching System (FBOSS), a production network switch operating system used in Meta's data centers. The codebase controls and manages network switches by running a software agent on each switch that programs hardware forwarding ASICs, implements control-plane protocols (ARP, NDP, LLDP, LACP), and provides Thrift-based APIs for external routing controllers. It encompasses a distributed architecture with multiple daemons: the core agent (SwSwitch, HwSwitch), a state database (FSDB) that publishes/subscribes to operational state and stats, a CLI (fboss2) with a trait-driven command framework, platform services (fan, sensor, LED, QSFP transceiver management, firmware updates), and extensive hardware abstraction layers for Broadcom BCM and SAI-based ASICs. A significant portion of the codebase supports multiple switch platforms (Wedge, Minipack, Meru, Janga, etc.) with platform-specific mappings, LED managers, and test harnesses. The open-source release includes OSS stubs for internal Meta features, SDK version conditionals, and a build system based on getdeps.py/FB code builder.
The LLM identified 5 files worth highlighting for reuse:
Provides a CRTP-based command handler pattern (CmdHandler<Cmd, Traits>) with explicit queryClient/printOutput methods, argument type traits, parent command nesting, and sample model generation. This pattern is self-contained and could be extracted to build a consistent CLI interface for any Thrift-driven service with minimal modification.
Implements a double-buffered, terminate-safe asynchronous logger that flushes in a dedicated thread. It batches log messages to reduce I/O overhead and installs a custom terminate handler for crash resilience. The interface is generic and reusable across any server-side application requiring high-performance, non-blocking logging.
Wraps the tabulate library to provide a styled table renderer with customizable column alignment, headers, and cell styles. It includes helper methods for generating border styles and row formatting. This component is independent of FBOSS internals and can be reused in any CLI tool that needs formatted tabular output.
Encapsulates a diagnostic workflow that connects to a switch (locally or via SSH/BMC), retrieves platform and firmware information, and verifies expected hardware status. Uses a ConnectOptions pattern for flexible transport selection and includes retry logic with password handling. This is a standalone utility that could be adapted for remote device health checks in other network management tools.
Provides a generic wrapper for retrieving SAI object keys (oids) from switch attributes, supporting different key types via template specialization. It demonstrates a clean abstraction over vendor-specific SDK calls and uses compile-time dispatch for object type identification. This pattern is reusable for any SAI-based hardware abstraction layer where object key retrieval is needed.