Charles Chan | fcfe890 | 2022-02-02 17:06:27 -0800 | [diff] [blame] | 1 | .. SPDX-FileCopyrightText: 2021 Open Networking Foundation <info@opennetworking.org> |
| 2 | .. SPDX-License-Identifier: Apache-2.0 |
| 3 | |
Daniele Moro | ed03356 | 2021-10-04 16:12:31 +0200 | [diff] [blame] | 4 | .. _stratum_chassis_config: |
| 5 | |
Yi Tseng | 22e7dbc | 2021-09-28 14:32:15 -0700 | [diff] [blame] | 6 | Stratum Chassis Configuration |
| 7 | ============================= |
| 8 | |
Carmelo Cascone | 4398998 | 2021-10-12 00:01:19 -0700 | [diff] [blame] | 9 | Chassis config is an internal data structure used by Stratum. The term "chassis" |
| 10 | refers to a switching box with one or more switching nodes (e.g., chips). The |
| 11 | chassis config file is usually placed on disk and loaded when starting Stratum. |
| 12 | This config includes all the not-so-frequent settings that are required before |
| 13 | the switch can accept flow programming requests from the controller. |
| 14 | |
| 15 | In the following, we provide a **non-exhaustive overview of the configurations |
| 16 | relevant to SD-Fabric for Tofino-based devices**. For a complete reference check |
| 17 | out the `ChassisConfig Protobuf message format |
| 18 | <https://github.com/stratum/stratum/blob/main/stratum/hal/lib/common/common.proto#L824-L833>`_ |
| 19 | and the `guide for running Stratum on Tofino-based switches |
| 20 | <https://github.com/stratum/stratum/blob/main/stratum/hal/bin/barefoot/README.run.md>`_ |
| 21 | in the Stratum repository. |
| 22 | |
Yi Tseng | 22e7dbc | 2021-09-28 14:32:15 -0700 | [diff] [blame] | 23 | .. tip:: |
| 24 | |
Carmelo Cascone | 4398998 | 2021-10-12 00:01:19 -0700 | [diff] [blame] | 25 | Check out the `Stratum repository |
| 26 | <https://github.com/stratum/stratum/tree/main/stratum/hal/config>`_ for |
| 27 | examples of chassis config files for different switch platforms. |
Yi Tseng | 22e7dbc | 2021-09-28 14:32:15 -0700 | [diff] [blame] | 28 | |
Carmelo Cascone | 4398998 | 2021-10-12 00:01:19 -0700 | [diff] [blame] | 29 | See the :ref:`deployment_guide` to learn about how to deploy Stratum |
Yi Tseng | 22e7dbc | 2021-09-28 14:32:15 -0700 | [diff] [blame] | 30 | with a custom chassis config. |
| 31 | |
Yi Tseng | 22e7dbc | 2021-09-28 14:32:15 -0700 | [diff] [blame] | 32 | .. note:: |
| 33 | |
Carmelo Cascone | 4398998 | 2021-10-12 00:01:19 -0700 | [diff] [blame] | 34 | In Stratum the external interface for pushing config is gNMI. The protobuf |
| 35 | realization of the YANG models for the config is internally converted to a |
| 36 | chassis config before it is consumed by the internal stack components. Not |
| 37 | all configurations are available through gNMI, for this reason we recommend |
| 38 | using the chassis config file. |
Yi Tseng | 22e7dbc | 2021-09-28 14:32:15 -0700 | [diff] [blame] | 39 | |
Carmelo Cascone | 4398998 | 2021-10-12 00:01:19 -0700 | [diff] [blame] | 40 | The file uses the protobuf text format, check out |
Yi Tseng | 22e7dbc | 2021-09-28 14:32:15 -0700 | [diff] [blame] | 41 | `the protobuf language guide for more info <https://developers.google.com/protocol-buffers/docs/overview?hl=en>`_ |
| 42 | |
| 43 | Chassis |
| 44 | ------- |
Carmelo Cascone | 4398998 | 2021-10-12 00:01:19 -0700 | [diff] [blame] | 45 | A valid chassis config includes a ``chassis``, a ``node`` field, and one |
| 46 | or more ``singleton_port`` fields. |
Yi Tseng | 22e7dbc | 2021-09-28 14:32:15 -0700 | [diff] [blame] | 47 | |
| 48 | A ``chassis`` uniquely identifies a switch with a single management interface. |
| 49 | Each chassis may contain one or more slots (aka linecards), |
| 50 | and one or more switching nodes (aka chips) on each slot. |
| 51 | |
| 52 | A chassis contains the following fields: |
| 53 | |
Carmelo Cascone | 4398998 | 2021-10-12 00:01:19 -0700 | [diff] [blame] | 54 | * ``platform``: The chassis platform, e.g., ``PLT_GENERIC_BAREFOOT_TOFINO`` for |
| 55 | Tofino-based devices (check out `here <https://github.com/stratum/stratum/blob/main/stratum/hal/lib/common/common.proto#L33-L47>`_ for other platforms). **Required** |
Yi Tseng | 22e7dbc | 2021-09-28 14:32:15 -0700 | [diff] [blame] | 56 | * ``name``: An arbitrary name for the chassis. **Optional** |
Carmelo Cascone | 4398998 | 2021-10-12 00:01:19 -0700 | [diff] [blame] | 57 | * ``config_params``: Parameters for the entire chassis, usually empty for Tofino-based devices. **Optional** |
Yi Tseng | 22e7dbc | 2021-09-28 14:32:15 -0700 | [diff] [blame] | 58 | |
| 59 | Node |
| 60 | ---- |
| 61 | |
| 62 | A ``node`` uniquely identifies a single switching node (aka chip) on a chassis linecard |
| 63 | and all its flow-related and config-related parameters. |
| 64 | |
| 65 | A node contains the following fields: |
| 66 | |
Carmelo Cascone | 4398998 | 2021-10-12 00:01:19 -0700 | [diff] [blame] | 67 | * ``id``: An arbitrary ID of the switch node on the chassis (corresponds to the P4Runtime device ID). **Required** |
Yi Tseng | 22e7dbc | 2021-09-28 14:32:15 -0700 | [diff] [blame] | 68 | * ``name``: An arbitrary name for the switching node. **Optional** |
Carmelo Cascone | 4398998 | 2021-10-12 00:01:19 -0700 | [diff] [blame] | 69 | * ``slot``: The 1-base index of the slot (aka linecard) to which this node belongs. **Required** |
| 70 | * ``index``: An optional 1-based index of the node within the chassis. **Optional** |
Yi Tseng | 22e7dbc | 2021-09-28 14:32:15 -0700 | [diff] [blame] | 71 | |
Daniele Moro | ed03356 | 2021-10-04 16:12:31 +0200 | [diff] [blame] | 72 | .. _singleton_port: |
| 73 | |
Yi Tseng | 22e7dbc | 2021-09-28 14:32:15 -0700 | [diff] [blame] | 74 | Singleton Port |
| 75 | -------------- |
| 76 | |
Carmelo Cascone | 4398998 | 2021-10-12 00:01:19 -0700 | [diff] [blame] | 77 | A ``singleton port`` uniquely identifies a switch port and it contains the following fields: |
Yi Tseng | 22e7dbc | 2021-09-28 14:32:15 -0700 | [diff] [blame] | 78 | |
Carmelo Cascone | 4398998 | 2021-10-12 00:01:19 -0700 | [diff] [blame] | 79 | * ``id``: An arbitrary ID, unique in the scope of a chassis. **Required** |
Charles Chan | a937f77 | 2022-02-23 16:24:35 -0800 | [diff] [blame^] | 80 | |
| 81 | .. note:: |
| 82 | We recommend using the following naming convention for both ONOS network config and Stratum chassis config: |
| 83 | - For unchannelized ports, use the **front panel port** number directly. |
| 84 | - For channelized ports, use the **front panel port number * 100 + channel id**. |
| 85 | For example, we can use port id ``2903`` for port ``29/3`` (port 29 channel 3). |
| 86 | - Note that we use **zero-based** channel number for singleton port ``id`` |
| 87 | but the ``channel`` field described below uses **one-based** channel number. |
| 88 | |
Carmelo Cascone | 4398998 | 2021-10-12 00:01:19 -0700 | [diff] [blame] | 89 | * ``name``: An optional user friendly name for the port (e.g., ``10/1`` to identify channel |
| 90 | 1 of front-panel port 10). **Required** |
Yi Tseng | 22e7dbc | 2021-09-28 14:32:15 -0700 | [diff] [blame] | 91 | |
Carmelo Cascone | 4398998 | 2021-10-12 00:01:19 -0700 | [diff] [blame] | 92 | ONOS obtains this name via gNMI and uses it internally to represent ports. |
Yi Tseng | 22e7dbc | 2021-09-28 14:32:15 -0700 | [diff] [blame] | 93 | |
| 94 | * ``slot``: The 1-base index of the slot (aka linecard) of the port. **Required** |
| 95 | * ``port``: The 1-base index of the singleton port on the slot. **Required** |
| 96 | * ``channel``: The 1-base channel index. Absence or zero means non-channelized. **Optional** |
| 97 | * ``speed_bps``: The speed of the port in bps. **Required** |
| 98 | * ``node``: The id of the corresponding node that the port belongs to. **Required** |
Carmelo Cascone | 4398998 | 2021-10-12 00:01:19 -0700 | [diff] [blame] | 99 | * ``config_params``: **Optional** |
Yi Tseng | 22e7dbc | 2021-09-28 14:32:15 -0700 | [diff] [blame] | 100 | |
Carmelo Cascone | 4398998 | 2021-10-12 00:01:19 -0700 | [diff] [blame] | 101 | * ``admin_state``: The initial admin state for this port, disabled by default. |
Yi Tseng | 22e7dbc | 2021-09-28 14:32:15 -0700 | [diff] [blame] | 102 | |
| 103 | * Choose from ``ADMIN_STATE_DISABLED`` or ``ADMIN_STATE_ENABLED``. |
| 104 | |
Yi Tseng | 22e7dbc | 2021-09-28 14:32:15 -0700 | [diff] [blame] | 105 | * ``autoneg``: Whether auto-negotiation is enabled or not for this port. |
| 106 | |
| 107 | * Choose from ``TRI_STATE_FALSE`` or ``TRI_STATE_TRUE`` |
| 108 | * The initial configuration might be different if this field is empty, based on the |
| 109 | platform or the connector you are using. |
| 110 | |
Carmelo Cascone | 4398998 | 2021-10-12 00:01:19 -0700 | [diff] [blame] | 111 | * ``fec_mode``: Forward Error Correction (FEC) mode |
Yi Tseng | 22e7dbc | 2021-09-28 14:32:15 -0700 | [diff] [blame] | 112 | |
| 113 | * Choose from ``FEC_MODE_ON``, ``FEC_MODE_OFF``, or ``FEC_MODE_AUTO`` |
| 114 | |
Yi Tseng | 22e7dbc | 2021-09-28 14:32:15 -0700 | [diff] [blame] | 115 | Example chassis config |
| 116 | ---------------------- |
| 117 | |
Carmelo Cascone | 4398998 | 2021-10-12 00:01:19 -0700 | [diff] [blame] | 118 | In this example, we want to set up a **Tofino-based switch** with only one node, one slot, |
| 119 | and two ports: |
Yi Tseng | 22e7dbc | 2021-09-28 14:32:15 -0700 | [diff] [blame] | 120 | |
Carmelo Cascone | 4398998 | 2021-10-12 00:01:19 -0700 | [diff] [blame] | 121 | * Port 1: 100G port without channelization, enabled by default, without auto-negotiation. |
| 122 | * Port 2: break out port with four 10G channels, enabled by default, with auto-negotiation. |
Yi Tseng | 22e7dbc | 2021-09-28 14:32:15 -0700 | [diff] [blame] | 123 | |
| 124 | .. image:: ../images/chassis-config-example.svg |
| 125 | :width: 500px |
| 126 | |
Yi Tseng | 22e7dbc | 2021-09-28 14:32:15 -0700 | [diff] [blame] | 127 | .. code-block:: |
| 128 | |
| 129 | description: "A chassis config example." |
| 130 | chassis { |
| 131 | platform: PLT_GENERIC_BAREFOOT_TOFINO |
| 132 | name: "leaf-1" |
| 133 | } |
| 134 | nodes { |
| 135 | id: 1 |
| 136 | slot: 1 |
| 137 | index: 1 |
| 138 | } |
| 139 | singleton_ports { |
| 140 | id: 1 |
| 141 | name: "1/0" |
| 142 | slot: 1 |
| 143 | port: 1 |
| 144 | speed_bps: 100000000000 # 100G |
| 145 | config_params { |
| 146 | admin_state: ADMIN_STATE_ENABLED |
| 147 | autoneg: TRI_STATE_FALSE |
| 148 | } |
| 149 | node: 1 |
| 150 | } |
| 151 | singleton_ports { |
| 152 | id: 200 |
| 153 | name: "2/0" |
| 154 | slot: 1 |
| 155 | port: 2 |
| 156 | channel: 1 |
| 157 | speed_bps: 10000000000 # 10G |
| 158 | config_params { |
| 159 | admin_state: ADMIN_STATE_ENABLED |
| 160 | autoneg: TRI_STATE_TRUE |
| 161 | } |
| 162 | node: 1 |
| 163 | } |
| 164 | singleton_ports { |
| 165 | id: 201 |
| 166 | name: "2/1" |
| 167 | slot: 1 |
| 168 | port: 2 |
| 169 | channel: 2 |
| 170 | speed_bps: 10000000000 # 10G |
| 171 | config_params { |
| 172 | admin_state: ADMIN_STATE_ENABLED |
| 173 | autoneg: TRI_STATE_TRUE |
| 174 | } |
| 175 | node: 1 |
| 176 | } |
| 177 | singleton_ports { |
| 178 | id: 202 |
| 179 | name: "2/2" |
| 180 | slot: 1 |
| 181 | port: 2 |
| 182 | channel: 3 |
| 183 | speed_bps: 10000000000 # 10G |
| 184 | config_params { |
| 185 | admin_state: ADMIN_STATE_ENABLED |
| 186 | autoneg: TRI_STATE_TRUE |
| 187 | } |
| 188 | node: 1 |
| 189 | } |
| 190 | singleton_ports { |
| 191 | id: 203 |
| 192 | name: "2/3" |
| 193 | slot: 1 |
| 194 | port: 2 |
| 195 | channel: 4 |
| 196 | speed_bps: 10000000000 # 10G |
| 197 | config_params { |
| 198 | admin_state: ADMIN_STATE_ENABLED |
| 199 | autoneg: TRI_STATE_TRUE |
| 200 | } |
| 201 | node: 1 |
| 202 | } |